@@ -66,6 +66,14 @@ int pldm::responder::oem_ibm_platform::Handler::
66
66
sensorOpState = fetchRealSAIStatus ();
67
67
presentState = PLDM_SENSOR_NORMAL;
68
68
}
69
+ else if ((entityType == PLDM_ENTITY_MEMORY_MODULE) &&
70
+ (stateSetId == PLDM_OEM_IBM_SBE_DUMP_UPDATE_STATE))
71
+ {
72
+ sensorOpState = fetchDimmStateSensor (entityInstance);
73
+ stateField.push_back ({PLDM_SENSOR_ENABLED, PLDM_SENSOR_UNKNOWN,
74
+ PLDM_SENSOR_UNKNOWN, sensorOpState});
75
+ break ;
76
+ }
69
77
else
70
78
{
71
79
rc = PLDM_PLATFORM_INVALID_STATE_VALUE;
@@ -162,9 +170,14 @@ int pldm::responder::oem_ibm_platform::Handler::
162
170
163
171
else
164
172
{
165
- error (" Invalid entity type received: {ENTITY_TYPE}" , " ENTITY_TYPE" ,
166
- entityType);
173
+ error (
174
+ " Invalid entity type received: {ENTITY_TYPE} for entityInstance '{INSTANCE}'" ,
175
+ " ENTITY_TYPE" , entityType, " INSTANCE" , entityInstance);
176
+ return PLDM_ERROR_INVALID_DATA;
167
177
}
178
+ info (
179
+ " Processing setNumericEffecter on ID {ID} for effecter type {TYPE} and entity instance {INST}" ,
180
+ " ID" , effecterId, " TYPE" , entityType, " INST" , entityInstance);
168
181
rc = setNumericEffecter (entityInstance, value, entityType);
169
182
}
170
183
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);
@@ -1015,15 +1081,59 @@ int encodeEventMsg(uint8_t eventType, const std::vector<uint8_t>& eventDataVec,
1015
1081
return rc;
1016
1082
}
1017
1083
1084
+ void pldm::responder::oem_ibm_platform::Handler::setDimmStateSensor (
1085
+ bool status, uint16_t entityInstance)
1086
+ {
1087
+ auto pdrs = findStateSensorPDR (TERMINUS_ID, PLDM_ENTITY_MEMORY_MODULE,
1088
+ PLDM_OEM_IBM_SBE_DUMP_UPDATE_STATE, pdrRepo);
1089
+ if (pdrs.empty ())
1090
+ {
1091
+ error (
1092
+ " 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}" ,
1093
+ " ENT_INSTANCE" , entityInstance);
1094
+ return ;
1095
+ }
1096
+ for (auto & pdr : pdrs)
1097
+ {
1098
+ auto stateSensorPDR =
1099
+ reinterpret_cast <pldm_state_sensor_pdr*>(pdr.data ());
1100
+ if (entityInstance == stateSensorPDR->entity_instance )
1101
+ {
1102
+ auto sid = stateSensorPDR->sensor_id ;
1103
+ info (
1104
+ " Sending state sensor event for sensor ID {SID} with status {STATUS}" ,
1105
+ " SID" , sid, " STATUS" , status);
1106
+ if (status)
1107
+ {
1108
+ sendStateSensorEvent (stateSensorPDR->sensor_id ,
1109
+ PLDM_STATE_SENSOR_STATE, 0 ,
1110
+ uint8_t (DimmDumpState::SUCCESS),
1111
+ uint8_t (dumpStatusMap[entityInstance]));
1112
+ dumpStatusMap[entityInstance] = DimmDumpState::SUCCESS;
1113
+ }
1114
+ else
1115
+ {
1116
+ sendStateSensorEvent (stateSensorPDR->sensor_id ,
1117
+ PLDM_STATE_SENSOR_STATE, 0 ,
1118
+ uint8_t (DimmDumpState::RETRY),
1119
+ uint8_t (dumpStatusMap[entityInstance]));
1120
+ dumpStatusMap[entityInstance] = DimmDumpState::RETRY;
1121
+ }
1122
+ }
1123
+ }
1124
+ }
1125
+
1126
+ int pldm::responder::oem_ibm_platform::Handler::fetchDimmStateSensor (
1127
+ uint16_t entityInstance)
1128
+ {
1129
+ return dumpStatusMap[entityInstance];
1130
+ }
1131
+
1018
1132
void pldm::responder::oem_ibm_platform::Handler::setHostEffecterState (
1019
1133
bool status, uint16_t entityTypeReceived, uint16_t entityInstance)
1020
1134
{
1021
1135
pldm::pdr::EntityType entityType;
1022
- if (entityTypeReceived == PLDM_ENTITY_MEMORY_MODULE)
1023
- {
1024
- entityType = PLDM_ENTITY_MEMORY_MODULE;
1025
- }
1026
- else if (entityTypeReceived == PLDM_ENTITY_PROC)
1136
+ if (entityTypeReceived == PLDM_ENTITY_PROC)
1027
1137
{
1028
1138
entityType = PLDM_ENTITY_PROC;
1029
1139
}
@@ -1056,6 +1166,9 @@ void pldm::responder::oem_ibm_platform::Handler::setHostEffecterState(
1056
1166
1057
1167
auto request = reinterpret_cast <pldm_msg*>(requestMsg.data ());
1058
1168
std::vector<set_effecter_state_field> stateField;
1169
+ info (
1170
+ " State effecter ID {EFFECTER_ID} will be set with state as - {STATUS}" ,
1171
+ " EFFECTER_ID" , effecterId, " STATUS" , status);
1059
1172
if (status == true )
1060
1173
{
1061
1174
stateField.push_back (set_effecter_state_field{
@@ -1142,15 +1255,29 @@ void pldm::responder::oem_ibm_platform::Handler::monitorDump(
1142
1255
if (propVal ==
1143
1256
" xyz.openbmc_project.Common.Progress.OperationStatus.Completed" )
1144
1257
{
1145
- setHostEffecterState (true , entityType, entityInstance);
1258
+ if (entityType == PLDM_ENTITY_MEMORY_MODULE)
1259
+ {
1260
+ setDimmStateSensor (true , entityInstance);
1261
+ }
1262
+ else
1263
+ {
1264
+ setHostEffecterState (true , entityType, entityInstance);
1265
+ }
1146
1266
}
1147
1267
else if (
1148
1268
propVal ==
1149
1269
" xyz.openbmc_project.Common.Progress.OperationStatus.Failed" ||
1150
1270
propVal ==
1151
1271
" xyz.openbmc_project.Common.Progress.OperationStatus.Aborted" )
1152
1272
{
1153
- setHostEffecterState (false , entityType, entityInstance);
1273
+ if (entityType == PLDM_ENTITY_MEMORY_MODULE)
1274
+ {
1275
+ setDimmStateSensor (false , entityInstance);
1276
+ }
1277
+ else
1278
+ {
1279
+ setHostEffecterState (false , entityType, entityInstance);
1280
+ }
1154
1281
}
1155
1282
}
1156
1283
sbeDumpMatch = nullptr ;
@@ -1206,7 +1333,9 @@ int pldm::responder::oem_ibm_platform::Handler::setNumericEffecter(
1206
1333
1207
1334
sdbusplus::message::object_path reply;
1208
1335
response.read (reply);
1209
-
1336
+ info (
1337
+ " Setting numeric effecter of type {TYPE} with entity instance {INST}" ,
1338
+ " TYPE" , entityType, " INST" , entityInstance);
1210
1339
monitorDump (reply, entityType, entityInstance);
1211
1340
}
1212
1341
catch (const std::exception & e)
@@ -1216,7 +1345,14 @@ int pldm::responder::oem_ibm_platform::Handler::setNumericEffecter(
1216
1345
" ERR" , e);
1217
1346
// case when the dump policy is disabled but we set the host effecter as
1218
1347
// true and the host moves on
1219
- setHostEffecterState (true , entityType, entityInstance);
1348
+ if (entityType == PLDM_ENTITY_MEMORY_MODULE)
1349
+ {
1350
+ setDimmStateSensor (true , entityInstance);
1351
+ }
1352
+ else
1353
+ {
1354
+ setHostEffecterState (true , entityType, entityInstance);
1355
+ }
1220
1356
}
1221
1357
return PLDM_SUCCESS;
1222
1358
}
0 commit comments