mbox_defs.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. /*
  2. *
  3. * Linux MegaRAID Unified device driver
  4. *
  5. * Copyright (c) 2003-2004 LSI Logic Corporation.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. *
  12. * FILE : mbox_defs.h
  13. *
  14. */
  15. #ifndef _MRAID_MBOX_DEFS_H_
  16. #define _MRAID_MBOX_DEFS_H_
  17. #include <linux/types.h>
  18. /*
  19. * Commands and states for mailbox based controllers
  20. */
  21. #define MBOXCMD_LREAD 0x01
  22. #define MBOXCMD_LWRITE 0x02
  23. #define MBOXCMD_PASSTHRU 0x03
  24. #define MBOXCMD_ADPEXTINQ 0x04
  25. #define MBOXCMD_ADAPTERINQ 0x05
  26. #define MBOXCMD_LREAD64 0xA7
  27. #define MBOXCMD_LWRITE64 0xA8
  28. #define MBOXCMD_PASSTHRU64 0xC3
  29. #define MBOXCMD_EXTPTHRU 0xE3
  30. #define MAIN_MISC_OPCODE 0xA4
  31. #define GET_MAX_SG_SUPPORT 0x01
  32. #define SUPPORT_EXT_CDB 0x16
  33. #define FC_NEW_CONFIG 0xA1
  34. #define NC_SUBOP_PRODUCT_INFO 0x0E
  35. #define NC_SUBOP_ENQUIRY3 0x0F
  36. #define ENQ3_GET_SOLICITED_FULL 0x02
  37. #define OP_DCMD_READ_CONFIG 0x04
  38. #define NEW_READ_CONFIG_8LD 0x67
  39. #define READ_CONFIG_8LD 0x07
  40. #define FLUSH_ADAPTER 0x0A
  41. #define FLUSH_SYSTEM 0xFE
  42. /*
  43. * Command for random deletion of logical drives
  44. */
  45. #define FC_DEL_LOGDRV 0xA4
  46. #define OP_SUP_DEL_LOGDRV 0x2A
  47. #define OP_GET_LDID_MAP 0x18
  48. #define OP_DEL_LOGDRV 0x1C
  49. /*
  50. * BIOS commands
  51. */
  52. #define IS_BIOS_ENABLED 0x62
  53. #define GET_BIOS 0x01
  54. #define CHNL_CLASS 0xA9
  55. #define GET_CHNL_CLASS 0x00
  56. #define SET_CHNL_CLASS 0x01
  57. #define CH_RAID 0x01
  58. #define CH_SCSI 0x00
  59. #define BIOS_PVT_DATA 0x40
  60. #define GET_BIOS_PVT_DATA 0x00
  61. /*
  62. * Commands to support clustering
  63. */
  64. #define GET_TARGET_ID 0x7D
  65. #define CLUSTER_OP 0x70
  66. #define GET_CLUSTER_MODE 0x02
  67. #define CLUSTER_CMD 0x6E
  68. #define RESERVE_LD 0x01
  69. #define RELEASE_LD 0x02
  70. #define RESET_RESERVATIONS 0x03
  71. #define RESERVATION_STATUS 0x04
  72. #define RESERVE_PD 0x05
  73. #define RELEASE_PD 0x06
  74. /*
  75. * Module battery status
  76. */
  77. #define BATTERY_MODULE_MISSING 0x01
  78. #define BATTERY_LOW_VOLTAGE 0x02
  79. #define BATTERY_TEMP_HIGH 0x04
  80. #define BATTERY_PACK_MISSING 0x08
  81. #define BATTERY_CHARGE_MASK 0x30
  82. #define BATTERY_CHARGE_DONE 0x00
  83. #define BATTERY_CHARGE_INPROG 0x10
  84. #define BATTERY_CHARGE_FAIL 0x20
  85. #define BATTERY_CYCLES_EXCEEDED 0x40
  86. /*
  87. * Physical drive states.
  88. */
  89. #define PDRV_UNCNF 0
  90. #define PDRV_ONLINE 3
  91. #define PDRV_FAILED 4
  92. #define PDRV_RBLD 5
  93. #define PDRV_HOTSPARE 6
  94. /*
  95. * Raid logical drive states.
  96. */
  97. #define RDRV_OFFLINE 0
  98. #define RDRV_DEGRADED 1
  99. #define RDRV_OPTIMAL 2
  100. #define RDRV_DELETED 3
  101. /*
  102. * Read, write and cache policies
  103. */
  104. #define NO_READ_AHEAD 0
  105. #define READ_AHEAD 1
  106. #define ADAP_READ_AHEAD 2
  107. #define WRMODE_WRITE_THRU 0
  108. #define WRMODE_WRITE_BACK 1
  109. #define CACHED_IO 0
  110. #define DIRECT_IO 1
  111. #define MAX_LOGICAL_DRIVES_8LD 8
  112. #define MAX_LOGICAL_DRIVES_40LD 40
  113. #define FC_MAX_PHYSICAL_DEVICES 256
  114. #define MAX_MBOX_CHANNELS 5
  115. #define MAX_MBOX_TARGET 15
  116. #define MBOX_MAX_PHYSICAL_DRIVES MAX_MBOX_CHANNELS*MAX_MBOX_TARGET
  117. #define MAX_ROW_SIZE_40LD 32
  118. #define MAX_ROW_SIZE_8LD 8
  119. #define SPAN_DEPTH_8_SPANS 8
  120. #define SPAN_DEPTH_4_SPANS 4
  121. #define MAX_REQ_SENSE_LEN 0x20
  122. /**
  123. * struct mbox_t - Driver and f/w handshake structure.
  124. * @cmd : firmware command
  125. * @cmdid : command id
  126. * @numsectors : number of sectors to be transferred
  127. * @lba : Logical Block Address on LD
  128. * @xferaddr : DMA address for data transfer
  129. * @logdrv : logical drive number
  130. * @numsge : number of scatter gather elements in sg list
  131. * @resvd : reserved
  132. * @busy : f/w busy, must wait to issue more commands.
  133. * @numstatus : number of commands completed.
  134. * @status : status of the commands completed
  135. * @completed : array of completed command ids.
  136. * @poll : poll and ack sequence
  137. * @ack : poll and ack sequence
  138. *
  139. * The central handshake structure between the driver and the firmware. This
  140. * structure must be allocated by the driver and aligned at 8-byte boundary.
  141. */
  142. #define MBOX_MAX_FIRMWARE_STATUS 46
  143. typedef struct {
  144. uint8_t cmd;
  145. uint8_t cmdid;
  146. uint16_t numsectors;
  147. uint32_t lba;
  148. uint32_t xferaddr;
  149. uint8_t logdrv;
  150. uint8_t numsge;
  151. uint8_t resvd;
  152. uint8_t busy;
  153. uint8_t numstatus;
  154. uint8_t status;
  155. uint8_t completed[MBOX_MAX_FIRMWARE_STATUS];
  156. uint8_t poll;
  157. uint8_t ack;
  158. } __attribute__ ((packed)) mbox_t;
  159. /**
  160. * mbox64_t - 64-bit extension for the mailbox
  161. * @segment_lo : the low 32-bits of the address of the scatter-gather list
  162. * @segment_hi : the upper 32-bits of the address of the scatter-gather list
  163. * @mbox : 32-bit mailbox, whose xferadder field must be set to
  164. * 0xFFFFFFFF
  165. *
  166. * This is the extension of the 32-bit mailbox to be able to perform DMA
  167. * beyond 4GB address range.
  168. */
  169. typedef struct {
  170. uint32_t xferaddr_lo;
  171. uint32_t xferaddr_hi;
  172. mbox_t mbox32;
  173. } __attribute__ ((packed)) mbox64_t;
  174. /*
  175. * mailbox structure used for internal commands
  176. */
  177. typedef struct {
  178. u8 cmd;
  179. u8 cmdid;
  180. u8 opcode;
  181. u8 subopcode;
  182. u32 lba;
  183. u32 xferaddr;
  184. u8 logdrv;
  185. u8 rsvd[3];
  186. u8 numstatus;
  187. u8 status;
  188. } __attribute__ ((packed)) int_mbox_t;
  189. /**
  190. * mraid_passthru_t - passthru structure to issue commands to physical devices
  191. * @timeout : command timeout, 0=6sec, 1=60sec, 2=10min, 3=3hr
  192. * @ars : set if ARS required after check condition
  193. * @islogical : set if command meant for logical devices
  194. * @logdrv : logical drive number if command for LD
  195. * @channel : Channel on which physical device is located
  196. * @target : SCSI target of the device
  197. * @queuetag : unused
  198. * @queueaction : unused
  199. * @cdb : SCSI CDB
  200. * @cdblen : length of the CDB
  201. * @reqsenselen : amount of request sense data to be returned
  202. * @reqsensearea : Sense information buffer
  203. * @numsge : number of scatter-gather elements in the sg list
  204. * @scsistatus : SCSI status of the command completed.
  205. * @dataxferaddr : DMA data transfer address
  206. * @dataxferlen : amount of the data to be transferred.
  207. */
  208. typedef struct {
  209. uint8_t timeout :3;
  210. uint8_t ars :1;
  211. uint8_t reserved :3;
  212. uint8_t islogical :1;
  213. uint8_t logdrv;
  214. uint8_t channel;
  215. uint8_t target;
  216. uint8_t queuetag;
  217. uint8_t queueaction;
  218. uint8_t cdb[10];
  219. uint8_t cdblen;
  220. uint8_t reqsenselen;
  221. uint8_t reqsensearea[MAX_REQ_SENSE_LEN];
  222. uint8_t numsge;
  223. uint8_t scsistatus;
  224. uint32_t dataxferaddr;
  225. uint32_t dataxferlen;
  226. } __attribute__ ((packed)) mraid_passthru_t;
  227. typedef struct {
  228. uint32_t dataxferaddr_lo;
  229. uint32_t dataxferaddr_hi;
  230. mraid_passthru_t pthru32;
  231. } __attribute__ ((packed)) mega_passthru64_t;
  232. /**
  233. * mraid_epassthru_t - passthru structure to issue commands to physical devices
  234. * @timeout : command timeout, 0=6sec, 1=60sec, 2=10min, 3=3hr
  235. * @ars : set if ARS required after check condition
  236. * @rsvd1 : reserved field
  237. * @cd_rom : (?)
  238. * @rsvd2 : reserved field
  239. * @islogical : set if command meant for logical devices
  240. * @logdrv : logical drive number if command for LD
  241. * @channel : Channel on which physical device is located
  242. * @target : SCSI target of the device
  243. * @queuetag : unused
  244. * @queueaction : unused
  245. * @cdblen : length of the CDB
  246. * @rsvd3 : reserved field
  247. * @cdb : SCSI CDB
  248. * @numsge : number of scatter-gather elements in the sg list
  249. * @status : SCSI status of the command completed.
  250. * @reqsenselen : amount of request sense data to be returned
  251. * @reqsensearea : Sense information buffer
  252. * @rsvd4 : reserved field
  253. * @dataxferaddr : DMA data transfer address
  254. * @dataxferlen : amount of the data to be transferred.
  255. */
  256. typedef struct {
  257. uint8_t timeout :3;
  258. uint8_t ars :1;
  259. uint8_t rsvd1 :1;
  260. uint8_t cd_rom :1;
  261. uint8_t rsvd2 :1;
  262. uint8_t islogical :1;
  263. uint8_t logdrv;
  264. uint8_t channel;
  265. uint8_t target;
  266. uint8_t queuetag;
  267. uint8_t queueaction;
  268. uint8_t cdblen;
  269. uint8_t rsvd3;
  270. uint8_t cdb[16];
  271. uint8_t numsge;
  272. uint8_t status;
  273. uint8_t reqsenselen;
  274. uint8_t reqsensearea[MAX_REQ_SENSE_LEN];
  275. uint8_t rsvd4;
  276. uint32_t dataxferaddr;
  277. uint32_t dataxferlen;
  278. } __attribute__ ((packed)) mraid_epassthru_t;
  279. /**
  280. * mraid_pinfo_t - product info, static information about the controller
  281. * @data_size : current size in bytes (not including resvd)
  282. * @config_signature : Current value is 0x00282008
  283. * @fw_version : Firmware version
  284. * @bios_version : version of the BIOS
  285. * @product_name : Name given to the controller
  286. * @max_commands : Maximum concurrent commands supported
  287. * @nchannels : Number of SCSI Channels detected
  288. * @fc_loop_present : Number of Fibre Loops detected
  289. * @mem_type : EDO, FPM, SDRAM etc
  290. * @signature :
  291. * @dram_size : In terms of MB
  292. * @subsysid : device PCI subsystem ID
  293. * @subsysvid : device PCI subsystem vendor ID
  294. * @notify_counters :
  295. * @pad1k : 135 + 889 resvd = 1024 total size
  296. *
  297. * This structures holds the information about the controller which is not
  298. * expected to change dynamically.
  299. *
  300. * The current value of config signature is 0x00282008:
  301. * 0x28 = MAX_LOGICAL_DRIVES,
  302. * 0x20 = Number of stripes and
  303. * 0x08 = Number of spans
  304. */
  305. typedef struct {
  306. uint32_t data_size;
  307. uint32_t config_signature;
  308. uint8_t fw_version[16];
  309. uint8_t bios_version[16];
  310. uint8_t product_name[80];
  311. uint8_t max_commands;
  312. uint8_t nchannels;
  313. uint8_t fc_loop_present;
  314. uint8_t mem_type;
  315. uint32_t signature;
  316. uint16_t dram_size;
  317. uint16_t subsysid;
  318. uint16_t subsysvid;
  319. uint8_t notify_counters;
  320. uint8_t pad1k[889];
  321. } __attribute__ ((packed)) mraid_pinfo_t;
  322. /**
  323. * mraid_notify_t - the notification structure
  324. * @global_counter : Any change increments this counter
  325. * @param_counter : Indicates any params changed
  326. * @param_id : Param modified - defined below
  327. * @param_val : New val of last param modified
  328. * @write_config_counter : write config occurred
  329. * @write_config_rsvd :
  330. * @ldrv_op_counter : Indicates ldrv op started/completed
  331. * @ldrv_opid : ldrv num
  332. * @ldrv_opcmd : ldrv operation - defined below
  333. * @ldrv_opstatus : status of the operation
  334. * @ldrv_state_counter : Indicates change of ldrv state
  335. * @ldrv_state_id : ldrv num
  336. * @ldrv_state_new : New state
  337. * @ldrv_state_old : old state
  338. * @pdrv_state_counter : Indicates change of ldrv state
  339. * @pdrv_state_id : pdrv id
  340. * @pdrv_state_new : New state
  341. * @pdrv_state_old : old state
  342. * @pdrv_fmt_counter : Indicates pdrv format started/over
  343. * @pdrv_fmt_id : pdrv id
  344. * @pdrv_fmt_val : format started/over
  345. * @pdrv_fmt_rsvd :
  346. * @targ_xfer_counter : Indicates SCSI-2 Xfer rate change
  347. * @targ_xfer_id : pdrv Id
  348. * @targ_xfer_val : new Xfer params of last pdrv
  349. * @targ_xfer_rsvd :
  350. * @fcloop_id_chg_counter : Indicates loopid changed
  351. * @fcloopid_pdrvid : pdrv id
  352. * @fcloop_id0 : loopid on fc loop 0
  353. * @fcloop_id1 : loopid on fc loop 1
  354. * @fcloop_state_counter : Indicates loop state changed
  355. * @fcloop_state0 : state of fc loop 0
  356. * @fcloop_state1 : state of fc loop 1
  357. * @fcloop_state_rsvd :
  358. */
  359. typedef struct {
  360. uint32_t global_counter;
  361. uint8_t param_counter;
  362. uint8_t param_id;
  363. uint16_t param_val;
  364. uint8_t write_config_counter;
  365. uint8_t write_config_rsvd[3];
  366. uint8_t ldrv_op_counter;
  367. uint8_t ldrv_opid;
  368. uint8_t ldrv_opcmd;
  369. uint8_t ldrv_opstatus;
  370. uint8_t ldrv_state_counter;
  371. uint8_t ldrv_state_id;
  372. uint8_t ldrv_state_new;
  373. uint8_t ldrv_state_old;
  374. uint8_t pdrv_state_counter;
  375. uint8_t pdrv_state_id;
  376. uint8_t pdrv_state_new;
  377. uint8_t pdrv_state_old;
  378. uint8_t pdrv_fmt_counter;
  379. uint8_t pdrv_fmt_id;
  380. uint8_t pdrv_fmt_val;
  381. uint8_t pdrv_fmt_rsvd;
  382. uint8_t targ_xfer_counter;
  383. uint8_t targ_xfer_id;
  384. uint8_t targ_xfer_val;
  385. uint8_t targ_xfer_rsvd;
  386. uint8_t fcloop_id_chg_counter;
  387. uint8_t fcloopid_pdrvid;
  388. uint8_t fcloop_id0;
  389. uint8_t fcloop_id1;
  390. uint8_t fcloop_state_counter;
  391. uint8_t fcloop_state0;
  392. uint8_t fcloop_state1;
  393. uint8_t fcloop_state_rsvd;
  394. } __attribute__ ((packed)) mraid_notify_t;
  395. /**
  396. * mraid_inquiry3_t - enquiry for device information
  397. *
  398. * @data_size : current size in bytes (not including resvd)
  399. * @notify :
  400. * @notify_rsvd :
  401. * @rebuild_rate : rebuild rate (0% - 100%)
  402. * @cache_flush_int : cache flush interval in seconds
  403. * @sense_alert :
  404. * @drive_insert_count : drive insertion count
  405. * @battery_status :
  406. * @num_ldrv : no. of Log Drives configured
  407. * @recon_state : state of reconstruct
  408. * @ldrv_op_status : logdrv Status
  409. * @ldrv_size : size of each log drv
  410. * @ldrv_prop :
  411. * @ldrv_state : state of log drives
  412. * @pdrv_state : state of phys drvs.
  413. * @pdrv_format :
  414. * @targ_xfer : phys device transfer rate
  415. * @pad1k : 761 + 263reserved = 1024 bytes total size
  416. */
  417. #define MAX_NOTIFY_SIZE 0x80
  418. #define CUR_NOTIFY_SIZE sizeof(mraid_notify_t)
  419. typedef struct {
  420. uint32_t data_size;
  421. mraid_notify_t notify;
  422. uint8_t notify_rsvd[MAX_NOTIFY_SIZE - CUR_NOTIFY_SIZE];
  423. uint8_t rebuild_rate;
  424. uint8_t cache_flush_int;
  425. uint8_t sense_alert;
  426. uint8_t drive_insert_count;
  427. uint8_t battery_status;
  428. uint8_t num_ldrv;
  429. uint8_t recon_state[MAX_LOGICAL_DRIVES_40LD / 8];
  430. uint16_t ldrv_op_status[MAX_LOGICAL_DRIVES_40LD / 8];
  431. uint32_t ldrv_size[MAX_LOGICAL_DRIVES_40LD];
  432. uint8_t ldrv_prop[MAX_LOGICAL_DRIVES_40LD];
  433. uint8_t ldrv_state[MAX_LOGICAL_DRIVES_40LD];
  434. uint8_t pdrv_state[FC_MAX_PHYSICAL_DEVICES];
  435. uint16_t pdrv_format[FC_MAX_PHYSICAL_DEVICES / 16];
  436. uint8_t targ_xfer[80];
  437. uint8_t pad1k[263];
  438. } __attribute__ ((packed)) mraid_inquiry3_t;
  439. /**
  440. * mraid_adapinfo_t - information about the adapter
  441. * @max_commands : max concurrent commands supported
  442. * @rebuild_rate : rebuild rate - 0% thru 100%
  443. * @max_targ_per_chan : max targ per channel
  444. * @nchannels : number of channels on HBA
  445. * @fw_version : firmware version
  446. * @age_of_flash : number of times FW has been flashed
  447. * @chip_set_value : contents of 0xC0000832
  448. * @dram_size : in MB
  449. * @cache_flush_interval : in seconds
  450. * @bios_version :
  451. * @board_type :
  452. * @sense_alert :
  453. * @write_config_count : increase with every configuration change
  454. * @drive_inserted_count : increase with every drive inserted
  455. * @inserted_drive : channel:Id of inserted drive
  456. * @battery_status : bit 0: battery module missing
  457. * bit 1: VBAD
  458. * bit 2: temperature high
  459. * bit 3: battery pack missing
  460. * bit 4,5:
  461. * 00 - charge complete
  462. * 01 - fast charge in progress
  463. * 10 - fast charge fail
  464. * 11 - undefined
  465. * bit 6: counter > 1000
  466. * bit 7: Undefined
  467. * @dec_fault_bus_info :
  468. */
  469. typedef struct {
  470. uint8_t max_commands;
  471. uint8_t rebuild_rate;
  472. uint8_t max_targ_per_chan;
  473. uint8_t nchannels;
  474. uint8_t fw_version[4];
  475. uint16_t age_of_flash;
  476. uint8_t chip_set_value;
  477. uint8_t dram_size;
  478. uint8_t cache_flush_interval;
  479. uint8_t bios_version[4];
  480. uint8_t board_type;
  481. uint8_t sense_alert;
  482. uint8_t write_config_count;
  483. uint8_t battery_status;
  484. uint8_t dec_fault_bus_info;
  485. } __attribute__ ((packed)) mraid_adapinfo_t;
  486. /**
  487. * mraid_ldrv_info_t - information about the logical drives
  488. * @nldrv : Number of logical drives configured
  489. * @rsvd :
  490. * @size : size of each logical drive
  491. * @prop :
  492. * @state : state of each logical drive
  493. */
  494. typedef struct {
  495. uint8_t nldrv;
  496. uint8_t rsvd[3];
  497. uint32_t size[MAX_LOGICAL_DRIVES_8LD];
  498. uint8_t prop[MAX_LOGICAL_DRIVES_8LD];
  499. uint8_t state[MAX_LOGICAL_DRIVES_8LD];
  500. } __attribute__ ((packed)) mraid_ldrv_info_t;
  501. /**
  502. * mraid_pdrv_info_t - information about the physical drives
  503. * @pdrv_state : state of each physical drive
  504. */
  505. typedef struct {
  506. uint8_t pdrv_state[MBOX_MAX_PHYSICAL_DRIVES];
  507. uint8_t rsvd;
  508. } __attribute__ ((packed)) mraid_pdrv_info_t;
  509. /**
  510. * mraid_inquiry_t - RAID inquiry, mailbox command 0x05
  511. * @mraid_adapinfo_t : adapter information
  512. * @mraid_ldrv_info_t : logical drives information
  513. * @mraid_pdrv_info_t : physical drives information
  514. */
  515. typedef struct {
  516. mraid_adapinfo_t adapter_info;
  517. mraid_ldrv_info_t logdrv_info;
  518. mraid_pdrv_info_t pdrv_info;
  519. } __attribute__ ((packed)) mraid_inquiry_t;
  520. /**
  521. * mraid_extinq_t - RAID extended inquiry, mailbox command 0x04
  522. *
  523. * @raid_inq : raid inquiry
  524. * @phys_drv_format :
  525. * @stack_attn :
  526. * @modem_status :
  527. * @rsvd :
  528. */
  529. typedef struct {
  530. mraid_inquiry_t raid_inq;
  531. uint16_t phys_drv_format[MAX_MBOX_CHANNELS];
  532. uint8_t stack_attn;
  533. uint8_t modem_status;
  534. uint8_t rsvd[2];
  535. } __attribute__ ((packed)) mraid_extinq_t;
  536. /**
  537. * adap_device_t - device information
  538. * @channel : channel fpor the device
  539. * @target : target ID of the device
  540. */
  541. typedef struct {
  542. uint8_t channel;
  543. uint8_t target;
  544. }__attribute__ ((packed)) adap_device_t;
  545. /**
  546. * adap_span_40ld_t - 40LD span
  547. * @start_blk : starting block
  548. * @num_blks : number of blocks
  549. */
  550. typedef struct {
  551. uint32_t start_blk;
  552. uint32_t num_blks;
  553. adap_device_t device[MAX_ROW_SIZE_40LD];
  554. }__attribute__ ((packed)) adap_span_40ld_t;
  555. /**
  556. * adap_span_8ld_t - 8LD span
  557. * @start_blk : starting block
  558. * @num_blks : number of blocks
  559. */
  560. typedef struct {
  561. uint32_t start_blk;
  562. uint32_t num_blks;
  563. adap_device_t device[MAX_ROW_SIZE_8LD];
  564. }__attribute__ ((packed)) adap_span_8ld_t;
  565. /**
  566. * logdrv_param_t - logical drives parameters
  567. *
  568. * @span_depth : total number of spans
  569. * @level : RAID level
  570. * @read_ahead : read ahead, no read ahead, adaptive read ahead
  571. * @stripe_sz : encoded stripe size
  572. * @status : status of the logical drive
  573. * @write_mode : write mode, write_through/write_back
  574. * @direct_io : direct io or through cache
  575. * @row_size : number of stripes in a row
  576. */
  577. typedef struct {
  578. uint8_t span_depth;
  579. uint8_t level;
  580. uint8_t read_ahead;
  581. uint8_t stripe_sz;
  582. uint8_t status;
  583. uint8_t write_mode;
  584. uint8_t direct_io;
  585. uint8_t row_size;
  586. } __attribute__ ((packed)) logdrv_param_t;
  587. /**
  588. * logdrv_40ld_t - logical drive definition for 40LD controllers
  589. * @lparam : logical drives parameters
  590. * @span : span
  591. */
  592. typedef struct {
  593. logdrv_param_t lparam;
  594. adap_span_40ld_t span[SPAN_DEPTH_8_SPANS];
  595. }__attribute__ ((packed)) logdrv_40ld_t;
  596. /**
  597. * logdrv_8ld_span8_t - logical drive definition for 8LD controllers
  598. * @lparam : logical drives parameters
  599. * @span : span
  600. *
  601. * 8-LD logical drive with up to 8 spans
  602. */
  603. typedef struct {
  604. logdrv_param_t lparam;
  605. adap_span_8ld_t span[SPAN_DEPTH_8_SPANS];
  606. }__attribute__ ((packed)) logdrv_8ld_span8_t;
  607. /**
  608. * logdrv_8ld_span4_t - logical drive definition for 8LD controllers
  609. * @lparam : logical drives parameters
  610. * @span : span
  611. *
  612. * 8-LD logical drive with up to 4 spans
  613. */
  614. typedef struct {
  615. logdrv_param_t lparam;
  616. adap_span_8ld_t span[SPAN_DEPTH_4_SPANS];
  617. }__attribute__ ((packed)) logdrv_8ld_span4_t;
  618. /**
  619. * phys_drive_t - physical device information
  620. * @type : Type of the device
  621. * @cur_status : current status of the device
  622. * @tag_depth : Level of tagging
  623. * @sync_neg : sync negotiation - ENABLE or DISABLE
  624. * @size : configurable size in terms of 512 byte
  625. */
  626. typedef struct {
  627. uint8_t type;
  628. uint8_t cur_status;
  629. uint8_t tag_depth;
  630. uint8_t sync_neg;
  631. uint32_t size;
  632. }__attribute__ ((packed)) phys_drive_t;
  633. /**
  634. * disk_array_40ld_t - disk array for 40LD controllers
  635. * @numldrv : number of logical drives
  636. * @resvd :
  637. * @ldrv : logical drives information
  638. * @pdrv : physical drives information
  639. */
  640. typedef struct {
  641. uint8_t numldrv;
  642. uint8_t resvd[3];
  643. logdrv_40ld_t ldrv[MAX_LOGICAL_DRIVES_40LD];
  644. phys_drive_t pdrv[MBOX_MAX_PHYSICAL_DRIVES];
  645. }__attribute__ ((packed)) disk_array_40ld_t;
  646. /**
  647. * disk_array_8ld_span8_t - disk array for 8LD controllers
  648. * @numldrv : number of logical drives
  649. * @resvd :
  650. * @ldrv : logical drives information
  651. * @pdrv : physical drives information
  652. *
  653. * Disk array for 8LD logical drives with up to 8 spans
  654. */
  655. typedef struct {
  656. uint8_t numldrv;
  657. uint8_t resvd[3];
  658. logdrv_8ld_span8_t ldrv[MAX_LOGICAL_DRIVES_8LD];
  659. phys_drive_t pdrv[MBOX_MAX_PHYSICAL_DRIVES];
  660. }__attribute__ ((packed)) disk_array_8ld_span8_t;
  661. /**
  662. * disk_array_8ld_span4_t - disk array for 8LD controllers
  663. * @numldrv : number of logical drives
  664. * @resvd :
  665. * @ldrv : logical drives information
  666. * @pdrv : physical drives information
  667. *
  668. * Disk array for 8LD logical drives with up to 4 spans
  669. */
  670. typedef struct {
  671. uint8_t numldrv;
  672. uint8_t resvd[3];
  673. logdrv_8ld_span4_t ldrv[MAX_LOGICAL_DRIVES_8LD];
  674. phys_drive_t pdrv[MBOX_MAX_PHYSICAL_DRIVES];
  675. }__attribute__ ((packed)) disk_array_8ld_span4_t;
  676. /**
  677. * struct private_bios_data - bios private data for boot devices
  678. * @geometry : bits 0-3 - BIOS geometry, 0x0001 - 1GB, 0x0010 - 2GB,
  679. * 0x1000 - 8GB, Others values are invalid
  680. * @unused : bits 4-7 are unused
  681. * @boot_drv : logical drive set as boot drive, 0..7 - for 8LD cards,
  682. * 0..39 - for 40LD cards
  683. * @cksum : 0-(sum of first 13 bytes of this structure)
  684. */
  685. struct private_bios_data {
  686. uint8_t geometry :4;
  687. uint8_t unused :4;
  688. uint8_t boot_drv;
  689. uint8_t rsvd[12];
  690. uint16_t cksum;
  691. } __attribute__ ((packed));
  692. /**
  693. * mbox_sgl64 - 64-bit scatter list for mailbox based controllers
  694. * @address : address of the buffer
  695. * @length : data transfer length
  696. */
  697. typedef struct {
  698. uint64_t address;
  699. uint32_t length;
  700. } __attribute__ ((packed)) mbox_sgl64;
  701. /**
  702. * mbox_sgl32 - 32-bit scatter list for mailbox based controllers
  703. * @address : address of the buffer
  704. * @length : data transfer length
  705. */
  706. typedef struct {
  707. uint32_t address;
  708. uint32_t length;
  709. } __attribute__ ((packed)) mbox_sgl32;
  710. #endif // _MRAID_MBOX_DEFS_H_
  711. /* vim: set ts=8 sw=8 tw=78: */