Skip to content

Commit

Permalink
show sensor: add critical controller temperatures
Browse files Browse the repository at this point in the history
Signed-off-by: Amy Wang <[email protected]>
Signed-off-by: Juston Li <[email protected]>
  • Loading branch information
Amy2Wang authored and Juston Li committed Aug 9, 2018
1 parent 57fcc1c commit 63b8823
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
6 changes: 4 additions & 2 deletions DcpmemPkg/cli/ShowSensorCommand.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,9 @@ ShowSensor(
**/
if (!DisplayOptionSet || (DisplayOptionSet && ContainsValue(pDisplayValues, LOWER_THRESHOLD_CRITICAL_STR))) {
switch (Index2) {
case SENSOR_TYPE_CONTROLLER_TEMPERATURE:
case SENSOR_TYPE_MEDIA_TEMPERATURE:
// Only Media temperature sensor got lower critical threshold
// Only Media temperature sensor and Controller Temperature Sensor got lower critical threshold
pTempBuff = GetSensorValue(DimmSensorsSet[Index2].CriticalLowerThreshold, DimmSensorsSet[Index2].Type);
break;
default:
Expand All @@ -400,8 +401,9 @@ ShowSensor(
**/
if (!DisplayOptionSet || (DisplayOptionSet && ContainsValue(pDisplayValues, UPPER_THRESHOLD_CRITICAL_STR))) {
switch (Index2) {
case SENSOR_TYPE_CONTROLLER_TEMPERATURE:
case SENSOR_TYPE_MEDIA_TEMPERATURE:
// Only Media temperature sensor got upper critical threshold
// Only Media temperature sensor and Controller Temperature Sensor got lower critical threshold
pTempBuff = GetSensorValue(DimmSensorsSet[Index2].CriticalUpperThreshold, DimmSensorsSet[Index2].Type);
break;
default:
Expand Down
10 changes: 6 additions & 4 deletions DcpmemPkg/common/NvmHealth.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,19 @@ GetSensorsInfo(

/** Copy SMART & Health values **/
DimmSensorsSet[SENSOR_TYPE_MEDIA_TEMPERATURE].Value = SensorInfo.MediaTemperature;
DimmSensorsSet[SENSOR_TYPE_MEDIA_TEMPERATURE].CriticalLowerThreshold = SensorInfo.MediaThrottlingStopThresh;
DimmSensorsSet[SENSOR_TYPE_MEDIA_TEMPERATURE].CriticalUpperThreshold = SensorInfo.MediaThrottlingStartThresh;
DimmSensorsSet[SENSOR_TYPE_MEDIA_TEMPERATURE].FatalThreshold = SensorInfo.MediaTempShutdownThresh;
DimmSensorsSet[SENSOR_TYPE_CONTROLLER_TEMPERATURE].Value = SensorInfo.ControllerTemperature;
DimmSensorsSet[SENSOR_TYPE_CONTROLLER_TEMPERATURE].FatalThreshold = SensorInfo.ContrTempShutdownThresh;
DimmSensorsSet[SENSOR_TYPE_CONTROLLER_TEMPERATURE].CriticalLowerThreshold = SensorInfo.ControllerThrottlingStopThresh;
DimmSensorsSet[SENSOR_TYPE_CONTROLLER_TEMPERATURE].CriticalUpperThreshold = SensorInfo.ControllerThrottlingStartThresh;
DimmSensorsSet[SENSOR_TYPE_PERCENTAGE_REMAINING].Value = SensorInfo.PercentageRemaining;
DimmSensorsSet[SENSOR_TYPE_POWER_CYCLES].Value = SensorInfo.PowerCycles;
DimmSensorsSet[SENSOR_TYPE_POWER_ON_TIME].Value = SensorInfo.PowerOnTime;
DimmSensorsSet[SENSOR_TYPE_DIRTY_SHUTDOWNS].Value = SensorInfo.DirtyShutdowns;
DimmSensorsSet[SENSOR_TYPE_FW_ERROR_COUNT].Value = SensorInfo.MediaErrorCount + SensorInfo.ThermalErrorCount;
DimmSensorsSet[SENSOR_TYPE_UP_TIME].Value = SensorInfo.UpTime;
DimmSensorsSet[SENSOR_TYPE_MEDIA_TEMPERATURE].CriticalLowerThreshold = SensorInfo.MediaThrottlingStopThresh;
DimmSensorsSet[SENSOR_TYPE_MEDIA_TEMPERATURE].CriticalUpperThreshold = SensorInfo.MediaThrottlingStartThresh;
DimmSensorsSet[SENSOR_TYPE_MEDIA_TEMPERATURE].FatalThreshold = SensorInfo.MediaTempShutdownThresh;
DimmSensorsSet[SENSOR_TYPE_CONTROLLER_TEMPERATURE].FatalThreshold = SensorInfo.ContrTempShutdownThresh;

/** Determine Health State based on Health Status Bit Mask **/
ConvertHealthBitmask(SensorInfo.HealthStatus, &DimmHealthState);
Expand Down
2 changes: 2 additions & 0 deletions DcpmemPkg/common/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ typedef struct _SENSOR_INFO {
INT16 MediaTempShutdownThresh; ///< Media temperature shutdown threshold in C
INT16 MediaThrottlingStartThresh; ///< Media throttling start temperature threshold in C
INT16 MediaThrottlingStopThresh; ///< Media throttling stop temperature threshold in C
INT16 ControllerThrottlingStartThresh;///< Controller throttling stop temperature threshold in C
INT16 ControllerThrottlingStopThresh; ///< Controller throttling stop temperature threshold in C
} SENSOR_INFO;

/**
Expand Down
4 changes: 3 additions & 1 deletion DcpmemPkg/driver/Core/NvmDimmPassThru.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ typedef struct {
TEMPERATURE MediaShutdownThreshold;
TEMPERATURE MediaThrottlingStartThreshold;
TEMPERATURE MediaThrottlingStopThreshold;
UINT8 Reserved[120];
TEMPERATURE ControllerThrottlingStartThreshold;
TEMPERATURE ControllerThrottlingStopThreshold;
UINT8 Reserved[116];
} PT_DEVICE_CHARACTERISTICS_PAYLOAD;

/**
Expand Down
4 changes: 4 additions & 0 deletions DcpmemPkg/driver/Protocol/Driver/NvmDimmConfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -2346,6 +2346,10 @@ GetSmartAndHealth (
/** Get Device Characteristics data **/
pSensorInfo->ContrTempShutdownThresh =
TransformFwTempToRealValue(pDevCharacteristics->ControllerShutdownThreshold);
pSensorInfo->ControllerThrottlingStartThresh =
TransformFwTempToRealValue(pDevCharacteristics->ControllerThrottlingStartThreshold);
pSensorInfo->ControllerThrottlingStopThresh =
TransformFwTempToRealValue(pDevCharacteristics->ControllerThrottlingStopThreshold);
pSensorInfo->MediaTempShutdownThresh =
TransformFwTempToRealValue(pDevCharacteristics->MediaShutdownThreshold);
pSensorInfo->MediaThrottlingStartThresh =
Expand Down

0 comments on commit 63b8823

Please sign in to comment.