Quanta: configure fru parser

Update fru information of project gsj and test on gsj board pass.

Change-Id: If660ad6e3d001d879899c364e175a07d3fb278cc
Signed-off-by: Duke Du <Duke.Du@quantatw.com>
Signed-off-by: FranHsu <Fran.Hsu@quantatw.com>
diff --git a/meta-gsj/conf/machine/gsj.conf b/meta-gsj/conf/machine/gsj.conf
index 96db990..e88e058 100644
--- a/meta-gsj/conf/machine/gsj.conf
+++ b/meta-gsj/conf/machine/gsj.conf
@@ -3,7 +3,7 @@
 
 UBOOT_MACHINE = "PolegSVB_config"
 
-FLASH_SIZE = "65536"
+FLASH_SIZE = "32768"
 require conf/machine/include/npcm7xx.inc
 require conf/machine/include/obmc-bsp-common.inc
 
@@ -23,3 +23,5 @@
 PREFERRED_PROVIDER_virtual/obmc-chassis-mgmt = "packagegroup-gsj-apps"
 PREFERRED_PROVIDER_virtual/obmc-fan-mgmt = "packagegroup-gsj-apps"
 PREFERRED_PROVIDER_virtual/obmc-flash-mgmt = "packagegroup-gsj-apps"
+PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-inventory = "gsj-ipmi-inventory-map-native"
+PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-read-inventory = "gsj-ipmi-fru-read-inventory-native"
diff --git a/meta-gsj/recipes-phosphor/ipmi/files/config.yaml b/meta-gsj/recipes-phosphor/ipmi/files/config.yaml
new file mode 100644
index 0000000..b5d323f
--- /dev/null
+++ b/meta-gsj/recipes-phosphor/ipmi/files/config.yaml
@@ -0,0 +1,72 @@
+0x01:
+  /system:
+    entityID: 23
+    entityInstance: 1
+    interfaces:
+      xyz.openbmc_project.Inventory.Item:
+        PrettyName:
+          IPMIFruProperty: Name
+          IPMIFruSection: Product
+  /system/chassis:
+    entityID: 23
+    entityInstance: 1
+    interfaces:
+      xyz.openbmc_project.Inventory.Item:
+        PrettyName:
+          IPMIFruProperty: Name
+          IPMIFruSection: Product
+  /system/chassis/hsbp:
+    entityID: 16
+    entityInstance: 1
+    interfaces:
+      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
+      xyz.openbmc_project.Inventory.Item:
+        PrettyName:
+          IPMIFruProperty: Name
+          IPMIFruSection: Board
+      xyz.openbmc_project.Inventory.Decorator.Revision:
+        Version:
+          IPMIFruProperty: FRU File ID
+          IPMIFruSection: Board
+      xyz.openbmc_project.Inventory.Item.Board:
+0x02:
+  /system/chassis/bmc:
+    entityID: 6
+    entityInstance: 1
+    interfaces:
+      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
+        CustomField:
+          IPMIFruProperty: CustomField
+          IPMIFruSection: Board
+      xyz.openbmc_project.Inventory.Item:
+        PrettyName:
+          IPMIFruProperty: Name
+          IPMIFruSection: Board
+      xyz.openbmc_project.Inventory.Decorator.Revision:
+        Version:
+          IPMIFruProperty: FRU File ID
+          IPMIFruSection: Board
diff --git a/meta-gsj/recipes-phosphor/ipmi/gsj-channel-config/channel.yaml b/meta-gsj/recipes-phosphor/ipmi/gsj-channel-config/channel.yaml
new file mode 100644
index 0000000..4e2a0a6
--- /dev/null
+++ b/meta-gsj/recipes-phosphor/ipmi/gsj-channel-config/channel.yaml
@@ -0,0 +1,2 @@
+1:
+  ifName: eth0
diff --git a/meta-gsj/recipes-phosphor/ipmi/gsj-ipmi-channel-config-native.bb b/meta-gsj/recipes-phosphor/ipmi/gsj-ipmi-channel-config-native.bb
new file mode 100644
index 0000000..a4ad933
--- /dev/null
+++ b/meta-gsj/recipes-phosphor/ipmi/gsj-ipmi-channel-config-native.bb
@@ -0,0 +1,19 @@
+SUMMARY = "Quanta gsj IPMI Channel to if_name mapping."
+PR = "r1"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${QUANTABASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
+
+inherit native
+inherit phosphor-ipmi-host
+
+PROVIDES += "virtual/phosphor-ipmi-channel-config"
+
+SRC_URI += "file://channel.yaml"
+
+S = "${WORKDIR}"
+
+do_install() {
+	DEST=${D}${sensor_datadir}
+        install -d ${DEST}
+	install channel.yaml ${DEST}/channel.yaml
+}
diff --git a/meta-gsj/recipes-phosphor/ipmi/gsj-ipmi-fru-read-inventory-native.bb b/meta-gsj/recipes-phosphor/ipmi/gsj-ipmi-fru-read-inventory-native.bb
new file mode 100644
index 0000000..340955c
--- /dev/null
+++ b/meta-gsj/recipes-phosphor/ipmi/gsj-ipmi-fru-read-inventory-native.bb
@@ -0,0 +1,19 @@
+SUMMARY = "gsj inventory map for phosphor-ipmi-host"
+PR = "r1"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${QUANTABASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
+
+inherit native
+inherit phosphor-ipmi-host
+
+SRC_URI += "file://config.yaml"
+
+PROVIDES += "virtual/phosphor-ipmi-fru-read-inventory"
+
+S = "${WORKDIR}"
+
+do_install() {
+        DEST=${D}${config_datadir}
+        install -d ${DEST}
+        install config.yaml ${DEST}
+}
diff --git a/meta-gsj/recipes-phosphor/ipmi/gsj-ipmi-inventory-map-native.bb b/meta-gsj/recipes-phosphor/ipmi/gsj-ipmi-inventory-map-native.bb
new file mode 100644
index 0000000..db3aaf2
--- /dev/null
+++ b/meta-gsj/recipes-phosphor/ipmi/gsj-ipmi-inventory-map-native.bb
@@ -0,0 +1,19 @@
+SUMMARY = "gsj IPMI to DBus Inventory mapping."
+PR = "r1"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${QUANTABASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
+
+inherit native
+inherit phosphor-ipmi-fru
+
+SRC_URI += "file://config.yaml"
+
+PROVIDES += "virtual/phosphor-ipmi-fru-inventory"
+
+S = "${WORKDIR}"
+
+do_install() {
+        DEST=${D}${config_datadir}
+        install -d ${DEST}
+        install config.yaml ${DEST}
+}
diff --git a/meta-gsj/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/bmc b/meta-gsj/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/bmc
new file mode 100644
index 0000000..02f4298
--- /dev/null
+++ b/meta-gsj/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/bmc
@@ -0,0 +1,2 @@
+SYSFS_PATH=/sys/bus/i2c/devices/10-0055/eeprom
+FRUID=2
diff --git a/meta-gsj/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/hsbp b/meta-gsj/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/hsbp
new file mode 100644
index 0000000..7a5056a
--- /dev/null
+++ b/meta-gsj/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/hsbp
@@ -0,0 +1,2 @@
+SYSFS_PATH=/sys/bus/i2c/devices/9-0055/eeprom
+FRUID=1
diff --git a/meta-gsj/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend b/meta-gsj/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend
new file mode 100644
index 0000000..0fb703b
--- /dev/null
+++ b/meta-gsj/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend
@@ -0,0 +1,20 @@
+inherit obmc-phosphor-systemd
+
+FILESEXTRAPATHS_prepend_gsj := "${THISDIR}/${PN}:"
+
+EEPROM_NAMES = "hsbp bmc"
+
+EEPROMFMT = "system/chassis/{0}"
+EEPROM_ESCAPEDFMT = "system-chassis-{0}"
+EEPROMS = "${@compose_list(d, 'EEPROMFMT', 'EEPROM_NAMES')}"
+EEPROMS_ESCAPED = "${@compose_list(d, 'EEPROM_ESCAPEDFMT', 'EEPROM_NAMES')}"
+
+ENVFMT = "obmc/eeproms/{0}"
+SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gsj := " ${@compose_list(d, 'ENVFMT', 'EEPROMS')}"
+
+TMPL = "obmc-read-eeprom@.service"
+TGT = "${SYSTEMD_DEFAULT_TARGET}"
+INSTFMT = "obmc-read-eeprom@{0}.service"
+FMT = "../${TMPL}:${TGT}.wants/${INSTFMT}"
+
+SYSTEMD_LINK_${PN}_append_gsj := " ${@compose_list(d, 'FMT', 'EEPROMS_ESCAPED')}"