Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fby35: remove hardcode sensor number from common #420

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions common/service/ipmi/include/oem_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include "ipmi.h"

uint8_t get_hsc_pwr_reading(int *reading);

void OEM_NM_SENSOR_READ(ipmi_msg *msg);

#ifdef CONFIG_ESPI
Expand Down
10 changes: 7 additions & 3 deletions common/service/ipmi/oem_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@
#include "plat_fan.h"
#endif

__weak uint8_t get_hsc_pwr_reading(int *reading)
{
return SENSOR_NOT_FOUND;
}

#ifdef CONFIG_ESPI
__weak void OEM_NM_SENSOR_READ(ipmi_msg *msg)
{
if (msg == NULL) {
return;
}

uint8_t status, sensor_num;
uint8_t status;
int reading;

// only input enable status
Expand All @@ -25,8 +30,7 @@ __weak void OEM_NM_SENSOR_READ(ipmi_msg *msg)

// Follow INTEL NM SPEC, read platform pwr from HSC
if (msg->data[0] == 0x00) {
sensor_num = SENSOR_NUM_PWR_HSCIN;
status = get_sensor_reading(sensor_num, &reading, GET_FROM_CACHE);
status = get_hsc_pwr_reading(&reading);
} else {
msg->completion_code = CC_INVALID_DATA_FIELD;
return;
Expand Down
5 changes: 5 additions & 0 deletions meta-facebook/yv35-bb/src/platform/plat_sensor_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,8 @@ void load_sensor_config(void)
memcpy(sensor_config, plat_sensor_config, sizeof(plat_sensor_config));
sensor_config_count = ARRAY_SIZE(plat_sensor_config);
}

uint8_t get_hsc_pwr_reading(int *reading)
{
return get_sensor_reading(SENSOR_NUM_PWR_HSCIN, reading, GET_FROM_CACHE);
}
6 changes: 6 additions & 0 deletions meta-facebook/yv35-cl/src/platform/plat_sensor_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,3 +494,9 @@ bool pal_is_time_to_poll(uint8_t sensor_num, int poll_time)
printf("[%s] can't find sensor 0x%x last accest time\n", __func__, sensor_num);
return true;
}

uint8_t get_hsc_pwr_reading(int *reading)
{
return get_sensor_reading(SENSOR_NUM_PWR_HSCIN, reading, GET_FROM_CACHE);
}