Initial commit
[wrt350n-kernel.git] / drivers / s390 / char / sclp_config.c
blob9dc77f14fa52042978de137751e74168972b3a42
1 /*
2 * drivers/s390/char/sclp_config.c
4 * Copyright IBM Corp. 2007
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 */
8 #include <linux/init.h>
9 #include <linux/errno.h>
10 #include <linux/cpu.h>
11 #include <linux/sysdev.h>
12 #include <linux/workqueue.h>
13 #include "sclp.h"
15 #define TAG "sclp_config: "
17 struct conf_mgm_data {
18 u8 reserved;
19 u8 ev_qualifier;
20 } __attribute__((packed));
22 #define EV_QUAL_CAP_CHANGE 3
24 static struct work_struct sclp_cpu_capability_work;
26 static void sclp_cpu_capability_notify(struct work_struct *work)
28 int cpu;
29 struct sys_device *sysdev;
31 printk(KERN_WARNING TAG "cpu capability changed.\n");
32 get_online_cpus();
33 for_each_online_cpu(cpu) {
34 sysdev = get_cpu_sysdev(cpu);
35 kobject_uevent(&sysdev->kobj, KOBJ_CHANGE);
37 put_online_cpus();
40 static void sclp_conf_receiver_fn(struct evbuf_header *evbuf)
42 struct conf_mgm_data *cdata;
44 cdata = (struct conf_mgm_data *)(evbuf + 1);
45 if (cdata->ev_qualifier == EV_QUAL_CAP_CHANGE)
46 schedule_work(&sclp_cpu_capability_work);
49 static struct sclp_register sclp_conf_register =
51 .receive_mask = EVTYP_CONFMGMDATA_MASK,
52 .receiver_fn = sclp_conf_receiver_fn,
55 static int __init sclp_conf_init(void)
57 int rc;
59 INIT_WORK(&sclp_cpu_capability_work, sclp_cpu_capability_notify);
61 rc = sclp_register(&sclp_conf_register);
62 if (rc) {
63 printk(KERN_ERR TAG "failed to register (%d).\n", rc);
64 return rc;
67 if (!(sclp_conf_register.sclp_receive_mask & EVTYP_CONFMGMDATA_MASK)) {
68 printk(KERN_WARNING TAG "no configuration management.\n");
69 sclp_unregister(&sclp_conf_register);
70 rc = -ENOSYS;
72 return rc;
75 __initcall(sclp_conf_init);