Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,8 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
PACKAGECONFIG:bletchley = " \
adcsensor \
fansensor \
hwmontempsensor \
psusensor \
"
@@ -0,0 +1,72 @@
#!/bin/bash
TARGET_FILE_NAME="/etc/nvme/nvme_config.json"
export_gpio() {
if [ ! -d "/sys/class/gpio/gpio$1" ]; then
echo "$1" >/sys/class/gpio/export
fi
}
for i in {0..5}
do
SLED_NVME_PCIE_EN[i]=0
for file in /sys/bus/i2c/drivers/pca953x/"$i"-0041/gpio/gpiochip*/base
do
if [ -f "$file" ]; then
GPIOCHIP_BASE="$(cat /sys/bus/i2c/drivers/pca953x/"$i"-0041/gpio/gpiochip*/base)"
SLED_NVME_PCIE_EN[i]=$((GPIOCHIP_BASE+3))
export_gpio "${SLED_NVME_PCIE_EN[i]}"
break
fi
done
done
cat > $TARGET_FILE_NAME << EOF1
{
"maxSmbusErrorRetry": 3,
"config": [
{
"NVMeDriveIndex": 1,
"NVMeDriveBusID": 0,
"NVMeDrivePwrGoodPin": ${SLED_NVME_PCIE_EN[0]}
},
{
"NVMeDriveIndex": 2,
"NVMeDriveBusID": 1,
"NVMeDrivePwrGoodPin": ${SLED_NVME_PCIE_EN[1]}
},
{
"NVMeDriveIndex": 3,
"NVMeDriveBusID": 2,
"NVMeDrivePwrGoodPin": ${SLED_NVME_PCIE_EN[2]}
},
{
"NVMeDriveIndex": 4,
"NVMeDriveBusID": 3,
"NVMeDrivePwrGoodPin": ${SLED_NVME_PCIE_EN[3]}
},
{
"NVMeDriveIndex": 5,
"NVMeDriveBusID": 4,
"NVMeDrivePwrGoodPin": ${SLED_NVME_PCIE_EN[4]}
},
{
"NVMeDriveIndex": 6,
"NVMeDriveBusID": 5,
"NVMeDrivePwrGoodPin": ${SLED_NVME_PCIE_EN[5]}
}
],
"threshold": [
{
"criticalHigh": 68,
"criticalLow": 0,
"warningHigh": 67,
"warningLow": 1,
"maxValue": 127,
"minValue": -127
}
]
}
EOF1
@@ -0,0 +1,2 @@
[Service]
ExecStartPre=/usr/libexec/phosphor-nvme/nvme-json-rewrite
@@ -0,0 +1,39 @@
{
"maxSmbusErrorRetry": 3,
"config": [
{
"NVMeDriveIndex": 1,
"NVMeDriveBusID": 0
},
{
"NVMeDriveIndex": 2,
"NVMeDriveBusID": 1
},
{
"NVMeDriveIndex": 3,
"NVMeDriveBusID": 2
},
{
"NVMeDriveIndex": 4,
"NVMeDriveBusID": 3
},
{
"NVMeDriveIndex": 5,
"NVMeDriveBusID": 4
},
{
"NVMeDriveIndex": 6,
"NVMeDriveBusID": 5
}
],
"threshold": [
{
"criticalHigh": 68,
"criticalLow": 0,
"warningHigh": 67,
"warningLow": 1,
"maxValue": 127,
"minValue": -127
}
]
}
@@ -0,0 +1,23 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
inherit obmc-phosphor-systemd
SRC_URI:append:bletchley = " \
file://nvme-json-rewrite \
file://nvme-json-rewrite.conf \
file://nvme_config.json \
"
RDEPENDS:${PN}:bletchley += "bash"
do_install:append:bletchley() {
install -d ${D}${libexecdir}/${PN}/
install -m 0755 ${WORKDIR}/nvme-json-rewrite ${D}${libexecdir}/${PN}/
install -d ${D}${sysconfdir}/nvme
install -m 0644 -D ${WORKDIR}/nvme_config.json ${D}${sysconfdir}/nvme
}
SYSTEMD_OVERRIDE:${PN}:append:bletchley = " \
nvme-json-rewrite.conf:xyz.openbmc_project.nvme.manager.service.d/nvme-json-rewrite.conf \
"
@@ -0,0 +1,143 @@
[
{
"Desc": {
"Name": "Virtual_CFM_Sensor",
"SensorType": "airflow"
},
"Params": {
"DbusParam": [
{
"ParamName": "fan0",
"Desc": {
"Name": "FAN0_TACH_IL",
"SensorType": "fan_tach"
}
},
{
"ParamName": "fan1",
"Desc": {
"Name": "FAN1_TACH_IL",
"SensorType": "fan_tach"
}
},
{
"ParamName": "fan2",
"Desc": {
"Name": "FAN2_TACH_IL",
"SensorType": "fan_tach"
}
},
{
"ParamName": "fan3",
"Desc": {
"Name": "FAN3_TACH_IL",
"SensorType": "fan_tach"
}
}
]
},
"Expression": "max(0, (avg(fan0, fan1, fan2, fan3) * 0.0448) - 9.5042)"
},
{
"Desc": {
"Name": "Virtual_Inlet_Temp",
"SensorType": "temperature"
},
"Threshold": {
"CriticalHigh": 40,
"CriticalLow": 0
},
"Params": {
"DbusParam": [
{
"ParamName": "inlet_temp",
"Desc": {
"Name": "FRONT_PANEL_TEMP",
"SensorType": "temperature"
}
},
{
"ParamName": "fan0",
"Desc": {
"Name": "FAN0_TACH_IL",
"SensorType": "fan_tach"
}
},
{
"ParamName": "fan1",
"Desc": {
"Name": "FAN1_TACH_IL",
"SensorType": "fan_tach"
}
},
{
"ParamName": "fan2",
"Desc": {
"Name": "FAN2_TACH_IL",
"SensorType": "fan_tach"
}
},
{
"ParamName": "fan3",
"Desc": {
"Name": "FAN3_TACH_IL",
"SensorType": "fan_tach"
}
}
]
},
"Expression": [
"if(",
" avg(fan0, fan1, fan2, fan3) > 0,",
" inlet_temp - (((avg(fan0, fan1, fan2, fan3)^2) * (5e-8)) -",
" (avg(fan0, fan1, fan2, fan3) * (6e-4)) + 1.5841),",
" inlet_temp)"
]
},
{
"Desc": {
"Name": "Virtual_P12V_AUX_HSC_Input_Power",
"SensorType": "power"
},
"Params": {
"DbusParam": [
{
"ParamName": "HSC_PWR",
"Desc": {
"Name": "P12V_AUX_HSC_Input_Power",
"SensorType": "power"
}
}
]
},
"Expression": [
"var PWR[9]:={",
" 68.082, 131.899, 194.753, 256.391, 316.721, 376.108, 433.569,",
" 490.850, 546.187 };",
"var ERR[9]:={",
" 0.0425, 0.0497, 0.0537, 0.0555, 0.0565, 0.0577, 0.0587, 0.0597,",
" 0.0603 };",
"switch {",
" case HSC_PWR<PWR[0]:",
" HSC_PWR/(1+ERR[0]);",
" case inrange(PWR[0],HSC_PWR,PWR[1]):",
" HSC_PWR/(1+ERR[0]+(HSC_PWR-PWR[0])*(ERR[1]-ERR[0])/(PWR[1]-PWR[0]));",
" case inrange(PWR[1],HSC_PWR,PWR[2]):",
" HSC_PWR/(1+ERR[1]+(HSC_PWR-PWR[1])*(ERR[2]-ERR[1])/(PWR[2]-PWR[1]));",
" case inrange(PWR[2],HSC_PWR,PWR[3]):",
" HSC_PWR/(1+ERR[2]+(HSC_PWR-PWR[2])*(ERR[3]-ERR[2])/(PWR[3]-PWR[2]));",
" case inrange(PWR[3],HSC_PWR,PWR[4]):",
" HSC_PWR/(1+ERR[3]+(HSC_PWR-PWR[3])*(ERR[4]-ERR[3])/(PWR[4]-PWR[3]));",
" case inrange(PWR[4],HSC_PWR,PWR[5]):",
" HSC_PWR/(1+ERR[4]+(HSC_PWR-PWR[4])*(ERR[5]-ERR[4])/(PWR[5]-PWR[4]));",
" case inrange(PWR[5],HSC_PWR,PWR[6]):",
" HSC_PWR/(1+ERR[5]+(HSC_PWR-PWR[5])*(ERR[6]-ERR[5])/(PWR[6]-PWR[5]));",
" case inrange(PWR[6],HSC_PWR,PWR[7]):",
" HSC_PWR/(1+ERR[6]+(HSC_PWR-PWR[6])*(ERR[7]-ERR[6])/(PWR[7]-PWR[6]));",
" case inrange(PWR[7],HSC_PWR,PWR[8]):",
" HSC_PWR/(1+ERR[7]+(HSC_PWR-PWR[7])*(ERR[8]-ERR[7])/(PWR[8]-PWR[7]));",
" default : HSC_PWR/(1+ERR[8]);",
"}"
]
}
]
@@ -0,0 +1,143 @@
[
{
"Desc": {
"Name": "Virtual_CFM_Sensor",
"SensorType": "airflow"
},
"Params": {
"DbusParam": [
{
"ParamName": "fan0",
"Desc": {
"Name": "FAN0_TACH_IL",
"SensorType": "fan_tach"
}
},
{
"ParamName": "fan1",
"Desc": {
"Name": "FAN1_TACH_IL",
"SensorType": "fan_tach"
}
},
{
"ParamName": "fan2",
"Desc": {
"Name": "FAN2_TACH_IL",
"SensorType": "fan_tach"
}
},
{
"ParamName": "fan3",
"Desc": {
"Name": "FAN3_TACH_IL",
"SensorType": "fan_tach"
}
}
]
},
"Expression": "max(0, (avg(fan0, fan1, fan2, fan3) * 0.0448) - 9.5042)"
},
{
"Desc": {
"Name": "Virtual_Inlet_Temp",
"SensorType": "temperature"
},
"Threshold": {
"CriticalHigh": 40,
"CriticalLow": 0
},
"Params": {
"DbusParam": [
{
"ParamName": "inlet_temp",
"Desc": {
"Name": "FRONT_PANEL_TEMP",
"SensorType": "temperature"
}
},
{
"ParamName": "fan0",
"Desc": {
"Name": "FAN0_TACH_IL",
"SensorType": "fan_tach"
}
},
{
"ParamName": "fan1",
"Desc": {
"Name": "FAN1_TACH_IL",
"SensorType": "fan_tach"
}
},
{
"ParamName": "fan2",
"Desc": {
"Name": "FAN2_TACH_IL",
"SensorType": "fan_tach"
}
},
{
"ParamName": "fan3",
"Desc": {
"Name": "FAN3_TACH_IL",
"SensorType": "fan_tach"
}
}
]
},
"Expression": [
"if(",
" avg(fan0, fan1, fan2, fan3) > 0,",
" inlet_temp - (((avg(fan0, fan1, fan2, fan3)^2) * (9e-8)) -",
" (avg(fan0, fan1, fan2, fan3) * (8e-4)) + 2.37),",
" inlet_temp)"
]
},
{
"Desc": {
"Name": "Virtual_P12V_AUX_HSC_Input_Power",
"SensorType": "power"
},
"Params": {
"DbusParam": [
{
"ParamName": "HSC_PWR",
"Desc": {
"Name": "P12V_AUX_HSC_Input_Power",
"SensorType": "power"
}
}
]
},
"Expression": [
"var PWR[9]:={",
" 68.082, 131.899, 194.753, 256.391, 316.721, 376.108, 433.569,",
" 490.850, 546.187 };",
"var ERR[9]:={",
" 0.0425, 0.0497, 0.0537, 0.0555, 0.0565, 0.0577, 0.0587, 0.0597,",
" 0.0603 };",
"switch {",
" case HSC_PWR<PWR[0]:",
" HSC_PWR/(1+ERR[0]);",
" case inrange(PWR[0],HSC_PWR,PWR[1]):",
" HSC_PWR/(1+ERR[0]+(HSC_PWR-PWR[0])*(ERR[1]-ERR[0])/(PWR[1]-PWR[0]));",
" case inrange(PWR[1],HSC_PWR,PWR[2]):",
" HSC_PWR/(1+ERR[1]+(HSC_PWR-PWR[1])*(ERR[2]-ERR[1])/(PWR[2]-PWR[1]));",
" case inrange(PWR[2],HSC_PWR,PWR[3]):",
" HSC_PWR/(1+ERR[2]+(HSC_PWR-PWR[2])*(ERR[3]-ERR[2])/(PWR[3]-PWR[2]));",
" case inrange(PWR[3],HSC_PWR,PWR[4]):",
" HSC_PWR/(1+ERR[3]+(HSC_PWR-PWR[3])*(ERR[4]-ERR[3])/(PWR[4]-PWR[3]));",
" case inrange(PWR[4],HSC_PWR,PWR[5]):",
" HSC_PWR/(1+ERR[4]+(HSC_PWR-PWR[4])*(ERR[5]-ERR[4])/(PWR[5]-PWR[4]));",
" case inrange(PWR[5],HSC_PWR,PWR[6]):",
" HSC_PWR/(1+ERR[5]+(HSC_PWR-PWR[5])*(ERR[6]-ERR[5])/(PWR[6]-PWR[5]));",
" case inrange(PWR[6],HSC_PWR,PWR[7]):",
" HSC_PWR/(1+ERR[6]+(HSC_PWR-PWR[6])*(ERR[7]-ERR[6])/(PWR[7]-PWR[6]));",
" case inrange(PWR[7],HSC_PWR,PWR[8]):",
" HSC_PWR/(1+ERR[7]+(HSC_PWR-PWR[7])*(ERR[8]-ERR[7])/(PWR[8]-PWR[7]));",
" default : HSC_PWR/(1+ERR[8]);",
"}"
]
}
]
@@ -0,0 +1,5 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SENSOR_CONFIGS = " \
virtual_sensor_config_hdc1080.json \
virtual_sensor_config_si7021.json \
"