mbox_defs.h 20 KB

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