diff options
Diffstat (limited to 'drivers/scsi/pm8001/pm8001_ctl.c')
-rw-r--r-- | drivers/scsi/pm8001/pm8001_ctl.c | 153 |
1 files changed, 153 insertions, 0 deletions
diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c index d99f41c2ca13..a04b4ff8c7f6 100644 --- a/drivers/scsi/pm8001/pm8001_ctl.c +++ b/drivers/scsi/pm8001/pm8001_ctl.c | |||
@@ -309,6 +309,117 @@ static ssize_t pm8001_ctl_aap_log_show(struct device *cdev, | |||
309 | } | 309 | } |
310 | static DEVICE_ATTR(aap_log, S_IRUGO, pm8001_ctl_aap_log_show, NULL); | 310 | static DEVICE_ATTR(aap_log, S_IRUGO, pm8001_ctl_aap_log_show, NULL); |
311 | /** | 311 | /** |
312 | * pm8001_ctl_ib_queue_log_show - Out bound Queue log | ||
313 | * @cdev:pointer to embedded class device | ||
314 | * @buf: the buffer returned | ||
315 | * A sysfs 'read-only' shost attribute. | ||
316 | */ | ||
317 | static ssize_t pm8001_ctl_ib_queue_log_show(struct device *cdev, | ||
318 | struct device_attribute *attr, char *buf) | ||
319 | { | ||
320 | struct Scsi_Host *shost = class_to_shost(cdev); | ||
321 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); | ||
322 | struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; | ||
323 | int offset; | ||
324 | char *str = buf; | ||
325 | int start = 0; | ||
326 | #define IB_MEMMAP(c) \ | ||
327 | (*(u32 *)((u8 *)pm8001_ha-> \ | ||
328 | memoryMap.region[IB].virt_ptr + \ | ||
329 | pm8001_ha->evtlog_ib_offset + (c))) | ||
330 | |||
331 | for (offset = 0; offset < IB_OB_READ_TIMES; offset++) { | ||
332 | if (pm8001_ha->chip_id != chip_8001) | ||
333 | str += sprintf(str, "0x%08x\n", IB_MEMMAP(start)); | ||
334 | else | ||
335 | str += sprintf(str, "0x%08x\n", IB_MEMMAP(start)); | ||
336 | start = start + 4; | ||
337 | } | ||
338 | pm8001_ha->evtlog_ib_offset += SYSFS_OFFSET; | ||
339 | if ((((pm8001_ha->evtlog_ib_offset) % (PM80XX_IB_OB_QUEUE_SIZE)) == 0) | ||
340 | && (pm8001_ha->chip_id != chip_8001)) | ||
341 | pm8001_ha->evtlog_ib_offset = 0; | ||
342 | if ((((pm8001_ha->evtlog_ib_offset) % (PM8001_IB_OB_QUEUE_SIZE)) == 0) | ||
343 | && (pm8001_ha->chip_id == chip_8001)) | ||
344 | pm8001_ha->evtlog_ib_offset = 0; | ||
345 | |||
346 | return str - buf; | ||
347 | } | ||
348 | |||
349 | static DEVICE_ATTR(ib_log, S_IRUGO, pm8001_ctl_ib_queue_log_show, NULL); | ||
350 | /** | ||
351 | * pm8001_ctl_ob_queue_log_show - Out bound Queue log | ||
352 | * @cdev:pointer to embedded class device | ||
353 | * @buf: the buffer returned | ||
354 | * A sysfs 'read-only' shost attribute. | ||
355 | */ | ||
356 | |||
357 | static ssize_t pm8001_ctl_ob_queue_log_show(struct device *cdev, | ||
358 | struct device_attribute *attr, char *buf) | ||
359 | { | ||
360 | struct Scsi_Host *shost = class_to_shost(cdev); | ||
361 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); | ||
362 | struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; | ||
363 | int offset; | ||
364 | char *str = buf; | ||
365 | int start = 0; | ||
366 | #define OB_MEMMAP(c) \ | ||
367 | (*(u32 *)((u8 *)pm8001_ha-> \ | ||
368 | memoryMap.region[OB].virt_ptr + \ | ||
369 | pm8001_ha->evtlog_ob_offset + (c))) | ||
370 | |||
371 | for (offset = 0; offset < IB_OB_READ_TIMES; offset++) { | ||
372 | if (pm8001_ha->chip_id != chip_8001) | ||
373 | str += sprintf(str, "0x%08x\n", OB_MEMMAP(start)); | ||
374 | else | ||
375 | str += sprintf(str, "0x%08x\n", OB_MEMMAP(start)); | ||
376 | start = start + 4; | ||
377 | } | ||
378 | pm8001_ha->evtlog_ob_offset += SYSFS_OFFSET; | ||
379 | if ((((pm8001_ha->evtlog_ob_offset) % (PM80XX_IB_OB_QUEUE_SIZE)) == 0) | ||
380 | && (pm8001_ha->chip_id != chip_8001)) | ||
381 | pm8001_ha->evtlog_ob_offset = 0; | ||
382 | if ((((pm8001_ha->evtlog_ob_offset) % (PM8001_IB_OB_QUEUE_SIZE)) == 0) | ||
383 | && (pm8001_ha->chip_id == chip_8001)) | ||
384 | pm8001_ha->evtlog_ob_offset = 0; | ||
385 | |||
386 | return str - buf; | ||
387 | } | ||
388 | static DEVICE_ATTR(ob_log, S_IRUGO, pm8001_ctl_ob_queue_log_show, NULL); | ||
389 | /** | ||
390 | * pm8001_ctl_bios_version_show - Bios version Display | ||
391 | * @cdev:pointer to embedded class device | ||
392 | * @buf:the buffer returned | ||
393 | * A sysfs 'read-only' shost attribute. | ||
394 | */ | ||
395 | static ssize_t pm8001_ctl_bios_version_show(struct device *cdev, | ||
396 | struct device_attribute *attr, char *buf) | ||
397 | { | ||
398 | struct Scsi_Host *shost = class_to_shost(cdev); | ||
399 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); | ||
400 | struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; | ||
401 | char *str = buf; | ||
402 | void *virt_addr; | ||
403 | int bios_index; | ||
404 | DECLARE_COMPLETION_ONSTACK(completion); | ||
405 | struct pm8001_ioctl_payload payload; | ||
406 | |||
407 | pm8001_ha->nvmd_completion = &completion; | ||
408 | payload.minor_function = 7; | ||
409 | payload.offset = 0; | ||
410 | payload.length = 4096; | ||
411 | payload.func_specific = kzalloc(4096, GFP_KERNEL); | ||
412 | PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload); | ||
413 | wait_for_completion(&completion); | ||
414 | virt_addr = pm8001_ha->memoryMap.region[NVMD].virt_ptr; | ||
415 | for (bios_index = BIOSOFFSET; bios_index < BIOS_OFFSET_LIMIT; | ||
416 | bios_index++) | ||
417 | str += sprintf(str, "%c", | ||
418 | *((u8 *)((u8 *)virt_addr+bios_index))); | ||
419 | return str - buf; | ||
420 | } | ||
421 | static DEVICE_ATTR(bios_version, S_IRUGO, pm8001_ctl_bios_version_show, NULL); | ||
422 | /** | ||
312 | * pm8001_ctl_aap_log_show - IOP event log | 423 | * pm8001_ctl_aap_log_show - IOP event log |
313 | * @cdev: pointer to embedded class device | 424 | * @cdev: pointer to embedded class device |
314 | * @buf: the buffer returned | 425 | * @buf: the buffer returned |
@@ -344,6 +455,43 @@ static ssize_t pm8001_ctl_iop_log_show(struct device *cdev, | |||
344 | } | 455 | } |
345 | static DEVICE_ATTR(iop_log, S_IRUGO, pm8001_ctl_iop_log_show, NULL); | 456 | static DEVICE_ATTR(iop_log, S_IRUGO, pm8001_ctl_iop_log_show, NULL); |
346 | 457 | ||
458 | /** | ||
459 | ** pm8001_ctl_fatal_log_show - fatal error logging | ||
460 | ** @cdev:pointer to embedded class device | ||
461 | ** @buf: the buffer returned | ||
462 | ** | ||
463 | ** A sysfs 'read-only' shost attribute. | ||
464 | **/ | ||
465 | |||
466 | static ssize_t pm8001_ctl_fatal_log_show(struct device *cdev, | ||
467 | struct device_attribute *attr, char *buf) | ||
468 | { | ||
469 | u32 count; | ||
470 | |||
471 | count = pm80xx_get_fatal_dump(cdev, attr, buf); | ||
472 | return count; | ||
473 | } | ||
474 | |||
475 | static DEVICE_ATTR(fatal_log, S_IRUGO, pm8001_ctl_fatal_log_show, NULL); | ||
476 | |||
477 | |||
478 | /** | ||
479 | ** pm8001_ctl_gsm_log_show - gsm dump collection | ||
480 | ** @cdev:pointer to embedded class device | ||
481 | ** @buf: the buffer returned | ||
482 | **A sysfs 'read-only' shost attribute. | ||
483 | **/ | ||
484 | static ssize_t pm8001_ctl_gsm_log_show(struct device *cdev, | ||
485 | struct device_attribute *attr, char *buf) | ||
486 | { | ||
487 | u32 count; | ||
488 | |||
489 | count = pm8001_get_gsm_dump(cdev, SYSFS_OFFSET, buf); | ||
490 | return count; | ||
491 | } | ||
492 | |||
493 | static DEVICE_ATTR(gsm_log, S_IRUGO, pm8001_ctl_gsm_log_show, NULL); | ||
494 | |||
347 | #define FLASH_CMD_NONE 0x00 | 495 | #define FLASH_CMD_NONE 0x00 |
348 | #define FLASH_CMD_UPDATE 0x01 | 496 | #define FLASH_CMD_UPDATE 0x01 |
349 | #define FLASH_CMD_SET_NVMD 0x02 | 497 | #define FLASH_CMD_SET_NVMD 0x02 |
@@ -603,12 +751,17 @@ struct device_attribute *pm8001_host_attrs[] = { | |||
603 | &dev_attr_update_fw, | 751 | &dev_attr_update_fw, |
604 | &dev_attr_aap_log, | 752 | &dev_attr_aap_log, |
605 | &dev_attr_iop_log, | 753 | &dev_attr_iop_log, |
754 | &dev_attr_fatal_log, | ||
755 | &dev_attr_gsm_log, | ||
606 | &dev_attr_max_out_io, | 756 | &dev_attr_max_out_io, |
607 | &dev_attr_max_devices, | 757 | &dev_attr_max_devices, |
608 | &dev_attr_max_sg_list, | 758 | &dev_attr_max_sg_list, |
609 | &dev_attr_sas_spec_support, | 759 | &dev_attr_sas_spec_support, |
610 | &dev_attr_logging_level, | 760 | &dev_attr_logging_level, |
611 | &dev_attr_host_sas_address, | 761 | &dev_attr_host_sas_address, |
762 | &dev_attr_bios_version, | ||
763 | &dev_attr_ib_log, | ||
764 | &dev_attr_ob_log, | ||
612 | NULL, | 765 | NULL, |
613 | }; | 766 | }; |
614 | 767 | ||