diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2006-03-24 06:15:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-24 10:33:16 -0500 |
commit | 495a5b45ac33b8fe2c49780fdbcc8014cb6d6ddc (patch) | |
tree | b456ebc9e8f53edd726c903401b5e40bbb9562d5 /drivers/s390/cio/css.c | |
parent | dc06010c62da773321258df1d8a1708a3158e29d (diff) |
[PATCH] s390: channel path measurements
Gather extended measurements for channel paths from the channel subsystem and
expose them to userspace via a sysfs attribute.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/s390/cio/css.c')
-rw-r--r-- | drivers/s390/cio/css.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 3c77d65960db..5b304dbacaeb 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -452,15 +452,50 @@ channel_subsystem_release(struct device *dev) | |||
452 | struct channel_subsystem *css; | 452 | struct channel_subsystem *css; |
453 | 453 | ||
454 | css = to_css(dev); | 454 | css = to_css(dev); |
455 | mutex_destroy(&css->mutex); | ||
455 | kfree(css); | 456 | kfree(css); |
456 | } | 457 | } |
457 | 458 | ||
459 | static ssize_t | ||
460 | css_cm_enable_show(struct device *dev, struct device_attribute *attr, | ||
461 | char *buf) | ||
462 | { | ||
463 | struct channel_subsystem *css = to_css(dev); | ||
464 | |||
465 | if (!css) | ||
466 | return 0; | ||
467 | return sprintf(buf, "%x\n", css->cm_enabled); | ||
468 | } | ||
469 | |||
470 | static ssize_t | ||
471 | css_cm_enable_store(struct device *dev, struct device_attribute *attr, | ||
472 | const char *buf, size_t count) | ||
473 | { | ||
474 | struct channel_subsystem *css = to_css(dev); | ||
475 | int ret; | ||
476 | |||
477 | switch (buf[0]) { | ||
478 | case '0': | ||
479 | ret = css->cm_enabled ? chsc_secm(css, 0) : 0; | ||
480 | break; | ||
481 | case '1': | ||
482 | ret = css->cm_enabled ? 0 : chsc_secm(css, 1); | ||
483 | break; | ||
484 | default: | ||
485 | ret = -EINVAL; | ||
486 | } | ||
487 | return ret < 0 ? ret : count; | ||
488 | } | ||
489 | |||
490 | static DEVICE_ATTR(cm_enable, 0644, css_cm_enable_show, css_cm_enable_store); | ||
491 | |||
458 | static inline void __init | 492 | static inline void __init |
459 | setup_css(int nr) | 493 | setup_css(int nr) |
460 | { | 494 | { |
461 | u32 tod_high; | 495 | u32 tod_high; |
462 | 496 | ||
463 | memset(css[nr], 0, sizeof(struct channel_subsystem)); | 497 | memset(css[nr], 0, sizeof(struct channel_subsystem)); |
498 | mutex_init(&css[nr]->mutex); | ||
464 | css[nr]->valid = 1; | 499 | css[nr]->valid = 1; |
465 | css[nr]->cssid = nr; | 500 | css[nr]->cssid = nr; |
466 | sprintf(css[nr]->device.bus_id, "css%x", nr); | 501 | sprintf(css[nr]->device.bus_id, "css%x", nr); |
@@ -507,6 +542,9 @@ init_channel_subsystem (void) | |||
507 | ret = device_register(&css[i]->device); | 542 | ret = device_register(&css[i]->device); |
508 | if (ret) | 543 | if (ret) |
509 | goto out_free; | 544 | goto out_free; |
545 | if (css_characteristics_avail && css_chsc_characteristics.secm) | ||
546 | device_create_file(&css[i]->device, | ||
547 | &dev_attr_cm_enable); | ||
510 | } | 548 | } |
511 | css_init_done = 1; | 549 | css_init_done = 1; |
512 | 550 | ||
@@ -519,6 +557,9 @@ out_free: | |||
519 | out_unregister: | 557 | out_unregister: |
520 | while (i > 0) { | 558 | while (i > 0) { |
521 | i--; | 559 | i--; |
560 | if (css_characteristics_avail && css_chsc_characteristics.secm) | ||
561 | device_remove_file(&css[i]->device, | ||
562 | &dev_attr_cm_enable); | ||
522 | device_unregister(&css[i]->device); | 563 | device_unregister(&css[i]->device); |
523 | } | 564 | } |
524 | out_bus: | 565 | out_bus: |