From c174e4f7175c49423b5afa87ac5d16b3398092fe Mon Sep 17 00:00:00 2001 From: marshallZhan Date: Wed, 24 Aug 2022 22:03:01 -0700 Subject: [PATCH] fby3: dl: support OEM get reading command for ME (#513) Summary: - Since the HSC has multiple sources, the ME will get power readings from the bic. Pull Request resolved: https://github.com/facebook/OpenBIC/pull/513 Test Plan: 1. Build code : pass 2. IPMI oem command: root@bmc-oob:~# bic-util slot2 0xc0 0xe2 0x0 0x0 0x0 00 17 00 3. Check the power reading from me: root@bmc-oob:~# me-util slot2 0xb8 0xc8 0x57 0x01 0x00 0x1 0x0 0x0 57 01 00 18 00 17 00 21 00 18 00 FF FF FF FF EF 2E 00 00 50 Reviewed By: garnermic Differential Revision: D38989044 Pulled By: GoldenBug fbshipit-source-id: 9ee622ba0e0658fc123d92537590acf18861bfad --- meta-facebook/yv3-dl/src/platform/plat_sensor_table.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/meta-facebook/yv3-dl/src/platform/plat_sensor_table.c b/meta-facebook/yv3-dl/src/platform/plat_sensor_table.c index 4e41e783d0..cba52bbd8c 100644 --- a/meta-facebook/yv3-dl/src/platform/plat_sensor_table.c +++ b/meta-facebook/yv3-dl/src/platform/plat_sensor_table.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "plat_sensor_table.h" #include "sensor.h" #include "ast_adc.h" @@ -16,6 +17,8 @@ #include "libutil.h" #include "util_sys.h" +LOG_MODULE_DECLARE(sensor); + struct k_mutex vr_page_mutex; sensor_cfg plat_sensor_config[] = { @@ -366,3 +369,9 @@ void pal_extend_sensor_config() return; } + +uint8_t get_hsc_pwr_reading(int *reading) +{ + CHECK_NULL_ARG_WITH_RETURN(reading, SENSOR_UNSPECIFIED_ERROR); + return get_sensor_reading(SENSOR_NUM_HSC_PIN, reading, GET_FROM_CACHE); +}