Lines Matching refs:nd_cmd
231 struct nd_intel_fw_info *nd_cmd, unsigned int buf_len, in nd_intel_test_get_fw_info() argument
238 __func__, t, nd_cmd, buf_len, idx); in nd_intel_test_get_fw_info()
240 if (buf_len < sizeof(*nd_cmd)) in nd_intel_test_get_fw_info()
243 nd_cmd->status = 0; in nd_intel_test_get_fw_info()
244 nd_cmd->storage_size = INTEL_FW_STORAGE_SIZE; in nd_intel_test_get_fw_info()
245 nd_cmd->max_send_len = INTEL_FW_MAX_SEND_LEN; in nd_intel_test_get_fw_info()
246 nd_cmd->query_interval = INTEL_FW_QUERY_INTERVAL; in nd_intel_test_get_fw_info()
247 nd_cmd->max_query_time = INTEL_FW_QUERY_MAX_TIME; in nd_intel_test_get_fw_info()
248 nd_cmd->update_cap = 0; in nd_intel_test_get_fw_info()
249 nd_cmd->fis_version = INTEL_FW_FIS_VERSION; in nd_intel_test_get_fw_info()
250 nd_cmd->run_version = 0; in nd_intel_test_get_fw_info()
251 nd_cmd->updated_version = fw->version; in nd_intel_test_get_fw_info()
257 struct nd_intel_fw_start *nd_cmd, unsigned int buf_len, in nd_intel_test_start_update() argument
264 __func__, t, nd_cmd, buf_len, idx); in nd_intel_test_start_update()
266 if (buf_len < sizeof(*nd_cmd)) in nd_intel_test_start_update()
271 nd_cmd->status = 0x10007; in nd_intel_test_start_update()
278 nd_cmd->status = 0; in nd_intel_test_start_update()
279 nd_cmd->context = fw->context; in nd_intel_test_start_update()
281 dev_dbg(dev, "%s: context issued: %#x\n", __func__, nd_cmd->context); in nd_intel_test_start_update()
287 struct nd_intel_fw_send_data *nd_cmd, unsigned int buf_len, in nd_intel_test_send_data() argument
292 u32 *status = (u32 *)&nd_cmd->data[nd_cmd->length]; in nd_intel_test_send_data()
295 __func__, t, nd_cmd, buf_len, idx); in nd_intel_test_send_data()
297 if (buf_len < sizeof(*nd_cmd)) in nd_intel_test_send_data()
302 dev_dbg(dev, "%s: cmd->data[0]: %#x\n", __func__, nd_cmd->data[0]); in nd_intel_test_send_data()
303 dev_dbg(dev, "%s: cmd->data[%u]: %#x\n", __func__, nd_cmd->length-1, in nd_intel_test_send_data()
304 nd_cmd->data[nd_cmd->length-1]); in nd_intel_test_send_data()
312 if (nd_cmd->context != fw->context) { in nd_intel_test_send_data()
314 __func__, nd_cmd->context, fw->context); in nd_intel_test_send_data()
323 if (nd_cmd->offset + nd_cmd->length > INTEL_FW_STORAGE_SIZE || in nd_intel_test_send_data()
324 nd_cmd->length > INTEL_FW_MAX_SEND_LEN) { in nd_intel_test_send_data()
330 fw->size_received += nd_cmd->length; in nd_intel_test_send_data()
332 __func__, nd_cmd->length, fw->size_received); in nd_intel_test_send_data()
338 struct nd_intel_fw_finish_update *nd_cmd, in nd_intel_test_finish_fw() argument
345 __func__, t, nd_cmd, buf_len, idx); in nd_intel_test_finish_fw()
349 nd_cmd->status = 0x20007; in nd_intel_test_finish_fw()
354 __func__, nd_cmd->context, nd_cmd->ctrl_flags); in nd_intel_test_finish_fw()
356 switch (nd_cmd->ctrl_flags) { in nd_intel_test_finish_fw()
358 if (nd_cmd->context != fw->context) { in nd_intel_test_finish_fw()
360 __func__, nd_cmd->context, in nd_intel_test_finish_fw()
362 nd_cmd->status = 0x10007; in nd_intel_test_finish_fw()
365 nd_cmd->status = 0; in nd_intel_test_finish_fw()
374 nd_cmd->status = 0x40007; in nd_intel_test_finish_fw()
381 __func__, nd_cmd->ctrl_flags); in nd_intel_test_finish_fw()
389 struct nd_intel_fw_finish_query *nd_cmd, in nd_intel_test_finish_query() argument
396 __func__, t, nd_cmd, buf_len, idx); in nd_intel_test_finish_query()
398 if (buf_len < sizeof(*nd_cmd)) in nd_intel_test_finish_query()
401 if (nd_cmd->context != fw->context) { in nd_intel_test_finish_query()
403 __func__, nd_cmd->context, fw->context); in nd_intel_test_finish_query()
404 nd_cmd->status = 0x10007; in nd_intel_test_finish_query()
408 dev_dbg(dev, "%s context: %#x\n", __func__, nd_cmd->context); in nd_intel_test_finish_query()
412 nd_cmd->updated_fw_rev = 0; in nd_intel_test_finish_query()
413 nd_cmd->status = 0; in nd_intel_test_finish_query()
419 nd_cmd->status = 0x40007; in nd_intel_test_finish_query()
420 nd_cmd->updated_fw_rev = 0; in nd_intel_test_finish_query()
426 nd_cmd->updated_fw_rev = 0; in nd_intel_test_finish_query()
427 nd_cmd->status = 0x20007; in nd_intel_test_finish_query()
435 nd_cmd->status = 0; in nd_intel_test_finish_query()
437 fw->version = nd_cmd->updated_fw_rev = in nd_intel_test_finish_query()
449 static int nfit_test_cmd_get_config_size(struct nd_cmd_get_config_size *nd_cmd, in nfit_test_cmd_get_config_size() argument
452 if (buf_len < sizeof(*nd_cmd)) in nfit_test_cmd_get_config_size()
455 nd_cmd->status = 0; in nfit_test_cmd_get_config_size()
456 nd_cmd->config_size = LABEL_SIZE; in nfit_test_cmd_get_config_size()
457 nd_cmd->max_xfer = SZ_4K; in nfit_test_cmd_get_config_size()
463 *nd_cmd, unsigned int buf_len, void *label) in nfit_test_cmd_get_config_data()
465 unsigned int len, offset = nd_cmd->in_offset; in nfit_test_cmd_get_config_data()
468 if (buf_len < sizeof(*nd_cmd)) in nfit_test_cmd_get_config_data()
472 if (nd_cmd->in_length + sizeof(*nd_cmd) > buf_len) in nfit_test_cmd_get_config_data()
475 nd_cmd->status = 0; in nfit_test_cmd_get_config_data()
476 len = min(nd_cmd->in_length, LABEL_SIZE - offset); in nfit_test_cmd_get_config_data()
477 memcpy(nd_cmd->out_buf, label + offset, len); in nfit_test_cmd_get_config_data()
478 rc = buf_len - sizeof(*nd_cmd) - len; in nfit_test_cmd_get_config_data()
483 static int nfit_test_cmd_set_config_data(struct nd_cmd_set_config_hdr *nd_cmd, in nfit_test_cmd_set_config_data() argument
486 unsigned int len, offset = nd_cmd->in_offset; in nfit_test_cmd_set_config_data()
490 if (buf_len < sizeof(*nd_cmd)) in nfit_test_cmd_set_config_data()
494 if (nd_cmd->in_length + sizeof(*nd_cmd) + 4 > buf_len) in nfit_test_cmd_set_config_data()
497 status = (void *)nd_cmd + nd_cmd->in_length + sizeof(*nd_cmd); in nfit_test_cmd_set_config_data()
499 len = min(nd_cmd->in_length, LABEL_SIZE - offset); in nfit_test_cmd_set_config_data()
500 memcpy(label + offset, nd_cmd->in_buf, len); in nfit_test_cmd_set_config_data()
501 rc = buf_len - sizeof(*nd_cmd) - (len + 4); in nfit_test_cmd_set_config_data()
508 static int nfit_test_cmd_ars_cap(struct nd_cmd_ars_cap *nd_cmd, in nfit_test_cmd_ars_cap() argument
513 if (buf_len < sizeof(*nd_cmd)) in nfit_test_cmd_ars_cap()
519 nd_cmd->max_ars_out = sizeof(struct nd_cmd_ars_status) in nfit_test_cmd_ars_cap()
521 nd_cmd->status = (ND_ARS_PERSISTENT | ND_ARS_VOLATILE) << 16; in nfit_test_cmd_ars_cap()
522 nd_cmd->clear_err_unit = NFIT_TEST_CLEAR_ERR_UNIT; in nfit_test_cmd_ars_cap()
902 struct nd_intel_lss *nd_cmd, unsigned int buf_len) in nd_intel_test_cmd_set_lss_status() argument
906 if (buf_len < sizeof(*nd_cmd)) in nd_intel_test_cmd_set_lss_status()
909 switch (nd_cmd->enable) { in nd_intel_test_cmd_set_lss_status()
911 nd_cmd->status = 0; in nd_intel_test_cmd_set_lss_status()
916 nd_cmd->status = 0; in nd_intel_test_cmd_set_lss_status()
921 dev_warn(dev, "Unknown enable value: %#x\n", nd_cmd->enable); in nd_intel_test_cmd_set_lss_status()
922 nd_cmd->status = 0x3; in nd_intel_test_cmd_set_lss_status()
941 struct nd_intel_get_security_state *nd_cmd, in nd_intel_test_cmd_security_status() argument
947 nd_cmd->status = 0; in nd_intel_test_cmd_security_status()
948 nd_cmd->state = sec->state; in nd_intel_test_cmd_security_status()
949 nd_cmd->extended_state = sec->ext_state; in nd_intel_test_cmd_security_status()
950 dev_dbg(dev, "security state (%#x) returned\n", nd_cmd->state); in nd_intel_test_cmd_security_status()
956 struct nd_intel_unlock_unit *nd_cmd, in nd_intel_test_cmd_unlock_unit() argument
964 nd_cmd->status = ND_INTEL_STATUS_INVALID_STATE; in nd_intel_test_cmd_unlock_unit()
967 } else if (memcmp(nd_cmd->passphrase, sec->passphrase, in nd_intel_test_cmd_unlock_unit()
969 nd_cmd->status = ND_INTEL_STATUS_INVALID_PASS; in nd_intel_test_cmd_unlock_unit()
972 nd_cmd->status = 0; in nd_intel_test_cmd_unlock_unit()
977 dev_dbg(dev, "unlocking status returned: %#x\n", nd_cmd->status); in nd_intel_test_cmd_unlock_unit()
982 struct nd_intel_set_passphrase *nd_cmd, in nd_intel_test_cmd_set_pass() argument
989 nd_cmd->status = ND_INTEL_STATUS_INVALID_STATE; in nd_intel_test_cmd_set_pass()
991 } else if (memcmp(nd_cmd->old_pass, sec->passphrase, in nd_intel_test_cmd_set_pass()
993 nd_cmd->status = ND_INTEL_STATUS_INVALID_PASS; in nd_intel_test_cmd_set_pass()
996 memcpy(sec->passphrase, nd_cmd->new_pass, in nd_intel_test_cmd_set_pass()
999 nd_cmd->status = 0; in nd_intel_test_cmd_set_pass()
1007 struct nd_intel_freeze_lock *nd_cmd, in nd_intel_test_cmd_freeze_lock() argument
1014 nd_cmd->status = ND_INTEL_STATUS_INVALID_STATE; in nd_intel_test_cmd_freeze_lock()
1018 nd_cmd->status = 0; in nd_intel_test_cmd_freeze_lock()
1026 struct nd_intel_disable_passphrase *nd_cmd, in nd_intel_test_cmd_disable_pass() argument
1034 nd_cmd->status = ND_INTEL_STATUS_INVALID_STATE; in nd_intel_test_cmd_disable_pass()
1036 } else if (memcmp(nd_cmd->passphrase, sec->passphrase, in nd_intel_test_cmd_disable_pass()
1038 nd_cmd->status = ND_INTEL_STATUS_INVALID_PASS; in nd_intel_test_cmd_disable_pass()
1050 struct nd_intel_secure_erase *nd_cmd, in nd_intel_test_cmd_secure_erase() argument
1057 nd_cmd->status = ND_INTEL_STATUS_INVALID_STATE; in nd_intel_test_cmd_secure_erase()
1059 } else if (memcmp(nd_cmd->passphrase, sec->passphrase, in nd_intel_test_cmd_secure_erase()
1061 nd_cmd->status = ND_INTEL_STATUS_INVALID_PASS; in nd_intel_test_cmd_secure_erase()
1065 && (memcmp(nd_cmd->passphrase, zero_key, in nd_intel_test_cmd_secure_erase()
1081 struct nd_intel_overwrite *nd_cmd, in nd_intel_test_cmd_overwrite() argument
1088 memcmp(nd_cmd->passphrase, sec->passphrase, in nd_intel_test_cmd_overwrite()
1090 nd_cmd->status = ND_INTEL_STATUS_INVALID_PASS; in nd_intel_test_cmd_overwrite()
1104 struct nd_intel_query_overwrite *nd_cmd, in nd_intel_test_cmd_query_overwrite() argument
1111 nd_cmd->status = ND_INTEL_STATUS_OQUERY_SEQUENCE_ERR; in nd_intel_test_cmd_query_overwrite()
1122 nd_cmd->status = ND_INTEL_STATUS_OQUERY_INPROGRESS; in nd_intel_test_cmd_query_overwrite()
1127 struct nd_intel_set_master_passphrase *nd_cmd, in nd_intel_test_cmd_master_set_pass() argument
1134 nd_cmd->status = ND_INTEL_STATUS_NOT_SUPPORTED; in nd_intel_test_cmd_master_set_pass()
1137 nd_cmd->status = ND_INTEL_STATUS_INVALID_STATE; in nd_intel_test_cmd_master_set_pass()
1139 } else if (memcmp(nd_cmd->old_pass, sec->master_passphrase, in nd_intel_test_cmd_master_set_pass()
1141 nd_cmd->status = ND_INTEL_STATUS_INVALID_PASS; in nd_intel_test_cmd_master_set_pass()
1144 memcpy(sec->master_passphrase, nd_cmd->new_pass, in nd_intel_test_cmd_master_set_pass()
1154 struct nd_intel_master_secure_erase *nd_cmd, in nd_intel_test_cmd_master_secure_erase() argument
1161 nd_cmd->status = ND_INTEL_STATUS_NOT_SUPPORTED; in nd_intel_test_cmd_master_secure_erase()
1164 nd_cmd->status = ND_INTEL_STATUS_INVALID_STATE; in nd_intel_test_cmd_master_secure_erase()
1166 } else if (memcmp(nd_cmd->passphrase, sec->master_passphrase, in nd_intel_test_cmd_master_secure_erase()
1168 nd_cmd->status = ND_INTEL_STATUS_INVALID_PASS; in nd_intel_test_cmd_master_secure_erase()