bytedance: g220a: Enable ipmi

Tested: Run ipmitool fru print 0 and ipmitool sensor list,
        the output is as expected.

Signed-off-by: John Wang <wangzhiqiang.bj@bytedance.com>
Change-Id: I02ded5d461eeec39bf35450f76efa78f61134038
diff --git a/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config.bb b/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config.bb
new file mode 100644
index 0000000..62fe8fe
--- /dev/null
+++ b/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config.bb
@@ -0,0 +1,35 @@
+SUMMARY = "YAML configuration for G220A"
+PR = "r1"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+inherit allarch
+
+SRC_URI = " \
+    file://g220a-ipmi-fru.yaml \
+    file://g220a-ipmi-fru-properties.yaml \
+    file://g220a-ipmi-inventory-sensors.yaml \
+    file://g220a-ipmi-sensors.yaml \
+    "
+
+S = "${WORKDIR}"
+
+do_install() {
+    install -m 0644 -D g220a-ipmi-fru-properties.yaml \
+        ${D}${datadir}/${BPN}/ipmi-extra-properties.yaml
+    install -m 0644 -D g220a-ipmi-fru.yaml \
+        ${D}${datadir}/${BPN}/ipmi-fru-read.yaml
+    install -m 0644 -D g220a-ipmi-inventory-sensors.yaml \
+        ${D}${datadir}/${BPN}/ipmi-inventory-sensors.yaml
+    install -m 0644 -D g220a-ipmi-sensors.yaml \
+        ${D}${datadir}/${BPN}/ipmi-sensors.yaml
+}
+
+FILES_${PN}-dev = " \
+    ${datadir}/${BPN}/ipmi-extra-properties.yaml \
+    ${datadir}/${BPN}/ipmi-fru-read.yaml \
+    ${datadir}/${BPN}/ipmi-inventory-sensors.yaml \
+    ${datadir}/${BPN}/ipmi-sensors.yaml \
+    "
+
+ALLOW_EMPTY_${PN} = "1"
diff --git a/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config/g220a-ipmi-fru-properties.yaml b/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config/g220a-ipmi-fru-properties.yaml
new file mode 100644
index 0000000..0076b0d
--- /dev/null
+++ b/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config/g220a-ipmi-fru-properties.yaml
@@ -0,0 +1,21 @@
+/system:
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'true'
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'true'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
+/system/board:
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'true'
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'true'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
+/system/board/G220A:
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'true'
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'true'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
diff --git a/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config/g220a-ipmi-fru.yaml b/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config/g220a-ipmi-fru.yaml
new file mode 100644
index 0000000..87817d2
--- /dev/null
+++ b/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config/g220a-ipmi-fru.yaml
@@ -0,0 +1,12 @@
+0:
+    /xyz/openbmc_project/FruDevice/G220A:
+        entityID: 7
+        entityInstance: 1
+        interfaces:
+            xyz.openbmc_project.FruDevice:
+                PRODUCT_MANUFACTURER:
+                    IPMIFruProperty: Manufacturer
+                    IPMIFruSection: Product
+                PRODUCT_PRODUCT_NAME:
+                    IPMIFruProperty: Name
+                    IPMIFruSection: Product
diff --git a/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config/g220a-ipmi-inventory-sensors.yaml b/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config/g220a-ipmi-inventory-sensors.yaml
new file mode 100644
index 0000000..bb2502d
--- /dev/null
+++ b/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config/g220a-ipmi-inventory-sensors.yaml
@@ -0,0 +1,5 @@
+/xyz/openbmc_project/inventory/system/board/G220A:
+    eventReadingType: 111
+    offset: 2
+    sensorID: 144
+    sensorType: 18
diff --git a/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config/g220a-ipmi-sensors.yaml b/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config/g220a-ipmi-sensors.yaml
new file mode 100644
index 0000000..af7aea4
--- /dev/null
+++ b/meta-g220a/recipes-phosphor/configuration/g220a-yaml-config/g220a-ipmi-sensors.yaml
@@ -0,0 +1,396 @@
+1:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 1
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/temperature/Outlet_Temp
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 1
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.DegreesC
+4:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 1
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/temperature/DTS_CPU1
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 1
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.DegreesC
+5:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 1
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/temperature/DTS_CPU2
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 1
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.DegreesC
+38:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 1
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/voltage/P3V3
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 2
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.Volts
+39:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 1
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/voltage/P5V
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 2
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.Volts
+40:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 1
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/voltage/P12V
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 2
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.Volts
+67:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 96
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/fan_tach/Fan1_0
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 4
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.RPMS
+68:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 96
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/fan_tach/Fan1_1
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 4
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.RPMS
+69:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 96
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/fan_tach/Fan2_0
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 4
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.RPMS
+70:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 96
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/fan_tach/Fan2_1
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 4
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.RPMS
+71:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 96
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/fan_tach/Fan3_0
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 4
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.RPMS
+72:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 96
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/fan_tach/Fan3_1
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 4
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.RPMS
+73:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 96
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/fan_tach/Fan4_0
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 4
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.RPMS
+74:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 96
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/fan_tach/Fan4_1
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 4
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.RPMS
+75:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double 
+  multiplierM: 96
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/fan_tach/Fan5_0
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 4
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.RPMS
+76:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double
+  multiplierM: 96
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/fan_tach/Fan5_1
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 4
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.RPMS
+77:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double 
+  multiplierM: 96
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/fan_tach/Fan6_0
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 4
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.RPMS
+78:
+  bExp: 0
+  entityID: 50
+  entityInstance: 1
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          255:
+            type: double 
+  multiplierM: 96
+  mutability: Mutability::Read
+  path: /xyz/openbmc_project/sensors/fan_tach/Fan6_1
+  offsetB: 0
+  rExp: 0
+  readingType: readingData
+  scale: 0
+  sensorNamePattern: nameLeaf
+  sensorReadingType: 1
+  sensorType: 4
+  serviceInterface: org.freedesktop.DBus.Properties
+  unit: xyz.openbmc_project.Sensor.Value.Unit.RPMS
diff --git a/meta-g220a/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend b/meta-g220a/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend
new file mode 100644
index 0000000..3658c6f
--- /dev/null
+++ b/meta-g220a/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend
@@ -0,0 +1,6 @@
+DEPENDS_append_g220a= " g220a-yaml-config"
+
+EXTRA_OECONF_g220a= " \
+    YAML_GEN=${STAGING_DIR_HOST}${datadir}/g220a-yaml-config/ipmi-fru-read.yaml \
+    PROP_YAML=${STAGING_DIR_HOST}${datadir}/g220a-yaml-config/ipmi-extra-properties.yaml \
+    "
diff --git a/meta-g220a/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/meta-g220a/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
new file mode 100644
index 0000000..91d99ad
--- /dev/null
+++ b/meta-g220a/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
@@ -0,0 +1,11 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += "file://0001-Disable-isFruPresent.patch"
+
+DEPENDS_append_g220a= " g220a-yaml-config"
+
+EXTRA_OECONF_g220a= " \
+    SENSOR_YAML_GEN=${STAGING_DIR_HOST}${datadir}/g220a-yaml-config/ipmi-sensors.yaml \
+    INVSENSOR_YAML_GEN=${STAGING_DIR_HOST}${datadir}/g220a-yaml-config/ipmi-inventory-sensors.yaml \
+    FRU_YAML_GEN=${STAGING_DIR_HOST}${datadir}/g220a-yaml-config/ipmi-fru-read.yaml \
+    "