Add BMC accessible FRUs to generate FRU map

At present MRW does not have FRU ID's for BMC accessible
FRUs, so supporting by hand coding the config details.

Resolves openbmc/openbmc#1931

Change-Id: Ia33aa56378fe0e31df722b9134c041e66a5133d5
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-bmc-inventory%.bbappend b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-bmc-inventory%.bbappend
new file mode 100644
index 0000000..72d991c
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-bmc-inventory%.bbappend
@@ -0,0 +1 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-bmc-inventory%/bmc-fru-config.yaml b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-bmc-inventory%/bmc-fru-config.yaml
new file mode 100644
index 0000000..c440837
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-bmc-inventory%/bmc-fru-config.yaml
@@ -0,0 +1,52 @@
+50:
+  /system/chassis/motherboard/fan0:
+    xyz.openbmc_project.Inventory.Item:
+      PrettyName:
+        IPMIFruProperty: Product Name
+        IPMIFruSection: Product
+51:
+  /system/chassis/motherboard/fan1:
+    xyz.openbmc_project.Inventory.Item:
+      PrettyName:
+        IPMIFruProperty: Product Name
+        IPMIFruSection: Product
+52:
+  /system/chassis/motherboard/fan2:
+    xyz.openbmc_project.Inventory.Item:
+      PrettyName:
+        IPMIFruProperty: Product Name
+        IPMIFruSection: Product
+53:
+  /system/chassis/motherboard/fan3:
+    xyz.openbmc_project.Inventory.Item:
+      PrettyName:
+        IPMIFruProperty: Product Name
+        IPMIFruSection: Product
+60:
+  /system/chassis/motherboard/boxelder/bmc:
+    xyz.openbmc_project.Inventory.Item:
+      PrettyName:
+        IPMIFruProperty: Board Name
+        IPMIFruSection: Board
+    xyz.openbmc_project.Inventory.Decorator.Asset:
+      PartNumber:
+        IPMIFruProperty: Part Number
+        IPMIFruSection: Board
+      SerialNumber:
+        IPMIFruProperty: Serial Number
+        IPMIFruSection: Board
+      Model:
+        IPMIFruProperty: Model Number
+        IPMIFruSection: Board
+      Manufacturer:
+        IPMIFruProperty: Manufacturer
+        IPMIFruSection: Board
+      BuildDate:
+        IPMIFruProperty: Mfg Date
+        IPMIFruSection: Board
+70:
+  /system/chassis/motherboard/boxelder/bmc/ethernet:
+    xyz.openbmc_project.Inventory.Item:
+      PrettyName:
+        IPMIFruProperty: Product Name
+        IPMIFruSection: Product
diff --git a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-merge-config-native.bb b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-merge-config-native.bb
new file mode 100644
index 0000000..dfedab2
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-merge-config-native.bb
@@ -0,0 +1,21 @@
+SUMMARY = "To merge the Host and BMC config files generated from MRW "
+DESCRIPTION = "Merge host provided FRU info config file and \
+BMC accessible FRU info config files generated by \
+gen-ipmi-fru.pl into a single config file. fru-gen parser \
+parses the merged config file and generates cpp file"
+PR = "r1"
+
+inherit native
+inherit phosphor-ipmi-host
+inherit obmc-phosphor-license
+
+DEPENDS += "virtual/phosphor-ipmi-fru-read-inventory"
+DEPENDS += "virtual/phosphor-ipmi-fru-read-bmc-inventory"
+PROVIDES += "virtual/phosphor-ipmi-fru-merge-config"
+
+do_install_append() {
+  SRC=${config_datadir}
+  DEST=${D}${config_datadir}
+  install -d ${DEST}
+  cat ${SRC}/config.yaml ${SRC}/bmc-fru-config.yaml > ${DEST}/fru_config.yaml
+}
diff --git a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-bmc-inventory-native.bb b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-bmc-inventory-native.bb
new file mode 100644
index 0000000..2f845d5
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-bmc-inventory-native.bb
@@ -0,0 +1,19 @@
+SUMMARY = "BMC accesible FRU inventory map for phosphor-ipmi-host"
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+inherit phosphor-ipmi-host
+
+SRC_URI += "file://bmc-fru-config.yaml"
+
+S = "${WORKDIR}"
+
+PROVIDES += "virtual/phosphor-ipmi-fru-read-bmc-inventory"
+
+do_install_append() {
+    DEST=${D}${config_datadir}
+    install -d ${DEST}
+    install bmc-fru-config.yaml ${DEST}/bmc-fru-config.yaml
+}
+
diff --git a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-bmc-inventory/bmc-fru-config.yaml b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-bmc-inventory/bmc-fru-config.yaml
new file mode 100644
index 0000000..ac13efb
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-bmc-inventory/bmc-fru-config.yaml
@@ -0,0 +1,43 @@
+# A YAML similar to this sample would have to be generated, for eg with MRW
+# inputs and system configuration, to depict IPMI FRU information.
+#
+# This file maps phosphor dbus inventory properties to IPMI properties
+#
+# This YAML could help generate C++ code.
+# Format of the YAML:
+# Fruid:
+#   Associated Fru paths
+#     d-bus Interfaces
+#       d-bus Properties
+#         IPMI Fru mapping
+#5:
+#  /system/chassis/motherboard/fan1:
+#    xyz.openbmc_project.Inventory.Item:
+#      PrettyName:
+#        IPMIFruProperty: Product Name
+#        IPMIFruSection: Product
+#6:
+#  /system/chassis/motherboard/boxelder/bmc:
+#    xyz.openbmc_project.Inventory.Item:
+#      PrettyName:
+#        IPMIFruProperty: Product Name
+#        IPMIFruSection: Board
+#    xyz.openbmc_project.Inventory.Decorator.Asset:
+#      BuildDate:
+#        IPMIFruProperty: Mfg Date
+#        IPMIFruSection: Board
+#      SerialNumber:
+#        IPMIFruProperty: Serial Number
+#        IPMIFruSection: Board
+#      PartNumber:
+#        IPMIFruProperty: Part Number
+#        IPMIFruSection: Board
+#      Manufacturer:
+#        IPMIFruProperty: Manufacturer
+#        IPMIFruSection: Board
+#7:
+#  /system/chassis/motherboard/boxelder/bmc/ethernet:
+#    xyz.openbmc_project.Inventory.Item:
+#      PrettyName:
+#        IPMIFruProperty: Product Name
+#        IPMIFruSection: Product
diff --git a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
index 45cb2ee..9a46307 100644
--- a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
+++ b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
@@ -21,7 +21,7 @@
 DEPENDS += "phosphor-dbus-interfaces"
 DEPENDS += "obmc-targets"
 DEPENDS += "virtual/phosphor-ipmi-inventory-sel"
-DEPENDS += "virtual/phosphor-ipmi-fru-read-inventory"
+DEPENDS += "virtual/phosphor-ipmi-fru-merge-config"
 
 RDEPENDS_${PN}-dev += "phosphor-logging"
 RDEPENDS_${PN}-dev += "phosphor-mapper-dev"
@@ -47,7 +47,7 @@
         WHITELIST_CONF="${WHITELIST_CONF}" \
         SENSOR_YAML_GEN=${STAGING_DIR_NATIVE}${sensor_datadir}/sensor.yaml \
         INVSENSOR_YAML_GEN=${STAGING_DIR_NATIVE}${sensor_datadir}/invsensor.yaml \
-        FRU_YAML_GEN=${STAGING_DIR_NATIVE}${config_datadir}/config.yaml \
+        FRU_YAML_GEN=${STAGING_DIR_NATIVE}${config_datadir}/fru_config.yaml \
         "
 
 S = "${WORKDIR}/git"