Skip to content

Commit

Permalink
[Edgecore][as9516-32d] Modify curl element number definition
Browse files Browse the repository at this point in the history
Modify curl element number definition

Signed-off-by: Willy Liu <[email protected]>
  • Loading branch information
WillyLiu-EC committed May 30, 2023
1 parent 9f6a39d commit c99dedc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ onlp_fan_info_t finfo[] = {
PSU_FAN_INFO(2)
};

static uint32_t farr[FAN_NUM_ELE];
static uint32_t ps[PS_NUM_ELE];
static uint32_t farr[curl_data_fan_num];
static uint32_t ps[curl_data_psu_num];
/*
* This function will be called prior to all of onlp_fani_* functions.
*/
Expand All @@ -83,7 +83,7 @@ void fan_call_back(void *p)
char str[20];
const char *ptr = (const char *)p;

for (i = 0; i < FAN_NUM_ELE; i++) {
for (i = 0; i < curl_data_fan_num; i++) {
farr[i] = 0;
}

Expand Down Expand Up @@ -111,7 +111,7 @@ void fan_call_back(void *p)

str[j] = '\0';

if (k < FAN_NUM_ELE)
if (k < curl_data_fan_num)
{
if (k == 0)
farr[k] = atoi(str+1);
Expand Down Expand Up @@ -139,7 +139,7 @@ static void ps_call_back(void *p)
char str[32];
const char *ptr = (const char *)p;

for (i = 0; i < PS_NUM_ELE; i++)
for (i = 0; i < curl_data_psu_num; i++)
ps[i] = 0;

if (ptr == NULL)
Expand Down Expand Up @@ -175,7 +175,7 @@ static void ps_call_back(void *p)

str[j] = '\0';

if (k < PS_NUM_ELE)
if (k < curl_data_psu_num)
{
/* There are three string - model name/serial/model ver */
if ((k < curl_data_loc_psu_model_name) || (k > curl_data_loc_psu_model_ver))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,8 @@
#define PSU_PRESENT true
#define PSU_ABSCENT false
#define MAX_PSU_FAN_SPEED 23000

#define TMP_NUM_ELE 7
#define PS_NUM_ELE 12

#define PS_DESC_LEN 32
#define FAN_NUM_ELE 6

/* CURL data status */
#define curl_data_normal 0
#define curl_data_fan_present 1
Expand All @@ -75,7 +71,8 @@ enum curl_loc_data_thermal
curl_data_loc_thermal_3_4a,
curl_data_loc_thermal_3_4b,
curl_data_loc_thermal_3_4c_max6658,
curl_data_loc_thermal_3_4d
curl_data_loc_thermal_3_4d,
curl_data_thermal_num
};
/* CURL data location - PSU */
enum curl_loc_data_psu
Expand All @@ -88,10 +85,11 @@ enum curl_loc_data_psu
curl_data_loc_psu_fan,
curl_data_loc_psu_fan_status,
curl_data_loc_psu_present,
load_share,
curl_data_loc_psu_load_share,
curl_data_loc_psu_model_name,
curl_data_loc_psu_mode_serial,
curl_data_loc_psu_model_ver
curl_data_loc_psu_model_ver,
curl_data_psu_num
};
/* CURL data location - FAN */
enum curl_loc_data_fan
Expand All @@ -101,7 +99,8 @@ enum curl_loc_data_fan
curl_data_loc_fan_front_rpm,
curl_data_loc_fan_rear_rpm,
curl_data_loc_fan_pwm,
curl_data_loc_fan_present
curl_data_loc_fan_present,
curl_data_fan_num
};

#define BMC_CURL_PREFIX "http://[fe80::ff:fe00:1%usb0]:8080/api/sys/bmc/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#define MODEL_LEN 21
#define SERIAL_LEN 18
#define STRING_STRAT_LOC 2
static uint32_t ps[PS_NUM_ELE];
static uint32_t ps[curl_data_psu_num];
static char ps_model[PS_DESC_LEN];
static char ps_serial[PS_DESC_LEN];
static char ps_rev[PS_DESC_LEN];
Expand Down Expand Up @@ -71,7 +71,7 @@ static void ps_call_back(void *p)
ps_presence = PSU_ABSCENT;
const char *ptr = (const char *)p;

for (i = 0; i < PS_NUM_ELE; i++)
for (i = 0; i < curl_data_psu_num; i++)
ps[i] = 0;

if (ptr == NULL)
Expand Down Expand Up @@ -120,7 +120,7 @@ static void ps_call_back(void *p)
}

str[j] = '\0';
if (k < PS_NUM_ELE)
if (k < curl_data_psu_num)
{
/* There are three string - model name/serial/model ver */
if ((k < curl_data_loc_psu_model_name) || (k > curl_data_loc_psu_model_ver))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ static char* cpu_coretemp_files[] =
NULL,
};

static uint32_t tmp[TMP_NUM_ELE] = {0};
static int curl_thermal_data_loc[TMP_NUM_ELE] =
static uint32_t tmp[curl_data_thermal_num] = {0};
static int curl_thermal_data_loc[curl_data_thermal_num] =
{
curl_data_loc_psu_status,
/* 3-0048 tmp75_3_48_temp */
Expand Down Expand Up @@ -107,7 +107,7 @@ void tmp_call_back(void *p)
char str[40];
char *ptr = p;

for (i = 0; i < TMP_NUM_ELE; i++)
for (i = 0; i < curl_data_thermal_num; i++)
tmp[i] = -1;

if (ptr == NULL)
Expand Down Expand Up @@ -137,7 +137,7 @@ void tmp_call_back(void *p)

str[j] = '\0';

if (k < TMP_NUM_ELE)
if (k < curl_data_thermal_num)
{
if (k == 0)
tmp[k] = atoi(str+1);
Expand Down

0 comments on commit c99dedc

Please sign in to comment.