9 #define KMSG_COMPONENT "sclp_cpi"
10 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
12 #include <linux/kernel.h>
14 #include <linux/stat.h>
15 #include <linux/device.h>
16 #include <linux/string.h>
17 #include <linux/ctype.h>
21 #include <linux/slab.h>
23 #include <linux/export.h>
31 #define CPI_LENGTH_NAME 8
32 #define CPI_LENGTH_LEVEL 16
64 static void set_data(
char *
field,
char *
data)
78 static struct sclp_req *cpi_prepare_req(
void)
119 static void cpi_free_req(
struct sclp_req *req)
125 static int cpi_req(
void)
140 req = cpi_prepare_req();
157 pr_warning(
"request failed (status=0x%02x)\n",
163 response = ((
struct cpi_sccb *) req->
sccb)->header.response_code;
164 if (response != 0x0020) {
165 pr_warning(
"request failed with response code 0x%x\n",
180 static int check_string(
const char *
attr,
const char *
str)
187 if ((len > 0) && (str[len - 1] ==
'\n'))
193 for (i = 0; i < len ; i++) {
203 static void set_string(
char *attr,
const char *
value)
210 if ((len > 0) && (value[len - 1] ==
'\n'))
239 rc = check_string(
"system_name", buf);
244 set_string(system_name, buf);
251 __ATTR(system_name, 0644, system_name_show, system_name_store);
271 rc = check_string(
"sysplex_name", buf);
276 set_string(sysplex_name, buf);
283 __ATTR(sysplex_name, 0644, sysplex_name_show, sysplex_name_store);
303 rc = check_string(
"system_type", buf);
308 set_string(system_type, buf);
315 __ATTR(system_type, 0644, system_type_show, system_type_store);
320 unsigned long long level;
333 unsigned long long level;
346 system_level =
level;
352 __ATTR(system_level, 0644, system_level_show, system_level_store);
356 const char *buf,
size_t len)
372 &system_name_attr.
attr,
373 &sysplex_name_attr.
attr,
374 &system_type_attr.
attr,
375 &system_level_attr.
attr,
384 static struct kset *cpi_kset;
391 rc = check_string(
"system_name", system);
394 rc = check_string(
"sysplex_name", sysplex);
397 rc = check_string(
"system_type", type);
402 set_string(system_name, system);
403 set_string(sysplex_name, sysplex);
404 set_string(system_type, type);
405 system_level =
level;
414 static int __init cpi_init(
void)