pm8001_ctl.c 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048
  1. /*
  2. * PMC-Sierra 8001/8081/8088/8089 SAS/SATA based host adapters driver
  3. *
  4. * Copyright (c) 2008-2009 USI Co., Ltd.
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions, and the following disclaimer,
  12. * without modification.
  13. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  14. * substantially similar to the "NO WARRANTY" disclaimer below
  15. * ("Disclaimer") and any redistribution must be conditioned upon
  16. * including a substantially similar Disclaimer requirement for further
  17. * binary redistribution.
  18. * 3. Neither the names of the above-listed copyright holders nor the names
  19. * of any contributors may be used to endorse or promote products derived
  20. * from this software without specific prior written permission.
  21. *
  22. * Alternatively, this software may be distributed under the terms of the
  23. * GNU General Public License ("GPL") version 2 as published by the Free
  24. * Software Foundation.
  25. *
  26. * NO WARRANTY
  27. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  28. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  29. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  30. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  31. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  32. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  33. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  34. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  35. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  36. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  37. * POSSIBILITY OF SUCH DAMAGES.
  38. *
  39. */
  40. #include <linux/firmware.h>
  41. #include <linux/slab.h>
  42. #include "pm8001_sas.h"
  43. #include "pm8001_ctl.h"
  44. #include "pm8001_chips.h"
  45. /* scsi host attributes */
  46. /**
  47. * pm8001_ctl_mpi_interface_rev_show - MPI interface revision number
  48. * @cdev: pointer to embedded class device
  49. * @attr: device attribute (unused)
  50. * @buf: the buffer returned
  51. *
  52. * A sysfs 'read-only' shost attribute.
  53. */
  54. static ssize_t pm8001_ctl_mpi_interface_rev_show(struct device *cdev,
  55. struct device_attribute *attr, char *buf)
  56. {
  57. struct Scsi_Host *shost = class_to_shost(cdev);
  58. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  59. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  60. if (pm8001_ha->chip_id == chip_8001) {
  61. return sysfs_emit(buf, "%d\n",
  62. pm8001_ha->main_cfg_tbl.pm8001_tbl.interface_rev);
  63. } else {
  64. return sysfs_emit(buf, "%d\n",
  65. pm8001_ha->main_cfg_tbl.pm80xx_tbl.interface_rev);
  66. }
  67. }
  68. static
  69. DEVICE_ATTR(interface_rev, S_IRUGO, pm8001_ctl_mpi_interface_rev_show, NULL);
  70. /**
  71. * controller_fatal_error_show - check controller is under fatal err
  72. * @cdev: pointer to embedded class device
  73. * @attr: device attribute (unused)
  74. * @buf: the buffer returned
  75. *
  76. * A sysfs 'read-only' shost attribute.
  77. */
  78. static ssize_t controller_fatal_error_show(struct device *cdev,
  79. struct device_attribute *attr, char *buf)
  80. {
  81. struct Scsi_Host *shost = class_to_shost(cdev);
  82. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  83. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  84. return sysfs_emit(buf, "%d\n",
  85. pm8001_ha->controller_fatal_error);
  86. }
  87. static DEVICE_ATTR_RO(controller_fatal_error);
  88. /**
  89. * pm8001_ctl_fw_version_show - firmware version
  90. * @cdev: pointer to embedded class device
  91. * @attr: device attribute (unused)
  92. * @buf: the buffer returned
  93. *
  94. * A sysfs 'read-only' shost attribute.
  95. */
  96. static ssize_t pm8001_ctl_fw_version_show(struct device *cdev,
  97. struct device_attribute *attr, char *buf)
  98. {
  99. struct Scsi_Host *shost = class_to_shost(cdev);
  100. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  101. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  102. if (pm8001_ha->chip_id == chip_8001) {
  103. return sysfs_emit(buf, "%02x.%02x.%02x.%02x\n",
  104. (u8)(pm8001_ha->main_cfg_tbl.pm8001_tbl.firmware_rev >> 24),
  105. (u8)(pm8001_ha->main_cfg_tbl.pm8001_tbl.firmware_rev >> 16),
  106. (u8)(pm8001_ha->main_cfg_tbl.pm8001_tbl.firmware_rev >> 8),
  107. (u8)(pm8001_ha->main_cfg_tbl.pm8001_tbl.firmware_rev));
  108. } else {
  109. return sysfs_emit(buf, "%02x.%02x.%02x.%02x\n",
  110. (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev >> 24),
  111. (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev >> 16),
  112. (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev >> 8),
  113. (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev));
  114. }
  115. }
  116. static DEVICE_ATTR(fw_version, S_IRUGO, pm8001_ctl_fw_version_show, NULL);
  117. /**
  118. * pm8001_ctl_ila_version_show - ila version
  119. * @cdev: pointer to embedded class device
  120. * @attr: device attribute (unused)
  121. * @buf: the buffer returned
  122. *
  123. * A sysfs 'read-only' shost attribute.
  124. */
  125. static ssize_t pm8001_ctl_ila_version_show(struct device *cdev,
  126. struct device_attribute *attr, char *buf)
  127. {
  128. struct Scsi_Host *shost = class_to_shost(cdev);
  129. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  130. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  131. if (pm8001_ha->chip_id != chip_8001) {
  132. return sysfs_emit(buf, "%02x.%02x.%02x.%02x\n",
  133. (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.ila_version >> 24),
  134. (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.ila_version >> 16),
  135. (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.ila_version >> 8),
  136. (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.ila_version));
  137. }
  138. return 0;
  139. }
  140. static DEVICE_ATTR(ila_version, 0444, pm8001_ctl_ila_version_show, NULL);
  141. /**
  142. * pm8001_ctl_inactive_fw_version_show - Inactive firmware version number
  143. * @cdev: pointer to embedded class device
  144. * @attr: device attribute (unused)
  145. * @buf: the buffer returned
  146. *
  147. * A sysfs 'read-only' shost attribute.
  148. */
  149. static ssize_t pm8001_ctl_inactive_fw_version_show(struct device *cdev,
  150. struct device_attribute *attr, char *buf)
  151. {
  152. struct Scsi_Host *shost = class_to_shost(cdev);
  153. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  154. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  155. if (pm8001_ha->chip_id != chip_8001) {
  156. return sysfs_emit(buf, "%02x.%02x.%02x.%02x\n",
  157. (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.inc_fw_version >> 24),
  158. (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.inc_fw_version >> 16),
  159. (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.inc_fw_version >> 8),
  160. (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.inc_fw_version));
  161. }
  162. return 0;
  163. }
  164. static
  165. DEVICE_ATTR(inc_fw_ver, 0444, pm8001_ctl_inactive_fw_version_show, NULL);
  166. /**
  167. * pm8001_ctl_max_out_io_show - max outstanding io supported
  168. * @cdev: pointer to embedded class device
  169. * @attr: device attribute (unused)
  170. * @buf: the buffer returned
  171. *
  172. * A sysfs 'read-only' shost attribute.
  173. */
  174. static ssize_t pm8001_ctl_max_out_io_show(struct device *cdev,
  175. struct device_attribute *attr, char *buf)
  176. {
  177. struct Scsi_Host *shost = class_to_shost(cdev);
  178. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  179. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  180. if (pm8001_ha->chip_id == chip_8001) {
  181. return sysfs_emit(buf, "%d\n",
  182. pm8001_ha->main_cfg_tbl.pm8001_tbl.max_out_io);
  183. } else {
  184. return sysfs_emit(buf, "%d\n",
  185. pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_out_io);
  186. }
  187. }
  188. static DEVICE_ATTR(max_out_io, S_IRUGO, pm8001_ctl_max_out_io_show, NULL);
  189. /**
  190. * pm8001_ctl_max_devices_show - max devices support
  191. * @cdev: pointer to embedded class device
  192. * @attr: device attribute (unused)
  193. * @buf: the buffer returned
  194. *
  195. * A sysfs 'read-only' shost attribute.
  196. */
  197. static ssize_t pm8001_ctl_max_devices_show(struct device *cdev,
  198. struct device_attribute *attr, char *buf)
  199. {
  200. struct Scsi_Host *shost = class_to_shost(cdev);
  201. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  202. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  203. if (pm8001_ha->chip_id == chip_8001) {
  204. return sysfs_emit(buf, "%04d\n",
  205. (u16)(pm8001_ha->main_cfg_tbl.pm8001_tbl.max_sgl >> 16));
  206. } else {
  207. return sysfs_emit(buf, "%04d\n",
  208. (u16)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_sgl >> 16));
  209. }
  210. }
  211. static DEVICE_ATTR(max_devices, S_IRUGO, pm8001_ctl_max_devices_show, NULL);
  212. /**
  213. * pm8001_ctl_max_sg_list_show - max sg list supported iff not 0.0 for no
  214. * hardware limitation
  215. * @cdev: pointer to embedded class device
  216. * @attr: device attribute (unused)
  217. * @buf: the buffer returned
  218. *
  219. * A sysfs 'read-only' shost attribute.
  220. */
  221. static ssize_t pm8001_ctl_max_sg_list_show(struct device *cdev,
  222. struct device_attribute *attr, char *buf)
  223. {
  224. struct Scsi_Host *shost = class_to_shost(cdev);
  225. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  226. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  227. if (pm8001_ha->chip_id == chip_8001) {
  228. return sysfs_emit(buf, "%04d\n",
  229. pm8001_ha->main_cfg_tbl.pm8001_tbl.max_sgl & 0x0000FFFF);
  230. } else {
  231. return sysfs_emit(buf, "%04d\n",
  232. pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_sgl & 0x0000FFFF);
  233. }
  234. }
  235. static DEVICE_ATTR(max_sg_list, S_IRUGO, pm8001_ctl_max_sg_list_show, NULL);
  236. #define SAS_1_0 0x1
  237. #define SAS_1_1 0x2
  238. #define SAS_2_0 0x4
  239. static ssize_t
  240. show_sas_spec_support_status(unsigned int mode, char *buf)
  241. {
  242. ssize_t len = 0;
  243. if (mode & SAS_1_1)
  244. len = sprintf(buf, "%s", "SAS1.1");
  245. if (mode & SAS_2_0)
  246. len += sprintf(buf + len, "%s%s", len ? ", " : "", "SAS2.0");
  247. len += sprintf(buf + len, "\n");
  248. return len;
  249. }
  250. /**
  251. * pm8001_ctl_sas_spec_support_show - sas spec supported
  252. * @cdev: pointer to embedded class device
  253. * @attr: device attribute (unused)
  254. * @buf: the buffer returned
  255. *
  256. * A sysfs 'read-only' shost attribute.
  257. */
  258. static ssize_t pm8001_ctl_sas_spec_support_show(struct device *cdev,
  259. struct device_attribute *attr, char *buf)
  260. {
  261. unsigned int mode;
  262. struct Scsi_Host *shost = class_to_shost(cdev);
  263. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  264. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  265. /* fe000000 means supports SAS2.1 */
  266. if (pm8001_ha->chip_id == chip_8001)
  267. mode = (pm8001_ha->main_cfg_tbl.pm8001_tbl.ctrl_cap_flag &
  268. 0xfe000000)>>25;
  269. else
  270. /* fe000000 means supports SAS2.1 */
  271. mode = (pm8001_ha->main_cfg_tbl.pm80xx_tbl.ctrl_cap_flag &
  272. 0xfe000000)>>25;
  273. return show_sas_spec_support_status(mode, buf);
  274. }
  275. static DEVICE_ATTR(sas_spec_support, S_IRUGO,
  276. pm8001_ctl_sas_spec_support_show, NULL);
  277. /**
  278. * pm8001_ctl_host_sas_address_show - sas address
  279. * @cdev: pointer to embedded class device
  280. * @attr: device attribute (unused)
  281. * @buf: the buffer returned
  282. *
  283. * This is the controller sas address
  284. *
  285. * A sysfs 'read-only' shost attribute.
  286. */
  287. static ssize_t pm8001_ctl_host_sas_address_show(struct device *cdev,
  288. struct device_attribute *attr, char *buf)
  289. {
  290. struct Scsi_Host *shost = class_to_shost(cdev);
  291. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  292. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  293. return sysfs_emit(buf, "0x%016llx\n",
  294. be64_to_cpu(*(__be64 *)pm8001_ha->sas_addr));
  295. }
  296. static DEVICE_ATTR(host_sas_address, S_IRUGO,
  297. pm8001_ctl_host_sas_address_show, NULL);
  298. /**
  299. * pm8001_ctl_logging_level_show - logging level
  300. * @cdev: pointer to embedded class device
  301. * @attr: device attribute (unused)
  302. * @buf: the buffer returned
  303. *
  304. * A sysfs 'read/write' shost attribute.
  305. */
  306. static ssize_t pm8001_ctl_logging_level_show(struct device *cdev,
  307. struct device_attribute *attr, char *buf)
  308. {
  309. struct Scsi_Host *shost = class_to_shost(cdev);
  310. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  311. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  312. return sysfs_emit(buf, "%08xh\n", pm8001_ha->logging_level);
  313. }
  314. static ssize_t pm8001_ctl_logging_level_store(struct device *cdev,
  315. struct device_attribute *attr, const char *buf, size_t count)
  316. {
  317. struct Scsi_Host *shost = class_to_shost(cdev);
  318. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  319. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  320. int val = 0;
  321. if (sscanf(buf, "%x", &val) != 1)
  322. return -EINVAL;
  323. pm8001_ha->logging_level = val;
  324. return strlen(buf);
  325. }
  326. static DEVICE_ATTR(logging_level, S_IRUGO | S_IWUSR,
  327. pm8001_ctl_logging_level_show, pm8001_ctl_logging_level_store);
  328. /**
  329. * pm8001_ctl_aap_log_show - aap1 event log
  330. * @cdev: pointer to embedded class device
  331. * @attr: device attribute (unused)
  332. * @buf: the buffer returned
  333. *
  334. * A sysfs 'read-only' shost attribute.
  335. */
  336. static ssize_t pm8001_ctl_aap_log_show(struct device *cdev,
  337. struct device_attribute *attr, char *buf)
  338. {
  339. struct Scsi_Host *shost = class_to_shost(cdev);
  340. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  341. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  342. u8 *ptr = (u8 *)pm8001_ha->memoryMap.region[AAP1].virt_ptr;
  343. int i;
  344. char *str = buf;
  345. int max = 2;
  346. for (i = 0; i < max; i++) {
  347. str += sprintf(str, "0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x"
  348. "0x%08x 0x%08x\n",
  349. pm8001_ctl_aap1_memmap(ptr, i, 0),
  350. pm8001_ctl_aap1_memmap(ptr, i, 4),
  351. pm8001_ctl_aap1_memmap(ptr, i, 8),
  352. pm8001_ctl_aap1_memmap(ptr, i, 12),
  353. pm8001_ctl_aap1_memmap(ptr, i, 16),
  354. pm8001_ctl_aap1_memmap(ptr, i, 20),
  355. pm8001_ctl_aap1_memmap(ptr, i, 24),
  356. pm8001_ctl_aap1_memmap(ptr, i, 28));
  357. }
  358. return str - buf;
  359. }
  360. static DEVICE_ATTR(aap_log, S_IRUGO, pm8001_ctl_aap_log_show, NULL);
  361. /**
  362. * pm8001_ctl_ib_queue_log_show - Out bound Queue log
  363. * @cdev:pointer to embedded class device
  364. * @attr: device attribute (unused)
  365. * @buf: the buffer returned
  366. *
  367. * A sysfs 'read-only' shost attribute.
  368. */
  369. static ssize_t pm8001_ctl_ib_queue_log_show(struct device *cdev,
  370. struct device_attribute *attr, char *buf)
  371. {
  372. struct Scsi_Host *shost = class_to_shost(cdev);
  373. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  374. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  375. int offset;
  376. char *str = buf;
  377. int start = 0;
  378. u32 ib_offset = pm8001_ha->ib_offset;
  379. u32 queue_size = pm8001_ha->max_q_num * PM8001_MPI_QUEUE * 128;
  380. #define IB_MEMMAP(c) \
  381. (*(u32 *)((u8 *)pm8001_ha-> \
  382. memoryMap.region[ib_offset].virt_ptr + \
  383. pm8001_ha->evtlog_ib_offset + (c)))
  384. for (offset = 0; offset < IB_OB_READ_TIMES; offset++) {
  385. str += sprintf(str, "0x%08x\n", IB_MEMMAP(start));
  386. start = start + 4;
  387. }
  388. pm8001_ha->evtlog_ib_offset += SYSFS_OFFSET;
  389. if (((pm8001_ha->evtlog_ib_offset) % queue_size) == 0)
  390. pm8001_ha->evtlog_ib_offset = 0;
  391. return str - buf;
  392. }
  393. static DEVICE_ATTR(ib_log, S_IRUGO, pm8001_ctl_ib_queue_log_show, NULL);
  394. /**
  395. * pm8001_ctl_ob_queue_log_show - Out bound Queue log
  396. * @cdev:pointer to embedded class device
  397. * @attr: device attribute (unused)
  398. * @buf: the buffer returned
  399. *
  400. * A sysfs 'read-only' shost attribute.
  401. */
  402. static ssize_t pm8001_ctl_ob_queue_log_show(struct device *cdev,
  403. struct device_attribute *attr, char *buf)
  404. {
  405. struct Scsi_Host *shost = class_to_shost(cdev);
  406. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  407. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  408. int offset;
  409. char *str = buf;
  410. int start = 0;
  411. u32 ob_offset = pm8001_ha->ob_offset;
  412. u32 queue_size = pm8001_ha->max_q_num * PM8001_MPI_QUEUE * 128;
  413. #define OB_MEMMAP(c) \
  414. (*(u32 *)((u8 *)pm8001_ha-> \
  415. memoryMap.region[ob_offset].virt_ptr + \
  416. pm8001_ha->evtlog_ob_offset + (c)))
  417. for (offset = 0; offset < IB_OB_READ_TIMES; offset++) {
  418. str += sprintf(str, "0x%08x\n", OB_MEMMAP(start));
  419. start = start + 4;
  420. }
  421. pm8001_ha->evtlog_ob_offset += SYSFS_OFFSET;
  422. if (((pm8001_ha->evtlog_ob_offset) % queue_size) == 0)
  423. pm8001_ha->evtlog_ob_offset = 0;
  424. return str - buf;
  425. }
  426. static DEVICE_ATTR(ob_log, S_IRUGO, pm8001_ctl_ob_queue_log_show, NULL);
  427. /**
  428. * pm8001_ctl_bios_version_show - Bios version Display
  429. * @cdev:pointer to embedded class device
  430. * @attr: device attribute (unused)
  431. * @buf:the buffer returned
  432. *
  433. * A sysfs 'read-only' shost attribute.
  434. */
  435. static ssize_t pm8001_ctl_bios_version_show(struct device *cdev,
  436. struct device_attribute *attr, char *buf)
  437. {
  438. struct Scsi_Host *shost = class_to_shost(cdev);
  439. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  440. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  441. char *str = buf;
  442. int bios_index;
  443. DECLARE_COMPLETION_ONSTACK(completion);
  444. struct pm8001_ioctl_payload payload;
  445. pm8001_ha->nvmd_completion = &completion;
  446. payload.minor_function = 7;
  447. payload.offset = 0;
  448. payload.rd_length = 4096;
  449. payload.func_specific = kzalloc(4096, GFP_KERNEL);
  450. if (!payload.func_specific)
  451. return -ENOMEM;
  452. if (PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload)) {
  453. kfree(payload.func_specific);
  454. return -ENOMEM;
  455. }
  456. wait_for_completion(&completion);
  457. for (bios_index = BIOSOFFSET; bios_index < BIOS_OFFSET_LIMIT;
  458. bios_index++)
  459. str += sprintf(str, "%c",
  460. *(payload.func_specific+bios_index));
  461. kfree(payload.func_specific);
  462. return str - buf;
  463. }
  464. static DEVICE_ATTR(bios_version, S_IRUGO, pm8001_ctl_bios_version_show, NULL);
  465. /**
  466. * event_log_size_show - event log size
  467. * @cdev: pointer to embedded class device
  468. * @attr: device attribute (unused)
  469. * @buf: the buffer returned
  470. *
  471. * A sysfs read shost attribute.
  472. */
  473. static ssize_t event_log_size_show(struct device *cdev,
  474. struct device_attribute *attr, char *buf)
  475. {
  476. struct Scsi_Host *shost = class_to_shost(cdev);
  477. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  478. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  479. return sysfs_emit(buf, "%d\n",
  480. pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_size);
  481. }
  482. static DEVICE_ATTR_RO(event_log_size);
  483. /**
  484. * pm8001_ctl_iop_log_show - IOP event log
  485. * @cdev: pointer to embedded class device
  486. * @attr: device attribute (unused)
  487. * @buf: the buffer returned
  488. *
  489. * A sysfs 'read-only' shost attribute.
  490. */
  491. static ssize_t pm8001_ctl_iop_log_show(struct device *cdev,
  492. struct device_attribute *attr, char *buf)
  493. {
  494. struct Scsi_Host *shost = class_to_shost(cdev);
  495. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  496. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  497. char *str = buf;
  498. u32 read_size =
  499. pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_size / 1024;
  500. u32 max_read_times = 32;
  501. u32 max_count = (read_size * 1024) / (max_read_times * 4);
  502. u32 *temp = (u32 *)pm8001_ha->memoryMap.region[IOP].virt_ptr;
  503. mutex_lock(&pm8001_ha->iop_log_lock);
  504. if ((pm8001_ha->iop_log_count % max_count) == 0) {
  505. pm8001_ha->iop_log_start = 0;
  506. pm8001_ha->iop_log_end = max_read_times;
  507. pm8001_ha->iop_log_count = 0;
  508. } else {
  509. pm8001_ha->iop_log_start = pm8001_ha->iop_log_end;
  510. pm8001_ha->iop_log_end = pm8001_ha->iop_log_end + max_read_times;
  511. }
  512. for (; pm8001_ha->iop_log_start < pm8001_ha->iop_log_end; pm8001_ha->iop_log_start++)
  513. str += sprintf(str, "%08x ", *(temp+pm8001_ha->iop_log_start));
  514. pm8001_ha->iop_log_count++;
  515. mutex_unlock(&pm8001_ha->iop_log_lock);
  516. return str - buf;
  517. }
  518. static DEVICE_ATTR(iop_log, S_IRUGO, pm8001_ctl_iop_log_show, NULL);
  519. /**
  520. * pm8001_ctl_fatal_log_show - fatal error logging
  521. * @cdev:pointer to embedded class device
  522. * @attr: device attribute
  523. * @buf: the buffer returned
  524. *
  525. * A sysfs 'read-only' shost attribute.
  526. */
  527. static ssize_t pm8001_ctl_fatal_log_show(struct device *cdev,
  528. struct device_attribute *attr, char *buf)
  529. {
  530. ssize_t count;
  531. count = pm80xx_get_fatal_dump(cdev, attr, buf);
  532. return count;
  533. }
  534. static DEVICE_ATTR(fatal_log, S_IRUGO, pm8001_ctl_fatal_log_show, NULL);
  535. /**
  536. * non_fatal_log_show - non fatal error logging
  537. * @cdev:pointer to embedded class device
  538. * @attr: device attribute
  539. * @buf: the buffer returned
  540. *
  541. * A sysfs 'read-only' shost attribute.
  542. */
  543. static ssize_t non_fatal_log_show(struct device *cdev,
  544. struct device_attribute *attr, char *buf)
  545. {
  546. u32 count;
  547. count = pm80xx_get_non_fatal_dump(cdev, attr, buf);
  548. return count;
  549. }
  550. static DEVICE_ATTR_RO(non_fatal_log);
  551. static ssize_t non_fatal_count_show(struct device *cdev,
  552. struct device_attribute *attr, char *buf)
  553. {
  554. struct Scsi_Host *shost = class_to_shost(cdev);
  555. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  556. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  557. return sysfs_emit(buf, "%08x\n",
  558. pm8001_ha->non_fatal_count);
  559. }
  560. static ssize_t non_fatal_count_store(struct device *cdev,
  561. struct device_attribute *attr, const char *buf, size_t count)
  562. {
  563. struct Scsi_Host *shost = class_to_shost(cdev);
  564. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  565. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  566. int val = 0;
  567. if (kstrtoint(buf, 16, &val) != 0)
  568. return -EINVAL;
  569. pm8001_ha->non_fatal_count = val;
  570. return strlen(buf);
  571. }
  572. static DEVICE_ATTR_RW(non_fatal_count);
  573. /**
  574. * pm8001_ctl_gsm_log_show - gsm dump collection
  575. * @cdev:pointer to embedded class device
  576. * @attr: device attribute (unused)
  577. * @buf: the buffer returned
  578. *
  579. * A sysfs 'read-only' shost attribute.
  580. */
  581. static ssize_t pm8001_ctl_gsm_log_show(struct device *cdev,
  582. struct device_attribute *attr, char *buf)
  583. {
  584. ssize_t count;
  585. count = pm8001_get_gsm_dump(cdev, SYSFS_OFFSET, buf);
  586. return count;
  587. }
  588. static DEVICE_ATTR(gsm_log, S_IRUGO, pm8001_ctl_gsm_log_show, NULL);
  589. #define FLASH_CMD_NONE 0x00
  590. #define FLASH_CMD_UPDATE 0x01
  591. #define FLASH_CMD_SET_NVMD 0x02
  592. struct flash_command {
  593. u8 command[8] __nonstring;
  594. int code;
  595. };
  596. static const struct flash_command flash_command_table[] = {
  597. {"set_nvmd", FLASH_CMD_SET_NVMD},
  598. {"update", FLASH_CMD_UPDATE},
  599. {"", FLASH_CMD_NONE} /* Last entry should be NULL. */
  600. };
  601. struct error_fw {
  602. char *reason;
  603. int err_code;
  604. };
  605. static const struct error_fw flash_error_table[] = {
  606. {"Failed to open fw image file", FAIL_OPEN_BIOS_FILE},
  607. {"image header mismatch", FLASH_UPDATE_HDR_ERR},
  608. {"image offset mismatch", FLASH_UPDATE_OFFSET_ERR},
  609. {"image CRC Error", FLASH_UPDATE_CRC_ERR},
  610. {"image length Error.", FLASH_UPDATE_LENGTH_ERR},
  611. {"Failed to program flash chip", FLASH_UPDATE_HW_ERR},
  612. {"Flash chip not supported.", FLASH_UPDATE_DNLD_NOT_SUPPORTED},
  613. {"Flash update disabled.", FLASH_UPDATE_DISABLED},
  614. {"Flash in progress", FLASH_IN_PROGRESS},
  615. {"Image file size Error", FAIL_FILE_SIZE},
  616. {"Input parameter error", FAIL_PARAMETERS},
  617. {"Out of memory", FAIL_OUT_MEMORY},
  618. {"OK", 0} /* Last entry err_code = 0. */
  619. };
  620. static int pm8001_set_nvmd(struct pm8001_hba_info *pm8001_ha)
  621. {
  622. struct pm8001_ioctl_payload *payload;
  623. DECLARE_COMPLETION_ONSTACK(completion);
  624. u8 *ioctlbuffer;
  625. int ret;
  626. u32 length = 1024 * 5 + sizeof(*payload) - 1;
  627. if (pm8001_ha->fw_image->size > 4096) {
  628. pm8001_ha->fw_status = FAIL_FILE_SIZE;
  629. return -EFAULT;
  630. }
  631. ioctlbuffer = kzalloc(length, GFP_KERNEL);
  632. if (!ioctlbuffer) {
  633. pm8001_ha->fw_status = FAIL_OUT_MEMORY;
  634. return -ENOMEM;
  635. }
  636. payload = (struct pm8001_ioctl_payload *)ioctlbuffer;
  637. memcpy((u8 *)&payload->func_specific, (u8 *)pm8001_ha->fw_image->data,
  638. pm8001_ha->fw_image->size);
  639. payload->wr_length = pm8001_ha->fw_image->size;
  640. payload->id = 0;
  641. payload->minor_function = 0x1;
  642. pm8001_ha->nvmd_completion = &completion;
  643. ret = PM8001_CHIP_DISP->set_nvmd_req(pm8001_ha, payload);
  644. if (ret) {
  645. pm8001_ha->fw_status = FAIL_OUT_MEMORY;
  646. goto out;
  647. }
  648. wait_for_completion(&completion);
  649. out:
  650. kfree(ioctlbuffer);
  651. return ret;
  652. }
  653. static int pm8001_update_flash(struct pm8001_hba_info *pm8001_ha)
  654. {
  655. struct pm8001_ioctl_payload *payload;
  656. DECLARE_COMPLETION_ONSTACK(completion);
  657. u8 *ioctlbuffer;
  658. struct fw_control_info *fwControl;
  659. __be32 partitionSizeTmp;
  660. u32 partitionSize;
  661. u32 loopNumber, loopcount;
  662. struct pm8001_fw_image_header *image_hdr;
  663. u32 sizeRead = 0;
  664. u32 ret = 0;
  665. u32 length = 1024 * 16 + sizeof(*payload) - 1;
  666. u32 fc_len;
  667. u8 *read_buf;
  668. if (pm8001_ha->fw_image->size < 28) {
  669. pm8001_ha->fw_status = FAIL_FILE_SIZE;
  670. return -EFAULT;
  671. }
  672. ioctlbuffer = kzalloc(length, GFP_KERNEL);
  673. if (!ioctlbuffer) {
  674. pm8001_ha->fw_status = FAIL_OUT_MEMORY;
  675. return -ENOMEM;
  676. }
  677. image_hdr = (struct pm8001_fw_image_header *)pm8001_ha->fw_image->data;
  678. while (sizeRead < pm8001_ha->fw_image->size) {
  679. partitionSizeTmp =
  680. *(__be32 *)((u8 *)&image_hdr->image_length + sizeRead);
  681. partitionSize = be32_to_cpu(partitionSizeTmp);
  682. loopcount = DIV_ROUND_UP(partitionSize + HEADER_LEN,
  683. IOCTL_BUF_SIZE);
  684. for (loopNumber = 0; loopNumber < loopcount; loopNumber++) {
  685. payload = (struct pm8001_ioctl_payload *)ioctlbuffer;
  686. payload->wr_length = 1024*16;
  687. payload->id = 0;
  688. fwControl =
  689. (struct fw_control_info *)&payload->func_specific;
  690. fwControl->len = IOCTL_BUF_SIZE; /* IN */
  691. fwControl->size = partitionSize + HEADER_LEN;/* IN */
  692. fwControl->retcode = 0;/* OUT */
  693. fwControl->offset = loopNumber * IOCTL_BUF_SIZE;/*OUT */
  694. /*
  695. * for the last chunk of data in case file size is
  696. * not even with 4k, load only the rest
  697. */
  698. read_buf = (u8 *)pm8001_ha->fw_image->data + sizeRead;
  699. fc_len = (partitionSize + HEADER_LEN) % IOCTL_BUF_SIZE;
  700. if (loopcount - loopNumber == 1 && fc_len) {
  701. fwControl->len = fc_len;
  702. memcpy((u8 *)fwControl->buffer, read_buf, fc_len);
  703. sizeRead += fc_len;
  704. } else {
  705. memcpy((u8 *)fwControl->buffer, read_buf, IOCTL_BUF_SIZE);
  706. sizeRead += IOCTL_BUF_SIZE;
  707. }
  708. pm8001_ha->nvmd_completion = &completion;
  709. ret = PM8001_CHIP_DISP->fw_flash_update_req(pm8001_ha, payload);
  710. if (ret) {
  711. pm8001_ha->fw_status = FAIL_OUT_MEMORY;
  712. goto out;
  713. }
  714. wait_for_completion(&completion);
  715. if (fwControl->retcode > FLASH_UPDATE_IN_PROGRESS) {
  716. pm8001_ha->fw_status = fwControl->retcode;
  717. ret = -EFAULT;
  718. goto out;
  719. }
  720. }
  721. }
  722. out:
  723. kfree(ioctlbuffer);
  724. return ret;
  725. }
  726. static ssize_t pm8001_store_update_fw(struct device *cdev,
  727. struct device_attribute *attr,
  728. const char *buf, size_t count)
  729. {
  730. struct Scsi_Host *shost = class_to_shost(cdev);
  731. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  732. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  733. char *cmd_ptr, *filename_ptr;
  734. int res, i;
  735. int flash_command = FLASH_CMD_NONE;
  736. int ret;
  737. if (!capable(CAP_SYS_ADMIN))
  738. return -EACCES;
  739. /* this test protects us from running two flash processes at once,
  740. * so we should start with this test */
  741. if (pm8001_ha->fw_status == FLASH_IN_PROGRESS)
  742. return -EINPROGRESS;
  743. pm8001_ha->fw_status = FLASH_IN_PROGRESS;
  744. cmd_ptr = kcalloc(count, 2, GFP_KERNEL);
  745. if (!cmd_ptr) {
  746. pm8001_ha->fw_status = FAIL_OUT_MEMORY;
  747. return -ENOMEM;
  748. }
  749. filename_ptr = cmd_ptr + count;
  750. res = sscanf(buf, "%s %s", cmd_ptr, filename_ptr);
  751. if (res != 2) {
  752. pm8001_ha->fw_status = FAIL_PARAMETERS;
  753. ret = -EINVAL;
  754. goto out;
  755. }
  756. for (i = 0; flash_command_table[i].code != FLASH_CMD_NONE; i++) {
  757. if (!memcmp(flash_command_table[i].command,
  758. cmd_ptr, strlen(cmd_ptr))) {
  759. flash_command = flash_command_table[i].code;
  760. break;
  761. }
  762. }
  763. if (flash_command == FLASH_CMD_NONE) {
  764. pm8001_ha->fw_status = FAIL_PARAMETERS;
  765. ret = -EINVAL;
  766. goto out;
  767. }
  768. ret = request_firmware(&pm8001_ha->fw_image,
  769. filename_ptr,
  770. pm8001_ha->dev);
  771. if (ret) {
  772. pm8001_dbg(pm8001_ha, FAIL,
  773. "Failed to load firmware image file %s, error %d\n",
  774. filename_ptr, ret);
  775. pm8001_ha->fw_status = FAIL_OPEN_BIOS_FILE;
  776. goto out;
  777. }
  778. if (FLASH_CMD_UPDATE == flash_command)
  779. ret = pm8001_update_flash(pm8001_ha);
  780. else
  781. ret = pm8001_set_nvmd(pm8001_ha);
  782. release_firmware(pm8001_ha->fw_image);
  783. out:
  784. kfree(cmd_ptr);
  785. if (ret)
  786. return ret;
  787. pm8001_ha->fw_status = FLASH_OK;
  788. return count;
  789. }
  790. static ssize_t pm8001_show_update_fw(struct device *cdev,
  791. struct device_attribute *attr, char *buf)
  792. {
  793. int i;
  794. struct Scsi_Host *shost = class_to_shost(cdev);
  795. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  796. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  797. for (i = 0; flash_error_table[i].err_code != 0; i++) {
  798. if (flash_error_table[i].err_code == pm8001_ha->fw_status)
  799. break;
  800. }
  801. if (pm8001_ha->fw_status != FLASH_IN_PROGRESS)
  802. pm8001_ha->fw_status = FLASH_OK;
  803. return sysfs_emit(buf, "status=%x %s\n",
  804. flash_error_table[i].err_code,
  805. flash_error_table[i].reason);
  806. }
  807. static DEVICE_ATTR(update_fw, S_IRUGO|S_IWUSR|S_IWGRP,
  808. pm8001_show_update_fw, pm8001_store_update_fw);
  809. static const char *const mpiStateText[] = {
  810. "MPI is not initialized",
  811. "MPI is successfully initialized",
  812. "MPI termination is in progress",
  813. "MPI initialization failed with error in [31:16]"
  814. };
  815. /**
  816. * ctl_mpi_state_show - controller MPI state check
  817. * @cdev: pointer to embedded class device
  818. * @attr: device attribute (unused)
  819. * @buf: the buffer returned
  820. *
  821. * A sysfs 'read-only' shost attribute.
  822. */
  823. static ssize_t ctl_mpi_state_show(struct device *cdev,
  824. struct device_attribute *attr, char *buf)
  825. {
  826. struct Scsi_Host *shost = class_to_shost(cdev);
  827. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  828. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  829. unsigned int mpidw0;
  830. mpidw0 = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 0);
  831. return sysfs_emit(buf, "%s\n", mpiStateText[mpidw0 & 0x0003]);
  832. }
  833. static DEVICE_ATTR_RO(ctl_mpi_state);
  834. /**
  835. * ctl_hmi_error_show - controller MPI initialization fails
  836. * @cdev: pointer to embedded class device
  837. * @attr: device attribute (unused)
  838. * @buf: the buffer returned
  839. *
  840. * A sysfs 'read-only' shost attribute.
  841. */
  842. static ssize_t ctl_hmi_error_show(struct device *cdev,
  843. struct device_attribute *attr, char *buf)
  844. {
  845. struct Scsi_Host *shost = class_to_shost(cdev);
  846. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  847. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  848. unsigned int mpidw0;
  849. mpidw0 = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 0);
  850. return sysfs_emit(buf, "0x%08x\n", (mpidw0 >> 16));
  851. }
  852. static DEVICE_ATTR_RO(ctl_hmi_error);
  853. /**
  854. * ctl_raae_count_show - controller raae count check
  855. * @cdev: pointer to embedded class device
  856. * @attr: device attribute (unused)
  857. * @buf: the buffer returned
  858. *
  859. * A sysfs 'read-only' shost attribute.
  860. */
  861. static ssize_t ctl_raae_count_show(struct device *cdev,
  862. struct device_attribute *attr, char *buf)
  863. {
  864. struct Scsi_Host *shost = class_to_shost(cdev);
  865. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  866. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  867. unsigned int raaecnt;
  868. raaecnt = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 12);
  869. return sysfs_emit(buf, "0x%08x\n", raaecnt);
  870. }
  871. static DEVICE_ATTR_RO(ctl_raae_count);
  872. /**
  873. * ctl_iop0_count_show - controller iop0 count check
  874. * @cdev: pointer to embedded class device
  875. * @attr: device attribute (unused)
  876. * @buf: the buffer returned
  877. *
  878. * A sysfs 'read-only' shost attribute.
  879. */
  880. static ssize_t ctl_iop0_count_show(struct device *cdev,
  881. struct device_attribute *attr, char *buf)
  882. {
  883. struct Scsi_Host *shost = class_to_shost(cdev);
  884. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  885. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  886. unsigned int iop0cnt;
  887. iop0cnt = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 16);
  888. return sysfs_emit(buf, "0x%08x\n", iop0cnt);
  889. }
  890. static DEVICE_ATTR_RO(ctl_iop0_count);
  891. /**
  892. * ctl_iop1_count_show - controller iop1 count check
  893. * @cdev: pointer to embedded class device
  894. * @attr: device attribute (unused)
  895. * @buf: the buffer returned
  896. *
  897. * A sysfs 'read-only' shost attribute.
  898. */
  899. static ssize_t ctl_iop1_count_show(struct device *cdev,
  900. struct device_attribute *attr, char *buf)
  901. {
  902. struct Scsi_Host *shost = class_to_shost(cdev);
  903. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  904. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  905. unsigned int iop1cnt;
  906. iop1cnt = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 20);
  907. return sysfs_emit(buf, "0x%08x\n", iop1cnt);
  908. }
  909. static DEVICE_ATTR_RO(ctl_iop1_count);
  910. static struct attribute *pm8001_host_attrs[] = {
  911. &dev_attr_interface_rev.attr,
  912. &dev_attr_controller_fatal_error.attr,
  913. &dev_attr_fw_version.attr,
  914. &dev_attr_update_fw.attr,
  915. &dev_attr_aap_log.attr,
  916. &dev_attr_iop_log.attr,
  917. &dev_attr_fatal_log.attr,
  918. &dev_attr_non_fatal_log.attr,
  919. &dev_attr_non_fatal_count.attr,
  920. &dev_attr_gsm_log.attr,
  921. &dev_attr_max_out_io.attr,
  922. &dev_attr_max_devices.attr,
  923. &dev_attr_max_sg_list.attr,
  924. &dev_attr_sas_spec_support.attr,
  925. &dev_attr_logging_level.attr,
  926. &dev_attr_event_log_size.attr,
  927. &dev_attr_host_sas_address.attr,
  928. &dev_attr_bios_version.attr,
  929. &dev_attr_ib_log.attr,
  930. &dev_attr_ob_log.attr,
  931. &dev_attr_ila_version.attr,
  932. &dev_attr_inc_fw_ver.attr,
  933. &dev_attr_ctl_mpi_state.attr,
  934. &dev_attr_ctl_hmi_error.attr,
  935. &dev_attr_ctl_raae_count.attr,
  936. &dev_attr_ctl_iop0_count.attr,
  937. &dev_attr_ctl_iop1_count.attr,
  938. NULL,
  939. };
  940. static const struct attribute_group pm8001_host_attr_group = {
  941. .attrs = pm8001_host_attrs
  942. };
  943. const struct attribute_group *pm8001_host_groups[] = {
  944. &pm8001_host_attr_group,
  945. NULL
  946. };
  947. const struct attribute_group *pm8001_sdev_groups[] = {
  948. &sas_ata_sdev_attr_group,
  949. NULL
  950. };