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,61 @@
#!/bin/sh
# Select UART Mux: UART Mux for switching between Host and BIC on Slot1 ~ Slot4
# Usage: select-uart-mux <slot1|slot2|slot3|slot4> <host|bic>
REG_OFFSET="0x01"
input_slot=$1
input_target=$2
i2c_bus_id=
show_usage() {
echo "Usage: select-uart-mux [ slot1 | slot2 | slot3 | slot4 ] [ host | bic ]"
echo "Select UART Mux"
}
if [ $# -gt 3 ]; then
show_usage
exit 255
fi
case $input_slot in
slot1)
i2c_bus_id="4"
;;
slot2)
i2c_bus_id="5"
;;
slot3)
i2c_bus_id="6"
;;
slot4)
i2c_bus_id="7"
;;
*)
echo "Slot must between 1 to 4."
show_usage
exit 255
;;
esac
case $input_target in
host)
reg_val="0x03"
;;
bic)
reg_val="0x04"
;;
*)
echo "Input must be host or bic."
show_usage
exit 255
esac
i2ctransfer -y -f $i2c_bus_id w2@0x0f $REG_OFFSET $reg_val
val=$(i2ctransfer -y -f $i2c_bus_id w1@0x0f $REG_OFFSET r1)
ret=$?
if [ $ret -ne 0 ] || [ "$val" != $reg_val ]; then
echo "Failed to modify the register value, the register value is $val instead of $reg_val."
exit 255
fi
@@ -0,0 +1,7 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI:append:greatlakes = " file://select-uart-mux"
do_install:append:greatlakes() {
install -m 0744 ${WORKDIR}/select-uart-mux ${D}${bindir}
}
@@ -0,0 +1 @@
EXTRA_OEMESON:greatlakes = "-Duse-host-power-state=enabled -Dsensor-monitor-hard-shutdown-delay=0"
@@ -0,0 +1,105 @@
{
"sensors": [
{
"name": "BB_INLET_TEMP_C",
"type": "temp",
"readPath": "/xyz/openbmc_project/sensors/temperature/BB_INLET_TEMP_C",
"timeout": 0,
"ignoreDbusMinMax": true
},
{
"name": "BB_FAN0_TACH_RPM",
"type": "fan",
"readPath": "/xyz/openbmc_project/sensors/fan_tach/BB_FAN0_TACH_RPM",
"writePath": "/xyz/openbmc_project/control/fanpwm/Pwm_1",
"min": 0,
"max": 255,
"ignoreDbusMinMax": true
},
{
"name": "BB_FAN1_TACH_RPM",
"type": "fan",
"readPath": "/xyz/openbmc_project/sensors/fan_tach/BB_FAN1_TACH_RPM",
"writePath": "/xyz/openbmc_project/control/fanpwm/Pwm_2",
"min": 0,
"max": 255,
"ignoreDbusMinMax": true
},
{
"name": "BB_FAN2_TACH_RPM",
"type": "fan",
"readPath": "/xyz/openbmc_project/sensors/fan_tach/BB_FAN2_TACH_RPM",
"writePath": "/xyz/openbmc_project/control/fanpwm/Pwm_3",
"min": 0,
"max": 255,
"ignoreDbusMinMax": true
},
{
"name": "BB_FAN3_TACH_RPM",
"type": "fan",
"readPath": "/xyz/openbmc_project/sensors/fan_tach/BB_FAN3_TACH_RPM",
"writePath": "/xyz/openbmc_project/control/fanpwm/Pwm_4",
"min": 0,
"max": 255,
"ignoreDbusMinMax": true
}
],
"zones" : [
{
"id": 1,
"failsafePercent": 90.0,
"minThermalOutput": 0.0,
"cycleTimeBaseMS": 1000,
"updateThermalsTimeMS": 1000,
"pids": [
{
"name": "fan0 1 2 3",
"type": "fan",
"inputs": [
"BB_FAN0_TACH_RPM",
"BB_FAN1_TACH_RPM",
"BB_FAN2_TACH_RPM",
"BB_FAN3_TACH_RPM"
],
"setpoint": 0.0,
"pid": {
"samplePeriod": 1,
"proportionalCoeff": 0.0,
"integralCoeff": 0.0,
"derivativeCoeff": 0.0,
"feedFwdOffsetCoeff": 0.0,
"feedFwdGainCoeff": 1.0,
"integralLimit_min": 0.0,
"integralLimit_max": 0.0,
"outLim_min": 0.0,
"outLim_max": 100.0,
"slewNeg": 0.0,
"slewPos": 0.0,
"positiveHysteresis": 0,
"negativeHysteresis": 0
}
},
{
"name": "Stepwise_BB_INLET_TEMP_C",
"type": "stepwise",
"inputs": [
"BB_INLET_TEMP_C"
],
"setpoint": 0.0,
"pid": {
"samplePeriod": 1,
"isCeiling": false,
"reading": {
"0": 20.0
},
"output": {
"0": 70.0
},
"positiveHysteresis": 0,
"negativeHysteresis": 2
}
}
]
}
]
}
@@ -0,0 +1,10 @@
FILESEXTRAPATHS:prepend:greatlakes := "${THISDIR}/${PN}:"
SRC_URI:append:greatlakes = " file://config.json \
"
FILES:${PN}:append:greatlakes = " ${datadir}/swampd/config.json"
do_install:append:greatlakes() {
install -d ${D}${datadir}/swampd
install -m 0644 -D ${WORKDIR}/config.json ${D}${datadir}/swampd/
}
@@ -0,0 +1,16 @@
SUMMARY = "greatlakes gpio monitor register"
DESCRIPTION = "greatlakes gpio monitor register"
SECTION = "base"
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
S = "${WORKDIR}"
inherit obmc-phosphor-systemd
SRC_URI = "file://set-current-host-state@.service \
"
DEPENDS += "systemd"
SYSTEMD_SERVICE:${PN} += "set-current-host-state@.service"
@@ -0,0 +1,8 @@
[Unit]
Description=Set currrent host state property slot%i
[Service]
Type=oneshot
ExecStart=/usr/bin/busctl set-property xyz.openbmc_project.State.Host%i /xyz/openbmc_project/state/host%i xyz.openbmc_project.State.Host CurrentHostState s "xyz.openbmc_project.State.Host.HostState.Off"
SyslogIdentifier=set-current-host-state-slot%i
@@ -0,0 +1,34 @@
[
{
"Name": "PWROK_STBY_BMC_SLOT1",
"ChipId": "0",
"GpioNum": 10,
"EventMon": "FALLING",
"Target": "set-current-host-state@1.service",
"Continue": true
},
{
"Name": "PWROK_STBY_BMC_SLOT2",
"ChipId": "0",
"GpioNum": 11,
"EventMon": "FALLING",
"Target": "set-current-host-state@2.service",
"Continue": true
},
{
"Name": "PWROK_STBY_BMC_SLOT3",
"ChipId": "0",
"GpioNum": 12,
"EventMon": "FALLING",
"Target": "set-current-host-state@3.service",
"Continue": true
},
{
"Name": "PWROK_STBY_BMC_SLOT4",
"ChipId": "0",
"GpioNum": 13,
"EventMon": "FALLING",
"Target": "set-current-host-state@4.service",
"Continue": true
}
]
@@ -0,0 +1,9 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://greatlakes-phosphor-multi-gpio-monitor.json"
do_install:append:() {
install -d ${D}${datadir}/phosphor-gpio-monitor
install -m 0644 ${WORKDIR}/greatlakes-phosphor-multi-gpio-monitor.json \
${D}${datadir}/phosphor-gpio-monitor/phosphor-multi-gpio-monitor.json
}
@@ -0,0 +1,14 @@
OBMC_IMAGE_EXTRA_INSTALL:append = " \
greatlakes-sysinit \
greatlakes-gpio-monitor-register \
phosphor-gpio-monitor \
"
# Currently, the led related services couldn't complete
# causing that multi-user.target never complete.
# If multi-user.target doesn't complete,
# the obmc-host-startmin@.target couldn't start.
# In that case, BMC couldn't set current host state to "Running".
IMAGE_FEATURES:remove = " \
obmc-leds \
"
@@ -0,0 +1,5 @@
# greatlakes doesn't use xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service in power control
SOFT_SVC = ""
SOFT_TGTFMT = ""
SOFT_FMT = ""
@@ -0,0 +1,7 @@
IPMB_CHANNELS:greatlakes = "\
/dev/ipmb-0 \
/dev/ipmb-1 \
/dev/ipmb-2 \
/dev/ipmb-3 \
/dev/ipmb-9 \
"
@@ -0,0 +1,314 @@
[
{
"Desc": {
"Name": "BB_ADC_FAN_OUTPUT_CURR_A",
"SensorType": "current",
"MinValue": 0
},
"Threshold": {
"CriticalHigh": 28.6,
"HardShutdownHigh": 39.2
},
"Params": {
"ConstParam": [
{
"ParamName": "P1",
"Value": 0.157
},
{
"ParamName": "P2",
"Value": 0.33
},
{
"ParamName": "P3",
"Value": 2.5
},
{
"ParamName": "P4",
"Value": 0.96
},
{
"ParamName": "P5",
"Value": 0.15
}
],
"DbusParam": [
{
"ParamName": "P6",
"Desc": {
"Name": "BB_ADC_FAN_ISENSE_VOLT_V",
"SensorType": "voltage"
}
}
]
},
"Expression": "( P6 / P1 / P2 - P3 ) * P4 + P5"
},
{
"Desc": {
"Name": "BB_ADC_NIC_OUTPUT_CURR_A",
"SensorType": "current"
},
"Threshold": {
"CriticalHigh": 6.6,
"HardShutdownHigh": 8.15
},
"Params": {
"ConstParam": [
{
"ParamName": "P1",
"Value": 0.183
}
],
"DbusParam": [
{
"ParamName": "P2",
"Desc": {
"Name": "BB_ADC_NIC_ISENSE_VOLT_V",
"SensorType": "voltage"
}
}
]
},
"Expression": "P2 / P1"
},
{
"Desc": {
"Name": "BB_NIC_PWR_W",
"SensorType": "power"
},
"Threshold": {
"CriticalHigh": 82.5,
"HardShutdownHigh": 101.875
},
"Params": {
"ConstParam": [
{
"ParamName": "P1",
"Value": 0.183
}
],
"DbusParam": [
{
"ParamName": "P2",
"Desc": {
"Name": "BB_ADC_NIC_P12V_VOLT_V",
"SensorType": "voltage"
}
},
{
"ParamName": "P3",
"Desc": {
"Name": "BB_ADC_NIC_ISENSE_VOLT_V",
"SensorType": "voltage"
}
}
]
},
"Expression": "P2 * ( P3 / P1 )"
},
{
"Desc": {
"Name": "BB_MEDUSA_VDELTA_VOLT_V",
"SensorType": "voltage"
},
"Threshold": {
"CriticalHigh": 0.5
},
"Params": {
"DbusParam": [
{
"ParamName": "P1",
"Desc": {
"Name": "BB_MEDUSA_INPUT_VOLT_V",
"SensorType": "voltage"
}
},
{
"ParamName": "P2",
"Desc": {
"Name": "BB_MEDUSA_OUTPUT_VOLT_V",
"SensorType": "voltage"
}
}
]
},
"Expression": "P1 - P2"
},
{
"Desc": {
"Name": "BB_CPU_PDB_VDELTA_VOLT_V",
"SensorType": "voltage",
"MinValue": 0
},
"Threshold": {
"CriticalHigh": 0.8
},
"Params": {
"DbusParam": [
{
"ParamName": "P1",
"Desc": {
"Name": "BB_MEDUSA_OUTPUT_VOLT_V",
"SensorType": "voltage"
}
},
{
"ParamName": "P2",
"Desc": {
"Name": "BB_HSC_INPUT_VOLT_V",
"SensorType": "voltage"
}
}
]
},
"Expression": "P1 - P2"
},
{
"Desc": {
"Name": "BB_FAN_PWR_W",
"SensorType": "power",
"MinValue": 0
},
"Threshold": {
"CriticalHigh": 396.825,
"HardShutdownHigh": 544.88
},
"Params": {
"ConstParam": [
{
"ParamName": "P1",
"Value": 0.157
},
{
"ParamName": "P2",
"Value": 0.33
},
{
"ParamName": "P3",
"Value": 2.5
},
{
"ParamName": "P4",
"Value": 0.96
},
{
"ParamName": "P5",
"Value": 0.15
}
],
"DbusParam": [
{
"ParamName": "P6",
"Desc": {
"Name": "BB_ADC_FAN_ISENSE_VOLT_V",
"SensorType": "voltage"
}
},
{
"ParamName": "P7",
"Desc": {
"Name": "BB_MEDUSA_OUTPUT_VOLT_V",
"SensorType": "voltage"
}
}
]
},
"Expression": "(( P6 / P1 / P2 - P3 ) * P4 + P5 ) * P7"
},
{
"Desc": {
"Name": "BB_SYSTEM_AIRFLOW_CFM",
"SensorType": "airflow",
"MinValue": 0
},
"Params": {
"ConstParam": [
{
"ParamName": "rotor_single_or_duo",
"Value": 1
},
{
"ParamName": "max_support_rotor_per_fan",
"Value": 2
},
{
"ParamName": "gradient_single",
"Value": 0.0203
},
{
"ParamName": "gradient_duo",
"Value": 0
},
{
"ParamName": "displacement_single",
"Value": -9.9157
},
{
"ParamName": "displacement_duo",
"Value": 0
}
],
"DbusParam": [
{
"ParamName": "rpm1",
"Desc": {
"Name": "BB_FAN0_TACH_RPM",
"SensorType": "fan_tach"
}
},
{
"ParamName": "rpm2",
"Desc": {
"Name": "BB_FAN1_TACH_RPM",
"SensorType": "fan_tach"
}
},
{
"ParamName": "rpm3",
"Desc": {
"Name": "BB_FAN2_TACH_RPM",
"SensorType": "fan_tach"
}
},
{
"ParamName": "rpm4",
"Desc": {
"Name": "BB_FAN3_TACH_RPM",
"SensorType": "fan_tach"
}
}
]
},
"Expression": [
"(max_support_rotor_per_fan - 1) * (max_support_rotor_per_fan - 2) == 0 ? ",
"((rotor_single_or_duo % 2) * (gradient_single * avg(rpm1, rpm2, rpm3, rpm4) + displacement_single)) + ",
"(((rotor_single_or_duo - 1) % 2) * (gradient_duo * avg(rpm1, rpm2, rpm3, rpm4) + displacement_duo)) : 0"
]
}
]
@@ -0,0 +1 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
@@ -0,0 +1,5 @@
SYS_POSTCODE_DISPLAY_PATH="/sys/bus/i2c/devices/12-000f/postcode-display-slot"
EXTRA_OEMESON:append:greatlakes = " \
-Dpostcode-display-path=${SYS_POSTCODE_DISPLAY_PATH} \
"