meta-quanta: gbs: add YAML paths/whitelist config/watchdog patch

1. set gbs YAML config paths for sensors and FRUs
2. add gbs IPMI whitelist config
3. add pre-timeout interrupt patch for IPMI watchdog commands

(From meta-quanta rev: fee51df037779d09b18d2ae0e7c864182d40c43c)

Signed-off-by: George Hung <george.hung@quantatw.com>
Change-Id: I06decf7f95ebd25153cefa7a12be45bbde63aee6
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch
new file mode 100644
index 0000000..d815cde
--- /dev/null
+++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch
@@ -0,0 +1,138 @@
+From 9deb72959477700216326c033c930236e58f965f Mon Sep 17 00:00:00 2001
+From: Ren Yu <yux.ren@intel.com>
+Date: Tue, 28 May 2019 17:11:17 +0800
+Subject: [PATCH] Save the pre-timeout interrupt in dbus property
+
+Get the watchdog pre-timeout interrupt value from ipmi watchdog set command,
+and store it into dbus property.
+
+Tested:
+Config IPMI watchdog: BIOS FRB2 Power Cycle after 1 seconds:
+ipmitool raw 0x06 0x24 0x01 0x13 0x0 0x2 0xa 0x00
+Start watchdog:
+Ipmitool mc watchdog reset
+Check the watchdog pre-timeout interrupt in below:
+https://BMCIP/redfish/v1/Systems/system/LogServices/EventLog/Entries
+
+Signed-off-by: Ren Yu <yux.ren@intel.com>
+
+---
+ app/watchdog.cpp         | 47 ++++++++++++++++++++++++++++++++++++++++
+ app/watchdog_service.cpp |  6 +++++
+ app/watchdog_service.hpp |  9 ++++++++
+ 3 files changed, 62 insertions(+)
+
+diff --git a/app/watchdog.cpp b/app/watchdog.cpp
+index 03c373e..cb0b1fd 100644
+--- a/app/watchdog.cpp
++++ b/app/watchdog.cpp
+@@ -80,6 +80,7 @@ ipmi::RspType<> ipmiAppResetWatchdogTimer()
+ 
+ static constexpr uint8_t wd_dont_stop = 0x1 << 6;
+ static constexpr uint8_t wd_timeout_action_mask = 0x3;
++static constexpr uint8_t wdPreTimeoutInterruptMask = 0x3;
+ 
+ static constexpr uint8_t wdTimerUseResTimer1 = 0x0;
+ static constexpr uint8_t wdTimerUseResTimer2 = 0x6;
+@@ -127,6 +128,45 @@ WatchdogService::Action ipmiActionToWdAction(IpmiAction ipmi_action)
+     }
+ }
+ 
++enum class IpmiPreTimeoutInterrupt : uint8_t
++{
++    None = 0x0,
++    SMI = 0x1,
++    NMI = 0x2,
++    MI = 0x3,
++};
++/** @brief Converts an IPMI Watchdog PreTimeoutInterrupt to DBUS defined action
++ *  @param[in] ipmi_action The IPMI Watchdog PreTimeoutInterrupt
++ *  @return The Watchdog PreTimeoutInterrupt that the ipmi_action maps to
++ */
++WatchdogService::PreTimeoutInterruptAction ipmiPreTimeoutInterruptToWdAction(
++    IpmiPreTimeoutInterrupt ipmiPreTimeOutInterrupt)
++{
++    switch (ipmiPreTimeOutInterrupt)
++    {
++        case IpmiPreTimeoutInterrupt::None:
++        {
++            return WatchdogService::PreTimeoutInterruptAction::None;
++        }
++        case IpmiPreTimeoutInterrupt::SMI:
++        {
++            return WatchdogService::PreTimeoutInterruptAction::SMI;
++        }
++        case IpmiPreTimeoutInterrupt::NMI:
++        {
++            return WatchdogService::PreTimeoutInterruptAction::NMI;
++        }
++        case IpmiPreTimeoutInterrupt::MI:
++        {
++            return WatchdogService::PreTimeoutInterruptAction::MI;
++        }
++        default:
++        {
++            throw std::domain_error("IPMI PreTimeoutInterrupt is invalid");
++        }
++    }
++}
++
+ enum class IpmiTimerUse : uint8_t
+ {
+     Reserved = 0x0,
+@@ -250,6 +290,13 @@ ipmi::RspType<>
+         // Mark as initialized so that future resets behave correctly
+         wd_service.setInitialized(true);
+ 
++        // pretimeOutAction
++        const auto ipmiPreTimeoutInterrupt =
++            static_cast<IpmiPreTimeoutInterrupt>(wdPreTimeoutInterruptMask &
++                (static_cast<uint8_t>(preTimeoutInterrupt)));
++        wd_service.setPreTimeoutInterrupt(
++            ipmiPreTimeoutInterruptToWdAction(ipmiPreTimeoutInterrupt));
++
+         lastCallSuccessful = true;
+         return ipmi::responseSuccess();
+     }
+diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp
+index 3534e89..4df1ab6 100644
+--- a/app/watchdog_service.cpp
++++ b/app/watchdog_service.cpp
+@@ -198,3 +198,9 @@ void WatchdogService::setInterval(uint64_t interval)
+ {
+     setProperty("Interval", interval);
+ }
++
++void WatchdogService::setPreTimeoutInterrupt(
++    PreTimeoutInterruptAction preTimeoutInterrupt)
++{
++    setProperty("PreTimeoutInterrupt", convertForMessage(preTimeoutInterrupt));
++}
+\ No newline at end of file
+diff --git a/app/watchdog_service.hpp b/app/watchdog_service.hpp
+index 141bdb7..32b7461 100644
+--- a/app/watchdog_service.hpp
++++ b/app/watchdog_service.hpp
+@@ -15,6 +15,8 @@ class WatchdogService
+ 
+     using Action =
+         sdbusplus::xyz::openbmc_project::State::server::Watchdog::Action;
++    using PreTimeoutInterruptAction = sdbusplus::xyz::openbmc_project::State::
++        server::Watchdog::PreTimeoutInterruptAction;
+     using TimerUse =
+         sdbusplus::xyz::openbmc_project::State::server::Watchdog::TimerUse;
+ 
+@@ -92,6 +94,13 @@ class WatchdogService
+      */
+     void setInterval(uint64_t interval);
+ 
++    /** @brief Sets the value of the PreTimeoutInterrupt property on the host
++     * watchdog
++     *
++     *  @param[in] PreTimeoutInterrupt - The new PreTimeoutInterrupt value
++     */
++    void setPreTimeoutInterrupt(PreTimeoutInterruptAction preTimeoutInterrupt);
++
+   private:
+     /** @brief sdbusplus handle */
+     sdbusplus::bus::bus bus;
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/gbs-ipmid-whitelist.conf b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/gbs-ipmid-whitelist.conf
new file mode 100644
index 0000000..359c7db
--- /dev/null
+++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/gbs-ipmid-whitelist.conf
@@ -0,0 +1,79 @@
+#<NetFn>:<Command>
+0x00:0x00    //<Chassis>:<Chassis Capabiliti>
+0x00:0x01    //<Chassis>:<Get Chassis Status>
+0x00:0x02    //<Chassis>:<Chassis Control>
+0x00:0x04    //<Chassis>:<Chassis Identify>
+0x00:0x05    //<Chassis>:<Set Chassis Capabilities>
+0x00:0x06    //<Chassis>:<Set Power Restore Policy>
+0x00:0x08    //<Chassis>:<Set System Boot Options>
+0x00:0x09    //<Chassis>:<Get System Boot Options>
+0x00:0x0F    //<Chassis>:<Get POH Counter>
+0x04:0x02    //<Sensor/Event>:<Platform Event>
+0x04:0x20    //<Sensor/Event>:<Get Device SDR Info>
+0x04:0x21    //<Sensor/Event>:<Get Device SDR>
+0x04:0x22    //<Sensor/Event>:<Reserve Device SDR Repository>
+0x04:0x27    //<Sensor/Event>:<Get Sensor Threshold>
+0x04:0x29    //<Sensor/Event>:<Get Sensor Event Enable>
+0x04:0x2B    //<Sensor/Event>:<Get Sensor Event Status>
+0x04:0x2D    //<Sensor/Event>:<Get Sensor Reading>
+0x04:0x2F    //<Sensor/Event>:<Get Sensor Type>
+0x04:0x30    //<Sensor/Event>:<Set Sensor Reading and Event Status>
+0x06:0x01    //<App>:<Get Device ID>
+0x06:0x02    //<App>:<Cold Reset>
+0x06:0x03    //<App>:<Warm Reset>
+0x06:0x04    //<App>:<Get Self Test Results>
+0x06:0x06    //<App>:<Set ACPI Power State>
+0x06:0x07    //<App>:<Get ACPI Power State>
+0x06:0x08    //<App>:<Get Device GUID>
+0x06:0x22    //<App>:<Reset Watchdog Timer>
+0x06:0x24    //<App>:<Set Watchdog Timer>
+0x06:0x25    //<App>:<Get Watchdog Timer>
+0x06:0x35    //<App>:<Read Event Message Buffer>
+0x06:0x3D    //<App>:<Get Session Info>
+0x06:0x40    //<App>:<Set Channel Access>
+0x06:0x41    //<App>:<Get Channel Access>
+0x06:0x42    //<App>:<Get Channel Info>
+0x06:0x43    //<App>:<Set User Access>
+0x06:0x44    //<App>:<Get User Access>
+0x06:0x45    //<App>:<Set User Name>
+0x06:0x46    //<App>:<Get User Name>
+0x06:0x47    //<App>:<Set User Password>
+0x06:0x48    //<App>:<Activate Payload>
+0x06:0x49    //<App>:<Deactivate Payload>
+0x06:0x4A    //<App>:<Get Payload Activation Status>
+0x06:0x4B    //<App>:<Get Payload Instance Info>
+0x06:0x54    //<App>:<Get Channel Cipher Suites>
+0x06:0x58    //<App>:<Set System Info Parameters>
+0x06:0x59    //<App>:<Get System Info Parameters>
+0x0A:0x10    //<Storage>:<Get FRU Inventory Area Info>
+0x0A:0x11    //<Storage>:<Read FRU Data>
+0x0A:0x20    //<Storage>:<Get SDR Repository Info>
+0x0A:0x22    //<Storage>:<Reserve SDR Repository>
+0x0A:0x23    //<Storage>:<Get SDR>
+0x0A:0x40    //<Storage>:<Get SEL Info>
+0x0A:0x42    //<Storage>:<Reserve SEL>
+0x0A:0x43    //<Storage>:<Get SEL Entry>
+0x0A:0x44    //<Storage>:<Add SEL Entry>
+0x0A:0x46    //<Storage>:<Delete SEL Entry>
+0x0A:0x47    //<Storage>:<Clear SEL>
+0x0A:0x48    //<Storage>:<Get SEL Time>
+0x0A:0x49    //<Storage>:<Set SEL Time>
+0x0C:0x01    //<Transport>:<Set LAN Configuration Parameters>
+0x0C:0x02    //<Transport>:<Get LAN Configuration Parameters>
+0x2C:0x00    //<Group Extension>:<Group Extension Command>
+0x2C:0x01    //<Group Extension>:<Get DCMI Capabilities>
+0x2C:0x02    //<Group Extension>:<Get Power Reading>
+0x2C:0x03    //<Group Extension>:<Get Power Limit>
+0x2C:0x06    //<Group Extension>:<Get Asset Tag>
+0x2C:0x07    //<Group Extension>:<Get Sensor Info>
+0x2C:0x09    //<Group Extension>:<Get Management Controller Identifier String>
+0x2C:0x0A    //<Group Extension>:<Set Management Controller Identifier String>
+0x2C:0x10    //<Group Extension>:<Get Temperature Readings>
+0x2C:0x12    //<Group Extension>:<Set DCMI Configuration Parameters>
+0x2C:0x13    //<Group Extension>:<Get DCMI Configuration Parameters>
+0x2C:0x3E    //<Group Extension>:<Get HPM.x Capabilities>
+0x2E:0x02    //<Google OEM>:<I2C via Proxy Adapter>
+0x2E:0x04    //<Google OEM>:<Fan Manual Control Mode>
+0x2E:0x30    //<Google OEM>:<Ethernet Statistics>
+0x2E:0x32    //<Google OEM>:<Sys Commands>
+0x2E:0x80    //<Google OEM>:<Blob Commands>
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
new file mode 100644
index 0000000..a197022
--- /dev/null
+++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
@@ -0,0 +1,18 @@
+DEPENDS_append_gbs = " gbs-yaml-config"
+
+SRC_URI_remove_gbs = "git://github.com/openbmc/phosphor-host-ipmid"
+SRC_URI_prepend_gbs = "git://github.com/quanta-bmc/phosphor-host-ipmid.git"
+
+SRCREV_gbs = "675d587abd8b068aa1816176221237ac6172a0bc"
+
+FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:"
+SRC_URI_append_gbs = " file://gbs-ipmid-whitelist.conf \
+                       file://0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch \
+                     "
+
+WHITELIST_CONF_gbs = "${WORKDIR}/gbs-ipmid-whitelist.conf"
+
+EXTRA_OECONF_append_gbs = " --with-journal-sel \
+     SENSOR_YAML_GEN=${STAGING_DIR_HOST}${datadir}/gbs-yaml-config/ipmi-sensors.yaml \
+     FRU_YAML_GEN=${STAGING_DIR_HOST}${datadir}/gbs-yaml-config/ipmi-fru-read.yaml \
+     "