aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/cio/cmf.c87
1 files changed, 74 insertions, 13 deletions
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index ff1e442d4b09..6ef0ab895477 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -74,19 +74,20 @@ enum cmb_index {
74 * enum cmb_format - types of supported measurement block formats 74 * enum cmb_format - types of supported measurement block formats
75 * 75 *
76 * @CMF_BASIC: traditional channel measurement blocks supported 76 * @CMF_BASIC: traditional channel measurement blocks supported
77 * by all machines that we run on 77 * by all machines that we run on
78 * @CMF_EXTENDED: improved format that was introduced with the z990 78 * @CMF_EXTENDED: improved format that was introduced with the z990
79 * machine 79 * machine
80 * @CMF_AUTODETECT: default: use extended format when running on a z990 80 * @CMF_AUTODETECT: default: use extended format when running on a machine
81 * or later machine, otherwise fall back to basic format 81 * supporting extended format, otherwise fall back to
82 **/ 82 * basic format
83 */
83enum cmb_format { 84enum cmb_format {
84 CMF_BASIC, 85 CMF_BASIC,
85 CMF_EXTENDED, 86 CMF_EXTENDED,
86 CMF_AUTODETECT = -1, 87 CMF_AUTODETECT = -1,
87}; 88};
88 89
89/** 90/*
90 * format - actual format for all measurement blocks 91 * format - actual format for all measurement blocks
91 * 92 *
92 * The format module parameter can be set to a value of 0 (zero) 93 * The format module parameter can be set to a value of 0 (zero)
@@ -107,6 +108,7 @@ module_param(format, bool, 0444);
107 * either with the help of a special pool or with kmalloc 108 * either with the help of a special pool or with kmalloc
108 * @free: free memory allocated with @alloc 109 * @free: free memory allocated with @alloc
109 * @set: enable or disable measurement 110 * @set: enable or disable measurement
111 * @read: read a measurement entry at an index
110 * @readall: read a measurement block in a common format 112 * @readall: read a measurement block in a common format
111 * @reset: clear the data in the associated measurement block and 113 * @reset: clear the data in the associated measurement block and
112 * reset its time stamp 114 * reset its time stamp
@@ -120,7 +122,7 @@ struct cmb_operations {
120 int (*readall)(struct ccw_device *, struct cmbdata *); 122 int (*readall)(struct ccw_device *, struct cmbdata *);
121 void (*reset) (struct ccw_device *); 123 void (*reset) (struct ccw_device *);
122 void *(*align) (void *); 124 void *(*align) (void *);
123 125/* private: */
124 struct attribute_group *attr_group; 126 struct attribute_group *attr_group;
125}; 127};
126static struct cmb_operations *cmbops; 128static struct cmb_operations *cmbops;
@@ -471,6 +473,7 @@ static void cmf_generic_reset(struct ccw_device *cdev)
471 * 473 *
472 * @mem: pointer to CMBs (only in basic measurement mode) 474 * @mem: pointer to CMBs (only in basic measurement mode)
473 * @list: contains a linked list of all subchannels 475 * @list: contains a linked list of all subchannels
476 * @num_channels: number of channels to be measured
474 * @lock: protect concurrent access to @mem and @list 477 * @lock: protect concurrent access to @mem and @list
475 */ 478 */
476struct cmb_area { 479struct cmb_area {
@@ -503,10 +506,20 @@ module_param_named(maxchannels, cmb_area.num_channels, uint, 0444);
503 506
504/** 507/**
505 * struct cmb - basic channel measurement block 508 * struct cmb - basic channel measurement block
509 * @ssch_rsch_count: number of ssch and rsch
510 * @sample_count: number of samples
511 * @device_connect_time: time of device connect
512 * @function_pending_time: time of function pending
513 * @device_disconnect_time: time of device disconnect
514 * @control_unit_queuing_time: time of control unit queuing
515 * @device_active_only_time: time of device active only
516 * @reserved: unused in basic measurement mode
517 *
518 * The measurement block as used by the hardware. The fields are described
519 * further in z/Architecture Principles of Operation, chapter 17.
506 * 520 *
507 * cmb as used by the hardware the fields are described in z/Architecture 521 * The cmb area made up from these blocks must be a contiguous array and may
508 * Principles of Operation, chapter 17. 522 * not be reallocated or freed.
509 * The area to be a contiguous array and may not be reallocated or freed.
510 * Only one cmb area can be present in the system. 523 * Only one cmb area can be present in the system.
511 */ 524 */
512struct cmb { 525struct cmb {
@@ -804,9 +817,20 @@ static struct cmb_operations cmbops_basic = {
804 817
805/** 818/**
806 * struct cmbe - extended channel measurement block 819 * struct cmbe - extended channel measurement block
820 * @ssch_rsch_count: number of ssch and rsch
821 * @sample_count: number of samples
822 * @device_connect_time: time of device connect
823 * @function_pending_time: time of function pending
824 * @device_disconnect_time: time of device disconnect
825 * @control_unit_queuing_time: time of control unit queuing
826 * @device_active_only_time: time of device active only
827 * @device_busy_time: time of device busy
828 * @initial_command_response_time: initial command response time
829 * @reserved: unused
807 * 830 *
808 * cmb as used by the hardware, may be in any 64 bit physical location, 831 * The measurement block as used by the hardware. May be in any 64 bit physical
809 * the fields are described in z/Architecture Principles of Operation, 832 * location.
833 * The fields are described further in z/Architecture Principles of Operation,
810 * third edition, chapter 17. 834 * third edition, chapter 17.
811 */ 835 */
812struct cmbe { 836struct cmbe {
@@ -1218,7 +1242,15 @@ static ssize_t cmb_enable_store(struct device *dev,
1218 1242
1219DEVICE_ATTR(cmb_enable, 0644, cmb_enable_show, cmb_enable_store); 1243DEVICE_ATTR(cmb_enable, 0644, cmb_enable_show, cmb_enable_store);
1220 1244
1221/* enable_cmf/disable_cmf: module interface for cmf (de)activation */ 1245/**
1246 * enable_cmf() - switch on the channel measurement for a specific device
1247 * @cdev: The ccw device to be enabled
1248 *
1249 * Returns %0 for success or a negative error value.
1250 *
1251 * Context:
1252 * non-atomic
1253 */
1222int enable_cmf(struct ccw_device *cdev) 1254int enable_cmf(struct ccw_device *cdev)
1223{ 1255{
1224 int ret; 1256 int ret;
@@ -1240,6 +1272,15 @@ int enable_cmf(struct ccw_device *cdev)
1240 return ret; 1272 return ret;
1241} 1273}
1242 1274
1275/**
1276 * disable_cmf() - switch off the channel measurement for a specific device
1277 * @cdev: The ccw device to be disabled
1278 *
1279 * Returns %0 for success or a negative error value.
1280 *
1281 * Context:
1282 * non-atomic
1283 */
1243int disable_cmf(struct ccw_device *cdev) 1284int disable_cmf(struct ccw_device *cdev)
1244{ 1285{
1245 int ret; 1286 int ret;
@@ -1252,11 +1293,31 @@ int disable_cmf(struct ccw_device *cdev)
1252 return ret; 1293 return ret;
1253} 1294}
1254 1295
1296/**
1297 * cmf_read() - read one value from the current channel measurement block
1298 * @cdev: the channel to be read
1299 * @index: the index of the value to be read
1300 *
1301 * Returns the value read or %0 if the value cannot be read.
1302 *
1303 * Context:
1304 * any
1305 */
1255u64 cmf_read(struct ccw_device *cdev, int index) 1306u64 cmf_read(struct ccw_device *cdev, int index)
1256{ 1307{
1257 return cmbops->read(cdev, index); 1308 return cmbops->read(cdev, index);
1258} 1309}
1259 1310
1311/**
1312 * cmf_readall() - read the current channel measurement block
1313 * @cdev: the channel to be read
1314 * @data: a pointer to a data block that will be filled
1315 *
1316 * Returns %0 on success, a negative error value otherwise.
1317 *
1318 * Context:
1319 * any
1320 */
1260int cmf_readall(struct ccw_device *cdev, struct cmbdata *data) 1321int cmf_readall(struct ccw_device *cdev, struct cmbdata *data)
1261{ 1322{
1262 return cmbops->readall(cdev, data); 1323 return cmbops->readall(cdev, data);