megaraid_sas.h 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357
  1. /*
  2. *
  3. * Linux MegaRAID driver for SAS based RAID controllers
  4. *
  5. * Copyright (c) 2003-2005 LSI 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 : megaraid_sas.h
  13. */
  14. #ifndef LSI_MEGARAID_SAS_H
  15. #define LSI_MEGARAID_SAS_H
  16. /*
  17. * MegaRAID SAS Driver meta data
  18. */
  19. #define MEGASAS_VERSION "00.00.04.17.1-rc1"
  20. #define MEGASAS_RELDATE "Oct. 29, 2009"
  21. #define MEGASAS_EXT_VERSION "Thu. Oct. 29, 11:41:51 PST 2009"
  22. /*
  23. * Device IDs
  24. */
  25. #define PCI_DEVICE_ID_LSI_SAS1078R 0x0060
  26. #define PCI_DEVICE_ID_LSI_SAS1078DE 0x007C
  27. #define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413
  28. #define PCI_DEVICE_ID_LSI_SAS1078GEN2 0x0078
  29. #define PCI_DEVICE_ID_LSI_SAS0079GEN2 0x0079
  30. #define PCI_DEVICE_ID_LSI_SAS0073SKINNY 0x0073
  31. #define PCI_DEVICE_ID_LSI_SAS0071SKINNY 0x0071
  32. /*
  33. * =====================================
  34. * MegaRAID SAS MFI firmware definitions
  35. * =====================================
  36. */
  37. /*
  38. * MFI stands for MegaRAID SAS FW Interface. This is just a moniker for
  39. * protocol between the software and firmware. Commands are issued using
  40. * "message frames"
  41. */
  42. /*
  43. * FW posts its state in upper 4 bits of outbound_msg_0 register
  44. */
  45. #define MFI_STATE_MASK 0xF0000000
  46. #define MFI_STATE_UNDEFINED 0x00000000
  47. #define MFI_STATE_BB_INIT 0x10000000
  48. #define MFI_STATE_FW_INIT 0x40000000
  49. #define MFI_STATE_WAIT_HANDSHAKE 0x60000000
  50. #define MFI_STATE_FW_INIT_2 0x70000000
  51. #define MFI_STATE_DEVICE_SCAN 0x80000000
  52. #define MFI_STATE_BOOT_MESSAGE_PENDING 0x90000000
  53. #define MFI_STATE_FLUSH_CACHE 0xA0000000
  54. #define MFI_STATE_READY 0xB0000000
  55. #define MFI_STATE_OPERATIONAL 0xC0000000
  56. #define MFI_STATE_FAULT 0xF0000000
  57. #define MEGAMFI_FRAME_SIZE 64
  58. /*
  59. * During FW init, clear pending cmds & reset state using inbound_msg_0
  60. *
  61. * ABORT : Abort all pending cmds
  62. * READY : Move from OPERATIONAL to READY state; discard queue info
  63. * MFIMODE : Discard (possible) low MFA posted in 64-bit mode (??)
  64. * CLR_HANDSHAKE: FW is waiting for HANDSHAKE from BIOS or Driver
  65. * HOTPLUG : Resume from Hotplug
  66. * MFI_STOP_ADP : Send signal to FW to stop processing
  67. */
  68. #define MFI_INIT_ABORT 0x00000001
  69. #define MFI_INIT_READY 0x00000002
  70. #define MFI_INIT_MFIMODE 0x00000004
  71. #define MFI_INIT_CLEAR_HANDSHAKE 0x00000008
  72. #define MFI_INIT_HOTPLUG 0x00000010
  73. #define MFI_STOP_ADP 0x00000020
  74. #define MFI_RESET_FLAGS MFI_INIT_READY| \
  75. MFI_INIT_MFIMODE| \
  76. MFI_INIT_ABORT
  77. /*
  78. * MFI frame flags
  79. */
  80. #define MFI_FRAME_POST_IN_REPLY_QUEUE 0x0000
  81. #define MFI_FRAME_DONT_POST_IN_REPLY_QUEUE 0x0001
  82. #define MFI_FRAME_SGL32 0x0000
  83. #define MFI_FRAME_SGL64 0x0002
  84. #define MFI_FRAME_SENSE32 0x0000
  85. #define MFI_FRAME_SENSE64 0x0004
  86. #define MFI_FRAME_DIR_NONE 0x0000
  87. #define MFI_FRAME_DIR_WRITE 0x0008
  88. #define MFI_FRAME_DIR_READ 0x0010
  89. #define MFI_FRAME_DIR_BOTH 0x0018
  90. #define MFI_FRAME_IEEE 0x0020
  91. /*
  92. * Definition for cmd_status
  93. */
  94. #define MFI_CMD_STATUS_POLL_MODE 0xFF
  95. /*
  96. * MFI command opcodes
  97. */
  98. #define MFI_CMD_INIT 0x00
  99. #define MFI_CMD_LD_READ 0x01
  100. #define MFI_CMD_LD_WRITE 0x02
  101. #define MFI_CMD_LD_SCSI_IO 0x03
  102. #define MFI_CMD_PD_SCSI_IO 0x04
  103. #define MFI_CMD_DCMD 0x05
  104. #define MFI_CMD_ABORT 0x06
  105. #define MFI_CMD_SMP 0x07
  106. #define MFI_CMD_STP 0x08
  107. #define MR_DCMD_CTRL_GET_INFO 0x01010000
  108. #define MR_DCMD_LD_GET_LIST 0x03010000
  109. #define MR_DCMD_CTRL_CACHE_FLUSH 0x01101000
  110. #define MR_FLUSH_CTRL_CACHE 0x01
  111. #define MR_FLUSH_DISK_CACHE 0x02
  112. #define MR_DCMD_CTRL_SHUTDOWN 0x01050000
  113. #define MR_DCMD_HIBERNATE_SHUTDOWN 0x01060000
  114. #define MR_ENABLE_DRIVE_SPINDOWN 0x01
  115. #define MR_DCMD_CTRL_EVENT_GET_INFO 0x01040100
  116. #define MR_DCMD_CTRL_EVENT_GET 0x01040300
  117. #define MR_DCMD_CTRL_EVENT_WAIT 0x01040500
  118. #define MR_DCMD_LD_GET_PROPERTIES 0x03030000
  119. #define MR_DCMD_CLUSTER 0x08000000
  120. #define MR_DCMD_CLUSTER_RESET_ALL 0x08010100
  121. #define MR_DCMD_CLUSTER_RESET_LD 0x08010200
  122. #define MR_DCMD_PD_LIST_QUERY 0x02010100
  123. /*
  124. * MFI command completion codes
  125. */
  126. enum MFI_STAT {
  127. MFI_STAT_OK = 0x00,
  128. MFI_STAT_INVALID_CMD = 0x01,
  129. MFI_STAT_INVALID_DCMD = 0x02,
  130. MFI_STAT_INVALID_PARAMETER = 0x03,
  131. MFI_STAT_INVALID_SEQUENCE_NUMBER = 0x04,
  132. MFI_STAT_ABORT_NOT_POSSIBLE = 0x05,
  133. MFI_STAT_APP_HOST_CODE_NOT_FOUND = 0x06,
  134. MFI_STAT_APP_IN_USE = 0x07,
  135. MFI_STAT_APP_NOT_INITIALIZED = 0x08,
  136. MFI_STAT_ARRAY_INDEX_INVALID = 0x09,
  137. MFI_STAT_ARRAY_ROW_NOT_EMPTY = 0x0a,
  138. MFI_STAT_CONFIG_RESOURCE_CONFLICT = 0x0b,
  139. MFI_STAT_DEVICE_NOT_FOUND = 0x0c,
  140. MFI_STAT_DRIVE_TOO_SMALL = 0x0d,
  141. MFI_STAT_FLASH_ALLOC_FAIL = 0x0e,
  142. MFI_STAT_FLASH_BUSY = 0x0f,
  143. MFI_STAT_FLASH_ERROR = 0x10,
  144. MFI_STAT_FLASH_IMAGE_BAD = 0x11,
  145. MFI_STAT_FLASH_IMAGE_INCOMPLETE = 0x12,
  146. MFI_STAT_FLASH_NOT_OPEN = 0x13,
  147. MFI_STAT_FLASH_NOT_STARTED = 0x14,
  148. MFI_STAT_FLUSH_FAILED = 0x15,
  149. MFI_STAT_HOST_CODE_NOT_FOUNT = 0x16,
  150. MFI_STAT_LD_CC_IN_PROGRESS = 0x17,
  151. MFI_STAT_LD_INIT_IN_PROGRESS = 0x18,
  152. MFI_STAT_LD_LBA_OUT_OF_RANGE = 0x19,
  153. MFI_STAT_LD_MAX_CONFIGURED = 0x1a,
  154. MFI_STAT_LD_NOT_OPTIMAL = 0x1b,
  155. MFI_STAT_LD_RBLD_IN_PROGRESS = 0x1c,
  156. MFI_STAT_LD_RECON_IN_PROGRESS = 0x1d,
  157. MFI_STAT_LD_WRONG_RAID_LEVEL = 0x1e,
  158. MFI_STAT_MAX_SPARES_EXCEEDED = 0x1f,
  159. MFI_STAT_MEMORY_NOT_AVAILABLE = 0x20,
  160. MFI_STAT_MFC_HW_ERROR = 0x21,
  161. MFI_STAT_NO_HW_PRESENT = 0x22,
  162. MFI_STAT_NOT_FOUND = 0x23,
  163. MFI_STAT_NOT_IN_ENCL = 0x24,
  164. MFI_STAT_PD_CLEAR_IN_PROGRESS = 0x25,
  165. MFI_STAT_PD_TYPE_WRONG = 0x26,
  166. MFI_STAT_PR_DISABLED = 0x27,
  167. MFI_STAT_ROW_INDEX_INVALID = 0x28,
  168. MFI_STAT_SAS_CONFIG_INVALID_ACTION = 0x29,
  169. MFI_STAT_SAS_CONFIG_INVALID_DATA = 0x2a,
  170. MFI_STAT_SAS_CONFIG_INVALID_PAGE = 0x2b,
  171. MFI_STAT_SAS_CONFIG_INVALID_TYPE = 0x2c,
  172. MFI_STAT_SCSI_DONE_WITH_ERROR = 0x2d,
  173. MFI_STAT_SCSI_IO_FAILED = 0x2e,
  174. MFI_STAT_SCSI_RESERVATION_CONFLICT = 0x2f,
  175. MFI_STAT_SHUTDOWN_FAILED = 0x30,
  176. MFI_STAT_TIME_NOT_SET = 0x31,
  177. MFI_STAT_WRONG_STATE = 0x32,
  178. MFI_STAT_LD_OFFLINE = 0x33,
  179. MFI_STAT_PEER_NOTIFICATION_REJECTED = 0x34,
  180. MFI_STAT_PEER_NOTIFICATION_FAILED = 0x35,
  181. MFI_STAT_RESERVATION_IN_PROGRESS = 0x36,
  182. MFI_STAT_I2C_ERRORS_DETECTED = 0x37,
  183. MFI_STAT_PCI_ERRORS_DETECTED = 0x38,
  184. MFI_STAT_INVALID_STATUS = 0xFF
  185. };
  186. /*
  187. * Number of mailbox bytes in DCMD message frame
  188. */
  189. #define MFI_MBOX_SIZE 12
  190. enum MR_EVT_CLASS {
  191. MR_EVT_CLASS_DEBUG = -2,
  192. MR_EVT_CLASS_PROGRESS = -1,
  193. MR_EVT_CLASS_INFO = 0,
  194. MR_EVT_CLASS_WARNING = 1,
  195. MR_EVT_CLASS_CRITICAL = 2,
  196. MR_EVT_CLASS_FATAL = 3,
  197. MR_EVT_CLASS_DEAD = 4,
  198. };
  199. enum MR_EVT_LOCALE {
  200. MR_EVT_LOCALE_LD = 0x0001,
  201. MR_EVT_LOCALE_PD = 0x0002,
  202. MR_EVT_LOCALE_ENCL = 0x0004,
  203. MR_EVT_LOCALE_BBU = 0x0008,
  204. MR_EVT_LOCALE_SAS = 0x0010,
  205. MR_EVT_LOCALE_CTRL = 0x0020,
  206. MR_EVT_LOCALE_CONFIG = 0x0040,
  207. MR_EVT_LOCALE_CLUSTER = 0x0080,
  208. MR_EVT_LOCALE_ALL = 0xffff,
  209. };
  210. enum MR_EVT_ARGS {
  211. MR_EVT_ARGS_NONE,
  212. MR_EVT_ARGS_CDB_SENSE,
  213. MR_EVT_ARGS_LD,
  214. MR_EVT_ARGS_LD_COUNT,
  215. MR_EVT_ARGS_LD_LBA,
  216. MR_EVT_ARGS_LD_OWNER,
  217. MR_EVT_ARGS_LD_LBA_PD_LBA,
  218. MR_EVT_ARGS_LD_PROG,
  219. MR_EVT_ARGS_LD_STATE,
  220. MR_EVT_ARGS_LD_STRIP,
  221. MR_EVT_ARGS_PD,
  222. MR_EVT_ARGS_PD_ERR,
  223. MR_EVT_ARGS_PD_LBA,
  224. MR_EVT_ARGS_PD_LBA_LD,
  225. MR_EVT_ARGS_PD_PROG,
  226. MR_EVT_ARGS_PD_STATE,
  227. MR_EVT_ARGS_PCI,
  228. MR_EVT_ARGS_RATE,
  229. MR_EVT_ARGS_STR,
  230. MR_EVT_ARGS_TIME,
  231. MR_EVT_ARGS_ECC,
  232. MR_EVT_ARGS_LD_PROP,
  233. MR_EVT_ARGS_PD_SPARE,
  234. MR_EVT_ARGS_PD_INDEX,
  235. MR_EVT_ARGS_DIAG_PASS,
  236. MR_EVT_ARGS_DIAG_FAIL,
  237. MR_EVT_ARGS_PD_LBA_LBA,
  238. MR_EVT_ARGS_PORT_PHY,
  239. MR_EVT_ARGS_PD_MISSING,
  240. MR_EVT_ARGS_PD_ADDRESS,
  241. MR_EVT_ARGS_BITMAP,
  242. MR_EVT_ARGS_CONNECTOR,
  243. MR_EVT_ARGS_PD_PD,
  244. MR_EVT_ARGS_PD_FRU,
  245. MR_EVT_ARGS_PD_PATHINFO,
  246. MR_EVT_ARGS_PD_POWER_STATE,
  247. MR_EVT_ARGS_GENERIC,
  248. };
  249. /*
  250. * define constants for device list query options
  251. */
  252. enum MR_PD_QUERY_TYPE {
  253. MR_PD_QUERY_TYPE_ALL = 0,
  254. MR_PD_QUERY_TYPE_STATE = 1,
  255. MR_PD_QUERY_TYPE_POWER_STATE = 2,
  256. MR_PD_QUERY_TYPE_MEDIA_TYPE = 3,
  257. MR_PD_QUERY_TYPE_SPEED = 4,
  258. MR_PD_QUERY_TYPE_EXPOSED_TO_HOST = 5,
  259. };
  260. #define MR_EVT_CFG_CLEARED 0x0004
  261. #define MR_EVT_LD_STATE_CHANGE 0x0051
  262. #define MR_EVT_PD_INSERTED 0x005b
  263. #define MR_EVT_PD_REMOVED 0x0070
  264. #define MR_EVT_LD_CREATED 0x008a
  265. #define MR_EVT_LD_DELETED 0x008b
  266. #define MR_EVT_FOREIGN_CFG_IMPORTED 0x00db
  267. #define MR_EVT_LD_OFFLINE 0x00fc
  268. #define MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED 0x0152
  269. #define MAX_LOGICAL_DRIVES 64
  270. enum MR_PD_STATE {
  271. MR_PD_STATE_UNCONFIGURED_GOOD = 0x00,
  272. MR_PD_STATE_UNCONFIGURED_BAD = 0x01,
  273. MR_PD_STATE_HOT_SPARE = 0x02,
  274. MR_PD_STATE_OFFLINE = 0x10,
  275. MR_PD_STATE_FAILED = 0x11,
  276. MR_PD_STATE_REBUILD = 0x14,
  277. MR_PD_STATE_ONLINE = 0x18,
  278. MR_PD_STATE_COPYBACK = 0x20,
  279. MR_PD_STATE_SYSTEM = 0x40,
  280. };
  281. /*
  282. * defines the physical drive address structure
  283. */
  284. struct MR_PD_ADDRESS {
  285. u16 deviceId;
  286. u16 enclDeviceId;
  287. union {
  288. struct {
  289. u8 enclIndex;
  290. u8 slotNumber;
  291. } mrPdAddress;
  292. struct {
  293. u8 enclPosition;
  294. u8 enclConnectorIndex;
  295. } mrEnclAddress;
  296. };
  297. u8 scsiDevType;
  298. union {
  299. u8 connectedPortBitmap;
  300. u8 connectedPortNumbers;
  301. };
  302. u64 sasAddr[2];
  303. } __packed;
  304. /*
  305. * defines the physical drive list structure
  306. */
  307. struct MR_PD_LIST {
  308. u32 size;
  309. u32 count;
  310. struct MR_PD_ADDRESS addr[1];
  311. } __packed;
  312. struct megasas_pd_list {
  313. u16 tid;
  314. u8 driveType;
  315. u8 driveState;
  316. } __packed;
  317. /*
  318. * defines the logical drive reference structure
  319. */
  320. union MR_LD_REF {
  321. struct {
  322. u8 targetId;
  323. u8 reserved;
  324. u16 seqNum;
  325. };
  326. u32 ref;
  327. } __packed;
  328. /*
  329. * defines the logical drive list structure
  330. */
  331. struct MR_LD_LIST {
  332. u32 ldCount;
  333. u32 reserved;
  334. struct {
  335. union MR_LD_REF ref;
  336. u8 state;
  337. u8 reserved[3];
  338. u64 size;
  339. } ldList[MAX_LOGICAL_DRIVES];
  340. } __packed;
  341. /*
  342. * SAS controller properties
  343. */
  344. struct megasas_ctrl_prop {
  345. u16 seq_num;
  346. u16 pred_fail_poll_interval;
  347. u16 intr_throttle_count;
  348. u16 intr_throttle_timeouts;
  349. u8 rebuild_rate;
  350. u8 patrol_read_rate;
  351. u8 bgi_rate;
  352. u8 cc_rate;
  353. u8 recon_rate;
  354. u8 cache_flush_interval;
  355. u8 spinup_drv_count;
  356. u8 spinup_delay;
  357. u8 cluster_enable;
  358. u8 coercion_mode;
  359. u8 alarm_enable;
  360. u8 disable_auto_rebuild;
  361. u8 disable_battery_warn;
  362. u8 ecc_bucket_size;
  363. u16 ecc_bucket_leak_rate;
  364. u8 restore_hotspare_on_insertion;
  365. u8 expose_encl_devices;
  366. u8 reserved[38];
  367. } __packed;
  368. /*
  369. * SAS controller information
  370. */
  371. struct megasas_ctrl_info {
  372. /*
  373. * PCI device information
  374. */
  375. struct {
  376. u16 vendor_id;
  377. u16 device_id;
  378. u16 sub_vendor_id;
  379. u16 sub_device_id;
  380. u8 reserved[24];
  381. } __attribute__ ((packed)) pci;
  382. /*
  383. * Host interface information
  384. */
  385. struct {
  386. u8 PCIX:1;
  387. u8 PCIE:1;
  388. u8 iSCSI:1;
  389. u8 SAS_3G:1;
  390. u8 reserved_0:4;
  391. u8 reserved_1[6];
  392. u8 port_count;
  393. u64 port_addr[8];
  394. } __attribute__ ((packed)) host_interface;
  395. /*
  396. * Device (backend) interface information
  397. */
  398. struct {
  399. u8 SPI:1;
  400. u8 SAS_3G:1;
  401. u8 SATA_1_5G:1;
  402. u8 SATA_3G:1;
  403. u8 reserved_0:4;
  404. u8 reserved_1[6];
  405. u8 port_count;
  406. u64 port_addr[8];
  407. } __attribute__ ((packed)) device_interface;
  408. /*
  409. * List of components residing in flash. All str are null terminated
  410. */
  411. u32 image_check_word;
  412. u32 image_component_count;
  413. struct {
  414. char name[8];
  415. char version[32];
  416. char build_date[16];
  417. char built_time[16];
  418. } __attribute__ ((packed)) image_component[8];
  419. /*
  420. * List of flash components that have been flashed on the card, but
  421. * are not in use, pending reset of the adapter. This list will be
  422. * empty if a flash operation has not occurred. All stings are null
  423. * terminated
  424. */
  425. u32 pending_image_component_count;
  426. struct {
  427. char name[8];
  428. char version[32];
  429. char build_date[16];
  430. char build_time[16];
  431. } __attribute__ ((packed)) pending_image_component[8];
  432. u8 max_arms;
  433. u8 max_spans;
  434. u8 max_arrays;
  435. u8 max_lds;
  436. char product_name[80];
  437. char serial_no[32];
  438. /*
  439. * Other physical/controller/operation information. Indicates the
  440. * presence of the hardware
  441. */
  442. struct {
  443. u32 bbu:1;
  444. u32 alarm:1;
  445. u32 nvram:1;
  446. u32 uart:1;
  447. u32 reserved:28;
  448. } __attribute__ ((packed)) hw_present;
  449. u32 current_fw_time;
  450. /*
  451. * Maximum data transfer sizes
  452. */
  453. u16 max_concurrent_cmds;
  454. u16 max_sge_count;
  455. u32 max_request_size;
  456. /*
  457. * Logical and physical device counts
  458. */
  459. u16 ld_present_count;
  460. u16 ld_degraded_count;
  461. u16 ld_offline_count;
  462. u16 pd_present_count;
  463. u16 pd_disk_present_count;
  464. u16 pd_disk_pred_failure_count;
  465. u16 pd_disk_failed_count;
  466. /*
  467. * Memory size information
  468. */
  469. u16 nvram_size;
  470. u16 memory_size;
  471. u16 flash_size;
  472. /*
  473. * Error counters
  474. */
  475. u16 mem_correctable_error_count;
  476. u16 mem_uncorrectable_error_count;
  477. /*
  478. * Cluster information
  479. */
  480. u8 cluster_permitted;
  481. u8 cluster_active;
  482. /*
  483. * Additional max data transfer sizes
  484. */
  485. u16 max_strips_per_io;
  486. /*
  487. * Controller capabilities structures
  488. */
  489. struct {
  490. u32 raid_level_0:1;
  491. u32 raid_level_1:1;
  492. u32 raid_level_5:1;
  493. u32 raid_level_1E:1;
  494. u32 raid_level_6:1;
  495. u32 reserved:27;
  496. } __attribute__ ((packed)) raid_levels;
  497. struct {
  498. u32 rbld_rate:1;
  499. u32 cc_rate:1;
  500. u32 bgi_rate:1;
  501. u32 recon_rate:1;
  502. u32 patrol_rate:1;
  503. u32 alarm_control:1;
  504. u32 cluster_supported:1;
  505. u32 bbu:1;
  506. u32 spanning_allowed:1;
  507. u32 dedicated_hotspares:1;
  508. u32 revertible_hotspares:1;
  509. u32 foreign_config_import:1;
  510. u32 self_diagnostic:1;
  511. u32 mixed_redundancy_arr:1;
  512. u32 global_hot_spares:1;
  513. u32 reserved:17;
  514. } __attribute__ ((packed)) adapter_operations;
  515. struct {
  516. u32 read_policy:1;
  517. u32 write_policy:1;
  518. u32 io_policy:1;
  519. u32 access_policy:1;
  520. u32 disk_cache_policy:1;
  521. u32 reserved:27;
  522. } __attribute__ ((packed)) ld_operations;
  523. struct {
  524. u8 min;
  525. u8 max;
  526. u8 reserved[2];
  527. } __attribute__ ((packed)) stripe_sz_ops;
  528. struct {
  529. u32 force_online:1;
  530. u32 force_offline:1;
  531. u32 force_rebuild:1;
  532. u32 reserved:29;
  533. } __attribute__ ((packed)) pd_operations;
  534. struct {
  535. u32 ctrl_supports_sas:1;
  536. u32 ctrl_supports_sata:1;
  537. u32 allow_mix_in_encl:1;
  538. u32 allow_mix_in_ld:1;
  539. u32 allow_sata_in_cluster:1;
  540. u32 reserved:27;
  541. } __attribute__ ((packed)) pd_mix_support;
  542. /*
  543. * Define ECC single-bit-error bucket information
  544. */
  545. u8 ecc_bucket_count;
  546. u8 reserved_2[11];
  547. /*
  548. * Include the controller properties (changeable items)
  549. */
  550. struct megasas_ctrl_prop properties;
  551. /*
  552. * Define FW pkg version (set in envt v'bles on OEM basis)
  553. */
  554. char package_version[0x60];
  555. u8 pad[0x800 - 0x6a0];
  556. } __packed;
  557. /*
  558. * ===============================
  559. * MegaRAID SAS driver definitions
  560. * ===============================
  561. */
  562. #define MEGASAS_MAX_PD_CHANNELS 2
  563. #define MEGASAS_MAX_LD_CHANNELS 2
  564. #define MEGASAS_MAX_CHANNELS (MEGASAS_MAX_PD_CHANNELS + \
  565. MEGASAS_MAX_LD_CHANNELS)
  566. #define MEGASAS_MAX_DEV_PER_CHANNEL 128
  567. #define MEGASAS_DEFAULT_INIT_ID -1
  568. #define MEGASAS_MAX_LUN 8
  569. #define MEGASAS_MAX_LD 64
  570. #define MEGASAS_MAX_PD (MEGASAS_MAX_PD_CHANNELS * \
  571. MEGASAS_MAX_DEV_PER_CHANNEL)
  572. #define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \
  573. MEGASAS_MAX_DEV_PER_CHANNEL)
  574. #define MEGASAS_DBG_LVL 1
  575. #define MEGASAS_FW_BUSY 1
  576. /* Frame Type */
  577. #define IO_FRAME 0
  578. #define PTHRU_FRAME 1
  579. /*
  580. * When SCSI mid-layer calls driver's reset routine, driver waits for
  581. * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note
  582. * that the driver cannot _actually_ abort or reset pending commands. While
  583. * it is waiting for the commands to complete, it prints a diagnostic message
  584. * every MEGASAS_RESET_NOTICE_INTERVAL seconds
  585. */
  586. #define MEGASAS_RESET_WAIT_TIME 180
  587. #define MEGASAS_INTERNAL_CMD_WAIT_TIME 180
  588. #define MEGASAS_RESET_NOTICE_INTERVAL 5
  589. #define MEGASAS_IOCTL_CMD 0
  590. #define MEGASAS_DEFAULT_CMD_TIMEOUT 90
  591. /*
  592. * FW reports the maximum of number of commands that it can accept (maximum
  593. * commands that can be outstanding) at any time. The driver must report a
  594. * lower number to the mid layer because it can issue a few internal commands
  595. * itself (E.g, AEN, abort cmd, IOCTLs etc). The number of commands it needs
  596. * is shown below
  597. */
  598. #define MEGASAS_INT_CMDS 32
  599. #define MEGASAS_SKINNY_INT_CMDS 5
  600. /*
  601. * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit
  602. * SGLs based on the size of dma_addr_t
  603. */
  604. #define IS_DMA64 (sizeof(dma_addr_t) == 8)
  605. #define MFI_OB_INTR_STATUS_MASK 0x00000002
  606. #define MFI_POLL_TIMEOUT_SECS 60
  607. #define MEGASAS_COMPLETION_TIMER_INTERVAL (HZ/10)
  608. #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000
  609. #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001
  610. #define MFI_GEN2_ENABLE_INTERRUPT_MASK (0x00000001 | 0x00000004)
  611. #define MFI_REPLY_SKINNY_MESSAGE_INTERRUPT 0x40000000
  612. #define MFI_SKINNY_ENABLE_INTERRUPT_MASK (0x00000001)
  613. /*
  614. * register set for both 1068 and 1078 controllers
  615. * structure extended for 1078 registers
  616. */
  617. struct megasas_register_set {
  618. u32 reserved_0[4]; /*0000h*/
  619. u32 inbound_msg_0; /*0010h*/
  620. u32 inbound_msg_1; /*0014h*/
  621. u32 outbound_msg_0; /*0018h*/
  622. u32 outbound_msg_1; /*001Ch*/
  623. u32 inbound_doorbell; /*0020h*/
  624. u32 inbound_intr_status; /*0024h*/
  625. u32 inbound_intr_mask; /*0028h*/
  626. u32 outbound_doorbell; /*002Ch*/
  627. u32 outbound_intr_status; /*0030h*/
  628. u32 outbound_intr_mask; /*0034h*/
  629. u32 reserved_1[2]; /*0038h*/
  630. u32 inbound_queue_port; /*0040h*/
  631. u32 outbound_queue_port; /*0044h*/
  632. u32 reserved_2[22]; /*0048h*/
  633. u32 outbound_doorbell_clear; /*00A0h*/
  634. u32 reserved_3[3]; /*00A4h*/
  635. u32 outbound_scratch_pad ; /*00B0h*/
  636. u32 reserved_4[3]; /*00B4h*/
  637. u32 inbound_low_queue_port ; /*00C0h*/
  638. u32 inbound_high_queue_port ; /*00C4h*/
  639. u32 reserved_5; /*00C8h*/
  640. u32 index_registers[820]; /*00CCh*/
  641. } __attribute__ ((packed));
  642. struct megasas_sge32 {
  643. u32 phys_addr;
  644. u32 length;
  645. } __attribute__ ((packed));
  646. struct megasas_sge64 {
  647. u64 phys_addr;
  648. u32 length;
  649. } __attribute__ ((packed));
  650. struct megasas_sge_skinny {
  651. u64 phys_addr;
  652. u32 length;
  653. u32 flag;
  654. } __packed;
  655. union megasas_sgl {
  656. struct megasas_sge32 sge32[1];
  657. struct megasas_sge64 sge64[1];
  658. struct megasas_sge_skinny sge_skinny[1];
  659. } __attribute__ ((packed));
  660. struct megasas_header {
  661. u8 cmd; /*00h */
  662. u8 sense_len; /*01h */
  663. u8 cmd_status; /*02h */
  664. u8 scsi_status; /*03h */
  665. u8 target_id; /*04h */
  666. u8 lun; /*05h */
  667. u8 cdb_len; /*06h */
  668. u8 sge_count; /*07h */
  669. u32 context; /*08h */
  670. u32 pad_0; /*0Ch */
  671. u16 flags; /*10h */
  672. u16 timeout; /*12h */
  673. u32 data_xferlen; /*14h */
  674. } __attribute__ ((packed));
  675. union megasas_sgl_frame {
  676. struct megasas_sge32 sge32[8];
  677. struct megasas_sge64 sge64[5];
  678. } __attribute__ ((packed));
  679. struct megasas_init_frame {
  680. u8 cmd; /*00h */
  681. u8 reserved_0; /*01h */
  682. u8 cmd_status; /*02h */
  683. u8 reserved_1; /*03h */
  684. u32 reserved_2; /*04h */
  685. u32 context; /*08h */
  686. u32 pad_0; /*0Ch */
  687. u16 flags; /*10h */
  688. u16 reserved_3; /*12h */
  689. u32 data_xfer_len; /*14h */
  690. u32 queue_info_new_phys_addr_lo; /*18h */
  691. u32 queue_info_new_phys_addr_hi; /*1Ch */
  692. u32 queue_info_old_phys_addr_lo; /*20h */
  693. u32 queue_info_old_phys_addr_hi; /*24h */
  694. u32 reserved_4[6]; /*28h */
  695. } __attribute__ ((packed));
  696. struct megasas_init_queue_info {
  697. u32 init_flags; /*00h */
  698. u32 reply_queue_entries; /*04h */
  699. u32 reply_queue_start_phys_addr_lo; /*08h */
  700. u32 reply_queue_start_phys_addr_hi; /*0Ch */
  701. u32 producer_index_phys_addr_lo; /*10h */
  702. u32 producer_index_phys_addr_hi; /*14h */
  703. u32 consumer_index_phys_addr_lo; /*18h */
  704. u32 consumer_index_phys_addr_hi; /*1Ch */
  705. } __attribute__ ((packed));
  706. struct megasas_io_frame {
  707. u8 cmd; /*00h */
  708. u8 sense_len; /*01h */
  709. u8 cmd_status; /*02h */
  710. u8 scsi_status; /*03h */
  711. u8 target_id; /*04h */
  712. u8 access_byte; /*05h */
  713. u8 reserved_0; /*06h */
  714. u8 sge_count; /*07h */
  715. u32 context; /*08h */
  716. u32 pad_0; /*0Ch */
  717. u16 flags; /*10h */
  718. u16 timeout; /*12h */
  719. u32 lba_count; /*14h */
  720. u32 sense_buf_phys_addr_lo; /*18h */
  721. u32 sense_buf_phys_addr_hi; /*1Ch */
  722. u32 start_lba_lo; /*20h */
  723. u32 start_lba_hi; /*24h */
  724. union megasas_sgl sgl; /*28h */
  725. } __attribute__ ((packed));
  726. struct megasas_pthru_frame {
  727. u8 cmd; /*00h */
  728. u8 sense_len; /*01h */
  729. u8 cmd_status; /*02h */
  730. u8 scsi_status; /*03h */
  731. u8 target_id; /*04h */
  732. u8 lun; /*05h */
  733. u8 cdb_len; /*06h */
  734. u8 sge_count; /*07h */
  735. u32 context; /*08h */
  736. u32 pad_0; /*0Ch */
  737. u16 flags; /*10h */
  738. u16 timeout; /*12h */
  739. u32 data_xfer_len; /*14h */
  740. u32 sense_buf_phys_addr_lo; /*18h */
  741. u32 sense_buf_phys_addr_hi; /*1Ch */
  742. u8 cdb[16]; /*20h */
  743. union megasas_sgl sgl; /*30h */
  744. } __attribute__ ((packed));
  745. struct megasas_dcmd_frame {
  746. u8 cmd; /*00h */
  747. u8 reserved_0; /*01h */
  748. u8 cmd_status; /*02h */
  749. u8 reserved_1[4]; /*03h */
  750. u8 sge_count; /*07h */
  751. u32 context; /*08h */
  752. u32 pad_0; /*0Ch */
  753. u16 flags; /*10h */
  754. u16 timeout; /*12h */
  755. u32 data_xfer_len; /*14h */
  756. u32 opcode; /*18h */
  757. union { /*1Ch */
  758. u8 b[12];
  759. u16 s[6];
  760. u32 w[3];
  761. } mbox;
  762. union megasas_sgl sgl; /*28h */
  763. } __attribute__ ((packed));
  764. struct megasas_abort_frame {
  765. u8 cmd; /*00h */
  766. u8 reserved_0; /*01h */
  767. u8 cmd_status; /*02h */
  768. u8 reserved_1; /*03h */
  769. u32 reserved_2; /*04h */
  770. u32 context; /*08h */
  771. u32 pad_0; /*0Ch */
  772. u16 flags; /*10h */
  773. u16 reserved_3; /*12h */
  774. u32 reserved_4; /*14h */
  775. u32 abort_context; /*18h */
  776. u32 pad_1; /*1Ch */
  777. u32 abort_mfi_phys_addr_lo; /*20h */
  778. u32 abort_mfi_phys_addr_hi; /*24h */
  779. u32 reserved_5[6]; /*28h */
  780. } __attribute__ ((packed));
  781. struct megasas_smp_frame {
  782. u8 cmd; /*00h */
  783. u8 reserved_1; /*01h */
  784. u8 cmd_status; /*02h */
  785. u8 connection_status; /*03h */
  786. u8 reserved_2[3]; /*04h */
  787. u8 sge_count; /*07h */
  788. u32 context; /*08h */
  789. u32 pad_0; /*0Ch */
  790. u16 flags; /*10h */
  791. u16 timeout; /*12h */
  792. u32 data_xfer_len; /*14h */
  793. u64 sas_addr; /*18h */
  794. union {
  795. struct megasas_sge32 sge32[2]; /* [0]: resp [1]: req */
  796. struct megasas_sge64 sge64[2]; /* [0]: resp [1]: req */
  797. } sgl;
  798. } __attribute__ ((packed));
  799. struct megasas_stp_frame {
  800. u8 cmd; /*00h */
  801. u8 reserved_1; /*01h */
  802. u8 cmd_status; /*02h */
  803. u8 reserved_2; /*03h */
  804. u8 target_id; /*04h */
  805. u8 reserved_3[2]; /*05h */
  806. u8 sge_count; /*07h */
  807. u32 context; /*08h */
  808. u32 pad_0; /*0Ch */
  809. u16 flags; /*10h */
  810. u16 timeout; /*12h */
  811. u32 data_xfer_len; /*14h */
  812. u16 fis[10]; /*18h */
  813. u32 stp_flags;
  814. union {
  815. struct megasas_sge32 sge32[2]; /* [0]: resp [1]: data */
  816. struct megasas_sge64 sge64[2]; /* [0]: resp [1]: data */
  817. } sgl;
  818. } __attribute__ ((packed));
  819. union megasas_frame {
  820. struct megasas_header hdr;
  821. struct megasas_init_frame init;
  822. struct megasas_io_frame io;
  823. struct megasas_pthru_frame pthru;
  824. struct megasas_dcmd_frame dcmd;
  825. struct megasas_abort_frame abort;
  826. struct megasas_smp_frame smp;
  827. struct megasas_stp_frame stp;
  828. u8 raw_bytes[64];
  829. };
  830. struct megasas_cmd;
  831. union megasas_evt_class_locale {
  832. struct {
  833. u16 locale;
  834. u8 reserved;
  835. s8 class;
  836. } __attribute__ ((packed)) members;
  837. u32 word;
  838. } __attribute__ ((packed));
  839. struct megasas_evt_log_info {
  840. u32 newest_seq_num;
  841. u32 oldest_seq_num;
  842. u32 clear_seq_num;
  843. u32 shutdown_seq_num;
  844. u32 boot_seq_num;
  845. } __attribute__ ((packed));
  846. struct megasas_progress {
  847. u16 progress;
  848. u16 elapsed_seconds;
  849. } __attribute__ ((packed));
  850. struct megasas_evtarg_ld {
  851. u16 target_id;
  852. u8 ld_index;
  853. u8 reserved;
  854. } __attribute__ ((packed));
  855. struct megasas_evtarg_pd {
  856. u16 device_id;
  857. u8 encl_index;
  858. u8 slot_number;
  859. } __attribute__ ((packed));
  860. struct megasas_evt_detail {
  861. u32 seq_num;
  862. u32 time_stamp;
  863. u32 code;
  864. union megasas_evt_class_locale cl;
  865. u8 arg_type;
  866. u8 reserved1[15];
  867. union {
  868. struct {
  869. struct megasas_evtarg_pd pd;
  870. u8 cdb_length;
  871. u8 sense_length;
  872. u8 reserved[2];
  873. u8 cdb[16];
  874. u8 sense[64];
  875. } __attribute__ ((packed)) cdbSense;
  876. struct megasas_evtarg_ld ld;
  877. struct {
  878. struct megasas_evtarg_ld ld;
  879. u64 count;
  880. } __attribute__ ((packed)) ld_count;
  881. struct {
  882. u64 lba;
  883. struct megasas_evtarg_ld ld;
  884. } __attribute__ ((packed)) ld_lba;
  885. struct {
  886. struct megasas_evtarg_ld ld;
  887. u32 prevOwner;
  888. u32 newOwner;
  889. } __attribute__ ((packed)) ld_owner;
  890. struct {
  891. u64 ld_lba;
  892. u64 pd_lba;
  893. struct megasas_evtarg_ld ld;
  894. struct megasas_evtarg_pd pd;
  895. } __attribute__ ((packed)) ld_lba_pd_lba;
  896. struct {
  897. struct megasas_evtarg_ld ld;
  898. struct megasas_progress prog;
  899. } __attribute__ ((packed)) ld_prog;
  900. struct {
  901. struct megasas_evtarg_ld ld;
  902. u32 prev_state;
  903. u32 new_state;
  904. } __attribute__ ((packed)) ld_state;
  905. struct {
  906. u64 strip;
  907. struct megasas_evtarg_ld ld;
  908. } __attribute__ ((packed)) ld_strip;
  909. struct megasas_evtarg_pd pd;
  910. struct {
  911. struct megasas_evtarg_pd pd;
  912. u32 err;
  913. } __attribute__ ((packed)) pd_err;
  914. struct {
  915. u64 lba;
  916. struct megasas_evtarg_pd pd;
  917. } __attribute__ ((packed)) pd_lba;
  918. struct {
  919. u64 lba;
  920. struct megasas_evtarg_pd pd;
  921. struct megasas_evtarg_ld ld;
  922. } __attribute__ ((packed)) pd_lba_ld;
  923. struct {
  924. struct megasas_evtarg_pd pd;
  925. struct megasas_progress prog;
  926. } __attribute__ ((packed)) pd_prog;
  927. struct {
  928. struct megasas_evtarg_pd pd;
  929. u32 prevState;
  930. u32 newState;
  931. } __attribute__ ((packed)) pd_state;
  932. struct {
  933. u16 vendorId;
  934. u16 deviceId;
  935. u16 subVendorId;
  936. u16 subDeviceId;
  937. } __attribute__ ((packed)) pci;
  938. u32 rate;
  939. char str[96];
  940. struct {
  941. u32 rtc;
  942. u32 elapsedSeconds;
  943. } __attribute__ ((packed)) time;
  944. struct {
  945. u32 ecar;
  946. u32 elog;
  947. char str[64];
  948. } __attribute__ ((packed)) ecc;
  949. u8 b[96];
  950. u16 s[48];
  951. u32 w[24];
  952. u64 d[12];
  953. } args;
  954. char description[128];
  955. } __attribute__ ((packed));
  956. struct megasas_aen_event {
  957. struct work_struct hotplug_work;
  958. struct megasas_instance *instance;
  959. };
  960. struct megasas_instance {
  961. u32 *producer;
  962. dma_addr_t producer_h;
  963. u32 *consumer;
  964. dma_addr_t consumer_h;
  965. u32 *reply_queue;
  966. dma_addr_t reply_queue_h;
  967. unsigned long base_addr;
  968. struct megasas_register_set __iomem *reg_set;
  969. struct megasas_pd_list pd_list[MEGASAS_MAX_PD];
  970. u8 ld_ids[MEGASAS_MAX_LD_IDS];
  971. s8 init_id;
  972. u16 max_num_sge;
  973. u16 max_fw_cmds;
  974. u32 max_sectors_per_req;
  975. struct megasas_aen_event *ev;
  976. struct megasas_cmd **cmd_list;
  977. struct list_head cmd_pool;
  978. spinlock_t cmd_pool_lock;
  979. /* used to synch producer, consumer ptrs in dpc */
  980. spinlock_t completion_lock;
  981. /* used to sync fire the cmd to fw */
  982. spinlock_t fire_lock;
  983. struct dma_pool *frame_dma_pool;
  984. struct dma_pool *sense_dma_pool;
  985. struct megasas_evt_detail *evt_detail;
  986. dma_addr_t evt_detail_h;
  987. struct megasas_cmd *aen_cmd;
  988. struct mutex aen_mutex;
  989. struct semaphore ioctl_sem;
  990. struct Scsi_Host *host;
  991. wait_queue_head_t int_cmd_wait_q;
  992. wait_queue_head_t abort_cmd_wait_q;
  993. struct pci_dev *pdev;
  994. u32 unique_id;
  995. atomic_t fw_outstanding;
  996. u32 hw_crit_error;
  997. struct megasas_instance_template *instancet;
  998. struct tasklet_struct isr_tasklet;
  999. u8 flag;
  1000. u8 unload;
  1001. u8 flag_ieee;
  1002. unsigned long last_time;
  1003. struct timer_list io_completion_timer;
  1004. };
  1005. struct megasas_instance_template {
  1006. void (*fire_cmd)(struct megasas_instance *, dma_addr_t, \
  1007. u32, struct megasas_register_set __iomem *);
  1008. void (*enable_intr)(struct megasas_register_set __iomem *) ;
  1009. void (*disable_intr)(struct megasas_register_set __iomem *);
  1010. int (*clear_intr)(struct megasas_register_set __iomem *);
  1011. u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *);
  1012. };
  1013. #define MEGASAS_IS_LOGICAL(scp) \
  1014. (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1
  1015. #define MEGASAS_DEV_INDEX(inst, scp) \
  1016. ((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \
  1017. scp->device->id
  1018. struct megasas_cmd {
  1019. union megasas_frame *frame;
  1020. dma_addr_t frame_phys_addr;
  1021. u8 *sense;
  1022. dma_addr_t sense_phys_addr;
  1023. u32 index;
  1024. u8 sync_cmd;
  1025. u8 cmd_status;
  1026. u16 abort_aen;
  1027. struct list_head list;
  1028. struct scsi_cmnd *scmd;
  1029. struct megasas_instance *instance;
  1030. u32 frame_count;
  1031. };
  1032. #define MAX_MGMT_ADAPTERS 1024
  1033. #define MAX_IOCTL_SGE 16
  1034. struct megasas_iocpacket {
  1035. u16 host_no;
  1036. u16 __pad1;
  1037. u32 sgl_off;
  1038. u32 sge_count;
  1039. u32 sense_off;
  1040. u32 sense_len;
  1041. union {
  1042. u8 raw[128];
  1043. struct megasas_header hdr;
  1044. } frame;
  1045. struct iovec sgl[MAX_IOCTL_SGE];
  1046. } __attribute__ ((packed));
  1047. struct megasas_aen {
  1048. u16 host_no;
  1049. u16 __pad1;
  1050. u32 seq_num;
  1051. u32 class_locale_word;
  1052. } __attribute__ ((packed));
  1053. #ifdef CONFIG_COMPAT
  1054. struct compat_megasas_iocpacket {
  1055. u16 host_no;
  1056. u16 __pad1;
  1057. u32 sgl_off;
  1058. u32 sge_count;
  1059. u32 sense_off;
  1060. u32 sense_len;
  1061. union {
  1062. u8 raw[128];
  1063. struct megasas_header hdr;
  1064. } frame;
  1065. struct compat_iovec sgl[MAX_IOCTL_SGE];
  1066. } __attribute__ ((packed));
  1067. #define MEGASAS_IOC_FIRMWARE32 _IOWR('M', 1, struct compat_megasas_iocpacket)
  1068. #endif
  1069. #define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket)
  1070. #define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen)
  1071. struct megasas_mgmt_info {
  1072. u16 count;
  1073. struct megasas_instance *instance[MAX_MGMT_ADAPTERS];
  1074. int max_index;
  1075. };
  1076. #endif /*LSI_MEGARAID_SAS_H */