meta-ufispace: Add meta-ufispace layer and meta-ncplite machine

Iniitial submission of meta-layer and meta-machine layer.

Tested: Build and run on our machine successfully.

Change-Id: I4920d8ce6aff119ba5cbc4772d84a6377784f85d
Signed-off-by: Jordan Chang <jordan.chang@ufispace.com>
diff --git a/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend
new file mode 100644
index 0000000..4fc41d0
--- /dev/null
+++ b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend
@@ -0,0 +1 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
diff --git a/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json
new file mode 100644
index 0000000..e2b78e3
--- /dev/null
+++ b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json
@@ -0,0 +1,8 @@
+{
+    "id": 32,
+    "revision": 1,
+    "addn_dev_support": 143,
+    "manuf_id": 51242,
+    "prod_id": 9600,
+    "aux": 0
+}
diff --git a/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru/ncplite-obmc-read-eeprom@.service b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru/ncplite-obmc-read-eeprom@.service
new file mode 100644
index 0000000..19448ad
--- /dev/null
+++ b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru/ncplite-obmc-read-eeprom@.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Read %I EEPROM
+Wants=mapper-wait@-xyz-openbmc_project-inventory.service
+After=mapper-wait@-xyz-openbmc_project-inventory.service
+StartLimitInterval=120
+StartLimitBurst=10
+
+[Service]
+Restart=on-failure
+RestartSec=10
+EnvironmentFile={envfiledir}/obmc/eeproms/%I
+ExecStartPre={bindir}/of-name-to-eeprom.sh {envfiledir}/obmc/eeproms/%I
+ExecStart=/usr/bin/env phosphor-read-eeprom --eeprom $SYSFS_PATH --fruid $FRUID
+SyslogIdentifier=phosphor-read-eeprom
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/motherboard b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/motherboard
new file mode 100644
index 0000000..f049834
--- /dev/null
+++ b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/motherboard
@@ -0,0 +1,2 @@
+SYSFS_PATH=/sys/bus/i2c/devices/3-0050/eeprom
+FRUID=0
diff --git a/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/psu0 b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/psu0
new file mode 100644
index 0000000..b0f2bd8
--- /dev/null
+++ b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/psu0
@@ -0,0 +1,2 @@
+SYSFS_PATH=/sys/bus/i2c/devices/4-0050/eeprom
+FRUID=1
diff --git a/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/psu1 b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/psu1
new file mode 100644
index 0000000..966e75a
--- /dev/null
+++ b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/psu1
@@ -0,0 +1,2 @@
+SYSFS_PATH=/sys/bus/i2c/devices/5-0050/eeprom
+FRUID=2
diff --git a/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend
new file mode 100644
index 0000000..e858511
--- /dev/null
+++ b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend
@@ -0,0 +1,35 @@
+inherit obmc-phosphor-systemd
+
+DEPENDS:append:ncplite = " ncplite-yaml-config"
+
+FILESEXTRAPATHS:prepend:ncplite := "${THISDIR}/${PN}:"
+
+SRC_URI:append:ncplite = " file://ncplite-obmc-read-eeprom@.service \
+                         "
+
+EXTRA_OECONF:ncplite = " \
+    YAML_GEN=${STAGING_DIR_HOST}${datadir}/ncplite-yaml-config/ipmi-fru-read.yaml \
+    PROP_YAML=${STAGING_DIR_HOST}${datadir}/ncplite-yaml-config/ipmi-extra-properties.yaml \
+    "
+
+EEPROM_NAMES = "motherboard psu1 psu0"
+
+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:ncplite := " ${@compose_list(d, 'ENVFMT', 'EEPROMS')}"
+
+TMPL = "obmc-read-eeprom@.service"
+TGT = "multi-user.target"
+INSTFMT = "obmc-read-eeprom@{0}.service"
+FMT = "../${TMPL}:${TGT}.wants/${INSTFMT}"
+
+SYSTEMD_LINK:${PN}:append:ncplite := " ${@compose_list(d, 'FMT', 'EEPROMS_ESCAPED')}"
+
+do_install:append:ncplite() {
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${WORKDIR}/ncplite-obmc-read-eeprom@.service ${D}${systemd_system_unitdir}/obmc-read-eeprom@.service
+}
diff --git a/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-host/phosphor-softpoweroff b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-host/phosphor-softpoweroff
new file mode 100644
index 0000000..ea24bdd
--- /dev/null
+++ b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-host/phosphor-softpoweroff
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+echo "Ufi_Bmc: Trigger soft off the host"
+exit 0
diff --git a/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-host/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-host/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service
new file mode 100644
index 0000000..8600738
--- /dev/null
+++ b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-host/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Soft power off of the host
+Wants=obmc-host-stop-pre@0.target
+Before=obmc-host-stop-pre@0.target
+Conflicts=obmc-host-start@0.target
+ConditionPathExists=!/run/openbmc/host@0-request
+ConditionPathExists=!/lib/systemd/system/pldmSoftPowerOff.service
+
+[Service]
+Restart=no
+ExecStart=/usr/bin/env phosphor-softpoweroff
+SyslogIdentifier=phosphor-softpoweroff
+Type=oneshot
diff --git a/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
new file mode 100644
index 0000000..748852e
--- /dev/null
+++ b/meta-ufispace/meta-ncplite/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
@@ -0,0 +1,20 @@
+FILESEXTRAPATHS:append:ncplite := "${THISDIR}/${PN}:"
+
+DEPENDS:append:ncplite = " ncplite-yaml-config"
+
+EXTRA_OEMESON:ncplite = " \
+    -Dsensor-yaml-gen=${STAGING_DIR_HOST}${datadir}/ncplite-yaml-config/ipmi-sensors.yaml \
+    -Dfru-yaml-gen=${STAGING_DIR_HOST}${datadir}/ncplite-yaml-config/ipmi-fru-read.yaml \
+    -Dinvsensor-yaml-gen=${STAGING_DIR_HOST}${datadir}/ncplite-yaml-config/ipmi-inventory-sensors.yaml \
+    "
+
+RDEPENDS:${PN} += "bash"
+
+SRC_URI += "file://phosphor-softpoweroff \
+            file://xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service \
+           "
+
+do_install:append:ncplite (){
+    install -m 0755 ${WORKDIR}/phosphor-softpoweroff ${D}/${bindir}/phosphor-softpoweroff
+    install -m 0644 ${WORKDIR}/${SOFT_SVC} ${D}${systemd_unitdir}/system/${SOFT_SVC}
+}