diff --git a/packages/platforms/delta/x86-64/x86-64-delta-ag9032v1/onlp/builds/src/module/src/platform_lib.h b/packages/platforms/delta/x86-64/x86-64-delta-ag9032v1/onlp/builds/src/module/src/platform_lib.h index 6146baaa..adcd9ee8 100644 --- a/packages/platforms/delta/x86-64/x86-64-delta-ag9032v1/onlp/builds/src/module/src/platform_lib.h +++ b/packages/platforms/delta/x86-64/x86-64-delta-ag9032v1/onlp/builds/src/module/src/platform_lib.h @@ -30,6 +30,7 @@ #include #include + /* CPLD numbrt & peripherals */ #define NUM_OF_THERMAL_ON_BOARDS 6 #define NUM_OF_FAN_ON_FAN_BOARD 10 @@ -87,9 +88,10 @@ #define PSU_STATUS_PRESENT (1) #define PSU_NODE_MAX_PATH_LEN (64) #define FAN_SPEED_NORMALLY (5) -#define SPEED_25_PERCENTAGE (25) -#define SPEED_50_PERCENTAGE (50) -#define SPEED_75_PERCENTAGE (75) +#define SPEED_30_PERCENTAGE (30) +#define SPEED_40_PERCENTAGE (40) +#define SPEED_60_PERCENTAGE (60) +#define SPEED_80_PERCENTAGE (80) #define SPEED_100_PERCENTAGE (100) #define FAN_ZERO_TACH (960) @@ -177,11 +179,11 @@ typedef enum { THERMAL_RESERVED = 0, THERMAL_CPU_CORE, - THERMAL_1_ON_CPU_BOARD, - THERMAL_2_ON_FAN_BOARD, - THERMAL_3_ON_SW_BOARD, - THERMAL_4_ON_SW_BOARD, - THERMAL_5_ON_SW_BOARD, + THERMAL_1_ON_CPU_BOARD, //U57 + THERMAL_2_ON_FAN_BOARD, //U334 + THERMAL_3_ON_SW_BOARD, //U38 + THERMAL_4_ON_SW_BOARD, //U40 + THERMAL_5_ON_SW_BOARD, //U240 THERMAL_1_ON_PSU1, THERMAL_1_ON_PSU2, } onlp_thermal_id; @@ -217,5 +219,23 @@ typedef enum LED_REAR_FAN_TRAY_5 }onlp_led_id; +typedef enum +{ + LEVEL_1=0, //worse zone + LEVEL_2, + LEVEL_3, + LEVEL_4, + LEVEL_5, + LEVEL_6 // good and save zone +}thermal_level_t; + +typedef struct thermal_fan_s +{ + int temp_H[6]; //high tmp LV1_LV6 + int temp_L[6]; //low tmp LV1_LV6 + int current_lv; +}thermal_fan_t; + + #endif /* __PLATFORM_LIB_H__ */ diff --git a/packages/platforms/delta/x86-64/x86-64-delta-ag9032v1/onlp/builds/src/module/src/sysi.c b/packages/platforms/delta/x86-64/x86-64-delta-ag9032v1/onlp/builds/src/module/src/sysi.c index 11a10fbe..e0415c17 100644 --- a/packages/platforms/delta/x86-64/x86-64-delta-ag9032v1/onlp/builds/src/module/src/sysi.c +++ b/packages/platforms/delta/x86-64/x86-64-delta-ag9032v1/onlp/builds/src/module/src/sysi.c @@ -38,6 +38,17 @@ #include "x86_64_delta_ag9032v1_log.h" #include "platform_lib.h" +// U57 , U334 ,U38,U40 ,U240 +static thermal_fan_t thermal_level[5]={ + { {200,64,60,56,52,45},{65,58,54,50,46,0},9}, + { {200,64,60,56,52,45},{65,58,54,50,46,0},9}, + { {200,79,75,71,67,63},{82,73,69,65,61,0},9}, + { {200,69,65,61,57,53},{71,63,59,55,51,0},9}, + { {200,54,49,44,39,39},{55,46,41,36,0,0},9} +}; + + + const char* onlp_sysi_platform_get(void) { @@ -121,15 +132,16 @@ onlp_sysi_oids_get(onlp_oid_t* table, int max) { *e++ = ONLP_PSU_ID_CREATE(i); } - return 0; } int onlp_sysi_platform_manage_fans(void) { - int i = 0; + int i=0,j=0; int highest_temp = 0; + int current_temp = 0; + int highest_lv = LEVEL_6; onlp_thermal_info_t thermal[8]; int new_duty_percentage; /* Get current temperature @@ -149,35 +161,51 @@ onlp_sysi_platform_manage_fans(void) { onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(i), new_duty_percentage); } - AIM_LOG_ERROR("Unable to read thermal status"); return ONLP_STATUS_E_INTERNAL; } - for (i = 0; i < 8; i++) - { - if (thermal[i].mcelsius > highest_temp) - { - highest_temp = thermal[i].mcelsius; + + for(i=0;i<5;i++){ + current_temp=thermal[i+1].mcelsius/1000; + if(thermal_level[i].current_lv == 9){ // initialize the temp level + thermal_level[i].current_lv = LEVEL_4; } + j=thermal_level[i].current_lv; + if(current_temp < thermal_level[i].temp_L[j] && thermal_level[i].current_lv < LEVEL_6 ){ // goto lower level + thermal_level[i].current_lv++; + } + else if(current_temp > thermal_level[i].temp_H[j] && thermal_level[i].current_lv > LEVEL_1 ){ // goto upper level + thermal_level[i].current_lv--; + } + else{ // keep in curent level + // keep in the curent level and + } + if(highest_lv > thermal_level[i].current_lv) + highest_lv = thermal_level[i].current_lv; //update the highest level } + + switch (highest_lv) + { + case LEVEL_1: + case LEVEL_2: + new_duty_percentage = SPEED_100_PERCENTAGE; + break; + case LEVEL_3: + new_duty_percentage = SPEED_80_PERCENTAGE; + break; + case LEVEL_4: + new_duty_percentage = SPEED_60_PERCENTAGE; + break; + case LEVEL_5: + new_duty_percentage = SPEED_40_PERCENTAGE; + break; + case LEVEL_6: + new_duty_percentage = SPEED_30_PERCENTAGE; + break; + default: + new_duty_percentage = SPEED_100_PERCENTAGE; + break; - highest_temp = highest_temp/1000; - - if (highest_temp > 0 && highest_temp <= 30) - { - new_duty_percentage = SPEED_25_PERCENTAGE; - } - else if (highest_temp > 30 && highest_temp <= 40) - { - new_duty_percentage = SPEED_50_PERCENTAGE; - } - else if (highest_temp > 40 && highest_temp <= 50) - { - new_duty_percentage = SPEED_75_PERCENTAGE; - } - else - { - new_duty_percentage = SPEED_100_PERCENTAGE; } /* Set speed on fan 1-10*/ for(i = 1 ; i <= 10; i++) @@ -189,7 +217,7 @@ onlp_sysi_platform_manage_fans(void) */ if(highest_temp >= 0 && highest_temp <= 55) { - new_duty_percentage = SPEED_50_PERCENTAGE; + new_duty_percentage = SPEED_60_PERCENTAGE; } else if(highest_temp > 55) {