powerpc/powernv: Create opal sysfs directory
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>
Tue, 27 Aug 2013 09:39:52 +0000 (15:09 +0530)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 30 Oct 2013 05:09:34 +0000 (16:09 +1100)
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>
arch/powerpc/include/asm/opal.h
arch/powerpc/platforms/powernv/opal.c

index 4cc33ba1edd3ed292cacd1d70bd3030023bbc3e5..ee0efd2f2abc13395d3286a0ee0030a811c85510 100644 (file)
@@ -601,6 +601,9 @@ typedef struct oppanel_line {
        uint64_t        line_len;
 } oppanel_line_t;
 
+/* /sys/firmware/opal */
+extern struct kobject *opal_kobj;
+
 /* API functions */
 int64_t opal_console_write(int64_t term_number, __be64 *length,
                           const uint8_t *buffer);
index 09336f0c54c56e12954b454f6d562aac64508c50..37f06580709a426c7632d924ac7bd2076568b689 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/notifier.h>
 #include <linux/slab.h>
+#include <linux/kobject.h>
 #include <asm/opal.h>
 #include <asm/firmware.h>
 
 #include "powernv.h"
 
+/* /sys/firmware/opal */
+struct kobject *opal_kobj;
+
 struct opal {
        u64 base;
        u64 entry;
@@ -375,6 +379,17 @@ static irqreturn_t opal_interrupt(int irq, void *data)
        return IRQ_HANDLED;
 }
 
+static int opal_sysfs_init(void)
+{
+       opal_kobj = kobject_create_and_add("opal", firmware_kobj);
+       if (!opal_kobj) {
+               pr_warn("kobject_create_and_add opal failed\n");
+               return -ENOMEM;
+       }
+
+       return 0;
+}
+
 static int __init opal_init(void)
 {
        struct device_node *np, *consoles;
@@ -420,6 +435,10 @@ static int __init opal_init(void)
                                   " (0x%x)\n", rc, irq, hwirq);
                opal_irqs[i] = irq;
        }
+
+       /* Create "opal" kobject under /sys/firmware */
+       rc = opal_sysfs_init();
+
        return 0;
 }
 subsys_initcall(opal_init);