thresholds: Add PerformanceLoss threshold

Create an xyz.openbmc_project.Sensor.Threshold.PerformanceLoss D-Bus
interface.  This could be placed on a sensor to:

a) Signal some other software to do something to the server that results
in performance loss, such as memory or CPU throttling, to bring down the
sensor value.

b) Trigger an event to the user so they know to expect a performance
loss, and which sensor caused it.

An immediate use of this will be on OpenPower systems to throttle the
CPU/memory and trigger event logs due to a high (virtual) ambient
temperature.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Id93843abdb45f00ee359f902d539b9df6bf5359a
diff --git a/gen/xyz/openbmc_project/Sensor/Threshold/PerformanceLoss/meson.build b/gen/xyz/openbmc_project/Sensor/Threshold/PerformanceLoss/meson.build
new file mode 100644
index 0000000..2e9e082
--- /dev/null
+++ b/gen/xyz/openbmc_project/Sensor/Threshold/PerformanceLoss/meson.build
@@ -0,0 +1,14 @@
+# Generated file; do not modify.
+generated_sources += custom_target(
+    'xyz/openbmc_project/Sensor/Threshold/PerformanceLoss__cpp'.underscorify(),
+    input: [ meson.source_root() / 'xyz/openbmc_project/Sensor/Threshold/PerformanceLoss.interface.yaml',  ],
+    output: [ 'server.cpp', 'server.hpp', 'client.hpp',  ],
+    command: [
+        sdbuspp_gen_meson_prog, '--command', 'cpp',
+        '--output', meson.current_build_dir(),
+        '--tool', sdbusplusplus_prog,
+        '--directory', meson.source_root(),
+        'xyz/openbmc_project/Sensor/Threshold/PerformanceLoss',
+    ],
+)
+
diff --git a/gen/xyz/openbmc_project/Sensor/Threshold/meson.build b/gen/xyz/openbmc_project/Sensor/Threshold/meson.build
index ebc1c2e..e04269e 100644
--- a/gen/xyz/openbmc_project/Sensor/Threshold/meson.build
+++ b/gen/xyz/openbmc_project/Sensor/Threshold/meson.build
@@ -42,6 +42,21 @@
     build_by_default: true,
 )
 
+subdir('PerformanceLoss')
+generated_others += custom_target(
+    'xyz/openbmc_project/Sensor/Threshold/PerformanceLoss__markdown'.underscorify(),
+    input: [ meson.source_root() / 'xyz/openbmc_project/Sensor/Threshold/PerformanceLoss.interface.yaml',  ],
+    output: [ 'PerformanceLoss.md' ],
+    command: [
+        sdbuspp_gen_meson_prog, '--command', 'markdown',
+        '--output', meson.current_build_dir(),
+        '--tool', sdbusplusplus_prog,
+        '--directory', meson.source_root(),
+        'xyz/openbmc_project/Sensor/Threshold/PerformanceLoss',
+    ],
+    build_by_default: true,
+)
+
 subdir('SoftShutdown')
 generated_others += custom_target(
     'xyz/openbmc_project/Sensor/Threshold/SoftShutdown__markdown'.underscorify(),
diff --git a/xyz/openbmc_project/Sensor/Threshold/PerformanceLoss.interface.yaml b/xyz/openbmc_project/Sensor/Threshold/PerformanceLoss.interface.yaml
new file mode 100644
index 0000000..343f648
--- /dev/null
+++ b/xyz/openbmc_project/Sensor/Threshold/PerformanceLoss.interface.yaml
@@ -0,0 +1,46 @@
+description: >
+    Implement to provide performance loss class sensor thresholds.  Objects
+    implementing Sensor.Threshold.PerformanceLoss must be instantiated in the correct
+    hierarchy within the sensors namespace.  The following sensor hierarchies
+    are recognized:
+      temperature
+      fan_tach
+      voltage
+      altitude
+      current
+      power
+      energy
+
+
+    Additionally, any object implementing Sensor.Threshold.PerformanceLoss must also
+    implement Sensor.Value.
+
+properties:
+    - name: PerformanceLossHigh
+      type: double
+      default: NaN
+      description: >
+          The upper bound of the warning threshold.  A value of 'NaN' is used
+          to indicate there is no threshold of this type.
+    - name: PerformanceLossLow
+      type: double
+      default: NaN
+      description: >
+          The lower bound of the warning threshold.  A value of 'NaN' is used
+          to indicate there is no threshold of this type.
+    - name: PerformanceLossAlarmHigh
+      type: boolean
+      description: >
+          True if the sensor value has exceeded the defined bound.
+          False if the sensor value has not exceeded the defined bound.
+
+          PerformanceLossAlarmHigh may be set to False to clear an alarm condition.
+          The behavior of setting PerformanceLossAlarmHigh to True is undefined.
+    - name: PerformanceLossAlarmLow
+      type: boolean
+      description: >
+          True if the sensor value has exceeded the defined bound.
+          False if the sensor value has not exceeded the defined bound.
+
+          PerformanceLossAlarmLow may be set to False to clear an alarm condition.
+          The behavior of setting PerformanceLossAlarmLow to True is undefined.