pm8001_ctl.c 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  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 snprintf(buf, PAGE_SIZE, "%d\n",
  62. pm8001_ha->main_cfg_tbl.pm8001_tbl.interface_rev);
  63. } else {
  64. return snprintf(buf, PAGE_SIZE, "%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 snprintf(buf, PAGE_SIZE, "%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 snprintf(buf, PAGE_SIZE, "%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 snprintf(buf, PAGE_SIZE, "%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 snprintf(buf, PAGE_SIZE, "%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 snprintf(buf, PAGE_SIZE, "%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 snprintf(buf, PAGE_SIZE, "%d\n",
  182. pm8001_ha->main_cfg_tbl.pm8001_tbl.max_out_io);
  183. } else {
  184. return snprintf(buf, PAGE_SIZE, "%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 snprintf(buf, PAGE_SIZE, "%04d\n",
  205. (u16)(pm8001_ha->main_cfg_tbl.pm8001_tbl.max_sgl >> 16)
  206. );
  207. } else {
  208. return snprintf(buf, PAGE_SIZE, "%04d\n",
  209. (u16)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_sgl >> 16)
  210. );
  211. }
  212. }
  213. static DEVICE_ATTR(max_devices, S_IRUGO, pm8001_ctl_max_devices_show, NULL);
  214. /**
  215. * pm8001_ctl_max_sg_list_show - max sg list supported iff not 0.0 for no
  216. * hardware limitation
  217. * @cdev: pointer to embedded class device
  218. * @attr: device attribute (unused)
  219. * @buf: the buffer returned
  220. *
  221. * A sysfs 'read-only' shost attribute.
  222. */
  223. static ssize_t pm8001_ctl_max_sg_list_show(struct device *cdev,
  224. struct device_attribute *attr, char *buf)
  225. {
  226. struct Scsi_Host *shost = class_to_shost(cdev);
  227. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  228. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  229. if (pm8001_ha->chip_id == chip_8001) {
  230. return snprintf(buf, PAGE_SIZE, "%04d\n",
  231. pm8001_ha->main_cfg_tbl.pm8001_tbl.max_sgl & 0x0000FFFF
  232. );
  233. } else {
  234. return snprintf(buf, PAGE_SIZE, "%04d\n",
  235. pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_sgl & 0x0000FFFF
  236. );
  237. }
  238. }
  239. static DEVICE_ATTR(max_sg_list, S_IRUGO, pm8001_ctl_max_sg_list_show, NULL);
  240. #define SAS_1_0 0x1
  241. #define SAS_1_1 0x2
  242. #define SAS_2_0 0x4
  243. static ssize_t
  244. show_sas_spec_support_status(unsigned int mode, char *buf)
  245. {
  246. ssize_t len = 0;
  247. if (mode & SAS_1_1)
  248. len = sprintf(buf, "%s", "SAS1.1");
  249. if (mode & SAS_2_0)
  250. len += sprintf(buf + len, "%s%s", len ? ", " : "", "SAS2.0");
  251. len += sprintf(buf + len, "\n");
  252. return len;
  253. }
  254. /**
  255. * pm8001_ctl_sas_spec_support_show - sas spec supported
  256. * @cdev: pointer to embedded class device
  257. * @attr: device attribute (unused)
  258. * @buf: the buffer returned
  259. *
  260. * A sysfs 'read-only' shost attribute.
  261. */
  262. static ssize_t pm8001_ctl_sas_spec_support_show(struct device *cdev,
  263. struct device_attribute *attr, char *buf)
  264. {
  265. unsigned int mode;
  266. struct Scsi_Host *shost = class_to_shost(cdev);
  267. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  268. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  269. /* fe000000 means supports SAS2.1 */
  270. if (pm8001_ha->chip_id == chip_8001)
  271. mode = (pm8001_ha->main_cfg_tbl.pm8001_tbl.ctrl_cap_flag &
  272. 0xfe000000)>>25;
  273. else
  274. /* fe000000 means supports SAS2.1 */
  275. mode = (pm8001_ha->main_cfg_tbl.pm80xx_tbl.ctrl_cap_flag &
  276. 0xfe000000)>>25;
  277. return show_sas_spec_support_status(mode, buf);
  278. }
  279. static DEVICE_ATTR(sas_spec_support, S_IRUGO,
  280. pm8001_ctl_sas_spec_support_show, NULL);
  281. /**
  282. * pm8001_ctl_host_sas_address_show - sas address
  283. * @cdev: pointer to embedded class device
  284. * @attr: device attribute (unused)
  285. * @buf: the buffer returned
  286. *
  287. * This is the controller sas address
  288. *
  289. * A sysfs 'read-only' shost attribute.
  290. */
  291. static ssize_t pm8001_ctl_host_sas_address_show(struct device *cdev,
  292. struct device_attribute *attr, char *buf)
  293. {
  294. struct Scsi_Host *shost = class_to_shost(cdev);
  295. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  296. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  297. return snprintf(buf, PAGE_SIZE, "0x%016llx\n",
  298. be64_to_cpu(*(__be64 *)pm8001_ha->sas_addr));
  299. }
  300. static DEVICE_ATTR(host_sas_address, S_IRUGO,
  301. pm8001_ctl_host_sas_address_show, NULL);
  302. /**
  303. * pm8001_ctl_logging_level_show - logging level
  304. * @cdev: pointer to embedded class device
  305. * @attr: device attribute (unused)
  306. * @buf: the buffer returned
  307. *
  308. * A sysfs 'read/write' shost attribute.
  309. */
  310. static ssize_t pm8001_ctl_logging_level_show(struct device *cdev,
  311. struct device_attribute *attr, char *buf)
  312. {
  313. struct Scsi_Host *shost = class_to_shost(cdev);
  314. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  315. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  316. return snprintf(buf, PAGE_SIZE, "%08xh\n", pm8001_ha->logging_level);
  317. }
  318. static ssize_t pm8001_ctl_logging_level_store(struct device *cdev,
  319. struct device_attribute *attr, const char *buf, size_t count)
  320. {
  321. struct Scsi_Host *shost = class_to_shost(cdev);
  322. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  323. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  324. int val = 0;
  325. if (sscanf(buf, "%x", &val) != 1)
  326. return -EINVAL;
  327. pm8001_ha->logging_level = val;
  328. return strlen(buf);
  329. }
  330. static DEVICE_ATTR(logging_level, S_IRUGO | S_IWUSR,
  331. pm8001_ctl_logging_level_show, pm8001_ctl_logging_level_store);
  332. /**
  333. * pm8001_ctl_aap_log_show - aap1 event log
  334. * @cdev: pointer to embedded class device
  335. * @attr: device attribute (unused)
  336. * @buf: the buffer returned
  337. *
  338. * A sysfs 'read-only' shost attribute.
  339. */
  340. static ssize_t pm8001_ctl_aap_log_show(struct device *cdev,
  341. struct device_attribute *attr, char *buf)
  342. {
  343. struct Scsi_Host *shost = class_to_shost(cdev);
  344. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  345. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  346. u8 *ptr = (u8 *)pm8001_ha->memoryMap.region[AAP1].virt_ptr;
  347. int i;
  348. char *str = buf;
  349. int max = 2;
  350. for (i = 0; i < max; i++) {
  351. str += sprintf(str, "0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x"
  352. "0x%08x 0x%08x\n",
  353. pm8001_ctl_aap1_memmap(ptr, i, 0),
  354. pm8001_ctl_aap1_memmap(ptr, i, 4),
  355. pm8001_ctl_aap1_memmap(ptr, i, 8),
  356. pm8001_ctl_aap1_memmap(ptr, i, 12),
  357. pm8001_ctl_aap1_memmap(ptr, i, 16),
  358. pm8001_ctl_aap1_memmap(ptr, i, 20),
  359. pm8001_ctl_aap1_memmap(ptr, i, 24),
  360. pm8001_ctl_aap1_memmap(ptr, i, 28));
  361. }
  362. return str - buf;
  363. }
  364. static DEVICE_ATTR(aap_log, S_IRUGO, pm8001_ctl_aap_log_show, NULL);
  365. /**
  366. * pm8001_ctl_ib_queue_log_show - Out bound Queue log
  367. * @cdev:pointer to embedded class device
  368. * @attr: device attribute (unused)
  369. * @buf: the buffer returned
  370. *
  371. * A sysfs 'read-only' shost attribute.
  372. */
  373. static ssize_t pm8001_ctl_ib_queue_log_show(struct device *cdev,
  374. struct device_attribute *attr, char *buf)
  375. {
  376. struct Scsi_Host *shost = class_to_shost(cdev);
  377. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  378. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  379. int offset;
  380. char *str = buf;
  381. int start = 0;
  382. u32 ib_offset = pm8001_ha->ib_offset;
  383. u32 queue_size = pm8001_ha->max_q_num * PM8001_MPI_QUEUE * 128;
  384. #define IB_MEMMAP(c) \
  385. (*(u32 *)((u8 *)pm8001_ha-> \
  386. memoryMap.region[ib_offset].virt_ptr + \
  387. pm8001_ha->evtlog_ib_offset + (c)))
  388. for (offset = 0; offset < IB_OB_READ_TIMES; offset++) {
  389. str += sprintf(str, "0x%08x\n", IB_MEMMAP(start));
  390. start = start + 4;
  391. }
  392. pm8001_ha->evtlog_ib_offset += SYSFS_OFFSET;
  393. if (((pm8001_ha->evtlog_ib_offset) % queue_size) == 0)
  394. pm8001_ha->evtlog_ib_offset = 0;
  395. return str - buf;
  396. }
  397. static DEVICE_ATTR(ib_log, S_IRUGO, pm8001_ctl_ib_queue_log_show, NULL);
  398. /**
  399. * pm8001_ctl_ob_queue_log_show - Out bound Queue log
  400. * @cdev:pointer to embedded class device
  401. * @attr: device attribute (unused)
  402. * @buf: the buffer returned
  403. *
  404. * A sysfs 'read-only' shost attribute.
  405. */
  406. static ssize_t pm8001_ctl_ob_queue_log_show(struct device *cdev,
  407. struct device_attribute *attr, char *buf)
  408. {
  409. struct Scsi_Host *shost = class_to_shost(cdev);
  410. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  411. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  412. int offset;
  413. char *str = buf;
  414. int start = 0;
  415. u32 ob_offset = pm8001_ha->ob_offset;
  416. u32 queue_size = pm8001_ha->max_q_num * PM8001_MPI_QUEUE * 128;
  417. #define OB_MEMMAP(c) \
  418. (*(u32 *)((u8 *)pm8001_ha-> \
  419. memoryMap.region[ob_offset].virt_ptr + \
  420. pm8001_ha->evtlog_ob_offset + (c)))
  421. for (offset = 0; offset < IB_OB_READ_TIMES; offset++) {
  422. str += sprintf(str, "0x%08x\n", OB_MEMMAP(start));
  423. start = start + 4;
  424. }
  425. pm8001_ha->evtlog_ob_offset += SYSFS_OFFSET;
  426. if (((pm8001_ha->evtlog_ob_offset) % queue_size) == 0)
  427. pm8001_ha->evtlog_ob_offset = 0;
  428. return str - buf;
  429. }
  430. static DEVICE_ATTR(ob_log, S_IRUGO, pm8001_ctl_ob_queue_log_show, NULL);
  431. /**
  432. * pm8001_ctl_bios_version_show - Bios version Display
  433. * @cdev:pointer to embedded class device
  434. * @attr: device attribute (unused)
  435. * @buf:the buffer returned
  436. *
  437. * A sysfs 'read-only' shost attribute.
  438. */
  439. static ssize_t pm8001_ctl_bios_version_show(struct device *cdev,
  440. struct device_attribute *attr, char *buf)
  441. {
  442. struct Scsi_Host *shost = class_to_shost(cdev);
  443. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  444. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  445. char *str = buf;
  446. int bios_index;
  447. DECLARE_COMPLETION_ONSTACK(completion);
  448. struct pm8001_ioctl_payload payload;
  449. pm8001_ha->nvmd_completion = &completion;
  450. payload.minor_function = 7;
  451. payload.offset = 0;
  452. payload.rd_length = 4096;
  453. payload.func_specific = kzalloc(4096, GFP_KERNEL);
  454. if (!payload.func_specific)
  455. return -ENOMEM;
  456. if (PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload)) {
  457. kfree(payload.func_specific);
  458. return -ENOMEM;
  459. }
  460. wait_for_completion(&completion);
  461. for (bios_index = BIOSOFFSET; bios_index < BIOS_OFFSET_LIMIT;
  462. bios_index++)
  463. str += sprintf(str, "%c",
  464. *(payload.func_specific+bios_index));
  465. kfree(payload.func_specific);
  466. return str - buf;
  467. }
  468. static DEVICE_ATTR(bios_version, S_IRUGO, pm8001_ctl_bios_version_show, NULL);
  469. /**
  470. * event_log_size_show - event log size
  471. * @cdev: pointer to embedded class device
  472. * @attr: device attribute (unused)
  473. * @buf: the buffer returned
  474. *
  475. * A sysfs read shost attribute.
  476. */
  477. static ssize_t event_log_size_show(struct device *cdev,
  478. struct device_attribute *attr, char *buf)
  479. {
  480. struct Scsi_Host *shost = class_to_shost(cdev);
  481. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  482. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  483. return snprintf(buf, PAGE_SIZE, "%d\n",
  484. pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_size);
  485. }
  486. static DEVICE_ATTR_RO(event_log_size);
  487. /**
  488. * pm8001_ctl_iop_log_show - IOP event log
  489. * @cdev: pointer to embedded class device
  490. * @attr: device attribute (unused)
  491. * @buf: the buffer returned
  492. *
  493. * A sysfs 'read-only' shost attribute.
  494. */
  495. static ssize_t pm8001_ctl_iop_log_show(struct device *cdev,
  496. struct device_attribute *attr, char *buf)
  497. {
  498. struct Scsi_Host *shost = class_to_shost(cdev);
  499. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  500. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  501. char *str = buf;
  502. u32 read_size =
  503. pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_size / 1024;
  504. static u32 start, end, count;
  505. u32 max_read_times = 32;
  506. u32 max_count = (read_size * 1024) / (max_read_times * 4);
  507. u32 *temp = (u32 *)pm8001_ha->memoryMap.region[IOP].virt_ptr;
  508. if ((count % max_count) == 0) {
  509. start = 0;
  510. end = max_read_times;
  511. count = 0;
  512. } else {
  513. start = end;
  514. end = end + max_read_times;
  515. }
  516. for (; start < end; start++)
  517. str += sprintf(str, "%08x ", *(temp+start));
  518. count++;
  519. return str - buf;
  520. }
  521. static DEVICE_ATTR(iop_log, S_IRUGO, pm8001_ctl_iop_log_show, NULL);
  522. /**
  523. * pm8001_ctl_fatal_log_show - fatal error logging
  524. * @cdev:pointer to embedded class device
  525. * @attr: device attribute
  526. * @buf: the buffer returned
  527. *
  528. * A sysfs 'read-only' shost attribute.
  529. */
  530. static ssize_t pm8001_ctl_fatal_log_show(struct device *cdev,
  531. struct device_attribute *attr, char *buf)
  532. {
  533. ssize_t count;
  534. count = pm80xx_get_fatal_dump(cdev, attr, buf);
  535. return count;
  536. }
  537. static DEVICE_ATTR(fatal_log, S_IRUGO, pm8001_ctl_fatal_log_show, NULL);
  538. /**
  539. * non_fatal_log_show - non fatal error logging
  540. * @cdev:pointer to embedded class device
  541. * @attr: device attribute
  542. * @buf: the buffer returned
  543. *
  544. * A sysfs 'read-only' shost attribute.
  545. */
  546. static ssize_t non_fatal_log_show(struct device *cdev,
  547. struct device_attribute *attr, char *buf)
  548. {
  549. u32 count;
  550. count = pm80xx_get_non_fatal_dump(cdev, attr, buf);
  551. return count;
  552. }
  553. static DEVICE_ATTR_RO(non_fatal_log);
  554. static ssize_t non_fatal_count_show(struct device *cdev,
  555. struct device_attribute *attr, char *buf)
  556. {
  557. struct Scsi_Host *shost = class_to_shost(cdev);
  558. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  559. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  560. return snprintf(buf, PAGE_SIZE, "%08x",
  561. pm8001_ha->non_fatal_count);
  562. }
  563. static ssize_t non_fatal_count_store(struct device *cdev,
  564. struct device_attribute *attr, const char *buf, size_t count)
  565. {
  566. struct Scsi_Host *shost = class_to_shost(cdev);
  567. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  568. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  569. int val = 0;
  570. if (kstrtoint(buf, 16, &val) != 0)
  571. return -EINVAL;
  572. pm8001_ha->non_fatal_count = val;
  573. return strlen(buf);
  574. }
  575. static DEVICE_ATTR_RW(non_fatal_count);
  576. /**
  577. * pm8001_ctl_gsm_log_show - gsm dump collection
  578. * @cdev:pointer to embedded class device
  579. * @attr: device attribute (unused)
  580. * @buf: the buffer returned
  581. *
  582. * A sysfs 'read-only' shost attribute.
  583. */
  584. static ssize_t pm8001_ctl_gsm_log_show(struct device *cdev,
  585. struct device_attribute *attr, char *buf)
  586. {
  587. ssize_t count;
  588. count = pm8001_get_gsm_dump(cdev, SYSFS_OFFSET, buf);
  589. return count;
  590. }
  591. static DEVICE_ATTR(gsm_log, S_IRUGO, pm8001_ctl_gsm_log_show, NULL);
  592. #define FLASH_CMD_NONE 0x00
  593. #define FLASH_CMD_UPDATE 0x01
  594. #define FLASH_CMD_SET_NVMD 0x02
  595. struct flash_command {
  596. u8 command[8];
  597. int code;
  598. };
  599. static const struct flash_command flash_command_table[] = {
  600. {"set_nvmd", FLASH_CMD_SET_NVMD},
  601. {"update", FLASH_CMD_UPDATE},
  602. {"", FLASH_CMD_NONE} /* Last entry should be NULL. */
  603. };
  604. struct error_fw {
  605. char *reason;
  606. int err_code;
  607. };
  608. static const struct error_fw flash_error_table[] = {
  609. {"Failed to open fw image file", FAIL_OPEN_BIOS_FILE},
  610. {"image header mismatch", FLASH_UPDATE_HDR_ERR},
  611. {"image offset mismatch", FLASH_UPDATE_OFFSET_ERR},
  612. {"image CRC Error", FLASH_UPDATE_CRC_ERR},
  613. {"image length Error.", FLASH_UPDATE_LENGTH_ERR},
  614. {"Failed to program flash chip", FLASH_UPDATE_HW_ERR},
  615. {"Flash chip not supported.", FLASH_UPDATE_DNLD_NOT_SUPPORTED},
  616. {"Flash update disabled.", FLASH_UPDATE_DISABLED},
  617. {"Flash in progress", FLASH_IN_PROGRESS},
  618. {"Image file size Error", FAIL_FILE_SIZE},
  619. {"Input parameter error", FAIL_PARAMETERS},
  620. {"Out of memory", FAIL_OUT_MEMORY},
  621. {"OK", 0} /* Last entry err_code = 0. */
  622. };
  623. static int pm8001_set_nvmd(struct pm8001_hba_info *pm8001_ha)
  624. {
  625. struct pm8001_ioctl_payload *payload;
  626. DECLARE_COMPLETION_ONSTACK(completion);
  627. u8 *ioctlbuffer;
  628. u32 ret;
  629. u32 length = 1024 * 5 + sizeof(*payload) - 1;
  630. if (pm8001_ha->fw_image->size > 4096) {
  631. pm8001_ha->fw_status = FAIL_FILE_SIZE;
  632. return -EFAULT;
  633. }
  634. ioctlbuffer = kzalloc(length, GFP_KERNEL);
  635. if (!ioctlbuffer) {
  636. pm8001_ha->fw_status = FAIL_OUT_MEMORY;
  637. return -ENOMEM;
  638. }
  639. payload = (struct pm8001_ioctl_payload *)ioctlbuffer;
  640. memcpy((u8 *)&payload->func_specific, (u8 *)pm8001_ha->fw_image->data,
  641. pm8001_ha->fw_image->size);
  642. payload->wr_length = pm8001_ha->fw_image->size;
  643. payload->id = 0;
  644. payload->minor_function = 0x1;
  645. pm8001_ha->nvmd_completion = &completion;
  646. ret = PM8001_CHIP_DISP->set_nvmd_req(pm8001_ha, payload);
  647. if (ret) {
  648. pm8001_ha->fw_status = FAIL_OUT_MEMORY;
  649. goto out;
  650. }
  651. wait_for_completion(&completion);
  652. out:
  653. kfree(ioctlbuffer);
  654. return ret;
  655. }
  656. static int pm8001_update_flash(struct pm8001_hba_info *pm8001_ha)
  657. {
  658. struct pm8001_ioctl_payload *payload;
  659. DECLARE_COMPLETION_ONSTACK(completion);
  660. u8 *ioctlbuffer;
  661. struct fw_control_info *fwControl;
  662. __be32 partitionSizeTmp;
  663. u32 partitionSize;
  664. u32 loopNumber, loopcount;
  665. struct pm8001_fw_image_header *image_hdr;
  666. u32 sizeRead = 0;
  667. u32 ret = 0;
  668. u32 length = 1024 * 16 + sizeof(*payload) - 1;
  669. u32 fc_len;
  670. u8 *read_buf;
  671. if (pm8001_ha->fw_image->size < 28) {
  672. pm8001_ha->fw_status = FAIL_FILE_SIZE;
  673. return -EFAULT;
  674. }
  675. ioctlbuffer = kzalloc(length, GFP_KERNEL);
  676. if (!ioctlbuffer) {
  677. pm8001_ha->fw_status = FAIL_OUT_MEMORY;
  678. return -ENOMEM;
  679. }
  680. image_hdr = (struct pm8001_fw_image_header *)pm8001_ha->fw_image->data;
  681. while (sizeRead < pm8001_ha->fw_image->size) {
  682. partitionSizeTmp =
  683. *(__be32 *)((u8 *)&image_hdr->image_length + sizeRead);
  684. partitionSize = be32_to_cpu(partitionSizeTmp);
  685. loopcount = DIV_ROUND_UP(partitionSize + HEADER_LEN,
  686. IOCTL_BUF_SIZE);
  687. for (loopNumber = 0; loopNumber < loopcount; loopNumber++) {
  688. payload = (struct pm8001_ioctl_payload *)ioctlbuffer;
  689. payload->wr_length = 1024*16;
  690. payload->id = 0;
  691. fwControl =
  692. (struct fw_control_info *)&payload->func_specific;
  693. fwControl->len = IOCTL_BUF_SIZE; /* IN */
  694. fwControl->size = partitionSize + HEADER_LEN;/* IN */
  695. fwControl->retcode = 0;/* OUT */
  696. fwControl->offset = loopNumber * IOCTL_BUF_SIZE;/*OUT */
  697. /*
  698. * for the last chunk of data in case file size is
  699. * not even with 4k, load only the rest
  700. */
  701. read_buf = (u8 *)pm8001_ha->fw_image->data + sizeRead;
  702. fc_len = (partitionSize + HEADER_LEN) % IOCTL_BUF_SIZE;
  703. if (loopcount - loopNumber == 1 && fc_len) {
  704. fwControl->len = fc_len;
  705. memcpy((u8 *)fwControl->buffer, read_buf, fc_len);
  706. sizeRead += fc_len;
  707. } else {
  708. memcpy((u8 *)fwControl->buffer, read_buf, IOCTL_BUF_SIZE);
  709. sizeRead += IOCTL_BUF_SIZE;
  710. }
  711. pm8001_ha->nvmd_completion = &completion;
  712. ret = PM8001_CHIP_DISP->fw_flash_update_req(pm8001_ha, payload);
  713. if (ret) {
  714. pm8001_ha->fw_status = FAIL_OUT_MEMORY;
  715. goto out;
  716. }
  717. wait_for_completion(&completion);
  718. if (fwControl->retcode > FLASH_UPDATE_IN_PROGRESS) {
  719. pm8001_ha->fw_status = fwControl->retcode;
  720. ret = -EFAULT;
  721. goto out;
  722. }
  723. }
  724. }
  725. out:
  726. kfree(ioctlbuffer);
  727. return ret;
  728. }
  729. static ssize_t pm8001_store_update_fw(struct device *cdev,
  730. struct device_attribute *attr,
  731. const char *buf, size_t count)
  732. {
  733. struct Scsi_Host *shost = class_to_shost(cdev);
  734. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  735. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  736. char *cmd_ptr, *filename_ptr;
  737. int res, i;
  738. int flash_command = FLASH_CMD_NONE;
  739. int ret;
  740. if (!capable(CAP_SYS_ADMIN))
  741. return -EACCES;
  742. /* this test protects us from running two flash processes at once,
  743. * so we should start with this test */
  744. if (pm8001_ha->fw_status == FLASH_IN_PROGRESS)
  745. return -EINPROGRESS;
  746. pm8001_ha->fw_status = FLASH_IN_PROGRESS;
  747. cmd_ptr = kcalloc(count, 2, GFP_KERNEL);
  748. if (!cmd_ptr) {
  749. pm8001_ha->fw_status = FAIL_OUT_MEMORY;
  750. return -ENOMEM;
  751. }
  752. filename_ptr = cmd_ptr + count;
  753. res = sscanf(buf, "%s %s", cmd_ptr, filename_ptr);
  754. if (res != 2) {
  755. pm8001_ha->fw_status = FAIL_PARAMETERS;
  756. ret = -EINVAL;
  757. goto out;
  758. }
  759. for (i = 0; flash_command_table[i].code != FLASH_CMD_NONE; i++) {
  760. if (!memcmp(flash_command_table[i].command,
  761. cmd_ptr, strlen(cmd_ptr))) {
  762. flash_command = flash_command_table[i].code;
  763. break;
  764. }
  765. }
  766. if (flash_command == FLASH_CMD_NONE) {
  767. pm8001_ha->fw_status = FAIL_PARAMETERS;
  768. ret = -EINVAL;
  769. goto out;
  770. }
  771. ret = request_firmware(&pm8001_ha->fw_image,
  772. filename_ptr,
  773. pm8001_ha->dev);
  774. if (ret) {
  775. pm8001_dbg(pm8001_ha, FAIL,
  776. "Failed to load firmware image file %s, error %d\n",
  777. filename_ptr, ret);
  778. pm8001_ha->fw_status = FAIL_OPEN_BIOS_FILE;
  779. goto out;
  780. }
  781. if (FLASH_CMD_UPDATE == flash_command)
  782. ret = pm8001_update_flash(pm8001_ha);
  783. else
  784. ret = pm8001_set_nvmd(pm8001_ha);
  785. release_firmware(pm8001_ha->fw_image);
  786. out:
  787. kfree(cmd_ptr);
  788. if (ret)
  789. return ret;
  790. pm8001_ha->fw_status = FLASH_OK;
  791. return count;
  792. }
  793. static ssize_t pm8001_show_update_fw(struct device *cdev,
  794. struct device_attribute *attr, char *buf)
  795. {
  796. int i;
  797. struct Scsi_Host *shost = class_to_shost(cdev);
  798. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  799. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  800. for (i = 0; flash_error_table[i].err_code != 0; i++) {
  801. if (flash_error_table[i].err_code == pm8001_ha->fw_status)
  802. break;
  803. }
  804. if (pm8001_ha->fw_status != FLASH_IN_PROGRESS)
  805. pm8001_ha->fw_status = FLASH_OK;
  806. return snprintf(buf, PAGE_SIZE, "status=%x %s\n",
  807. flash_error_table[i].err_code,
  808. flash_error_table[i].reason);
  809. }
  810. static DEVICE_ATTR(update_fw, S_IRUGO|S_IWUSR|S_IWGRP,
  811. pm8001_show_update_fw, pm8001_store_update_fw);
  812. static const char *const mpiStateText[] = {
  813. "MPI is not initialized",
  814. "MPI is successfully initialized",
  815. "MPI termination is in progress",
  816. "MPI initialization failed with error in [31:16]"
  817. };
  818. /**
  819. * ctl_mpi_state_show - controller MPI state check
  820. * @cdev: pointer to embedded class device
  821. * @attr: device attribute (unused)
  822. * @buf: the buffer returned
  823. *
  824. * A sysfs 'read-only' shost attribute.
  825. */
  826. static ssize_t ctl_mpi_state_show(struct device *cdev,
  827. struct device_attribute *attr, char *buf)
  828. {
  829. struct Scsi_Host *shost = class_to_shost(cdev);
  830. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  831. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  832. unsigned int mpidw0;
  833. mpidw0 = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 0);
  834. return sysfs_emit(buf, "%s\n", mpiStateText[mpidw0 & 0x0003]);
  835. }
  836. static DEVICE_ATTR_RO(ctl_mpi_state);
  837. /**
  838. * ctl_hmi_error_show - controller MPI initialization fails
  839. * @cdev: pointer to embedded class device
  840. * @attr: device attribute (unused)
  841. * @buf: the buffer returned
  842. *
  843. * A sysfs 'read-only' shost attribute.
  844. */
  845. static ssize_t ctl_hmi_error_show(struct device *cdev,
  846. struct device_attribute *attr, char *buf)
  847. {
  848. struct Scsi_Host *shost = class_to_shost(cdev);
  849. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  850. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  851. unsigned int mpidw0;
  852. mpidw0 = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 0);
  853. return sysfs_emit(buf, "0x%08x\n", (mpidw0 >> 16));
  854. }
  855. static DEVICE_ATTR_RO(ctl_hmi_error);
  856. /**
  857. * ctl_raae_count_show - controller raae count check
  858. * @cdev: pointer to embedded class device
  859. * @attr: device attribute (unused)
  860. * @buf: the buffer returned
  861. *
  862. * A sysfs 'read-only' shost attribute.
  863. */
  864. static ssize_t ctl_raae_count_show(struct device *cdev,
  865. struct device_attribute *attr, char *buf)
  866. {
  867. struct Scsi_Host *shost = class_to_shost(cdev);
  868. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  869. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  870. unsigned int raaecnt;
  871. raaecnt = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 12);
  872. return sysfs_emit(buf, "0x%08x\n", raaecnt);
  873. }
  874. static DEVICE_ATTR_RO(ctl_raae_count);
  875. /**
  876. * ctl_iop0_count_show - controller iop0 count check
  877. * @cdev: pointer to embedded class device
  878. * @attr: device attribute (unused)
  879. * @buf: the buffer returned
  880. *
  881. * A sysfs 'read-only' shost attribute.
  882. */
  883. static ssize_t ctl_iop0_count_show(struct device *cdev,
  884. struct device_attribute *attr, char *buf)
  885. {
  886. struct Scsi_Host *shost = class_to_shost(cdev);
  887. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  888. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  889. unsigned int iop0cnt;
  890. iop0cnt = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 16);
  891. return sysfs_emit(buf, "0x%08x\n", iop0cnt);
  892. }
  893. static DEVICE_ATTR_RO(ctl_iop0_count);
  894. /**
  895. * ctl_iop1_count_show - controller iop1 count check
  896. * @cdev: pointer to embedded class device
  897. * @attr: device attribute (unused)
  898. * @buf: the buffer returned
  899. *
  900. * A sysfs 'read-only' shost attribute.
  901. */
  902. static ssize_t ctl_iop1_count_show(struct device *cdev,
  903. struct device_attribute *attr, char *buf)
  904. {
  905. struct Scsi_Host *shost = class_to_shost(cdev);
  906. struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
  907. struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
  908. unsigned int iop1cnt;
  909. iop1cnt = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 20);
  910. return sysfs_emit(buf, "0x%08x\n", iop1cnt);
  911. }
  912. static DEVICE_ATTR_RO(ctl_iop1_count);
  913. static struct attribute *pm8001_host_attrs[] = {
  914. &dev_attr_interface_rev.attr,
  915. &dev_attr_controller_fatal_error.attr,
  916. &dev_attr_fw_version.attr,
  917. &dev_attr_update_fw.attr,
  918. &dev_attr_aap_log.attr,
  919. &dev_attr_iop_log.attr,
  920. &dev_attr_fatal_log.attr,
  921. &dev_attr_non_fatal_log.attr,
  922. &dev_attr_non_fatal_count.attr,
  923. &dev_attr_gsm_log.attr,
  924. &dev_attr_max_out_io.attr,
  925. &dev_attr_max_devices.attr,
  926. &dev_attr_max_sg_list.attr,
  927. &dev_attr_sas_spec_support.attr,
  928. &dev_attr_logging_level.attr,
  929. &dev_attr_event_log_size.attr,
  930. &dev_attr_host_sas_address.attr,
  931. &dev_attr_bios_version.attr,
  932. &dev_attr_ib_log.attr,
  933. &dev_attr_ob_log.attr,
  934. &dev_attr_ila_version.attr,
  935. &dev_attr_inc_fw_ver.attr,
  936. &dev_attr_ctl_mpi_state.attr,
  937. &dev_attr_ctl_hmi_error.attr,
  938. &dev_attr_ctl_raae_count.attr,
  939. &dev_attr_ctl_iop0_count.attr,
  940. &dev_attr_ctl_iop1_count.attr,
  941. NULL,
  942. };
  943. static const struct attribute_group pm8001_host_attr_group = {
  944. .attrs = pm8001_host_attrs
  945. };
  946. const struct attribute_group *pm8001_host_groups[] = {
  947. &pm8001_host_attr_group,
  948. NULL
  949. };