phosphor-dbus-interfaces: add NetworkAdapter/Port/PLDM state interface
1) add NetworkAdapter and Port Inventory Item
2) add PLDM state sensor reading interface
Tested: https://paste.googleplex.com/5066731105550336
Fusion-Link: N/A, doesn't affect presubmit
Google-Bug-Id: 322542727
Change-Id: I3a2881da2c640713c277af658771554c0d121e15
Signed-off-by: Jinliang Wang <jinliangw@google.com>
diff --git a/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-Inventory-add-NetworkAdapter-and-Port-Inventory-Item.patch b/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-Inventory-add-NetworkAdapter-and-Port-Inventory-Item.patch
new file mode 100644
index 0000000..da0e7d2
--- /dev/null
+++ b/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-Inventory-add-NetworkAdapter-and-Port-Inventory-Item.patch
@@ -0,0 +1,155 @@
+From 3969599add758a8915c53761c2b723bcdd19e8f8 Mon Sep 17 00:00:00 2001
+From: Jinliang Wang <jinliangw@google.com>
+Date: Sun, 14 Apr 2024 11:32:10 -0700
+Subject: [PATCH 2/2] Inventory: add NetworkAdapter and Port Inventory Item
+
+Minimal Implement to support NetworkAdapter (NIC).
+
+Patch Tracking Bug: b/335330343
+Upstream info / review: N/A
+Upstream-Status: Pending
+Justification: Need for redfish NIC model
+
+Google-Bug-Id: 322542727
+Signed-off-by: Jinliang Wang <jinliangw@google.com>
+---
+ .../Inventory/Item/NetworkAdapter/meson.build | 15 ++++++++++
+ .../Inventory/Item/Port/meson.build | 15 ++++++++++
+ .../Inventory/Item/meson.build | 30 +++++++++++++++++++
+ .../Item/NetworkAdapter.interface.yaml | 8 +++++
+ .../Inventory/Item/Port.interface.yaml | 16 ++++++++++
+ 5 files changed, 84 insertions(+)
+ create mode 100644 gen/xyz/openbmc_project/Inventory/Item/NetworkAdapter/meson.build
+ create mode 100644 gen/xyz/openbmc_project/Inventory/Item/Port/meson.build
+ create mode 100644 yaml/xyz/openbmc_project/Inventory/Item/NetworkAdapter.interface.yaml
+ create mode 100644 yaml/xyz/openbmc_project/Inventory/Item/Port.interface.yaml
+
+diff --git a/gen/xyz/openbmc_project/Inventory/Item/NetworkAdapter/meson.build b/gen/xyz/openbmc_project/Inventory/Item/NetworkAdapter/meson.build
+new file mode 100644
+index 0000000..0133130
+--- /dev/null
++++ b/gen/xyz/openbmc_project/Inventory/Item/NetworkAdapter/meson.build
+@@ -0,0 +1,15 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/Inventory/Item/NetworkAdapter__cpp'.underscorify(),
++ input: [ '../../../../../../yaml/xyz/openbmc_project/Inventory/Item/NetworkAdapter.interface.yaml', ],
++ output: [ 'common.hpp', 'server.cpp', 'server.hpp', 'aserver.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/Inventory/Item/NetworkAdapter',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/Inventory/Item/Port/meson.build b/gen/xyz/openbmc_project/Inventory/Item/Port/meson.build
+new file mode 100644
+index 0000000..8061fc4
+--- /dev/null
++++ b/gen/xyz/openbmc_project/Inventory/Item/Port/meson.build
+@@ -0,0 +1,15 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/Inventory/Item/Port__cpp'.underscorify(),
++ input: [ '../../../../../../yaml/xyz/openbmc_project/Inventory/Item/Port.interface.yaml', ],
++ output: [ 'common.hpp', 'server.cpp', 'server.hpp', 'aserver.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/Inventory/Item/Port',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/Inventory/Item/meson.build b/gen/xyz/openbmc_project/Inventory/Item/meson.build
+index b5bc3b4..794ee49 100644
+--- a/gen/xyz/openbmc_project/Inventory/Item/meson.build
++++ b/gen/xyz/openbmc_project/Inventory/Item/meson.build
+@@ -283,6 +283,21 @@ generated_others += custom_target(
+ ],
+ )
+
++subdir('NetworkAdapter')
++generated_others += custom_target(
++ 'xyz/openbmc_project/Inventory/Item/NetworkAdapter__markdown'.underscorify(),
++ input: [ '../../../../../yaml/xyz/openbmc_project/Inventory/Item/NetworkAdapter.interface.yaml', ],
++ output: [ 'NetworkAdapter.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/Inventory/Item/NetworkAdapter',
++ ],
++)
++
+ subdir('NetworkInterface')
+ generated_others += custom_target(
+ 'xyz/openbmc_project/Inventory/Item/NetworkInterface__markdown'.underscorify(),
+@@ -358,6 +373,21 @@ generated_others += custom_target(
+ ],
+ )
+
++subdir('Port')
++generated_others += custom_target(
++ 'xyz/openbmc_project/Inventory/Item/Port__markdown'.underscorify(),
++ input: [ '../../../../../yaml/xyz/openbmc_project/Inventory/Item/Port.interface.yaml', ],
++ output: [ 'Port.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/Inventory/Item/Port',
++ ],
++)
++
+ subdir('PowerSupply')
+ generated_others += custom_target(
+ 'xyz/openbmc_project/Inventory/Item/PowerSupply__markdown'.underscorify(),
+diff --git a/yaml/xyz/openbmc_project/Inventory/Item/NetworkAdapter.interface.yaml b/yaml/xyz/openbmc_project/Inventory/Item/NetworkAdapter.interface.yaml
+new file mode 100644
+index 0000000..e99f48e
+--- /dev/null
++++ b/yaml/xyz/openbmc_project/Inventory/Item/NetworkAdapter.interface.yaml
+@@ -0,0 +1,8 @@
++description: >
++ Implement to provide network adapter attributes.
++properties:
++ - name: StatusHealth
++ type: string
++ description: >
++ The health state of this network adapter in the absence of its
++ dependent resources
+diff --git a/yaml/xyz/openbmc_project/Inventory/Item/Port.interface.yaml b/yaml/xyz/openbmc_project/Inventory/Item/Port.interface.yaml
+new file mode 100644
+index 0000000..a494769
+--- /dev/null
++++ b/yaml/xyz/openbmc_project/Inventory/Item/Port.interface.yaml
+@@ -0,0 +1,16 @@
++description: >
++ Implement to provide port attributes.
++properties:
++ - name: CurrentSpeedGbps
++ default: 0
++ type: double
++ description: >
++ Current link speed Gbps. `0` if link is down.
++ - name: LinkState
++ type: string
++ description: >
++ The desired link state for this interface
++ - name: LinkStatus
++ type: string
++ description: >
++ The link status for this interface
+--
+2.44.0.769.g3c40516874-goog
+
diff --git a/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-PLDM-add-StateReading-interface.patch b/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-PLDM-add-StateReading-interface.patch
new file mode 100644
index 0000000..f0558c7
--- /dev/null
+++ b/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-PLDM-add-StateReading-interface.patch
@@ -0,0 +1,87 @@
+From 61092bc3717db85af5d444c0d41f044969cfa479 Mon Sep 17 00:00:00 2001
+From: Jinliang Wang <jinliangw@google.com>
+Date: Wed, 10 Apr 2024 16:12:15 -0700
+Subject: [PATCH 1/2] PLDM: add StateReading interface
+
+Simple interface to hold PLDM state sensor reading.
+PLDM state sensor reading may contain multiple (1 ~ 8) state set ID, so
+here we use an array of struct [ StateSetID, sensorOperationalState,
+presentState, previousState, eventState ].
+
+Patch Tracking Bug: b/335329945
+Upstream info / review: N/A
+Upstream-Status: Pending
+Justification: Needed for PLDM state sensor
+
+Google-Bug-Id: 322542727
+Signed-off-by: Jinliang Wang <jinliangw@google.com>
+---
+ .../openbmc_project/PLDM/StateReading/meson.build | 15 +++++++++++++++
+ gen/xyz/openbmc_project/PLDM/meson.build | 15 +++++++++++++++
+ .../PLDM/StateReading.interface.yaml | 9 +++++++++
+ 3 files changed, 39 insertions(+)
+ create mode 100644 gen/xyz/openbmc_project/PLDM/StateReading/meson.build
+ create mode 100644 yaml/xyz/openbmc_project/PLDM/StateReading.interface.yaml
+
+diff --git a/gen/xyz/openbmc_project/PLDM/StateReading/meson.build b/gen/xyz/openbmc_project/PLDM/StateReading/meson.build
+new file mode 100644
+index 0000000..a23d792
+--- /dev/null
++++ b/gen/xyz/openbmc_project/PLDM/StateReading/meson.build
+@@ -0,0 +1,15 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/PLDM/StateReading__cpp'.underscorify(),
++ input: [ '../../../../../yaml/xyz/openbmc_project/PLDM/StateReading.interface.yaml', ],
++ output: [ 'common.hpp', 'server.cpp', 'server.hpp', 'aserver.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/PLDM/StateReading',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/PLDM/meson.build b/gen/xyz/openbmc_project/PLDM/meson.build
+index b0140d5..ba707b2 100644
+--- a/gen/xyz/openbmc_project/PLDM/meson.build
++++ b/gen/xyz/openbmc_project/PLDM/meson.build
+@@ -45,3 +45,18 @@ generated_others += custom_target(
+ ],
+ )
+
++subdir('StateReading')
++generated_others += custom_target(
++ 'xyz/openbmc_project/PLDM/StateReading__markdown'.underscorify(),
++ input: [ '../../../../yaml/xyz/openbmc_project/PLDM/StateReading.interface.yaml', ],
++ output: [ 'StateReading.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/PLDM/StateReading',
++ ],
++)
++
+diff --git a/yaml/xyz/openbmc_project/PLDM/StateReading.interface.yaml b/yaml/xyz/openbmc_project/PLDM/StateReading.interface.yaml
+new file mode 100644
+index 0000000..b4d70ed
+--- /dev/null
++++ b/yaml/xyz/openbmc_project/PLDM/StateReading.interface.yaml
+@@ -0,0 +1,9 @@
++description: >
++ Implement to provide PLDM State sensor readings.
++
++properties:
++ - name: Values
++ type: array[struct[uint16, byte, byte, byte, byte]]
++ description: >
++ The state sensor reading, array of struct [ StateSetID,
++ sensorOperationalState, presentState, previousState, eventState ]
+--
+2.44.0.769.g3c40516874-goog
+
diff --git a/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend b/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend
index fd133dd..53be14f 100644
--- a/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend
+++ b/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend
@@ -7,6 +7,8 @@
file://0004-Add-Common.DeviceOperationFailed-error.patch \
file://0005-Add-DriveErase-interface.patch \
file://0001-boot-time-monitor-Add-needed-dbus-interfaces.patch \
+ file://0001-PLDM-add-StateReading-interface.patch \
+ file://0001-Inventory-add-NetworkAdapter-and-Port-Inventory-Item.patch \
"
EXTRA_OEMESON += " \