.. | .. |
---|
47 | 47 | /** |
---|
48 | 48 | * pm8001_ctl_mpi_interface_rev_show - MPI interface revision number |
---|
49 | 49 | * @cdev: pointer to embedded class device |
---|
| 50 | + * @attr: device attribute (unused) |
---|
50 | 51 | * @buf: the buffer returned |
---|
51 | 52 | * |
---|
52 | 53 | * A sysfs 'read-only' shost attribute. |
---|
.. | .. |
---|
70 | 71 | DEVICE_ATTR(interface_rev, S_IRUGO, pm8001_ctl_mpi_interface_rev_show, NULL); |
---|
71 | 72 | |
---|
72 | 73 | /** |
---|
| 74 | + * controller_fatal_error_show - check controller is under fatal err |
---|
| 75 | + * @cdev: pointer to embedded class device |
---|
| 76 | + * @attr: device attribute (unused) |
---|
| 77 | + * @buf: the buffer returned |
---|
| 78 | + * |
---|
| 79 | + * A sysfs 'read only' shost attribute. |
---|
| 80 | + */ |
---|
| 81 | +static ssize_t controller_fatal_error_show(struct device *cdev, |
---|
| 82 | + struct device_attribute *attr, char *buf) |
---|
| 83 | +{ |
---|
| 84 | + struct Scsi_Host *shost = class_to_shost(cdev); |
---|
| 85 | + struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); |
---|
| 86 | + struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; |
---|
| 87 | + |
---|
| 88 | + return snprintf(buf, PAGE_SIZE, "%d\n", |
---|
| 89 | + pm8001_ha->controller_fatal_error); |
---|
| 90 | +} |
---|
| 91 | +static DEVICE_ATTR_RO(controller_fatal_error); |
---|
| 92 | + |
---|
| 93 | +/** |
---|
73 | 94 | * pm8001_ctl_fw_version_show - firmware version |
---|
74 | 95 | * @cdev: pointer to embedded class device |
---|
| 96 | + * @attr: device attribute (unused) |
---|
75 | 97 | * @buf: the buffer returned |
---|
76 | 98 | * |
---|
77 | 99 | * A sysfs 'read-only' shost attribute. |
---|
.. | .. |
---|
102 | 124 | /** |
---|
103 | 125 | * pm8001_ctl_ila_version_show - ila version |
---|
104 | 126 | * @cdev: pointer to embedded class device |
---|
| 127 | + * @attr: device attribute (unused) |
---|
105 | 128 | * @buf: the buffer returned |
---|
106 | 129 | * |
---|
107 | 130 | * A sysfs 'read-only' shost attribute. |
---|
.. | .. |
---|
127 | 150 | /** |
---|
128 | 151 | * pm8001_ctl_inactive_fw_version_show - Inacative firmware version number |
---|
129 | 152 | * @cdev: pointer to embedded class device |
---|
| 153 | + * @attr: device attribute (unused) |
---|
130 | 154 | * @buf: the buffer returned |
---|
131 | 155 | * |
---|
132 | 156 | * A sysfs 'read-only' shost attribute. |
---|
.. | .. |
---|
153 | 177 | /** |
---|
154 | 178 | * pm8001_ctl_max_out_io_show - max outstanding io supported |
---|
155 | 179 | * @cdev: pointer to embedded class device |
---|
| 180 | + * @attr: device attribute (unused) |
---|
156 | 181 | * @buf: the buffer returned |
---|
157 | 182 | * |
---|
158 | 183 | * A sysfs 'read-only' shost attribute. |
---|
.. | .. |
---|
176 | 201 | /** |
---|
177 | 202 | * pm8001_ctl_max_devices_show - max devices support |
---|
178 | 203 | * @cdev: pointer to embedded class device |
---|
| 204 | + * @attr: device attribute (unused) |
---|
179 | 205 | * @buf: the buffer returned |
---|
180 | 206 | * |
---|
181 | 207 | * A sysfs 'read-only' shost attribute. |
---|
.. | .. |
---|
202 | 228 | * pm8001_ctl_max_sg_list_show - max sg list supported iff not 0.0 for no |
---|
203 | 229 | * hardware limitation |
---|
204 | 230 | * @cdev: pointer to embedded class device |
---|
| 231 | + * @attr: device attribute (unused) |
---|
205 | 232 | * @buf: the buffer returned |
---|
206 | 233 | * |
---|
207 | 234 | * A sysfs 'read-only' shost attribute. |
---|
.. | .. |
---|
246 | 273 | /** |
---|
247 | 274 | * pm8001_ctl_sas_spec_support_show - sas spec supported |
---|
248 | 275 | * @cdev: pointer to embedded class device |
---|
| 276 | + * @attr: device attribute (unused) |
---|
249 | 277 | * @buf: the buffer returned |
---|
250 | 278 | * |
---|
251 | 279 | * A sysfs 'read-only' shost attribute. |
---|
.. | .. |
---|
273 | 301 | /** |
---|
274 | 302 | * pm8001_ctl_sas_address_show - sas address |
---|
275 | 303 | * @cdev: pointer to embedded class device |
---|
| 304 | + * @attr: device attribute (unused) |
---|
276 | 305 | * @buf: the buffer returned |
---|
277 | 306 | * |
---|
278 | 307 | * This is the controller sas address |
---|
.. | .. |
---|
294 | 323 | /** |
---|
295 | 324 | * pm8001_ctl_logging_level_show - logging level |
---|
296 | 325 | * @cdev: pointer to embedded class device |
---|
| 326 | + * @attr: device attribute (unused) |
---|
297 | 327 | * @buf: the buffer returned |
---|
298 | 328 | * |
---|
299 | 329 | * A sysfs 'read/write' shost attribute. |
---|
.. | .. |
---|
307 | 337 | |
---|
308 | 338 | return snprintf(buf, PAGE_SIZE, "%08xh\n", pm8001_ha->logging_level); |
---|
309 | 339 | } |
---|
| 340 | + |
---|
310 | 341 | static ssize_t pm8001_ctl_logging_level_store(struct device *cdev, |
---|
311 | 342 | struct device_attribute *attr, const char *buf, size_t count) |
---|
312 | 343 | { |
---|
.. | .. |
---|
327 | 358 | /** |
---|
328 | 359 | * pm8001_ctl_aap_log_show - aap1 event log |
---|
329 | 360 | * @cdev: pointer to embedded class device |
---|
| 361 | + * @attr: device attribute (unused) |
---|
330 | 362 | * @buf: the buffer returned |
---|
331 | 363 | * |
---|
332 | 364 | * A sysfs 'read-only' shost attribute. |
---|
.. | .. |
---|
363 | 395 | /** |
---|
364 | 396 | * pm8001_ctl_ib_queue_log_show - Out bound Queue log |
---|
365 | 397 | * @cdev:pointer to embedded class device |
---|
| 398 | + * @attr: device attribute (unused) |
---|
366 | 399 | * @buf: the buffer returned |
---|
367 | 400 | * A sysfs 'read-only' shost attribute. |
---|
368 | 401 | */ |
---|
.. | .. |
---|
375 | 408 | int offset; |
---|
376 | 409 | char *str = buf; |
---|
377 | 410 | int start = 0; |
---|
| 411 | + u32 ib_offset = pm8001_ha->ib_offset; |
---|
378 | 412 | #define IB_MEMMAP(c) \ |
---|
379 | 413 | (*(u32 *)((u8 *)pm8001_ha-> \ |
---|
380 | | - memoryMap.region[IB].virt_ptr + \ |
---|
| 414 | + memoryMap.region[ib_offset].virt_ptr + \ |
---|
381 | 415 | pm8001_ha->evtlog_ib_offset + (c))) |
---|
382 | 416 | |
---|
383 | 417 | for (offset = 0; offset < IB_OB_READ_TIMES; offset++) { |
---|
.. | .. |
---|
395 | 429 | /** |
---|
396 | 430 | * pm8001_ctl_ob_queue_log_show - Out bound Queue log |
---|
397 | 431 | * @cdev:pointer to embedded class device |
---|
| 432 | + * @attr: device attribute (unused) |
---|
398 | 433 | * @buf: the buffer returned |
---|
399 | 434 | * A sysfs 'read-only' shost attribute. |
---|
400 | 435 | */ |
---|
.. | .. |
---|
408 | 443 | int offset; |
---|
409 | 444 | char *str = buf; |
---|
410 | 445 | int start = 0; |
---|
| 446 | + u32 ob_offset = pm8001_ha->ob_offset; |
---|
411 | 447 | #define OB_MEMMAP(c) \ |
---|
412 | 448 | (*(u32 *)((u8 *)pm8001_ha-> \ |
---|
413 | | - memoryMap.region[OB].virt_ptr + \ |
---|
| 449 | + memoryMap.region[ob_offset].virt_ptr + \ |
---|
414 | 450 | pm8001_ha->evtlog_ob_offset + (c))) |
---|
415 | 451 | |
---|
416 | 452 | for (offset = 0; offset < IB_OB_READ_TIMES; offset++) { |
---|
.. | .. |
---|
427 | 463 | /** |
---|
428 | 464 | * pm8001_ctl_bios_version_show - Bios version Display |
---|
429 | 465 | * @cdev:pointer to embedded class device |
---|
| 466 | + * @attr: device attribute (unused) |
---|
430 | 467 | * @buf:the buffer returned |
---|
431 | 468 | * A sysfs 'read-only' shost attribute. |
---|
432 | 469 | */ |
---|
.. | .. |
---|
444 | 481 | pm8001_ha->nvmd_completion = &completion; |
---|
445 | 482 | payload.minor_function = 7; |
---|
446 | 483 | payload.offset = 0; |
---|
447 | | - payload.length = 4096; |
---|
| 484 | + payload.rd_length = 4096; |
---|
448 | 485 | payload.func_specific = kzalloc(4096, GFP_KERNEL); |
---|
449 | 486 | if (!payload.func_specific) |
---|
450 | 487 | return -ENOMEM; |
---|
.. | .. |
---|
462 | 499 | } |
---|
463 | 500 | static DEVICE_ATTR(bios_version, S_IRUGO, pm8001_ctl_bios_version_show, NULL); |
---|
464 | 501 | /** |
---|
| 502 | + * event_log_size_show - event log size |
---|
| 503 | + * @cdev: pointer to embedded class device |
---|
| 504 | + * @attr: device attribute (unused) |
---|
| 505 | + * @buf: the buffer returned |
---|
| 506 | + * |
---|
| 507 | + * A sysfs read shost attribute. |
---|
| 508 | + */ |
---|
| 509 | +static ssize_t event_log_size_show(struct device *cdev, |
---|
| 510 | + struct device_attribute *attr, char *buf) |
---|
| 511 | +{ |
---|
| 512 | + struct Scsi_Host *shost = class_to_shost(cdev); |
---|
| 513 | + struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); |
---|
| 514 | + struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; |
---|
| 515 | + |
---|
| 516 | + return snprintf(buf, PAGE_SIZE, "%d\n", |
---|
| 517 | + pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_size); |
---|
| 518 | +} |
---|
| 519 | +static DEVICE_ATTR_RO(event_log_size); |
---|
| 520 | +/** |
---|
465 | 521 | * pm8001_ctl_aap_log_show - IOP event log |
---|
466 | 522 | * @cdev: pointer to embedded class device |
---|
| 523 | + * @attr: device attribute (unused) |
---|
467 | 524 | * @buf: the buffer returned |
---|
468 | 525 | * |
---|
469 | 526 | * A sysfs 'read-only' shost attribute. |
---|
.. | .. |
---|
474 | 531 | struct Scsi_Host *shost = class_to_shost(cdev); |
---|
475 | 532 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); |
---|
476 | 533 | struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; |
---|
477 | | -#define IOP_MEMMAP(r, c) \ |
---|
478 | | - (*(u32 *)((u8*)pm8001_ha->memoryMap.region[IOP].virt_ptr + (r) * 32 \ |
---|
479 | | - + (c))) |
---|
480 | | - int i; |
---|
481 | 534 | char *str = buf; |
---|
482 | | - int max = 2; |
---|
483 | | - for (i = 0; i < max; i++) { |
---|
484 | | - str += sprintf(str, "0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x" |
---|
485 | | - "0x%08x 0x%08x\n", |
---|
486 | | - IOP_MEMMAP(i, 0), |
---|
487 | | - IOP_MEMMAP(i, 4), |
---|
488 | | - IOP_MEMMAP(i, 8), |
---|
489 | | - IOP_MEMMAP(i, 12), |
---|
490 | | - IOP_MEMMAP(i, 16), |
---|
491 | | - IOP_MEMMAP(i, 20), |
---|
492 | | - IOP_MEMMAP(i, 24), |
---|
493 | | - IOP_MEMMAP(i, 28)); |
---|
| 535 | + u32 read_size = |
---|
| 536 | + pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_size / 1024; |
---|
| 537 | + static u32 start, end, count; |
---|
| 538 | + u32 max_read_times = 32; |
---|
| 539 | + u32 max_count = (read_size * 1024) / (max_read_times * 4); |
---|
| 540 | + u32 *temp = (u32 *)pm8001_ha->memoryMap.region[IOP].virt_ptr; |
---|
| 541 | + |
---|
| 542 | + if ((count % max_count) == 0) { |
---|
| 543 | + start = 0; |
---|
| 544 | + end = max_read_times; |
---|
| 545 | + count = 0; |
---|
| 546 | + } else { |
---|
| 547 | + start = end; |
---|
| 548 | + end = end + max_read_times; |
---|
494 | 549 | } |
---|
495 | 550 | |
---|
| 551 | + for (; start < end; start++) |
---|
| 552 | + str += sprintf(str, "%08x ", *(temp+start)); |
---|
| 553 | + count++; |
---|
496 | 554 | return str - buf; |
---|
497 | 555 | } |
---|
498 | 556 | static DEVICE_ATTR(iop_log, S_IRUGO, pm8001_ctl_iop_log_show, NULL); |
---|
.. | .. |
---|
500 | 558 | /** |
---|
501 | 559 | ** pm8001_ctl_fatal_log_show - fatal error logging |
---|
502 | 560 | ** @cdev:pointer to embedded class device |
---|
| 561 | + ** @attr: device attribute |
---|
503 | 562 | ** @buf: the buffer returned |
---|
504 | 563 | ** |
---|
505 | 564 | ** A sysfs 'read-only' shost attribute. |
---|
.. | .. |
---|
516 | 575 | |
---|
517 | 576 | static DEVICE_ATTR(fatal_log, S_IRUGO, pm8001_ctl_fatal_log_show, NULL); |
---|
518 | 577 | |
---|
| 578 | +/** |
---|
| 579 | + ** non_fatal_log_show - non fatal error logging |
---|
| 580 | + ** @cdev:pointer to embedded class device |
---|
| 581 | + ** @attr: device attribute |
---|
| 582 | + ** @buf: the buffer returned |
---|
| 583 | + ** |
---|
| 584 | + ** A sysfs 'read-only' shost attribute. |
---|
| 585 | + **/ |
---|
| 586 | +static ssize_t non_fatal_log_show(struct device *cdev, |
---|
| 587 | + struct device_attribute *attr, char *buf) |
---|
| 588 | +{ |
---|
| 589 | + u32 count; |
---|
| 590 | + |
---|
| 591 | + count = pm80xx_get_non_fatal_dump(cdev, attr, buf); |
---|
| 592 | + return count; |
---|
| 593 | +} |
---|
| 594 | +static DEVICE_ATTR_RO(non_fatal_log); |
---|
| 595 | + |
---|
| 596 | +static ssize_t non_fatal_count_show(struct device *cdev, |
---|
| 597 | + struct device_attribute *attr, char *buf) |
---|
| 598 | +{ |
---|
| 599 | + struct Scsi_Host *shost = class_to_shost(cdev); |
---|
| 600 | + struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); |
---|
| 601 | + struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; |
---|
| 602 | + |
---|
| 603 | + return snprintf(buf, PAGE_SIZE, "%08x", |
---|
| 604 | + pm8001_ha->non_fatal_count); |
---|
| 605 | +} |
---|
| 606 | + |
---|
| 607 | +static ssize_t non_fatal_count_store(struct device *cdev, |
---|
| 608 | + struct device_attribute *attr, const char *buf, size_t count) |
---|
| 609 | +{ |
---|
| 610 | + struct Scsi_Host *shost = class_to_shost(cdev); |
---|
| 611 | + struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); |
---|
| 612 | + struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; |
---|
| 613 | + int val = 0; |
---|
| 614 | + |
---|
| 615 | + if (kstrtoint(buf, 16, &val) != 0) |
---|
| 616 | + return -EINVAL; |
---|
| 617 | + |
---|
| 618 | + pm8001_ha->non_fatal_count = val; |
---|
| 619 | + return strlen(buf); |
---|
| 620 | +} |
---|
| 621 | +static DEVICE_ATTR_RW(non_fatal_count); |
---|
519 | 622 | |
---|
520 | 623 | /** |
---|
521 | 624 | ** pm8001_ctl_gsm_log_show - gsm dump collection |
---|
522 | 625 | ** @cdev:pointer to embedded class device |
---|
| 626 | + ** @attr: device attribute (unused) |
---|
523 | 627 | ** @buf: the buffer returned |
---|
524 | | - **A sysfs 'read-only' shost attribute. |
---|
| 628 | + ** A sysfs 'read-only' shost attribute. |
---|
525 | 629 | **/ |
---|
526 | 630 | static ssize_t pm8001_ctl_gsm_log_show(struct device *cdev, |
---|
527 | 631 | struct device_attribute *attr, char *buf) |
---|
.. | .. |
---|
593 | 697 | payload = (struct pm8001_ioctl_payload *)ioctlbuffer; |
---|
594 | 698 | memcpy((u8 *)&payload->func_specific, (u8 *)pm8001_ha->fw_image->data, |
---|
595 | 699 | pm8001_ha->fw_image->size); |
---|
596 | | - payload->length = pm8001_ha->fw_image->size; |
---|
| 700 | + payload->wr_length = pm8001_ha->fw_image->size; |
---|
597 | 701 | payload->id = 0; |
---|
598 | 702 | payload->minor_function = 0x1; |
---|
599 | 703 | pm8001_ha->nvmd_completion = &completion; |
---|
.. | .. |
---|
639 | 743 | IOCTL_BUF_SIZE); |
---|
640 | 744 | for (loopNumber = 0; loopNumber < loopcount; loopNumber++) { |
---|
641 | 745 | payload = (struct pm8001_ioctl_payload *)ioctlbuffer; |
---|
642 | | - payload->length = 1024*16; |
---|
| 746 | + payload->wr_length = 1024*16; |
---|
643 | 747 | payload->id = 0; |
---|
644 | 748 | fwControl = |
---|
645 | 749 | (struct fw_control_info *)&payload->func_specific; |
---|
.. | .. |
---|
737 | 841 | pm8001_ha->dev); |
---|
738 | 842 | |
---|
739 | 843 | if (ret) { |
---|
740 | | - PM8001_FAIL_DBG(pm8001_ha, |
---|
741 | | - pm8001_printk( |
---|
742 | | - "Failed to load firmware image file %s, error %d\n", |
---|
743 | | - filename_ptr, ret)); |
---|
| 844 | + pm8001_dbg(pm8001_ha, FAIL, |
---|
| 845 | + "Failed to load firmware image file %s, error %d\n", |
---|
| 846 | + filename_ptr, ret); |
---|
744 | 847 | pm8001_ha->fw_status = FAIL_OPEN_BIOS_FILE; |
---|
745 | 848 | goto out; |
---|
746 | 849 | } |
---|
.. | .. |
---|
785 | 888 | pm8001_show_update_fw, pm8001_store_update_fw); |
---|
786 | 889 | struct device_attribute *pm8001_host_attrs[] = { |
---|
787 | 890 | &dev_attr_interface_rev, |
---|
| 891 | + &dev_attr_controller_fatal_error, |
---|
788 | 892 | &dev_attr_fw_version, |
---|
789 | 893 | &dev_attr_update_fw, |
---|
790 | 894 | &dev_attr_aap_log, |
---|
791 | 895 | &dev_attr_iop_log, |
---|
792 | 896 | &dev_attr_fatal_log, |
---|
| 897 | + &dev_attr_non_fatal_log, |
---|
| 898 | + &dev_attr_non_fatal_count, |
---|
793 | 899 | &dev_attr_gsm_log, |
---|
794 | 900 | &dev_attr_max_out_io, |
---|
795 | 901 | &dev_attr_max_devices, |
---|
796 | 902 | &dev_attr_max_sg_list, |
---|
797 | 903 | &dev_attr_sas_spec_support, |
---|
798 | 904 | &dev_attr_logging_level, |
---|
| 905 | + &dev_attr_event_log_size, |
---|
799 | 906 | &dev_attr_host_sas_address, |
---|
800 | 907 | &dev_attr_bios_version, |
---|
801 | 908 | &dev_attr_ib_log, |
---|