diff options
author | Kent Yoder <key@linux.vnet.ibm.com> | 2012-04-12 01:04:11 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-05-13 20:49:06 -0400 |
commit | 4726b7b5e5a0a3d11a3c80ae8e2d5395003c51af (patch) | |
tree | 37f5236d2ebf5b3598836bae69245358a6905961 | |
parent | 4d6e0fa1a593b2d7c4b468cb5ac52c29fe20e716 (diff) |
powerpc/pseries: Add pseries update notifier for OFDT prop changes
This adds an update notifier mechanism for changes to properties in the
device tree. One use of this would be a device driver that needs to act
on changes to it's properties in the device tree after a live migration
or a dynamic activation that is triggered by updates to ofdt properties.
Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/include/asm/pSeries_reconfig.h | 12 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/reconfig.c | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/pSeries_reconfig.h b/arch/powerpc/include/asm/pSeries_reconfig.h index 23cd6cc30bcf..c07edfe98b98 100644 --- a/arch/powerpc/include/asm/pSeries_reconfig.h +++ b/arch/powerpc/include/asm/pSeries_reconfig.h | |||
@@ -13,6 +13,18 @@ | |||
13 | #define PSERIES_RECONFIG_REMOVE 0x0002 | 13 | #define PSERIES_RECONFIG_REMOVE 0x0002 |
14 | #define PSERIES_DRCONF_MEM_ADD 0x0003 | 14 | #define PSERIES_DRCONF_MEM_ADD 0x0003 |
15 | #define PSERIES_DRCONF_MEM_REMOVE 0x0004 | 15 | #define PSERIES_DRCONF_MEM_REMOVE 0x0004 |
16 | #define PSERIES_UPDATE_PROPERTY 0x0005 | ||
17 | |||
18 | /** | ||
19 | * pSeries_reconfig_notify - Notifier value structure for OFDT property updates | ||
20 | * | ||
21 | * @node: Device tree node which owns the property being updated | ||
22 | * @property: Updated property | ||
23 | */ | ||
24 | struct pSeries_reconfig_prop_update { | ||
25 | struct device_node *node; | ||
26 | struct property *property; | ||
27 | }; | ||
16 | 28 | ||
17 | #ifdef CONFIG_PPC_PSERIES | 29 | #ifdef CONFIG_PPC_PSERIES |
18 | extern int pSeries_reconfig_notifier_register(struct notifier_block *); | 30 | extern int pSeries_reconfig_notifier_register(struct notifier_block *); |
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c index 168651acdd83..7b3bf76ef834 100644 --- a/arch/powerpc/platforms/pseries/reconfig.c +++ b/arch/powerpc/platforms/pseries/reconfig.c | |||
@@ -103,11 +103,13 @@ int pSeries_reconfig_notifier_register(struct notifier_block *nb) | |||
103 | { | 103 | { |
104 | return blocking_notifier_chain_register(&pSeries_reconfig_chain, nb); | 104 | return blocking_notifier_chain_register(&pSeries_reconfig_chain, nb); |
105 | } | 105 | } |
106 | EXPORT_SYMBOL_GPL(pSeries_reconfig_notifier_register); | ||
106 | 107 | ||
107 | void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) | 108 | void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) |
108 | { | 109 | { |
109 | blocking_notifier_chain_unregister(&pSeries_reconfig_chain, nb); | 110 | blocking_notifier_chain_unregister(&pSeries_reconfig_chain, nb); |
110 | } | 111 | } |
112 | EXPORT_SYMBOL_GPL(pSeries_reconfig_notifier_unregister); | ||
111 | 113 | ||
112 | int pSeries_reconfig_notify(unsigned long action, void *p) | 114 | int pSeries_reconfig_notify(unsigned long action, void *p) |
113 | { | 115 | { |
@@ -426,6 +428,7 @@ static int do_remove_property(char *buf, size_t bufsize) | |||
426 | static int do_update_property(char *buf, size_t bufsize) | 428 | static int do_update_property(char *buf, size_t bufsize) |
427 | { | 429 | { |
428 | struct device_node *np; | 430 | struct device_node *np; |
431 | struct pSeries_reconfig_prop_update upd_value; | ||
429 | unsigned char *value; | 432 | unsigned char *value; |
430 | char *name, *end, *next_prop; | 433 | char *name, *end, *next_prop; |
431 | int rc, length; | 434 | int rc, length; |
@@ -454,6 +457,10 @@ static int do_update_property(char *buf, size_t bufsize) | |||
454 | return -ENODEV; | 457 | return -ENODEV; |
455 | } | 458 | } |
456 | 459 | ||
460 | upd_value.node = np; | ||
461 | upd_value.property = newprop; | ||
462 | pSeries_reconfig_notify(PSERIES_UPDATE_PROPERTY, &upd_value); | ||
463 | |||
457 | rc = prom_update_property(np, newprop, oldprop); | 464 | rc = prom_update_property(np, newprop, oldprop); |
458 | if (rc) | 465 | if (rc) |
459 | return rc; | 466 | return rc; |