meta-bletchley: phosphor-nvme: add nvme config script
In Bletchley, we use PCIE_PWR_EN pin as NVME power good pin from each
interposer board. Because PCIE_PWR_EN is form the I/O expander, it
won't have fixed GPIO pin number.
Add script to generate a nvme_config.json with correct GPIO pin number
before nvme management service start.
Tested:
- nvme_config.json generated
```
root@bletchley:~# cat /etc/nvme/nvme_config.json
{
"config": [
{
"NVMeDriveIndex": 1,
"NVMeDriveBusID": 0,
"NVMeDrivePwrGoodPin": 779
},
{
"NVMeDriveIndex": 2,
"NVMeDriveBusID": 1,
"NVMeDrivePwrGoodPin": 759
},
{
"NVMeDriveIndex": 3,
"NVMeDriveBusID": 2,
"NVMeDrivePwrGoodPin": 739
},
{
"NVMeDriveIndex": 4,
"NVMeDriveBusID": 3,
"NVMeDrivePwrGoodPin": 719
},
{
"NVMeDriveIndex": 5,
"NVMeDriveBusID": 4,
"NVMeDrivePwrGoodPin": 699
},
{
"NVMeDriveIndex": 6,
"NVMeDriveBusID": 5,
"NVMeDrivePwrGoodPin": 679
}
],
"threshold": [
{
"criticalHigh": 68,
"criticalLow": 0,
"warningHigh": 67,
"warningLow": 1,
"maxValue": 127,
"minValue": -127
}
]
}
```
- nvme sensor available (host on)
```
root@bletchley:~# busctl introspect xyz.openbmc_project.nvme.manager \
< /xyz/openbmc_project/sensors/temperature/nvme6 \
< xyz.openbmc_project.Sensor.Value
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
xyz.openbmc_project.Sensor.Value interface - - -
.MaxValue property d 127 emits-change writable
.MinValue property d -127 emits-change writable
.Unit property s "xyz.openbmc_project.Sensor.Value.Uni... emits-change writable
.Value property d 36 emits-change writable
root@bletchley:~# busctl introspect xyz.openbmc_project.nvme.manager \
> /xyz/openbmc_project/sensors/temperature/nvme6 \
> xyz.openbmc_project.State.Decorator.Availability
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.Available property b true emits-change writable
```
- nvme sensor not available (host off)
```
root@bletchley:~# busctl introspect xyz.openbmc_project.nvme.manager \
> /xyz/openbmc_project/sensors/temperature/nvme6 \
> xyz.openbmc_project.Sensor.Value
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.MaxValue property d 127 emits-change writable
.MinValue property d -127 emits-change writable
.Unit property s "xyz.openbmc_project.Sensor.Value.Uni... emits-change writable
.Value property d -127 emits-change writable
root@bletchley:~# busctl introspect xyz.openbmc_project.nvme.manager \
> /xyz/openbmc_project/sensors/temperature/nvme6 \
> xyz.openbmc_project.State.Decorator.Availability
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.Available property b false emits-change writable
```
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I2cda2e5e252fdfdd66ba6f9e0ea006c425cbf43b
diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/sensors/phosphor-nvme_%.bbappend b/meta-facebook/meta-bletchley/recipes-phosphor/sensors/phosphor-nvme_%.bbappend
new file mode 100644
index 0000000..d495c8d
--- /dev/null
+++ b/meta-facebook/meta-bletchley/recipes-phosphor/sensors/phosphor-nvme_%.bbappend
@@ -0,0 +1,19 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+inherit obmc-phosphor-systemd
+
+SRC_URI:append:bletchley = " \
+ file://nvme-json-rewrite \
+ file://nvme-json-rewrite.conf \
+"
+
+RDEPENDS:${PN}:bletchley += "bash"
+
+do_install:append:bletchley() {
+ install -d ${D}${libexecdir}/${PN}/
+ install -m 0755 ${WORKDIR}/nvme-json-rewrite ${D}${libexecdir}/${PN}/
+}
+
+SYSTEMD_OVERRIDE:${PN}:append:bletchley = " \
+ nvme-json-rewrite.conf:xyz.openbmc_project.nvme.manager.service.d/nvme-json-rewrite.conf \
+"