meta-facebook: yosemite4: Control NIC main/aux mode
Support NIC 1 switch to main mode when one of slot1 or slot2 Host's
ACPI power status reach to S3. NIC 2 targets to slot3 and slot4,
NIC 3 targets to slot5 and slot6, etc.
Support NIC 1 switch to aux mode when slot1 and slot2 Host's ACPI
power status are S4. NIC 3 targets to slot3 and slot4,
NIC 3 targets to slot5 and slot6, etc.
Tested:
- Power off corresponding Hosts and check the NIC's power status.
- Power on one of the corresponding Host and check the NIC's power
status.
- All NICs have been tested.
Change-Id: I2e76ce3d18f81328789bb9a5d5be4025832b21e7
Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/dbus/power-saving-policy/nic-3.yaml b/meta-facebook/meta-yosemite4/recipes-phosphor/dbus/power-saving-policy/nic-3.yaml
new file mode 100644
index 0000000..7b207a8
--- /dev/null
+++ b/meta-facebook/meta-yosemite4/recipes-phosphor/dbus/power-saving-policy/nic-3.yaml
@@ -0,0 +1,79 @@
+- name: nic 3 current host state path group
+ class: group
+ group: path
+ members:
+ - meta: PATH
+ path: /xyz/openbmc_project/state/host5
+ - meta: PATH
+ path: /xyz/openbmc_project/state/host6
+
+- name: current host state property
+ class: group
+ group: property
+ type: string
+ members:
+ - interface: xyz.openbmc_project.State.Host
+ meta: PROPERTY
+ property: CurrentHostState
+
+- name: nic 3 main mode monitor
+ class: watch
+ watch: property
+ paths: nic 3 current host state path group
+ properties: current host state property
+ callback: check if fulfill nic main mode requirement
+
+- name: nic 3 aux mode monitor
+ class: watch
+ watch: property
+ paths: nic 3 current host state path group
+ properties: current host state property
+ callback: check if fulfill nic aux mode requirement
+
+- name: check if fulfill nic main mode requirement
+ class: condition
+ condition: count
+ paths: nic 3 current host state path group
+ properties: current host state property
+ callback: switch nic 3 to main mode
+ countop: ">="
+ countbound: 1
+ op: "=="
+ bound: xyz.openbmc_project.State.Host.HostState.Running
+
+- name: check if fulfill nic aux mode requirement
+ class: condition
+ condition: count
+ paths: nic 3 current host state path group
+ properties: current host state property
+ callback: switch nic 3 to aux mode
+ countop: "=="
+ countbound: 2
+ op: "=="
+ bound: xyz.openbmc_project.State.Host.HostState.Off
+
+- name: switch nic 3 to main mode
+ class: callback
+ callback: method
+ service: org.freedesktop.systemd1
+ path: /org/freedesktop/systemd1
+ interface: org.freedesktop.systemd1.Manager
+ method: StartUnit
+ args:
+ - value: switch-nic-to-main-mode@3.service
+ type: string
+ - value: replace
+ type: string
+
+- name: switch nic 3 to aux mode
+ class: callback
+ callback: method
+ service: org.freedesktop.systemd1
+ path: /org/freedesktop/systemd1
+ interface: org.freedesktop.systemd1.Manager
+ method: StartUnit
+ args:
+ - value: switch-nic-to-aux-mode@3.service
+ type: string
+ - value: replace
+ type: string