Add sensor and some FRU definitions for ipmi.

When phosphor-ipmi-host supports returning sensor data, this is
the file it will use to build the cpp map and provide the information.

This has been tested on my platform via ipmitool from the host.

Change-Id: Ie5b0696935d23d6f50c9f62ddb583618a9f3ff91
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%.bbappend b/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%.bbappend
new file mode 100644
index 0000000..24ae11c
--- /dev/null
+++ b/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%.bbappend
@@ -0,0 +1,18 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+EEPROM_NAMES = "motherboard pdb fp 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} += "${@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} += "${@compose_list(d, 'FMT', 'EEPROMS_ESCAPED')}"
diff --git a/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%/obmc/eeproms/system/chassis/bmc b/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%/obmc/eeproms/system/chassis/bmc
new file mode 100644
index 0000000..0404080
--- /dev/null
+++ b/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%/obmc/eeproms/system/chassis/bmc
@@ -0,0 +1,2 @@
+SYSFS_PATH=/sys/bus/i2c/devices/8-0050/eeprom
+FRUID=50
diff --git a/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%/obmc/eeproms/system/chassis/fp b/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%/obmc/eeproms/system/chassis/fp
new file mode 100644
index 0000000..32e3ef7
--- /dev/null
+++ b/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%/obmc/eeproms/system/chassis/fp
@@ -0,0 +1,2 @@
+SYSFS_PATH=/sys/bus/i2c/devices/1-0057/eeprom
+FRUID=57
diff --git a/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%/obmc/eeproms/system/chassis/motherboard b/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%/obmc/eeproms/system/chassis/motherboard
new file mode 100644
index 0000000..b01390a
--- /dev/null
+++ b/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%/obmc/eeproms/system/chassis/motherboard
@@ -0,0 +1,2 @@
+SYSFS_PATH=/sys/bus/i2c/devices/1-0054/eeprom
+FRUID=56
diff --git a/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%/obmc/eeproms/system/chassis/pdb b/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%/obmc/eeproms/system/chassis/pdb
new file mode 100644
index 0000000..a083921
--- /dev/null
+++ b/meta-q71l/recipes-phosphor/ipmi/phosphor-ipmi-fru%/obmc/eeproms/system/chassis/pdb
@@ -0,0 +1,2 @@
+SYSFS_PATH=/sys/bus/i2c/devices/7-0052/eeprom
+FRUID=52
diff --git a/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-fru-properties.bb b/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-fru-properties.bb
new file mode 100644
index 0000000..0297b8b
--- /dev/null
+++ b/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-fru-properties.bb
@@ -0,0 +1,23 @@
+SUMMARY = "FRU properties config for ipmi-fru-parser"
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+inherit phosphor-ipmi-fru
+
+SRC_URI += "file://extra-properties.yaml"
+
+PROVIDES += "virtual/phosphor-ipmi-fru-properties"
+
+S = "${WORKDIR}"
+
+do_install() {
+        # TODO: install this to inventory_datadir
+        # after ipmi-fru-parser untangles the host
+        # firmware config from the machine inventory.
+        DEST=${D}${properties_datadir}
+
+        install -d ${DEST}
+        install extra-properties.yaml ${DEST}/.
+}
+
diff --git a/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-fru-properties/extra-properties.yaml b/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-fru-properties/extra-properties.yaml
new file mode 100644
index 0000000..75bbe0c
--- /dev/null
+++ b/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-fru-properties/extra-properties.yaml
@@ -0,0 +1,71 @@
+/system/chassis/motherboard/cpu0:
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'true'
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'true'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
+
+/system/chassis/motherboard/cpu1:
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'true'
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'true'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
+
+/system/chassis/motherboard/cpu2:
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'true'
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'true'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
+
+/system/chassis/motherboard/cpu3:
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'true'
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'true'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
+
+/system/chassis/motherboard/bmc:
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'true'
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'true'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
+
+/system/chassis/motherboard:
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'true'
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'true'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
+
+/system:
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'true'
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'true'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
+
+/system/chassis/pdb:
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'true'
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'true'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
+
+/system/chassis/fp:
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'true'
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'true'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
diff --git a/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-inventory-map-native.bb b/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-inventory-map-native.bb
new file mode 100644
index 0000000..dc19aa4
--- /dev/null
+++ b/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-inventory-map-native.bb
@@ -0,0 +1,22 @@
+SUMMARY = "Quanta Q71l IPMI to DBus Inventory mapping."
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+inherit phosphor-ipmi-fru
+
+SRC_URI += "file://config.yaml"
+
+PROVIDES += "virtual/phosphor-ipmi-fru-inventory"
+
+S = "${WORKDIR}"
+
+do_install() {
+        # TODO: install this to inventory_datadir
+        # after ipmi-fru-parser untangles the host
+        # firmware config from the machine inventory.
+        DEST=${D}${config_datadir}
+
+        install -d ${DEST}
+        install config.yaml ${DEST}
+}
diff --git a/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-inventory-map/config.yaml b/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-inventory-map/config.yaml
new file mode 100644
index 0000000..8bb0105
--- /dev/null
+++ b/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-inventory-map/config.yaml
@@ -0,0 +1,109 @@
+0x56:
+  /system/chassis/motherboard:
+    xyz.openbmc_project.Inventory.Decorator.Asset:
+      BuildDate:
+        IPMIFruProperty: Mfg Date
+        IPMIFruSection: Board
+      PartNumber:
+        IPMIFruProperty: Part Number
+        IPMIFruSection: Board
+      Manufacturer:
+        IPMIFruProperty: Manufacturer
+        IPMIFruSection: Board
+      SerialNumber:
+        IPMIFruProperty: Serial Number
+        IPMIFruSection: Board
+    xyz.openbmc_project.Inventory.Item:
+      PrettyName:
+        IPMIFruProperty: Name
+        IPMIFruSection: Board
+  /system:
+    xyz.openbmc_project.Inventory.Decorator.Asset:
+      SerialNumber:
+        IPMIFruProperty: Serial Number
+        IPMIFruSection: Chassis
+      PartNumber:
+        IPMIFruProperty: Part Number
+        IPMIFruSection: Chassis
+      Model:
+        IPMIFruProperty: Type
+        IPMIFruSection: Chassis
+
+0x50:
+  /system/chassis/motherboard/bmc:
+    xyz.openbmc_project.Inventory.Item:
+      PrettyName:
+        IPMIFruProperty: Name
+        IPMIFruSection: Board
+    xyz.openbmc_project.Inventory.Decorator.Asset:
+      BuildDate:
+        IPMIFruProperty: Mfg Date
+        IPMIFruSection: Board
+      PartNumber:
+        IPMIFruProperty: Part Number
+        IPMIFruSection: Board
+      Manufacturer:
+        IPMIFruProperty: Manufacturer
+        IPMIFruSection: Board
+      SerialNumber:
+        IPMIFruProperty: Serial Number
+        IPMIFruSection: Board
+    xyz.openbmc_project.Inventory.Decorator.Revision:
+      Version:
+        IPMIFruProperty: FRU File ID
+        IPMIFruSection: Board
+
+0x52:
+  /system/chassis/pdb:
+    xyz.openbmc_project.Inventory.Item:
+      PrettyName:
+        IPMIFruProperty: Name
+        IPMIFruSection: Board
+    xyz.openbmc_project.Inventory.Decorator.Asset:
+      SerialNumber:
+        IPMIFruProperty: Serial Number
+        IPMIFruSection: Board
+      Manufacturer:
+        IPMIFruProperty: Manufacturer
+        IPMIFruSection: Board
+      PartNumber:
+        IPMIFruProperty: Part Number
+        IPMIFruSection: Board
+      BuildDate:
+        IPMIFruProperty: Mfg Date
+        IPMIFruSection: Board
+      Model:
+        IPMIFruProperty: Model Number
+        IPMIFruSection: Board
+    xyz.openbmc_project.Inventory.Decorator.Revision:
+      Version:
+        IPMIFruProperty: FRU File ID
+        IPMIFruSection: Board
+
+0x57:
+  /system/chassis/fp:
+    xyz.openbmc_project.Inventory.Item:
+      PrettyName:
+        IPMIFruProperty: Name
+        IPMIFruSection: Board
+    xyz.openbmc_project.Inventory.Decorator.Asset:
+      SerialNumber:
+        IPMIFruProperty: Serial Number
+        IPMIFruSection: Board
+      Manufacturer:
+        IPMIFruProperty: Manufacturer
+        IPMIFruSection: Board
+      PartNumber:
+        IPMIFruProperty: Part Number
+        IPMIFruSection: Board
+      BuildDate:
+        IPMIFruProperty: Mfg Date
+        IPMIFruSection: Board
+      Model:
+        IPMIFruProperty: Model Number
+        IPMIFruSection: Board
+    xyz.openbmc_project.Inventory.Decorator.Revision:
+      Version:
+        IPMIFruProperty: FRU File ID
+        IPMIFruSection: Board
+
diff --git a/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-sensor-map-native.bb b/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-sensor-map-native.bb
new file mode 100644
index 0000000..951a55f
--- /dev/null
+++ b/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-sensor-map-native.bb
@@ -0,0 +1,18 @@
+SUMMARY = "Quanta Q71l IPMI to DBus Sensor mapping."
+PR = "r1"
+
+inherit native
+inherit phosphor-ipmi-host
+inherit obmc-phosphor-license
+
+PROVIDES += "virtual/phosphor-ipmi-sensor-inventory"
+
+SRC_URI += "file://config.yaml"
+
+S = "${WORKDIR}"
+
+do_install() {
+	DEST=${D}${sensor_datadir}
+        install -d ${DEST}
+	install config.yaml ${DEST}/sensor.yaml
+}
diff --git a/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-sensor-map/config.yaml b/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-sensor-map/config.yaml
new file mode 100644
index 0000000..0d6261d
--- /dev/null
+++ b/meta-q71l/recipes-phosphor/ipmi/q71l-ipmi-sensor-map/config.yaml
@@ -0,0 +1,142 @@
+0xF0:
+  sensorType: 0x01
+  path: /xyz/openbmc_project/sensors/temperature/temp2_inlet
+  sensorReadingType: 0x01
+  multiplierM: 511
+  offsetB: 0
+  bExp: 0
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        0x0:
+          type: int
+
+0xF1:
+  sensorType: 0x01
+  path: /xyz/openbmc_project/sensors/temperature/temp1
+  sensorReadingType: 0x01
+  multiplierM: 511
+  offsetB: 0
+  bExp: 0
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        0x0:
+          type: int
+
+0xF2:
+  sensorType: 0x01
+  path: /xyz/openbmc_project/sensors/temperature/temp3
+  sensorReadingType: 0x01
+  multiplierM: 511
+  offsetB: 0
+  bExp: 0
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        0x0:
+          type: int
+
+0xB0:
+  sensorType: 0x04
+  path: /xyz/openbmc_project/sensors/fan_tach/fan1
+  sensorReadingType: 0x01
+  multiplierM: 100
+  offsetB: 0
+  bExp: 0
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        0x0:
+          type: int
+
+0xB1:
+  sensorType: 0x04
+  path: /xyz/openbmc_project/sensors/fan_tach/fan2
+  sensorReadingType: 0x01
+  multiplierM: 100
+  offsetB: 0
+  bExp: 0
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        0x0:
+          type: int
+
+0xB2:
+  sensorType: 0x04
+  path: /xyz/openbmc_project/sensors/fan_tach/fan3
+  sensorReadingType: 0x01
+  multiplierM: 100
+  offsetB: 0
+  bExp: 0
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        0x0:
+          type: int
+
+0xB3:
+  sensorType: 0x04
+  path: /xyz/openbmc_project/sensors/fan_tach/fan4
+  sensorReadingType: 0x01
+  multiplierM: 100
+  offsetB: 0
+  bExp: 0
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        0x0:
+          type: int
+
+0xB4:
+  sensorType: 0x04
+  path: /xyz/openbmc_project/sensors/fan_tach/fan5
+  sensorReadingType: 0x01
+  multiplierM: 100
+  offsetB: 0
+  bExp: 0
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        0x0:
+          type: int
+
+0xB5:
+  sensorType: 0x04
+  path: /xyz/openbmc_project/sensors/fan_tach/fan6
+  sensorReadingType: 0x01
+  multiplierM: 100
+  offsetB: 0
+  bExp: 0
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        0x0:
+          type: int
+
+0xB6:
+  sensorType: 0x04
+  path: /xyz/openbmc_project/sensors/fan_tach/fan7
+  sensorReadingType: 0x01
+  multiplierM: 100
+  offsetB: 0
+  bExp: 0
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        0x0:
+          type: int
+
+0xB7:
+  sensorType: 0x04
+  path: /xyz/openbmc_project/sensors/fan_tach/fan8
+  sensorReadingType: 0x01
+  multiplierM: 100
+  offsetB: 0
+  bExp: 0
+  interfaces:
+    xyz.openbmc_project.Sensor.Value:
+      Value:
+        0x0:
+          type: int