megaraid_sas.h 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384
  1. /*
  2. * Linux MegaRAID driver for SAS based RAID controllers
  3. *
  4. * Copyright (c) 2003-2013 LSI Corporation
  5. * Copyright (c) 2013-2014 Avago Technologies
  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 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. * FILE: megaraid_sas.h
  21. *
  22. * Authors: Avago Technologies
  23. * Kashyap Desai <kashyap.desai@avagotech.com>
  24. * Sumit Saxena <sumit.saxena@avagotech.com>
  25. *
  26. * Send feedback to: megaraidlinux.pdl@avagotech.com
  27. *
  28. * Mail to: Avago Technologies, 350 West Trimble Road, Building 90,
  29. * San Jose, California 95131
  30. */
  31. #ifndef LSI_MEGARAID_SAS_H
  32. #define LSI_MEGARAID_SAS_H
  33. /*
  34. * MegaRAID SAS Driver meta data
  35. */
  36. #define MEGASAS_VERSION "06.811.02.00-rc1"
  37. #define MEGASAS_RELDATE "April 12, 2016"
  38. /*
  39. * Device IDs
  40. */
  41. #define PCI_DEVICE_ID_LSI_SAS1078R 0x0060
  42. #define PCI_DEVICE_ID_LSI_SAS1078DE 0x007C
  43. #define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413
  44. #define PCI_DEVICE_ID_LSI_SAS1078GEN2 0x0078
  45. #define PCI_DEVICE_ID_LSI_SAS0079GEN2 0x0079
  46. #define PCI_DEVICE_ID_LSI_SAS0073SKINNY 0x0073
  47. #define PCI_DEVICE_ID_LSI_SAS0071SKINNY 0x0071
  48. #define PCI_DEVICE_ID_LSI_FUSION 0x005b
  49. #define PCI_DEVICE_ID_LSI_PLASMA 0x002f
  50. #define PCI_DEVICE_ID_LSI_INVADER 0x005d
  51. #define PCI_DEVICE_ID_LSI_FURY 0x005f
  52. #define PCI_DEVICE_ID_LSI_INTRUDER 0x00ce
  53. #define PCI_DEVICE_ID_LSI_INTRUDER_24 0x00cf
  54. #define PCI_DEVICE_ID_LSI_CUTLASS_52 0x0052
  55. #define PCI_DEVICE_ID_LSI_CUTLASS_53 0x0053
  56. /*
  57. * Intel HBA SSDIDs
  58. */
  59. #define MEGARAID_INTEL_RS3DC080_SSDID 0x9360
  60. #define MEGARAID_INTEL_RS3DC040_SSDID 0x9362
  61. #define MEGARAID_INTEL_RS3SC008_SSDID 0x9380
  62. #define MEGARAID_INTEL_RS3MC044_SSDID 0x9381
  63. #define MEGARAID_INTEL_RS3WC080_SSDID 0x9341
  64. #define MEGARAID_INTEL_RS3WC040_SSDID 0x9343
  65. #define MEGARAID_INTEL_RMS3BC160_SSDID 0x352B
  66. /*
  67. * Intruder HBA SSDIDs
  68. */
  69. #define MEGARAID_INTRUDER_SSDID1 0x9371
  70. #define MEGARAID_INTRUDER_SSDID2 0x9390
  71. #define MEGARAID_INTRUDER_SSDID3 0x9370
  72. /*
  73. * Intel HBA branding
  74. */
  75. #define MEGARAID_INTEL_RS3DC080_BRANDING \
  76. "Intel(R) RAID Controller RS3DC080"
  77. #define MEGARAID_INTEL_RS3DC040_BRANDING \
  78. "Intel(R) RAID Controller RS3DC040"
  79. #define MEGARAID_INTEL_RS3SC008_BRANDING \
  80. "Intel(R) RAID Controller RS3SC008"
  81. #define MEGARAID_INTEL_RS3MC044_BRANDING \
  82. "Intel(R) RAID Controller RS3MC044"
  83. #define MEGARAID_INTEL_RS3WC080_BRANDING \
  84. "Intel(R) RAID Controller RS3WC080"
  85. #define MEGARAID_INTEL_RS3WC040_BRANDING \
  86. "Intel(R) RAID Controller RS3WC040"
  87. #define MEGARAID_INTEL_RMS3BC160_BRANDING \
  88. "Intel(R) Integrated RAID Module RMS3BC160"
  89. /*
  90. * =====================================
  91. * MegaRAID SAS MFI firmware definitions
  92. * =====================================
  93. */
  94. /*
  95. * MFI stands for MegaRAID SAS FW Interface. This is just a moniker for
  96. * protocol between the software and firmware. Commands are issued using
  97. * "message frames"
  98. */
  99. /*
  100. * FW posts its state in upper 4 bits of outbound_msg_0 register
  101. */
  102. #define MFI_STATE_MASK 0xF0000000
  103. #define MFI_STATE_UNDEFINED 0x00000000
  104. #define MFI_STATE_BB_INIT 0x10000000
  105. #define MFI_STATE_FW_INIT 0x40000000
  106. #define MFI_STATE_WAIT_HANDSHAKE 0x60000000
  107. #define MFI_STATE_FW_INIT_2 0x70000000
  108. #define MFI_STATE_DEVICE_SCAN 0x80000000
  109. #define MFI_STATE_BOOT_MESSAGE_PENDING 0x90000000
  110. #define MFI_STATE_FLUSH_CACHE 0xA0000000
  111. #define MFI_STATE_READY 0xB0000000
  112. #define MFI_STATE_OPERATIONAL 0xC0000000
  113. #define MFI_STATE_FAULT 0xF0000000
  114. #define MFI_STATE_FORCE_OCR 0x00000080
  115. #define MFI_STATE_DMADONE 0x00000008
  116. #define MFI_STATE_CRASH_DUMP_DONE 0x00000004
  117. #define MFI_RESET_REQUIRED 0x00000001
  118. #define MFI_RESET_ADAPTER 0x00000002
  119. #define MEGAMFI_FRAME_SIZE 64
  120. /*
  121. * During FW init, clear pending cmds & reset state using inbound_msg_0
  122. *
  123. * ABORT : Abort all pending cmds
  124. * READY : Move from OPERATIONAL to READY state; discard queue info
  125. * MFIMODE : Discard (possible) low MFA posted in 64-bit mode (??)
  126. * CLR_HANDSHAKE: FW is waiting for HANDSHAKE from BIOS or Driver
  127. * HOTPLUG : Resume from Hotplug
  128. * MFI_STOP_ADP : Send signal to FW to stop processing
  129. */
  130. #define WRITE_SEQUENCE_OFFSET (0x0000000FC) /* I20 */
  131. #define HOST_DIAGNOSTIC_OFFSET (0x000000F8) /* I20 */
  132. #define DIAG_WRITE_ENABLE (0x00000080)
  133. #define DIAG_RESET_ADAPTER (0x00000004)
  134. #define MFI_ADP_RESET 0x00000040
  135. #define MFI_INIT_ABORT 0x00000001
  136. #define MFI_INIT_READY 0x00000002
  137. #define MFI_INIT_MFIMODE 0x00000004
  138. #define MFI_INIT_CLEAR_HANDSHAKE 0x00000008
  139. #define MFI_INIT_HOTPLUG 0x00000010
  140. #define MFI_STOP_ADP 0x00000020
  141. #define MFI_RESET_FLAGS MFI_INIT_READY| \
  142. MFI_INIT_MFIMODE| \
  143. MFI_INIT_ABORT
  144. #define MPI2_IOCINIT_MSGFLAG_RDPQ_ARRAY_MODE (0x01)
  145. /*
  146. * MFI frame flags
  147. */
  148. #define MFI_FRAME_POST_IN_REPLY_QUEUE 0x0000
  149. #define MFI_FRAME_DONT_POST_IN_REPLY_QUEUE 0x0001
  150. #define MFI_FRAME_SGL32 0x0000
  151. #define MFI_FRAME_SGL64 0x0002
  152. #define MFI_FRAME_SENSE32 0x0000
  153. #define MFI_FRAME_SENSE64 0x0004
  154. #define MFI_FRAME_DIR_NONE 0x0000
  155. #define MFI_FRAME_DIR_WRITE 0x0008
  156. #define MFI_FRAME_DIR_READ 0x0010
  157. #define MFI_FRAME_DIR_BOTH 0x0018
  158. #define MFI_FRAME_IEEE 0x0020
  159. /* Driver internal */
  160. #define DRV_DCMD_POLLED_MODE 0x1
  161. #define DRV_DCMD_SKIP_REFIRE 0x2
  162. /*
  163. * Definition for cmd_status
  164. */
  165. #define MFI_CMD_STATUS_POLL_MODE 0xFF
  166. /*
  167. * MFI command opcodes
  168. */
  169. #define MFI_CMD_INIT 0x00
  170. #define MFI_CMD_LD_READ 0x01
  171. #define MFI_CMD_LD_WRITE 0x02
  172. #define MFI_CMD_LD_SCSI_IO 0x03
  173. #define MFI_CMD_PD_SCSI_IO 0x04
  174. #define MFI_CMD_DCMD 0x05
  175. #define MFI_CMD_ABORT 0x06
  176. #define MFI_CMD_SMP 0x07
  177. #define MFI_CMD_STP 0x08
  178. #define MFI_CMD_INVALID 0xff
  179. #define MR_DCMD_CTRL_GET_INFO 0x01010000
  180. #define MR_DCMD_LD_GET_LIST 0x03010000
  181. #define MR_DCMD_LD_LIST_QUERY 0x03010100
  182. #define MR_DCMD_CTRL_CACHE_FLUSH 0x01101000
  183. #define MR_FLUSH_CTRL_CACHE 0x01
  184. #define MR_FLUSH_DISK_CACHE 0x02
  185. #define MR_DCMD_CTRL_SHUTDOWN 0x01050000
  186. #define MR_DCMD_HIBERNATE_SHUTDOWN 0x01060000
  187. #define MR_ENABLE_DRIVE_SPINDOWN 0x01
  188. #define MR_DCMD_CTRL_EVENT_GET_INFO 0x01040100
  189. #define MR_DCMD_CTRL_EVENT_GET 0x01040300
  190. #define MR_DCMD_CTRL_EVENT_WAIT 0x01040500
  191. #define MR_DCMD_LD_GET_PROPERTIES 0x03030000
  192. #define MR_DCMD_CLUSTER 0x08000000
  193. #define MR_DCMD_CLUSTER_RESET_ALL 0x08010100
  194. #define MR_DCMD_CLUSTER_RESET_LD 0x08010200
  195. #define MR_DCMD_PD_LIST_QUERY 0x02010100
  196. #define MR_DCMD_CTRL_SET_CRASH_DUMP_PARAMS 0x01190100
  197. #define MR_DRIVER_SET_APP_CRASHDUMP_MODE (0xF0010000 | 0x0600)
  198. #define MR_DCMD_PD_GET_INFO 0x02020000
  199. /*
  200. * Global functions
  201. */
  202. extern u8 MR_ValidateMapInfo(struct megasas_instance *instance);
  203. /*
  204. * MFI command completion codes
  205. */
  206. enum MFI_STAT {
  207. MFI_STAT_OK = 0x00,
  208. MFI_STAT_INVALID_CMD = 0x01,
  209. MFI_STAT_INVALID_DCMD = 0x02,
  210. MFI_STAT_INVALID_PARAMETER = 0x03,
  211. MFI_STAT_INVALID_SEQUENCE_NUMBER = 0x04,
  212. MFI_STAT_ABORT_NOT_POSSIBLE = 0x05,
  213. MFI_STAT_APP_HOST_CODE_NOT_FOUND = 0x06,
  214. MFI_STAT_APP_IN_USE = 0x07,
  215. MFI_STAT_APP_NOT_INITIALIZED = 0x08,
  216. MFI_STAT_ARRAY_INDEX_INVALID = 0x09,
  217. MFI_STAT_ARRAY_ROW_NOT_EMPTY = 0x0a,
  218. MFI_STAT_CONFIG_RESOURCE_CONFLICT = 0x0b,
  219. MFI_STAT_DEVICE_NOT_FOUND = 0x0c,
  220. MFI_STAT_DRIVE_TOO_SMALL = 0x0d,
  221. MFI_STAT_FLASH_ALLOC_FAIL = 0x0e,
  222. MFI_STAT_FLASH_BUSY = 0x0f,
  223. MFI_STAT_FLASH_ERROR = 0x10,
  224. MFI_STAT_FLASH_IMAGE_BAD = 0x11,
  225. MFI_STAT_FLASH_IMAGE_INCOMPLETE = 0x12,
  226. MFI_STAT_FLASH_NOT_OPEN = 0x13,
  227. MFI_STAT_FLASH_NOT_STARTED = 0x14,
  228. MFI_STAT_FLUSH_FAILED = 0x15,
  229. MFI_STAT_HOST_CODE_NOT_FOUNT = 0x16,
  230. MFI_STAT_LD_CC_IN_PROGRESS = 0x17,
  231. MFI_STAT_LD_INIT_IN_PROGRESS = 0x18,
  232. MFI_STAT_LD_LBA_OUT_OF_RANGE = 0x19,
  233. MFI_STAT_LD_MAX_CONFIGURED = 0x1a,
  234. MFI_STAT_LD_NOT_OPTIMAL = 0x1b,
  235. MFI_STAT_LD_RBLD_IN_PROGRESS = 0x1c,
  236. MFI_STAT_LD_RECON_IN_PROGRESS = 0x1d,
  237. MFI_STAT_LD_WRONG_RAID_LEVEL = 0x1e,
  238. MFI_STAT_MAX_SPARES_EXCEEDED = 0x1f,
  239. MFI_STAT_MEMORY_NOT_AVAILABLE = 0x20,
  240. MFI_STAT_MFC_HW_ERROR = 0x21,
  241. MFI_STAT_NO_HW_PRESENT = 0x22,
  242. MFI_STAT_NOT_FOUND = 0x23,
  243. MFI_STAT_NOT_IN_ENCL = 0x24,
  244. MFI_STAT_PD_CLEAR_IN_PROGRESS = 0x25,
  245. MFI_STAT_PD_TYPE_WRONG = 0x26,
  246. MFI_STAT_PR_DISABLED = 0x27,
  247. MFI_STAT_ROW_INDEX_INVALID = 0x28,
  248. MFI_STAT_SAS_CONFIG_INVALID_ACTION = 0x29,
  249. MFI_STAT_SAS_CONFIG_INVALID_DATA = 0x2a,
  250. MFI_STAT_SAS_CONFIG_INVALID_PAGE = 0x2b,
  251. MFI_STAT_SAS_CONFIG_INVALID_TYPE = 0x2c,
  252. MFI_STAT_SCSI_DONE_WITH_ERROR = 0x2d,
  253. MFI_STAT_SCSI_IO_FAILED = 0x2e,
  254. MFI_STAT_SCSI_RESERVATION_CONFLICT = 0x2f,
  255. MFI_STAT_SHUTDOWN_FAILED = 0x30,
  256. MFI_STAT_TIME_NOT_SET = 0x31,
  257. MFI_STAT_WRONG_STATE = 0x32,
  258. MFI_STAT_LD_OFFLINE = 0x33,
  259. MFI_STAT_PEER_NOTIFICATION_REJECTED = 0x34,
  260. MFI_STAT_PEER_NOTIFICATION_FAILED = 0x35,
  261. MFI_STAT_RESERVATION_IN_PROGRESS = 0x36,
  262. MFI_STAT_I2C_ERRORS_DETECTED = 0x37,
  263. MFI_STAT_PCI_ERRORS_DETECTED = 0x38,
  264. MFI_STAT_CONFIG_SEQ_MISMATCH = 0x67,
  265. MFI_STAT_INVALID_STATUS = 0xFF
  266. };
  267. enum mfi_evt_class {
  268. MFI_EVT_CLASS_DEBUG = -2,
  269. MFI_EVT_CLASS_PROGRESS = -1,
  270. MFI_EVT_CLASS_INFO = 0,
  271. MFI_EVT_CLASS_WARNING = 1,
  272. MFI_EVT_CLASS_CRITICAL = 2,
  273. MFI_EVT_CLASS_FATAL = 3,
  274. MFI_EVT_CLASS_DEAD = 4
  275. };
  276. /*
  277. * Crash dump related defines
  278. */
  279. #define MAX_CRASH_DUMP_SIZE 512
  280. #define CRASH_DMA_BUF_SIZE (1024 * 1024)
  281. enum MR_FW_CRASH_DUMP_STATE {
  282. UNAVAILABLE = 0,
  283. AVAILABLE = 1,
  284. COPYING = 2,
  285. COPIED = 3,
  286. COPY_ERROR = 4,
  287. };
  288. enum _MR_CRASH_BUF_STATUS {
  289. MR_CRASH_BUF_TURN_OFF = 0,
  290. MR_CRASH_BUF_TURN_ON = 1,
  291. };
  292. /*
  293. * Number of mailbox bytes in DCMD message frame
  294. */
  295. #define MFI_MBOX_SIZE 12
  296. enum MR_EVT_CLASS {
  297. MR_EVT_CLASS_DEBUG = -2,
  298. MR_EVT_CLASS_PROGRESS = -1,
  299. MR_EVT_CLASS_INFO = 0,
  300. MR_EVT_CLASS_WARNING = 1,
  301. MR_EVT_CLASS_CRITICAL = 2,
  302. MR_EVT_CLASS_FATAL = 3,
  303. MR_EVT_CLASS_DEAD = 4,
  304. };
  305. enum MR_EVT_LOCALE {
  306. MR_EVT_LOCALE_LD = 0x0001,
  307. MR_EVT_LOCALE_PD = 0x0002,
  308. MR_EVT_LOCALE_ENCL = 0x0004,
  309. MR_EVT_LOCALE_BBU = 0x0008,
  310. MR_EVT_LOCALE_SAS = 0x0010,
  311. MR_EVT_LOCALE_CTRL = 0x0020,
  312. MR_EVT_LOCALE_CONFIG = 0x0040,
  313. MR_EVT_LOCALE_CLUSTER = 0x0080,
  314. MR_EVT_LOCALE_ALL = 0xffff,
  315. };
  316. enum MR_EVT_ARGS {
  317. MR_EVT_ARGS_NONE,
  318. MR_EVT_ARGS_CDB_SENSE,
  319. MR_EVT_ARGS_LD,
  320. MR_EVT_ARGS_LD_COUNT,
  321. MR_EVT_ARGS_LD_LBA,
  322. MR_EVT_ARGS_LD_OWNER,
  323. MR_EVT_ARGS_LD_LBA_PD_LBA,
  324. MR_EVT_ARGS_LD_PROG,
  325. MR_EVT_ARGS_LD_STATE,
  326. MR_EVT_ARGS_LD_STRIP,
  327. MR_EVT_ARGS_PD,
  328. MR_EVT_ARGS_PD_ERR,
  329. MR_EVT_ARGS_PD_LBA,
  330. MR_EVT_ARGS_PD_LBA_LD,
  331. MR_EVT_ARGS_PD_PROG,
  332. MR_EVT_ARGS_PD_STATE,
  333. MR_EVT_ARGS_PCI,
  334. MR_EVT_ARGS_RATE,
  335. MR_EVT_ARGS_STR,
  336. MR_EVT_ARGS_TIME,
  337. MR_EVT_ARGS_ECC,
  338. MR_EVT_ARGS_LD_PROP,
  339. MR_EVT_ARGS_PD_SPARE,
  340. MR_EVT_ARGS_PD_INDEX,
  341. MR_EVT_ARGS_DIAG_PASS,
  342. MR_EVT_ARGS_DIAG_FAIL,
  343. MR_EVT_ARGS_PD_LBA_LBA,
  344. MR_EVT_ARGS_PORT_PHY,
  345. MR_EVT_ARGS_PD_MISSING,
  346. MR_EVT_ARGS_PD_ADDRESS,
  347. MR_EVT_ARGS_BITMAP,
  348. MR_EVT_ARGS_CONNECTOR,
  349. MR_EVT_ARGS_PD_PD,
  350. MR_EVT_ARGS_PD_FRU,
  351. MR_EVT_ARGS_PD_PATHINFO,
  352. MR_EVT_ARGS_PD_POWER_STATE,
  353. MR_EVT_ARGS_GENERIC,
  354. };
  355. #define SGE_BUFFER_SIZE 4096
  356. #define MEGASAS_CLUSTER_ID_SIZE 16
  357. /*
  358. * define constants for device list query options
  359. */
  360. enum MR_PD_QUERY_TYPE {
  361. MR_PD_QUERY_TYPE_ALL = 0,
  362. MR_PD_QUERY_TYPE_STATE = 1,
  363. MR_PD_QUERY_TYPE_POWER_STATE = 2,
  364. MR_PD_QUERY_TYPE_MEDIA_TYPE = 3,
  365. MR_PD_QUERY_TYPE_SPEED = 4,
  366. MR_PD_QUERY_TYPE_EXPOSED_TO_HOST = 5,
  367. };
  368. enum MR_LD_QUERY_TYPE {
  369. MR_LD_QUERY_TYPE_ALL = 0,
  370. MR_LD_QUERY_TYPE_EXPOSED_TO_HOST = 1,
  371. MR_LD_QUERY_TYPE_USED_TGT_IDS = 2,
  372. MR_LD_QUERY_TYPE_CLUSTER_ACCESS = 3,
  373. MR_LD_QUERY_TYPE_CLUSTER_LOCALE = 4,
  374. };
  375. #define MR_EVT_CFG_CLEARED 0x0004
  376. #define MR_EVT_LD_STATE_CHANGE 0x0051
  377. #define MR_EVT_PD_INSERTED 0x005b
  378. #define MR_EVT_PD_REMOVED 0x0070
  379. #define MR_EVT_LD_CREATED 0x008a
  380. #define MR_EVT_LD_DELETED 0x008b
  381. #define MR_EVT_FOREIGN_CFG_IMPORTED 0x00db
  382. #define MR_EVT_LD_OFFLINE 0x00fc
  383. #define MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED 0x0152
  384. #define MR_EVT_CTRL_PROP_CHANGED 0x012f
  385. enum MR_PD_STATE {
  386. MR_PD_STATE_UNCONFIGURED_GOOD = 0x00,
  387. MR_PD_STATE_UNCONFIGURED_BAD = 0x01,
  388. MR_PD_STATE_HOT_SPARE = 0x02,
  389. MR_PD_STATE_OFFLINE = 0x10,
  390. MR_PD_STATE_FAILED = 0x11,
  391. MR_PD_STATE_REBUILD = 0x14,
  392. MR_PD_STATE_ONLINE = 0x18,
  393. MR_PD_STATE_COPYBACK = 0x20,
  394. MR_PD_STATE_SYSTEM = 0x40,
  395. };
  396. union MR_PD_REF {
  397. struct {
  398. u16 deviceId;
  399. u16 seqNum;
  400. } mrPdRef;
  401. u32 ref;
  402. };
  403. /*
  404. * define the DDF Type bit structure
  405. */
  406. union MR_PD_DDF_TYPE {
  407. struct {
  408. union {
  409. struct {
  410. #ifndef __BIG_ENDIAN_BITFIELD
  411. u16 forcedPDGUID:1;
  412. u16 inVD:1;
  413. u16 isGlobalSpare:1;
  414. u16 isSpare:1;
  415. u16 isForeign:1;
  416. u16 reserved:7;
  417. u16 intf:4;
  418. #else
  419. u16 intf:4;
  420. u16 reserved:7;
  421. u16 isForeign:1;
  422. u16 isSpare:1;
  423. u16 isGlobalSpare:1;
  424. u16 inVD:1;
  425. u16 forcedPDGUID:1;
  426. #endif
  427. } pdType;
  428. u16 type;
  429. };
  430. u16 reserved;
  431. } ddf;
  432. struct {
  433. u32 reserved;
  434. } nonDisk;
  435. u32 type;
  436. } __packed;
  437. /*
  438. * defines the progress structure
  439. */
  440. union MR_PROGRESS {
  441. struct {
  442. u16 progress;
  443. union {
  444. u16 elapsedSecs;
  445. u16 elapsedSecsForLastPercent;
  446. };
  447. } mrProgress;
  448. u32 w;
  449. } __packed;
  450. /*
  451. * defines the physical drive progress structure
  452. */
  453. struct MR_PD_PROGRESS {
  454. struct {
  455. #ifndef MFI_BIG_ENDIAN
  456. u32 rbld:1;
  457. u32 patrol:1;
  458. u32 clear:1;
  459. u32 copyBack:1;
  460. u32 erase:1;
  461. u32 locate:1;
  462. u32 reserved:26;
  463. #else
  464. u32 reserved:26;
  465. u32 locate:1;
  466. u32 erase:1;
  467. u32 copyBack:1;
  468. u32 clear:1;
  469. u32 patrol:1;
  470. u32 rbld:1;
  471. #endif
  472. } active;
  473. union MR_PROGRESS rbld;
  474. union MR_PROGRESS patrol;
  475. union {
  476. union MR_PROGRESS clear;
  477. union MR_PROGRESS erase;
  478. };
  479. struct {
  480. #ifndef MFI_BIG_ENDIAN
  481. u32 rbld:1;
  482. u32 patrol:1;
  483. u32 clear:1;
  484. u32 copyBack:1;
  485. u32 erase:1;
  486. u32 reserved:27;
  487. #else
  488. u32 reserved:27;
  489. u32 erase:1;
  490. u32 copyBack:1;
  491. u32 clear:1;
  492. u32 patrol:1;
  493. u32 rbld:1;
  494. #endif
  495. } pause;
  496. union MR_PROGRESS reserved[3];
  497. } __packed;
  498. struct MR_PD_INFO {
  499. union MR_PD_REF ref;
  500. u8 inquiryData[96];
  501. u8 vpdPage83[64];
  502. u8 notSupported;
  503. u8 scsiDevType;
  504. union {
  505. u8 connectedPortBitmap;
  506. u8 connectedPortNumbers;
  507. };
  508. u8 deviceSpeed;
  509. u32 mediaErrCount;
  510. u32 otherErrCount;
  511. u32 predFailCount;
  512. u32 lastPredFailEventSeqNum;
  513. u16 fwState;
  514. u8 disabledForRemoval;
  515. u8 linkSpeed;
  516. union MR_PD_DDF_TYPE state;
  517. struct {
  518. u8 count;
  519. #ifndef __BIG_ENDIAN_BITFIELD
  520. u8 isPathBroken:4;
  521. u8 reserved3:3;
  522. u8 widePortCapable:1;
  523. #else
  524. u8 widePortCapable:1;
  525. u8 reserved3:3;
  526. u8 isPathBroken:4;
  527. #endif
  528. u8 connectorIndex[2];
  529. u8 reserved[4];
  530. u64 sasAddr[2];
  531. u8 reserved2[16];
  532. } pathInfo;
  533. u64 rawSize;
  534. u64 nonCoercedSize;
  535. u64 coercedSize;
  536. u16 enclDeviceId;
  537. u8 enclIndex;
  538. union {
  539. u8 slotNumber;
  540. u8 enclConnectorIndex;
  541. };
  542. struct MR_PD_PROGRESS progInfo;
  543. u8 badBlockTableFull;
  544. u8 unusableInCurrentConfig;
  545. u8 vpdPage83Ext[64];
  546. u8 powerState;
  547. u8 enclPosition;
  548. u32 allowedOps;
  549. u16 copyBackPartnerId;
  550. u16 enclPartnerDeviceId;
  551. struct {
  552. #ifndef __BIG_ENDIAN_BITFIELD
  553. u16 fdeCapable:1;
  554. u16 fdeEnabled:1;
  555. u16 secured:1;
  556. u16 locked:1;
  557. u16 foreign:1;
  558. u16 needsEKM:1;
  559. u16 reserved:10;
  560. #else
  561. u16 reserved:10;
  562. u16 needsEKM:1;
  563. u16 foreign:1;
  564. u16 locked:1;
  565. u16 secured:1;
  566. u16 fdeEnabled:1;
  567. u16 fdeCapable:1;
  568. #endif
  569. } security;
  570. u8 mediaType;
  571. u8 notCertified;
  572. u8 bridgeVendor[8];
  573. u8 bridgeProductIdentification[16];
  574. u8 bridgeProductRevisionLevel[4];
  575. u8 satBridgeExists;
  576. u8 interfaceType;
  577. u8 temperature;
  578. u8 emulatedBlockSize;
  579. u16 userDataBlockSize;
  580. u16 reserved2;
  581. struct {
  582. #ifndef __BIG_ENDIAN_BITFIELD
  583. u32 piType:3;
  584. u32 piFormatted:1;
  585. u32 piEligible:1;
  586. u32 NCQ:1;
  587. u32 WCE:1;
  588. u32 commissionedSpare:1;
  589. u32 emergencySpare:1;
  590. u32 ineligibleForSSCD:1;
  591. u32 ineligibleForLd:1;
  592. u32 useSSEraseType:1;
  593. u32 wceUnchanged:1;
  594. u32 supportScsiUnmap:1;
  595. u32 reserved:18;
  596. #else
  597. u32 reserved:18;
  598. u32 supportScsiUnmap:1;
  599. u32 wceUnchanged:1;
  600. u32 useSSEraseType:1;
  601. u32 ineligibleForLd:1;
  602. u32 ineligibleForSSCD:1;
  603. u32 emergencySpare:1;
  604. u32 commissionedSpare:1;
  605. u32 WCE:1;
  606. u32 NCQ:1;
  607. u32 piEligible:1;
  608. u32 piFormatted:1;
  609. u32 piType:3;
  610. #endif
  611. } properties;
  612. u64 shieldDiagCompletionTime;
  613. u8 shieldCounter;
  614. u8 linkSpeedOther;
  615. u8 reserved4[2];
  616. struct {
  617. #ifndef __BIG_ENDIAN_BITFIELD
  618. u32 bbmErrCountSupported:1;
  619. u32 bbmErrCount:31;
  620. #else
  621. u32 bbmErrCount:31;
  622. u32 bbmErrCountSupported:1;
  623. #endif
  624. } bbmErr;
  625. u8 reserved1[512-428];
  626. } __packed;
  627. /*
  628. * defines the physical drive address structure
  629. */
  630. struct MR_PD_ADDRESS {
  631. __le16 deviceId;
  632. u16 enclDeviceId;
  633. union {
  634. struct {
  635. u8 enclIndex;
  636. u8 slotNumber;
  637. } mrPdAddress;
  638. struct {
  639. u8 enclPosition;
  640. u8 enclConnectorIndex;
  641. } mrEnclAddress;
  642. };
  643. u8 scsiDevType;
  644. union {
  645. u8 connectedPortBitmap;
  646. u8 connectedPortNumbers;
  647. };
  648. u64 sasAddr[2];
  649. } __packed;
  650. /*
  651. * defines the physical drive list structure
  652. */
  653. struct MR_PD_LIST {
  654. __le32 size;
  655. __le32 count;
  656. struct MR_PD_ADDRESS addr[1];
  657. } __packed;
  658. struct megasas_pd_list {
  659. u16 tid;
  660. u8 driveType;
  661. u8 driveState;
  662. u8 interface;
  663. } __packed;
  664. /*
  665. * defines the logical drive reference structure
  666. */
  667. union MR_LD_REF {
  668. struct {
  669. u8 targetId;
  670. u8 reserved;
  671. __le16 seqNum;
  672. };
  673. __le32 ref;
  674. } __packed;
  675. /*
  676. * defines the logical drive list structure
  677. */
  678. struct MR_LD_LIST {
  679. __le32 ldCount;
  680. __le32 reserved;
  681. struct {
  682. union MR_LD_REF ref;
  683. u8 state;
  684. u8 reserved[3];
  685. __le64 size;
  686. } ldList[MAX_LOGICAL_DRIVES_EXT];
  687. } __packed;
  688. struct MR_LD_TARGETID_LIST {
  689. __le32 size;
  690. __le32 count;
  691. u8 pad[3];
  692. u8 targetId[MAX_LOGICAL_DRIVES_EXT];
  693. };
  694. /*
  695. * SAS controller properties
  696. */
  697. struct megasas_ctrl_prop {
  698. u16 seq_num;
  699. u16 pred_fail_poll_interval;
  700. u16 intr_throttle_count;
  701. u16 intr_throttle_timeouts;
  702. u8 rebuild_rate;
  703. u8 patrol_read_rate;
  704. u8 bgi_rate;
  705. u8 cc_rate;
  706. u8 recon_rate;
  707. u8 cache_flush_interval;
  708. u8 spinup_drv_count;
  709. u8 spinup_delay;
  710. u8 cluster_enable;
  711. u8 coercion_mode;
  712. u8 alarm_enable;
  713. u8 disable_auto_rebuild;
  714. u8 disable_battery_warn;
  715. u8 ecc_bucket_size;
  716. u16 ecc_bucket_leak_rate;
  717. u8 restore_hotspare_on_insertion;
  718. u8 expose_encl_devices;
  719. u8 maintainPdFailHistory;
  720. u8 disallowHostRequestReordering;
  721. u8 abortCCOnError;
  722. u8 loadBalanceMode;
  723. u8 disableAutoDetectBackplane;
  724. u8 snapVDSpace;
  725. /*
  726. * Add properties that can be controlled by
  727. * a bit in the following structure.
  728. */
  729. struct {
  730. #if defined(__BIG_ENDIAN_BITFIELD)
  731. u32 reserved:18;
  732. u32 enableJBOD:1;
  733. u32 disableSpinDownHS:1;
  734. u32 allowBootWithPinnedCache:1;
  735. u32 disableOnlineCtrlReset:1;
  736. u32 enableSecretKeyControl:1;
  737. u32 autoEnhancedImport:1;
  738. u32 enableSpinDownUnconfigured:1;
  739. u32 SSDPatrolReadEnabled:1;
  740. u32 SSDSMARTerEnabled:1;
  741. u32 disableNCQ:1;
  742. u32 useFdeOnly:1;
  743. u32 prCorrectUnconfiguredAreas:1;
  744. u32 SMARTerEnabled:1;
  745. u32 copyBackDisabled:1;
  746. #else
  747. u32 copyBackDisabled:1;
  748. u32 SMARTerEnabled:1;
  749. u32 prCorrectUnconfiguredAreas:1;
  750. u32 useFdeOnly:1;
  751. u32 disableNCQ:1;
  752. u32 SSDSMARTerEnabled:1;
  753. u32 SSDPatrolReadEnabled:1;
  754. u32 enableSpinDownUnconfigured:1;
  755. u32 autoEnhancedImport:1;
  756. u32 enableSecretKeyControl:1;
  757. u32 disableOnlineCtrlReset:1;
  758. u32 allowBootWithPinnedCache:1;
  759. u32 disableSpinDownHS:1;
  760. u32 enableJBOD:1;
  761. u32 reserved:18;
  762. #endif
  763. } OnOffProperties;
  764. u8 autoSnapVDSpace;
  765. u8 viewSpace;
  766. __le16 spinDownTime;
  767. u8 reserved[24];
  768. } __packed;
  769. /*
  770. * SAS controller information
  771. */
  772. struct megasas_ctrl_info {
  773. /*
  774. * PCI device information
  775. */
  776. struct {
  777. __le16 vendor_id;
  778. __le16 device_id;
  779. __le16 sub_vendor_id;
  780. __le16 sub_device_id;
  781. u8 reserved[24];
  782. } __attribute__ ((packed)) pci;
  783. /*
  784. * Host interface information
  785. */
  786. struct {
  787. u8 PCIX:1;
  788. u8 PCIE:1;
  789. u8 iSCSI:1;
  790. u8 SAS_3G:1;
  791. u8 SRIOV:1;
  792. u8 reserved_0:3;
  793. u8 reserved_1[6];
  794. u8 port_count;
  795. u64 port_addr[8];
  796. } __attribute__ ((packed)) host_interface;
  797. /*
  798. * Device (backend) interface information
  799. */
  800. struct {
  801. u8 SPI:1;
  802. u8 SAS_3G:1;
  803. u8 SATA_1_5G:1;
  804. u8 SATA_3G:1;
  805. u8 reserved_0:4;
  806. u8 reserved_1[6];
  807. u8 port_count;
  808. u64 port_addr[8];
  809. } __attribute__ ((packed)) device_interface;
  810. /*
  811. * List of components residing in flash. All str are null terminated
  812. */
  813. __le32 image_check_word;
  814. __le32 image_component_count;
  815. struct {
  816. char name[8];
  817. char version[32];
  818. char build_date[16];
  819. char built_time[16];
  820. } __attribute__ ((packed)) image_component[8];
  821. /*
  822. * List of flash components that have been flashed on the card, but
  823. * are not in use, pending reset of the adapter. This list will be
  824. * empty if a flash operation has not occurred. All stings are null
  825. * terminated
  826. */
  827. __le32 pending_image_component_count;
  828. struct {
  829. char name[8];
  830. char version[32];
  831. char build_date[16];
  832. char build_time[16];
  833. } __attribute__ ((packed)) pending_image_component[8];
  834. u8 max_arms;
  835. u8 max_spans;
  836. u8 max_arrays;
  837. u8 max_lds;
  838. char product_name[80];
  839. char serial_no[32];
  840. /*
  841. * Other physical/controller/operation information. Indicates the
  842. * presence of the hardware
  843. */
  844. struct {
  845. u32 bbu:1;
  846. u32 alarm:1;
  847. u32 nvram:1;
  848. u32 uart:1;
  849. u32 reserved:28;
  850. } __attribute__ ((packed)) hw_present;
  851. __le32 current_fw_time;
  852. /*
  853. * Maximum data transfer sizes
  854. */
  855. __le16 max_concurrent_cmds;
  856. __le16 max_sge_count;
  857. __le32 max_request_size;
  858. /*
  859. * Logical and physical device counts
  860. */
  861. __le16 ld_present_count;
  862. __le16 ld_degraded_count;
  863. __le16 ld_offline_count;
  864. __le16 pd_present_count;
  865. __le16 pd_disk_present_count;
  866. __le16 pd_disk_pred_failure_count;
  867. __le16 pd_disk_failed_count;
  868. /*
  869. * Memory size information
  870. */
  871. __le16 nvram_size;
  872. __le16 memory_size;
  873. __le16 flash_size;
  874. /*
  875. * Error counters
  876. */
  877. __le16 mem_correctable_error_count;
  878. __le16 mem_uncorrectable_error_count;
  879. /*
  880. * Cluster information
  881. */
  882. u8 cluster_permitted;
  883. u8 cluster_active;
  884. /*
  885. * Additional max data transfer sizes
  886. */
  887. __le16 max_strips_per_io;
  888. /*
  889. * Controller capabilities structures
  890. */
  891. struct {
  892. u32 raid_level_0:1;
  893. u32 raid_level_1:1;
  894. u32 raid_level_5:1;
  895. u32 raid_level_1E:1;
  896. u32 raid_level_6:1;
  897. u32 reserved:27;
  898. } __attribute__ ((packed)) raid_levels;
  899. struct {
  900. u32 rbld_rate:1;
  901. u32 cc_rate:1;
  902. u32 bgi_rate:1;
  903. u32 recon_rate:1;
  904. u32 patrol_rate:1;
  905. u32 alarm_control:1;
  906. u32 cluster_supported:1;
  907. u32 bbu:1;
  908. u32 spanning_allowed:1;
  909. u32 dedicated_hotspares:1;
  910. u32 revertible_hotspares:1;
  911. u32 foreign_config_import:1;
  912. u32 self_diagnostic:1;
  913. u32 mixed_redundancy_arr:1;
  914. u32 global_hot_spares:1;
  915. u32 reserved:17;
  916. } __attribute__ ((packed)) adapter_operations;
  917. struct {
  918. u32 read_policy:1;
  919. u32 write_policy:1;
  920. u32 io_policy:1;
  921. u32 access_policy:1;
  922. u32 disk_cache_policy:1;
  923. u32 reserved:27;
  924. } __attribute__ ((packed)) ld_operations;
  925. struct {
  926. u8 min;
  927. u8 max;
  928. u8 reserved[2];
  929. } __attribute__ ((packed)) stripe_sz_ops;
  930. struct {
  931. u32 force_online:1;
  932. u32 force_offline:1;
  933. u32 force_rebuild:1;
  934. u32 reserved:29;
  935. } __attribute__ ((packed)) pd_operations;
  936. struct {
  937. u32 ctrl_supports_sas:1;
  938. u32 ctrl_supports_sata:1;
  939. u32 allow_mix_in_encl:1;
  940. u32 allow_mix_in_ld:1;
  941. u32 allow_sata_in_cluster:1;
  942. u32 reserved:27;
  943. } __attribute__ ((packed)) pd_mix_support;
  944. /*
  945. * Define ECC single-bit-error bucket information
  946. */
  947. u8 ecc_bucket_count;
  948. u8 reserved_2[11];
  949. /*
  950. * Include the controller properties (changeable items)
  951. */
  952. struct megasas_ctrl_prop properties;
  953. /*
  954. * Define FW pkg version (set in envt v'bles on OEM basis)
  955. */
  956. char package_version[0x60];
  957. /*
  958. * If adapterOperations.supportMoreThan8Phys is set,
  959. * and deviceInterface.portCount is greater than 8,
  960. * SAS Addrs for first 8 ports shall be populated in
  961. * deviceInterface.portAddr, and the rest shall be
  962. * populated in deviceInterfacePortAddr2.
  963. */
  964. __le64 deviceInterfacePortAddr2[8]; /*6a0h */
  965. u8 reserved3[128]; /*6e0h */
  966. struct { /*760h */
  967. u16 minPdRaidLevel_0:4;
  968. u16 maxPdRaidLevel_0:12;
  969. u16 minPdRaidLevel_1:4;
  970. u16 maxPdRaidLevel_1:12;
  971. u16 minPdRaidLevel_5:4;
  972. u16 maxPdRaidLevel_5:12;
  973. u16 minPdRaidLevel_1E:4;
  974. u16 maxPdRaidLevel_1E:12;
  975. u16 minPdRaidLevel_6:4;
  976. u16 maxPdRaidLevel_6:12;
  977. u16 minPdRaidLevel_10:4;
  978. u16 maxPdRaidLevel_10:12;
  979. u16 minPdRaidLevel_50:4;
  980. u16 maxPdRaidLevel_50:12;
  981. u16 minPdRaidLevel_60:4;
  982. u16 maxPdRaidLevel_60:12;
  983. u16 minPdRaidLevel_1E_RLQ0:4;
  984. u16 maxPdRaidLevel_1E_RLQ0:12;
  985. u16 minPdRaidLevel_1E0_RLQ0:4;
  986. u16 maxPdRaidLevel_1E0_RLQ0:12;
  987. u16 reserved[6];
  988. } pdsForRaidLevels;
  989. __le16 maxPds; /*780h */
  990. __le16 maxDedHSPs; /*782h */
  991. __le16 maxGlobalHSP; /*784h */
  992. __le16 ddfSize; /*786h */
  993. u8 maxLdsPerArray; /*788h */
  994. u8 partitionsInDDF; /*789h */
  995. u8 lockKeyBinding; /*78ah */
  996. u8 maxPITsPerLd; /*78bh */
  997. u8 maxViewsPerLd; /*78ch */
  998. u8 maxTargetId; /*78dh */
  999. __le16 maxBvlVdSize; /*78eh */
  1000. __le16 maxConfigurableSSCSize; /*790h */
  1001. __le16 currentSSCsize; /*792h */
  1002. char expanderFwVersion[12]; /*794h */
  1003. __le16 PFKTrialTimeRemaining; /*7A0h */
  1004. __le16 cacheMemorySize; /*7A2h */
  1005. struct { /*7A4h */
  1006. #if defined(__BIG_ENDIAN_BITFIELD)
  1007. u32 reserved:5;
  1008. u32 activePassive:2;
  1009. u32 supportConfigAutoBalance:1;
  1010. u32 mpio:1;
  1011. u32 supportDataLDonSSCArray:1;
  1012. u32 supportPointInTimeProgress:1;
  1013. u32 supportUnevenSpans:1;
  1014. u32 dedicatedHotSparesLimited:1;
  1015. u32 headlessMode:1;
  1016. u32 supportEmulatedDrives:1;
  1017. u32 supportResetNow:1;
  1018. u32 realTimeScheduler:1;
  1019. u32 supportSSDPatrolRead:1;
  1020. u32 supportPerfTuning:1;
  1021. u32 disableOnlinePFKChange:1;
  1022. u32 supportJBOD:1;
  1023. u32 supportBootTimePFKChange:1;
  1024. u32 supportSetLinkSpeed:1;
  1025. u32 supportEmergencySpares:1;
  1026. u32 supportSuspendResumeBGops:1;
  1027. u32 blockSSDWriteCacheChange:1;
  1028. u32 supportShieldState:1;
  1029. u32 supportLdBBMInfo:1;
  1030. u32 supportLdPIType3:1;
  1031. u32 supportLdPIType2:1;
  1032. u32 supportLdPIType1:1;
  1033. u32 supportPIcontroller:1;
  1034. #else
  1035. u32 supportPIcontroller:1;
  1036. u32 supportLdPIType1:1;
  1037. u32 supportLdPIType2:1;
  1038. u32 supportLdPIType3:1;
  1039. u32 supportLdBBMInfo:1;
  1040. u32 supportShieldState:1;
  1041. u32 blockSSDWriteCacheChange:1;
  1042. u32 supportSuspendResumeBGops:1;
  1043. u32 supportEmergencySpares:1;
  1044. u32 supportSetLinkSpeed:1;
  1045. u32 supportBootTimePFKChange:1;
  1046. u32 supportJBOD:1;
  1047. u32 disableOnlinePFKChange:1;
  1048. u32 supportPerfTuning:1;
  1049. u32 supportSSDPatrolRead:1;
  1050. u32 realTimeScheduler:1;
  1051. u32 supportResetNow:1;
  1052. u32 supportEmulatedDrives:1;
  1053. u32 headlessMode:1;
  1054. u32 dedicatedHotSparesLimited:1;
  1055. u32 supportUnevenSpans:1;
  1056. u32 supportPointInTimeProgress:1;
  1057. u32 supportDataLDonSSCArray:1;
  1058. u32 mpio:1;
  1059. u32 supportConfigAutoBalance:1;
  1060. u32 activePassive:2;
  1061. u32 reserved:5;
  1062. #endif
  1063. } adapterOperations2;
  1064. u8 driverVersion[32]; /*7A8h */
  1065. u8 maxDAPdCountSpinup60; /*7C8h */
  1066. u8 temperatureROC; /*7C9h */
  1067. u8 temperatureCtrl; /*7CAh */
  1068. u8 reserved4; /*7CBh */
  1069. __le16 maxConfigurablePds; /*7CCh */
  1070. u8 reserved5[2]; /*0x7CDh */
  1071. /*
  1072. * HA cluster information
  1073. */
  1074. struct {
  1075. #if defined(__BIG_ENDIAN_BITFIELD)
  1076. u32 reserved:25;
  1077. u32 passive:1;
  1078. u32 premiumFeatureMismatch:1;
  1079. u32 ctrlPropIncompatible:1;
  1080. u32 fwVersionMismatch:1;
  1081. u32 hwIncompatible:1;
  1082. u32 peerIsIncompatible:1;
  1083. u32 peerIsPresent:1;
  1084. #else
  1085. u32 peerIsPresent:1;
  1086. u32 peerIsIncompatible:1;
  1087. u32 hwIncompatible:1;
  1088. u32 fwVersionMismatch:1;
  1089. u32 ctrlPropIncompatible:1;
  1090. u32 premiumFeatureMismatch:1;
  1091. u32 passive:1;
  1092. u32 reserved:25;
  1093. #endif
  1094. } cluster;
  1095. char clusterId[MEGASAS_CLUSTER_ID_SIZE]; /*0x7D4 */
  1096. struct {
  1097. u8 maxVFsSupported; /*0x7E4*/
  1098. u8 numVFsEnabled; /*0x7E5*/
  1099. u8 requestorId; /*0x7E6 0:PF, 1:VF1, 2:VF2*/
  1100. u8 reserved; /*0x7E7*/
  1101. } iov;
  1102. struct {
  1103. #if defined(__BIG_ENDIAN_BITFIELD)
  1104. u32 reserved:7;
  1105. u32 useSeqNumJbodFP:1;
  1106. u32 supportExtendedSSCSize:1;
  1107. u32 supportDiskCacheSettingForSysPDs:1;
  1108. u32 supportCPLDUpdate:1;
  1109. u32 supportTTYLogCompression:1;
  1110. u32 discardCacheDuringLDDelete:1;
  1111. u32 supportSecurityonJBOD:1;
  1112. u32 supportCacheBypassModes:1;
  1113. u32 supportDisableSESMonitoring:1;
  1114. u32 supportForceFlash:1;
  1115. u32 supportNVDRAM:1;
  1116. u32 supportDrvActivityLEDSetting:1;
  1117. u32 supportAllowedOpsforDrvRemoval:1;
  1118. u32 supportHOQRebuild:1;
  1119. u32 supportForceTo512e:1;
  1120. u32 supportNVCacheErase:1;
  1121. u32 supportDebugQueue:1;
  1122. u32 supportSwZone:1;
  1123. u32 supportCrashDump:1;
  1124. u32 supportMaxExtLDs:1;
  1125. u32 supportT10RebuildAssist:1;
  1126. u32 supportDisableImmediateIO:1;
  1127. u32 supportThermalPollInterval:1;
  1128. u32 supportPersonalityChange:2;
  1129. #else
  1130. u32 supportPersonalityChange:2;
  1131. u32 supportThermalPollInterval:1;
  1132. u32 supportDisableImmediateIO:1;
  1133. u32 supportT10RebuildAssist:1;
  1134. u32 supportMaxExtLDs:1;
  1135. u32 supportCrashDump:1;
  1136. u32 supportSwZone:1;
  1137. u32 supportDebugQueue:1;
  1138. u32 supportNVCacheErase:1;
  1139. u32 supportForceTo512e:1;
  1140. u32 supportHOQRebuild:1;
  1141. u32 supportAllowedOpsforDrvRemoval:1;
  1142. u32 supportDrvActivityLEDSetting:1;
  1143. u32 supportNVDRAM:1;
  1144. u32 supportForceFlash:1;
  1145. u32 supportDisableSESMonitoring:1;
  1146. u32 supportCacheBypassModes:1;
  1147. u32 supportSecurityonJBOD:1;
  1148. u32 discardCacheDuringLDDelete:1;
  1149. u32 supportTTYLogCompression:1;
  1150. u32 supportCPLDUpdate:1;
  1151. u32 supportDiskCacheSettingForSysPDs:1;
  1152. u32 supportExtendedSSCSize:1;
  1153. u32 useSeqNumJbodFP:1;
  1154. u32 reserved:7;
  1155. #endif
  1156. } adapterOperations3;
  1157. u8 pad[0x800-0x7EC];
  1158. } __packed;
  1159. /*
  1160. * ===============================
  1161. * MegaRAID SAS driver definitions
  1162. * ===============================
  1163. */
  1164. #define MEGASAS_MAX_PD_CHANNELS 2
  1165. #define MEGASAS_MAX_LD_CHANNELS 2
  1166. #define MEGASAS_MAX_CHANNELS (MEGASAS_MAX_PD_CHANNELS + \
  1167. MEGASAS_MAX_LD_CHANNELS)
  1168. #define MEGASAS_MAX_DEV_PER_CHANNEL 128
  1169. #define MEGASAS_DEFAULT_INIT_ID -1
  1170. #define MEGASAS_MAX_LUN 8
  1171. #define MEGASAS_DEFAULT_CMD_PER_LUN 256
  1172. #define MEGASAS_MAX_PD (MEGASAS_MAX_PD_CHANNELS * \
  1173. MEGASAS_MAX_DEV_PER_CHANNEL)
  1174. #define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \
  1175. MEGASAS_MAX_DEV_PER_CHANNEL)
  1176. #define MEGASAS_MAX_SECTORS (2*1024)
  1177. #define MEGASAS_MAX_SECTORS_IEEE (2*128)
  1178. #define MEGASAS_DBG_LVL 1
  1179. #define MEGASAS_FW_BUSY 1
  1180. #define VD_EXT_DEBUG 0
  1181. #define SCAN_PD_CHANNEL 0x1
  1182. #define SCAN_VD_CHANNEL 0x2
  1183. #define MEGASAS_KDUMP_QUEUE_DEPTH 100
  1184. enum MR_SCSI_CMD_TYPE {
  1185. READ_WRITE_LDIO = 0,
  1186. NON_READ_WRITE_LDIO = 1,
  1187. READ_WRITE_SYSPDIO = 2,
  1188. NON_READ_WRITE_SYSPDIO = 3,
  1189. };
  1190. enum DCMD_TIMEOUT_ACTION {
  1191. INITIATE_OCR = 0,
  1192. KILL_ADAPTER = 1,
  1193. IGNORE_TIMEOUT = 2,
  1194. };
  1195. enum FW_BOOT_CONTEXT {
  1196. PROBE_CONTEXT = 0,
  1197. OCR_CONTEXT = 1,
  1198. };
  1199. /* Frame Type */
  1200. #define IO_FRAME 0
  1201. #define PTHRU_FRAME 1
  1202. /*
  1203. * When SCSI mid-layer calls driver's reset routine, driver waits for
  1204. * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note
  1205. * that the driver cannot _actually_ abort or reset pending commands. While
  1206. * it is waiting for the commands to complete, it prints a diagnostic message
  1207. * every MEGASAS_RESET_NOTICE_INTERVAL seconds
  1208. */
  1209. #define MEGASAS_RESET_WAIT_TIME 180
  1210. #define MEGASAS_INTERNAL_CMD_WAIT_TIME 180
  1211. #define MEGASAS_RESET_NOTICE_INTERVAL 5
  1212. #define MEGASAS_IOCTL_CMD 0
  1213. #define MEGASAS_DEFAULT_CMD_TIMEOUT 90
  1214. #define MEGASAS_THROTTLE_QUEUE_DEPTH 16
  1215. #define MEGASAS_BLOCKED_CMD_TIMEOUT 60
  1216. /*
  1217. * FW reports the maximum of number of commands that it can accept (maximum
  1218. * commands that can be outstanding) at any time. The driver must report a
  1219. * lower number to the mid layer because it can issue a few internal commands
  1220. * itself (E.g, AEN, abort cmd, IOCTLs etc). The number of commands it needs
  1221. * is shown below
  1222. */
  1223. #define MEGASAS_INT_CMDS 32
  1224. #define MEGASAS_SKINNY_INT_CMDS 5
  1225. #define MEGASAS_FUSION_INTERNAL_CMDS 5
  1226. #define MEGASAS_FUSION_IOCTL_CMDS 3
  1227. #define MEGASAS_MFI_IOCTL_CMDS 27
  1228. #define MEGASAS_MAX_MSIX_QUEUES 128
  1229. /*
  1230. * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit
  1231. * SGLs based on the size of dma_addr_t
  1232. */
  1233. #define IS_DMA64 (sizeof(dma_addr_t) == 8)
  1234. #define MFI_XSCALE_OMR0_CHANGE_INTERRUPT 0x00000001
  1235. #define MFI_INTR_FLAG_REPLY_MESSAGE 0x00000001
  1236. #define MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE 0x00000002
  1237. #define MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT 0x00000004
  1238. #define MFI_OB_INTR_STATUS_MASK 0x00000002
  1239. #define MFI_POLL_TIMEOUT_SECS 60
  1240. #define MFI_IO_TIMEOUT_SECS 180
  1241. #define MEGASAS_SRIOV_HEARTBEAT_INTERVAL_VF (5 * HZ)
  1242. #define MEGASAS_OCR_SETTLE_TIME_VF (1000 * 30)
  1243. #define MEGASAS_ROUTINE_WAIT_TIME_VF 300
  1244. #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000
  1245. #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001
  1246. #define MFI_GEN2_ENABLE_INTERRUPT_MASK (0x00000001 | 0x00000004)
  1247. #define MFI_REPLY_SKINNY_MESSAGE_INTERRUPT 0x40000000
  1248. #define MFI_SKINNY_ENABLE_INTERRUPT_MASK (0x00000001)
  1249. #define MFI_1068_PCSR_OFFSET 0x84
  1250. #define MFI_1068_FW_HANDSHAKE_OFFSET 0x64
  1251. #define MFI_1068_FW_READY 0xDDDD0000
  1252. #define MR_MAX_REPLY_QUEUES_OFFSET 0X0000001F
  1253. #define MR_MAX_REPLY_QUEUES_EXT_OFFSET 0X003FC000
  1254. #define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14
  1255. #define MR_MAX_MSIX_REG_ARRAY 16
  1256. #define MR_RDPQ_MODE_OFFSET 0X00800000
  1257. /*
  1258. * register set for both 1068 and 1078 controllers
  1259. * structure extended for 1078 registers
  1260. */
  1261. struct megasas_register_set {
  1262. u32 doorbell; /*0000h*/
  1263. u32 fusion_seq_offset; /*0004h*/
  1264. u32 fusion_host_diag; /*0008h*/
  1265. u32 reserved_01; /*000Ch*/
  1266. u32 inbound_msg_0; /*0010h*/
  1267. u32 inbound_msg_1; /*0014h*/
  1268. u32 outbound_msg_0; /*0018h*/
  1269. u32 outbound_msg_1; /*001Ch*/
  1270. u32 inbound_doorbell; /*0020h*/
  1271. u32 inbound_intr_status; /*0024h*/
  1272. u32 inbound_intr_mask; /*0028h*/
  1273. u32 outbound_doorbell; /*002Ch*/
  1274. u32 outbound_intr_status; /*0030h*/
  1275. u32 outbound_intr_mask; /*0034h*/
  1276. u32 reserved_1[2]; /*0038h*/
  1277. u32 inbound_queue_port; /*0040h*/
  1278. u32 outbound_queue_port; /*0044h*/
  1279. u32 reserved_2[9]; /*0048h*/
  1280. u32 reply_post_host_index; /*006Ch*/
  1281. u32 reserved_2_2[12]; /*0070h*/
  1282. u32 outbound_doorbell_clear; /*00A0h*/
  1283. u32 reserved_3[3]; /*00A4h*/
  1284. u32 outbound_scratch_pad ; /*00B0h*/
  1285. u32 outbound_scratch_pad_2; /*00B4h*/
  1286. u32 outbound_scratch_pad_3; /*00B8h*/
  1287. u32 reserved_4; /*00BCh*/
  1288. u32 inbound_low_queue_port ; /*00C0h*/
  1289. u32 inbound_high_queue_port ; /*00C4h*/
  1290. u32 reserved_5; /*00C8h*/
  1291. u32 res_6[11]; /*CCh*/
  1292. u32 host_diag;
  1293. u32 seq_offset;
  1294. u32 index_registers[807]; /*00CCh*/
  1295. } __attribute__ ((packed));
  1296. struct megasas_sge32 {
  1297. __le32 phys_addr;
  1298. __le32 length;
  1299. } __attribute__ ((packed));
  1300. struct megasas_sge64 {
  1301. __le64 phys_addr;
  1302. __le32 length;
  1303. } __attribute__ ((packed));
  1304. struct megasas_sge_skinny {
  1305. __le64 phys_addr;
  1306. __le32 length;
  1307. __le32 flag;
  1308. } __packed;
  1309. union megasas_sgl {
  1310. struct megasas_sge32 sge32[1];
  1311. struct megasas_sge64 sge64[1];
  1312. struct megasas_sge_skinny sge_skinny[1];
  1313. } __attribute__ ((packed));
  1314. struct megasas_header {
  1315. u8 cmd; /*00h */
  1316. u8 sense_len; /*01h */
  1317. u8 cmd_status; /*02h */
  1318. u8 scsi_status; /*03h */
  1319. u8 target_id; /*04h */
  1320. u8 lun; /*05h */
  1321. u8 cdb_len; /*06h */
  1322. u8 sge_count; /*07h */
  1323. __le32 context; /*08h */
  1324. __le32 pad_0; /*0Ch */
  1325. __le16 flags; /*10h */
  1326. __le16 timeout; /*12h */
  1327. __le32 data_xferlen; /*14h */
  1328. } __attribute__ ((packed));
  1329. union megasas_sgl_frame {
  1330. struct megasas_sge32 sge32[8];
  1331. struct megasas_sge64 sge64[5];
  1332. } __attribute__ ((packed));
  1333. typedef union _MFI_CAPABILITIES {
  1334. struct {
  1335. #if defined(__BIG_ENDIAN_BITFIELD)
  1336. u32 reserved:20;
  1337. u32 support_qd_throttling:1;
  1338. u32 support_fp_rlbypass:1;
  1339. u32 support_vfid_in_ioframe:1;
  1340. u32 support_ext_io_size:1;
  1341. u32 support_ext_queue_depth:1;
  1342. u32 security_protocol_cmds_fw:1;
  1343. u32 support_core_affinity:1;
  1344. u32 support_ndrive_r1_lb:1;
  1345. u32 support_max_255lds:1;
  1346. u32 support_fastpath_wb:1;
  1347. u32 support_additional_msix:1;
  1348. u32 support_fp_remote_lun:1;
  1349. #else
  1350. u32 support_fp_remote_lun:1;
  1351. u32 support_additional_msix:1;
  1352. u32 support_fastpath_wb:1;
  1353. u32 support_max_255lds:1;
  1354. u32 support_ndrive_r1_lb:1;
  1355. u32 support_core_affinity:1;
  1356. u32 security_protocol_cmds_fw:1;
  1357. u32 support_ext_queue_depth:1;
  1358. u32 support_ext_io_size:1;
  1359. u32 support_vfid_in_ioframe:1;
  1360. u32 support_fp_rlbypass:1;
  1361. u32 support_qd_throttling:1;
  1362. u32 reserved:20;
  1363. #endif
  1364. } mfi_capabilities;
  1365. __le32 reg;
  1366. } MFI_CAPABILITIES;
  1367. struct megasas_init_frame {
  1368. u8 cmd; /*00h */
  1369. u8 reserved_0; /*01h */
  1370. u8 cmd_status; /*02h */
  1371. u8 reserved_1; /*03h */
  1372. MFI_CAPABILITIES driver_operations; /*04h*/
  1373. __le32 context; /*08h */
  1374. __le32 pad_0; /*0Ch */
  1375. __le16 flags; /*10h */
  1376. __le16 reserved_3; /*12h */
  1377. __le32 data_xfer_len; /*14h */
  1378. __le32 queue_info_new_phys_addr_lo; /*18h */
  1379. __le32 queue_info_new_phys_addr_hi; /*1Ch */
  1380. __le32 queue_info_old_phys_addr_lo; /*20h */
  1381. __le32 queue_info_old_phys_addr_hi; /*24h */
  1382. __le32 reserved_4[2]; /*28h */
  1383. __le32 system_info_lo; /*30h */
  1384. __le32 system_info_hi; /*34h */
  1385. __le32 reserved_5[2]; /*38h */
  1386. } __attribute__ ((packed));
  1387. struct megasas_init_queue_info {
  1388. __le32 init_flags; /*00h */
  1389. __le32 reply_queue_entries; /*04h */
  1390. __le32 reply_queue_start_phys_addr_lo; /*08h */
  1391. __le32 reply_queue_start_phys_addr_hi; /*0Ch */
  1392. __le32 producer_index_phys_addr_lo; /*10h */
  1393. __le32 producer_index_phys_addr_hi; /*14h */
  1394. __le32 consumer_index_phys_addr_lo; /*18h */
  1395. __le32 consumer_index_phys_addr_hi; /*1Ch */
  1396. } __attribute__ ((packed));
  1397. struct megasas_io_frame {
  1398. u8 cmd; /*00h */
  1399. u8 sense_len; /*01h */
  1400. u8 cmd_status; /*02h */
  1401. u8 scsi_status; /*03h */
  1402. u8 target_id; /*04h */
  1403. u8 access_byte; /*05h */
  1404. u8 reserved_0; /*06h */
  1405. u8 sge_count; /*07h */
  1406. __le32 context; /*08h */
  1407. __le32 pad_0; /*0Ch */
  1408. __le16 flags; /*10h */
  1409. __le16 timeout; /*12h */
  1410. __le32 lba_count; /*14h */
  1411. __le32 sense_buf_phys_addr_lo; /*18h */
  1412. __le32 sense_buf_phys_addr_hi; /*1Ch */
  1413. __le32 start_lba_lo; /*20h */
  1414. __le32 start_lba_hi; /*24h */
  1415. union megasas_sgl sgl; /*28h */
  1416. } __attribute__ ((packed));
  1417. struct megasas_pthru_frame {
  1418. u8 cmd; /*00h */
  1419. u8 sense_len; /*01h */
  1420. u8 cmd_status; /*02h */
  1421. u8 scsi_status; /*03h */
  1422. u8 target_id; /*04h */
  1423. u8 lun; /*05h */
  1424. u8 cdb_len; /*06h */
  1425. u8 sge_count; /*07h */
  1426. __le32 context; /*08h */
  1427. __le32 pad_0; /*0Ch */
  1428. __le16 flags; /*10h */
  1429. __le16 timeout; /*12h */
  1430. __le32 data_xfer_len; /*14h */
  1431. __le32 sense_buf_phys_addr_lo; /*18h */
  1432. __le32 sense_buf_phys_addr_hi; /*1Ch */
  1433. u8 cdb[16]; /*20h */
  1434. union megasas_sgl sgl; /*30h */
  1435. } __attribute__ ((packed));
  1436. struct megasas_dcmd_frame {
  1437. u8 cmd; /*00h */
  1438. u8 reserved_0; /*01h */
  1439. u8 cmd_status; /*02h */
  1440. u8 reserved_1[4]; /*03h */
  1441. u8 sge_count; /*07h */
  1442. __le32 context; /*08h */
  1443. __le32 pad_0; /*0Ch */
  1444. __le16 flags; /*10h */
  1445. __le16 timeout; /*12h */
  1446. __le32 data_xfer_len; /*14h */
  1447. __le32 opcode; /*18h */
  1448. union { /*1Ch */
  1449. u8 b[12];
  1450. __le16 s[6];
  1451. __le32 w[3];
  1452. } mbox;
  1453. union megasas_sgl sgl; /*28h */
  1454. } __attribute__ ((packed));
  1455. struct megasas_abort_frame {
  1456. u8 cmd; /*00h */
  1457. u8 reserved_0; /*01h */
  1458. u8 cmd_status; /*02h */
  1459. u8 reserved_1; /*03h */
  1460. __le32 reserved_2; /*04h */
  1461. __le32 context; /*08h */
  1462. __le32 pad_0; /*0Ch */
  1463. __le16 flags; /*10h */
  1464. __le16 reserved_3; /*12h */
  1465. __le32 reserved_4; /*14h */
  1466. __le32 abort_context; /*18h */
  1467. __le32 pad_1; /*1Ch */
  1468. __le32 abort_mfi_phys_addr_lo; /*20h */
  1469. __le32 abort_mfi_phys_addr_hi; /*24h */
  1470. __le32 reserved_5[6]; /*28h */
  1471. } __attribute__ ((packed));
  1472. struct megasas_smp_frame {
  1473. u8 cmd; /*00h */
  1474. u8 reserved_1; /*01h */
  1475. u8 cmd_status; /*02h */
  1476. u8 connection_status; /*03h */
  1477. u8 reserved_2[3]; /*04h */
  1478. u8 sge_count; /*07h */
  1479. __le32 context; /*08h */
  1480. __le32 pad_0; /*0Ch */
  1481. __le16 flags; /*10h */
  1482. __le16 timeout; /*12h */
  1483. __le32 data_xfer_len; /*14h */
  1484. __le64 sas_addr; /*18h */
  1485. union {
  1486. struct megasas_sge32 sge32[2]; /* [0]: resp [1]: req */
  1487. struct megasas_sge64 sge64[2]; /* [0]: resp [1]: req */
  1488. } sgl;
  1489. } __attribute__ ((packed));
  1490. struct megasas_stp_frame {
  1491. u8 cmd; /*00h */
  1492. u8 reserved_1; /*01h */
  1493. u8 cmd_status; /*02h */
  1494. u8 reserved_2; /*03h */
  1495. u8 target_id; /*04h */
  1496. u8 reserved_3[2]; /*05h */
  1497. u8 sge_count; /*07h */
  1498. __le32 context; /*08h */
  1499. __le32 pad_0; /*0Ch */
  1500. __le16 flags; /*10h */
  1501. __le16 timeout; /*12h */
  1502. __le32 data_xfer_len; /*14h */
  1503. __le16 fis[10]; /*18h */
  1504. __le32 stp_flags;
  1505. union {
  1506. struct megasas_sge32 sge32[2]; /* [0]: resp [1]: data */
  1507. struct megasas_sge64 sge64[2]; /* [0]: resp [1]: data */
  1508. } sgl;
  1509. } __attribute__ ((packed));
  1510. union megasas_frame {
  1511. struct megasas_header hdr;
  1512. struct megasas_init_frame init;
  1513. struct megasas_io_frame io;
  1514. struct megasas_pthru_frame pthru;
  1515. struct megasas_dcmd_frame dcmd;
  1516. struct megasas_abort_frame abort;
  1517. struct megasas_smp_frame smp;
  1518. struct megasas_stp_frame stp;
  1519. u8 raw_bytes[64];
  1520. };
  1521. /**
  1522. * struct MR_PRIV_DEVICE - sdev private hostdata
  1523. * @is_tm_capable: firmware managed tm_capable flag
  1524. * @tm_busy: TM request is in progress
  1525. */
  1526. struct MR_PRIV_DEVICE {
  1527. bool is_tm_capable;
  1528. bool tm_busy;
  1529. };
  1530. struct megasas_cmd;
  1531. union megasas_evt_class_locale {
  1532. struct {
  1533. #ifndef __BIG_ENDIAN_BITFIELD
  1534. u16 locale;
  1535. u8 reserved;
  1536. s8 class;
  1537. #else
  1538. s8 class;
  1539. u8 reserved;
  1540. u16 locale;
  1541. #endif
  1542. } __attribute__ ((packed)) members;
  1543. u32 word;
  1544. } __attribute__ ((packed));
  1545. struct megasas_evt_log_info {
  1546. __le32 newest_seq_num;
  1547. __le32 oldest_seq_num;
  1548. __le32 clear_seq_num;
  1549. __le32 shutdown_seq_num;
  1550. __le32 boot_seq_num;
  1551. } __attribute__ ((packed));
  1552. struct megasas_progress {
  1553. __le16 progress;
  1554. __le16 elapsed_seconds;
  1555. } __attribute__ ((packed));
  1556. struct megasas_evtarg_ld {
  1557. u16 target_id;
  1558. u8 ld_index;
  1559. u8 reserved;
  1560. } __attribute__ ((packed));
  1561. struct megasas_evtarg_pd {
  1562. u16 device_id;
  1563. u8 encl_index;
  1564. u8 slot_number;
  1565. } __attribute__ ((packed));
  1566. struct megasas_evt_detail {
  1567. __le32 seq_num;
  1568. __le32 time_stamp;
  1569. __le32 code;
  1570. union megasas_evt_class_locale cl;
  1571. u8 arg_type;
  1572. u8 reserved1[15];
  1573. union {
  1574. struct {
  1575. struct megasas_evtarg_pd pd;
  1576. u8 cdb_length;
  1577. u8 sense_length;
  1578. u8 reserved[2];
  1579. u8 cdb[16];
  1580. u8 sense[64];
  1581. } __attribute__ ((packed)) cdbSense;
  1582. struct megasas_evtarg_ld ld;
  1583. struct {
  1584. struct megasas_evtarg_ld ld;
  1585. __le64 count;
  1586. } __attribute__ ((packed)) ld_count;
  1587. struct {
  1588. __le64 lba;
  1589. struct megasas_evtarg_ld ld;
  1590. } __attribute__ ((packed)) ld_lba;
  1591. struct {
  1592. struct megasas_evtarg_ld ld;
  1593. __le32 prevOwner;
  1594. __le32 newOwner;
  1595. } __attribute__ ((packed)) ld_owner;
  1596. struct {
  1597. u64 ld_lba;
  1598. u64 pd_lba;
  1599. struct megasas_evtarg_ld ld;
  1600. struct megasas_evtarg_pd pd;
  1601. } __attribute__ ((packed)) ld_lba_pd_lba;
  1602. struct {
  1603. struct megasas_evtarg_ld ld;
  1604. struct megasas_progress prog;
  1605. } __attribute__ ((packed)) ld_prog;
  1606. struct {
  1607. struct megasas_evtarg_ld ld;
  1608. u32 prev_state;
  1609. u32 new_state;
  1610. } __attribute__ ((packed)) ld_state;
  1611. struct {
  1612. u64 strip;
  1613. struct megasas_evtarg_ld ld;
  1614. } __attribute__ ((packed)) ld_strip;
  1615. struct megasas_evtarg_pd pd;
  1616. struct {
  1617. struct megasas_evtarg_pd pd;
  1618. u32 err;
  1619. } __attribute__ ((packed)) pd_err;
  1620. struct {
  1621. u64 lba;
  1622. struct megasas_evtarg_pd pd;
  1623. } __attribute__ ((packed)) pd_lba;
  1624. struct {
  1625. u64 lba;
  1626. struct megasas_evtarg_pd pd;
  1627. struct megasas_evtarg_ld ld;
  1628. } __attribute__ ((packed)) pd_lba_ld;
  1629. struct {
  1630. struct megasas_evtarg_pd pd;
  1631. struct megasas_progress prog;
  1632. } __attribute__ ((packed)) pd_prog;
  1633. struct {
  1634. struct megasas_evtarg_pd pd;
  1635. u32 prevState;
  1636. u32 newState;
  1637. } __attribute__ ((packed)) pd_state;
  1638. struct {
  1639. u16 vendorId;
  1640. __le16 deviceId;
  1641. u16 subVendorId;
  1642. u16 subDeviceId;
  1643. } __attribute__ ((packed)) pci;
  1644. u32 rate;
  1645. char str[96];
  1646. struct {
  1647. u32 rtc;
  1648. u32 elapsedSeconds;
  1649. } __attribute__ ((packed)) time;
  1650. struct {
  1651. u32 ecar;
  1652. u32 elog;
  1653. char str[64];
  1654. } __attribute__ ((packed)) ecc;
  1655. u8 b[96];
  1656. __le16 s[48];
  1657. __le32 w[24];
  1658. __le64 d[12];
  1659. } args;
  1660. char description[128];
  1661. } __attribute__ ((packed));
  1662. struct megasas_aen_event {
  1663. struct delayed_work hotplug_work;
  1664. struct megasas_instance *instance;
  1665. };
  1666. struct megasas_irq_context {
  1667. struct megasas_instance *instance;
  1668. u32 MSIxIndex;
  1669. };
  1670. struct MR_DRV_SYSTEM_INFO {
  1671. u8 infoVersion;
  1672. u8 systemIdLength;
  1673. u16 reserved0;
  1674. u8 systemId[64];
  1675. u8 reserved[1980];
  1676. };
  1677. enum MR_PD_TYPE {
  1678. UNKNOWN_DRIVE = 0,
  1679. PARALLEL_SCSI = 1,
  1680. SAS_PD = 2,
  1681. SATA_PD = 3,
  1682. FC_PD = 4,
  1683. };
  1684. /* JBOD Queue depth definitions */
  1685. #define MEGASAS_SATA_QD 32
  1686. #define MEGASAS_SAS_QD 64
  1687. #define MEGASAS_DEFAULT_PD_QD 64
  1688. struct megasas_instance {
  1689. __le32 *producer;
  1690. dma_addr_t producer_h;
  1691. __le32 *consumer;
  1692. dma_addr_t consumer_h;
  1693. struct MR_DRV_SYSTEM_INFO *system_info_buf;
  1694. dma_addr_t system_info_h;
  1695. struct MR_LD_VF_AFFILIATION *vf_affiliation;
  1696. dma_addr_t vf_affiliation_h;
  1697. struct MR_LD_VF_AFFILIATION_111 *vf_affiliation_111;
  1698. dma_addr_t vf_affiliation_111_h;
  1699. struct MR_CTRL_HB_HOST_MEM *hb_host_mem;
  1700. dma_addr_t hb_host_mem_h;
  1701. struct MR_PD_INFO *pd_info;
  1702. dma_addr_t pd_info_h;
  1703. __le32 *reply_queue;
  1704. dma_addr_t reply_queue_h;
  1705. u32 *crash_dump_buf;
  1706. dma_addr_t crash_dump_h;
  1707. void *crash_buf[MAX_CRASH_DUMP_SIZE];
  1708. u32 crash_buf_pages;
  1709. unsigned int fw_crash_buffer_size;
  1710. unsigned int fw_crash_state;
  1711. unsigned int fw_crash_buffer_offset;
  1712. u32 drv_buf_index;
  1713. u32 drv_buf_alloc;
  1714. u32 crash_dump_fw_support;
  1715. u32 crash_dump_drv_support;
  1716. u32 crash_dump_app_support;
  1717. u32 secure_jbod_support;
  1718. bool use_seqnum_jbod_fp; /* Added for PD sequence */
  1719. spinlock_t crashdump_lock;
  1720. struct megasas_register_set __iomem *reg_set;
  1721. u32 __iomem *reply_post_host_index_addr[MR_MAX_MSIX_REG_ARRAY];
  1722. struct megasas_pd_list pd_list[MEGASAS_MAX_PD];
  1723. struct megasas_pd_list local_pd_list[MEGASAS_MAX_PD];
  1724. u8 ld_ids[MEGASAS_MAX_LD_IDS];
  1725. s8 init_id;
  1726. u16 max_num_sge;
  1727. u16 max_fw_cmds;
  1728. u16 max_mfi_cmds;
  1729. u16 max_scsi_cmds;
  1730. u16 ldio_threshold;
  1731. u16 cur_can_queue;
  1732. u32 max_sectors_per_req;
  1733. struct megasas_aen_event *ev;
  1734. struct megasas_cmd **cmd_list;
  1735. struct list_head cmd_pool;
  1736. /* used to sync fire the cmd to fw */
  1737. spinlock_t mfi_pool_lock;
  1738. /* used to sync fire the cmd to fw */
  1739. spinlock_t hba_lock;
  1740. /* used to synch producer, consumer ptrs in dpc */
  1741. spinlock_t completion_lock;
  1742. struct dma_pool *frame_dma_pool;
  1743. struct dma_pool *sense_dma_pool;
  1744. struct megasas_evt_detail *evt_detail;
  1745. dma_addr_t evt_detail_h;
  1746. struct megasas_cmd *aen_cmd;
  1747. struct mutex hba_mutex;
  1748. struct semaphore ioctl_sem;
  1749. struct Scsi_Host *host;
  1750. wait_queue_head_t int_cmd_wait_q;
  1751. wait_queue_head_t abort_cmd_wait_q;
  1752. struct pci_dev *pdev;
  1753. u32 unique_id;
  1754. u32 fw_support_ieee;
  1755. atomic_t fw_outstanding;
  1756. atomic_t ldio_outstanding;
  1757. atomic_t fw_reset_no_pci_access;
  1758. struct megasas_instance_template *instancet;
  1759. struct tasklet_struct isr_tasklet;
  1760. struct work_struct work_init;
  1761. struct work_struct crash_init;
  1762. u8 flag;
  1763. u8 unload;
  1764. u8 flag_ieee;
  1765. u8 issuepend_done;
  1766. u8 disableOnlineCtrlReset;
  1767. u8 UnevenSpanSupport;
  1768. u8 supportmax256vd;
  1769. u8 pd_list_not_supported;
  1770. u16 fw_supported_vd_count;
  1771. u16 fw_supported_pd_count;
  1772. u16 drv_supported_vd_count;
  1773. u16 drv_supported_pd_count;
  1774. atomic_t adprecovery;
  1775. unsigned long last_time;
  1776. u32 mfiStatus;
  1777. u32 last_seq_num;
  1778. struct list_head internal_reset_pending_q;
  1779. /* Ptr to hba specific information */
  1780. void *ctrl_context;
  1781. u32 ctrl_context_pages;
  1782. struct megasas_ctrl_info *ctrl_info;
  1783. unsigned int msix_vectors;
  1784. struct msix_entry msixentry[MEGASAS_MAX_MSIX_QUEUES];
  1785. struct megasas_irq_context irq_context[MEGASAS_MAX_MSIX_QUEUES];
  1786. u64 map_id;
  1787. u64 pd_seq_map_id;
  1788. struct megasas_cmd *map_update_cmd;
  1789. struct megasas_cmd *jbod_seq_cmd;
  1790. unsigned long bar;
  1791. long reset_flags;
  1792. struct mutex reset_mutex;
  1793. struct timer_list sriov_heartbeat_timer;
  1794. char skip_heartbeat_timer_del;
  1795. u8 requestorId;
  1796. char PlasmaFW111;
  1797. char clusterId[MEGASAS_CLUSTER_ID_SIZE];
  1798. u8 peerIsPresent;
  1799. u8 passive;
  1800. u16 throttlequeuedepth;
  1801. u8 mask_interrupts;
  1802. u16 max_chain_frame_sz;
  1803. u8 is_imr;
  1804. u8 is_rdpq;
  1805. bool dev_handle;
  1806. };
  1807. struct MR_LD_VF_MAP {
  1808. u32 size;
  1809. union MR_LD_REF ref;
  1810. u8 ldVfCount;
  1811. u8 reserved[6];
  1812. u8 policy[1];
  1813. };
  1814. struct MR_LD_VF_AFFILIATION {
  1815. u32 size;
  1816. u8 ldCount;
  1817. u8 vfCount;
  1818. u8 thisVf;
  1819. u8 reserved[9];
  1820. struct MR_LD_VF_MAP map[1];
  1821. };
  1822. /* Plasma 1.11 FW backward compatibility structures */
  1823. #define IOV_111_OFFSET 0x7CE
  1824. #define MAX_VIRTUAL_FUNCTIONS 8
  1825. #define MR_LD_ACCESS_HIDDEN 15
  1826. struct IOV_111 {
  1827. u8 maxVFsSupported;
  1828. u8 numVFsEnabled;
  1829. u8 requestorId;
  1830. u8 reserved[5];
  1831. };
  1832. struct MR_LD_VF_MAP_111 {
  1833. u8 targetId;
  1834. u8 reserved[3];
  1835. u8 policy[MAX_VIRTUAL_FUNCTIONS];
  1836. };
  1837. struct MR_LD_VF_AFFILIATION_111 {
  1838. u8 vdCount;
  1839. u8 vfCount;
  1840. u8 thisVf;
  1841. u8 reserved[5];
  1842. struct MR_LD_VF_MAP_111 map[MAX_LOGICAL_DRIVES];
  1843. };
  1844. struct MR_CTRL_HB_HOST_MEM {
  1845. struct {
  1846. u32 fwCounter; /* Firmware heart beat counter */
  1847. struct {
  1848. u32 debugmode:1; /* 1=Firmware is in debug mode.
  1849. Heart beat will not be updated. */
  1850. u32 reserved:31;
  1851. } debug;
  1852. u32 reserved_fw[6];
  1853. u32 driverCounter; /* Driver heart beat counter. 0x20 */
  1854. u32 reserved_driver[7];
  1855. } HB;
  1856. u8 pad[0x400-0x40];
  1857. };
  1858. enum {
  1859. MEGASAS_HBA_OPERATIONAL = 0,
  1860. MEGASAS_ADPRESET_SM_INFAULT = 1,
  1861. MEGASAS_ADPRESET_SM_FW_RESET_SUCCESS = 2,
  1862. MEGASAS_ADPRESET_SM_OPERATIONAL = 3,
  1863. MEGASAS_HW_CRITICAL_ERROR = 4,
  1864. MEGASAS_ADPRESET_SM_POLLING = 5,
  1865. MEGASAS_ADPRESET_INPROG_SIGN = 0xDEADDEAD,
  1866. };
  1867. struct megasas_instance_template {
  1868. void (*fire_cmd)(struct megasas_instance *, dma_addr_t, \
  1869. u32, struct megasas_register_set __iomem *);
  1870. void (*enable_intr)(struct megasas_instance *);
  1871. void (*disable_intr)(struct megasas_instance *);
  1872. int (*clear_intr)(struct megasas_register_set __iomem *);
  1873. u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *);
  1874. int (*adp_reset)(struct megasas_instance *, \
  1875. struct megasas_register_set __iomem *);
  1876. int (*check_reset)(struct megasas_instance *, \
  1877. struct megasas_register_set __iomem *);
  1878. irqreturn_t (*service_isr)(int irq, void *devp);
  1879. void (*tasklet)(unsigned long);
  1880. u32 (*init_adapter)(struct megasas_instance *);
  1881. u32 (*build_and_issue_cmd) (struct megasas_instance *,
  1882. struct scsi_cmnd *);
  1883. int (*issue_dcmd)(struct megasas_instance *instance,
  1884. struct megasas_cmd *cmd);
  1885. };
  1886. #define MEGASAS_IS_LOGICAL(scp) \
  1887. ((scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1)
  1888. #define MEGASAS_DEV_INDEX(scp) \
  1889. (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \
  1890. scp->device->id)
  1891. #define MEGASAS_PD_INDEX(scp) \
  1892. ((scp->device->channel * MEGASAS_MAX_DEV_PER_CHANNEL) + \
  1893. scp->device->id)
  1894. struct megasas_cmd {
  1895. union megasas_frame *frame;
  1896. dma_addr_t frame_phys_addr;
  1897. u8 *sense;
  1898. dma_addr_t sense_phys_addr;
  1899. u32 index;
  1900. u8 sync_cmd;
  1901. u8 cmd_status_drv;
  1902. u8 abort_aen;
  1903. u8 retry_for_fw_reset;
  1904. struct list_head list;
  1905. struct scsi_cmnd *scmd;
  1906. u8 flags;
  1907. struct megasas_instance *instance;
  1908. union {
  1909. struct {
  1910. u16 smid;
  1911. u16 resvd;
  1912. } context;
  1913. u32 frame_count;
  1914. };
  1915. };
  1916. #define MAX_MGMT_ADAPTERS 1024
  1917. #define MAX_IOCTL_SGE 16
  1918. struct megasas_iocpacket {
  1919. u16 host_no;
  1920. u16 __pad1;
  1921. u32 sgl_off;
  1922. u32 sge_count;
  1923. u32 sense_off;
  1924. u32 sense_len;
  1925. union {
  1926. u8 raw[128];
  1927. struct megasas_header hdr;
  1928. } frame;
  1929. struct iovec sgl[MAX_IOCTL_SGE];
  1930. } __attribute__ ((packed));
  1931. struct megasas_aen {
  1932. u16 host_no;
  1933. u16 __pad1;
  1934. u32 seq_num;
  1935. u32 class_locale_word;
  1936. } __attribute__ ((packed));
  1937. #ifdef CONFIG_COMPAT
  1938. struct compat_megasas_iocpacket {
  1939. u16 host_no;
  1940. u16 __pad1;
  1941. u32 sgl_off;
  1942. u32 sge_count;
  1943. u32 sense_off;
  1944. u32 sense_len;
  1945. union {
  1946. u8 raw[128];
  1947. struct megasas_header hdr;
  1948. } frame;
  1949. struct compat_iovec sgl[MAX_IOCTL_SGE];
  1950. } __attribute__ ((packed));
  1951. #define MEGASAS_IOC_FIRMWARE32 _IOWR('M', 1, struct compat_megasas_iocpacket)
  1952. #endif
  1953. #define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket)
  1954. #define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen)
  1955. struct megasas_mgmt_info {
  1956. u16 count;
  1957. struct megasas_instance *instance[MAX_MGMT_ADAPTERS];
  1958. int max_index;
  1959. };
  1960. enum MEGASAS_OCR_CAUSE {
  1961. FW_FAULT_OCR = 0,
  1962. SCSIIO_TIMEOUT_OCR = 1,
  1963. MFI_IO_TIMEOUT_OCR = 2,
  1964. };
  1965. enum DCMD_RETURN_STATUS {
  1966. DCMD_SUCCESS = 0,
  1967. DCMD_TIMEOUT = 1,
  1968. DCMD_FAILED = 2,
  1969. DCMD_NOT_FIRED = 3,
  1970. };
  1971. u8
  1972. MR_BuildRaidContext(struct megasas_instance *instance,
  1973. struct IO_REQUEST_INFO *io_info,
  1974. struct RAID_CONTEXT *pRAID_Context,
  1975. struct MR_DRV_RAID_MAP_ALL *map, u8 **raidLUN);
  1976. u8 MR_TargetIdToLdGet(u32 ldTgtId, struct MR_DRV_RAID_MAP_ALL *map);
  1977. struct MR_LD_RAID *MR_LdRaidGet(u32 ld, struct MR_DRV_RAID_MAP_ALL *map);
  1978. u16 MR_ArPdGet(u32 ar, u32 arm, struct MR_DRV_RAID_MAP_ALL *map);
  1979. u16 MR_LdSpanArrayGet(u32 ld, u32 span, struct MR_DRV_RAID_MAP_ALL *map);
  1980. __le16 MR_PdDevHandleGet(u32 pd, struct MR_DRV_RAID_MAP_ALL *map);
  1981. u16 MR_GetLDTgtId(u32 ld, struct MR_DRV_RAID_MAP_ALL *map);
  1982. __le16 get_updated_dev_handle(struct megasas_instance *instance,
  1983. struct LD_LOAD_BALANCE_INFO *lbInfo, struct IO_REQUEST_INFO *in_info);
  1984. void mr_update_load_balance_params(struct MR_DRV_RAID_MAP_ALL *map,
  1985. struct LD_LOAD_BALANCE_INFO *lbInfo);
  1986. int megasas_get_ctrl_info(struct megasas_instance *instance);
  1987. /* PD sequence */
  1988. int
  1989. megasas_sync_pd_seq_num(struct megasas_instance *instance, bool pend);
  1990. int megasas_set_crash_dump_params(struct megasas_instance *instance,
  1991. u8 crash_buf_state);
  1992. void megasas_free_host_crash_buffer(struct megasas_instance *instance);
  1993. void megasas_fusion_crash_dump_wq(struct work_struct *work);
  1994. void megasas_return_cmd_fusion(struct megasas_instance *instance,
  1995. struct megasas_cmd_fusion *cmd);
  1996. int megasas_issue_blocked_cmd(struct megasas_instance *instance,
  1997. struct megasas_cmd *cmd, int timeout);
  1998. void __megasas_return_cmd(struct megasas_instance *instance,
  1999. struct megasas_cmd *cmd);
  2000. void megasas_return_mfi_mpt_pthr(struct megasas_instance *instance,
  2001. struct megasas_cmd *cmd_mfi, struct megasas_cmd_fusion *cmd_fusion);
  2002. int megasas_cmd_type(struct scsi_cmnd *cmd);
  2003. void megasas_setup_jbod_map(struct megasas_instance *instance);
  2004. void megasas_update_sdev_properties(struct scsi_device *sdev);
  2005. int megasas_reset_fusion(struct Scsi_Host *shost, int reason);
  2006. int megasas_task_abort_fusion(struct scsi_cmnd *scmd);
  2007. int megasas_reset_target_fusion(struct scsi_cmnd *scmd);
  2008. #endif /*LSI_MEGARAID_SAS_H */