diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_attr.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 5a8d5c4c69ba..049e5cf1af7f 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -196,6 +196,9 @@ qla2x00_free_sysfs_attr(scsi_qla_host_t *ha) | |||
196 | 196 | ||
197 | sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr); | 197 | sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr); |
198 | sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr); | 198 | sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr); |
199 | |||
200 | if (ha->beacon_blink_led == 1) | ||
201 | ha->isp_ops.beacon_off(ha); | ||
199 | } | 202 | } |
200 | 203 | ||
201 | /* Scsi_Host attributes. */ | 204 | /* Scsi_Host attributes. */ |
@@ -383,6 +386,50 @@ qla2x00_zio_timer_store(struct class_device *cdev, const char *buf, | |||
383 | return strlen(buf); | 386 | return strlen(buf); |
384 | } | 387 | } |
385 | 388 | ||
389 | static ssize_t | ||
390 | qla2x00_beacon_show(struct class_device *cdev, char *buf) | ||
391 | { | ||
392 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
393 | int len = 0; | ||
394 | |||
395 | if (ha->beacon_blink_led) | ||
396 | len += snprintf(buf + len, PAGE_SIZE-len, "Enabled\n"); | ||
397 | else | ||
398 | len += snprintf(buf + len, PAGE_SIZE-len, "Disabled\n"); | ||
399 | return len; | ||
400 | } | ||
401 | |||
402 | static ssize_t | ||
403 | qla2x00_beacon_store(struct class_device *cdev, const char *buf, | ||
404 | size_t count) | ||
405 | { | ||
406 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
407 | int val = 0; | ||
408 | int rval; | ||
409 | |||
410 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) | ||
411 | return -EPERM; | ||
412 | |||
413 | if (test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)) { | ||
414 | qla_printk(KERN_WARNING, ha, | ||
415 | "Abort ISP active -- ignoring beacon request.\n"); | ||
416 | return -EBUSY; | ||
417 | } | ||
418 | |||
419 | if (sscanf(buf, "%d", &val) != 1) | ||
420 | return -EINVAL; | ||
421 | |||
422 | if (val) | ||
423 | rval = ha->isp_ops.beacon_on(ha); | ||
424 | else | ||
425 | rval = ha->isp_ops.beacon_off(ha); | ||
426 | |||
427 | if (rval != QLA_SUCCESS) | ||
428 | count = 0; | ||
429 | |||
430 | return count; | ||
431 | } | ||
432 | |||
386 | static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, | 433 | static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, |
387 | NULL); | 434 | NULL); |
388 | static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); | 435 | static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); |
@@ -397,6 +444,8 @@ static CLASS_DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, | |||
397 | qla2x00_zio_store); | 444 | qla2x00_zio_store); |
398 | static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, | 445 | static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, |
399 | qla2x00_zio_timer_store); | 446 | qla2x00_zio_timer_store); |
447 | static CLASS_DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show, | ||
448 | qla2x00_beacon_store); | ||
400 | 449 | ||
401 | struct class_device_attribute *qla2x00_host_attrs[] = { | 450 | struct class_device_attribute *qla2x00_host_attrs[] = { |
402 | &class_device_attr_driver_version, | 451 | &class_device_attr_driver_version, |
@@ -410,6 +459,7 @@ struct class_device_attribute *qla2x00_host_attrs[] = { | |||
410 | &class_device_attr_state, | 459 | &class_device_attr_state, |
411 | &class_device_attr_zio, | 460 | &class_device_attr_zio, |
412 | &class_device_attr_zio_timer, | 461 | &class_device_attr_zio_timer, |
462 | &class_device_attr_beacon, | ||
413 | NULL, | 463 | NULL, |
414 | }; | 464 | }; |
415 | 465 | ||