State.BMC: add event for RebootCause

When the BMC comes out of reset, some chips provide a reason / cause
of the last reboot.  This is already saved in the BMC interface.
Define an event which can also be used to record this.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I8fde0e341261a5d7a20af3c1a9f672dfe3b103a9
diff --git a/gen/xyz/openbmc_project/State/BMC/meson.build b/gen/xyz/openbmc_project/State/BMC/meson.build
index 3ede9dd..7d3c553 100644
--- a/gen/xyz/openbmc_project/State/BMC/meson.build
+++ b/gen/xyz/openbmc_project/State/BMC/meson.build
@@ -7,11 +7,14 @@
     'xyz/openbmc_project/State/BMC__cpp'.underscorify(),
     input: [
         '../../../../../yaml/xyz/openbmc_project/State/BMC.errors.yaml',
+        '../../../../../yaml/xyz/openbmc_project/State/BMC.events.yaml',
         '../../../../../yaml/xyz/openbmc_project/State/BMC.interface.yaml',
     ],
     output: [
         'error.cpp',
         'error.hpp',
+        'event.cpp',
+        'event.hpp',
         'common.hpp',
         'server.hpp',
         'server.cpp',
@@ -35,6 +38,8 @@
     install_dir: [
         false,
         get_option('includedir') / sdbusplus_current_path,
+        false,
+        get_option('includedir') / sdbusplus_current_path,
         get_option('includedir') / sdbusplus_current_path,
         get_option('includedir') / sdbusplus_current_path,
         false,
diff --git a/gen/xyz/openbmc_project/State/meson.build b/gen/xyz/openbmc_project/State/meson.build
index 2d4861d..7ac8f28 100644
--- a/gen/xyz/openbmc_project/State/meson.build
+++ b/gen/xyz/openbmc_project/State/meson.build
@@ -25,6 +25,7 @@
     'xyz/openbmc_project/State/BMC__markdown'.underscorify(),
     input: [
         '../../../../yaml/xyz/openbmc_project/State/BMC.errors.yaml',
+        '../../../../yaml/xyz/openbmc_project/State/BMC.events.yaml',
         '../../../../yaml/xyz/openbmc_project/State/BMC.interface.yaml',
     ],
     output: ['BMC.md'],
@@ -46,6 +47,28 @@
     build_by_default: should_generate_markdown,
 )
 
+generated_registry += custom_target(
+    'xyz/openbmc_project/State/BMC__registry'.underscorify(),
+    input: ['../../../../yaml/xyz/openbmc_project/State/BMC.events.yaml'],
+    output: ['BMC.json'],
+    depend_files: sdbusplusplus_depfiles,
+    command: [
+        sdbuspp_gen_meson_prog,
+        '--command',
+        'registry',
+        '--output',
+        meson.current_build_dir(),
+        '--tool',
+        sdbusplusplus_prog,
+        '--directory',
+        meson.current_source_dir() / '../../../../yaml',
+        'xyz/openbmc_project/State/BMC',
+    ],
+    install: should_generate_registry,
+    install_dir: [inst_registry_dir / sdbusplus_current_path],
+    build_by_default: should_generate_registry,
+)
+
 generated_markdown += custom_target(
     'xyz/openbmc_project/State/BMCRedundancy__markdown'.underscorify(),
     input: [
diff --git a/yaml/xyz/openbmc_project/State/BMC.events.yaml b/yaml/xyz/openbmc_project/State/BMC.events.yaml
new file mode 100644
index 0000000..016a49c
--- /dev/null
+++ b/yaml/xyz/openbmc_project/State/BMC.events.yaml
@@ -0,0 +1,12 @@
+version: 1.0.0
+
+events:
+    - name: RebootCause
+      metadata:
+          - name: Cause
+            type: enum[xyz.openbmc_project.State.BMC.RebootCause]
+            primary: true
+            description: The detected cause of the last BMC reboot.
+      en:
+          description: The BMC reboot and the cause was identified.
+          message: The last BMC reboot was caused by '{Cause}'.