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,23 @@
SUMMARY = "Fan watchdog services"
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
inherit obmc-phosphor-systemd
RDEPENDS:${PN} += "phosphor-gpio-monitor-monitor"
RDEPENDS:${PN} += "busybox"
RESET_SERVICE = "reset-fan-watchdog.service"
TGTFMT = "obmc-chassis-poweron@0.target"
RESET_FMT = "../${RESET_SERVICE}:${TGTFMT}.wants/${RESET_SERVICE}"
MONITOR_SERVICE = "fan-watchdog-monitor@.service"
WATCHDOG_SERVICE = "fan-watchdog.service"
WATCHDOG_FMT = "../${WATCHDOG_SERVICE}:${TGTFMT}.wants/${WATCHDOG_SERVICE}"
SYSTEMD_SERVICE:${PN} += "${RESET_SERVICE} ${MONITOR_SERVICE} ${WATCHDOG_SERVICE}"
SYSTEMD_LINK:${PN} += "${RESET_FMT} ${WATCHDOG_FMT}"
SYSTEMD_ENVIRONMENT_FILE:${PN}:append:df-openpower = " obmc/fan-watchdog/reset-fan-watchdog.conf"
SYSTEMD_ENVIRONMENT_FILE:${PN}:append:df-openpower = " obmc/fan-watchdog/fan-watchdog.conf"
@@ -0,0 +1,9 @@
[Unit]
Description=Fan Watchdog Failure Monitor
#This can get called every time a process dies, so ensure it's never limited
StartLimitIntervalSec=0
[Service]
Type=oneshot
ExecStart=/usr/bin/phosphor-unit-failure-monitor --source %i --target obmc-fan-watchdog-takeover.target --action start
@@ -0,0 +1,14 @@
[Unit]
Description=Fan Watchdog Daemon
Wants=phosphor-fan-monitor-init@0.service
Before=phosphor-fan-monitor-init@0.service
Conflicts=obmc-fan-watchdog-takeover.target
[Service]
EnvironmentFile={envfiledir}/obmc/fan-watchdog/fan-watchdog.conf
ExecStartPre=/bin/sh -c "echo V > ${{DEVICE}}"
ExecStart=/sbin/watchdog -T ${{TIMEOUT}} -t ${{INTERVAL}} -F ${{DEVICE}}
KillSignal=SIGKILL
[Install]
#RequiredBy=obmc-chassis-poweron@0.target
@@ -0,0 +1,3 @@
TIMEOUT=5
INTERVAL=1
DEVICE=/dev/watchdog0
@@ -0,0 +1,3 @@
GPIO_PATH=/dev/gpiochip0
GPIO=114
DELAY=1
@@ -0,0 +1,12 @@
[Unit]
Description=Fan Watchdog Reset
Wants=phosphor-fan-monitor-init@0.service
Before=phosphor-fan-monitor-init@0.service
Conflicts=obmc-chassis-poweroff@0.target
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile={envfiledir}/obmc/fan-watchdog/reset-fan-watchdog.conf
ExecStart=/usr/bin/gpioset --mode=time -u ${{DELAY}} ${{GPIO_PATH}} ${{GPIO}}=0
ExecStart=/usr/bin/gpioset --mode=time -u ${{DELAY}} ${{GPIO_PATH}} ${{GPIO}}=1
@@ -0,0 +1,3 @@
TIMEOUT=5
INTERVAL=1
DEVICE=/dev/watchdog0
@@ -0,0 +1,3 @@
GPIO_PATH=/dev/gpiochip0
GPIO=109
DELAY=1
@@ -0,0 +1,3 @@
TIMEOUT=5
INTERVAL=1
DEVICE=/dev/watchdog0
@@ -0,0 +1,3 @@
GPIO_PATH=/dev/gpiochip0
GPIO=114
DELAY=1
@@ -0,0 +1,3 @@
TIMEOUT=5
INTERVAL=1
DEVICE=/dev/watchdog0
@@ -0,0 +1,3 @@
GPIO_PATH=/dev/gpiochip0
GPIO=109
DELAY=1
@@ -0,0 +1 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
@@ -0,0 +1 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
@@ -0,0 +1,21 @@
fans:
- inventory: /system/chassis/motherboard/fan2
cooling_zone: 0
cooling_profile: all
sensors:
- fan2_0
- inventory: /system/chassis/motherboard/fan0
cooling_zone: 0
cooling_profile: all
sensors:
- fan0_0
- inventory: /system/chassis/motherboard/fan1
cooling_zone: 0
cooling_profile: air
sensors:
- fan1_0
- inventory: /system/chassis/motherboard/fan3
cooling_zone: 0
cooling_profile: all
sensors:
- fan3_0
@@ -0,0 +1,21 @@
fans:
- inventory: /system/chassis/motherboard/fan2
cooling_zone: 0
cooling_profile: all
sensors:
- fan2_0
- inventory: /system/chassis/motherboard/fan0
cooling_zone: 0
cooling_profile: all
sensors:
- fan0_0
- inventory: /system/chassis/motherboard/fan1
cooling_zone: 0
cooling_profile: air
sensors:
- fan1_0
- inventory: /system/chassis/motherboard/fan3
cooling_zone: 0
cooling_profile: all
sensors:
- fan3_0
@@ -0,0 +1 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
@@ -0,0 +1,18 @@
conditions:
- name: air_cooled_chassis
type: getProperty
properties:
- property: WaterCooled
interface: xyz.openbmc_project.Inventory.Decorator.CoolingType
path: /xyz/openbmc_project/inventory/system/chassis
type: bool
value: false
- name: water_and_air_cooled_chassis
type: getProperty
properties:
- property: WaterCooled
interface: xyz.openbmc_project.Inventory.Decorator.CoolingType
path: /xyz/openbmc_project/inventory/system/chassis
type: bool
value: true
@@ -0,0 +1,18 @@
conditions:
- name: air_cooled_chassis
type: getProperty
properties:
- property: WaterCooled
interface: xyz.openbmc_project.Inventory.Decorator.CoolingType
path: /xyz/openbmc_project/inventory/system/chassis
type: bool
value: false
- name: water_and_air_cooled_chassis
type: getProperty
properties:
- property: WaterCooled
interface: xyz.openbmc_project.Inventory.Decorator.CoolingType
path: /xyz/openbmc_project/inventory/system/chassis
type: bool
value: true
@@ -0,0 +1 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
@@ -0,0 +1,68 @@
manager_configuration:
power_on_delay: 20
zone_configuration:
#Air cooled zones
- zone_conditions:
- name: air_cooled_chassis
zones:
- zone: 0
cooling_profiles:
- air
- all
full_speed: 9500
default_floor: 8000
increase_delay: 5
decrease_interval: 30
interfaces:
- name: xyz.openbmc_project.Control.ThermalMode
properties:
- name: Supported
type: array[string]
values:
- value: DEFAULT
description: >
Default thermal control mode
- name: Current
type: string
persist: true
values:
- value: DEFAULT
description: >
Set current thermal control mode to the
default which will be replaced on startup if
another supported mode was selected & persisted.
#Water cooled zones
- zone_conditions:
- name: water_and_air_cooled_chassis
zones:
- zone: 0
cooling_profiles:
- water
- all
full_speed: 9500
default_floor: 8000
increase_delay: 5
decrease_interval: 30
interfaces:
- name: xyz.openbmc_project.Control.ThermalMode
properties:
- name: Supported
type: array[string]
values:
- value: DEFAULT
description: >
Default thermal control mode
- name: Current
type: string
persist: true
values:
- value: DEFAULT
description: >
Set current thermal control mode to the
default which will be replaced on startup if
another supported mode was selected & persisted.
@@ -0,0 +1,100 @@
manager_configuration:
power_on_delay: 20
zone_configuration:
#Air cooled zones
- zone_conditions:
- name: air_cooled_chassis
zones:
- zone: 0
cooling_profiles:
- air
- all
full_speed: 10500
default_floor: 8000
increase_delay: 5
decrease_interval: 30
interfaces:
- name: xyz.openbmc_project.Control.ThermalMode
properties:
- name: Supported
type: array[string]
values:
- value: DEFAULT
description: >
Default thermal control mode
- value: CUSTOM
description: >
Custom thermal control mode for handling the use of
PCI cards located behind the GPU exhaust that
could overtemp where the default mode is not
sufficient enough.
- value: HEAVY_IO
description: >
Heavy IO thermal control mode for handling the use
of PCI cards that produce heavy IO utilization and
could overtemp.
- value: MAX_BASE_FAN_FLOOR
description: >
Maximum base fan floor mode is for handling the
use of any hardware that requires the highest
amount of cooling even when the system may be idle.
- name: Current
type: string
persist: true
values:
- value: DEFAULT
description: >
Set current thermal control mode to the
default which will be replaced on startup if
another selected mode was persisted.
#Water cooled zones
- zone_conditions:
- name: water_and_air_cooled_chassis
zones:
- zone: 0
cooling_profiles:
- water
- all
full_speed: 10500
default_floor: 8000
increase_delay: 5
decrease_interval: 30
interfaces:
- name: xyz.openbmc_project.Control.ThermalMode
properties:
- name: Supported
type: array[string]
values:
- value: DEFAULT
description: >
Default thermal control mode
- value: CUSTOM
description: >
Custom thermal control mode for handling the use of
PCI cards located behind the GPU exhaust that
could overtemp where the default mode is not
sufficient enough.
- value: HEAVY_IO
description: >
Heavy IO thermal control mode for handling the use
of PCI cards that produce heavy IO utilization and
could overtemp.
- value: MAX_BASE_FAN_FLOOR
description: >
Maximum base fan floor mode is for handling the
use of any hardware that requires the highest
amount of cooling even when the system may be idle.
- name: Current
type: string
persist: true
values:
- value: DEFAULT
description: >
Set current thermal control mode to the
default which will be replaced on startup if
another selected mode was persisted.
@@ -0,0 +1,36 @@
fans:
- inventory: /system/chassis/motherboard/fan0
functional_delay: 5
allowed_out_of_range_time: 30
deviation: 15
num_sensors_nonfunc_for_fan_nonfunc: 1
sensors:
- name: fan0_0
has_target: true
- inventory: /system/chassis/motherboard/fan1
functional_delay: 5
allowed_out_of_range_time: 30
deviation: 15
num_sensors_nonfunc_for_fan_nonfunc: 1
sensors:
- name: fan1_0
has_target: true
- inventory: /system/chassis/motherboard/fan2
functional_delay: 5
allowed_out_of_range_time: 30
deviation: 15
num_sensors_nonfunc_for_fan_nonfunc: 1
sensors:
- name: fan2_0
has_target: true
- inventory: /system/chassis/motherboard/fan3
functional_delay: 5
allowed_out_of_range_time: 30
deviation: 15
num_sensors_nonfunc_for_fan_nonfunc: 1
sensors:
- name: fan3_0
has_target: true
@@ -0,0 +1,62 @@
- name: fan0
path: /system/chassis/motherboard/fan0
methods:
- type: gpio
key: 5
physpath: /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a100.i2c-bus/i2c-3/3-0060
devpath: /dev/input/by-path/platform-gpio-keys-polled-event
- type: tach
sensors:
- fan0_0
rpolicy:
type: anyof
- name: fan1
path: /system/chassis/motherboard/fan1
methods:
- type: gpio
key: 6
physpath: /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a100.i2c-bus/i2c-3/3-0060
devpath: /dev/input/by-path/platform-gpio-keys-polled-event
- type: tach
sensors:
- fan1_0
rpolicy:
type: anyof
- name: fan2
path: /system/chassis/motherboard/fan2
methods:
- type: gpio
key: 7
physpath: /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a100.i2c-bus/i2c-3/3-0060
devpath: /dev/input/by-path/platform-gpio-keys-polled-event
- type: tach
sensors:
- fan2_0
rpolicy:
type: anyof
- name: fan3
path: /system/chassis/motherboard/fan3
methods:
- type: gpio
key: 8
physpath: /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a100.i2c-bus/i2c-3/3-0060
devpath: /dev/input/by-path/platform-gpio-keys-polled-event
- type: tach
sensors:
- fan3_0
rpolicy:
type: anyof
# Boost fan presence
- name: fan4
path: /system/chassis/motherboard/fan4
methods:
- type: gpio
key: 9
physpath: /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a100.i2c-bus/i2c-3/3-0060
devpath: /dev/input/by-path/platform-gpio-keys-polled-event
rpolicy:
type: anyof
@@ -0,0 +1,2 @@
[Unit]
Conflicts=obmc-fan-watchdog-takeover.target
@@ -0,0 +1,3 @@
[Unit]
#These overrides allow the fan watchdog to take over when this service dies
OnFailure=fan-watchdog-monitor@%n.service
@@ -0,0 +1,6 @@
OBJPATH="--path=/system/chassis"
AIR="--air"
WATER=""
DEVICE="--dev=/dev/input/by-path/platform-gpio-keys-event"
CODE="--event=13"
@@ -0,0 +1,14 @@
[Unit]
Description=Phosphor Cooling Type
Wants=mapper-wait@-xyz-openbmc_project-inventory.service
After=mapper-wait@-xyz-openbmc_project-inventory.service
ConditionPathExists={envfiledir}/obmc/phosphor-fan/phosphor-cooling-type-%i.conf
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile={envfiledir}/obmc/phosphor-fan/phosphor-cooling-type-%i.conf
ExecStart=/usr/bin/phosphor-cooling-type ${{OBJPATH}} ${{AIR}} ${{WATER}} ${{DEVICE}} ${{CODE}}
[Install]
RequiredBy=multi-user.target
@@ -0,0 +1,5 @@
OBJPATH="--path=/system/chassis"
AIR="--air"
WATER=""
DEVICE=""
CODE=""
@@ -0,0 +1,6 @@
OBJPATH="--path=/system/chassis"
AIR="--air"
WATER=""
DEVICE="--dev=/dev/input/by-path/platform-gpio-keys-event"
CODE="--event=13"
@@ -0,0 +1,14 @@
[Unit]
Description=Phosphor Cooling Type
Wants=mapper-wait@-xyz-openbmc_project-inventory.service
After=mapper-wait@-xyz-openbmc_project-inventory.service
ConditionPathExists={envfiledir}/obmc/phosphor-fan/phosphor-cooling-type-%i.conf
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile={envfiledir}/obmc/phosphor-fan/phosphor-cooling-type-%i.conf
ExecStart=/usr/bin/phosphor-cooling-type ${{OBJPATH}} ${{AIR}} ${{WATER}} ${{DEVICE}} ${{CODE}}
[Install]
RequiredBy=multi-user.target
@@ -0,0 +1,13 @@
[Unit]
Description=Phosphor Fan Control Daemon
Requires=xyz.openbmc_project.Hwmon@-ahb-apb-bus\x401e78a000-i2c\x2dbus\x40{ADDR}-max31785\x4052.service
After=xyz.openbmc_project.Hwmon@-ahb-apb-bus\x401e78a000-i2c\x2dbus\x40{ADDR}-max31785\x4052.service
Requires=phosphor-cooling-type@%i.service
After=phosphor-cooling-type@%i.service
[Service]
Restart=on-failure
ExecStart=/usr/bin/phosphor-fan-control --control
[Install]
RequiredBy=obmc-chassis-poweron@%i.target
@@ -0,0 +1,63 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
# Package configuration
FAN_PACKAGES:append:ibm-ac-server = " \
phosphor-cooling-type \
"
PACKAGECONFIG:append:ibm-ac-server = " cooling-type"
TMPL_COOLING = "phosphor-cooling-type@.service"
INSTFMT_COOLING = "phosphor-cooling-type@{0}.service"
MULTI_USR_TGT = "multi-user.target"
FMT_COOLING = "../${TMPL_COOLING}:${MULTI_USR_TGT}.requires/${INSTFMT_COOLING}"
FILES:phosphor-cooling-type:append:ibm-ac-server = " ${bindir}/phosphor-cooling-type"
SYSTEMD_SERVICE:phosphor-cooling-type:append:ibm-ac-server = " ${TMPL_COOLING}"
SYSTEMD_LINK:phosphor-cooling-type:append:ibm-ac-server = " ${@compose_list(d, 'FMT_COOLING', 'OBMC_CHASSIS_INSTANCES')}"
COOLING_ENV_FMT = "obmc/phosphor-fan/phosphor-cooling-type-{0}.conf"
SYSTEMD_ENVIRONMENT_FILE:phosphor-cooling-type:append:ibm-ac-server = " ${@compose_list(d, 'COOLING_ENV_FMT', 'OBMC_CHASSIS_INSTANCES')}"
#These services are protected by the watchdog
SYSTEMD_OVERRIDE:phosphor-fan-control:witherspoon += "fan-watchdog-monitor.conf:phosphor-fan-control-init@0.service.d/fan-watchdog-monitor.conf"
SYSTEMD_OVERRIDE:phosphor-fan-control:witherspoon += "fan-watchdog-monitor.conf:phosphor-fan-control@0.service.d/fan-watchdog-monitor.conf"
SYSTEMD_OVERRIDE:phosphor-fan-monitor:witherspoon += "fan-watchdog-monitor.conf:phosphor-fan-monitor-init@0.service.d/fan-watchdog-monitor.conf"
SYSTEMD_OVERRIDE:phosphor-fan-monitor:witherspoon += "fan-watchdog-monitor.conf:phosphor-fan-monitor@0.service.d/fan-watchdog-monitor.conf"
SYSTEMD_OVERRIDE:phosphor-fan-control:p10bmc += "fan-watchdog-monitor.conf:phosphor-fan-control-init@0.service.d/fan-watchdog-monitor.conf"
SYSTEMD_OVERRIDE:phosphor-fan-control:p10bmc += "fan-watchdog-monitor.conf:phosphor-fan-control@0.service.d/fan-watchdog-monitor.conf"
SYSTEMD_OVERRIDE:phosphor-fan-monitor:p10bmc += "fan-watchdog-monitor.conf:phosphor-fan-monitor-init@0.service.d/fan-watchdog-monitor.conf"
SYSTEMD_OVERRIDE:phosphor-fan-monitor:p10bmc += "fan-watchdog-monitor.conf:phosphor-fan-monitor@0.service.d/fan-watchdog-monitor.conf"
#These services need to be stopped when watchdog expires
SYSTEMD_OVERRIDE:phosphor-fan-control:witherspoon += "fan-watchdog-conflicts.conf:phosphor-fan-control@0.service.d/fan-watchdog-conflicts.conf"
SYSTEMD_OVERRIDE:phosphor-fan-monitor:witherspoon += "fan-watchdog-conflicts.conf:phosphor-fan-monitor@0.service.d/fan-watchdog-conflicts.conf"
SYSTEMD_OVERRIDE:phosphor-fan-control:p10bmc += "fan-watchdog-conflicts.conf:phosphor-fan-control@0.service.d/fan-watchdog-conflicts.conf"
SYSTEMD_OVERRIDE:phosphor-fan-monitor:p10bmc += "fan-watchdog-conflicts.conf:phosphor-fan-monitor@0.service.d/fan-watchdog-conflicts.conf"
# Witherspoon fan control service linking
# Link fan control init service
SYSTEMD_SERVICE:${PN}-control:witherspoon += "${TMPL_CONTROL} ${TMPL_CONTROL_INIT}"
SYSTEMD_LINK:${PN}-control:witherspoon += "${@compose_list(d, 'FMT_CONTROL_INIT', 'OBMC_CHASSIS_INSTANCES')}"
# Link fan control service to be started at standby
FMT_CONTROL_STDBY:witherspoon = "../${TMPL_CONTROL}:${MULTI_USR_TGT}.wants/${INSTFMT_CONTROL}"
SYSTEMD_LINK:${PN}-control:witherspoon += "${@compose_list(d, 'FMT_CONTROL_STDBY', 'OBMC_CHASSIS_INSTANCES')}"
# Link fan control service to also start at poweron
FMT_CONTROL_PWRON:witherspoon = "../${TMPL_CONTROL}:${POWERON_TGT}.requires/${INSTFMT_CONTROL}"
SYSTEMD_LINK:${PN}-control:witherspoon += "${@compose_list(d, 'FMT_CONTROL_PWRON', 'OBMC_CHASSIS_INSTANCES')}"
# Enable the use of JSON on the fan applications that support it
PACKAGECONFIG:append:witherspoon = " json"
EXTRA_OEMESON:append:witherspoon = " -Djson-control=disabled"
PACKAGECONFIG:append:p10bmc = " json sensor-monitor"
# Set the appropriate i2c address used within the overridden phosphor-fan-control@.service
# file that's used for witherspoon type(including witherspoon-tacoma) machines
SYSTEMD_SUBSTITUTIONS:witherspoon = "ADDR:100:phosphor-fan-control@.service"
SYSTEMD_SUBSTITUTIONS:witherspoon-tacoma = "ADDR:200:phosphor-fan-control@.service"
# Set the PKG_DEFAULT_MACHINE name to "witherspoon" for tacoma so witherspoon's
# JSON config files are installed on tacoma machines (since they use the same ones)
PKG_DEFAULT_MACHINE:witherspoon-tacoma = "witherspoon"