@@ -65,6 +65,14 @@ int pldm::responder::oem_ibm_platform::Handler::
65
65
sensorOpState = fetchRealSAIStatus ();
66
66
presentState = PLDM_SENSOR_NORMAL;
67
67
}
68
+ else if ((entityType == PLDM_ENTITY_MEMORY_MODULE) &&
69
+ (stateSetId == PLDM_OEM_IBM_SBE_DUMP_UPDATE_STATE))
70
+ {
71
+ sensorOpState = fetchDimmStateSensor (entityInstance);
72
+ stateField.push_back ({PLDM_SENSOR_ENABLED, PLDM_SENSOR_UNKNOWN,
73
+ PLDM_SENSOR_UNKNOWN, sensorOpState});
74
+ break ;
75
+ }
68
76
else
69
77
{
70
78
rc = PLDM_PLATFORM_INVALID_STATE_VALUE;
@@ -161,9 +169,14 @@ int pldm::responder::oem_ibm_platform::Handler::
161
169
162
170
else
163
171
{
164
- error (" Invalid entity type received: {ENTITY_TYPE}" , " ENTITY_TYPE" ,
165
- entityType);
172
+ error (
173
+ " Invalid entity type received: {ENTITY_TYPE} for entityInstance '{INSTANCE}'" ,
174
+ " ENTITY_TYPE" , entityType, " INSTANCE" , entityInstance);
175
+ return PLDM_ERROR_INVALID_DATA;
166
176
}
177
+ info (
178
+ " Processing setNumericEffecter on ID {ID} for effecter type {TYPE} and entity instance {INST}" ,
179
+ " ID" , effecterId, " TYPE" , entityType, " INST" , entityInstance);
167
180
rc = setNumericEffecter (entityInstance, value, entityType);
168
181
}
169
182
return rc;
@@ -879,6 +892,57 @@ void buildAllNumericEffecterDimmPDR(oem_ibm_platform::Handler* platformHandler,
879
892
}
880
893
}
881
894
895
+ void buildAllDimmSensorPDR (oem_ibm_platform::Handler* platformHandler,
896
+ uint16_t entityType, uint16_t stateSetID,
897
+ pdr_utils::Repo& repo)
898
+ {
899
+ size_t pdrSize = 0 ;
900
+ pdrSize = sizeof (pldm_state_sensor_pdr) +
901
+ sizeof (state_sensor_possible_states);
902
+ std::vector<uint8_t > entry{};
903
+ entry.resize (pdrSize);
904
+ pldm_state_sensor_pdr* pdr =
905
+ reinterpret_cast <pldm_state_sensor_pdr*>(entry.data ());
906
+ if (!pdr)
907
+ {
908
+ error (" Failed to get record by PDR type, ERROR:{ERR}" , " ERR" , lg2::hex,
909
+ static_cast <unsigned >(PLDM_PLATFORM_INVALID_SENSOR_ID));
910
+ return ;
911
+ }
912
+ auto dimm_info = platformHandler->generateDimmIds ();
913
+ for (const auto & dimm : dimm_info)
914
+ {
915
+ pdr->hdr .record_handle = 0 ;
916
+ pdr->hdr .version = 1 ;
917
+ pdr->hdr .type = PLDM_STATE_SENSOR_PDR;
918
+ pdr->hdr .record_change_num = 0 ;
919
+ pdr->hdr .length = sizeof (pldm_state_sensor_pdr) - sizeof (pldm_pdr_hdr);
920
+ pdr->terminus_handle = TERMINUS_HANDLE;
921
+ pdr->sensor_id = platformHandler->getNextSensorId ();
922
+ pdr->entity_type = entityType;
923
+ pdr->entity_instance = dimm;
924
+ dumpStatusMap[dimm] = DimmDumpState::UNAVAILABLE;
925
+ pdr->container_id = 1 ;
926
+ pdr->sensor_init = PLDM_NO_INIT;
927
+ pdr->sensor_auxiliary_names_pdr = false ;
928
+ pdr->composite_sensor_count = 1 ;
929
+
930
+ auto * possibleStatesPtr = pdr->possible_states ;
931
+ auto possibleStates =
932
+ reinterpret_cast <state_sensor_possible_states*>(possibleStatesPtr);
933
+ possibleStates->state_set_id = stateSetID;
934
+ possibleStates->possible_states_size = 1 ;
935
+ auto state =
936
+ reinterpret_cast <state_sensor_possible_states*>(possibleStates);
937
+ if (stateSetID == PLDM_OEM_IBM_SBE_DUMP_UPDATE_STATE)
938
+ state->states [0 ].byte = 7 ;
939
+ pldm::responder::pdr_utils::PdrEntry pdrEntry{};
940
+ pdrEntry.data = entry.data ();
941
+ pdrEntry.size = pdrSize;
942
+ repo.addRecord (pdrEntry);
943
+ }
944
+ }
945
+
882
946
void pldm::responder::oem_ibm_platform::Handler::buildOEMPDR (
883
947
pdr_utils::Repo& repo)
884
948
{
@@ -943,6 +1007,8 @@ void pldm::responder::oem_ibm_platform::Handler::buildOEMPDR(
943
1007
buildAllNumericEffecterDimmPDR (
944
1008
this , PLDM_ENTITY_MEMORY_MODULE, ENTITY_INSTANCE_0,
945
1009
PLDM_OEM_IBM_SBE_SEMANTIC_ID, repo, instanceDimmMap);
1010
+ buildAllDimmSensorPDR (this , PLDM_ENTITY_MEMORY_MODULE,
1011
+ PLDM_OEM_IBM_SBE_DUMP_UPDATE_STATE, repo);
946
1012
auto sensorId = findStateSensorId (
947
1013
repo.getPdr (), 0 , PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
948
1014
ENTITY_INSTANCE_0, 1 , PLDM_OEM_IBM_VERIFICATION_STATE);
@@ -1014,15 +1080,59 @@ int encodeEventMsg(uint8_t eventType, const std::vector<uint8_t>& eventDataVec,
1014
1080
return rc;
1015
1081
}
1016
1082
1083
+ void pldm::responder::oem_ibm_platform::Handler::setDimmStateSensor (
1084
+ bool status, uint16_t entityInstance)
1085
+ {
1086
+ auto pdrs = findStateSensorPDR (TERMINUS_ID, PLDM_ENTITY_MEMORY_MODULE,
1087
+ PLDM_OEM_IBM_SBE_DUMP_UPDATE_STATE, pdrRepo);
1088
+ if (pdrs.empty ())
1089
+ {
1090
+ error (
1091
+ " Failed to find state sensor PDR of entity type 'PLDM_ENTITY_MEMORY_MODULE' and state set id 'PLDM_OEM_IBM_SBE_DUMP_UPDATE_STATE' for entity instance = {ENT_INSTANCE}" ,
1092
+ " ENT_INSTANCE" , entityInstance);
1093
+ return ;
1094
+ }
1095
+ for (auto & pdr : pdrs)
1096
+ {
1097
+ auto stateSensorPDR =
1098
+ reinterpret_cast <pldm_state_sensor_pdr*>(pdr.data ());
1099
+ if (entityInstance == stateSensorPDR->entity_instance )
1100
+ {
1101
+ auto sid = stateSensorPDR->sensor_id ;
1102
+ info (
1103
+ " Sending state sensor event for sensor ID {SID} with status {STATUS}" ,
1104
+ " SID" , sid, " STATUS" , status);
1105
+ if (status)
1106
+ {
1107
+ sendStateSensorEvent (stateSensorPDR->sensor_id ,
1108
+ PLDM_STATE_SENSOR_STATE, 0 ,
1109
+ uint8_t (DimmDumpState::SUCCESS),
1110
+ uint8_t (dumpStatusMap[entityInstance]));
1111
+ dumpStatusMap[entityInstance] = DimmDumpState::SUCCESS;
1112
+ }
1113
+ else
1114
+ {
1115
+ sendStateSensorEvent (stateSensorPDR->sensor_id ,
1116
+ PLDM_STATE_SENSOR_STATE, 0 ,
1117
+ uint8_t (DimmDumpState::RETRY),
1118
+ uint8_t (dumpStatusMap[entityInstance]));
1119
+ dumpStatusMap[entityInstance] = DimmDumpState::RETRY;
1120
+ }
1121
+ }
1122
+ }
1123
+ }
1124
+
1125
+ int pldm::responder::oem_ibm_platform::Handler::fetchDimmStateSensor (
1126
+ uint16_t entityInstance)
1127
+ {
1128
+ return dumpStatusMap[entityInstance];
1129
+ }
1130
+
1017
1131
void pldm::responder::oem_ibm_platform::Handler::setHostEffecterState (
1018
1132
bool status, uint16_t entityTypeReceived, uint16_t entityInstance)
1019
1133
{
1020
1134
pldm::pdr::EntityType entityType;
1021
- if (entityTypeReceived == PLDM_ENTITY_MEMORY_MODULE)
1022
- {
1023
- entityType = PLDM_ENTITY_MEMORY_MODULE;
1024
- }
1025
- else if (entityTypeReceived == PLDM_ENTITY_PROC)
1135
+ if (entityTypeReceived == PLDM_ENTITY_PROC)
1026
1136
{
1027
1137
entityType = PLDM_ENTITY_PROC;
1028
1138
}
@@ -1055,6 +1165,9 @@ void pldm::responder::oem_ibm_platform::Handler::setHostEffecterState(
1055
1165
1056
1166
auto request = reinterpret_cast <pldm_msg*>(requestMsg.data ());
1057
1167
std::vector<set_effecter_state_field> stateField;
1168
+ info (
1169
+ " State effecter ID {EFFECTER_ID} will be set with state as - {STATUS}" ,
1170
+ " EFFECTER_ID" , effecterId, " STATUS" , status);
1058
1171
if (status == true )
1059
1172
{
1060
1173
stateField.push_back (set_effecter_state_field{
@@ -1141,15 +1254,29 @@ void pldm::responder::oem_ibm_platform::Handler::monitorDump(
1141
1254
if (propVal ==
1142
1255
" xyz.openbmc_project.Common.Progress.OperationStatus.Completed" )
1143
1256
{
1144
- setHostEffecterState (true , entityType, entityInstance);
1257
+ if (entityType == PLDM_ENTITY_MEMORY_MODULE)
1258
+ {
1259
+ setDimmStateSensor (true , entityInstance);
1260
+ }
1261
+ else
1262
+ {
1263
+ setHostEffecterState (true , entityType, entityInstance);
1264
+ }
1145
1265
}
1146
1266
else if (
1147
1267
propVal ==
1148
1268
" xyz.openbmc_project.Common.Progress.OperationStatus.Failed" ||
1149
1269
propVal ==
1150
1270
" xyz.openbmc_project.Common.Progress.OperationStatus.Aborted" )
1151
1271
{
1152
- setHostEffecterState (false , entityType, entityInstance);
1272
+ if (entityType == PLDM_ENTITY_MEMORY_MODULE)
1273
+ {
1274
+ setDimmStateSensor (false , entityInstance);
1275
+ }
1276
+ else
1277
+ {
1278
+ setHostEffecterState (false , entityType, entityInstance);
1279
+ }
1153
1280
}
1154
1281
}
1155
1282
sbeDumpMatch = nullptr ;
@@ -1205,7 +1332,9 @@ int pldm::responder::oem_ibm_platform::Handler::setNumericEffecter(
1205
1332
1206
1333
sdbusplus::message::object_path reply;
1207
1334
response.read (reply);
1208
-
1335
+ info (
1336
+ " Setting numeric effecter of type {TYPE} with entity instance {INST}" ,
1337
+ " TYPE" , entityType, " INST" , entityInstance);
1209
1338
monitorDump (reply, entityType, entityInstance);
1210
1339
}
1211
1340
catch (const std::exception & e)
@@ -1215,7 +1344,14 @@ int pldm::responder::oem_ibm_platform::Handler::setNumericEffecter(
1215
1344
" ERR" , e);
1216
1345
// case when the dump policy is disabled but we set the host effecter as
1217
1346
// true and the host moves on
1218
- setHostEffecterState (true , entityType, entityInstance);
1347
+ if (entityType == PLDM_ENTITY_MEMORY_MODULE)
1348
+ {
1349
+ setDimmStateSensor (true , entityInstance);
1350
+ }
1351
+ else
1352
+ {
1353
+ setHostEffecterState (true , entityType, entityInstance);
1354
+ }
1219
1355
}
1220
1356
return PLDM_SUCCESS;
1221
1357
}
0 commit comments