Support temp sensor on MCU which is available from I2C
Chassis MCU exposes register to report temperature for the peripheral board.
The MCU access is configurable as below:
{
"Bus": $bus,
"Address": "0xAA",
"Reg": "0xBB",
"Class": "MCUTemp",
"Name": "MCU Temp",
"Thresholds": [
xxx
]
"Type": "MCUTempSensor"
}
Tested:
The below interface was found under temperature sensor namespace:
└─/xyz/openbmc_project/sensors/temperature/MCU_Temp
Run ipmitool sensor and check below from list:
MCU Temp | 30.175 | degrees C | cr | na | 0.000 | 5.000 | 110.000 | 115.000 | na
Change-Id: I8d54455ccc39ea4f60a5b4aee5c68be092d39a72
Signed-off-by: Yuan Li <yuan.li@linux.intel.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8279694..af1a41c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,7 @@
option (DISABLE_HWMON_TEMP "Disable installing hwmon temp sensor" OFF)
option (DISABLE_INTRUSION "Disable installing intrusion sensor" OFF)
option (DISABLE_IPMB "Disable installing IPMB sensor" OFF)
+option (DISABLE_MCUTEMP "Disable installing MCU temperature sensor" OFF)
option (DISABLE_PSU "Disable installing PSU sensor" OFF)
include ("cmake/HunterGate.cmake")
@@ -42,6 +43,8 @@
set (IPMB_SRC_FILES src/Utils.cpp src/Thresholds.cpp)
+set (MCUTEMP_SRC_FILES src/Utils.cpp src/Thresholds.cpp)
+
set (PSU_SRC_FILES src/Utils.cpp src/PSUSensor.cpp src/Thresholds.cpp
src/PwmSensor.cpp src/PSUEvent.cpp)
@@ -151,6 +154,11 @@
add_dependencies (ipmbsensor sdbusplus-project)
target_link_libraries (ipmbsensor ${SENSOR_LINK_LIBS})
+add_executable (mcutempsensor src/MCUTempSensor.cpp ${MCUTEMP_SRC_FILES})
+add_dependencies (mcutempsensor sdbusplus-project)
+target_link_libraries (mcutempsensor ${SENSOR_LINK_LIBS})
+target_link_libraries (mcutempsensor i2c)
+
add_executable (psusensor src/PSUSensorMain.cpp ${PSU_SRC_FILES})
add_dependencies (psusensor sdbusplus-project)
target_link_libraries (psusensor ${SENSOR_LINK_LIBS})
@@ -163,6 +171,7 @@
add_dependencies (hwmontempsensor ${EXTERNAL_PACKAGES})
add_dependencies (intrusionsensor ${EXTERNAL_PACKAGES})
add_dependencies (ipmbsensor ${EXTERNAL_PACKAGES})
+ add_dependencies (mcutempsensor ${EXTERNAL_PACKAGES})
add_dependencies (psusensor ${EXTERNAL_PACKAGES})
endif ()
@@ -223,6 +232,13 @@
DESTINATION ${SERVICE_FILE_INSTALL_DIR})
endif ()
+if (NOT DISABLE_MCUTEMP)
+ install (TARGETS mcutempsensor DESTINATION bin)
+ install (FILES
+ ${SERVICE_FILE_SRC_DIR}/xyz.openbmc_project.mcutempsensor.service
+ DESTINATION ${SERVICE_FILE_INSTALL_DIR})
+endif ()
+
if (NOT DISABLE_PSU)
install (TARGETS psusensor DESTINATION bin)
install (FILES