mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-25 09:17:08 +00:00
fix sensors names and path.
Signed-off-by: Mykola Kostenok <c_mykolak@mellanox.com> Conflicts: packages/platforms/mellanox/x86-64/x86-64-mlnx-mqm8700/onlp/builds/src/module/src/thermali.c
This commit is contained in:
@@ -138,9 +138,12 @@ typedef struct mlnx_platform_info_s {
|
||||
|
||||
#define PSU1_ID 1
|
||||
#define PSU2_ID 2
|
||||
#define PSU_MODULE_PREFIX "/bsp/module/psu%d_%s"
|
||||
#define PSU_POWER_PREFIX "/bsp/power/psu%d_%s"
|
||||
#define IDPROM_PATH "/bsp/eeprom/%s%d_info"
|
||||
#define HW_MANAGEMENT_PATH "/var/run/hw-management"
|
||||
#define QSFP_PATH HW_MANAGEMENT_PATH"/qsfp"
|
||||
#define THERMAL_PATH "/var/run/hw-management/thermal"
|
||||
#define PSU_MODULE_PREFIX THERMAL_PATH"/psu%d_%s"
|
||||
#define PSU_POWER_PREFIX HW_MANAGEMENT_PATH"/power/psu%d_%s"
|
||||
#define IDPROM_PATH HW_MANAGEMENT_PATH"/eeprom/%s%d_info"
|
||||
|
||||
typedef enum psu_type {
|
||||
PSU_TYPE_UNKNOWN,
|
||||
|
||||
@@ -31,9 +31,6 @@
|
||||
#include "mlnx_common/mlnx_common.h"
|
||||
#include "mlnx_common_log.h"
|
||||
|
||||
#define PREFIX_PATH "/bsp/fan/"
|
||||
#define PREFIX_MODULE_PATH "/bsp/module/"
|
||||
|
||||
#define FAN_STATUS_OK 1
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
@@ -144,7 +141,7 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info)
|
||||
/* get fan status */
|
||||
fru_index = (local_id + mlnx_platform_info->fan_per_module -1) / mlnx_platform_info->fan_per_module;
|
||||
|
||||
ret = onlp_file_read_int(&r_val, "%s%s", PREFIX_MODULE_PATH, mlnx_platform_info->fan_fnames[fru_index].status);
|
||||
ret = onlp_file_read_int(&r_val, "%s/%s", THERMAL_PATH, mlnx_platform_info->fan_fnames[fru_index].status);
|
||||
if (ret < 0) {
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
@@ -158,7 +155,7 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info)
|
||||
info->status |= ONLP_FAN_STATUS_PRESENT;
|
||||
|
||||
/* get fan speed */
|
||||
ret = onlp_file_read_int(&r_val, "%s%s", PREFIX_PATH, mlnx_platform_info->fan_fnames[local_id].r_speed_get);
|
||||
ret = onlp_file_read_int(&r_val, "%s/%s", THERMAL_PATH, mlnx_platform_info->fan_fnames[local_id].r_speed_get);
|
||||
if (ret < 0) {
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
@@ -172,14 +169,14 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info)
|
||||
|
||||
if (ONLP_FAN_CAPS_GET_PERCENTAGE & info->caps) {
|
||||
/* get fan min speed */
|
||||
ret = onlp_file_read_int(&r_val, "%s%s", PREFIX_PATH, mlnx_platform_info->fan_fnames[local_id].min);
|
||||
ret = onlp_file_read_int(&r_val, "%s/%s", THERMAL_PATH, mlnx_platform_info->fan_fnames[local_id].min);
|
||||
if (ret < 0) {
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
mlnx_platform_info->min_fan_speed[local_id] = r_val;
|
||||
|
||||
/* get fan max speed */
|
||||
ret = onlp_file_read_int(&r_val, "%s%s", PREFIX_PATH, mlnx_platform_info->fan_fnames[local_id].max);
|
||||
ret = onlp_file_read_int(&r_val, "%s/%s", THERMAL_PATH, mlnx_platform_info->fan_fnames[local_id].max);
|
||||
if (ret < 0) {
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
@@ -214,7 +211,7 @@ _onlp_fani_info_get_fan_on_psu(int local_id, int psu_id, onlp_fan_info_t* info)
|
||||
mlnx_platform_info_t* mlnx_platform_info = get_platform_info();
|
||||
/* get fan status
|
||||
*/
|
||||
ret = onlp_file_read_int(&r_val, "%s%s", PREFIX_MODULE_PATH, mlnx_platform_info->fan_fnames[local_id].status);
|
||||
ret = onlp_file_read_int(&r_val, "%s/%s", THERMAL_PATH, mlnx_platform_info->fan_fnames[local_id].status);
|
||||
if (ret < 0) {
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
@@ -228,7 +225,7 @@ _onlp_fani_info_get_fan_on_psu(int local_id, int psu_id, onlp_fan_info_t* info)
|
||||
|
||||
/* get fan speed
|
||||
*/
|
||||
ret = onlp_file_read_int(&r_val, "%s%s", PREFIX_PATH, mlnx_platform_info->fan_fnames[local_id].r_speed_get);
|
||||
ret = onlp_file_read_int(&r_val, "%s/%s", THERMAL_PATH, mlnx_platform_info->fan_fnames[local_id].r_speed_get);
|
||||
if (ret < 0) {
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
@@ -325,7 +322,7 @@ onlp_fani_rpm_set(onlp_oid_t id, int rpm)
|
||||
|
||||
snprintf(r_data, sizeof(r_data), "%d", (int)temp);
|
||||
nbytes = strnlen(r_data, sizeof(r_data));
|
||||
rv = onlp_file_write((uint8_t*)r_data, nbytes, "%s%s", PREFIX_PATH,
|
||||
rv = onlp_file_write((uint8_t*)r_data, nbytes, "%s/%s", THERMAL_PATH,
|
||||
mlnx_platform_info->fan_fnames[local_id].r_speed_set);
|
||||
if (rv < 0) {
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
@@ -378,7 +375,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
|
||||
snprintf(r_data, sizeof(r_data), "%d", (int)temp);
|
||||
nbytes = strnlen(r_data, sizeof(r_data));
|
||||
rv = onlp_file_write((uint8_t*)r_data, nbytes, "%s%s", PREFIX_PATH,
|
||||
rv = onlp_file_write((uint8_t*)r_data, nbytes, "%s/%s", THERMAL_PATH,
|
||||
mlnx_platform_info->fan_fnames[local_id].r_speed_set);
|
||||
if (rv < 0) {
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
@@ -394,7 +391,7 @@ onlp_fani_get_min_rpm(int id)
|
||||
|
||||
mlnx_platform_info_t* mlnx_platform_info = get_platform_info();
|
||||
|
||||
if (onlp_file_read_int(&r_val, "%s%s", PREFIX_PATH, mlnx_platform_info->fan_fnames[id].min) < 0)
|
||||
if (onlp_file_read_int(&r_val, "%s/%s", THERMAL_PATH, mlnx_platform_info->fan_fnames[id].min) < 0)
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
|
||||
return r_val;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <mlnx_common/mlnx_common.h>
|
||||
|
||||
#define MAX_NUM_OF_CPLD 3
|
||||
#define PREFIX_PATH_ON_CPLD_DEV "/bsp/cpld"
|
||||
#define PREFIX_PATH_ON_CPLD_DEV HW_MANAGEMENT_PATH"/system"
|
||||
|
||||
mlnx_platform_info_t* get_platform_info(void);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <onlp/platformi/ledi.h>
|
||||
#include <mlnx_common/mlnx_common.h>
|
||||
|
||||
#define prefix_path "/bsp/led/led_"
|
||||
#define prefix_path HW_MANAGEMENT_PATH"/led/led_"
|
||||
#define driver_value_len 50
|
||||
|
||||
#define LED_MODE_OFF "none"
|
||||
|
||||
@@ -74,16 +74,16 @@ static char*
|
||||
mc_sfp_get_port_path(int port, char *node_name)
|
||||
{
|
||||
if (node_name)
|
||||
sprintf(sfp_node_path, "/bsp/qsfp/qsfp%d%s", port, node_name);
|
||||
sprintf(sfp_node_path, "%s/qsfp%d%s", QSFP_PATH, port, node_name);
|
||||
else
|
||||
sprintf(sfp_node_path, "/bsp/qsfp/qsfp%d", port);
|
||||
sprintf(sfp_node_path, "%s/qsfp%d", QSFP_PATH, port);
|
||||
return sfp_node_path;
|
||||
}
|
||||
|
||||
static char*
|
||||
mc_sfp_convert_i2c_path(int port, int devaddr)
|
||||
{
|
||||
sprintf(sfp_node_path, "/bsp/qsfp/qsfp%d", port);
|
||||
sprintf(sfp_node_path, "%s/qsfp%d", QSFP_PATH, port);
|
||||
return sfp_node_path;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <onlp/platformi/thermali.h>
|
||||
#include "mlnx_common/mlnx_common.h"
|
||||
|
||||
#define prefix_path "/bsp/thermal"
|
||||
#define prefix_path HW_MANAGEMENT_PATH"/thermal"
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
*
|
||||
* Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
* Thermal Sensor Platform Implementation.
|
||||
*
|
||||
***********************************************************/
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <AIM/aim_log.h>
|
||||
#include <onlplib/file.h>
|
||||
#include <onlplib/mmap.h>
|
||||
#include <onlp/platformi/thermali.h>
|
||||
#include "platform_lib.h"
|
||||
#include "mlnx_common/mlnx_common.h"
|
||||
|
||||
enum onlp_thermal_id
|
||||
{
|
||||
THERMAL_RESERVED = 0,
|
||||
THERMAL_CPU_CORE_0,
|
||||
THERMAL_CPU_CORE_1,
|
||||
THERMAL_CPU_PACK,
|
||||
THERMAL_ASIC,
|
||||
THERMAL_BOARD_AMB,
|
||||
THERMAL_PORT,
|
||||
THERMAL_ON_PSU1,
|
||||
THERMAL_ON_PSU2,
|
||||
};
|
||||
|
||||
static char* thermal_fnames[] = /* must map with onlp_thermal_id */
|
||||
{
|
||||
"reserved",
|
||||
"cpu_core0",
|
||||
"cpu_core1",
|
||||
"cpu_pack",
|
||||
"asic",
|
||||
"fan_amb",
|
||||
"port_amb",
|
||||
"psu1",
|
||||
"psu2"
|
||||
};
|
||||
|
||||
/* Static values */
|
||||
static onlp_thermal_info_t tinfo[] = {
|
||||
{ }, /* Not used */
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_CPU_CORE_0), "CPU Core 0", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, CPU_THERMAL_THRESHOLD_INIT_DEFAULTS
|
||||
},
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_CPU_CORE_1), "CPU Core 1", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, CPU_THERMAL_THRESHOLD_INIT_DEFAULTS
|
||||
},
|
||||
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_CPU_PACK), "CPU pack", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, CPU_THERMAL_THRESHOLD_INIT_DEFAULTS
|
||||
},
|
||||
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_ASIC), "Asic Thermal Sensor", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, ASIC_THERMAL_THRESHOLD_INIT_DEFAULTS
|
||||
},
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_BOARD_AMB), "Board AMB Thermal Sensor", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0, {0,0,0}
|
||||
},
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_PORT), "Port AMB Thermal Sensor", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0, {0,0,0}
|
||||
},
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_ON_PSU1), "PSU-1 Thermal Sensor 1", ONLP_PSU_ID_CREATE(PSU1_ID)},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0, {0,0,0}
|
||||
},
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_ON_PSU2), "PSU-2 Thermal Sensor 1", ONLP_PSU_ID_CREATE(PSU2_ID)},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0, {0,0,0}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* This will be called to intiialize the thermali subsystem.
|
||||
*/
|
||||
int
|
||||
onlp_thermali_init(void)
|
||||
{
|
||||
mlnx_platform_info_t* mlnx_platform_info = get_platform_info();
|
||||
mlnx_platform_info->tinfo=tinfo;
|
||||
mlnx_platform_info->thermal_fnames=thermal_fnames;
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ static char* thermal_fnames[] = /* must map with onlp_thermal_id */
|
||||
"cpu_core2",
|
||||
"cpu_core3",
|
||||
"asic",
|
||||
"board_amb",
|
||||
"fan_amb",
|
||||
"port_amb"
|
||||
};
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ static char* thermal_fnames[] = /* must map with onlp_thermal_id */
|
||||
"cpu_core2",
|
||||
"cpu_core3",
|
||||
"asic",
|
||||
"board_amb",
|
||||
"fan_amb",
|
||||
"port_amb"
|
||||
};
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ static char* thermal_fnames[] = /* must map with onlp_thermal_id */
|
||||
"cpu_core1",
|
||||
"cpu_pack",
|
||||
"asic",
|
||||
"board_amb",
|
||||
"fan_amb",
|
||||
"port_amb",
|
||||
"psu1",
|
||||
"psu2"
|
||||
|
||||
@@ -38,7 +38,7 @@ enum onlp_thermal_id
|
||||
THERMAL_CPU_CORE_1,
|
||||
THERMAL_CPU_PACK,
|
||||
THERMAL_ASIC,
|
||||
THERMAL_BOAR_AMB,
|
||||
THERMAL_BOARD_AMB,
|
||||
THERMAL_PORT,
|
||||
THERMAL_ON_PSU1,
|
||||
THERMAL_ON_PSU2,
|
||||
@@ -51,7 +51,7 @@ static char* thermal_fnames[] = /* must map with onlp_thermal_id */
|
||||
"cpu_core1",
|
||||
"cpu_pack",
|
||||
"asic",
|
||||
"board_amb",
|
||||
"fan_amb",
|
||||
"port_amb",
|
||||
"psu1",
|
||||
"psu2"
|
||||
@@ -76,7 +76,7 @@ static onlp_thermal_info_t tinfo[] = {
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, ASIC_THERMAL_THRESHOLD_INIT_DEFAULTS
|
||||
},
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_BOAR_AMB), "Board AMB Thermal Sensor", 0},
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_BOARD_AMB), "Board AMB Thermal Sensor", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0, {0,0,0}
|
||||
},
|
||||
|
||||
@@ -53,7 +53,7 @@ static char* thermal_fnames[] = /* must map with onlp_thermal_id */
|
||||
"cpu_core2",
|
||||
"cpu_core3",
|
||||
"asic",
|
||||
"board_amb",
|
||||
"fan_amb",
|
||||
"port_amb",
|
||||
"psu1",
|
||||
"psu2"
|
||||
|
||||
@@ -55,7 +55,7 @@ static char* thermal_fnames[] = /* must map with onlp_thermal_id */
|
||||
"cpu_core3",
|
||||
"cpu_pack",
|
||||
"asic",
|
||||
"board_amb",
|
||||
"fan_amb",
|
||||
"port_amb",
|
||||
"psu1",
|
||||
"psu2"
|
||||
|
||||
Reference in New Issue
Block a user