phosphor-dbus-monitor: Add the witherspoon specific config file

This config file would be used to create the events when
configured property gets changed.
This config file would be used by the phosphor-event-manager
process.

Resolves openbmc/openbmc#2399

Change-Id: Ib933d720cd81313caf025c35074304f55fac401d
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/meta-witherspoon/recipes-phosphor/dbus/phosphor-dbus-monitor-config-native%.bbappend b/meta-witherspoon/recipes-phosphor/dbus/phosphor-dbus-monitor-config-native%.bbappend
index 7de97f3..2831afe 100644
--- a/meta-witherspoon/recipes-phosphor/dbus/phosphor-dbus-monitor-config-native%.bbappend
+++ b/meta-witherspoon/recipes-phosphor/dbus/phosphor-dbus-monitor-config-native%.bbappend
@@ -1,3 +1,4 @@
 PHOSPHOR_DBUS_MONITOR_CONFIGS_append = " witherspoon-fan-policy-native"
 PHOSPHOR_DBUS_MONITOR_CONFIGS_append = " witherspoon-thermal-policy-native"
 PHOSPHOR_DBUS_MONITOR_CONFIGS_append = " witherspoon-power-supply-policy-native"
+PHOSPHOR_DBUS_MONITOR_CONFIGS_append = " witherspoon-events-policy-native"
diff --git a/meta-witherspoon/recipes-phosphor/events/witherspoon-events-policy-native.bb b/meta-witherspoon/recipes-phosphor/events/witherspoon-events-policy-native.bb
new file mode 100644
index 0000000..c478e12
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/events/witherspoon-events-policy-native.bb
@@ -0,0 +1,13 @@
+SUMMARY = "Event policy for Witherspoon"
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+inherit phosphor-dbus-monitor
+
+SRC_URI += "file://config.yaml"
+
+do_install() {
+        install -D ${WORKDIR}/config.yaml ${D}${config_dir}/config.yaml
+}
+
diff --git a/meta-witherspoon/recipes-phosphor/events/witherspoon-events-policy/config.yaml b/meta-witherspoon/recipes-phosphor/events/witherspoon-events-policy/config.yaml
new file mode 100644
index 0000000..0d31afb
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/events/witherspoon-events-policy/config.yaml
@@ -0,0 +1,114 @@
+- name:  occpath group
+  class: group
+  group: path
+  members:
+    - meta: PATH
+      path: /org/open_power/control/occ0
+
+- name:  occproctemp property
+  class: group
+  group: property
+  type:  boolean
+  members:
+    - interface: org.open_power.OCC.Status
+      meta: PROPERTY
+      property: ThrottleProcTemp
+
+- name:  occprocpower property
+  class: group
+  group: property
+  type:  boolean
+  members:
+    - interface: org.open_power.OCC.Status
+      meta: PROPERTY
+      property: ThrottleProcPower
+
+- name:  occmemtemp property
+  class: group
+  group: property
+  type:  boolean
+  members:
+    - interface: org.open_power.OCC.Status
+      meta: PROPERTY
+      property: ThrottleMemTemp
+
+- name: watch occproctemp
+  class: watch
+  watch: property
+  paths: occpath group
+  properties: occproctemp property
+  callback: check occproctemp
+
+- name: watch occprocpower
+  class: watch
+  watch: property
+  paths: occpath group
+  properties: occprocpower property
+  callback: check occprocpower
+
+- name: watch occmemtemp
+  class: watch
+  watch: property
+  paths: occpath group
+  properties: occmemtemp property
+  callback: check occmemtemp
+
+- name: check occproctemp
+  class: condition
+  condition: count
+  paths: occpath group
+  properties: occproctemp property
+  defer: 1000us
+  callback: create occproctemp event
+  countop: '=='
+  countbound: 1
+  op: '=='
+  bound: true
+
+- name: check occprocpower
+  class: condition
+  condition: count
+  paths: occpath group
+  properties: occprocpower property
+  defer: 1000us
+  callback: create occprocpower event
+  countop: '=='
+  countbound: 1
+  op: '=='
+  bound: true
+
+- name: check occmemtemp
+  class: condition
+  condition: count
+  paths: occpath group
+  properties: occmemtemp property
+  defer: 1000us
+  callback: create occmemtemp event
+  countop: '=='
+  countbound: 1
+  op: '=='
+  bound: true
+
+- name: create occproctemp event
+  class: callback
+  callback: event
+  paths: occpath group
+  properties: occproctemp property
+  eventName: occ
+  eventMessage: "Processor throttled due to an over temperature condition."
+
+- name: create occprocpower event
+  class: callback
+  callback: event
+  paths: occpath group
+  properties: occprocpower property
+  eventName: occ
+  eventMessage: "Processor throttled due to reaching the power cap limit."
+
+- name: create occmemtemp event
+  class: callback
+  callback: event
+  paths: occpath group
+  properties: occmemtemp property
+  eventName: occ
+  eventMessage: "Memory throttled due to an over temperature condition."