From 7b1bd6c2b0c605c2cfbfaf9e3a81f4e8c57dfee6 Mon Sep 17 00:00:00 2001
From: roly <Rolyli.Li@luxshare-ict.com>
Date: Fri, 27 Dec 2024 18:28:28 +0800
Subject: [PATCH] Add applyoption and updatetarget interface

---
 .../Software/UpdateTarget/meson.build         | 15 ++++++++++
 gen/xyz/openbmc_project/Software/meson.build  | 15 ++++++++++
 .../Software/Activation.interface.yaml        |  4 +++
 .../Software/ApplyOptions.interface.yaml      | 28 ++++++++++++++-----
 .../Software/UpdateTarget.interface.yaml      | 17 +++++++++++
 5 files changed, 72 insertions(+), 7 deletions(-)
 create mode 100755 gen/xyz/openbmc_project/Software/UpdateTarget/meson.build
 create mode 100755 yaml/xyz/openbmc_project/Software/UpdateTarget.interface.yaml

diff --git a/gen/xyz/openbmc_project/Software/UpdateTarget/meson.build b/gen/xyz/openbmc_project/Software/UpdateTarget/meson.build
new file mode 100755
index 0000000..c250c86
--- /dev/null
+++ b/gen/xyz/openbmc_project/Software/UpdateTarget/meson.build
@@ -0,0 +1,15 @@
+# Generated file; do not modify.
+generated_sources += custom_target(
+    'xyz/openbmc_project/Software/UpdateTarget__cpp'.underscorify(),
+    input: [ '../../../../../yaml/xyz/openbmc_project/Software/UpdateTarget.interface.yaml',  ],
+    output: [ 'common.hpp', 'server.cpp', 'server.hpp', 'client.hpp',  ],
+    depend_files: sdbusplusplus_depfiles,
+    command: [
+        sdbuspp_gen_meson_prog, '--command', 'cpp',
+        '--output', meson.current_build_dir(),
+        '--tool', sdbusplusplus_prog,
+        '--directory', meson.current_source_dir() / '../../../../../yaml',
+        'xyz/openbmc_project/Software/UpdateTarget',
+    ],
+)
+
diff --git a/gen/xyz/openbmc_project/Software/meson.build b/gen/xyz/openbmc_project/Software/meson.build
index 84424b4..b90d1f8 100644
--- a/gen/xyz/openbmc_project/Software/meson.build
+++ b/gen/xyz/openbmc_project/Software/meson.build
@@ -149,6 +149,21 @@ generated_others += custom_target(
     ],
 )
 
+subdir('UpdateTarget')
+generated_others += custom_target(
+    'xyz/openbmc_project/Software/UpdateTarget__markdown'.underscorify(),
+    input: [ '../../../../yaml/xyz/openbmc_project/Software/UpdateTarget.interface.yaml',  ],
+    output: [ 'UpdateTarget.md' ],
+    depend_files: sdbusplusplus_depfiles,
+    command: [
+        sdbuspp_gen_meson_prog, '--command', 'markdown',
+        '--output', meson.current_build_dir(),
+        '--tool', sdbusplusplus_prog,
+        '--directory', meson.current_source_dir() / '../../../../yaml',
+        'xyz/openbmc_project/Software/UpdateTarget',
+    ],
+)
+
 subdir('Version')
 generated_others += custom_target(
     'xyz/openbmc_project/Software/Version__markdown'.underscorify(),
diff --git a/yaml/xyz/openbmc_project/Software/Activation.interface.yaml b/yaml/xyz/openbmc_project/Software/Activation.interface.yaml
index aba2a62..19c64f4 100644
--- a/yaml/xyz/openbmc_project/Software/Activation.interface.yaml
+++ b/yaml/xyz/openbmc_project/Software/Activation.interface.yaml
@@ -42,6 +42,10 @@ enumerations:
             description: >
                 The Software.Version is currently being staged into the staging
                 flash area.
+          - name: AddQueue
+            description: >
+                The Software.Version is currently being added to the upgrade
+                queue and is waiting for powercycle to trigger the upgrade.
     - name: RequestedActivations
       description: >
           The possible RequestedActivation states of a Software.Version.
diff --git a/yaml/xyz/openbmc_project/Software/ApplyOptions.interface.yaml b/yaml/xyz/openbmc_project/Software/ApplyOptions.interface.yaml
index 4d5a447..3a95d8d 100644
--- a/yaml/xyz/openbmc_project/Software/ApplyOptions.interface.yaml
+++ b/yaml/xyz/openbmc_project/Software/ApplyOptions.interface.yaml
@@ -4,14 +4,28 @@ description: >
     used during firmware activation. ApplyOptions usage during firmware
     activation is implementation specific, not all firmware targets need
     ApplyOptions. This property is removed after activation of the firmware is
-    done and when the firmware goes to Active state. The default value of this
-    property is false.
+    done and when the firmware goes to Active state.
 properties:
     - name: ClearConfig
-      type: boolean
-      default: false
+      type: enum[self.ConfigManagement]
       description: >
           This property indicates whether to clear the software configurations
-          when the firmware image update is getting applied. A value of true
-          indicates the firmware configurations should be cleared along with
-          firmware image activation.
+          when the firmware image update is getting applied.
+enumerations:
+    - name: ConfigManagement
+      description: >
+          An enumeration of possible purposes of the config management in
+          upgrade.
+      values:
+          - name: Keep
+            description: >
+                Keep config in upgrade.
+          - name: Clear
+            description: >
+                Clear config in upgrade.
+          - name: PartialKeep
+            description: >
+                Partial keep config in upgrade.
+          - name: FactoryReset
+            description: >
+                Factory reset config in upgrade.
\ No newline at end of file
diff --git a/yaml/xyz/openbmc_project/Software/UpdateTarget.interface.yaml b/yaml/xyz/openbmc_project/Software/UpdateTarget.interface.yaml
new file mode 100755
index 0000000..ae3366b
--- /dev/null
+++ b/yaml/xyz/openbmc_project/Software/UpdateTarget.interface.yaml
@@ -0,0 +1,17 @@
+description: >
+    Provide the setting of target slot(s) to be updated.
+
+properties:
+    - name: UpdateTargetSlot
+      type: enum[self.TargetSlot]
+      description: >
+          Indicate which slot(s) to update when an image is to be updated.
+
+enumerations:
+    - name: TargetSlot
+      description: >
+          The target slot(s) for code update.
+      values:
+          - name: Primary
+          - name: Secondary
+          - name: Both
\ No newline at end of file
-- 
2.25.1

