• Home
  • Raw
  • Download

Lines Matching refs:hdr

224 static int nvme_trans_copy_to_user(struct sg_io_hdr *hdr, void *from,  in nvme_trans_copy_to_user()  argument
232 if (hdr->iovec_count > 0) { in nvme_trans_copy_to_user()
235 for (i = 0; i < hdr->iovec_count; i++) { in nvme_trans_copy_to_user()
236 if (copy_from_user(&sgl, hdr->dxferp + in nvme_trans_copy_to_user()
252 if (copy_to_user(hdr->dxferp, from, n)) in nvme_trans_copy_to_user()
259 static int nvme_trans_copy_from_user(struct sg_io_hdr *hdr, void *to, in nvme_trans_copy_from_user() argument
267 if (hdr->iovec_count > 0) { in nvme_trans_copy_from_user()
270 for (i = 0; i < hdr->iovec_count; i++) { in nvme_trans_copy_from_user()
271 if (copy_from_user(&sgl, hdr->dxferp + in nvme_trans_copy_from_user()
286 if (copy_from_user(to, hdr->dxferp, n)) in nvme_trans_copy_from_user()
293 static int nvme_trans_completion(struct sg_io_hdr *hdr, u8 status, u8 sense_key, in nvme_trans_completion() argument
300 hdr->status = SAM_STAT_GOOD; in nvme_trans_completion()
301 hdr->masked_status = GOOD; in nvme_trans_completion()
302 hdr->host_status = DID_OK; in nvme_trans_completion()
303 hdr->driver_status = DRIVER_OK; in nvme_trans_completion()
304 hdr->sb_len_wr = 0; in nvme_trans_completion()
306 hdr->status = status; in nvme_trans_completion()
307 hdr->masked_status = status >> 1; in nvme_trans_completion()
308 hdr->host_status = DID_OK; in nvme_trans_completion()
309 hdr->driver_status = DRIVER_OK; in nvme_trans_completion()
317 xfer_len = min_t(u8, hdr->mx_sb_len, DESC_FMT_SENSE_DATA_SIZE); in nvme_trans_completion()
318 hdr->sb_len_wr = xfer_len; in nvme_trans_completion()
319 if (copy_to_user(hdr->sbp, resp, xfer_len) > 0) in nvme_trans_completion()
332 static int nvme_trans_status_code(struct sg_io_hdr *hdr, int nvme_sc) in nvme_trans_status_code() argument
508 res = nvme_trans_completion(hdr, status, sense_key, asc, ascq); in nvme_trans_status_code()
515 struct sg_io_hdr *hdr, u8 *inq_response, in nvme_trans_standard_inquiry_page() argument
530 res = nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_standard_inquiry_page()
555 return nvme_trans_copy_to_user(hdr, inq_response, xfer_len); in nvme_trans_standard_inquiry_page()
559 struct sg_io_hdr *hdr, u8 *inq_response, in nvme_trans_supported_vpd_pages() argument
575 return nvme_trans_copy_to_user(hdr, inq_response, xfer_len); in nvme_trans_supported_vpd_pages()
579 struct sg_io_hdr *hdr, u8 *inq_response, in nvme_trans_unit_serial_page() argument
590 return nvme_trans_copy_to_user(hdr, inq_response, xfer_len); in nvme_trans_unit_serial_page()
593 static int nvme_fill_device_id_eui64(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_fill_device_id_eui64() argument
602 res = nvme_trans_status_code(hdr, nvme_sc); in nvme_fill_device_id_eui64()
632 res = nvme_trans_copy_to_user(hdr, inq_response, alloc_len); in nvme_fill_device_id_eui64()
639 struct sg_io_hdr *hdr, u8 *inq_response, int alloc_len) in nvme_fill_device_id_scsi_string() argument
646 return nvme_trans_completion(hdr, in nvme_fill_device_id_scsi_string()
653 res = nvme_trans_status_code(hdr, nvme_sc); in nvme_fill_device_id_scsi_string()
672 res = nvme_trans_copy_to_user(hdr, inq_response, alloc_len); in nvme_fill_device_id_scsi_string()
677 static int nvme_trans_device_id_page(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_device_id_page() argument
683 res = nvme_fill_device_id_eui64(ns, hdr, resp, alloc_len); in nvme_trans_device_id_page()
688 return nvme_fill_device_id_scsi_string(ns, hdr, resp, alloc_len); in nvme_trans_device_id_page()
691 static int nvme_trans_ext_inq_page(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_ext_inq_page() argument
714 res = nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_ext_inq_page()
730 res = nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_ext_inq_page()
749 res = nvme_trans_copy_to_user(hdr, inq_response, xfer_len); in nvme_trans_ext_inq_page()
756 static int nvme_trans_bdev_limits_page(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_bdev_limits_page() argument
773 return nvme_trans_copy_to_user(hdr, inq_response, 0x3c); in nvme_trans_bdev_limits_page()
776 static int nvme_trans_bdev_char_page(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_bdev_char_page() argument
797 res = nvme_trans_copy_to_user(hdr, inq_response, xfer_len); in nvme_trans_bdev_char_page()
806 static int nvme_trans_log_supp_pages(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_log_supp_pages() argument
827 res = nvme_trans_copy_to_user(hdr, log_response, xfer_len); in nvme_trans_log_supp_pages()
835 struct sg_io_hdr *hdr, int alloc_len) in nvme_trans_log_info_exceptions() argument
873 res = nvme_trans_copy_to_user(hdr, log_response, xfer_len); in nvme_trans_log_info_exceptions()
880 static int nvme_trans_log_temperature(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_log_temperature() argument
933 res = nvme_trans_copy_to_user(hdr, log_response, xfer_len); in nvme_trans_log_temperature()
966 static int nvme_trans_fill_blk_desc(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_fill_blk_desc() argument
981 res = nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_fill_blk_desc()
1009 struct sg_io_hdr *hdr, u8 *resp, in nvme_trans_fill_control_page() argument
1031 struct sg_io_hdr *hdr, in nvme_trans_fill_caching_page() argument
1044 res = nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_fill_caching_page()
1057 struct sg_io_hdr *hdr, u8 *resp, in nvme_trans_fill_pow_cnd_page() argument
1071 struct sg_io_hdr *hdr, u8 *resp, in nvme_trans_fill_inf_exc_page() argument
1085 static int nvme_trans_fill_all_pages(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_fill_all_pages() argument
1096 res = nvme_trans_fill_caching_page(ns, hdr, &resp[mode_pages_offset_1], in nvme_trans_fill_all_pages()
1100 res = nvme_trans_fill_control_page(ns, hdr, &resp[mode_pages_offset_2], in nvme_trans_fill_all_pages()
1104 res = nvme_trans_fill_pow_cnd_page(ns, hdr, &resp[mode_pages_offset_3], in nvme_trans_fill_all_pages()
1108 return nvme_trans_fill_inf_exc_page(ns, hdr, &resp[mode_pages_offset_4], in nvme_trans_fill_all_pages()
1123 struct sg_io_hdr *hdr, u8 *cmd, in nvme_trans_mode_page_create() argument
1127 struct sg_io_hdr *hdr, u8 *, int), in nvme_trans_mode_page_create()
1163 res = nvme_trans_fill_blk_desc(ns, hdr, in nvme_trans_mode_page_create()
1169 res = mode_page_fill_func(ns, hdr, &response[mode_pages_offset_1], in nvme_trans_mode_page_create()
1175 res = nvme_trans_copy_to_user(hdr, response, xfer_len); in nvme_trans_mode_page_create()
1223 static int nvme_trans_send_activate_fw_cmd(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_send_activate_fw_cmd() argument
1234 return nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_send_activate_fw_cmd()
1237 static int nvme_trans_send_download_fw_cmd(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_send_download_fw_cmd() argument
1244 if (hdr->iovec_count > 0) { in nvme_trans_send_download_fw_cmd()
1246 return nvme_trans_completion(hdr, in nvme_trans_send_download_fw_cmd()
1259 hdr->dxferp, tot_len, NULL, 0); in nvme_trans_send_download_fw_cmd()
1260 return nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_send_download_fw_cmd()
1320 static int nvme_trans_modesel_get_mp(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_modesel_get_mp() argument
1332 res = nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_modesel_get_mp()
1339 res = nvme_trans_completion(hdr, in nvme_trans_modesel_get_mp()
1348 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_modesel_get_mp()
1357 static int nvme_trans_modesel_data(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_modesel_data() argument
1376 res = nvme_trans_copy_from_user(hdr, parm_list, parm_list_len); in nvme_trans_modesel_data()
1398 res = nvme_trans_completion(hdr, in nvme_trans_modesel_data()
1413 res = nvme_trans_modesel_get_mp(ns, hdr, &parm_list[index], in nvme_trans_modesel_data()
1429 struct sg_io_hdr *hdr) in nvme_trans_fmt_set_blk_size_count() argument
1446 res = nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_fmt_set_blk_size_count()
1464 static int nvme_trans_fmt_get_parm_header(struct sg_io_hdr *hdr, u8 len, in nvme_trans_fmt_get_parm_header() argument
1476 res = nvme_trans_copy_from_user(hdr, parm_list, len); in nvme_trans_fmt_get_parm_header()
1482 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_fmt_get_parm_header()
1490 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_fmt_get_parm_header()
1512 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_fmt_get_parm_header()
1524 static int nvme_trans_fmt_send_cmd(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_fmt_send_cmd() argument
1538 res = nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_fmt_send_cmd()
1552 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_fmt_send_cmd()
1557 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_fmt_send_cmd()
1570 res = nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_fmt_send_cmd()
1576 static inline u32 nvme_trans_io_get_num_cmds(struct sg_io_hdr *hdr, in nvme_trans_io_get_num_cmds() argument
1581 if (hdr->iovec_count > 0) in nvme_trans_io_get_num_cmds()
1582 return hdr->iovec_count; in nvme_trans_io_get_num_cmds()
1602 static int nvme_trans_do_nvme_io(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_do_nvme_io() argument
1618 num_cmds = nvme_trans_io_get_num_cmds(hdr, cdb_info, max_blocks); in nvme_trans_do_nvme_io()
1631 if (hdr->iovec_count > 0) { in nvme_trans_do_nvme_io()
1634 retcode = copy_from_user(&sgl, hdr->dxferp + in nvme_trans_do_nvme_io()
1646 next_mapping_addr = hdr->dxferp + in nvme_trans_do_nvme_io()
1670 return nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_do_nvme_io()
1676 static int nvme_trans_io(struct nvme_ns *ns, struct sg_io_hdr *hdr, u8 is_write, in nvme_trans_io() argument
1700 return nvme_trans_completion(hdr, in nvme_trans_io()
1738 if (hdr->iovec_count > 0) { in nvme_trans_io()
1739 for (i = 0; i < hdr->iovec_count; i++) { in nvme_trans_io()
1740 not_copied = copy_from_user(&sgl, hdr->dxferp + in nvme_trans_io()
1748 res = nvme_trans_completion(hdr, in nvme_trans_io()
1757 sum_iov_len = hdr->dxfer_len; in nvme_trans_io()
1761 xfer_bytes = min(((u64)hdr->dxfer_len), sum_iov_len); in nvme_trans_io()
1774 res = nvme_trans_do_nvme_io(ns, hdr, &cdb_info, is_write); in nvme_trans_io()
1782 static int nvme_trans_inquiry(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_inquiry() argument
1804 res = nvme_trans_standard_inquiry_page(ns, hdr, in nvme_trans_inquiry()
1807 res = nvme_trans_completion(hdr, in nvme_trans_inquiry()
1816 res = nvme_trans_supported_vpd_pages(ns, hdr, in nvme_trans_inquiry()
1820 res = nvme_trans_unit_serial_page(ns, hdr, inq_response, in nvme_trans_inquiry()
1824 res = nvme_trans_device_id_page(ns, hdr, inq_response, in nvme_trans_inquiry()
1828 res = nvme_trans_ext_inq_page(ns, hdr, alloc_len); in nvme_trans_inquiry()
1831 res = nvme_trans_bdev_limits_page(ns, hdr, inq_response, in nvme_trans_inquiry()
1835 res = nvme_trans_bdev_char_page(ns, hdr, alloc_len); in nvme_trans_inquiry()
1838 res = nvme_trans_completion(hdr, in nvme_trans_inquiry()
1851 static int nvme_trans_log_sense(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_log_sense() argument
1860 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_log_sense()
1869 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_log_sense()
1877 res = nvme_trans_log_supp_pages(ns, hdr, alloc_len); in nvme_trans_log_sense()
1880 res = nvme_trans_log_info_exceptions(ns, hdr, alloc_len); in nvme_trans_log_sense()
1883 res = nvme_trans_log_temperature(ns, hdr, alloc_len); in nvme_trans_log_sense()
1886 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_log_sense()
1896 static int nvme_trans_mode_select(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_mode_select() argument
1919 return nvme_trans_modesel_data(ns, hdr, cmd, parm_list_len, in nvme_trans_mode_select()
1926 static int nvme_trans_mode_sense(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_mode_sense() argument
1942 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_mode_sense()
1950 res = nvme_trans_mode_page_create(ns, hdr, cmd, alloc_len, in nvme_trans_mode_sense()
1956 res = nvme_trans_mode_page_create(ns, hdr, cmd, alloc_len, in nvme_trans_mode_sense()
1962 res = nvme_trans_mode_page_create(ns, hdr, cmd, alloc_len, in nvme_trans_mode_sense()
1968 res = nvme_trans_mode_page_create(ns, hdr, cmd, alloc_len, in nvme_trans_mode_sense()
1974 res = nvme_trans_mode_page_create(ns, hdr, cmd, alloc_len, in nvme_trans_mode_sense()
1980 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_mode_sense()
1990 static int nvme_trans_read_capacity(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_read_capacity() argument
2010 res = nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_read_capacity()
2022 res = nvme_trans_copy_to_user(hdr, response, xfer_len); in nvme_trans_read_capacity()
2030 static int nvme_trans_report_luns(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_report_luns() argument
2044 return nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_report_luns()
2051 res = nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_report_luns()
2060 res = nvme_trans_completion(hdr, in nvme_trans_report_luns()
2088 res = nvme_trans_copy_to_user(hdr, response, xfer_len); in nvme_trans_report_luns()
2096 static int nvme_trans_request_sense(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_request_sense() argument
2138 res = nvme_trans_copy_to_user(hdr, response, xfer_len); in nvme_trans_request_sense()
2146 struct sg_io_hdr *hdr, in nvme_trans_security_protocol() argument
2149 return nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_security_protocol()
2155 struct sg_io_hdr *hdr) in nvme_trans_synchronize_cache() argument
2165 return nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_synchronize_cache()
2168 static int nvme_trans_start_stop(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_start_stop() argument
2179 return nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_start_stop()
2185 int res = nvme_trans_synchronize_cache(ns, hdr); in nvme_trans_start_stop()
2194 static int nvme_trans_format_unit(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_format_unit() argument
2214 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_format_unit()
2226 res = nvme_trans_fmt_get_parm_header(hdr, parm_hdr_len, in nvme_trans_format_unit()
2233 res = nvme_trans_send_activate_fw_cmd(ns, hdr, 0); in nvme_trans_format_unit()
2236 res = nvme_trans_fmt_set_blk_size_count(ns, hdr); in nvme_trans_format_unit()
2240 res = nvme_trans_fmt_send_cmd(ns, hdr, nvme_pf_code); in nvme_trans_format_unit()
2247 struct sg_io_hdr *hdr, in nvme_trans_test_unit_ready() argument
2251 return nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_test_unit_ready()
2255 return nvme_trans_completion(hdr, SAM_STAT_GOOD, NO_SENSE, 0, 0); in nvme_trans_test_unit_ready()
2258 static int nvme_trans_write_buffer(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_write_buffer() argument
2268 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_write_buffer()
2275 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_write_buffer()
2285 res = nvme_trans_send_download_fw_cmd(ns, hdr, nvme_admin_download_fw, in nvme_trans_write_buffer()
2290 res = nvme_trans_send_activate_fw_cmd(ns, hdr, buffer_id); in nvme_trans_write_buffer()
2293 res = nvme_trans_send_download_fw_cmd(ns, hdr, nvme_admin_download_fw, in nvme_trans_write_buffer()
2298 res = nvme_trans_send_activate_fw_cmd(ns, hdr, buffer_id); in nvme_trans_write_buffer()
2301 res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_trans_write_buffer()
2324 static int nvme_trans_unmap(struct nvme_ns *ns, struct sg_io_hdr *hdr, in nvme_trans_unmap() argument
2341 res = nvme_trans_copy_from_user(hdr, plist, list_len); in nvme_trans_unmap()
2371 res = nvme_trans_status_code(hdr, nvme_sc); in nvme_trans_unmap()
2379 static int nvme_scsi_translate(struct nvme_ns *ns, struct sg_io_hdr *hdr) in nvme_scsi_translate() argument
2385 if (hdr->cmdp == NULL) in nvme_scsi_translate()
2387 if (copy_from_user(cmd, hdr->cmdp, hdr->cmd_len)) in nvme_scsi_translate()
2394 retcode = nvme_trans_status_code(hdr, NVME_SC_SUCCESS); in nvme_scsi_translate()
2405 retcode = nvme_trans_io(ns, hdr, 0, cmd); in nvme_scsi_translate()
2411 retcode = nvme_trans_io(ns, hdr, 1, cmd); in nvme_scsi_translate()
2414 retcode = nvme_trans_inquiry(ns, hdr, cmd); in nvme_scsi_translate()
2417 retcode = nvme_trans_log_sense(ns, hdr, cmd); in nvme_scsi_translate()
2421 retcode = nvme_trans_mode_select(ns, hdr, cmd); in nvme_scsi_translate()
2425 retcode = nvme_trans_mode_sense(ns, hdr, cmd); in nvme_scsi_translate()
2428 retcode = nvme_trans_read_capacity(ns, hdr, cmd, 0); in nvme_scsi_translate()
2433 retcode = nvme_trans_read_capacity(ns, hdr, cmd, 1); in nvme_scsi_translate()
2440 retcode = nvme_trans_report_luns(ns, hdr, cmd); in nvme_scsi_translate()
2443 retcode = nvme_trans_request_sense(ns, hdr, cmd); in nvme_scsi_translate()
2447 retcode = nvme_trans_security_protocol(ns, hdr, cmd); in nvme_scsi_translate()
2450 retcode = nvme_trans_start_stop(ns, hdr, cmd); in nvme_scsi_translate()
2453 retcode = nvme_trans_synchronize_cache(ns, hdr); in nvme_scsi_translate()
2456 retcode = nvme_trans_format_unit(ns, hdr, cmd); in nvme_scsi_translate()
2459 retcode = nvme_trans_test_unit_ready(ns, hdr, cmd); in nvme_scsi_translate()
2462 retcode = nvme_trans_write_buffer(ns, hdr, cmd); in nvme_scsi_translate()
2465 retcode = nvme_trans_unmap(ns, hdr, cmd); in nvme_scsi_translate()
2469 retcode = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, in nvme_scsi_translate()
2479 struct sg_io_hdr hdr; in nvme_sg_io() local
2484 if (copy_from_user(&hdr, u_hdr, sizeof(hdr))) in nvme_sg_io()
2486 if (hdr.interface_id != 'S') in nvme_sg_io()
2488 if (hdr.cmd_len > BLK_MAX_CDB) in nvme_sg_io()
2495 retcode = nvme_scsi_translate(ns, &hdr); in nvme_sg_io()
2498 if (copy_to_user(u_hdr, &hdr, sizeof(sg_io_hdr_t)) > 0) in nvme_sg_io()