meta-ampere: mtjade: support IPMI sensor report

Add ipmi-sensor Yaml file to configure IPMI sensor report following
Mt.Jade SDR Definition document.

Tested:
1. Check sensor report using IPMI sdr and sensor commands:
 $ ipmitool sdr list
 $ ipmitool sensor list

Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com>
Change-Id: Ib61d459087d3cf2711b2dd19a64c69d91e39861f
diff --git a/meta-ampere/meta-jade/recipes-phosphor/configuration/mtjade-yaml-config.bb b/meta-ampere/meta-jade/recipes-phosphor/configuration/mtjade-yaml-config.bb
index 66238dc..cf154ee 100644
--- a/meta-ampere/meta-jade/recipes-phosphor/configuration/mtjade-yaml-config.bb
+++ b/meta-ampere/meta-jade/recipes-phosphor/configuration/mtjade-yaml-config.bb
@@ -5,6 +5,7 @@
 inherit allarch
 
 SRC_URI = " \
+    file://ipmi-sensors-${MACHINE}.yaml \
     file://mtjade-ipmi-fru.yaml \
     file://mtjade-ipmi-fru-properties.yaml \
     "
@@ -12,6 +13,8 @@
 S = "${WORKDIR}"
 
 do_install() {
+    install -m 0644 -D ipmi-sensors-${MACHINE}.yaml \
+        ${D}${datadir}/${BPN}/ipmi-sensors-${MACHINE}.yaml
     cat mtjade-ipmi-fru.yaml > fru-read.yaml
     install -m 0644 -D mtjade-ipmi-fru-properties.yaml \
         ${D}${datadir}/${BPN}/ipmi-extra-properties.yaml
@@ -20,6 +23,7 @@
 }
 
 FILES_${PN}-dev = " \
+    ${datadir}/${BPN}/ipmi-sensors-${MACHINE}.yaml \
     ${datadir}/${BPN}/ipmi-extra-properties.yaml \
     ${datadir}/${BPN}/ipmi-fru-read.yaml \
     "
