|
@@ -1133,10 +1133,8 @@ static CXLRetCode cmd_features_get_supported(const struct cxl_cmd *cmd,
|
|
(struct CXLSupportedFeatureEntry) {
|
|
(struct CXLSupportedFeatureEntry) {
|
|
.uuid = ecs_uuid,
|
|
.uuid = ecs_uuid,
|
|
.feat_index = index,
|
|
.feat_index = index,
|
|
- .get_feat_size = CXL_ECS_NUM_MEDIA_FRUS *
|
|
|
|
- sizeof(CXLMemECSReadAttrs),
|
|
|
|
- .set_feat_size = CXL_ECS_NUM_MEDIA_FRUS *
|
|
|
|
- sizeof(CXLMemECSWriteAttrs),
|
|
|
|
|
|
+ .get_feat_size = sizeof(CXLMemECSReadAttrs),
|
|
|
|
+ .set_feat_size = sizeof(CXLMemECSWriteAttrs),
|
|
.attr_flags = CXL_FEAT_ENTRY_ATTR_FLAG_CHANGABLE,
|
|
.attr_flags = CXL_FEAT_ENTRY_ATTR_FLAG_CHANGABLE,
|
|
.get_feat_version = CXL_ECS_GET_FEATURE_VERSION,
|
|
.get_feat_version = CXL_ECS_GET_FEATURE_VERSION,
|
|
.set_feat_version = CXL_ECS_SET_FEATURE_VERSION,
|
|
.set_feat_version = CXL_ECS_SET_FEATURE_VERSION,
|
|
@@ -1204,13 +1202,10 @@ static CXLRetCode cmd_features_get_feature(const struct cxl_cmd *cmd,
|
|
(uint8_t *)&ct3d->patrol_scrub_attrs + get_feature->offset,
|
|
(uint8_t *)&ct3d->patrol_scrub_attrs + get_feature->offset,
|
|
bytes_to_copy);
|
|
bytes_to_copy);
|
|
} else if (qemu_uuid_is_equal(&get_feature->uuid, &ecs_uuid)) {
|
|
} else if (qemu_uuid_is_equal(&get_feature->uuid, &ecs_uuid)) {
|
|
- if (get_feature->offset >= CXL_ECS_NUM_MEDIA_FRUS *
|
|
|
|
- sizeof(CXLMemECSReadAttrs)) {
|
|
|
|
|
|
+ if (get_feature->offset >= sizeof(CXLMemECSReadAttrs)) {
|
|
return CXL_MBOX_INVALID_INPUT;
|
|
return CXL_MBOX_INVALID_INPUT;
|
|
}
|
|
}
|
|
- bytes_to_copy = CXL_ECS_NUM_MEDIA_FRUS *
|
|
|
|
- sizeof(CXLMemECSReadAttrs) -
|
|
|
|
- get_feature->offset;
|
|
|
|
|
|
+ bytes_to_copy = sizeof(CXLMemECSReadAttrs) - get_feature->offset;
|
|
bytes_to_copy = MIN(bytes_to_copy, get_feature->count);
|
|
bytes_to_copy = MIN(bytes_to_copy, get_feature->count);
|
|
memcpy(payload_out,
|
|
memcpy(payload_out,
|
|
(uint8_t *)&ct3d->ecs_attrs + get_feature->offset,
|
|
(uint8_t *)&ct3d->ecs_attrs + get_feature->offset,
|
|
@@ -1299,18 +1294,17 @@ static CXLRetCode cmd_features_set_feature(const struct cxl_cmd *cmd,
|
|
|
|
|
|
ecs_set_feature = (void *)payload_in;
|
|
ecs_set_feature = (void *)payload_in;
|
|
ecs_write_attrs = ecs_set_feature->feat_data;
|
|
ecs_write_attrs = ecs_set_feature->feat_data;
|
|
- memcpy((uint8_t *)ct3d->ecs_wr_attrs + hdr->offset,
|
|
|
|
|
|
+ memcpy((uint8_t *)&ct3d->ecs_wr_attrs + hdr->offset,
|
|
ecs_write_attrs,
|
|
ecs_write_attrs,
|
|
bytes_to_copy);
|
|
bytes_to_copy);
|
|
set_feat_info->data_size += bytes_to_copy;
|
|
set_feat_info->data_size += bytes_to_copy;
|
|
|
|
|
|
if (data_transfer_flag == CXL_SET_FEATURE_FLAG_FULL_DATA_TRANSFER ||
|
|
if (data_transfer_flag == CXL_SET_FEATURE_FLAG_FULL_DATA_TRANSFER ||
|
|
data_transfer_flag == CXL_SET_FEATURE_FLAG_FINISH_DATA_TRANSFER) {
|
|
data_transfer_flag == CXL_SET_FEATURE_FLAG_FINISH_DATA_TRANSFER) {
|
|
|
|
+ ct3d->ecs_attrs.ecs_log_cap = ct3d->ecs_wr_attrs.ecs_log_cap;
|
|
for (count = 0; count < CXL_ECS_NUM_MEDIA_FRUS; count++) {
|
|
for (count = 0; count < CXL_ECS_NUM_MEDIA_FRUS; count++) {
|
|
- ct3d->ecs_attrs[count].ecs_log_cap =
|
|
|
|
- ct3d->ecs_wr_attrs[count].ecs_log_cap;
|
|
|
|
- ct3d->ecs_attrs[count].ecs_config =
|
|
|
|
- ct3d->ecs_wr_attrs[count].ecs_config & 0x1F;
|
|
|
|
|
|
+ ct3d->ecs_attrs.fru_attrs[count].ecs_config =
|
|
|
|
+ ct3d->ecs_wr_attrs.fru_attrs[count].ecs_config & 0x1F;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -1324,7 +1318,7 @@ static CXLRetCode cmd_features_set_feature(const struct cxl_cmd *cmd,
|
|
if (qemu_uuid_is_equal(&hdr->uuid, &patrol_scrub_uuid)) {
|
|
if (qemu_uuid_is_equal(&hdr->uuid, &patrol_scrub_uuid)) {
|
|
memset(&ct3d->patrol_scrub_wr_attrs, 0, set_feat_info->data_size);
|
|
memset(&ct3d->patrol_scrub_wr_attrs, 0, set_feat_info->data_size);
|
|
} else if (qemu_uuid_is_equal(&hdr->uuid, &ecs_uuid)) {
|
|
} else if (qemu_uuid_is_equal(&hdr->uuid, &ecs_uuid)) {
|
|
- memset(ct3d->ecs_wr_attrs, 0, set_feat_info->data_size);
|
|
|
|
|
|
+ memset(&ct3d->ecs_wr_attrs, 0, set_feat_info->data_size);
|
|
}
|
|
}
|
|
set_feat_info->data_transfer_flag = 0;
|
|
set_feat_info->data_transfer_flag = 0;
|
|
set_feat_info->data_saved_across_reset = false;
|
|
set_feat_info->data_saved_across_reset = false;
|