Commit 6f68b5e2c6c04e9cf0e3074f884da36957ce9aae

Authored by Vasant Hegde
Committed by Benjamin Herrenschmidt
1 parent ef1313deaf

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>

Showing 2 changed files with 22 additions and 0 deletions Side-by-side Diff

arch/powerpc/include/asm/opal.h
... ... @@ -601,6 +601,9 @@
601 601 uint64_t line_len;
602 602 } oppanel_line_t;
603 603  
  604 +/* /sys/firmware/opal */
  605 +extern struct kobject *opal_kobj;
  606 +
604 607 /* API functions */
605 608 int64_t opal_console_write(int64_t term_number, __be64 *length,
606 609 const uint8_t *buffer);
arch/powerpc/platforms/powernv/opal.c
... ... @@ -17,11 +17,15 @@
17 17 #include <linux/interrupt.h>
18 18 #include <linux/notifier.h>
19 19 #include <linux/slab.h>
  20 +#include <linux/kobject.h>
20 21 #include <asm/opal.h>
21 22 #include <asm/firmware.h>
22 23  
23 24 #include "powernv.h"
24 25  
  26 +/* /sys/firmware/opal */
  27 +struct kobject *opal_kobj;
  28 +
25 29 struct opal {
26 30 u64 base;
27 31 u64 entry;
... ... @@ -375,6 +379,17 @@
375 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 393 static int __init opal_init(void)
379 394 {
380 395 struct device_node *np, *consoles;
... ... @@ -420,6 +435,10 @@
420 435 " (0x%x)\n", rc, irq, hwirq);
421 436 opal_irqs[i] = irq;
422 437 }
  438 +
  439 + /* Create "opal" kobject under /sys/firmware */
  440 + rc = opal_sysfs_init();
  441 +
423 442 return 0;
424 443 }
425 444 subsys_initcall(opal_init);