diff --git a/meta-ampere/meta-jade/recipes-phosphor/configuration/mtjade-yaml-config/ipmi-sensors-mtjade.yaml b/meta-ampere/meta-jade/recipes-phosphor/configuration/mtjade-yaml-config/ipmi-sensors-mtjade.yaml
new file mode 100644
index 0000000..959f353
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/configuration/mtjade-yaml-config/ipmi-sensors-mtjade.yaml
@@ -0,0 +1,399 @@
+1: &TEMP_DEFAULTS
+    bExp: 0
+    entityID: 30
+    entityInstance: 1
+    interfaces:
+        xyz.openbmc_project.Sensor.Value:
+            Value:
+                Offsets:
+                    255:
+                        type: double
+    multiplierM: 1
+    mutability: Mutability::Write|Mutability::Read
+    offsetB: 0
+    path: /xyz/openbmc_project/sensors/temperature/TS1_Temp
+    rExp: 0
+    readingType: readingData
+    sensorNamePattern: nameLeaf
+    sensorReadingType: 1
+    sensorType: 1
+    serviceInterface: org.freedesktop.DBus.Properties
+    unit: xyz.openbmc_project.Sensor.Value.Unit.DegreesC
+2:
+    <<: *TEMP_DEFAULTS
+    entityInstance: 2
+    path: /xyz/openbmc_project/sensors/temperature/TS2_Temp
+3:
+    <<: *TEMP_DEFAULTS
+    entityInstance: 3
+    path: /xyz/openbmc_project/sensors/temperature/TS3_Temp
+4:
+    <<: *TEMP_DEFAULTS
+    entityInstance: 4
+    path: /xyz/openbmc_project/sensors/temperature/TS4_Temp
+5:
+    <<: *TEMP_DEFAULTS
+    entityInstance: 5
+    path: /xyz/openbmc_project/sensors/temperature/TS5_Temp
+6:
+    <<: *TEMP_DEFAULTS
+    entityInstance: 6
+    path: /xyz/openbmc_project/sensors/temperature/TS6_Temp
+243:
+    <<: *TEMP_DEFAULTS
+    entityInstance: 58
+    path: /xyz/openbmc_project/sensors/temperature/PSU0_TEMP
+244:
+    <<: *TEMP_DEFAULTS
+    entityInstance: 59
+    path: /xyz/openbmc_project/sensors/temperature/PSU1_TEMP
+
+37: &FAN_DEFAULTS
+  entityID: 29
+  entityInstance: 13
+  sensorType: 4
+  path: /xyz/openbmc_project/sensors/fan_tach/FAN3_1
+  sensorReadingType: 1
+  multiplierM: 100
+  offsetB: 0
+  rExp: 0
+  unit: xyz.openbmc_project.Sensor.Value.Unit.RPMS
+  mutability: Mutability::Write|Mutability::Read
+  serviceInterface: org.freedesktop.DBus.Properties
+  readingType: readingData
+  sensorNamePattern: nameLeaf
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          0x0:
+            type: double
+
+40:
+    <<: *FAN_DEFAULTS
+    entityInstance: 16
+    path: /xyz/openbmc_project/sensors/fan_tach/FAN3_2
+43:
+    <<: *FAN_DEFAULTS
+    entityInstance: 19
+    path: /xyz/openbmc_project/sensors/fan_tach/FAN4_1
+46:
+    <<: *FAN_DEFAULTS
+    entityInstance: 22
+    path: /xyz/openbmc_project/sensors/fan_tach/FAN4_2
+49:
+    <<: *FAN_DEFAULTS
+    entityInstance: 25
+    path: /xyz/openbmc_project/sensors/fan_tach/FAN5_1
+52:
+    <<: *FAN_DEFAULTS
+    entityInstance: 28
+    path: /xyz/openbmc_project/sensors/fan_tach/FAN5_2
+55:
+    <<: *FAN_DEFAULTS
+    entityInstance: 31
+    path: /xyz/openbmc_project/sensors/fan_tach/FAN6_1
+58:
+    <<: *FAN_DEFAULTS
+    entityInstance: 34
+    path: /xyz/openbmc_project/sensors/fan_tach/FAN6_2
+61:
+    <<: *FAN_DEFAULTS
+    entityInstance: 37
+    path: /xyz/openbmc_project/sensors/fan_tach/FAN7_1
+64:
+    <<: *FAN_DEFAULTS
+    entityInstance: 40
+    path: /xyz/openbmc_project/sensors/fan_tach/FAN7_2
+67:
+    <<: *FAN_DEFAULTS
+    entityInstance: 43
+    path: /xyz/openbmc_project/sensors/fan_tach/FAN8_1
+70:
+    <<: *FAN_DEFAULTS
+    entityInstance: 46
+    path: /xyz/openbmc_project/sensors/fan_tach/FAN8_2
+245:
+    <<: *FAN_DEFAULTS
+    entityInstance: 60
+    path: /xyz/openbmc_project/sensors/fan_tach/PSU0_fan1
+246:
+    <<: *FAN_DEFAULTS
+    entityInstance: 61
+    path: /xyz/openbmc_project/sensors/fan_tach/PSU1_fan1
+
+73: &VOLTAGE_DEFAULTS
+  entityID: 0x13
+  entityInstance: 9
+  sensorType: 0x02
+  path: /xyz/openbmc_project/sensors/voltage/S0_0V8_VDDC_SOC
+  sensorReadingType: 0x01
+  multiplierM: 5
+  offsetB: 0
+  bExp: 0
+  unit: xyz.openbmc_project.Sensor.Value.Unit.Volts
+  rExp: -3
+  serviceInterface: org.freedesktop.DBus.Properties
+  readingType: readingData
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        Offsets:
+          0xFF:
+            type: double
+74:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 11
+    multiplierM: 7
+    path: /xyz/openbmc_project/sensors/voltage/S0_0V75_PCP
+75:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 13
+    multiplierM: 7
+    path: /xyz/openbmc_project/sensors/voltage/S0_1V2_VDDQ0123
+76:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 15
+    multiplierM: 4
+    path: /xyz/openbmc_project/sensors/voltage/S0_0V6_VTT0123
+77:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 17
+    multiplierM: 15
+    path: /xyz/openbmc_project/sensors/voltage/S0_2V5_VPP0123
+78:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 19
+    multiplierM: 7
+    path: /xyz/openbmc_project/sensors/voltage/S0_1V2_VDDQ4567
+79:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 21
+    multiplierM: 4
+    path: /xyz/openbmc_project/sensors/voltage/S0_0V6_VTT4567
+80:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 23
+    multiplierM: 15
+    path: /xyz/openbmc_project/sensors/voltage/S0_2V5_VPP4567
+81:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 25
+    multiplierM: 5
+    path: /xyz/openbmc_project/sensors/voltage/S0_0V85_RCA
+82:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 27
+    multiplierM: 11
+    path: /xyz/openbmc_project/sensors/voltage/S0_1V8_VDDH
+83:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 29
+    multiplierM: 9
+    path: /xyz/openbmc_project/sensors/voltage/S0_1V5_VDDH
+84:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 31
+    multiplierM: 11
+    path: /xyz/openbmc_project/sensors/voltage/S0_1V8_SOC
+85:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 33
+    multiplierM: 11
+    path: /xyz/openbmc_project/sensors/voltage/S0_1V8_PCP
+86:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 35
+    multiplierM: 20
+    path: /xyz/openbmc_project/sensors/voltage/S0_3V3_SOC
+
+87:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 10
+    multiplierM: 5
+    path: /xyz/openbmc_project/sensors/voltage/S1_0V8_VDDC_SOC
+88:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 12
+    multiplierM: 7
+    path: /xyz/openbmc_project/sensors/voltage/S1_0V75_PCP
+89:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 14
+    multiplierM: 7
+    path: /xyz/openbmc_project/sensors/voltage/S1_1V2_VDDQ0123
+90:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 16
+    multiplierM: 4
+    path: /xyz/openbmc_project/sensors/voltage/S1_0V6_VTT0123
+91:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 18
+    multiplierM: 15
+    path: /xyz/openbmc_project/sensors/voltage/S1_2V5_VPP0123
+92:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 20
+    multiplierM: 7
+    path: /xyz/openbmc_project/sensors/voltage/S1_1V2_VDDQ4567
+93:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 22
+    multiplierM: 4
+    path: /xyz/openbmc_project/sensors/voltage/S1_0V6_VTT4567
+94:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 24
+    multiplierM: 15
+    path: /xyz/openbmc_project/sensors/voltage/S1_2V5_VPP4567
+95:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 26
+    multiplierM: 5
+    path: /xyz/openbmc_project/sensors/voltage/S1_0V85_RCA
+96:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 28
+    multiplierM: 11
+    path: /xyz/openbmc_project/sensors/voltage/S1_1V8_VDDH
+97:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 30
+    multiplierM: 9
+    path: /xyz/openbmc_project/sensors/voltage/S1_1V5_VDDH
+98:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 32
+    multiplierM: 11
+    path: /xyz/openbmc_project/sensors/voltage/S1_1V8_SOC
+99:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 34
+    multiplierM: 11
+    path: /xyz/openbmc_project/sensors/voltage/S1_1V8_PCP
+100:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 36
+    multiplierM: 20
+    path: /xyz/openbmc_project/sensors/voltage/S1_3V3_SOC
+101:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 37
+    multiplierM: 20
+    path: /xyz/openbmc_project/sensors/voltage/3V3_SB
+102:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 38
+    multiplierM: 18
+    path: /xyz/openbmc_project/sensors/voltage/VBAT_RTC
+230:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 74
+    multiplierM: 18
+    rExp: -1
+    path: /xyz/openbmc_project/sensors/voltage/PSU0_VINPUT
+231:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 75
+    multiplierM: 18
+    rExp: -1
+    path: /xyz/openbmc_project/sensors/voltage/PSU1_VINPUT
+232:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 76
+    multiplierM: 18
+    rExp: -2
+    path: /xyz/openbmc_project/sensors/voltage/PSU0_VOUTPUT
+233:
+    <<: *VOLTAGE_DEFAULTS
+    entityInstance: 77
+    multiplierM: 18
+    rExp: -2
+    path: /xyz/openbmc_project/sensors/voltage/PSU1_VOUTPUT
+
+240: &power
+    sensorType: 0x08
+    path: /xyz/openbmc_project/sensors/power/PSU0_POUTPUT
+    entityID: 19
+    entityInstance: 84
+    sensorReadingType: 0x01
+    multiplierM: 80
+    offsetB: 0
+    bExp: 0
+    unit: xyz.openbmc_project.Sensor.Value.Unit.Watts
+    rExp: -1
+    serviceInterface: org.freedesktop.DBus.Properties
+    readingType: readingData
+    interfaces:
+      xyz.openbmc_project.Sensor.Value:
+        Value:
+          Offsets:
+            0xFF:
+              type: double
+
+241:
+    <<: *power
+    entityInstance: 85
+    multiplierM: 80
+    rExp: -1
+    path: /xyz/openbmc_project/sensors/power/PSU1_POUTPUT
+
+242:
+    <<: *power
+    entityInstance: 57
+    multiplierM: 80
+    rExp: -1
+    path: /xyz/openbmc_project/sensors/power/total_power
+
+238:
+    <<: *power
+    entityInstance: 82
+    multiplierM: 80
+    rExp: -1
+    path: /xyz/openbmc_project/sensors/power/PSU0_PINPUT
+
+239:
+    <<: *power
+    entityInstance: 83
+    multiplierM: 80
+    rExp: -1
+    path: /xyz/openbmc_project/sensors/power/PSU1_PINPUT
+
+234: &current
+    sensorType: 0x03
+    path: /xyz/openbmc_project/sensors/current/PSU0_IINPUT
+    entityID: 19
+    entityInstance: 78
+    sensorReadingType: 0x01
+    multiplierM: 80
+    offsetB: 0
+    bExp: 0
+    unit: xyz.openbmc_project.Sensor.Value.Unit.Amperes
+    rExp: -3
+    serviceInterface: org.freedesktop.DBus.Properties
+    readingType: readingData
+    interfaces:
+      xyz.openbmc_project.Sensor.Value:
+        Value:
+          Offsets:
+            0xFF:
+              type: double
+
+235:
+    <<: *current
+    entityInstance: 79
+    multiplierM: 80
+    path: /xyz/openbmc_project/sensors/current/PSU1_IINPUT
+
+236:
+    <<: *current
+    entityInstance: 80
+    multiplierM: 80
+    path: /xyz/openbmc_project/sensors/current/PSU0_IOUTPUT
+
+237:
+    <<: *current
+    entityInstance: 81
+    multiplierM: 80
+    path: /xyz/openbmc_project/sensors/current/PSU1_IOUTPUT
diff --git a/meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
index 980746e..c0bcbdd 100644
--- a/meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
+++ b/meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
@@ -5,6 +5,7 @@
 RRECOMMENDS_${PN} += "ipmitool"
 
 EXTRA_OECONF_mtjade = " \
+    SENSOR_YAML_GEN=${STAGING_DIR_HOST}${datadir}/mtjade-yaml-config/ipmi-sensors-${MACHINE}.yaml \
     FRU_YAML_GEN=${STAGING_DIR_HOST}${datadir}/mtjade-yaml-config/ipmi-fru-read.yaml \
     "