diff options
author | Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | 2013-08-27 05:39:52 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-10-30 01:09:34 -0400 |
commit | 6f68b5e2c6c04e9cf0e3074f884da36957ce9aae (patch) | |
tree | bb2f83cfc00a044d5c4f3926643a1000c4007799 | |
parent | ef1313deafb7baa6d3382044e962d5ad5e8c8dd6 (diff) |
powerpc/powernv: Create opal sysfs directory
Create /sys/firmware/opal directory. We wil use this
interface to fetch opal error logs, firmware update, etc.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/include/asm/opal.h | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/opal.c | 19 |
2 files changed, 22 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 4cc33ba1edd3..ee0efd2f2abc 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h | |||
@@ -601,6 +601,9 @@ typedef struct oppanel_line { | |||
601 | uint64_t line_len; | 601 | uint64_t line_len; |
602 | } oppanel_line_t; | 602 | } oppanel_line_t; |
603 | 603 | ||
604 | /* /sys/firmware/opal */ | ||
605 | extern struct kobject *opal_kobj; | ||
606 | |||
604 | /* API functions */ | 607 | /* API functions */ |
605 | int64_t opal_console_write(int64_t term_number, __be64 *length, | 608 | int64_t opal_console_write(int64_t term_number, __be64 *length, |
606 | const uint8_t *buffer); | 609 | const uint8_t *buffer); |
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 09336f0c54c5..37f06580709a 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c | |||
@@ -17,11 +17,15 @@ | |||
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/notifier.h> | 18 | #include <linux/notifier.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/kobject.h> | ||
20 | #include <asm/opal.h> | 21 | #include <asm/opal.h> |
21 | #include <asm/firmware.h> | 22 | #include <asm/firmware.h> |
22 | 23 | ||
23 | #include "powernv.h" | 24 | #include "powernv.h" |
24 | 25 | ||
26 | /* /sys/firmware/opal */ | ||
27 | struct kobject *opal_kobj; | ||
28 | |||
25 | struct opal { | 29 | struct opal { |
26 | u64 base; | 30 | u64 base; |
27 | u64 entry; | 31 | u64 entry; |
@@ -375,6 +379,17 @@ static irqreturn_t opal_interrupt(int irq, void *data) | |||
375 | return IRQ_HANDLED; | 379 | return IRQ_HANDLED; |
376 | } | 380 | } |
377 | 381 | ||
382 | static int opal_sysfs_init(void) | ||
383 | { | ||
384 | opal_kobj = kobject_create_and_add("opal", firmware_kobj); | ||
385 | if (!opal_kobj) { | ||
386 | pr_warn("kobject_create_and_add opal failed\n"); | ||
387 | return -ENOMEM; | ||
388 | } | ||
389 | |||
390 | return 0; | ||
391 | } | ||
392 | |||
378 | static int __init opal_init(void) | 393 | static int __init opal_init(void) |
379 | { | 394 | { |
380 | struct device_node *np, *consoles; | 395 | struct device_node *np, *consoles; |
@@ -420,6 +435,10 @@ static int __init opal_init(void) | |||
420 | " (0x%x)\n", rc, irq, hwirq); | 435 | " (0x%x)\n", rc, irq, hwirq); |
421 | opal_irqs[i] = irq; | 436 | opal_irqs[i] = irq; |
422 | } | 437 | } |
438 | |||
439 | /* Create "opal" kobject under /sys/firmware */ | ||
440 | rc = opal_sysfs_init(); | ||
441 | |||
423 | return 0; | 442 | return 0; |
424 | } | 443 | } |
425 | subsys_initcall(opal_init); | 444 | subsys_initcall(opal_init); |