Searched refs:cmd (Results 1 - 200 of 4213) sorted by relevance

1234567891011>>

/linux-4.4.14/include/linux/
H A Dfcntl.h12 #define IS_GETLK32(cmd) ((cmd) == F_GETLK)
13 #define IS_SETLK32(cmd) ((cmd) == F_SETLK)
14 #define IS_SETLKW32(cmd) ((cmd) == F_SETLKW)
15 #define IS_GETLK64(cmd) ((cmd) == F_GETLK64)
16 #define IS_SETLK64(cmd) ((cmd) == F_SETLK64)
17 #define IS_SETLKW64(cmd) ((cmd) == F_SETLKW64)
19 #define IS_GETLK32(cmd) (0)
20 #define IS_SETLK32(cmd) (0)
21 #define IS_SETLKW32(cmd) (0)
22 #define IS_GETLK64(cmd) ((cmd) == F_GETLK)
23 #define IS_SETLK64(cmd) ((cmd) == F_SETLK)
24 #define IS_SETLKW64(cmd) ((cmd) == F_SETLKW)
27 #define IS_GETLK(cmd) (IS_GETLK32(cmd) || IS_GETLK64(cmd))
28 #define IS_SETLK(cmd) (IS_SETLK32(cmd) || IS_SETLK64(cmd))
29 #define IS_SETLKW(cmd) (IS_SETLKW32(cmd) || IS_SETLKW64(cmd))
/linux-4.4.14/drivers/net/wireless/ti/wl18xx/
H A Dcmd.c22 #include "../wlcore/cmd.h"
26 #include "cmd.h"
32 struct wl18xx_cmd_channel_switch *cmd; wl18xx_cmd_channel_switch() local
36 wl1271_debug(DEBUG_ACX, "cmd channel switch (count=%d)", wl18xx_cmd_channel_switch()
39 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl18xx_cmd_channel_switch()
40 if (!cmd) { wl18xx_cmd_channel_switch()
45 cmd->role_id = wlvif->role_id; wl18xx_cmd_channel_switch()
46 cmd->channel = ch_switch->chandef.chan->hw_value; wl18xx_cmd_channel_switch()
47 cmd->switch_time = ch_switch->count; wl18xx_cmd_channel_switch()
48 cmd->stop_tx = ch_switch->block_tx; wl18xx_cmd_channel_switch()
52 cmd->band = WLCORE_BAND_2_4GHZ; wl18xx_cmd_channel_switch()
55 cmd->band = WLCORE_BAND_5GHZ; wl18xx_cmd_channel_switch()
72 cmd->local_supported_rates = cpu_to_le32(supported_rates); wl18xx_cmd_channel_switch()
73 cmd->channel_type = wlvif->channel_type; wl18xx_cmd_channel_switch()
75 ret = wl1271_cmd_send(wl, CMD_CHANNEL_SWITCH, cmd, sizeof(*cmd), 0); wl18xx_cmd_channel_switch()
82 kfree(cmd); wl18xx_cmd_channel_switch()
89 struct wl18xx_cmd_smart_config_start *cmd; wl18xx_cmd_smart_config_start() local
92 wl1271_debug(DEBUG_CMD, "cmd smart config start group_bitmap=0x%x", wl18xx_cmd_smart_config_start()
95 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl18xx_cmd_smart_config_start()
96 if (!cmd) { wl18xx_cmd_smart_config_start()
101 cmd->group_id_bitmask = cpu_to_le32(group_bitmap); wl18xx_cmd_smart_config_start()
103 ret = wl1271_cmd_send(wl, CMD_SMART_CONFIG_START, cmd, sizeof(*cmd), 0); wl18xx_cmd_smart_config_start()
110 kfree(cmd); wl18xx_cmd_smart_config_start()
117 struct wl1271_cmd_header *cmd; wl18xx_cmd_smart_config_stop() local
120 wl1271_debug(DEBUG_CMD, "cmd smart config stop"); wl18xx_cmd_smart_config_stop()
122 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl18xx_cmd_smart_config_stop()
123 if (!cmd) { wl18xx_cmd_smart_config_stop()
128 ret = wl1271_cmd_send(wl, CMD_SMART_CONFIG_STOP, cmd, sizeof(*cmd), 0); wl18xx_cmd_smart_config_stop()
135 kfree(cmd); wl18xx_cmd_smart_config_stop()
143 struct wl18xx_cmd_smart_config_set_group_key *cmd; wl18xx_cmd_smart_config_set_group_key() local
146 wl1271_debug(DEBUG_CMD, "cmd smart config set group key id=0x%x", wl18xx_cmd_smart_config_set_group_key()
149 if (key_len != sizeof(cmd->key)) { wl18xx_cmd_smart_config_set_group_key()
154 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl18xx_cmd_smart_config_set_group_key()
155 if (!cmd) { wl18xx_cmd_smart_config_set_group_key()
160 cmd->group_id = cpu_to_le32(group_id); wl18xx_cmd_smart_config_set_group_key()
161 memcpy(cmd->key, key, key_len); wl18xx_cmd_smart_config_set_group_key()
163 ret = wl1271_cmd_send(wl, CMD_SMART_CONFIG_SET_GROUP_KEY, cmd, wl18xx_cmd_smart_config_set_group_key()
164 sizeof(*cmd), 0); wl18xx_cmd_smart_config_set_group_key()
166 wl1271_error("failed to send smart config set group key cmd"); wl18xx_cmd_smart_config_set_group_key()
171 kfree(cmd); wl18xx_cmd_smart_config_set_group_key()
178 struct wlcore_cmd_cac_start *cmd; wl18xx_cmd_set_cac() local
181 wl1271_debug(DEBUG_CMD, "cmd cac (channel %d) %s", wl18xx_cmd_set_cac()
184 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl18xx_cmd_set_cac()
185 if (!cmd) wl18xx_cmd_set_cac()
188 cmd->role_id = wlvif->role_id; wl18xx_cmd_set_cac()
189 cmd->channel = wlvif->channel; wl18xx_cmd_set_cac()
191 cmd->band = WLCORE_BAND_5GHZ; wl18xx_cmd_set_cac()
192 cmd->bandwidth = wlcore_get_native_channel_type(wlvif->channel_type); wl18xx_cmd_set_cac()
196 cmd, sizeof(*cmd), 0); wl18xx_cmd_set_cac()
203 kfree(cmd); wl18xx_cmd_set_cac()
209 struct wl18xx_cmd_dfs_radar_debug *cmd; wl18xx_cmd_radar_detection_debug() local
212 wl1271_debug(DEBUG_CMD, "cmd radar detection debug (chan %d)", wl18xx_cmd_radar_detection_debug()
215 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl18xx_cmd_radar_detection_debug()
216 if (!cmd) wl18xx_cmd_radar_detection_debug()
219 cmd->channel = channel; wl18xx_cmd_radar_detection_debug()
222 cmd, sizeof(*cmd), 0); wl18xx_cmd_radar_detection_debug()
229 kfree(cmd); wl18xx_cmd_radar_detection_debug()
235 struct wl18xx_cmd_dfs_master_restart *cmd; wl18xx_cmd_dfs_master_restart() local
238 wl1271_debug(DEBUG_CMD, "cmd dfs master restart (role %d)", wl18xx_cmd_dfs_master_restart()
241 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl18xx_cmd_dfs_master_restart()
242 if (!cmd) wl18xx_cmd_dfs_master_restart()
245 cmd->role_id = wlvif->role_id; wl18xx_cmd_dfs_master_restart()
248 cmd, sizeof(*cmd), 0); wl18xx_cmd_dfs_master_restart()
254 kfree(cmd); wl18xx_cmd_dfs_master_restart()
H A Dscan.c26 static void wl18xx_adjust_channels(struct wl18xx_cmd_scan_params *cmd, wl18xx_adjust_channels() argument
29 memcpy(cmd->passive, cmd_channels->passive, sizeof(cmd->passive)); wl18xx_adjust_channels()
30 memcpy(cmd->active, cmd_channels->active, sizeof(cmd->active)); wl18xx_adjust_channels()
31 cmd->dfs = cmd_channels->dfs; wl18xx_adjust_channels()
32 cmd->passive_active = cmd_channels->passive_active; wl18xx_adjust_channels()
34 memcpy(cmd->channels_2, cmd_channels->channels_2, wl18xx_adjust_channels()
35 sizeof(cmd->channels_2)); wl18xx_adjust_channels()
36 memcpy(cmd->channels_5, cmd_channels->channels_5, wl18xx_adjust_channels()
37 sizeof(cmd->channels_5)); wl18xx_adjust_channels()
44 struct wl18xx_cmd_scan_params *cmd; wl18xx_scan_send() local
48 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl18xx_scan_send()
49 if (!cmd) { wl18xx_scan_send()
56 cmd->role_id = wlvif->dev_role_id; wl18xx_scan_send()
58 cmd->role_id = wlvif->role_id; wl18xx_scan_send()
60 if (WARN_ON(cmd->role_id == WL12XX_INVALID_ROLE_ID)) { wl18xx_scan_send()
65 cmd->scan_type = SCAN_TYPE_SEARCH; wl18xx_scan_send()
66 cmd->rssi_threshold = -127; wl18xx_scan_send()
67 cmd->snr_threshold = 0; wl18xx_scan_send()
69 cmd->bss_type = SCAN_BSS_TYPE_ANY; wl18xx_scan_send()
71 cmd->ssid_from_list = 0; wl18xx_scan_send()
72 cmd->filter = 0; wl18xx_scan_send()
73 cmd->add_broadcast = 0; wl18xx_scan_send()
75 cmd->urgency = 0; wl18xx_scan_send()
76 cmd->protect = 0; wl18xx_scan_send()
78 cmd->n_probe_reqs = wl->conf.scan.num_probe_reqs; wl18xx_scan_send()
79 cmd->terminate_after = 0; wl18xx_scan_send()
93 wl18xx_adjust_channels(cmd, cmd_channels); wl18xx_scan_send()
99 cmd->total_cycles = 1; wl18xx_scan_send()
102 cmd->rate = WL18XX_SCAN_RATE_6; wl18xx_scan_send()
104 cmd->tag = WL1271_SCAN_DEFAULT_TAG; wl18xx_scan_send()
107 cmd->ssid_len = req->ssids[0].ssid_len; wl18xx_scan_send()
108 memcpy(cmd->ssid, req->ssids[0].ssid, cmd->ssid_len); wl18xx_scan_send()
112 if (cmd->active[0]) { wl18xx_scan_send()
115 cmd->role_id, band, wl18xx_scan_send()
129 if (cmd->active[1] || cmd->dfs) { wl18xx_scan_send()
132 cmd->role_id, band, wl18xx_scan_send()
146 wl1271_dump(DEBUG_SCAN, "SCAN: ", cmd, sizeof(*cmd)); wl18xx_scan_send()
148 ret = wl1271_cmd_send(wl, CMD_SCAN, cmd, sizeof(*cmd), 0); wl18xx_scan_send()
156 kfree(cmd); wl18xx_scan_send()
174 struct wl18xx_cmd_scan_params *cmd; wl18xx_scan_sched_scan_config() local
180 wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config"); wl18xx_scan_sched_scan_config()
186 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl18xx_scan_sched_scan_config()
187 if (!cmd) { wl18xx_scan_sched_scan_config()
192 cmd->role_id = wlvif->role_id; wl18xx_scan_sched_scan_config()
194 if (WARN_ON(cmd->role_id == WL12XX_INVALID_ROLE_ID)) { wl18xx_scan_sched_scan_config()
199 cmd->scan_type = SCAN_TYPE_PERIODIC; wl18xx_scan_sched_scan_config()
200 cmd->rssi_threshold = c->rssi_threshold; wl18xx_scan_sched_scan_config()
201 cmd->snr_threshold = c->snr_threshold; wl18xx_scan_sched_scan_config()
204 cmd->bss_type = SCAN_BSS_TYPE_ANY; wl18xx_scan_sched_scan_config()
206 cmd->ssid_from_list = 1; wl18xx_scan_sched_scan_config()
208 cmd->filter = 1; wl18xx_scan_sched_scan_config()
209 cmd->add_broadcast = 0; wl18xx_scan_sched_scan_config()
211 cmd->urgency = 0; wl18xx_scan_sched_scan_config()
212 cmd->protect = 0; wl18xx_scan_sched_scan_config()
214 cmd->n_probe_reqs = c->num_probe_reqs; wl18xx_scan_sched_scan_config()
216 cmd->terminate_after = 0; wl18xx_scan_sched_scan_config()
228 wl18xx_adjust_channels(cmd, cmd_channels); wl18xx_scan_sched_scan_config()
232 cmd->short_cycles_msec = wl18xx_scan_sched_scan_config()
234 cmd->long_cycles_msec = cpu_to_le16(c->long_interval); wl18xx_scan_sched_scan_config()
235 cmd->short_cycles_count = c->num_short_intervals; wl18xx_scan_sched_scan_config()
237 cmd->short_cycles_msec = 0; wl18xx_scan_sched_scan_config()
238 cmd->long_cycles_msec = wl18xx_scan_sched_scan_config()
240 cmd->short_cycles_count = 0; wl18xx_scan_sched_scan_config()
243 le16_to_cpu(cmd->short_cycles_msec), wl18xx_scan_sched_scan_config()
244 le16_to_cpu(cmd->long_cycles_msec), wl18xx_scan_sched_scan_config()
245 cmd->short_cycles_count); wl18xx_scan_sched_scan_config()
247 cmd->total_cycles = 0; wl18xx_scan_sched_scan_config()
249 cmd->tag = WL1271_SCAN_DEFAULT_TAG; wl18xx_scan_sched_scan_config()
252 cmd->report_threshold = 1; wl18xx_scan_sched_scan_config()
253 cmd->terminate_on_report = 0; wl18xx_scan_sched_scan_config()
255 if (cmd->active[0]) { wl18xx_scan_sched_scan_config()
258 cmd->role_id, band, wl18xx_scan_sched_scan_config()
272 if (cmd->active[1] || cmd->dfs) { wl18xx_scan_sched_scan_config()
275 cmd->role_id, band, wl18xx_scan_sched_scan_config()
289 wl1271_dump(DEBUG_SCAN, "SCAN: ", cmd, sizeof(*cmd)); wl18xx_scan_sched_scan_config()
291 ret = wl1271_cmd_send(wl, CMD_SCAN, cmd, sizeof(*cmd), 0); wl18xx_scan_sched_scan_config()
299 kfree(cmd); wl18xx_scan_sched_scan_config()
316 wl1271_debug(DEBUG_CMD, "cmd periodic scan stop"); __wl18xx_scan_stop()
H A DMakefile1 wl18xx-objs = main.o acx.o tx.o io.o debugfs.o scan.o cmd.o event.o
/linux-4.4.14/tools/perf/util/
H A Drun-command.c19 int start_command(struct child_process *cmd) start_command() argument
30 need_in = !cmd->no_stdin && cmd->in < 0; start_command()
33 if (cmd->out > 0) start_command()
34 close(cmd->out); start_command()
37 cmd->in = fdin[1]; start_command()
40 need_out = !cmd->no_stdout start_command()
41 && !cmd->stdout_to_stderr start_command()
42 && cmd->out < 0; start_command()
47 else if (cmd->in) start_command()
48 close(cmd->in); start_command()
51 cmd->out = fdout[0]; start_command()
54 need_err = !cmd->no_stderr && cmd->err < 0; start_command()
59 else if (cmd->in) start_command()
60 close(cmd->in); start_command()
63 else if (cmd->out) start_command()
64 close(cmd->out); start_command()
67 cmd->err = fderr[0]; start_command()
71 cmd->pid = fork(); start_command()
72 if (!cmd->pid) { start_command()
73 if (cmd->no_stdin) start_command()
78 } else if (cmd->in) { start_command()
79 dup2(cmd->in, 0); start_command()
80 close(cmd->in); start_command()
83 if (cmd->no_stderr) start_command()
90 if (cmd->no_stdout) start_command()
92 else if (cmd->stdout_to_stderr) start_command()
97 } else if (cmd->out > 1) { start_command()
98 dup2(cmd->out, 1); start_command()
99 close(cmd->out); start_command()
102 if (cmd->dir && chdir(cmd->dir)) start_command()
103 die("exec %s: cd to %s failed (%s)", cmd->argv[0], start_command()
104 cmd->dir, strerror_r(errno, sbuf, sizeof(sbuf))); start_command()
105 if (cmd->env) { start_command()
106 for (; *cmd->env; cmd->env++) { start_command()
107 if (strchr(*cmd->env, '=')) start_command()
108 putenv((char*)*cmd->env); start_command()
110 unsetenv(*cmd->env); start_command()
113 if (cmd->preexec_cb) start_command()
114 cmd->preexec_cb(); start_command()
115 if (cmd->perf_cmd) { start_command()
116 execv_perf_cmd(cmd->argv); start_command()
118 execvp(cmd->argv[0], (char *const*) cmd->argv); start_command()
123 if (cmd->pid < 0) { start_command()
127 else if (cmd->in) start_command()
128 close(cmd->in); start_command()
131 else if (cmd->out) start_command()
132 close(cmd->out); start_command()
142 else if (cmd->in) start_command()
143 close(cmd->in); start_command()
147 else if (cmd->out) start_command()
148 close(cmd->out); start_command()
190 int finish_command(struct child_process *cmd) finish_command() argument
192 return wait_or_whine(cmd->pid); finish_command()
195 int run_command(struct child_process *cmd) run_command() argument
197 int code = start_command(cmd); run_command()
200 return finish_command(cmd); run_command()
203 static void prepare_run_command_v_opt(struct child_process *cmd, prepare_run_command_v_opt() argument
207 memset(cmd, 0, sizeof(*cmd)); prepare_run_command_v_opt()
208 cmd->argv = argv; prepare_run_command_v_opt()
209 cmd->no_stdin = opt & RUN_COMMAND_NO_STDIN ? 1 : 0; prepare_run_command_v_opt()
210 cmd->perf_cmd = opt & RUN_PERF_CMD ? 1 : 0; prepare_run_command_v_opt()
211 cmd->stdout_to_stderr = opt & RUN_COMMAND_STDOUT_TO_STDERR ? 1 : 0; prepare_run_command_v_opt()
216 struct child_process cmd; run_command_v_opt() local
217 prepare_run_command_v_opt(&cmd, argv, opt); run_command_v_opt()
218 return run_command(&cmd); run_command_v_opt()
/linux-4.4.14/drivers/md/
H A Ddm-cache-metadata.c216 static int superblock_read_lock(struct dm_cache_metadata *cmd, superblock_read_lock() argument
219 return dm_bm_read_lock(cmd->bm, CACHE_SUPERBLOCK_LOCATION, superblock_read_lock()
223 static int superblock_lock_zero(struct dm_cache_metadata *cmd, superblock_lock_zero() argument
226 return dm_bm_write_lock_zero(cmd->bm, CACHE_SUPERBLOCK_LOCATION, superblock_lock_zero()
230 static int superblock_lock(struct dm_cache_metadata *cmd, superblock_lock() argument
233 return dm_bm_write_lock(cmd->bm, CACHE_SUPERBLOCK_LOCATION, superblock_lock()
268 static void __setup_mapping_info(struct dm_cache_metadata *cmd) __setup_mapping_info() argument
277 dm_array_info_init(&cmd->info, cmd->tm, &vt); __setup_mapping_info()
279 if (cmd->policy_hint_size) { __setup_mapping_info()
281 dm_array_info_init(&cmd->hint_info, cmd->tm, &vt); __setup_mapping_info()
285 static int __save_sm_root(struct dm_cache_metadata *cmd) __save_sm_root() argument
290 r = dm_sm_root_size(cmd->metadata_sm, &metadata_len); __save_sm_root()
294 return dm_sm_copy_root(cmd->metadata_sm, &cmd->metadata_space_map_root, __save_sm_root()
298 static void __copy_sm_root(struct dm_cache_metadata *cmd, __copy_sm_root() argument
302 &cmd->metadata_space_map_root, __copy_sm_root()
303 sizeof(cmd->metadata_space_map_root)); __copy_sm_root()
306 static int __write_initial_superblock(struct dm_cache_metadata *cmd) __write_initial_superblock() argument
311 sector_t bdev_size = i_size_read(cmd->bdev->bd_inode) >> SECTOR_SHIFT; __write_initial_superblock()
317 r = dm_tm_pre_commit(cmd->tm); __write_initial_superblock()
325 r = __save_sm_root(cmd); __write_initial_superblock()
329 r = superblock_lock_zero(cmd, &sblock); __write_initial_superblock()
342 __copy_sm_root(cmd, disk_super); __write_initial_superblock()
344 disk_super->mapping_root = cpu_to_le64(cmd->root); __write_initial_superblock()
345 disk_super->hint_root = cpu_to_le64(cmd->hint_root); __write_initial_superblock()
346 disk_super->discard_root = cpu_to_le64(cmd->discard_root); __write_initial_superblock()
347 disk_super->discard_block_size = cpu_to_le64(cmd->discard_block_size); __write_initial_superblock()
348 disk_super->discard_nr_blocks = cpu_to_le64(from_dblock(cmd->discard_nr_blocks)); __write_initial_superblock()
350 disk_super->data_block_size = cpu_to_le32(cmd->data_block_size); __write_initial_superblock()
358 return dm_tm_commit(cmd->tm, sblock); __write_initial_superblock()
361 static int __format_metadata(struct dm_cache_metadata *cmd) __format_metadata() argument
365 r = dm_tm_create_with_sm(cmd->bm, CACHE_SUPERBLOCK_LOCATION, __format_metadata()
366 &cmd->tm, &cmd->metadata_sm); __format_metadata()
372 __setup_mapping_info(cmd); __format_metadata()
374 r = dm_array_empty(&cmd->info, &cmd->root); __format_metadata()
378 dm_disk_bitset_init(cmd->tm, &cmd->discard_info); __format_metadata()
380 r = dm_bitset_empty(&cmd->discard_info, &cmd->discard_root); __format_metadata()
384 cmd->discard_block_size = 0; __format_metadata()
385 cmd->discard_nr_blocks = 0; __format_metadata()
387 r = __write_initial_superblock(cmd); __format_metadata()
391 cmd->clean_when_opened = true; __format_metadata()
395 dm_tm_destroy(cmd->tm); __format_metadata()
396 dm_sm_destroy(cmd->metadata_sm); __format_metadata()
402 struct dm_cache_metadata *cmd) __check_incompat_features()
416 if (get_disk_ro(cmd->bdev->bd_disk)) __check_incompat_features()
429 static int __open_metadata(struct dm_cache_metadata *cmd) __open_metadata() argument
436 r = superblock_read_lock(cmd, &sblock); __open_metadata()
445 if (le32_to_cpu(disk_super->data_block_size) != cmd->data_block_size) { __open_metadata()
448 (unsigned long long)cmd->data_block_size); __open_metadata()
453 r = __check_incompat_features(disk_super, cmd); __open_metadata()
457 r = dm_tm_open_with_sm(cmd->bm, CACHE_SUPERBLOCK_LOCATION, __open_metadata()
460 &cmd->tm, &cmd->metadata_sm); __open_metadata()
466 __setup_mapping_info(cmd); __open_metadata()
467 dm_disk_bitset_init(cmd->tm, &cmd->discard_info); __open_metadata()
469 cmd->clean_when_opened = test_bit(CLEAN_SHUTDOWN, &sb_flags); __open_metadata()
479 static int __open_or_format_metadata(struct dm_cache_metadata *cmd, __open_or_format_metadata() argument
485 r = __superblock_all_zeroes(cmd->bm, &unformatted); __open_or_format_metadata()
490 return format_device ? __format_metadata(cmd) : -EPERM; __open_or_format_metadata()
492 return __open_metadata(cmd); __open_or_format_metadata()
495 static int __create_persistent_data_objects(struct dm_cache_metadata *cmd, __create_persistent_data_objects() argument
499 cmd->bm = dm_block_manager_create(cmd->bdev, DM_CACHE_METADATA_BLOCK_SIZE << SECTOR_SHIFT, __create_persistent_data_objects()
502 if (IS_ERR(cmd->bm)) { __create_persistent_data_objects()
504 return PTR_ERR(cmd->bm); __create_persistent_data_objects()
507 r = __open_or_format_metadata(cmd, may_format_device); __create_persistent_data_objects()
509 dm_block_manager_destroy(cmd->bm); __create_persistent_data_objects()
514 static void __destroy_persistent_data_objects(struct dm_cache_metadata *cmd) __destroy_persistent_data_objects() argument
516 dm_sm_destroy(cmd->metadata_sm); __destroy_persistent_data_objects()
517 dm_tm_destroy(cmd->tm); __destroy_persistent_data_objects()
518 dm_block_manager_destroy(cmd->bm); __destroy_persistent_data_objects()
542 static void read_superblock_fields(struct dm_cache_metadata *cmd, read_superblock_fields() argument
545 cmd->flags = le32_to_cpu(disk_super->flags); read_superblock_fields()
546 cmd->root = le64_to_cpu(disk_super->mapping_root); read_superblock_fields()
547 cmd->hint_root = le64_to_cpu(disk_super->hint_root); read_superblock_fields()
548 cmd->discard_root = le64_to_cpu(disk_super->discard_root); read_superblock_fields()
549 cmd->discard_block_size = le64_to_cpu(disk_super->discard_block_size); read_superblock_fields()
550 cmd->discard_nr_blocks = to_dblock(le64_to_cpu(disk_super->discard_nr_blocks)); read_superblock_fields()
551 cmd->data_block_size = le32_to_cpu(disk_super->data_block_size); read_superblock_fields()
552 cmd->cache_blocks = to_cblock(le32_to_cpu(disk_super->cache_blocks)); read_superblock_fields()
553 strncpy(cmd->policy_name, disk_super->policy_name, sizeof(cmd->policy_name)); read_superblock_fields()
554 cmd->policy_version[0] = le32_to_cpu(disk_super->policy_version[0]); read_superblock_fields()
555 cmd->policy_version[1] = le32_to_cpu(disk_super->policy_version[1]); read_superblock_fields()
556 cmd->policy_version[2] = le32_to_cpu(disk_super->policy_version[2]); read_superblock_fields()
557 cmd->policy_hint_size = le32_to_cpu(disk_super->policy_hint_size); read_superblock_fields()
559 cmd->stats.read_hits = le32_to_cpu(disk_super->read_hits); read_superblock_fields()
560 cmd->stats.read_misses = le32_to_cpu(disk_super->read_misses); read_superblock_fields()
561 cmd->stats.write_hits = le32_to_cpu(disk_super->write_hits); read_superblock_fields()
562 cmd->stats.write_misses = le32_to_cpu(disk_super->write_misses); read_superblock_fields()
564 cmd->changed = false; read_superblock_fields()
570 static int __begin_transaction_flags(struct dm_cache_metadata *cmd, __begin_transaction_flags() argument
577 r = superblock_lock(cmd, &sblock); __begin_transaction_flags()
583 read_superblock_fields(cmd, disk_super); __begin_transaction_flags()
586 return dm_bm_flush(cmd->bm); __begin_transaction_flags()
589 static int __begin_transaction(struct dm_cache_metadata *cmd) __begin_transaction() argument
599 r = superblock_read_lock(cmd, &sblock); __begin_transaction()
604 read_superblock_fields(cmd, disk_super); __begin_transaction()
610 static int __commit_transaction(struct dm_cache_metadata *cmd, __commit_transaction() argument
622 r = dm_bitset_flush(&cmd->discard_info, cmd->discard_root, __commit_transaction()
623 &cmd->discard_root); __commit_transaction()
627 r = dm_tm_pre_commit(cmd->tm); __commit_transaction()
631 r = __save_sm_root(cmd); __commit_transaction()
635 r = superblock_lock(cmd, &sblock); __commit_transaction()
641 disk_super->flags = cpu_to_le32(cmd->flags); __commit_transaction()
645 disk_super->mapping_root = cpu_to_le64(cmd->root); __commit_transaction()
646 disk_super->hint_root = cpu_to_le64(cmd->hint_root); __commit_transaction()
647 disk_super->discard_root = cpu_to_le64(cmd->discard_root); __commit_transaction()
648 disk_super->discard_block_size = cpu_to_le64(cmd->discard_block_size); __commit_transaction()
649 disk_super->discard_nr_blocks = cpu_to_le64(from_dblock(cmd->discard_nr_blocks)); __commit_transaction()
650 disk_super->cache_blocks = cpu_to_le32(from_cblock(cmd->cache_blocks)); __commit_transaction()
651 strncpy(disk_super->policy_name, cmd->policy_name, sizeof(disk_super->policy_name)); __commit_transaction()
652 disk_super->policy_version[0] = cpu_to_le32(cmd->policy_version[0]); __commit_transaction()
653 disk_super->policy_version[1] = cpu_to_le32(cmd->policy_version[1]); __commit_transaction()
654 disk_super->policy_version[2] = cpu_to_le32(cmd->policy_version[2]); __commit_transaction()
656 disk_super->read_hits = cpu_to_le32(cmd->stats.read_hits); __commit_transaction()
657 disk_super->read_misses = cpu_to_le32(cmd->stats.read_misses); __commit_transaction()
658 disk_super->write_hits = cpu_to_le32(cmd->stats.write_hits); __commit_transaction()
659 disk_super->write_misses = cpu_to_le32(cmd->stats.write_misses); __commit_transaction()
660 __copy_sm_root(cmd, disk_super); __commit_transaction()
662 return dm_tm_commit(cmd->tm, sblock); __commit_transaction()
698 struct dm_cache_metadata *cmd; metadata_open() local
700 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); metadata_open()
701 if (!cmd) { metadata_open()
706 atomic_set(&cmd->ref_count, 1); metadata_open()
707 init_rwsem(&cmd->root_lock); metadata_open()
708 cmd->bdev = bdev; metadata_open()
709 cmd->data_block_size = data_block_size; metadata_open()
710 cmd->cache_blocks = 0; metadata_open()
711 cmd->policy_hint_size = policy_hint_size; metadata_open()
712 cmd->changed = true; metadata_open()
713 cmd->fail_io = false; metadata_open()
715 r = __create_persistent_data_objects(cmd, may_format_device); metadata_open()
717 kfree(cmd); metadata_open()
721 r = __begin_transaction_flags(cmd, clear_clean_shutdown); metadata_open()
723 dm_cache_metadata_close(cmd); metadata_open()
727 return cmd; metadata_open()
740 struct dm_cache_metadata *cmd; lookup() local
742 list_for_each_entry(cmd, &table, list) lookup()
743 if (cmd->bdev == bdev) { lookup()
744 atomic_inc(&cmd->ref_count); lookup()
745 return cmd; lookup()
756 struct dm_cache_metadata *cmd, *cmd2; lookup_or_open() local
759 cmd = lookup(bdev); lookup_or_open()
762 if (cmd) lookup_or_open()
763 return cmd; lookup_or_open()
765 cmd = metadata_open(bdev, data_block_size, may_format_device, policy_hint_size); lookup_or_open()
766 if (!IS_ERR(cmd)) { lookup_or_open()
771 __destroy_persistent_data_objects(cmd); lookup_or_open()
772 kfree(cmd); lookup_or_open()
775 list_add(&cmd->list, &table); lookup_or_open()
779 return cmd; lookup_or_open()
782 static bool same_params(struct dm_cache_metadata *cmd, sector_t data_block_size) same_params() argument
784 if (cmd->data_block_size != data_block_size) { same_params()
787 (unsigned long long) cmd->data_block_size); same_params()
799 struct dm_cache_metadata *cmd = lookup_or_open(bdev, data_block_size, dm_cache_metadata_open() local
802 if (!IS_ERR(cmd) && !same_params(cmd, data_block_size)) { dm_cache_metadata_open()
803 dm_cache_metadata_close(cmd); dm_cache_metadata_open()
807 return cmd; dm_cache_metadata_open()
810 void dm_cache_metadata_close(struct dm_cache_metadata *cmd) dm_cache_metadata_close() argument
812 if (atomic_dec_and_test(&cmd->ref_count)) { dm_cache_metadata_close()
814 list_del(&cmd->list); dm_cache_metadata_close()
817 if (!cmd->fail_io) dm_cache_metadata_close()
818 __destroy_persistent_data_objects(cmd); dm_cache_metadata_close()
819 kfree(cmd); dm_cache_metadata_close()
826 static int block_unmapped_or_clean(struct dm_cache_metadata *cmd, dm_cblock_t b, block_unmapped_or_clean() argument
834 r = dm_array_get_value(&cmd->info, cmd->root, from_cblock(b), &value); block_unmapped_or_clean()
846 static int blocks_are_unmapped_or_clean(struct dm_cache_metadata *cmd, blocks_are_unmapped_or_clean() argument
854 r = block_unmapped_or_clean(cmd, begin, result); blocks_are_unmapped_or_clean()
870 static bool cmd_write_lock(struct dm_cache_metadata *cmd) cmd_write_lock() argument
872 down_write(&cmd->root_lock); cmd_write_lock()
873 if (cmd->fail_io || dm_bm_is_read_only(cmd->bm)) { cmd_write_lock()
874 up_write(&cmd->root_lock); cmd_write_lock()
880 #define WRITE_LOCK(cmd) \
882 if (!cmd_write_lock((cmd))) \
886 #define WRITE_LOCK_VOID(cmd) \
888 if (!cmd_write_lock((cmd))) \
892 #define WRITE_UNLOCK(cmd) \
893 up_write(&(cmd)->root_lock)
895 static bool cmd_read_lock(struct dm_cache_metadata *cmd) cmd_read_lock() argument
897 down_read(&cmd->root_lock); cmd_read_lock()
898 if (cmd->fail_io) { cmd_read_lock()
899 up_read(&cmd->root_lock); cmd_read_lock()
905 #define READ_LOCK(cmd) \
907 if (!cmd_read_lock((cmd))) \
911 #define READ_LOCK_VOID(cmd) \
913 if (!cmd_read_lock((cmd))) \
917 #define READ_UNLOCK(cmd) \
918 up_read(&(cmd)->root_lock)
920 int dm_cache_resize(struct dm_cache_metadata *cmd, dm_cblock_t new_cache_size) dm_cache_resize() argument
926 WRITE_LOCK(cmd); dm_cache_resize()
929 if (from_cblock(new_cache_size) < from_cblock(cmd->cache_blocks)) { dm_cache_resize()
930 r = blocks_are_unmapped_or_clean(cmd, new_cache_size, cmd->cache_blocks, &clean); dm_cache_resize()
944 r = dm_array_resize(&cmd->info, cmd->root, from_cblock(cmd->cache_blocks), dm_cache_resize()
946 &null_mapping, &cmd->root); dm_cache_resize()
948 cmd->cache_blocks = new_cache_size; dm_cache_resize()
949 cmd->changed = true; dm_cache_resize()
952 WRITE_UNLOCK(cmd); dm_cache_resize()
957 int dm_cache_discard_bitset_resize(struct dm_cache_metadata *cmd, dm_cache_discard_bitset_resize() argument
963 WRITE_LOCK(cmd); dm_cache_discard_bitset_resize()
964 r = dm_bitset_resize(&cmd->discard_info, dm_cache_discard_bitset_resize()
965 cmd->discard_root, dm_cache_discard_bitset_resize()
966 from_dblock(cmd->discard_nr_blocks), dm_cache_discard_bitset_resize()
968 false, &cmd->discard_root); dm_cache_discard_bitset_resize()
970 cmd->discard_block_size = discard_block_size; dm_cache_discard_bitset_resize()
971 cmd->discard_nr_blocks = new_nr_entries; dm_cache_discard_bitset_resize()
974 cmd->changed = true; dm_cache_discard_bitset_resize()
975 WRITE_UNLOCK(cmd); dm_cache_discard_bitset_resize()
980 static int __set_discard(struct dm_cache_metadata *cmd, dm_dblock_t b) __set_discard() argument
982 return dm_bitset_set_bit(&cmd->discard_info, cmd->discard_root, __set_discard()
983 from_dblock(b), &cmd->discard_root); __set_discard()
986 static int __clear_discard(struct dm_cache_metadata *cmd, dm_dblock_t b) __clear_discard() argument
988 return dm_bitset_clear_bit(&cmd->discard_info, cmd->discard_root, __clear_discard()
989 from_dblock(b), &cmd->discard_root); __clear_discard()
992 static int __is_discarded(struct dm_cache_metadata *cmd, dm_dblock_t b, __is_discarded() argument
995 return dm_bitset_test_bit(&cmd->discard_info, cmd->discard_root, __is_discarded()
996 from_dblock(b), &cmd->discard_root, __is_discarded()
1000 static int __discard(struct dm_cache_metadata *cmd, __discard() argument
1005 r = (discard ? __set_discard : __clear_discard)(cmd, dblock); __discard()
1009 cmd->changed = true; __discard()
1013 int dm_cache_set_discard(struct dm_cache_metadata *cmd, dm_cache_set_discard() argument
1018 WRITE_LOCK(cmd); dm_cache_set_discard()
1019 r = __discard(cmd, dblock, discard); dm_cache_set_discard()
1020 WRITE_UNLOCK(cmd); dm_cache_set_discard()
1025 static int __load_discards(struct dm_cache_metadata *cmd, __load_discards() argument
1032 for (b = 0; b < from_dblock(cmd->discard_nr_blocks); b++) { __load_discards()
1035 if (cmd->clean_when_opened) { __load_discards()
1036 r = __is_discarded(cmd, dblock, &discard); __load_discards()
1042 r = fn(context, cmd->discard_block_size, dblock, discard); __load_discards()
1050 int dm_cache_load_discards(struct dm_cache_metadata *cmd, dm_cache_load_discards() argument
1055 READ_LOCK(cmd); dm_cache_load_discards()
1056 r = __load_discards(cmd, fn, context); dm_cache_load_discards()
1057 READ_UNLOCK(cmd); dm_cache_load_discards()
1062 int dm_cache_size(struct dm_cache_metadata *cmd, dm_cblock_t *result) dm_cache_size() argument
1064 READ_LOCK(cmd); dm_cache_size()
1065 *result = cmd->cache_blocks; dm_cache_size()
1066 READ_UNLOCK(cmd); dm_cache_size()
1071 static int __remove(struct dm_cache_metadata *cmd, dm_cblock_t cblock) __remove() argument
1077 r = dm_array_set_value(&cmd->info, cmd->root, from_cblock(cblock), __remove()
1078 &value, &cmd->root); __remove()
1082 cmd->changed = true; __remove()
1086 int dm_cache_remove_mapping(struct dm_cache_metadata *cmd, dm_cblock_t cblock) dm_cache_remove_mapping() argument
1090 WRITE_LOCK(cmd); dm_cache_remove_mapping()
1091 r = __remove(cmd, cblock); dm_cache_remove_mapping()
1092 WRITE_UNLOCK(cmd); dm_cache_remove_mapping()
1097 static int __insert(struct dm_cache_metadata *cmd, __insert() argument
1104 r = dm_array_set_value(&cmd->info, cmd->root, from_cblock(cblock), __insert()
1105 &value, &cmd->root); __insert()
1109 cmd->changed = true; __insert()
1113 int dm_cache_insert_mapping(struct dm_cache_metadata *cmd, dm_cache_insert_mapping() argument
1118 WRITE_LOCK(cmd); dm_cache_insert_mapping()
1119 r = __insert(cmd, cblock, oblock); dm_cache_insert_mapping()
1120 WRITE_UNLOCK(cmd); dm_cache_insert_mapping()
1129 struct dm_cache_metadata *cmd; member in struct:thunk
1134 static bool policy_unchanged(struct dm_cache_metadata *cmd, policy_unchanged() argument
1144 if (strncmp(cmd->policy_name, policy_name, sizeof(cmd->policy_name))) policy_unchanged()
1150 if (cmd->policy_version[0] != policy_version[0]) policy_unchanged()
1156 if (cmd->policy_hint_size != policy_hint_size) policy_unchanged()
1162 static bool hints_array_initialized(struct dm_cache_metadata *cmd) hints_array_initialized() argument
1164 return cmd->hint_root && cmd->policy_hint_size; hints_array_initialized()
1167 static bool hints_array_available(struct dm_cache_metadata *cmd, hints_array_available() argument
1170 return cmd->clean_when_opened && policy_unchanged(cmd, policy) && hints_array_available()
1171 hints_array_initialized(cmd); hints_array_available()
1183 struct dm_cache_metadata *cmd = thunk->cmd; __load_mapping() local
1190 r = dm_array_get_value(&cmd->hint_info, cmd->hint_root, __load_mapping()
1204 static int __load_mappings(struct dm_cache_metadata *cmd, __load_mappings() argument
1213 thunk.cmd = cmd; __load_mappings()
1214 thunk.respect_dirty_flags = cmd->clean_when_opened; __load_mappings()
1215 thunk.hints_valid = hints_array_available(cmd, policy); __load_mappings()
1217 return dm_array_walk(&cmd->info, cmd->root, __load_mapping, &thunk); __load_mappings()
1220 int dm_cache_load_mappings(struct dm_cache_metadata *cmd, dm_cache_load_mappings() argument
1226 READ_LOCK(cmd); dm_cache_load_mappings()
1227 r = __load_mappings(cmd, policy, fn, context); dm_cache_load_mappings()
1228 READ_UNLOCK(cmd); dm_cache_load_mappings()
1246 static int __dump_mappings(struct dm_cache_metadata *cmd) __dump_mappings() argument
1248 return dm_array_walk(&cmd->info, cmd->root, __dump_mapping, NULL); __dump_mappings()
1251 void dm_cache_dump(struct dm_cache_metadata *cmd) dm_cache_dump() argument
1253 READ_LOCK_VOID(cmd); dm_cache_dump()
1254 __dump_mappings(cmd); dm_cache_dump()
1255 READ_UNLOCK(cmd); dm_cache_dump()
1258 int dm_cache_changed_this_transaction(struct dm_cache_metadata *cmd) dm_cache_changed_this_transaction() argument
1262 READ_LOCK(cmd); dm_cache_changed_this_transaction()
1263 r = cmd->changed; dm_cache_changed_this_transaction()
1264 READ_UNLOCK(cmd); dm_cache_changed_this_transaction()
1269 static int __dirty(struct dm_cache_metadata *cmd, dm_cblock_t cblock, bool dirty) __dirty() argument
1276 r = dm_array_get_value(&cmd->info, cmd->root, from_cblock(cblock), &value); __dirty()
1289 r = dm_array_set_value(&cmd->info, cmd->root, from_cblock(cblock), __dirty()
1290 &value, &cmd->root); __dirty()
1294 cmd->changed = true; __dirty()
1299 int dm_cache_set_dirty(struct dm_cache_metadata *cmd, dm_cache_set_dirty() argument
1304 WRITE_LOCK(cmd); dm_cache_set_dirty()
1305 r = __dirty(cmd, cblock, dirty); dm_cache_set_dirty()
1306 WRITE_UNLOCK(cmd); dm_cache_set_dirty()
1311 void dm_cache_metadata_get_stats(struct dm_cache_metadata *cmd, dm_cache_metadata_get_stats() argument
1314 READ_LOCK_VOID(cmd); dm_cache_metadata_get_stats()
1315 *stats = cmd->stats; dm_cache_metadata_get_stats()
1316 READ_UNLOCK(cmd); dm_cache_metadata_get_stats()
1319 void dm_cache_metadata_set_stats(struct dm_cache_metadata *cmd, dm_cache_metadata_set_stats() argument
1322 WRITE_LOCK_VOID(cmd); dm_cache_metadata_set_stats()
1323 cmd->stats = *stats; dm_cache_metadata_set_stats()
1324 WRITE_UNLOCK(cmd); dm_cache_metadata_set_stats()
1327 int dm_cache_commit(struct dm_cache_metadata *cmd, bool clean_shutdown) dm_cache_commit() argument
1333 WRITE_LOCK(cmd); dm_cache_commit()
1334 r = __commit_transaction(cmd, mutator); dm_cache_commit()
1338 r = __begin_transaction(cmd); dm_cache_commit()
1341 WRITE_UNLOCK(cmd); dm_cache_commit()
1345 int dm_cache_get_free_metadata_block_count(struct dm_cache_metadata *cmd, dm_cache_get_free_metadata_block_count() argument
1350 READ_LOCK(cmd); dm_cache_get_free_metadata_block_count()
1351 r = dm_sm_get_nr_free(cmd->metadata_sm, result); dm_cache_get_free_metadata_block_count()
1352 READ_UNLOCK(cmd); dm_cache_get_free_metadata_block_count()
1357 int dm_cache_get_metadata_dev_size(struct dm_cache_metadata *cmd, dm_cache_get_metadata_dev_size() argument
1362 READ_LOCK(cmd); dm_cache_get_metadata_dev_size()
1363 r = dm_sm_get_nr_blocks(cmd->metadata_sm, result); dm_cache_get_metadata_dev_size()
1364 READ_UNLOCK(cmd); dm_cache_get_metadata_dev_size()
1371 static int begin_hints(struct dm_cache_metadata *cmd, struct dm_cache_policy *policy) begin_hints() argument
1380 (strlen(policy_name) > sizeof(cmd->policy_name) - 1)) begin_hints()
1383 if (!policy_unchanged(cmd, policy)) { begin_hints()
1384 strncpy(cmd->policy_name, policy_name, sizeof(cmd->policy_name)); begin_hints()
1385 memcpy(cmd->policy_version, policy_version, sizeof(cmd->policy_version)); begin_hints()
1390 cmd->policy_hint_size = hint_size; begin_hints()
1392 if (cmd->hint_root) { begin_hints()
1393 r = dm_array_del(&cmd->hint_info, cmd->hint_root); begin_hints()
1398 r = dm_array_empty(&cmd->hint_info, &cmd->hint_root); begin_hints()
1404 r = dm_array_resize(&cmd->hint_info, cmd->hint_root, 0, begin_hints()
1405 from_cblock(cmd->cache_blocks), begin_hints()
1406 &value, &cmd->hint_root); begin_hints()
1416 struct dm_cache_metadata *cmd = context; save_hint() local
1422 r = dm_array_set_value(&cmd->hint_info, cmd->hint_root, save_hint()
1423 from_cblock(cblock), &value, &cmd->hint_root); save_hint()
1424 cmd->changed = true; save_hint()
1429 static int write_hints(struct dm_cache_metadata *cmd, struct dm_cache_policy *policy) write_hints() argument
1433 r = begin_hints(cmd, policy); write_hints()
1439 return policy_walk_mappings(policy, save_hint, cmd); write_hints()
1442 int dm_cache_write_hints(struct dm_cache_metadata *cmd, struct dm_cache_policy *policy) dm_cache_write_hints() argument
1446 WRITE_LOCK(cmd); dm_cache_write_hints()
1447 r = write_hints(cmd, policy); dm_cache_write_hints()
1448 WRITE_UNLOCK(cmd); dm_cache_write_hints()
1453 int dm_cache_metadata_all_clean(struct dm_cache_metadata *cmd, bool *result) dm_cache_metadata_all_clean() argument
1457 READ_LOCK(cmd); dm_cache_metadata_all_clean()
1458 r = blocks_are_unmapped_or_clean(cmd, 0, cmd->cache_blocks, result); dm_cache_metadata_all_clean()
1459 READ_UNLOCK(cmd); dm_cache_metadata_all_clean()
1464 void dm_cache_metadata_set_read_only(struct dm_cache_metadata *cmd) dm_cache_metadata_set_read_only() argument
1466 WRITE_LOCK_VOID(cmd); dm_cache_metadata_set_read_only()
1467 dm_bm_set_read_only(cmd->bm); dm_cache_metadata_set_read_only()
1468 WRITE_UNLOCK(cmd); dm_cache_metadata_set_read_only()
1471 void dm_cache_metadata_set_read_write(struct dm_cache_metadata *cmd) dm_cache_metadata_set_read_write() argument
1473 WRITE_LOCK_VOID(cmd); dm_cache_metadata_set_read_write()
1474 dm_bm_set_read_write(cmd->bm); dm_cache_metadata_set_read_write()
1475 WRITE_UNLOCK(cmd); dm_cache_metadata_set_read_write()
1478 int dm_cache_metadata_set_needs_check(struct dm_cache_metadata *cmd) dm_cache_metadata_set_needs_check() argument
1484 WRITE_LOCK(cmd); dm_cache_metadata_set_needs_check()
1485 set_bit(NEEDS_CHECK, &cmd->flags); dm_cache_metadata_set_needs_check()
1487 r = superblock_lock(cmd, &sblock); dm_cache_metadata_set_needs_check()
1494 disk_super->flags = cpu_to_le32(cmd->flags); dm_cache_metadata_set_needs_check()
1499 WRITE_UNLOCK(cmd); dm_cache_metadata_set_needs_check()
1503 int dm_cache_metadata_needs_check(struct dm_cache_metadata *cmd, bool *result) dm_cache_metadata_needs_check() argument
1505 READ_LOCK(cmd); dm_cache_metadata_needs_check()
1506 *result = !!test_bit(NEEDS_CHECK, &cmd->flags); dm_cache_metadata_needs_check()
1507 READ_UNLOCK(cmd); dm_cache_metadata_needs_check()
1512 int dm_cache_metadata_abort(struct dm_cache_metadata *cmd) dm_cache_metadata_abort() argument
1516 WRITE_LOCK(cmd); dm_cache_metadata_abort()
1517 __destroy_persistent_data_objects(cmd); dm_cache_metadata_abort()
1518 r = __create_persistent_data_objects(cmd, false); dm_cache_metadata_abort()
1520 cmd->fail_io = true; dm_cache_metadata_abort()
1521 WRITE_UNLOCK(cmd); dm_cache_metadata_abort()
401 __check_incompat_features(struct cache_disk_superblock *disk_super, struct dm_cache_metadata *cmd) __check_incompat_features() argument
H A Ddm-cache-metadata.h61 void dm_cache_metadata_close(struct dm_cache_metadata *cmd);
68 int dm_cache_resize(struct dm_cache_metadata *cmd, dm_cblock_t new_cache_size);
69 int dm_cache_size(struct dm_cache_metadata *cmd, dm_cblock_t *result);
71 int dm_cache_discard_bitset_resize(struct dm_cache_metadata *cmd,
77 int dm_cache_load_discards(struct dm_cache_metadata *cmd,
80 int dm_cache_set_discard(struct dm_cache_metadata *cmd, dm_dblock_t dblock, bool discard);
82 int dm_cache_remove_mapping(struct dm_cache_metadata *cmd, dm_cblock_t cblock);
83 int dm_cache_insert_mapping(struct dm_cache_metadata *cmd, dm_cblock_t cblock, dm_oblock_t oblock);
84 int dm_cache_changed_this_transaction(struct dm_cache_metadata *cmd);
89 int dm_cache_load_mappings(struct dm_cache_metadata *cmd,
94 int dm_cache_set_dirty(struct dm_cache_metadata *cmd, dm_cblock_t cblock, bool dirty);
103 void dm_cache_metadata_get_stats(struct dm_cache_metadata *cmd,
109 void dm_cache_metadata_set_stats(struct dm_cache_metadata *cmd,
112 int dm_cache_commit(struct dm_cache_metadata *cmd, bool clean_shutdown);
114 int dm_cache_get_free_metadata_block_count(struct dm_cache_metadata *cmd,
117 int dm_cache_get_metadata_dev_size(struct dm_cache_metadata *cmd,
120 void dm_cache_dump(struct dm_cache_metadata *cmd);
133 int dm_cache_write_hints(struct dm_cache_metadata *cmd, struct dm_cache_policy *p);
138 int dm_cache_metadata_all_clean(struct dm_cache_metadata *cmd, bool *result);
140 int dm_cache_metadata_needs_check(struct dm_cache_metadata *cmd, bool *result);
141 int dm_cache_metadata_set_needs_check(struct dm_cache_metadata *cmd);
142 void dm_cache_metadata_set_read_only(struct dm_cache_metadata *cmd);
143 void dm_cache_metadata_set_read_write(struct dm_cache_metadata *cmd);
144 int dm_cache_metadata_abort(struct dm_cache_metadata *cmd);
/linux-4.4.14/drivers/staging/wilc1000/
H A Dwilc_sdio.c44 sdio_cmd52_t cmd; sdio_set_func0_csa_address() local
49 cmd.read_write = 1; sdio_set_func0_csa_address()
50 cmd.function = 0; sdio_set_func0_csa_address()
51 cmd.raw = 0; sdio_set_func0_csa_address()
52 cmd.address = 0x10c; sdio_set_func0_csa_address()
53 cmd.data = (u8)adr; sdio_set_func0_csa_address()
54 if (!g_sdio.sdio_cmd52(&cmd)) { sdio_set_func0_csa_address()
59 cmd.address = 0x10d; sdio_set_func0_csa_address()
60 cmd.data = (u8)(adr >> 8); sdio_set_func0_csa_address()
61 if (!g_sdio.sdio_cmd52(&cmd)) { sdio_set_func0_csa_address()
66 cmd.address = 0x10e; sdio_set_func0_csa_address()
67 cmd.data = (u8)(adr >> 16); sdio_set_func0_csa_address()
68 if (!g_sdio.sdio_cmd52(&cmd)) { sdio_set_func0_csa_address()
80 sdio_cmd52_t cmd; sdio_set_func0_block_size() local
82 cmd.read_write = 1; sdio_set_func0_block_size()
83 cmd.function = 0; sdio_set_func0_block_size()
84 cmd.raw = 0; sdio_set_func0_block_size()
85 cmd.address = 0x10; sdio_set_func0_block_size()
86 cmd.data = (u8)block_size; sdio_set_func0_block_size()
87 if (!g_sdio.sdio_cmd52(&cmd)) { sdio_set_func0_block_size()
92 cmd.address = 0x11; sdio_set_func0_block_size()
93 cmd.data = (u8)(block_size >> 8); sdio_set_func0_block_size()
94 if (!g_sdio.sdio_cmd52(&cmd)) { sdio_set_func0_block_size()
112 sdio_cmd52_t cmd; sdio_set_func1_block_size() local
114 cmd.read_write = 1; sdio_set_func1_block_size()
115 cmd.function = 0; sdio_set_func1_block_size()
116 cmd.raw = 0; sdio_set_func1_block_size()
117 cmd.address = 0x110; sdio_set_func1_block_size()
118 cmd.data = (u8)block_size; sdio_set_func1_block_size()
119 if (!g_sdio.sdio_cmd52(&cmd)) { sdio_set_func1_block_size()
123 cmd.address = 0x111; sdio_set_func1_block_size()
124 cmd.data = (u8)(block_size >> 8); sdio_set_func1_block_size()
125 if (!g_sdio.sdio_cmd52(&cmd)) { sdio_set_func1_block_size()
139 sdio_cmd52_t cmd; sdio_clear_int() local
141 cmd.read_write = 0; sdio_clear_int()
142 cmd.function = 1; sdio_clear_int()
143 cmd.raw = 0; sdio_clear_int()
144 cmd.address = 0x4; sdio_clear_int()
145 cmd.data = 0; sdio_clear_int()
146 g_sdio.sdio_cmd52(&cmd); sdio_clear_int()
148 return cmd.data; sdio_clear_int()
166 sdio_cmd52_t cmd; sdio_xfer_cnt() local
168 cmd.read_write = 0; sdio_xfer_cnt()
169 cmd.function = 1; sdio_xfer_cnt()
170 cmd.raw = 0; sdio_xfer_cnt()
171 cmd.address = 0x1C; sdio_xfer_cnt()
172 cmd.data = 0; sdio_xfer_cnt()
173 g_sdio.sdio_cmd52(&cmd); sdio_xfer_cnt()
174 cnt = cmd.data; sdio_xfer_cnt()
176 cmd.read_write = 0; sdio_xfer_cnt()
177 cmd.function = 1; sdio_xfer_cnt()
178 cmd.raw = 0; sdio_xfer_cnt()
179 cmd.address = 0x1D; sdio_xfer_cnt()
180 cmd.data = 0; sdio_xfer_cnt()
181 g_sdio.sdio_cmd52(&cmd); sdio_xfer_cnt()
182 cnt |= (cmd.data << 8); sdio_xfer_cnt()
184 cmd.read_write = 0; sdio_xfer_cnt()
185 cmd.function = 1; sdio_xfer_cnt()
186 cmd.raw = 0; sdio_xfer_cnt()
187 cmd.address = 0x1E; sdio_xfer_cnt()
188 cmd.data = 0; sdio_xfer_cnt()
189 g_sdio.sdio_cmd52(&cmd); sdio_xfer_cnt()
190 cnt |= (cmd.data << 16); sdio_xfer_cnt()
202 sdio_cmd52_t cmd; sdio_check_bs() local
207 cmd.read_write = 0; sdio_check_bs()
208 cmd.function = 0; sdio_check_bs()
209 cmd.raw = 0; sdio_check_bs()
210 cmd.address = 0xc; sdio_check_bs()
211 cmd.data = 0; sdio_check_bs()
212 if (!g_sdio.sdio_cmd52(&cmd)) { sdio_check_bs()
213 g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get BS register...\n"); sdio_check_bs()
231 sdio_cmd52_t cmd; sdio_write_reg() local
233 cmd.read_write = 1; sdio_write_reg()
234 cmd.function = 0; sdio_write_reg()
235 cmd.raw = 0; sdio_write_reg()
236 cmd.address = addr; sdio_write_reg()
237 cmd.data = data; sdio_write_reg()
238 if (!g_sdio.sdio_cmd52(&cmd)) { sdio_write_reg()
239 g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr); sdio_write_reg()
243 sdio_cmd53_t cmd; sdio_write_reg() local
251 cmd.read_write = 1; sdio_write_reg()
252 cmd.function = 0; sdio_write_reg()
253 cmd.address = 0x10f; sdio_write_reg()
254 cmd.block_mode = 0; sdio_write_reg()
255 cmd.increment = 1; sdio_write_reg()
256 cmd.count = 4; sdio_write_reg()
257 cmd.buffer = (u8 *)&data; sdio_write_reg()
258 cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */ sdio_write_reg()
260 if (!g_sdio.sdio_cmd53(&cmd)) { sdio_write_reg()
276 sdio_cmd53_t cmd; sdio_write() local
279 cmd.read_write = 1; sdio_write()
292 cmd.function = 0; sdio_write()
293 cmd.address = 0x10f; sdio_write()
306 cmd.function = 1; sdio_write()
307 cmd.address = 0; sdio_write()
314 cmd.block_mode = 1; sdio_write()
315 cmd.increment = 1; sdio_write()
316 cmd.count = nblk; sdio_write()
317 cmd.buffer = buf; sdio_write()
318 cmd.block_size = block_size; sdio_write()
323 if (!g_sdio.sdio_cmd53(&cmd)) { sdio_write()
333 cmd.block_mode = 0; sdio_write()
334 cmd.increment = 1; sdio_write()
335 cmd.count = nleft; sdio_write()
336 cmd.buffer = buf; sdio_write()
338 cmd.block_size = block_size; /* johnny : prevent it from setting unexpected value */ sdio_write()
344 if (!g_sdio.sdio_cmd53(&cmd)) { sdio_write()
360 sdio_cmd52_t cmd; sdio_read_reg() local
362 cmd.read_write = 0; sdio_read_reg()
363 cmd.function = 0; sdio_read_reg()
364 cmd.raw = 0; sdio_read_reg()
365 cmd.address = addr; sdio_read_reg()
366 if (!g_sdio.sdio_cmd52(&cmd)) { sdio_read_reg()
367 g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr); sdio_read_reg()
370 *data = cmd.data; sdio_read_reg()
372 sdio_cmd53_t cmd; sdio_read_reg() local
377 cmd.read_write = 0; sdio_read_reg()
378 cmd.function = 0; sdio_read_reg()
379 cmd.address = 0x10f; sdio_read_reg()
380 cmd.block_mode = 0; sdio_read_reg()
381 cmd.increment = 1; sdio_read_reg()
382 cmd.count = 4; sdio_read_reg()
383 cmd.buffer = (u8 *)data; sdio_read_reg()
385 cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */ sdio_read_reg()
387 if (!g_sdio.sdio_cmd53(&cmd)) { sdio_read_reg()
407 sdio_cmd53_t cmd; sdio_read() local
410 cmd.read_write = 0; sdio_read()
423 cmd.function = 0; sdio_read()
424 cmd.address = 0x10f; sdio_read()
437 cmd.function = 1; sdio_read()
438 cmd.address = 0; sdio_read()
445 cmd.block_mode = 1; sdio_read()
446 cmd.increment = 1; sdio_read()
447 cmd.count = nblk; sdio_read()
448 cmd.buffer = buf; sdio_read()
449 cmd.block_size = block_size; sdio_read()
454 if (!g_sdio.sdio_cmd53(&cmd)) { sdio_read()
464 cmd.block_mode = 0; sdio_read()
465 cmd.increment = 1; sdio_read()
466 cmd.count = nleft; sdio_read()
467 cmd.buffer = buf; sdio_read()
469 cmd.block_size = block_size; /* johnny : prevent it from setting unexpected value */ sdio_read()
475 if (!g_sdio.sdio_cmd53(&cmd)) { sdio_read()
559 sdio_cmd52_t cmd; sdio_init() local
585 cmd.read_write = 1; sdio_init()
586 cmd.function = 0; sdio_init()
587 cmd.raw = 1; sdio_init()
588 cmd.address = 0x100; sdio_init()
589 cmd.data = 0x80; sdio_init()
590 if (!g_sdio.sdio_cmd52(&cmd)) { sdio_init()
591 g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, enable csa...\n"); sdio_init()
599 g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, set func 0 block size...\n"); sdio_init()
607 cmd.read_write = 1; sdio_init()
608 cmd.function = 0; sdio_init()
609 cmd.raw = 1; sdio_init()
610 cmd.address = 0x2; sdio_init()
611 cmd.data = 0x2; sdio_init()
612 if (!g_sdio.sdio_cmd52(&cmd)) { sdio_init()
613 g_sdio.dPrint(N_ERR, "[wilc sdio] Fail cmd 52, set IOE register...\n"); sdio_init()
620 cmd.read_write = 0; sdio_init()
621 cmd.function = 0; sdio_init()
622 cmd.raw = 0; sdio_init()
623 cmd.address = 0x3; sdio_init()
626 cmd.data = 0; sdio_init()
627 if (!g_sdio.sdio_cmd52(&cmd)) { sdio_init()
628 g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get IOR register...\n"); sdio_init()
631 if (cmd.data == 0x2) sdio_init()
651 cmd.read_write = 1; sdio_init()
652 cmd.function = 0; sdio_init()
653 cmd.raw = 1; sdio_init()
654 cmd.address = 0x4; sdio_init()
655 cmd.data = 0x3; sdio_init()
656 if (!g_sdio.sdio_cmd52(&cmd)) { sdio_init()
657 g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, set IEN register...\n"); sdio_init()
665 g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd read chip id...\n"); sdio_init()
696 sdio_cmd52_t cmd; sdio_read_size() local
701 cmd.read_write = 0; sdio_read_size()
702 cmd.function = 0; sdio_read_size()
703 cmd.raw = 0; sdio_read_size()
704 cmd.address = 0xf2; sdio_read_size()
705 cmd.data = 0; sdio_read_size()
706 g_sdio.sdio_cmd52(&cmd); sdio_read_size()
707 tmp = cmd.data; sdio_read_size()
709 /* cmd.read_write = 0; */ sdio_read_size()
710 /* cmd.function = 0; */ sdio_read_size()
711 /* cmd.raw = 0; */ sdio_read_size()
712 cmd.address = 0xf3; sdio_read_size()
713 cmd.data = 0; sdio_read_size()
714 g_sdio.sdio_cmd52(&cmd); sdio_read_size()
715 tmp |= (cmd.data << 8); sdio_read_size()
725 sdio_cmd52_t cmd; sdio_read_int() local
733 cmd.function = 1; sdio_read_int()
734 cmd.address = 0x04; sdio_read_int()
735 cmd.data = 0; sdio_read_int()
736 g_sdio.sdio_cmd52(&cmd); sdio_read_int()
738 if (cmd.data & BIT(0)) sdio_read_int()
740 if (cmd.data & BIT(2)) sdio_read_int()
742 if (cmd.data & BIT(3)) sdio_read_int()
744 if (cmd.data & BIT(4)) sdio_read_int()
746 if (cmd.data & BIT(5)) sdio_read_int()
748 if (cmd.data & BIT(6)) sdio_read_int()
755 g_sdio.dPrint(N_ERR, "[wilc sdio]: Unexpected interrupt (1) : tmp=%x, data=%x\n", tmp, cmd.data); sdio_read_int()
764 cmd.read_write = 0; sdio_read_int()
765 cmd.function = 0; sdio_read_int()
766 cmd.raw = 0; sdio_read_int()
767 cmd.address = 0xf7; sdio_read_int()
768 cmd.data = 0; sdio_read_int()
769 g_sdio.sdio_cmd52(&cmd); sdio_read_int()
770 irq_flags = cmd.data & 0x1f; sdio_read_int()
808 sdio_cmd52_t cmd; sdio_clear_int_ext() local
810 cmd.read_write = 1; sdio_clear_int_ext()
811 cmd.function = 0; sdio_clear_int_ext()
812 cmd.raw = 0; sdio_clear_int_ext()
813 cmd.address = 0xf8; sdio_clear_int_ext()
814 cmd.data = reg; sdio_clear_int_ext()
816 ret = g_sdio.sdio_cmd52(&cmd); sdio_clear_int_ext()
837 sdio_cmd52_t cmd; sdio_clear_int_ext() local
839 cmd.read_write = 1; sdio_clear_int_ext()
840 cmd.function = 0; sdio_clear_int_ext()
841 cmd.raw = 0; sdio_clear_int_ext()
842 cmd.address = 0xf8; sdio_clear_int_ext()
843 cmd.data = BIT(i); sdio_clear_int_ext()
845 ret = g_sdio.sdio_cmd52(&cmd); sdio_clear_int_ext()
882 sdio_cmd52_t cmd; sdio_clear_int_ext() local
884 cmd.read_write = 1; sdio_clear_int_ext()
885 cmd.function = 0; sdio_clear_int_ext()
886 cmd.raw = 0; sdio_clear_int_ext()
887 cmd.address = 0xf6; sdio_clear_int_ext()
888 cmd.data = vmm_ctl; sdio_clear_int_ext()
889 ret = g_sdio.sdio_cmd52(&cmd); sdio_clear_int_ext()
H A Dlinux_wlan_sdio.c56 int linux_sdio_cmd52(sdio_cmd52_t *cmd) linux_sdio_cmd52() argument
64 func->num = cmd->function; linux_sdio_cmd52()
65 if (cmd->read_write) { /* write */ linux_sdio_cmd52()
66 if (cmd->raw) { linux_sdio_cmd52()
67 sdio_writeb(func, cmd->data, cmd->address, &ret); linux_sdio_cmd52()
68 data = sdio_readb(func, cmd->address, &ret); linux_sdio_cmd52()
69 cmd->data = data; linux_sdio_cmd52()
71 sdio_writeb(func, cmd->data, cmd->address, &ret); linux_sdio_cmd52()
74 data = sdio_readb(func, cmd->address, &ret); linux_sdio_cmd52()
75 cmd->data = data; linux_sdio_cmd52()
88 int linux_sdio_cmd53(sdio_cmd53_t *cmd) linux_sdio_cmd53() argument
95 func->num = cmd->function; linux_sdio_cmd53()
96 func->cur_blksize = cmd->block_size; linux_sdio_cmd53()
97 if (cmd->block_mode) linux_sdio_cmd53()
98 size = cmd->count * cmd->block_size; linux_sdio_cmd53()
100 size = cmd->count; linux_sdio_cmd53()
102 if (cmd->read_write) { /* write */ linux_sdio_cmd53()
103 ret = sdio_memcpy_toio(func, cmd->address, (void *)cmd->buffer, size); linux_sdio_cmd53()
105 ret = sdio_memcpy_fromio(func, (void *)cmd->buffer, cmd->address, size); linux_sdio_cmd53()
/linux-4.4.14/drivers/scsi/
H A Dscsi_lib_dma.c17 * @cmd: scsi command
22 int scsi_dma_map(struct scsi_cmnd *cmd) scsi_dma_map() argument
26 if (scsi_sg_count(cmd)) { scsi_dma_map()
27 struct device *dev = cmd->device->host->dma_dev; scsi_dma_map()
29 nseg = dma_map_sg(dev, scsi_sglist(cmd), scsi_sg_count(cmd), scsi_dma_map()
30 cmd->sc_data_direction); scsi_dma_map()
40 * @cmd: scsi command
42 void scsi_dma_unmap(struct scsi_cmnd *cmd) scsi_dma_unmap() argument
44 if (scsi_sg_count(cmd)) { scsi_dma_unmap()
45 struct device *dev = cmd->device->host->dma_dev; scsi_dma_unmap()
47 dma_unmap_sg(dev, scsi_sglist(cmd), scsi_sg_count(cmd), scsi_dma_unmap()
48 cmd->sc_data_direction); scsi_dma_unmap()
H A Dps3rom.c97 struct scsi_cmnd *cmd) ps3rom_atapi_request()
100 unsigned char opcode = cmd->cmnd[0]; ps3rom_atapi_request()
108 memcpy(&atapi_cmnd.pkt, cmd->cmnd, 12); ps3rom_atapi_request()
111 atapi_cmnd.blocks = atapi_cmnd.arglen = scsi_bufflen(cmd); ps3rom_atapi_request()
114 switch (cmd->sc_data_direction) { ps3rom_atapi_request()
116 if (scsi_bufflen(cmd) >= CD_FRAMESIZE) ps3rom_atapi_request()
124 if (scsi_bufflen(cmd) >= CD_FRAMESIZE) ps3rom_atapi_request()
129 scsi_sg_copy_to_buffer(cmd, dev->bounce_buf, dev->bounce_size); ps3rom_atapi_request()
160 static inline unsigned int srb10_lba(const struct scsi_cmnd *cmd) srb10_lba() argument
162 return cmd->cmnd[2] << 24 | cmd->cmnd[3] << 16 | cmd->cmnd[4] << 8 | srb10_lba()
163 cmd->cmnd[5]; srb10_lba()
166 static inline unsigned int srb10_len(const struct scsi_cmnd *cmd) srb10_len() argument
168 return cmd->cmnd[7] << 8 | cmd->cmnd[8]; srb10_len()
172 struct scsi_cmnd *cmd, u32 start_sector, ps3rom_read_request()
193 struct scsi_cmnd *cmd, u32 start_sector, ps3rom_write_request()
201 scsi_sg_copy_to_buffer(cmd, dev->bounce_buf, dev->bounce_size); ps3rom_write_request()
215 static int ps3rom_queuecommand_lck(struct scsi_cmnd *cmd, ps3rom_queuecommand_lck() argument
218 struct ps3rom_private *priv = shost_priv(cmd->device->host); ps3rom_queuecommand_lck()
223 priv->curr_cmd = cmd; ps3rom_queuecommand_lck()
224 cmd->scsi_done = done; ps3rom_queuecommand_lck()
226 opcode = cmd->cmnd[0]; ps3rom_queuecommand_lck()
234 res = ps3rom_read_request(dev, cmd, srb10_lba(cmd), ps3rom_queuecommand_lck()
235 srb10_len(cmd)); ps3rom_queuecommand_lck()
239 res = ps3rom_write_request(dev, cmd, srb10_lba(cmd), ps3rom_queuecommand_lck()
240 srb10_len(cmd)); ps3rom_queuecommand_lck()
244 res = ps3rom_atapi_request(dev, cmd); ps3rom_queuecommand_lck()
249 memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); ps3rom_queuecommand_lck()
250 cmd->result = res; ps3rom_queuecommand_lck()
251 cmd->sense_buffer[0] = 0x70; ps3rom_queuecommand_lck()
252 cmd->sense_buffer[2] = ILLEGAL_REQUEST; ps3rom_queuecommand_lck()
254 cmd->scsi_done(cmd); ps3rom_queuecommand_lck()
279 struct scsi_cmnd *cmd; ps3rom_interrupt() local
304 cmd = priv->curr_cmd; ps3rom_interrupt()
308 if (cmd->sc_data_direction == DMA_FROM_DEVICE) { ps3rom_interrupt()
311 len = scsi_sg_copy_from_buffer(cmd, ps3rom_interrupt()
315 scsi_set_resid(cmd, scsi_bufflen(cmd) - len); ps3rom_interrupt()
317 cmd->result = DID_OK << 16; ps3rom_interrupt()
321 if (cmd->cmnd[0] == REQUEST_SENSE) { ps3rom_interrupt()
325 cmd->result = DID_ERROR << 16 | SAM_STAT_CHECK_CONDITION; ps3rom_interrupt()
330 cmd->result = DID_ERROR << 16; ps3rom_interrupt()
334 scsi_build_sense_buffer(0, cmd->sense_buffer, sense_key, asc, ascq); ps3rom_interrupt()
335 cmd->result = SAM_STAT_CHECK_CONDITION; ps3rom_interrupt()
339 cmd->scsi_done(cmd); ps3rom_interrupt()
96 ps3rom_atapi_request(struct ps3_storage_device *dev, struct scsi_cmnd *cmd) ps3rom_atapi_request() argument
171 ps3rom_read_request(struct ps3_storage_device *dev, struct scsi_cmnd *cmd, u32 start_sector, u32 sectors) ps3rom_read_request() argument
192 ps3rom_write_request(struct ps3_storage_device *dev, struct scsi_cmnd *cmd, u32 start_sector, u32 sectors) ps3rom_write_request() argument
H A Dch.c185 ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, ch_do_scsi() argument
192 timeout = (cmd[0] == INITIALIZE_ELEMENT_STATUS) ch_do_scsi()
197 result = scsi_execute_req(ch->device, cmd, direction, buffer, ch_do_scsi()
236 u_char cmd[12]; ch_read_element_status() local
245 memset(cmd,0,sizeof(cmd)); ch_read_element_status()
246 cmd[0] = READ_ELEMENT_STATUS; ch_read_element_status()
247 cmd[1] = ((ch->device->lun & 0x7) << 5) | ch_read_element_status()
250 cmd[2] = (elem >> 8) & 0xff; ch_read_element_status()
251 cmd[3] = elem & 0xff; ch_read_element_status()
252 cmd[5] = 1; ch_read_element_status()
253 cmd[9] = 255; ch_read_element_status()
254 if (0 == (result = ch_do_scsi(ch, cmd, 12, ch_read_element_status()
279 u_char cmd[6]; ch_init_elem() local
282 memset(cmd,0,sizeof(cmd)); ch_init_elem()
283 cmd[0] = INITIALIZE_ELEMENT_STATUS; ch_init_elem()
284 cmd[1] = (ch->device->lun & 0x7) << 5; ch_init_elem()
285 err = ch_do_scsi(ch, cmd, 6, NULL, 0, DMA_NONE); ch_init_elem()
293 u_char cmd[10], data[16]; ch_readconfig() local
302 memset(cmd,0,sizeof(cmd)); ch_readconfig()
303 cmd[0] = MODE_SENSE; ch_readconfig()
304 cmd[1] = (ch->device->lun & 0x7) << 5; ch_readconfig()
305 cmd[2] = 0x1d; ch_readconfig()
306 cmd[4] = 255; ch_readconfig()
307 result = ch_do_scsi(ch, cmd, 10, buffer, 255, DMA_FROM_DEVICE); ch_readconfig()
309 cmd[1] |= (1<<3); ch_readconfig()
310 result = ch_do_scsi(ch, cmd, 10, buffer, 255, DMA_FROM_DEVICE); ch_readconfig()
422 u_char cmd[10]; ch_position() local
427 memset(cmd,0,sizeof(cmd)); ch_position()
428 cmd[0] = POSITION_TO_ELEMENT; ch_position()
429 cmd[1] = (ch->device->lun & 0x7) << 5; ch_position()
430 cmd[2] = (trans >> 8) & 0xff; ch_position()
431 cmd[3] = trans & 0xff; ch_position()
432 cmd[4] = (elem >> 8) & 0xff; ch_position()
433 cmd[5] = elem & 0xff; ch_position()
434 cmd[8] = rotate ? 1 : 0; ch_position()
435 return ch_do_scsi(ch, cmd, 10, NULL, 0, DMA_NONE); ch_position()
441 u_char cmd[12]; ch_move() local
446 memset(cmd,0,sizeof(cmd)); ch_move()
447 cmd[0] = MOVE_MEDIUM; ch_move()
448 cmd[1] = (ch->device->lun & 0x7) << 5; ch_move()
449 cmd[2] = (trans >> 8) & 0xff; ch_move()
450 cmd[3] = trans & 0xff; ch_move()
451 cmd[4] = (src >> 8) & 0xff; ch_move()
452 cmd[5] = src & 0xff; ch_move()
453 cmd[6] = (dest >> 8) & 0xff; ch_move()
454 cmd[7] = dest & 0xff; ch_move()
455 cmd[10] = rotate ? 1 : 0; ch_move()
456 return ch_do_scsi(ch, cmd, 12, NULL,0, DMA_NONE); ch_move()
463 u_char cmd[12]; ch_exchange() local
469 memset(cmd,0,sizeof(cmd)); ch_exchange()
470 cmd[0] = EXCHANGE_MEDIUM; ch_exchange()
471 cmd[1] = (ch->device->lun & 0x7) << 5; ch_exchange()
472 cmd[2] = (trans >> 8) & 0xff; ch_exchange()
473 cmd[3] = trans & 0xff; ch_exchange()
474 cmd[4] = (src >> 8) & 0xff; ch_exchange()
475 cmd[5] = src & 0xff; ch_exchange()
476 cmd[6] = (dest1 >> 8) & 0xff; ch_exchange()
477 cmd[7] = dest1 & 0xff; ch_exchange()
478 cmd[8] = (dest2 >> 8) & 0xff; ch_exchange()
479 cmd[9] = dest2 & 0xff; ch_exchange()
480 cmd[10] = (rotate1 ? 1 : 0) | (rotate2 ? 2 : 0); ch_exchange()
482 return ch_do_scsi(ch, cmd, 12, NULL, 0, DMA_NONE); ch_exchange()
505 u_char cmd[12]; ch_set_voltag() local
517 memset(cmd,0,sizeof(cmd)); ch_set_voltag()
518 cmd[0] = SEND_VOLUME_TAG; ch_set_voltag()
519 cmd[1] = ((ch->device->lun & 0x7) << 5) | ch_set_voltag()
521 cmd[2] = (elem >> 8) & 0xff; ch_set_voltag()
522 cmd[3] = elem & 0xff; ch_set_voltag()
523 cmd[5] = clear ch_set_voltag()
527 cmd[9] = 255; ch_set_voltag()
532 result = ch_do_scsi(ch, cmd, 12, buffer, 256, DMA_TO_DEVICE); ch_set_voltag()
607 unsigned int cmd, unsigned long arg) ch_ioctl()
613 retval = scsi_ioctl_block_when_processing_errors(ch->device, cmd, ch_ioctl()
618 switch (cmd) { ch_ioctl()
846 return scsi_ioctl(ch->device, cmd, argp); ch_ioctl()
860 unsigned int cmd, unsigned long arg) ch_ioctl_compat()
864 switch (cmd) { ch_ioctl_compat()
874 return ch_ioctl(file, cmd, arg); ch_ioctl_compat()
889 // return scsi_ioctl_compat(ch->device, cmd, (void*)arg); ch_ioctl_compat()
606 ch_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ch_ioctl() argument
859 ch_ioctl_compat(struct file * file, unsigned int cmd, unsigned long arg) ch_ioctl_compat() argument
H A Dmac53c94.c69 static int mac53c94_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) mac53c94_queue_lck() argument
74 if (cmd->sc_data_direction == DMA_TO_DEVICE) { mac53c94_queue_lck()
76 printk(KERN_DEBUG "mac53c94_queue %p: command is", cmd); mac53c94_queue_lck()
77 for (i = 0; i < cmd->cmd_len; ++i) mac53c94_queue_lck()
78 printk(KERN_CONT " %.2x", cmd->cmnd[i]); mac53c94_queue_lck()
81 scsi_sg_count(cmd), scsi_bufflen(cmd), scsi_sglist(cmd)); mac53c94_queue_lck()
85 cmd->scsi_done = done; mac53c94_queue_lck()
86 cmd->host_scribble = NULL; mac53c94_queue_lck()
88 state = (struct fsc_state *) cmd->device->host->hostdata; mac53c94_queue_lck()
91 state->request_q = cmd; mac53c94_queue_lck()
93 state->request_qtail->host_scribble = (void *) cmd; mac53c94_queue_lck()
94 state->request_qtail = cmd; mac53c94_queue_lck()
104 static int mac53c94_host_reset(struct scsi_cmnd *cmd) mac53c94_host_reset() argument
106 struct fsc_state *state = (struct fsc_state *) cmd->device->host->hostdata; mac53c94_host_reset()
111 spin_lock_irqsave(cmd->device->host->host_lock, flags); mac53c94_host_reset()
121 spin_unlock_irqrestore(cmd->device->host->host_lock, flags); mac53c94_host_reset()
148 struct scsi_cmnd *cmd; mac53c94_start() local
156 state->current_req = cmd = state->request_q; mac53c94_start()
157 state->request_q = (struct scsi_cmnd *) cmd->host_scribble; mac53c94_start()
167 writeb(cmd->device->id, &regs->dest_id); mac53c94_start()
172 for (i = 0; i < cmd->cmd_len; ++i) mac53c94_start()
173 writeb(cmd->cmnd[i], &regs->fifo); mac53c94_start()
179 set_dma_cmds(state, cmd); mac53c94_start()
198 struct scsi_cmnd *cmd = state->current_req; mac53c94_interrupt() local
224 printk(KERN_ERR "53c94: invalid cmd, intr=%x stat=%x seq=%x phase=%d\n", mac53c94_interrupt()
238 if (cmd == 0) { mac53c94_interrupt()
267 && (scsi_sg_count(cmd) > 0 || scsi_bufflen(cmd))) { mac53c94_interrupt()
268 nb = cmd->SCp.this_residual; mac53c94_interrupt()
271 cmd->SCp.this_residual -= nb; mac53c94_interrupt()
285 printk(KERN_DEBUG "in unexpected phase %x after cmd\n", mac53c94_interrupt()
298 if (cmd->SCp.this_residual != 0 mac53c94_interrupt()
301 nb = cmd->SCp.this_residual; mac53c94_interrupt()
304 cmd->SCp.this_residual -= nb; mac53c94_interrupt()
315 scsi_dma_unmap(cmd); mac53c94_interrupt()
326 cmd->SCp.Status = readb(&regs->fifo); mac53c94_interrupt()
327 cmd->SCp.Message = readb(&regs->fifo); mac53c94_interrupt()
328 cmd->result = CMD_ACCEPT_MSG; mac53c94_interrupt()
336 cmd_done(state, (DID_OK << 16) + (cmd->SCp.Message << 8) mac53c94_interrupt()
337 + cmd->SCp.Status); mac53c94_interrupt()
346 struct scsi_cmnd *cmd; cmd_done() local
348 cmd = state->current_req; cmd_done()
349 if (cmd != 0) { cmd_done()
350 cmd->result = result; cmd_done()
351 (*cmd->scsi_done)(cmd); cmd_done()
361 static void set_dma_cmds(struct fsc_state *state, struct scsi_cmnd *cmd) set_dma_cmds() argument
369 nseg = scsi_dma_map(cmd); set_dma_cmds()
374 dma_cmd = cmd->sc_data_direction == DMA_TO_DEVICE ? set_dma_cmds()
379 scsi_for_each_sg(cmd, scl, nseg, i) { scsi_for_each_sg()
395 cmd->SCp.this_residual = total;
H A Dscsi_lib.c85 scsi_set_blocked(struct scsi_cmnd *cmd, int reason) scsi_set_blocked() argument
87 struct Scsi_Host *host = cmd->device->host; scsi_set_blocked()
88 struct scsi_device *device = cmd->device; scsi_set_blocked()
120 static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd) scsi_mq_requeue_cmd() argument
122 struct scsi_device *sdev = cmd->device; scsi_mq_requeue_cmd()
123 struct request_queue *q = cmd->request->q; scsi_mq_requeue_cmd()
125 blk_mq_requeue_request(cmd->request); scsi_mq_requeue_cmd()
132 * @cmd: The SCSI command being requeued
142 static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, int unbusy) __scsi_queue_insert() argument
144 struct scsi_device *device = cmd->device; __scsi_queue_insert()
148 SCSI_LOG_MLQUEUE(1, scmd_printk(KERN_INFO, cmd, __scsi_queue_insert()
149 "Inserting command %p into mlqueue\n", cmd)); __scsi_queue_insert()
151 scsi_set_blocked(cmd, reason); __scsi_queue_insert()
166 cmd->result = 0; __scsi_queue_insert()
168 scsi_mq_requeue_cmd(cmd); __scsi_queue_insert()
172 blk_requeue_request(q, cmd->request); __scsi_queue_insert()
182 * Arguments: cmd - command that we are adding to queue.
196 void scsi_queue_insert(struct scsi_cmnd *cmd, int reason) scsi_queue_insert() argument
198 __scsi_queue_insert(cmd, reason, 1); scsi_queue_insert()
203 * @cmd: scsi command
216 int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, scsi_execute() argument
234 req->cmd_len = COMMAND_SIZE(cmd[0]); scsi_execute()
235 memcpy(req->cmd, cmd, req->cmd_len); scsi_execute()
266 int scsi_execute_req_flags(struct scsi_device *sdev, const unsigned char *cmd, scsi_execute_req_flags() argument
279 result = scsi_execute(sdev, cmd, data_direction, buffer, bufflen, scsi_execute_req_flags()
292 * Purpose: Initialize cmd fields related to error handling.
294 * Arguments: cmd - command that is ready to be queued.
300 static void scsi_init_cmd_errh(struct scsi_cmnd *cmd) scsi_init_cmd_errh() argument
302 cmd->serial_number = 0; scsi_init_cmd_errh()
303 scsi_set_resid(cmd, 0); scsi_init_cmd_errh()
304 memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); scsi_init_cmd_errh()
305 if (cmd->cmd_len == 0) scsi_init_cmd_errh()
306 cmd->cmd_len = scsi_command_size(cmd->cmnd); scsi_init_cmd_errh()
517 * cmd - command that may need to be requeued.
527 * Notes: Upon return, cmd is a stale pointer.
529 static void scsi_requeue_command(struct request_queue *q, struct scsi_cmnd *cmd) scsi_requeue_command() argument
531 struct scsi_device *sdev = cmd->device; scsi_requeue_command()
532 struct request *req = cmd->request; scsi_requeue_command()
538 scsi_put_command(cmd); scsi_requeue_command()
615 static void scsi_uninit_cmd(struct scsi_cmnd *cmd) scsi_uninit_cmd() argument
617 if (cmd->request->cmd_type == REQ_TYPE_FS) { scsi_uninit_cmd()
618 struct scsi_driver *drv = scsi_cmd_to_driver(cmd); scsi_uninit_cmd()
621 drv->uninit_command(cmd); scsi_uninit_cmd()
625 static void scsi_mq_free_sgtables(struct scsi_cmnd *cmd) scsi_mq_free_sgtables() argument
627 if (cmd->sdb.table.nents) scsi_mq_free_sgtables()
628 scsi_free_sgtable(&cmd->sdb, true); scsi_mq_free_sgtables()
629 if (cmd->request->next_rq && cmd->request->next_rq->special) scsi_mq_free_sgtables()
630 scsi_free_sgtable(cmd->request->next_rq->special, true); scsi_mq_free_sgtables()
631 if (scsi_prot_sg_count(cmd)) scsi_mq_free_sgtables()
632 scsi_free_sgtable(cmd->prot_sdb, true); scsi_mq_free_sgtables()
635 static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd) scsi_mq_uninit_cmd() argument
637 struct scsi_device *sdev = cmd->device; scsi_mq_uninit_cmd()
641 scsi_mq_free_sgtables(cmd); scsi_mq_uninit_cmd()
642 scsi_uninit_cmd(cmd); scsi_mq_uninit_cmd()
645 BUG_ON(list_empty(&cmd->list)); scsi_mq_uninit_cmd()
647 list_del_init(&cmd->list); scsi_mq_uninit_cmd()
657 * Arguments: cmd - command that we are bailing.
668 static void scsi_release_buffers(struct scsi_cmnd *cmd) scsi_release_buffers() argument
670 if (cmd->sdb.table.nents) scsi_release_buffers()
671 scsi_free_sgtable(&cmd->sdb, false); scsi_release_buffers()
673 memset(&cmd->sdb, 0, sizeof(cmd->sdb)); scsi_release_buffers()
675 if (scsi_prot_sg_count(cmd)) scsi_release_buffers()
676 scsi_free_sgtable(cmd->prot_sdb, false); scsi_release_buffers()
679 static void scsi_release_bidi_buffers(struct scsi_cmnd *cmd) scsi_release_bidi_buffers() argument
681 struct scsi_data_buffer *bidi_sdb = cmd->request->next_rq->special; scsi_release_bidi_buffers()
685 cmd->request->next_rq->special = NULL; scsi_release_bidi_buffers()
691 struct scsi_cmnd *cmd = req->special; scsi_end_request() local
692 struct scsi_device *sdev = cmd->device; scsi_end_request()
714 scsi_mq_uninit_cmd(cmd); scsi_end_request()
727 scsi_release_bidi_buffers(cmd); scsi_end_request()
733 scsi_release_buffers(cmd); scsi_end_request()
735 scsi_put_command(cmd); scsi_end_request()
745 * @cmd: SCSI command (unused)
757 static int __scsi_error_from_host_byte(struct scsi_cmnd *cmd, int result) __scsi_error_from_host_byte() argument
766 set_host_byte(cmd, DID_OK); __scsi_error_from_host_byte()
770 set_host_byte(cmd, DID_OK); __scsi_error_from_host_byte()
774 set_host_byte(cmd, DID_OK); __scsi_error_from_host_byte()
778 set_host_byte(cmd, DID_OK); __scsi_error_from_host_byte()
794 * Arguments: cmd - command that is finished.
818 void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) scsi_io_completion() argument
820 int result = cmd->result; scsi_io_completion()
821 struct request_queue *q = cmd->device->request_queue; scsi_io_completion()
822 struct request *req = cmd->request; scsi_io_completion()
829 unsigned long wait_for = (cmd->allowed + 1) * req->timeout; scsi_io_completion()
832 sense_valid = scsi_command_normalize_sense(cmd, &sshdr); scsi_io_completion()
843 int len = 8 + cmd->sense_buffer[7]; scsi_io_completion()
847 memcpy(req->sense, cmd->sense_buffer, len); scsi_io_completion()
851 error = __scsi_error_from_host_byte(cmd, result); scsi_io_completion()
856 req->errors = cmd->result; scsi_io_completion()
858 req->resid_len = scsi_get_resid(cmd); scsi_io_completion()
860 if (scsi_bidi_cmnd(cmd)) { scsi_io_completion()
865 req->next_rq->resid_len = scsi_in(cmd)->resid; scsi_io_completion()
878 error = __scsi_error_from_host_byte(cmd, result); scsi_io_completion()
888 SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, cmd, scsi_io_completion()
906 scsi_print_sense(cmd); scsi_io_completion()
924 if (error && scsi_noretry_cmd(cmd)) { scsi_io_completion()
937 error = __scsi_error_from_host_byte(cmd, result); scsi_io_completion()
948 if (cmd->device->removable) { scsi_io_completion()
952 cmd->device->changed = 1; scsi_io_completion()
972 if ((cmd->device->use_10_for_rw && scsi_io_completion()
974 (cmd->cmnd[0] == READ_10 || scsi_io_completion()
975 cmd->cmnd[0] == WRITE_10)) { scsi_io_completion()
977 cmd->device->use_10_for_rw = 0; scsi_io_completion()
1029 time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) scsi_io_completion()
1049 scsi_print_result(cmd, NULL, FAILED); scsi_io_completion()
1051 scsi_print_sense(cmd); scsi_io_completion()
1052 scsi_print_command(cmd); scsi_io_completion()
1064 cmd->request->cmd_flags &= ~REQ_DONTPREP; scsi_io_completion()
1065 scsi_mq_uninit_cmd(cmd); scsi_io_completion()
1066 scsi_mq_requeue_cmd(cmd); scsi_io_completion()
1068 scsi_release_buffers(cmd); scsi_io_completion()
1069 scsi_requeue_command(q, cmd); scsi_io_completion()
1074 __scsi_queue_insert(cmd, SCSI_MLQUEUE_EH_RETRY, 0); scsi_io_completion()
1078 __scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY, 0); scsi_io_completion()
1110 * Arguments: cmd - Command descriptor we wish to initialize
1116 int scsi_init_io(struct scsi_cmnd *cmd) scsi_init_io() argument
1118 struct scsi_device *sdev = cmd->device; scsi_init_io()
1119 struct request *rq = cmd->request; scsi_init_io()
1125 error = scsi_init_sgtable(rq, &cmd->sdb); scsi_init_io()
1147 struct scsi_data_buffer *prot_sdb = cmd->prot_sdb; scsi_init_io()
1173 cmd->prot_sdb = prot_sdb; scsi_init_io()
1174 cmd->prot_sdb->table.nents = count; scsi_init_io()
1180 scsi_mq_free_sgtables(cmd); scsi_init_io()
1182 scsi_release_buffers(cmd); scsi_init_io()
1183 cmd->request->special = NULL; scsi_init_io()
1184 scsi_put_command(cmd); scsi_init_io()
1194 struct scsi_cmnd *cmd; scsi_get_cmd_from_req() local
1201 cmd = scsi_get_command(sdev, GFP_ATOMIC); scsi_get_cmd_from_req()
1202 if (unlikely(!cmd)) { scsi_get_cmd_from_req()
1206 req->special = cmd; scsi_get_cmd_from_req()
1208 cmd = req->special; scsi_get_cmd_from_req()
1212 cmd->tag = req->tag; scsi_get_cmd_from_req()
1213 cmd->request = req; scsi_get_cmd_from_req()
1215 cmd->cmnd = req->cmd; scsi_get_cmd_from_req()
1216 cmd->prot_op = SCSI_PROT_NORMAL; scsi_get_cmd_from_req()
1218 return cmd; scsi_get_cmd_from_req()
1223 struct scsi_cmnd *cmd = req->special; scsi_setup_blk_pc_cmnd() local
1232 int ret = scsi_init_io(cmd); scsi_setup_blk_pc_cmnd()
1238 memset(&cmd->sdb, 0, sizeof(cmd->sdb)); scsi_setup_blk_pc_cmnd()
1241 cmd->cmd_len = req->cmd_len; scsi_setup_blk_pc_cmnd()
1242 cmd->transfersize = blk_rq_bytes(req); scsi_setup_blk_pc_cmnd()
1243 cmd->allowed = req->retries; scsi_setup_blk_pc_cmnd()
1253 struct scsi_cmnd *cmd = req->special; scsi_setup_fs_cmnd() local
1261 memset(cmd->cmnd, 0, BLK_MAX_CDB); scsi_setup_fs_cmnd()
1262 return scsi_cmd_to_driver(cmd)->init_command(cmd); scsi_setup_fs_cmnd()
1267 struct scsi_cmnd *cmd = req->special; scsi_setup_cmnd() local
1270 cmd->sc_data_direction = DMA_NONE; scsi_setup_cmnd()
1272 cmd->sc_data_direction = DMA_TO_DEVICE; scsi_setup_cmnd()
1274 cmd->sc_data_direction = DMA_FROM_DEVICE; scsi_setup_cmnd()
1352 struct scsi_cmnd *cmd = req->special; scsi_prep_return() local
1353 scsi_release_buffers(cmd); scsi_prep_return()
1354 scsi_put_command(cmd); scsi_prep_return()
1378 struct scsi_cmnd *cmd; scsi_prep_fn() local
1385 cmd = scsi_get_cmd_from_req(sdev, req); scsi_prep_fn()
1386 if (unlikely(!cmd)) { scsi_prep_fn()
1589 struct scsi_cmnd *cmd = req->special; scsi_kill_request() local
1596 scmd_printk(KERN_INFO, cmd, "killing request\n"); scsi_kill_request()
1598 sdev = cmd->device; scsi_kill_request()
1601 scsi_init_cmd_errh(cmd); scsi_kill_request()
1602 cmd->result = DID_NO_CONNECT << 16; scsi_kill_request()
1603 atomic_inc(&cmd->device->iorequest_cnt); scsi_kill_request()
1620 struct scsi_cmnd *cmd = rq->special; scsi_softirq_done() local
1621 unsigned long wait_for = (cmd->allowed + 1) * rq->timeout; scsi_softirq_done()
1624 INIT_LIST_HEAD(&cmd->eh_entry); scsi_softirq_done()
1626 atomic_inc(&cmd->device->iodone_cnt); scsi_softirq_done()
1627 if (cmd->result) scsi_softirq_done()
1628 atomic_inc(&cmd->device->ioerr_cnt); scsi_softirq_done()
1630 disposition = scsi_decide_disposition(cmd); scsi_softirq_done()
1632 time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) { scsi_softirq_done()
1633 sdev_printk(KERN_ERR, cmd->device, scsi_softirq_done()
1639 scsi_log_completion(cmd, disposition); scsi_softirq_done()
1643 scsi_finish_command(cmd); scsi_softirq_done()
1646 scsi_queue_insert(cmd, SCSI_MLQUEUE_EH_RETRY); scsi_softirq_done()
1649 scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY); scsi_softirq_done()
1652 if (!scsi_eh_scmd_add(cmd, 0)) scsi_softirq_done()
1653 scsi_finish_command(cmd); scsi_softirq_done()
1659 * @cmd: command block we are dispatching.
1664 static int scsi_dispatch_cmd(struct scsi_cmnd *cmd) scsi_dispatch_cmd() argument
1666 struct Scsi_Host *host = cmd->device->host; scsi_dispatch_cmd()
1669 atomic_inc(&cmd->device->iorequest_cnt); scsi_dispatch_cmd()
1672 if (unlikely(cmd->device->sdev_state == SDEV_DEL)) { scsi_dispatch_cmd()
1676 cmd->result = DID_NO_CONNECT << 16; scsi_dispatch_cmd()
1681 if (unlikely(scsi_device_blocked(cmd->device))) { scsi_dispatch_cmd()
1689 SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd, scsi_dispatch_cmd()
1695 if (cmd->device->lun_in_cdb) scsi_dispatch_cmd()
1696 cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) | scsi_dispatch_cmd()
1697 (cmd->device->lun << 5 & 0xe0); scsi_dispatch_cmd()
1699 scsi_log_send(cmd); scsi_dispatch_cmd()
1705 if (cmd->cmd_len > cmd->device->host->max_cmd_len) { scsi_dispatch_cmd()
1706 SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd, scsi_dispatch_cmd()
1709 cmd->cmd_len, cmd->device->host->max_cmd_len)); scsi_dispatch_cmd()
1710 cmd->result = (DID_ABORT << 16); scsi_dispatch_cmd()
1715 cmd->result = (DID_NO_CONNECT << 16); scsi_dispatch_cmd()
1720 trace_scsi_dispatch_cmd_start(cmd); scsi_dispatch_cmd()
1721 rtn = host->hostt->queuecommand(host, cmd); scsi_dispatch_cmd()
1723 trace_scsi_dispatch_cmd_error(cmd, rtn); scsi_dispatch_cmd()
1728 SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd, scsi_dispatch_cmd()
1734 cmd->scsi_done(cmd); scsi_dispatch_cmd()
1740 * @cmd: The SCSI Command for which a low-level device driver (LLDD) gives
1749 static void scsi_done(struct scsi_cmnd *cmd) scsi_done() argument
1751 trace_scsi_dispatch_cmd_done(cmd); scsi_done()
1752 blk_complete_request(cmd->request); scsi_done()
1772 struct scsi_cmnd *cmd; variable in typeref:struct:scsi_cmnd
1808 cmd = req->special;
1809 if (unlikely(cmd == NULL)) {
1842 cmd->flags |= SCMD_TAGGED;
1844 cmd->flags &= ~SCMD_TAGGED;
1850 scsi_init_cmd_errh(cmd); variable
1855 cmd->scsi_done = scsi_done;
1856 rtn = scsi_dispatch_cmd(cmd);
1858 scsi_queue_insert(cmd, rtn);
1901 struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); scsi_mq_prep_fn() local
1904 unsigned char *sense_buf = cmd->sense_buffer; scsi_mq_prep_fn()
1907 memset(cmd, 0, sizeof(struct scsi_cmnd)); scsi_mq_prep_fn()
1909 req->special = cmd; scsi_mq_prep_fn()
1911 cmd->request = req; scsi_mq_prep_fn()
1912 cmd->device = sdev; scsi_mq_prep_fn()
1913 cmd->sense_buffer = sense_buf; scsi_mq_prep_fn()
1915 cmd->tag = req->tag; scsi_mq_prep_fn()
1917 cmd->cmnd = req->cmd; scsi_mq_prep_fn()
1918 cmd->prot_op = SCSI_PROT_NORMAL; scsi_mq_prep_fn()
1920 INIT_LIST_HEAD(&cmd->list); scsi_mq_prep_fn()
1921 INIT_DELAYED_WORK(&cmd->abort_work, scmd_eh_abort_handler); scsi_mq_prep_fn()
1922 cmd->jiffies_at_alloc = jiffies; scsi_mq_prep_fn()
1926 list_add_tail(&cmd->list, &sdev->cmd_list); scsi_mq_prep_fn()
1930 sg = (void *)cmd + sizeof(struct scsi_cmnd) + shost->hostt->cmd_size; scsi_mq_prep_fn()
1931 cmd->sdb.table.sgl = sg; scsi_mq_prep_fn()
1934 cmd->prot_sdb = (void *)sg + scsi_mq_prep_fn()
1938 memset(cmd->prot_sdb, 0, sizeof(struct scsi_data_buffer)); scsi_mq_prep_fn()
1940 cmd->prot_sdb->table.sgl = scsi_mq_prep_fn()
1941 (struct scatterlist *)(cmd->prot_sdb + 1); scsi_mq_prep_fn()
1960 static void scsi_mq_done(struct scsi_cmnd *cmd) scsi_mq_done() argument
1962 trace_scsi_dispatch_cmd_done(cmd); scsi_mq_done()
1963 blk_mq_complete_request(cmd->request, cmd->request->errors); scsi_mq_done()
1973 struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); scsi_queue_rq() local
2003 cmd->flags |= SCMD_TAGGED; scsi_queue_rq()
2005 cmd->flags &= ~SCMD_TAGGED; scsi_queue_rq()
2007 scsi_init_cmd_errh(cmd); scsi_queue_rq()
2008 cmd->scsi_done = scsi_mq_done; scsi_queue_rq()
2010 reason = scsi_dispatch_cmd(cmd); scsi_queue_rq()
2012 scsi_set_blocked(cmd, reason); scsi_queue_rq()
2043 scsi_mq_uninit_cmd(cmd); scsi_queue_rq()
2063 struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(rq); scsi_init_request() local
2065 cmd->sense_buffer = kzalloc_node(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL, scsi_init_request()
2067 if (!cmd->sense_buffer) scsi_init_request()
2075 struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(rq); scsi_exit_request() local
2077 kfree(cmd->sense_buffer); scsi_exit_request()
2350 unsigned char cmd[10]; scsi_mode_select() local
2354 memset(cmd, 0, sizeof(cmd)); scsi_mode_select()
2355 cmd[1] = (pf ? 0x10 : 0) | (sp ? 0x01 : 0); scsi_mode_select()
2374 cmd[0] = MODE_SELECT_10; scsi_mode_select()
2375 cmd[7] = len >> 8; scsi_mode_select()
2376 cmd[8] = len; scsi_mode_select()
2393 cmd[0] = MODE_SELECT; scsi_mode_select()
2394 cmd[4] = len; scsi_mode_select()
2397 ret = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, real_buffer, len, scsi_mode_select()
2426 unsigned char cmd[12]; scsi_mode_sense() local
2433 memset(&cmd[0], 0, 12); scsi_mode_sense()
2434 cmd[1] = dbd & 0x18; /* allows DBD and LLBA bits */ scsi_mode_sense()
2435 cmd[2] = modepage; scsi_mode_sense()
2448 cmd[0] = MODE_SENSE_10; scsi_mode_sense()
2449 cmd[8] = len; scsi_mode_sense()
2455 cmd[0] = MODE_SENSE; scsi_mode_sense()
2456 cmd[4] = len; scsi_mode_sense()
2462 result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, scsi_mode_sense()
2535 char cmd[] = { scsi_test_unit_ready() local
2548 result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr, scsi_test_unit_ready()
H A Din2000.c207 static inline void write_3393_cmd(struct IN2000_hostdata *hostdata, uchar cmd) write_3393_cmd() argument
212 write1_io(cmd, IO_WD_DATA); write_3393_cmd()
257 static int is_dir_out(Scsi_Cmnd * cmd) is_dir_out() argument
259 switch (cmd->cmnd[0]) { is_dir_out()
336 static int in2000_queuecommand_lck(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) in2000_queuecommand_lck() argument
342 instance = cmd->device->host; in2000_queuecommand_lck()
345 DB(DB_QUEUE_COMMAND, scmd_printk(KERN_DEBUG, cmd, "Q-%02x(", cmd->cmnd[0])) in2000_queuecommand_lck()
348 * - host_scribble is the pointer to the next cmd in the input queue in2000_queuecommand_lck()
349 * - scsi_done points to the routine we call when a cmd is finished in2000_queuecommand_lck()
352 cmd->host_scribble = NULL; in2000_queuecommand_lck()
353 cmd->scsi_done = done; in2000_queuecommand_lck()
354 cmd->result = 0; in2000_queuecommand_lck()
359 * cmd, and are preserved across disconnect-reselect. This means we in2000_queuecommand_lck()
371 if (scsi_bufflen(cmd)) { in2000_queuecommand_lck()
372 cmd->SCp.buffer = scsi_sglist(cmd); in2000_queuecommand_lck()
373 cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1; in2000_queuecommand_lck()
374 cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); in2000_queuecommand_lck()
375 cmd->SCp.this_residual = cmd->SCp.buffer->length; in2000_queuecommand_lck()
377 cmd->SCp.buffer = NULL; in2000_queuecommand_lck()
378 cmd->SCp.buffers_residual = 0; in2000_queuecommand_lck()
379 cmd->SCp.ptr = NULL; in2000_queuecommand_lck()
380 cmd->SCp.this_residual = 0; in2000_queuecommand_lck()
382 cmd->SCp.have_data_in = 0; in2000_queuecommand_lck()
403 cmd->SCp.Status = ILLEGAL_STATUS_BYTE; in2000_queuecommand_lck()
410 * Add the cmd to the end of 'input_Q'. Note that REQUEST_SENSE in2000_queuecommand_lck()
415 if (!(hostdata->input_Q) || (cmd->cmnd[0] == REQUEST_SENSE)) { in2000_queuecommand_lck()
416 cmd->host_scribble = (uchar *) hostdata->input_Q; in2000_queuecommand_lck()
417 hostdata->input_Q = cmd; in2000_queuecommand_lck()
420 tmp->host_scribble = (uchar *) cmd; in2000_queuecommand_lck()
427 in2000_execute(cmd->device->host); in2000_queuecommand_lck()
448 Scsi_Cmnd *cmd, *prev; in2000_execute() local
471 cmd = (Scsi_Cmnd *) hostdata->input_Q; in2000_execute()
473 while (cmd) { in2000_execute()
474 if (!(hostdata->busy[cmd->device->id] & (1 << cmd->device->lun))) in2000_execute()
476 prev = cmd; in2000_execute()
477 cmd = (Scsi_Cmnd *) cmd->host_scribble; in2000_execute()
482 if (!cmd) { in2000_execute()
492 prev->host_scribble = cmd->host_scribble; in2000_execute()
494 hostdata->input_Q = (Scsi_Cmnd *) cmd->host_scribble; in2000_execute()
497 hostdata->cmd_cnt[cmd->device->id]++; in2000_execute()
504 if (is_dir_out(cmd)) in2000_execute()
505 write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id); in2000_execute()
507 write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id | DSTID_DPD); in2000_execute()
532 cmd->SCp.phase = 0; /* assume no disconnect */ in2000_execute()
537 if (cmd->device->type == 1) /* tape drive? */ in2000_execute()
544 if ((prev->device->id != cmd->device->id) || (prev->device->lun != cmd->device->lun)) { in2000_execute()
553 cmd->SCp.phase = 1; in2000_execute()
556 hostdata->disc_allowed_cnt[cmd->device->id]++; in2000_execute()
560 write_3393(hostdata, WD_SOURCE_ID, ((cmd->SCp.phase) ? SRCID_ER : 0)); in2000_execute()
562 write_3393(hostdata, WD_TARGET_LUN, cmd->device->lun); in2000_execute()
563 write_3393(hostdata, WD_SYNCHRONOUS_TRANSFER, hostdata->sync_xfer[cmd->device->id]); in2000_execute()
564 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); in2000_execute()
566 if ((hostdata->level2 <= L2_NONE) || (hostdata->sync_stat[cmd->device->id] == SS_UNSET)) { in2000_execute()
576 hostdata->selecting = cmd; in2000_execute()
588 if (hostdata->sync_stat[cmd->device->id] == SS_UNSET) { in2000_execute()
589 if (hostdata->sync_off & (1 << cmd->device->id)) in2000_execute()
590 hostdata->sync_stat[cmd->device->id] = SS_SET; in2000_execute()
592 hostdata->sync_stat[cmd->device->id] = SS_FIRST; in2000_execute()
609 hostdata->connected = cmd; in2000_execute()
617 for (i = 0; i < cmd->cmd_len; i++) in2000_execute()
618 write1_io(cmd->cmnd[i], IO_WD_DATA); in2000_execute()
626 write_3393(hostdata, WD_OWN_ID, cmd->cmd_len); in2000_execute()
646 if (!(cmd->SCp.phase)) { in2000_execute()
647 write_3393_count(hostdata, cmd->SCp.this_residual); in2000_execute()
651 if (is_dir_out(cmd)) { in2000_execute()
653 if ((i = cmd->SCp.this_residual) > (IN2000_FIFO_SIZE - 16)) in2000_execute()
655 cmd->SCp.have_data_in = i; /* this much data in fifo */ in2000_execute()
657 sp = (unsigned short *) cmd->SCp.ptr; in2000_execute()
671 if (cmd->SCp.have_data_in <= ((IN2000_FIFO_SIZE - 16) - 32)) { in2000_execute()
690 cmd->SCp.have_data_in = 0; /* nothing transferred yet */ in2000_execute()
707 DB(DB_EXECUTE, printk("%s)EX-2 ", (cmd->SCp.phase) ? "d:" : "")) in2000_execute()
747 static void transfer_bytes(Scsi_Cmnd * cmd, int data_in_dir) transfer_bytes() argument
754 hostdata = (struct IN2000_hostdata *) cmd->device->host->hostdata; transfer_bytes()
764 if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) { transfer_bytes()
765 ++cmd->SCp.buffer; transfer_bytes()
766 --cmd->SCp.buffers_residual; transfer_bytes()
767 cmd->SCp.this_residual = cmd->SCp.buffer->length; transfer_bytes()
768 cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); transfer_bytes()
773 write_3393(hostdata, WD_SYNCHRONOUS_TRANSFER, hostdata->sync_xfer[cmd->device->id]); transfer_bytes()
774 write_3393_count(hostdata, cmd->SCp.this_residual); transfer_bytes()
784 if ((hostdata->level2 >= L2_DATA) || (hostdata->level2 == L2_BASIC && cmd->SCp.phase == 0)) { transfer_bytes()
791 cmd->SCp.have_data_in = 0; transfer_bytes()
800 if ((hostdata->level2 >= L2_DATA) || (hostdata->level2 == L2_BASIC && cmd->SCp.phase == 0)) { transfer_bytes()
807 sp = (unsigned short *) cmd->SCp.ptr; transfer_bytes()
809 if ((i = cmd->SCp.this_residual) > IN2000_FIFO_SIZE) transfer_bytes()
811 cmd->SCp.have_data_in = i; transfer_bytes()
837 Scsi_Cmnd *patch, *cmd; in2000_intr() local
913 cmd = (Scsi_Cmnd *) hostdata->connected; /* assume we're connected */ in2000_intr()
914 CHECK_NULL(cmd, "fifo_int") in2000_intr()
920 sp = (unsigned short *) (cmd->SCp.ptr + cmd->SCp.have_data_in); in2000_intr()
934 i = sp - (unsigned short *) (cmd->SCp.ptr + cmd->SCp.have_data_in); in2000_intr()
936 cmd->SCp.have_data_in += i; in2000_intr()
953 if (cmd->SCp.this_residual == cmd->SCp.have_data_in) { in2000_intr()
964 sp = (unsigned short *) (cmd->SCp.ptr + cmd->SCp.have_data_in); in2000_intr()
965 i = cmd->SCp.this_residual - cmd->SCp.have_data_in; /* bytes yet to go */ in2000_intr()
973 i = sp - (unsigned short *) (cmd->SCp.ptr + cmd->SCp.have_data_in); in2000_intr()
975 cmd->SCp.have_data_in += i; in2000_intr()
995 cmd = (Scsi_Cmnd *) hostdata->connected; /* assume we're connected */ in2000_intr()
999 if (!cmd && (sr != CSR_RESEL_AM && sr != CSR_TIMEOUT && sr != CSR_SELECT)) { in2000_intr()
1026 sp = (unsigned short *) (cmd->SCp.ptr + cmd->SCp.have_data_in); in2000_intr()
1030 i = (cmd->SCp.this_residual - read_3393_count(hostdata)) - cmd->SCp.have_data_in; in2000_intr()
1044 length = cmd->SCp.this_residual; in2000_intr()
1045 cmd->SCp.this_residual = read_3393_count(hostdata); in2000_intr()
1046 cmd->SCp.ptr += (length - cmd->SCp.this_residual); in2000_intr()
1048 DB(DB_TRANSFER, printk("(%p,%d)", cmd->SCp.ptr, cmd->SCp.this_residual)) in2000_intr()
1054 length = cmd->SCp.this_residual; in2000_intr()
1055 cmd->SCp.this_residual = read_3393_count(hostdata); in2000_intr()
1056 cmd->SCp.ptr += (length - cmd->SCp.this_residual); in2000_intr()
1058 DB(DB_TRANSFER, printk("(%p,%d)", cmd->SCp.ptr, cmd->SCp.this_residual)) in2000_intr()
1072 cmd = (Scsi_Cmnd *) hostdata->selecting; /* get a valid cmd */ in2000_intr()
1073 CHECK_NULL(cmd, "csr_timeout") in2000_intr()
1077 cmd->result = DID_NO_CONNECT << 16; in2000_intr()
1078 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); in2000_intr()
1080 cmd->scsi_done(cmd); in2000_intr()
1094 hostdata->connected = cmd = (Scsi_Cmnd *) hostdata->selecting; in2000_intr()
1095 CHECK_NULL(cmd, "csr_select") in2000_intr()
1100 hostdata->outgoing_msg[0] = (0x80 | 0x00 | cmd->device->lun); in2000_intr()
1101 if (cmd->SCp.phase) in2000_intr()
1104 if (hostdata->sync_stat[cmd->device->id] == SS_FIRST) { in2000_intr()
1109 hostdata->sync_stat[cmd->device->id] = SS_WAITING; in2000_intr()
1129 DB(DB_INTR, printk("IN-%d.%d", cmd->SCp.this_residual, cmd->SCp.buffers_residual)) in2000_intr()
1130 transfer_bytes(cmd, DATA_IN_DIR); in2000_intr()
1139 DB(DB_INTR, printk("OUT-%d.%d", cmd->SCp.this_residual, cmd->SCp.buffers_residual)) in2000_intr()
1140 transfer_bytes(cmd, DATA_OUT_DIR); in2000_intr()
1151 DB(DB_INTR, printk("CMND-%02x", cmd->cmnd[0])) in2000_intr()
1152 transfer_pio(cmd->cmnd, cmd->cmd_len, DATA_OUT_DIR, hostdata); in2000_intr()
1162 cmd->SCp.Status = read_1_byte(hostdata); in2000_intr()
1163 DB(DB_INTR, printk("%02x", cmd->SCp.Status)) in2000_intr()
1189 cmd->SCp.Message = msg; in2000_intr()
1218 cmd->device->disconnect = 1; in2000_intr()
1228 if (hostdata->sync_stat[cmd->device->id] == SS_WAITING) in2000_intr()
1229 hostdata->sync_stat[cmd->device->id] = SS_SET; in2000_intr()
1249 if (hostdata->sync_stat[cmd->device->id] != SS_WAITING) { in2000_intr()
1267 hostdata->sync_xfer[cmd->device->id] = calc_sync_xfer(hostdata->default_sx_per / 4, 0); in2000_intr()
1269 hostdata->sync_xfer[cmd->device->id] = id; in2000_intr()
1272 printk("sync_xfer=%02x", hostdata->sync_xfer[cmd->device->id]); in2000_intr()
1274 hostdata->sync_stat[cmd->device->id] = SS_SET; in2000_intr()
1332 cmd->SCp.Message = COMMAND_COMPLETE; in2000_intr()
1334 DB(DB_INTR, printk(":%d.%d", cmd->SCp.Status, lun)) in2000_intr()
1336 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); in2000_intr()
1338 if (cmd->SCp.Status == ILLEGAL_STATUS_BYTE) in2000_intr()
1339 cmd->SCp.Status = lun; in2000_intr()
1340 if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD) in2000_intr()
1341 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); in2000_intr()
1343 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); in2000_intr()
1344 cmd->scsi_done(cmd); in2000_intr()
1411 if (cmd == NULL) { in2000_intr()
1421 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); in2000_intr()
1423 if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD) in2000_intr()
1424 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); in2000_intr()
1426 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); in2000_intr()
1427 cmd->scsi_done(cmd); in2000_intr()
1445 if (cmd == NULL) { in2000_intr()
1452 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); in2000_intr()
1454 DB(DB_INTR, printk(":%d", cmd->SCp.Status)) in2000_intr()
1455 if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD) in2000_intr()
1456 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); in2000_intr()
1458 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); in2000_intr()
1459 cmd->scsi_done(cmd); in2000_intr()
1463 cmd->host_scribble = (uchar *) hostdata->disconnected_Q; in2000_intr()
1464 hostdata->disconnected_Q = cmd; in2000_intr()
1469 hostdata->disc_done_cnt[cmd->device->id]++; in2000_intr()
1495 cmd = (Scsi_Cmnd *) hostdata->selecting; in2000_intr()
1497 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); in2000_intr()
1498 cmd->host_scribble = (uchar *) hostdata->input_Q; in2000_intr()
1499 hostdata->input_Q = cmd; in2000_intr()
1505 if (cmd) { in2000_intr()
1507 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); in2000_intr()
1508 cmd->host_scribble = (uchar *) hostdata->input_Q; in2000_intr()
1509 hostdata->input_Q = cmd; in2000_intr()
1536 cmd = (Scsi_Cmnd *) hostdata->disconnected_Q; in2000_intr()
1538 while (cmd) { in2000_intr()
1539 if (id == cmd->device->id && lun == cmd->device->lun) in2000_intr()
1541 patch = cmd; in2000_intr()
1542 cmd = (Scsi_Cmnd *) cmd->host_scribble; in2000_intr()
1547 if (!cmd) { in2000_intr()
1555 patch->host_scribble = cmd->host_scribble; in2000_intr()
1557 hostdata->disconnected_Q = (Scsi_Cmnd *) cmd->host_scribble; in2000_intr()
1558 hostdata->connected = cmd; in2000_intr()
1565 if (is_dir_out(cmd)) in2000_intr()
1566 write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id); in2000_intr()
1568 write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id | DSTID_DPD); in2000_intr()
1642 static int in2000_bus_reset(Scsi_Cmnd * cmd) in2000_bus_reset() argument
1649 instance = cmd->device->host; in2000_bus_reset()
1672 cmd->result = DID_RESET << 16; in2000_bus_reset()
1678 static int __in2000_abort(Scsi_Cmnd * cmd) __in2000_abort() argument
1686 instance = cmd->device->host; __in2000_abort()
1690 printk("(asr=%02x,count=%ld,resid=%d,buf_resid=%d,have_data=%d,FC=%02x)- ", READ_AUX_STAT(), read_3393_count(hostdata), cmd->SCp.this_residual, cmd->SCp.buffers_residual, cmd->SCp.have_data_in, read1_io(IO_FIFO_COUNT)); __in2000_abort()
1700 if (tmp == cmd) { __in2000_abort()
1702 prev->host_scribble = cmd->host_scribble; __in2000_abort()
1703 cmd->host_scribble = NULL; __in2000_abort()
1704 cmd->result = DID_ABORT << 16; __in2000_abort()
1706 cmd->scsi_done(cmd); __in2000_abort()
1724 if (hostdata->connected == cmd) { __in2000_abort()
1760 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); __in2000_abort()
1763 cmd->result = DID_ABORT << 16; __in2000_abort()
1764 cmd->scsi_done(cmd); __in2000_abort()
1778 if (cmd == tmp) { __in2000_abort()
1799 static int in2000_abort(Scsi_Cmnd * cmd) in2000_abort() argument
1803 spin_lock_irq(cmd->device->host->host_lock); in2000_abort()
1804 rc = __in2000_abort(cmd); in2000_abort()
1805 spin_unlock_irq(cmd->device->host->host_lock); in2000_abort()
2218 Scsi_Cmnd *cmd; in2000_show_info() local
2253 cmd = (Scsi_Cmnd *) hd->connected; in2000_show_info()
2254 seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); in2000_show_info()
2259 cmd = (Scsi_Cmnd *) hd->input_Q; in2000_show_info()
2260 while (cmd) { in2000_show_info()
2261 seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); in2000_show_info()
2262 cmd = (Scsi_Cmnd *) cmd->host_scribble; in2000_show_info()
2267 cmd = (Scsi_Cmnd *) hd->disconnected_Q; in2000_show_info()
2268 while (cmd) { in2000_show_info()
2269 seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); in2000_show_info()
2270 cmd = (Scsi_Cmnd *) cmd->host_scribble; in2000_show_info()
H A Dscsi.c129 * @cmd: command to release
135 scsi_host_free_command(struct Scsi_Host *shost, struct scsi_cmnd *cmd) scsi_host_free_command() argument
139 if (cmd->prot_sdb) scsi_host_free_command()
140 kmem_cache_free(scsi_sdb_cache, cmd->prot_sdb); scsi_host_free_command()
141 kmem_cache_free(pool->sense_slab, cmd->sense_buffer); scsi_host_free_command()
142 kmem_cache_free(pool->cmd_slab, cmd); scsi_host_free_command()
157 struct scsi_cmnd *cmd; scsi_host_alloc_command() local
159 cmd = kmem_cache_zalloc(pool->cmd_slab, gfp_mask | pool->gfp_mask); scsi_host_alloc_command()
160 if (!cmd) scsi_host_alloc_command()
163 cmd->sense_buffer = kmem_cache_alloc(pool->sense_slab, scsi_host_alloc_command()
165 if (!cmd->sense_buffer) scsi_host_alloc_command()
169 cmd->prot_sdb = kmem_cache_zalloc(scsi_sdb_cache, gfp_mask); scsi_host_alloc_command()
170 if (!cmd->prot_sdb) scsi_host_alloc_command()
174 return cmd; scsi_host_alloc_command()
177 kmem_cache_free(pool->sense_slab, cmd->sense_buffer); scsi_host_alloc_command()
179 kmem_cache_free(pool->cmd_slab, cmd); scsi_host_alloc_command()
195 struct scsi_cmnd *cmd = scsi_host_alloc_command(shost, gfp_mask); __scsi_get_command() local
197 if (unlikely(!cmd)) { __scsi_get_command()
202 cmd = list_entry(shost->free_list.next, __scsi_get_command()
204 list_del_init(&cmd->list); __scsi_get_command()
208 if (cmd) { __scsi_get_command()
211 buf = cmd->sense_buffer; __scsi_get_command()
212 prot = cmd->prot_sdb; __scsi_get_command()
214 memset(cmd, 0, sizeof(*cmd)); __scsi_get_command()
216 cmd->sense_buffer = buf; __scsi_get_command()
217 cmd->prot_sdb = prot; __scsi_get_command()
221 return cmd; __scsi_get_command()
233 struct scsi_cmnd *cmd = __scsi_get_command(dev->host, gfp_mask); scsi_get_command() local
236 if (unlikely(cmd == NULL)) scsi_get_command()
239 cmd->device = dev; scsi_get_command()
240 INIT_LIST_HEAD(&cmd->list); scsi_get_command()
241 INIT_DELAYED_WORK(&cmd->abort_work, scmd_eh_abort_handler); scsi_get_command()
243 list_add_tail(&cmd->list, &dev->cmd_list); scsi_get_command()
245 cmd->jiffies_at_alloc = jiffies; scsi_get_command()
246 return cmd; scsi_get_command()
252 * @cmd: Command to free
254 static void __scsi_put_command(struct Scsi_Host *shost, struct scsi_cmnd *cmd) __scsi_put_command() argument
261 list_add(&cmd->list, &shost->free_list); __scsi_put_command()
262 cmd = NULL; __scsi_put_command()
267 if (likely(cmd != NULL)) __scsi_put_command()
268 scsi_host_free_command(shost, cmd); __scsi_put_command()
273 * @cmd: command block to free
279 void scsi_put_command(struct scsi_cmnd *cmd) scsi_put_command() argument
284 spin_lock_irqsave(&cmd->device->list_lock, flags); scsi_put_command()
285 BUG_ON(list_empty(&cmd->list)); scsi_put_command()
286 list_del_init(&cmd->list); scsi_put_command()
287 spin_unlock_irqrestore(&cmd->device->list_lock, flags); scsi_put_command()
289 BUG_ON(delayed_work_pending(&cmd->abort_work)); scsi_put_command()
291 __scsi_put_command(cmd->device->host, cmd); scsi_put_command()
428 struct scsi_cmnd *cmd; scsi_setup_command_freelist() local
440 cmd = scsi_host_alloc_command(shost, gfp_mask); scsi_setup_command_freelist()
441 if (!cmd) { scsi_setup_command_freelist()
446 list_add(&cmd->list, &shost->free_list); scsi_setup_command_freelist()
464 struct scsi_cmnd *cmd; scsi_destroy_command_freelist() local
466 cmd = list_entry(shost->free_list.next, struct scsi_cmnd, list); scsi_destroy_command_freelist()
467 list_del_init(&cmd->list); scsi_destroy_command_freelist()
468 scsi_host_free_command(shost, cmd); scsi_destroy_command_freelist()
475 void scsi_log_send(struct scsi_cmnd *cmd) scsi_log_send() argument
484 * 2: log opcode + command of all commands + cmd address scsi_log_send()
494 scmd_printk(KERN_INFO, cmd, scsi_log_send()
495 "Send: scmd 0x%p\n", cmd); scsi_log_send()
496 scsi_print_command(cmd); scsi_log_send()
501 void scsi_log_completion(struct scsi_cmnd *cmd, int disposition) scsi_log_completion() argument
520 if (((level > 0) && (cmd->result || disposition != SUCCESS)) || scsi_log_completion()
522 scsi_print_result(cmd, "Done", disposition); scsi_log_completion()
523 scsi_print_command(cmd); scsi_log_completion()
524 if (status_byte(cmd->result) & CHECK_CONDITION) scsi_log_completion()
525 scsi_print_sense(cmd); scsi_log_completion()
527 scmd_printk(KERN_INFO, cmd, scsi_log_completion()
529 atomic_read(&cmd->device->host->host_busy), scsi_log_completion()
530 cmd->device->host->host_failed); scsi_log_completion()
539 * @cmd: command to assign serial number to
544 void scsi_cmd_get_serial(struct Scsi_Host *host, struct scsi_cmnd *cmd) scsi_cmd_get_serial() argument
546 cmd->serial_number = host->cmd_serial_number++; scsi_cmd_get_serial()
547 if (cmd->serial_number == 0) scsi_cmd_get_serial()
548 cmd->serial_number = host->cmd_serial_number++; scsi_cmd_get_serial()
554 * @cmd: the command
560 void scsi_finish_command(struct scsi_cmnd *cmd) scsi_finish_command() argument
562 struct scsi_device *sdev = cmd->device; scsi_finish_command()
585 if (SCSI_SENSE_VALID(cmd)) scsi_finish_command()
586 cmd->result |= (DRIVER_SENSE << 24); scsi_finish_command()
590 "(result %x)\n", cmd->result)); scsi_finish_command()
592 good_bytes = scsi_bufflen(cmd); scsi_finish_command()
593 if (cmd->request->cmd_type != REQ_TYPE_BLOCK_PC) { scsi_finish_command()
595 drv = scsi_cmd_to_driver(cmd); scsi_finish_command()
597 good_bytes = drv->done(cmd); scsi_finish_command()
605 good_bytes -= scsi_get_resid(cmd); scsi_finish_command()
607 scsi_io_completion(cmd, good_bytes); scsi_finish_command()
689 unsigned char cmd[16]; scsi_vpd_inquiry() local
694 cmd[0] = INQUIRY; scsi_vpd_inquiry()
695 cmd[1] = 1; /* EVPD */ scsi_vpd_inquiry()
696 cmd[2] = page; scsi_vpd_inquiry()
697 cmd[3] = len >> 8; scsi_vpd_inquiry()
698 cmd[4] = len & 0xff; scsi_vpd_inquiry()
699 cmd[5] = 0; /* Control byte */ scsi_vpd_inquiry()
705 result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, scsi_vpd_inquiry()
871 unsigned char cmd[16]; scsi_report_opcode() local
878 memset(cmd, 0, 16); scsi_report_opcode()
879 cmd[0] = MAINTENANCE_IN; scsi_report_opcode()
880 cmd[1] = MI_REPORT_SUPPORTED_OPERATION_CODES; scsi_report_opcode()
881 cmd[2] = 1; /* One command format */ scsi_report_opcode()
882 cmd[3] = opcode; scsi_report_opcode()
883 put_unaligned_be32(len, &cmd[6]); scsi_report_opcode()
886 result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, scsi_report_opcode()
H A Dsr_ioctl.c53 cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP; sr_read_tochdr()
54 cgc.cmd[8] = 12; /* LSB of length */ sr_read_tochdr()
83 cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP; sr_read_tocentry()
84 cgc.cmd[1] |= (tocentry->cdte_format == CDROM_MSF) ? 0x02 : 0; sr_read_tocentry()
85 cgc.cmd[6] = tocentry->cdte_track; sr_read_tocentry()
86 cgc.cmd[8] = 12; /* LSB of length */ sr_read_tocentry()
145 cgc.cmd[0] = GPCMD_PLAY_AUDIO_MSF; sr_fake_playtrkind()
146 cgc.cmd[3] = trk0_te.cdte_addr.msf.minute; sr_fake_playtrkind()
147 cgc.cmd[4] = trk0_te.cdte_addr.msf.second; sr_fake_playtrkind()
148 cgc.cmd[5] = trk0_te.cdte_addr.msf.frame; sr_fake_playtrkind()
149 cgc.cmd[6] = trk1_te.cdte_addr.msf.minute; sr_fake_playtrkind()
150 cgc.cmd[7] = trk1_te.cdte_addr.msf.second; sr_fake_playtrkind()
151 cgc.cmd[8] = trk1_te.cdte_addr.msf.frame; sr_fake_playtrkind()
167 cgc.cmd[0] = GPCMD_PLAYAUDIO_TI; sr_play_trkind()
168 cgc.cmd[4] = ti->cdti_trk0; sr_play_trkind()
169 cgc.cmd[5] = ti->cdti_ind0; sr_play_trkind()
170 cgc.cmd[7] = ti->cdti_trk1; sr_play_trkind()
171 cgc.cmd[8] = ti->cdti_ind1; sr_play_trkind()
209 result = scsi_execute(SDev, cgc->cmd, cgc->data_direction, sr_do_ioctl()
279 cgc.cmd[0] = GPCMD_START_STOP_UNIT; sr_tray_move()
280 cgc.cmd[4] = (pos == 0) ? 0x03 /* close */ : 0x02 /* eject */ ; sr_tray_move()
404 cgc.cmd[0] = GPCMD_READ_SUBCHANNEL; sr_get_mcn()
405 cgc.cmd[2] = 0x40; /* I do want the subchannel info */ sr_get_mcn()
406 cgc.cmd[3] = 0x02; /* Give me medium catalog number info */ sr_get_mcn()
407 cgc.cmd[8] = 24; sr_get_mcn()
437 cgc.cmd[0] = GPCMD_SET_SPEED; /* SET CD SPEED */ sr_select_speed()
438 cgc.cmd[2] = (speed >> 8) & 0xff; /* MSB for speed (in kbytes/sec) */ sr_select_speed()
439 cgc.cmd[3] = speed & 0xff; /* LSB */ sr_select_speed()
454 int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg) sr_audio_ioctl() argument
456 switch (cmd) { sr_audio_ioctl()
492 cgc.cmd[0] = GPCMD_READ_CD; /* READ_CD */ sr_read_cd()
493 cgc.cmd[1] = ((format & 7) << 2); sr_read_cd()
494 cgc.cmd[2] = (unsigned char) (lba >> 24) & 0xff; sr_read_cd()
495 cgc.cmd[3] = (unsigned char) (lba >> 16) & 0xff; sr_read_cd()
496 cgc.cmd[4] = (unsigned char) (lba >> 8) & 0xff; sr_read_cd()
497 cgc.cmd[5] = (unsigned char) lba & 0xff; sr_read_cd()
498 cgc.cmd[8] = 1; sr_read_cd()
501 cgc.cmd[9] = 0x58; sr_read_cd()
504 cgc.cmd[9] = 0x78; sr_read_cd()
507 cgc.cmd[9] = 0xf8; sr_read_cd()
510 cgc.cmd[9] = 0x10; sr_read_cd()
550 cgc.cmd[0] = GPCMD_READ_10; sr_read_sector()
551 cgc.cmd[2] = (unsigned char) (lba >> 24) & 0xff; sr_read_sector()
552 cgc.cmd[3] = (unsigned char) (lba >> 16) & 0xff; sr_read_sector()
553 cgc.cmd[4] = (unsigned char) (lba >> 8) & 0xff; sr_read_sector()
554 cgc.cmd[5] = (unsigned char) lba & 0xff; sr_read_sector()
555 cgc.cmd[8] = 1; sr_read_sector()
H A Datari_NCR5380.c230 #define NEXT(cmd) ((struct scsi_cmnd *)(cmd)->host_scribble)
231 #define SET_NEXT(cmd,next) ((cmd)->host_scribble = (void *)(next))
232 #define NEXTADDR(cmd) ((struct scsi_cmnd **)&(cmd)->host_scribble)
235 #define H_NO(cmd) (cmd)->device->host->host_no
304 static int is_lun_busy(struct scsi_cmnd *cmd, int should_be_tagged) is_lun_busy() argument
306 u8 lun = cmd->device->lun; is_lun_busy()
307 SETUP_HOSTDATA(cmd->device->host); is_lun_busy()
309 if (hostdata->busy[cmd->device->id] & (1 << lun)) is_lun_busy()
313 !cmd->device->tagged_supported) is_lun_busy()
315 if (hostdata->TagAlloc[scmd_id(cmd)][lun].nr_allocated >= is_lun_busy()
316 hostdata->TagAlloc[scmd_id(cmd)][lun].queue_size) { is_lun_busy()
318 H_NO(cmd), cmd->device->id, lun); is_lun_busy()
330 static void cmd_get_tag(struct scsi_cmnd *cmd, int should_be_tagged) cmd_get_tag() argument
332 u8 lun = cmd->device->lun; cmd_get_tag()
333 SETUP_HOSTDATA(cmd->device->host); cmd_get_tag()
340 !cmd->device->tagged_supported) { cmd_get_tag()
341 cmd->tag = TAG_NONE; cmd_get_tag()
342 hostdata->busy[cmd->device->id] |= (1 << lun); cmd_get_tag()
344 "command\n", H_NO(cmd), cmd->device->id, lun); cmd_get_tag()
346 struct tag_alloc *ta = &hostdata->TagAlloc[scmd_id(cmd)][lun]; cmd_get_tag()
348 cmd->tag = find_first_zero_bit(ta->allocated, MAX_TAGS); cmd_get_tag()
349 set_bit(cmd->tag, ta->allocated); cmd_get_tag()
353 H_NO(cmd), cmd->tag, cmd->device->id, cmd_get_tag()
359 /* Mark the tag of command 'cmd' as free, or in case of an untagged command,
363 static void cmd_free_tag(struct scsi_cmnd *cmd) cmd_free_tag() argument
365 u8 lun = cmd->device->lun; cmd_free_tag()
366 SETUP_HOSTDATA(cmd->device->host); cmd_free_tag()
368 if (cmd->tag == TAG_NONE) { cmd_free_tag()
369 hostdata->busy[cmd->device->id] &= ~(1 << lun); cmd_free_tag()
370 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d untagged cmd finished\n", cmd_free_tag()
371 H_NO(cmd), cmd->device->id, lun); cmd_free_tag()
372 } else if (cmd->tag >= MAX_TAGS) { cmd_free_tag()
374 H_NO(cmd), cmd->tag); cmd_free_tag()
376 struct tag_alloc *ta = &hostdata->TagAlloc[scmd_id(cmd)][lun]; cmd_free_tag()
377 clear_bit(cmd->tag, ta->allocated); cmd_free_tag()
380 H_NO(cmd), cmd->tag, cmd->device->id, lun); cmd_free_tag()
406 * Function: void merge_contiguous_buffers( struct scsi_cmnd *cmd )
412 * Parameters: struct scsi_cmnd *cmd
417 static void merge_contiguous_buffers(struct scsi_cmnd *cmd) merge_contiguous_buffers() argument
422 unsigned long oldlen = cmd->SCp.this_residual; merge_contiguous_buffers()
426 for (endaddr = virt_to_phys(cmd->SCp.ptr + cmd->SCp.this_residual - 1) + 1; merge_contiguous_buffers()
427 cmd->SCp.buffers_residual && merge_contiguous_buffers()
428 virt_to_phys(sg_virt(&cmd->SCp.buffer[1])) == endaddr;) { merge_contiguous_buffers()
430 page_address(sg_page(&cmd->SCp.buffer[1])), endaddr); merge_contiguous_buffers()
434 ++cmd->SCp.buffer; merge_contiguous_buffers()
435 --cmd->SCp.buffers_residual; merge_contiguous_buffers()
436 cmd->SCp.this_residual += cmd->SCp.buffer->length; merge_contiguous_buffers()
437 endaddr += cmd->SCp.buffer->length; merge_contiguous_buffers()
440 if (oldlen != cmd->SCp.this_residual) merge_contiguous_buffers()
442 cnt, cmd->SCp.ptr, cmd->SCp.this_residual); merge_contiguous_buffers()
449 * @cmd: command block to set up
454 static inline void initialize_SCp(struct scsi_cmnd *cmd) initialize_SCp() argument
461 if (scsi_bufflen(cmd)) { initialize_SCp()
462 cmd->SCp.buffer = scsi_sglist(cmd); initialize_SCp()
463 cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1; initialize_SCp()
464 cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); initialize_SCp()
465 cmd->SCp.this_residual = cmd->SCp.buffer->length; initialize_SCp()
469 merge_contiguous_buffers(cmd); initialize_SCp()
471 cmd->SCp.buffer = NULL; initialize_SCp()
472 cmd->SCp.buffers_residual = 0; initialize_SCp()
473 cmd->SCp.ptr = NULL; initialize_SCp()
474 cmd->SCp.this_residual = 0; initialize_SCp()
663 static void lprint_Scsi_Cmnd(struct scsi_cmnd *cmd) lprint_Scsi_Cmnd() argument
668 H_NO(cmd), cmd->device->id, cmd->device->lun); lprint_Scsi_Cmnd()
670 command = cmd->cmnd; lprint_Scsi_Cmnd()
708 static void show_Scsi_Cmnd(struct scsi_cmnd *cmd, struct seq_file *m) show_Scsi_Cmnd() argument
713 H_NO(cmd), cmd->device->id, cmd->device->lun); show_Scsi_Cmnd()
715 command = cmd->cmnd; show_Scsi_Cmnd()
820 * @cmd: SCSI command
822 * cmd is added to the per instance issue_queue, with minor
823 * twiddling done to the host specific fields of cmd. If the
828 struct scsi_cmnd *cmd) NCR5380_queue_command()
835 switch (cmd->cmnd[0]) { NCR5380_queue_command()
839 H_NO(cmd)); NCR5380_queue_command()
840 cmd->result = (DID_ERROR << 16); NCR5380_queue_command()
841 cmd->scsi_done(cmd); NCR5380_queue_command()
851 SET_NEXT(cmd, NULL); NCR5380_queue_command()
852 cmd->result = 0; NCR5380_queue_command()
855 * Insert the cmd into the issue queue. Note that REQUEST SENSE NCR5380_queue_command()
879 * Insert the cmd into the issue queue. Note that REQUEST SENSE NCR5380_queue_command()
885 if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) { NCR5380_queue_command()
886 LIST(cmd, hostdata->issue_queue); NCR5380_queue_command()
887 SET_NEXT(cmd, hostdata->issue_queue); NCR5380_queue_command()
888 hostdata->issue_queue = cmd; NCR5380_queue_command()
893 LIST(cmd, tmp); NCR5380_queue_command()
894 SET_NEXT(tmp, cmd); NCR5380_queue_command()
898 dprintk(NDEBUG_QUEUES, "scsi%d: command added to %s of queue\n", H_NO(cmd), NCR5380_queue_command()
899 (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail"); NCR5380_queue_command()
1116 "no connected cmd\n", HOSTNO); NCR5380_dma_complete()
1280 * struct scsi_cmnd *cmd)
1287 * target lives, cmd - SCSI command to execute.
1300 * instance->connected will be set to cmd.
1303 * If failed (no target) : cmd->scsi_done() will be called, and the
1304 * cmd->result host byte set to DID_BAD_TARGET.
1307 static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) NCR5380_select() argument
1429 NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->device->id))); NCR5380_select()
1482 dprintk(NDEBUG_SELECTION, "scsi%d: selecting target %d\n", HOSTNO, cmd->device->id); NCR5380_select()
1534 if (hostdata->targets_present & (1 << cmd->device->id)) { NCR5380_select()
1542 cmd->result = DID_BAD_TARGET << 16; NCR5380_select()
1544 cmd_free_tag(cmd); NCR5380_select()
1546 cmd->scsi_done(cmd); NCR5380_select()
1553 hostdata->targets_present |= (1 << cmd->device->id); NCR5380_select()
1575 HOSTNO, cmd->device->id); NCR5380_select()
1576 tmp[0] = IDENTIFY(1, cmd->device->lun); NCR5380_select()
1579 if (cmd->tag != TAG_NONE) { NCR5380_select()
1581 tmp[2] = cmd->tag; NCR5380_select()
1587 cmd->tag = 0; NCR5380_select()
1596 hostdata->connected = cmd; NCR5380_select()
1598 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); NCR5380_select()
1604 initialize_SCp(cmd); NCR5380_select()
1956 struct scsi_cmnd *cmd = (struct scsi_cmnd *) hostdata->connected; NCR5380_information_transfer() local
1977 if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) { NCR5380_information_transfer()
1978 count = cmd->SCp.buffer->length; NCR5380_information_transfer()
1979 d = sg_virt(cmd->SCp.buffer); NCR5380_information_transfer()
1981 count = cmd->SCp.this_residual; NCR5380_information_transfer()
1982 d = cmd->SCp.ptr; NCR5380_information_transfer()
1985 if ((count >= DMA_MIN_SIZE) && (sun3_dma_setup_done != cmd)) { NCR5380_information_transfer()
1986 if (cmd->request->cmd_type == REQ_TYPE_FS) { NCR5380_information_transfer()
1988 rq_data_dir(cmd->request)); NCR5380_information_transfer()
1989 sun3_dma_setup_done = cmd; NCR5380_information_transfer()
2019 cmd->result = DID_ERROR << 16; NCR5380_information_transfer()
2020 cmd->scsi_done(cmd); NCR5380_information_transfer()
2029 if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) { NCR5380_information_transfer()
2030 ++cmd->SCp.buffer; NCR5380_information_transfer()
2031 --cmd->SCp.buffers_residual; NCR5380_information_transfer()
2032 cmd->SCp.this_residual = cmd->SCp.buffer->length; NCR5380_information_transfer()
2033 cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); NCR5380_information_transfer()
2037 merge_contiguous_buffers(cmd); NCR5380_information_transfer()
2039 HOSTNO, cmd->SCp.this_residual, NCR5380_information_transfer()
2040 cmd->SCp.buffers_residual); NCR5380_information_transfer()
2061 !cmd->device->borken && NCR5380_information_transfer()
2063 (transfersize = NCR5380_dma_xfer_len(instance, cmd, phase)) >= DMA_MIN_SIZE) { NCR5380_information_transfer()
2065 cmd->SCp.phase = phase; NCR5380_information_transfer()
2067 &len, (unsigned char **)&cmd->SCp.ptr)) { NCR5380_information_transfer()
2072 scmd_printk(KERN_INFO, cmd, NCR5380_information_transfer()
2074 cmd->device->borken = 1; NCR5380_information_transfer()
2079 cmd->result = DID_ERROR << 16; NCR5380_information_transfer()
2080 cmd->scsi_done(cmd); NCR5380_information_transfer()
2091 cmd->SCp.this_residual -= transfersize - len; NCR5380_information_transfer()
2097 (int *)&cmd->SCp.this_residual, NCR5380_information_transfer()
2098 (unsigned char **)&cmd->SCp.ptr); NCR5380_information_transfer()
2101 if (sun3_dma_setup_done == cmd) NCR5380_information_transfer()
2110 cmd->SCp.Message = tmp; NCR5380_information_transfer()
2130 "complete.\n", HOSTNO, cmd->device->id, cmd->device->lun); NCR5380_information_transfer()
2140 if (!cmd->next_link) { NCR5380_information_transfer()
2143 HOSTNO, cmd->device->id, cmd->device->lun); NCR5380_information_transfer()
2149 initialize_SCp(cmd->next_link); NCR5380_information_transfer()
2152 cmd->next_link->tag = cmd->tag; NCR5380_information_transfer()
2153 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); NCR5380_information_transfer()
2156 HOSTNO, cmd->device->id, cmd->device->lun); NCR5380_information_transfer()
2157 cmd->scsi_done(cmd); NCR5380_information_transfer()
2158 cmd = hostdata->connected; NCR5380_information_transfer()
2166 "completed\n", HOSTNO, cmd->device->id, cmd->device->lun); NCR5380_information_transfer()
2172 cmd_free_tag(cmd); NCR5380_information_transfer()
2173 if (status_byte(cmd->SCp.Status) == QUEUE_FULL) { NCR5380_information_transfer()
2182 struct tag_alloc *ta = &hostdata->TagAlloc[scmd_id(cmd)][cmd->device->lun]; NCR5380_information_transfer()
2185 HOSTNO, cmd->device->id, cmd->device->lun, NCR5380_information_transfer()
2191 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); NCR5380_information_transfer()
2212 if (cmd->cmnd[0] != REQUEST_SENSE) NCR5380_information_transfer()
2213 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); NCR5380_information_transfer()
2214 else if (status_byte(cmd->SCp.Status) != GOOD) NCR5380_information_transfer()
2215 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); NCR5380_information_transfer()
2217 if ((cmd->cmnd[0] == REQUEST_SENSE) && NCR5380_information_transfer()
2219 scsi_eh_restore_cmnd(cmd, &hostdata->ses); NCR5380_information_transfer()
2223 if ((cmd->cmnd[0] != REQUEST_SENSE) && NCR5380_information_transfer()
2224 (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) { NCR5380_information_transfer()
2225 scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0); NCR5380_information_transfer()
2229 LIST(cmd,hostdata->issue_queue); NCR5380_information_transfer()
2230 SET_NEXT(cmd, hostdata->issue_queue); NCR5380_information_transfer()
2231 hostdata->issue_queue = (struct scsi_cmnd *) cmd; NCR5380_information_transfer()
2233 "issue queue\n", H_NO(cmd)); NCR5380_information_transfer()
2235 cmd->scsi_done(cmd); NCR5380_information_transfer()
2274 cmd->device->tagged_supported = 0; NCR5380_information_transfer()
2275 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); NCR5380_information_transfer()
2276 cmd->tag = TAG_NONE; NCR5380_information_transfer()
2280 HOSTNO, cmd->device->id, cmd->device->lun); NCR5380_information_transfer()
2288 cmd->device->disconnect = 1; NCR5380_information_transfer()
2289 LIST(cmd,hostdata->disconnected_queue); NCR5380_information_transfer()
2290 SET_NEXT(cmd, hostdata->disconnected_queue); NCR5380_information_transfer()
2292 hostdata->disconnected_queue = cmd; NCR5380_information_transfer()
2297 cmd->device->id, cmd->device->lun); NCR5380_information_transfer()
2398 scmd_printk(KERN_INFO, cmd, NCR5380_information_transfer()
2402 scmd_printk(KERN_INFO, cmd, NCR5380_information_transfer()
2419 cmd_free_tag(cmd); NCR5380_information_transfer()
2421 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); NCR5380_information_transfer()
2424 cmd->result = DID_ERROR << 16; NCR5380_information_transfer()
2428 cmd->scsi_done(cmd); NCR5380_information_transfer()
2434 len = cmd->cmd_len; NCR5380_information_transfer()
2435 data = cmd->cmnd; NCR5380_information_transfer()
2447 cmd->SCp.Status = tmp; NCR5380_information_transfer()
2654 * Function : int NCR5380_abort (struct scsi_cmnd *cmd)
2658 * Inputs : cmd - the scsi_cmnd to abort, code - code to set the
2671 int NCR5380_abort(struct scsi_cmnd *cmd) NCR5380_abort() argument
2673 struct Scsi_Host *instance = cmd->device->host; NCR5380_abort()
2678 scmd_printk(KERN_NOTICE, cmd, "aborting command\n"); NCR5380_abort()
2695 if (hostdata->connected == cmd) { NCR5380_abort()
2718 cmd->result = DID_ABORT << 16; NCR5380_abort()
2720 cmd_free_tag(cmd); NCR5380_abort()
2722 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); NCR5380_abort()
2726 cmd->scsi_done(cmd); NCR5380_abort()
2743 if (cmd == tmp) { NCR5380_abort()
2803 if (cmd == tmp) { NCR5380_abort()
2807 if (NCR5380_select(instance, cmd)) NCR5380_abort()
2818 if (cmd == tmp) { NCR5380_abort()
2830 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); NCR5380_abort()
2865 * Function : int NCR5380_reset (struct scsi_cmnd *cmd)
2873 static int NCR5380_bus_reset(struct scsi_cmnd *cmd) NCR5380_bus_reset() argument
2875 struct Scsi_Host *instance = cmd->device->host; NCR5380_bus_reset()
2904 dprintk(NDEBUG_ABORT, "scsi%d: reset aborted issued command(s)\n", H_NO(cmd)); NCR5380_bus_reset()
2906 dprintk(NDEBUG_ABORT, "scsi%d: reset aborted a connected command\n", H_NO(cmd)); NCR5380_bus_reset()
2908 dprintk(NDEBUG_ABORT, "scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd)); NCR5380_bus_reset()
827 NCR5380_queue_command(struct Scsi_Host *instance, struct scsi_cmnd *cmd) NCR5380_queue_command() argument
H A Dvmw_pvscsi.c60 struct scsi_cmnd *cmd; member in struct:pvscsi_ctx
160 pvscsi_find_context(const struct pvscsi_adapter *adapter, struct scsi_cmnd *cmd) pvscsi_find_context() argument
166 if (ctx->cmd == cmd) pvscsi_find_context()
173 pvscsi_acquire_context(struct pvscsi_adapter *adapter, struct scsi_cmnd *cmd) pvscsi_acquire_context() argument
181 ctx->cmd = cmd; pvscsi_acquire_context()
190 ctx->cmd = NULL; pvscsi_release_context()
251 u32 cmd, const void *desc, size_t len) pvscsi_write_cmd_desc()
257 pvscsi_reg_write(adapter, PVSCSI_REG_OFFSET_COMMAND, cmd); pvscsi_write_cmd_desc()
266 struct PVSCSICmdDescAbortCmd cmd = { 0 }; pvscsi_abort_cmd() local
268 cmd.target = ctx->cmd->device->id; pvscsi_abort_cmd()
269 cmd.context = pvscsi_map_context(adapter, ctx); pvscsi_abort_cmd()
271 pvscsi_write_cmd_desc(adapter, PVSCSI_CMD_ABORT_CMD, &cmd, sizeof(cmd)); pvscsi_abort_cmd()
322 struct PVSCSICmdDescResetDevice cmd = { 0 }; ll_device_reset() local
326 cmd.target = target; ll_device_reset()
329 &cmd, sizeof(cmd)); ll_device_reset()
353 struct pvscsi_ctx *ctx, struct scsi_cmnd *cmd, pvscsi_map_buffers()
357 unsigned bufflen = scsi_bufflen(cmd); pvscsi_map_buffers()
365 sg = scsi_sglist(cmd); pvscsi_map_buffers()
366 count = scsi_sg_count(cmd); pvscsi_map_buffers()
368 int segs = scsi_dma_map(cmd); pvscsi_map_buffers()
384 cmd->sc_data_direction); pvscsi_map_buffers()
392 struct scsi_cmnd *cmd; pvscsi_unmap_buffers() local
395 cmd = ctx->cmd; pvscsi_unmap_buffers()
396 bufflen = scsi_bufflen(cmd); pvscsi_unmap_buffers()
399 unsigned count = scsi_sg_count(cmd); pvscsi_unmap_buffers()
402 scsi_dma_unmap(cmd); pvscsi_unmap_buffers()
410 cmd->sc_data_direction); pvscsi_unmap_buffers()
412 if (cmd->sense_buffer) pvscsi_unmap_buffers()
463 struct PVSCSICmdDescSetupRings cmd = { 0 }; pvscsi_setup_all_rings() local
467 cmd.ringsStatePPN = adapter->ringStatePA >> PAGE_SHIFT; pvscsi_setup_all_rings()
468 cmd.reqRingNumPages = adapter->req_pages; pvscsi_setup_all_rings()
469 cmd.cmpRingNumPages = adapter->cmp_pages; pvscsi_setup_all_rings()
473 cmd.reqRingPPNs[i] = base >> PAGE_SHIFT; pvscsi_setup_all_rings()
479 cmd.cmpRingPPNs[i] = base >> PAGE_SHIFT; pvscsi_setup_all_rings()
488 &cmd, sizeof(cmd)); pvscsi_setup_all_rings()
522 struct scsi_cmnd *cmd; pvscsi_complete_request() local
528 cmd = ctx->cmd; pvscsi_complete_request()
535 * the request completed and swallow the actual cmd completion pvscsi_complete_request()
543 cmd->result = 0; pvscsi_complete_request()
548 cmd->result = (DID_OK << 16) | sdstat; pvscsi_complete_request()
549 if (sdstat == SAM_STAT_CHECK_CONDITION && cmd->sense_buffer) pvscsi_complete_request()
550 cmd->result |= (DRIVER_SENSE << 24); pvscsi_complete_request()
557 cmd->result = (DID_OK << 16); pvscsi_complete_request()
563 scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen); pvscsi_complete_request()
564 cmd->result = (DID_ERROR << 16); pvscsi_complete_request()
569 cmd->result = (DID_BAD_TARGET << 16); pvscsi_complete_request()
575 cmd->result = (DRIVER_INVALID << 24); pvscsi_complete_request()
586 cmd->result |= (DID_ERROR << 16); pvscsi_complete_request()
592 cmd->result = (DID_RESET << 16); pvscsi_complete_request()
596 cmd->result = (DID_ABORT << 16); pvscsi_complete_request()
600 cmd->result = (DID_PARITY << 16); pvscsi_complete_request()
604 cmd->result = (DID_ERROR << 16); pvscsi_complete_request()
605 scmd_printk(KERN_DEBUG, cmd, pvscsi_complete_request()
610 dev_dbg(&cmd->device->sdev_gendev, pvscsi_complete_request()
611 "cmd=%p %x ctx=%p result=0x%x status=0x%x,%x\n", pvscsi_complete_request()
612 cmd, cmd->cmnd[0], ctx, cmd->result, btstat, sdstat); pvscsi_complete_request()
614 cmd->scsi_done(cmd); pvscsi_complete_request()
656 struct pvscsi_ctx *ctx, struct scsi_cmnd *cmd) pvscsi_queue_ring()
664 sdev = cmd->device; pvscsi_queue_ring()
676 scmd_printk(KERN_ERR, cmd, "vmw_pvscsi: " pvscsi_queue_ring()
689 if (cmd->sense_buffer) { pvscsi_queue_ring()
690 ctx->sensePA = pci_map_single(adapter->dev, cmd->sense_buffer, pvscsi_queue_ring()
699 e->cdbLen = cmd->cmd_len; pvscsi_queue_ring()
701 memcpy(e->cdb, cmd->cmnd, e->cdbLen); pvscsi_queue_ring()
705 if (cmd->sc_data_direction == DMA_FROM_DEVICE) pvscsi_queue_ring()
707 else if (cmd->sc_data_direction == DMA_TO_DEVICE) pvscsi_queue_ring()
709 else if (cmd->sc_data_direction == DMA_NONE) pvscsi_queue_ring()
714 pvscsi_map_buffers(adapter, ctx, cmd, e); pvscsi_queue_ring()
725 static int pvscsi_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) pvscsi_queue_lck() argument
727 struct Scsi_Host *host = cmd->device->host; pvscsi_queue_lck()
734 ctx = pvscsi_acquire_context(adapter, cmd); pvscsi_queue_lck()
735 if (!ctx || pvscsi_queue_ring(adapter, ctx, cmd) != 0) { pvscsi_queue_lck()
742 cmd->scsi_done = done; pvscsi_queue_lck()
744 dev_dbg(&cmd->device->sdev_gendev, pvscsi_queue_lck()
745 "queued cmd %p, ctx %p, op=%x\n", cmd, ctx, cmd->cmnd[0]); pvscsi_queue_lck()
749 pvscsi_kick_io(adapter, cmd->cmnd[0]); pvscsi_queue_lck()
756 static int pvscsi_abort(struct scsi_cmnd *cmd) pvscsi_abort() argument
758 struct pvscsi_adapter *adapter = shost_priv(cmd->device->host); pvscsi_abort()
764 scmd_printk(KERN_DEBUG, cmd, "task abort on host %u, %p\n", pvscsi_abort()
765 adapter->host->host_no, cmd); pvscsi_abort()
779 ctx = pvscsi_find_context(adapter, cmd); pvscsi_abort()
781 scmd_printk(KERN_DEBUG, cmd, "Failed to abort cmd %p\n", cmd); pvscsi_abort()
804 scmd_printk(KERN_DEBUG, cmd, pvscsi_abort()
805 "Failed to get completion for aborted cmd %p\n", pvscsi_abort()
806 cmd); pvscsi_abort()
813 cmd->result = (DID_ABORT << 16); pvscsi_abort()
814 cmd->scsi_done(cmd); pvscsi_abort()
833 struct scsi_cmnd *cmd = ctx->cmd; pvscsi_reset_all() local
834 if (cmd) { pvscsi_reset_all()
835 scmd_printk(KERN_ERR, cmd, pvscsi_reset_all()
836 "Forced reset on cmd %p\n", cmd); pvscsi_reset_all()
839 cmd->result = (DID_RESET << 16); pvscsi_reset_all()
840 cmd->scsi_done(cmd); pvscsi_reset_all()
845 static int pvscsi_host_reset(struct scsi_cmnd *cmd) pvscsi_host_reset() argument
847 struct Scsi_Host *host = cmd->device->host; pvscsi_host_reset()
852 scmd_printk(KERN_INFO, cmd, "SCSI Host reset\n"); pvscsi_host_reset()
899 static int pvscsi_bus_reset(struct scsi_cmnd *cmd) pvscsi_bus_reset() argument
901 struct Scsi_Host *host = cmd->device->host; pvscsi_bus_reset()
905 scmd_printk(KERN_INFO, cmd, "SCSI Bus reset\n"); pvscsi_bus_reset()
924 static int pvscsi_device_reset(struct scsi_cmnd *cmd) pvscsi_device_reset() argument
926 struct Scsi_Host *host = cmd->device->host; pvscsi_device_reset()
930 scmd_printk(KERN_INFO, cmd, "SCSI device reset on scsi%u:%u\n", pvscsi_device_reset()
931 host->host_no, cmd->device->id); pvscsi_device_reset()
941 ll_device_reset(adapter, cmd->device->id); pvscsi_device_reset()
1278 struct PVSCSICmdDescConfigCmd cmd; pvscsi_get_max_targets() local
1295 cmd.configPageAddress = ((u64)PVSCSI_CONFIG_CONTROLLER_ADDRESS) << 32; pvscsi_get_max_targets()
1296 cmd.configPageNum = PVSCSI_CONFIG_PAGE_CONTROLLER; pvscsi_get_max_targets()
1297 cmd.cmpAddr = configPagePA; pvscsi_get_max_targets()
1298 cmd._pad = 0; pvscsi_get_max_targets()
1310 pvscsi_write_cmd_desc(adapter, PVSCSI_CMD_CONFIG, &cmd, sizeof cmd); pvscsi_get_max_targets()
250 pvscsi_write_cmd_desc(const struct pvscsi_adapter *adapter, u32 cmd, const void *desc, size_t len) pvscsi_write_cmd_desc() argument
352 pvscsi_map_buffers(struct pvscsi_adapter *adapter, struct pvscsi_ctx *ctx, struct scsi_cmnd *cmd, struct PVSCSIRingReqDesc *e) pvscsi_map_buffers() argument
655 pvscsi_queue_ring(struct pvscsi_adapter *adapter, struct pvscsi_ctx *ctx, struct scsi_cmnd *cmd) pvscsi_queue_ring() argument
H A Dmvumi.c251 static int mvumi_internal_cmd_sgl(struct mvumi_hba *mhba, struct mvumi_cmd *cmd, mvumi_internal_cmd_sgl() argument
265 m_sg = (struct mvumi_sgl *) &cmd->frame->payload[0]; mvumi_internal_cmd_sgl()
266 cmd->frame->sg_counts = 1; mvumi_internal_cmd_sgl()
267 cmd->data_buf = virt_addr; mvumi_internal_cmd_sgl()
280 struct mvumi_cmd *cmd; mvumi_create_internal_cmd() local
282 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mvumi_create_internal_cmd()
283 if (!cmd) { mvumi_create_internal_cmd()
284 dev_err(&mhba->pdev->dev, "failed to create a internal cmd\n"); mvumi_create_internal_cmd()
287 INIT_LIST_HEAD(&cmd->queue_pointer); mvumi_create_internal_cmd()
289 cmd->frame = pci_alloc_consistent(mhba->pdev, mvumi_create_internal_cmd()
290 mhba->ib_max_size, &cmd->frame_phys); mvumi_create_internal_cmd()
291 if (!cmd->frame) { mvumi_create_internal_cmd()
294 kfree(cmd); mvumi_create_internal_cmd()
299 if (mvumi_internal_cmd_sgl(mhba, cmd, buf_size)) { mvumi_create_internal_cmd()
303 cmd->frame, cmd->frame_phys); mvumi_create_internal_cmd()
304 kfree(cmd); mvumi_create_internal_cmd()
308 cmd->frame->sg_counts = 0; mvumi_create_internal_cmd()
310 return cmd; mvumi_create_internal_cmd()
314 struct mvumi_cmd *cmd) mvumi_delete_internal_cmd()
320 if (cmd && cmd->frame) { mvumi_delete_internal_cmd()
321 if (cmd->frame->sg_counts) { mvumi_delete_internal_cmd()
322 m_sg = (struct mvumi_sgl *) &cmd->frame->payload[0]; mvumi_delete_internal_cmd()
328 pci_free_consistent(mhba->pdev, size, cmd->data_buf, mvumi_delete_internal_cmd()
332 cmd->frame, cmd->frame_phys); mvumi_delete_internal_cmd()
333 kfree(cmd); mvumi_delete_internal_cmd()
345 struct mvumi_cmd *cmd = NULL; mvumi_get_cmd() local
348 cmd = list_entry((&mhba->cmd_pool)->next, mvumi_get_cmd()
350 list_del_init(&cmd->queue_pointer); mvumi_get_cmd()
354 return cmd; mvumi_get_cmd()
358 * mvumi_return_cmd - Return a cmd to free command pool
360 * @cmd: Command packet to be returned to free command pool
363 struct mvumi_cmd *cmd) mvumi_return_cmd()
365 cmd->scmd = NULL; mvumi_return_cmd()
366 list_add_tail(&cmd->queue_pointer, &mhba->cmd_pool); mvumi_return_cmd()
370 * mvumi_free_cmds - Free all the cmds in the free cmd pool
375 struct mvumi_cmd *cmd; mvumi_free_cmds() local
378 cmd = list_first_entry(&mhba->cmd_pool, struct mvumi_cmd, mvumi_free_cmds()
380 list_del(&cmd->queue_pointer); mvumi_free_cmds()
382 kfree(cmd->frame); mvumi_free_cmds()
383 kfree(cmd); mvumi_free_cmds()
395 struct mvumi_cmd *cmd; mvumi_alloc_cmds() local
398 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mvumi_alloc_cmds()
399 if (!cmd) mvumi_alloc_cmds()
402 INIT_LIST_HEAD(&cmd->queue_pointer); mvumi_alloc_cmds()
403 list_add_tail(&cmd->queue_pointer, &mhba->cmd_pool); mvumi_alloc_cmds()
405 cmd->frame = mhba->ib_frame + i * mhba->ib_max_size; mvumi_alloc_cmds()
406 cmd->frame_phys = mhba->ib_frame_phys mvumi_alloc_cmds()
409 cmd->frame = kzalloc(mhba->ib_max_size, GFP_KERNEL); mvumi_alloc_cmds()
410 if (!cmd->frame) mvumi_alloc_cmds()
417 "failed to allocate memory for cmd[0x%x].\n", i); mvumi_alloc_cmds()
419 cmd = list_first_entry(&mhba->cmd_pool, struct mvumi_cmd, mvumi_alloc_cmds()
421 list_del(&cmd->queue_pointer); mvumi_alloc_cmds()
423 kfree(cmd->frame); mvumi_alloc_cmds()
424 kfree(cmd); mvumi_alloc_cmds()
508 "cmd request ID:0x%x\n", request_id, mvumi_check_ob_frame()
730 scmd_printk(KERN_NOTICE, scmd, "RESET -%ld cmd=%x retries=%x\n", mvumi_host_reset()
737 struct mvumi_cmd *cmd) mvumi_issue_blocked_cmd()
741 cmd->cmd_status = REQ_STATUS_PENDING; mvumi_issue_blocked_cmd()
743 if (atomic_read(&cmd->sync_cmd)) { mvumi_issue_blocked_cmd()
745 "last blocked cmd not finished, sync_cmd = %d\n", mvumi_issue_blocked_cmd()
746 atomic_read(&cmd->sync_cmd)); mvumi_issue_blocked_cmd()
750 atomic_inc(&cmd->sync_cmd); mvumi_issue_blocked_cmd()
752 mhba->instancet->fire_cmd(mhba, cmd); mvumi_issue_blocked_cmd()
756 (cmd->cmd_status != REQ_STATUS_PENDING), mvumi_issue_blocked_cmd()
760 if (atomic_read(&cmd->sync_cmd)) { mvumi_issue_blocked_cmd()
762 atomic_dec(&cmd->sync_cmd); mvumi_issue_blocked_cmd()
763 if (mhba->tag_cmd[cmd->frame->tag]) { mvumi_issue_blocked_cmd()
764 mhba->tag_cmd[cmd->frame->tag] = 0; mvumi_issue_blocked_cmd()
766 cmd->frame->tag); mvumi_issue_blocked_cmd()
767 tag_release_one(mhba, &mhba->tag_pool, cmd->frame->tag); mvumi_issue_blocked_cmd()
769 if (!list_empty(&cmd->queue_pointer)) { mvumi_issue_blocked_cmd()
772 list_del_init(&cmd->queue_pointer); mvumi_issue_blocked_cmd()
794 struct mvumi_cmd *cmd; mvumi_flush_cache() local
803 get_cmd: cmd = mvumi_create_internal_cmd(mhba, 0); mvumi_flush_cache()
804 if (!cmd) { mvumi_flush_cache()
807 " for internal flush cache cmd for " mvumi_flush_cache()
814 cmd->scmd = NULL; mvumi_flush_cache()
815 cmd->cmd_status = REQ_STATUS_PENDING; mvumi_flush_cache()
816 atomic_set(&cmd->sync_cmd, 0); mvumi_flush_cache()
817 frame = cmd->frame; mvumi_flush_cache()
828 mvumi_issue_blocked_cmd(mhba, cmd); mvumi_flush_cache()
829 if (cmd->cmd_status != SAM_STAT_GOOD) { mvumi_flush_cache()
832 device_id, cmd->cmd_status); mvumi_flush_cache()
835 mvumi_delete_internal_cmd(mhba, cmd); mvumi_flush_cache()
1323 * @cmd: Command to be completed
1325 static void mvumi_complete_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd, mvumi_complete_cmd() argument
1328 struct scsi_cmnd *scmd = cmd->scmd; mvumi_complete_cmd()
1330 cmd->scmd->SCp.ptr = NULL; mvumi_complete_cmd()
1343 memcpy(cmd->scmd->sense_buffer, ob_frame->payload, mvumi_complete_cmd()
1368 cmd->scmd->scsi_done(scmd); mvumi_complete_cmd()
1369 mvumi_return_cmd(mhba, cmd); mvumi_complete_cmd()
1373 struct mvumi_cmd *cmd, mvumi_complete_internal_cmd()
1376 if (atomic_read(&cmd->sync_cmd)) { mvumi_complete_internal_cmd()
1377 cmd->cmd_status = ob_frame->req_status; mvumi_complete_internal_cmd()
1381 cmd->data_buf) { mvumi_complete_internal_cmd()
1382 memcpy(cmd->data_buf, ob_frame->payload, mvumi_complete_internal_cmd()
1385 atomic_dec(&cmd->sync_cmd); mvumi_complete_internal_cmd()
1449 unsigned int id, struct mvumi_cmd *cmd) mvumi_inquiry()
1456 if (!cmd) { mvumi_inquiry()
1457 cmd = mvumi_create_internal_cmd(mhba, data_buf_len); mvumi_inquiry()
1458 if (cmd) mvumi_inquiry()
1463 memset(cmd->data_buf, 0, data_buf_len); mvumi_inquiry()
1465 cmd->scmd = NULL; mvumi_inquiry()
1466 cmd->cmd_status = REQ_STATUS_PENDING; mvumi_inquiry()
1467 atomic_set(&cmd->sync_cmd, 0); mvumi_inquiry()
1468 frame = cmd->frame; mvumi_inquiry()
1478 mvumi_issue_blocked_cmd(mhba, cmd); mvumi_inquiry()
1480 if (cmd->cmd_status == SAM_STAT_GOOD) { mvumi_inquiry()
1485 (cmd->data_buf + MVUMI_INQUIRY_UUID_OFF), mvumi_inquiry()
1493 mvumi_delete_internal_cmd(mhba, cmd); mvumi_inquiry()
1590 struct mvumi_cmd *cmd = NULL; mvumi_probe_devices() local
1593 cmd = mvumi_create_internal_cmd(mhba, 64); mvumi_probe_devices()
1594 if (!cmd) mvumi_probe_devices()
1603 wwid = mvumi_inquiry(mhba, id, cmd); mvumi_probe_devices()
1636 if (cmd) mvumi_probe_devices()
1637 mvumi_delete_internal_cmd(mhba, cmd); mvumi_probe_devices()
1738 struct mvumi_cmd *cmd; mvumi_get_event() local
1741 cmd = mvumi_create_internal_cmd(mhba, 512); mvumi_get_event()
1742 if (!cmd) mvumi_get_event()
1744 cmd->scmd = NULL; mvumi_get_event()
1745 cmd->cmd_status = REQ_STATUS_PENDING; mvumi_get_event()
1746 atomic_set(&cmd->sync_cmd, 0); mvumi_get_event()
1747 frame = cmd->frame; mvumi_get_event()
1756 mvumi_issue_blocked_cmd(mhba, cmd); mvumi_get_event()
1758 if (cmd->cmd_status != SAM_STAT_GOOD) mvumi_get_event()
1760 cmd->cmd_status); mvumi_get_event()
1762 mvumi_notification(mhba, cmd->frame->cdb[1], cmd->data_buf); mvumi_get_event()
1764 mvumi_delete_internal_cmd(mhba, cmd); mvumi_get_event()
1804 struct mvumi_cmd *cmd; mvumi_handle_clob() local
1814 cmd = mhba->tag_cmd[ob_frame->tag]; mvumi_handle_clob()
1819 if (cmd->scmd) mvumi_handle_clob()
1820 mvumi_complete_cmd(mhba, cmd, ob_frame); mvumi_handle_clob()
1822 mvumi_complete_internal_cmd(mhba, cmd, ob_frame); mvumi_handle_clob()
1860 struct mvumi_cmd *cmd) mvumi_send_command()
1866 ib_frame = cmd->frame; mvumi_send_command()
1877 cmd->frame->tag = tag_get_one(mhba, &mhba->tag_pool); mvumi_send_command()
1878 cmd->frame->request_id = mhba->io_seq++; mvumi_send_command()
1879 cmd->request_id = cmd->frame->request_id; mvumi_send_command()
1880 mhba->tag_cmd[cmd->frame->tag] = cmd; mvumi_send_command()
1887 cpu_to_le32(lower_32_bits(cmd->frame_phys)); mvumi_send_command()
1889 cpu_to_le32(upper_32_bits(cmd->frame_phys)); mvumi_send_command()
1897 static void mvumi_fire_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd) mvumi_fire_cmd() argument
1903 if (cmd) mvumi_fire_cmd()
1904 list_add_tail(&cmd->queue_pointer, &mhba->waiting_req_list); mvumi_fire_cmd()
1910 cmd = list_first_entry(&mhba->waiting_req_list, mvumi_fire_cmd()
1912 list_del_init(&cmd->queue_pointer); mvumi_fire_cmd()
1913 result = mvumi_send_command(mhba, cmd); mvumi_fire_cmd()
1919 list_add(&cmd->queue_pointer, &mhba->waiting_req_list); mvumi_fire_cmd()
2057 * @cmd: Command to be prepared in
2063 struct scsi_cmnd *scmd, struct mvumi_cmd *cmd) mvumi_build_frame()
2067 cmd->scmd = scmd; mvumi_build_frame()
2068 cmd->cmd_status = REQ_STATUS_PENDING; mvumi_build_frame()
2069 pframe = cmd->frame; mvumi_build_frame()
2087 "cmd[0x%x]\n", scmd->sc_data_direction, scmd->cmnd[0]); mvumi_build_frame()
2122 struct mvumi_cmd *cmd; mvumi_queue_command() local
2131 cmd = mvumi_get_cmd(mhba); mvumi_queue_command()
2132 if (unlikely(!cmd)) { mvumi_queue_command()
2137 if (unlikely(mvumi_build_frame(mhba, scmd, cmd))) mvumi_queue_command()
2140 cmd->scmd = scmd; mvumi_queue_command()
2141 scmd->SCp.ptr = (char *) cmd; mvumi_queue_command()
2142 mhba->instancet->fire_cmd(mhba, cmd); mvumi_queue_command()
2147 mvumi_return_cmd(mhba, cmd); mvumi_queue_command()
2155 struct mvumi_cmd *cmd = (struct mvumi_cmd *) scmd->SCp.ptr; mvumi_timed_out() local
2162 if (mhba->tag_cmd[cmd->frame->tag]) { mvumi_timed_out()
2163 mhba->tag_cmd[cmd->frame->tag] = 0; mvumi_timed_out()
2164 tag_release_one(mhba, &mhba->tag_pool, cmd->frame->tag); mvumi_timed_out()
2166 if (!list_empty(&cmd->queue_pointer)) mvumi_timed_out()
2167 list_del_init(&cmd->queue_pointer); mvumi_timed_out()
2188 mvumi_return_cmd(mhba, cmd); mvumi_timed_out()
313 mvumi_delete_internal_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd) mvumi_delete_internal_cmd() argument
362 mvumi_return_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd) mvumi_return_cmd() argument
736 mvumi_issue_blocked_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd) mvumi_issue_blocked_cmd() argument
1372 mvumi_complete_internal_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd, struct mvumi_rsp_frame *ob_frame) mvumi_complete_internal_cmd() argument
1448 mvumi_inquiry(struct mvumi_hba *mhba, unsigned int id, struct mvumi_cmd *cmd) mvumi_inquiry() argument
1859 mvumi_send_command(struct mvumi_hba *mhba, struct mvumi_cmd *cmd) mvumi_send_command() argument
2062 mvumi_build_frame(struct mvumi_hba *mhba, struct scsi_cmnd *scmd, struct mvumi_cmd *cmd) mvumi_build_frame() argument
H A Dwd33c93.c219 #define write_wd33c93_cmd(regs, cmd) \
220 write_wd33c93((regs), WD_COMMAND, (cmd))
282 write_wd33c93_cmd(const wd33c93_regs regs, uchar cmd) write_wd33c93_cmd() argument
286 *regs.SCMD = cmd; write_wd33c93_cmd()
375 wd33c93_queuecommand_lck(struct scsi_cmnd *cmd, wd33c93_queuecommand_lck() argument
381 hostdata = (struct WD33C93_hostdata *) cmd->device->host->hostdata; wd33c93_queuecommand_lck()
384 printk("Q-%d-%02x( ", cmd->device->id, cmd->cmnd[0])) wd33c93_queuecommand_lck()
387 * - host_scribble is the pointer to the next cmd in the input queue wd33c93_queuecommand_lck()
388 * - scsi_done points to the routine we call when a cmd is finished wd33c93_queuecommand_lck()
391 cmd->host_scribble = NULL; wd33c93_queuecommand_lck()
392 cmd->scsi_done = done; wd33c93_queuecommand_lck()
393 cmd->result = 0; wd33c93_queuecommand_lck()
398 * cmd, and are preserved across disconnect-reselect. This means we wd33c93_queuecommand_lck()
410 if (scsi_bufflen(cmd)) { wd33c93_queuecommand_lck()
411 cmd->SCp.buffer = scsi_sglist(cmd); wd33c93_queuecommand_lck()
412 cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1; wd33c93_queuecommand_lck()
413 cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); wd33c93_queuecommand_lck()
414 cmd->SCp.this_residual = cmd->SCp.buffer->length; wd33c93_queuecommand_lck()
416 cmd->SCp.buffer = NULL; wd33c93_queuecommand_lck()
417 cmd->SCp.buffers_residual = 0; wd33c93_queuecommand_lck()
418 cmd->SCp.ptr = NULL; wd33c93_queuecommand_lck()
419 cmd->SCp.this_residual = 0; wd33c93_queuecommand_lck()
439 cmd->SCp.Status = ILLEGAL_STATUS_BYTE; wd33c93_queuecommand_lck()
442 * Add the cmd to the end of 'input_Q'. Note that REQUEST SENSE wd33c93_queuecommand_lck()
449 if (!(hostdata->input_Q) || (cmd->cmnd[0] == REQUEST_SENSE)) { wd33c93_queuecommand_lck()
450 cmd->host_scribble = (uchar *) hostdata->input_Q; wd33c93_queuecommand_lck()
451 hostdata->input_Q = cmd; wd33c93_queuecommand_lck()
456 tmp->host_scribble = (uchar *) cmd; wd33c93_queuecommand_lck()
463 wd33c93_execute(cmd->device->host); wd33c93_queuecommand_lck()
489 struct scsi_cmnd *cmd, *prev; wd33c93_execute() local
502 cmd = (struct scsi_cmnd *) hostdata->input_Q; wd33c93_execute()
504 while (cmd) { wd33c93_execute()
505 if (!(hostdata->busy[cmd->device->id] & wd33c93_execute()
506 (1 << (cmd->device->lun & 0xff)))) wd33c93_execute()
508 prev = cmd; wd33c93_execute()
509 cmd = (struct scsi_cmnd *) cmd->host_scribble; wd33c93_execute()
514 if (!cmd) { wd33c93_execute()
522 prev->host_scribble = cmd->host_scribble; wd33c93_execute()
524 hostdata->input_Q = (struct scsi_cmnd *) cmd->host_scribble; wd33c93_execute()
527 hostdata->cmd_cnt[cmd->device->id]++; wd33c93_execute()
534 if (cmd->sc_data_direction == DMA_TO_DEVICE) wd33c93_execute()
535 write_wd33c93(regs, WD_DESTINATION_ID, cmd->device->id); wd33c93_execute()
537 write_wd33c93(regs, WD_DESTINATION_ID, cmd->device->id | DSTID_DPD); wd33c93_execute()
562 cmd->SCp.phase = 0; /* assume no disconnect */ wd33c93_execute()
567 if (cmd->device->type == 1) /* tape drive? */ wd33c93_execute()
575 if ((prev->device->id != cmd->device->id) || wd33c93_execute()
576 (prev->device->lun != cmd->device->lun)) { wd33c93_execute()
587 cmd->SCp.phase = 1; wd33c93_execute()
590 hostdata->disc_allowed_cnt[cmd->device->id]++; wd33c93_execute()
595 write_wd33c93(regs, WD_SOURCE_ID, ((cmd->SCp.phase) ? SRCID_ER : 0)); wd33c93_execute()
597 write_wd33c93(regs, WD_TARGET_LUN, (u8)cmd->device->lun); wd33c93_execute()
599 hostdata->sync_xfer[cmd->device->id]); wd33c93_execute()
600 hostdata->busy[cmd->device->id] |= (1 << (cmd->device->lun & 0xFF)); wd33c93_execute()
603 (hostdata->sync_stat[cmd->device->id] == SS_UNSET)) { wd33c93_execute()
613 hostdata->selecting = cmd; wd33c93_execute()
627 if (hostdata->sync_stat[cmd->device->id] == SS_UNSET) wd33c93_execute()
628 hostdata->sync_stat[cmd->device->id] = SS_FIRST; wd33c93_execute()
642 hostdata->connected = cmd; wd33c93_execute()
649 write_wd33c93_cdb(regs, cmd->cmd_len, cmd->cmnd); wd33c93_execute()
657 write_wd33c93(regs, WD_OWN_ID, cmd->cmd_len); wd33c93_execute()
664 if ((cmd->SCp.phase == 0) && (hostdata->no_dma == 0)) { wd33c93_execute()
665 if (hostdata->dma_setup(cmd, wd33c93_execute()
666 (cmd->sc_data_direction == DMA_TO_DEVICE) ? wd33c93_execute()
671 cmd->SCp.this_residual); wd33c93_execute()
691 printk("%s)EX-2 ", (cmd->SCp.phase) ? "d:" : "")) wd33c93_execute()
730 transfer_bytes(const wd33c93_regs regs, struct scsi_cmnd *cmd, transfer_bytes() argument
736 hostdata = (struct WD33C93_hostdata *) cmd->device->host->hostdata; transfer_bytes()
746 if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) { transfer_bytes()
747 ++cmd->SCp.buffer; transfer_bytes()
748 --cmd->SCp.buffers_residual; transfer_bytes()
749 cmd->SCp.this_residual = cmd->SCp.buffer->length; transfer_bytes()
750 cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); transfer_bytes()
752 if (!cmd->SCp.this_residual) /* avoid bogus setups */ transfer_bytes()
756 hostdata->sync_xfer[cmd->device->id]); transfer_bytes()
762 if (hostdata->no_dma || hostdata->dma_setup(cmd, data_in_dir)) { transfer_bytes()
766 transfer_pio(regs, (uchar *) cmd->SCp.ptr, transfer_bytes()
767 cmd->SCp.this_residual, data_in_dir, hostdata); transfer_bytes()
768 length = cmd->SCp.this_residual; transfer_bytes()
769 cmd->SCp.this_residual = read_wd33c93_count(regs); transfer_bytes()
770 cmd->SCp.ptr += (length - cmd->SCp.this_residual); transfer_bytes()
787 write_wd33c93_count(regs, cmd->SCp.this_residual); transfer_bytes()
790 (hostdata->level2 == L2_BASIC && cmd->SCp.phase == 0)) { transfer_bytes()
807 struct scsi_cmnd *patch, *cmd; wd33c93_intr() local
821 cmd = (struct scsi_cmnd *) hostdata->connected; /* assume we're connected */ wd33c93_intr()
843 printk("[%p/%d:", cmd->SCp.ptr, cmd->SCp.this_residual)) wd33c93_intr()
844 hostdata->dma_stop(cmd->device->host, cmd, 1); wd33c93_intr()
846 length = cmd->SCp.this_residual; wd33c93_intr()
847 cmd->SCp.this_residual = read_wd33c93_count(regs); wd33c93_intr()
848 cmd->SCp.ptr += (length - cmd->SCp.this_residual); wd33c93_intr()
850 printk("%p/%d]", cmd->SCp.ptr, cmd->SCp.this_residual)) wd33c93_intr()
861 cmd = (struct scsi_cmnd *) hostdata->selecting; /* get a valid cmd */ wd33c93_intr()
865 cmd->result = DID_NO_CONNECT << 16; wd33c93_intr()
866 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff)); wd33c93_intr()
868 cmd->scsi_done(cmd); wd33c93_intr()
893 hostdata->connected = cmd = wd33c93_intr()
899 hostdata->outgoing_msg[0] = IDENTIFY(0, cmd->device->lun); wd33c93_intr()
900 if (cmd->SCp.phase) wd33c93_intr()
903 if (hostdata->sync_stat[cmd->device->id] == SS_FIRST) { wd33c93_intr()
905 hostdata->sync_stat[cmd->device->id] = SS_WAITING; wd33c93_intr()
916 if (hostdata->no_sync & (1 << cmd->device->id)) { wd33c93_intr()
942 printk("IN-%d.%d", cmd->SCp.this_residual, wd33c93_intr()
943 cmd->SCp.buffers_residual)) wd33c93_intr()
944 transfer_bytes(regs, cmd, DATA_IN_DIR); wd33c93_intr()
954 printk("OUT-%d.%d", cmd->SCp.this_residual, wd33c93_intr()
955 cmd->SCp.buffers_residual)) wd33c93_intr()
956 transfer_bytes(regs, cmd, DATA_OUT_DIR); wd33c93_intr()
967 DB(DB_INTR, printk("CMND-%02x", cmd->cmnd[0])) wd33c93_intr()
968 transfer_pio(regs, cmd->cmnd, cmd->cmd_len, DATA_OUT_DIR, wd33c93_intr()
978 cmd->SCp.Status = read_1_byte(regs); wd33c93_intr()
979 DB(DB_INTR, printk("%02x", cmd->SCp.Status)) wd33c93_intr()
1007 cmd->SCp.Message = msg; wd33c93_intr()
1036 cmd->device->disconnect = 1; wd33c93_intr()
1046 if (hostdata->sync_stat[cmd->device->id] == SS_WAITING) { wd33c93_intr()
1047 hostdata->sync_stat[cmd->device->id] = SS_SET; wd33c93_intr()
1049 hostdata->sync_xfer[cmd->device->id] = wd33c93_intr()
1076 if (hostdata->sync_stat[cmd->device->id] != wd33c93_intr()
1107 hostdata->sync_xfer[cmd->device->id] = id; wd33c93_intr()
1110 hostdata->sync_xfer[cmd->device->id]); wd33c93_intr()
1112 hostdata->sync_stat[cmd->device->id] = wd33c93_intr()
1179 cmd->SCp.Message = COMMAND_COMPLETE; wd33c93_intr()
1181 DB(DB_INTR, printk(":%d.%d", cmd->SCp.Status, lun)) wd33c93_intr()
1183 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff)); wd33c93_intr()
1185 if (cmd->SCp.Status == ILLEGAL_STATUS_BYTE) wd33c93_intr()
1186 cmd->SCp.Status = lun; wd33c93_intr()
1187 if (cmd->cmnd[0] == REQUEST_SENSE wd33c93_intr()
1188 && cmd->SCp.Status != GOOD) wd33c93_intr()
1189 cmd->result = wd33c93_intr()
1190 (cmd-> wd33c93_intr()
1193 cmd->result = wd33c93_intr()
1194 cmd->SCp.Status | (cmd->SCp.Message << 8); wd33c93_intr()
1195 cmd->scsi_done(cmd); wd33c93_intr()
1264 if (cmd == NULL) { wd33c93_intr()
1272 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff)); wd33c93_intr()
1274 if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD) wd33c93_intr()
1275 cmd->result = wd33c93_intr()
1276 (cmd->result & 0x00ffff) | (DID_ERROR << 16); wd33c93_intr()
1278 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); wd33c93_intr()
1279 cmd->scsi_done(cmd); wd33c93_intr()
1297 if (cmd == NULL) { wd33c93_intr()
1304 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff)); wd33c93_intr()
1306 DB(DB_INTR, printk(":%d", cmd->SCp.Status)) wd33c93_intr()
1307 if (cmd->cmnd[0] == REQUEST_SENSE wd33c93_intr()
1308 && cmd->SCp.Status != GOOD) wd33c93_intr()
1309 cmd->result = wd33c93_intr()
1310 (cmd-> wd33c93_intr()
1313 cmd->result = wd33c93_intr()
1314 cmd->SCp.Status | (cmd->SCp.Message << 8); wd33c93_intr()
1315 cmd->scsi_done(cmd); wd33c93_intr()
1319 cmd->host_scribble = (uchar *) hostdata->disconnected_Q; wd33c93_intr()
1320 hostdata->disconnected_Q = cmd; wd33c93_intr()
1325 hostdata->disc_done_cnt[cmd->device->id]++; wd33c93_intr()
1355 cmd = (struct scsi_cmnd *) hostdata->selecting; wd33c93_intr()
1357 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff)); wd33c93_intr()
1358 cmd->host_scribble = wd33c93_intr()
1360 hostdata->input_Q = cmd; wd33c93_intr()
1366 if (cmd) { wd33c93_intr()
1368 hostdata->busy[cmd->device->id] &= wd33c93_intr()
1369 ~(1 << (cmd->device->lun & 0xff)); wd33c93_intr()
1370 cmd->host_scribble = wd33c93_intr()
1372 hostdata->input_Q = cmd; wd33c93_intr()
1449 cmd = (struct scsi_cmnd *) hostdata->disconnected_Q; wd33c93_intr()
1451 while (cmd) { wd33c93_intr()
1452 if (id == cmd->device->id && lun == (u8)cmd->device->lun) wd33c93_intr()
1454 patch = cmd; wd33c93_intr()
1455 cmd = (struct scsi_cmnd *) cmd->host_scribble; wd33c93_intr()
1460 if (!cmd) { wd33c93_intr()
1471 patch->host_scribble = cmd->host_scribble; wd33c93_intr()
1474 (struct scsi_cmnd *) cmd->host_scribble; wd33c93_intr()
1475 hostdata->connected = cmd; wd33c93_intr()
1482 if (cmd->sc_data_direction == DMA_TO_DEVICE) wd33c93_intr()
1483 write_wd33c93(regs, WD_DESTINATION_ID, cmd->device->id); wd33c93_intr()
1486 cmd->device->id | DSTID_DPD); wd33c93_intr()
1610 wd33c93_abort(struct scsi_cmnd * cmd) wd33c93_abort() argument
1617 disable_irq(cmd->device->host->irq); wd33c93_abort()
1619 instance = cmd->device->host; wd33c93_abort()
1631 if (tmp == cmd) { wd33c93_abort()
1633 prev->host_scribble = cmd->host_scribble; wd33c93_abort()
1636 (struct scsi_cmnd *) cmd->host_scribble; wd33c93_abort()
1637 cmd->host_scribble = NULL; wd33c93_abort()
1638 cmd->result = DID_ABORT << 16; wd33c93_abort()
1642 enable_irq(cmd->device->host->irq); wd33c93_abort()
1643 cmd->scsi_done(cmd); wd33c93_abort()
1661 if (hostdata->connected == cmd) { wd33c93_abort()
1670 hostdata->dma_stop(instance, cmd, 0); wd33c93_abort()
1709 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff)); wd33c93_abort()
1712 cmd->result = DID_ABORT << 16; wd33c93_abort()
1717 enable_irq(cmd->device->host->irq); wd33c93_abort()
1718 cmd->scsi_done(cmd); wd33c93_abort()
1730 if (tmp == cmd) { wd33c93_abort()
1735 enable_irq(cmd->device->host->irq); wd33c93_abort()
1754 enable_irq(cmd->device->host->irq); wd33c93_abort()
2132 struct scsi_cmnd *cmd; wd33c93_show_info() local
2172 cmd = (struct scsi_cmnd *) hd->connected; wd33c93_show_info()
2174 cmd->device->id, cmd->device->lun, cmd->cmnd[0]); wd33c93_show_info()
2179 cmd = (struct scsi_cmnd *) hd->input_Q; wd33c93_show_info()
2180 while (cmd) { wd33c93_show_info()
2182 cmd->device->id, cmd->device->lun, cmd->cmnd[0]); wd33c93_show_info()
2183 cmd = (struct scsi_cmnd *) cmd->host_scribble; wd33c93_show_info()
2188 cmd = (struct scsi_cmnd *) hd->disconnected_Q; wd33c93_show_info()
2189 while (cmd) { wd33c93_show_info()
2191 cmd->device->id, cmd->device->lun, cmd->cmnd[0]); wd33c93_show_info()
2192 cmd = (struct scsi_cmnd *) cmd->host_scribble; wd33c93_show_info()
H A Dpmcraid.c303 * @cmd: pointer to struct pmcraid_cmd to be initialized
309 void pmcraid_init_cmdblk(struct pmcraid_cmd *cmd, int index) pmcraid_init_cmdblk() argument
311 struct pmcraid_ioarcb *ioarcb = &(cmd->ioa_cb->ioarcb); pmcraid_init_cmdblk()
312 dma_addr_t dma_addr = cmd->ioa_cb_bus_addr; pmcraid_init_cmdblk()
319 cmd->index = index; pmcraid_init_cmdblk()
328 memset(&cmd->ioa_cb->ioarcb.cdb, 0, PMCRAID_MAX_CDB_LEN); pmcraid_init_cmdblk()
339 cmd->ioa_cb->ioasa.ioasc = 0; pmcraid_init_cmdblk()
340 cmd->ioa_cb->ioasa.residual_data_length = 0; pmcraid_init_cmdblk()
341 cmd->time_left = 0; pmcraid_init_cmdblk()
344 cmd->cmd_done = NULL; pmcraid_init_cmdblk()
345 cmd->scsi_cmd = NULL; pmcraid_init_cmdblk()
346 cmd->release = 0; pmcraid_init_cmdblk()
347 cmd->completion_req = 0; pmcraid_init_cmdblk()
348 cmd->sense_buffer = 0; pmcraid_init_cmdblk()
349 cmd->sense_buffer_dma = 0; pmcraid_init_cmdblk()
350 cmd->dma_handle = 0; pmcraid_init_cmdblk()
351 init_timer(&cmd->timer); pmcraid_init_cmdblk()
357 * @cmd: pointer to struct pmcraid_cmd to be reinitialized
362 static void pmcraid_reinit_cmdblk(struct pmcraid_cmd *cmd) pmcraid_reinit_cmdblk() argument
364 pmcraid_init_cmdblk(cmd, -1); pmcraid_reinit_cmdblk()
368 * pmcraid_get_free_cmd - get a free cmd block from command block pool
372 * returns pointer to cmd block or NULL if no blocks are available
378 struct pmcraid_cmd *cmd = NULL; pmcraid_get_free_cmd() local
381 /* free cmd block list is protected by free_pool_lock */ pmcraid_get_free_cmd()
385 cmd = list_entry(pinstance->free_cmd_pool.next, pmcraid_get_free_cmd()
387 list_del(&cmd->free_list); pmcraid_get_free_cmd()
392 if (cmd != NULL) pmcraid_get_free_cmd()
393 pmcraid_reinit_cmdblk(cmd); pmcraid_get_free_cmd()
394 return cmd; pmcraid_get_free_cmd()
399 * @cmd: pointer to the command block
404 void pmcraid_return_cmd(struct pmcraid_cmd *cmd) pmcraid_return_cmd() argument
406 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_return_cmd()
410 list_add_tail(&cmd->free_list, &pinstance->free_cmd_pool); pmcraid_return_cmd()
553 * @cmd: pointer to reset command
560 static void pmcraid_bist_done(struct pmcraid_cmd *cmd) pmcraid_bist_done() argument
562 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_bist_done()
571 cmd->time_left > 0) { pmcraid_bist_done()
573 cmd->timer.expires = jiffies + cmd->time_left; pmcraid_bist_done()
574 cmd->time_left = 0; pmcraid_bist_done()
575 cmd->timer.data = (unsigned long)cmd; pmcraid_bist_done()
576 cmd->timer.function = pmcraid_bist_done()
578 add_timer(&cmd->timer); pmcraid_bist_done()
580 cmd->time_left = 0; pmcraid_bist_done()
583 pmcraid_ioa_reset(cmd); pmcraid_bist_done()
590 * @cmd: pointer to reset cmd
594 static void pmcraid_start_bist(struct pmcraid_cmd *cmd) pmcraid_start_bist() argument
596 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_start_bist()
607 cmd->time_left = msecs_to_jiffies(PMCRAID_BIST_TIMEOUT); pmcraid_start_bist()
608 cmd->timer.data = (unsigned long)cmd; pmcraid_start_bist()
609 cmd->timer.expires = jiffies + msecs_to_jiffies(PMCRAID_BIST_TIMEOUT); pmcraid_start_bist()
610 cmd->timer.function = (void (*)(unsigned long))pmcraid_bist_done; pmcraid_start_bist()
611 add_timer(&cmd->timer); pmcraid_start_bist()
616 * @cmd: pointer to command block used in reset sequence
620 static void pmcraid_reset_alert_done(struct pmcraid_cmd *cmd) pmcraid_reset_alert_done() argument
622 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_reset_alert_done()
631 cmd->time_left <= 0) { pmcraid_reset_alert_done()
634 pmcraid_ioa_reset(cmd); pmcraid_reset_alert_done()
639 cmd->time_left -= PMCRAID_CHECK_FOR_RESET_TIMEOUT; pmcraid_reset_alert_done()
640 cmd->timer.data = (unsigned long)cmd; pmcraid_reset_alert_done()
641 cmd->timer.expires = jiffies + PMCRAID_CHECK_FOR_RESET_TIMEOUT; pmcraid_reset_alert_done()
642 cmd->timer.function = pmcraid_reset_alert_done()
644 add_timer(&cmd->timer); pmcraid_reset_alert_done()
650 * @cmd : command block to be used for reset sequence.
658 static void pmcraid_reset_alert(struct pmcraid_cmd *cmd) pmcraid_reset_alert() argument
660 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_reset_alert()
678 cmd->time_left = PMCRAID_RESET_TIMEOUT; pmcraid_reset_alert()
679 cmd->timer.data = (unsigned long)cmd; pmcraid_reset_alert()
680 cmd->timer.expires = jiffies + PMCRAID_CHECK_FOR_RESET_TIMEOUT; pmcraid_reset_alert()
681 cmd->timer.function = pmcraid_reset_alert()
683 add_timer(&cmd->timer); pmcraid_reset_alert()
693 pmcraid_start_bist(cmd); pmcraid_reset_alert()
700 * @cmd : pointer to command structure, that got timedout
707 static void pmcraid_timeout_handler(struct pmcraid_cmd *cmd) pmcraid_timeout_handler() argument
709 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_timeout_handler()
713 "Adapter being reset due to cmd(CDB[0] = %x) timeout\n", pmcraid_timeout_handler()
714 cmd->ioa_cb->ioarcb.cdb[0]); pmcraid_timeout_handler()
725 cmd = pmcraid_get_free_cmd(pinstance); pmcraid_timeout_handler()
730 if (cmd == NULL) { pmcraid_timeout_handler()
737 pinstance->reset_cmd = cmd; pmcraid_timeout_handler()
742 if (pinstance->reset_cmd != cmd) { pmcraid_timeout_handler()
747 pmcraid_err("cmd is pending but reset in progress\n"); pmcraid_timeout_handler()
755 if (cmd == pinstance->reset_cmd) pmcraid_timeout_handler()
756 cmd->cmd_done = pmcraid_ioa_reset; pmcraid_timeout_handler()
767 pmcraid_reset_alert(cmd); pmcraid_timeout_handler()
774 * @cmd: command that got response from IOA
779 static void pmcraid_internal_done(struct pmcraid_cmd *cmd) pmcraid_internal_done() argument
781 pmcraid_info("response internal cmd CDB[0] = %x ioasc = %x\n", pmcraid_internal_done()
782 cmd->ioa_cb->ioarcb.cdb[0], pmcraid_internal_done()
783 le32_to_cpu(cmd->ioa_cb->ioasa.ioasc)); pmcraid_internal_done()
786 * response. Same will be indicated as part of cmd->completion_req pmcraid_internal_done()
787 * field. Response path needs to wake up any waiters waiting for cmd pmcraid_internal_done()
790 if (cmd->completion_req) { pmcraid_internal_done()
791 cmd->completion_req = 0; pmcraid_internal_done()
792 complete(&cmd->wait_for_completion); pmcraid_internal_done()
799 if (cmd->release) { pmcraid_internal_done()
800 cmd->release = 0; pmcraid_internal_done()
801 pmcraid_return_cmd(cmd); pmcraid_internal_done()
808 * @cmd: command that got response from IOA
817 static void pmcraid_reinit_cfgtable_done(struct pmcraid_cmd *cmd) pmcraid_reinit_cfgtable_done() argument
819 pmcraid_info("response internal cmd CDB[0] = %x ioasc = %x\n", pmcraid_reinit_cfgtable_done()
820 cmd->ioa_cb->ioarcb.cdb[0], pmcraid_reinit_cfgtable_done()
821 le32_to_cpu(cmd->ioa_cb->ioasa.ioasc)); pmcraid_reinit_cfgtable_done()
823 if (cmd->release) { pmcraid_reinit_cfgtable_done()
824 cmd->release = 0; pmcraid_reinit_cfgtable_done()
825 pmcraid_return_cmd(cmd); pmcraid_reinit_cfgtable_done()
828 schedule_work(&cmd->drv_inst->worker_q); pmcraid_reinit_cfgtable_done()
833 * @cmd: pmcraid_command
841 static void pmcraid_erp_done(struct pmcraid_cmd *cmd) pmcraid_erp_done() argument
843 struct scsi_cmnd *scsi_cmd = cmd->scsi_cmd; pmcraid_erp_done()
844 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_erp_done()
845 u32 ioasc = le32_to_cpu(cmd->ioa_cb->ioasa.ioasc); pmcraid_erp_done()
851 cmd->ioa_cb->ioarcb.cdb[0], ioasc); pmcraid_erp_done()
857 if (cmd->sense_buffer != NULL) { pmcraid_erp_done()
859 cmd->sense_buffer, pmcraid_erp_done()
863 cmd->sense_buffer, cmd->sense_buffer_dma); pmcraid_erp_done()
864 cmd->sense_buffer = NULL; pmcraid_erp_done()
865 cmd->sense_buffer_dma = 0; pmcraid_erp_done()
869 pmcraid_return_cmd(cmd); pmcraid_erp_done()
879 * @cmd : command to be sent to the device
884 static void _pmcraid_fire_command(struct pmcraid_cmd *cmd) _pmcraid_fire_command() argument
886 struct pmcraid_instance *pinstance = cmd->drv_inst; _pmcraid_fire_command()
889 /* Add this command block to pending cmd pool. We do this prior to _pmcraid_fire_command()
892 * (isr/tasklet) looks for cmd block in the pending pending list. _pmcraid_fire_command()
895 list_add_tail(&cmd->free_list, &pinstance->pending_cmd_pool); _pmcraid_fire_command()
901 iowrite32(le32_to_cpu(cmd->ioa_cb->ioarcb.ioarcb_bus_addr), _pmcraid_fire_command()
911 * @cmd: pointer to the command block to be fired to IOA
920 struct pmcraid_cmd *cmd, pmcraid_send_cmd()
927 cmd->cmd_done = cmd_done; pmcraid_send_cmd()
931 cmd->timer.data = (unsigned long)cmd; pmcraid_send_cmd()
932 cmd->timer.expires = jiffies + timeout; pmcraid_send_cmd()
933 cmd->timer.function = (void (*)(unsigned long))timeout_func; pmcraid_send_cmd()
934 add_timer(&cmd->timer); pmcraid_send_cmd()
938 _pmcraid_fire_command(cmd); pmcraid_send_cmd()
943 * @cmd: pointer to the command block used for sending IOA shutdown command
948 static void pmcraid_ioa_shutdown_done(struct pmcraid_cmd *cmd) pmcraid_ioa_shutdown_done() argument
950 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_ioa_shutdown_done()
954 pmcraid_ioa_reset(cmd); pmcraid_ioa_shutdown_done()
961 * @cmd: pointer to the command block used as part of reset sequence
966 static void pmcraid_ioa_shutdown(struct pmcraid_cmd *cmd) pmcraid_ioa_shutdown() argument
969 cmd->ioa_cb->ioarcb.cdb[0], pmcraid_ioa_shutdown()
970 le32_to_cpu(cmd->ioa_cb->ioasa.ioasc)); pmcraid_ioa_shutdown()
975 pmcraid_reinit_cmdblk(cmd); pmcraid_ioa_shutdown()
976 cmd->ioa_cb->ioarcb.request_type = REQ_TYPE_IOACMD; pmcraid_ioa_shutdown()
977 cmd->ioa_cb->ioarcb.resource_handle = pmcraid_ioa_shutdown()
979 cmd->ioa_cb->ioarcb.cdb[0] = PMCRAID_IOA_SHUTDOWN; pmcraid_ioa_shutdown()
980 cmd->ioa_cb->ioarcb.cdb[1] = PMCRAID_SHUTDOWN_NORMAL; pmcraid_ioa_shutdown()
984 le32_to_cpu(cmd->ioa_cb->ioarcb.response_handle)); pmcraid_ioa_shutdown()
986 pmcraid_notify_ioastate(cmd->drv_inst, PMC_DEVICE_EVENT_SHUTDOWN_START); pmcraid_ioa_shutdown()
988 pmcraid_send_cmd(cmd, pmcraid_ioa_shutdown_done, pmcraid_ioa_shutdown()
996 * @cmd: pointer to command block used to send INQUIRY command
1003 static void pmcraid_get_fwversion_done(struct pmcraid_cmd *cmd) pmcraid_get_fwversion_done() argument
1005 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_get_fwversion_done()
1006 u32 ioasc = le32_to_cpu(cmd->ioa_cb->ioasa.ioasc); pmcraid_get_fwversion_done()
1017 pmcraid_reset_alert(cmd); pmcraid_get_fwversion_done()
1020 pmcraid_querycfg(cmd); pmcraid_get_fwversion_done()
1027 * @cmd: pointer to command block used to send INQUIRY command
1032 static void pmcraid_get_fwversion(struct pmcraid_cmd *cmd) pmcraid_get_fwversion() argument
1034 struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; pmcraid_get_fwversion()
1036 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_get_fwversion()
1039 pmcraid_reinit_cmdblk(cmd); pmcraid_get_fwversion()
1050 ioarcb->ioadl_bus_addr = cpu_to_le64((cmd->ioa_cb_bus_addr) + pmcraid_get_fwversion()
1063 pmcraid_send_cmd(cmd, pmcraid_get_fwversion_done, pmcraid_get_fwversion()
1069 * @cmd: pointer to command block to be used for identify hrrq
1074 static void pmcraid_identify_hrrq(struct pmcraid_cmd *cmd) pmcraid_identify_hrrq() argument
1076 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_identify_hrrq()
1077 struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; pmcraid_identify_hrrq()
1078 int index = cmd->hrrq_index; pmcraid_identify_hrrq()
1083 pmcraid_reinit_cmdblk(cmd); pmcraid_identify_hrrq()
1084 cmd->hrrq_index = index + 1; pmcraid_identify_hrrq()
1086 if (cmd->hrrq_index < pinstance->num_hrrq) { pmcraid_identify_hrrq()
1089 cmd->hrrq_index = 0; pmcraid_identify_hrrq()
1115 pmcraid_send_cmd(cmd, done_function, pmcraid_identify_hrrq()
1120 static void pmcraid_process_ccn(struct pmcraid_cmd *cmd);
1121 static void pmcraid_process_ldn(struct pmcraid_cmd *cmd);
1126 * @cmd: initialized command block pointer
1131 static void pmcraid_send_hcam_cmd(struct pmcraid_cmd *cmd) pmcraid_send_hcam_cmd() argument
1133 if (cmd->ioa_cb->ioarcb.cdb[1] == PMCRAID_HCAM_CODE_CONFIG_CHANGE) pmcraid_send_hcam_cmd()
1134 atomic_set(&(cmd->drv_inst->ccn.ignore), 0); pmcraid_send_hcam_cmd()
1136 atomic_set(&(cmd->drv_inst->ldn.ignore), 0); pmcraid_send_hcam_cmd()
1138 pmcraid_send_cmd(cmd, cmd->cmd_done, 0, NULL); pmcraid_send_hcam_cmd()
1156 struct pmcraid_cmd *cmd; pmcraid_init_hcam() local
1164 cmd = pmcraid_get_free_cmd(pinstance); pmcraid_init_hcam()
1166 if (!cmd) { pmcraid_init_hcam()
1168 return cmd; pmcraid_init_hcam()
1184 hcam->cmd = cmd; pmcraid_init_hcam()
1186 ioarcb = &cmd->ioa_cb->ioarcb; pmcraid_init_hcam()
1187 ioarcb->ioadl_bus_addr = cpu_to_le64((cmd->ioa_cb_bus_addr) + pmcraid_init_hcam()
1207 cmd->cmd_done = cmd_done; pmcraid_init_hcam()
1208 return cmd; pmcraid_init_hcam()
1223 struct pmcraid_cmd *cmd = pmcraid_init_hcam(pinstance, type); pmcraid_send_hcam() local
1224 pmcraid_send_hcam_cmd(cmd); pmcraid_send_hcam()
1231 * @cmd: pointer to cmd that is used as cancelling command
1235 struct pmcraid_cmd *cmd, pmcraid_prepare_cancel_cmd()
1239 struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; pmcraid_prepare_cancel_cmd()
1261 * @cmd: command to be used as cancelling command
1266 struct pmcraid_cmd *cmd, pmcraid_cancel_hcam()
1274 pinstance = cmd->drv_inst; pmcraid_cancel_hcam()
1279 * currently not pending with IOA, we would have hcam->cmd as non-null pmcraid_cancel_hcam()
1281 if (hcam->cmd == NULL) pmcraid_cancel_hcam()
1284 pmcraid_prepare_cancel_cmd(cmd, hcam->cmd); pmcraid_cancel_hcam()
1289 pmcraid_send_cmd(cmd, cmd_done, pmcraid_cancel_hcam()
1297 * @cmd: command block to be used for cancelling the HCAM
1299 static void pmcraid_cancel_ccn(struct pmcraid_cmd *cmd) pmcraid_cancel_ccn() argument
1302 cmd->ioa_cb->ioarcb.cdb[0], pmcraid_cancel_ccn()
1303 le32_to_cpu(cmd->ioa_cb->ioasa.ioasc)); pmcraid_cancel_ccn()
1305 pmcraid_reinit_cmdblk(cmd); pmcraid_cancel_ccn()
1307 pmcraid_cancel_hcam(cmd, pmcraid_cancel_ccn()
1315 * @cmd: command block to be used for cancelling the HCAM
1317 static void pmcraid_cancel_ldn(struct pmcraid_cmd *cmd) pmcraid_cancel_ldn() argument
1319 pmcraid_cancel_hcam(cmd, pmcraid_cancel_ldn()
1548 struct pmcraid_cmd *cmd; pmcraid_handle_config_change() local
1591 pmcraid_err("lost CCN, no free cmd for querycfg\n"); pmcraid_handle_config_change()
1687 cmd = pmcraid_init_hcam(pinstance, PMCRAID_HCAM_CODE_CONFIG_CHANGE); pmcraid_handle_config_change()
1688 if (cmd) pmcraid_handle_config_change()
1689 pmcraid_send_hcam_cmd(cmd); pmcraid_handle_config_change()
1711 * @cmd: pointer to command that resulted in 'ioasc'
1713 void pmcraid_ioasc_logger(u32 ioasc, struct pmcraid_cmd *cmd) pmcraid_ioasc_logger() argument
1718 cmd->drv_inst->current_log_level < error_info->log_level) pmcraid_ioasc_logger()
1722 pmcraid_err("cmd [%x] for resource %x failed with %x(%s)\n", pmcraid_ioasc_logger()
1723 cmd->ioa_cb->ioarcb.cdb[0], pmcraid_ioasc_logger()
1724 cmd->ioa_cb->ioarcb.resource_handle, pmcraid_ioasc_logger()
1777 * @cmd: pointer to command struct
1785 static void pmcraid_process_ccn(struct pmcraid_cmd *cmd) pmcraid_process_ccn() argument
1787 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_process_ccn()
1788 u32 ioasc = le32_to_cpu(cmd->ioa_cb->ioasa.ioasc); pmcraid_process_ccn()
1791 pinstance->ccn.cmd = NULL; pmcraid_process_ccn()
1792 pmcraid_return_cmd(cmd); pmcraid_process_ccn()
1814 * @cmd: pointer to command block
1820 static void pmcraid_set_timestamp(struct pmcraid_cmd *cmd);
1822 static void pmcraid_process_ldn(struct pmcraid_cmd *cmd) pmcraid_process_ldn() argument
1824 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_process_ldn()
1827 u32 ioasc = le32_to_cpu(cmd->ioa_cb->ioasa.ioasc); pmcraid_process_ldn()
1832 pinstance->ldn.cmd = NULL; pmcraid_process_ldn()
1833 pmcraid_return_cmd(cmd); pmcraid_process_ldn()
1854 pmcraid_set_timestamp(cmd); pmcraid_process_ldn()
1864 cmd = pmcraid_init_hcam(pinstance, PMCRAID_HCAM_CODE_LOG_DATA); pmcraid_process_ldn()
1865 if (cmd) pmcraid_process_ldn()
1866 pmcraid_send_hcam_cmd(cmd); pmcraid_process_ldn()
1885 * @cmd: pointer to command used as part of reset sequence
1887 static void pmcraid_unregister_hcams(struct pmcraid_cmd *cmd) pmcraid_unregister_hcams() argument
1889 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_unregister_hcams()
1908 pmcraid_reset_alert(cmd); pmcraid_unregister_hcams()
1916 pmcraid_cancel_ldn(cmd); pmcraid_unregister_hcams()
1952 * @cmd : pointer to reset command block
1957 static void pmcraid_soft_reset(struct pmcraid_cmd *cmd) pmcraid_soft_reset() argument
1959 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_soft_reset()
1967 cmd->cmd_done = pmcraid_ioa_reset; pmcraid_soft_reset()
1968 cmd->timer.data = (unsigned long)cmd; pmcraid_soft_reset()
1969 cmd->timer.expires = jiffies + pmcraid_soft_reset()
1971 cmd->timer.function = (void (*)(unsigned long))pmcraid_timeout_handler; pmcraid_soft_reset()
1973 if (!timer_pending(&cmd->timer)) pmcraid_soft_reset()
1974 add_timer(&cmd->timer); pmcraid_soft_reset()
2019 * otherwise just completes the commands and returns the cmd blocks to free
2027 struct pmcraid_cmd *cmd, *temp; pmcraid_fail_outstanding_cmds() local
2034 list_for_each_entry_safe(cmd, temp, &pinstance->pending_cmd_pool, pmcraid_fail_outstanding_cmds()
2036 list_del(&cmd->free_list); pmcraid_fail_outstanding_cmds()
2039 cmd->ioa_cb->ioasa.ioasc = pmcraid_fail_outstanding_cmds()
2041 cmd->ioa_cb->ioasa.ilid = pmcraid_fail_outstanding_cmds()
2045 del_timer(&cmd->timer); pmcraid_fail_outstanding_cmds()
2052 if (cmd->scsi_cmd) { pmcraid_fail_outstanding_cmds()
2054 struct scsi_cmnd *scsi_cmd = cmd->scsi_cmd; pmcraid_fail_outstanding_cmds()
2055 __le32 resp = cmd->ioa_cb->ioarcb.response_handle; pmcraid_fail_outstanding_cmds()
2060 pmcraid_return_cmd(cmd); pmcraid_fail_outstanding_cmds()
2064 cmd->ioa_cb->ioarcb.cdb[0], pmcraid_fail_outstanding_cmds()
2067 } else if (cmd->cmd_done == pmcraid_internal_done || pmcraid_fail_outstanding_cmds()
2068 cmd->cmd_done == pmcraid_erp_done) { pmcraid_fail_outstanding_cmds()
2069 cmd->cmd_done(cmd); pmcraid_fail_outstanding_cmds()
2070 } else if (cmd->cmd_done != pmcraid_ioa_reset && pmcraid_fail_outstanding_cmds()
2071 cmd->cmd_done != pmcraid_ioa_shutdown_done) { pmcraid_fail_outstanding_cmds()
2072 pmcraid_return_cmd(cmd); pmcraid_fail_outstanding_cmds()
2085 * @cmd: pointer to the cmd block to be used for entire reset process
2097 static void pmcraid_ioa_reset(struct pmcraid_cmd *cmd) pmcraid_ioa_reset() argument
2099 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_ioa_reset()
2104 if (pinstance->reset_cmd != cmd) { pmcraid_ioa_reset()
2106 pinstance->reset_cmd = cmd; pmcraid_ioa_reset()
2110 pinstance->ioa_state, cmd); pmcraid_ioa_reset()
2130 pmcraid_reset_alert(cmd); pmcraid_ioa_reset()
2148 pmcraid_reinit_cmdblk(cmd); pmcraid_ioa_reset()
2149 pmcraid_identify_hrrq(cmd); pmcraid_ioa_reset()
2152 pmcraid_soft_reset(cmd); pmcraid_ioa_reset()
2159 pmcraid_reset_alert(cmd); pmcraid_ioa_reset()
2170 pmcraid_start_bist(cmd); pmcraid_ioa_reset()
2207 pmcraid_reset_alert(cmd); pmcraid_ioa_reset()
2231 pmcraid_reinit_cmdblk(cmd); pmcraid_ioa_reset()
2232 pmcraid_identify_hrrq(cmd); pmcraid_ioa_reset()
2235 pmcraid_soft_reset(cmd); pmcraid_ioa_reset()
2251 pmcraid_identify_hrrq(cmd); pmcraid_ioa_reset()
2277 pmcraid_reinit_cmdblk(cmd); pmcraid_ioa_reset()
2278 pmcraid_unregister_hcams(cmd); pmcraid_ioa_reset()
2294 pmcraid_return_cmd(cmd); pmcraid_ioa_reset()
2321 struct pmcraid_cmd *cmd; pmcraid_initiate_reset() local
2328 cmd = pmcraid_get_free_cmd(pinstance); pmcraid_initiate_reset()
2330 if (cmd == NULL) { pmcraid_initiate_reset()
2336 pinstance->reset_cmd = cmd; pmcraid_initiate_reset()
2340 pmcraid_ioa_reset(cmd); pmcraid_initiate_reset()
2458 * @cmd: pmcraid command struct
2463 static void pmcraid_request_sense(struct pmcraid_cmd *cmd) pmcraid_request_sense() argument
2465 struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; pmcraid_request_sense()
2469 cmd->sense_buffer = pci_alloc_consistent(cmd->drv_inst->pdev, pmcraid_request_sense()
2471 &cmd->sense_buffer_dma); pmcraid_request_sense()
2473 if (cmd->sense_buffer == NULL) { pmcraid_request_sense()
2476 pmcraid_erp_done(cmd); pmcraid_request_sense()
2481 memset(&cmd->ioa_cb->ioasa, 0, sizeof(struct pmcraid_ioasa)); pmcraid_request_sense()
2490 ioarcb->ioadl_bus_addr = cpu_to_le64((cmd->ioa_cb_bus_addr) + pmcraid_request_sense()
2497 ioadl->address = cpu_to_le64(cmd->sense_buffer_dma); pmcraid_request_sense()
2506 pmcraid_send_cmd(cmd, pmcraid_erp_done, pmcraid_request_sense()
2513 * @cmd: command that failed
2518 static void pmcraid_cancel_all(struct pmcraid_cmd *cmd, u32 sense) pmcraid_cancel_all() argument
2520 struct scsi_cmnd *scsi_cmd = cmd->scsi_cmd; pmcraid_cancel_all()
2521 struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; pmcraid_cancel_all()
2542 pmcraid_send_cmd(cmd, cmd_done, pmcraid_cancel_all()
2550 * @cmd: pointer to failing command block
2555 static void pmcraid_frame_auto_sense(struct pmcraid_cmd *cmd) pmcraid_frame_auto_sense() argument
2557 u8 *sense_buf = cmd->scsi_cmd->sense_buffer; pmcraid_frame_auto_sense()
2558 struct pmcraid_resource_entry *res = cmd->scsi_cmd->device->hostdata; pmcraid_frame_auto_sense()
2559 struct pmcraid_ioasa *ioasa = &cmd->ioa_cb->ioasa; pmcraid_frame_auto_sense()
2564 cmd->scsi_cmd->result = SAM_STAT_CHECK_CONDITION; pmcraid_frame_auto_sense()
2617 * @cmd: pointer to pmcraid_cmd that has failed
2627 static int pmcraid_error_handler(struct pmcraid_cmd *cmd) pmcraid_error_handler() argument
2629 struct scsi_cmnd *scsi_cmd = cmd->scsi_cmd; pmcraid_error_handler()
2631 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_error_handler()
2632 struct pmcraid_ioasa *ioasa = &cmd->ioa_cb->ioasa; pmcraid_error_handler()
2650 pmcraid_frame_auto_sense(cmd); pmcraid_error_handler()
2654 pmcraid_ioasc_logger(ioasc, cmd); pmcraid_error_handler()
2711 pmcraid_cancel_all(cmd, sense_copied); pmcraid_error_handler()
2713 pmcraid_erp_done(cmd); pmcraid_error_handler()
2715 pmcraid_request_sense(cmd); pmcraid_error_handler()
2749 struct pmcraid_cmd *cmd; pmcraid_reset_device() local
2783 /* get a free cmd block */ pmcraid_reset_device()
2784 cmd = pmcraid_get_free_cmd(pinstance); pmcraid_reset_device()
2786 if (cmd == NULL) { pmcraid_reset_device()
2788 pmcraid_err("%s: no cmd blocks are available\n", __func__); pmcraid_reset_device()
2792 ioarcb = &cmd->ioa_cb->ioarcb; pmcraid_reset_device()
2803 init_completion(&cmd->wait_for_completion); pmcraid_reset_device()
2804 cmd->completion_req = 1; pmcraid_reset_device()
2806 pmcraid_info("cmd(CDB[0] = %x) for %x with index = %d\n", pmcraid_reset_device()
2807 cmd->ioa_cb->ioarcb.cdb[0], pmcraid_reset_device()
2808 le32_to_cpu(cmd->ioa_cb->ioarcb.resource_handle), pmcraid_reset_device()
2809 le32_to_cpu(cmd->ioa_cb->ioarcb.response_handle) >> 2); pmcraid_reset_device()
2811 pmcraid_send_cmd(cmd, pmcraid_reset_device()
2822 wait_for_completion(&cmd->wait_for_completion); pmcraid_reset_device()
2827 pmcraid_return_cmd(cmd); pmcraid_reset_device()
2829 ioasc = le32_to_cpu(cmd->ioa_cb->ioasa.ioasc); pmcraid_reset_device()
2838 * @cmd: pointer to pmcraid command struct
2851 static int _pmcraid_io_done(struct pmcraid_cmd *cmd, int reslen, int ioasc) _pmcraid_io_done() argument
2853 struct scsi_cmnd *scsi_cmd = cmd->scsi_cmd; _pmcraid_io_done()
2859 le32_to_cpu(cmd->ioa_cb->ioarcb.response_handle) >> 2, _pmcraid_io_done()
2860 cmd->ioa_cb->ioarcb.cdb[0], _pmcraid_io_done()
2864 rc = pmcraid_error_handler(cmd); _pmcraid_io_done()
2877 * @cmd: pointer to pmcraid command struct
2886 static void pmcraid_io_done(struct pmcraid_cmd *cmd) pmcraid_io_done() argument
2888 u32 ioasc = le32_to_cpu(cmd->ioa_cb->ioasa.ioasc); pmcraid_io_done()
2889 u32 reslen = le32_to_cpu(cmd->ioa_cb->ioasa.residual_data_length); pmcraid_io_done()
2891 if (_pmcraid_io_done(cmd, reslen, ioasc) == 0) pmcraid_io_done()
2892 pmcraid_return_cmd(cmd); pmcraid_io_done()
2898 * @cmd: command block of the command to be aborted
2901 * returns pointer to command structure used as cancelling cmd
2903 static struct pmcraid_cmd *pmcraid_abort_cmd(struct pmcraid_cmd *cmd) pmcraid_abort_cmd() argument
2909 pinstance = (struct pmcraid_instance *)cmd->drv_inst; pmcraid_abort_cmd()
2910 res = cmd->scsi_cmd->device->hostdata; pmcraid_abort_cmd()
2915 pmcraid_err("%s: no cmd blocks are available\n", __func__); pmcraid_abort_cmd()
2919 pmcraid_prepare_cancel_cmd(cancel_cmd, cmd); pmcraid_abort_cmd()
2922 cmd->ioa_cb->ioarcb.cdb[0], pmcraid_abort_cmd()
2923 cmd->ioa_cb->ioarcb.response_handle >> 2); pmcraid_abort_cmd()
2989 struct pmcraid_cmd *cmd; pmcraid_eh_abort_handler() local
3022 /* loop over pending cmd list to find cmd corresponding to this pmcraid_eh_abort_handler()
3028 list_for_each_entry(cmd, &pinstance->pending_cmd_pool, free_list) { pmcraid_eh_abort_handler()
3030 if (cmd->scsi_cmd == scsi_cmd) { pmcraid_eh_abort_handler()
3043 cancel_cmd = pmcraid_abort_cmd(cmd); pmcraid_eh_abort_handler()
3049 cancel_cmd->res = cmd->scsi_cmd->device->hostdata; pmcraid_eh_abort_handler()
3133 * @cmd: pmcraid command struct
3141 pmcraid_init_ioadls(struct pmcraid_cmd *cmd, int sgcount) pmcraid_init_ioadls() argument
3144 struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; pmcraid_init_ioadls()
3160 cpu_to_le64((cmd->ioa_cb_bus_addr) + pmcraid_init_ioadls()
3166 cpu_to_le64((cmd->ioa_cb_bus_addr) + pmcraid_init_ioadls()
3181 * @cmd: pmcraid command struct
3191 struct pmcraid_cmd *cmd pmcraid_build_ioadl()
3197 struct scsi_cmnd *scsi_cmd = cmd->scsi_cmd; pmcraid_build_ioadl()
3198 struct pmcraid_ioarcb *ioarcb = &(cmd->ioa_cb->ioarcb); pmcraid_build_ioadl()
3224 ioadl = pmcraid_init_ioadls(cmd, nseg); pmcraid_build_ioadl()
3404 * would use cmd block queue locks (free_pool_lock and pending_pool_lock)
3419 struct pmcraid_cmd *cmd; pmcraid_queuecommand_lck() local
3454 cmd = pmcraid_get_free_cmd(pinstance); pmcraid_queuecommand_lck()
3456 if (cmd == NULL) { pmcraid_queuecommand_lck()
3461 cmd->scsi_cmd = scsi_cmd; pmcraid_queuecommand_lck()
3462 ioarcb = &(cmd->ioa_cb->ioarcb); pmcraid_queuecommand_lck()
3468 * generated internally uses hrrq_id 0, exception to this is the cmd pmcraid_queuecommand_lck()
3474 cmd->cmd_done = pmcraid_io_done; pmcraid_queuecommand_lck()
3494 rc = pmcraid_build_ioadl(pinstance, cmd); pmcraid_queuecommand_lck()
3509 _pmcraid_fire_command(cmd); pmcraid_queuecommand_lck()
3512 pmcraid_return_cmd(cmd); pmcraid_queuecommand_lck()
3562 * @cmd : pointer to struct pmcraid_cmd
3570 struct pmcraid_cmd *cmd, pmcraid_build_passthrough_ioadls()
3577 struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; pmcraid_build_passthrough_ioadls()
3588 sglist->num_dma_sg = pci_map_sg(cmd->drv_inst->pdev, pmcraid_build_passthrough_ioadls()
3593 dev_err(&cmd->drv_inst->pdev->dev, pmcraid_build_passthrough_ioadls()
3599 cmd->sglist = sglist; pmcraid_build_passthrough_ioadls()
3602 ioadl = pmcraid_init_ioadls(cmd, sglist->num_dma_sg); pmcraid_build_passthrough_ioadls()
3621 * @cmd: pointer to struct pmcraid_cmd for which ioadls were allocated
3629 struct pmcraid_cmd *cmd, pmcraid_release_passthrough_ioadls()
3634 struct pmcraid_sglist *sglist = cmd->sglist; pmcraid_release_passthrough_ioadls()
3637 pci_unmap_sg(cmd->drv_inst->pdev, pmcraid_release_passthrough_ioadls()
3642 cmd->sglist = NULL; pmcraid_release_passthrough_ioadls()
3650 * @cmd: ioctl code
3665 struct pmcraid_cmd *cmd; pmcraid_ioctl_passthrough() local
3751 cmd = pmcraid_get_free_cmd(pinstance); pmcraid_ioctl_passthrough()
3753 if (!cmd) { pmcraid_ioctl_passthrough()
3759 cmd->scsi_cmd = NULL; pmcraid_ioctl_passthrough()
3760 ioarcb = &(cmd->ioa_cb->ioarcb); pmcraid_ioctl_passthrough()
3782 * generated internally uses hrrq_id 0, exception to this is the cmd pmcraid_ioctl_passthrough()
3790 rc = pmcraid_build_passthrough_ioadls(cmd, pmcraid_ioctl_passthrough()
3806 rc = pmcraid_copy_sglist(cmd->sglist, pmcraid_ioctl_passthrough()
3819 cmd->cmd_done = pmcraid_internal_done; pmcraid_ioctl_passthrough()
3820 init_completion(&cmd->wait_for_completion); pmcraid_ioctl_passthrough()
3821 cmd->completion_req = 1; pmcraid_ioctl_passthrough()
3824 le32_to_cpu(cmd->ioa_cb->ioarcb.response_handle) >> 2, pmcraid_ioctl_passthrough()
3825 cmd->ioa_cb->ioarcb.cdb[0], pmcraid_ioctl_passthrough()
3826 le32_to_cpu(cmd->ioa_cb->ioarcb.resource_handle)); pmcraid_ioctl_passthrough()
3829 _pmcraid_fire_command(cmd); pmcraid_ioctl_passthrough()
3845 wait_for_completion(&cmd->wait_for_completion); pmcraid_ioctl_passthrough()
3847 &cmd->wait_for_completion, pmcraid_ioctl_passthrough()
3850 pmcraid_info("aborting cmd %d (CDB[0] = %x) due to timeout\n", pmcraid_ioctl_passthrough()
3851 le32_to_cpu(cmd->ioa_cb->ioarcb.response_handle >> 2), pmcraid_ioctl_passthrough()
3852 cmd->ioa_cb->ioarcb.cdb[0]); pmcraid_ioctl_passthrough()
3855 cancel_cmd = pmcraid_abort_cmd(cmd); pmcraid_ioctl_passthrough()
3882 &cmd->wait_for_completion, pmcraid_ioctl_passthrough()
3884 pmcraid_reset_bringup(cmd->drv_inst); pmcraid_ioctl_passthrough()
3894 if (copy_to_user(ioasa, &cmd->ioa_cb->ioasa, pmcraid_ioctl_passthrough()
3904 rc = pmcraid_copy_sglist(cmd->sglist, pmcraid_ioctl_passthrough()
3915 pmcraid_release_passthrough_ioadls(cmd, request_size, direction); pmcraid_ioctl_passthrough()
3916 pmcraid_return_cmd(cmd); pmcraid_ioctl_passthrough()
3931 * @cmd: ioctl command passed in
3940 unsigned int cmd, pmcraid_ioctl_driver()
3947 if (!access_ok(VERIFY_READ, user_buffer, _IOC_SIZE(cmd))) { pmcraid_ioctl_driver()
3952 switch (cmd) { pmcraid_ioctl_driver()
3968 * @cmd: ioctl command
3978 int cmd, pmcraid_check_ioctl_buffer()
4001 if ((_IOC_DIR(cmd) & _IOC_READ) == _IOC_READ) pmcraid_check_ioctl_buffer()
4021 unsigned int cmd, pmcraid_chr_ioctl()
4036 retval = pmcraid_check_ioctl_buffer(cmd, (void *)arg, hdr); pmcraid_chr_ioctl()
4052 switch (_IOC_TYPE(cmd)) { pmcraid_chr_ioctl()
4058 if (cmd == PMCRAID_IOCTL_DOWNLOAD_MICROCODE) pmcraid_chr_ioctl()
4062 cmd, pmcraid_chr_ioctl()
4066 if (cmd == PMCRAID_IOCTL_DOWNLOAD_MICROCODE) pmcraid_chr_ioctl()
4073 cmd, pmcraid_chr_ioctl()
4536 struct pmcraid_cmd *cmd = NULL; pmcraid_tasklet_function() local
4552 cmd = pinstance->cmd_list[cmd_index]; pmcraid_tasklet_function()
4557 list_del(&cmd->free_list); pmcraid_tasklet_function()
4560 del_timer(&cmd->timer); pmcraid_tasklet_function()
4563 if (cmd->cmd_done == pmcraid_ioa_reset) { pmcraid_tasklet_function()
4566 cmd->cmd_done(cmd); pmcraid_tasklet_function()
4569 } else if (cmd->cmd_done != NULL) { pmcraid_tasklet_function()
4570 cmd->cmd_done(cmd); pmcraid_tasklet_function()
4726 * pmcraid_allocate_cmd_blocks - allocate memory for cmd block structures
5110 pmcraid_err("couldn't allocate memory for cmd blocks\n"); pmcraid_init_buffers()
5496 * @cmd: pointer to reset command block
5498 static void pmcraid_complete_ioa_reset(struct pmcraid_cmd *cmd) pmcraid_complete_ioa_reset() argument
5500 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_complete_ioa_reset()
5504 pmcraid_ioa_reset(cmd); pmcraid_complete_ioa_reset()
5513 * @cmd: pointer to pmcraid_cmd structure
5518 static void pmcraid_set_supported_devs(struct pmcraid_cmd *cmd) pmcraid_set_supported_devs() argument
5520 struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; pmcraid_set_supported_devs()
5523 pmcraid_reinit_cmdblk(cmd); pmcraid_set_supported_devs()
5534 if (cmd->drv_inst->reinit_cfg_table) { pmcraid_set_supported_devs()
5535 cmd->drv_inst->reinit_cfg_table = 0; pmcraid_set_supported_devs()
5536 cmd->release = 1; pmcraid_set_supported_devs()
5544 pmcraid_send_cmd(cmd, pmcraid_set_supported_devs()
5554 * @cmd: pointer to pmcraid_cmd structure
5559 static void pmcraid_set_timestamp(struct pmcraid_cmd *cmd) pmcraid_set_timestamp() argument
5561 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_set_timestamp()
5562 struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; pmcraid_set_timestamp()
5577 pmcraid_reinit_cmdblk(cmd); pmcraid_set_timestamp()
5584 ioarcb->ioadl_bus_addr = cpu_to_le64((cmd->ioa_cb_bus_addr) + pmcraid_set_timestamp()
5601 pmcraid_send_cmd(cmd, pmcraid_set_supported_devs, pmcraid_set_timestamp()
5604 pmcraid_send_cmd(cmd, pmcraid_return_cmd, pmcraid_set_timestamp()
5613 * @cmd: pointer to pmcraid command struct
5623 static void pmcraid_init_res_table(struct pmcraid_cmd *cmd) pmcraid_init_res_table() argument
5625 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_init_res_table()
5722 pmcraid_set_timestamp(cmd); pmcraid_init_res_table()
5727 * @cmd: pointer pmcraid_cmd struct
5735 static void pmcraid_querycfg(struct pmcraid_cmd *cmd) pmcraid_querycfg() argument
5737 struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; pmcraid_querycfg()
5739 struct pmcraid_instance *pinstance = cmd->drv_inst; pmcraid_querycfg()
5761 ioarcb->ioadl_bus_addr = cpu_to_le64((cmd->ioa_cb_bus_addr) + pmcraid_querycfg()
5776 pmcraid_send_cmd(cmd, pmcraid_init_res_table, pmcraid_querycfg()
919 pmcraid_send_cmd( struct pmcraid_cmd *cmd, void (*cmd_done) (struct pmcraid_cmd *), unsigned long timeout, void (*timeout_func) (struct pmcraid_cmd *) ) pmcraid_send_cmd() argument
1234 pmcraid_prepare_cancel_cmd( struct pmcraid_cmd *cmd, struct pmcraid_cmd *cmd_to_cancel ) pmcraid_prepare_cancel_cmd() argument
1265 pmcraid_cancel_hcam( struct pmcraid_cmd *cmd, u8 type, void (*cmd_done) (struct pmcraid_cmd *) ) pmcraid_cancel_hcam() argument
3569 pmcraid_build_passthrough_ioadls( struct pmcraid_cmd *cmd, int buflen, int direction ) pmcraid_build_passthrough_ioadls() argument
3628 pmcraid_release_passthrough_ioadls( struct pmcraid_cmd *cmd, int buflen, int direction ) pmcraid_release_passthrough_ioadls() argument
3938 pmcraid_ioctl_driver( struct pmcraid_instance *pinstance, unsigned int cmd, unsigned int buflen, void __user *user_buffer ) pmcraid_ioctl_driver() argument
3977 pmcraid_check_ioctl_buffer( int cmd, void __user *arg, struct pmcraid_ioctl_header *hdr ) pmcraid_check_ioctl_buffer() argument
4019 pmcraid_chr_ioctl( struct file *filep, unsigned int cmd, unsigned long arg ) pmcraid_chr_ioctl() argument
H A Deata_pio.c161 struct scsi_cmnd *cmd; eata_pio_int_handler() local
184 cmd = cp->cmd; eata_pio_int_handler()
185 base = cmd->device->host->base; eata_pio_int_handler()
193 while ((cmd->SCp.Status) && ((z > 0) || (odd))) { eata_pio_int_handler()
195 *(cmd->SCp.ptr) = zwickel >> 8; eata_pio_int_handler()
196 IncStat(&cmd->SCp, 1); eata_pio_int_handler()
199 x = min_t(unsigned int, z, cmd->SCp.this_residual / 2); eata_pio_int_handler()
200 insw(base + HA_RDATA, cmd->SCp.ptr, x); eata_pio_int_handler()
202 IncStat(&cmd->SCp, 2 * x); eata_pio_int_handler()
203 if ((z > 0) && (cmd->SCp.this_residual == 1)) { eata_pio_int_handler()
205 *(cmd->SCp.ptr) = zwickel & 0xff; eata_pio_int_handler()
206 IncStat(&cmd->SCp, 1); eata_pio_int_handler()
219 while ((cmd->SCp.Status) && ((z > 0) || (odd))) { eata_pio_int_handler()
221 zwickel += *(cmd->SCp.ptr) << 8; eata_pio_int_handler()
222 IncStat(&cmd->SCp, 1); eata_pio_int_handler()
227 x = min_t(unsigned int, z, cmd->SCp.this_residual / 2); eata_pio_int_handler()
228 outsw(base + HA_RDATA, cmd->SCp.ptr, x); eata_pio_int_handler()
230 IncStat(&cmd->SCp, 2 * x); eata_pio_int_handler()
231 if ((z > 0) && (cmd->SCp.this_residual == 1)) { eata_pio_int_handler()
232 zwickel = *(cmd->SCp.ptr); eata_pio_int_handler()
234 IncStat(&cmd->SCp, 1); eata_pio_int_handler()
258 cmd->result = (DID_OK << 16); eata_pio_int_handler()
261 cmd->result = (DID_OK << 16) + 0x02; eata_pio_int_handler()
263 cmd->result = (DID_NO_CONNECT << 16); eata_pio_int_handler()
273 printk(KERN_DEBUG "stat: %#.2x, result: %#.8x\n", stat, cmd->result); eata_pio_int_handler()
278 cmd->scsi_done(cmd); eata_pio_int_handler()
302 static int eata_pio_queue_lck(struct scsi_cmnd *cmd, eata_pio_queue_lck() argument
314 hd = HD(cmd); eata_pio_queue_lck()
315 sh = cmd->device->host; eata_pio_queue_lck()
318 /* use only slot 0, as 2001 can handle only one cmd at a time */ eata_pio_queue_lck()
338 DBG(DBG_QUEUE, scmd_printk(KERN_DEBUG, cmd, eata_pio_queue_lck()
339 "eata_pio_queue 0x%p, y %d\n", cmd, y)); eata_pio_queue_lck()
341 cmd->scsi_done = (void *) done; eata_pio_queue_lck()
343 if (cmd->sc_data_direction == DMA_TO_DEVICE) eata_pio_queue_lck()
348 cp->Interpret = (cmd->device->id == hd->hostid); eata_pio_queue_lck()
349 cp->cp_datalen = cpu_to_be32(scsi_bufflen(cmd)); eata_pio_queue_lck()
354 cp->cp_id = cmd->device->id; eata_pio_queue_lck()
355 cp->cp_lun = cmd->device->lun; eata_pio_queue_lck()
358 memcpy(cp->cp_cdb, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd)); eata_pio_queue_lck()
363 cp->cmd = cmd; eata_pio_queue_lck()
364 cmd->host_scribble = (char *) &hd->ccb[y]; eata_pio_queue_lck()
366 if (!scsi_bufflen(cmd)) { eata_pio_queue_lck()
367 cmd->SCp.buffers_residual = 1; eata_pio_queue_lck()
368 cmd->SCp.ptr = NULL; eata_pio_queue_lck()
369 cmd->SCp.this_residual = 0; eata_pio_queue_lck()
370 cmd->SCp.buffer = NULL; eata_pio_queue_lck()
372 cmd->SCp.buffer = scsi_sglist(cmd); eata_pio_queue_lck()
373 cmd->SCp.buffers_residual = scsi_sg_count(cmd); eata_pio_queue_lck()
374 cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); eata_pio_queue_lck()
375 cmd->SCp.this_residual = cmd->SCp.buffer->length; eata_pio_queue_lck()
377 cmd->SCp.Status = (cmd->SCp.this_residual != 0); /* TRUE as long as bytes eata_pio_queue_lck()
381 cmd->result = DID_BUS_BUSY << 16; eata_pio_queue_lck()
382 scmd_printk(KERN_NOTICE, cmd, eata_pio_queue_lck()
384 "returning DID_BUS_BUSY, done.\n", cmd); eata_pio_queue_lck()
385 done(cmd); eata_pio_queue_lck()
397 DBG(DBG_QUEUE, scmd_printk(KERN_DEBUG, cmd, eata_pio_queue_lck()
398 "Queued base %#.4lx cmd: 0x%p " eata_pio_queue_lck()
399 "slot %d irq %d\n", sh->base, cmd, y, sh->irq)); eata_pio_queue_lck()
406 static int eata_pio_abort(struct scsi_cmnd *cmd) eata_pio_abort() argument
410 DBG(DBG_ABNORM, scmd_printk(KERN_WARNING, cmd, eata_pio_abort()
411 "eata_pio_abort called pid: 0x%p\n", cmd)); eata_pio_abort()
413 while (inb(cmd->device->host->base + HA_RAUXSTAT) & HA_ABUSY) eata_pio_abort()
418 if (CD(cmd)->status == FREE) { eata_pio_abort()
422 if (CD(cmd)->status == USED) { eata_pio_abort()
427 if (CD(cmd)->status == RESET) { eata_pio_abort()
431 if (CD(cmd)->status == LOCKED) { eata_pio_abort()
438 static int eata_pio_host_reset(struct scsi_cmnd *cmd) eata_pio_host_reset() argument
443 struct Scsi_Host *host = cmd->device->host; eata_pio_host_reset()
445 DBG(DBG_ABNORM, scmd_printk(KERN_WARNING, cmd, eata_pio_host_reset()
450 if (HD(cmd)->state == RESET) { eata_pio_host_reset()
458 for (x = 0; x < cmd->device->host->can_queue; x++) { eata_pio_host_reset()
460 if (HD(cmd)->ccb[x].status == FREE) eata_pio_host_reset()
463 sp = HD(cmd)->ccb[x].cmd; eata_pio_host_reset()
464 HD(cmd)->ccb[x].status = RESET; eata_pio_host_reset()
472 outb(EATA_CMD_RESET, cmd->device->host->base + HA_WCOMMAND); eata_pio_host_reset()
475 HD(cmd)->state = RESET; eata_pio_host_reset()
483 for (x = 0; x < cmd->device->host->can_queue; x++) { eata_pio_host_reset()
486 if (HD(cmd)->ccb[x].status != RESET) eata_pio_host_reset()
489 sp = HD(cmd)->ccb[x].cmd; eata_pio_host_reset()
494 HD(cmd)->ccb[x].status = FREE; eata_pio_host_reset()
499 HD(cmd)->state = 0; eata_pio_host_reset()
H A Dmvme147.c30 static int dma_setup(struct scsi_cmnd *cmd, int dir_in) dma_setup() argument
32 struct Scsi_Host *instance = cmd->device->host; dma_setup()
35 unsigned long addr = virt_to_bus(cmd->SCp.ptr); dma_setup()
46 cache_clear(addr, cmd->SCp.this_residual); dma_setup()
49 cache_push(addr, cmd->SCp.this_residual); dma_setup()
53 m147_pcc->dma_bcr = cmd->SCp.this_residual | (1 << 24); dma_setup()
124 static int mvme147_bus_reset(struct scsi_cmnd *cmd) mvme147_bus_reset() argument
131 spin_lock_irq(cmd->device->host->host_lock); mvme147_bus_reset()
132 wd33c93_host_reset(cmd); mvme147_bus_reset()
133 spin_unlock_irq(cmd->device->host->host_lock); mvme147_bus_reset()
H A Dscsi_logging.c220 void scsi_print_command(struct scsi_cmnd *cmd) scsi_print_command() argument
226 if (!cmd->cmnd) scsi_print_command()
234 scmd_name(cmd), cmd->request->tag); scsi_print_command()
242 cmd->cmnd); scsi_print_command()
247 if (cmd->cmd_len > 16) { scsi_print_command()
250 dev_printk(KERN_INFO, &cmd->device->sdev_gendev, "%s", logbuf); scsi_print_command()
252 for (k = 0; k < cmd->cmd_len; k += 16) { scsi_print_command()
253 size_t linelen = min(cmd->cmd_len - k, 16); scsi_print_command()
259 scmd_name(cmd), scsi_print_command()
260 cmd->request->tag); scsi_print_command()
264 hex_dump_to_buffer(&cmd->cmnd[k], linelen, scsi_print_command()
268 dev_printk(KERN_INFO, &cmd->device->sdev_gendev, "%s", scsi_print_command()
276 hex_dump_to_buffer(cmd->cmnd, cmd->cmd_len, 16, 1, scsi_print_command()
281 dev_printk(KERN_INFO, &cmd->device->sdev_gendev, "%s", logbuf); scsi_print_command()
421 void scsi_print_sense(const struct scsi_cmnd *cmd) scsi_print_sense() argument
423 scsi_log_print_sense(cmd->device, scmd_name(cmd), cmd->request->tag, scsi_print_sense()
424 cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE); scsi_print_sense()
428 void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg, scsi_print_result() argument
434 const char *hb_string = scsi_hostbyte_string(cmd->result); scsi_print_result()
435 const char *db_string = scsi_driverbyte_string(cmd->result); scsi_print_result()
442 scmd_name(cmd), cmd->request->tag); scsi_print_result()
471 "hostbyte=0x%02x ", host_byte(cmd->result)); scsi_print_result()
480 "driverbyte=0x%02x", driver_byte(cmd->result)); scsi_print_result()
482 dev_printk(KERN_INFO, &cmd->device->sdev_gendev, "%s", logbuf); scsi_print_result()
/linux-4.4.14/drivers/ide/
H A Dide-taskfile.c27 void ide_tf_readback(ide_drive_t *drive, struct ide_cmd *cmd) ide_tf_readback() argument
35 tp_ops->tf_read(drive, &cmd->tf, cmd->valid.in.tf); ide_tf_readback()
37 if (cmd->tf_flags & IDE_TFLAG_LBA48) { ide_tf_readback()
40 tp_ops->tf_read(drive, &cmd->hob, cmd->valid.in.hob); ide_tf_readback()
44 void ide_tf_dump(const char *s, struct ide_cmd *cmd) ide_tf_dump() argument
48 "lbam 0x%02x lbah 0x%02x dev 0x%02x cmd 0x%02x\n", ide_tf_dump()
49 s, cmd->tf.feature, cmd->tf.nsect, ide_tf_dump()
50 cmd->tf.lbal, cmd->tf.lbam, cmd->tf.lbah, ide_tf_dump()
51 cmd->tf.device, cmd->tf.command); ide_tf_dump()
53 s, cmd->hob.nsect, cmd->hob.lbal, cmd->hob.lbam, cmd->hob.lbah); ide_tf_dump()
59 struct ide_cmd cmd; taskfile_lib_get_identify() local
61 memset(&cmd, 0, sizeof(cmd)); taskfile_lib_get_identify()
62 cmd.tf.nsect = 0x01; taskfile_lib_get_identify()
64 cmd.tf.command = ATA_CMD_ID_ATA; taskfile_lib_get_identify()
66 cmd.tf.command = ATA_CMD_ID_ATAPI; taskfile_lib_get_identify()
67 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; taskfile_lib_get_identify()
68 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; taskfile_lib_get_identify()
69 cmd.protocol = ATA_PROT_PIO; taskfile_lib_get_identify()
71 return ide_raw_taskfile(drive, &cmd, buf, 1); taskfile_lib_get_identify()
81 struct ide_cmd *cmd = &hwif->cmd; do_rw_taskfile() local
82 struct ide_taskfile *tf = &cmd->tf; do_rw_taskfile()
97 memcpy(cmd, orig_cmd, sizeof(*cmd)); do_rw_taskfile()
99 if ((cmd->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) { do_rw_taskfile()
100 ide_tf_dump(drive->name, cmd); do_rw_taskfile()
103 if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) { do_rw_taskfile()
104 u8 data[2] = { cmd->tf.data, cmd->hob.data }; do_rw_taskfile()
106 tp_ops->output_data(drive, cmd, data, 2); do_rw_taskfile()
109 if (cmd->valid.out.tf & IDE_VALID_DEVICE) { do_rw_taskfile()
110 u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? do_rw_taskfile()
113 if (!(cmd->ftf_flags & IDE_FTFLAG_FLAGGED)) do_rw_taskfile()
114 cmd->tf.device &= HIHI; do_rw_taskfile()
115 cmd->tf.device |= drive->select; do_rw_taskfile()
118 tp_ops->tf_load(drive, &cmd->hob, cmd->valid.out.hob); do_rw_taskfile()
119 tp_ops->tf_load(drive, &cmd->tf, cmd->valid.out.tf); do_rw_taskfile()
122 switch (cmd->protocol) { do_rw_taskfile()
124 if (cmd->tf_flags & IDE_TFLAG_WRITE) { do_rw_taskfile()
127 return pre_task_out_intr(drive, cmd); do_rw_taskfile()
134 ide_execute_command(drive, cmd, handler, WAIT_WORSTCASE); do_rw_taskfile()
137 if (ide_dma_prepare(drive, cmd)) do_rw_taskfile()
140 ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD); do_rw_taskfile()
151 struct ide_cmd *cmd = &hwif->cmd; task_no_data_intr() local
152 struct ide_taskfile *tf = &cmd->tf; task_no_data_intr()
153 int custom = (cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) ? 1 : 0; task_no_data_intr()
192 ide_finish_cmd(drive, cmd, stat); task_no_data_intr()
223 void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd, ide_pio_bytes() argument
228 struct scatterlist *cursg = cmd->cursg; ide_pio_bytes()
234 cursg = cmd->cursg; ide_pio_bytes()
236 cursg = cmd->cursg = sg; ide_pio_bytes()
239 unsigned nr_bytes = min(len, cursg->length - cmd->cursg_ofs); ide_pio_bytes()
243 offset = cursg->offset + cmd->cursg_ofs; ide_pio_bytes()
257 cmd->nleft -= nr_bytes; ide_pio_bytes()
258 cmd->cursg_ofs += nr_bytes; ide_pio_bytes()
260 if (cmd->cursg_ofs == cursg->length) { ide_pio_bytes()
261 cursg = cmd->cursg = sg_next(cmd->cursg); ide_pio_bytes()
262 cmd->cursg_ofs = 0; ide_pio_bytes()
267 hwif->tp_ops->output_data(drive, cmd, buf, nr_bytes); ide_pio_bytes()
269 hwif->tp_ops->input_data(drive, cmd, buf, nr_bytes); ide_pio_bytes()
281 static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd, ide_pio_datablock() argument
288 if (cmd->tf_flags & IDE_TFLAG_FS) ide_pio_datablock()
289 cmd->rq->errors = 0; ide_pio_datablock()
291 if (cmd->tf_flags & IDE_TFLAG_IO_16BIT) ide_pio_datablock()
296 if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) ide_pio_datablock()
297 nr_bytes = min_t(unsigned, cmd->nleft, drive->mult_count << 9); ide_pio_datablock()
301 ide_pio_bytes(drive, cmd, write, nr_bytes); ide_pio_datablock()
306 static void ide_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd) ide_error_cmd() argument
308 if (cmd->tf_flags & IDE_TFLAG_FS) { ide_error_cmd()
309 int nr_bytes = cmd->nbytes - cmd->nleft; ide_error_cmd()
311 if (cmd->protocol == ATA_PROT_PIO && ide_error_cmd()
312 ((cmd->tf_flags & IDE_TFLAG_WRITE) || cmd->nleft == 0)) { ide_error_cmd()
313 if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) ide_error_cmd()
324 void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat) ide_finish_cmd() argument
327 u8 err = ide_read_error(drive), nsect = cmd->tf.nsect; ide_finish_cmd()
328 u8 set_xfer = !!(cmd->tf_flags & IDE_TFLAG_SET_XFER); ide_finish_cmd()
330 ide_complete_cmd(drive, cmd, stat, err); ide_finish_cmd()
347 struct ide_cmd *cmd = &drive->hwif->cmd; task_pio_intr() local
349 u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE); task_pio_intr()
370 if (((stat & ATA_DRQ) == 0) ^ (cmd->nleft == 0)) task_pio_intr()
374 if (write && cmd->nleft == 0) task_pio_intr()
378 ide_pio_datablock(drive, cmd, write); task_pio_intr()
381 if (write == 0 && cmd->nleft == 0) { task_pio_intr()
393 if ((cmd->tf_flags & IDE_TFLAG_FS) == 0) task_pio_intr()
394 ide_finish_cmd(drive, cmd, stat); task_pio_intr()
396 ide_complete_rq(drive, 0, blk_rq_sectors(cmd->rq) << 9); task_pio_intr()
399 ide_error_cmd(drive, cmd); task_pio_intr()
404 struct ide_cmd *cmd) pre_task_out_intr()
411 (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) ? "MULT" : "", pre_task_out_intr()
421 ide_pio_datablock(drive, cmd, 1); pre_task_out_intr()
426 int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf, ide_raw_taskfile() argument
431 int rw = !(cmd->tf_flags & IDE_TFLAG_WRITE) ? READ : WRITE; ide_raw_taskfile()
449 rq->special = cmd; ide_raw_taskfile()
450 cmd->rq = rq; ide_raw_taskfile()
460 int ide_no_data_taskfile(ide_drive_t *drive, struct ide_cmd *cmd) ide_no_data_taskfile() argument
462 cmd->protocol = ATA_PROT_NODATA; ide_no_data_taskfile()
464 return ide_raw_taskfile(drive, cmd, NULL, 0); ide_no_data_taskfile()
472 struct ide_cmd cmd; ide_taskfile_ioctl() local
521 memset(&cmd, 0, sizeof(cmd)); ide_taskfile_ioctl()
523 memcpy(&cmd.hob, req_task->hob_ports, HDIO_DRIVE_HOB_HDR_SIZE - 2); ide_taskfile_ioctl()
524 memcpy(&cmd.tf, req_task->io_ports, HDIO_DRIVE_TASK_HDR_SIZE); ide_taskfile_ioctl()
526 cmd.valid.out.tf = IDE_VALID_DEVICE; ide_taskfile_ioctl()
527 cmd.valid.in.tf = IDE_VALID_DEVICE | IDE_VALID_IN_TF; ide_taskfile_ioctl()
528 cmd.tf_flags = IDE_TFLAG_IO_16BIT; ide_taskfile_ioctl()
531 cmd.tf_flags |= IDE_TFLAG_LBA48; ide_taskfile_ioctl()
532 cmd.valid.in.hob = IDE_VALID_IN_HOB; ide_taskfile_ioctl()
536 cmd.ftf_flags |= IDE_FTFLAG_FLAGGED; ide_taskfile_ioctl()
539 cmd.ftf_flags |= IDE_FTFLAG_OUT_DATA; ide_taskfile_ioctl()
542 cmd.valid.out.hob |= IDE_VALID_NSECT; ide_taskfile_ioctl()
544 cmd.valid.out.hob |= IDE_VALID_LBAL; ide_taskfile_ioctl()
546 cmd.valid.out.hob |= IDE_VALID_LBAM; ide_taskfile_ioctl()
548 cmd.valid.out.hob |= IDE_VALID_LBAH; ide_taskfile_ioctl()
551 cmd.valid.out.tf |= IDE_VALID_FEATURE; ide_taskfile_ioctl()
553 cmd.valid.out.tf |= IDE_VALID_NSECT; ide_taskfile_ioctl()
555 cmd.valid.out.tf |= IDE_VALID_LBAL; ide_taskfile_ioctl()
557 cmd.valid.out.tf |= IDE_VALID_LBAM; ide_taskfile_ioctl()
559 cmd.valid.out.tf |= IDE_VALID_LBAH; ide_taskfile_ioctl()
561 cmd.valid.out.tf |= IDE_VALID_OUT_TF; ide_taskfile_ioctl()
562 if (cmd.tf_flags & IDE_TFLAG_LBA48) ide_taskfile_ioctl()
563 cmd.valid.out.hob |= IDE_VALID_OUT_HOB; ide_taskfile_ioctl()
567 cmd.ftf_flags |= IDE_FTFLAG_IN_DATA; ide_taskfile_ioctl()
573 cmd.tf_flags |= IDE_TFLAG_WRITE; ide_taskfile_ioctl()
576 cmd.protocol = ATA_PROT_DMA; ide_taskfile_ioctl()
587 cmd.tf_flags |= IDE_TFLAG_MULTI_PIO; ide_taskfile_ioctl()
590 cmd.protocol = ATA_PROT_PIO; ide_taskfile_ioctl()
594 cmd.tf_flags |= IDE_TFLAG_WRITE; ide_taskfile_ioctl()
606 cmd.tf_flags |= IDE_TFLAG_MULTI_PIO; ide_taskfile_ioctl()
609 cmd.protocol = ATA_PROT_PIO; ide_taskfile_ioctl()
617 cmd.protocol = ATA_PROT_NODATA; ide_taskfile_ioctl()
627 nsect = (cmd.hob.nsect << 8) | cmd.tf.nsect; ide_taskfile_ioctl()
637 err = ide_raw_taskfile(drive, &cmd, data_buf, nsect); ide_taskfile_ioctl()
639 memcpy(req_task->hob_ports, &cmd.hob, HDIO_DRIVE_HOB_HDR_SIZE - 2); ide_taskfile_ioctl()
640 memcpy(req_task->io_ports, &cmd.tf, HDIO_DRIVE_TASK_HDR_SIZE); ide_taskfile_ioctl()
642 if ((cmd.ftf_flags & IDE_FTFLAG_SET_IN_FLAGS) && ide_taskfile_ioctl()
403 pre_task_out_intr(ide_drive_t *drive, struct ide_cmd *cmd) pre_task_out_intr() argument
H A Dide-disk_ioctl.c19 unsigned int cmd, unsigned long arg) ide_disk_ioctl()
24 err = ide_setting_ioctl(drive, bdev, cmd, arg, ide_disk_ioctl_settings); ide_disk_ioctl()
28 err = generic_ide_ioctl(drive, bdev, cmd, arg); ide_disk_ioctl()
18 ide_disk_ioctl(ide_drive_t *drive, struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) ide_disk_ioctl() argument
H A Dide-disk.c55 static void ide_tf_set_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 dma) ide_tf_set_cmd() argument
59 lba48 = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 2 : 0; ide_tf_set_cmd()
60 write = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 1 : 0; ide_tf_set_cmd()
63 cmd->protocol = ATA_PROT_DMA; ide_tf_set_cmd()
66 cmd->protocol = ATA_PROT_PIO; ide_tf_set_cmd()
68 cmd->tf_flags |= IDE_TFLAG_MULTI_PIO; ide_tf_set_cmd()
74 cmd->tf.command = ide_rw_cmds[index + lba48 + write]; ide_tf_set_cmd()
88 struct ide_cmd cmd; __ide_do_rw_disk() local
89 struct ide_taskfile *tf = &cmd.tf; __ide_do_rw_disk()
99 memset(&cmd, 0, sizeof(cmd)); __ide_do_rw_disk()
100 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; __ide_do_rw_disk()
101 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; __ide_do_rw_disk()
114 tf = &cmd.hob; __ide_do_rw_disk()
122 cmd.valid.out.hob = IDE_VALID_OUT_HOB; __ide_do_rw_disk()
123 cmd.valid.in.hob = IDE_VALID_IN_HOB; __ide_do_rw_disk()
124 cmd.tf_flags |= IDE_TFLAG_LBA48; __ide_do_rw_disk()
149 cmd.tf_flags |= IDE_TFLAG_FS; __ide_do_rw_disk()
152 cmd.tf_flags |= IDE_TFLAG_WRITE; __ide_do_rw_disk()
154 ide_tf_set_cmd(drive, &cmd, dma); __ide_do_rw_disk()
155 cmd.rq = rq; __ide_do_rw_disk()
158 ide_init_sg_cmd(&cmd, nsectors << 9); __ide_do_rw_disk()
159 ide_map_sg(drive, &cmd); __ide_do_rw_disk()
162 rc = do_rw_taskfile(drive, &cmd); __ide_do_rw_disk()
166 cmd.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK; __ide_do_rw_disk()
167 ide_tf_set_cmd(drive, &cmd, 0); __ide_do_rw_disk()
168 ide_init_sg_cmd(&cmd, nsectors << 9); __ide_do_rw_disk()
169 rc = do_rw_taskfile(drive, &cmd); __ide_do_rw_disk()
207 struct ide_cmd cmd; idedisk_read_native_max_address() local
208 struct ide_taskfile *tf = &cmd.tf; idedisk_read_native_max_address()
211 memset(&cmd, 0, sizeof(cmd)); idedisk_read_native_max_address()
218 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; idedisk_read_native_max_address()
219 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; idedisk_read_native_max_address()
221 cmd.valid.out.hob = IDE_VALID_OUT_HOB; idedisk_read_native_max_address()
222 cmd.valid.in.hob = IDE_VALID_IN_HOB; idedisk_read_native_max_address()
223 cmd.tf_flags = IDE_TFLAG_LBA48; idedisk_read_native_max_address()
226 ide_no_data_taskfile(drive, &cmd); idedisk_read_native_max_address()
230 addr = ide_get_lba_addr(&cmd, lba48) + 1; idedisk_read_native_max_address()
241 struct ide_cmd cmd; idedisk_set_max_address() local
242 struct ide_taskfile *tf = &cmd.tf; idedisk_set_max_address()
247 memset(&cmd, 0, sizeof(cmd)); idedisk_set_max_address()
252 cmd.hob.lbal = (addr_req >>= 8) & 0xff; idedisk_set_max_address()
253 cmd.hob.lbam = (addr_req >>= 8) & 0xff; idedisk_set_max_address()
254 cmd.hob.lbah = (addr_req >>= 8) & 0xff; idedisk_set_max_address()
262 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; idedisk_set_max_address()
263 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; idedisk_set_max_address()
265 cmd.valid.out.hob = IDE_VALID_OUT_HOB; idedisk_set_max_address()
266 cmd.valid.in.hob = IDE_VALID_IN_HOB; idedisk_set_max_address()
267 cmd.tf_flags = IDE_TFLAG_LBA48; idedisk_set_max_address()
270 ide_no_data_taskfile(drive, &cmd); idedisk_set_max_address()
274 addr_set = ide_get_lba_addr(&cmd, lba48) + 1; idedisk_set_max_address()
432 struct ide_cmd *cmd; idedisk_prep_fn() local
438 cmd = rq->special; idedisk_prep_fn()
439 memset(cmd, 0, sizeof(*cmd)); idedisk_prep_fn()
441 cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC); idedisk_prep_fn()
444 /* FIXME: map struct ide_taskfile on rq->cmd[] */ idedisk_prep_fn()
445 BUG_ON(cmd == NULL); idedisk_prep_fn()
449 cmd->tf.command = ATA_CMD_FLUSH_EXT; idedisk_prep_fn()
451 cmd->tf.command = ATA_CMD_FLUSH; idedisk_prep_fn()
452 cmd->valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; idedisk_prep_fn()
453 cmd->tf_flags = IDE_TFLAG_DYN; idedisk_prep_fn()
454 cmd->protocol = ATA_PROT_NODATA; idedisk_prep_fn()
457 rq->special = cmd; idedisk_prep_fn()
458 cmd->rq = rq; idedisk_prep_fn()
510 struct ide_cmd cmd; ide_do_setfeature() local
512 memset(&cmd, 0, sizeof(cmd)); ide_do_setfeature()
513 cmd.tf.feature = feature; ide_do_setfeature()
514 cmd.tf.nsect = nsect; ide_do_setfeature()
515 cmd.tf.command = ATA_CMD_SET_FEATURES; ide_do_setfeature()
516 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; ide_do_setfeature()
517 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; ide_do_setfeature()
519 return ide_no_data_taskfile(drive, &cmd); ide_do_setfeature()
584 struct ide_cmd cmd; do_idedisk_flushcache() local
586 memset(&cmd, 0, sizeof(cmd)); do_idedisk_flushcache()
588 cmd.tf.command = ATA_CMD_FLUSH_EXT; do_idedisk_flushcache()
590 cmd.tf.command = ATA_CMD_FLUSH; do_idedisk_flushcache()
591 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; do_idedisk_flushcache()
592 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; do_idedisk_flushcache()
594 return ide_no_data_taskfile(drive, &cmd); do_idedisk_flushcache()
768 struct ide_cmd cmd; ide_disk_set_doorlock() local
774 memset(&cmd, 0, sizeof(cmd)); ide_disk_set_doorlock()
775 cmd.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK; ide_disk_set_doorlock()
776 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; ide_disk_set_doorlock()
777 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; ide_disk_set_doorlock()
779 ret = ide_no_data_taskfile(drive, &cmd); ide_disk_set_doorlock()
H A Dide-disk_proc.c11 struct ide_cmd cmd; smart_enable() local
12 struct ide_taskfile *tf = &cmd.tf; smart_enable()
14 memset(&cmd, 0, sizeof(cmd)); smart_enable()
19 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; smart_enable()
20 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; smart_enable()
22 return ide_no_data_taskfile(drive, &cmd); smart_enable()
27 struct ide_cmd cmd; get_smart_data() local
28 struct ide_taskfile *tf = &cmd.tf; get_smart_data()
30 memset(&cmd, 0, sizeof(cmd)); get_smart_data()
36 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; get_smart_data()
37 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; get_smart_data()
38 cmd.protocol = ATA_PROT_PIO; get_smart_data()
40 return ide_raw_taskfile(drive, &cmd, buf, 1); get_smart_data()
H A Dide-ioctls.c20 unsigned int cmd, unsigned long arg, ide_setting_ioctl()
27 if (ds->get && s->get_ioctl == cmd) ide_setting_ioctl()
29 else if (ds->set && s->set_ioctl == cmd) ide_setting_ioctl()
57 static int ide_get_identity_ioctl(ide_drive_t *drive, unsigned int cmd, ide_get_identity_ioctl() argument
61 int size = (cmd == HDIO_GET_IDENTITY) ? (ATA_ID_WORDS * 2) : 142; ide_get_identity_ioctl()
122 struct ide_cmd cmd; ide_cmd_ioctl() local
123 struct ide_taskfile *tf = &cmd.tf; ide_cmd_ioctl()
139 memset(&cmd, 0, sizeof(cmd)); ide_cmd_ioctl()
146 cmd.valid.out.tf = IDE_VALID_OUT_TF; ide_cmd_ioctl()
147 cmd.valid.in.tf = IDE_VALID_NSECT; ide_cmd_ioctl()
150 cmd.valid.out.tf = IDE_VALID_FEATURE | IDE_VALID_NSECT; ide_cmd_ioctl()
151 cmd.valid.in.tf = IDE_VALID_NSECT; ide_cmd_ioctl()
154 cmd.protocol = args[3] ? ATA_PROT_PIO : ATA_PROT_NODATA; ide_cmd_ioctl()
157 cmd.tf_flags |= IDE_TFLAG_IO_16BIT; ide_cmd_ioctl()
173 cmd.tf_flags |= IDE_TFLAG_SET_XFER; ide_cmd_ioctl()
176 err = ide_raw_taskfile(drive, &cmd, buf, args[3]); ide_cmd_ioctl()
197 struct ide_cmd cmd; ide_task_ioctl() local
202 memset(&cmd, 0, sizeof(cmd)); ide_task_ioctl()
203 memcpy(&cmd.tf.feature, &args[1], 6); ide_task_ioctl()
204 cmd.tf.command = args[0]; ide_task_ioctl()
205 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; ide_task_ioctl()
206 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; ide_task_ioctl()
208 err = ide_no_data_taskfile(drive, &cmd); ide_task_ioctl()
210 args[0] = cmd.tf.command; ide_task_ioctl()
211 memcpy(&args[1], &cmd.tf.feature, 6); ide_task_ioctl()
227 rq->cmd[0] = REQ_DRIVE_RESET; generic_drive_reset()
235 unsigned int cmd, unsigned long arg) generic_ide_ioctl()
239 err = ide_setting_ioctl(drive, bdev, cmd, arg, ide_ioctl_settings); generic_ide_ioctl()
243 switch (cmd) { generic_ide_ioctl()
248 return ide_get_identity_ioctl(drive, cmd, arg); generic_ide_ioctl()
19 ide_setting_ioctl(ide_drive_t *drive, struct block_device *bdev, unsigned int cmd, unsigned long arg, const struct ide_ioctl_devset *s) ide_setting_ioctl() argument
234 generic_ide_ioctl(ide_drive_t *drive, struct block_device *bdev, unsigned int cmd, unsigned long arg) generic_ide_ioctl() argument
H A Dide-park.c35 rq->cmd[0] = REQ_PARK_HEADS; issue_park_cmd()
52 rq->cmd[0] = REQ_UNPARK_HEADS; issue_park_cmd()
63 struct ide_cmd cmd; ide_do_park_unpark() local
64 struct ide_taskfile *tf = &cmd.tf; ide_do_park_unpark()
66 memset(&cmd, 0, sizeof(cmd)); ide_do_park_unpark()
67 if (rq->cmd[0] == REQ_PARK_HEADS) { ide_do_park_unpark()
75 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; ide_do_park_unpark()
76 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; ide_do_park_unpark()
77 } else /* cmd == REQ_UNPARK_HEADS */ ide_do_park_unpark()
80 cmd.tf_flags |= IDE_TFLAG_CUSTOM_HANDLER; ide_do_park_unpark()
81 cmd.protocol = ATA_PROT_NODATA; ide_do_park_unpark()
83 cmd.rq = rq; ide_do_park_unpark()
85 return do_rw_taskfile(drive, &cmd); ide_do_park_unpark()
H A Dide-cd_ioctl.c113 unsigned char cmd[BLK_MAX_CDB]; cdrom_eject() local
126 memset(cmd, 0, BLK_MAX_CDB); cdrom_eject()
128 cmd[0] = GPCMD_START_STOP_UNIT; cdrom_eject()
129 cmd[4] = loej | (ejectflag != 0); cdrom_eject()
131 return ide_cd_queue_pc(drive, cmd, 0, NULL, NULL, sense, 0, 0); cdrom_eject()
149 unsigned char cmd[BLK_MAX_CDB]; ide_cd_lockdoor() local
151 memset(cmd, 0, BLK_MAX_CDB); ide_cd_lockdoor()
153 cmd[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL; ide_cd_lockdoor()
154 cmd[4] = lockflag ? 1 : 0; ide_cd_lockdoor()
156 stat = ide_cd_queue_pc(drive, cmd, 0, NULL, NULL, ide_cd_lockdoor()
218 unsigned char cmd[BLK_MAX_CDB]; ide_cdrom_select_speed() local
225 memset(cmd, 0, BLK_MAX_CDB); ide_cdrom_select_speed()
227 cmd[0] = GPCMD_SET_SPEED; ide_cdrom_select_speed()
229 cmd[2] = (speed >> 8) & 0xff; ide_cdrom_select_speed()
230 cmd[3] = speed & 0xff; ide_cdrom_select_speed()
234 cmd[4] = (speed >> 8) & 0xff; ide_cdrom_select_speed()
235 cmd[5] = speed & 0xff; ide_cdrom_select_speed()
238 stat = ide_cd_queue_pc(drive, cmd, 0, NULL, NULL, &sense, 0, 0); ide_cdrom_select_speed()
276 unsigned char cmd[BLK_MAX_CDB]; ide_cdrom_get_mcn() local
279 memset(cmd, 0, BLK_MAX_CDB); ide_cdrom_get_mcn()
281 cmd[0] = GPCMD_READ_SUBCHANNEL; ide_cdrom_get_mcn()
282 cmd[1] = 2; /* MSF addressing */ ide_cdrom_get_mcn()
283 cmd[2] = 0x40; /* request subQ data */ ide_cdrom_get_mcn()
284 cmd[3] = 2; /* format */ ide_cdrom_get_mcn()
285 cmd[8] = len; ide_cdrom_get_mcn()
287 stat = ide_cd_queue_pc(drive, cmd, 0, buf, &len, NULL, 0, 0); ide_cdrom_get_mcn()
357 unsigned char cmd[BLK_MAX_CDB]; ide_cd_fake_play_trkind() local
375 memset(cmd, 0, BLK_MAX_CDB); ide_cd_fake_play_trkind()
377 cmd[0] = GPCMD_PLAY_AUDIO_MSF; ide_cd_fake_play_trkind()
378 lba_to_msf(lba_start, &cmd[3], &cmd[4], &cmd[5]); ide_cd_fake_play_trkind()
379 lba_to_msf(lba_end - 1, &cmd[6], &cmd[7], &cmd[8]); ide_cd_fake_play_trkind()
381 return ide_cd_queue_pc(drive, cmd, 0, NULL, NULL, &sense, 0, 0); ide_cd_fake_play_trkind()
427 unsigned int cmd, void *arg) ide_cdrom_audio_ioctl()
431 switch (cmd) { ide_cdrom_audio_ioctl()
471 cgc->stat = ide_cd_queue_pc(drive, cgc->cmd, ide_cdrom_packet()
426 ide_cdrom_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg) ide_cdrom_audio_ioctl() argument
H A Dide-lib.c35 u64 ide_get_lba_addr(struct ide_cmd *cmd, int lba48) ide_get_lba_addr() argument
37 struct ide_taskfile *tf = &cmd->tf; ide_get_lba_addr()
42 tf = &cmd->hob; ide_get_lba_addr()
53 struct ide_cmd cmd; ide_dump_sector() local
54 struct ide_taskfile *tf = &cmd.tf; ide_dump_sector()
57 memset(&cmd, 0, sizeof(cmd)); ide_dump_sector()
59 cmd.valid.in.tf = IDE_VALID_LBA; ide_dump_sector()
60 cmd.valid.in.hob = IDE_VALID_LBA; ide_dump_sector()
61 cmd.tf_flags = IDE_TFLAG_LBA48; ide_dump_sector()
63 cmd.valid.in.tf = IDE_VALID_LBA | IDE_VALID_DEVICE; ide_dump_sector()
65 ide_tf_readback(drive, &cmd); ide_dump_sector()
69 (unsigned long long)ide_get_lba_addr(&cmd, lba48)); ide_dump_sector()
167 drive->name, drive->hwif->cmd.tf.command); ide_dump_status()
/linux-4.4.14/drivers/net/wireless/ti/wl1251/
H A Dcmd.c1 #include "cmd.h"
23 struct wl1251_cmd_header *cmd; wl1251_cmd_send() local
28 cmd = buf; wl1251_cmd_send()
29 cmd->id = id; wl1251_cmd_send()
30 cmd->status = 0; wl1251_cmd_send()
72 wl1251_debug(DEBUG_CMD, "cmd test"); wl1251_cmd_test()
114 wl1251_debug(DEBUG_CMD, "cmd interrogate"); wl1251_cmd_interrogate()
131 if (acx->cmd.status != CMD_STATUS_SUCCESS) wl1251_cmd_interrogate()
133 acx->cmd.status); wl1251_cmd_interrogate()
152 wl1251_debug(DEBUG_CMD, "cmd configure"); wl1251_cmd_configure()
174 wl1251_debug(DEBUG_CMD, "cmd vbm"); wl1251_cmd_vbm()
185 wl1251_warning("cmd vbm len is %d B, truncating to %d", wl1251_cmd_vbm()
208 struct cmd_enabledisable_path *cmd; wl1251_cmd_data_path_rx() local
212 wl1251_debug(DEBUG_CMD, "cmd data path"); wl1251_cmd_data_path_rx()
214 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl1251_cmd_data_path_rx()
215 if (!cmd) { wl1251_cmd_data_path_rx()
220 cmd->channel = channel; wl1251_cmd_data_path_rx()
227 ret = wl1251_cmd_send(wl, cmd_rx, cmd, sizeof(*cmd)); wl1251_cmd_data_path_rx()
229 wl1251_error("rx %s cmd for channel %d failed", wl1251_cmd_data_path_rx()
234 wl1251_debug(DEBUG_BOOT, "rx %s cmd channel %d", wl1251_cmd_data_path_rx()
238 kfree(cmd); wl1251_cmd_data_path_rx()
244 struct cmd_enabledisable_path *cmd; wl1251_cmd_data_path_tx() local
248 wl1251_debug(DEBUG_CMD, "cmd data path"); wl1251_cmd_data_path_tx()
250 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl1251_cmd_data_path_tx()
251 if (!cmd) wl1251_cmd_data_path_tx()
254 cmd->channel = channel; wl1251_cmd_data_path_tx()
261 ret = wl1251_cmd_send(wl, cmd_tx, cmd, sizeof(*cmd)); wl1251_cmd_data_path_tx()
263 wl1251_error("tx %s cmd for channel %d failed", wl1251_cmd_data_path_tx()
266 wl1251_debug(DEBUG_BOOT, "tx %s cmd channel %d", wl1251_cmd_data_path_tx()
269 kfree(cmd); wl1251_cmd_data_path_tx()
286 wl1251_debug(DEBUG_CMD, "cmd join%s ch %d %d/%d", wl1251_cmd_join()
309 wl1251_error("failed to initiate cmd join"); wl1251_cmd_join()
323 wl1251_debug(DEBUG_CMD, "cmd set ps mode"); wl1251_cmd_ps_mode()
340 wl1251_error("cmd set_ps_mode failed"); wl1251_cmd_ps_mode()
352 struct cmd_read_write_memory *cmd; wl1251_cmd_read_memory() local
355 wl1251_debug(DEBUG_CMD, "cmd read memory"); wl1251_cmd_read_memory()
357 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl1251_cmd_read_memory()
358 if (!cmd) { wl1251_cmd_read_memory()
366 cmd->addr = addr; wl1251_cmd_read_memory()
367 cmd->size = len; wl1251_cmd_read_memory()
369 ret = wl1251_cmd_send(wl, CMD_READ_MEMORY, cmd, sizeof(*cmd)); wl1251_cmd_read_memory()
376 wl1251_mem_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd)); wl1251_cmd_read_memory()
378 if (cmd->header.status != CMD_STATUS_SUCCESS) wl1251_cmd_read_memory()
380 cmd->header.status); wl1251_cmd_read_memory()
382 memcpy(answer, cmd->value, len); wl1251_cmd_read_memory()
385 kfree(cmd); wl1251_cmd_read_memory()
392 struct wl1251_cmd_packet_template *cmd; wl1251_cmd_template_set() local
396 wl1251_debug(DEBUG_CMD, "cmd template %d", cmd_id); wl1251_cmd_template_set()
400 cmd_len = ALIGN(sizeof(*cmd) + buf_len, 4); wl1251_cmd_template_set()
402 cmd = kzalloc(cmd_len, GFP_KERNEL); wl1251_cmd_template_set()
403 if (!cmd) { wl1251_cmd_template_set()
408 cmd->size = cpu_to_le16(buf_len); wl1251_cmd_template_set()
411 memcpy(cmd->data, buf, buf_len); wl1251_cmd_template_set()
413 ret = wl1251_cmd_send(wl, cmd_id, cmd, cmd_len); wl1251_cmd_template_set()
415 wl1251_warning("cmd set_template failed: %d", ret); wl1251_cmd_template_set()
420 kfree(cmd); wl1251_cmd_template_set()
428 struct wl1251_cmd_scan *cmd; wl1251_cmd_scan() local
431 wl1251_debug(DEBUG_CMD, "cmd scan channels %d", n_channels); wl1251_cmd_scan()
435 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl1251_cmd_scan()
436 if (!cmd) wl1251_cmd_scan()
439 cmd->params.rx_config_options = cpu_to_le32(CFG_RX_ALL_GOOD); wl1251_cmd_scan()
440 cmd->params.rx_filter_options = cpu_to_le32(CFG_RX_PRSP_EN | wl1251_cmd_scan()
443 cmd->params.scan_options = 0; wl1251_cmd_scan()
450 cmd->params.scan_options |= cpu_to_le16(WL1251_SCAN_OPT_PRIORITY_HIGH); wl1251_cmd_scan()
451 cmd->params.num_channels = n_channels; wl1251_cmd_scan()
452 cmd->params.num_probe_requests = n_probes; wl1251_cmd_scan()
453 cmd->params.tx_rate = cpu_to_le16(1 << 1); /* 2 Mbps */ wl1251_cmd_scan()
454 cmd->params.tid_trigger = 0; wl1251_cmd_scan()
457 cmd->channels[i].min_duration = wl1251_cmd_scan()
459 cmd->channels[i].max_duration = wl1251_cmd_scan()
461 memset(&cmd->channels[i].bssid_lsb, 0xff, 4); wl1251_cmd_scan()
462 memset(&cmd->channels[i].bssid_msb, 0xff, 2); wl1251_cmd_scan()
463 cmd->channels[i].early_termination = 0; wl1251_cmd_scan()
464 cmd->channels[i].tx_power_att = 0; wl1251_cmd_scan()
465 cmd->channels[i].channel = channels[i]->hw_value; wl1251_cmd_scan()
468 cmd->params.ssid_len = ssid_len; wl1251_cmd_scan()
470 memcpy(cmd->params.ssid, ssid, ssid_len); wl1251_cmd_scan()
472 ret = wl1251_cmd_send(wl, CMD_SCAN, cmd, sizeof(*cmd)); wl1251_cmd_scan()
474 wl1251_error("cmd scan failed: %d", ret); wl1251_cmd_scan()
478 wl1251_mem_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd)); wl1251_cmd_scan()
480 if (cmd->header.status != CMD_STATUS_SUCCESS) { wl1251_cmd_scan()
481 wl1251_error("cmd scan status wasn't success: %d", wl1251_cmd_scan()
482 cmd->header.status); wl1251_cmd_scan()
488 kfree(cmd); wl1251_cmd_scan()
494 struct wl1251_cmd_trigger_scan_to *cmd; wl1251_cmd_trigger_scan_to() local
497 wl1251_debug(DEBUG_CMD, "cmd trigger scan to"); wl1251_cmd_trigger_scan_to()
499 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl1251_cmd_trigger_scan_to()
500 if (!cmd) wl1251_cmd_trigger_scan_to()
503 cmd->timeout = timeout; wl1251_cmd_trigger_scan_to()
505 ret = wl1251_cmd_send(wl, CMD_TRIGGER_SCAN_TO, cmd, sizeof(*cmd)); wl1251_cmd_trigger_scan_to()
507 wl1251_error("cmd trigger scan to failed: %d", ret); wl1251_cmd_trigger_scan_to()
512 kfree(cmd); wl1251_cmd_trigger_scan_to()
H A Dspi.c59 u8 *cmd; wl1251_spi_reset() local
63 cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); wl1251_spi_reset()
64 if (!cmd) { wl1251_spi_reset()
65 wl1251_error("could not allocate cmd for spi reset"); wl1251_spi_reset()
72 memset(cmd, 0xff, WSPI_INIT_CMD_LEN); wl1251_spi_reset()
74 t.tx_buf = cmd; wl1251_spi_reset()
80 wl1251_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN); wl1251_spi_reset()
82 kfree(cmd); wl1251_spi_reset()
89 u8 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); wl1251_spi_wake() local
91 if (!cmd) { wl1251_spi_wake()
92 wl1251_error("could not allocate cmd for spi init"); wl1251_spi_wake()
102 cmd[0] = 0xff; wl1251_spi_wake()
103 cmd[1] = 0xff; wl1251_spi_wake()
104 cmd[2] = WSPI_INIT_CMD_START | WSPI_INIT_CMD_TX; wl1251_spi_wake()
105 cmd[3] = 0; wl1251_spi_wake()
106 cmd[4] = 0; wl1251_spi_wake()
107 cmd[5] = HW_ACCESS_WSPI_INIT_CMD_MASK << 3; wl1251_spi_wake()
108 cmd[5] |= HW_ACCESS_WSPI_FIXED_BUSY_LEN & WSPI_INIT_CMD_FIXEDBUSY_LEN; wl1251_spi_wake()
110 cmd[6] = WSPI_INIT_CMD_IOD | WSPI_INIT_CMD_IP | WSPI_INIT_CMD_CS wl1251_spi_wake()
114 cmd[6] |= WSPI_INIT_CMD_DIS_FIXEDBUSY; wl1251_spi_wake()
116 cmd[6] |= WSPI_INIT_CMD_EN_FIXEDBUSY; wl1251_spi_wake()
118 cmd[7] = crc7_be(0, cmd+2, WSPI_INIT_CMD_CRC_LEN) | WSPI_INIT_CMD_END; wl1251_spi_wake()
123 __swab32s((u32 *)cmd); wl1251_spi_wake()
124 __swab32s((u32 *)cmd+1); wl1251_spi_wake()
126 t.tx_buf = cmd; wl1251_spi_wake()
132 wl1251_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN); wl1251_spi_wake()
134 kfree(cmd); wl1251_spi_wake()
149 u32 *cmd; wl1251_spi_read() local
151 cmd = &wl->buffer_cmd; wl1251_spi_read()
154 *cmd = 0; wl1251_spi_read()
155 *cmd |= WSPI_CMD_READ; wl1251_spi_read()
156 *cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH; wl1251_spi_read()
157 *cmd |= addr & WSPI_CMD_BYTE_ADDR; wl1251_spi_read()
162 t[0].tx_buf = cmd; wl1251_spi_read()
179 wl1251_dump(DEBUG_SPI, "spi_read cmd -> ", cmd, sizeof(*cmd)); wl1251_spi_read()
188 u32 *cmd; wl1251_spi_write() local
190 cmd = &wl->buffer_cmd; wl1251_spi_write()
192 *cmd = 0; wl1251_spi_write()
193 *cmd |= WSPI_CMD_WRITE; wl1251_spi_write()
194 *cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH; wl1251_spi_write()
195 *cmd |= addr & WSPI_CMD_BYTE_ADDR; wl1251_spi_write()
200 t[0].tx_buf = cmd; wl1251_spi_write()
201 t[0].len = sizeof(*cmd); wl1251_spi_write()
210 wl1251_dump(DEBUG_SPI, "spi_write cmd -> ", cmd, sizeof(*cmd)); wl1251_spi_write()
H A DMakefile1 wl1251-objs = main.o event.o tx.o rx.o ps.o cmd.o \
/linux-4.4.14/drivers/staging/fsl-mc/bus/
H A Ddprc.c33 #include "../include/mc-cmd.h"
35 #include "dprc-cmd.h"
53 struct mc_command cmd = { 0 }; dprc_open() local
57 cmd.header = mc_encode_cmd_header(DPRC_CMDID_OPEN, cmd_flags, dprc_open()
59 cmd.params[0] |= mc_enc(0, 32, container_id); dprc_open()
62 err = mc_send_command(mc_io, &cmd); dprc_open()
67 *token = MC_CMD_HDR_READ_TOKEN(cmd.header); dprc_open()
88 struct mc_command cmd = { 0 }; dprc_close() local
91 cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLOSE, cmd_flags, dprc_close()
95 return mc_send_command(mc_io, &cmd); dprc_close()
117 struct mc_command cmd = { 0 }; dprc_create_container() local
121 cmd.params[0] |= mc_enc(32, 16, cfg->icid); dprc_create_container()
122 cmd.params[0] |= mc_enc(0, 32, cfg->options); dprc_create_container()
123 cmd.params[1] |= mc_enc(32, 32, cfg->portal_id); dprc_create_container()
124 cmd.params[2] |= mc_enc(0, 8, cfg->label[0]); dprc_create_container()
125 cmd.params[2] |= mc_enc(8, 8, cfg->label[1]); dprc_create_container()
126 cmd.params[2] |= mc_enc(16, 8, cfg->label[2]); dprc_create_container()
127 cmd.params[2] |= mc_enc(24, 8, cfg->label[3]); dprc_create_container()
128 cmd.params[2] |= mc_enc(32, 8, cfg->label[4]); dprc_create_container()
129 cmd.params[2] |= mc_enc(40, 8, cfg->label[5]); dprc_create_container()
130 cmd.params[2] |= mc_enc(48, 8, cfg->label[6]); dprc_create_container()
131 cmd.params[2] |= mc_enc(56, 8, cfg->label[7]); dprc_create_container()
132 cmd.params[3] |= mc_enc(0, 8, cfg->label[8]); dprc_create_container()
133 cmd.params[3] |= mc_enc(8, 8, cfg->label[9]); dprc_create_container()
134 cmd.params[3] |= mc_enc(16, 8, cfg->label[10]); dprc_create_container()
135 cmd.params[3] |= mc_enc(24, 8, cfg->label[11]); dprc_create_container()
136 cmd.params[3] |= mc_enc(32, 8, cfg->label[12]); dprc_create_container()
137 cmd.params[3] |= mc_enc(40, 8, cfg->label[13]); dprc_create_container()
138 cmd.params[3] |= mc_enc(48, 8, cfg->label[14]); dprc_create_container()
139 cmd.params[3] |= mc_enc(56, 8, cfg->label[15]); dprc_create_container()
141 cmd.header = mc_encode_cmd_header(DPRC_CMDID_CREATE_CONT, dprc_create_container()
145 err = mc_send_command(mc_io, &cmd); dprc_create_container()
150 *child_container_id = mc_dec(cmd.params[1], 0, 32); dprc_create_container()
151 *child_portal_offset = mc_dec(cmd.params[2], 0, 64); dprc_create_container()
183 struct mc_command cmd = { 0 }; dprc_destroy_container() local
186 cmd.header = mc_encode_cmd_header(DPRC_CMDID_DESTROY_CONT, dprc_destroy_container()
188 cmd.params[0] |= mc_enc(0, 32, child_container_id); dprc_destroy_container()
191 return mc_send_command(mc_io, &cmd); dprc_destroy_container()
221 struct mc_command cmd = { 0 }; dprc_reset_container() local
224 cmd.header = mc_encode_cmd_header(DPRC_CMDID_RESET_CONT, dprc_reset_container()
226 cmd.params[0] |= mc_enc(0, 32, child_container_id); dprc_reset_container()
229 return mc_send_command(mc_io, &cmd); dprc_reset_container()
251 struct mc_command cmd = { 0 }; dprc_get_irq() local
255 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ, dprc_get_irq()
258 cmd.params[0] |= mc_enc(32, 8, irq_index); dprc_get_irq()
261 err = mc_send_command(mc_io, &cmd); dprc_get_irq()
266 irq_cfg->val = mc_dec(cmd.params[0], 0, 32); dprc_get_irq()
267 irq_cfg->paddr = mc_dec(cmd.params[1], 0, 64); dprc_get_irq()
268 irq_cfg->user_irq_id = mc_dec(cmd.params[2], 0, 32); dprc_get_irq()
269 *type = mc_dec(cmd.params[2], 32, 32); dprc_get_irq()
290 struct mc_command cmd = { 0 }; dprc_set_irq() local
293 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ, dprc_set_irq()
296 cmd.params[0] |= mc_enc(32, 8, irq_index); dprc_set_irq()
297 cmd.params[0] |= mc_enc(0, 32, irq_cfg->val); dprc_set_irq()
298 cmd.params[1] |= mc_enc(0, 64, irq_cfg->paddr); dprc_set_irq()
299 cmd.params[2] |= mc_enc(0, 32, irq_cfg->user_irq_id); dprc_set_irq()
302 return mc_send_command(mc_io, &cmd); dprc_set_irq()
321 struct mc_command cmd = { 0 }; dprc_get_irq_enable() local
325 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_ENABLE, dprc_get_irq_enable()
327 cmd.params[0] |= mc_enc(32, 8, irq_index); dprc_get_irq_enable()
330 err = mc_send_command(mc_io, &cmd); dprc_get_irq_enable()
335 *en = mc_dec(cmd.params[0], 0, 8); dprc_get_irq_enable()
361 struct mc_command cmd = { 0 }; dprc_set_irq_enable() local
364 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ_ENABLE, dprc_set_irq_enable()
366 cmd.params[0] |= mc_enc(0, 8, en); dprc_set_irq_enable()
367 cmd.params[0] |= mc_enc(32, 8, irq_index); dprc_set_irq_enable()
370 return mc_send_command(mc_io, &cmd); dprc_set_irq_enable()
392 struct mc_command cmd = { 0 }; dprc_get_irq_mask() local
396 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_MASK, dprc_get_irq_mask()
398 cmd.params[0] |= mc_enc(32, 8, irq_index); dprc_get_irq_mask()
401 err = mc_send_command(mc_io, &cmd); dprc_get_irq_mask()
406 *mask = mc_dec(cmd.params[0], 0, 32); dprc_get_irq_mask()
433 struct mc_command cmd = { 0 }; dprc_set_irq_mask() local
436 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ_MASK, dprc_set_irq_mask()
438 cmd.params[0] |= mc_enc(0, 32, mask); dprc_set_irq_mask()
439 cmd.params[0] |= mc_enc(32, 8, irq_index); dprc_set_irq_mask()
442 return mc_send_command(mc_io, &cmd); dprc_set_irq_mask()
463 struct mc_command cmd = { 0 }; dprc_get_irq_status() local
467 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_STATUS, dprc_get_irq_status()
469 cmd.params[0] |= mc_enc(32, 8, irq_index); dprc_get_irq_status()
472 err = mc_send_command(mc_io, &cmd); dprc_get_irq_status()
477 *status = mc_dec(cmd.params[0], 0, 32); dprc_get_irq_status()
500 struct mc_command cmd = { 0 }; dprc_clear_irq_status() local
503 cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLEAR_IRQ_STATUS, dprc_clear_irq_status()
505 cmd.params[0] |= mc_enc(0, 32, status); dprc_clear_irq_status()
506 cmd.params[0] |= mc_enc(32, 8, irq_index); dprc_clear_irq_status()
509 return mc_send_command(mc_io, &cmd); dprc_clear_irq_status()
526 struct mc_command cmd = { 0 }; dprc_get_attributes() local
530 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_ATTR, dprc_get_attributes()
535 err = mc_send_command(mc_io, &cmd); dprc_get_attributes()
540 attr->container_id = mc_dec(cmd.params[0], 0, 32); dprc_get_attributes()
541 attr->icid = mc_dec(cmd.params[0], 32, 16); dprc_get_attributes()
542 attr->options = mc_dec(cmd.params[1], 0, 32); dprc_get_attributes()
543 attr->portal_id = mc_dec(cmd.params[1], 32, 32); dprc_get_attributes()
544 attr->version.major = mc_dec(cmd.params[2], 0, 16); dprc_get_attributes()
545 attr->version.minor = mc_dec(cmd.params[2], 16, 16); dprc_get_attributes()
582 struct mc_command cmd = { 0 }; dprc_set_res_quota() local
585 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_RES_QUOTA, dprc_set_res_quota()
587 cmd.params[0] |= mc_enc(0, 32, child_container_id); dprc_set_res_quota()
588 cmd.params[0] |= mc_enc(32, 16, quota); dprc_set_res_quota()
589 cmd.params[1] |= mc_enc(0, 8, type[0]); dprc_set_res_quota()
590 cmd.params[1] |= mc_enc(8, 8, type[1]); dprc_set_res_quota()
591 cmd.params[1] |= mc_enc(16, 8, type[2]); dprc_set_res_quota()
592 cmd.params[1] |= mc_enc(24, 8, type[3]); dprc_set_res_quota()
593 cmd.params[1] |= mc_enc(32, 8, type[4]); dprc_set_res_quota()
594 cmd.params[1] |= mc_enc(40, 8, type[5]); dprc_set_res_quota()
595 cmd.params[1] |= mc_enc(48, 8, type[6]); dprc_set_res_quota()
596 cmd.params[1] |= mc_enc(56, 8, type[7]); dprc_set_res_quota()
597 cmd.params[2] |= mc_enc(0, 8, type[8]); dprc_set_res_quota()
598 cmd.params[2] |= mc_enc(8, 8, type[9]); dprc_set_res_quota()
599 cmd.params[2] |= mc_enc(16, 8, type[10]); dprc_set_res_quota()
600 cmd.params[2] |= mc_enc(24, 8, type[11]); dprc_set_res_quota()
601 cmd.params[2] |= mc_enc(32, 8, type[12]); dprc_set_res_quota()
602 cmd.params[2] |= mc_enc(40, 8, type[13]); dprc_set_res_quota()
603 cmd.params[2] |= mc_enc(48, 8, type[14]); dprc_set_res_quota()
604 cmd.params[2] |= mc_enc(56, 8, '\0'); dprc_set_res_quota()
607 return mc_send_command(mc_io, &cmd); dprc_set_res_quota()
632 struct mc_command cmd = { 0 }; dprc_get_res_quota() local
636 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_QUOTA, dprc_get_res_quota()
638 cmd.params[0] |= mc_enc(0, 32, child_container_id); dprc_get_res_quota()
639 cmd.params[1] |= mc_enc(0, 8, type[0]); dprc_get_res_quota()
640 cmd.params[1] |= mc_enc(8, 8, type[1]); dprc_get_res_quota()
641 cmd.params[1] |= mc_enc(16, 8, type[2]); dprc_get_res_quota()
642 cmd.params[1] |= mc_enc(24, 8, type[3]); dprc_get_res_quota()
643 cmd.params[1] |= mc_enc(32, 8, type[4]); dprc_get_res_quota()
644 cmd.params[1] |= mc_enc(40, 8, type[5]); dprc_get_res_quota()
645 cmd.params[1] |= mc_enc(48, 8, type[6]); dprc_get_res_quota()
646 cmd.params[1] |= mc_enc(56, 8, type[7]); dprc_get_res_quota()
647 cmd.params[2] |= mc_enc(0, 8, type[8]); dprc_get_res_quota()
648 cmd.params[2] |= mc_enc(8, 8, type[9]); dprc_get_res_quota()
649 cmd.params[2] |= mc_enc(16, 8, type[10]); dprc_get_res_quota()
650 cmd.params[2] |= mc_enc(24, 8, type[11]); dprc_get_res_quota()
651 cmd.params[2] |= mc_enc(32, 8, type[12]); dprc_get_res_quota()
652 cmd.params[2] |= mc_enc(40, 8, type[13]); dprc_get_res_quota()
653 cmd.params[2] |= mc_enc(48, 8, type[14]); dprc_get_res_quota()
654 cmd.params[2] |= mc_enc(56, 8, '\0'); dprc_get_res_quota()
657 err = mc_send_command(mc_io, &cmd); dprc_get_res_quota()
662 *quota = mc_dec(cmd.params[0], 32, 16); dprc_get_res_quota()
705 struct mc_command cmd = { 0 }; dprc_assign() local
708 cmd.header = mc_encode_cmd_header(DPRC_CMDID_ASSIGN, dprc_assign()
710 cmd.params[0] |= mc_enc(0, 32, container_id); dprc_assign()
711 cmd.params[0] |= mc_enc(32, 32, res_req->options); dprc_assign()
712 cmd.params[1] |= mc_enc(0, 32, res_req->num); dprc_assign()
713 cmd.params[1] |= mc_enc(32, 32, res_req->id_base_align); dprc_assign()
714 cmd.params[2] |= mc_enc(0, 8, res_req->type[0]); dprc_assign()
715 cmd.params[2] |= mc_enc(8, 8, res_req->type[1]); dprc_assign()
716 cmd.params[2] |= mc_enc(16, 8, res_req->type[2]); dprc_assign()
717 cmd.params[2] |= mc_enc(24, 8, res_req->type[3]); dprc_assign()
718 cmd.params[2] |= mc_enc(32, 8, res_req->type[4]); dprc_assign()
719 cmd.params[2] |= mc_enc(40, 8, res_req->type[5]); dprc_assign()
720 cmd.params[2] |= mc_enc(48, 8, res_req->type[6]); dprc_assign()
721 cmd.params[2] |= mc_enc(56, 8, res_req->type[7]); dprc_assign()
722 cmd.params[3] |= mc_enc(0, 8, res_req->type[8]); dprc_assign()
723 cmd.params[3] |= mc_enc(8, 8, res_req->type[9]); dprc_assign()
724 cmd.params[3] |= mc_enc(16, 8, res_req->type[10]); dprc_assign()
725 cmd.params[3] |= mc_enc(24, 8, res_req->type[11]); dprc_assign()
726 cmd.params[3] |= mc_enc(32, 8, res_req->type[12]); dprc_assign()
727 cmd.params[3] |= mc_enc(40, 8, res_req->type[13]); dprc_assign()
728 cmd.params[3] |= mc_enc(48, 8, res_req->type[14]); dprc_assign()
729 cmd.params[3] |= mc_enc(56, 8, res_req->type[15]); dprc_assign()
732 return mc_send_command(mc_io, &cmd); dprc_assign()
756 struct mc_command cmd = { 0 }; dprc_unassign() local
759 cmd.header = mc_encode_cmd_header(DPRC_CMDID_UNASSIGN, dprc_unassign()
762 cmd.params[0] |= mc_enc(0, 32, child_container_id); dprc_unassign()
763 cmd.params[0] |= mc_enc(32, 32, res_req->options); dprc_unassign()
764 cmd.params[1] |= mc_enc(0, 32, res_req->num); dprc_unassign()
765 cmd.params[1] |= mc_enc(32, 32, res_req->id_base_align); dprc_unassign()
766 cmd.params[2] |= mc_enc(0, 8, res_req->type[0]); dprc_unassign()
767 cmd.params[2] |= mc_enc(8, 8, res_req->type[1]); dprc_unassign()
768 cmd.params[2] |= mc_enc(16, 8, res_req->type[2]); dprc_unassign()
769 cmd.params[2] |= mc_enc(24, 8, res_req->type[3]); dprc_unassign()
770 cmd.params[2] |= mc_enc(32, 8, res_req->type[4]); dprc_unassign()
771 cmd.params[2] |= mc_enc(40, 8, res_req->type[5]); dprc_unassign()
772 cmd.params[2] |= mc_enc(48, 8, res_req->type[6]); dprc_unassign()
773 cmd.params[2] |= mc_enc(56, 8, res_req->type[7]); dprc_unassign()
774 cmd.params[3] |= mc_enc(0, 8, res_req->type[8]); dprc_unassign()
775 cmd.params[3] |= mc_enc(8, 8, res_req->type[9]); dprc_unassign()
776 cmd.params[3] |= mc_enc(16, 8, res_req->type[10]); dprc_unassign()
777 cmd.params[3] |= mc_enc(24, 8, res_req->type[11]); dprc_unassign()
778 cmd.params[3] |= mc_enc(32, 8, res_req->type[12]); dprc_unassign()
779 cmd.params[3] |= mc_enc(40, 8, res_req->type[13]); dprc_unassign()
780 cmd.params[3] |= mc_enc(48, 8, res_req->type[14]); dprc_unassign()
781 cmd.params[3] |= mc_enc(56, 8, res_req->type[15]); dprc_unassign()
784 return mc_send_command(mc_io, &cmd); dprc_unassign()
801 struct mc_command cmd = { 0 }; dprc_get_pool_count() local
805 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_POOL_COUNT, dprc_get_pool_count()
809 err = mc_send_command(mc_io, &cmd); dprc_get_pool_count()
814 *pool_count = mc_dec(cmd.params[0], 0, 32); dprc_get_pool_count()
840 struct mc_command cmd = { 0 }; dprc_get_pool() local
844 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_POOL, dprc_get_pool()
847 cmd.params[0] |= mc_enc(0, 32, pool_index); dprc_get_pool()
850 err = mc_send_command(mc_io, &cmd); dprc_get_pool()
855 type[0] = mc_dec(cmd.params[1], 0, 8); dprc_get_pool()
856 type[1] = mc_dec(cmd.params[1], 8, 8); dprc_get_pool()
857 type[2] = mc_dec(cmd.params[1], 16, 8); dprc_get_pool()
858 type[3] = mc_dec(cmd.params[1], 24, 8); dprc_get_pool()
859 type[4] = mc_dec(cmd.params[1], 32, 8); dprc_get_pool()
860 type[5] = mc_dec(cmd.params[1], 40, 8); dprc_get_pool()
861 type[6] = mc_dec(cmd.params[1], 48, 8); dprc_get_pool()
862 type[7] = mc_dec(cmd.params[1], 56, 8); dprc_get_pool()
863 type[8] = mc_dec(cmd.params[2], 0, 8); dprc_get_pool()
864 type[9] = mc_dec(cmd.params[2], 8, 8); dprc_get_pool()
865 type[10] = mc_dec(cmd.params[2], 16, 8); dprc_get_pool()
866 type[11] = mc_dec(cmd.params[2], 24, 8); dprc_get_pool()
867 type[12] = mc_dec(cmd.params[2], 32, 8); dprc_get_pool()
868 type[13] = mc_dec(cmd.params[2], 40, 8); dprc_get_pool()
869 type[14] = mc_dec(cmd.params[2], 48, 8); dprc_get_pool()
889 struct mc_command cmd = { 0 }; dprc_get_obj_count() local
893 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_COUNT, dprc_get_obj_count()
897 err = mc_send_command(mc_io, &cmd); dprc_get_obj_count()
902 *obj_count = mc_dec(cmd.params[0], 32, 32); dprc_get_obj_count()
929 struct mc_command cmd = { 0 }; dprc_get_obj() local
933 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ, dprc_get_obj()
936 cmd.params[0] |= mc_enc(0, 32, obj_index); dprc_get_obj()
939 err = mc_send_command(mc_io, &cmd); dprc_get_obj()
944 obj_desc->id = mc_dec(cmd.params[0], 32, 32); dprc_get_obj()
945 obj_desc->vendor = mc_dec(cmd.params[1], 0, 16); dprc_get_obj()
946 obj_desc->irq_count = mc_dec(cmd.params[1], 16, 8); dprc_get_obj()
947 obj_desc->region_count = mc_dec(cmd.params[1], 24, 8); dprc_get_obj()
948 obj_desc->state = mc_dec(cmd.params[1], 32, 32); dprc_get_obj()
949 obj_desc->ver_major = mc_dec(cmd.params[2], 0, 16); dprc_get_obj()
950 obj_desc->ver_minor = mc_dec(cmd.params[2], 16, 16); dprc_get_obj()
951 obj_desc->type[0] = mc_dec(cmd.params[3], 0, 8); dprc_get_obj()
952 obj_desc->type[1] = mc_dec(cmd.params[3], 8, 8); dprc_get_obj()
953 obj_desc->type[2] = mc_dec(cmd.params[3], 16, 8); dprc_get_obj()
954 obj_desc->type[3] = mc_dec(cmd.params[3], 24, 8); dprc_get_obj()
955 obj_desc->type[4] = mc_dec(cmd.params[3], 32, 8); dprc_get_obj()
956 obj_desc->type[5] = mc_dec(cmd.params[3], 40, 8); dprc_get_obj()
957 obj_desc->type[6] = mc_dec(cmd.params[3], 48, 8); dprc_get_obj()
958 obj_desc->type[7] = mc_dec(cmd.params[3], 56, 8); dprc_get_obj()
959 obj_desc->type[8] = mc_dec(cmd.params[4], 0, 8); dprc_get_obj()
960 obj_desc->type[9] = mc_dec(cmd.params[4], 8, 8); dprc_get_obj()
961 obj_desc->type[10] = mc_dec(cmd.params[4], 16, 8); dprc_get_obj()
962 obj_desc->type[11] = mc_dec(cmd.params[4], 24, 8); dprc_get_obj()
963 obj_desc->type[12] = mc_dec(cmd.params[4], 32, 8); dprc_get_obj()
964 obj_desc->type[13] = mc_dec(cmd.params[4], 40, 8); dprc_get_obj()
965 obj_desc->type[14] = mc_dec(cmd.params[4], 48, 8); dprc_get_obj()
967 obj_desc->label[0] = mc_dec(cmd.params[5], 0, 8); dprc_get_obj()
968 obj_desc->label[1] = mc_dec(cmd.params[5], 8, 8); dprc_get_obj()
969 obj_desc->label[2] = mc_dec(cmd.params[5], 16, 8); dprc_get_obj()
970 obj_desc->label[3] = mc_dec(cmd.params[5], 24, 8); dprc_get_obj()
971 obj_desc->label[4] = mc_dec(cmd.params[5], 32, 8); dprc_get_obj()
972 obj_desc->label[5] = mc_dec(cmd.params[5], 40, 8); dprc_get_obj()
973 obj_desc->label[6] = mc_dec(cmd.params[5], 48, 8); dprc_get_obj()
974 obj_desc->label[7] = mc_dec(cmd.params[5], 56, 8); dprc_get_obj()
975 obj_desc->label[8] = mc_dec(cmd.params[6], 0, 8); dprc_get_obj()
976 obj_desc->label[9] = mc_dec(cmd.params[6], 8, 8); dprc_get_obj()
977 obj_desc->label[10] = mc_dec(cmd.params[6], 16, 8); dprc_get_obj()
978 obj_desc->label[11] = mc_dec(cmd.params[6], 24, 8); dprc_get_obj()
979 obj_desc->label[12] = mc_dec(cmd.params[6], 32, 8); dprc_get_obj()
980 obj_desc->label[13] = mc_dec(cmd.params[6], 40, 8); dprc_get_obj()
981 obj_desc->label[14] = mc_dec(cmd.params[6], 48, 8); dprc_get_obj()
1007 struct mc_command cmd = { 0 }; dprc_get_obj_desc() local
1011 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_DESC, dprc_get_obj_desc()
1014 cmd.params[0] |= mc_enc(0, 32, obj_id); dprc_get_obj_desc()
1015 cmd.params[1] |= mc_enc(0, 8, obj_type[0]); dprc_get_obj_desc()
1016 cmd.params[1] |= mc_enc(8, 8, obj_type[1]); dprc_get_obj_desc()
1017 cmd.params[1] |= mc_enc(16, 8, obj_type[2]); dprc_get_obj_desc()
1018 cmd.params[1] |= mc_enc(24, 8, obj_type[3]); dprc_get_obj_desc()
1019 cmd.params[1] |= mc_enc(32, 8, obj_type[4]); dprc_get_obj_desc()
1020 cmd.params[1] |= mc_enc(40, 8, obj_type[5]); dprc_get_obj_desc()
1021 cmd.params[1] |= mc_enc(48, 8, obj_type[6]); dprc_get_obj_desc()
1022 cmd.params[1] |= mc_enc(56, 8, obj_type[7]); dprc_get_obj_desc()
1023 cmd.params[2] |= mc_enc(0, 8, obj_type[8]); dprc_get_obj_desc()
1024 cmd.params[2] |= mc_enc(8, 8, obj_type[9]); dprc_get_obj_desc()
1025 cmd.params[2] |= mc_enc(16, 8, obj_type[10]); dprc_get_obj_desc()
1026 cmd.params[2] |= mc_enc(24, 8, obj_type[11]); dprc_get_obj_desc()
1027 cmd.params[2] |= mc_enc(32, 8, obj_type[12]); dprc_get_obj_desc()
1028 cmd.params[2] |= mc_enc(40, 8, obj_type[13]); dprc_get_obj_desc()
1029 cmd.params[2] |= mc_enc(48, 8, obj_type[14]); dprc_get_obj_desc()
1030 cmd.params[2] |= mc_enc(56, 8, obj_type[15]); dprc_get_obj_desc()
1033 err = mc_send_command(mc_io, &cmd); dprc_get_obj_desc()
1038 obj_desc->id = (int)mc_dec(cmd.params[0], 32, 32); dprc_get_obj_desc()
1039 obj_desc->vendor = (u16)mc_dec(cmd.params[1], 0, 16); dprc_get_obj_desc()
1040 obj_desc->vendor = (u8)mc_dec(cmd.params[1], 16, 8); dprc_get_obj_desc()
1041 obj_desc->region_count = (u8)mc_dec(cmd.params[1], 24, 8); dprc_get_obj_desc()
1042 obj_desc->state = (u32)mc_dec(cmd.params[1], 32, 32); dprc_get_obj_desc()
1043 obj_desc->ver_major = (u16)mc_dec(cmd.params[2], 0, 16); dprc_get_obj_desc()
1044 obj_desc->ver_minor = (u16)mc_dec(cmd.params[2], 16, 16); dprc_get_obj_desc()
1045 obj_desc->type[0] = (char)mc_dec(cmd.params[3], 0, 8); dprc_get_obj_desc()
1046 obj_desc->type[1] = (char)mc_dec(cmd.params[3], 8, 8); dprc_get_obj_desc()
1047 obj_desc->type[2] = (char)mc_dec(cmd.params[3], 16, 8); dprc_get_obj_desc()
1048 obj_desc->type[3] = (char)mc_dec(cmd.params[3], 24, 8); dprc_get_obj_desc()
1049 obj_desc->type[4] = (char)mc_dec(cmd.params[3], 32, 8); dprc_get_obj_desc()
1050 obj_desc->type[5] = (char)mc_dec(cmd.params[3], 40, 8); dprc_get_obj_desc()
1051 obj_desc->type[6] = (char)mc_dec(cmd.params[3], 48, 8); dprc_get_obj_desc()
1052 obj_desc->type[7] = (char)mc_dec(cmd.params[3], 56, 8); dprc_get_obj_desc()
1053 obj_desc->type[8] = (char)mc_dec(cmd.params[4], 0, 8); dprc_get_obj_desc()
1054 obj_desc->type[9] = (char)mc_dec(cmd.params[4], 8, 8); dprc_get_obj_desc()
1055 obj_desc->type[10] = (char)mc_dec(cmd.params[4], 16, 8); dprc_get_obj_desc()
1056 obj_desc->type[11] = (char)mc_dec(cmd.params[4], 24, 8); dprc_get_obj_desc()
1057 obj_desc->type[12] = (char)mc_dec(cmd.params[4], 32, 8); dprc_get_obj_desc()
1058 obj_desc->type[13] = (char)mc_dec(cmd.params[4], 40, 8); dprc_get_obj_desc()
1059 obj_desc->type[14] = (char)mc_dec(cmd.params[4], 48, 8); dprc_get_obj_desc()
1060 obj_desc->type[15] = (char)mc_dec(cmd.params[4], 56, 8); dprc_get_obj_desc()
1061 obj_desc->label[0] = (char)mc_dec(cmd.params[5], 0, 8); dprc_get_obj_desc()
1062 obj_desc->label[1] = (char)mc_dec(cmd.params[5], 8, 8); dprc_get_obj_desc()
1063 obj_desc->label[2] = (char)mc_dec(cmd.params[5], 16, 8); dprc_get_obj_desc()
1064 obj_desc->label[3] = (char)mc_dec(cmd.params[5], 24, 8); dprc_get_obj_desc()
1065 obj_desc->label[4] = (char)mc_dec(cmd.params[5], 32, 8); dprc_get_obj_desc()
1066 obj_desc->label[5] = (char)mc_dec(cmd.params[5], 40, 8); dprc_get_obj_desc()
1067 obj_desc->label[6] = (char)mc_dec(cmd.params[5], 48, 8); dprc_get_obj_desc()
1068 obj_desc->label[7] = (char)mc_dec(cmd.params[5], 56, 8); dprc_get_obj_desc()
1069 obj_desc->label[8] = (char)mc_dec(cmd.params[6], 0, 8); dprc_get_obj_desc()
1070 obj_desc->label[9] = (char)mc_dec(cmd.params[6], 8, 8); dprc_get_obj_desc()
1071 obj_desc->label[10] = (char)mc_dec(cmd.params[6], 16, 8); dprc_get_obj_desc()
1072 obj_desc->label[11] = (char)mc_dec(cmd.params[6], 24, 8); dprc_get_obj_desc()
1073 obj_desc->label[12] = (char)mc_dec(cmd.params[6], 32, 8); dprc_get_obj_desc()
1074 obj_desc->label[13] = (char)mc_dec(cmd.params[6], 40, 8); dprc_get_obj_desc()
1075 obj_desc->label[14] = (char)mc_dec(cmd.params[6], 48, 8); dprc_get_obj_desc()
1076 obj_desc->label[15] = (char)mc_dec(cmd.params[6], 56, 8); dprc_get_obj_desc()
1102 struct mc_command cmd = { 0 }; dprc_set_obj_irq() local
1105 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_OBJ_IRQ, dprc_set_obj_irq()
1108 cmd.params[0] |= mc_enc(32, 8, irq_index); dprc_set_obj_irq()
1109 cmd.params[0] |= mc_enc(0, 32, irq_cfg->val); dprc_set_obj_irq()
1110 cmd.params[1] |= mc_enc(0, 64, irq_cfg->paddr); dprc_set_obj_irq()
1111 cmd.params[2] |= mc_enc(0, 32, irq_cfg->user_irq_id); dprc_set_obj_irq()
1112 cmd.params[2] |= mc_enc(32, 32, obj_id); dprc_set_obj_irq()
1113 cmd.params[3] |= mc_enc(0, 8, obj_type[0]); dprc_set_obj_irq()
1114 cmd.params[3] |= mc_enc(8, 8, obj_type[1]); dprc_set_obj_irq()
1115 cmd.params[3] |= mc_enc(16, 8, obj_type[2]); dprc_set_obj_irq()
1116 cmd.params[3] |= mc_enc(24, 8, obj_type[3]); dprc_set_obj_irq()
1117 cmd.params[3] |= mc_enc(32, 8, obj_type[4]); dprc_set_obj_irq()
1118 cmd.params[3] |= mc_enc(40, 8, obj_type[5]); dprc_set_obj_irq()
1119 cmd.params[3] |= mc_enc(48, 8, obj_type[6]); dprc_set_obj_irq()
1120 cmd.params[3] |= mc_enc(56, 8, obj_type[7]); dprc_set_obj_irq()
1121 cmd.params[4] |= mc_enc(0, 8, obj_type[8]); dprc_set_obj_irq()
1122 cmd.params[4] |= mc_enc(8, 8, obj_type[9]); dprc_set_obj_irq()
1123 cmd.params[4] |= mc_enc(16, 8, obj_type[10]); dprc_set_obj_irq()
1124 cmd.params[4] |= mc_enc(24, 8, obj_type[11]); dprc_set_obj_irq()
1125 cmd.params[4] |= mc_enc(32, 8, obj_type[12]); dprc_set_obj_irq()
1126 cmd.params[4] |= mc_enc(40, 8, obj_type[13]); dprc_set_obj_irq()
1127 cmd.params[4] |= mc_enc(48, 8, obj_type[14]); dprc_set_obj_irq()
1128 cmd.params[4] |= mc_enc(56, 8, obj_type[15]); dprc_set_obj_irq()
1131 return mc_send_command(mc_io, &cmd); dprc_set_obj_irq()
1158 struct mc_command cmd = { 0 }; dprc_get_obj_irq() local
1162 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_IRQ, dprc_get_obj_irq()
1165 cmd.params[0] |= mc_enc(0, 32, obj_id); dprc_get_obj_irq()
1166 cmd.params[0] |= mc_enc(32, 8, irq_index); dprc_get_obj_irq()
1167 cmd.params[1] |= mc_enc(0, 8, obj_type[0]); dprc_get_obj_irq()
1168 cmd.params[1] |= mc_enc(8, 8, obj_type[1]); dprc_get_obj_irq()
1169 cmd.params[1] |= mc_enc(16, 8, obj_type[2]); dprc_get_obj_irq()
1170 cmd.params[1] |= mc_enc(24, 8, obj_type[3]); dprc_get_obj_irq()
1171 cmd.params[1] |= mc_enc(32, 8, obj_type[4]); dprc_get_obj_irq()
1172 cmd.params[1] |= mc_enc(40, 8, obj_type[5]); dprc_get_obj_irq()
1173 cmd.params[1] |= mc_enc(48, 8, obj_type[6]); dprc_get_obj_irq()
1174 cmd.params[1] |= mc_enc(56, 8, obj_type[7]); dprc_get_obj_irq()
1175 cmd.params[2] |= mc_enc(0, 8, obj_type[8]); dprc_get_obj_irq()
1176 cmd.params[2] |= mc_enc(8, 8, obj_type[9]); dprc_get_obj_irq()
1177 cmd.params[2] |= mc_enc(16, 8, obj_type[10]); dprc_get_obj_irq()
1178 cmd.params[2] |= mc_enc(24, 8, obj_type[11]); dprc_get_obj_irq()
1179 cmd.params[2] |= mc_enc(32, 8, obj_type[12]); dprc_get_obj_irq()
1180 cmd.params[2] |= mc_enc(40, 8, obj_type[13]); dprc_get_obj_irq()
1181 cmd.params[2] |= mc_enc(48, 8, obj_type[14]); dprc_get_obj_irq()
1182 cmd.params[2] |= mc_enc(56, 8, obj_type[15]); dprc_get_obj_irq()
1185 err = mc_send_command(mc_io, &cmd); dprc_get_obj_irq()
1190 irq_cfg->val = (u32)mc_dec(cmd.params[0], 0, 32); dprc_get_obj_irq()
1191 irq_cfg->paddr = (u64)mc_dec(cmd.params[1], 0, 64); dprc_get_obj_irq()
1192 irq_cfg->user_irq_id = (int)mc_dec(cmd.params[2], 0, 32); dprc_get_obj_irq()
1193 *type = (int)mc_dec(cmd.params[2], 32, 32); dprc_get_obj_irq()
1217 struct mc_command cmd = { 0 }; dprc_get_res_count() local
1223 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_COUNT, dprc_get_res_count()
1225 cmd.params[1] |= mc_enc(0, 8, type[0]); dprc_get_res_count()
1226 cmd.params[1] |= mc_enc(8, 8, type[1]); dprc_get_res_count()
1227 cmd.params[1] |= mc_enc(16, 8, type[2]); dprc_get_res_count()
1228 cmd.params[1] |= mc_enc(24, 8, type[3]); dprc_get_res_count()
1229 cmd.params[1] |= mc_enc(32, 8, type[4]); dprc_get_res_count()
1230 cmd.params[1] |= mc_enc(40, 8, type[5]); dprc_get_res_count()
1231 cmd.params[1] |= mc_enc(48, 8, type[6]); dprc_get_res_count()
1232 cmd.params[1] |= mc_enc(56, 8, type[7]); dprc_get_res_count()
1233 cmd.params[2] |= mc_enc(0, 8, type[8]); dprc_get_res_count()
1234 cmd.params[2] |= mc_enc(8, 8, type[9]); dprc_get_res_count()
1235 cmd.params[2] |= mc_enc(16, 8, type[10]); dprc_get_res_count()
1236 cmd.params[2] |= mc_enc(24, 8, type[11]); dprc_get_res_count()
1237 cmd.params[2] |= mc_enc(32, 8, type[12]); dprc_get_res_count()
1238 cmd.params[2] |= mc_enc(40, 8, type[13]); dprc_get_res_count()
1239 cmd.params[2] |= mc_enc(48, 8, type[14]); dprc_get_res_count()
1240 cmd.params[2] |= mc_enc(56, 8, '\0'); dprc_get_res_count()
1243 err = mc_send_command(mc_io, &cmd); dprc_get_res_count()
1248 *res_count = mc_dec(cmd.params[0], 0, 32); dprc_get_res_count()
1270 struct mc_command cmd = { 0 }; dprc_get_res_ids() local
1274 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_IDS, dprc_get_res_ids()
1276 cmd.params[0] |= mc_enc(42, 7, range_desc->iter_status); dprc_get_res_ids()
1277 cmd.params[1] |= mc_enc(0, 32, range_desc->base_id); dprc_get_res_ids()
1278 cmd.params[1] |= mc_enc(32, 32, range_desc->last_id); dprc_get_res_ids()
1279 cmd.params[2] |= mc_enc(0, 8, type[0]); dprc_get_res_ids()
1280 cmd.params[2] |= mc_enc(8, 8, type[1]); dprc_get_res_ids()
1281 cmd.params[2] |= mc_enc(16, 8, type[2]); dprc_get_res_ids()
1282 cmd.params[2] |= mc_enc(24, 8, type[3]); dprc_get_res_ids()
1283 cmd.params[2] |= mc_enc(32, 8, type[4]); dprc_get_res_ids()
1284 cmd.params[2] |= mc_enc(40, 8, type[5]); dprc_get_res_ids()
1285 cmd.params[2] |= mc_enc(48, 8, type[6]); dprc_get_res_ids()
1286 cmd.params[2] |= mc_enc(56, 8, type[7]); dprc_get_res_ids()
1287 cmd.params[3] |= mc_enc(0, 8, type[8]); dprc_get_res_ids()
1288 cmd.params[3] |= mc_enc(8, 8, type[9]); dprc_get_res_ids()
1289 cmd.params[3] |= mc_enc(16, 8, type[10]); dprc_get_res_ids()
1290 cmd.params[3] |= mc_enc(24, 8, type[11]); dprc_get_res_ids()
1291 cmd.params[3] |= mc_enc(32, 8, type[12]); dprc_get_res_ids()
1292 cmd.params[3] |= mc_enc(40, 8, type[13]); dprc_get_res_ids()
1293 cmd.params[3] |= mc_enc(48, 8, type[14]); dprc_get_res_ids()
1294 cmd.params[3] |= mc_enc(56, 8, '\0'); dprc_get_res_ids()
1297 err = mc_send_command(mc_io, &cmd); dprc_get_res_ids()
1302 range_desc->iter_status = mc_dec(cmd.params[0], 42, 7); dprc_get_res_ids()
1303 range_desc->base_id = mc_dec(cmd.params[1], 0, 32); dprc_get_res_ids()
1304 range_desc->last_id = mc_dec(cmd.params[1], 32, 32); dprc_get_res_ids()
1330 struct mc_command cmd = { 0 }; dprc_get_obj_region() local
1334 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_REG, dprc_get_obj_region()
1336 cmd.params[0] |= mc_enc(0, 32, obj_id); dprc_get_obj_region()
1337 cmd.params[0] |= mc_enc(48, 8, region_index); dprc_get_obj_region()
1338 cmd.params[3] |= mc_enc(0, 8, obj_type[0]); dprc_get_obj_region()
1339 cmd.params[3] |= mc_enc(8, 8, obj_type[1]); dprc_get_obj_region()
1340 cmd.params[3] |= mc_enc(16, 8, obj_type[2]); dprc_get_obj_region()
1341 cmd.params[3] |= mc_enc(24, 8, obj_type[3]); dprc_get_obj_region()
1342 cmd.params[3] |= mc_enc(32, 8, obj_type[4]); dprc_get_obj_region()
1343 cmd.params[3] |= mc_enc(40, 8, obj_type[5]); dprc_get_obj_region()
1344 cmd.params[3] |= mc_enc(48, 8, obj_type[6]); dprc_get_obj_region()
1345 cmd.params[3] |= mc_enc(56, 8, obj_type[7]); dprc_get_obj_region()
1346 cmd.params[4] |= mc_enc(0, 8, obj_type[8]); dprc_get_obj_region()
1347 cmd.params[4] |= mc_enc(8, 8, obj_type[9]); dprc_get_obj_region()
1348 cmd.params[4] |= mc_enc(16, 8, obj_type[10]); dprc_get_obj_region()
1349 cmd.params[4] |= mc_enc(24, 8, obj_type[11]); dprc_get_obj_region()
1350 cmd.params[4] |= mc_enc(32, 8, obj_type[12]); dprc_get_obj_region()
1351 cmd.params[4] |= mc_enc(40, 8, obj_type[13]); dprc_get_obj_region()
1352 cmd.params[4] |= mc_enc(48, 8, obj_type[14]); dprc_get_obj_region()
1353 cmd.params[4] |= mc_enc(56, 8, '\0'); dprc_get_obj_region()
1356 err = mc_send_command(mc_io, &cmd); dprc_get_obj_region()
1361 region_desc->base_offset = mc_dec(cmd.params[1], 0, 64); dprc_get_obj_region()
1362 region_desc->size = mc_dec(cmd.params[2], 0, 32); dprc_get_obj_region()
1386 struct mc_command cmd = { 0 }; dprc_set_obj_label() local
1389 cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_OBJ_LABEL, dprc_set_obj_label()
1393 cmd.params[0] |= mc_enc(0, 32, obj_id); dprc_set_obj_label()
1394 cmd.params[1] |= mc_enc(0, 8, label[0]); dprc_set_obj_label()
1395 cmd.params[1] |= mc_enc(8, 8, label[1]); dprc_set_obj_label()
1396 cmd.params[1] |= mc_enc(16, 8, label[2]); dprc_set_obj_label()
1397 cmd.params[1] |= mc_enc(24, 8, label[3]); dprc_set_obj_label()
1398 cmd.params[1] |= mc_enc(32, 8, label[4]); dprc_set_obj_label()
1399 cmd.params[1] |= mc_enc(40, 8, label[5]); dprc_set_obj_label()
1400 cmd.params[1] |= mc_enc(48, 8, label[6]); dprc_set_obj_label()
1401 cmd.params[1] |= mc_enc(56, 8, label[7]); dprc_set_obj_label()
1402 cmd.params[2] |= mc_enc(0, 8, label[8]); dprc_set_obj_label()
1403 cmd.params[2] |= mc_enc(8, 8, label[9]); dprc_set_obj_label()
1404 cmd.params[2] |= mc_enc(16, 8, label[10]); dprc_set_obj_label()
1405 cmd.params[2] |= mc_enc(24, 8, label[11]); dprc_set_obj_label()
1406 cmd.params[2] |= mc_enc(32, 8, label[12]); dprc_set_obj_label()
1407 cmd.params[2] |= mc_enc(40, 8, label[13]); dprc_set_obj_label()
1408 cmd.params[2] |= mc_enc(48, 8, label[14]); dprc_set_obj_label()
1409 cmd.params[2] |= mc_enc(56, 8, label[15]); dprc_set_obj_label()
1410 cmd.params[3] |= mc_enc(0, 8, obj_type[0]); dprc_set_obj_label()
1411 cmd.params[3] |= mc_enc(8, 8, obj_type[1]); dprc_set_obj_label()
1412 cmd.params[3] |= mc_enc(16, 8, obj_type[2]); dprc_set_obj_label()
1413 cmd.params[3] |= mc_enc(24, 8, obj_type[3]); dprc_set_obj_label()
1414 cmd.params[3] |= mc_enc(32, 8, obj_type[4]); dprc_set_obj_label()
1415 cmd.params[3] |= mc_enc(40, 8, obj_type[5]); dprc_set_obj_label()
1416 cmd.params[3] |= mc_enc(48, 8, obj_type[6]); dprc_set_obj_label()
1417 cmd.params[3] |= mc_enc(56, 8, obj_type[7]); dprc_set_obj_label()
1418 cmd.params[4] |= mc_enc(0, 8, obj_type[8]); dprc_set_obj_label()
1419 cmd.params[4] |= mc_enc(8, 8, obj_type[9]); dprc_set_obj_label()
1420 cmd.params[4] |= mc_enc(16, 8, obj_type[10]); dprc_set_obj_label()
1421 cmd.params[4] |= mc_enc(24, 8, obj_type[11]); dprc_set_obj_label()
1422 cmd.params[4] |= mc_enc(32, 8, obj_type[12]); dprc_set_obj_label()
1423 cmd.params[4] |= mc_enc(40, 8, obj_type[13]); dprc_set_obj_label()
1424 cmd.params[4] |= mc_enc(48, 8, obj_type[14]); dprc_set_obj_label()
1425 cmd.params[4] |= mc_enc(56, 8, obj_type[15]); dprc_set_obj_label()
1428 return mc_send_command(mc_io, &cmd); dprc_set_obj_label()
1458 struct mc_command cmd = { 0 }; dprc_connect() local
1461 cmd.header = mc_encode_cmd_header(DPRC_CMDID_CONNECT, dprc_connect()
1464 cmd.params[0] |= mc_enc(0, 32, endpoint1->id); dprc_connect()
1465 cmd.params[0] |= mc_enc(32, 32, endpoint1->if_id); dprc_connect()
1466 cmd.params[1] |= mc_enc(0, 32, endpoint2->id); dprc_connect()
1467 cmd.params[1] |= mc_enc(32, 32, endpoint2->if_id); dprc_connect()
1468 cmd.params[2] |= mc_enc(0, 8, endpoint1->type[0]); dprc_connect()
1469 cmd.params[2] |= mc_enc(8, 8, endpoint1->type[1]); dprc_connect()
1470 cmd.params[2] |= mc_enc(16, 8, endpoint1->type[2]); dprc_connect()
1471 cmd.params[2] |= mc_enc(24, 8, endpoint1->type[3]); dprc_connect()
1472 cmd.params[2] |= mc_enc(32, 8, endpoint1->type[4]); dprc_connect()
1473 cmd.params[2] |= mc_enc(40, 8, endpoint1->type[5]); dprc_connect()
1474 cmd.params[2] |= mc_enc(48, 8, endpoint1->type[6]); dprc_connect()
1475 cmd.params[2] |= mc_enc(56, 8, endpoint1->type[7]); dprc_connect()
1476 cmd.params[3] |= mc_enc(0, 8, endpoint1->type[8]); dprc_connect()
1477 cmd.params[3] |= mc_enc(8, 8, endpoint1->type[9]); dprc_connect()
1478 cmd.params[3] |= mc_enc(16, 8, endpoint1->type[10]); dprc_connect()
1479 cmd.params[3] |= mc_enc(24, 8, endpoint1->type[11]); dprc_connect()
1480 cmd.params[3] |= mc_enc(32, 8, endpoint1->type[12]); dprc_connect()
1481 cmd.params[3] |= mc_enc(40, 8, endpoint1->type[13]); dprc_connect()
1482 cmd.params[3] |= mc_enc(48, 8, endpoint1->type[14]); dprc_connect()
1483 cmd.params[3] |= mc_enc(56, 8, endpoint1->type[15]); dprc_connect()
1484 cmd.params[4] |= mc_enc(0, 32, cfg->max_rate); dprc_connect()
1485 cmd.params[4] |= mc_enc(32, 32, cfg->committed_rate); dprc_connect()
1486 cmd.params[5] |= mc_enc(0, 8, endpoint2->type[0]); dprc_connect()
1487 cmd.params[5] |= mc_enc(8, 8, endpoint2->type[1]); dprc_connect()
1488 cmd.params[5] |= mc_enc(16, 8, endpoint2->type[2]); dprc_connect()
1489 cmd.params[5] |= mc_enc(24, 8, endpoint2->type[3]); dprc_connect()
1490 cmd.params[5] |= mc_enc(32, 8, endpoint2->type[4]); dprc_connect()
1491 cmd.params[5] |= mc_enc(40, 8, endpoint2->type[5]); dprc_connect()
1492 cmd.params[5] |= mc_enc(48, 8, endpoint2->type[6]); dprc_connect()
1493 cmd.params[5] |= mc_enc(56, 8, endpoint2->type[7]); dprc_connect()
1494 cmd.params[6] |= mc_enc(0, 8, endpoint2->type[8]); dprc_connect()
1495 cmd.params[6] |= mc_enc(8, 8, endpoint2->type[9]); dprc_connect()
1496 cmd.params[6] |= mc_enc(16, 8, endpoint2->type[10]); dprc_connect()
1497 cmd.params[6] |= mc_enc(24, 8, endpoint2->type[11]); dprc_connect()
1498 cmd.params[6] |= mc_enc(32, 8, endpoint2->type[12]); dprc_connect()
1499 cmd.params[6] |= mc_enc(40, 8, endpoint2->type[13]); dprc_connect()
1500 cmd.params[6] |= mc_enc(48, 8, endpoint2->type[14]); dprc_connect()
1501 cmd.params[6] |= mc_enc(56, 8, endpoint2->type[15]); dprc_connect()
1504 return mc_send_command(mc_io, &cmd); dprc_connect()
1521 struct mc_command cmd = { 0 }; dprc_disconnect() local
1524 cmd.header = mc_encode_cmd_header(DPRC_CMDID_DISCONNECT, dprc_disconnect()
1527 cmd.params[0] |= mc_enc(0, 32, endpoint->id); dprc_disconnect()
1528 cmd.params[0] |= mc_enc(32, 32, endpoint->if_id); dprc_disconnect()
1529 cmd.params[1] |= mc_enc(0, 8, endpoint->type[0]); dprc_disconnect()
1530 cmd.params[1] |= mc_enc(8, 8, endpoint->type[1]); dprc_disconnect()
1531 cmd.params[1] |= mc_enc(16, 8, endpoint->type[2]); dprc_disconnect()
1532 cmd.params[1] |= mc_enc(24, 8, endpoint->type[3]); dprc_disconnect()
1533 cmd.params[1] |= mc_enc(32, 8, endpoint->type[4]); dprc_disconnect()
1534 cmd.params[1] |= mc_enc(40, 8, endpoint->type[5]); dprc_disconnect()
1535 cmd.params[1] |= mc_enc(48, 8, endpoint->type[6]); dprc_disconnect()
1536 cmd.params[1] |= mc_enc(56, 8, endpoint->type[7]); dprc_disconnect()
1537 cmd.params[2] |= mc_enc(0, 8, endpoint->type[8]); dprc_disconnect()
1538 cmd.params[2] |= mc_enc(8, 8, endpoint->type[9]); dprc_disconnect()
1539 cmd.params[2] |= mc_enc(16, 8, endpoint->type[10]); dprc_disconnect()
1540 cmd.params[2] |= mc_enc(24, 8, endpoint->type[11]); dprc_disconnect()
1541 cmd.params[2] |= mc_enc(32, 8, endpoint->type[12]); dprc_disconnect()
1542 cmd.params[2] |= mc_enc(40, 8, endpoint->type[13]); dprc_disconnect()
1543 cmd.params[2] |= mc_enc(48, 8, endpoint->type[14]); dprc_disconnect()
1544 cmd.params[2] |= mc_enc(56, 8, endpoint->type[15]); dprc_disconnect()
1547 return mc_send_command(mc_io, &cmd); dprc_disconnect()
1569 struct mc_command cmd = { 0 }; dprc_get_connection() local
1573 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_CONNECTION, dprc_get_connection()
1576 cmd.params[0] |= mc_enc(0, 32, endpoint1->id); dprc_get_connection()
1577 cmd.params[0] |= mc_enc(32, 32, endpoint1->if_id); dprc_get_connection()
1578 cmd.params[1] |= mc_enc(0, 8, endpoint1->type[0]); dprc_get_connection()
1579 cmd.params[1] |= mc_enc(8, 8, endpoint1->type[1]); dprc_get_connection()
1580 cmd.params[1] |= mc_enc(16, 8, endpoint1->type[2]); dprc_get_connection()
1581 cmd.params[1] |= mc_enc(24, 8, endpoint1->type[3]); dprc_get_connection()
1582 cmd.params[1] |= mc_enc(32, 8, endpoint1->type[4]); dprc_get_connection()
1583 cmd.params[1] |= mc_enc(40, 8, endpoint1->type[5]); dprc_get_connection()
1584 cmd.params[1] |= mc_enc(48, 8, endpoint1->type[6]); dprc_get_connection()
1585 cmd.params[1] |= mc_enc(56, 8, endpoint1->type[7]); dprc_get_connection()
1586 cmd.params[2] |= mc_enc(0, 8, endpoint1->type[8]); dprc_get_connection()
1587 cmd.params[2] |= mc_enc(8, 8, endpoint1->type[9]); dprc_get_connection()
1588 cmd.params[2] |= mc_enc(16, 8, endpoint1->type[10]); dprc_get_connection()
1589 cmd.params[2] |= mc_enc(24, 8, endpoint1->type[11]); dprc_get_connection()
1590 cmd.params[2] |= mc_enc(32, 8, endpoint1->type[12]); dprc_get_connection()
1591 cmd.params[2] |= mc_enc(40, 8, endpoint1->type[13]); dprc_get_connection()
1592 cmd.params[2] |= mc_enc(48, 8, endpoint1->type[14]); dprc_get_connection()
1593 cmd.params[2] |= mc_enc(56, 8, endpoint1->type[15]); dprc_get_connection()
1596 err = mc_send_command(mc_io, &cmd); dprc_get_connection()
1601 endpoint2->id = mc_dec(cmd.params[3], 0, 32); dprc_get_connection()
1602 endpoint2->if_id = mc_dec(cmd.params[3], 32, 32); dprc_get_connection()
1603 endpoint2->type[0] = mc_dec(cmd.params[4], 0, 8); dprc_get_connection()
1604 endpoint2->type[1] = mc_dec(cmd.params[4], 8, 8); dprc_get_connection()
1605 endpoint2->type[2] = mc_dec(cmd.params[4], 16, 8); dprc_get_connection()
1606 endpoint2->type[3] = mc_dec(cmd.params[4], 24, 8); dprc_get_connection()
1607 endpoint2->type[4] = mc_dec(cmd.params[4], 32, 8); dprc_get_connection()
1608 endpoint2->type[5] = mc_dec(cmd.params[4], 40, 8); dprc_get_connection()
1609 endpoint2->type[6] = mc_dec(cmd.params[4], 48, 8); dprc_get_connection()
1610 endpoint2->type[7] = mc_dec(cmd.params[4], 56, 8); dprc_get_connection()
1611 endpoint2->type[8] = mc_dec(cmd.params[5], 0, 8); dprc_get_connection()
1612 endpoint2->type[9] = mc_dec(cmd.params[5], 8, 8); dprc_get_connection()
1613 endpoint2->type[10] = mc_dec(cmd.params[5], 16, 8); dprc_get_connection()
1614 endpoint2->type[11] = mc_dec(cmd.params[5], 24, 8); dprc_get_connection()
1615 endpoint2->type[12] = mc_dec(cmd.params[5], 32, 8); dprc_get_connection()
1616 endpoint2->type[13] = mc_dec(cmd.params[5], 40, 8); dprc_get_connection()
1617 endpoint2->type[14] = mc_dec(cmd.params[5], 48, 8); dprc_get_connection()
1618 endpoint2->type[15] = mc_dec(cmd.params[5], 56, 8); dprc_get_connection()
1619 *state = mc_dec(cmd.params[6], 0, 32); dprc_get_connection()
H A Ddpmcp.c33 #include "../include/mc-cmd.h"
35 #include "dpmcp-cmd.h"
59 struct mc_command cmd = { 0 }; dpmcp_open() local
63 cmd.header = mc_encode_cmd_header(DPMCP_CMDID_OPEN, dpmcp_open()
65 cmd.params[0] |= mc_enc(0, 32, dpmcp_id); dpmcp_open()
68 err = mc_send_command(mc_io, &cmd); dpmcp_open()
73 *token = MC_CMD_HDR_READ_TOKEN(cmd.header); dpmcp_open()
93 struct mc_command cmd = { 0 }; dpmcp_close() local
96 cmd.header = mc_encode_cmd_header(DPMCP_CMDID_CLOSE, dpmcp_close()
100 return mc_send_command(mc_io, &cmd); dpmcp_close()
129 struct mc_command cmd = { 0 }; dpmcp_create() local
133 cmd.header = mc_encode_cmd_header(DPMCP_CMDID_CREATE, dpmcp_create()
135 cmd.params[0] |= mc_enc(0, 32, cfg->portal_id); dpmcp_create()
138 err = mc_send_command(mc_io, &cmd); dpmcp_create()
143 *token = MC_CMD_HDR_READ_TOKEN(cmd.header); dpmcp_create()
160 struct mc_command cmd = { 0 }; dpmcp_destroy() local
163 cmd.header = mc_encode_cmd_header(DPMCP_CMDID_DESTROY, dpmcp_destroy()
167 return mc_send_command(mc_io, &cmd); dpmcp_destroy()
182 struct mc_command cmd = { 0 }; dpmcp_reset() local
185 cmd.header = mc_encode_cmd_header(DPMCP_CMDID_RESET, dpmcp_reset()
189 return mc_send_command(mc_io, &cmd); dpmcp_reset()
208 struct mc_command cmd = { 0 }; dpmcp_set_irq() local
211 cmd.header = mc_encode_cmd_header(DPMCP_CMDID_SET_IRQ, dpmcp_set_irq()
213 cmd.params[0] |= mc_enc(0, 8, irq_index); dpmcp_set_irq()
214 cmd.params[0] |= mc_enc(32, 32, irq_cfg->val); dpmcp_set_irq()
215 cmd.params[1] |= mc_enc(0, 64, irq_cfg->paddr); dpmcp_set_irq()
216 cmd.params[2] |= mc_enc(0, 32, irq_cfg->user_irq_id); dpmcp_set_irq()
219 return mc_send_command(mc_io, &cmd); dpmcp_set_irq()
241 struct mc_command cmd = { 0 }; dpmcp_get_irq() local
245 cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_IRQ, dpmcp_get_irq()
247 cmd.params[0] |= mc_enc(32, 8, irq_index); dpmcp_get_irq()
250 err = mc_send_command(mc_io, &cmd); dpmcp_get_irq()
255 irq_cfg->val = (u32)mc_dec(cmd.params[0], 0, 32); dpmcp_get_irq()
256 irq_cfg->paddr = (u64)mc_dec(cmd.params[1], 0, 64); dpmcp_get_irq()
257 irq_cfg->user_irq_id = (int)mc_dec(cmd.params[2], 0, 32); dpmcp_get_irq()
258 *type = (int)mc_dec(cmd.params[2], 32, 32); dpmcp_get_irq()
283 struct mc_command cmd = { 0 }; dpmcp_set_irq_enable() local
286 cmd.header = mc_encode_cmd_header(DPMCP_CMDID_SET_IRQ_ENABLE, dpmcp_set_irq_enable()
288 cmd.params[0] |= mc_enc(0, 8, en); dpmcp_set_irq_enable()
289 cmd.params[0] |= mc_enc(32, 8, irq_index); dpmcp_set_irq_enable()
292 return mc_send_command(mc_io, &cmd); dpmcp_set_irq_enable()
311 struct mc_command cmd = { 0 }; dpmcp_get_irq_enable() local
315 cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_IRQ_ENABLE, dpmcp_get_irq_enable()
317 cmd.params[0] |= mc_enc(32, 8, irq_index); dpmcp_get_irq_enable()
320 err = mc_send_command(mc_io, &cmd); dpmcp_get_irq_enable()
325 *en = (u8)mc_dec(cmd.params[0], 0, 8); dpmcp_get_irq_enable()
351 struct mc_command cmd = { 0 }; dpmcp_set_irq_mask() local
354 cmd.header = mc_encode_cmd_header(DPMCP_CMDID_SET_IRQ_MASK, dpmcp_set_irq_mask()
356 cmd.params[0] |= mc_enc(0, 32, mask); dpmcp_set_irq_mask()
357 cmd.params[0] |= mc_enc(32, 8, irq_index); dpmcp_set_irq_mask()
360 return mc_send_command(mc_io, &cmd); dpmcp_set_irq_mask()
382 struct mc_command cmd = { 0 }; dpmcp_get_irq_mask() local
386 cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_IRQ_MASK, dpmcp_get_irq_mask()
388 cmd.params[0] |= mc_enc(32, 8, irq_index); dpmcp_get_irq_mask()
391 err = mc_send_command(mc_io, &cmd); dpmcp_get_irq_mask()
396 *mask = (u32)mc_dec(cmd.params[0], 0, 32); dpmcp_get_irq_mask()
419 struct mc_command cmd = { 0 }; dpmcp_get_irq_status() local
423 cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_IRQ_STATUS, dpmcp_get_irq_status()
425 cmd.params[0] |= mc_enc(32, 8, irq_index); dpmcp_get_irq_status()
428 err = mc_send_command(mc_io, &cmd); dpmcp_get_irq_status()
433 *status = (u32)mc_dec(cmd.params[0], 0, 32); dpmcp_get_irq_status()
456 struct mc_command cmd = { 0 }; dpmcp_clear_irq_status() local
459 cmd.header = mc_encode_cmd_header(DPMCP_CMDID_CLEAR_IRQ_STATUS, dpmcp_clear_irq_status()
461 cmd.params[0] |= mc_enc(0, 32, status); dpmcp_clear_irq_status()
462 cmd.params[0] |= mc_enc(32, 8, irq_index); dpmcp_clear_irq_status()
465 return mc_send_command(mc_io, &cmd); dpmcp_clear_irq_status()
483 struct mc_command cmd = { 0 }; dpmcp_get_attributes() local
487 cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_ATTR, dpmcp_get_attributes()
491 err = mc_send_command(mc_io, &cmd); dpmcp_get_attributes()
496 attr->id = (int)mc_dec(cmd.params[0], 32, 32); dpmcp_get_attributes()
497 attr->version.major = (u16)mc_dec(cmd.params[1], 0, 16); dpmcp_get_attributes()
498 attr->version.minor = (u16)mc_dec(cmd.params[1], 16, 16); dpmcp_get_attributes()
H A Ddpbp.c33 #include "../include/mc-cmd.h"
35 #include "../include/dpbp-cmd.h"
59 struct mc_command cmd = { 0 }; dpbp_open() local
63 cmd.header = mc_encode_cmd_header(DPBP_CMDID_OPEN, dpbp_open()
65 cmd.params[0] |= mc_enc(0, 32, dpbp_id); dpbp_open()
68 err = mc_send_command(mc_io, &cmd); dpbp_open()
73 *token = MC_CMD_HDR_READ_TOKEN(cmd.header); dpbp_open()
94 struct mc_command cmd = { 0 }; dpbp_close() local
97 cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLOSE, cmd_flags, dpbp_close()
101 return mc_send_command(mc_io, &cmd); dpbp_close()
131 struct mc_command cmd = { 0 }; dpbp_create() local
137 cmd.header = mc_encode_cmd_header(DPBP_CMDID_CREATE, dpbp_create()
141 err = mc_send_command(mc_io, &cmd); dpbp_create()
146 *token = MC_CMD_HDR_READ_TOKEN(cmd.header); dpbp_create()
163 struct mc_command cmd = { 0 }; dpbp_destroy() local
166 cmd.header = mc_encode_cmd_header(DPBP_CMDID_DESTROY, dpbp_destroy()
170 return mc_send_command(mc_io, &cmd); dpbp_destroy()
185 struct mc_command cmd = { 0 }; dpbp_enable() local
188 cmd.header = mc_encode_cmd_header(DPBP_CMDID_ENABLE, cmd_flags, dpbp_enable()
192 return mc_send_command(mc_io, &cmd); dpbp_enable()
208 struct mc_command cmd = { 0 }; dpbp_disable() local
211 cmd.header = mc_encode_cmd_header(DPBP_CMDID_DISABLE, dpbp_disable()
215 return mc_send_command(mc_io, &cmd); dpbp_disable()
233 struct mc_command cmd = { 0 }; dpbp_is_enabled() local
236 cmd.header = mc_encode_cmd_header(DPBP_CMDID_IS_ENABLED, cmd_flags, dpbp_is_enabled()
240 err = mc_send_command(mc_io, &cmd); dpbp_is_enabled()
245 *en = (int)mc_dec(cmd.params[0], 0, 1); dpbp_is_enabled()
262 struct mc_command cmd = { 0 }; dpbp_reset() local
265 cmd.header = mc_encode_cmd_header(DPBP_CMDID_RESET, dpbp_reset()
269 return mc_send_command(mc_io, &cmd); dpbp_reset()
288 struct mc_command cmd = { 0 }; dpbp_set_irq() local
291 cmd.header = mc_encode_cmd_header(DPBP_CMDID_SET_IRQ, dpbp_set_irq()
293 cmd.params[0] |= mc_enc(0, 8, irq_index); dpbp_set_irq()
294 cmd.params[0] |= mc_enc(32, 32, irq_cfg->val); dpbp_set_irq()
295 cmd.params[1] |= mc_enc(0, 64, irq_cfg->addr); dpbp_set_irq()
296 cmd.params[2] |= mc_enc(0, 32, irq_cfg->user_irq_id); dpbp_set_irq()
299 return mc_send_command(mc_io, &cmd); dpbp_set_irq()
321 struct mc_command cmd = { 0 }; dpbp_get_irq() local
325 cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ, dpbp_get_irq()
327 cmd.params[0] |= mc_enc(32, 8, irq_index); dpbp_get_irq()
330 err = mc_send_command(mc_io, &cmd); dpbp_get_irq()
335 irq_cfg->val = (u32)mc_dec(cmd.params[0], 0, 32); dpbp_get_irq()
336 irq_cfg->addr = (u64)mc_dec(cmd.params[1], 0, 64); dpbp_get_irq()
337 irq_cfg->user_irq_id = (int)mc_dec(cmd.params[2], 0, 32); dpbp_get_irq()
338 *type = (int)mc_dec(cmd.params[2], 32, 32); dpbp_get_irq()
363 struct mc_command cmd = { 0 }; dpbp_set_irq_enable() local
366 cmd.header = mc_encode_cmd_header(DPBP_CMDID_SET_IRQ_ENABLE, dpbp_set_irq_enable()
368 cmd.params[0] |= mc_enc(0, 8, en); dpbp_set_irq_enable()
369 cmd.params[0] |= mc_enc(32, 8, irq_index); dpbp_set_irq_enable()
372 return mc_send_command(mc_io, &cmd); dpbp_set_irq_enable()
391 struct mc_command cmd = { 0 }; dpbp_get_irq_enable() local
395 cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ_ENABLE, dpbp_get_irq_enable()
397 cmd.params[0] |= mc_enc(32, 8, irq_index); dpbp_get_irq_enable()
400 err = mc_send_command(mc_io, &cmd); dpbp_get_irq_enable()
405 *en = (u8)mc_dec(cmd.params[0], 0, 8); dpbp_get_irq_enable()
431 struct mc_command cmd = { 0 }; dpbp_set_irq_mask() local
434 cmd.header = mc_encode_cmd_header(DPBP_CMDID_SET_IRQ_MASK, dpbp_set_irq_mask()
436 cmd.params[0] |= mc_enc(0, 32, mask); dpbp_set_irq_mask()
437 cmd.params[0] |= mc_enc(32, 8, irq_index); dpbp_set_irq_mask()
440 return mc_send_command(mc_io, &cmd); dpbp_set_irq_mask()
462 struct mc_command cmd = { 0 }; dpbp_get_irq_mask() local
466 cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ_MASK, dpbp_get_irq_mask()
468 cmd.params[0] |= mc_enc(32, 8, irq_index); dpbp_get_irq_mask()
471 err = mc_send_command(mc_io, &cmd); dpbp_get_irq_mask()
476 *mask = (u32)mc_dec(cmd.params[0], 0, 32); dpbp_get_irq_mask()
499 struct mc_command cmd = { 0 }; dpbp_get_irq_status() local
503 cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ_STATUS, dpbp_get_irq_status()
505 cmd.params[0] |= mc_enc(32, 8, irq_index); dpbp_get_irq_status()
508 err = mc_send_command(mc_io, &cmd); dpbp_get_irq_status()
513 *status = (u32)mc_dec(cmd.params[0], 0, 32); dpbp_get_irq_status()
536 struct mc_command cmd = { 0 }; dpbp_clear_irq_status() local
539 cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLEAR_IRQ_STATUS, dpbp_clear_irq_status()
541 cmd.params[0] |= mc_enc(0, 32, status); dpbp_clear_irq_status()
542 cmd.params[0] |= mc_enc(32, 8, irq_index); dpbp_clear_irq_status()
545 return mc_send_command(mc_io, &cmd); dpbp_clear_irq_status()
563 struct mc_command cmd = { 0 }; dpbp_get_attributes() local
567 cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_ATTR, dpbp_get_attributes()
571 err = mc_send_command(mc_io, &cmd); dpbp_get_attributes()
576 attr->bpid = (u16)mc_dec(cmd.params[0], 16, 16); dpbp_get_attributes()
577 attr->id = (int)mc_dec(cmd.params[0], 32, 32); dpbp_get_attributes()
578 attr->version.major = (u16)mc_dec(cmd.params[1], 0, 16); dpbp_get_attributes()
579 attr->version.minor = (u16)mc_dec(cmd.params[1], 16, 16); dpbp_get_attributes()
H A Ddpmng.c33 #include "../include/mc-cmd.h"
35 #include "dpmng-cmd.h"
50 struct mc_command cmd = { 0 }; mc_get_version() local
54 cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION, mc_get_version()
59 err = mc_send_command(mc_io, &cmd); mc_get_version()
64 mc_ver_info->revision = mc_dec(cmd.params[0], 0, 32); mc_get_version()
65 mc_ver_info->major = mc_dec(cmd.params[0], 32, 32); mc_get_version()
66 mc_ver_info->minor = mc_dec(cmd.params[1], 0, 32); mc_get_version()
83 struct mc_command cmd = { 0 }; dpmng_get_container_id() local
87 cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_CONT_ID, dpmng_get_container_id()
92 err = mc_send_command(mc_io, &cmd); dpmng_get_container_id()
97 *container_id = mc_dec(cmd.params[0], 0, 32); dpmng_get_container_id()
/linux-4.4.14/drivers/mmc/core/
H A Dsd_ops.c28 struct mmc_command cmd = {0}; mmc_app_cmd() local
33 cmd.opcode = MMC_APP_CMD; mmc_app_cmd()
36 cmd.arg = card->rca << 16; mmc_app_cmd()
37 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; mmc_app_cmd()
39 cmd.arg = 0; mmc_app_cmd()
40 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_BCR; mmc_app_cmd()
43 err = mmc_wait_for_cmd(host, &cmd, 0); mmc_app_cmd()
48 if (!mmc_host_is_spi(host) && !(cmd.resp[0] & R1_APP_CMD)) mmc_app_cmd()
60 * @cmd: MMC command to start
69 struct mmc_command *cmd, int retries) mmc_wait_for_app_cmd()
75 BUG_ON(!cmd); mmc_wait_for_app_cmd()
89 if (cmd->resp[0] & R1_SPI_ILLEGAL_COMMAND) mmc_wait_for_app_cmd()
97 memset(cmd->resp, 0, sizeof(cmd->resp)); mmc_wait_for_app_cmd()
98 cmd->retries = 0; mmc_wait_for_app_cmd()
100 mrq.cmd = cmd; mmc_wait_for_app_cmd()
101 cmd->data = NULL; mmc_wait_for_app_cmd()
105 err = cmd->error; mmc_wait_for_app_cmd()
106 if (!cmd->error) mmc_wait_for_app_cmd()
111 if (cmd->resp[0] & R1_SPI_ILLEGAL_COMMAND) mmc_wait_for_app_cmd()
124 struct mmc_command cmd = {0}; mmc_app_set_bus_width() local
129 cmd.opcode = SD_APP_SET_BUS_WIDTH; mmc_app_set_bus_width()
130 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; mmc_app_set_bus_width()
134 cmd.arg = SD_BUS_WIDTH_1; mmc_app_set_bus_width()
137 cmd.arg = SD_BUS_WIDTH_4; mmc_app_set_bus_width()
143 err = mmc_wait_for_app_cmd(card->host, card, &cmd, MMC_CMD_RETRIES); mmc_app_set_bus_width()
152 struct mmc_command cmd = {0}; mmc_send_app_op_cond() local
157 cmd.opcode = SD_APP_OP_COND; mmc_send_app_op_cond()
159 cmd.arg = ocr & (1 << 30); /* SPI only defines one bit */ mmc_send_app_op_cond()
161 cmd.arg = ocr; mmc_send_app_op_cond()
162 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R3 | MMC_CMD_BCR; mmc_send_app_op_cond()
165 err = mmc_wait_for_app_cmd(host, NULL, &cmd, MMC_CMD_RETRIES); mmc_send_app_op_cond()
175 if (!(cmd.resp[0] & R1_SPI_IDLE)) mmc_send_app_op_cond()
178 if (cmd.resp[0] & MMC_CARD_BUSY) mmc_send_app_op_cond()
191 *rocr = cmd.resp[0]; mmc_send_app_op_cond()
198 struct mmc_command cmd = {0}; mmc_send_if_cond() local
208 cmd.opcode = SD_SEND_IF_COND; mmc_send_if_cond()
209 cmd.arg = ((ocr & 0xFF8000) != 0) << 8 | test_pattern; mmc_send_if_cond()
210 cmd.flags = MMC_RSP_SPI_R7 | MMC_RSP_R7 | MMC_CMD_BCR; mmc_send_if_cond()
212 err = mmc_wait_for_cmd(host, &cmd, 0); mmc_send_if_cond()
217 result_pattern = cmd.resp[1] & 0xFF; mmc_send_if_cond()
219 result_pattern = cmd.resp[0] & 0xFF; mmc_send_if_cond()
230 struct mmc_command cmd = {0}; mmc_send_relative_addr() local
235 cmd.opcode = SD_SEND_RELATIVE_ADDR; mmc_send_relative_addr()
236 cmd.arg = 0; mmc_send_relative_addr()
237 cmd.flags = MMC_RSP_R6 | MMC_CMD_BCR; mmc_send_relative_addr()
239 err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); mmc_send_relative_addr()
243 *rca = cmd.resp[0] >> 16; mmc_send_relative_addr()
252 struct mmc_command cmd = {0}; mmc_app_send_scr() local
274 mrq.cmd = &cmd; mmc_app_send_scr()
277 cmd.opcode = SD_APP_SEND_SCR; mmc_app_send_scr()
278 cmd.arg = 0; mmc_app_send_scr()
279 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; mmc_app_send_scr()
296 if (cmd.error) mmc_app_send_scr()
297 return cmd.error; mmc_app_send_scr()
311 struct mmc_command cmd = {0}; mmc_sd_switch() local
323 mrq.cmd = &cmd; mmc_sd_switch()
326 cmd.opcode = SD_SWITCH; mmc_sd_switch()
327 cmd.arg = mode << 31 | 0x00FFFFFF; mmc_sd_switch()
328 cmd.arg &= ~(0xF << (group * 4)); mmc_sd_switch()
329 cmd.arg |= value << (group * 4); mmc_sd_switch()
330 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; mmc_sd_switch()
344 if (cmd.error) mmc_sd_switch()
345 return cmd.error; mmc_sd_switch()
356 struct mmc_command cmd = {0}; mmc_app_sd_status() local
370 mrq.cmd = &cmd; mmc_app_sd_status()
373 cmd.opcode = SD_APP_SD_STATUS; mmc_app_sd_status()
374 cmd.arg = 0; mmc_app_sd_status()
375 cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_ADTC; mmc_app_sd_status()
389 if (cmd.error) mmc_app_sd_status()
390 return cmd.error; mmc_app_sd_status()
68 mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card, struct mmc_command *cmd, int retries) mmc_wait_for_app_cmd() argument
H A Dsdio_ops.c24 struct mmc_command cmd = {0}; mmc_send_io_op_cond() local
29 cmd.opcode = SD_IO_SEND_OP_COND; mmc_send_io_op_cond()
30 cmd.arg = ocr; mmc_send_io_op_cond()
31 cmd.flags = MMC_RSP_SPI_R4 | MMC_RSP_R4 | MMC_CMD_BCR; mmc_send_io_op_cond()
34 err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); mmc_send_io_op_cond()
50 if (cmd.resp[1] & MMC_CARD_BUSY) mmc_send_io_op_cond()
53 if (cmd.resp[0] & MMC_CARD_BUSY) mmc_send_io_op_cond()
63 *rocr = cmd.resp[mmc_host_is_spi(host) ? 1 : 0]; mmc_send_io_op_cond()
71 struct mmc_command cmd = {0}; mmc_io_rw_direct_host() local
81 cmd.opcode = SD_IO_RW_DIRECT; mmc_io_rw_direct_host()
82 cmd.arg = write ? 0x80000000 : 0x00000000; mmc_io_rw_direct_host()
83 cmd.arg |= fn << 28; mmc_io_rw_direct_host()
84 cmd.arg |= (write && out) ? 0x08000000 : 0x00000000; mmc_io_rw_direct_host()
85 cmd.arg |= addr << 9; mmc_io_rw_direct_host()
86 cmd.arg |= in; mmc_io_rw_direct_host()
87 cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC; mmc_io_rw_direct_host()
89 err = mmc_wait_for_cmd(host, &cmd, 0); mmc_io_rw_direct_host()
96 if (cmd.resp[0] & R5_ERROR) mmc_io_rw_direct_host()
98 if (cmd.resp[0] & R5_FUNCTION_NUMBER) mmc_io_rw_direct_host()
100 if (cmd.resp[0] & R5_OUT_OF_RANGE) mmc_io_rw_direct_host()
106 *out = (cmd.resp[0] >> 8) & 0xFF; mmc_io_rw_direct_host()
108 *out = cmd.resp[0] & 0xFF; mmc_io_rw_direct_host()
125 struct mmc_command cmd = {0}; mmc_io_rw_extended() local
140 mrq.cmd = &cmd; mmc_io_rw_extended()
143 cmd.opcode = SD_IO_RW_EXTENDED; mmc_io_rw_extended()
144 cmd.arg = write ? 0x80000000 : 0x00000000; mmc_io_rw_extended()
145 cmd.arg |= fn << 28; mmc_io_rw_extended()
146 cmd.arg |= incr_addr ? 0x04000000 : 0x00000000; mmc_io_rw_extended()
147 cmd.arg |= addr << 9; mmc_io_rw_extended()
149 cmd.arg |= (blksz == 512) ? 0 : blksz; /* byte mode */ mmc_io_rw_extended()
151 cmd.arg |= 0x08000000 | blocks; /* block mode */ mmc_io_rw_extended()
152 cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_ADTC; mmc_io_rw_extended()
188 if (cmd.error)
189 return cmd.error;
196 if (cmd.resp[0] & R5_ERROR)
198 if (cmd.resp[0] & R5_FUNCTION_NUMBER)
200 if (cmd.resp[0] & R5_OUT_OF_RANGE)
H A Dmmc_ops.c61 struct mmc_command cmd = {0}; __mmc_send_status() local
66 cmd.opcode = MMC_SEND_STATUS; __mmc_send_status()
68 cmd.arg = card->rca << 16; __mmc_send_status()
69 cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_AC; __mmc_send_status()
71 cmd.flags &= ~MMC_RSP_CRC; __mmc_send_status()
73 err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); __mmc_send_status()
81 *status = cmd.resp[0]; __mmc_send_status()
94 struct mmc_command cmd = {0}; _mmc_select_card() local
98 cmd.opcode = MMC_SELECT_CARD; _mmc_select_card()
101 cmd.arg = card->rca << 16; _mmc_select_card()
102 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; _mmc_select_card()
104 cmd.arg = 0; _mmc_select_card()
105 cmd.flags = MMC_RSP_NONE | MMC_CMD_AC; _mmc_select_card()
108 err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); _mmc_select_card()
137 struct mmc_command cmd = {0}; mmc_set_dsr() local
139 cmd.opcode = MMC_SET_DSR; mmc_set_dsr()
141 cmd.arg = (host->dsr << 16) | 0xffff; mmc_set_dsr()
142 cmd.flags = MMC_RSP_NONE | MMC_CMD_AC; mmc_set_dsr()
144 return mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); mmc_set_dsr()
150 struct mmc_command cmd = {0}; mmc_go_idle() local
166 cmd.opcode = MMC_GO_IDLE_STATE; mmc_go_idle()
167 cmd.arg = 0; mmc_go_idle()
168 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_NONE | MMC_CMD_BC; mmc_go_idle()
170 err = mmc_wait_for_cmd(host, &cmd, 0); mmc_go_idle()
186 struct mmc_command cmd = {0}; mmc_send_op_cond() local
191 cmd.opcode = MMC_SEND_OP_COND; mmc_send_op_cond()
192 cmd.arg = mmc_host_is_spi(host) ? 0 : ocr; mmc_send_op_cond()
193 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R3 | MMC_CMD_BCR; mmc_send_op_cond()
196 err = mmc_wait_for_cmd(host, &cmd, 0); mmc_send_op_cond()
206 if (!(cmd.resp[0] & R1_SPI_IDLE)) mmc_send_op_cond()
209 if (cmd.resp[0] & MMC_CARD_BUSY) mmc_send_op_cond()
219 *rocr = cmd.resp[0]; mmc_send_op_cond()
227 struct mmc_command cmd = {0}; mmc_all_send_cid() local
232 cmd.opcode = MMC_ALL_SEND_CID; mmc_all_send_cid()
233 cmd.arg = 0; mmc_all_send_cid()
234 cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR; mmc_all_send_cid()
236 err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); mmc_all_send_cid()
240 memcpy(cid, cmd.resp, sizeof(u32) * 4); mmc_all_send_cid()
248 struct mmc_command cmd = {0}; mmc_set_relative_addr() local
253 cmd.opcode = MMC_SET_RELATIVE_ADDR; mmc_set_relative_addr()
254 cmd.arg = card->rca << 16; mmc_set_relative_addr()
255 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; mmc_set_relative_addr()
257 err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); mmc_set_relative_addr()
268 struct mmc_command cmd = {0}; mmc_send_cxd_native() local
273 cmd.opcode = opcode; mmc_send_cxd_native()
274 cmd.arg = arg; mmc_send_cxd_native()
275 cmd.flags = MMC_RSP_R2 | MMC_CMD_AC; mmc_send_cxd_native()
277 err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); mmc_send_cxd_native()
281 memcpy(cxd, cmd.resp, sizeof(u32) * 4); mmc_send_cxd_native()
295 struct mmc_command cmd = {0}; mmc_send_cxd_data() local
299 mrq.cmd = &cmd; mmc_send_cxd_data()
302 cmd.opcode = opcode; mmc_send_cxd_data()
303 cmd.arg = 0; mmc_send_cxd_data()
310 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; mmc_send_cxd_data()
332 if (cmd.error) mmc_send_cxd_data()
333 return cmd.error; mmc_send_cxd_data()
425 struct mmc_command cmd = {0}; mmc_spi_read_ocr() local
428 cmd.opcode = MMC_SPI_READ_OCR; mmc_spi_read_ocr()
429 cmd.arg = highcap ? (1 << 30) : 0; mmc_spi_read_ocr()
430 cmd.flags = MMC_RSP_SPI_R3; mmc_spi_read_ocr()
432 err = mmc_wait_for_cmd(host, &cmd, 0); mmc_spi_read_ocr()
434 *ocrp = cmd.resp[1]; mmc_spi_read_ocr()
440 struct mmc_command cmd = {0}; mmc_spi_set_crc() local
443 cmd.opcode = MMC_SPI_CRC_ON_OFF; mmc_spi_set_crc()
444 cmd.flags = MMC_RSP_SPI_R1; mmc_spi_set_crc()
445 cmd.arg = use_crc; mmc_spi_set_crc()
447 err = mmc_wait_for_cmd(host, &cmd, 0); mmc_spi_set_crc()
471 * @set: cmd set values
477 * @send_status: send status cmd to poll for busy
478 * @ignore_crc: ignore CRC errors when sending status cmd to poll for busy
488 struct mmc_command cmd = {0}; __mmc_switch() local
496 * If the cmd timeout and the max_busy_timeout of the host are both __mmc_switch()
505 cmd.opcode = MMC_SWITCH; __mmc_switch()
506 cmd.arg = (MMC_SWITCH_MODE_WRITE_BYTE << 24) | __mmc_switch()
510 cmd.flags = MMC_CMD_AC; __mmc_switch()
512 cmd.flags |= MMC_RSP_SPI_R1B | MMC_RSP_R1B; __mmc_switch()
517 cmd.busy_timeout = timeout_ms; __mmc_switch()
519 cmd.flags |= MMC_RSP_SPI_R1 | MMC_RSP_R1; __mmc_switch()
523 cmd.sanitize_busy = true; __mmc_switch()
525 err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); __mmc_switch()
540 /* We have an unspecified cmd timeout, use the fallback value. */ __mmc_switch()
594 struct mmc_command cmd = {0}; mmc_send_tuning() local
615 mrq.cmd = &cmd; mmc_send_tuning()
618 cmd.opcode = opcode; mmc_send_tuning()
619 cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC; mmc_send_tuning()
639 *cmd_error = cmd.error; mmc_send_tuning()
641 if (cmd.error) { mmc_send_tuning()
642 err = cmd.error; mmc_send_tuning()
665 struct mmc_command cmd = {0}; mmc_send_bus_test() local
695 mrq.cmd = &cmd; mmc_send_bus_test()
697 cmd.opcode = opcode; mmc_send_bus_test()
698 cmd.arg = 0; mmc_send_bus_test()
705 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; mmc_send_bus_test()
729 if (cmd.error) mmc_send_bus_test()
730 return cmd.error; mmc_send_bus_test()
761 struct mmc_command cmd = {0}; mmc_send_hpi_cmd() local
773 cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; mmc_send_hpi_cmd()
775 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; mmc_send_hpi_cmd()
777 cmd.opcode = opcode; mmc_send_hpi_cmd()
778 cmd.arg = card->rca << 16 | 1; mmc_send_hpi_cmd()
780 err = mmc_wait_for_cmd(card->host, &cmd, 0); mmc_send_hpi_cmd()
784 err, cmd.resp[0]); mmc_send_hpi_cmd()
788 *status = cmd.resp[0]; mmc_send_hpi_cmd()
/linux-4.4.14/drivers/media/usb/cpia2/
H A Dcpia2_core.c144 struct cpia2_command cmd; cpia2_do_command() local
147 cmd.command = command; cpia2_do_command()
148 cmd.reg_count = 2; /* default */ cpia2_do_command()
149 cmd.direction = direction; cpia2_do_command()
156 cmd.req_mode = cpia2_do_command()
158 cmd.start = CPIA2_SYSTEM_DEVICE_HI; cpia2_do_command()
161 cmd.req_mode = cpia2_do_command()
163 cmd.reg_count = 8; cpia2_do_command()
164 cmd.start = CPIA2_SYSTEM_DESCRIP_VID_HI; cpia2_do_command()
167 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC; cpia2_do_command()
168 cmd.start = CPIA2_VC_ASIC_ID; cpia2_do_command()
171 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
172 cmd.start = CPIA2_VP_SENSOR_FLAGS; cpia2_do_command()
175 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
176 cmd.start = CPIA2_VP_DEVICEH; cpia2_do_command()
179 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
181 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
182 cmd.reg_count = 1; cpia2_do_command()
184 cmd.start = CPIA2_VP4_EXPOSURE_TARGET; cpia2_do_command()
186 cmd.start = CPIA2_VP5_EXPOSURE_TARGET; cpia2_do_command()
189 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
191 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
192 cmd.reg_count = 1; cpia2_do_command()
193 cmd.start = CPIA2_VP_YRANGE; cpia2_do_command()
196 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
198 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
199 cmd.reg_count = 1; cpia2_do_command()
201 cmd.start = CPIA2_VP_SATURATION; cpia2_do_command()
203 cmd.start = CPIA2_VP5_MCUVSATURATION; cpia2_do_command()
206 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
208 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
209 cmd.reg_count = 1; cpia2_do_command()
210 cmd.start = CPIA2_VP_GPIO_DATA; cpia2_do_command()
213 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
215 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
216 cmd.reg_count = 1; cpia2_do_command()
217 cmd.start = CPIA2_VP_GPIO_DIRECTION; cpia2_do_command()
220 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
222 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC; cpia2_do_command()
223 cmd.reg_count = 1; cpia2_do_command()
224 cmd.start = CPIA2_VC_MP_DATA; cpia2_do_command()
227 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
229 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC; cpia2_do_command()
230 cmd.reg_count = 1; cpia2_do_command()
231 cmd.start = CPIA2_VC_MP_DIR; cpia2_do_command()
234 cmd.req_mode = cpia2_do_command()
236 cmd.start = CPIA2_SYSTEM_INT_PACKET_CTRL; cpia2_do_command()
237 cmd.reg_count = 1; cpia2_do_command()
238 cmd.buffer.block_data[0] = param; cpia2_do_command()
241 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
243 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
244 cmd.reg_count = 1; cpia2_do_command()
245 cmd.start = CPIA2_VP_FLICKER_MODES; cpia2_do_command()
248 cmd.req_mode = CAMERAACCESS_TYPE_RANDOM | CAMERAACCESS_VC; cpia2_do_command()
249 cmd.reg_count = 2; cpia2_do_command()
250 cmd.start = 0; cpia2_do_command()
251 cmd.buffer.registers[0].index = CPIA2_VC_ST_CTRL; cpia2_do_command()
252 cmd.buffer.registers[0].value = CPIA2_VC_ST_CTRL_SRC_VC | cpia2_do_command()
254 cmd.buffer.registers[1].index = CPIA2_VC_ST_CTRL; cpia2_do_command()
255 cmd.buffer.registers[1].value = CPIA2_VC_ST_CTRL_SRC_VC | cpia2_do_command()
261 cmd.req_mode = cpia2_do_command()
263 cmd.reg_count = 2; cpia2_do_command()
264 cmd.buffer.registers[0].index = cpia2_do_command()
266 cmd.buffer.registers[1].index = cpia2_do_command()
268 cmd.buffer.registers[0].value = CPIA2_SYSTEM_CONTROL_CLEAR_ERR; cpia2_do_command()
269 cmd.buffer.registers[1].value = cpia2_do_command()
273 cmd.req_mode = cpia2_do_command()
275 cmd.reg_count = 1; cpia2_do_command()
276 cmd.start = CPIA2_SYSTEM_SYSTEM_CONTROL; cpia2_do_command()
277 cmd.buffer.block_data[0] = 0; cpia2_do_command()
280 cmd.req_mode = cpia2_do_command()
282 cmd.reg_count = 1; cpia2_do_command()
283 cmd.start = CPIA2_SYSTEM_SYSTEM_CONTROL; cpia2_do_command()
284 cmd.buffer.block_data[0] = CPIA2_SYSTEM_CONTROL_CLEAR_ERR; cpia2_do_command()
287 cmd.buffer.block_data[0] = param; cpia2_do_command()
289 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
290 cmd.reg_count = 1; cpia2_do_command()
292 cmd.start = CPIA2_VP4_USER_MODE; cpia2_do_command()
294 cmd.start = CPIA2_VP5_USER_MODE; cpia2_do_command()
297 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
298 cmd.reg_count = 1; cpia2_do_command()
300 cmd.start = CPIA2_VP4_FRAMERATE_REQUEST; cpia2_do_command()
302 cmd.start = CPIA2_VP5_FRAMERATE_REQUEST; cpia2_do_command()
303 cmd.buffer.block_data[0] = param; cpia2_do_command()
306 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
308 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC; cpia2_do_command()
309 cmd.reg_count = 1; cpia2_do_command()
310 cmd.start = CPIA2_VC_WAKEUP; cpia2_do_command()
313 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
315 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC; cpia2_do_command()
316 cmd.reg_count = 1; cpia2_do_command()
317 cmd.start = CPIA2_VC_PW_CTRL; cpia2_do_command()
320 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
321 cmd.reg_count = 1; cpia2_do_command()
322 cmd.start = CPIA2_VP_SYSTEMSTATE; cpia2_do_command()
325 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
327 cmd.req_mode = cpia2_do_command()
329 cmd.reg_count = 1; cpia2_do_command()
330 cmd.start = CPIA2_SYSTEM_SYSTEM_CONTROL; cpia2_do_command()
333 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
335 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
336 cmd.reg_count = 1; cpia2_do_command()
337 cmd.start = CPIA2_VP_SYSTEMCTRL; cpia2_do_command()
340 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
342 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
343 cmd.reg_count = 1; cpia2_do_command()
344 cmd.start = CPIA2_VP_EXPOSURE_MODES; cpia2_do_command()
347 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
349 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
350 cmd.reg_count = 1; cpia2_do_command()
351 cmd.start = CPIA2_VP_DEVICE_CONFIG; cpia2_do_command()
354 cmd.buffer.block_data[0] = param; cpia2_do_command()
355 cmd.req_mode = cpia2_do_command()
357 cmd.reg_count = 1; cpia2_do_command()
358 cmd.start = CPIA2_SYSTEM_VP_SERIAL_ADDR; cpia2_do_command()
361 cmd.buffer.block_data[0] = param; cpia2_do_command()
362 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
363 cmd.reg_count = 1; cpia2_do_command()
364 cmd.start = CPIA2_SENSOR_CR1; cpia2_do_command()
367 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
369 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC; cpia2_do_command()
370 cmd.reg_count = 1; cpia2_do_command()
371 cmd.start = CPIA2_VC_VC_CTRL; cpia2_do_command()
374 cmd.req_mode = CAMERAACCESS_TYPE_RANDOM | CAMERAACCESS_VC; cpia2_do_command()
375 cmd.reg_count = 1; cpia2_do_command()
376 cmd.buffer.registers[0].index = CPIA2_VC_VC_TARGET_KB; cpia2_do_command()
377 cmd.buffer.registers[0].value = param; cpia2_do_command()
380 cmd.req_mode = CAMERAACCESS_TYPE_RANDOM | CAMERAACCESS_VC; cpia2_do_command()
381 cmd.reg_count = 4; cpia2_do_command()
382 cmd.buffer.registers[0].index = CPIA2_VC_VC_JPEG_OPT; cpia2_do_command()
383 cmd.buffer.registers[0].value = cpia2_do_command()
385 cmd.buffer.registers[1].index = CPIA2_VC_VC_USER_SQUEEZE; cpia2_do_command()
386 cmd.buffer.registers[1].value = 20; cpia2_do_command()
387 cmd.buffer.registers[2].index = CPIA2_VC_VC_CREEP_PERIOD; cpia2_do_command()
388 cmd.buffer.registers[2].value = 2; cpia2_do_command()
389 cmd.buffer.registers[3].index = CPIA2_VC_VC_JPEG_OPT; cpia2_do_command()
390 cmd.buffer.registers[3].value = CPIA2_VC_VC_JPEG_OPT_DEFAULT; cpia2_do_command()
393 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
394 cmd.reg_count = 1; cpia2_do_command()
395 cmd.start = CPIA2_VP_REHASH_VALUES; cpia2_do_command()
396 cmd.buffer.block_data[0] = param; cpia2_do_command()
401 cmd.buffer.block_data[0] = param; /* Then fall through */ cpia2_do_command()
403 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_do_command()
404 cmd.reg_count = 1; cpia2_do_command()
406 cmd.start = CPIA2_VP4_USER_EFFECTS; cpia2_do_command()
408 cmd.start = CPIA2_VP5_USER_EFFECTS; cpia2_do_command()
415 retval = cpia2_send_command(cam, &cmd); cpia2_do_command()
426 cmd.buffer.block_data[0]; cpia2_do_command()
428 cmd.buffer.block_data[1]; cpia2_do_command()
431 cam->params.pnp_id.vendor = (cmd.buffer.block_data[0] << 8) | cpia2_do_command()
432 cmd.buffer.block_data[1]; cpia2_do_command()
433 cam->params.pnp_id.product = (cmd.buffer.block_data[2] << 8) | cpia2_do_command()
434 cmd.buffer.block_data[3]; cpia2_do_command()
436 (cmd.buffer.block_data[4] << 8) | cpia2_do_command()
437 cmd.buffer.block_data[5]; cpia2_do_command()
448 cam->params.version.asic_id = cmd.buffer.block_data[0]; cpia2_do_command()
449 cam->params.version.asic_rev = cmd.buffer.block_data[1]; cpia2_do_command()
452 cam->params.version.sensor_flags = cmd.buffer.block_data[0]; cpia2_do_command()
453 cam->params.version.sensor_rev = cmd.buffer.block_data[1]; cpia2_do_command()
456 cam->params.version.vp_device_hi = cmd.buffer.block_data[0]; cpia2_do_command()
457 cam->params.version.vp_device_lo = cmd.buffer.block_data[1]; cpia2_do_command()
460 cam->params.vp_params.gpio_data = cmd.buffer.block_data[0]; cpia2_do_command()
463 cam->params.vp_params.gpio_direction = cmd.buffer.block_data[0]; cpia2_do_command()
466 cam->params.vc_params.vc_mp_direction =cmd.buffer.block_data[0]; cpia2_do_command()
469 cam->params.vc_params.vc_mp_data = cmd.buffer.block_data[0]; cpia2_do_command()
473 cmd.buffer.block_data[0]; cpia2_do_command()
476 cam->params.vc_params.wakeup = cmd.buffer.block_data[0]; cpia2_do_command()
479 cam->params.vc_params.pw_control = cmd.buffer.block_data[0]; cpia2_do_command()
482 cam->params.camera_state.system_ctrl = cmd.buffer.block_data[0]; cpia2_do_command()
485 cam->params.vp_params.system_state = cmd.buffer.block_data[0]; cpia2_do_command()
488 cam->params.vp_params.system_ctrl = cmd.buffer.block_data[0]; cpia2_do_command()
491 cam->params.vp_params.exposure_modes = cmd.buffer.block_data[0]; cpia2_do_command()
494 cam->params.vp_params.device_config = cmd.buffer.block_data[0]; cpia2_do_command()
497 cam->params.vc_params.vc_control = cmd.buffer.block_data[0]; cpia2_do_command()
500 cam->params.vp_params.video_mode = cmd.buffer.block_data[0]; cpia2_do_command()
503 cam->params.vp_params.user_effects = cmd.buffer.block_data[0]; cpia2_do_command()
517 #define DIR(cmd) ((cmd->direction == TRANSFER_WRITE) ? "Write" : "Read")
518 #define BINDEX(cmd) (cmd->req_mode & 0x03)
520 int cpia2_send_command(struct camera_data *cam, struct cpia2_command *cmd) cpia2_send_command() argument
527 switch (cmd->req_mode & 0x0c) { cpia2_send_command()
529 count = cmd->reg_count * sizeof(struct cpia2_register); cpia2_send_command()
531 buffer = (u8 *) & cmd->buffer; cpia2_send_command()
533 DBG("%s Random: Register block %s\n", DIR(cmd), cpia2_send_command()
534 block_name[BINDEX(cmd)]); cpia2_send_command()
537 count = cmd->reg_count; cpia2_send_command()
538 start = cmd->start; cpia2_send_command()
539 buffer = cmd->buffer.block_data; cpia2_send_command()
541 DBG("%s Block: Register block %s\n", DIR(cmd), cpia2_send_command()
542 block_name[BINDEX(cmd)]); cpia2_send_command()
545 count = cmd->reg_count * sizeof(struct cpia2_reg_mask); cpia2_send_command()
547 buffer = (u8 *) & cmd->buffer; cpia2_send_command()
549 DBG("%s Mask: Register block %s\n", DIR(cmd), cpia2_send_command()
550 block_name[BINDEX(cmd)]); cpia2_send_command()
553 count = cmd->reg_count; cpia2_send_command()
554 start = cmd->start; cpia2_send_command()
555 buffer = cmd->buffer.block_data; cpia2_send_command()
557 DBG("%s Repeat: Register block %s\n", DIR(cmd), cpia2_send_command()
558 block_name[BINDEX(cmd)]); cpia2_send_command()
567 cmd->req_mode, cpia2_send_command()
568 start, count, cmd->direction); cpia2_send_command()
572 for (i = 0; i < cmd->reg_count; i++) { cpia2_send_command()
573 if((cmd->req_mode & 0x0c) == CAMERAACCESS_TYPE_BLOCK) cpia2_send_command()
575 DIR(cmd), start + i, buffer[i]); cpia2_send_command()
576 if((cmd->req_mode & 0x0c) == CAMERAACCESS_TYPE_RANDOM) cpia2_send_command()
578 DIR(cmd), cmd->buffer.registers[i].index, cpia2_send_command()
579 cmd->buffer.registers[i].value); cpia2_send_command()
616 struct cpia2_command cmd; cpia2_reset_camera() local
630 cmd.req_mode = CAMERAACCESS_TYPE_RANDOM | CAMERAACCESS_VC; cpia2_reset_camera()
631 cmd.direction = TRANSFER_WRITE; cpia2_reset_camera()
632 cmd.reg_count = 2; cpia2_reset_camera()
633 cmd.buffer.registers[0].index = CPIA2_VC_ST_CTRL; cpia2_reset_camera()
634 cmd.buffer.registers[0].value = CPIA2_VC_ST_CTRL_SRC_VC | cpia2_reset_camera()
636 cmd.buffer.registers[1].index = CPIA2_VC_ST_CTRL; cpia2_reset_camera()
637 cmd.buffer.registers[1].value = CPIA2_VC_ST_CTRL_SRC_VC | cpia2_reset_camera()
641 cpia2_send_command(cam, &cmd); cpia2_reset_camera()
647 cmd.req_mode = CAMERAACCESS_TYPE_RANDOM | CAMERAACCESS_SYSTEM; cpia2_reset_camera()
648 cmd.buffer.registers[0].index = CPIA2_SYSTEM_INT_PACKET_CTRL; cpia2_reset_camera()
649 cmd.buffer.registers[0].value = cpia2_reset_camera()
651 cmd.reg_count = 1; cpia2_reset_camera()
652 cpia2_send_command(cam, &cmd); cpia2_reset_camera()
667 cmd.req_mode = CAMERAACCESS_TYPE_RANDOM | CAMERAACCESS_VP; cpia2_reset_camera()
670 cmd.buffer.registers[0].index = CPIA2_VP5_MYBLACK_LEVEL; cpia2_reset_camera()
671 cmd.buffer.registers[0].value = 0; /* reduce from the default cpia2_reset_camera()
673 cmd.buffer.registers[1].index = CPIA2_VP5_MCYRANGE; cpia2_reset_camera()
674 cmd.buffer.registers[1].value = 0x92; /* increase from 100% to cpia2_reset_camera()
677 cmd.buffer.registers[2].index = CPIA2_VP5_MYCEILING; cpia2_reset_camera()
678 cmd.buffer.registers[2].value = 0xFF; /* Increase from the cpia2_reset_camera()
681 cmd.buffer.registers[3].index = CPIA2_VP5_MCUVSATURATION; cpia2_reset_camera()
682 cmd.buffer.registers[3].value = 0xFF; /* Increase from the rec cpia2_reset_camera()
685 cmd.buffer.registers[4].index = CPIA2_VP5_ANTIFLKRSETUP; cpia2_reset_camera()
686 cmd.buffer.registers[4].value = 0x80; /* Inhibit the cpia2_reset_camera()
690 cmd.buffer.registers[5].index = CPIA2_VP_RAM_ADDR_H; cpia2_reset_camera()
691 cmd.buffer.registers[5].value = 0x01; cpia2_reset_camera()
692 cmd.buffer.registers[6].index = CPIA2_VP_RAM_ADDR_L; cpia2_reset_camera()
693 cmd.buffer.registers[6].value = 0xE3; cpia2_reset_camera()
694 cmd.buffer.registers[7].index = CPIA2_VP_RAM_DATA; cpia2_reset_camera()
695 cmd.buffer.registers[7].value = 0x02; cpia2_reset_camera()
696 cmd.buffer.registers[8].index = CPIA2_VP_RAM_DATA; cpia2_reset_camera()
697 cmd.buffer.registers[8].value = 0xFC; cpia2_reset_camera()
699 cmd.direction = TRANSFER_WRITE; cpia2_reset_camera()
700 cmd.reg_count = 9; cpia2_reset_camera()
702 cpia2_send_command(cam, &cmd); cpia2_reset_camera()
726 cmd.buffer.registers[0].value = tmp_reg & cpia2_reset_camera()
730 cmd.buffer.registers[1].value = cam->params.vp_params.device_config | cpia2_reset_camera()
732 cmd.buffer.registers[0].index = CPIA2_VP_SYSTEMCTRL; cpia2_reset_camera()
733 cmd.buffer.registers[1].index = CPIA2_VP_DEVICE_CONFIG; cpia2_reset_camera()
734 cmd.req_mode = CAMERAACCESS_TYPE_RANDOM | CAMERAACCESS_VP; cpia2_reset_camera()
735 cmd.reg_count = 2; cpia2_reset_camera()
736 cmd.direction = TRANSFER_WRITE; cpia2_reset_camera()
737 cmd.start = 0; cpia2_reset_camera()
738 cpia2_send_command(cam, &cmd); cpia2_reset_camera()
772 cmd.buffer.registers[0].value = cam->params.vp_params.device_config & cpia2_reset_camera()
776 cmd.buffer.registers[1].value = cpia2_reset_camera()
779 cmd.buffer.registers[0].index = CPIA2_VP_DEVICE_CONFIG; cpia2_reset_camera()
780 cmd.buffer.registers[1].index = CPIA2_VP_SYSTEMCTRL; cpia2_reset_camera()
781 cmd.req_mode = CAMERAACCESS_TYPE_RANDOM | CAMERAACCESS_VP; cpia2_reset_camera()
782 cmd.reg_count = 2; cpia2_reset_camera()
783 cmd.direction = TRANSFER_WRITE; cpia2_reset_camera()
785 cpia2_send_command(cam, &cmd); cpia2_reset_camera()
893 struct cpia2_command *cmd, cpia2_send_onebyte_command()
896 cmd->buffer.block_data[0] = datum; cpia2_send_onebyte_command()
897 cmd->start = start; cpia2_send_onebyte_command()
898 cmd->reg_count = 1; cpia2_send_onebyte_command()
899 return cpia2_send_command(cam, cmd); cpia2_send_onebyte_command()
907 struct cpia2_command cmd; apply_vp_patch() local
916 cmd.req_mode = CAMERAACCESS_TYPE_REPEAT | CAMERAACCESS_VP; apply_vp_patch()
917 cmd.direction = TRANSFER_WRITE; apply_vp_patch()
920 cpia2_send_onebyte_command(cam, &cmd, 0x0A, fw->data[0]); /* hi */ apply_vp_patch()
921 cpia2_send_onebyte_command(cam, &cmd, 0x0B, fw->data[1]); /* lo */ apply_vp_patch()
925 cmd.start = 0x0C; /* Data */ apply_vp_patch()
926 cmd.reg_count = min_t(int, 64, fw->size - i); apply_vp_patch()
927 memcpy(cmd.buffer.block_data, &fw->data[i], cmd.reg_count); apply_vp_patch()
928 cpia2_send_command(cam, &cmd); apply_vp_patch()
932 cpia2_send_onebyte_command(cam, &cmd, 0x0A, fw->data[0]); /* hi */ apply_vp_patch()
933 cpia2_send_onebyte_command(cam, &cmd, 0x0B, fw->data[1]); /* lo */ apply_vp_patch()
936 cpia2_send_onebyte_command(cam, &cmd, 0x0D, 1); apply_vp_patch()
1146 struct cpia2_command cmd; config_sensor_410() local
1189 cmd.req_mode = CAMERAACCESS_TYPE_RANDOM | CAMERAACCESS_VC; config_sensor_410()
1190 cmd.direction = TRANSFER_WRITE; config_sensor_410()
1193 cmd.buffer.registers[i].index = CPIA2_VC_VC_FORMAT; config_sensor_410()
1195 cmd.buffer.registers[i++].value = config_sensor_410()
1199 cmd.buffer.registers[i++].value = config_sensor_410()
1204 cmd.buffer.registers[i].index = CPIA2_VC_VC_CLOCKS; config_sensor_410()
1207 cmd.buffer.registers[i++].value= config_sensor_410()
1214 cmd.buffer.registers[i++].value= config_sensor_410()
1220 cmd.buffer.registers[i++].value = config_sensor_410()
1225 cmd.buffer.registers[i++].value = config_sensor_410()
1231 DBG("VC_Clocks (0xc4) = 0x%0X\n", cmd.buffer.registers[i-1].value); config_sensor_410()
1234 cmd.buffer.registers[i].index = CPIA2_VC_VC_IHSIZE_LO; config_sensor_410()
1236 cmd.buffer.registers[i++].value = config_sensor_410()
1239 cmd.buffer.registers[i++].value = config_sensor_410()
1243 cmd.buffer.registers[i].index = CPIA2_VC_VC_XLIM_HI; config_sensor_410()
1245 cmd.buffer.registers[i++].value = (u8) 0; config_sensor_410()
1247 cmd.buffer.registers[i++].value = (u8) 1; config_sensor_410()
1249 cmd.buffer.registers[i].index = CPIA2_VC_VC_XLIM_LO; config_sensor_410()
1251 cmd.buffer.registers[i++].value = (u8) 208; config_sensor_410()
1253 cmd.buffer.registers[i++].value = (u8) 160; config_sensor_410()
1255 cmd.buffer.registers[i].index = CPIA2_VC_VC_YLIM_HI; config_sensor_410()
1257 cmd.buffer.registers[i++].value = (u8) 0; config_sensor_410()
1259 cmd.buffer.registers[i++].value = (u8) 1; config_sensor_410()
1261 cmd.buffer.registers[i].index = CPIA2_VC_VC_YLIM_LO; config_sensor_410()
1263 cmd.buffer.registers[i++].value = (u8) 160; config_sensor_410()
1265 cmd.buffer.registers[i++].value = (u8) 64; config_sensor_410()
1268 cmd.buffer.registers[i].index = CPIA2_VC_VC_OHSIZE; config_sensor_410()
1269 cmd.buffer.registers[i++].value = cam->params.roi.width / 4; config_sensor_410()
1271 cmd.buffer.registers[i].index = CPIA2_VC_VC_OVSIZE; config_sensor_410()
1272 cmd.buffer.registers[i++].value = cam->params.roi.height / 4; config_sensor_410()
1275 cmd.buffer.registers[i].index = CPIA2_VC_VC_HCROP; config_sensor_410()
1277 cmd.buffer.registers[i++].value = config_sensor_410()
1280 cmd.buffer.registers[i++].value = config_sensor_410()
1283 cmd.buffer.registers[i].index = CPIA2_VC_VC_VCROP; config_sensor_410()
1285 cmd.buffer.registers[i++].value = config_sensor_410()
1288 cmd.buffer.registers[i++].value = config_sensor_410()
1292 cmd.buffer.registers[i].index = CPIA2_VC_VC_HPHASE; config_sensor_410()
1293 cmd.buffer.registers[i++].value = (u8) 0; config_sensor_410()
1295 cmd.buffer.registers[i].index = CPIA2_VC_VC_VPHASE; config_sensor_410()
1296 cmd.buffer.registers[i++].value = (u8) 0; config_sensor_410()
1298 cmd.buffer.registers[i].index = CPIA2_VC_VC_HISPAN; config_sensor_410()
1299 cmd.buffer.registers[i++].value = (u8) 31; config_sensor_410()
1301 cmd.buffer.registers[i].index = CPIA2_VC_VC_VISPAN; config_sensor_410()
1302 cmd.buffer.registers[i++].value = (u8) 31; config_sensor_410()
1304 cmd.buffer.registers[i].index = CPIA2_VC_VC_HICROP; config_sensor_410()
1305 cmd.buffer.registers[i++].value = (u8) 0; config_sensor_410()
1307 cmd.buffer.registers[i].index = CPIA2_VC_VC_VICROP; config_sensor_410()
1308 cmd.buffer.registers[i++].value = (u8) 0; config_sensor_410()
1310 cmd.buffer.registers[i].index = CPIA2_VC_VC_HFRACT; config_sensor_410()
1311 cmd.buffer.registers[i++].value = (u8) 0x81; /* = 8/1 = 8 (HIBYTE/LOBYTE) */ config_sensor_410()
1313 cmd.buffer.registers[i].index = CPIA2_VC_VC_VFRACT; config_sensor_410()
1314 cmd.buffer.registers[i++].value = (u8) 0x81; /* = 8/1 = 8 (HIBYTE/LOBYTE) */ config_sensor_410()
1316 cmd.reg_count = i; config_sensor_410()
1318 cpia2_send_command(cam, &cmd); config_sensor_410()
1332 struct cpia2_command cmd; config_sensor_500() local
1363 cmd.req_mode = CAMERAACCESS_TYPE_RANDOM | CAMERAACCESS_VC; config_sensor_500()
1364 cmd.direction = TRANSFER_WRITE; config_sensor_500()
1368 cmd.buffer.registers[i].index = CPIA2_VC_VC_FORMAT; config_sensor_500()
1369 cmd.buffer.registers[i].value = (u8) CPIA2_VC_VC_FORMAT_UFIRST; config_sensor_500()
1371 cmd.buffer.registers[i].value |= (u8) CPIA2_VC_VC_FORMAT_DECIMATING; config_sensor_500()
1375 cmd.buffer.registers[i].index = CPIA2_VC_VC_CLOCKS; config_sensor_500()
1378 cmd.buffer.registers[i].value = config_sensor_500()
1381 cmd.buffer.registers[i].value = config_sensor_500()
1386 cmd.buffer.registers[i].value = config_sensor_500()
1389 cmd.buffer.registers[i].value = config_sensor_500()
1395 DBG("VC_CLOCKS = 0x%X\n", cmd.buffer.registers[i-1].value); config_sensor_500()
1398 cmd.buffer.registers[i].index = CPIA2_VC_VC_IHSIZE_LO; config_sensor_500()
1400 cmd.buffer.registers[i].value = config_sensor_500()
1403 cmd.buffer.registers[i].value = config_sensor_500()
1406 DBG("Input width = %d\n", cmd.buffer.registers[i-1].value); config_sensor_500()
1409 cmd.buffer.registers[i].index = CPIA2_VC_VC_XLIM_HI; config_sensor_500()
1411 cmd.buffer.registers[i++].value = (u8) 2; config_sensor_500()
1413 cmd.buffer.registers[i++].value = (u8) 1; config_sensor_500()
1415 cmd.buffer.registers[i].index = CPIA2_VC_VC_XLIM_LO; config_sensor_500()
1417 cmd.buffer.registers[i++].value = (u8) 250; config_sensor_500()
1419 cmd.buffer.registers[i++].value = (u8) 125; config_sensor_500()
1421 cmd.buffer.registers[i++].value = (u8) 160; config_sensor_500()
1423 cmd.buffer.registers[i].index = CPIA2_VC_VC_YLIM_HI; config_sensor_500()
1425 cmd.buffer.registers[i++].value = (u8) 2; config_sensor_500()
1427 cmd.buffer.registers[i++].value = (u8) 1; config_sensor_500()
1429 cmd.buffer.registers[i].index = CPIA2_VC_VC_YLIM_LO; config_sensor_500()
1431 cmd.buffer.registers[i++].value = (u8) 12; config_sensor_500()
1433 cmd.buffer.registers[i++].value = (u8) 64; config_sensor_500()
1435 cmd.buffer.registers[i++].value = (u8) 6; config_sensor_500()
1438 cmd.buffer.registers[i].index = CPIA2_VC_VC_OHSIZE; config_sensor_500()
1440 cmd.buffer.registers[i++].value = STV_IMAGE_CIF_COLS / 4; config_sensor_500()
1442 cmd.buffer.registers[i++].value = width / 4; config_sensor_500()
1444 cmd.buffer.registers[i].index = CPIA2_VC_VC_OVSIZE; config_sensor_500()
1446 cmd.buffer.registers[i++].value = STV_IMAGE_CIF_ROWS / 4; config_sensor_500()
1448 cmd.buffer.registers[i++].value = height / 4; config_sensor_500()
1451 cmd.buffer.registers[i].index = CPIA2_VC_VC_HCROP; config_sensor_500()
1453 cmd.buffer.registers[i++].value = config_sensor_500()
1456 cmd.buffer.registers[i++].value = config_sensor_500()
1459 cmd.buffer.registers[i++].value = config_sensor_500()
1462 cmd.buffer.registers[i++].value = config_sensor_500()
1465 cmd.buffer.registers[i].index = CPIA2_VC_VC_VCROP; config_sensor_500()
1467 cmd.buffer.registers[i++].value = config_sensor_500()
1470 cmd.buffer.registers[i++].value = config_sensor_500()
1473 cmd.buffer.registers[i++].value = config_sensor_500()
1476 cmd.buffer.registers[i++].value = config_sensor_500()
1480 cmd.buffer.registers[i].index = CPIA2_VC_VC_HPHASE; config_sensor_500()
1482 cmd.buffer.registers[i++].value = (u8) 36; config_sensor_500()
1484 cmd.buffer.registers[i++].value = (u8) 0; config_sensor_500()
1486 cmd.buffer.registers[i].index = CPIA2_VC_VC_VPHASE; config_sensor_500()
1488 cmd.buffer.registers[i++].value = (u8) 32; config_sensor_500()
1490 cmd.buffer.registers[i++].value = (u8) 0; config_sensor_500()
1492 cmd.buffer.registers[i].index = CPIA2_VC_VC_HISPAN; config_sensor_500()
1494 cmd.buffer.registers[i++].value = (u8) 26; config_sensor_500()
1496 cmd.buffer.registers[i++].value = (u8) 31; config_sensor_500()
1498 cmd.buffer.registers[i].index = CPIA2_VC_VC_VISPAN; config_sensor_500()
1500 cmd.buffer.registers[i++].value = (u8) 21; config_sensor_500()
1502 cmd.buffer.registers[i++].value = (u8) 31; config_sensor_500()
1504 cmd.buffer.registers[i].index = CPIA2_VC_VC_HICROP; config_sensor_500()
1505 cmd.buffer.registers[i++].value = (u8) 0; config_sensor_500()
1507 cmd.buffer.registers[i].index = CPIA2_VC_VC_VICROP; config_sensor_500()
1508 cmd.buffer.registers[i++].value = (u8) 0; config_sensor_500()
1510 cmd.buffer.registers[i].index = CPIA2_VC_VC_HFRACT; config_sensor_500()
1512 cmd.buffer.registers[i++].value = (u8) 0x2B; /* 2/11 */ config_sensor_500()
1514 cmd.buffer.registers[i++].value = (u8) 0x81; /* 8/1 */ config_sensor_500()
1516 cmd.buffer.registers[i].index = CPIA2_VC_VC_VFRACT; config_sensor_500()
1518 cmd.buffer.registers[i++].value = (u8) 0x13; /* 1/3 */ config_sensor_500()
1520 cmd.buffer.registers[i++].value = (u8) 0x81; /* 8/1 */ config_sensor_500()
1522 cmd.reg_count = i; config_sensor_500()
1524 cpia2_send_command(cam, &cmd); config_sensor_500()
1831 struct cpia2_command cmd; set_lowlight_boost() local
1837 cmd.direction = TRANSFER_WRITE; set_lowlight_boost()
1838 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; set_lowlight_boost()
1839 cmd.reg_count = 3; set_lowlight_boost()
1840 cmd.start = CPIA2_VP_RAM_ADDR_H; set_lowlight_boost()
1842 cmd.buffer.block_data[0] = 0; /* High byte of address to write to */ set_lowlight_boost()
1843 cmd.buffer.block_data[1] = 0x59; /* Low byte of address to write to */ set_lowlight_boost()
1844 cmd.buffer.block_data[2] = 0; /* High byte of data to write */ set_lowlight_boost()
1846 cpia2_send_command(cam, &cmd); set_lowlight_boost()
1849 cmd.buffer.block_data[0] = 0x02; /* Low byte data to write */ set_lowlight_boost()
1851 cmd.buffer.block_data[0] = 0x06; set_lowlight_boost()
1853 cmd.start = CPIA2_VP_RAM_DATA; set_lowlight_boost()
1854 cmd.reg_count = 1; set_lowlight_boost()
1855 cpia2_send_command(cam, &cmd); set_lowlight_boost()
1891 struct cpia2_command cmd; cpia2_dbg_dump_registers() local
1896 cmd.direction = TRANSFER_READ; cpia2_dbg_dump_registers()
1899 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_SYSTEM; cpia2_dbg_dump_registers()
1900 cmd.reg_count = 3; cpia2_dbg_dump_registers()
1901 cmd.start = 0; cpia2_dbg_dump_registers()
1902 cpia2_send_command(cam, &cmd); cpia2_dbg_dump_registers()
1904 cmd.buffer.block_data[0]); cpia2_dbg_dump_registers()
1906 cmd.buffer.block_data[1]); cpia2_dbg_dump_registers()
1908 cmd.buffer.block_data[2]); cpia2_dbg_dump_registers()
1911 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC; cpia2_dbg_dump_registers()
1912 cmd.reg_count = 4; cpia2_dbg_dump_registers()
1913 cmd.start = 0x80; cpia2_dbg_dump_registers()
1914 cpia2_send_command(cam, &cmd); cpia2_dbg_dump_registers()
1916 cmd.buffer.block_data[0]); cpia2_dbg_dump_registers()
1918 cmd.buffer.block_data[1]); cpia2_dbg_dump_registers()
1920 cmd.buffer.block_data[2]); cpia2_dbg_dump_registers()
1922 cmd.buffer.block_data[3]); cpia2_dbg_dump_registers()
1924 cmd.start = 0xA0; /* ST_CTRL */ cpia2_dbg_dump_registers()
1925 cmd.reg_count = 1; cpia2_dbg_dump_registers()
1926 cpia2_send_command(cam, &cmd); cpia2_dbg_dump_registers()
1928 cmd.buffer.block_data[0]); cpia2_dbg_dump_registers()
1930 cmd.start = 0xA4; /* Stream status */ cpia2_dbg_dump_registers()
1931 cpia2_send_command(cam, &cmd); cpia2_dbg_dump_registers()
1933 cmd.buffer.block_data[0]); cpia2_dbg_dump_registers()
1935 cmd.start = 0xA8; /* USB status */ cpia2_dbg_dump_registers()
1936 cmd.reg_count = 3; cpia2_dbg_dump_registers()
1937 cpia2_send_command(cam, &cmd); cpia2_dbg_dump_registers()
1939 cmd.buffer.block_data[0]); cpia2_dbg_dump_registers()
1941 cmd.buffer.block_data[1]); cpia2_dbg_dump_registers()
1943 cmd.buffer.block_data[2]); cpia2_dbg_dump_registers()
1945 cmd.start = 0xAF; /* USB settings */ cpia2_dbg_dump_registers()
1946 cmd.reg_count = 1; cpia2_dbg_dump_registers()
1947 cpia2_send_command(cam, &cmd); cpia2_dbg_dump_registers()
1949 cmd.buffer.block_data[0]); cpia2_dbg_dump_registers()
1951 cmd.start = 0xC0; /* VC stuff */ cpia2_dbg_dump_registers()
1952 cmd.reg_count = 26; cpia2_dbg_dump_registers()
1953 cpia2_send_command(cam, &cmd); cpia2_dbg_dump_registers()
1955 cmd.buffer.block_data[0]); cpia2_dbg_dump_registers()
1957 cmd.buffer.block_data[3]); cpia2_dbg_dump_registers()
1959 cmd.buffer.block_data[4]); cpia2_dbg_dump_registers()
1961 cmd.buffer.block_data[5]); cpia2_dbg_dump_registers()
1963 cmd.buffer.block_data[6]); cpia2_dbg_dump_registers()
1965 cmd.buffer.block_data[7]); cpia2_dbg_dump_registers()
1967 cmd.buffer.block_data[8]); cpia2_dbg_dump_registers()
1969 cmd.buffer.block_data[9]); cpia2_dbg_dump_registers()
1971 cmd.buffer.block_data[10]); cpia2_dbg_dump_registers()
1973 cmd.buffer.block_data[11]); cpia2_dbg_dump_registers()
1975 cmd.buffer.block_data[12]); cpia2_dbg_dump_registers()
1977 cmd.buffer.block_data[13]); cpia2_dbg_dump_registers()
1979 cmd.buffer.block_data[14]); cpia2_dbg_dump_registers()
1981 cmd.buffer.block_data[15]); cpia2_dbg_dump_registers()
1983 cmd.buffer.block_data[16]); cpia2_dbg_dump_registers()
1985 cmd.buffer.block_data[17]); cpia2_dbg_dump_registers()
1987 cmd.buffer.block_data[18]); cpia2_dbg_dump_registers()
1989 cmd.buffer.block_data[19]); cpia2_dbg_dump_registers()
1991 cmd.buffer.block_data[20]); cpia2_dbg_dump_registers()
1993 cmd.buffer.block_data[21]); cpia2_dbg_dump_registers()
1995 cmd.buffer.block_data[22]); cpia2_dbg_dump_registers()
1997 cmd.buffer.block_data[23]); cpia2_dbg_dump_registers()
1999 cmd.buffer.block_data[24]); cpia2_dbg_dump_registers()
2001 cmd.buffer.block_data[25]); cpia2_dbg_dump_registers()
2004 cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP; cpia2_dbg_dump_registers()
2005 cmd.reg_count = 14; cpia2_dbg_dump_registers()
2006 cmd.start = 0; cpia2_dbg_dump_registers()
2007 cpia2_send_command(cam, &cmd); cpia2_dbg_dump_registers()
2010 cmd.buffer.block_data[0]); cpia2_dbg_dump_registers()
2012 cmd.buffer.block_data[1]); cpia2_dbg_dump_registers()
2014 cmd.buffer.block_data[2]); cpia2_dbg_dump_registers()
2016 cmd.buffer.block_data[3]); cpia2_dbg_dump_registers()
2018 cmd.buffer.block_data[5]); cpia2_dbg_dump_registers()
2020 cmd.buffer.block_data[6]); cpia2_dbg_dump_registers()
2022 cmd.buffer.block_data[7]); cpia2_dbg_dump_registers()
2024 cmd.buffer.block_data[8]); cpia2_dbg_dump_registers()
2026 cmd.buffer.block_data[9]); cpia2_dbg_dump_registers()
2028 cmd.buffer.block_data[10]); cpia2_dbg_dump_registers()
2030 cmd.buffer.block_data[11]); cpia2_dbg_dump_registers()
2032 cmd.buffer.block_data[12]); cpia2_dbg_dump_registers()
2034 cmd.buffer.block_data[13]); cpia2_dbg_dump_registers()
2037 cmd.reg_count = 9; cpia2_dbg_dump_registers()
2038 cmd.start = 0x0E; cpia2_dbg_dump_registers()
2039 cpia2_send_command(cam, &cmd); cpia2_dbg_dump_registers()
2041 cmd.buffer.block_data[0]); cpia2_dbg_dump_registers()
2043 cmd.buffer.block_data[1]); cpia2_dbg_dump_registers()
2045 cmd.buffer.block_data[2]); cpia2_dbg_dump_registers()
2047 cmd.buffer.block_data[3]); cpia2_dbg_dump_registers()
2049 cmd.buffer.block_data[4]); cpia2_dbg_dump_registers()
2051 cmd.buffer.block_data[5]); cpia2_dbg_dump_registers()
2053 cmd.buffer.block_data[6]); cpia2_dbg_dump_registers()
2055 cmd.buffer.block_data[7]); cpia2_dbg_dump_registers()
2057 cmd.buffer.block_data[8]); cpia2_dbg_dump_registers()
2059 cmd.reg_count = 1; cpia2_dbg_dump_registers()
2060 cmd.start = 0x1B; cpia2_dbg_dump_registers()
2061 cpia2_send_command(cam, &cmd); cpia2_dbg_dump_registers()
2063 cmd.buffer.block_data[0]); cpia2_dbg_dump_registers()
2065 cmd.reg_count = 8 ; cpia2_dbg_dump_registers()
2066 cmd.start = 0x0E; cpia2_dbg_dump_registers()
2067 cpia2_send_command(cam, &cmd); cpia2_dbg_dump_registers()
2069 cmd.buffer.block_data[0]); cpia2_dbg_dump_registers()
2071 cmd.buffer.block_data[1]); cpia2_dbg_dump_registers()
2073 cmd.buffer.block_data[5]); cpia2_dbg_dump_registers()
2075 cmd.buffer.block_data[6]); cpia2_dbg_dump_registers()
2077 cmd.buffer.block_data[7]); cpia2_dbg_dump_registers()
2079 cmd.reg_count = 1; cpia2_dbg_dump_registers()
2080 cmd.start = CPIA2_VP5_EXPOSURE_TARGET; cpia2_dbg_dump_registers()
2081 cpia2_send_command(cam, &cmd); cpia2_dbg_dump_registers()
2083 cmd.buffer.block_data[0]); cpia2_dbg_dump_registers()
2085 cmd.reg_count = 4; cpia2_dbg_dump_registers()
2086 cmd.start = 0x3A; cpia2_dbg_dump_registers()
2087 cpia2_send_command(cam, &cmd); cpia2_dbg_dump_registers()
2089 cmd.buffer.block_data[0]); cpia2_dbg_dump_registers()
2091 cmd.buffer.block_data[1]); cpia2_dbg_dump_registers()
2093 cmd.buffer.block_data[2]); cpia2_dbg_dump_registers()
2095 cmd.buffer.block_data[3]); cpia2_dbg_dump_registers()
892 cpia2_send_onebyte_command(struct camera_data *cam, struct cpia2_command *cmd, u8 start, u8 datum) cpia2_send_onebyte_command() argument
/linux-4.4.14/drivers/gpu/drm/nouveau/
H A Dnouveau_ioctl.h4 long nouveau_compat_ioctl(struct file *, unsigned int cmd, unsigned long arg);
5 long nouveau_drm_ioctl(struct file *, unsigned int cmd, unsigned long arg);
/linux-4.4.14/drivers/media/tuners/
H A Dsi2157.c22 static int si2157_cmd_execute(struct i2c_client *client, struct si2157_cmd *cmd) si2157_cmd_execute() argument
30 if (cmd->wlen) { si2157_cmd_execute()
31 /* write cmd and args for firmware */ si2157_cmd_execute()
32 ret = i2c_master_send(client, cmd->args, cmd->wlen); si2157_cmd_execute()
35 } else if (ret != cmd->wlen) { si2157_cmd_execute()
41 if (cmd->rlen) { si2157_cmd_execute()
42 /* wait cmd execution terminate */ si2157_cmd_execute()
46 ret = i2c_master_recv(client, cmd->args, cmd->rlen); si2157_cmd_execute()
49 } else if (ret != cmd->rlen) { si2157_cmd_execute()
55 if ((cmd->args[0] >> 7) & 0x01) si2157_cmd_execute()
59 dev_dbg(&client->dev, "cmd execution took %d ms\n", si2157_cmd_execute()
63 if (!((cmd->args[0] >> 7) & 0x01)) { si2157_cmd_execute()
84 struct si2157_cmd cmd; si2157_init() local
96 memcpy(cmd.args, "\xc0\x05\x01\x00\x00\x0b\x00\x00\x01", 9); si2157_init()
97 cmd.wlen = 9; si2157_init()
99 memcpy(cmd.args, "\xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01", 15); si2157_init()
100 cmd.wlen = 15; si2157_init()
102 cmd.rlen = 1; si2157_init()
103 ret = si2157_cmd_execute(client, &cmd); si2157_init()
108 memcpy(cmd.args, "\x02", 1); si2157_init()
109 cmd.wlen = 1; si2157_init()
110 cmd.rlen = 13; si2157_init()
111 ret = si2157_cmd_execute(client, &cmd); si2157_init()
115 chip_id = cmd.args[1] << 24 | cmd.args[2] << 16 | cmd.args[3] << 8 | si2157_init()
116 cmd.args[4] << 0; si2157_init()
136 cmd.args[2], cmd.args[1], si2157_init()
137 cmd.args[3], cmd.args[4]); si2157_init()
143 cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]); si2157_init()
174 memcpy(cmd.args, &fw->data[(fw->size - remaining) + 1], len); si2157_init()
175 cmd.wlen = len; si2157_init()
176 cmd.rlen = 1; si2157_init()
177 ret = si2157_cmd_execute(client, &cmd); si2157_init()
189 memcpy(cmd.args, "\x01\x01", 2); si2157_init()
190 cmd.wlen = 2; si2157_init()
191 cmd.rlen = 1; si2157_init()
192 ret = si2157_cmd_execute(client, &cmd); si2157_init()
197 memcpy(cmd.args, "\x11", 1); si2157_init()
198 cmd.wlen = 1; si2157_init()
199 cmd.rlen = 10; si2157_init()
200 ret = si2157_cmd_execute(client, &cmd); si2157_init()
205 cmd.args[6], cmd.args[7], cmd.args[8]); si2157_init()
230 struct si2157_cmd cmd; si2157_sleep() local
240 memcpy(cmd.args, "\x16\x00", 2); si2157_sleep()
241 cmd.wlen = 2; si2157_sleep()
242 cmd.rlen = 1; si2157_sleep()
243 ret = si2157_cmd_execute(client, &cmd); si2157_sleep()
259 struct si2157_cmd cmd; si2157_set_params() local
302 memcpy(cmd.args, "\x14\x00\x03\x07\x00\x00", 6); si2157_set_params()
303 cmd.args[4] = delivery_system | bandwidth; si2157_set_params()
305 cmd.args[5] = 0x01; si2157_set_params()
306 cmd.wlen = 6; si2157_set_params()
307 cmd.rlen = 4; si2157_set_params()
308 ret = si2157_cmd_execute(client, &cmd); si2157_set_params()
313 memcpy(cmd.args, "\x14\x00\x02\x07\x00\x01", 6); si2157_set_params()
315 memcpy(cmd.args, "\x14\x00\x02\x07\x00\x00", 6); si2157_set_params()
316 cmd.args[4] = dev->if_port; si2157_set_params()
317 cmd.wlen = 6; si2157_set_params()
318 cmd.rlen = 4; si2157_set_params()
319 ret = si2157_cmd_execute(client, &cmd); si2157_set_params()
325 memcpy(cmd.args, "\x14\x00\x06\x07", 4); si2157_set_params()
326 cmd.args[4] = (if_frequency / 1000) & 0xff; si2157_set_params()
327 cmd.args[5] = ((if_frequency / 1000) >> 8) & 0xff; si2157_set_params()
328 cmd.wlen = 6; si2157_set_params()
329 cmd.rlen = 4; si2157_set_params()
330 ret = si2157_cmd_execute(client, &cmd); si2157_set_params()
338 memcpy(cmd.args, "\x41\x00\x00\x00\x00\x00\x00\x00", 8); si2157_set_params()
339 cmd.args[4] = (c->frequency >> 0) & 0xff; si2157_set_params()
340 cmd.args[5] = (c->frequency >> 8) & 0xff; si2157_set_params()
341 cmd.args[6] = (c->frequency >> 16) & 0xff; si2157_set_params()
342 cmd.args[7] = (c->frequency >> 24) & 0xff; si2157_set_params()
343 cmd.wlen = 8; si2157_set_params()
344 cmd.rlen = 1; si2157_set_params()
345 ret = si2157_cmd_execute(client, &cmd); si2157_set_params()
383 struct si2157_cmd cmd; si2157_stat_work() local
388 memcpy(cmd.args, "\x42\x00", 2); si2157_stat_work()
389 cmd.wlen = 2; si2157_stat_work()
390 cmd.rlen = 12; si2157_stat_work()
391 ret = si2157_cmd_execute(client, &cmd); si2157_stat_work()
396 c->strength.stat[0].svalue = (s8) cmd.args[3] * 1000; si2157_stat_work()
411 struct si2157_cmd cmd; si2157_probe() local
432 cmd.wlen = 0; si2157_probe()
433 cmd.rlen = 1; si2157_probe()
434 ret = si2157_cmd_execute(client, &cmd); si2157_probe()
/linux-4.4.14/drivers/target/
H A Dtarget_core_sbc.c41 static sense_reason_t sbc_execute_unmap(struct se_cmd *cmd);
44 sbc_emulate_readcapacity(struct se_cmd *cmd) sbc_emulate_readcapacity() argument
46 struct se_device *dev = cmd->se_dev; sbc_emulate_readcapacity()
47 unsigned char *cdb = cmd->t_task_cdb; sbc_emulate_readcapacity()
82 rbuf = transport_kmap_data_sg(cmd); sbc_emulate_readcapacity()
84 memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); sbc_emulate_readcapacity()
85 transport_kunmap_data_sg(cmd); sbc_emulate_readcapacity()
88 target_complete_cmd_with_length(cmd, GOOD, 8); sbc_emulate_readcapacity()
93 sbc_emulate_readcapacity_16(struct se_cmd *cmd) sbc_emulate_readcapacity_16() argument
95 struct se_device *dev = cmd->se_dev; sbc_emulate_readcapacity_16()
96 struct se_session *sess = cmd->se_sess; sbc_emulate_readcapacity_16()
147 rbuf = transport_kmap_data_sg(cmd); sbc_emulate_readcapacity_16()
149 memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); sbc_emulate_readcapacity_16()
150 transport_kunmap_data_sg(cmd); sbc_emulate_readcapacity_16()
153 target_complete_cmd_with_length(cmd, GOOD, 32); sbc_emulate_readcapacity_16()
158 sbc_emulate_startstop(struct se_cmd *cmd) sbc_emulate_startstop() argument
160 unsigned char *cdb = cmd->t_task_cdb; sbc_emulate_startstop()
185 target_complete_cmd(cmd, SAM_STAT_GOOD); sbc_emulate_startstop()
189 sector_t sbc_get_write_same_sectors(struct se_cmd *cmd) sbc_get_write_same_sectors() argument
193 if (cmd->t_task_cdb[0] == WRITE_SAME) sbc_get_write_same_sectors()
194 num_blocks = get_unaligned_be16(&cmd->t_task_cdb[7]); sbc_get_write_same_sectors()
195 else if (cmd->t_task_cdb[0] == WRITE_SAME_16) sbc_get_write_same_sectors()
196 num_blocks = get_unaligned_be32(&cmd->t_task_cdb[10]); sbc_get_write_same_sectors()
198 num_blocks = get_unaligned_be32(&cmd->t_task_cdb[28]); sbc_get_write_same_sectors()
207 return cmd->se_dev->transport->get_blocks(cmd->se_dev) - sbc_get_write_same_sectors()
208 cmd->t_task_lba + 1; sbc_get_write_same_sectors()
213 sbc_execute_write_same_unmap(struct se_cmd *cmd) sbc_execute_write_same_unmap() argument
215 struct sbc_ops *ops = cmd->protocol_data; sbc_execute_write_same_unmap()
216 sector_t nolb = sbc_get_write_same_sectors(cmd); sbc_execute_write_same_unmap()
220 ret = ops->execute_unmap(cmd, cmd->t_task_lba, nolb); sbc_execute_write_same_unmap()
225 target_complete_cmd(cmd, GOOD); sbc_execute_write_same_unmap()
230 sbc_emulate_noop(struct se_cmd *cmd) sbc_emulate_noop() argument
232 target_complete_cmd(cmd, GOOD); sbc_emulate_noop()
236 static inline u32 sbc_get_size(struct se_cmd *cmd, u32 sectors) sbc_get_size() argument
238 return cmd->se_dev->dev_attrib.block_size * sectors; sbc_get_size()
314 sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *ops) sbc_setup_write_same() argument
316 struct se_device *dev = cmd->se_dev; sbc_setup_write_same()
318 unsigned int sectors = sbc_get_write_same_sectors(cmd); sbc_setup_write_same()
327 if (sectors > cmd->se_dev->dev_attrib.max_write_same_len) { sbc_setup_write_same()
329 sectors, cmd->se_dev->dev_attrib.max_write_same_len); sbc_setup_write_same()
335 if (((cmd->t_task_lba + sectors) < cmd->t_task_lba) || sbc_setup_write_same()
336 ((cmd->t_task_lba + sectors) > end_lba)) { sbc_setup_write_same()
338 (unsigned long long)end_lba, cmd->t_task_lba, sectors); sbc_setup_write_same()
360 cmd->execute_cmd = sbc_execute_write_same_unmap; sbc_setup_write_same()
366 ret = sbc_check_prot(dev, cmd, &cmd->t_task_cdb[0], sectors, true); sbc_setup_write_same()
370 cmd->execute_cmd = ops->execute_write_same; sbc_setup_write_same()
374 static sense_reason_t xdreadwrite_callback(struct se_cmd *cmd, bool success, xdreadwrite_callback() argument
393 buf = kmalloc(cmd->data_length, GFP_KERNEL); xdreadwrite_callback()
399 * Copy the scatterlist WRITE buffer located at cmd->t_data_sg xdreadwrite_callback()
402 sg_copy_to_buffer(cmd->t_data_sg, xdreadwrite_callback()
403 cmd->t_data_nents, xdreadwrite_callback()
405 cmd->data_length); xdreadwrite_callback()
409 * cmd->t_mem_bidi_list xdreadwrite_callback()
413 for_each_sg(cmd->t_bidi_data_sg, sg, cmd->t_bidi_data_nents, count) { xdreadwrite_callback()
433 sbc_execute_rw(struct se_cmd *cmd) sbc_execute_rw() argument
435 struct sbc_ops *ops = cmd->protocol_data; sbc_execute_rw()
437 return ops->execute_rw(cmd, cmd->t_data_sg, cmd->t_data_nents, sbc_execute_rw()
438 cmd->data_direction); sbc_execute_rw()
441 static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success, compare_and_write_post() argument
444 struct se_device *dev = cmd->se_dev; compare_and_write_post()
451 spin_lock_irq(&cmd->t_state_lock); compare_and_write_post()
452 if ((cmd->transport_state & CMD_T_SENT) && !cmd->scsi_status) { compare_and_write_post()
453 cmd->se_cmd_flags |= SCF_COMPARE_AND_WRITE_POST; compare_and_write_post()
456 spin_unlock_irq(&cmd->t_state_lock); compare_and_write_post()
467 static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool success, compare_and_write_callback() argument
470 struct se_device *dev = cmd->se_dev; compare_and_write_callback()
475 unsigned int nlbas = cmd->t_task_nolb; compare_and_write_callback()
485 if (!success && (!cmd->t_data_sg || !cmd->t_bidi_data_sg)) compare_and_write_callback()
490 if (!cmd->data_length) compare_and_write_callback()
496 if (cmd->scsi_status) { compare_and_write_callback()
498 " 0x%02x\n", cmd->scsi_status); compare_and_write_callback()
502 buf = kzalloc(cmd->data_length, GFP_KERNEL); compare_and_write_callback()
509 write_sg = kmalloc(sizeof(struct scatterlist) * cmd->t_data_nents, compare_and_write_callback()
516 sg_init_table(write_sg, cmd->t_data_nents); compare_and_write_callback()
520 rc = sg_copy_to_buffer(cmd->t_data_sg, cmd->t_data_nents, buf, compare_and_write_callback()
521 cmd->data_length); compare_and_write_callback()
530 for_each_sg(cmd->t_bidi_data_sg, sg, cmd->t_bidi_data_nents, i) { compare_and_write_callback()
554 len = cmd->t_task_nolb * block_size; compare_and_write_callback()
555 sg_miter_start(&m, cmd->t_data_sg, cmd->t_data_nents, SG_MITER_TO_SG); compare_and_write_callback()
579 cmd->t_data_sg_orig = cmd->t_data_sg; compare_and_write_callback()
580 cmd->t_data_sg = write_sg; compare_and_write_callback()
581 cmd->t_data_nents_orig = cmd->t_data_nents; compare_and_write_callback()
582 cmd->t_data_nents = 1; compare_and_write_callback()
584 cmd->sam_task_attr = TCM_HEAD_TAG; compare_and_write_callback()
585 cmd->transport_complete_callback = compare_and_write_post; compare_and_write_callback()
590 cmd->execute_cmd = sbc_execute_rw; compare_and_write_callback()
592 spin_lock_irq(&cmd->t_state_lock); compare_and_write_callback()
593 cmd->t_state = TRANSPORT_PROCESSING; compare_and_write_callback()
594 cmd->transport_state |= CMD_T_ACTIVE|CMD_T_BUSY|CMD_T_SENT; compare_and_write_callback()
595 spin_unlock_irq(&cmd->t_state_lock); compare_and_write_callback()
597 __target_execute_cmd(cmd); compare_and_write_callback()
618 sbc_compare_and_write(struct se_cmd *cmd) sbc_compare_and_write() argument
620 struct sbc_ops *ops = cmd->protocol_data; sbc_compare_and_write()
621 struct se_device *dev = cmd->se_dev; sbc_compare_and_write()
626 * comparision using SGLs at cmd->t_bidi_data_sg.. sbc_compare_and_write()
630 cmd->transport_complete_callback = NULL; sbc_compare_and_write()
634 * Reset cmd->data_length to individual block_size in order to not sbc_compare_and_write()
638 cmd->data_length = cmd->t_task_nolb * dev->dev_attrib.block_size; sbc_compare_and_write()
640 ret = ops->execute_rw(cmd, cmd->t_bidi_data_sg, cmd->t_bidi_data_nents, sbc_compare_and_write()
643 cmd->transport_complete_callback = NULL; sbc_compare_and_write()
657 bool is_write, struct se_cmd *cmd) sbc_set_prot_op_checks()
660 cmd->prot_op = fabric_prot ? TARGET_PROT_DOUT_STRIP : sbc_set_prot_op_checks()
666 cmd->prot_checks = 0; sbc_set_prot_op_checks()
670 cmd->prot_checks = TARGET_DIF_CHECK_GUARD; sbc_set_prot_op_checks()
672 cmd->prot_checks |= TARGET_DIF_CHECK_REFTAG; sbc_set_prot_op_checks()
676 cmd->prot_checks = TARGET_DIF_CHECK_REFTAG; sbc_set_prot_op_checks()
679 cmd->prot_checks = TARGET_DIF_CHECK_GUARD; sbc_set_prot_op_checks()
686 cmd->prot_op = fabric_prot ? TARGET_PROT_DIN_INSERT : sbc_set_prot_op_checks()
693 cmd->prot_checks = TARGET_DIF_CHECK_GUARD; sbc_set_prot_op_checks()
695 cmd->prot_checks |= TARGET_DIF_CHECK_REFTAG; sbc_set_prot_op_checks()
699 cmd->prot_checks = TARGET_DIF_CHECK_REFTAG; sbc_set_prot_op_checks()
702 cmd->prot_checks = 0; sbc_set_prot_op_checks()
705 cmd->prot_checks = TARGET_DIF_CHECK_GUARD; sbc_set_prot_op_checks()
717 sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb, sbc_check_prot() argument
721 int sp_ops = cmd->se_sess->sup_prot_ops; sbc_check_prot()
725 if (!cmd->t_prot_sg || !cmd->t_prot_nents) { sbc_check_prot()
727 !dev->dev_attrib.pi_prot_type && !cmd->se_sess->sess_prot_type)) { sbc_check_prot()
732 if (cmd->prot_pto) sbc_check_prot()
738 cmd->reftag_seed = 0xffffffff; sbc_check_prot()
744 cmd->reftag_seed = cmd->t_task_lba; sbc_check_prot()
747 cmd->reftag_seed = cmd->t_task_lba; sbc_check_prot()
759 if (fabric_prot && cmd->se_sess->sess_prot_type) { sbc_check_prot()
760 pi_prot_type = cmd->se_sess->sess_prot_type; sbc_check_prot()
772 if (sbc_set_prot_op_checks(protect, fabric_prot, pi_prot_type, is_write, cmd)) sbc_check_prot()
775 cmd->prot_type = pi_prot_type; sbc_check_prot()
776 cmd->prot_length = dev->prot_length * sectors; sbc_check_prot()
785 cmd->data_length = sectors * dev->dev_attrib.block_size; sbc_check_prot()
789 __func__, cmd->prot_type, cmd->data_length, cmd->prot_length, sbc_check_prot()
790 cmd->prot_op, cmd->prot_checks); sbc_check_prot()
796 sbc_check_dpofua(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb) sbc_check_dpofua() argument
813 cmd->se_cmd_flags |= SCF_FUA; sbc_check_dpofua()
819 sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) sbc_parse_cdb() argument
821 struct se_device *dev = cmd->se_dev; sbc_parse_cdb()
822 unsigned char *cdb = cmd->t_task_cdb; sbc_parse_cdb()
827 cmd->protocol_data = ops; sbc_parse_cdb()
832 cmd->t_task_lba = transport_lba_21(cdb); sbc_parse_cdb()
833 cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; sbc_parse_cdb()
834 cmd->execute_cmd = sbc_execute_rw; sbc_parse_cdb()
838 cmd->t_task_lba = transport_lba_32(cdb); sbc_parse_cdb()
840 if (sbc_check_dpofua(dev, cmd, cdb)) sbc_parse_cdb()
843 ret = sbc_check_prot(dev, cmd, cdb, sectors, false); sbc_parse_cdb()
847 cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; sbc_parse_cdb()
848 cmd->execute_cmd = sbc_execute_rw; sbc_parse_cdb()
852 cmd->t_task_lba = transport_lba_32(cdb); sbc_parse_cdb()
854 if (sbc_check_dpofua(dev, cmd, cdb)) sbc_parse_cdb()
857 ret = sbc_check_prot(dev, cmd, cdb, sectors, false); sbc_parse_cdb()
861 cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; sbc_parse_cdb()
862 cmd->execute_cmd = sbc_execute_rw; sbc_parse_cdb()
866 cmd->t_task_lba = transport_lba_64(cdb); sbc_parse_cdb()
868 if (sbc_check_dpofua(dev, cmd, cdb)) sbc_parse_cdb()
871 ret = sbc_check_prot(dev, cmd, cdb, sectors, false); sbc_parse_cdb()
875 cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; sbc_parse_cdb()
876 cmd->execute_cmd = sbc_execute_rw; sbc_parse_cdb()
880 cmd->t_task_lba = transport_lba_21(cdb); sbc_parse_cdb()
881 cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; sbc_parse_cdb()
882 cmd->execute_cmd = sbc_execute_rw; sbc_parse_cdb()
887 cmd->t_task_lba = transport_lba_32(cdb); sbc_parse_cdb()
889 if (sbc_check_dpofua(dev, cmd, cdb)) sbc_parse_cdb()
892 ret = sbc_check_prot(dev, cmd, cdb, sectors, true); sbc_parse_cdb()
896 cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; sbc_parse_cdb()
897 cmd->execute_cmd = sbc_execute_rw; sbc_parse_cdb()
901 cmd->t_task_lba = transport_lba_32(cdb); sbc_parse_cdb()
903 if (sbc_check_dpofua(dev, cmd, cdb)) sbc_parse_cdb()
906 ret = sbc_check_prot(dev, cmd, cdb, sectors, true); sbc_parse_cdb()
910 cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; sbc_parse_cdb()
911 cmd->execute_cmd = sbc_execute_rw; sbc_parse_cdb()
915 cmd->t_task_lba = transport_lba_64(cdb); sbc_parse_cdb()
917 if (sbc_check_dpofua(dev, cmd, cdb)) sbc_parse_cdb()
920 ret = sbc_check_prot(dev, cmd, cdb, sectors, true); sbc_parse_cdb()
924 cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; sbc_parse_cdb()
925 cmd->execute_cmd = sbc_execute_rw; sbc_parse_cdb()
928 if (cmd->data_direction != DMA_TO_DEVICE || sbc_parse_cdb()
929 !(cmd->se_cmd_flags & SCF_BIDI)) sbc_parse_cdb()
933 if (sbc_check_dpofua(dev, cmd, cdb)) sbc_parse_cdb()
936 cmd->t_task_lba = transport_lba_32(cdb); sbc_parse_cdb()
937 cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; sbc_parse_cdb()
942 cmd->execute_cmd = sbc_execute_rw; sbc_parse_cdb()
943 cmd->transport_complete_callback = &xdreadwrite_callback; sbc_parse_cdb()
952 if (sbc_check_dpofua(dev, cmd, cdb)) sbc_parse_cdb()
958 cmd->t_task_lba = transport_lba_64_ext(cdb); sbc_parse_cdb()
959 cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; sbc_parse_cdb()
965 cmd->execute_cmd = sbc_execute_rw; sbc_parse_cdb()
966 cmd->transport_complete_callback = &xdreadwrite_callback; sbc_parse_cdb()
976 size = sbc_get_size(cmd, 1); sbc_parse_cdb()
977 cmd->t_task_lba = get_unaligned_be64(&cdb[12]); sbc_parse_cdb()
979 ret = sbc_setup_write_same(cmd, &cdb[10], ops); sbc_parse_cdb()
1000 if (sbc_check_dpofua(dev, cmd, cdb)) sbc_parse_cdb()
1007 size = 2 * sbc_get_size(cmd, sectors); sbc_parse_cdb()
1008 cmd->t_task_lba = get_unaligned_be64(&cdb[2]); sbc_parse_cdb()
1009 cmd->t_task_nolb = sectors; sbc_parse_cdb()
1010 cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB | SCF_COMPARE_AND_WRITE; sbc_parse_cdb()
1011 cmd->execute_cmd = sbc_compare_and_write; sbc_parse_cdb()
1012 cmd->transport_complete_callback = compare_and_write_callback; sbc_parse_cdb()
1016 cmd->execute_cmd = sbc_emulate_readcapacity; sbc_parse_cdb()
1019 switch (cmd->t_task_cdb[1] & 0x1f) { sbc_parse_cdb()
1021 cmd->execute_cmd = sbc_emulate_readcapacity_16; sbc_parse_cdb()
1024 cmd->execute_cmd = target_emulate_report_referrals; sbc_parse_cdb()
1028 cmd->t_task_cdb[1] & 0x1f); sbc_parse_cdb()
1038 cmd->t_task_lba = transport_lba_32(cdb); sbc_parse_cdb()
1041 cmd->t_task_lba = transport_lba_64(cdb); sbc_parse_cdb()
1044 cmd->execute_cmd = ops->execute_sync_cache; sbc_parse_cdb()
1048 cmd->execute_cmd = sbc_emulate_noop; sbc_parse_cdb()
1060 cmd->execute_cmd = sbc_execute_unmap; sbc_parse_cdb()
1069 size = sbc_get_size(cmd, 1); sbc_parse_cdb()
1070 cmd->t_task_lba = get_unaligned_be64(&cdb[2]); sbc_parse_cdb()
1072 ret = sbc_setup_write_same(cmd, &cdb[1], ops); sbc_parse_cdb()
1083 size = sbc_get_size(cmd, 1); sbc_parse_cdb()
1084 cmd->t_task_lba = get_unaligned_be32(&cdb[2]); sbc_parse_cdb()
1090 ret = sbc_setup_write_same(cmd, &cdb[1], ops); sbc_parse_cdb()
1097 cmd->t_task_lba = transport_lba_32(cdb); sbc_parse_cdb()
1098 cmd->execute_cmd = sbc_emulate_noop; sbc_parse_cdb()
1110 cmd->execute_cmd = sbc_emulate_noop; sbc_parse_cdb()
1114 cmd->execute_cmd = sbc_emulate_startstop; sbc_parse_cdb()
1117 ret = spc_parse_cdb(cmd, &size); sbc_parse_cdb()
1123 if (!cmd->execute_cmd) sbc_parse_cdb()
1126 if (cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) { sbc_parse_cdb()
1130 if (((cmd->t_task_lba + sectors) < cmd->t_task_lba) || sbc_parse_cdb()
1131 ((cmd->t_task_lba + sectors) > end_lba)) { sbc_parse_cdb()
1132 pr_err("cmd exceeds last lba %llu " sbc_parse_cdb()
1134 end_lba, cmd->t_task_lba, sectors); sbc_parse_cdb()
1138 if (!(cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE)) sbc_parse_cdb()
1139 size = sbc_get_size(cmd, sectors); sbc_parse_cdb()
1142 return target_cmd_size_check(cmd, size); sbc_parse_cdb()
1153 sbc_execute_unmap(struct se_cmd *cmd) sbc_execute_unmap() argument
1155 struct sbc_ops *ops = cmd->protocol_data; sbc_execute_unmap()
1156 struct se_device *dev = cmd->se_dev; sbc_execute_unmap()
1165 if (cmd->t_task_cdb[1]) sbc_execute_unmap()
1168 if (cmd->data_length == 0) { sbc_execute_unmap()
1169 target_complete_cmd(cmd, SAM_STAT_GOOD); sbc_execute_unmap()
1173 if (cmd->data_length < 8) { sbc_execute_unmap()
1175 cmd->data_length); sbc_execute_unmap()
1179 buf = transport_kmap_data_sg(cmd); sbc_execute_unmap()
1186 size = cmd->data_length - 8; sbc_execute_unmap()
1189 cmd->data_length, bd_dl); sbc_execute_unmap()
1219 ret = ops->execute_unmap(cmd, lba, range); sbc_execute_unmap()
1228 transport_kunmap_data_sg(cmd); sbc_execute_unmap()
1230 target_complete_cmd(cmd, GOOD); sbc_execute_unmap()
1235 sbc_dif_generate(struct se_cmd *cmd) sbc_dif_generate() argument
1237 struct se_device *dev = cmd->se_dev; sbc_dif_generate()
1239 struct scatterlist *dsg = cmd->t_data_sg, *psg; sbc_dif_generate()
1240 sector_t sector = cmd->t_task_lba; sbc_dif_generate()
1245 for_each_sg(cmd->t_prot_sg, psg, cmd->t_prot_nents, i) { sbc_dif_generate()
1283 if (cmd->prot_type == TARGET_DIF_TYPE1_PROT) sbc_dif_generate()
1289 (cmd->data_direction == DMA_TO_DEVICE) ? sbc_dif_generate()
1303 sbc_dif_v1_verify(struct se_cmd *cmd, struct t10_pi_tuple *sdt, sbc_dif_v1_verify() argument
1308 if (!(cmd->prot_checks & TARGET_DIF_CHECK_GUARD)) sbc_dif_v1_verify()
1321 if (!(cmd->prot_checks & TARGET_DIF_CHECK_REFTAG)) sbc_dif_v1_verify()
1324 if (cmd->prot_type == TARGET_DIF_TYPE1_PROT && sbc_dif_v1_verify()
1332 if (cmd->prot_type == TARGET_DIF_TYPE2_PROT && sbc_dif_v1_verify()
1343 void sbc_dif_copy_prot(struct se_cmd *cmd, unsigned int sectors, bool read, sbc_dif_copy_prot() argument
1346 struct se_device *dev = cmd->se_dev; sbc_dif_copy_prot()
1357 for_each_sg(cmd->t_prot_sg, psg, cmd->t_prot_nents, i) { sbc_dif_copy_prot()
1389 sbc_dif_verify(struct se_cmd *cmd, sector_t start, unsigned int sectors, sbc_dif_verify() argument
1392 struct se_device *dev = cmd->se_dev; sbc_dif_verify()
1394 struct scatterlist *dsg = cmd->t_data_sg; sbc_dif_verify()
1451 rc = sbc_dif_v1_verify(cmd, sdt, crc, sector, ei_lba); sbc_dif_verify()
1455 cmd->bad_sector = sector; sbc_dif_verify()
656 sbc_set_prot_op_checks(u8 protect, bool fabric_prot, enum target_prot_type prot_type, bool is_write, struct se_cmd *cmd) sbc_set_prot_op_checks() argument
H A Dtarget_core_transport.c66 static void transport_complete_task_attr(struct se_cmd *cmd);
67 static void transport_handle_queue_full(struct se_cmd *cmd,
69 static int transport_put_cmd(struct se_cmd *cmd);
531 static void target_remove_from_state_list(struct se_cmd *cmd) target_remove_from_state_list() argument
533 struct se_device *dev = cmd->se_dev; target_remove_from_state_list()
539 if (cmd->transport_state & CMD_T_BUSY) target_remove_from_state_list()
543 if (cmd->state_active) { target_remove_from_state_list()
544 list_del(&cmd->state_list); target_remove_from_state_list()
545 cmd->state_active = false; target_remove_from_state_list()
550 static int transport_cmd_check_stop(struct se_cmd *cmd, bool remove_from_lists, transport_cmd_check_stop() argument
556 target_remove_from_state_list(cmd); transport_cmd_check_stop()
561 cmd->se_lun = NULL; transport_cmd_check_stop()
564 spin_lock_irqsave(&cmd->t_state_lock, flags); transport_cmd_check_stop()
566 cmd->t_state = TRANSPORT_WRITE_PENDING; transport_cmd_check_stop()
572 if (cmd->transport_state & CMD_T_STOP) { transport_cmd_check_stop()
574 __func__, __LINE__, cmd->tag); transport_cmd_check_stop()
576 spin_unlock_irqrestore(&cmd->t_state_lock, flags); transport_cmd_check_stop()
578 complete_all(&cmd->t_transport_stop_comp); transport_cmd_check_stop()
582 cmd->transport_state &= ~CMD_T_ACTIVE; transport_cmd_check_stop()
593 if (cmd->se_tfo->check_stop_free != NULL) { transport_cmd_check_stop()
594 spin_unlock_irqrestore(&cmd->t_state_lock, flags); transport_cmd_check_stop()
595 return cmd->se_tfo->check_stop_free(cmd); transport_cmd_check_stop()
599 spin_unlock_irqrestore(&cmd->t_state_lock, flags); transport_cmd_check_stop()
603 static int transport_cmd_check_stop_to_fabric(struct se_cmd *cmd) transport_cmd_check_stop_to_fabric() argument
605 return transport_cmd_check_stop(cmd, true, false); transport_cmd_check_stop_to_fabric()
608 static void transport_lun_remove_cmd(struct se_cmd *cmd) transport_lun_remove_cmd() argument
610 struct se_lun *lun = cmd->se_lun; transport_lun_remove_cmd()
615 if (cmpxchg(&cmd->lun_ref_active, true, false)) transport_lun_remove_cmd()
619 void transport_cmd_finish_abort(struct se_cmd *cmd, int remove) transport_cmd_finish_abort() argument
621 bool ack_kref = (cmd->se_cmd_flags & SCF_ACK_KREF); transport_cmd_finish_abort()
623 if (cmd->se_cmd_flags & SCF_SE_LUN_CMD) transport_cmd_finish_abort()
624 transport_lun_remove_cmd(cmd); transport_cmd_finish_abort()
630 cmd->se_tfo->aborted_task(cmd); transport_cmd_finish_abort()
632 if (transport_cmd_check_stop_to_fabric(cmd)) transport_cmd_finish_abort()
635 transport_put_cmd(cmd); transport_cmd_finish_abort()
640 struct se_cmd *cmd = container_of(work, struct se_cmd, work); target_complete_failure_work() local
642 transport_generic_request_failure(cmd, target_complete_failure_work()
650 static unsigned char *transport_get_sense_buffer(struct se_cmd *cmd) transport_get_sense_buffer() argument
652 struct se_device *dev = cmd->se_dev; transport_get_sense_buffer()
654 WARN_ON(!cmd->se_lun); transport_get_sense_buffer()
659 if (cmd->se_cmd_flags & SCF_SENT_CHECK_CONDITION) transport_get_sense_buffer()
662 cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER; transport_get_sense_buffer()
665 dev->se_hba->hba_id, dev->transport->name, cmd->scsi_status); transport_get_sense_buffer()
666 return cmd->sense_buffer; transport_get_sense_buffer()
669 void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) target_complete_cmd() argument
671 struct se_device *dev = cmd->se_dev; target_complete_cmd()
675 cmd->scsi_status = scsi_status; target_complete_cmd()
678 spin_lock_irqsave(&cmd->t_state_lock, flags); target_complete_cmd()
679 cmd->transport_state &= ~CMD_T_BUSY; target_complete_cmd()
682 dev->transport->transport_complete(cmd, target_complete_cmd()
683 cmd->t_data_sg, target_complete_cmd()
684 transport_get_sense_buffer(cmd)); target_complete_cmd()
685 if (cmd->se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) target_complete_cmd()
692 if (cmd->transport_state & CMD_T_REQUEST_STOP) { target_complete_cmd()
693 spin_unlock_irqrestore(&cmd->t_state_lock, flags); target_complete_cmd()
694 complete(&cmd->task_stop_comp); target_complete_cmd()
702 if (cmd->transport_state & CMD_T_ABORTED || target_complete_cmd()
703 cmd->transport_state & CMD_T_STOP) { target_complete_cmd()
704 spin_unlock_irqrestore(&cmd->t_state_lock, flags); target_complete_cmd()
705 complete_all(&cmd->t_transport_stop_comp); target_complete_cmd()
708 INIT_WORK(&cmd->work, target_complete_failure_work); target_complete_cmd()
710 INIT_WORK(&cmd->work, target_complete_ok_work); target_complete_cmd()
713 cmd->t_state = TRANSPORT_COMPLETE; target_complete_cmd()
714 cmd->transport_state |= (CMD_T_COMPLETE | CMD_T_ACTIVE); target_complete_cmd()
715 spin_unlock_irqrestore(&cmd->t_state_lock, flags); target_complete_cmd()
717 queue_work(target_completion_wq, &cmd->work); target_complete_cmd()
721 void target_complete_cmd_with_length(struct se_cmd *cmd, u8 scsi_status, int length) target_complete_cmd_with_length() argument
723 if (scsi_status == SAM_STAT_GOOD && length < cmd->data_length) { target_complete_cmd_with_length()
724 if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) { target_complete_cmd_with_length()
725 cmd->residual_count += cmd->data_length - length; target_complete_cmd_with_length()
727 cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT; target_complete_cmd_with_length()
728 cmd->residual_count = cmd->data_length - length; target_complete_cmd_with_length()
731 cmd->data_length = length; target_complete_cmd_with_length()
734 target_complete_cmd(cmd, scsi_status); target_complete_cmd_with_length()
738 static void target_add_to_state_list(struct se_cmd *cmd) target_add_to_state_list() argument
740 struct se_device *dev = cmd->se_dev; target_add_to_state_list()
744 if (!cmd->state_active) { target_add_to_state_list()
745 list_add_tail(&cmd->state_list, &dev->state_list); target_add_to_state_list()
746 cmd->state_active = true; target_add_to_state_list()
754 static void transport_write_pending_qf(struct se_cmd *cmd);
755 static void transport_complete_qf(struct se_cmd *cmd);
762 struct se_cmd *cmd, *cmd_tmp; target_qf_do_work() local
768 list_for_each_entry_safe(cmd, cmd_tmp, &qf_cmd_list, se_qf_node) { target_qf_do_work()
769 list_del(&cmd->se_qf_node); target_qf_do_work()
772 pr_debug("Processing %s cmd: %p QUEUE_FULL in work queue" target_qf_do_work()
773 " context: %s\n", cmd->se_tfo->get_fabric_name(), cmd, target_qf_do_work()
774 (cmd->t_state == TRANSPORT_COMPLETE_QF_OK) ? "COMPLETE_OK" : target_qf_do_work()
775 (cmd->t_state == TRANSPORT_COMPLETE_QF_WP) ? "WRITE_PENDING" target_qf_do_work()
778 if (cmd->t_state == TRANSPORT_COMPLETE_QF_WP) target_qf_do_work()
779 transport_write_pending_qf(cmd); target_qf_do_work()
780 else if (cmd->t_state == TRANSPORT_COMPLETE_QF_OK) target_qf_do_work()
781 transport_complete_qf(cmd); target_qf_do_work()
785 unsigned char *transport_dump_cmd_direction(struct se_cmd *cmd) transport_dump_cmd_direction() argument
787 switch (cmd->data_direction) { transport_dump_cmd_direction()
1078 target_check_max_data_sg_nents(struct se_cmd *cmd, struct se_device *dev, target_check_max_data_sg_nents() argument
1083 if (!cmd->se_tfo->max_data_sg_nents) target_check_max_data_sg_nents()
1088 * residual_count and reduce original cmd->data_length to maximum target_check_max_data_sg_nents()
1091 mtl = (cmd->se_tfo->max_data_sg_nents * PAGE_SIZE); target_check_max_data_sg_nents()
1092 if (cmd->data_length > mtl) { target_check_max_data_sg_nents()
1098 * based on original cmd->data_length minus fabric maximum transfer target_check_max_data_sg_nents()
1101 * Otherwise, set the underflow residual based on cmd->data_length target_check_max_data_sg_nents()
1104 if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { target_check_max_data_sg_nents()
1105 cmd->residual_count = (size - mtl); target_check_max_data_sg_nents()
1106 } else if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) { target_check_max_data_sg_nents()
1107 u32 orig_dl = size + cmd->residual_count; target_check_max_data_sg_nents()
1108 cmd->residual_count = (orig_dl - mtl); target_check_max_data_sg_nents()
1110 cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT; target_check_max_data_sg_nents()
1111 cmd->residual_count = (cmd->data_length - mtl); target_check_max_data_sg_nents()
1113 cmd->data_length = mtl; target_check_max_data_sg_nents()
1118 if (cmd->prot_length) { target_check_max_data_sg_nents()
1120 cmd->prot_length = dev->prot_length * sectors; target_check_max_data_sg_nents()
1127 target_cmd_size_check(struct se_cmd *cmd, unsigned int size) target_cmd_size_check() argument
1129 struct se_device *dev = cmd->se_dev; target_cmd_size_check()
1131 if (cmd->unknown_data_length) { target_cmd_size_check()
1132 cmd->data_length = size; target_cmd_size_check()
1133 } else if (size != cmd->data_length) { target_cmd_size_check()
1136 " 0x%02x\n", cmd->se_tfo->get_fabric_name(), target_cmd_size_check()
1137 cmd->data_length, size, cmd->t_task_cdb[0]); target_cmd_size_check()
1139 if (cmd->data_direction == DMA_TO_DEVICE && target_cmd_size_check()
1140 cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) { target_cmd_size_check()
1161 if (size > cmd->data_length) { target_cmd_size_check()
1162 cmd->se_cmd_flags |= SCF_OVERFLOW_BIT; target_cmd_size_check()
1163 cmd->residual_count = (size - cmd->data_length); target_cmd_size_check()
1165 cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT; target_cmd_size_check()
1166 cmd->residual_count = (cmd->data_length - size); target_cmd_size_check()
1167 cmd->data_length = size; target_cmd_size_check()
1171 return target_check_max_data_sg_nents(cmd, dev, size); target_cmd_size_check()
1179 * Preserves the value of @cmd->tag.
1182 struct se_cmd *cmd, transport_init_se_cmd()
1190 INIT_LIST_HEAD(&cmd->se_delayed_node); transport_init_se_cmd()
1191 INIT_LIST_HEAD(&cmd->se_qf_node); transport_init_se_cmd()
1192 INIT_LIST_HEAD(&cmd->se_cmd_list); transport_init_se_cmd()
1193 INIT_LIST_HEAD(&cmd->state_list); transport_init_se_cmd()
1194 init_completion(&cmd->t_transport_stop_comp); transport_init_se_cmd()
1195 init_completion(&cmd->cmd_wait_comp); transport_init_se_cmd()
1196 init_completion(&cmd->task_stop_comp); transport_init_se_cmd()
1197 spin_lock_init(&cmd->t_state_lock); transport_init_se_cmd()
1198 kref_init(&cmd->cmd_kref); transport_init_se_cmd()
1199 cmd->transport_state = CMD_T_DEV_ACTIVE; transport_init_se_cmd()
1201 cmd->se_tfo = tfo; transport_init_se_cmd()
1202 cmd->se_sess = se_sess; transport_init_se_cmd()
1203 cmd->data_length = data_length; transport_init_se_cmd()
1204 cmd->data_direction = data_direction; transport_init_se_cmd()
1205 cmd->sam_task_attr = task_attr; transport_init_se_cmd()
1206 cmd->sense_buffer = sense_buffer; transport_init_se_cmd()
1208 cmd->state_active = false; transport_init_se_cmd()
1213 transport_check_alloc_task_attr(struct se_cmd *cmd) transport_check_alloc_task_attr() argument
1215 struct se_device *dev = cmd->se_dev; transport_check_alloc_task_attr()
1224 if (cmd->sam_task_attr == TCM_ACA_TAG) { transport_check_alloc_task_attr()
1234 target_setup_cmd_from_cdb(struct se_cmd *cmd, unsigned char *cdb) target_setup_cmd_from_cdb() argument
1236 struct se_device *dev = cmd->se_dev; target_setup_cmd_from_cdb()
1254 if (scsi_command_size(cdb) > sizeof(cmd->__t_task_cdb)) { target_setup_cmd_from_cdb()
1255 cmd->t_task_cdb = kzalloc(scsi_command_size(cdb), target_setup_cmd_from_cdb()
1257 if (!cmd->t_task_cdb) { target_setup_cmd_from_cdb()
1258 pr_err("Unable to allocate cmd->t_task_cdb" target_setup_cmd_from_cdb()
1259 " %u > sizeof(cmd->__t_task_cdb): %lu ops\n", target_setup_cmd_from_cdb()
1261 (unsigned long)sizeof(cmd->__t_task_cdb)); target_setup_cmd_from_cdb()
1265 cmd->t_task_cdb = &cmd->__t_task_cdb[0]; target_setup_cmd_from_cdb()
1267 * Copy the original CDB into cmd-> target_setup_cmd_from_cdb()
1269 memcpy(cmd->t_task_cdb, cdb, scsi_command_size(cdb)); target_setup_cmd_from_cdb()
1271 trace_target_sequencer_start(cmd); target_setup_cmd_from_cdb()
1276 ret = target_scsi3_ua_check(cmd); target_setup_cmd_from_cdb()
1280 ret = target_alua_state_check(cmd); target_setup_cmd_from_cdb()
1284 ret = target_check_reservation(cmd); target_setup_cmd_from_cdb()
1286 cmd->scsi_status = SAM_STAT_RESERVATION_CONFLICT; target_setup_cmd_from_cdb()
1290 ret = dev->transport->parse_cdb(cmd); target_setup_cmd_from_cdb()
1293 cmd->se_tfo->get_fabric_name(), target_setup_cmd_from_cdb()
1294 cmd->se_sess->se_node_acl->initiatorname, target_setup_cmd_from_cdb()
1295 cmd->t_task_cdb[0]); target_setup_cmd_from_cdb()
1299 ret = transport_check_alloc_task_attr(cmd); target_setup_cmd_from_cdb()
1303 cmd->se_cmd_flags |= SCF_SUPPORTED_SAM_OPCODE; target_setup_cmd_from_cdb()
1304 atomic_long_inc(&cmd->se_lun->lun_stats.cmd_pdus); target_setup_cmd_from_cdb()
1314 struct se_cmd *cmd) transport_handle_cdb_direct()
1318 if (!cmd->se_lun) { transport_handle_cdb_direct()
1320 pr_err("cmd->se_lun is NULL\n"); transport_handle_cdb_direct()
1334 * Also, we don't take cmd->t_state_lock here as we only expect transport_handle_cdb_direct()
1337 cmd->t_state = TRANSPORT_NEW_CMD; transport_handle_cdb_direct()
1338 cmd->transport_state |= CMD_T_ACTIVE; transport_handle_cdb_direct()
1345 ret = transport_generic_new_cmd(cmd); transport_handle_cdb_direct()
1347 transport_generic_request_failure(cmd, ret); transport_handle_cdb_direct()
1353 transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *sgl, transport_generic_map_mem_to_cmd() argument
1364 if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { transport_generic_map_mem_to_cmd()
1370 cmd->t_data_sg = sgl; transport_generic_map_mem_to_cmd()
1371 cmd->t_data_nents = sgl_count; transport_generic_map_mem_to_cmd()
1372 cmd->t_bidi_data_sg = sgl_bidi; transport_generic_map_mem_to_cmd()
1373 cmd->t_bidi_data_nents = sgl_bidi_count; transport_generic_map_mem_to_cmd()
1375 cmd->se_cmd_flags |= SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC; transport_generic_map_mem_to_cmd()
1433 * Obtain struct se_cmd->cmd_kref reference and add new cmd to target_submit_cmd_map_sgls()
1576 * @flags: submit cmd flags
1628 * If the cmd is active, request it to be stopped and sleep until it
1631 bool target_stop_cmd(struct se_cmd *cmd, unsigned long *flags)
1632 __releases(&cmd->t_state_lock)
1633 __acquires(&cmd->t_state_lock)
1637 if (cmd->transport_state & CMD_T_BUSY) {
1638 cmd->transport_state |= CMD_T_REQUEST_STOP;
1639 spin_unlock_irqrestore(&cmd->t_state_lock, *flags);
1641 pr_debug("cmd %p waiting to complete\n", cmd);
1642 wait_for_completion(&cmd->task_stop_comp);
1643 pr_debug("cmd %p stopped successfully\n", cmd);
1645 spin_lock_irqsave(&cmd->t_state_lock, *flags);
1646 cmd->transport_state &= ~CMD_T_REQUEST_STOP;
1647 cmd->transport_state &= ~CMD_T_BUSY;
1657 void transport_generic_request_failure(struct se_cmd *cmd, transport_generic_request_failure() argument
1662 pr_debug("-----[ Storage Engine Exception for cmd: %p ITT: 0x%08llx" transport_generic_request_failure()
1663 " CDB: 0x%02x\n", cmd, cmd->tag, cmd->t_task_cdb[0]); transport_generic_request_failure()
1665 cmd->se_tfo->get_cmd_state(cmd), transport_generic_request_failure()
1666 cmd->t_state, sense_reason); transport_generic_request_failure()
1668 (cmd->transport_state & CMD_T_ACTIVE) != 0, transport_generic_request_failure()
1669 (cmd->transport_state & CMD_T_STOP) != 0, transport_generic_request_failure()
1670 (cmd->transport_state & CMD_T_SENT) != 0); transport_generic_request_failure()
1675 transport_complete_task_attr(cmd); transport_generic_request_failure()
1680 if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) && transport_generic_request_failure()
1681 cmd->transport_complete_callback) transport_generic_request_failure()
1682 cmd->transport_complete_callback(cmd, false, &post_ret); transport_generic_request_failure()
1711 cmd->scsi_status = SAM_STAT_RESERVATION_CONFLICT; transport_generic_request_failure()
1719 if (cmd->se_sess && transport_generic_request_failure()
1720 cmd->se_dev->dev_attrib.emulate_ua_intlck_ctrl == 2) { transport_generic_request_failure()
1721 target_ua_allocate_lun(cmd->se_sess->se_node_acl, transport_generic_request_failure()
1722 cmd->orig_fe_lun, 0x2C, transport_generic_request_failure()
1725 trace_target_cmd_complete(cmd); transport_generic_request_failure()
1726 ret = cmd->se_tfo->queue_status(cmd); transport_generic_request_failure()
1732 cmd->t_task_cdb[0], sense_reason); transport_generic_request_failure()
1737 ret = transport_send_check_condition_and_sense(cmd, sense_reason, 0); transport_generic_request_failure()
1742 transport_lun_remove_cmd(cmd); transport_generic_request_failure()
1743 transport_cmd_check_stop_to_fabric(cmd); transport_generic_request_failure()
1747 cmd->t_state = TRANSPORT_COMPLETE_QF_OK; transport_generic_request_failure()
1748 transport_handle_queue_full(cmd, cmd->se_dev); transport_generic_request_failure()
1752 void __target_execute_cmd(struct se_cmd *cmd) __target_execute_cmd() argument
1756 if (cmd->execute_cmd) { __target_execute_cmd()
1757 ret = cmd->execute_cmd(cmd); __target_execute_cmd()
1759 spin_lock_irq(&cmd->t_state_lock); __target_execute_cmd()
1760 cmd->transport_state &= ~(CMD_T_BUSY|CMD_T_SENT); __target_execute_cmd()
1761 spin_unlock_irq(&cmd->t_state_lock); __target_execute_cmd()
1763 transport_generic_request_failure(cmd, ret); __target_execute_cmd()
1768 static int target_write_prot_action(struct se_cmd *cmd) target_write_prot_action() argument
1776 switch (cmd->prot_op) { target_write_prot_action()
1778 if (!(cmd->se_sess->sup_prot_ops & TARGET_PROT_DOUT_INSERT)) target_write_prot_action()
1779 sbc_dif_generate(cmd); target_write_prot_action()
1782 if (cmd->se_sess->sup_prot_ops & TARGET_PROT_DOUT_STRIP) target_write_prot_action()
1785 sectors = cmd->data_length >> ilog2(cmd->se_dev->dev_attrib.block_size); target_write_prot_action()
1786 cmd->pi_err = sbc_dif_verify(cmd, cmd->t_task_lba, target_write_prot_action()
1787 sectors, 0, cmd->t_prot_sg, 0); target_write_prot_action()
1788 if (unlikely(cmd->pi_err)) { target_write_prot_action()
1789 spin_lock_irq(&cmd->t_state_lock); target_write_prot_action()
1790 cmd->transport_state &= ~(CMD_T_BUSY|CMD_T_SENT); target_write_prot_action()
1791 spin_unlock_irq(&cmd->t_state_lock); target_write_prot_action()
1792 transport_generic_request_failure(cmd, cmd->pi_err); target_write_prot_action()
1803 static bool target_handle_task_attr(struct se_cmd *cmd) target_handle_task_attr() argument
1805 struct se_device *dev = cmd->se_dev; target_handle_task_attr()
1814 switch (cmd->sam_task_attr) { target_handle_task_attr()
1817 cmd->t_task_cdb[0]); target_handle_task_attr()
1823 cmd->t_task_cdb[0]); target_handle_task_attr()
1844 list_add_tail(&cmd->se_delayed_node, &dev->delayed_cmd_list); target_handle_task_attr()
1848 cmd->t_task_cdb[0], cmd->sam_task_attr); target_handle_task_attr()
1854 void target_execute_cmd(struct se_cmd *cmd) target_execute_cmd() argument
1862 spin_lock_irq(&cmd->t_state_lock); target_execute_cmd()
1863 if (__transport_check_aborted_status(cmd, 1)) { target_execute_cmd()
1864 spin_unlock_irq(&cmd->t_state_lock); target_execute_cmd()
1867 if (cmd->transport_state & CMD_T_STOP) { target_execute_cmd()
1869 __func__, __LINE__, cmd->tag); target_execute_cmd()
1871 spin_unlock_irq(&cmd->t_state_lock); target_execute_cmd()
1872 complete_all(&cmd->t_transport_stop_comp); target_execute_cmd()
1876 cmd->t_state = TRANSPORT_PROCESSING; target_execute_cmd()
1877 cmd->transport_state |= CMD_T_ACTIVE|CMD_T_BUSY|CMD_T_SENT; target_execute_cmd()
1878 spin_unlock_irq(&cmd->t_state_lock); target_execute_cmd()
1880 if (target_write_prot_action(cmd)) target_execute_cmd()
1883 if (target_handle_task_attr(cmd)) { target_execute_cmd()
1884 spin_lock_irq(&cmd->t_state_lock); target_execute_cmd()
1885 cmd->transport_state &= ~(CMD_T_BUSY | CMD_T_SENT); target_execute_cmd()
1886 spin_unlock_irq(&cmd->t_state_lock); target_execute_cmd()
1890 __target_execute_cmd(cmd); target_execute_cmd()
1901 struct se_cmd *cmd; target_restart_delayed_cmds() local
1909 cmd = list_entry(dev->delayed_cmd_list.next, target_restart_delayed_cmds()
1911 list_del(&cmd->se_delayed_node); target_restart_delayed_cmds()
1914 __target_execute_cmd(cmd); target_restart_delayed_cmds()
1916 if (cmd->sam_task_attr == TCM_ORDERED_TAG) target_restart_delayed_cmds()
1925 static void transport_complete_task_attr(struct se_cmd *cmd) transport_complete_task_attr() argument
1927 struct se_device *dev = cmd->se_dev; transport_complete_task_attr()
1932 if (cmd->sam_task_attr == TCM_SIMPLE_TAG) { transport_complete_task_attr()
1937 } else if (cmd->sam_task_attr == TCM_HEAD_TAG) { transport_complete_task_attr()
1941 } else if (cmd->sam_task_attr == TCM_ORDERED_TAG) { transport_complete_task_attr()
1952 static void transport_complete_qf(struct se_cmd *cmd) transport_complete_qf() argument
1956 transport_complete_task_attr(cmd); transport_complete_qf()
1958 if (cmd->se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) { transport_complete_qf()
1959 trace_target_cmd_complete(cmd); transport_complete_qf()
1960 ret = cmd->se_tfo->queue_status(cmd); transport_complete_qf()
1964 switch (cmd->data_direction) { transport_complete_qf()
1966 trace_target_cmd_complete(cmd); transport_complete_qf()
1967 ret = cmd->se_tfo->queue_data_in(cmd); transport_complete_qf()
1970 if (cmd->se_cmd_flags & SCF_BIDI) { transport_complete_qf()
1971 ret = cmd->se_tfo->queue_data_in(cmd); transport_complete_qf()
1976 trace_target_cmd_complete(cmd); transport_complete_qf()
1977 ret = cmd->se_tfo->queue_status(cmd); transport_complete_qf()
1985 transport_handle_queue_full(cmd, cmd->se_dev); transport_complete_qf()
1988 transport_lun_remove_cmd(cmd); transport_complete_qf()
1989 transport_cmd_check_stop_to_fabric(cmd); transport_complete_qf()
1993 struct se_cmd *cmd, transport_handle_queue_full()
1997 list_add_tail(&cmd->se_qf_node, &cmd->se_dev->qf_cmd_list); transport_handle_queue_full()
1999 spin_unlock_irq(&cmd->se_dev->qf_cmd_lock); transport_handle_queue_full()
2001 schedule_work(&cmd->se_dev->qf_work_queue); transport_handle_queue_full()
2004 static bool target_read_prot_action(struct se_cmd *cmd) target_read_prot_action() argument
2006 switch (cmd->prot_op) { target_read_prot_action()
2008 if (!(cmd->se_sess->sup_prot_ops & TARGET_PROT_DIN_STRIP)) { target_read_prot_action()
2009 u32 sectors = cmd->data_length >> target_read_prot_action()
2010 ilog2(cmd->se_dev->dev_attrib.block_size); target_read_prot_action()
2012 cmd->pi_err = sbc_dif_verify(cmd, cmd->t_task_lba, target_read_prot_action()
2013 sectors, 0, cmd->t_prot_sg, target_read_prot_action()
2015 if (cmd->pi_err) target_read_prot_action()
2020 if (cmd->se_sess->sup_prot_ops & TARGET_PROT_DIN_INSERT) target_read_prot_action()
2023 sbc_dif_generate(cmd); target_read_prot_action()
2034 struct se_cmd *cmd = container_of(work, struct se_cmd, work); target_complete_ok_work() local
2042 transport_complete_task_attr(cmd); target_complete_ok_work()
2046 * cmd->transport_qf_callback() target_complete_ok_work()
2048 if (atomic_read(&cmd->se_dev->dev_qf_count) != 0) target_complete_ok_work()
2049 schedule_work(&cmd->se_dev->qf_work_queue); target_complete_ok_work()
2055 if (cmd->se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) { target_complete_ok_work()
2056 WARN_ON(!cmd->scsi_status); target_complete_ok_work()
2058 cmd, 0, 1); target_complete_ok_work()
2062 transport_lun_remove_cmd(cmd); target_complete_ok_work()
2063 transport_cmd_check_stop_to_fabric(cmd); target_complete_ok_work()
2070 if (cmd->transport_complete_callback) { target_complete_ok_work()
2072 bool caw = (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE); target_complete_ok_work()
2073 bool zero_dl = !(cmd->data_length); target_complete_ok_work()
2076 rc = cmd->transport_complete_callback(cmd, true, &post_ret); target_complete_ok_work()
2083 ret = transport_send_check_condition_and_sense(cmd, target_complete_ok_work()
2088 transport_lun_remove_cmd(cmd); target_complete_ok_work()
2089 transport_cmd_check_stop_to_fabric(cmd); target_complete_ok_work()
2095 switch (cmd->data_direction) { target_complete_ok_work()
2097 atomic_long_add(cmd->data_length, target_complete_ok_work()
2098 &cmd->se_lun->lun_stats.tx_data_octets); target_complete_ok_work()
2104 if (target_read_prot_action(cmd)) { target_complete_ok_work()
2105 ret = transport_send_check_condition_and_sense(cmd, target_complete_ok_work()
2106 cmd->pi_err, 0); target_complete_ok_work()
2110 transport_lun_remove_cmd(cmd); target_complete_ok_work()
2111 transport_cmd_check_stop_to_fabric(cmd); target_complete_ok_work()
2115 trace_target_cmd_complete(cmd); target_complete_ok_work()
2116 ret = cmd->se_tfo->queue_data_in(cmd); target_complete_ok_work()
2121 atomic_long_add(cmd->data_length, target_complete_ok_work()
2122 &cmd->se_lun->lun_stats.rx_data_octets); target_complete_ok_work()
2126 if (cmd->se_cmd_flags & SCF_BIDI) { target_complete_ok_work()
2127 atomic_long_add(cmd->data_length, target_complete_ok_work()
2128 &cmd->se_lun->lun_stats.tx_data_octets); target_complete_ok_work()
2129 ret = cmd->se_tfo->queue_data_in(cmd); target_complete_ok_work()
2136 trace_target_cmd_complete(cmd); target_complete_ok_work()
2137 ret = cmd->se_tfo->queue_status(cmd); target_complete_ok_work()
2145 transport_lun_remove_cmd(cmd); target_complete_ok_work()
2146 transport_cmd_check_stop_to_fabric(cmd); target_complete_ok_work()
2151 " data_direction: %d\n", cmd, cmd->data_direction); target_complete_ok_work()
2152 cmd->t_state = TRANSPORT_COMPLETE_QF_OK; target_complete_ok_work()
2153 transport_handle_queue_full(cmd, cmd->se_dev); target_complete_ok_work()
2167 static inline void transport_reset_sgl_orig(struct se_cmd *cmd) transport_reset_sgl_orig() argument
2173 if (!cmd->t_data_sg_orig) transport_reset_sgl_orig()
2176 kfree(cmd->t_data_sg); transport_reset_sgl_orig()
2177 cmd->t_data_sg = cmd->t_data_sg_orig; transport_reset_sgl_orig()
2178 cmd->t_data_sg_orig = NULL; transport_reset_sgl_orig()
2179 cmd->t_data_nents = cmd->t_data_nents_orig; transport_reset_sgl_orig()
2180 cmd->t_data_nents_orig = 0; transport_reset_sgl_orig()
2183 static inline void transport_free_pages(struct se_cmd *cmd) transport_free_pages() argument
2185 if (!(cmd->se_cmd_flags & SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC)) { transport_free_pages()
2186 transport_free_sgl(cmd->t_prot_sg, cmd->t_prot_nents); transport_free_pages()
2187 cmd->t_prot_sg = NULL; transport_free_pages()
2188 cmd->t_prot_nents = 0; transport_free_pages()
2191 if (cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) { transport_free_pages()
2196 if (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) { transport_free_pages()
2197 transport_free_sgl(cmd->t_bidi_data_sg, transport_free_pages()
2198 cmd->t_bidi_data_nents); transport_free_pages()
2199 cmd->t_bidi_data_sg = NULL; transport_free_pages()
2200 cmd->t_bidi_data_nents = 0; transport_free_pages()
2202 transport_reset_sgl_orig(cmd); transport_free_pages()
2205 transport_reset_sgl_orig(cmd); transport_free_pages()
2207 transport_free_sgl(cmd->t_data_sg, cmd->t_data_nents); transport_free_pages()
2208 cmd->t_data_sg = NULL; transport_free_pages()
2209 cmd->t_data_nents = 0; transport_free_pages()
2211 transport_free_sgl(cmd->t_bidi_data_sg, cmd->t_bidi_data_nents); transport_free_pages()
2212 cmd->t_bidi_data_sg = NULL; transport_free_pages()
2213 cmd->t_bidi_data_nents = 0; transport_free_pages()
2218 * @cmd: command to release
2222 static int transport_put_cmd(struct se_cmd *cmd) transport_put_cmd() argument
2224 BUG_ON(!cmd->se_tfo); transport_put_cmd()
2226 * If this cmd has been setup with target_get_sess_cmd(), drop transport_put_cmd()
2229 return target_put_sess_cmd(cmd); transport_put_cmd()
2232 void *transport_kmap_data_sg(struct se_cmd *cmd) transport_kmap_data_sg() argument
2234 struct scatterlist *sg = cmd->t_data_sg; transport_kmap_data_sg()
2243 if (!cmd->t_data_nents) transport_kmap_data_sg()
2247 if (cmd->t_data_nents == 1) transport_kmap_data_sg()
2251 pages = kmalloc(sizeof(*pages) * cmd->t_data_nents, GFP_KERNEL); transport_kmap_data_sg()
2256 for_each_sg(cmd->t_data_sg, sg, cmd->t_data_nents, i) { transport_kmap_data_sg()
2260 cmd->t_data_vmap = vmap(pages, cmd->t_data_nents, VM_MAP, PAGE_KERNEL); transport_kmap_data_sg()
2262 if (!cmd->t_data_vmap) transport_kmap_data_sg()
2265 return cmd->t_data_vmap + cmd->t_data_sg[0].offset; transport_kmap_data_sg()
2269 void transport_kunmap_data_sg(struct se_cmd *cmd) transport_kunmap_data_sg() argument
2271 if (!cmd->t_data_nents) { transport_kunmap_data_sg()
2273 } else if (cmd->t_data_nents == 1) { transport_kunmap_data_sg()
2274 kunmap(sg_page(cmd->t_data_sg)); transport_kunmap_data_sg()
2278 vunmap(cmd->t_data_vmap); transport_kunmap_data_sg()
2279 cmd->t_data_vmap = NULL; transport_kunmap_data_sg()
2329 transport_generic_new_cmd(struct se_cmd *cmd) transport_generic_new_cmd() argument
2332 bool zero_flag = !(cmd->se_cmd_flags & SCF_SCSI_DATA_CDB); transport_generic_new_cmd()
2334 if (cmd->prot_op != TARGET_PROT_NORMAL && transport_generic_new_cmd()
2335 !(cmd->se_cmd_flags & SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC)) { transport_generic_new_cmd()
2336 ret = target_alloc_sgl(&cmd->t_prot_sg, &cmd->t_prot_nents, transport_generic_new_cmd()
2337 cmd->prot_length, true); transport_generic_new_cmd()
2347 if (!(cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) && transport_generic_new_cmd()
2348 cmd->data_length) { transport_generic_new_cmd()
2350 if ((cmd->se_cmd_flags & SCF_BIDI) || transport_generic_new_cmd()
2351 (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE)) { transport_generic_new_cmd()
2354 if (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) transport_generic_new_cmd()
2355 bidi_length = cmd->t_task_nolb * transport_generic_new_cmd()
2356 cmd->se_dev->dev_attrib.block_size; transport_generic_new_cmd()
2358 bidi_length = cmd->data_length; transport_generic_new_cmd()
2360 ret = target_alloc_sgl(&cmd->t_bidi_data_sg, transport_generic_new_cmd()
2361 &cmd->t_bidi_data_nents, transport_generic_new_cmd()
2367 ret = target_alloc_sgl(&cmd->t_data_sg, &cmd->t_data_nents, transport_generic_new_cmd()
2368 cmd->data_length, zero_flag); transport_generic_new_cmd()
2371 } else if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) && transport_generic_new_cmd()
2372 cmd->data_length) { transport_generic_new_cmd()
2377 u32 caw_length = cmd->t_task_nolb * transport_generic_new_cmd()
2378 cmd->se_dev->dev_attrib.block_size; transport_generic_new_cmd()
2380 ret = target_alloc_sgl(&cmd->t_bidi_data_sg, transport_generic_new_cmd()
2381 &cmd->t_bidi_data_nents, transport_generic_new_cmd()
2391 target_add_to_state_list(cmd); transport_generic_new_cmd()
2392 if (cmd->data_direction != DMA_TO_DEVICE || cmd->data_length == 0) { transport_generic_new_cmd()
2393 target_execute_cmd(cmd); transport_generic_new_cmd()
2396 transport_cmd_check_stop(cmd, false, true); transport_generic_new_cmd()
2398 ret = cmd->se_tfo->write_pending(cmd); transport_generic_new_cmd()
2408 pr_debug("Handling write_pending QUEUE__FULL: se_cmd: %p\n", cmd); transport_generic_new_cmd()
2409 cmd->t_state = TRANSPORT_COMPLETE_QF_WP; transport_generic_new_cmd()
2410 transport_handle_queue_full(cmd, cmd->se_dev); transport_generic_new_cmd()
2415 static void transport_write_pending_qf(struct se_cmd *cmd) transport_write_pending_qf() argument
2419 ret = cmd->se_tfo->write_pending(cmd); transport_write_pending_qf()
2422 cmd); transport_write_pending_qf()
2423 transport_handle_queue_full(cmd, cmd->se_dev); transport_write_pending_qf()
2431 static void target_wait_free_cmd(struct se_cmd *cmd, bool *aborted, bool *tas) target_wait_free_cmd() argument
2435 spin_lock_irqsave(&cmd->t_state_lock, flags); target_wait_free_cmd()
2436 __transport_wait_for_tasks(cmd, true, aborted, tas, &flags); target_wait_free_cmd()
2437 spin_unlock_irqrestore(&cmd->t_state_lock, flags); target_wait_free_cmd()
2440 int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) transport_generic_free_cmd() argument
2445 if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) { transport_generic_free_cmd()
2446 if (wait_for_tasks && (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) transport_generic_free_cmd()
2447 target_wait_free_cmd(cmd, &aborted, &tas); transport_generic_free_cmd()
2450 ret = transport_put_cmd(cmd); transport_generic_free_cmd()
2453 target_wait_free_cmd(cmd, &aborted, &tas); transport_generic_free_cmd()
2459 if (cmd->state_active) transport_generic_free_cmd()
2460 target_remove_from_state_list(cmd); transport_generic_free_cmd()
2462 if (cmd->se_lun) transport_generic_free_cmd()
2463 transport_lun_remove_cmd(cmd); transport_generic_free_cmd()
2466 ret = transport_put_cmd(cmd); transport_generic_free_cmd()
2475 pr_debug("Detected CMD_T_ABORTED for ITT: %llu\n", cmd->tag); transport_generic_free_cmd()
2476 wait_for_completion(&cmd->cmd_wait_comp); transport_generic_free_cmd()
2477 cmd->se_tfo->release_cmd(cmd); transport_generic_free_cmd()
2518 static void target_free_cmd_mem(struct se_cmd *cmd) target_free_cmd_mem() argument
2520 transport_free_pages(cmd); target_free_cmd_mem()
2522 if (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) target_free_cmd_mem()
2523 core_tmr_release_req(cmd->se_tmr_req); target_free_cmd_mem()
2524 if (cmd->t_task_cdb != cmd->__t_task_cdb) target_free_cmd_mem()
2525 kfree(cmd->t_task_cdb); target_free_cmd_mem()
2656 __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop,
2658 __releases(&cmd->t_state_lock)
2659 __acquires(&cmd->t_state_lock)
2662 assert_spin_locked(&cmd->t_state_lock);
2666 cmd->transport_state |= CMD_T_FABRIC_STOP;
2668 if (cmd->transport_state & CMD_T_ABORTED)
2671 if (cmd->transport_state & CMD_T_TAS)
2674 if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD) &&
2675 !(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB))
2678 if (!(cmd->se_cmd_flags & SCF_SUPPORTED_SAM_OPCODE) &&
2679 !(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB))
2682 if (!(cmd->transport_state & CMD_T_ACTIVE))
2688 cmd->transport_state |= CMD_T_STOP;
2691 " t_state: %d, CMD_T_STOP\n", cmd, cmd->tag,
2692 cmd->se_tfo->get_cmd_state(cmd), cmd->t_state);
2694 spin_unlock_irqrestore(&cmd->t_state_lock, *flags);
2696 wait_for_completion(&cmd->t_transport_stop_comp);
2698 spin_lock_irqsave(&cmd->t_state_lock, *flags);
2699 cmd->transport_state &= ~(CMD_T_ACTIVE | CMD_T_STOP);
2701 pr_debug("wait_for_tasks: Stopped wait_for_completion(&cmd->"
2702 "t_transport_stop_comp) for ITT: 0x%08llx\n", cmd->tag);
2709 * @cmd: command to wait
2714 bool transport_wait_for_tasks(struct se_cmd *cmd) transport_wait_for_tasks() argument
2719 spin_lock_irqsave(&cmd->t_state_lock, flags); transport_wait_for_tasks()
2720 ret = __transport_wait_for_tasks(cmd, false, &aborted, &tas, &flags); transport_wait_for_tasks()
2721 spin_unlock_irqrestore(&cmd->t_state_lock, flags); transport_wait_for_tasks()
2840 static int translate_sense_reason(struct se_cmd *cmd, sense_reason_t reason) translate_sense_reason() argument
2843 u8 *buffer = cmd->sense_buffer; translate_sense_reason()
2846 bool desc_format = target_sense_desc_format(cmd->se_dev); translate_sense_reason()
2855 core_scsi3_ua_for_check_condition(cmd, &asc, &ascq); translate_sense_reason()
2858 WARN_ON_ONCE(cmd->scsi_asc == 0); translate_sense_reason()
2859 asc = cmd->scsi_asc; translate_sense_reason()
2860 ascq = cmd->scsi_ascq; translate_sense_reason()
2869 cmd->scsi_sense_length, translate_sense_reason()
2870 cmd->bad_sector); translate_sense_reason()
2876 transport_send_check_condition_and_sense(struct se_cmd *cmd, transport_send_check_condition_and_sense() argument
2881 spin_lock_irqsave(&cmd->t_state_lock, flags); transport_send_check_condition_and_sense()
2882 if (cmd->se_cmd_flags & SCF_SENT_CHECK_CONDITION) { transport_send_check_condition_and_sense()
2883 spin_unlock_irqrestore(&cmd->t_state_lock, flags); transport_send_check_condition_and_sense()
2886 cmd->se_cmd_flags |= SCF_SENT_CHECK_CONDITION; transport_send_check_condition_and_sense()
2887 spin_unlock_irqrestore(&cmd->t_state_lock, flags); transport_send_check_condition_and_sense()
2892 cmd->se_cmd_flags |= SCF_EMULATED_TASK_SENSE; transport_send_check_condition_and_sense()
2893 cmd->scsi_status = SAM_STAT_CHECK_CONDITION; transport_send_check_condition_and_sense()
2894 cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER; transport_send_check_condition_and_sense()
2895 rc = translate_sense_reason(cmd, reason); transport_send_check_condition_and_sense()
2900 trace_target_cmd_complete(cmd); transport_send_check_condition_and_sense()
2901 return cmd->se_tfo->queue_status(cmd); transport_send_check_condition_and_sense()
2905 static int __transport_check_aborted_status(struct se_cmd *cmd, int send_status)
2906 __releases(&cmd->t_state_lock)
2907 __acquires(&cmd->t_state_lock)
2909 assert_spin_locked(&cmd->t_state_lock);
2912 if (!(cmd->transport_state & CMD_T_ABORTED))
2915 * If cmd has been aborted but either no status is to be sent or it has
2918 if (!send_status || !(cmd->se_cmd_flags & SCF_SEND_DELAYED_TAS)) {
2920 cmd->se_cmd_flags |= SCF_SEND_DELAYED_TAS;
2925 " 0x%02x ITT: 0x%08llx\n", cmd->t_task_cdb[0], cmd->tag);
2927 cmd->se_cmd_flags &= ~SCF_SEND_DELAYED_TAS;
2928 cmd->scsi_status = SAM_STAT_TASK_ABORTED;
2929 trace_target_cmd_complete(cmd); variable
2931 spin_unlock_irq(&cmd->t_state_lock);
2932 cmd->se_tfo->queue_status(cmd);
2933 spin_lock_irq(&cmd->t_state_lock);
2938 int transport_check_aborted_status(struct se_cmd *cmd, int send_status) transport_check_aborted_status() argument
2942 spin_lock_irq(&cmd->t_state_lock); transport_check_aborted_status()
2943 ret = __transport_check_aborted_status(cmd, send_status); transport_check_aborted_status()
2944 spin_unlock_irq(&cmd->t_state_lock); transport_check_aborted_status()
2950 void transport_send_task_abort(struct se_cmd *cmd) transport_send_task_abort() argument
2954 spin_lock_irqsave(&cmd->t_state_lock, flags); transport_send_task_abort()
2955 if (cmd->se_cmd_flags & (SCF_SENT_CHECK_CONDITION)) { transport_send_task_abort()
2956 spin_unlock_irqrestore(&cmd->t_state_lock, flags); transport_send_task_abort()
2959 spin_unlock_irqrestore(&cmd->t_state_lock, flags); transport_send_task_abort()
2967 if (cmd->data_direction == DMA_TO_DEVICE) { transport_send_task_abort()
2968 if (cmd->se_tfo->write_pending_status(cmd) != 0) { transport_send_task_abort()
2969 spin_lock_irqsave(&cmd->t_state_lock, flags); transport_send_task_abort()
2970 if (cmd->se_cmd_flags & SCF_SEND_DELAYED_TAS) { transport_send_task_abort()
2971 spin_unlock_irqrestore(&cmd->t_state_lock, flags); transport_send_task_abort()
2974 cmd->se_cmd_flags |= SCF_SEND_DELAYED_TAS; transport_send_task_abort()
2975 spin_unlock_irqrestore(&cmd->t_state_lock, flags); transport_send_task_abort()
2980 cmd->scsi_status = SAM_STAT_TASK_ABORTED; transport_send_task_abort()
2982 transport_lun_remove_cmd(cmd); transport_send_task_abort()
2985 cmd->t_task_cdb[0], cmd->tag); transport_send_task_abort()
2987 trace_target_cmd_complete(cmd); transport_send_task_abort()
2988 cmd->se_tfo->queue_status(cmd); transport_send_task_abort()
2993 struct se_cmd *cmd = container_of(work, struct se_cmd, work); target_tmr_work() local
2994 struct se_device *dev = cmd->se_dev; target_tmr_work()
2995 struct se_tmr_req *tmr = cmd->se_tmr_req; target_tmr_work()
2999 spin_lock_irqsave(&cmd->t_state_lock, flags); target_tmr_work()
3000 if (cmd->transport_state & CMD_T_ABORTED) { target_tmr_work()
3002 spin_unlock_irqrestore(&cmd->t_state_lock, flags); target_tmr_work()
3005 spin_unlock_irqrestore(&cmd->t_state_lock, flags); target_tmr_work()
3009 core_tmr_abort_task(dev, tmr, cmd->se_sess); target_tmr_work()
3021 target_ua_allocate_lun(cmd->se_sess->se_node_acl, target_tmr_work()
3022 cmd->orig_fe_lun, 0x29, target_tmr_work()
3039 spin_lock_irqsave(&cmd->t_state_lock, flags); target_tmr_work()
3040 if (cmd->transport_state & CMD_T_ABORTED) { target_tmr_work()
3041 spin_unlock_irqrestore(&cmd->t_state_lock, flags); target_tmr_work()
3044 cmd->t_state = TRANSPORT_ISTATE_PROCESSING; target_tmr_work()
3045 spin_unlock_irqrestore(&cmd->t_state_lock, flags); target_tmr_work()
3047 cmd->se_tfo->queue_tm_rsp(cmd); target_tmr_work()
3050 transport_cmd_check_stop_to_fabric(cmd); target_tmr_work()
3054 struct se_cmd *cmd) transport_generic_handle_tmr()
3058 spin_lock_irqsave(&cmd->t_state_lock, flags); transport_generic_handle_tmr()
3059 cmd->transport_state |= CMD_T_ACTIVE; transport_generic_handle_tmr()
3060 spin_unlock_irqrestore(&cmd->t_state_lock, flags); transport_generic_handle_tmr()
3062 INIT_WORK(&cmd->work, target_tmr_work); transport_generic_handle_tmr()
3063 queue_work(cmd->se_dev->tmr_wq, &cmd->work); transport_generic_handle_tmr()
1181 transport_init_se_cmd( struct se_cmd *cmd, const struct target_core_fabric_ops *tfo, struct se_session *se_sess, u32 data_length, int data_direction, int task_attr, unsigned char *sense_buffer) transport_init_se_cmd() argument
1313 transport_handle_cdb_direct( struct se_cmd *cmd) transport_handle_cdb_direct() argument
1992 transport_handle_queue_full( struct se_cmd *cmd, struct se_device *dev) transport_handle_queue_full() argument
3053 transport_generic_handle_tmr( struct se_cmd *cmd) transport_generic_handle_tmr() argument
H A Dtarget_core_tmr.c78 static void core_tmr_handle_tas_abort(struct se_cmd *cmd, int tas) core_tmr_handle_tas_abort() argument
85 spin_lock_irqsave(&cmd->t_state_lock, flags); core_tmr_handle_tas_abort()
86 send_tas = (cmd->transport_state & CMD_T_TAS); core_tmr_handle_tas_abort()
87 spin_unlock_irqrestore(&cmd->t_state_lock, flags); core_tmr_handle_tas_abort()
91 transport_send_task_abort(cmd); core_tmr_handle_tas_abort()
94 transport_cmd_finish_abort(cmd, remove); core_tmr_handle_tas_abort()
98 struct se_cmd *cmd) target_check_cdb_and_preempt()
105 if (reg->pr_res_key == cmd->pr_res_key) list_for_each_entry()
212 struct se_cmd *cmd; core_tmr_drain_tmr_list() local
227 cmd = tmr_p->task_cmd; core_tmr_drain_tmr_list()
228 if (!cmd) { core_tmr_drain_tmr_list()
237 if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd)) core_tmr_drain_tmr_list()
240 sess = cmd->se_sess; core_tmr_drain_tmr_list()
245 spin_lock(&cmd->t_state_lock); core_tmr_drain_tmr_list()
246 if (!(cmd->transport_state & CMD_T_ACTIVE) || core_tmr_drain_tmr_list()
247 (cmd->transport_state & CMD_T_FABRIC_STOP)) { core_tmr_drain_tmr_list()
248 spin_unlock(&cmd->t_state_lock); core_tmr_drain_tmr_list()
252 if (cmd->t_state == TRANSPORT_ISTATE_PROCESSING) { core_tmr_drain_tmr_list()
253 spin_unlock(&cmd->t_state_lock); core_tmr_drain_tmr_list()
257 if (sess->sess_tearing_down || cmd->cmd_wait_set) { core_tmr_drain_tmr_list()
258 spin_unlock(&cmd->t_state_lock); core_tmr_drain_tmr_list()
262 cmd->transport_state |= CMD_T_ABORTED; core_tmr_drain_tmr_list()
263 spin_unlock(&cmd->t_state_lock); core_tmr_drain_tmr_list()
265 rc = kref_get_unless_zero(&cmd->cmd_kref); core_tmr_drain_tmr_list()
279 cmd = tmr_p->task_cmd; core_tmr_drain_tmr_list()
284 tmr_p->function, tmr_p->response, cmd->t_state); core_tmr_drain_tmr_list()
286 cancel_work_sync(&cmd->work); core_tmr_drain_tmr_list()
287 transport_wait_for_tasks(cmd); core_tmr_drain_tmr_list()
289 transport_cmd_finish_abort(cmd, 1); core_tmr_drain_tmr_list()
290 target_put_sess_cmd(cmd); core_tmr_drain_tmr_list()
303 struct se_cmd *cmd, *next; core_tmr_drain_state_list() local
330 list_for_each_entry_safe(cmd, next, &dev->state_list, state_list) { core_tmr_drain_state_list()
335 if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd)) core_tmr_drain_state_list()
341 if (prout_cmd == cmd) core_tmr_drain_state_list()
344 sess = cmd->se_sess; core_tmr_drain_state_list()
349 rc = __target_check_io_state(cmd, tmr_sess, tas); core_tmr_drain_state_list()
354 list_move_tail(&cmd->state_list, &drain_task_list); core_tmr_drain_state_list()
355 cmd->state_active = false; core_tmr_drain_state_list()
360 cmd = list_entry(drain_task_list.next, struct se_cmd, state_list); core_tmr_drain_state_list()
361 list_del_init(&cmd->state_list); core_tmr_drain_state_list()
363 pr_debug("LUN_RESET: %s cmd: %p" core_tmr_drain_state_list()
366 (preempt_and_abort_list) ? "Preempt" : "", cmd, core_tmr_drain_state_list()
367 cmd->tag, 0, core_tmr_drain_state_list()
368 cmd->se_tfo->get_cmd_state(cmd), cmd->t_state, core_tmr_drain_state_list()
369 cmd->t_task_cdb[0]); core_tmr_drain_state_list()
373 cmd->tag, cmd->pr_res_key, core_tmr_drain_state_list()
374 (cmd->transport_state & CMD_T_ACTIVE) != 0, core_tmr_drain_state_list()
375 (cmd->transport_state & CMD_T_STOP) != 0, core_tmr_drain_state_list()
376 (cmd->transport_state & CMD_T_SENT) != 0); core_tmr_drain_state_list()
385 cancel_work_sync(&cmd->work); core_tmr_drain_state_list()
386 transport_wait_for_tasks(cmd); core_tmr_drain_state_list()
388 core_tmr_handle_tas_abort(cmd, tas); core_tmr_drain_state_list()
389 target_put_sess_cmd(cmd); core_tmr_drain_state_list()
97 target_check_cdb_and_preempt(struct list_head *list, struct se_cmd *cmd) target_check_cdb_and_preempt() argument
H A Dtarget_core_file.c249 static int fd_do_rw(struct se_cmd *cmd, struct file *fd, fd_do_rw() argument
257 loff_t pos = (cmd->t_task_lba * block_size); fd_do_rw()
312 fd_execute_sync_cache(struct se_cmd *cmd) fd_execute_sync_cache() argument
314 struct se_device *dev = cmd->se_dev; fd_execute_sync_cache()
316 int immed = (cmd->t_task_cdb[1] & 0x2); fd_execute_sync_cache()
325 target_complete_cmd(cmd, SAM_STAT_GOOD); fd_execute_sync_cache()
330 if (cmd->t_task_lba == 0 && cmd->data_length == 0) { fd_execute_sync_cache()
334 start = cmd->t_task_lba * dev->dev_attrib.block_size; fd_execute_sync_cache()
335 if (cmd->data_length) fd_execute_sync_cache()
336 end = start + cmd->data_length - 1; fd_execute_sync_cache()
349 target_complete_cmd(cmd, SAM_STAT_CHECK_CONDITION); fd_execute_sync_cache()
351 target_complete_cmd(cmd, SAM_STAT_GOOD); fd_execute_sync_cache()
357 fd_execute_write_same(struct se_cmd *cmd) fd_execute_write_same() argument
359 struct se_device *se_dev = cmd->se_dev; fd_execute_write_same()
361 loff_t pos = cmd->t_task_lba * se_dev->dev_attrib.block_size; fd_execute_write_same()
362 sector_t nolb = sbc_get_write_same_sectors(cmd); fd_execute_write_same()
369 target_complete_cmd(cmd, SAM_STAT_GOOD); fd_execute_write_same()
372 if (cmd->prot_op) { fd_execute_write_same()
378 if (cmd->t_data_nents > 1 || fd_execute_write_same()
379 cmd->t_data_sg[0].length != cmd->se_dev->dev_attrib.block_size) { fd_execute_write_same()
382 cmd->t_data_nents, fd_execute_write_same()
383 cmd->t_data_sg[0].length, fd_execute_write_same()
384 cmd->se_dev->dev_attrib.block_size); fd_execute_write_same()
393 bvec[i].bv_page = sg_page(&cmd->t_data_sg[0]); fd_execute_write_same()
394 bvec[i].bv_len = cmd->t_data_sg[0].length; fd_execute_write_same()
395 bvec[i].bv_offset = cmd->t_data_sg[0].offset; fd_execute_write_same()
409 target_complete_cmd(cmd, SAM_STAT_GOOD); fd_execute_write_same()
444 fd_do_prot_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb) fd_do_prot_unmap() argument
456 rc = fd_do_prot_fill(cmd->se_dev, lba, nolb, buf, PAGE_SIZE); fd_do_prot_unmap()
464 fd_execute_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb) fd_execute_unmap() argument
466 struct file *file = FD_DEV(cmd->se_dev)->fd_file; fd_execute_unmap()
470 if (cmd->se_dev->dev_attrib.pi_prot_type) { fd_execute_unmap()
471 ret = fd_do_prot_unmap(cmd, lba, nolb); fd_execute_unmap()
479 struct se_device *dev = cmd->se_dev; fd_execute_unmap()
492 struct se_device *se_dev = cmd->se_dev; fd_execute_unmap()
511 fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, fd_execute_rw() argument
514 struct se_device *dev = cmd->se_dev; fd_execute_rw()
524 if (cmd->data_length > FD_MAX_BYTES) { fd_execute_rw()
527 cmd->data_length, FD_MAX_BYTES); fd_execute_rw()
535 if (cmd->prot_type && dev->dev_attrib.pi_prot_type) { fd_execute_rw()
536 ret = fd_do_rw(cmd, pfile, dev->prot_length, fd_execute_rw()
537 cmd->t_prot_sg, cmd->t_prot_nents, fd_execute_rw()
538 cmd->prot_length, 0); fd_execute_rw()
543 ret = fd_do_rw(cmd, file, dev->dev_attrib.block_size, fd_execute_rw()
544 sgl, sgl_nents, cmd->data_length, 0); fd_execute_rw()
546 if (ret > 0 && cmd->prot_type && dev->dev_attrib.pi_prot_type) { fd_execute_rw()
547 u32 sectors = cmd->data_length >> fd_execute_rw()
550 rc = sbc_dif_verify(cmd, cmd->t_task_lba, sectors, fd_execute_rw()
551 0, cmd->t_prot_sg, 0); fd_execute_rw()
556 if (cmd->prot_type && dev->dev_attrib.pi_prot_type) { fd_execute_rw()
557 u32 sectors = cmd->data_length >> fd_execute_rw()
560 rc = sbc_dif_verify(cmd, cmd->t_task_lba, sectors, fd_execute_rw()
561 0, cmd->t_prot_sg, 0); fd_execute_rw()
566 ret = fd_do_rw(cmd, file, dev->dev_attrib.block_size, fd_execute_rw()
567 sgl, sgl_nents, cmd->data_length, 1); fd_execute_rw()
573 if (ret > 0 && (cmd->se_cmd_flags & SCF_FUA)) { fd_execute_rw()
574 loff_t start = cmd->t_task_lba * fd_execute_rw()
578 if (cmd->data_length) fd_execute_rw()
579 end = start + cmd->data_length - 1; fd_execute_rw()
586 if (ret > 0 && cmd->prot_type && dev->dev_attrib.pi_prot_type) { fd_execute_rw()
587 ret = fd_do_rw(cmd, pfile, dev->prot_length, fd_execute_rw()
588 cmd->t_prot_sg, cmd->t_prot_nents, fd_execute_rw()
589 cmd->prot_length, 1); fd_execute_rw()
599 target_complete_cmd(cmd, SAM_STAT_GOOD); fd_execute_rw()
803 fd_parse_cdb(struct se_cmd *cmd) fd_parse_cdb() argument
805 return sbc_parse_cdb(cmd, &fd_sbc_ops); fd_parse_cdb()
H A Dtarget_core_spc.c64 spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char *buf) spc_emulate_inquiry_std() argument
66 struct se_lun *lun = cmd->se_lun; spc_emulate_inquiry_std()
67 struct se_device *dev = cmd->se_dev; spc_emulate_inquiry_std()
68 struct se_session *sess = cmd->se_sess; spc_emulate_inquiry_std()
105 if (dev->dev_attrib.pi_prot_type || cmd->se_sess->sess_prot_type) spc_emulate_inquiry_std()
125 spc_emulate_evpd_80(struct se_cmd *cmd, unsigned char *buf) spc_emulate_evpd_80() argument
127 struct se_device *dev = cmd->se_dev; spc_emulate_evpd_80()
174 spc_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf) spc_emulate_evpd_83() argument
176 struct se_device *dev = cmd->se_dev; spc_emulate_evpd_83()
177 struct se_lun *lun = cmd->se_lun; spc_emulate_evpd_83()
442 spc_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf) spc_emulate_evpd_86() argument
444 struct se_device *dev = cmd->se_dev; spc_emulate_evpd_86()
445 struct se_session *sess = cmd->se_sess; spc_emulate_evpd_86()
454 cmd->se_sess->sess_prot_type == TARGET_DIF_TYPE1_PROT) spc_emulate_evpd_86()
457 cmd->se_sess->sess_prot_type == TARGET_DIF_TYPE3_PROT) spc_emulate_evpd_86()
464 (dev->dev_attrib.pi_prot_type || cmd->se_sess->sess_prot_type)) { spc_emulate_evpd_86()
475 spin_lock(&cmd->se_dev->t10_alua.lba_map_lock); spc_emulate_evpd_86()
478 spin_unlock(&cmd->se_dev->t10_alua.lba_map_lock); spc_emulate_evpd_86()
484 spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) spc_emulate_evpd_b0() argument
486 struct se_device *dev = cmd->se_dev; spc_emulate_evpd_b0()
523 if (cmd->se_tfo->max_data_sg_nents) { spc_emulate_evpd_b0()
524 mtl = (cmd->se_tfo->max_data_sg_nents * PAGE_SIZE) / spc_emulate_evpd_b0()
578 spc_emulate_evpd_b1(struct se_cmd *cmd, unsigned char *buf) spc_emulate_evpd_b1() argument
580 struct se_device *dev = cmd->se_dev; spc_emulate_evpd_b1()
591 spc_emulate_evpd_b2(struct se_cmd *cmd, unsigned char *buf) spc_emulate_evpd_b2() argument
593 struct se_device *dev = cmd->se_dev; spc_emulate_evpd_b2()
643 spc_emulate_evpd_b3(struct se_cmd *cmd, unsigned char *buf) spc_emulate_evpd_b3() argument
645 struct se_device *dev = cmd->se_dev; spc_emulate_evpd_b3()
656 spc_emulate_evpd_00(struct se_cmd *cmd, unsigned char *buf);
674 spc_emulate_evpd_00(struct se_cmd *cmd, unsigned char *buf) spc_emulate_evpd_00() argument
683 if (cmd->se_dev->dev_flags & DF_EMULATED_VPD_UNIT_SERIAL) { spc_emulate_evpd_00()
693 spc_emulate_inquiry(struct se_cmd *cmd) spc_emulate_inquiry() argument
695 struct se_device *dev = cmd->se_dev; spc_emulate_inquiry()
696 struct se_portal_group *tpg = cmd->se_lun->lun_tpg; spc_emulate_inquiry()
698 unsigned char *cdb = cmd->t_task_cdb; spc_emulate_inquiry()
723 ret = spc_emulate_inquiry_std(cmd, buf); spc_emulate_inquiry()
731 ret = evpd_handlers[p].emulate(cmd, buf); spc_emulate_inquiry()
741 rbuf = transport_kmap_data_sg(cmd); spc_emulate_inquiry()
743 memcpy(rbuf, buf, min_t(u32, SE_INQUIRY_BUF, cmd->data_length)); spc_emulate_inquiry()
744 transport_kunmap_data_sg(cmd); spc_emulate_inquiry()
749 target_complete_cmd_with_length(cmd, GOOD, len); spc_emulate_inquiry()
753 static int spc_modesense_rwrecovery(struct se_cmd *cmd, u8 pc, u8 *p) spc_modesense_rwrecovery() argument
766 static int spc_modesense_control(struct se_cmd *cmd, u8 pc, u8 *p) spc_modesense_control() argument
768 struct se_device *dev = cmd->se_dev; spc_modesense_control()
769 struct se_session *sess = cmd->se_sess; spc_modesense_control()
880 static int spc_modesense_caching(struct se_cmd *cmd, u8 pc, u8 *p) spc_modesense_caching() argument
882 struct se_device *dev = cmd->se_dev; spc_modesense_caching()
899 static int spc_modesense_informational_exceptions(struct se_cmd *cmd, u8 pc, unsigned char *p) spc_modesense_informational_exceptions() argument
973 static sense_reason_t spc_emulate_modesense(struct se_cmd *cmd) spc_emulate_modesense() argument
975 struct se_device *dev = cmd->se_dev; spc_emulate_modesense()
976 char *cdb = cmd->t_task_cdb; spc_emulate_modesense()
979 int ten = (cmd->t_task_cdb[0] == MODE_SENSE_10); spc_emulate_modesense()
988 bool read_only = target_lun_is_rdonly(cmd);; spc_emulate_modesense()
999 if ((cmd->se_lun->lun_access & TRANSPORT_LUNFLAGS_READ_ONLY) || read_only) spc_emulate_modesense()
1056 ret = modesense_handlers[i].emulate(cmd, pc, &buf[length]); spc_emulate_modesense()
1069 length += modesense_handlers[i].emulate(cmd, pc, &buf[length]); spc_emulate_modesense()
1089 rbuf = transport_kmap_data_sg(cmd); spc_emulate_modesense()
1091 memcpy(rbuf, buf, min_t(u32, SE_MODE_PAGE_BUF, cmd->data_length)); spc_emulate_modesense()
1092 transport_kunmap_data_sg(cmd); spc_emulate_modesense()
1095 target_complete_cmd_with_length(cmd, GOOD, length); spc_emulate_modesense()
1099 static sense_reason_t spc_emulate_modeselect(struct se_cmd *cmd) spc_emulate_modeselect() argument
1101 char *cdb = cmd->t_task_cdb; spc_emulate_modeselect()
1112 if (!cmd->data_length) { spc_emulate_modeselect()
1113 target_complete_cmd(cmd, GOOD); spc_emulate_modeselect()
1117 if (cmd->data_length < off + 2) spc_emulate_modeselect()
1120 buf = transport_kmap_data_sg(cmd); spc_emulate_modeselect()
1136 length = modesense_handlers[i].emulate(cmd, 0, tbuf); spc_emulate_modeselect()
1144 if (cmd->data_length < off + length) { spc_emulate_modeselect()
1153 transport_kunmap_data_sg(cmd); spc_emulate_modeselect()
1156 target_complete_cmd(cmd, GOOD); spc_emulate_modeselect()
1160 static sense_reason_t spc_emulate_request_sense(struct se_cmd *cmd) spc_emulate_request_sense() argument
1162 unsigned char *cdb = cmd->t_task_cdb; spc_emulate_request_sense()
1166 bool desc_format = target_sense_desc_format(cmd->se_dev); spc_emulate_request_sense()
1176 rbuf = transport_kmap_data_sg(cmd); spc_emulate_request_sense()
1180 if (!core_scsi3_ua_clear_for_request_sense(cmd, &ua_asc, &ua_ascq)) spc_emulate_request_sense()
1186 memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); spc_emulate_request_sense()
1187 transport_kunmap_data_sg(cmd); spc_emulate_request_sense()
1189 target_complete_cmd(cmd, GOOD); spc_emulate_request_sense()
1193 sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd) spc_emulate_report_luns() argument
1196 struct se_session *sess = cmd->se_sess; spc_emulate_report_luns()
1203 buf = transport_kmap_data_sg(cmd); spc_emulate_report_luns()
1204 if (cmd->data_length && !buf) spc_emulate_report_luns()
1225 if (offset >= cmd->data_length) spc_emulate_report_luns()
1230 min(8u, cmd->data_length - offset)); spc_emulate_report_luns()
1244 if (cmd->data_length > 8) spc_emulate_report_luns()
1246 min(8u, cmd->data_length - offset)); spc_emulate_report_luns()
1252 memcpy(buf, &len, min_t(int, sizeof len, cmd->data_length)); spc_emulate_report_luns()
1253 transport_kunmap_data_sg(cmd); spc_emulate_report_luns()
1256 target_complete_cmd_with_length(cmd, GOOD, 8 + lun_count * 8); spc_emulate_report_luns()
1262 spc_emulate_testunitready(struct se_cmd *cmd) spc_emulate_testunitready() argument
1264 target_complete_cmd(cmd, GOOD); spc_emulate_testunitready()
1269 spc_parse_cdb(struct se_cmd *cmd, unsigned int *size) spc_parse_cdb() argument
1271 struct se_device *dev = cmd->se_dev; spc_parse_cdb()
1272 unsigned char *cdb = cmd->t_task_cdb; spc_parse_cdb()
1277 cmd->execute_cmd = spc_emulate_modeselect; spc_parse_cdb()
1281 cmd->execute_cmd = spc_emulate_modeselect; spc_parse_cdb()
1285 cmd->execute_cmd = spc_emulate_modesense; spc_parse_cdb()
1289 cmd->execute_cmd = spc_emulate_modesense; spc_parse_cdb()
1297 cmd->execute_cmd = target_scsi3_emulate_pr_in; spc_parse_cdb()
1301 cmd->execute_cmd = target_scsi3_emulate_pr_out; spc_parse_cdb()
1308 *size = cmd->data_length; spc_parse_cdb()
1310 cmd->execute_cmd = target_scsi2_reservation_release; spc_parse_cdb()
1321 *size = cmd->data_length; spc_parse_cdb()
1323 cmd->execute_cmd = target_scsi2_reservation_reserve; spc_parse_cdb()
1327 cmd->execute_cmd = spc_emulate_request_sense; spc_parse_cdb()
1336 cmd->sam_task_attr = TCM_HEAD_TAG; spc_parse_cdb()
1337 cmd->execute_cmd = spc_emulate_inquiry; spc_parse_cdb()
1345 cmd->execute_cmd = target_do_xcopy; spc_parse_cdb()
1349 cmd->execute_cmd = target_do_receive_copy_results; spc_parse_cdb()
1364 cmd->execute_cmd = spc_emulate_report_luns; spc_parse_cdb()
1370 cmd->sam_task_attr = TCM_HEAD_TAG; spc_parse_cdb()
1373 cmd->execute_cmd = spc_emulate_testunitready; spc_parse_cdb()
1383 cmd->execute_cmd = spc_parse_cdb()
1401 cmd->execute_cmd = spc_parse_cdb()
/linux-4.4.14/drivers/media/dvb-frontends/
H A Dsi2168.c54 struct si2168_cmd *cmd) si2168_cmd_execute_unlocked()
59 if (cmd->wlen) { si2168_cmd_execute_unlocked()
60 /* write cmd and args for firmware */ si2168_cmd_execute_unlocked()
61 ret = si2168_i2c_master_send_unlocked(client, cmd->args, si2168_cmd_execute_unlocked()
62 cmd->wlen); si2168_cmd_execute_unlocked()
65 } else if (ret != cmd->wlen) { si2168_cmd_execute_unlocked()
71 if (cmd->rlen) { si2168_cmd_execute_unlocked()
72 /* wait cmd execution terminate */ si2168_cmd_execute_unlocked()
76 ret = si2168_i2c_master_recv_unlocked(client, cmd->args, si2168_cmd_execute_unlocked()
77 cmd->rlen); si2168_cmd_execute_unlocked()
80 } else if (ret != cmd->rlen) { si2168_cmd_execute_unlocked()
86 if ((cmd->args[0] >> 7) & 0x01) si2168_cmd_execute_unlocked()
90 dev_dbg(&client->dev, "cmd execution took %d ms\n", si2168_cmd_execute_unlocked()
95 if ((cmd->args[0] >> 6) & 0x01) { si2168_cmd_execute_unlocked()
100 if (!((cmd->args[0] >> 7) & 0x01)) { si2168_cmd_execute_unlocked()
112 static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd) si2168_cmd_execute() argument
117 ret = si2168_cmd_execute_unlocked(client, cmd); si2168_cmd_execute()
129 struct si2168_cmd cmd; si2168_read_status() local
140 memcpy(cmd.args, "\xa0\x01", 2); si2168_read_status()
141 cmd.wlen = 2; si2168_read_status()
142 cmd.rlen = 13; si2168_read_status()
145 memcpy(cmd.args, "\x90\x01", 2); si2168_read_status()
146 cmd.wlen = 2; si2168_read_status()
147 cmd.rlen = 9; si2168_read_status()
150 memcpy(cmd.args, "\x50\x01", 2); si2168_read_status()
151 cmd.wlen = 2; si2168_read_status()
152 cmd.rlen = 14; si2168_read_status()
159 ret = si2168_cmd_execute(client, &cmd); si2168_read_status()
163 switch ((cmd.args[2] >> 1) & 0x03) { si2168_read_status()
178 c->cnr.stat[0].svalue = cmd.args[3] * 1000 / 4; si2168_read_status()
185 *status, cmd.rlen, cmd.args); si2168_read_status()
199 struct si2168_cmd cmd; si2168_set_frontend() local
255 memcpy(cmd.args, "\x88\x02\x02\x02\x02", 5); si2168_set_frontend()
256 cmd.wlen = 5; si2168_set_frontend()
257 cmd.rlen = 5; si2168_set_frontend()
258 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
264 memcpy(cmd.args, "\x89\x21\x06\x11\xff\x98", 6); si2168_set_frontend()
266 memcpy(cmd.args, "\x89\x21\x06\x11\x89\xf0", 6); si2168_set_frontend()
268 memcpy(cmd.args, "\x89\x21\x06\x11\x89\x20", 6); si2168_set_frontend()
269 cmd.wlen = 6; si2168_set_frontend()
270 cmd.rlen = 3; si2168_set_frontend()
271 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
277 cmd.args[0] = 0x52; si2168_set_frontend()
278 cmd.args[1] = c->stream_id & 0xff; si2168_set_frontend()
279 cmd.args[2] = c->stream_id == NO_STREAM_ID_FILTER ? 0 : 1; si2168_set_frontend()
280 cmd.wlen = 3; si2168_set_frontend()
281 cmd.rlen = 1; si2168_set_frontend()
282 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
287 memcpy(cmd.args, "\x51\x03", 2); si2168_set_frontend()
288 cmd.wlen = 2; si2168_set_frontend()
289 cmd.rlen = 12; si2168_set_frontend()
290 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
294 memcpy(cmd.args, "\x12\x08\x04", 3); si2168_set_frontend()
295 cmd.wlen = 3; si2168_set_frontend()
296 cmd.rlen = 3; si2168_set_frontend()
297 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
301 memcpy(cmd.args, "\x14\x00\x0c\x10\x12\x00", 6); si2168_set_frontend()
302 cmd.wlen = 6; si2168_set_frontend()
303 cmd.rlen = 4; si2168_set_frontend()
304 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
308 memcpy(cmd.args, "\x14\x00\x06\x10\x24\x00", 6); si2168_set_frontend()
309 cmd.wlen = 6; si2168_set_frontend()
310 cmd.rlen = 4; si2168_set_frontend()
311 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
315 memcpy(cmd.args, "\x14\x00\x07\x10\x00\x24", 6); si2168_set_frontend()
316 cmd.wlen = 6; si2168_set_frontend()
317 cmd.rlen = 4; si2168_set_frontend()
318 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
322 memcpy(cmd.args, "\x14\x00\x0a\x10\x00\x00", 6); si2168_set_frontend()
323 cmd.args[4] = delivery_system | bandwidth; si2168_set_frontend()
324 cmd.wlen = 6; si2168_set_frontend()
325 cmd.rlen = 4; si2168_set_frontend()
326 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
332 memcpy(cmd.args, "\x14\x00\x02\x11", 4); si2168_set_frontend()
333 cmd.args[4] = ((c->symbol_rate / 1000) >> 0) & 0xff; si2168_set_frontend()
334 cmd.args[5] = ((c->symbol_rate / 1000) >> 8) & 0xff; si2168_set_frontend()
335 cmd.wlen = 6; si2168_set_frontend()
336 cmd.rlen = 4; si2168_set_frontend()
337 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
342 memcpy(cmd.args, "\x14\x00\x0f\x10\x10\x00", 6); si2168_set_frontend()
343 cmd.wlen = 6; si2168_set_frontend()
344 cmd.rlen = 4; si2168_set_frontend()
345 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
349 memcpy(cmd.args, "\x14\x00\x09\x10\xe3\x08", 6); si2168_set_frontend()
350 cmd.args[5] |= dev->ts_clock_inv ? 0x00 : 0x10; si2168_set_frontend()
351 cmd.wlen = 6; si2168_set_frontend()
352 cmd.rlen = 4; si2168_set_frontend()
353 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
357 memcpy(cmd.args, "\x14\x00\x08\x10\xd7\x05", 6); si2168_set_frontend()
358 cmd.args[5] |= dev->ts_clock_inv ? 0x00 : 0x10; si2168_set_frontend()
359 cmd.wlen = 6; si2168_set_frontend()
360 cmd.rlen = 4; si2168_set_frontend()
361 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
365 memcpy(cmd.args, "\x14\x00\x01\x12\x00\x00", 6); si2168_set_frontend()
366 cmd.wlen = 6; si2168_set_frontend()
367 cmd.rlen = 4; si2168_set_frontend()
368 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
372 memcpy(cmd.args, "\x14\x00\x01\x03\x0c\x00", 6); si2168_set_frontend()
373 cmd.wlen = 6; si2168_set_frontend()
374 cmd.rlen = 4; si2168_set_frontend()
375 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
379 memcpy(cmd.args, "\x85", 1); si2168_set_frontend()
380 cmd.wlen = 1; si2168_set_frontend()
381 cmd.rlen = 1; si2168_set_frontend()
382 ret = si2168_cmd_execute(client, &cmd); si2168_set_frontend()
401 struct si2168_cmd cmd; si2168_init() local
407 memcpy(cmd.args, "\xc0\x12\x00\x0c\x00\x0d\x16\x00\x00\x00\x00\x00\x00", 13); si2168_init()
408 cmd.wlen = 13; si2168_init()
409 cmd.rlen = 0; si2168_init()
410 ret = si2168_cmd_execute(client, &cmd); si2168_init()
416 memcpy(cmd.args, "\xc0\x06\x08\x0f\x00\x20\x21\x01", 8); si2168_init()
417 cmd.wlen = 8; si2168_init()
418 cmd.rlen = 1; si2168_init()
419 ret = si2168_cmd_execute(client, &cmd); si2168_init()
423 memcpy(cmd.args, "\x85", 1); si2168_init()
424 cmd.wlen = 1; si2168_init()
425 cmd.rlen = 1; si2168_init()
426 ret = si2168_cmd_execute(client, &cmd); si2168_init()
434 memcpy(cmd.args, "\xc0\x06\x01\x0f\x00\x20\x20\x01", 8); si2168_init()
435 cmd.wlen = 8; si2168_init()
436 cmd.rlen = 1; si2168_init()
437 ret = si2168_cmd_execute(client, &cmd); si2168_init()
442 memcpy(cmd.args, "\x02", 1); si2168_init()
443 cmd.wlen = 1; si2168_init()
444 cmd.rlen = 13; si2168_init()
445 ret = si2168_cmd_execute(client, &cmd); si2168_init()
449 chip_id = cmd.args[1] << 24 | cmd.args[2] << 16 | cmd.args[3] << 8 | si2168_init()
450 cmd.args[4] << 0; si2168_init()
468 cmd.args[2], cmd.args[1], si2168_init()
469 cmd.args[3], cmd.args[4]); si2168_init()
475 cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]); si2168_init()
509 memcpy(cmd.args, &fw->data[(fw->size - remaining) + 1], len); si2168_init()
510 cmd.wlen = len; si2168_init()
511 cmd.rlen = 1; si2168_init()
512 ret = si2168_cmd_execute(client, &cmd); si2168_init()
520 memcpy(cmd.args, &fw->data[fw->size - remaining], len); si2168_init()
521 cmd.wlen = len; si2168_init()
522 cmd.rlen = 1; si2168_init()
523 ret = si2168_cmd_execute(client, &cmd); si2168_init()
539 memcpy(cmd.args, "\x01\x01", 2); si2168_init()
540 cmd.wlen = 2; si2168_init()
541 cmd.rlen = 1; si2168_init()
542 ret = si2168_cmd_execute(client, &cmd); si2168_init()
547 memcpy(cmd.args, "\x11", 1); si2168_init()
548 cmd.wlen = 1; si2168_init()
549 cmd.rlen = 10; si2168_init()
550 ret = si2168_cmd_execute(client, &cmd); si2168_init()
555 cmd.args[6], cmd.args[7], cmd.args[8]); si2168_init()
558 memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6); si2168_init()
559 cmd.args[4] |= dev->ts_mode; si2168_init()
561 cmd.args[4] |= 0x40; si2168_init()
562 cmd.wlen = 6; si2168_init()
563 cmd.rlen = 4; si2168_init()
564 ret = si2168_cmd_execute(client, &cmd); si2168_init()
586 struct si2168_cmd cmd; si2168_sleep() local
592 memcpy(cmd.args, "\x13", 1); si2168_sleep()
593 cmd.wlen = 1; si2168_sleep()
594 cmd.rlen = 0; si2168_sleep()
595 ret = si2168_cmd_execute(client, &cmd); si2168_sleep()
622 struct si2168_cmd cmd; si2168_select() local
625 memcpy(cmd.args, "\xc0\x0d\x01", 3); si2168_select()
626 cmd.wlen = 3; si2168_select()
627 cmd.rlen = 0; si2168_select()
628 ret = si2168_cmd_execute_unlocked(client, &cmd); si2168_select()
642 struct si2168_cmd cmd; si2168_deselect() local
645 memcpy(cmd.args, "\xc0\x0d\x00", 3); si2168_deselect()
646 cmd.wlen = 3; si2168_deselect()
647 cmd.rlen = 0; si2168_deselect()
648 ret = si2168_cmd_execute_unlocked(client, &cmd); si2168_deselect()
53 si2168_cmd_execute_unlocked(struct i2c_client *client, struct si2168_cmd *cmd) si2168_cmd_execute_unlocked() argument
H A Dcx24120.c70 CMD_VCO_SET = 0x10, /* cmd.len = 12; */
71 CMD_TUNEREQUEST = 0x11, /* cmd.len = 15; */
73 CMD_MPEG_ONOFF = 0x13, /* cmd.len = 4; */
74 CMD_MPEG_INIT = 0x14, /* cmd.len = 7; */
75 CMD_BANDWIDTH = 0x15, /* cmd.len = 12; */
77 CMD_CLOCK_SET = 0x17, /* cmd.len = 10; */
79 CMD_DISEQC_MSG1 = 0x20, /* cmd.len = 11; */
80 CMD_DISEQC_MSG2 = 0x21, /* cmd.len = d->msg_len + 6; */
81 CMD_SETVOLTAGE = 0x22, /* cmd.len = 2; */
82 CMD_SETTONE = 0x23, /* cmd.len = 4; */
83 CMD_DISEQC_BURST = 0x24, /* cmd.len not used !!! */
90 CMD_BER_CTRL = 0x3c, /* cmd.len = 0x03; */
381 struct cx24120_cmd *cmd) cx24120_message_send()
387 cx24120_check_cmd(state, cmd->id); cx24120_message_send()
390 cx24120_writereg(state, CX24120_REG_CMD_START, cmd->id); cx24120_message_send()
391 cx24120_writeregs(state, CX24120_REG_CMD_ARGS, &cmd->arg[0], cx24120_message_send()
392 cmd->len, 1); cx24120_message_send()
404 dev_dbg(&state->i2c->dev, "sent message 0x%02x\n", cmd->id); cx24120_message_send()
411 struct cx24120_cmd *cmd, u8 numreg) cx24120_message_sendrcv()
416 err("Too many registers to read. cmd->reg = %d", numreg); cx24120_message_sendrcv()
420 ret = cx24120_message_send(state, cmd); cx24120_message_sendrcv()
427 /* Read numreg registers starting from register cmd->len */ cx24120_message_sendrcv()
429 cmd->arg[i] = cx24120_readreg(state, (cmd->len + i + 1)); cx24120_message_sendrcv()
450 struct cx24120_cmd cmd; cx24120_msg_mpeg_output_global_config() local
453 cmd.id = CMD_MPEG_ONOFF; cx24120_msg_mpeg_output_global_config()
454 cmd.len = 4; cx24120_msg_mpeg_output_global_config()
455 cmd.arg[0] = 0x01; cx24120_msg_mpeg_output_global_config()
456 cmd.arg[1] = 0x00; cx24120_msg_mpeg_output_global_config()
457 cmd.arg[2] = enable ? 0 : (u8)(-1); cx24120_msg_mpeg_output_global_config()
458 cmd.arg[3] = 0x01; cx24120_msg_mpeg_output_global_config()
460 ret = cx24120_message_send(state, &cmd); cx24120_msg_mpeg_output_global_config()
476 struct cx24120_cmd cmd; cx24120_msg_mpeg_output_config() local
480 cmd.id = CMD_MPEG_INIT; cx24120_msg_mpeg_output_config()
481 cmd.len = 7; cx24120_msg_mpeg_output_config()
482 cmd.arg[0] = seq; /* sequental number - can be 0,1,2 */ cx24120_msg_mpeg_output_config()
483 cmd.arg[1] = ((i.x1 & 0x01) << 1) | ((i.x1 >> 1) & 0x01); cx24120_msg_mpeg_output_config()
484 cmd.arg[2] = 0x05; cx24120_msg_mpeg_output_config()
485 cmd.arg[3] = 0x02; cx24120_msg_mpeg_output_config()
486 cmd.arg[4] = ((i.x2 >> 1) & 0x01); cx24120_msg_mpeg_output_config()
487 cmd.arg[5] = (i.x2 & 0xf0) | (i.x3 & 0x0f); cx24120_msg_mpeg_output_config()
488 cmd.arg[6] = 0x10; cx24120_msg_mpeg_output_config()
490 return cx24120_message_send(state, &cmd); cx24120_msg_mpeg_output_config()
497 struct cx24120_cmd cmd; cx24120_diseqc_send_burst() local
502 * Yes, cmd.len is set to zero. The old driver cx24120_diseqc_send_burst()
504 * memset 0 before every use of the cmd struct cx24120_diseqc_send_burst()
508 cmd.id = CMD_DISEQC_BURST; cx24120_diseqc_send_burst()
509 cmd.len = 0; cx24120_diseqc_send_burst()
510 cmd.arg[0] = 0x00; cx24120_diseqc_send_burst()
511 cmd.arg[1] = (burst == SEC_MINI_B) ? 0x01 : 0x00; cx24120_diseqc_send_burst()
513 return cx24120_message_send(state, &cmd); cx24120_diseqc_send_burst()
519 struct cx24120_cmd cmd; cx24120_set_tone() local
528 cmd.id = CMD_SETTONE; cx24120_set_tone()
529 cmd.len = 4; cx24120_set_tone()
530 cmd.arg[0] = 0x00; cx24120_set_tone()
531 cmd.arg[1] = 0x00; cx24120_set_tone()
532 cmd.arg[2] = 0x00; cx24120_set_tone()
533 cmd.arg[3] = (tone == SEC_TONE_ON) ? 0x01 : 0x00; cx24120_set_tone()
535 return cx24120_message_send(state, &cmd); cx24120_set_tone()
542 struct cx24120_cmd cmd; cx24120_set_voltage() local
546 cmd.id = CMD_SETVOLTAGE; cx24120_set_voltage()
547 cmd.len = 2; cx24120_set_voltage()
548 cmd.arg[0] = 0x00; cx24120_set_voltage()
549 cmd.arg[1] = (voltage == SEC_VOLTAGE_18) ? 0x01 : 0x00; cx24120_set_voltage()
551 return cx24120_message_send(state, &cmd); cx24120_set_voltage()
558 struct cx24120_cmd cmd; cx24120_send_diseqc_msg() local
563 cmd.id = CMD_DISEQC_MSG1; cx24120_send_diseqc_msg()
564 cmd.len = 11; cx24120_send_diseqc_msg()
565 cmd.arg[0] = 0x00; cx24120_send_diseqc_msg()
566 cmd.arg[1] = 0x00; cx24120_send_diseqc_msg()
567 cmd.arg[2] = 0x03; cx24120_send_diseqc_msg()
568 cmd.arg[3] = 0x16; cx24120_send_diseqc_msg()
569 cmd.arg[4] = 0x28; cx24120_send_diseqc_msg()
570 cmd.arg[5] = 0x01; cx24120_send_diseqc_msg()
571 cmd.arg[6] = 0x01; cx24120_send_diseqc_msg()
572 cmd.arg[7] = 0x14; cx24120_send_diseqc_msg()
573 cmd.arg[8] = 0x19; cx24120_send_diseqc_msg()
574 cmd.arg[9] = 0x14; cx24120_send_diseqc_msg()
575 cmd.arg[10] = 0x1e; cx24120_send_diseqc_msg()
577 if (cx24120_message_send(state, &cmd)) { cx24120_send_diseqc_msg()
578 err("send 1st message(0x%x) failed\n", cmd.id); cx24120_send_diseqc_msg()
582 cmd.id = CMD_DISEQC_MSG2; cx24120_send_diseqc_msg()
583 cmd.len = d->msg_len + 6; cx24120_send_diseqc_msg()
584 cmd.arg[0] = 0x00; cx24120_send_diseqc_msg()
585 cmd.arg[1] = 0x01; cx24120_send_diseqc_msg()
586 cmd.arg[2] = 0x02; cx24120_send_diseqc_msg()
587 cmd.arg[3] = 0x00; cx24120_send_diseqc_msg()
588 cmd.arg[4] = 0x00; cx24120_send_diseqc_msg()
589 cmd.arg[5] = d->msg_len; cx24120_send_diseqc_msg()
591 memcpy(&cmd.arg[6], &d->msg, d->msg_len); cx24120_send_diseqc_msg()
593 if (cx24120_message_send(state, &cmd)) { cx24120_send_diseqc_msg()
594 err("send 2nd message(0x%x) failed\n", cmd.id); cx24120_send_diseqc_msg()
616 struct cx24120_cmd cmd; cx24120_get_stats() local
625 cmd.id = CMD_READ_SNR; cx24120_get_stats()
626 cmd.len = 1; cx24120_get_stats()
627 cmd.arg[0] = 0x00; cx24120_get_stats()
629 ret = cx24120_message_send(state, &cmd); cx24120_get_stats()
925 struct cx24120_cmd cmd; cx24120_set_clock_ratios() local
953 cmd.id = CMD_CLOCK_READ; cx24120_set_clock_ratios()
954 cmd.len = 1; cx24120_set_clock_ratios()
955 cmd.arg[0] = 0x00; cx24120_set_clock_ratios()
956 ret = cx24120_message_sendrcv(state, &cmd, 6); cx24120_set_clock_ratios()
959 /* in cmd[0]-[5] - result */ cx24120_set_clock_ratios()
962 cmd.arg[2] | (cmd.arg[1] << 8) | (cmd.arg[0] << 16), cx24120_set_clock_ratios()
963 cmd.arg[5] | (cmd.arg[4] << 8) | (cmd.arg[3] << 16), cx24120_set_clock_ratios()
970 cmd.id = CMD_CLOCK_SET; cx24120_set_clock_ratios()
971 cmd.len = 10; cx24120_set_clock_ratios()
972 cmd.arg[0] = 0; cx24120_set_clock_ratios()
973 cmd.arg[1] = 0x10; cx24120_set_clock_ratios()
974 cmd.arg[2] = (clock_ratios_table[idx].m_rat >> 16) & 0xff; cx24120_set_clock_ratios()
975 cmd.arg[3] = (clock_ratios_table[idx].m_rat >> 8) & 0xff; cx24120_set_clock_ratios()
976 cmd.arg[4] = (clock_ratios_table[idx].m_rat >> 0) & 0xff; cx24120_set_clock_ratios()
977 cmd.arg[5] = (clock_ratios_table[idx].n_rat >> 16) & 0xff; cx24120_set_clock_ratios()
978 cmd.arg[6] = (clock_ratios_table[idx].n_rat >> 8) & 0xff; cx24120_set_clock_ratios()
979 cmd.arg[7] = (clock_ratios_table[idx].n_rat >> 0) & 0xff; cx24120_set_clock_ratios()
980 cmd.arg[8] = (clock_ratios_table[idx].rate >> 8) & 0xff; cx24120_set_clock_ratios()
981 cmd.arg[9] = (clock_ratios_table[idx].rate >> 0) & 0xff; cx24120_set_clock_ratios()
983 cx24120_message_send(state, &cmd); cx24120_set_clock_ratios()
1143 struct cx24120_cmd cmd; cx24120_set_frontend() local
1209 cmd.id = CMD_TUNEREQUEST; cx24120_set_frontend()
1210 cmd.len = 15; cx24120_set_frontend()
1211 cmd.arg[0] = 0; cx24120_set_frontend()
1212 cmd.arg[1] = (state->dcur.frequency & 0xff0000) >> 16; cx24120_set_frontend()
1213 cmd.arg[2] = (state->dcur.frequency & 0x00ff00) >> 8; cx24120_set_frontend()
1214 cmd.arg[3] = (state->dcur.frequency & 0x0000ff); cx24120_set_frontend()
1215 cmd.arg[4] = ((state->dcur.symbol_rate / 1000) & 0xff00) >> 8; cx24120_set_frontend()
1216 cmd.arg[5] = ((state->dcur.symbol_rate / 1000) & 0x00ff); cx24120_set_frontend()
1217 cmd.arg[6] = state->dcur.inversion; cx24120_set_frontend()
1218 cmd.arg[7] = state->dcur.fec_val | state->dcur.pilot_val; cx24120_set_frontend()
1219 cmd.arg[8] = CX24120_SEARCH_RANGE_KHZ >> 8; cx24120_set_frontend()
1220 cmd.arg[9] = CX24120_SEARCH_RANGE_KHZ & 0xff; cx24120_set_frontend()
1221 cmd.arg[10] = 0; /* maybe rolloff? */ cx24120_set_frontend()
1222 cmd.arg[11] = state->dcur.fec_mask; cx24120_set_frontend()
1223 cmd.arg[12] = state->dcur.ratediv; cx24120_set_frontend()
1224 cmd.arg[13] = state->dcur.clkdiv; cx24120_set_frontend()
1225 cmd.arg[14] = 0; cx24120_set_frontend()
1228 ret = cx24120_message_send(state, &cmd); cx24120_set_frontend()
1245 struct cx24120_cmd cmd; cx24120_set_vco() local
1257 cmd.id = CMD_VCO_SET; cx24120_set_vco()
1258 cmd.len = 12; cx24120_set_vco()
1259 cmd.arg[0] = (vco >> 16) & 0xff; cx24120_set_vco()
1260 cmd.arg[1] = (vco >> 8) & 0xff; cx24120_set_vco()
1261 cmd.arg[2] = vco & 0xff; cx24120_set_vco()
1262 cmd.arg[3] = (inv_vco >> 8) & 0xff; cx24120_set_vco()
1263 cmd.arg[4] = (inv_vco) & 0xff; cx24120_set_vco()
1264 cmd.arg[5] = 0x03; cx24120_set_vco()
1265 cmd.arg[6] = (nxtal_khz >> 8) & 0xff; cx24120_set_vco()
1266 cmd.arg[7] = nxtal_khz & 0xff; cx24120_set_vco()
1267 cmd.arg[8] = 0x06; cx24120_set_vco()
1268 cmd.arg[9] = 0x03; cx24120_set_vco()
1269 cmd.arg[10] = (xtal_khz >> 16) & 0xff; cx24120_set_vco()
1270 cmd.arg[11] = xtal_khz & 0xff; cx24120_set_vco()
1272 return cx24120_message_send(state, &cmd); cx24120_set_vco()
1280 struct cx24120_cmd cmd; cx24120_init() local
1375 cmd.id = CMD_START_TUNER; cx24120_init()
1376 cmd.len = 3; cx24120_init()
1377 cmd.arg[0] = 0x00; cx24120_init()
1378 cmd.arg[1] = 0x00; cx24120_init()
1379 cmd.arg[2] = 0x00; cx24120_init()
1381 if (cx24120_message_send(state, &cmd) != 0) { cx24120_init()
1394 cmd.id = CMD_BANDWIDTH; cx24120_init()
1395 cmd.len = 12; cx24120_init()
1396 cmd.arg[0] = 0x00; cx24120_init()
1397 cmd.arg[1] = 0x00; cx24120_init()
1398 cmd.arg[2] = 0x00; cx24120_init()
1399 cmd.arg[3] = 0x00; cx24120_init()
1400 cmd.arg[4] = 0x05; cx24120_init()
1401 cmd.arg[5] = 0x02; cx24120_init()
1402 cmd.arg[6] = 0x02; cx24120_init()
1403 cmd.arg[7] = 0x00; cx24120_init()
1404 cmd.arg[8] = 0x05; cx24120_init()
1405 cmd.arg[9] = 0x02; cx24120_init()
1406 cmd.arg[10] = 0x02; cx24120_init()
1407 cmd.arg[11] = 0x00; cx24120_init()
1409 if (cx24120_message_send(state, &cmd)) { cx24120_init()
1434 cmd.id = CMD_BER_CTRL; cx24120_init()
1435 cmd.len = 3; cx24120_init()
1436 cmd.arg[0] = 0x00; cx24120_init()
1437 cmd.arg[1] = CX24120_BER_WINDOW; cx24120_init()
1438 cmd.arg[2] = CX24120_BER_WINDOW; cx24120_init()
1439 if (cx24120_message_send(state, &cmd)) { cx24120_init()
1445 cmd.id = CMD_FWVERSION; cx24120_init()
1446 cmd.len = 1; cx24120_init()
1448 cmd.arg[0] = i; cx24120_init()
1449 ret = cx24120_message_send(state, &cmd); cx24120_init()
380 cx24120_message_send(struct cx24120_state *state, struct cx24120_cmd *cmd) cx24120_message_send() argument
410 cx24120_message_sendrcv(struct cx24120_state *state, struct cx24120_cmd *cmd, u8 numreg) cx24120_message_sendrcv() argument
H A Dtda10071.c53 struct tda10071_cmd *cmd) tda10071_cmd_execute()
66 /* write cmd and args for firmware */ tda10071_cmd_execute()
67 ret = regmap_bulk_write(dev->regmap, 0x00, cmd->args, cmd->len); tda10071_cmd_execute()
71 /* start cmd execution */ tda10071_cmd_execute()
76 /* wait cmd execution terminate */ tda10071_cmd_execute()
106 struct tda10071_cmd cmd; tda10071_set_tone() local
130 cmd.args[0] = CMD_LNB_PCB_CONFIG; tda10071_set_tone()
131 cmd.args[1] = 0; tda10071_set_tone()
132 cmd.args[2] = 0x00; tda10071_set_tone()
133 cmd.args[3] = 0x00; tda10071_set_tone()
134 cmd.args[4] = tone; tda10071_set_tone()
135 cmd.len = 5; tda10071_set_tone()
136 ret = tda10071_cmd_execute(dev, &cmd); tda10071_set_tone()
151 struct tda10071_cmd cmd; tda10071_set_voltage() local
178 cmd.args[0] = CMD_LNB_SET_DC_LEVEL; tda10071_set_voltage()
179 cmd.args[1] = 0; tda10071_set_voltage()
180 cmd.args[2] = voltage; tda10071_set_voltage()
181 cmd.len = 3; tda10071_set_voltage()
182 ret = tda10071_cmd_execute(dev, &cmd); tda10071_set_voltage()
197 struct tda10071_cmd cmd; tda10071_diseqc_send_master_cmd() local
233 cmd.args[0] = CMD_LNB_SEND_DISEQC; tda10071_diseqc_send_master_cmd()
234 cmd.args[1] = 0; tda10071_diseqc_send_master_cmd()
235 cmd.args[2] = 0; tda10071_diseqc_send_master_cmd()
236 cmd.args[3] = 0; tda10071_diseqc_send_master_cmd()
237 cmd.args[4] = 2; tda10071_diseqc_send_master_cmd()
238 cmd.args[5] = 0; tda10071_diseqc_send_master_cmd()
239 cmd.args[6] = diseqc_cmd->msg_len; tda10071_diseqc_send_master_cmd()
240 memcpy(&cmd.args[7], diseqc_cmd->msg, diseqc_cmd->msg_len); tda10071_diseqc_send_master_cmd()
241 cmd.len = 7 + diseqc_cmd->msg_len; tda10071_diseqc_send_master_cmd()
242 ret = tda10071_cmd_execute(dev, &cmd); tda10071_diseqc_send_master_cmd()
257 struct tda10071_cmd cmd; tda10071_diseqc_recv_slave_reply() local
294 cmd.args[0] = CMD_LNB_UPDATE_REPLY; tda10071_diseqc_recv_slave_reply()
295 cmd.args[1] = 0; tda10071_diseqc_recv_slave_reply()
296 cmd.len = 2; tda10071_diseqc_recv_slave_reply()
297 ret = tda10071_cmd_execute(dev, &cmd); tda10071_diseqc_recv_slave_reply()
301 ret = regmap_bulk_read(dev->regmap, cmd.len, reply->msg, tda10071_diseqc_recv_slave_reply()
317 struct tda10071_cmd cmd; tda10071_diseqc_send_burst() local
362 cmd.args[0] = CMD_LNB_SEND_TONEBURST; tda10071_diseqc_send_burst()
363 cmd.args[1] = 0; tda10071_diseqc_send_burst()
364 cmd.args[2] = burst; tda10071_diseqc_send_burst()
365 cmd.len = 3; tda10071_diseqc_send_burst()
366 ret = tda10071_cmd_execute(dev, &cmd); tda10071_diseqc_send_burst()
381 struct tda10071_cmd cmd; tda10071_read_status() local
409 cmd.args[0] = CMD_GET_AGCACC; tda10071_read_status()
410 cmd.args[1] = 0; tda10071_read_status()
411 cmd.len = 2; tda10071_read_status()
412 ret = tda10071_cmd_execute(dev, &cmd); tda10071_read_status()
473 cmd.args[0] = CMD_BER_UPDATE_COUNTERS; tda10071_read_status()
474 cmd.args[1] = 0; tda10071_read_status()
475 cmd.args[2] = delivery_system; tda10071_read_status()
476 cmd.len = 3; tda10071_read_status()
477 ret = tda10071_cmd_execute(dev, &cmd); tda10071_read_status()
481 ret = regmap_bulk_read(dev->regmap, cmd.len, buf, len); tda10071_read_status()
563 struct tda10071_cmd cmd; tda10071_set_frontend() local
676 cmd.args[0] = CMD_CHANGE_CHANNEL; tda10071_set_frontend()
677 cmd.args[1] = 0; tda10071_set_frontend()
678 cmd.args[2] = mode; tda10071_set_frontend()
679 cmd.args[3] = (c->frequency >> 16) & 0xff; tda10071_set_frontend()
680 cmd.args[4] = (c->frequency >> 8) & 0xff; tda10071_set_frontend()
681 cmd.args[5] = (c->frequency >> 0) & 0xff; tda10071_set_frontend()
682 cmd.args[6] = ((c->symbol_rate / 1000) >> 8) & 0xff; tda10071_set_frontend()
683 cmd.args[7] = ((c->symbol_rate / 1000) >> 0) & 0xff; tda10071_set_frontend()
684 cmd.args[8] = (tda10071_ops.info.frequency_tolerance >> 8) & 0xff; tda10071_set_frontend()
685 cmd.args[9] = (tda10071_ops.info.frequency_tolerance >> 0) & 0xff; tda10071_set_frontend()
686 cmd.args[10] = rolloff; tda10071_set_frontend()
687 cmd.args[11] = inversion; tda10071_set_frontend()
688 cmd.args[12] = pilot; tda10071_set_frontend()
689 cmd.args[13] = 0x00; tda10071_set_frontend()
690 cmd.args[14] = 0x00; tda10071_set_frontend()
691 cmd.len = 15; tda10071_set_frontend()
692 ret = tda10071_cmd_execute(dev, &cmd); tda10071_set_frontend()
767 struct tda10071_cmd cmd; tda10071_init() local
841 cmd.args[0] = CMD_SET_SLEEP_MODE; tda10071_init()
842 cmd.args[1] = 0; tda10071_init()
843 cmd.args[2] = 0; tda10071_init()
844 cmd.len = 3; tda10071_init()
845 ret = tda10071_cmd_execute(dev, &cmd); tda10071_init()
934 cmd.args[0] = CMD_GET_FW_VERSION; tda10071_init()
935 cmd.len = 1; tda10071_init()
936 ret = tda10071_cmd_execute(dev, &cmd); tda10071_init()
940 ret = regmap_bulk_read(dev->regmap, cmd.len, buf, 4); tda10071_init()
953 cmd.args[0] = CMD_DEMOD_INIT; tda10071_init()
954 cmd.args[1] = ((dev->clk / 1000) >> 8) & 0xff; tda10071_init()
955 cmd.args[2] = ((dev->clk / 1000) >> 0) & 0xff; tda10071_init()
956 cmd.args[3] = buf[0]; tda10071_init()
957 cmd.args[4] = buf[1]; tda10071_init()
958 cmd.args[5] = dev->pll_multiplier; tda10071_init()
959 cmd.args[6] = dev->spec_inv; tda10071_init()
960 cmd.args[7] = 0x00; tda10071_init()
961 cmd.len = 8; tda10071_init()
962 ret = tda10071_cmd_execute(dev, &cmd); tda10071_init()
971 cmd.args[0] = CMD_TUNER_INIT; tda10071_init()
972 cmd.args[1] = 0x00; tda10071_init()
973 cmd.args[2] = 0x00; tda10071_init()
974 cmd.args[3] = 0x00; tda10071_init()
975 cmd.args[4] = 0x00; tda10071_init()
976 cmd.args[5] = tmp; tda10071_init()
977 cmd.args[6] = 0x00; tda10071_init()
978 cmd.args[7] = 0x03; tda10071_init()
979 cmd.args[8] = 0x02; tda10071_init()
980 cmd.args[9] = 0x02; tda10071_init()
981 cmd.args[10] = 0x00; tda10071_init()
982 cmd.args[11] = 0x00; tda10071_init()
983 cmd.args[12] = 0x00; tda10071_init()
984 cmd.args[13] = 0x00; tda10071_init()
985 cmd.args[14] = 0x00; tda10071_init()
986 cmd.len = 15; tda10071_init()
987 ret = tda10071_cmd_execute(dev, &cmd); tda10071_init()
991 cmd.args[0] = CMD_MPEG_CONFIG; tda10071_init()
992 cmd.args[1] = 0; tda10071_init()
993 cmd.args[2] = dev->ts_mode; tda10071_init()
994 cmd.args[3] = 0x00; tda10071_init()
995 cmd.args[4] = 0x04; tda10071_init()
996 cmd.args[5] = 0x00; tda10071_init()
997 cmd.len = 6; tda10071_init()
998 ret = tda10071_cmd_execute(dev, &cmd); tda10071_init()
1006 cmd.args[0] = CMD_LNB_CONFIG; tda10071_init()
1007 cmd.args[1] = 0; tda10071_init()
1008 cmd.args[2] = 150; tda10071_init()
1009 cmd.args[3] = 3; tda10071_init()
1010 cmd.args[4] = 22; tda10071_init()
1011 cmd.args[5] = 1; tda10071_init()
1012 cmd.args[6] = 1; tda10071_init()
1013 cmd.args[7] = 30; tda10071_init()
1014 cmd.args[8] = 30; tda10071_init()
1015 cmd.args[9] = 30; tda10071_init()
1016 cmd.args[10] = 30; tda10071_init()
1017 cmd.len = 11; tda10071_init()
1018 ret = tda10071_cmd_execute(dev, &cmd); tda10071_init()
1022 cmd.args[0] = CMD_BER_CONTROL; tda10071_init()
1023 cmd.args[1] = 0; tda10071_init()
1024 cmd.args[2] = 14; tda10071_init()
1025 cmd.args[3] = 14; tda10071_init()
1026 cmd.len = 4; tda10071_init()
1027 ret = tda10071_cmd_execute(dev, &cmd); tda10071_init()
1054 struct tda10071_cmd cmd; tda10071_sleep() local
1074 cmd.args[0] = CMD_SET_SLEEP_MODE; tda10071_sleep()
1075 cmd.args[1] = 0; tda10071_sleep()
1076 cmd.args[2] = 1; tda10071_sleep()
1077 cmd.len = 3; tda10071_sleep()
1078 ret = tda10071_cmd_execute(dev, &cmd); tda10071_sleep()
52 tda10071_cmd_execute(struct tda10071_dev *dev, struct tda10071_cmd *cmd) tda10071_cmd_execute() argument
H A Dcx24117.c291 struct cx24117_cmd *cmd) cx24117_writecmd()
298 "%s() demod%d i2c wr cmd len=%d\n", cx24117_writecmd()
299 __func__, state->demod, cmd->len); cx24117_writecmd()
302 memcpy(&buf[1], cmd->args, cmd->len); cx24117_writecmd()
306 msg.len = cmd->len+1; cx24117_writecmd()
311 "%s: demod%d i2c wr cmd err(%i) len=%d\n", cx24117_writecmd()
312 KBUILD_MODNAME, state->demod, ret, cmd->len); cx24117_writecmd()
507 struct cx24117_cmd *cmd) cx24117_cmd_execute_nolock()
521 cx24117_writecmd(state, cmd); cx24117_cmd_execute_nolock()
523 /* Start execution and wait for cmd to terminate */ cx24117_cmd_execute_nolock()
539 static int cx24117_cmd_execute(struct dvb_frontend *fe, struct cx24117_cmd *cmd) cx24117_cmd_execute() argument
545 ret = cx24117_cmd_execute_nolock(fe, cmd); cx24117_cmd_execute()
555 struct cx24117_cmd cmd; cx24117_load_firmware() local
643 cmd.args[0] = CMD_DEMODINIT; cx24117_load_firmware()
644 cmd.args[1] = 0x00; cx24117_load_firmware()
645 cmd.args[2] = 0x01; cx24117_load_firmware()
646 cmd.args[3] = 0x00; cx24117_load_firmware()
647 cmd.len = 4; cx24117_load_firmware()
648 ret = cx24117_cmd_execute_nolock(fe, &cmd); cx24117_load_firmware()
653 cmd.args[0] = CMD_SET_VCOFREQ; cx24117_load_firmware()
654 cmd.args[1] = 0x06; cx24117_load_firmware()
655 cmd.args[2] = 0x2b; cx24117_load_firmware()
656 cmd.args[3] = 0xd8; cx24117_load_firmware()
657 cmd.args[4] = 0xa5; cx24117_load_firmware()
658 cmd.args[5] = 0xee; cx24117_load_firmware()
659 cmd.args[6] = 0x03; cx24117_load_firmware()
660 cmd.args[7] = 0x9d; cx24117_load_firmware()
661 cmd.args[8] = 0xfc; cx24117_load_firmware()
662 cmd.args[9] = 0x06; cx24117_load_firmware()
663 cmd.args[10] = 0x02; cx24117_load_firmware()
664 cmd.args[11] = 0x9d; cx24117_load_firmware()
665 cmd.args[12] = 0xfc; cx24117_load_firmware()
666 cmd.len = 13; cx24117_load_firmware()
667 ret = cx24117_cmd_execute_nolock(fe, &cmd); cx24117_load_firmware()
672 cmd.args[0] = CMD_TUNERINIT; cx24117_load_firmware()
673 cmd.args[1] = 0x00; cx24117_load_firmware()
674 cmd.args[2] = 0x01; cx24117_load_firmware()
675 cmd.args[3] = 0x00; cx24117_load_firmware()
676 cmd.args[4] = 0x00; cx24117_load_firmware()
677 cmd.args[5] = 0x01; cx24117_load_firmware()
678 cmd.args[6] = 0x01; cx24117_load_firmware()
679 cmd.args[7] = 0x01; cx24117_load_firmware()
680 cmd.args[8] = 0x00; cx24117_load_firmware()
681 cmd.args[9] = 0x05; cx24117_load_firmware()
682 cmd.args[10] = 0x02; cx24117_load_firmware()
683 cmd.args[11] = 0x02; cx24117_load_firmware()
684 cmd.args[12] = 0x00; cx24117_load_firmware()
685 cmd.len = 13; cx24117_load_firmware()
686 ret = cx24117_cmd_execute_nolock(fe, &cmd); cx24117_load_firmware()
691 cmd.args[0] = CMD_GLOBAL_MPEGCFG; cx24117_load_firmware()
692 cmd.args[1] = 0x00; cx24117_load_firmware()
693 cmd.args[2] = 0x00; cx24117_load_firmware()
694 cmd.args[3] = 0x00; cx24117_load_firmware()
695 cmd.args[4] = 0x01; cx24117_load_firmware()
696 cmd.args[5] = 0x00; cx24117_load_firmware()
697 cmd.len = 6; cx24117_load_firmware()
698 ret = cx24117_cmd_execute_nolock(fe, &cmd); cx24117_load_firmware()
704 cmd.args[0] = CMD_MPEGCFG; cx24117_load_firmware()
705 cmd.args[1] = (u8) i; cx24117_load_firmware()
706 cmd.args[2] = 0x00; cx24117_load_firmware()
707 cmd.args[3] = 0x05; cx24117_load_firmware()
708 cmd.args[4] = 0x00; cx24117_load_firmware()
709 cmd.args[5] = 0x00; cx24117_load_firmware()
710 cmd.args[6] = 0x55; cx24117_load_firmware()
711 cmd.args[7] = 0x00; cx24117_load_firmware()
712 cmd.len = 8; cx24117_load_firmware()
713 ret = cx24117_cmd_execute_nolock(fe, &cmd); cx24117_load_firmware()
723 cmd.args[0] = CMD_FWVERSION; cx24117_load_firmware()
724 cmd.len = 2; cx24117_load_firmware()
726 cmd.args[1] = i; cx24117_load_firmware()
727 ret = cx24117_cmd_execute_nolock(fe, &cmd); cx24117_load_firmware()
795 struct cx24117_cmd cmd; cx24117_read_signal_strength() local
803 cmd.args[0] = CMD_GET_AGCACC; cx24117_read_signal_strength()
804 cmd.args[1] = (u8) state->demod; cx24117_read_signal_strength()
805 cmd.len = 2; cx24117_read_signal_strength()
806 ret = cx24117_cmd_execute(fe, &cmd); cx24117_read_signal_strength()
912 struct cx24117_cmd cmd; cx24117_set_voltage() local
923 cmd.args[0] = CMD_SET_GPIOOUT; cx24117_set_voltage()
924 cmd.args[2] = reg; /* mask */ cx24117_set_voltage()
925 cmd.len = 3; cx24117_set_voltage()
930 cmd.args[1] = reg; cx24117_set_voltage()
931 ret = cx24117_cmd_execute(fe, &cmd); cx24117_set_voltage()
943 cmd.args[0] = CMD_LNBDCLEVEL; cx24117_set_voltage()
944 cmd.args[1] = state->demod ? 0 : 1; cx24117_set_voltage()
945 cmd.args[2] = (voltage == SEC_VOLTAGE_18 ? 0x01 : 0x00); cx24117_set_voltage()
946 cmd.len = 3; cx24117_set_voltage()
947 ret = cx24117_cmd_execute(fe, &cmd); cx24117_set_voltage()
953 cmd.args[1] = 0x00; cx24117_set_voltage()
954 ret = cx24117_cmd_execute(fe, &cmd); cx24117_set_voltage()
964 struct cx24117_cmd cmd; cx24117_set_tone() local
984 cmd.args[0] = CMD_LNBPCBCONFIG; cx24117_set_tone()
985 cmd.args[1] = (state->demod ? 0 : 1); cx24117_set_tone()
986 cmd.args[2] = 0x00; cx24117_set_tone()
987 cmd.args[3] = 0x00; cx24117_set_tone()
988 cmd.len = 5; cx24117_set_tone()
991 cmd.args[4] = 0x01; cx24117_set_tone()
994 cmd.args[4] = 0x00; cx24117_set_tone()
1000 return cx24117_cmd_execute(fe, &cmd); cx24117_set_tone()
1230 struct cx24117_cmd cmd; cx24117_initfe() local
1239 cmd.args[0] = CMD_SET_SLEEPMODE; cx24117_initfe()
1240 cmd.args[1] = (state->demod ? 1 : 0); cx24117_initfe()
1241 cmd.args[2] = 0; cx24117_initfe()
1242 cmd.len = 3; cx24117_initfe()
1243 ret = cx24117_cmd_execute_nolock(fe, &cmd); cx24117_initfe()
1252 cmd.args[0] = CMD_BERCTRL; cx24117_initfe()
1253 cmd.args[1] = (state->demod ? 1 : 0); cx24117_initfe()
1254 cmd.args[2] = 0x10; cx24117_initfe()
1255 cmd.args[3] = 0x10; cx24117_initfe()
1256 cmd.len = 4; cx24117_initfe()
1257 ret = cx24117_cmd_execute_nolock(fe, &cmd); cx24117_initfe()
1262 cmd.args[0] = CMD_ENABLERSCORR; cx24117_initfe()
1263 cmd.args[1] = (state->demod ? 1 : 0); cx24117_initfe()
1264 cmd.args[2] = CX24117_OCC; cx24117_initfe()
1265 cmd.len = 3; cx24117_initfe()
1266 ret = cx24117_cmd_execute_nolock(fe, &cmd); cx24117_initfe()
1272 cmd.args[0] = CMD_SET_GPIODIR; cx24117_initfe()
1273 cmd.args[1] = 0x30; cx24117_initfe()
1274 cmd.args[2] = 0x30; cx24117_initfe()
1275 cmd.len = 3; cx24117_initfe()
1276 ret = cx24117_cmd_execute_nolock(fe, &cmd); cx24117_initfe()
1290 struct cx24117_cmd cmd; cx24117_sleep() local
1296 cmd.args[0] = CMD_SET_SLEEPMODE; cx24117_sleep()
1297 cmd.args[1] = (state->demod ? 1 : 0); cx24117_sleep()
1298 cmd.args[2] = 1; cx24117_sleep()
1299 cmd.len = 3; cx24117_sleep()
1300 return cx24117_cmd_execute(fe, &cmd); cx24117_sleep()
1310 struct cx24117_cmd cmd; cx24117_set_frontend() local
1446 cmd.args[0] = CMD_TUNEREQUEST; cx24117_set_frontend()
1449 cmd.args[1] = state->demod; cx24117_set_frontend()
1452 cmd.args[2] = (state->dcur.frequency & 0xff0000) >> 16; cx24117_set_frontend()
1453 cmd.args[3] = (state->dcur.frequency & 0x00ff00) >> 8; cx24117_set_frontend()
1454 cmd.args[4] = (state->dcur.frequency & 0x0000ff); cx24117_set_frontend()
1457 cmd.args[5] = ((state->dcur.symbol_rate / 1000) & 0xff00) >> 8; cx24117_set_frontend()
1458 cmd.args[6] = ((state->dcur.symbol_rate / 1000) & 0x00ff); cx24117_set_frontend()
1461 cmd.args[7] = state->dcur.inversion_val; cx24117_set_frontend()
1464 cmd.args[8] = state->dcur.fec_val | state->dcur.pilot_val; cx24117_set_frontend()
1466 cmd.args[9] = CX24117_SEARCH_RANGE_KHZ >> 8; cx24117_set_frontend()
1467 cmd.args[10] = CX24117_SEARCH_RANGE_KHZ & 0xff; cx24117_set_frontend()
1469 cmd.args[11] = state->dcur.rolloff_val; cx24117_set_frontend()
1470 cmd.args[12] = state->dcur.fec_mask; cx24117_set_frontend()
1483 cmd.args[13] = reg_ratediv; cx24117_set_frontend()
1484 cmd.args[14] = reg_clkdiv; cx24117_set_frontend()
1491 cmd.args[15] = CX24117_PNE; cx24117_set_frontend()
1492 cmd.len = 16; cx24117_set_frontend()
1508 ret = cx24117_cmd_execute(fe, &cmd); cx24117_set_frontend()
1535 cmd.args[11]--; cx24117_set_frontend()
1567 struct cx24117_cmd cmd; cx24117_get_frontend() local
1576 cmd.args[0] = CMD_GETCTLACC; cx24117_get_frontend()
1577 cmd.args[1] = (u8) state->demod; cx24117_get_frontend()
1578 cmd.len = 2; cx24117_get_frontend()
1579 ret = cx24117_cmd_execute(fe, &cmd); cx24117_get_frontend()
290 cx24117_writecmd(struct cx24117_state *state, struct cx24117_cmd *cmd) cx24117_writecmd() argument
506 cx24117_cmd_execute_nolock(struct dvb_frontend *fe, struct cx24117_cmd *cmd) cx24117_cmd_execute_nolock() argument
H A Dcx24116.c530 static int cx24116_cmd_execute(struct dvb_frontend *fe, struct cx24116_cmd *cmd) cx24116_cmd_execute() argument
546 for (i = 0; i < cmd->len ; i++) { cx24116_cmd_execute()
547 dprintk("%s: 0x%02x == 0x%02x\n", __func__, i, cmd->args[i]); cx24116_cmd_execute()
548 cx24116_writereg(state, i, cmd->args[i]); cx24116_cmd_execute()
551 /* Start execution and wait for cmd to terminate */ cx24116_cmd_execute()
570 struct cx24116_cmd cmd; cx24116_load_firmware() local
629 cmd.args[0x00] = CMD_SET_VCO; cx24116_load_firmware()
630 cmd.args[0x01] = 0x05; cx24116_load_firmware()
631 cmd.args[0x02] = 0xdc; cx24116_load_firmware()
632 cmd.args[0x03] = 0xda; cx24116_load_firmware()
633 cmd.args[0x04] = 0xae; cx24116_load_firmware()
634 cmd.args[0x05] = 0xaa; cx24116_load_firmware()
635 cmd.args[0x06] = 0x04; cx24116_load_firmware()
636 cmd.args[0x07] = 0x9d; cx24116_load_firmware()
637 cmd.args[0x08] = 0xfc; cx24116_load_firmware()
638 cmd.args[0x09] = 0x06; cx24116_load_firmware()
639 cmd.len = 0x0a; cx24116_load_firmware()
640 ret = cx24116_cmd_execute(fe, &cmd); cx24116_load_firmware()
647 cmd.args[0x00] = CMD_TUNERINIT; cx24116_load_firmware()
648 cmd.args[0x01] = 0x00; cx24116_load_firmware()
649 cmd.args[0x02] = 0x00; cx24116_load_firmware()
650 cmd.len = 0x03; cx24116_load_firmware()
651 ret = cx24116_cmd_execute(fe, &cmd); cx24116_load_firmware()
658 cmd.args[0x00] = CMD_MPEGCONFIG; cx24116_load_firmware()
659 cmd.args[0x01] = 0x01; cx24116_load_firmware()
660 cmd.args[0x02] = 0x75; cx24116_load_firmware()
661 cmd.args[0x03] = 0x00; cx24116_load_firmware()
663 cmd.args[0x04] = state->config->mpg_clk_pos_pol; cx24116_load_firmware()
665 cmd.args[0x04] = 0x02; cx24116_load_firmware()
666 cmd.args[0x05] = 0x00; cx24116_load_firmware()
667 cmd.len = 0x06; cx24116_load_firmware()
668 ret = cx24116_cmd_execute(fe, &cmd); cx24116_load_firmware()
673 cmd.args[0x00] = CMD_UPDFWVERS; cx24116_load_firmware()
674 cmd.len = 0x02; cx24116_load_firmware()
676 cmd.args[0x01] = i; cx24116_load_firmware()
677 ret = cx24116_cmd_execute(fe, &cmd); cx24116_load_firmware()
730 struct cx24116_cmd cmd; cx24116_read_signal_strength() local
737 cmd.args[0x00] = CMD_GETAGC; cx24116_read_signal_strength()
738 cmd.len = 0x01; cx24116_read_signal_strength()
739 ret = cx24116_cmd_execute(fe, &cmd); cx24116_read_signal_strength()
851 struct cx24116_cmd cmd; cx24116_set_voltage() local
866 cmd.args[0x00] = CMD_LNBDCLEVEL; cx24116_set_voltage()
867 cmd.args[0x01] = (voltage == SEC_VOLTAGE_18 ? 0x01 : 0x00); cx24116_set_voltage()
868 cmd.len = 0x02; cx24116_set_voltage()
873 return cx24116_cmd_execute(fe, &cmd); cx24116_set_voltage()
879 struct cx24116_cmd cmd; cx24116_set_tone() local
897 cmd.args[0x00] = CMD_SET_TONE; cx24116_set_tone()
898 cmd.args[0x01] = 0x00; cx24116_set_tone()
899 cmd.args[0x02] = 0x00; cx24116_set_tone()
904 cmd.args[0x03] = 0x01; cx24116_set_tone()
908 cmd.args[0x03] = 0x00; cx24116_set_tone()
911 cmd.len = 0x04; cx24116_set_tone()
916 return cx24116_cmd_execute(fe, &cmd); cx24116_set_tone()
923 struct cx24116_cmd cmd; cx24116_diseqc_init() local
927 cmd.args[0x00] = CMD_LNBCONFIG; cx24116_diseqc_init()
928 cmd.args[0x01] = 0x00; cx24116_diseqc_init()
929 cmd.args[0x02] = 0x10; cx24116_diseqc_init()
930 cmd.args[0x03] = 0x00; cx24116_diseqc_init()
931 cmd.args[0x04] = 0x8f; cx24116_diseqc_init()
932 cmd.args[0x05] = 0x28; cx24116_diseqc_init()
933 cmd.args[0x06] = (toneburst == CX24116_DISEQC_TONEOFF) ? 0x00 : 0x01; cx24116_diseqc_init()
934 cmd.args[0x07] = 0x01; cx24116_diseqc_init()
935 cmd.len = 0x08; cx24116_diseqc_init()
936 ret = cx24116_cmd_execute(fe, &cmd); cx24116_diseqc_init()
1164 struct cx24116_cmd cmd; cx24116_initfe() local
1175 cmd.args[0x00] = CMD_TUNERSLEEP; cx24116_initfe()
1176 cmd.args[0x01] = 0; cx24116_initfe()
1177 cmd.len = 0x02; cx24116_initfe()
1178 ret = cx24116_cmd_execute(fe, &cmd); cx24116_initfe()
1196 struct cx24116_cmd cmd; cx24116_sleep() local
1202 cmd.args[0x00] = CMD_TUNERSLEEP; cx24116_sleep()
1203 cmd.args[0x01] = 1; cx24116_sleep()
1204 cmd.len = 0x02; cx24116_sleep()
1205 ret = cx24116_cmd_execute(fe, &cmd); cx24116_sleep()
1224 struct cx24116_cmd cmd; cx24116_set_frontend() local
1348 cmd.args[0x00] = CMD_BANDWIDTH; cx24116_set_frontend()
1349 cmd.args[0x01] = 0x01; cx24116_set_frontend()
1350 cmd.len = 0x02; cx24116_set_frontend()
1351 ret = cx24116_cmd_execute(fe, &cmd); cx24116_set_frontend()
1356 cmd.args[0x00] = CMD_TUNEREQUEST; cx24116_set_frontend()
1359 cmd.args[0x01] = (state->dcur.frequency & 0xff0000) >> 16; cx24116_set_frontend()
1360 cmd.args[0x02] = (state->dcur.frequency & 0x00ff00) >> 8; cx24116_set_frontend()
1361 cmd.args[0x03] = (state->dcur.frequency & 0x0000ff); cx24116_set_frontend()
1364 cmd.args[0x04] = ((state->dcur.symbol_rate / 1000) & 0xff00) >> 8; cx24116_set_frontend()
1365 cmd.args[0x05] = ((state->dcur.symbol_rate / 1000) & 0x00ff); cx24116_set_frontend()
1368 cmd.args[0x06] = state->dcur.inversion_val; cx24116_set_frontend()
1371 cmd.args[0x07] = state->dcur.fec_val | state->dcur.pilot_val; cx24116_set_frontend()
1373 cmd.args[0x08] = CX24116_SEARCH_RANGE_KHZ >> 8; cx24116_set_frontend()
1374 cmd.args[0x09] = CX24116_SEARCH_RANGE_KHZ & 0xff; cx24116_set_frontend()
1375 cmd.args[0x0a] = 0x00; cx24116_set_frontend()
1376 cmd.args[0x0b] = 0x00; cx24116_set_frontend()
1377 cmd.args[0x0c] = state->dcur.rolloff_val; cx24116_set_frontend()
1378 cmd.args[0x0d] = state->dcur.fec_mask; cx24116_set_frontend()
1381 cmd.args[0x0e] = 0x04; cx24116_set_frontend()
1382 cmd.args[0x0f] = 0x00; cx24116_set_frontend()
1383 cmd.args[0x10] = 0x01; cx24116_set_frontend()
1384 cmd.args[0x11] = 0x77; cx24116_set_frontend()
1385 cmd.args[0x12] = 0x36; cx24116_set_frontend()
1389 cmd.args[0x0e] = 0x06; cx24116_set_frontend()
1390 cmd.args[0x0f] = 0x00; cx24116_set_frontend()
1391 cmd.args[0x10] = 0x00; cx24116_set_frontend()
1392 cmd.args[0x11] = 0xFA; cx24116_set_frontend()
1393 cmd.args[0x12] = 0x24; cx24116_set_frontend()
1398 cmd.len = 0x13; cx24116_set_frontend()
1411 ret = cx24116_cmd_execute(fe, &cmd); cx24116_set_frontend()
1435 cmd.args[0x07] ^= CX24116_PILOT_ON; cx24116_set_frontend()
1439 cmd.args[0x00] = CMD_BANDWIDTH; cx24116_set_frontend()
1440 cmd.args[0x01] = 0x00; cx24116_set_frontend()
1441 cmd.len = 0x02; cx24116_set_frontend()
1442 return cx24116_cmd_execute(fe, &cmd); cx24116_set_frontend()
/linux-4.4.14/drivers/target/iscsi/
H A Discsi_target_seq_pdu_list.c31 static void iscsit_dump_seq_list(struct iscsi_cmd *cmd) iscsit_dump_seq_list() argument
37 cmd->init_task_tag); iscsit_dump_seq_list()
39 for (i = 0; i < cmd->seq_count; i++) { iscsit_dump_seq_list()
40 seq = &cmd->seq_list[i]; iscsit_dump_seq_list()
49 static void iscsit_dump_pdu_list(struct iscsi_cmd *cmd) iscsit_dump_pdu_list() argument
55 cmd->init_task_tag); iscsit_dump_pdu_list()
57 for (i = 0; i < cmd->pdu_count; i++) { iscsit_dump_pdu_list()
58 pdu = &cmd->pdu_list[i]; iscsit_dump_pdu_list()
65 static void iscsit_dump_seq_list(struct iscsi_cmd *cmd) {} iscsit_dump_pdu_list() argument
66 static void iscsit_dump_pdu_list(struct iscsi_cmd *cmd) {} iscsit_dump_pdu_list() argument
70 struct iscsi_cmd *cmd, iscsit_ordered_seq_lists()
75 for (i = 0; i < cmd->seq_count; i++) { iscsit_ordered_seq_lists()
76 if (cmd->seq_list[i].type != SEQTYPE_NORMAL) iscsit_ordered_seq_lists()
78 cmd->seq_list[i].seq_send_order = seq_count++; iscsit_ordered_seq_lists()
83 struct iscsi_cmd *cmd, iscsit_ordered_pdu_lists()
88 for (i = 0; i < cmd->pdu_count; i++) { iscsit_ordered_pdu_lists()
90 if (cmd->pdu_list[i].seq_no == seq_no) { iscsit_ordered_pdu_lists()
91 cmd->pdu_list[i].pdu_send_order = pdu_send_order++; iscsit_ordered_pdu_lists()
130 struct iscsi_cmd *cmd, iscsit_randomize_pdu_lists()
136 for (pdu_count = 0; pdu_count < cmd->pdu_count; pdu_count++) { iscsit_randomize_pdu_lists()
138 if (cmd->pdu_list[pdu_count].seq_no == seq_no) { iscsit_randomize_pdu_lists()
151 cmd->pdu_list[seq_offset+i].pdu_send_order = array[i]; iscsit_randomize_pdu_lists()
171 cmd->pdu_list[seq_offset+i].pdu_send_order = array[i]; iscsit_randomize_pdu_lists()
180 struct iscsi_cmd *cmd, iscsit_randomize_seq_lists()
184 u32 *array, seq_count = cmd->seq_count; iscsit_randomize_seq_lists()
201 for (i = 0; i < cmd->seq_count; i++) { iscsit_randomize_seq_lists()
202 if (cmd->seq_list[i].type != SEQTYPE_NORMAL) iscsit_randomize_seq_lists()
204 cmd->seq_list[i].seq_send_order = array[j++]; iscsit_randomize_seq_lists()
212 struct iscsi_cmd *cmd, iscsit_determine_counts_for_list()
221 struct iscsi_conn *conn = cmd->conn; iscsit_determine_counts_for_list()
223 if (cmd->se_cmd.data_direction == DMA_TO_DEVICE) iscsit_determine_counts_for_list()
224 mdsl = cmd->conn->conn_ops->MaxXmitDataSegmentLength; iscsit_determine_counts_for_list()
226 mdsl = cmd->conn->conn_ops->MaxRecvDataSegmentLength; iscsit_determine_counts_for_list()
234 unsolicited_data_length = min(cmd->se_cmd.data_length, iscsit_determine_counts_for_list()
237 while (offset < cmd->se_cmd.data_length) { iscsit_determine_counts_for_list()
250 if ((offset + mdsl) >= cmd->se_cmd.data_length) { iscsit_determine_counts_for_list()
252 (cmd->se_cmd.data_length - offset); iscsit_determine_counts_for_list()
253 offset += (cmd->se_cmd.data_length - offset); iscsit_determine_counts_for_list()
272 if ((offset + mdsl) >= cmd->se_cmd.data_length) { iscsit_determine_counts_for_list()
273 offset += (cmd->se_cmd.data_length - offset); iscsit_determine_counts_for_list()
296 struct iscsi_cmd *cmd, iscsit_do_build_pdu_and_seq_lists()
302 struct iscsi_conn *conn = cmd->conn; iscsit_do_build_pdu_and_seq_lists()
303 struct iscsi_pdu *pdu = cmd->pdu_list; iscsit_do_build_pdu_and_seq_lists()
304 struct iscsi_seq *seq = cmd->seq_list; iscsit_do_build_pdu_and_seq_lists()
306 if (cmd->se_cmd.data_direction == DMA_TO_DEVICE) iscsit_do_build_pdu_and_seq_lists()
307 mdsl = cmd->conn->conn_ops->MaxXmitDataSegmentLength; iscsit_do_build_pdu_and_seq_lists()
309 mdsl = cmd->conn->conn_ops->MaxRecvDataSegmentLength; iscsit_do_build_pdu_and_seq_lists()
320 unsolicited_data_length = min(cmd->se_cmd.data_length, iscsit_do_build_pdu_and_seq_lists()
323 while (offset < cmd->se_cmd.data_length) { iscsit_do_build_pdu_and_seq_lists()
357 if ((offset + mdsl) >= cmd->se_cmd.data_length) { iscsit_do_build_pdu_and_seq_lists()
361 (cmd->se_cmd.data_length - offset); iscsit_do_build_pdu_and_seq_lists()
367 (cmd->se_cmd.data_length - offset)); iscsit_do_build_pdu_and_seq_lists()
370 (cmd->se_cmd.data_length - offset); iscsit_do_build_pdu_and_seq_lists()
371 offset += (cmd->se_cmd.data_length - offset); iscsit_do_build_pdu_and_seq_lists()
409 if ((offset + mdsl) >= cmd->se_cmd.data_length) { iscsit_do_build_pdu_and_seq_lists()
412 pdu[i].length = (cmd->se_cmd.data_length - offset); iscsit_do_build_pdu_and_seq_lists()
418 (cmd->se_cmd.data_length - offset)); iscsit_do_build_pdu_and_seq_lists()
420 offset += (cmd->se_cmd.data_length - offset); iscsit_do_build_pdu_and_seq_lists()
457 if (iscsit_randomize_seq_lists(cmd, bl->type) iscsit_do_build_pdu_and_seq_lists()
461 iscsit_ordered_seq_lists(cmd, bl->type); iscsit_do_build_pdu_and_seq_lists()
464 if (iscsit_randomize_seq_lists(cmd, bl->type) iscsit_do_build_pdu_and_seq_lists()
468 iscsit_ordered_seq_lists(cmd, bl->type); iscsit_do_build_pdu_and_seq_lists()
471 iscsit_dump_seq_list(cmd); iscsit_do_build_pdu_and_seq_lists()
476 if (iscsit_randomize_pdu_lists(cmd, bl->type) iscsit_do_build_pdu_and_seq_lists()
480 iscsit_ordered_pdu_lists(cmd, bl->type); iscsit_do_build_pdu_and_seq_lists()
483 if (iscsit_randomize_pdu_lists(cmd, bl->type) iscsit_do_build_pdu_and_seq_lists()
487 iscsit_ordered_pdu_lists(cmd, bl->type); iscsit_do_build_pdu_and_seq_lists()
490 iscsit_dump_pdu_list(cmd); iscsit_do_build_pdu_and_seq_lists()
497 struct iscsi_cmd *cmd, iscsit_build_pdu_and_seq_lists()
502 struct iscsi_conn *conn = cmd->conn; iscsit_build_pdu_and_seq_lists()
516 if (cmd->data_direction == DMA_NONE) iscsit_build_pdu_and_seq_lists()
522 if (cmd->data_direction == DMA_FROM_DEVICE) { iscsit_build_pdu_and_seq_lists()
535 if (!cmd->immediate_data && !cmd->unsolicited_data) iscsit_build_pdu_and_seq_lists()
537 else if (cmd->immediate_data && !cmd->unsolicited_data) iscsit_build_pdu_and_seq_lists()
539 else if (!cmd->immediate_data && cmd->unsolicited_data) iscsit_build_pdu_and_seq_lists()
541 else if (cmd->immediate_data && cmd->unsolicited_data) iscsit_build_pdu_and_seq_lists()
545 iscsit_determine_counts_for_list(cmd, &bl, &seq_count, &pdu_count); iscsit_build_pdu_and_seq_lists()
553 cmd->seq_list = seq; iscsit_build_pdu_and_seq_lists()
554 cmd->seq_count = seq_count; iscsit_build_pdu_and_seq_lists()
564 cmd->pdu_list = pdu; iscsit_build_pdu_and_seq_lists()
565 cmd->pdu_count = pdu_count; iscsit_build_pdu_and_seq_lists()
568 return iscsit_do_build_pdu_and_seq_lists(cmd, &bl); iscsit_build_pdu_and_seq_lists()
572 struct iscsi_cmd *cmd, iscsit_get_pdu_holder()
579 if (!cmd->pdu_list) { iscsit_get_pdu_holder()
584 pdu = &cmd->pdu_list[0]; iscsit_get_pdu_holder()
586 for (i = 0; i < cmd->pdu_count; i++) iscsit_get_pdu_holder()
591 " %u, Length: %u\n", cmd->init_task_tag, offset, length); iscsit_get_pdu_holder()
596 struct iscsi_cmd *cmd, iscsit_get_pdu_holder_for_seq()
600 struct iscsi_conn *conn = cmd->conn; iscsit_get_pdu_holder_for_seq()
603 if (!cmd->pdu_list) { iscsit_get_pdu_holder_for_seq()
610 pdu = &cmd->pdu_list[cmd->pdu_start]; iscsit_get_pdu_holder_for_seq()
612 for (i = 0; pdu[i].seq_no != cmd->seq_no; i++) { iscsit_get_pdu_holder_for_seq()
619 if (pdu[i].pdu_send_order == cmd->pdu_send_order) { iscsit_get_pdu_holder_for_seq()
620 cmd->pdu_send_order++; iscsit_get_pdu_holder_for_seq()
625 cmd->pdu_start += cmd->pdu_send_order; iscsit_get_pdu_holder_for_seq()
626 cmd->pdu_send_order = 0; iscsit_get_pdu_holder_for_seq()
627 cmd->seq_no++; iscsit_get_pdu_holder_for_seq()
629 if (cmd->pdu_start < cmd->pdu_count) iscsit_get_pdu_holder_for_seq()
633 " struct iscsi_pdu for cmd->pdu_send_order: %u.\n", iscsit_get_pdu_holder_for_seq()
634 cmd->init_task_tag, cmd->pdu_send_order); iscsit_get_pdu_holder_for_seq()
646 pdu = &cmd->pdu_list[seq->pdu_start]; iscsit_get_pdu_holder_for_seq()
651 cmd->init_task_tag, seq->pdu_send_order, iscsit_get_pdu_holder_for_seq()
665 cmd->init_task_tag, seq->pdu_send_order); iscsit_get_pdu_holder_for_seq()
673 struct iscsi_cmd *cmd, iscsit_get_seq_holder()
679 if (!cmd->seq_list) { iscsit_get_seq_holder()
684 for (i = 0; i < cmd->seq_count; i++) { iscsit_get_seq_holder()
687 cmd->seq_list[i].orig_offset, cmd->seq_list[i].xfer_len, iscsit_get_seq_holder()
688 cmd->seq_list[i].seq_no); iscsit_get_seq_holder()
690 if ((cmd->seq_list[i].orig_offset + iscsit_get_seq_holder()
691 cmd->seq_list[i].xfer_len) >= iscsit_get_seq_holder()
693 return &cmd->seq_list[i]; iscsit_get_seq_holder()
697 " Offset: %u, Length: %u\n", cmd->init_task_tag, offset, iscsit_get_seq_holder()
69 iscsit_ordered_seq_lists( struct iscsi_cmd *cmd, u8 type) iscsit_ordered_seq_lists() argument
82 iscsit_ordered_pdu_lists( struct iscsi_cmd *cmd, u8 type) iscsit_ordered_pdu_lists() argument
129 iscsit_randomize_pdu_lists( struct iscsi_cmd *cmd, u8 type) iscsit_randomize_pdu_lists() argument
179 iscsit_randomize_seq_lists( struct iscsi_cmd *cmd, u8 type) iscsit_randomize_seq_lists() argument
211 iscsit_determine_counts_for_list( struct iscsi_cmd *cmd, struct iscsi_build_list *bl, u32 *seq_count, u32 *pdu_count) iscsit_determine_counts_for_list() argument
295 iscsit_do_build_pdu_and_seq_lists( struct iscsi_cmd *cmd, struct iscsi_build_list *bl) iscsit_do_build_pdu_and_seq_lists() argument
496 iscsit_build_pdu_and_seq_lists( struct iscsi_cmd *cmd, u32 immediate_data_length) iscsit_build_pdu_and_seq_lists() argument
571 iscsit_get_pdu_holder( struct iscsi_cmd *cmd, u32 offset, u32 length) iscsit_get_pdu_holder() argument
595 iscsit_get_pdu_holder_for_seq( struct iscsi_cmd *cmd, struct iscsi_seq *seq) iscsit_get_pdu_holder_for_seq() argument
672 iscsit_get_seq_holder( struct iscsi_cmd *cmd, u32 offset, u32 length) iscsit_get_seq_holder() argument
H A Discsi_target_erl1.c121 struct iscsi_cmd *cmd, iscsit_send_recovery_r2t_for_snack()
129 spin_lock_bh(&cmd->r2t_lock); iscsit_send_recovery_r2t_for_snack()
131 spin_unlock_bh(&cmd->r2t_lock); iscsit_send_recovery_r2t_for_snack()
135 spin_unlock_bh(&cmd->r2t_lock); iscsit_send_recovery_r2t_for_snack()
137 iscsit_add_cmd_to_immediate_queue(cmd, cmd->conn, ISTATE_SEND_R2T); iscsit_send_recovery_r2t_for_snack()
143 struct iscsi_cmd *cmd, iscsit_handle_r2t_snack()
155 if ((cmd->cmd_flags & ICF_GOT_DATACK_SNACK) && iscsit_handle_r2t_snack()
156 (begrun <= cmd->acked_data_sn)) { iscsit_handle_r2t_snack()
160 " protocol error.\n", cmd->init_task_tag, begrun, iscsit_handle_r2t_snack()
161 (begrun + runlength), cmd->acked_data_sn); iscsit_handle_r2t_snack()
163 return iscsit_reject_cmd(cmd, iscsit_handle_r2t_snack()
168 if ((begrun + runlength) > cmd->r2t_sn) { iscsit_handle_r2t_snack()
172 cmd->init_task_tag, begrun, runlength, cmd->r2t_sn); iscsit_handle_r2t_snack()
173 return iscsit_reject_cmd(cmd, iscsit_handle_r2t_snack()
178 last_r2tsn = cmd->r2t_sn; iscsit_handle_r2t_snack()
181 r2t = iscsit_get_holder_for_r2tsn(cmd, begrun); iscsit_handle_r2t_snack()
184 if (iscsit_send_recovery_r2t_for_snack(cmd, r2t) < 0) iscsit_handle_r2t_snack()
202 struct iscsi_cmd *cmd, iscsit_create_recovery_datain_values_datasequenceinorder_yes()
208 struct iscsi_conn *conn = cmd->conn; iscsit_create_recovery_datain_values_datasequenceinorder_yes()
231 cmd->seq_no = seq_no; iscsit_create_recovery_datain_values_datasequenceinorder_yes()
232 cmd->pdu_start = pdu_start; iscsit_create_recovery_datain_values_datasequenceinorder_yes()
233 cmd->pdu_send_order = data_sn_count; iscsit_create_recovery_datain_values_datasequenceinorder_yes()
248 struct iscsi_cmd *cmd, iscsit_create_recovery_datain_values_datasequenceinorder_no()
255 struct iscsi_conn *conn = cmd->conn; iscsit_create_recovery_datain_values_datasequenceinorder_no()
258 if (!cmd->seq_list) { iscsit_create_recovery_datain_values_datasequenceinorder_no()
272 for (i = 0; i < cmd->seq_count; i++) { iscsit_create_recovery_datain_values_datasequenceinorder_no()
273 seq = &cmd->seq_list[i]; iscsit_create_recovery_datain_values_datasequenceinorder_no()
300 read_data_done += cmd->seq_list[i].xfer_len; iscsit_create_recovery_datain_values_datasequenceinorder_no()
348 pdu = &cmd->pdu_list[ iscsit_create_recovery_datain_values_datasequenceinorder_no()
382 cmd->init_task_tag, begrun); iscsit_create_recovery_datain_values_datasequenceinorder_no()
393 cmd->init_task_tag, begrun, runlength, iscsit_create_recovery_datain_values_datasequenceinorder_no()
406 struct iscsi_cmd *cmd, iscsit_handle_recovery_datain()
411 struct iscsi_conn *conn = cmd->conn; iscsit_handle_recovery_datain()
413 struct se_cmd *se_cmd = &cmd->se_cmd; iscsit_handle_recovery_datain()
417 cmd->init_task_tag); iscsit_handle_recovery_datain()
425 if ((cmd->cmd_flags & ICF_GOT_DATACK_SNACK) && iscsit_handle_recovery_datain()
426 (begrun <= cmd->acked_data_sn)) { iscsit_handle_recovery_datain()
430 " protocol error.\n", cmd->init_task_tag, begrun, iscsit_handle_recovery_datain()
431 (begrun + runlength), cmd->acked_data_sn); iscsit_handle_recovery_datain()
433 return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf); iscsit_handle_recovery_datain()
438 * Note: (cmd->data_sn - 1) will carry the maximum DataSN sent. iscsit_handle_recovery_datain()
440 if ((begrun + runlength) > (cmd->data_sn - 1)) { iscsit_handle_recovery_datain()
443 begrun, runlength, (cmd->data_sn - 1)); iscsit_handle_recovery_datain()
444 return iscsit_reject_cmd(cmd, ISCSI_REASON_BOOKMARK_INVALID, iscsit_handle_recovery_datain()
450 return iscsit_reject_cmd(cmd, ISCSI_REASON_BOOKMARK_NO_RESOURCES, iscsit_handle_recovery_datain()
458 iscsit_attach_datain_req(cmd, dr); iscsit_handle_recovery_datain()
460 cmd->i_state = ISTATE_SEND_DATAIN; iscsit_handle_recovery_datain()
461 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_handle_recovery_datain()
474 struct iscsi_cmd *cmd; iscsit_handle_recovery_datain_or_r2t() local
476 cmd = iscsit_find_cmd_from_itt(conn, init_task_tag); iscsit_handle_recovery_datain_or_r2t()
477 if (!cmd) iscsit_handle_recovery_datain_or_r2t()
483 switch (cmd->data_direction) { iscsit_handle_recovery_datain_or_r2t()
485 return iscsit_handle_r2t_snack(cmd, buf, begrun, runlength); iscsit_handle_recovery_datain_or_r2t()
487 return iscsit_handle_recovery_datain(cmd, buf, begrun, iscsit_handle_recovery_datain_or_r2t()
490 pr_err("Unknown cmd->data_direction: 0x%02x\n", iscsit_handle_recovery_datain_or_r2t()
491 cmd->data_direction); iscsit_handle_recovery_datain_or_r2t()
506 struct iscsi_cmd *cmd = NULL; iscsit_handle_status_snack() local
526 list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { iscsit_handle_status_snack()
527 if (cmd->stat_sn == begrun) { iscsit_handle_status_snack()
543 spin_lock_bh(&cmd->istate_lock); iscsit_handle_status_snack()
544 if (cmd->i_state == ISTATE_SEND_DATAIN) { iscsit_handle_status_snack()
545 spin_unlock_bh(&cmd->istate_lock); iscsit_handle_status_snack()
553 spin_unlock_bh(&cmd->istate_lock); iscsit_handle_status_snack()
555 cmd->i_state = ISTATE_SEND_STATUS_RECOVERY; iscsit_handle_status_snack()
556 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_handle_status_snack()
569 struct iscsi_cmd *cmd = NULL; iscsit_handle_data_ack() local
571 cmd = iscsit_find_cmd_from_ttt(conn, targ_xfer_tag); iscsit_handle_data_ack()
572 if (!cmd) { iscsit_handle_data_ack()
578 if (begrun <= cmd->acked_data_sn) { iscsit_handle_data_ack()
581 cmd->init_task_tag, begrun, cmd->acked_data_sn); iscsit_handle_data_ack()
589 cmd->cmd_flags |= ICF_GOT_DATACK_SNACK; iscsit_handle_data_ack()
590 cmd->acked_data_sn = (begrun - 1); iscsit_handle_data_ack()
594 cmd->init_task_tag, cmd->acked_data_sn); iscsit_handle_data_ack()
600 struct iscsi_cmd *cmd, iscsit_send_recovery_r2t()
606 spin_lock_bh(&cmd->r2t_lock); iscsit_send_recovery_r2t()
607 ret = iscsit_add_r2t_to_list(cmd, offset, xfer_len, 1, 0); iscsit_send_recovery_r2t()
608 spin_unlock_bh(&cmd->r2t_lock); iscsit_send_recovery_r2t()
614 struct iscsi_cmd *cmd, iscsit_dataout_datapduinorder_no_fbit()
619 struct iscsi_conn *conn = cmd->conn; iscsit_dataout_datapduinorder_no_fbit()
627 for (i = 0; i < cmd->pdu_count; i++) { iscsit_dataout_datapduinorder_no_fbit()
628 if (cmd->pdu_list[i].seq_no == pdu->seq_no) { iscsit_dataout_datapduinorder_no_fbit()
630 first_pdu = &cmd->pdu_list[i]; iscsit_dataout_datapduinorder_no_fbit()
631 xfer_len += cmd->pdu_list[i].length; iscsit_dataout_datapduinorder_no_fbit()
637 struct iscsi_seq *seq = cmd->seq_ptr; iscsit_dataout_datapduinorder_no_fbit()
639 first_pdu = &cmd->pdu_list[seq->pdu_start]; iscsit_dataout_datapduinorder_no_fbit()
655 if (iscsit_send_recovery_r2t(cmd, offset, length) < 0) iscsit_dataout_datapduinorder_no_fbit()
683 if (iscsit_send_recovery_r2t(cmd, offset, length) < 0) iscsit_dataout_datapduinorder_no_fbit()
690 struct iscsi_cmd *cmd, iscsit_recalculate_dataout_values()
697 struct iscsi_conn *conn = cmd->conn; iscsit_recalculate_dataout_values()
701 cmd->data_sn = 0; iscsit_recalculate_dataout_values()
704 *r2t_offset = cmd->write_data_done; iscsit_recalculate_dataout_values()
705 *r2t_length = (cmd->seq_end_offset - iscsit_recalculate_dataout_values()
706 cmd->write_data_done); iscsit_recalculate_dataout_values()
710 *r2t_offset = cmd->seq_start_offset; iscsit_recalculate_dataout_values()
711 *r2t_length = (cmd->seq_end_offset - cmd->seq_start_offset); iscsit_recalculate_dataout_values()
713 for (i = 0; i < cmd->pdu_count; i++) { iscsit_recalculate_dataout_values()
714 pdu = &cmd->pdu_list[i]; iscsit_recalculate_dataout_values()
719 if ((pdu->offset >= cmd->seq_start_offset) && iscsit_recalculate_dataout_values()
721 cmd->seq_end_offset)) { iscsit_recalculate_dataout_values()
722 if (!cmd->unsolicited_data) iscsit_recalculate_dataout_values()
723 cmd->next_burst_len -= pdu->length; iscsit_recalculate_dataout_values()
725 cmd->first_burst_len -= pdu->length; iscsit_recalculate_dataout_values()
727 cmd->write_data_done -= pdu->length; iscsit_recalculate_dataout_values()
734 seq = iscsit_get_seq_holder(cmd, pdu_offset, pdu_length); iscsit_recalculate_dataout_values()
741 cmd->write_data_done -= (seq->offset - seq->orig_offset); iscsit_recalculate_dataout_values()
742 if (cmd->immediate_data) iscsit_recalculate_dataout_values()
743 cmd->first_burst_len = cmd->write_data_done; iscsit_recalculate_dataout_values()
754 pdu = &cmd->pdu_list[i+seq->pdu_start]; iscsit_recalculate_dataout_values()
767 struct iscsi_cmd *cmd, iscsit_recover_dataout_sequence()
773 spin_lock_bh(&cmd->istate_lock); iscsit_recover_dataout_sequence()
774 cmd->cmd_flags |= ICF_WITHIN_COMMAND_RECOVERY; iscsit_recover_dataout_sequence()
775 spin_unlock_bh(&cmd->istate_lock); iscsit_recover_dataout_sequence()
777 if (iscsit_recalculate_dataout_values(cmd, pdu_offset, pdu_length, iscsit_recover_dataout_sequence()
781 iscsit_send_recovery_r2t(cmd, r2t_offset, r2t_length); iscsit_recover_dataout_sequence()
870 ooo_cmdsn->cmd = NULL; iscsit_clear_ooo_cmdsns_for_conn()
881 struct iscsi_cmd *cmd = NULL; iscsit_execute_ooo_cmdsns() local
889 if (!ooo_cmdsn->cmd) { iscsit_execute_ooo_cmdsns()
895 cmd = ooo_cmdsn->cmd; iscsit_execute_ooo_cmdsns()
896 cmd->i_state = cmd->deferred_i_state; iscsit_execute_ooo_cmdsns()
901 cmd->cmd_sn, sess->exp_cmd_sn); iscsit_execute_ooo_cmdsns()
905 if (iscsit_execute_cmd(cmd, 1) < 0) iscsit_execute_ooo_cmdsns()
922 int iscsit_execute_cmd(struct iscsi_cmd *cmd, int ooo) iscsit_execute_cmd() argument
924 struct se_cmd *se_cmd = &cmd->se_cmd; iscsit_execute_cmd()
925 struct iscsi_conn *conn = cmd->conn; iscsit_execute_cmd()
928 spin_lock_bh(&cmd->istate_lock); iscsit_execute_cmd()
930 cmd->cmd_flags &= ~ICF_OOO_CMDSN; iscsit_execute_cmd()
932 switch (cmd->iscsi_opcode) { iscsit_execute_cmd()
938 if (cmd->sense_reason) { iscsit_execute_cmd()
939 if (cmd->sense_reason == TCM_RESERVATION_CONFLICT) { iscsit_execute_cmd()
940 cmd->i_state = ISTATE_SEND_STATUS; iscsit_execute_cmd()
941 spin_unlock_bh(&cmd->istate_lock); iscsit_execute_cmd()
942 iscsit_add_cmd_to_response_queue(cmd, cmd->conn, iscsit_execute_cmd()
943 cmd->i_state); iscsit_execute_cmd()
946 spin_unlock_bh(&cmd->istate_lock); iscsit_execute_cmd()
955 (cmd->unsolicited_data == 0)) != 0) iscsit_execute_cmd()
962 cmd->sense_reason, 0); iscsit_execute_cmd()
968 if (cmd->immediate_data) { iscsit_execute_cmd()
969 if (cmd->cmd_flags & ICF_GOT_LAST_DATAOUT) { iscsit_execute_cmd()
970 spin_unlock_bh(&cmd->istate_lock); iscsit_execute_cmd()
971 target_execute_cmd(&cmd->se_cmd); iscsit_execute_cmd()
974 spin_unlock_bh(&cmd->istate_lock); iscsit_execute_cmd()
976 if (!(cmd->cmd_flags & iscsit_execute_cmd()
987 iscsit_set_dataout_sequence_values(cmd); iscsit_execute_cmd()
988 conn->conn_transport->iscsit_get_dataout(conn, cmd, false); iscsit_execute_cmd()
995 spin_unlock_bh(&cmd->istate_lock); iscsit_execute_cmd()
997 if ((cmd->data_direction == DMA_TO_DEVICE) && iscsit_execute_cmd()
998 !(cmd->cmd_flags & ICF_NON_IMMEDIATE_UNSOLICITED_DATA)) { iscsit_execute_cmd()
1006 iscsit_set_unsoliticed_dataout(cmd); iscsit_execute_cmd()
1008 return transport_handle_cdb_direct(&cmd->se_cmd); iscsit_execute_cmd()
1012 spin_unlock_bh(&cmd->istate_lock); iscsit_execute_cmd()
1013 iscsit_add_cmd_to_response_queue(cmd, cmd->conn, cmd->i_state); iscsit_execute_cmd()
1016 if (cmd->se_cmd.se_tmr_req->response) { iscsit_execute_cmd()
1017 spin_unlock_bh(&cmd->istate_lock); iscsit_execute_cmd()
1018 iscsit_add_cmd_to_response_queue(cmd, cmd->conn, iscsit_execute_cmd()
1019 cmd->i_state); iscsit_execute_cmd()
1022 spin_unlock_bh(&cmd->istate_lock); iscsit_execute_cmd()
1024 return transport_generic_handle_tmr(&cmd->se_cmd); iscsit_execute_cmd()
1026 spin_unlock_bh(&cmd->istate_lock); iscsit_execute_cmd()
1027 switch (cmd->logout_reason) { iscsit_execute_cmd()
1029 lr = iscsit_logout_closesession(cmd, cmd->conn); iscsit_execute_cmd()
1032 lr = iscsit_logout_closeconnection(cmd, cmd->conn); iscsit_execute_cmd()
1035 lr = iscsit_logout_removeconnforrecovery(cmd, cmd->conn); iscsit_execute_cmd()
1039 " 0x%02x\n", cmd->logout_reason); iscsit_execute_cmd()
1045 spin_unlock_bh(&cmd->istate_lock); iscsit_execute_cmd()
1047 " unknown iSCSI Opcode: 0x%02x\n", cmd->iscsi_opcode); iscsit_execute_cmd()
1070 struct iscsi_cmd *cmd, iscsit_handle_ooo_cmdsn()
1076 cmd->deferred_i_state = cmd->i_state; iscsit_handle_ooo_cmdsn()
1077 cmd->i_state = ISTATE_DEFERRED_CMD; iscsit_handle_ooo_cmdsn()
1078 cmd->cmd_flags |= ICF_OOO_CMDSN; iscsit_handle_ooo_cmdsn()
1093 ooo_cmdsn->cmd = cmd; iscsit_handle_ooo_cmdsn()
1096 ooo_cmdsn->cid = cmd->conn->cid; iscsit_handle_ooo_cmdsn()
1109 struct iscsi_cmd *cmd, iscsit_set_dataout_timeout_values()
1113 struct iscsi_conn *conn = cmd->conn; iscsit_set_dataout_timeout_values()
1116 if (cmd->unsolicited_data) { iscsit_set_dataout_timeout_values()
1119 cmd->se_cmd.data_length) ? iscsit_set_dataout_timeout_values()
1120 cmd->se_cmd.data_length : iscsit_set_dataout_timeout_values()
1125 spin_lock_bh(&cmd->r2t_lock); iscsit_set_dataout_timeout_values()
1126 if (list_empty(&cmd->cmd_r2t_list)) { iscsit_set_dataout_timeout_values()
1127 pr_err("cmd->cmd_r2t_list is empty!\n"); iscsit_set_dataout_timeout_values()
1128 spin_unlock_bh(&cmd->r2t_lock); iscsit_set_dataout_timeout_values()
1132 list_for_each_entry(r2t, &cmd->cmd_r2t_list, r2t_list) { iscsit_set_dataout_timeout_values()
1136 spin_unlock_bh(&cmd->r2t_lock); iscsit_set_dataout_timeout_values()
1140 spin_unlock_bh(&cmd->r2t_lock); iscsit_set_dataout_timeout_values()
1143 " sequences for ITT: 0x%08x.\n", cmd->init_task_tag); iscsit_set_dataout_timeout_values()
1155 struct iscsi_cmd *cmd = (struct iscsi_cmd *) data; iscsit_handle_dataout_timeout() local
1156 struct iscsi_conn *conn = cmd->conn; iscsit_handle_dataout_timeout()
1162 spin_lock_bh(&cmd->dataout_timeout_lock); iscsit_handle_dataout_timeout()
1163 if (cmd->dataout_timer_flags & ISCSI_TF_STOP) { iscsit_handle_dataout_timeout()
1164 spin_unlock_bh(&cmd->dataout_timeout_lock); iscsit_handle_dataout_timeout()
1168 cmd->dataout_timer_flags &= ~ISCSI_TF_RUNNING; iscsit_handle_dataout_timeout()
1178 if (++cmd->dataout_timeout_retries == na->dataout_timeout_retries) { iscsit_handle_dataout_timeout()
1181 cmd->init_task_tag, na->dataout_timeout_retries); iscsit_handle_dataout_timeout()
1185 cmd->cmd_flags |= ICF_WITHIN_COMMAND_RECOVERY; iscsit_handle_dataout_timeout()
1189 pdu_offset = cmd->write_data_done; iscsit_handle_dataout_timeout()
1191 cmd->next_burst_len)) > cmd->se_cmd.data_length) iscsit_handle_dataout_timeout()
1192 pdu_length = (cmd->se_cmd.data_length - iscsit_handle_dataout_timeout()
1193 cmd->write_data_done); iscsit_handle_dataout_timeout()
1196 cmd->next_burst_len); iscsit_handle_dataout_timeout()
1198 pdu_offset = cmd->seq_start_offset; iscsit_handle_dataout_timeout()
1199 pdu_length = (cmd->seq_end_offset - iscsit_handle_dataout_timeout()
1200 cmd->seq_start_offset); iscsit_handle_dataout_timeout()
1203 if (iscsit_set_dataout_timeout_values(cmd, &pdu_offset, iscsit_handle_dataout_timeout()
1208 if (iscsit_recalculate_dataout_values(cmd, pdu_offset, pdu_length, iscsit_handle_dataout_timeout()
1214 cmd->init_task_tag, (cmd->unsolicited_data) ? "Unsolicited " : iscsit_handle_dataout_timeout()
1217 if (iscsit_send_recovery_r2t(cmd, r2t_offset, r2t_length) < 0) iscsit_handle_dataout_timeout()
1220 iscsit_start_dataout_timer(cmd, conn); iscsit_handle_dataout_timeout()
1221 spin_unlock_bh(&cmd->dataout_timeout_lock); iscsit_handle_dataout_timeout()
1227 spin_unlock_bh(&cmd->dataout_timeout_lock); iscsit_handle_dataout_timeout()
1232 void iscsit_mod_dataout_timer(struct iscsi_cmd *cmd) iscsit_mod_dataout_timer() argument
1234 struct iscsi_conn *conn = cmd->conn; iscsit_mod_dataout_timer()
1238 spin_lock_bh(&cmd->dataout_timeout_lock); iscsit_mod_dataout_timer()
1239 if (!(cmd->dataout_timer_flags & ISCSI_TF_RUNNING)) { iscsit_mod_dataout_timer()
1240 spin_unlock_bh(&cmd->dataout_timeout_lock); iscsit_mod_dataout_timer()
1244 mod_timer(&cmd->dataout_timer, iscsit_mod_dataout_timer()
1247 cmd->init_task_tag); iscsit_mod_dataout_timer()
1248 spin_unlock_bh(&cmd->dataout_timeout_lock); iscsit_mod_dataout_timer()
1252 * Called with cmd->dataout_timeout_lock held.
1255 struct iscsi_cmd *cmd, iscsit_start_dataout_timer()
1261 if (cmd->dataout_timer_flags & ISCSI_TF_RUNNING) iscsit_start_dataout_timer()
1265 " CID: %hu.\n", cmd->init_task_tag, conn->cid); iscsit_start_dataout_timer()
1267 init_timer(&cmd->dataout_timer); iscsit_start_dataout_timer()
1268 cmd->dataout_timer.expires = (get_jiffies_64() + na->dataout_timeout * HZ); iscsit_start_dataout_timer()
1269 cmd->dataout_timer.data = (unsigned long)cmd; iscsit_start_dataout_timer()
1270 cmd->dataout_timer.function = iscsit_handle_dataout_timeout; iscsit_start_dataout_timer()
1271 cmd->dataout_timer_flags &= ~ISCSI_TF_STOP; iscsit_start_dataout_timer()
1272 cmd->dataout_timer_flags |= ISCSI_TF_RUNNING; iscsit_start_dataout_timer()
1273 add_timer(&cmd->dataout_timer); iscsit_start_dataout_timer()
1276 void iscsit_stop_dataout_timer(struct iscsi_cmd *cmd) iscsit_stop_dataout_timer() argument
1278 spin_lock_bh(&cmd->dataout_timeout_lock); iscsit_stop_dataout_timer()
1279 if (!(cmd->dataout_timer_flags & ISCSI_TF_RUNNING)) { iscsit_stop_dataout_timer()
1280 spin_unlock_bh(&cmd->dataout_timeout_lock); iscsit_stop_dataout_timer()
1283 cmd->dataout_timer_flags |= ISCSI_TF_STOP; iscsit_stop_dataout_timer()
1284 spin_unlock_bh(&cmd->dataout_timeout_lock); iscsit_stop_dataout_timer()
1286 del_timer_sync(&cmd->dataout_timer); iscsit_stop_dataout_timer()
1288 spin_lock_bh(&cmd->dataout_timeout_lock); iscsit_stop_dataout_timer()
1289 cmd->dataout_timer_flags &= ~ISCSI_TF_RUNNING; iscsit_stop_dataout_timer()
1291 cmd->init_task_tag); iscsit_stop_dataout_timer()
1292 spin_unlock_bh(&cmd->dataout_timeout_lock); iscsit_stop_dataout_timer()
120 iscsit_send_recovery_r2t_for_snack( struct iscsi_cmd *cmd, struct iscsi_r2t *r2t) iscsit_send_recovery_r2t_for_snack() argument
142 iscsit_handle_r2t_snack( struct iscsi_cmd *cmd, unsigned char *buf, u32 begrun, u32 runlength) iscsit_handle_r2t_snack() argument
201 iscsit_create_recovery_datain_values_datasequenceinorder_yes( struct iscsi_cmd *cmd, struct iscsi_datain_req *dr) iscsit_create_recovery_datain_values_datasequenceinorder_yes() argument
247 iscsit_create_recovery_datain_values_datasequenceinorder_no( struct iscsi_cmd *cmd, struct iscsi_datain_req *dr) iscsit_create_recovery_datain_values_datasequenceinorder_no() argument
405 iscsit_handle_recovery_datain( struct iscsi_cmd *cmd, unsigned char *buf, u32 begrun, u32 runlength) iscsit_handle_recovery_datain() argument
599 iscsit_send_recovery_r2t( struct iscsi_cmd *cmd, u32 offset, u32 xfer_len) iscsit_send_recovery_r2t() argument
613 iscsit_dataout_datapduinorder_no_fbit( struct iscsi_cmd *cmd, struct iscsi_pdu *pdu) iscsit_dataout_datapduinorder_no_fbit() argument
689 iscsit_recalculate_dataout_values( struct iscsi_cmd *cmd, u32 pdu_offset, u32 pdu_length, u32 *r2t_offset, u32 *r2t_length) iscsit_recalculate_dataout_values() argument
766 iscsit_recover_dataout_sequence( struct iscsi_cmd *cmd, u32 pdu_offset, u32 pdu_length) iscsit_recover_dataout_sequence() argument
1068 iscsit_handle_ooo_cmdsn( struct iscsi_session *sess, struct iscsi_cmd *cmd, u32 cmdsn) iscsit_handle_ooo_cmdsn() argument
1108 iscsit_set_dataout_timeout_values( struct iscsi_cmd *cmd, u32 *offset, u32 *length) iscsit_set_dataout_timeout_values() argument
1254 iscsit_start_dataout_timer( struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_start_dataout_timer() argument
H A Discsi_target_tmr.c39 struct iscsi_cmd *cmd, iscsit_tmr_abort_task()
43 struct iscsi_conn *conn = cmd->conn; iscsit_tmr_abort_task()
44 struct iscsi_tmr_req *tmr_req = cmd->tmr_req; iscsit_tmr_abort_task()
45 struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req; iscsit_tmr_abort_task()
114 struct iscsi_cmd *cmd, iscsit_tmr_task_reassign()
118 struct iscsi_conn *conn = cmd->conn; iscsit_tmr_task_reassign()
120 struct iscsi_tmr_req *tmr_req = cmd->tmr_req; iscsit_tmr_task_reassign()
121 struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req; iscsit_tmr_task_reassign()
186 struct iscsi_cmd *cmd, iscsit_task_reassign_remove_cmd()
193 ret = iscsit_remove_cmd_from_connection_recovery(cmd, sess); iscsit_task_reassign_remove_cmd()
206 struct iscsi_cmd *cmd = tmr_req->ref_cmd; iscsit_task_reassign_complete_nop_out() local
209 if (!cmd->cr) { iscsit_task_reassign_complete_nop_out()
211 " is NULL!\n", cmd->init_task_tag); iscsit_task_reassign_complete_nop_out()
214 cr = cmd->cr; iscsit_task_reassign_complete_nop_out()
221 cmd->stat_sn = cmd->exp_stat_sn = 0; iscsit_task_reassign_complete_nop_out()
223 iscsit_task_reassign_remove_cmd(cmd, cr, conn->sess); iscsit_task_reassign_complete_nop_out()
226 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); iscsit_task_reassign_complete_nop_out()
229 cmd->i_state = ISTATE_SEND_NOPIN; iscsit_task_reassign_complete_nop_out()
230 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_task_reassign_complete_nop_out()
235 struct iscsi_cmd *cmd, iscsit_task_reassign_complete_write()
240 struct iscsi_conn *conn = cmd->conn; iscsit_task_reassign_complete_write()
241 struct se_cmd *se_cmd = &cmd->se_cmd; iscsit_task_reassign_complete_write()
247 cmd->cmd_flags &= ~ICF_GOT_DATACK_SNACK; iscsit_task_reassign_complete_write()
248 cmd->acked_data_sn = 0; iscsit_task_reassign_complete_write()
250 cmd->cmd_flags |= ICF_GOT_DATACK_SNACK; iscsit_task_reassign_complete_write()
251 cmd->acked_data_sn = (tmr_req->exp_data_sn - 1); iscsit_task_reassign_complete_write()
259 if (cmd->cmd_flags & ICF_GOT_LAST_DATAOUT) { iscsit_task_reassign_complete_write()
260 if (!(cmd->se_cmd.transport_state & CMD_T_SENT)) { iscsit_task_reassign_complete_write()
263 cmd->init_task_tag, cmd->se_cmd.t_state); iscsit_task_reassign_complete_write()
268 cmd->i_state = ISTATE_SEND_STATUS; iscsit_task_reassign_complete_write()
269 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_task_reassign_complete_write()
277 if (cmd->unsolicited_data) { iscsit_task_reassign_complete_write()
278 cmd->unsolicited_data = 0; iscsit_task_reassign_complete_write()
280 offset = cmd->next_burst_len = cmd->write_data_done; iscsit_task_reassign_complete_write()
283 cmd->se_cmd.data_length) { iscsit_task_reassign_complete_write()
285 length = (cmd->se_cmd.data_length - offset); iscsit_task_reassign_complete_write()
289 spin_lock_bh(&cmd->r2t_lock); iscsit_task_reassign_complete_write()
290 if (iscsit_add_r2t_to_list(cmd, offset, length, 0, 0) < 0) { iscsit_task_reassign_complete_write()
291 spin_unlock_bh(&cmd->r2t_lock); iscsit_task_reassign_complete_write()
294 cmd->outstanding_r2ts++; iscsit_task_reassign_complete_write()
295 spin_unlock_bh(&cmd->r2t_lock); iscsit_task_reassign_complete_write()
303 return conn->conn_transport->iscsit_get_dataout(conn, cmd, true); iscsit_task_reassign_complete_write()
307 struct iscsi_cmd *cmd, iscsit_task_reassign_complete_read()
310 struct iscsi_conn *conn = cmd->conn; iscsit_task_reassign_complete_read()
312 struct se_cmd *se_cmd = &cmd->se_cmd; iscsit_task_reassign_complete_read()
318 cmd->cmd_flags &= ~ICF_GOT_DATACK_SNACK; iscsit_task_reassign_complete_read()
319 cmd->acked_data_sn = 0; iscsit_task_reassign_complete_read()
321 cmd->cmd_flags |= ICF_GOT_DATACK_SNACK; iscsit_task_reassign_complete_read()
322 cmd->acked_data_sn = (tmr_req->exp_data_sn - 1); iscsit_task_reassign_complete_read()
325 if (!(cmd->se_cmd.transport_state & CMD_T_SENT)) { iscsit_task_reassign_complete_read()
327 " transport\n", cmd->init_task_tag, iscsit_task_reassign_complete_read()
328 cmd->se_cmd.t_state); iscsit_task_reassign_complete_read()
335 " from transport\n", cmd->init_task_tag, iscsit_task_reassign_complete_read()
336 cmd->se_cmd.t_state); iscsit_task_reassign_complete_read()
352 iscsit_attach_datain_req(cmd, dr); iscsit_task_reassign_complete_read()
354 cmd->i_state = ISTATE_SEND_DATAIN; iscsit_task_reassign_complete_read()
355 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_task_reassign_complete_read()
360 struct iscsi_cmd *cmd, iscsit_task_reassign_complete_none()
363 struct iscsi_conn *conn = cmd->conn; iscsit_task_reassign_complete_none()
365 cmd->i_state = ISTATE_SEND_STATUS; iscsit_task_reassign_complete_none()
366 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_task_reassign_complete_none()
374 struct iscsi_cmd *cmd = tmr_req->ref_cmd; iscsit_task_reassign_complete_scsi_cmnd() local
377 if (!cmd->cr) { iscsit_task_reassign_complete_scsi_cmnd()
379 " is NULL!\n", cmd->init_task_tag); iscsit_task_reassign_complete_scsi_cmnd()
382 cr = cmd->cr; iscsit_task_reassign_complete_scsi_cmnd()
389 cmd->stat_sn = cmd->exp_stat_sn = 0; iscsit_task_reassign_complete_scsi_cmnd()
391 iscsit_task_reassign_remove_cmd(cmd, cr, conn->sess); iscsit_task_reassign_complete_scsi_cmnd()
394 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); iscsit_task_reassign_complete_scsi_cmnd()
397 if (cmd->se_cmd.se_cmd_flags & SCF_SENT_CHECK_CONDITION) { iscsit_task_reassign_complete_scsi_cmnd()
398 cmd->i_state = ISTATE_SEND_STATUS; iscsit_task_reassign_complete_scsi_cmnd()
399 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_task_reassign_complete_scsi_cmnd()
403 switch (cmd->data_direction) { iscsit_task_reassign_complete_scsi_cmnd()
405 return iscsit_task_reassign_complete_write(cmd, tmr_req); iscsit_task_reassign_complete_scsi_cmnd()
407 return iscsit_task_reassign_complete_read(cmd, tmr_req); iscsit_task_reassign_complete_scsi_cmnd()
409 return iscsit_task_reassign_complete_none(cmd, tmr_req); iscsit_task_reassign_complete_scsi_cmnd()
411 pr_err("Unknown cmd->data_direction: 0x%02x\n", iscsit_task_reassign_complete_scsi_cmnd()
412 cmd->data_direction); iscsit_task_reassign_complete_scsi_cmnd()
423 struct iscsi_cmd *cmd; iscsit_task_reassign_complete() local
430 cmd = tmr_req->ref_cmd; iscsit_task_reassign_complete()
432 cmd->conn = conn; iscsit_task_reassign_complete()
434 switch (cmd->iscsi_opcode) { iscsit_task_reassign_complete()
443 " command realligence\n", cmd->iscsi_opcode); iscsit_task_reassign_complete()
451 " ITT: 0x%08x to CID: %hu.\n", cmd->iscsi_opcode, iscsit_task_reassign_complete()
452 cmd->init_task_tag, conn->cid); iscsit_task_reassign_complete()
462 int iscsit_tmr_post_handler(struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_tmr_post_handler() argument
464 struct iscsi_tmr_req *tmr_req = cmd->tmr_req; iscsit_tmr_post_handler()
465 struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req; iscsit_tmr_post_handler()
486 struct iscsi_cmd *cmd, iscsit_task_reassign_prepare_unsolicited_dataout()
494 cmd->data_sn = 0; iscsit_task_reassign_prepare_unsolicited_dataout()
496 if (cmd->immediate_data) iscsit_task_reassign_prepare_unsolicited_dataout()
497 cmd->r2t_offset += (cmd->first_burst_len - iscsit_task_reassign_prepare_unsolicited_dataout()
498 cmd->seq_start_offset); iscsit_task_reassign_prepare_unsolicited_dataout()
501 cmd->write_data_done -= (cmd->immediate_data) ? iscsit_task_reassign_prepare_unsolicited_dataout()
502 (cmd->first_burst_len - iscsit_task_reassign_prepare_unsolicited_dataout()
503 cmd->seq_start_offset) : iscsit_task_reassign_prepare_unsolicited_dataout()
504 cmd->first_burst_len; iscsit_task_reassign_prepare_unsolicited_dataout()
505 cmd->first_burst_len = 0; iscsit_task_reassign_prepare_unsolicited_dataout()
509 for (i = 0; i < cmd->pdu_count; i++) { iscsit_task_reassign_prepare_unsolicited_dataout()
510 pdu = &cmd->pdu_list[i]; iscsit_task_reassign_prepare_unsolicited_dataout()
515 if ((pdu->offset >= cmd->seq_start_offset) && iscsit_task_reassign_prepare_unsolicited_dataout()
517 cmd->seq_end_offset)) { iscsit_task_reassign_prepare_unsolicited_dataout()
518 cmd->first_burst_len -= pdu->length; iscsit_task_reassign_prepare_unsolicited_dataout()
519 cmd->write_data_done -= pdu->length; iscsit_task_reassign_prepare_unsolicited_dataout()
524 for (i = 0; i < cmd->seq_count; i++) { iscsit_task_reassign_prepare_unsolicited_dataout()
525 seq = &cmd->seq_list[i]; iscsit_task_reassign_prepare_unsolicited_dataout()
530 cmd->write_data_done -= iscsit_task_reassign_prepare_unsolicited_dataout()
532 cmd->first_burst_len = 0; iscsit_task_reassign_prepare_unsolicited_dataout()
542 pdu = &cmd->pdu_list[j+seq->pdu_start]; iscsit_task_reassign_prepare_unsolicited_dataout()
557 struct iscsi_cmd *cmd = tmr_req->ref_cmd; iscsit_task_reassign_prepare_write() local
566 if (cmd->unsolicited_data) iscsit_task_reassign_prepare_write()
567 iscsit_task_reassign_prepare_unsolicited_dataout(cmd, conn); iscsit_task_reassign_prepare_write()
590 spin_lock_bh(&cmd->r2t_lock); iscsit_task_reassign_prepare_write()
591 if (list_empty(&cmd->cmd_r2t_list)) { iscsit_task_reassign_prepare_write()
592 spin_unlock_bh(&cmd->r2t_lock); iscsit_task_reassign_prepare_write()
596 list_for_each_entry(r2t, &cmd->cmd_r2t_list, r2t_list) { iscsit_task_reassign_prepare_write()
645 cmd->r2t_offset -= r2t->xfer_len; iscsit_task_reassign_prepare_write()
650 cmd->data_sn = 0; iscsit_task_reassign_prepare_write()
651 cmd->r2t_offset -= (r2t->xfer_len - iscsit_task_reassign_prepare_write()
652 cmd->next_burst_len); iscsit_task_reassign_prepare_write()
657 cmd->data_sn = 0; iscsit_task_reassign_prepare_write()
658 cmd->r2t_offset -= r2t->xfer_len; iscsit_task_reassign_prepare_write()
660 for (i = 0; i < cmd->pdu_count; i++) { iscsit_task_reassign_prepare_write()
661 pdu = &cmd->pdu_list[i]; iscsit_task_reassign_prepare_write()
669 cmd->next_burst_len -= pdu->length; iscsit_task_reassign_prepare_write()
670 cmd->write_data_done -= pdu->length; iscsit_task_reassign_prepare_write()
679 seq = iscsit_get_seq_holder(cmd, r2t->offset, iscsit_task_reassign_prepare_write()
682 spin_unlock_bh(&cmd->r2t_lock); iscsit_task_reassign_prepare_write()
686 cmd->write_data_done -= iscsit_task_reassign_prepare_write()
693 cmd->seq_send_order--; iscsit_task_reassign_prepare_write()
699 pdu = &cmd->pdu_list[i+seq->pdu_start]; iscsit_task_reassign_prepare_write()
709 cmd->outstanding_r2ts--; iscsit_task_reassign_prepare_write()
711 spin_unlock_bh(&cmd->r2t_lock); iscsit_task_reassign_prepare_write()
725 cmd->cmd_flags &= ~ICF_SENT_LAST_R2T; iscsit_task_reassign_prepare_write()
726 cmd->r2t_sn = tmr_req->exp_data_sn; iscsit_task_reassign_prepare_write()
728 spin_lock_bh(&cmd->r2t_lock); iscsit_task_reassign_prepare_write()
729 list_for_each_entry_safe(r2t, r2t_tmp, &cmd->cmd_r2t_list, r2t_list) { iscsit_task_reassign_prepare_write()
744 spin_unlock_bh(&cmd->r2t_lock); iscsit_task_reassign_prepare_write()
749 iscsit_free_r2t(r2t, cmd); iscsit_task_reassign_prepare_write()
763 * current offset and original offset from cmd->write_data_done iscsit_task_reassign_prepare_write()
770 cmd->r2t_offset -= r2t->xfer_len; iscsit_task_reassign_prepare_write()
772 cmd->seq_send_order--; iscsit_task_reassign_prepare_write()
774 cmd->outstanding_r2ts--; iscsit_task_reassign_prepare_write()
775 iscsit_free_r2t(r2t, cmd); iscsit_task_reassign_prepare_write()
777 spin_unlock_bh(&cmd->r2t_lock); iscsit_task_reassign_prepare_write()
38 iscsit_tmr_abort_task( struct iscsi_cmd *cmd, unsigned char *buf) iscsit_tmr_abort_task() argument
113 iscsit_tmr_task_reassign( struct iscsi_cmd *cmd, unsigned char *buf) iscsit_tmr_task_reassign() argument
185 iscsit_task_reassign_remove_cmd( struct iscsi_cmd *cmd, struct iscsi_conn_recovery *cr, struct iscsi_session *sess) iscsit_task_reassign_remove_cmd() argument
234 iscsit_task_reassign_complete_write( struct iscsi_cmd *cmd, struct iscsi_tmr_req *tmr_req) iscsit_task_reassign_complete_write() argument
306 iscsit_task_reassign_complete_read( struct iscsi_cmd *cmd, struct iscsi_tmr_req *tmr_req) iscsit_task_reassign_complete_read() argument
359 iscsit_task_reassign_complete_none( struct iscsi_cmd *cmd, struct iscsi_tmr_req *tmr_req) iscsit_task_reassign_complete_none() argument
485 iscsit_task_reassign_prepare_unsolicited_dataout( struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_task_reassign_prepare_unsolicited_dataout() argument
H A Discsi_target_datain_values.c43 void iscsit_attach_datain_req(struct iscsi_cmd *cmd, struct iscsi_datain_req *dr) iscsit_attach_datain_req() argument
45 spin_lock(&cmd->datain_lock); iscsit_attach_datain_req()
46 list_add_tail(&dr->cmd_datain_node, &cmd->datain_list); iscsit_attach_datain_req()
47 spin_unlock(&cmd->datain_lock); iscsit_attach_datain_req()
50 void iscsit_free_datain_req(struct iscsi_cmd *cmd, struct iscsi_datain_req *dr) iscsit_free_datain_req() argument
52 spin_lock(&cmd->datain_lock); iscsit_free_datain_req()
54 spin_unlock(&cmd->datain_lock); iscsit_free_datain_req()
59 void iscsit_free_all_datain_reqs(struct iscsi_cmd *cmd) iscsit_free_all_datain_reqs() argument
63 spin_lock(&cmd->datain_lock); iscsit_free_all_datain_reqs()
64 list_for_each_entry_safe(dr, dr_tmp, &cmd->datain_list, cmd_datain_node) { iscsit_free_all_datain_reqs()
68 spin_unlock(&cmd->datain_lock); iscsit_free_all_datain_reqs()
71 struct iscsi_datain_req *iscsit_get_datain_req(struct iscsi_cmd *cmd) iscsit_get_datain_req() argument
73 if (list_empty(&cmd->datain_list)) { iscsit_get_datain_req()
74 pr_err("cmd->datain_list is empty for ITT:" iscsit_get_datain_req()
75 " 0x%08x\n", cmd->init_task_tag); iscsit_get_datain_req()
79 return list_first_entry(&cmd->datain_list, struct iscsi_datain_req, iscsit_get_datain_req()
87 struct iscsi_cmd *cmd, iscsit_set_datain_values_yes_and_yes()
91 struct iscsi_conn *conn = cmd->conn; iscsit_set_datain_values_yes_and_yes()
94 dr = iscsit_get_datain_req(cmd); iscsit_set_datain_values_yes_and_yes()
100 cmd, dr) < 0) iscsit_set_datain_values_yes_and_yes()
107 cmd->next_burst_len : dr->next_burst_len; iscsit_set_datain_values_yes_and_yes()
109 cmd->read_data_done : dr->read_data_done; iscsit_set_datain_values_yes_and_yes()
111 read_data_left = (cmd->se_cmd.data_length - read_data_done); iscsit_set_datain_values_yes_and_yes()
114 cmd->init_task_tag); iscsit_set_datain_values_yes_and_yes()
144 datain->data_sn = (!dr->recovery) ? cmd->data_sn++ : dr->data_sn++; iscsit_set_datain_values_yes_and_yes()
148 cmd->next_burst_len = next_burst_len; iscsit_set_datain_values_yes_and_yes()
149 cmd->read_data_done += datain->length; iscsit_set_datain_values_yes_and_yes()
185 struct iscsi_cmd *cmd, iscsit_set_datain_values_no_and_yes()
189 struct iscsi_conn *conn = cmd->conn; iscsit_set_datain_values_no_and_yes()
193 dr = iscsit_get_datain_req(cmd); iscsit_set_datain_values_no_and_yes()
199 cmd, dr) < 0) iscsit_set_datain_values_no_and_yes()
206 cmd->read_data_done : dr->read_data_done; iscsit_set_datain_values_no_and_yes()
208 cmd->seq_send_order : dr->seq_send_order; iscsit_set_datain_values_no_and_yes()
210 read_data_left = (cmd->se_cmd.data_length - read_data_done); iscsit_set_datain_values_no_and_yes()
213 cmd->init_task_tag); iscsit_set_datain_values_no_and_yes()
217 seq = iscsit_get_seq_holder_for_datain(cmd, seq_send_order); iscsit_set_datain_values_no_and_yes()
224 seq->first_datasn = cmd->data_sn; iscsit_set_datain_values_no_and_yes()
229 cmd->se_cmd.data_length) { iscsit_set_datain_values_no_and_yes()
230 datain->length = (cmd->se_cmd.data_length - offset); iscsit_set_datain_values_no_and_yes()
262 if ((read_data_done + datain->length) == cmd->se_cmd.data_length) iscsit_set_datain_values_no_and_yes()
265 datain->data_sn = (!dr->recovery) ? cmd->data_sn++ : dr->data_sn++; iscsit_set_datain_values_no_and_yes()
267 cmd->seq_send_order = seq_send_order; iscsit_set_datain_values_no_and_yes()
268 cmd->read_data_done += datain->length; iscsit_set_datain_values_no_and_yes()
306 struct iscsi_cmd *cmd, iscsit_set_datain_values_yes_and_no()
310 struct iscsi_conn *conn = cmd->conn; iscsit_set_datain_values_yes_and_no()
314 dr = iscsit_get_datain_req(cmd); iscsit_set_datain_values_yes_and_no()
320 cmd, dr) < 0) iscsit_set_datain_values_yes_and_no()
327 cmd->next_burst_len : dr->next_burst_len; iscsit_set_datain_values_yes_and_no()
329 cmd->read_data_done : dr->read_data_done; iscsit_set_datain_values_yes_and_no()
331 read_data_left = (cmd->se_cmd.data_length - read_data_done); iscsit_set_datain_values_yes_and_no()
334 cmd->init_task_tag); iscsit_set_datain_values_yes_and_no()
338 pdu = iscsit_get_pdu_holder_for_seq(cmd, NULL); iscsit_set_datain_values_yes_and_no()
342 if ((read_data_done + pdu->length) == cmd->se_cmd.data_length) { iscsit_set_datain_values_yes_and_no()
361 pdu->data_sn = (!dr->recovery) ? cmd->data_sn++ : dr->data_sn++; iscsit_set_datain_values_yes_and_no()
363 cmd->next_burst_len = next_burst_len; iscsit_set_datain_values_yes_and_no()
364 cmd->read_data_done += pdu->length; iscsit_set_datain_values_yes_and_no()
405 struct iscsi_cmd *cmd, iscsit_set_datain_values_no_and_no()
409 struct iscsi_conn *conn = cmd->conn; iscsit_set_datain_values_no_and_no()
414 dr = iscsit_get_datain_req(cmd); iscsit_set_datain_values_no_and_no()
420 cmd, dr) < 0) iscsit_set_datain_values_no_and_no()
427 cmd->read_data_done : dr->read_data_done; iscsit_set_datain_values_no_and_no()
429 cmd->seq_send_order : dr->seq_send_order; iscsit_set_datain_values_no_and_no()
431 read_data_left = (cmd->se_cmd.data_length - read_data_done); iscsit_set_datain_values_no_and_no()
434 cmd->init_task_tag); iscsit_set_datain_values_no_and_no()
438 seq = iscsit_get_seq_holder_for_datain(cmd, seq_send_order); iscsit_set_datain_values_no_and_no()
445 seq->first_datasn = cmd->data_sn; iscsit_set_datain_values_no_and_no()
447 pdu = iscsit_get_pdu_holder_for_seq(cmd, seq); iscsit_set_datain_values_no_and_no()
461 if ((read_data_done + pdu->length) == cmd->se_cmd.data_length) iscsit_set_datain_values_no_and_no()
464 pdu->data_sn = (!dr->recovery) ? cmd->data_sn++ : dr->data_sn++; iscsit_set_datain_values_no_and_no()
466 cmd->seq_send_order = seq_send_order; iscsit_set_datain_values_no_and_no()
467 cmd->read_data_done += pdu->length; iscsit_set_datain_values_no_and_no()
507 struct iscsi_cmd *cmd, iscsit_get_datain_values()
510 struct iscsi_conn *conn = cmd->conn; iscsit_get_datain_values()
514 return iscsit_set_datain_values_yes_and_yes(cmd, datain); iscsit_get_datain_values()
517 return iscsit_set_datain_values_no_and_yes(cmd, datain); iscsit_get_datain_values()
520 return iscsit_set_datain_values_yes_and_no(cmd, datain); iscsit_get_datain_values()
523 return iscsit_set_datain_values_no_and_no(cmd, datain); iscsit_get_datain_values()
86 iscsit_set_datain_values_yes_and_yes( struct iscsi_cmd *cmd, struct iscsi_datain *datain) iscsit_set_datain_values_yes_and_yes() argument
184 iscsit_set_datain_values_no_and_yes( struct iscsi_cmd *cmd, struct iscsi_datain *datain) iscsit_set_datain_values_no_and_yes() argument
305 iscsit_set_datain_values_yes_and_no( struct iscsi_cmd *cmd, struct iscsi_datain *datain) iscsit_set_datain_values_yes_and_no() argument
404 iscsit_set_datain_values_no_and_no( struct iscsi_cmd *cmd, struct iscsi_datain *datain) iscsit_set_datain_values_no_and_no() argument
506 iscsit_get_datain_values( struct iscsi_cmd *cmd, struct iscsi_datain *datain) iscsit_get_datain_values() argument
H A Discsi_target_erl2.c36 struct iscsi_cmd *cmd, iscsit_create_conn_recovery_datain_values()
40 struct iscsi_conn *conn = cmd->conn; iscsit_create_conn_recovery_datain_values()
42 cmd->next_burst_len = 0; iscsit_create_conn_recovery_datain_values()
43 cmd->read_data_done = 0; iscsit_create_conn_recovery_datain_values()
46 if ((cmd->next_burst_len + iscsit_create_conn_recovery_datain_values()
49 cmd->read_data_done += iscsit_create_conn_recovery_datain_values()
51 cmd->next_burst_len += iscsit_create_conn_recovery_datain_values()
54 cmd->read_data_done += iscsit_create_conn_recovery_datain_values()
56 cmd->next_burst_len); iscsit_create_conn_recovery_datain_values()
57 cmd->next_burst_len = 0; iscsit_create_conn_recovery_datain_values()
64 struct iscsi_cmd *cmd) iscsit_create_conn_recovery_dataout_values()
67 struct iscsi_conn *conn = cmd->conn; iscsit_create_conn_recovery_dataout_values()
69 cmd->data_sn = 0; iscsit_create_conn_recovery_dataout_values()
70 cmd->next_burst_len = 0; iscsit_create_conn_recovery_dataout_values()
72 while (cmd->write_data_done > write_data_done) { iscsit_create_conn_recovery_dataout_values()
74 cmd->write_data_done) iscsit_create_conn_recovery_dataout_values()
80 cmd->write_data_done = write_data_done; iscsit_create_conn_recovery_dataout_values()
129 struct iscsi_cmd *cmd, *cmd_tmp; iscsit_free_connection_recovery_entires() local
138 list_for_each_entry_safe(cmd, cmd_tmp, iscsit_free_connection_recovery_entires()
141 list_del_init(&cmd->i_conn_node); iscsit_free_connection_recovery_entires()
142 cmd->conn = NULL; iscsit_free_connection_recovery_entires()
144 iscsit_free_cmd(cmd, true); iscsit_free_connection_recovery_entires()
160 list_for_each_entry_safe(cmd, cmd_tmp, iscsit_free_connection_recovery_entires()
163 list_del_init(&cmd->i_conn_node); iscsit_free_connection_recovery_entires()
164 cmd->conn = NULL; iscsit_free_connection_recovery_entires()
166 iscsit_free_cmd(cmd, true); iscsit_free_connection_recovery_entires()
207 struct iscsi_cmd *cmd, iscsit_remove_cmd_from_connection_recovery()
212 if (!cmd->cr) { iscsit_remove_cmd_from_connection_recovery()
214 " is NULL!\n", cmd->init_task_tag); iscsit_remove_cmd_from_connection_recovery()
217 cr = cmd->cr; iscsit_remove_cmd_from_connection_recovery()
219 list_del_init(&cmd->i_conn_node); iscsit_remove_cmd_from_connection_recovery()
228 struct iscsi_cmd *cmd, *cmd_tmp; iscsit_discard_cr_cmds_by_expstatsn() local
232 list_for_each_entry_safe(cmd, cmd_tmp, iscsit_discard_cr_cmds_by_expstatsn()
235 if (((cmd->deferred_i_state != ISTATE_SENT_STATUS) && iscsit_discard_cr_cmds_by_expstatsn()
236 (cmd->deferred_i_state != ISTATE_REMOVE)) || iscsit_discard_cr_cmds_by_expstatsn()
237 (cmd->stat_sn >= exp_statsn)) { iscsit_discard_cr_cmds_by_expstatsn()
243 " 0x%08x, CID: %hu.\n", cmd->init_task_tag, iscsit_discard_cr_cmds_by_expstatsn()
244 cmd->stat_sn, cr->cid); iscsit_discard_cr_cmds_by_expstatsn()
246 iscsit_remove_cmd_from_connection_recovery(cmd, sess); iscsit_discard_cr_cmds_by_expstatsn()
249 iscsit_free_cmd(cmd, true); iscsit_discard_cr_cmds_by_expstatsn()
276 struct iscsi_cmd *cmd, *cmd_tmp; iscsit_discard_unacknowledged_ooo_cmdsns_for_conn() local
296 list_for_each_entry_safe(cmd, cmd_tmp, &conn->conn_cmd_list, i_conn_node) { iscsit_discard_unacknowledged_ooo_cmdsns_for_conn()
297 if (!(cmd->cmd_flags & ICF_OOO_CMDSN)) iscsit_discard_unacknowledged_ooo_cmdsns_for_conn()
300 list_del_init(&cmd->i_conn_node); iscsit_discard_unacknowledged_ooo_cmdsns_for_conn()
303 iscsit_free_cmd(cmd, true); iscsit_discard_unacknowledged_ooo_cmdsns_for_conn()
317 struct iscsi_cmd *cmd, *cmd_tmp; iscsit_prepare_cmds_for_realligance() local
338 * list_del_init(&cmd->i_conn_node); to release the command to the iscsit_prepare_cmds_for_realligance()
345 list_for_each_entry_safe(cmd, cmd_tmp, &conn->conn_cmd_list, i_conn_node) { iscsit_prepare_cmds_for_realligance()
347 if ((cmd->iscsi_opcode != ISCSI_OP_SCSI_CMD) && iscsit_prepare_cmds_for_realligance()
348 (cmd->iscsi_opcode != ISCSI_OP_NOOP_OUT)) { iscsit_prepare_cmds_for_realligance()
351 " CID: %hu\n", cmd->iscsi_opcode, iscsit_prepare_cmds_for_realligance()
352 cmd->init_task_tag, cmd->cmd_sn, conn->cid); iscsit_prepare_cmds_for_realligance()
354 list_del_init(&cmd->i_conn_node); iscsit_prepare_cmds_for_realligance()
356 iscsit_free_cmd(cmd, true); iscsit_prepare_cmds_for_realligance()
372 if (!(cmd->cmd_flags & ICF_OOO_CMDSN) && !cmd->immediate_cmd && iscsit_prepare_cmds_for_realligance()
373 iscsi_sna_gte(cmd->cmd_sn, conn->sess->exp_cmd_sn)) { iscsit_prepare_cmds_for_realligance()
374 list_del_init(&cmd->i_conn_node); iscsit_prepare_cmds_for_realligance()
376 iscsit_free_cmd(cmd, true); iscsit_prepare_cmds_for_realligance()
384 " realligence.\n", cmd->iscsi_opcode, iscsit_prepare_cmds_for_realligance()
385 cmd->init_task_tag, cmd->cmd_sn, cmd->stat_sn, iscsit_prepare_cmds_for_realligance()
388 cmd->deferred_i_state = cmd->i_state; iscsit_prepare_cmds_for_realligance()
389 cmd->i_state = ISTATE_IN_CONNECTION_RECOVERY; iscsit_prepare_cmds_for_realligance()
391 if (cmd->data_direction == DMA_TO_DEVICE) iscsit_prepare_cmds_for_realligance()
392 iscsit_stop_dataout_timer(cmd); iscsit_prepare_cmds_for_realligance()
394 cmd->sess = conn->sess; iscsit_prepare_cmds_for_realligance()
396 list_del_init(&cmd->i_conn_node); iscsit_prepare_cmds_for_realligance()
399 iscsit_free_all_datain_reqs(cmd); iscsit_prepare_cmds_for_realligance()
401 transport_wait_for_tasks(&cmd->se_cmd); iscsit_prepare_cmds_for_realligance()
403 * Add the struct iscsi_cmd to the connection recovery cmd list iscsit_prepare_cmds_for_realligance()
406 list_add_tail(&cmd->i_conn_node, &cr->conn_recovery_cmd_list); iscsit_prepare_cmds_for_realligance()
410 cmd->cr = cr; iscsit_prepare_cmds_for_realligance()
411 cmd->conn = NULL; iscsit_prepare_cmds_for_realligance()
35 iscsit_create_conn_recovery_datain_values( struct iscsi_cmd *cmd, __be32 exp_data_sn) iscsit_create_conn_recovery_datain_values() argument
63 iscsit_create_conn_recovery_dataout_values( struct iscsi_cmd *cmd) iscsit_create_conn_recovery_dataout_values() argument
206 iscsit_remove_cmd_from_connection_recovery( struct iscsi_cmd *cmd, struct iscsi_session *sess) iscsit_remove_cmd_from_connection_recovery() argument
H A Discsi_target_erl0.c38 struct iscsi_cmd *cmd) iscsit_set_dataout_sequence_values()
40 struct iscsi_conn *conn = cmd->conn; iscsit_set_dataout_sequence_values()
45 if (cmd->unsolicited_data) { iscsit_set_dataout_sequence_values()
46 cmd->seq_start_offset = cmd->write_data_done; iscsit_set_dataout_sequence_values()
47 cmd->seq_end_offset = (cmd->write_data_done + iscsit_set_dataout_sequence_values()
48 ((cmd->se_cmd.data_length > iscsit_set_dataout_sequence_values()
50 conn->sess->sess_ops->FirstBurstLength : cmd->se_cmd.data_length)); iscsit_set_dataout_sequence_values()
57 if (!cmd->seq_start_offset && !cmd->seq_end_offset) { iscsit_set_dataout_sequence_values()
58 cmd->seq_start_offset = cmd->write_data_done; iscsit_set_dataout_sequence_values()
59 cmd->seq_end_offset = (cmd->se_cmd.data_length > iscsit_set_dataout_sequence_values()
61 (cmd->write_data_done + iscsit_set_dataout_sequence_values()
62 conn->sess->sess_ops->MaxBurstLength) : cmd->se_cmd.data_length; iscsit_set_dataout_sequence_values()
64 cmd->seq_start_offset = cmd->seq_end_offset; iscsit_set_dataout_sequence_values()
65 cmd->seq_end_offset = ((cmd->seq_end_offset + iscsit_set_dataout_sequence_values()
67 cmd->se_cmd.data_length) ? cmd->se_cmd.data_length : iscsit_set_dataout_sequence_values()
68 (cmd->seq_end_offset + iscsit_set_dataout_sequence_values()
74 struct iscsi_cmd *cmd, iscsit_dataout_within_command_recovery_check()
77 struct iscsi_conn *conn = cmd->conn; iscsit_dataout_within_command_recovery_check()
94 if ((cmd->cmd_flags & ICF_WITHIN_COMMAND_RECOVERY) && iscsit_dataout_within_command_recovery_check()
95 cmd->write_data_done != be32_to_cpu(hdr->offset)) iscsit_dataout_within_command_recovery_check()
98 cmd->cmd_flags &= ~ICF_WITHIN_COMMAND_RECOVERY; iscsit_dataout_within_command_recovery_check()
102 seq = iscsit_get_seq_holder(cmd, be32_to_cpu(hdr->offset), iscsit_dataout_within_command_recovery_check()
109 cmd->seq_ptr = seq; iscsit_dataout_within_command_recovery_check()
140 struct iscsi_cmd *cmd, iscsit_dataout_check_unsolicited_sequence()
144 struct iscsi_conn *conn = cmd->conn; iscsit_dataout_check_unsolicited_sequence()
149 if ((be32_to_cpu(hdr->offset) < cmd->seq_start_offset) || iscsit_dataout_check_unsolicited_sequence()
150 ((be32_to_cpu(hdr->offset) + payload_length) > cmd->seq_end_offset)) { iscsit_dataout_check_unsolicited_sequence()
153 " DataSequenceInOrder=Yes.\n", cmd->init_task_tag, iscsit_dataout_check_unsolicited_sequence()
154 be32_to_cpu(hdr->offset), payload_length, cmd->seq_start_offset, iscsit_dataout_check_unsolicited_sequence()
155 cmd->seq_end_offset); iscsit_dataout_check_unsolicited_sequence()
159 first_burst_len = (cmd->first_burst_len + payload_length); iscsit_dataout_check_unsolicited_sequence()
165 transport_send_check_condition_and_sense(&cmd->se_cmd, iscsit_dataout_check_unsolicited_sequence()
183 if ((first_burst_len != cmd->se_cmd.data_length) && iscsit_dataout_check_unsolicited_sequence()
189 cmd->se_cmd.data_length); iscsit_dataout_check_unsolicited_sequence()
190 transport_send_check_condition_and_sense(&cmd->se_cmd, iscsit_dataout_check_unsolicited_sequence()
198 " error.\n", cmd->init_task_tag, iscsit_dataout_check_unsolicited_sequence()
202 if (first_burst_len == cmd->se_cmd.data_length) { iscsit_dataout_check_unsolicited_sequence()
205 " error.\n", cmd->init_task_tag, cmd->se_cmd.data_length); iscsit_dataout_check_unsolicited_sequence()
215 struct iscsi_cmd *cmd, iscsit_dataout_check_sequence()
219 struct iscsi_conn *conn = cmd->conn; iscsit_dataout_check_sequence()
237 if ((be32_to_cpu(hdr->offset) < cmd->seq_start_offset) || iscsit_dataout_check_sequence()
238 ((be32_to_cpu(hdr->offset) + payload_length) > cmd->seq_end_offset)) { iscsit_dataout_check_sequence()
241 " DataSequenceInOrder=Yes.\n", cmd->init_task_tag, iscsit_dataout_check_sequence()
242 be32_to_cpu(hdr->offset), payload_length, cmd->seq_start_offset, iscsit_dataout_check_sequence()
243 cmd->seq_end_offset); iscsit_dataout_check_sequence()
250 next_burst_len = (cmd->next_burst_len + payload_length); iscsit_dataout_check_sequence()
252 seq = iscsit_get_seq_holder(cmd, be32_to_cpu(hdr->offset), iscsit_dataout_check_sequence()
259 cmd->seq_ptr = seq; iscsit_dataout_check_sequence()
273 " error.\n", cmd->init_task_tag, iscsit_dataout_check_sequence()
295 ((cmd->write_data_done + payload_length) < iscsit_dataout_check_sequence()
296 cmd->se_cmd.data_length)) { iscsit_dataout_check_sequence()
299 " error.\n", cmd->init_task_tag); iscsit_dataout_check_sequence()
306 " error.\n", cmd->init_task_tag); iscsit_dataout_check_sequence()
316 " not set, protocol error.", cmd->init_task_tag, iscsit_dataout_check_sequence()
320 if ((cmd->write_data_done + payload_length) == iscsit_dataout_check_sequence()
321 cmd->se_cmd.data_length) { iscsit_dataout_check_sequence()
325 cmd->init_task_tag); iscsit_dataout_check_sequence()
333 cmd->init_task_tag); iscsit_dataout_check_sequence()
344 struct iscsi_cmd *cmd, iscsit_dataout_check_datasn()
348 struct iscsi_conn *conn = cmd->conn; iscsit_dataout_check_datasn()
361 data_sn = cmd->data_sn; iscsit_dataout_check_datasn()
363 struct iscsi_seq *seq = cmd->seq_ptr; iscsit_dataout_check_datasn()
369 " higher than expected 0x%08x.\n", cmd->init_task_tag, iscsit_dataout_check_datasn()
375 cmd->init_task_tag, be32_to_cpu(hdr->datasn), data_sn); iscsit_dataout_check_datasn()
395 struct iscsi_cmd *cmd, iscsit_dataout_pre_datapduinorder_yes()
399 struct iscsi_conn *conn = cmd->conn; iscsit_dataout_pre_datapduinorder_yes()
413 if (be32_to_cpu(hdr->offset) != cmd->write_data_done) { iscsit_dataout_pre_datapduinorder_yes()
415 " %u different than expected %u.\n", cmd->init_task_tag, iscsit_dataout_pre_datapduinorder_yes()
416 be32_to_cpu(hdr->offset), cmd->write_data_done); iscsit_dataout_pre_datapduinorder_yes()
421 struct iscsi_seq *seq = cmd->seq_ptr; iscsit_dataout_pre_datapduinorder_yes()
425 " %u greater than expected %u.\n", cmd->init_task_tag, iscsit_dataout_pre_datapduinorder_yes()
432 cmd->init_task_tag, be32_to_cpu(hdr->offset), iscsit_dataout_pre_datapduinorder_yes()
451 return (recovery) ? iscsit_recover_dataout_sequence(cmd, iscsit_dataout_pre_datapduinorder_yes()
457 struct iscsi_cmd *cmd, iscsit_dataout_pre_datapduinorder_no()
464 pdu = iscsit_get_pdu_holder(cmd, be32_to_cpu(hdr->offset), iscsit_dataout_pre_datapduinorder_no()
469 cmd->pdu_ptr = pdu; iscsit_dataout_pre_datapduinorder_no()
478 " Offset: %u, Length: %u\n", cmd->init_task_tag, iscsit_dataout_pre_datapduinorder_no()
480 return iscsit_dump_data_payload(cmd->conn, payload_length, 1); iscsit_dataout_pre_datapduinorder_no()
488 static int iscsit_dataout_update_r2t(struct iscsi_cmd *cmd, u32 offset, u32 length) iscsit_dataout_update_r2t() argument
492 if (cmd->unsolicited_data) iscsit_dataout_update_r2t()
495 r2t = iscsit_get_r2t_for_eos(cmd, offset, length); iscsit_dataout_update_r2t()
499 spin_lock_bh(&cmd->r2t_lock); iscsit_dataout_update_r2t()
501 cmd->outstanding_r2ts--; iscsit_dataout_update_r2t()
502 spin_unlock_bh(&cmd->r2t_lock); iscsit_dataout_update_r2t()
508 struct iscsi_cmd *cmd, iscsit_dataout_update_datapduinorder_no()
513 struct iscsi_pdu *pdu = cmd->pdu_ptr; iscsit_dataout_update_datapduinorder_no()
532 ret = iscsit_dataout_datapduinorder_no_fbit(cmd, pdu); iscsit_dataout_update_datapduinorder_no()
541 struct iscsi_cmd *cmd, iscsit_dataout_post_crc_passed()
545 struct iscsi_conn *conn = cmd->conn; iscsit_dataout_post_crc_passed()
550 if (cmd->unsolicited_data) { iscsit_dataout_post_crc_passed()
551 if ((cmd->first_burst_len + payload_length) == iscsit_dataout_post_crc_passed()
553 if (iscsit_dataout_update_r2t(cmd, be32_to_cpu(hdr->offset), iscsit_dataout_post_crc_passed()
560 ret = iscsit_dataout_update_datapduinorder_no(cmd, iscsit_dataout_post_crc_passed()
567 cmd->first_burst_len += payload_length; iscsit_dataout_post_crc_passed()
570 cmd->data_sn++; iscsit_dataout_post_crc_passed()
572 seq = cmd->seq_ptr; iscsit_dataout_post_crc_passed()
580 cmd->first_burst_len = 0; iscsit_dataout_post_crc_passed()
581 cmd->unsolicited_data = 0; iscsit_dataout_post_crc_passed()
585 if ((cmd->next_burst_len + payload_length) == iscsit_dataout_post_crc_passed()
587 if (iscsit_dataout_update_r2t(cmd, iscsit_dataout_post_crc_passed()
596 cmd, be32_to_cpu(hdr->datasn), iscsit_dataout_post_crc_passed()
602 cmd->next_burst_len += payload_length; iscsit_dataout_post_crc_passed()
603 cmd->data_sn++; iscsit_dataout_post_crc_passed()
606 cmd->next_burst_len = 0; iscsit_dataout_post_crc_passed()
608 seq = cmd->seq_ptr; iscsit_dataout_post_crc_passed()
612 if (iscsit_dataout_update_r2t(cmd, iscsit_dataout_post_crc_passed()
621 cmd, be32_to_cpu(hdr->datasn), iscsit_dataout_post_crc_passed()
639 cmd->data_sn = 0; iscsit_dataout_post_crc_passed()
641 cmd->write_data_done += payload_length; iscsit_dataout_post_crc_passed()
643 if (cmd->write_data_done == cmd->se_cmd.data_length) iscsit_dataout_post_crc_passed()
652 struct iscsi_cmd *cmd, iscsit_dataout_post_crc_failed()
655 struct iscsi_conn *conn = cmd->conn; iscsit_dataout_post_crc_failed()
665 pdu = cmd->pdu_ptr; iscsit_dataout_post_crc_failed()
681 return iscsit_recover_dataout_sequence(cmd, be32_to_cpu(hdr->offset), iscsit_dataout_post_crc_failed()
690 struct iscsi_cmd *cmd, iscsit_check_pre_dataout()
694 struct iscsi_conn *conn = cmd->conn; iscsit_check_pre_dataout()
696 ret = iscsit_dataout_within_command_recovery_check(cmd, buf); iscsit_check_pre_dataout()
701 ret = iscsit_dataout_check_datasn(cmd, buf); iscsit_check_pre_dataout()
706 if (cmd->unsolicited_data) { iscsit_check_pre_dataout()
707 ret = iscsit_dataout_check_unsolicited_sequence(cmd, buf); iscsit_check_pre_dataout()
712 ret = iscsit_dataout_check_sequence(cmd, buf); iscsit_check_pre_dataout()
719 iscsit_dataout_pre_datapduinorder_yes(cmd, buf) : iscsit_check_pre_dataout()
720 iscsit_dataout_pre_datapduinorder_no(cmd, buf); iscsit_check_pre_dataout()
728 struct iscsi_cmd *cmd, iscsit_check_post_dataout()
732 struct iscsi_conn *conn = cmd->conn; iscsit_check_post_dataout()
734 cmd->dataout_timeout_retries = 0; iscsit_check_post_dataout()
737 return iscsit_dataout_post_crc_passed(cmd, buf); iscsit_check_post_dataout()
742 iscsit_reject_cmd(cmd, ISCSI_REASON_DATA_DIGEST_ERROR, iscsit_check_post_dataout()
747 iscsit_reject_cmd(cmd, ISCSI_REASON_DATA_DIGEST_ERROR, buf); iscsit_check_post_dataout()
748 return iscsit_dataout_post_crc_failed(cmd, buf); iscsit_check_post_dataout()
37 iscsit_set_dataout_sequence_values( struct iscsi_cmd *cmd) iscsit_set_dataout_sequence_values() argument
73 iscsit_dataout_within_command_recovery_check( struct iscsi_cmd *cmd, unsigned char *buf) iscsit_dataout_within_command_recovery_check() argument
139 iscsit_dataout_check_unsolicited_sequence( struct iscsi_cmd *cmd, unsigned char *buf) iscsit_dataout_check_unsolicited_sequence() argument
214 iscsit_dataout_check_sequence( struct iscsi_cmd *cmd, unsigned char *buf) iscsit_dataout_check_sequence() argument
343 iscsit_dataout_check_datasn( struct iscsi_cmd *cmd, unsigned char *buf) iscsit_dataout_check_datasn() argument
394 iscsit_dataout_pre_datapduinorder_yes( struct iscsi_cmd *cmd, unsigned char *buf) iscsit_dataout_pre_datapduinorder_yes() argument
456 iscsit_dataout_pre_datapduinorder_no( struct iscsi_cmd *cmd, unsigned char *buf) iscsit_dataout_pre_datapduinorder_no() argument
507 iscsit_dataout_update_datapduinorder_no( struct iscsi_cmd *cmd, u32 data_sn, int f_bit) iscsit_dataout_update_datapduinorder_no() argument
540 iscsit_dataout_post_crc_passed( struct iscsi_cmd *cmd, unsigned char *buf) iscsit_dataout_post_crc_passed() argument
651 iscsit_dataout_post_crc_failed( struct iscsi_cmd *cmd, unsigned char *buf) iscsit_dataout_post_crc_failed() argument
689 iscsit_check_pre_dataout( struct iscsi_cmd *cmd, unsigned char *buf) iscsit_check_pre_dataout() argument
727 iscsit_check_post_dataout( struct iscsi_cmd *cmd, unsigned char *buf, u8 data_crc_failed) iscsit_check_post_dataout() argument
H A Discsi_target_util.c59 * Called with cmd->r2t_lock held.
62 struct iscsi_cmd *cmd, iscsit_add_r2t_to_list()
78 r2t->r2t_sn = (!r2t_sn) ? cmd->r2t_sn++ : r2t_sn; iscsit_add_r2t_to_list()
81 list_add_tail(&r2t->r2t_list, &cmd->cmd_r2t_list); iscsit_add_r2t_to_list()
82 spin_unlock_bh(&cmd->r2t_lock); iscsit_add_r2t_to_list()
84 iscsit_add_cmd_to_immediate_queue(cmd, cmd->conn, ISTATE_SEND_R2T); iscsit_add_r2t_to_list()
86 spin_lock_bh(&cmd->r2t_lock); iscsit_add_r2t_to_list()
91 struct iscsi_cmd *cmd, iscsit_get_r2t_for_eos()
97 spin_lock_bh(&cmd->r2t_lock); iscsit_get_r2t_for_eos()
98 list_for_each_entry(r2t, &cmd->cmd_r2t_list, r2t_list) { iscsit_get_r2t_for_eos()
101 spin_unlock_bh(&cmd->r2t_lock); iscsit_get_r2t_for_eos()
105 spin_unlock_bh(&cmd->r2t_lock); iscsit_get_r2t_for_eos()
112 struct iscsi_r2t *iscsit_get_r2t_from_list(struct iscsi_cmd *cmd) iscsit_get_r2t_from_list() argument
116 spin_lock_bh(&cmd->r2t_lock); iscsit_get_r2t_from_list()
117 list_for_each_entry(r2t, &cmd->cmd_r2t_list, r2t_list) { iscsit_get_r2t_from_list()
119 spin_unlock_bh(&cmd->r2t_lock); iscsit_get_r2t_from_list()
123 spin_unlock_bh(&cmd->r2t_lock); iscsit_get_r2t_from_list()
126 " 0x%08x.\n", cmd->init_task_tag); iscsit_get_r2t_from_list()
131 * Called with cmd->r2t_lock held.
133 void iscsit_free_r2t(struct iscsi_r2t *r2t, struct iscsi_cmd *cmd) iscsit_free_r2t() argument
139 void iscsit_free_r2ts_from_list(struct iscsi_cmd *cmd) iscsit_free_r2ts_from_list() argument
143 spin_lock_bh(&cmd->r2t_lock); iscsit_free_r2ts_from_list()
144 list_for_each_entry_safe(r2t, r2t_tmp, &cmd->cmd_r2t_list, r2t_list) iscsit_free_r2ts_from_list()
145 iscsit_free_r2t(r2t, cmd); iscsit_free_r2ts_from_list()
146 spin_unlock_bh(&cmd->r2t_lock); iscsit_free_r2ts_from_list()
155 struct iscsi_cmd *cmd; iscsit_allocate_cmd() local
164 cmd = (struct iscsi_cmd *)(se_sess->sess_cmd_map + (tag * size)); iscsit_allocate_cmd()
165 memset(cmd, 0, size); iscsit_allocate_cmd()
167 cmd->se_cmd.map_tag = tag; iscsit_allocate_cmd()
168 cmd->conn = conn; iscsit_allocate_cmd()
169 INIT_LIST_HEAD(&cmd->i_conn_node); iscsit_allocate_cmd()
170 INIT_LIST_HEAD(&cmd->datain_list); iscsit_allocate_cmd()
171 INIT_LIST_HEAD(&cmd->cmd_r2t_list); iscsit_allocate_cmd()
172 spin_lock_init(&cmd->datain_lock); iscsit_allocate_cmd()
173 spin_lock_init(&cmd->dataout_timeout_lock); iscsit_allocate_cmd()
174 spin_lock_init(&cmd->istate_lock); iscsit_allocate_cmd()
175 spin_lock_init(&cmd->error_lock); iscsit_allocate_cmd()
176 spin_lock_init(&cmd->r2t_lock); iscsit_allocate_cmd()
178 return cmd; iscsit_allocate_cmd()
183 struct iscsi_cmd *cmd, iscsit_get_seq_holder_for_datain()
188 for (i = 0; i < cmd->seq_count; i++) iscsit_get_seq_holder_for_datain()
189 if (cmd->seq_list[i].seq_send_order == seq_send_order) iscsit_get_seq_holder_for_datain()
190 return &cmd->seq_list[i]; iscsit_get_seq_holder_for_datain()
195 struct iscsi_seq *iscsit_get_seq_holder_for_r2t(struct iscsi_cmd *cmd) iscsit_get_seq_holder_for_r2t() argument
199 if (!cmd->seq_list) { iscsit_get_seq_holder_for_r2t()
204 for (i = 0; i < cmd->seq_count; i++) { iscsit_get_seq_holder_for_r2t()
205 if (cmd->seq_list[i].type != SEQTYPE_NORMAL) iscsit_get_seq_holder_for_r2t()
207 if (cmd->seq_list[i].seq_send_order == cmd->seq_send_order) { iscsit_get_seq_holder_for_r2t()
208 cmd->seq_send_order++; iscsit_get_seq_holder_for_r2t()
209 return &cmd->seq_list[i]; iscsit_get_seq_holder_for_r2t()
217 struct iscsi_cmd *cmd, iscsit_get_holder_for_r2tsn()
222 spin_lock_bh(&cmd->r2t_lock); iscsit_get_holder_for_r2tsn()
223 list_for_each_entry(r2t, &cmd->cmd_r2t_list, r2t_list) { iscsit_get_holder_for_r2tsn()
225 spin_unlock_bh(&cmd->r2t_lock); iscsit_get_holder_for_r2tsn()
229 spin_unlock_bh(&cmd->r2t_lock); iscsit_get_holder_for_r2tsn()
278 int iscsit_sequence_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, iscsit_sequence_cmd() argument
290 ret = iscsit_execute_cmd(cmd, 0); iscsit_sequence_cmd()
299 ret = iscsit_handle_ooo_cmdsn(conn->sess, cmd, be32_to_cpu(cmdsn)); iscsit_sequence_cmd()
310 cmd->i_state = ISTATE_REMOVE; iscsit_sequence_cmd()
311 iscsit_add_cmd_to_immediate_queue(cmd, conn, cmd->i_state); iscsit_sequence_cmd()
323 iscsit_reject_cmd(cmd, reason, buf); iscsit_sequence_cmd()
329 int iscsit_check_unsolicited_dataout(struct iscsi_cmd *cmd, unsigned char *buf) iscsit_check_unsolicited_dataout() argument
331 struct iscsi_conn *conn = cmd->conn; iscsit_check_unsolicited_dataout()
332 struct se_cmd *se_cmd = &cmd->se_cmd; iscsit_check_unsolicited_dataout()
344 if ((cmd->first_burst_len + payload_length) > iscsit_check_unsolicited_dataout()
348 (cmd->first_burst_len + payload_length), iscsit_check_unsolicited_dataout()
358 if (((cmd->first_burst_len + payload_length) != cmd->se_cmd.data_length) && iscsit_check_unsolicited_dataout()
359 ((cmd->first_burst_len + payload_length) != iscsit_check_unsolicited_dataout()
364 (cmd->first_burst_len + payload_length), iscsit_check_unsolicited_dataout()
365 conn->sess->sess_ops->FirstBurstLength, cmd->se_cmd.data_length); iscsit_check_unsolicited_dataout()
377 struct iscsi_cmd *cmd; iscsit_find_cmd_from_itt() local
380 list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { iscsit_find_cmd_from_itt()
381 if (cmd->init_task_tag == init_task_tag) { iscsit_find_cmd_from_itt()
383 return cmd; iscsit_find_cmd_from_itt()
399 struct iscsi_cmd *cmd; iscsit_find_cmd_from_itt_or_dump() local
402 list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { iscsit_find_cmd_from_itt_or_dump()
403 if (cmd->cmd_flags & ICF_GOT_LAST_DATAOUT) iscsit_find_cmd_from_itt_or_dump()
405 if (cmd->init_task_tag == init_task_tag) { iscsit_find_cmd_from_itt_or_dump()
407 return cmd; iscsit_find_cmd_from_itt_or_dump()
424 struct iscsi_cmd *cmd = NULL; iscsit_find_cmd_from_ttt() local
427 list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { iscsit_find_cmd_from_ttt()
428 if (cmd->targ_xfer_tag == targ_xfer_tag) { iscsit_find_cmd_from_ttt()
430 return cmd; iscsit_find_cmd_from_ttt()
446 struct iscsi_cmd *cmd = NULL; iscsit_find_cmd_for_recovery() local
455 list_for_each_entry(cmd, &cr->conn_recovery_cmd_list, i_conn_node) { iscsit_find_cmd_for_recovery()
456 if (cmd->init_task_tag == init_task_tag) { iscsit_find_cmd_for_recovery()
461 *cmd_ptr = cmd; iscsit_find_cmd_for_recovery()
475 list_for_each_entry(cmd, &cr->conn_recovery_cmd_list, i_conn_node) { iscsit_find_cmd_for_recovery()
476 if (cmd->init_task_tag == init_task_tag) { iscsit_find_cmd_for_recovery()
481 *cmd_ptr = cmd; iscsit_find_cmd_for_recovery()
493 struct iscsi_cmd *cmd, iscsit_add_cmd_to_immediate_queue()
506 qr->cmd = cmd; iscsit_add_cmd_to_immediate_queue()
511 atomic_inc(&cmd->immed_queue_count); iscsit_add_cmd_to_immediate_queue()
531 if (qr->cmd) iscsit_get_cmd_from_immediate_queue()
532 atomic_dec(&qr->cmd->immed_queue_count); iscsit_get_cmd_from_immediate_queue()
539 struct iscsi_cmd *cmd, iscsit_remove_cmd_from_immediate_queue()
545 if (!atomic_read(&cmd->immed_queue_count)) { iscsit_remove_cmd_from_immediate_queue()
551 if (qr->cmd != cmd) iscsit_remove_cmd_from_immediate_queue()
554 atomic_dec(&qr->cmd->immed_queue_count); iscsit_remove_cmd_from_immediate_queue()
560 if (atomic_read(&cmd->immed_queue_count)) { iscsit_remove_cmd_from_immediate_queue()
562 cmd->init_task_tag, iscsit_remove_cmd_from_immediate_queue()
563 atomic_read(&cmd->immed_queue_count)); iscsit_remove_cmd_from_immediate_queue()
568 struct iscsi_cmd *cmd, iscsit_add_cmd_to_response_queue()
581 qr->cmd = cmd; iscsit_add_cmd_to_response_queue()
586 atomic_inc(&cmd->response_queue_count); iscsit_add_cmd_to_response_queue()
606 if (qr->cmd) iscsit_get_cmd_from_response_queue()
607 atomic_dec(&qr->cmd->response_queue_count); iscsit_get_cmd_from_response_queue()
614 struct iscsi_cmd *cmd, iscsit_remove_cmd_from_response_queue()
620 if (!atomic_read(&cmd->response_queue_count)) { iscsit_remove_cmd_from_response_queue()
627 if (qr->cmd != cmd) iscsit_remove_cmd_from_response_queue()
630 atomic_dec(&qr->cmd->response_queue_count); iscsit_remove_cmd_from_response_queue()
636 if (atomic_read(&cmd->response_queue_count)) { iscsit_remove_cmd_from_response_queue()
638 cmd->init_task_tag, iscsit_remove_cmd_from_response_queue()
639 atomic_read(&cmd->response_queue_count)); iscsit_remove_cmd_from_response_queue()
668 if (qr->cmd) iscsit_free_queue_reqs_for_conn()
669 atomic_dec(&qr->cmd->immed_queue_count); iscsit_free_queue_reqs_for_conn()
679 if (qr->cmd) iscsit_free_queue_reqs_for_conn()
680 atomic_dec(&qr->cmd->response_queue_count); iscsit_free_queue_reqs_for_conn()
687 void iscsit_release_cmd(struct iscsi_cmd *cmd) iscsit_release_cmd() argument
690 struct se_cmd *se_cmd = &cmd->se_cmd; iscsit_release_cmd()
692 if (cmd->conn) iscsit_release_cmd()
693 sess = cmd->conn->sess; iscsit_release_cmd()
695 sess = cmd->sess; iscsit_release_cmd()
699 kfree(cmd->buf_ptr); iscsit_release_cmd()
700 kfree(cmd->pdu_list); iscsit_release_cmd()
701 kfree(cmd->seq_list); iscsit_release_cmd()
702 kfree(cmd->tmr_req); iscsit_release_cmd()
703 kfree(cmd->iov_data); iscsit_release_cmd()
704 kfree(cmd->text_in_ptr); iscsit_release_cmd()
710 void __iscsit_free_cmd(struct iscsi_cmd *cmd, bool scsi_cmd, __iscsit_free_cmd() argument
713 struct iscsi_conn *conn = cmd->conn; __iscsit_free_cmd()
716 if (cmd->data_direction == DMA_TO_DEVICE) { __iscsit_free_cmd()
717 iscsit_stop_dataout_timer(cmd); __iscsit_free_cmd()
718 iscsit_free_r2ts_from_list(cmd); __iscsit_free_cmd()
720 if (cmd->data_direction == DMA_FROM_DEVICE) __iscsit_free_cmd()
721 iscsit_free_all_datain_reqs(cmd); __iscsit_free_cmd()
725 iscsit_remove_cmd_from_immediate_queue(cmd, conn); __iscsit_free_cmd()
726 iscsit_remove_cmd_from_response_queue(cmd, conn); __iscsit_free_cmd()
730 void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown) iscsit_free_cmd() argument
738 switch (cmd->iscsi_opcode) { iscsit_free_cmd()
740 se_cmd = &cmd->se_cmd; iscsit_free_cmd()
741 __iscsit_free_cmd(cmd, true, shutdown); iscsit_free_cmd()
746 rc = transport_generic_free_cmd(&cmd->se_cmd, shutdown); iscsit_free_cmd()
748 __iscsit_free_cmd(cmd, true, shutdown); iscsit_free_cmd()
756 * associated cmd->se_cmd needs to be released. iscsit_free_cmd()
758 if (cmd->se_cmd.se_tfo != NULL) { iscsit_free_cmd()
759 se_cmd = &cmd->se_cmd; iscsit_free_cmd()
760 __iscsit_free_cmd(cmd, true, shutdown); iscsit_free_cmd()
762 rc = transport_generic_free_cmd(&cmd->se_cmd, shutdown); iscsit_free_cmd()
764 __iscsit_free_cmd(cmd, true, shutdown); iscsit_free_cmd()
771 __iscsit_free_cmd(cmd, false, shutdown); iscsit_free_cmd()
772 iscsit_release_cmd(cmd); iscsit_free_cmd()
884 struct iscsi_cmd *cmd; iscsit_add_nopin() local
886 cmd = iscsit_allocate_cmd(conn, TASK_RUNNING); iscsit_add_nopin()
887 if (!cmd) iscsit_add_nopin()
890 cmd->iscsi_opcode = ISCSI_OP_NOOP_IN; iscsit_add_nopin()
893 cmd->init_task_tag = RESERVED_ITT; iscsit_add_nopin()
894 cmd->targ_xfer_tag = (want_response) ? iscsit_add_nopin()
897 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); iscsit_add_nopin()
902 iscsit_add_cmd_to_immediate_queue(cmd, conn, state); iscsit_add_nopin()
1101 struct iscsi_cmd *cmd, iscsit_send_tx_data()
1110 tx_size = cmd->tx_size; iscsit_send_tx_data()
1113 iov = &cmd->iov_data[0]; iscsit_send_tx_data()
1114 iov_count = cmd->iov_data_count; iscsit_send_tx_data()
1116 iov = &cmd->iov_misc[0]; iscsit_send_tx_data()
1117 iov_count = cmd->iov_misc_count; iscsit_send_tx_data()
1128 cmd->tx_size = 0; iscsit_send_tx_data()
1134 struct iscsi_cmd *cmd, iscsit_fe_sendpage_sg()
1137 struct scatterlist *sg = cmd->first_data_sg; iscsit_fe_sendpage_sg()
1140 u32 offset = cmd->first_data_sg_off; iscsit_fe_sendpage_sg()
1148 iov.iov_base = cmd->pdu; iscsit_fe_sendpage_sg()
1160 data_len = cmd->tx_size - tx_hdr_size - cmd->padding; iscsit_fe_sendpage_sg()
1163 * in order to determine proper offset into cmd->iov_data[] iscsit_fe_sendpage_sg()
1167 if (cmd->padding) iscsit_fe_sendpage_sg()
1168 iov_off = (cmd->iov_data_count - 2); iscsit_fe_sendpage_sg()
1170 iov_off = (cmd->iov_data_count - 1); iscsit_fe_sendpage_sg()
1172 iov_off = (cmd->iov_data_count - 1); iscsit_fe_sendpage_sg()
1201 if (cmd->padding) { iscsit_fe_sendpage_sg()
1202 struct kvec *iov_p = &cmd->iov_data[iov_off++]; iscsit_fe_sendpage_sg()
1204 tx_sent = tx_data(conn, iov_p, 1, cmd->padding); iscsit_fe_sendpage_sg()
1205 if (cmd->padding != tx_sent) { iscsit_fe_sendpage_sg()
1216 struct kvec *iov_d = &cmd->iov_data[iov_off]; iscsit_fe_sendpage_sg()
61 iscsit_add_r2t_to_list( struct iscsi_cmd *cmd, u32 offset, u32 xfer_len, int recovery, u32 r2t_sn) iscsit_add_r2t_to_list() argument
90 iscsit_get_r2t_for_eos( struct iscsi_cmd *cmd, u32 offset, u32 length) iscsit_get_r2t_for_eos() argument
182 iscsit_get_seq_holder_for_datain( struct iscsi_cmd *cmd, u32 seq_send_order) iscsit_get_seq_holder_for_datain() argument
216 iscsit_get_holder_for_r2tsn( struct iscsi_cmd *cmd, u32 r2t_sn) iscsit_get_holder_for_r2tsn() argument
492 iscsit_add_cmd_to_immediate_queue( struct iscsi_cmd *cmd, struct iscsi_conn *conn, u8 state) iscsit_add_cmd_to_immediate_queue() argument
538 iscsit_remove_cmd_from_immediate_queue( struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_remove_cmd_from_immediate_queue() argument
567 iscsit_add_cmd_to_response_queue( struct iscsi_cmd *cmd, struct iscsi_conn *conn, u8 state) iscsit_add_cmd_to_response_queue() argument
613 iscsit_remove_cmd_from_response_queue( struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_remove_cmd_from_response_queue() argument
1100 iscsit_send_tx_data( struct iscsi_cmd *cmd, struct iscsi_conn *conn, int use_misc) iscsit_send_tx_data() argument
1133 iscsit_fe_sendpage_sg( struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_fe_sendpage_sg() argument
H A Discsi_target.c484 static int iscsit_queue_rsp(struct iscsi_conn *conn, struct iscsi_cmd *cmd) iscsit_queue_rsp() argument
486 iscsit_add_cmd_to_response_queue(cmd, cmd->conn, cmd->i_state); iscsit_queue_rsp()
490 static void iscsit_aborted_task(struct iscsi_conn *conn, struct iscsi_cmd *cmd) iscsit_aborted_task() argument
492 bool scsi_cmd = (cmd->iscsi_opcode == ISCSI_OP_SCSI_CMD); iscsit_aborted_task()
495 if (!list_empty(&cmd->i_conn_node)) iscsit_aborted_task()
496 list_del_init(&cmd->i_conn_node); iscsit_aborted_task()
499 __iscsit_free_cmd(cmd, scsi_cmd, true); iscsit_aborted_task()
642 struct iscsi_cmd *cmd; iscsit_add_reject() local
644 cmd = iscsit_allocate_cmd(conn, TASK_INTERRUPTIBLE); iscsit_add_reject()
645 if (!cmd) iscsit_add_reject()
648 cmd->iscsi_opcode = ISCSI_OP_REJECT; iscsit_add_reject()
649 cmd->reject_reason = reason; iscsit_add_reject()
651 cmd->buf_ptr = kmemdup(buf, ISCSI_HDR_LEN, GFP_KERNEL); iscsit_add_reject()
652 if (!cmd->buf_ptr) { iscsit_add_reject()
653 pr_err("Unable to allocate memory for cmd->buf_ptr\n"); iscsit_add_reject()
654 iscsit_free_cmd(cmd, false); iscsit_add_reject()
659 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); iscsit_add_reject()
662 cmd->i_state = ISTATE_SEND_REJECT; iscsit_add_reject()
663 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_add_reject()
669 struct iscsi_cmd *cmd, iscsit_add_reject_from_cmd()
676 if (!cmd->conn) { iscsit_add_reject_from_cmd()
677 pr_err("cmd->conn is NULL for ITT: 0x%08x\n", iscsit_add_reject_from_cmd()
678 cmd->init_task_tag); iscsit_add_reject_from_cmd()
681 conn = cmd->conn; iscsit_add_reject_from_cmd()
683 cmd->iscsi_opcode = ISCSI_OP_REJECT; iscsit_add_reject_from_cmd()
684 cmd->reject_reason = reason; iscsit_add_reject_from_cmd()
686 cmd->buf_ptr = kmemdup(buf, ISCSI_HDR_LEN, GFP_KERNEL); iscsit_add_reject_from_cmd()
687 if (!cmd->buf_ptr) { iscsit_add_reject_from_cmd()
688 pr_err("Unable to allocate memory for cmd->buf_ptr\n"); iscsit_add_reject_from_cmd()
689 iscsit_free_cmd(cmd, false); iscsit_add_reject_from_cmd()
695 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); iscsit_add_reject_from_cmd()
699 cmd->i_state = ISTATE_SEND_REJECT; iscsit_add_reject_from_cmd()
700 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_add_reject_from_cmd()
705 if (cmd->se_cmd.se_tfo != NULL) { iscsit_add_reject_from_cmd()
707 target_put_sess_cmd(&cmd->se_cmd); iscsit_add_reject_from_cmd()
712 static int iscsit_add_reject_cmd(struct iscsi_cmd *cmd, u8 reason, iscsit_add_reject_cmd() argument
715 return iscsit_add_reject_from_cmd(cmd, reason, true, buf); iscsit_add_reject_cmd()
718 int iscsit_reject_cmd(struct iscsi_cmd *cmd, u8 reason, unsigned char *buf) iscsit_reject_cmd() argument
720 return iscsit_add_reject_from_cmd(cmd, reason, false, buf); iscsit_reject_cmd()
728 struct iscsi_cmd *cmd, iscsit_map_iovec()
740 sg = &cmd->se_cmd.t_data_sg[data_offset / PAGE_SIZE]; iscsit_map_iovec()
743 cmd->first_data_sg = sg; iscsit_map_iovec()
744 cmd->first_data_sg_off = page_off; iscsit_map_iovec()
758 cmd->kmapped_nents = i; iscsit_map_iovec()
763 static void iscsit_unmap_iovec(struct iscsi_cmd *cmd) iscsit_unmap_iovec() argument
768 sg = cmd->first_data_sg; iscsit_unmap_iovec()
770 for (i = 0; i < cmd->kmapped_nents; i++) iscsit_unmap_iovec()
777 struct iscsi_cmd *cmd, *cmd_p; iscsit_ack_from_expstatsn() local
785 list_for_each_entry_safe(cmd, cmd_p, &conn->conn_cmd_list, i_conn_node) { iscsit_ack_from_expstatsn()
786 spin_lock(&cmd->istate_lock); iscsit_ack_from_expstatsn()
787 if ((cmd->i_state == ISTATE_SENT_STATUS) && iscsit_ack_from_expstatsn()
788 iscsi_sna_lt(cmd->stat_sn, exp_statsn)) { iscsit_ack_from_expstatsn()
789 cmd->i_state = ISTATE_REMOVE; iscsit_ack_from_expstatsn()
790 spin_unlock(&cmd->istate_lock); iscsit_ack_from_expstatsn()
791 list_move_tail(&cmd->i_conn_node, &ack_list); iscsit_ack_from_expstatsn()
794 spin_unlock(&cmd->istate_lock); iscsit_ack_from_expstatsn()
798 list_for_each_entry_safe(cmd, cmd_p, &ack_list, i_conn_node) { iscsit_ack_from_expstatsn()
799 list_del_init(&cmd->i_conn_node); iscsit_ack_from_expstatsn()
800 iscsit_free_cmd(cmd, false); iscsit_ack_from_expstatsn()
804 static int iscsit_allocate_iovecs(struct iscsi_cmd *cmd) iscsit_allocate_iovecs() argument
806 u32 iov_count = max(1UL, DIV_ROUND_UP(cmd->se_cmd.data_length, PAGE_SIZE)); iscsit_allocate_iovecs()
810 cmd->iov_data = kzalloc(iov_count * sizeof(struct kvec), GFP_KERNEL); iscsit_allocate_iovecs()
811 if (!cmd->iov_data) { iscsit_allocate_iovecs()
812 pr_err("Unable to allocate cmd->iov_data\n"); iscsit_allocate_iovecs()
816 cmd->orig_iov_data_count = iov_count; iscsit_allocate_iovecs()
820 int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, iscsit_setup_scsi_cmd() argument
839 return iscsit_add_reject_cmd(cmd, iscsit_setup_scsi_cmd()
868 return iscsit_add_reject_cmd(cmd, iscsit_setup_scsi_cmd()
875 return iscsit_add_reject_cmd(cmd, iscsit_setup_scsi_cmd()
882 return iscsit_add_reject_cmd(cmd, iscsit_setup_scsi_cmd()
889 return iscsit_add_reject_cmd(cmd, iscsit_setup_scsi_cmd()
898 return iscsit_add_reject_cmd(cmd, iscsit_setup_scsi_cmd()
906 return iscsit_add_reject_cmd(cmd, iscsit_setup_scsi_cmd()
914 return iscsit_add_reject_cmd(cmd, iscsit_setup_scsi_cmd()
922 return iscsit_add_reject_cmd(cmd, iscsit_setup_scsi_cmd()
930 cmd->data_direction = data_direction; iscsit_setup_scsi_cmd()
950 cmd->iscsi_opcode = ISCSI_OP_SCSI_CMD; iscsit_setup_scsi_cmd()
951 cmd->i_state = ISTATE_NEW_CMD; iscsit_setup_scsi_cmd()
952 cmd->immediate_cmd = ((hdr->opcode & ISCSI_OP_IMMEDIATE) ? 1 : 0); iscsit_setup_scsi_cmd()
953 cmd->immediate_data = (payload_length) ? 1 : 0; iscsit_setup_scsi_cmd()
954 cmd->unsolicited_data = ((!(hdr->flags & ISCSI_FLAG_CMD_FINAL) && iscsit_setup_scsi_cmd()
956 if (cmd->unsolicited_data) iscsit_setup_scsi_cmd()
957 cmd->cmd_flags |= ICF_NON_IMMEDIATE_UNSOLICITED_DATA; iscsit_setup_scsi_cmd()
959 conn->sess->init_task_tag = cmd->init_task_tag = hdr->itt; iscsit_setup_scsi_cmd()
961 cmd->targ_xfer_tag = session_get_next_ttt(conn->sess); iscsit_setup_scsi_cmd()
963 cmd->targ_xfer_tag = 0xFFFFFFFF; iscsit_setup_scsi_cmd()
964 cmd->cmd_sn = be32_to_cpu(hdr->cmdsn); iscsit_setup_scsi_cmd()
965 cmd->exp_stat_sn = be32_to_cpu(hdr->exp_statsn); iscsit_setup_scsi_cmd()
966 cmd->first_burst_len = payload_length; iscsit_setup_scsi_cmd()
969 cmd->data_direction == DMA_FROM_DEVICE) { iscsit_setup_scsi_cmd()
974 return iscsit_add_reject_cmd(cmd, iscsit_setup_scsi_cmd()
977 iscsit_attach_datain_req(cmd, dr); iscsit_setup_scsi_cmd()
983 transport_init_se_cmd(&cmd->se_cmd, &iscsi_ops, iscsit_setup_scsi_cmd()
985 cmd->data_direction, sam_task_attr, iscsit_setup_scsi_cmd()
986 cmd->sense_buffer + 2); iscsit_setup_scsi_cmd()
993 target_get_sess_cmd(&cmd->se_cmd, true); iscsit_setup_scsi_cmd()
995 cmd->sense_reason = transport_lookup_cmd_lun(&cmd->se_cmd, iscsit_setup_scsi_cmd()
997 if (cmd->sense_reason) iscsit_setup_scsi_cmd()
1001 cmd->se_cmd.tag = (__force u32)cmd->init_task_tag; iscsit_setup_scsi_cmd()
1002 cmd->sense_reason = target_setup_cmd_from_cdb(&cmd->se_cmd, hdr->cdb); iscsit_setup_scsi_cmd()
1003 if (cmd->sense_reason) { iscsit_setup_scsi_cmd()
1004 if (cmd->sense_reason == TCM_OUT_OF_RESOURCES) { iscsit_setup_scsi_cmd()
1005 return iscsit_add_reject_cmd(cmd, iscsit_setup_scsi_cmd()
1012 if (iscsit_build_pdu_and_seq_lists(cmd, payload_length) < 0) { iscsit_setup_scsi_cmd()
1013 return iscsit_add_reject_cmd(cmd, iscsit_setup_scsi_cmd()
1019 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); iscsit_setup_scsi_cmd()
1025 core_alua_check_nonop_delay(&cmd->se_cmd); iscsit_setup_scsi_cmd()
1031 void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *cmd) iscsit_set_unsoliticed_dataout() argument
1033 iscsit_set_dataout_sequence_values(cmd); iscsit_set_unsoliticed_dataout()
1035 spin_lock_bh(&cmd->dataout_timeout_lock); iscsit_set_unsoliticed_dataout()
1036 iscsit_start_dataout_timer(cmd, cmd->conn); iscsit_set_unsoliticed_dataout()
1037 spin_unlock_bh(&cmd->dataout_timeout_lock); iscsit_set_unsoliticed_dataout()
1041 int iscsit_process_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, iscsit_process_scsi_cmd() argument
1055 if (!cmd->immediate_data) { iscsit_process_scsi_cmd()
1056 cmdsn_ret = iscsit_sequence_cmd(conn, cmd, iscsit_process_scsi_cmd()
1061 target_put_sess_cmd(&cmd->se_cmd); iscsit_process_scsi_cmd()
1071 if (!cmd->immediate_data) { iscsit_process_scsi_cmd()
1072 if (!cmd->sense_reason && cmd->unsolicited_data) iscsit_process_scsi_cmd()
1073 iscsit_set_unsoliticed_dataout(cmd); iscsit_process_scsi_cmd()
1074 if (!cmd->sense_reason) iscsit_process_scsi_cmd()
1077 target_put_sess_cmd(&cmd->se_cmd); iscsit_process_scsi_cmd()
1086 if (cmd->sense_reason) { iscsit_process_scsi_cmd()
1087 if (cmd->reject_reason) iscsit_process_scsi_cmd()
1096 cmd->sense_reason = transport_generic_new_cmd(&cmd->se_cmd); iscsit_process_scsi_cmd()
1097 if (cmd->sense_reason) iscsit_process_scsi_cmd()
1105 iscsit_get_immediate_data(struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr, iscsit_get_immediate_data() argument
1115 immed_ret = iscsit_handle_immediate_data(cmd, hdr, iscsit_get_immediate_data()
1116 cmd->first_burst_len); iscsit_get_immediate_data()
1124 cmdsn_ret = iscsit_sequence_cmd(cmd->conn, cmd, iscsit_get_immediate_data()
1129 if (cmd->sense_reason || cmdsn_ret == CMDSN_LOWER_THAN_EXP) { iscsit_get_immediate_data()
1132 rc = iscsit_dump_data_payload(cmd->conn, iscsit_get_immediate_data()
1133 cmd->first_burst_len, 1); iscsit_get_immediate_data()
1134 target_put_sess_cmd(&cmd->se_cmd); iscsit_get_immediate_data()
1136 } else if (cmd->unsolicited_data) iscsit_get_immediate_data()
1137 iscsit_set_unsoliticed_dataout(cmd); iscsit_get_immediate_data()
1151 cmd->i_state = ISTATE_REMOVE; iscsit_get_immediate_data()
1152 iscsit_add_cmd_to_immediate_queue(cmd, cmd->conn, cmd->i_state); iscsit_get_immediate_data()
1160 iscsit_handle_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, iscsit_handle_scsi_cmd() argument
1167 rc = iscsit_setup_scsi_cmd(conn, cmd, buf); iscsit_handle_scsi_cmd()
1174 if (iscsit_allocate_iovecs(cmd) < 0) { iscsit_handle_scsi_cmd()
1175 return iscsit_reject_cmd(cmd, iscsit_handle_scsi_cmd()
1178 immed_data = cmd->immediate_data; iscsit_handle_scsi_cmd()
1180 rc = iscsit_process_scsi_cmd(conn, cmd, hdr); iscsit_handle_scsi_cmd()
1189 return iscsit_get_immediate_data(cmd, hdr, dump_payload); iscsit_handle_scsi_cmd()
1194 struct iscsi_cmd *cmd, iscsit_do_crypto_hash_sg()
1206 sg = cmd->first_data_sg; iscsit_do_crypto_hash_sg()
1207 page_off = cmd->first_data_sg_off; iscsit_do_crypto_hash_sg()
1258 struct iscsi_cmd *cmd = NULL; iscsit_check_dataout_hdr() local
1279 cmd = iscsit_find_cmd_from_itt_or_dump(conn, hdr->itt, iscsit_check_dataout_hdr()
1281 if (!cmd) iscsit_check_dataout_hdr()
1289 if (cmd->cmd_flags & ICF_GOT_LAST_DATAOUT) { iscsit_check_dataout_hdr()
1292 cmd->init_task_tag); iscsit_check_dataout_hdr()
1296 if (cmd->data_direction != DMA_TO_DEVICE) { iscsit_check_dataout_hdr()
1298 " NON-WRITE command.\n", cmd->init_task_tag); iscsit_check_dataout_hdr()
1301 se_cmd = &cmd->se_cmd; iscsit_check_dataout_hdr()
1302 iscsit_mod_dataout_timer(cmd); iscsit_check_dataout_hdr()
1304 if ((be32_to_cpu(hdr->offset) + payload_length) > cmd->se_cmd.data_length) { iscsit_check_dataout_hdr()
1307 hdr->offset, payload_length, cmd->se_cmd.data_length); iscsit_check_dataout_hdr()
1308 return iscsit_reject_cmd(cmd, ISCSI_REASON_BOOKMARK_INVALID, buf); iscsit_check_dataout_hdr()
1311 if (cmd->unsolicited_data) { iscsit_check_dataout_hdr()
1317 transport_send_check_condition_and_sense(&cmd->se_cmd, iscsit_check_dataout_hdr()
1339 iscsit_stop_dataout_timer(cmd); iscsit_check_dataout_hdr()
1358 if (--cmd->outstanding_r2ts < 1) { iscsit_check_dataout_hdr()
1359 iscsit_stop_dataout_timer(cmd); iscsit_check_dataout_hdr()
1371 rc = iscsit_check_pre_dataout(cmd, buf); iscsit_check_dataout_hdr()
1377 *out_cmd = cmd; iscsit_check_dataout_hdr()
1383 iscsit_get_dataout(struct iscsi_conn *conn, struct iscsi_cmd *cmd, iscsit_get_dataout() argument
1392 iov = &cmd->iov_data[0]; iscsit_get_dataout()
1394 iov_ret = iscsit_map_iovec(cmd, iov, be32_to_cpu(hdr->offset), iscsit_get_dataout()
1403 iov[iov_count].iov_base = cmd->pad_bytes; iscsit_get_dataout()
1415 rx_got = rx_data(conn, &cmd->iov_data[0], iov_count, rx_size); iscsit_get_dataout()
1417 iscsit_unmap_iovec(cmd); iscsit_get_dataout()
1425 data_crc = iscsit_do_crypto_hash_sg(&conn->conn_rx_hash, cmd, iscsit_get_dataout()
1428 cmd->pad_bytes); iscsit_get_dataout()
1448 iscsit_check_dataout_payload(struct iscsi_cmd *cmd, struct iscsi_data *hdr, iscsit_check_dataout_payload() argument
1451 struct iscsi_conn *conn = cmd->conn; iscsit_check_dataout_payload()
1457 rc = iscsit_check_post_dataout(cmd, (unsigned char *)hdr, data_crc_failed); iscsit_check_dataout_payload()
1461 iscsit_set_dataout_sequence_values(cmd); iscsit_check_dataout_payload()
1462 conn->conn_transport->iscsit_get_dataout(conn, cmd, false); iscsit_check_dataout_payload()
1468 spin_lock_bh(&cmd->istate_lock); iscsit_check_dataout_payload()
1469 ooo_cmdsn = (cmd->cmd_flags & ICF_OOO_CMDSN); iscsit_check_dataout_payload()
1470 cmd->cmd_flags |= ICF_GOT_LAST_DATAOUT; iscsit_check_dataout_payload()
1471 cmd->i_state = ISTATE_RECEIVED_LAST_DATAOUT; iscsit_check_dataout_payload()
1472 spin_unlock_bh(&cmd->istate_lock); iscsit_check_dataout_payload()
1474 iscsit_stop_dataout_timer(cmd); iscsit_check_dataout_payload()
1477 target_execute_cmd(&cmd->se_cmd); iscsit_check_dataout_payload()
1488 struct iscsi_cmd *cmd = NULL; iscsit_handle_data_out() local
1493 rc = iscsit_check_dataout_hdr(conn, buf, &cmd); iscsit_handle_data_out()
1496 else if (!cmd) iscsit_handle_data_out()
1499 rc = iscsit_get_dataout(conn, cmd, hdr); iscsit_handle_data_out()
1505 return iscsit_check_dataout_payload(cmd, hdr, data_crc_failed); iscsit_handle_data_out()
1508 int iscsit_setup_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd, iscsit_setup_nop_out() argument
1515 if (!cmd) iscsit_setup_nop_out()
1519 return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, iscsit_setup_nop_out()
1526 if (!cmd) iscsit_setup_nop_out()
1530 return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, iscsit_setup_nop_out()
1539 if (!cmd) iscsit_setup_nop_out()
1543 return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, iscsit_setup_nop_out()
1560 cmd->iscsi_opcode = ISCSI_OP_NOOP_OUT; iscsit_setup_nop_out()
1561 cmd->i_state = ISTATE_SEND_NOPIN; iscsit_setup_nop_out()
1562 cmd->immediate_cmd = ((hdr->opcode & ISCSI_OP_IMMEDIATE) ? iscsit_setup_nop_out()
1564 conn->sess->init_task_tag = cmd->init_task_tag = hdr->itt; iscsit_setup_nop_out()
1565 cmd->targ_xfer_tag = 0xFFFFFFFF; iscsit_setup_nop_out()
1566 cmd->cmd_sn = be32_to_cpu(hdr->cmdsn); iscsit_setup_nop_out()
1567 cmd->exp_stat_sn = be32_to_cpu(hdr->exp_statsn); iscsit_setup_nop_out()
1568 cmd->data_direction = DMA_NONE; iscsit_setup_nop_out()
1575 int iscsit_process_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd, iscsit_process_nop_out() argument
1584 if (!cmd) iscsit_process_nop_out()
1589 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); iscsit_process_nop_out()
1595 iscsit_add_cmd_to_response_queue(cmd, conn, iscsit_process_nop_out()
1596 cmd->i_state); iscsit_process_nop_out()
1600 cmdsn_ret = iscsit_sequence_cmd(conn, cmd, iscsit_process_nop_out()
1633 static int iscsit_handle_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd, iscsit_handle_nop_out() argument
1642 ret = iscsit_setup_nop_out(conn, cmd, hdr); iscsit_handle_nop_out()
1660 iov = &cmd->iov_misc[0]; iscsit_handle_nop_out()
1668 iov[niov].iov_base = &cmd->pad_bytes; iscsit_handle_nop_out()
1678 rx_got = rx_data(conn, &cmd->iov_misc[0], niov, rx_size); iscsit_handle_nop_out()
1687 padding, cmd->pad_bytes, iscsit_handle_nop_out()
1722 cmd->buf_ptr = ping_data; iscsit_handle_nop_out()
1723 cmd->buf_ptr_size = payload_length; iscsit_handle_nop_out()
1730 return iscsit_process_nop_out(conn, cmd, hdr); iscsit_handle_nop_out()
1732 if (cmd) iscsit_handle_nop_out()
1733 iscsit_free_cmd(cmd, false); iscsit_handle_nop_out()
1740 iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, iscsit_handle_task_mgt_cmd() argument
1771 return iscsit_add_reject_cmd(cmd, iscsit_handle_task_mgt_cmd()
1778 cmd->data_direction = DMA_NONE; iscsit_handle_task_mgt_cmd()
1780 cmd->tmr_req = kzalloc(sizeof(struct iscsi_tmr_req), GFP_KERNEL); iscsit_handle_task_mgt_cmd()
1781 if (!cmd->tmr_req) { iscsit_handle_task_mgt_cmd()
1784 return iscsit_add_reject_cmd(cmd, iscsit_handle_task_mgt_cmd()
1798 transport_init_se_cmd(&cmd->se_cmd, &iscsi_ops, iscsit_handle_task_mgt_cmd()
1800 TCM_SIMPLE_TAG, cmd->sense_buffer + 2); iscsit_handle_task_mgt_cmd()
1802 target_get_sess_cmd(&cmd->se_cmd, true); iscsit_handle_task_mgt_cmd()
1830 return iscsit_add_reject_cmd(cmd, iscsit_handle_task_mgt_cmd()
1834 ret = core_tmr_alloc_req(&cmd->se_cmd, cmd->tmr_req, iscsit_handle_task_mgt_cmd()
1837 return iscsit_add_reject_cmd(cmd, iscsit_handle_task_mgt_cmd()
1840 cmd->tmr_req->se_tmr_req = cmd->se_cmd.se_tmr_req; iscsit_handle_task_mgt_cmd()
1843 cmd->iscsi_opcode = ISCSI_OP_SCSI_TMFUNC; iscsit_handle_task_mgt_cmd()
1844 cmd->i_state = ISTATE_SEND_TASKMGTRSP; iscsit_handle_task_mgt_cmd()
1845 cmd->immediate_cmd = ((hdr->opcode & ISCSI_OP_IMMEDIATE) ? 1 : 0); iscsit_handle_task_mgt_cmd()
1846 cmd->init_task_tag = hdr->itt; iscsit_handle_task_mgt_cmd()
1847 cmd->targ_xfer_tag = 0xFFFFFFFF; iscsit_handle_task_mgt_cmd()
1848 cmd->cmd_sn = be32_to_cpu(hdr->cmdsn); iscsit_handle_task_mgt_cmd()
1849 cmd->exp_stat_sn = be32_to_cpu(hdr->exp_statsn); iscsit_handle_task_mgt_cmd()
1850 se_tmr = cmd->se_cmd.se_tmr_req; iscsit_handle_task_mgt_cmd()
1851 tmr_req = cmd->tmr_req; iscsit_handle_task_mgt_cmd()
1856 ret = transport_lookup_tmr_lun(&cmd->se_cmd, iscsit_handle_task_mgt_cmd()
1866 se_tmr->response = iscsit_tmr_abort_task(cmd, buf); iscsit_handle_task_mgt_cmd()
1888 se_tmr->response = iscsit_tmr_task_reassign(cmd, buf); iscsit_handle_task_mgt_cmd()
1897 return iscsit_add_reject_cmd(cmd, iscsit_handle_task_mgt_cmd()
1912 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); iscsit_handle_task_mgt_cmd()
1916 int cmdsn_ret = iscsit_sequence_cmd(conn, cmd, buf, hdr->cmdsn); iscsit_handle_task_mgt_cmd()
1932 return transport_generic_handle_tmr(&cmd->se_cmd); iscsit_handle_task_mgt_cmd()
1944 target_put_sess_cmd(&cmd->se_cmd); iscsit_handle_task_mgt_cmd()
1947 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_handle_task_mgt_cmd()
1954 iscsit_setup_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, iscsit_setup_text_cmd() argument
1963 return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, iscsit_setup_text_cmd()
1970 return iscsit_reject_cmd(cmd, ISCSI_REASON_CMD_NOT_SUPPORTED, iscsit_setup_text_cmd()
1978 cmd->iscsi_opcode = ISCSI_OP_TEXT; iscsit_setup_text_cmd()
1979 cmd->i_state = ISTATE_SEND_TEXTRSP; iscsit_setup_text_cmd()
1980 cmd->immediate_cmd = ((hdr->opcode & ISCSI_OP_IMMEDIATE) ? 1 : 0); iscsit_setup_text_cmd()
1981 conn->sess->init_task_tag = cmd->init_task_tag = hdr->itt; iscsit_setup_text_cmd()
1982 cmd->targ_xfer_tag = 0xFFFFFFFF; iscsit_setup_text_cmd()
1983 cmd->cmd_sn = be32_to_cpu(hdr->cmdsn); iscsit_setup_text_cmd()
1984 cmd->exp_stat_sn = be32_to_cpu(hdr->exp_statsn); iscsit_setup_text_cmd()
1985 cmd->data_direction = DMA_NONE; iscsit_setup_text_cmd()
1986 cmd->text_in_ptr = NULL; iscsit_setup_text_cmd()
1993 iscsit_process_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, iscsit_process_text_cmd() argument
1996 unsigned char *text_in = cmd->text_in_ptr, *text_ptr; iscsit_process_text_cmd()
2000 cmd->targ_xfer_tag = be32_to_cpu(hdr->ttt); iscsit_process_text_cmd()
2001 if (cmd->targ_xfer_tag == 0xFFFFFFFF) { iscsit_process_text_cmd()
2020 cmd->cmd_flags |= ICF_SENDTARGETS_ALL; iscsit_process_text_cmd()
2023 cmd->cmd_flags |= ICF_SENDTARGETS_SINGLE; iscsit_process_text_cmd()
2030 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); iscsit_process_text_cmd()
2037 cmdsn_ret = iscsit_sequence_cmd(conn, cmd, iscsit_process_text_cmd()
2045 return iscsit_execute_cmd(cmd, 0); iscsit_process_text_cmd()
2048 return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, iscsit_process_text_cmd()
2054 iscsit_handle_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, iscsit_handle_text_cmd() argument
2062 rc = iscsit_setup_text_cmd(conn, cmd, hdr); iscsit_handle_text_cmd()
2079 cmd->text_in_ptr = text_in; iscsit_handle_text_cmd()
2140 return iscsit_process_text_cmd(conn, cmd, hdr); iscsit_handle_text_cmd()
2143 kfree(cmd->text_in_ptr); iscsit_handle_text_cmd()
2144 cmd->text_in_ptr = NULL; iscsit_handle_text_cmd()
2145 return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf); iscsit_handle_text_cmd()
2148 int iscsit_logout_closesession(struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_logout_closesession() argument
2173 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_logout_closesession()
2178 int iscsit_logout_closeconnection(struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_logout_closeconnection() argument
2184 " %hu on CID: %hu.\n", cmd->logout_cid, conn->cid); iscsit_logout_closeconnection()
2190 if (conn->cid == cmd->logout_cid) { iscsit_logout_closeconnection()
2210 cmd->logout_cid); iscsit_logout_closeconnection()
2212 cmd->logout_response = ISCSI_LOGOUT_CID_NOT_FOUND; iscsit_logout_closeconnection()
2213 iscsit_add_cmd_to_response_queue(cmd, conn, iscsit_logout_closeconnection()
2214 cmd->i_state); iscsit_logout_closeconnection()
2221 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_logout_closeconnection()
2226 int iscsit_logout_removeconnforrecovery(struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_logout_removeconnforrecovery() argument
2231 " CID: %hu on CID: %hu.\n", cmd->logout_cid, conn->cid); iscsit_logout_removeconnforrecovery()
2236 cmd->logout_response = ISCSI_LOGOUT_RECOVERY_UNSUPPORTED; iscsit_logout_removeconnforrecovery()
2237 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_logout_removeconnforrecovery()
2241 if (conn->cid == cmd->logout_cid) { iscsit_logout_removeconnforrecovery()
2244 cmd->logout_cid, conn->cid); iscsit_logout_removeconnforrecovery()
2245 cmd->logout_response = ISCSI_LOGOUT_CLEANUP_FAILED; iscsit_logout_removeconnforrecovery()
2246 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_logout_removeconnforrecovery()
2250 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_logout_removeconnforrecovery()
2256 iscsit_handle_logout_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, iscsit_handle_logout_cmd() argument
2284 iscsit_free_cmd(cmd, false); iscsit_handle_logout_cmd()
2288 cmd->iscsi_opcode = ISCSI_OP_LOGOUT; iscsit_handle_logout_cmd()
2289 cmd->i_state = ISTATE_SEND_LOGOUTRSP; iscsit_handle_logout_cmd()
2290 cmd->immediate_cmd = ((hdr->opcode & ISCSI_OP_IMMEDIATE) ? 1 : 0); iscsit_handle_logout_cmd()
2291 conn->sess->init_task_tag = cmd->init_task_tag = hdr->itt; iscsit_handle_logout_cmd()
2292 cmd->targ_xfer_tag = 0xFFFFFFFF; iscsit_handle_logout_cmd()
2293 cmd->cmd_sn = be32_to_cpu(hdr->cmdsn); iscsit_handle_logout_cmd()
2294 cmd->exp_stat_sn = be32_to_cpu(hdr->exp_statsn); iscsit_handle_logout_cmd()
2295 cmd->logout_cid = be16_to_cpu(hdr->cid); iscsit_handle_logout_cmd()
2296 cmd->logout_reason = reason_code; iscsit_handle_logout_cmd()
2297 cmd->data_direction = DMA_NONE; iscsit_handle_logout_cmd()
2309 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); iscsit_handle_logout_cmd()
2319 if (cmd->immediate_cmd) { iscsit_handle_logout_cmd()
2320 int ret = iscsit_execute_cmd(cmd, 0); iscsit_handle_logout_cmd()
2325 cmdsn_ret = iscsit_sequence_cmd(conn, cmd, buf, hdr->cmdsn); iscsit_handle_logout_cmd()
2401 struct iscsi_cmd *cmd, iscsit_handle_immediate_data()
2407 struct iscsi_conn *conn = cmd->conn; iscsit_handle_immediate_data()
2410 iov_ret = iscsit_map_iovec(cmd, cmd->iov_data, cmd->write_data_done, length); iscsit_handle_immediate_data()
2416 iov = &cmd->iov_data[0]; iscsit_handle_immediate_data()
2420 iov[iov_count].iov_base = cmd->pad_bytes; iscsit_handle_immediate_data()
2431 rx_got = rx_data(conn, &cmd->iov_data[0], iov_count, rx_size); iscsit_handle_immediate_data()
2433 iscsit_unmap_iovec(cmd); iscsit_handle_immediate_data()
2443 data_crc = iscsit_do_crypto_hash_sg(&conn->conn_rx_hash, cmd, iscsit_handle_immediate_data()
2444 cmd->write_data_done, length, padding, iscsit_handle_immediate_data()
2445 cmd->pad_bytes); iscsit_handle_immediate_data()
2456 iscsit_reject_cmd(cmd, iscsit_handle_immediate_data()
2461 iscsit_reject_cmd(cmd, iscsit_handle_immediate_data()
2473 cmd->write_data_done += length; iscsit_handle_immediate_data()
2475 if (cmd->write_data_done == cmd->se_cmd.data_length) { iscsit_handle_immediate_data()
2476 spin_lock_bh(&cmd->istate_lock); iscsit_handle_immediate_data()
2477 cmd->cmd_flags |= ICF_GOT_LAST_DATAOUT; iscsit_handle_immediate_data()
2478 cmd->i_state = ISTATE_RECEIVED_LAST_DATAOUT; iscsit_handle_immediate_data()
2479 spin_unlock_bh(&cmd->istate_lock); iscsit_handle_immediate_data()
2492 struct iscsi_cmd *cmd; iscsit_build_conn_drop_async_message() local
2511 cmd = iscsit_allocate_cmd(conn_p, TASK_RUNNING); iscsit_build_conn_drop_async_message()
2512 if (!cmd) { iscsit_build_conn_drop_async_message()
2517 cmd->logout_cid = conn->cid; iscsit_build_conn_drop_async_message()
2518 cmd->iscsi_opcode = ISCSI_OP_ASYNC_EVENT; iscsit_build_conn_drop_async_message()
2519 cmd->i_state = ISTATE_SEND_ASYNCMSG; iscsit_build_conn_drop_async_message()
2522 list_add_tail(&cmd->i_conn_node, &conn_p->conn_cmd_list); iscsit_build_conn_drop_async_message()
2525 iscsit_add_cmd_to_response_queue(cmd, conn_p, cmd->i_state); iscsit_build_conn_drop_async_message()
2530 struct iscsi_cmd *cmd, iscsit_send_conn_drop_async_message()
2535 cmd->tx_size = ISCSI_HDR_LEN; iscsit_send_conn_drop_async_message()
2536 cmd->iscsi_opcode = ISCSI_OP_ASYNC_EVENT; iscsit_send_conn_drop_async_message()
2538 hdr = (struct iscsi_async *) cmd->pdu; iscsit_send_conn_drop_async_message()
2541 cmd->init_task_tag = RESERVED_ITT; iscsit_send_conn_drop_async_message()
2542 cmd->targ_xfer_tag = 0xFFFFFFFF; iscsit_send_conn_drop_async_message()
2544 cmd->stat_sn = conn->stat_sn++; iscsit_send_conn_drop_async_message()
2545 hdr->statsn = cpu_to_be32(cmd->stat_sn); iscsit_send_conn_drop_async_message()
2549 hdr->param1 = cpu_to_be16(cmd->logout_cid); iscsit_send_conn_drop_async_message()
2554 u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; iscsit_send_conn_drop_async_message()
2559 cmd->tx_size += ISCSI_CRC_LEN; iscsit_send_conn_drop_async_message()
2564 cmd->iov_misc[0].iov_base = cmd->pdu; iscsit_send_conn_drop_async_message()
2565 cmd->iov_misc[0].iov_len = cmd->tx_size; iscsit_send_conn_drop_async_message()
2566 cmd->iov_misc_count = 1; iscsit_send_conn_drop_async_message()
2569 " 0x%08x, for CID: %hu on CID: %hu\n", cmd->stat_sn, iscsit_send_conn_drop_async_message()
2570 cmd->logout_cid, conn->cid); iscsit_send_conn_drop_async_message()
2585 iscsit_build_datain_pdu(struct iscsi_cmd *cmd, struct iscsi_conn *conn, iscsit_build_datain_pdu() argument
2592 if (cmd->se_cmd.se_cmd_flags & SCF_OVERFLOW_BIT) { iscsit_build_datain_pdu()
2594 hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count); iscsit_build_datain_pdu()
2595 } else if (cmd->se_cmd.se_cmd_flags & SCF_UNDERFLOW_BIT) { iscsit_build_datain_pdu()
2597 hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count); iscsit_build_datain_pdu()
2602 int_to_scsilun(cmd->se_cmd.orig_fe_lun, iscsit_build_datain_pdu()
2607 hdr->itt = cmd->init_task_tag; iscsit_build_datain_pdu()
2610 hdr->ttt = cpu_to_be32(cmd->targ_xfer_tag); iscsit_build_datain_pdu()
2614 hdr->statsn = cpu_to_be32(cmd->stat_sn); iscsit_build_datain_pdu()
2625 cmd->init_task_tag, ntohl(hdr->statsn), ntohl(hdr->datasn), iscsit_build_datain_pdu()
2629 static int iscsit_send_datain(struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_send_datain() argument
2631 struct iscsi_data_rsp *hdr = (struct iscsi_data_rsp *)&cmd->pdu[0]; iscsit_send_datain()
2640 dr = iscsit_get_datain_values(cmd, &datain); iscsit_send_datain()
2643 cmd->init_task_tag); iscsit_send_datain()
2649 if ((datain.offset + datain.length) > cmd->se_cmd.data_length) { iscsit_send_datain()
2651 " datain.length: %u exceeds cmd->data_length: %u\n", iscsit_send_datain()
2652 cmd->init_task_tag, datain.offset, datain.length, iscsit_send_datain()
2653 cmd->se_cmd.data_length); iscsit_send_datain()
2663 (cmd->se_cmd.se_cmd_flags & SCF_TRANSPORT_TASK_SENSE)) iscsit_send_datain()
2668 iscsit_increment_maxcmdsn(cmd, conn->sess); iscsit_send_datain()
2669 cmd->stat_sn = conn->stat_sn++; iscsit_send_datain()
2676 iscsit_build_datain_pdu(cmd, conn, &datain, hdr, set_statsn); iscsit_send_datain()
2678 iov = &cmd->iov_data[0]; iscsit_send_datain()
2679 iov[iov_count].iov_base = cmd->pdu; iscsit_send_datain()
2684 u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; iscsit_send_datain()
2686 iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, cmd->pdu, iscsit_send_datain()
2696 iov_ret = iscsit_map_iovec(cmd, &cmd->iov_data[1], iscsit_send_datain()
2704 cmd->padding = ((-datain.length) & 3); iscsit_send_datain()
2705 if (cmd->padding) { iscsit_send_datain()
2706 iov[iov_count].iov_base = cmd->pad_bytes; iscsit_send_datain()
2707 iov[iov_count++].iov_len = cmd->padding; iscsit_send_datain()
2708 tx_size += cmd->padding; iscsit_send_datain()
2711 cmd->padding); iscsit_send_datain()
2714 cmd->data_crc = iscsit_do_crypto_hash_sg(&conn->conn_tx_hash, cmd, iscsit_send_datain()
2715 datain.offset, datain.length, cmd->padding, cmd->pad_bytes); iscsit_send_datain()
2717 iov[iov_count].iov_base = &cmd->data_crc; iscsit_send_datain()
2722 " 0x%08x\n", datain.length+cmd->padding, cmd->data_crc); iscsit_send_datain()
2725 cmd->iov_data_count = iov_count; iscsit_send_datain()
2726 cmd->tx_size = tx_size; iscsit_send_datain()
2728 ret = iscsit_fe_sendpage_sg(cmd, conn); iscsit_send_datain()
2730 iscsit_unmap_iovec(cmd); iscsit_send_datain()
2738 eodr = (cmd->se_cmd.se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) ? iscsit_send_datain()
2740 iscsit_free_datain_req(cmd, dr); iscsit_send_datain()
2747 iscsit_build_logout_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn, iscsit_build_logout_rsp() argument
2758 switch (cmd->logout_reason) { iscsit_build_logout_rsp()
2762 cmd->logout_response = ISCSI_LOGOUT_SUCCESS; iscsit_build_logout_rsp()
2765 if (cmd->logout_response == ISCSI_LOGOUT_CID_NOT_FOUND) iscsit_build_logout_rsp()
2775 * on, the connection responding to cmd->logout_cid iscsit_build_logout_rsp()
2780 " successful.\n", cmd->logout_cid, conn->cid); iscsit_build_logout_rsp()
2781 cmd->logout_response = ISCSI_LOGOUT_SUCCESS; iscsit_build_logout_rsp()
2784 if ((cmd->logout_response == ISCSI_LOGOUT_RECOVERY_UNSUPPORTED) || iscsit_build_logout_rsp()
2785 (cmd->logout_response == ISCSI_LOGOUT_CLEANUP_FAILED)) iscsit_build_logout_rsp()
2792 cmd->logout_cid); iscsit_build_logout_rsp()
2799 conn->sess, cmd->logout_cid); iscsit_build_logout_rsp()
2803 cmd->logout_cid); iscsit_build_logout_rsp()
2804 cmd->logout_response = ISCSI_LOGOUT_CID_NOT_FOUND; iscsit_build_logout_rsp()
2808 iscsit_discard_cr_cmds_by_expstatsn(cr, cmd->exp_stat_sn); iscsit_build_logout_rsp()
2812 cmd->logout_cid, conn->cid); iscsit_build_logout_rsp()
2813 cmd->logout_response = ISCSI_LOGOUT_SUCCESS; iscsit_build_logout_rsp()
2816 pr_err("Unknown cmd->logout_reason: 0x%02x\n", iscsit_build_logout_rsp()
2817 cmd->logout_reason); iscsit_build_logout_rsp()
2823 hdr->response = cmd->logout_response; iscsit_build_logout_rsp()
2824 hdr->itt = cmd->init_task_tag; iscsit_build_logout_rsp()
2825 cmd->stat_sn = conn->stat_sn++; iscsit_build_logout_rsp()
2826 hdr->statsn = cpu_to_be32(cmd->stat_sn); iscsit_build_logout_rsp()
2828 iscsit_increment_maxcmdsn(cmd, conn->sess); iscsit_build_logout_rsp()
2834 cmd->init_task_tag, cmd->stat_sn, hdr->response, iscsit_build_logout_rsp()
2835 cmd->logout_cid, conn->cid); iscsit_build_logout_rsp()
2842 iscsit_send_logout(struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_send_logout() argument
2847 rc = iscsit_build_logout_rsp(cmd, conn, iscsit_send_logout()
2848 (struct iscsi_logout_rsp *)&cmd->pdu[0]); iscsit_send_logout()
2853 iov = &cmd->iov_misc[0]; iscsit_send_logout()
2854 iov[niov].iov_base = cmd->pdu; iscsit_send_logout()
2858 u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; iscsit_send_logout()
2860 iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, &cmd->pdu[0], iscsit_send_logout()
2868 cmd->iov_misc_count = niov; iscsit_send_logout()
2869 cmd->tx_size = tx_size; iscsit_send_logout()
2875 iscsit_build_nopin_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn, iscsit_build_nopin_rsp() argument
2880 hton24(hdr->dlength, cmd->buf_ptr_size); iscsit_build_nopin_rsp()
2883 hdr->itt = cmd->init_task_tag; iscsit_build_nopin_rsp()
2884 hdr->ttt = cpu_to_be32(cmd->targ_xfer_tag); iscsit_build_nopin_rsp()
2885 cmd->stat_sn = (nopout_response) ? conn->stat_sn++ : iscsit_build_nopin_rsp()
2887 hdr->statsn = cpu_to_be32(cmd->stat_sn); iscsit_build_nopin_rsp()
2890 iscsit_increment_maxcmdsn(cmd, conn->sess); iscsit_build_nopin_rsp()
2897 "Solicitied" : "Unsolicitied", cmd->init_task_tag, iscsit_build_nopin_rsp()
2898 cmd->targ_xfer_tag, cmd->stat_sn, cmd->buf_ptr_size); iscsit_build_nopin_rsp()
2906 struct iscsi_cmd *cmd, iscsit_send_unsolicited_nopin()
2910 struct iscsi_nopin *hdr = (struct iscsi_nopin *)&cmd->pdu[0]; iscsit_send_unsolicited_nopin()
2913 iscsit_build_nopin_rsp(cmd, conn, hdr, false); iscsit_send_unsolicited_nopin()
2916 u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; iscsit_send_unsolicited_nopin()
2926 cmd->iov_misc[0].iov_base = cmd->pdu; iscsit_send_unsolicited_nopin()
2927 cmd->iov_misc[0].iov_len = tx_size; iscsit_send_unsolicited_nopin()
2928 cmd->iov_misc_count = 1; iscsit_send_unsolicited_nopin()
2929 cmd->tx_size = tx_size; iscsit_send_unsolicited_nopin()
2932 " 0x%08x CID: %hu\n", hdr->ttt, cmd->stat_sn, conn->cid); iscsit_send_unsolicited_nopin()
2934 ret = iscsit_send_tx_data(cmd, conn, 1); iscsit_send_unsolicited_nopin()
2940 spin_lock_bh(&cmd->istate_lock); iscsit_send_unsolicited_nopin()
2941 cmd->i_state = want_response ? iscsit_send_unsolicited_nopin()
2943 spin_unlock_bh(&cmd->istate_lock); iscsit_send_unsolicited_nopin()
2949 iscsit_send_nopin(struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_send_nopin() argument
2951 struct iscsi_nopin *hdr = (struct iscsi_nopin *)&cmd->pdu[0]; iscsit_send_nopin()
2956 iscsit_build_nopin_rsp(cmd, conn, hdr, true); iscsit_send_nopin()
2959 iov = &cmd->iov_misc[0]; iscsit_send_nopin()
2960 iov[niov].iov_base = cmd->pdu; iscsit_send_nopin()
2964 u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; iscsit_send_nopin()
2979 if (cmd->buf_ptr_size) { iscsit_send_nopin()
2980 iov[niov].iov_base = cmd->buf_ptr; iscsit_send_nopin()
2981 iov[niov++].iov_len = cmd->buf_ptr_size; iscsit_send_nopin()
2982 tx_size += cmd->buf_ptr_size; iscsit_send_nopin()
2985 " data.\n", cmd->buf_ptr_size); iscsit_send_nopin()
2987 padding = ((-cmd->buf_ptr_size) & 3); iscsit_send_nopin()
2989 iov[niov].iov_base = &cmd->pad_bytes; iscsit_send_nopin()
2997 cmd->buf_ptr, cmd->buf_ptr_size, iscsit_send_nopin()
2998 padding, (u8 *)&cmd->pad_bytes, iscsit_send_nopin()
2999 (u8 *)&cmd->data_crc); iscsit_send_nopin()
3001 iov[niov].iov_base = &cmd->data_crc; iscsit_send_nopin()
3006 cmd->buf_ptr_size, cmd->data_crc); iscsit_send_nopin()
3010 cmd->iov_misc_count = niov; iscsit_send_nopin()
3011 cmd->tx_size = tx_size; iscsit_send_nopin()
3017 struct iscsi_cmd *cmd, iscsit_send_r2t()
3025 r2t = iscsit_get_r2t_from_list(cmd); iscsit_send_r2t()
3029 hdr = (struct iscsi_r2t_rsp *) cmd->pdu; iscsit_send_r2t()
3033 int_to_scsilun(cmd->se_cmd.orig_fe_lun, iscsit_send_r2t()
3035 hdr->itt = cmd->init_task_tag; iscsit_send_r2t()
3045 cmd->iov_misc[0].iov_base = cmd->pdu; iscsit_send_r2t()
3046 cmd->iov_misc[0].iov_len = ISCSI_HDR_LEN; iscsit_send_r2t()
3050 u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; iscsit_send_r2t()
3055 cmd->iov_misc[0].iov_len += ISCSI_CRC_LEN; iscsit_send_r2t()
3063 (!r2t->recovery_r2t) ? "" : "Recovery ", cmd->init_task_tag, iscsit_send_r2t()
3067 cmd->iov_misc_count = 1; iscsit_send_r2t()
3068 cmd->tx_size = tx_size; iscsit_send_r2t()
3070 spin_lock_bh(&cmd->r2t_lock); iscsit_send_r2t()
3072 spin_unlock_bh(&cmd->r2t_lock); iscsit_send_r2t()
3074 ret = iscsit_send_tx_data(cmd, conn, 1); iscsit_send_r2t()
3080 spin_lock_bh(&cmd->dataout_timeout_lock); iscsit_send_r2t()
3081 iscsit_start_dataout_timer(cmd, conn); iscsit_send_r2t()
3082 spin_unlock_bh(&cmd->dataout_timeout_lock); iscsit_send_r2t()
3093 struct iscsi_cmd *cmd, iscsit_build_r2ts_for_cmd()
3099 spin_lock_bh(&cmd->r2t_lock); iscsit_build_r2ts_for_cmd()
3100 if (cmd->cmd_flags & ICF_SENT_LAST_R2T) { iscsit_build_r2ts_for_cmd()
3101 spin_unlock_bh(&cmd->r2t_lock); iscsit_build_r2ts_for_cmd()
3107 cmd->r2t_offset = max(cmd->r2t_offset, cmd->write_data_done); iscsit_build_r2ts_for_cmd()
3109 while (cmd->outstanding_r2ts < conn->sess->sess_ops->MaxOutstandingR2T) { iscsit_build_r2ts_for_cmd()
3111 offset = cmd->r2t_offset; iscsit_build_r2ts_for_cmd()
3116 cmd->next_burst_len; iscsit_build_r2ts_for_cmd()
3118 if (new_data_end > cmd->se_cmd.data_length) iscsit_build_r2ts_for_cmd()
3119 xfer_len = cmd->se_cmd.data_length - offset; iscsit_build_r2ts_for_cmd()
3123 cmd->next_burst_len; iscsit_build_r2ts_for_cmd()
3128 if (new_data_end > cmd->se_cmd.data_length) iscsit_build_r2ts_for_cmd()
3129 xfer_len = cmd->se_cmd.data_length - offset; iscsit_build_r2ts_for_cmd()
3133 cmd->r2t_offset += xfer_len; iscsit_build_r2ts_for_cmd()
3135 if (cmd->r2t_offset == cmd->se_cmd.data_length) iscsit_build_r2ts_for_cmd()
3136 cmd->cmd_flags |= ICF_SENT_LAST_R2T; iscsit_build_r2ts_for_cmd()
3140 seq = iscsit_get_seq_holder_for_r2t(cmd); iscsit_build_r2ts_for_cmd()
3142 spin_unlock_bh(&cmd->r2t_lock); iscsit_build_r2ts_for_cmd()
3149 if (cmd->seq_send_order == cmd->seq_count) iscsit_build_r2ts_for_cmd()
3150 cmd->cmd_flags |= ICF_SENT_LAST_R2T; iscsit_build_r2ts_for_cmd()
3152 cmd->outstanding_r2ts++; iscsit_build_r2ts_for_cmd()
3155 if (iscsit_add_r2t_to_list(cmd, offset, xfer_len, 0, 0) < 0) { iscsit_build_r2ts_for_cmd()
3156 spin_unlock_bh(&cmd->r2t_lock); iscsit_build_r2ts_for_cmd()
3160 if (cmd->cmd_flags & ICF_SENT_LAST_R2T) iscsit_build_r2ts_for_cmd()
3163 spin_unlock_bh(&cmd->r2t_lock); iscsit_build_r2ts_for_cmd()
3168 void iscsit_build_rsp_pdu(struct iscsi_cmd *cmd, struct iscsi_conn *conn, iscsit_build_rsp_pdu() argument
3172 cmd->stat_sn = conn->stat_sn++; iscsit_build_rsp_pdu()
3179 if (cmd->se_cmd.se_cmd_flags & SCF_OVERFLOW_BIT) { iscsit_build_rsp_pdu()
3181 hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count); iscsit_build_rsp_pdu()
3182 } else if (cmd->se_cmd.se_cmd_flags & SCF_UNDERFLOW_BIT) { iscsit_build_rsp_pdu()
3184 hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count); iscsit_build_rsp_pdu()
3186 hdr->response = cmd->iscsi_response; iscsit_build_rsp_pdu()
3187 hdr->cmd_status = cmd->se_cmd.scsi_status; iscsit_build_rsp_pdu()
3188 hdr->itt = cmd->init_task_tag; iscsit_build_rsp_pdu()
3189 hdr->statsn = cpu_to_be32(cmd->stat_sn); iscsit_build_rsp_pdu()
3191 iscsit_increment_maxcmdsn(cmd, conn->sess); iscsit_build_rsp_pdu()
3197 cmd->init_task_tag, cmd->stat_sn, cmd->se_cmd.scsi_status, iscsit_build_rsp_pdu()
3198 cmd->se_cmd.scsi_status, conn->cid); iscsit_build_rsp_pdu()
3202 static int iscsit_send_response(struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_send_response() argument
3204 struct iscsi_scsi_rsp *hdr = (struct iscsi_scsi_rsp *)&cmd->pdu[0]; iscsit_send_response()
3208 bool inc_stat_sn = (cmd->i_state == ISTATE_SEND_STATUS); iscsit_send_response()
3210 iscsit_build_rsp_pdu(cmd, conn, inc_stat_sn, hdr); iscsit_send_response()
3212 iov = &cmd->iov_misc[0]; iscsit_send_response()
3213 iov[iov_count].iov_base = cmd->pdu; iscsit_send_response()
3220 if (cmd->se_cmd.sense_buffer && iscsit_send_response()
3221 ((cmd->se_cmd.se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) || iscsit_send_response()
3222 (cmd->se_cmd.se_cmd_flags & SCF_EMULATED_TASK_SENSE))) { iscsit_send_response()
3223 put_unaligned_be16(cmd->se_cmd.scsi_sense_length, cmd->sense_buffer); iscsit_send_response()
3224 cmd->se_cmd.scsi_sense_length += sizeof (__be16); iscsit_send_response()
3226 padding = -(cmd->se_cmd.scsi_sense_length) & 3; iscsit_send_response()
3227 hton24(hdr->dlength, (u32)cmd->se_cmd.scsi_sense_length); iscsit_send_response()
3228 iov[iov_count].iov_base = cmd->sense_buffer; iscsit_send_response()
3230 (cmd->se_cmd.scsi_sense_length + padding); iscsit_send_response()
3231 tx_size += cmd->se_cmd.scsi_sense_length; iscsit_send_response()
3234 memset(cmd->sense_buffer + iscsit_send_response()
3235 cmd->se_cmd.scsi_sense_length, 0, padding); iscsit_send_response()
3243 cmd->sense_buffer, iscsit_send_response()
3244 (cmd->se_cmd.scsi_sense_length + padding), iscsit_send_response()
3245 0, NULL, (u8 *)&cmd->data_crc); iscsit_send_response()
3247 iov[iov_count].iov_base = &cmd->data_crc; iscsit_send_response()
3253 (cmd->se_cmd.scsi_sense_length + padding), iscsit_send_response()
3254 cmd->data_crc); iscsit_send_response()
3259 cmd->se_cmd.scsi_sense_length); iscsit_send_response()
3263 u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; iscsit_send_response()
3265 iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, cmd->pdu, iscsit_send_response()
3274 cmd->iov_misc_count = iov_count; iscsit_send_response()
3275 cmd->tx_size = tx_size; iscsit_send_response()
3298 iscsit_build_task_mgt_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn, iscsit_build_task_mgt_rsp() argument
3301 struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req; iscsit_build_task_mgt_rsp()
3306 hdr->itt = cmd->init_task_tag; iscsit_build_task_mgt_rsp()
3307 cmd->stat_sn = conn->stat_sn++; iscsit_build_task_mgt_rsp()
3308 hdr->statsn = cpu_to_be32(cmd->stat_sn); iscsit_build_task_mgt_rsp()
3310 iscsit_increment_maxcmdsn(cmd, conn->sess); iscsit_build_task_mgt_rsp()
3316 cmd->init_task_tag, cmd->stat_sn, hdr->response, conn->cid); iscsit_build_task_mgt_rsp()
3321 iscsit_send_task_mgt_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_send_task_mgt_rsp() argument
3323 struct iscsi_tm_rsp *hdr = (struct iscsi_tm_rsp *)&cmd->pdu[0]; iscsit_send_task_mgt_rsp()
3326 iscsit_build_task_mgt_rsp(cmd, conn, hdr); iscsit_send_task_mgt_rsp()
3328 cmd->iov_misc[0].iov_base = cmd->pdu; iscsit_send_task_mgt_rsp()
3329 cmd->iov_misc[0].iov_len = ISCSI_HDR_LEN; iscsit_send_task_mgt_rsp()
3333 u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; iscsit_send_task_mgt_rsp()
3338 cmd->iov_misc[0].iov_len += ISCSI_CRC_LEN; iscsit_send_task_mgt_rsp()
3344 cmd->iov_misc_count = 1; iscsit_send_task_mgt_rsp()
3345 cmd->tx_size = tx_size; iscsit_send_task_mgt_rsp()
3377 iscsit_build_sendtargets_response(struct iscsi_cmd *cmd, iscsit_build_sendtargets_response() argument
3382 struct iscsi_conn *conn = cmd->conn; iscsit_build_sendtargets_response()
3389 unsigned char *text_in = cmd->text_in_ptr, *text_ptr = NULL; iscsit_build_sendtargets_response()
3405 if (cmd->cmd_flags & ICF_SENDTARGETS_SINGLE) { iscsit_build_sendtargets_response()
3421 if ((cmd->cmd_flags & ICF_SENDTARGETS_SINGLE) && iscsit_build_sendtargets_response()
3439 cmd->conn->sess->sess_ops->InitiatorName))) { iscsit_build_sendtargets_response()
3519 if (cmd->cmd_flags & ICF_SENDTARGETS_SINGLE) iscsit_build_sendtargets_response()
3524 cmd->buf_ptr = payload; iscsit_build_sendtargets_response()
3530 iscsit_build_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn, iscsit_build_text_rsp() argument
3537 text_length = iscsit_build_sendtargets_response(cmd, network_transport, iscsit_build_text_rsp()
3538 cmd->read_data_done, iscsit_build_text_rsp()
3547 cmd->read_data_done += text_length; iscsit_build_text_rsp()
3548 if (cmd->targ_xfer_tag == 0xFFFFFFFF) iscsit_build_text_rsp()
3549 cmd->targ_xfer_tag = session_get_next_ttt(conn->sess); iscsit_build_text_rsp()
3554 hdr->itt = cmd->init_task_tag; iscsit_build_text_rsp()
3555 hdr->ttt = cpu_to_be32(cmd->targ_xfer_tag); iscsit_build_text_rsp()
3556 cmd->stat_sn = conn->stat_sn++; iscsit_build_text_rsp()
3557 hdr->statsn = cpu_to_be32(cmd->stat_sn); iscsit_build_text_rsp()
3559 iscsit_increment_maxcmdsn(cmd, conn->sess); iscsit_build_text_rsp()
3565 cmd->maxcmdsn_inc = 0; iscsit_build_text_rsp()
3570 " Length: %u, CID: %hu F: %d C: %d\n", cmd->init_task_tag, iscsit_build_text_rsp()
3571 cmd->targ_xfer_tag, cmd->stat_sn, text_length, conn->cid, iscsit_build_text_rsp()
3580 struct iscsi_cmd *cmd, iscsit_send_text_rsp()
3583 struct iscsi_text_rsp *hdr = (struct iscsi_text_rsp *)cmd->pdu; iscsit_send_text_rsp()
3588 rc = iscsit_build_text_rsp(cmd, conn, hdr, ISCSI_TCP); iscsit_send_text_rsp()
3593 iov = &cmd->iov_misc[0]; iscsit_send_text_rsp()
3594 iov[iov_count].iov_base = cmd->pdu; iscsit_send_text_rsp()
3596 iov[iov_count].iov_base = cmd->buf_ptr; iscsit_send_text_rsp()
3602 u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; iscsit_send_text_rsp()
3615 cmd->buf_ptr, text_length, iscsit_send_text_rsp()
3616 0, NULL, (u8 *)&cmd->data_crc); iscsit_send_text_rsp()
3618 iov[iov_count].iov_base = &cmd->data_crc; iscsit_send_text_rsp()
3624 cmd->data_crc); iscsit_send_text_rsp()
3627 cmd->iov_misc_count = iov_count; iscsit_send_text_rsp()
3628 cmd->tx_size = tx_size; iscsit_send_text_rsp()
3634 iscsit_build_reject(struct iscsi_cmd *cmd, struct iscsi_conn *conn, iscsit_build_reject() argument
3638 hdr->reason = cmd->reject_reason; iscsit_build_reject()
3642 cmd->stat_sn = conn->stat_sn++; iscsit_build_reject()
3643 hdr->statsn = cpu_to_be32(cmd->stat_sn); iscsit_build_reject()
3651 struct iscsi_cmd *cmd, iscsit_send_reject()
3654 struct iscsi_reject *hdr = (struct iscsi_reject *)&cmd->pdu[0]; iscsit_send_reject()
3658 iscsit_build_reject(cmd, conn, hdr); iscsit_send_reject()
3660 iov = &cmd->iov_misc[0]; iscsit_send_reject()
3661 iov[iov_count].iov_base = cmd->pdu; iscsit_send_reject()
3663 iov[iov_count].iov_base = cmd->buf_ptr; iscsit_send_reject()
3669 u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; iscsit_send_reject()
3681 iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, cmd->buf_ptr, iscsit_send_reject()
3682 ISCSI_HDR_LEN, 0, NULL, (u8 *)&cmd->data_crc); iscsit_send_reject()
3684 iov[iov_count].iov_base = &cmd->data_crc; iscsit_send_reject()
3688 " PDU 0x%08x\n", cmd->data_crc); iscsit_send_reject()
3691 cmd->iov_misc_count = iov_count; iscsit_send_reject()
3692 cmd->tx_size = tx_size; iscsit_send_reject()
3752 iscsit_immediate_queue(struct iscsi_conn *conn, struct iscsi_cmd *cmd, int state) iscsit_immediate_queue() argument
3758 ret = iscsit_send_r2t(cmd, conn); iscsit_immediate_queue()
3764 list_del_init(&cmd->i_conn_node); iscsit_immediate_queue()
3767 iscsit_free_cmd(cmd, false); iscsit_immediate_queue()
3771 ret = iscsit_send_unsolicited_nopin(cmd, conn, 1); iscsit_immediate_queue()
3776 ret = iscsit_send_unsolicited_nopin(cmd, conn, 0); iscsit_immediate_queue()
3783 cmd->iscsi_opcode, cmd->init_task_tag, state, iscsit_immediate_queue()
3799 struct iscsi_cmd *cmd; iscsit_handle_immediate_queue() local
3805 cmd = qr->cmd; iscsit_handle_immediate_queue()
3809 ret = t->iscsit_immediate_queue(conn, cmd, state); iscsit_handle_immediate_queue()
3818 iscsit_response_queue(struct iscsi_conn *conn, struct iscsi_cmd *cmd, int state) iscsit_response_queue() argument
3825 ret = iscsit_send_datain(cmd, conn); iscsit_response_queue()
3833 spin_lock_bh(&cmd->istate_lock); iscsit_response_queue()
3834 cmd->i_state = ISTATE_SENT_STATUS; iscsit_response_queue()
3835 spin_unlock_bh(&cmd->istate_lock); iscsit_response_queue()
3844 spin_lock_bh(&cmd->istate_lock); iscsit_response_queue()
3845 cmd->i_state = ISTATE_SEND_STATUS; iscsit_response_queue()
3846 spin_unlock_bh(&cmd->istate_lock); iscsit_response_queue()
3854 ret = iscsit_send_response(cmd, conn); iscsit_response_queue()
3857 ret = iscsit_send_logout(cmd, conn); iscsit_response_queue()
3861 cmd, conn); iscsit_response_queue()
3864 ret = iscsit_send_nopin(cmd, conn); iscsit_response_queue()
3867 ret = iscsit_send_reject(cmd, conn); iscsit_response_queue()
3870 ret = iscsit_send_task_mgt_rsp(cmd, conn); iscsit_response_queue()
3873 ret = iscsit_tmr_post_handler(cmd, conn); iscsit_response_queue()
3878 ret = iscsit_send_text_rsp(cmd, conn); iscsit_response_queue()
3883 cmd->iscsi_opcode, cmd->init_task_tag, iscsit_response_queue()
3890 if (iscsit_send_tx_data(cmd, conn, 1) < 0) { iscsit_response_queue()
3892 iscsit_unmap_iovec(cmd); iscsit_response_queue()
3895 iscsit_unmap_iovec(cmd); iscsit_response_queue()
3899 if (!iscsit_logout_post_handler(cmd, conn)) iscsit_response_queue()
3909 spin_lock_bh(&cmd->istate_lock); iscsit_response_queue()
3910 cmd->i_state = ISTATE_SENT_STATUS; iscsit_response_queue()
3911 spin_unlock_bh(&cmd->istate_lock); iscsit_response_queue()
3916 cmd->iscsi_opcode, cmd->init_task_tag, iscsit_response_queue()
3917 cmd->i_state, conn->cid); iscsit_response_queue()
3934 struct iscsi_cmd *cmd; iscsit_handle_response_queue() local
3939 cmd = qr->cmd; iscsit_handle_response_queue()
3943 ret = t->iscsit_response_queue(conn, cmd, state); iscsit_handle_response_queue()
4003 struct iscsi_cmd *cmd; iscsi_target_rx_opcode() local
4008 cmd = iscsit_allocate_cmd(conn, TASK_INTERRUPTIBLE); iscsi_target_rx_opcode()
4009 if (!cmd) iscsi_target_rx_opcode()
4012 ret = iscsit_handle_scsi_cmd(conn, cmd, buf); iscsi_target_rx_opcode()
4018 cmd = NULL; iscsi_target_rx_opcode()
4020 cmd = iscsit_allocate_cmd(conn, TASK_INTERRUPTIBLE); iscsi_target_rx_opcode()
4021 if (!cmd) iscsi_target_rx_opcode()
4024 ret = iscsit_handle_nop_out(conn, cmd, buf); iscsi_target_rx_opcode()
4027 cmd = iscsit_allocate_cmd(conn, TASK_INTERRUPTIBLE); iscsi_target_rx_opcode()
4028 if (!cmd) iscsi_target_rx_opcode()
4031 ret = iscsit_handle_task_mgt_cmd(conn, cmd, buf); iscsi_target_rx_opcode()
4035 cmd = iscsit_find_cmd_from_itt(conn, hdr->itt); iscsi_target_rx_opcode()
4036 if (!cmd) iscsi_target_rx_opcode()
4039 cmd = iscsit_allocate_cmd(conn, TASK_INTERRUPTIBLE); iscsi_target_rx_opcode()
4040 if (!cmd) iscsi_target_rx_opcode()
4044 ret = iscsit_handle_text_cmd(conn, cmd, buf); iscsi_target_rx_opcode()
4047 cmd = iscsit_allocate_cmd(conn, TASK_INTERRUPTIBLE); iscsi_target_rx_opcode()
4048 if (!cmd) iscsi_target_rx_opcode()
4051 ret = iscsit_handle_logout_cmd(conn, cmd, buf); iscsi_target_rx_opcode()
4197 struct iscsi_cmd *cmd = NULL, *cmd_tmp = NULL; iscsit_release_commands_from_conn() local
4205 list_for_each_entry_safe(cmd, cmd_tmp, &conn->conn_cmd_list, i_conn_node) { iscsit_release_commands_from_conn()
4207 list_del_init(&cmd->i_conn_node); iscsit_release_commands_from_conn()
4210 iscsit_increment_maxcmdsn(cmd, sess); iscsit_release_commands_from_conn()
4212 iscsit_free_cmd(cmd, true); iscsit_release_commands_from_conn()
4222 struct iscsi_cmd *cmd; iscsit_stop_timers_for_cmds() local
4225 list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { iscsit_stop_timers_for_cmds()
4226 if (cmd->data_direction == DMA_TO_DEVICE) iscsit_stop_timers_for_cmds()
4227 iscsit_stop_dataout_timer(cmd); iscsit_stop_timers_for_cmds()
4623 struct iscsi_cmd *cmd, iscsit_logout_post_handler()
4628 switch (cmd->logout_reason) { iscsit_logout_post_handler()
4630 switch (cmd->logout_response) { iscsit_logout_post_handler()
4640 if (conn->cid == cmd->logout_cid) { iscsit_logout_post_handler()
4641 switch (cmd->logout_response) { iscsit_logout_post_handler()
4650 switch (cmd->logout_response) { iscsit_logout_post_handler()
4653 cmd->logout_cid); iscsit_logout_post_handler()
4664 switch (cmd->logout_response) { iscsit_logout_post_handler()
668 iscsit_add_reject_from_cmd( struct iscsi_cmd *cmd, u8 reason, bool add_to_conn, unsigned char *buf) iscsit_add_reject_from_cmd() argument
727 iscsit_map_iovec( struct iscsi_cmd *cmd, struct kvec *iov, u32 data_offset, u32 data_length) iscsit_map_iovec() argument
1192 iscsit_do_crypto_hash_sg( struct hash_desc *hash, struct iscsi_cmd *cmd, u32 data_offset, u32 data_length, u32 padding, u8 *pad_bytes) iscsit_do_crypto_hash_sg() argument
2400 iscsit_handle_immediate_data( struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr, u32 length) iscsit_handle_immediate_data() argument
2529 iscsit_send_conn_drop_async_message( struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_send_conn_drop_async_message() argument
2905 iscsit_send_unsolicited_nopin( struct iscsi_cmd *cmd, struct iscsi_conn *conn, int want_response) iscsit_send_unsolicited_nopin() argument
3016 iscsit_send_r2t( struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_send_r2t() argument
3091 iscsit_build_r2ts_for_cmd( struct iscsi_conn *conn, struct iscsi_cmd *cmd, bool recovery) iscsit_build_r2ts_for_cmd() argument
3579 iscsit_send_text_rsp( struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_send_text_rsp() argument
3650 iscsit_send_reject( struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_send_reject() argument
4622 iscsit_logout_post_handler( struct iscsi_cmd *cmd, struct iscsi_conn *conn) iscsit_logout_post_handler() argument
/linux-4.4.14/net/bluetooth/
H A Dmgmt_util.c60 int mgmt_cmd_status(struct sock *sk, u16 index, u16 cmd, u8 status) mgmt_cmd_status() argument
67 BT_DBG("sock %p, index %u, cmd %u, status %u", sk, index, cmd, status); mgmt_cmd_status()
81 ev->opcode = cpu_to_le16(cmd); mgmt_cmd_status()
90 int mgmt_cmd_complete(struct sock *sk, u16 index, u16 cmd, u8 status, mgmt_cmd_complete() argument
111 ev->opcode = cpu_to_le16(cmd); mgmt_cmd_complete()
127 struct mgmt_pending_cmd *cmd; mgmt_pending_find() local
129 list_for_each_entry(cmd, &hdev->mgmt_pending, list) { mgmt_pending_find()
130 if (hci_sock_get_channel(cmd->sk) != channel) mgmt_pending_find()
132 if (cmd->opcode == opcode) mgmt_pending_find()
133 return cmd; mgmt_pending_find()
144 struct mgmt_pending_cmd *cmd; mgmt_pending_find_data() local
146 list_for_each_entry(cmd, &hdev->mgmt_pending, list) { mgmt_pending_find_data()
147 if (cmd->user_data != data) mgmt_pending_find_data()
149 if (cmd->opcode == opcode) mgmt_pending_find_data()
150 return cmd; mgmt_pending_find_data()
157 void (*cb)(struct mgmt_pending_cmd *cmd, void *data), mgmt_pending_foreach()
160 struct mgmt_pending_cmd *cmd, *tmp; mgmt_pending_foreach() local
162 list_for_each_entry_safe(cmd, tmp, &hdev->mgmt_pending, list) { mgmt_pending_foreach()
163 if (opcode > 0 && cmd->opcode != opcode) mgmt_pending_foreach()
166 cb(cmd, data); mgmt_pending_foreach()
174 struct mgmt_pending_cmd *cmd; mgmt_pending_add() local
176 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mgmt_pending_add()
177 if (!cmd) mgmt_pending_add()
180 cmd->opcode = opcode; mgmt_pending_add()
181 cmd->index = hdev->id; mgmt_pending_add()
183 cmd->param = kmemdup(data, len, GFP_KERNEL); mgmt_pending_add()
184 if (!cmd->param) { mgmt_pending_add()
185 kfree(cmd); mgmt_pending_add()
189 cmd->param_len = len; mgmt_pending_add()
191 cmd->sk = sk; mgmt_pending_add()
194 list_add(&cmd->list, &hdev->mgmt_pending); mgmt_pending_add()
196 return cmd; mgmt_pending_add()
199 void mgmt_pending_free(struct mgmt_pending_cmd *cmd) mgmt_pending_free() argument
201 sock_put(cmd->sk); mgmt_pending_free()
202 kfree(cmd->param); mgmt_pending_free()
203 kfree(cmd); mgmt_pending_free()
206 void mgmt_pending_remove(struct mgmt_pending_cmd *cmd) mgmt_pending_remove() argument
208 list_del(&cmd->list); mgmt_pending_remove()
209 mgmt_pending_free(cmd); mgmt_pending_remove()
156 mgmt_pending_foreach(u16 opcode, struct hci_dev *hdev, void (*cb)(struct mgmt_pending_cmd *cmd, void *data), void *data) mgmt_pending_foreach() argument
H A Dmgmt.c936 struct mgmt_pending_cmd *cmd; get_adv_discov_flags() local
941 cmd = pending_find(MGMT_OP_SET_DISCOVERABLE, hdev); get_adv_discov_flags()
942 if (cmd) { get_adv_discov_flags()
943 struct mgmt_mode *cp = cmd->param; get_adv_discov_flags()
960 struct mgmt_pending_cmd *cmd; get_connectable() local
965 cmd = pending_find(MGMT_OP_SET_CONNECTABLE, hdev); get_connectable()
966 if (cmd) { get_connectable()
967 struct mgmt_mode *cp = cmd->param; get_connectable()
1657 struct mgmt_pending_cmd *cmd; set_powered() local
1690 cmd = mgmt_pending_add(sk, MGMT_OP_SET_POWERED, hdev, data, len); set_powered()
1691 if (!cmd) { set_powered()
1738 static void settings_rsp(struct mgmt_pending_cmd *cmd, void *data) settings_rsp() argument
1742 send_settings_rsp(cmd->sk, cmd->opcode, match->hdev); settings_rsp()
1744 list_del(&cmd->list); settings_rsp()
1747 match->sk = cmd->sk; settings_rsp()
1751 mgmt_pending_free(cmd); settings_rsp()
1754 static void cmd_status_rsp(struct mgmt_pending_cmd *cmd, void *data) cmd_status_rsp() argument
1758 mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, *status); cmd_status_rsp()
1759 mgmt_pending_remove(cmd); cmd_status_rsp()
1762 static void cmd_complete_rsp(struct mgmt_pending_cmd *cmd, void *data) cmd_complete_rsp() argument
1764 if (cmd->cmd_complete) { cmd_complete_rsp()
1767 cmd->cmd_complete(cmd, *status); cmd_complete_rsp()
1768 mgmt_pending_remove(cmd); cmd_complete_rsp()
1773 cmd_status_rsp(cmd, data); cmd_complete_rsp()
1776 static int generic_cmd_complete(struct mgmt_pending_cmd *cmd, u8 status) generic_cmd_complete() argument
1778 return mgmt_cmd_complete(cmd->sk, cmd->index, cmd->opcode, status, generic_cmd_complete()
1779 cmd->param, cmd->param_len); generic_cmd_complete()
1782 static int addr_cmd_complete(struct mgmt_pending_cmd *cmd, u8 status) addr_cmd_complete() argument
1784 return mgmt_cmd_complete(cmd->sk, cmd->index, cmd->opcode, status, addr_cmd_complete()
1785 cmd->param, sizeof(struct mgmt_addr_info)); addr_cmd_complete()
1811 struct mgmt_pending_cmd *cmd; set_discoverable_complete() local
1820 cmd = pending_find(MGMT_OP_SET_DISCOVERABLE, hdev); set_discoverable_complete()
1821 if (!cmd) set_discoverable_complete()
1826 mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err); set_discoverable_complete()
1831 cp = cmd->param; set_discoverable_complete()
1844 send_settings_rsp(cmd->sk, MGMT_OP_SET_DISCOVERABLE, hdev); set_discoverable_complete()
1847 new_settings(hdev, cmd->sk); set_discoverable_complete()
1860 mgmt_pending_remove(cmd); set_discoverable_complete()
1870 struct mgmt_pending_cmd *cmd; set_discoverable() local
1960 cmd = mgmt_pending_add(sk, MGMT_OP_SET_DISCOVERABLE, hdev, data, len); set_discoverable()
1961 if (!cmd) { set_discoverable()
2024 mgmt_pending_remove(cmd); set_discoverable()
2069 struct mgmt_pending_cmd *cmd; set_connectable_complete() local
2077 cmd = pending_find(MGMT_OP_SET_CONNECTABLE, hdev); set_connectable_complete()
2078 if (!cmd) set_connectable_complete()
2083 mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err); set_connectable_complete()
2087 cp = cmd->param; set_connectable_complete()
2099 send_settings_rsp(cmd->sk, MGMT_OP_SET_CONNECTABLE, hdev); set_connectable_complete()
2102 new_settings(hdev, cmd->sk); set_connectable_complete()
2110 mgmt_pending_remove(cmd); set_connectable_complete()
2149 struct mgmt_pending_cmd *cmd; set_connectable() local
2179 cmd = mgmt_pending_add(sk, MGMT_OP_SET_CONNECTABLE, hdev, data, len); set_connectable()
2180 if (!cmd) { set_connectable()
2230 mgmt_pending_remove(cmd); set_connectable()
2278 struct mgmt_pending_cmd *cmd; set_link_security() local
2326 cmd = mgmt_pending_add(sk, MGMT_OP_SET_LINK_SECURITY, hdev, data, len); set_link_security()
2327 if (!cmd) { set_link_security()
2334 mgmt_pending_remove(cmd); set_link_security()
2346 struct mgmt_pending_cmd *cmd; set_ssp() local
2403 cmd = mgmt_pending_add(sk, MGMT_OP_SET_SSP, hdev, data, len); set_ssp()
2404 if (!cmd) { set_ssp()
2415 mgmt_pending_remove(cmd); set_ssp()
2525 struct mgmt_pending_cmd *cmd; set_le() local
2595 cmd = mgmt_pending_add(sk, MGMT_OP_SET_LE, hdev, data, len); set_le()
2596 if (!cmd) { set_le()
2618 mgmt_pending_remove(cmd); set_le()
2633 struct mgmt_pending_cmd *cmd; pending_eir_or_class() local
2635 list_for_each_entry(cmd, &hdev->mgmt_pending, list) { pending_eir_or_class()
2636 switch (cmd->opcode) { pending_eir_or_class()
2669 struct mgmt_pending_cmd *cmd; mgmt_class_complete() local
2673 cmd = pending_find(mgmt_op, hdev); mgmt_class_complete()
2674 if (!cmd) mgmt_class_complete()
2677 mgmt_cmd_complete(cmd->sk, cmd->index, cmd->opcode, mgmt_class_complete()
2680 mgmt_pending_remove(cmd); mgmt_class_complete()
2696 struct mgmt_pending_cmd *cmd; add_uuid() local
2738 cmd = mgmt_pending_add(sk, MGMT_OP_ADD_UUID, hdev, data, len); add_uuid()
2739 if (!cmd) { add_uuid()
2776 struct mgmt_pending_cmd *cmd; remove_uuid() local
2838 cmd = mgmt_pending_add(sk, MGMT_OP_REMOVE_UUID, hdev, data, len); remove_uuid()
2839 if (!cmd) { remove_uuid()
2862 struct mgmt_pending_cmd *cmd; set_dev_class() local
2916 cmd = mgmt_pending_add(sk, MGMT_OP_SET_DEV_CLASS, hdev, data, len); set_dev_class()
2917 if (!cmd) { set_dev_class()
3029 struct mgmt_pending_cmd *cmd; unpair_device() local
3136 cmd = mgmt_pending_add(sk, MGMT_OP_UNPAIR_DEVICE, hdev, cp, unpair_device()
3138 if (!cmd) { unpair_device()
3143 cmd->cmd_complete = addr_cmd_complete; unpair_device()
3147 mgmt_pending_remove(cmd); unpair_device()
3159 struct mgmt_pending_cmd *cmd; disconnect() local
3203 cmd = mgmt_pending_add(sk, MGMT_OP_DISCONNECT, hdev, data, len); disconnect()
3204 if (!cmd) { disconnect()
3209 cmd->cmd_complete = generic_cmd_complete; disconnect()
3213 mgmt_pending_remove(cmd); disconnect()
3300 struct mgmt_pending_cmd *cmd; send_pin_code_neg_reply() local
3303 cmd = mgmt_pending_add(sk, MGMT_OP_PIN_CODE_NEG_REPLY, hdev, cp, send_pin_code_neg_reply()
3305 if (!cmd) send_pin_code_neg_reply()
3311 mgmt_pending_remove(cmd); send_pin_code_neg_reply()
3322 struct mgmt_pending_cmd *cmd; pin_code_reply() local
3357 cmd = mgmt_pending_add(sk, MGMT_OP_PIN_CODE_REPLY, hdev, data, len); pin_code_reply()
3358 if (!cmd) { pin_code_reply()
3363 cmd->cmd_complete = addr_cmd_complete; pin_code_reply()
3371 mgmt_pending_remove(cmd); pin_code_reply()
3405 struct mgmt_pending_cmd *cmd; find_pairing() local
3407 list_for_each_entry(cmd, &hdev->mgmt_pending, list) { find_pairing()
3408 if (cmd->opcode != MGMT_OP_PAIR_DEVICE) find_pairing()
3411 if (cmd->user_data != conn) find_pairing()
3414 return cmd; find_pairing()
3420 static int pairing_complete(struct mgmt_pending_cmd *cmd, u8 status) pairing_complete() argument
3423 struct hci_conn *conn = cmd->user_data; pairing_complete()
3429 err = mgmt_cmd_complete(cmd->sk, cmd->index, MGMT_OP_PAIR_DEVICE, pairing_complete()
3452 struct mgmt_pending_cmd *cmd; mgmt_smp_complete() local
3454 cmd = find_pairing(conn); mgmt_smp_complete()
3455 if (cmd) { mgmt_smp_complete()
3456 cmd->cmd_complete(cmd, status); mgmt_smp_complete()
3457 mgmt_pending_remove(cmd); mgmt_smp_complete()
3463 struct mgmt_pending_cmd *cmd; pairing_complete_cb() local
3467 cmd = find_pairing(conn); pairing_complete_cb()
3468 if (!cmd) { pairing_complete_cb()
3473 cmd->cmd_complete(cmd, mgmt_status(status)); pairing_complete_cb()
3474 mgmt_pending_remove(cmd); pairing_complete_cb()
3479 struct mgmt_pending_cmd *cmd; le_pairing_complete_cb() local
3486 cmd = find_pairing(conn); le_pairing_complete_cb()
3487 if (!cmd) { le_pairing_complete_cb()
3492 cmd->cmd_complete(cmd, mgmt_status(status)); le_pairing_complete_cb()
3493 mgmt_pending_remove(cmd); le_pairing_complete_cb()
3501 struct mgmt_pending_cmd *cmd; pair_device() local
3592 cmd = mgmt_pending_add(sk, MGMT_OP_PAIR_DEVICE, hdev, data, len); pair_device()
3593 if (!cmd) { pair_device()
3599 cmd->cmd_complete = pairing_complete; pair_device()
3613 cmd->user_data = hci_conn_get(conn); pair_device()
3617 cmd->cmd_complete(cmd, 0); pair_device()
3618 mgmt_pending_remove(cmd); pair_device()
3632 struct mgmt_pending_cmd *cmd; cancel_pair_device() local
3646 cmd = pending_find(MGMT_OP_PAIR_DEVICE, hdev); cancel_pair_device()
3647 if (!cmd) { cancel_pair_device()
3653 conn = cmd->user_data; cancel_pair_device()
3661 cmd->cmd_complete(cmd, MGMT_STATUS_CANCELLED); cancel_pair_device()
3662 mgmt_pending_remove(cmd); cancel_pair_device()
3675 struct mgmt_pending_cmd *cmd; user_pairing_resp() local
3715 cmd = mgmt_pending_add(sk, mgmt_op, hdev, addr, sizeof(*addr)); user_pairing_resp()
3716 if (!cmd) { user_pairing_resp()
3721 cmd->cmd_complete = addr_cmd_complete; user_pairing_resp()
3735 mgmt_pending_remove(cmd); user_pairing_resp()
3819 struct mgmt_pending_cmd *cmd; set_name_complete() local
3825 cmd = pending_find(MGMT_OP_SET_LOCAL_NAME, hdev); set_name_complete()
3826 if (!cmd) set_name_complete()
3829 cp = cmd->param; set_name_complete()
3832 mgmt_cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_LOCAL_NAME, set_name_complete()
3835 mgmt_cmd_complete(cmd->sk, hdev->id, MGMT_OP_SET_LOCAL_NAME, 0, set_name_complete()
3838 mgmt_pending_remove(cmd); set_name_complete()
3848 struct mgmt_pending_cmd *cmd; set_local_name() local
3883 cmd = mgmt_pending_add(sk, MGMT_OP_SET_LOCAL_NAME, hdev, data, len); set_local_name()
3884 if (!cmd) { set_local_name()
3906 mgmt_pending_remove(cmd); set_local_name()
3918 struct mgmt_pending_cmd *cmd; read_local_oob_data_complete() local
3922 cmd = pending_find(MGMT_OP_READ_LOCAL_OOB_DATA, hdev); read_local_oob_data_complete()
3923 if (!cmd) read_local_oob_data_complete()
3927 mgmt_cmd_status(cmd->sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA, read_local_oob_data_complete()
3938 mgmt_cmd_status(cmd->sk, hdev->id, read_local_oob_data_complete()
3952 mgmt_cmd_status(cmd->sk, hdev->id, read_local_oob_data_complete()
3965 mgmt_cmd_complete(cmd->sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA, read_local_oob_data_complete()
3969 mgmt_pending_remove(cmd); read_local_oob_data_complete()
3975 struct mgmt_pending_cmd *cmd; read_local_oob_data() local
4001 cmd = mgmt_pending_add(sk, MGMT_OP_READ_LOCAL_OOB_DATA, hdev, NULL, 0); read_local_oob_data()
4002 if (!cmd) { read_local_oob_data()
4016 mgmt_pending_remove(cmd); read_local_oob_data()
4304 struct mgmt_pending_cmd *cmd; start_discovery_complete() local
4311 cmd = pending_find(MGMT_OP_START_DISCOVERY, hdev); start_discovery_complete()
4312 if (!cmd) start_discovery_complete()
4313 cmd = pending_find(MGMT_OP_START_SERVICE_DISCOVERY, hdev); start_discovery_complete()
4315 if (cmd) { start_discovery_complete()
4316 cmd->cmd_complete(cmd, mgmt_status(status)); start_discovery_complete()
4317 mgmt_pending_remove(cmd); start_discovery_complete()
4382 struct mgmt_pending_cmd *cmd; start_discovery() local
4406 cmd = mgmt_pending_add(sk, MGMT_OP_START_DISCOVERY, hdev, data, len); start_discovery()
4407 if (!cmd) { start_discovery()
4412 cmd->cmd_complete = generic_cmd_complete; start_discovery()
4427 mgmt_pending_remove(cmd); start_discovery()
4433 mgmt_pending_remove(cmd); start_discovery()
4444 static int service_discovery_cmd_complete(struct mgmt_pending_cmd *cmd, service_discovery_cmd_complete() argument
4447 return mgmt_cmd_complete(cmd->sk, cmd->index, cmd->opcode, status, service_discovery_cmd_complete()
4448 cmd->param, 1); service_discovery_cmd_complete()
4455 struct mgmt_pending_cmd *cmd; start_service_discovery() local
4505 cmd = mgmt_pending_add(sk, MGMT_OP_START_SERVICE_DISCOVERY, start_service_discovery()
4507 if (!cmd) { start_service_discovery()
4512 cmd->cmd_complete = service_discovery_cmd_complete; start_service_discovery()
4532 mgmt_pending_remove(cmd); start_service_discovery()
4543 mgmt_pending_remove(cmd); start_service_discovery()
4549 mgmt_pending_remove(cmd); start_service_discovery()
4562 struct mgmt_pending_cmd *cmd; stop_discovery_complete() local
4568 cmd = pending_find(MGMT_OP_STOP_DISCOVERY, hdev); stop_discovery_complete()
4569 if (cmd) { stop_discovery_complete()
4570 cmd->cmd_complete(cmd, mgmt_status(status)); stop_discovery_complete()
4571 mgmt_pending_remove(cmd); stop_discovery_complete()
4584 struct mgmt_pending_cmd *cmd; stop_discovery() local
4606 cmd = mgmt_pending_add(sk, MGMT_OP_STOP_DISCOVERY, hdev, data, len); stop_discovery()
4607 if (!cmd) { stop_discovery()
4612 cmd->cmd_complete = generic_cmd_complete; stop_discovery()
4624 mgmt_pending_remove(cmd); stop_discovery()
4861 struct mgmt_pending_cmd *cmd; set_advertising() local
4922 cmd = mgmt_pending_add(sk, MGMT_OP_SET_ADVERTISING, hdev, data, len); set_advertising()
4923 if (!cmd) { set_advertising()
4951 mgmt_pending_remove(cmd); set_advertising()
5062 struct mgmt_pending_cmd *cmd; fast_connectable_complete() local
5068 cmd = pending_find(MGMT_OP_SET_FAST_CONNECTABLE, hdev); fast_connectable_complete()
5069 if (!cmd) fast_connectable_complete()
5073 mgmt_cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, fast_connectable_complete()
5076 struct mgmt_mode *cp = cmd->param; fast_connectable_complete()
5083 send_settings_rsp(cmd->sk, MGMT_OP_SET_FAST_CONNECTABLE, hdev); fast_connectable_complete()
5084 new_settings(hdev, cmd->sk); fast_connectable_complete()
5087 mgmt_pending_remove(cmd); fast_connectable_complete()
5097 struct mgmt_pending_cmd *cmd; set_fast_connectable() local
5134 cmd = mgmt_pending_add(sk, MGMT_OP_SET_FAST_CONNECTABLE, hdev, set_fast_connectable()
5136 if (!cmd) { set_fast_connectable()
5149 mgmt_pending_remove(cmd); set_fast_connectable()
5160 struct mgmt_pending_cmd *cmd; set_bredr_complete() local
5166 cmd = pending_find(MGMT_OP_SET_BREDR, hdev); set_bredr_complete()
5167 if (!cmd) set_bredr_complete()
5178 mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err); set_bredr_complete()
5180 send_settings_rsp(cmd->sk, MGMT_OP_SET_BREDR, hdev); set_bredr_complete()
5181 new_settings(hdev, cmd->sk); set_bredr_complete()
5184 mgmt_pending_remove(cmd); set_bredr_complete()
5193 struct mgmt_pending_cmd *cmd; set_bredr() local
5272 cmd = mgmt_pending_add(sk, MGMT_OP_SET_BREDR, hdev, data, len); set_bredr()
5273 if (!cmd) { set_bredr()
5295 mgmt_pending_remove(cmd); set_bredr()
5304 struct mgmt_pending_cmd *cmd; sc_enable_complete() local
5311 cmd = pending_find(MGMT_OP_SET_SECURE_CONN, hdev); sc_enable_complete()
5312 if (!cmd) sc_enable_complete()
5316 mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, sc_enable_complete()
5321 cp = cmd->param; sc_enable_complete()
5338 send_settings_rsp(cmd->sk, MGMT_OP_SET_SECURE_CONN, hdev); sc_enable_complete()
5339 new_settings(hdev, cmd->sk); sc_enable_complete()
5342 mgmt_pending_remove(cmd); sc_enable_complete()
5351 struct mgmt_pending_cmd *cmd; set_secure_conn() local
5416 cmd = mgmt_pending_add(sk, MGMT_OP_SET_SECURE_CONN, hdev, data, len); set_secure_conn()
5417 if (!cmd) { set_secure_conn()
5426 mgmt_pending_remove(cmd); set_secure_conn()
5716 static int conn_info_cmd_complete(struct mgmt_pending_cmd *cmd, u8 status) conn_info_cmd_complete() argument
5718 struct hci_conn *conn = cmd->user_data; conn_info_cmd_complete()
5722 memcpy(&rp.addr, cmd->param, sizeof(rp.addr)); conn_info_cmd_complete()
5734 err = mgmt_cmd_complete(cmd->sk, cmd->index, MGMT_OP_GET_CONN_INFO, conn_info_cmd_complete()
5747 struct mgmt_pending_cmd *cmd; conn_info_refresh_complete() local
5785 cmd = pending_find_data(MGMT_OP_GET_CONN_INFO, hdev, conn); conn_info_refresh_complete()
5786 if (!cmd) conn_info_refresh_complete()
5789 cmd->cmd_complete(cmd, status); conn_info_refresh_complete()
5790 mgmt_pending_remove(cmd); conn_info_refresh_complete()
5860 struct mgmt_pending_cmd *cmd; get_conn_info() local
5890 cmd = mgmt_pending_add(sk, MGMT_OP_GET_CONN_INFO, hdev, get_conn_info()
5892 if (!cmd) { get_conn_info()
5898 cmd->user_data = hci_conn_get(conn); get_conn_info()
5899 cmd->cmd_complete = conn_info_cmd_complete; get_conn_info()
5917 static int clock_info_cmd_complete(struct mgmt_pending_cmd *cmd, u8 status) clock_info_cmd_complete() argument
5919 struct hci_conn *conn = cmd->user_data; clock_info_cmd_complete()
5925 memcpy(&rp.addr, &cmd->param, sizeof(rp.addr)); clock_info_cmd_complete()
5930 hdev = hci_dev_get(cmd->index); clock_info_cmd_complete()
5942 err = mgmt_cmd_complete(cmd->sk, cmd->index, cmd->opcode, status, &rp, clock_info_cmd_complete()
5956 struct mgmt_pending_cmd *cmd; get_clock_info_complete() local
5974 cmd = pending_find_data(MGMT_OP_GET_CLOCK_INFO, hdev, conn); get_clock_info_complete()
5975 if (!cmd) get_clock_info_complete()
5978 cmd->cmd_complete(cmd, mgmt_status(status)); get_clock_info_complete()
5979 mgmt_pending_remove(cmd); get_clock_info_complete()
5991 struct mgmt_pending_cmd *cmd; get_clock_info() local
6030 cmd = mgmt_pending_add(sk, MGMT_OP_GET_CLOCK_INFO, hdev, data, len); get_clock_info()
6031 if (!cmd) { get_clock_info()
6036 cmd->cmd_complete = clock_info_cmd_complete; get_clock_info()
6045 cmd->user_data = hci_conn_get(conn); get_clock_info()
6054 mgmt_pending_remove(cmd); get_clock_info()
6147 struct mgmt_pending_cmd *cmd; add_device_complete() local
6153 cmd = pending_find(MGMT_OP_ADD_DEVICE, hdev); add_device_complete()
6154 if (!cmd) add_device_complete()
6157 cmd->cmd_complete(cmd, mgmt_status(status)); add_device_complete()
6158 mgmt_pending_remove(cmd); add_device_complete()
6168 struct mgmt_pending_cmd *cmd; add_device() local
6190 cmd = mgmt_pending_add(sk, MGMT_OP_ADD_DEVICE, hdev, data, len); add_device()
6191 if (!cmd) { add_device()
6196 cmd->cmd_complete = addr_cmd_complete; add_device()
6201 err = cmd->cmd_complete(cmd, add_device()
6203 mgmt_pending_remove(cmd); add_device()
6232 err = cmd->cmd_complete(cmd, MGMT_STATUS_INVALID_PARAMS); add_device()
6233 mgmt_pending_remove(cmd); add_device()
6242 err = cmd->cmd_complete(cmd, MGMT_STATUS_FAILED); add_device()
6243 mgmt_pending_remove(cmd); add_device()
6256 err = cmd->cmd_complete(cmd, MGMT_STATUS_SUCCESS); add_device()
6257 mgmt_pending_remove(cmd); add_device()
6278 struct mgmt_pending_cmd *cmd; remove_device_complete() local
6284 cmd = pending_find(MGMT_OP_REMOVE_DEVICE, hdev); remove_device_complete()
6285 if (!cmd) remove_device_complete()
6288 cmd->cmd_complete(cmd, mgmt_status(status)); remove_device_complete()
6289 mgmt_pending_remove(cmd); remove_device_complete()
6299 struct mgmt_pending_cmd *cmd; remove_device() local
6309 cmd = mgmt_pending_add(sk, MGMT_OP_REMOVE_DEVICE, hdev, data, len); remove_device()
6310 if (!cmd) { remove_device()
6315 cmd->cmd_complete = addr_cmd_complete; remove_device()
6322 err = cmd->cmd_complete(cmd, remove_device()
6324 mgmt_pending_remove(cmd); remove_device()
6333 err = cmd->cmd_complete(cmd, remove_device()
6335 mgmt_pending_remove(cmd); remove_device()
6354 err = cmd->cmd_complete(cmd, remove_device()
6356 mgmt_pending_remove(cmd); remove_device()
6363 err = cmd->cmd_complete(cmd, remove_device()
6365 mgmt_pending_remove(cmd); remove_device()
6371 err = cmd->cmd_complete(cmd, remove_device()
6373 mgmt_pending_remove(cmd); remove_device()
6388 err = cmd->cmd_complete(cmd, remove_device()
6390 mgmt_pending_remove(cmd); remove_device()
6427 err = cmd->cmd_complete(cmd, MGMT_STATUS_SUCCESS); remove_device()
6428 mgmt_pending_remove(cmd); remove_device()
6647 struct mgmt_pending_cmd *cmd; read_local_oob_ext_data_complete() local
6653 cmd = pending_find(MGMT_OP_READ_LOCAL_OOB_EXT_DATA, hdev); read_local_oob_ext_data_complete()
6654 if (!cmd) read_local_oob_ext_data_complete()
6657 mgmt_cp = cmd->param; read_local_oob_ext_data_complete()
6736 err = mgmt_cmd_complete(cmd->sk, hdev->id, read_local_oob_ext_data_complete()
6742 hci_sock_set_flag(cmd->sk, HCI_MGMT_OOB_DATA_EVENTS); read_local_oob_ext_data_complete()
6746 HCI_MGMT_OOB_DATA_EVENTS, cmd->sk); read_local_oob_ext_data_complete()
6749 mgmt_pending_remove(cmd); read_local_oob_ext_data_complete()
6755 struct mgmt_pending_cmd *cmd; read_local_ssp_oob_req() local
6759 cmd = mgmt_pending_add(sk, MGMT_OP_READ_LOCAL_OOB_EXT_DATA, hdev, read_local_ssp_oob_req()
6761 if (!cmd) read_local_ssp_oob_req()
6773 mgmt_pending_remove(cmd); read_local_ssp_oob_req()
7058 struct mgmt_pending_cmd *cmd; add_advertising_complete() local
7068 cmd = pending_find(MGMT_OP_ADD_ADVERTISING, hdev); add_advertising_complete()
7088 advertising_removed(cmd ? cmd->sk : NULL, hdev, instance); add_advertising_complete()
7091 if (!cmd) add_advertising_complete()
7094 cp = cmd->param; add_advertising_complete()
7098 mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, add_advertising_complete()
7101 mgmt_cmd_complete(cmd->sk, cmd->index, cmd->opcode, add_advertising_complete()
7104 mgmt_pending_remove(cmd); add_advertising_complete()
7148 struct mgmt_pending_cmd *cmd; add_advertising() local
7251 cmd = mgmt_pending_add(sk, MGMT_OP_ADD_ADVERTISING, hdev, data, add_advertising()
7253 if (!cmd) { add_advertising()
7266 mgmt_pending_remove(cmd); add_advertising()
7277 struct mgmt_pending_cmd *cmd; remove_advertising_complete() local
7289 cmd = pending_find(MGMT_OP_REMOVE_ADVERTISING, hdev); remove_advertising_complete()
7290 if (!cmd) remove_advertising_complete()
7293 cp = cmd->param; remove_advertising_complete()
7296 mgmt_cmd_complete(cmd->sk, cmd->index, cmd->opcode, MGMT_STATUS_SUCCESS, remove_advertising_complete()
7298 mgmt_pending_remove(cmd); remove_advertising_complete()
7309 struct mgmt_pending_cmd *cmd; remove_advertising() local
7359 cmd = mgmt_pending_add(sk, MGMT_OP_REMOVE_ADVERTISING, hdev, data, remove_advertising()
7361 if (!cmd) { remove_advertising()
7368 mgmt_pending_remove(cmd); remove_advertising()
7723 struct mgmt_pending_cmd *cmd; mgmt_set_powered_failed() local
7726 cmd = pending_find(MGMT_OP_SET_POWERED, hdev); mgmt_set_powered_failed()
7727 if (!cmd) mgmt_set_powered_failed()
7735 mgmt_cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_POWERED, status); mgmt_set_powered_failed()
7737 mgmt_pending_remove(cmd); mgmt_set_powered_failed()
7960 static void disconnect_rsp(struct mgmt_pending_cmd *cmd, void *data) disconnect_rsp() argument
7964 cmd->cmd_complete(cmd, 0); disconnect_rsp()
7966 *sk = cmd->sk; disconnect_rsp()
7969 mgmt_pending_remove(cmd); disconnect_rsp()
7972 static void unpair_device_rsp(struct mgmt_pending_cmd *cmd, void *data) unpair_device_rsp() argument
7975 struct mgmt_cp_unpair_device *cp = cmd->param; unpair_device_rsp()
7977 device_unpaired(hdev, &cp->addr.bdaddr, cp->addr.type, cmd->sk); unpair_device_rsp()
7979 cmd->cmd_complete(cmd, 0); unpair_device_rsp()
7980 mgmt_pending_remove(cmd); unpair_device_rsp()
7985 struct mgmt_pending_cmd *cmd; mgmt_powering_down() local
7988 cmd = pending_find(MGMT_OP_SET_POWERED, hdev); mgmt_powering_down()
7989 if (!cmd) mgmt_powering_down()
7992 cp = cmd->param; mgmt_powering_down()
8040 struct mgmt_pending_cmd *cmd; mgmt_disconnect_failed() local
8045 cmd = pending_find(MGMT_OP_DISCONNECT, hdev); mgmt_disconnect_failed()
8046 if (!cmd) mgmt_disconnect_failed()
8049 cp = cmd->param; mgmt_disconnect_failed()
8057 cmd->cmd_complete(cmd, mgmt_status(status)); mgmt_disconnect_failed()
8058 mgmt_pending_remove(cmd); mgmt_disconnect_failed()
8095 struct mgmt_pending_cmd *cmd; mgmt_pin_code_reply_complete() local
8097 cmd = pending_find(MGMT_OP_PIN_CODE_REPLY, hdev); mgmt_pin_code_reply_complete()
8098 if (!cmd) mgmt_pin_code_reply_complete()
8101 cmd->cmd_complete(cmd, mgmt_status(status)); mgmt_pin_code_reply_complete()
8102 mgmt_pending_remove(cmd); mgmt_pin_code_reply_complete()
8108 struct mgmt_pending_cmd *cmd; mgmt_pin_code_neg_reply_complete() local
8110 cmd = pending_find(MGMT_OP_PIN_CODE_NEG_REPLY, hdev); mgmt_pin_code_neg_reply_complete()
8111 if (!cmd) mgmt_pin_code_neg_reply_complete()
8114 cmd->cmd_complete(cmd, mgmt_status(status)); mgmt_pin_code_neg_reply_complete()
8115 mgmt_pending_remove(cmd); mgmt_pin_code_neg_reply_complete()
8153 struct mgmt_pending_cmd *cmd; user_pairing_resp_complete() local
8155 cmd = pending_find(opcode, hdev); user_pairing_resp_complete()
8156 if (!cmd) user_pairing_resp_complete()
8159 cmd->cmd_complete(cmd, mgmt_status(status)); user_pairing_resp_complete()
8160 mgmt_pending_remove(cmd); user_pairing_resp_complete()
8214 struct mgmt_pending_cmd *cmd; mgmt_auth_failed() local
8221 cmd = find_pairing(conn); mgmt_auth_failed()
8224 cmd ? cmd->sk : NULL); mgmt_auth_failed()
8226 if (cmd) { mgmt_auth_failed()
8227 cmd->cmd_complete(cmd, status); mgmt_auth_failed()
8228 mgmt_pending_remove(cmd); mgmt_auth_failed()
8327 static void sk_lookup(struct mgmt_pending_cmd *cmd, void *data) sk_lookup() argument
8332 match->sk = cmd->sk; sk_lookup()
8357 struct mgmt_pending_cmd *cmd; mgmt_set_local_name_complete() local
8366 cmd = pending_find(MGMT_OP_SET_LOCAL_NAME, hdev); mgmt_set_local_name_complete()
8367 if (!cmd) { mgmt_set_local_name_complete()
8378 cmd ? cmd->sk : NULL); mgmt_set_local_name_complete()
/linux-4.4.14/drivers/net/wireless/libertas_tf/
H A DMakefile1 libertas_tf-objs := main.o cmd.o
H A Dcmd.c85 struct cmd_ds_get_hw_spec cmd; lbtf_update_hw_spec() local
91 memset(&cmd, 0, sizeof(cmd)); lbtf_update_hw_spec()
92 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbtf_update_hw_spec()
93 memcpy(cmd.permanentaddr, priv->current_addr, ETH_ALEN); lbtf_update_hw_spec()
94 ret = lbtf_cmd_with_response(priv, CMD_GET_HW_SPEC, &cmd); lbtf_update_hw_spec()
98 priv->fwcapinfo = le32_to_cpu(cmd.fwcapinfo); lbtf_update_hw_spec()
102 priv->fwrelease = le32_to_cpu(cmd.fwrelease); lbtf_update_hw_spec()
107 cmd.permanentaddr, lbtf_update_hw_spec()
114 cmd.hwifversion, cmd.version); lbtf_update_hw_spec()
120 priv->regioncode = le16_to_cpu(cmd.regioncode) & 0xFF; lbtf_update_hw_spec()
135 memmove(priv->current_addr, cmd.permanentaddr, ETH_ALEN); lbtf_update_hw_spec()
156 struct cmd_ds_802_11_rf_channel cmd; lbtf_set_channel() local
160 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbtf_set_channel()
161 cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_SET); lbtf_set_channel()
162 cmd.channel = cpu_to_le16(channel); lbtf_set_channel()
164 ret = lbtf_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, &cmd); lbtf_set_channel()
171 struct cmd_ds_802_11_beacon_set cmd; lbtf_beacon_set() local
180 size = sizeof(cmd) - sizeof(cmd.beacon) + beacon->len; lbtf_beacon_set()
181 cmd.hdr.size = cpu_to_le16(size); lbtf_beacon_set()
182 cmd.len = cpu_to_le16(beacon->len); lbtf_beacon_set()
183 memcpy(cmd.beacon, (u8 *) beacon->data, beacon->len); lbtf_beacon_set()
185 lbtf_cmd_async(priv, CMD_802_11_BEACON_SET, &cmd.hdr, size); lbtf_beacon_set()
194 struct cmd_ds_802_11_beacon_control cmd; lbtf_beacon_ctrl() local
197 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbtf_beacon_ctrl()
198 cmd.action = cpu_to_le16(CMD_ACT_SET); lbtf_beacon_ctrl()
199 cmd.beacon_enable = cpu_to_le16(beacon_enable); lbtf_beacon_ctrl()
200 cmd.beacon_period = cpu_to_le16(beacon_int); lbtf_beacon_ctrl()
202 lbtf_cmd_async(priv, CMD_802_11_BEACON_CTRL, &cmd.hdr, sizeof(cmd)); lbtf_beacon_ctrl()
220 lbtf_deb_host("DNLD_CMD: cmd size is zero\n"); lbtf_queue_cmd()
240 struct cmd_header *cmd; lbtf_submit_command() local
248 cmd = cmdnode->cmdbuf; lbtf_submit_command()
252 cmdsize = le16_to_cpu(cmd->size); lbtf_submit_command()
253 command = le16_to_cpu(cmd->command); lbtf_submit_command()
256 command, le16_to_cpu(cmd->seqnum), cmdsize); lbtf_submit_command()
259 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); lbtf_submit_command()
308 void lbtf_complete_command(struct lbtf_private *priv, struct cmd_ctrl_node *cmd, lbtf_complete_command() argument
311 cmd->result = result; lbtf_complete_command()
312 cmd->cmdwaitqwoken = 1; lbtf_complete_command()
313 wake_up_interruptible(&cmd->cmdwait_q); lbtf_complete_command()
315 if (!cmd->callback) lbtf_complete_command()
316 __lbtf_cleanup_and_insert_cmd(priv, cmd); lbtf_complete_command()
322 struct cmd_ds_mac_multicast_addr cmd; lbtf_cmd_set_mac_multicast_addr() local
326 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbtf_cmd_set_mac_multicast_addr()
327 cmd.action = cpu_to_le16(CMD_ACT_SET); lbtf_cmd_set_mac_multicast_addr()
329 cmd.nr_of_adrs = cpu_to_le16((u16) priv->nr_of_multicastmacaddr); lbtf_cmd_set_mac_multicast_addr()
331 lbtf_deb_cmd("MULTICAST_ADR: setting %d addresses\n", cmd.nr_of_adrs); lbtf_cmd_set_mac_multicast_addr()
333 memcpy(cmd.maclist, priv->multicastlist, lbtf_cmd_set_mac_multicast_addr()
336 lbtf_cmd_async(priv, CMD_MAC_MULTICAST_ADR, &cmd.hdr, sizeof(cmd)); lbtf_cmd_set_mac_multicast_addr()
344 struct cmd_ds_set_mode cmd; lbtf_set_mode() local
347 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbtf_set_mode()
348 cmd.mode = cpu_to_le16(mode); lbtf_set_mode()
350 lbtf_cmd_async(priv, CMD_802_11_SET_MODE, &cmd.hdr, sizeof(cmd)); lbtf_set_mode()
357 struct cmd_ds_set_bssid cmd; lbtf_set_bssid() local
360 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbtf_set_bssid()
361 cmd.activate = activate ? 1 : 0; lbtf_set_bssid()
363 memcpy(cmd.bssid, bssid, ETH_ALEN); lbtf_set_bssid()
365 lbtf_cmd_async(priv, CMD_802_11_SET_BSSID, &cmd.hdr, sizeof(cmd)); lbtf_set_bssid()
371 struct cmd_ds_802_11_mac_address cmd; lbtf_set_mac_address() local
374 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbtf_set_mac_address()
375 cmd.action = cpu_to_le16(CMD_ACT_SET); lbtf_set_mac_address()
377 memcpy(cmd.macadd, mac_addr, ETH_ALEN); lbtf_set_mac_address()
379 lbtf_cmd_async(priv, CMD_802_11_MAC_ADDRESS, &cmd.hdr, sizeof(cmd)); lbtf_set_mac_address()
387 struct cmd_ds_802_11_radio_control cmd; lbtf_set_radio_control() local
391 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbtf_set_radio_control()
392 cmd.action = cpu_to_le16(CMD_ACT_SET); lbtf_set_radio_control()
396 cmd.control = cpu_to_le16(SET_SHORT_PREAMBLE); lbtf_set_radio_control()
400 cmd.control = cpu_to_le16(SET_LONG_PREAMBLE); lbtf_set_radio_control()
405 cmd.control = cpu_to_le16(SET_AUTO_PREAMBLE); lbtf_set_radio_control()
410 cmd.control |= cpu_to_le16(TURN_ON_RF); lbtf_set_radio_control()
412 cmd.control &= cpu_to_le16(~TURN_ON_RF); lbtf_set_radio_control()
417 ret = lbtf_cmd_with_response(priv, CMD_802_11_RADIO_CONTROL, &cmd); lbtf_set_radio_control()
425 struct cmd_ds_mac_control cmd; lbtf_set_mac_control() local
428 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbtf_set_mac_control()
429 cmd.action = cpu_to_le16(priv->mac_control); lbtf_set_mac_control()
430 cmd.reserved = 0; lbtf_set_mac_control()
433 &cmd.hdr, sizeof(cmd)); lbtf_set_mac_control()
439 * lbtf_allocate_cmd_buffer - Allocates cmd buffer, links it to free cmd queue
487 * lbtf_free_cmd_buffer - Frees the cmd buffer.
500 /* need to check if cmd array is allocated or not */ lbtf_free_cmd_buffer()
524 * lbtf_get_cmd_ctrl_node - Gets free cmd node from free cmd queue.
558 * lbtf_execute_next_command: execute next command in cmd pending queue.
567 struct cmd_header *cmd; lbtf_execute_next_command() local
591 cmd = cmdnode->cmdbuf; lbtf_execute_next_command()
595 le16_to_cpu(cmd->command)); lbtf_execute_next_command()
741 pr_info("libertastf: cmd response 0x%04x, seq %d, size %d\n", lbtf_process_rx_command()
/linux-4.4.14/drivers/net/wireless/ti/wl12xx/
H A DMakefile1 wl12xx-objs = main.o cmd.o acx.o debugfs.o scan.o event.o
H A Dscan.c99 struct wl1271_cmd_scan *cmd; wl1271_scan_send() local
108 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl1271_scan_send()
110 if (!cmd || !trigger) { wl1271_scan_send()
123 cmd->params.role_id = wlvif->dev_role_id; wl1271_scan_send()
125 cmd->params.role_id = wlvif->role_id; wl1271_scan_send()
127 if (WARN_ON(cmd->params.role_id == WL12XX_INVALID_ROLE_ID)) { wl1271_scan_send()
132 cmd->params.scan_options = cpu_to_le16(scan_options); wl1271_scan_send()
134 cmd->params.n_ch = wl1271_get_scan_channels(wl, wl->scan.req, wl1271_scan_send()
135 cmd->channels, wl1271_scan_send()
137 if (cmd->params.n_ch == 0) { wl1271_scan_send()
142 cmd->params.tx_rate = cpu_to_le32(basic_rate); wl1271_scan_send()
143 cmd->params.n_probe_reqs = wl->conf.scan.num_probe_reqs; wl1271_scan_send()
144 cmd->params.tid_trigger = CONF_TX_AC_ANY_TID; wl1271_scan_send()
145 cmd->params.scan_tag = WL1271_SCAN_DEFAULT_TAG; wl1271_scan_send()
148 cmd->params.band = WL1271_SCAN_BAND_2_4_GHZ; wl1271_scan_send()
150 cmd->params.band = WL1271_SCAN_BAND_5_GHZ; wl1271_scan_send()
153 cmd->params.ssid_len = wl->scan.ssid_len; wl1271_scan_send()
154 memcpy(cmd->params.ssid, wl->scan.ssid, wl->scan.ssid_len); wl1271_scan_send()
157 memcpy(cmd->addr, vif->addr, ETH_ALEN); wl1271_scan_send()
160 cmd->params.role_id, band, wl1271_scan_send()
177 wl1271_dump(DEBUG_SCAN, "SCAN: ", cmd, sizeof(*cmd)); wl1271_scan_send()
179 ret = wl1271_cmd_send(wl, CMD_SCAN, cmd, sizeof(*cmd), 0); wl1271_scan_send()
186 kfree(cmd); wl1271_scan_send()
193 struct wl1271_cmd_header *cmd = NULL; wl12xx_scan_stop() local
199 wl1271_debug(DEBUG_CMD, "cmd scan stop"); wl12xx_scan_stop()
201 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_scan_stop()
202 if (!cmd) { wl12xx_scan_stop()
207 ret = wl1271_cmd_send(wl, CMD_STOP_SCAN, cmd, wl12xx_scan_stop()
208 sizeof(*cmd), 0); wl12xx_scan_stop()
210 wl1271_error("cmd stop_scan failed"); wl12xx_scan_stop()
214 kfree(cmd); wl12xx_scan_stop()
306 static void wl12xx_adjust_channels(struct wl1271_cmd_sched_scan_config *cmd, wl12xx_adjust_channels() argument
309 memcpy(cmd->passive, cmd_channels->passive, sizeof(cmd->passive)); wl12xx_adjust_channels()
310 memcpy(cmd->active, cmd_channels->active, sizeof(cmd->active)); wl12xx_adjust_channels()
311 cmd->dfs = cmd_channels->dfs; wl12xx_adjust_channels()
312 cmd->n_pactive_ch = cmd_channels->passive_active; wl12xx_adjust_channels()
314 memcpy(cmd->channels_2, cmd_channels->channels_2, wl12xx_adjust_channels()
315 sizeof(cmd->channels_2)); wl12xx_adjust_channels()
316 memcpy(cmd->channels_5, cmd_channels->channels_5, wl12xx_adjust_channels()
317 sizeof(cmd->channels_5)); wl12xx_adjust_channels()
332 wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config"); wl1271_scan_sched_scan_config()
433 wl1271_debug(DEBUG_CMD, "cmd periodic scan start"); wl1271_scan_sched_scan_start()
479 wl1271_debug(DEBUG_CMD, "cmd periodic scan stop"); wl12xx_scan_sched_scan_stop()
/linux-4.4.14/tools/perf/tests/
H A Dpython-use.c13 char *cmd; test__python_use() local
16 if (asprintf(&cmd, "echo \"import sys ; sys.path.append('%s'); import perf\" | %s %s", test__python_use()
20 ret = system(cmd) ? -1 : 0; test__python_use()
21 free(cmd); test__python_use()
/linux-4.4.14/drivers/clk/
H A Dclk-mb86s7x.c55 struct mb86s7x_peri_clk cmd; crg_gate_control() local
58 cmd.payload_size = sizeof(cmd); crg_gate_control()
59 cmd.cntrlr = crgclk->cntrlr; crg_gate_control()
60 cmd.domain = crgclk->domain; crg_gate_control()
61 cmd.port = crgclk->port; crg_gate_control()
62 cmd.en = en; crg_gate_control()
65 if (cmd.port == 8) crg_gate_control()
69 __func__, __LINE__, cmd.cntrlr, crg_gate_control()
70 cmd.domain, cmd.port, cmd.en); crg_gate_control()
73 &cmd, sizeof(cmd)); crg_gate_control()
80 __func__, __LINE__, cmd.cntrlr, crg_gate_control()
81 cmd.domain, cmd.port, cmd.en); crg_gate_control()
84 if (cmd.en != en) crg_gate_control()
106 struct mb86s7x_peri_clk cmd; crg_rate_control() local
109 cmd.payload_size = sizeof(cmd); crg_rate_control()
110 cmd.cntrlr = crgclk->cntrlr; crg_rate_control()
111 cmd.domain = crgclk->domain; crg_rate_control()
112 cmd.port = crgclk->port; crg_rate_control()
113 cmd.frequency = *rate; crg_rate_control()
118 __func__, __LINE__, cmd.cntrlr, crg_rate_control()
119 cmd.domain, cmd.port, cmd.frequency); crg_rate_control()
123 __func__, __LINE__, cmd.cntrlr, crg_rate_control()
124 cmd.domain, cmd.port); crg_rate_control()
127 ret = mb86s7x_send_packet(code, &cmd, sizeof(cmd)); crg_rate_control()
135 __func__, __LINE__, cmd.cntrlr, crg_rate_control()
136 cmd.domain, cmd.port, cmd.frequency); crg_rate_control()
139 __func__, __LINE__, cmd.cntrlr, crg_rate_control()
140 cmd.domain, cmd.port, cmd.frequency); crg_rate_control()
142 *rate = cmd.frequency; crg_rate_control()
266 struct mb86s7x_cpu_freq cmd; mhu_cluster_rate() local
269 cmd.payload_size = sizeof(cmd); mhu_cluster_rate()
270 cmd.cluster_class = 0; mhu_cluster_rate()
271 cmd.cluster_id = clc->cluster; mhu_cluster_rate()
272 cmd.cpu_id = 0; mhu_cluster_rate()
273 cmd.frequency = *rate; mhu_cluster_rate()
281 __func__, __LINE__, cmd.cluster_class, mhu_cluster_rate()
282 cmd.cluster_id, cmd.cpu_id, cmd.frequency); mhu_cluster_rate()
284 ret = mb86s7x_send_packet(code, &cmd, sizeof(cmd)); mhu_cluster_rate()
291 __func__, __LINE__, cmd.cluster_class, mhu_cluster_rate()
292 cmd.cluster_id, cmd.cpu_id, cmd.frequency); mhu_cluster_rate()
294 *rate = cmd.frequency; mhu_cluster_rate()
/linux-4.4.14/drivers/video/fbdev/mb862xx/
H A Dmb862xxfb_accel.c49 __u32 cmd[6]; mb86290fb_copyarea() local
51 cmd[0] = (GDC_TYPE_SETREGISTER << 24) | (1 << 16) | GDC_REG_MODE_BITMAP; mb86290fb_copyarea()
53 cmd[1] = (2 << 7) | (GDC_ROP_COPY << 9); mb86290fb_copyarea()
54 cmd[2] = GDC_TYPE_BLTCOPYP << 24; mb86290fb_copyarea()
57 cmd[2] |= GDC_CMD_BLTCOPY_TOP_LEFT << 16; mb86290fb_copyarea()
59 cmd[2] |= GDC_CMD_BLTCOPY_BOTTOM_LEFT << 16; mb86290fb_copyarea()
61 cmd[2] |= GDC_CMD_BLTCOPY_TOP_RIGHT << 16; mb86290fb_copyarea()
63 cmd[2] |= GDC_CMD_BLTCOPY_BOTTOM_RIGHT << 16; mb86290fb_copyarea()
65 cmd[3] = (area->sy << 16) | area->sx; mb86290fb_copyarea()
66 cmd[4] = (area->dy << 16) | area->dx; mb86290fb_copyarea()
67 cmd[5] = (area->height << 16) | area->width; mb86290fb_copyarea()
68 mb862xxfb_write_fifo(6, cmd, info); mb86290fb_copyarea()
72 * Fill in the cmd array /GDC FIFO commands/ to draw a 1bit image.
73 * Make sure cmd has enough room!
75 static void mb86290fb_imageblit1(u32 *cmd, u16 step, u16 dx, u16 dy, mb86290fb_imageblit1() argument
85 cmd[0] = (GDC_TYPE_SETREGISTER << 24) | (1 << 16) | GDC_REG_MODE_BITMAP; mb86290fb_imageblit1()
87 cmd[1] = (2 << 7) | (GDC_ROP_COPY << 9); mb86290fb_imageblit1()
88 cmd[2] = mb86290fb_imageblit1()
90 cmd[3] = fgcolor; mb86290fb_imageblit1()
91 cmd[4] = mb86290fb_imageblit1()
93 cmd[5] = bgcolor; mb86290fb_imageblit1()
100 cmd[6] = (GDC_TYPE_DRAWBITMAPP << 24) | mb86290fb_imageblit1()
102 cmd[7] = (dy << 16) | dx; mb86290fb_imageblit1()
103 cmd[8] = (height << 16) | width; mb86290fb_imageblit1()
106 memcpy(&cmd[9 + i * step], line, step << 2); mb86290fb_imageblit1()
111 cmd[9 + i * step + k] = mb86290fb_imageblit1()
112 cpu_to_be32(cmd[9 + i * step + k]); mb86290fb_imageblit1()
121 * Fill in the cmd array /GDC FIFO commands/ to draw a 8bit image.
122 * Make sure cmd has enough room!
124 static void mb86290fb_imageblit8(u32 *cmd, u16 step, u16 dx, u16 dy, mb86290fb_imageblit8() argument
133 cmd[0] = (GDC_TYPE_DRAWBITMAPP << 24) | mb86290fb_imageblit8()
135 cmd[1] = (dy << 16) | dx; mb86290fb_imageblit8()
136 cmd[2] = (height << 16) | width; mb86290fb_imageblit8()
145 cmd[3 + i * step + j] = mb86290fb_imageblit8()
148 cmd[3 + i * step + j] |= mb86290fb_imageblit8()
160 * Fill in the cmd array /GDC FIFO commands/ to draw a 16bit image.
161 * Make sure cmd has enough room!
163 static void mb86290fb_imageblit16(u32 *cmd, u16 step, u16 dx, u16 dy, mb86290fb_imageblit16() argument
176 cmd[0] = (GDC_TYPE_DRAWBITMAPP << 24) | mb86290fb_imageblit16()
178 cmd[1] = (dy << 16) | dx; mb86290fb_imageblit16()
179 cmd[2] = (height << 16) | width; mb86290fb_imageblit16()
182 memcpy(&cmd[3 + i * step], line, step); mb86290fb_imageblit16()
192 u32 *cmd = NULL; mb86290fb_imageblit() local
248 cmd = kmalloc(cmdlen * 4, GFP_DMA); mb86290fb_imageblit()
249 if (!cmd) mb86290fb_imageblit()
251 cmdfn(cmd, step, dx, dy, width, height, fgcolor, bgcolor, image, info); mb86290fb_imageblit()
252 mb862xxfb_write_fifo(cmdlen, cmd, info); mb86290fb_imageblit()
253 kfree(cmd); mb86290fb_imageblit()
261 u32 cmd[7]; mb86290fb_fillrect() local
288 cmd[1] = (2 << 7) | (GDC_ROP_XOR << 9); mb86290fb_fillrect()
293 cmd[1] = (2 << 7) | (GDC_ROP_COPY << 9); mb86290fb_fillrect()
298 cmd[0] = (GDC_TYPE_SETREGISTER << 24) | (1 << 16) | GDC_REG_MODE_BITMAP; mb86290fb_fillrect()
299 /* cmd[1] set earlier */ mb86290fb_fillrect()
300 cmd[2] = mb86290fb_fillrect()
302 cmd[3] = fg; mb86290fb_fillrect()
303 cmd[4] = (GDC_TYPE_DRAWRECTP << 24) | (GDC_CMD_BLT_FILL << 16); mb86290fb_fillrect()
304 cmd[5] = (rect->dy << 16) | (rect->dx); mb86290fb_fillrect()
305 cmd[6] = (height << 16) | width; mb86290fb_fillrect()
307 mb862xxfb_write_fifo(7, cmd, info); mb86290fb_fillrect()
/linux-4.4.14/drivers/net/wireless/ti/wlcore/
H A Dcmd.c36 #include "cmd.h"
51 * return the cmd status code on success.
56 struct wl1271_cmd_header *cmd; __wlcore_cmd_send() local
67 if (WARN_ON_ONCE(len < sizeof(*cmd))) __wlcore_cmd_send()
70 cmd = buf; __wlcore_cmd_send()
71 cmd->id = cpu_to_le16(id); __wlcore_cmd_send()
72 cmd->status = 0; __wlcore_cmd_send()
116 ret = wlcore_read(wl, wl->cmd_box_addr, cmd, res_len, false); __wlcore_cmd_send()
120 status = le16_to_cpu(cmd->status); __wlcore_cmd_send()
131 * send command to fw and return cmd status on success
233 struct wl12xx_cmd_role_enable *cmd; wl12xx_cmd_role_enable() local
236 wl1271_debug(DEBUG_CMD, "cmd role enable"); wl12xx_cmd_role_enable()
241 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_role_enable()
242 if (!cmd) { wl12xx_cmd_role_enable()
248 cmd->role_id = find_first_zero_bit(wl->roles_map, WL12XX_MAX_ROLES); wl12xx_cmd_role_enable()
249 if (cmd->role_id >= WL12XX_MAX_ROLES) { wl12xx_cmd_role_enable()
254 memcpy(cmd->mac_address, addr, ETH_ALEN); wl12xx_cmd_role_enable()
255 cmd->role_type = role_type; wl12xx_cmd_role_enable()
257 ret = wl1271_cmd_send(wl, CMD_ROLE_ENABLE, cmd, sizeof(*cmd), 0); wl12xx_cmd_role_enable()
259 wl1271_error("failed to initiate cmd role enable"); wl12xx_cmd_role_enable()
263 __set_bit(cmd->role_id, wl->roles_map); wl12xx_cmd_role_enable()
264 *role_id = cmd->role_id; wl12xx_cmd_role_enable()
267 kfree(cmd); wl12xx_cmd_role_enable()
275 struct wl12xx_cmd_role_disable *cmd; wl12xx_cmd_role_disable() local
278 wl1271_debug(DEBUG_CMD, "cmd role disable"); wl12xx_cmd_role_disable()
283 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_role_disable()
284 if (!cmd) { wl12xx_cmd_role_disable()
288 cmd->role_id = *role_id; wl12xx_cmd_role_disable()
290 ret = wl1271_cmd_send(wl, CMD_ROLE_DISABLE, cmd, sizeof(*cmd), 0); wl12xx_cmd_role_disable()
292 wl1271_error("failed to initiate cmd role disable"); wl12xx_cmd_role_disable()
300 kfree(cmd); wl12xx_cmd_role_disable()
429 struct wl12xx_cmd_role_start *cmd; wl12xx_cmd_role_start_dev() local
432 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_role_start_dev()
433 if (!cmd) { wl12xx_cmd_role_start_dev()
438 wl1271_debug(DEBUG_CMD, "cmd role start dev %d", wlvif->dev_role_id); wl12xx_cmd_role_start_dev()
440 cmd->role_id = wlvif->dev_role_id; wl12xx_cmd_role_start_dev()
442 cmd->band = WLCORE_BAND_5GHZ; wl12xx_cmd_role_start_dev()
443 cmd->channel = channel; wl12xx_cmd_role_start_dev()
450 cmd->device.hlid = wlvif->dev_hlid; wl12xx_cmd_role_start_dev()
451 cmd->device.session = wl->session_ids[wlvif->dev_hlid]; wl12xx_cmd_role_start_dev()
454 cmd->role_id, cmd->device.hlid, cmd->device.session); wl12xx_cmd_role_start_dev()
456 ret = wl1271_cmd_send(wl, CMD_ROLE_START, cmd, sizeof(*cmd), 0); wl12xx_cmd_role_start_dev()
458 wl1271_error("failed to initiate cmd role enable"); wl12xx_cmd_role_start_dev()
469 kfree(cmd); wl12xx_cmd_role_start_dev()
478 struct wl12xx_cmd_role_stop *cmd; wl12xx_cmd_role_stop_dev() local
484 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_role_stop_dev()
485 if (!cmd) { wl12xx_cmd_role_stop_dev()
490 wl1271_debug(DEBUG_CMD, "cmd role stop dev"); wl12xx_cmd_role_stop_dev()
492 cmd->role_id = wlvif->dev_role_id; wl12xx_cmd_role_stop_dev()
493 cmd->disc_type = DISCONNECT_IMMEDIATE; wl12xx_cmd_role_stop_dev()
494 cmd->reason = cpu_to_le16(WLAN_REASON_UNSPECIFIED); wl12xx_cmd_role_stop_dev()
496 ret = wl1271_cmd_send(wl, CMD_ROLE_STOP, cmd, sizeof(*cmd), 0); wl12xx_cmd_role_stop_dev()
498 wl1271_error("failed to initiate cmd role stop"); wl12xx_cmd_role_stop_dev()
505 kfree(cmd); wl12xx_cmd_role_stop_dev()
514 struct wl12xx_cmd_role_start *cmd; wl12xx_cmd_role_start_sta() local
518 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_role_start_sta()
519 if (!cmd) { wl12xx_cmd_role_start_sta()
524 wl1271_debug(DEBUG_CMD, "cmd role start sta %d", wlvif->role_id); wl12xx_cmd_role_start_sta()
526 cmd->role_id = wlvif->role_id; wl12xx_cmd_role_start_sta()
528 cmd->band = WLCORE_BAND_5GHZ; wl12xx_cmd_role_start_sta()
529 cmd->channel = wlvif->channel; wl12xx_cmd_role_start_sta()
530 cmd->sta.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set); wl12xx_cmd_role_start_sta()
531 cmd->sta.beacon_interval = cpu_to_le16(wlvif->beacon_int); wl12xx_cmd_role_start_sta()
532 cmd->sta.ssid_type = WL12XX_SSID_TYPE_ANY; wl12xx_cmd_role_start_sta()
533 cmd->sta.ssid_len = wlvif->ssid_len; wl12xx_cmd_role_start_sta()
534 memcpy(cmd->sta.ssid, wlvif->ssid, wlvif->ssid_len); wl12xx_cmd_role_start_sta()
535 memcpy(cmd->sta.bssid, vif->bss_conf.bssid, ETH_ALEN); wl12xx_cmd_role_start_sta()
542 cmd->sta.local_rates = cpu_to_le32(supported_rates); wl12xx_cmd_role_start_sta()
544 cmd->channel_type = wlcore_get_native_channel_type(wlvif->channel_type); wl12xx_cmd_role_start_sta()
551 cmd->sta.hlid = wlvif->sta.hlid; wl12xx_cmd_role_start_sta()
552 cmd->sta.session = wl->session_ids[wlvif->sta.hlid]; wl12xx_cmd_role_start_sta()
559 cmd->sta.remote_rates = cpu_to_le32(supported_rates); wl12xx_cmd_role_start_sta()
563 wlvif->role_id, cmd->sta.hlid, cmd->sta.session, wl12xx_cmd_role_start_sta()
566 ret = wl1271_cmd_send(wl, CMD_ROLE_START, cmd, sizeof(*cmd), 0); wl12xx_cmd_role_start_sta()
568 wl1271_error("failed to initiate cmd role start sta"); wl12xx_cmd_role_start_sta()
580 kfree(cmd); wl12xx_cmd_role_start_sta()
589 struct wl12xx_cmd_role_stop *cmd; wl12xx_cmd_role_stop_sta() local
595 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_role_stop_sta()
596 if (!cmd) { wl12xx_cmd_role_stop_sta()
601 wl1271_debug(DEBUG_CMD, "cmd role stop sta %d", wlvif->role_id); wl12xx_cmd_role_stop_sta()
603 cmd->role_id = wlvif->role_id; wl12xx_cmd_role_stop_sta()
604 cmd->disc_type = DISCONNECT_IMMEDIATE; wl12xx_cmd_role_stop_sta()
605 cmd->reason = cpu_to_le16(WLAN_REASON_UNSPECIFIED); wl12xx_cmd_role_stop_sta()
607 ret = wl1271_cmd_send(wl, CMD_ROLE_STOP, cmd, sizeof(*cmd), 0); wl12xx_cmd_role_stop_sta()
609 wl1271_error("failed to initiate cmd role stop sta"); wl12xx_cmd_role_stop_sta()
616 kfree(cmd); wl12xx_cmd_role_stop_sta()
624 struct wl12xx_cmd_role_start *cmd; wl12xx_cmd_role_start_ap() local
630 wl1271_debug(DEBUG_CMD, "cmd role start ap %d", wlvif->role_id); wl12xx_cmd_role_start_ap()
639 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_role_start_ap()
640 if (!cmd) { wl12xx_cmd_role_start_ap()
657 cmd->role_id = wlvif->role_id; wl12xx_cmd_role_start_ap()
658 cmd->ap.aging_period = cpu_to_le16(wl->conf.tx.ap_aging_period); wl12xx_cmd_role_start_ap()
659 cmd->ap.bss_index = WL1271_AP_BSS_INDEX; wl12xx_cmd_role_start_ap()
660 cmd->ap.global_hlid = wlvif->ap.global_hlid; wl12xx_cmd_role_start_ap()
661 cmd->ap.broadcast_hlid = wlvif->ap.bcast_hlid; wl12xx_cmd_role_start_ap()
662 cmd->ap.global_session_id = wl->session_ids[wlvif->ap.global_hlid]; wl12xx_cmd_role_start_ap()
663 cmd->ap.bcast_session_id = wl->session_ids[wlvif->ap.bcast_hlid]; wl12xx_cmd_role_start_ap()
664 cmd->ap.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set); wl12xx_cmd_role_start_ap()
665 cmd->ap.beacon_interval = cpu_to_le16(wlvif->beacon_int); wl12xx_cmd_role_start_ap()
666 cmd->ap.dtim_interval = bss_conf->dtim_period; wl12xx_cmd_role_start_ap()
667 cmd->ap.beacon_expiry = WL1271_AP_DEF_BEACON_EXP; wl12xx_cmd_role_start_ap()
669 cmd->ap.reset_tsf = 1; /* By default reset AP TSF */ wl12xx_cmd_role_start_ap()
670 cmd->ap.wmm = wlvif->wmm_enabled; wl12xx_cmd_role_start_ap()
671 cmd->channel = wlvif->channel; wl12xx_cmd_role_start_ap()
672 cmd->channel_type = wlcore_get_native_channel_type(wlvif->channel_type); wl12xx_cmd_role_start_ap()
676 cmd->ap.ssid_type = WL12XX_SSID_TYPE_PUBLIC; wl12xx_cmd_role_start_ap()
677 cmd->ap.ssid_len = wlvif->ssid_len; wl12xx_cmd_role_start_ap()
678 memcpy(cmd->ap.ssid, wlvif->ssid, wlvif->ssid_len); wl12xx_cmd_role_start_ap()
680 cmd->ap.ssid_type = WL12XX_SSID_TYPE_HIDDEN; wl12xx_cmd_role_start_ap()
681 cmd->ap.ssid_len = bss_conf->ssid_len; wl12xx_cmd_role_start_ap()
682 memcpy(cmd->ap.ssid, bss_conf->ssid, bss_conf->ssid_len); wl12xx_cmd_role_start_ap()
690 wl1271_debug(DEBUG_CMD, "cmd role start ap with supported_rates 0x%08x", wl12xx_cmd_role_start_ap()
693 cmd->ap.local_rates = cpu_to_le32(supported_rates); wl12xx_cmd_role_start_ap()
697 cmd->band = WLCORE_BAND_2_4GHZ; wl12xx_cmd_role_start_ap()
700 cmd->band = WLCORE_BAND_5GHZ; wl12xx_cmd_role_start_ap()
704 cmd->band = WLCORE_BAND_2_4GHZ; wl12xx_cmd_role_start_ap()
708 ret = wl1271_cmd_send(wl, CMD_ROLE_START, cmd, sizeof(*cmd), 0); wl12xx_cmd_role_start_ap()
710 wl1271_error("failed to initiate cmd role start ap"); wl12xx_cmd_role_start_ap()
723 kfree(cmd); wl12xx_cmd_role_start_ap()
731 struct wl12xx_cmd_role_stop *cmd; wl12xx_cmd_role_stop_ap() local
734 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_role_stop_ap()
735 if (!cmd) { wl12xx_cmd_role_stop_ap()
740 wl1271_debug(DEBUG_CMD, "cmd role stop ap %d", wlvif->role_id); wl12xx_cmd_role_stop_ap()
742 cmd->role_id = wlvif->role_id; wl12xx_cmd_role_stop_ap()
744 ret = wl1271_cmd_send(wl, CMD_ROLE_STOP, cmd, sizeof(*cmd), 0); wl12xx_cmd_role_stop_ap()
746 wl1271_error("failed to initiate cmd role stop ap"); wl12xx_cmd_role_stop_ap()
754 kfree(cmd); wl12xx_cmd_role_stop_ap()
763 struct wl12xx_cmd_role_start *cmd; wl12xx_cmd_role_start_ibss() local
767 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_role_start_ibss()
768 if (!cmd) { wl12xx_cmd_role_start_ibss()
773 wl1271_debug(DEBUG_CMD, "cmd role start ibss %d", wlvif->role_id); wl12xx_cmd_role_start_ibss()
775 cmd->role_id = wlvif->role_id; wl12xx_cmd_role_start_ibss()
777 cmd->band = WLCORE_BAND_5GHZ; wl12xx_cmd_role_start_ibss()
778 cmd->channel = wlvif->channel; wl12xx_cmd_role_start_ibss()
779 cmd->ibss.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set); wl12xx_cmd_role_start_ibss()
780 cmd->ibss.beacon_interval = cpu_to_le16(wlvif->beacon_int); wl12xx_cmd_role_start_ibss()
781 cmd->ibss.dtim_interval = bss_conf->dtim_period; wl12xx_cmd_role_start_ibss()
782 cmd->ibss.ssid_type = WL12XX_SSID_TYPE_ANY; wl12xx_cmd_role_start_ibss()
783 cmd->ibss.ssid_len = wlvif->ssid_len; wl12xx_cmd_role_start_ibss()
784 memcpy(cmd->ibss.ssid, wlvif->ssid, wlvif->ssid_len); wl12xx_cmd_role_start_ibss()
785 memcpy(cmd->ibss.bssid, vif->bss_conf.bssid, ETH_ALEN); wl12xx_cmd_role_start_ibss()
786 cmd->sta.local_rates = cpu_to_le32(wlvif->rate_set); wl12xx_cmd_role_start_ibss()
793 cmd->ibss.hlid = wlvif->sta.hlid; wl12xx_cmd_role_start_ibss()
794 cmd->ibss.remote_rates = cpu_to_le32(wlvif->rate_set); wl12xx_cmd_role_start_ibss()
798 wlvif->role_id, cmd->sta.hlid, cmd->sta.session, wl12xx_cmd_role_start_ibss()
804 ret = wl1271_cmd_send(wl, CMD_ROLE_START, cmd, sizeof(*cmd), 0); wl12xx_cmd_role_start_ibss()
806 wl1271_error("failed to initiate cmd role enable"); wl12xx_cmd_role_start_ibss()
817 kfree(cmd); wl12xx_cmd_role_start_ibss()
837 wl1271_debug(DEBUG_CMD, "cmd test"); wl1271_cmd_test()
867 wl1271_debug(DEBUG_CMD, "cmd interrogate"); wl1271_cmd_interrogate()
888 * @valid_rets: bitmap of valid cmd status codes (i.e. return values).
889 * return the cmd status on success.
897 wl1271_debug(DEBUG_CMD, "cmd configure (%d)", id); wlcore_cmd_configure_failsafe()
933 struct cmd_enabledisable_path *cmd; wl1271_cmd_data_path() local
937 wl1271_debug(DEBUG_CMD, "cmd data path"); wl1271_cmd_data_path()
939 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl1271_cmd_data_path()
940 if (!cmd) { wl1271_cmd_data_path()
946 cmd->channel = 1; wl1271_cmd_data_path()
956 ret = wl1271_cmd_send(wl, cmd_rx, cmd, sizeof(*cmd), 0); wl1271_cmd_data_path()
958 wl1271_error("rx %s cmd for channel %d failed", wl1271_cmd_data_path()
959 enable ? "start" : "stop", cmd->channel); wl1271_cmd_data_path()
963 wl1271_debug(DEBUG_BOOT, "rx %s cmd channel %d", wl1271_cmd_data_path()
964 enable ? "start" : "stop", cmd->channel); wl1271_cmd_data_path()
966 ret = wl1271_cmd_send(wl, cmd_tx, cmd, sizeof(*cmd), 0); wl1271_cmd_data_path()
968 wl1271_error("tx %s cmd for channel %d failed", wl1271_cmd_data_path()
969 enable ? "start" : "stop", cmd->channel); wl1271_cmd_data_path()
973 wl1271_debug(DEBUG_BOOT, "tx %s cmd channel %d", wl1271_cmd_data_path()
974 enable ? "start" : "stop", cmd->channel); wl1271_cmd_data_path()
977 kfree(cmd); wl1271_cmd_data_path()
988 wl1271_debug(DEBUG_CMD, "cmd set ps mode"); wl1271_cmd_ps_mode()
1003 wl1271_error("cmd set_ps_mode failed"); wl1271_cmd_ps_mode()
1016 struct wl1271_cmd_template_set *cmd; wl1271_cmd_template_set() local
1019 wl1271_debug(DEBUG_CMD, "cmd template_set %d (role %d)", wl1271_cmd_template_set()
1025 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl1271_cmd_template_set()
1026 if (!cmd) { wl1271_cmd_template_set()
1032 cmd->role_id = role_id; wl1271_cmd_template_set()
1033 cmd->len = cpu_to_le16(buf_len); wl1271_cmd_template_set()
1034 cmd->template_type = template_id; wl1271_cmd_template_set()
1035 cmd->enabled_rates = cpu_to_le32(rates); wl1271_cmd_template_set()
1036 cmd->short_retry_limit = wl->conf.tx.tmpl_short_retry_limit; wl1271_cmd_template_set()
1037 cmd->long_retry_limit = wl->conf.tx.tmpl_long_retry_limit; wl1271_cmd_template_set()
1038 cmd->index = index; wl1271_cmd_template_set()
1041 memcpy(cmd->template_data, buf, buf_len); wl1271_cmd_template_set()
1043 ret = wl1271_cmd_send(wl, CMD_SET_TEMPLATE, cmd, sizeof(*cmd), 0); wl1271_cmd_template_set()
1045 wl1271_warning("cmd set_template failed: %d", ret); wl1271_cmd_template_set()
1050 kfree(cmd); wl1271_cmd_template_set()
1083 wl1271_warning("cmd buld null data failed %d", ret); wl12xx_cmd_build_null_data()
1108 wl1271_warning("cmd build klv null data failed %d", ret); wl12xx_cmd_build_klv_null_data()
1332 struct wl1271_cmd_set_keys *cmd; wl12xx_cmd_set_default_wep_key() local
1335 wl1271_debug(DEBUG_CMD, "cmd set_default_wep_key %d", id); wl12xx_cmd_set_default_wep_key()
1337 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_set_default_wep_key()
1338 if (!cmd) { wl12xx_cmd_set_default_wep_key()
1343 cmd->hlid = hlid; wl12xx_cmd_set_default_wep_key()
1344 cmd->key_id = id; wl12xx_cmd_set_default_wep_key()
1345 cmd->lid_key_type = WEP_DEFAULT_LID_TYPE; wl12xx_cmd_set_default_wep_key()
1346 cmd->key_action = cpu_to_le16(KEY_SET_ID); wl12xx_cmd_set_default_wep_key()
1347 cmd->key_type = KEY_WEP; wl12xx_cmd_set_default_wep_key()
1349 ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0); wl12xx_cmd_set_default_wep_key()
1351 wl1271_warning("cmd set_default_wep_key failed: %d", ret); wl12xx_cmd_set_default_wep_key()
1356 kfree(cmd); wl12xx_cmd_set_default_wep_key()
1366 struct wl1271_cmd_set_keys *cmd; wl1271_cmd_set_sta_key() local
1373 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl1271_cmd_set_sta_key()
1374 if (!cmd) { wl1271_cmd_set_sta_key()
1379 cmd->hlid = wlvif->sta.hlid; wl1271_cmd_set_sta_key()
1382 cmd->lid_key_type = WEP_DEFAULT_LID_TYPE; wl1271_cmd_set_sta_key()
1384 cmd->lid_key_type = BROADCAST_LID_TYPE; wl1271_cmd_set_sta_key()
1386 cmd->lid_key_type = UNICAST_LID_TYPE; wl1271_cmd_set_sta_key()
1388 cmd->key_action = cpu_to_le16(action); wl1271_cmd_set_sta_key()
1389 cmd->key_size = key_size; wl1271_cmd_set_sta_key()
1390 cmd->key_type = key_type; wl1271_cmd_set_sta_key()
1392 cmd->ac_seq_num16[0] = cpu_to_le16(tx_seq_16); wl1271_cmd_set_sta_key()
1393 cmd->ac_seq_num32[0] = cpu_to_le32(tx_seq_32); wl1271_cmd_set_sta_key()
1395 cmd->key_id = id; wl1271_cmd_set_sta_key()
1404 memcpy(cmd->key, key, 16); wl1271_cmd_set_sta_key()
1405 memcpy(cmd->key + 16, key + 24, 8); wl1271_cmd_set_sta_key()
1406 memcpy(cmd->key + 24, key + 16, 8); wl1271_cmd_set_sta_key()
1409 memcpy(cmd->key, key, key_size); wl1271_cmd_set_sta_key()
1412 wl1271_dump(DEBUG_CRYPT, "TARGET KEY: ", cmd, sizeof(*cmd)); wl1271_cmd_set_sta_key()
1414 ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0); wl1271_cmd_set_sta_key()
1421 kfree(cmd); wl1271_cmd_set_sta_key()
1435 struct wl1271_cmd_set_keys *cmd; wl1271_cmd_set_ap_key() local
1439 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl1271_cmd_set_ap_key()
1440 if (!cmd) wl1271_cmd_set_ap_key()
1456 cmd->lid_key_type = lid_type; wl1271_cmd_set_ap_key()
1457 cmd->hlid = hlid; wl1271_cmd_set_ap_key()
1458 cmd->key_action = cpu_to_le16(action); wl1271_cmd_set_ap_key()
1459 cmd->key_size = key_size; wl1271_cmd_set_ap_key()
1460 cmd->key_type = key_type; wl1271_cmd_set_ap_key()
1461 cmd->key_id = id; wl1271_cmd_set_ap_key()
1462 cmd->ac_seq_num16[0] = cpu_to_le16(tx_seq_16); wl1271_cmd_set_ap_key()
1463 cmd->ac_seq_num32[0] = cpu_to_le32(tx_seq_32); wl1271_cmd_set_ap_key()
1472 memcpy(cmd->key, key, 16); wl1271_cmd_set_ap_key()
1473 memcpy(cmd->key + 16, key + 24, 8); wl1271_cmd_set_ap_key()
1474 memcpy(cmd->key + 24, key + 16, 8); wl1271_cmd_set_ap_key()
1476 memcpy(cmd->key, key, key_size); wl1271_cmd_set_ap_key()
1479 wl1271_dump(DEBUG_CRYPT, "TARGET AP KEY: ", cmd, sizeof(*cmd)); wl1271_cmd_set_ap_key()
1481 ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0); wl1271_cmd_set_ap_key()
1488 kfree(cmd); wl1271_cmd_set_ap_key()
1495 struct wl12xx_cmd_set_peer_state *cmd; wl12xx_cmd_set_peer_state() local
1498 wl1271_debug(DEBUG_CMD, "cmd set peer state (hlid=%d)", hlid); wl12xx_cmd_set_peer_state()
1500 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_set_peer_state()
1501 if (!cmd) { wl12xx_cmd_set_peer_state()
1506 cmd->hlid = hlid; wl12xx_cmd_set_peer_state()
1507 cmd->state = WL1271_CMD_STA_STATE_CONNECTED; wl12xx_cmd_set_peer_state()
1511 cmd->wmm = wlvif->wmm_enabled; wl12xx_cmd_set_peer_state()
1513 ret = wl1271_cmd_send(wl, CMD_SET_PEER_STATE, cmd, sizeof(*cmd), 0); wl12xx_cmd_set_peer_state()
1520 kfree(cmd); wl12xx_cmd_set_peer_state()
1529 struct wl12xx_cmd_add_peer *cmd; wl12xx_cmd_add_peer() local
1533 wl1271_debug(DEBUG_CMD, "cmd add peer %d", (int)hlid); wl12xx_cmd_add_peer()
1535 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_add_peer()
1536 if (!cmd) { wl12xx_cmd_add_peer()
1541 memcpy(cmd->addr, sta->addr, ETH_ALEN); wl12xx_cmd_add_peer()
1542 cmd->bss_index = WL1271_AP_BSS_INDEX; wl12xx_cmd_add_peer()
1543 cmd->aid = sta->aid; wl12xx_cmd_add_peer()
1544 cmd->hlid = hlid; wl12xx_cmd_add_peer()
1545 cmd->sp_len = sta->max_sp; wl12xx_cmd_add_peer()
1546 cmd->wmm = sta->wme ? 1 : 0; wl12xx_cmd_add_peer()
1547 cmd->session_id = wl->session_ids[hlid]; wl12xx_cmd_add_peer()
1548 cmd->role_id = wlvif->role_id; wl12xx_cmd_add_peer()
1552 cmd->psd_type[NUM_ACCESS_CATEGORIES_COPY-1-i] = wl12xx_cmd_add_peer()
1555 cmd->psd_type[NUM_ACCESS_CATEGORIES_COPY-1-i] = wl12xx_cmd_add_peer()
1565 cmd->supported_rates = wl12xx_cmd_add_peer()
1570 cmd->supported_rates, sta->uapsd_queues); wl12xx_cmd_add_peer()
1572 ret = wl1271_cmd_send(wl, CMD_ADD_PEER, cmd, sizeof(*cmd), 0); wl12xx_cmd_add_peer()
1574 wl1271_error("failed to initiate cmd add peer"); wl12xx_cmd_add_peer()
1579 kfree(cmd); wl12xx_cmd_add_peer()
1588 struct wl12xx_cmd_remove_peer *cmd; wl12xx_cmd_remove_peer() local
1592 wl1271_debug(DEBUG_CMD, "cmd remove peer %d", (int)hlid); wl12xx_cmd_remove_peer()
1594 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_remove_peer()
1595 if (!cmd) { wl12xx_cmd_remove_peer()
1600 cmd->hlid = hlid; wl12xx_cmd_remove_peer()
1602 cmd->reason_opcode = 0; wl12xx_cmd_remove_peer()
1603 cmd->send_deauth_flag = 0; wl12xx_cmd_remove_peer()
1604 cmd->role_id = wlvif->role_id; wl12xx_cmd_remove_peer()
1606 ret = wl1271_cmd_send(wl, CMD_REMOVE_PEER, cmd, sizeof(*cmd), 0); wl12xx_cmd_remove_peer()
1608 wl1271_error("failed to initiate cmd remove peer"); wl12xx_cmd_remove_peer()
1625 kfree(cmd); wl12xx_cmd_remove_peer()
1688 struct wl12xx_cmd_regdomain_dfs_config *cmd = NULL; wlcore_cmd_regdomain_config_locked() local
1698 wl1271_debug(DEBUG_CMD, "cmd reg domain config"); wlcore_cmd_regdomain_config_locked()
1731 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wlcore_cmd_regdomain_config_locked()
1732 if (!cmd) { wlcore_cmd_regdomain_config_locked()
1737 cmd->ch_bit_map1 = cpu_to_le32(tmp_ch_bitmap[0]); wlcore_cmd_regdomain_config_locked()
1738 cmd->ch_bit_map2 = cpu_to_le32(tmp_ch_bitmap[1]); wlcore_cmd_regdomain_config_locked()
1739 cmd->dfs_region = wl->dfs_region; wlcore_cmd_regdomain_config_locked()
1742 "cmd reg domain bitmap1: 0x%08x, bitmap2: 0x%08x", wlcore_cmd_regdomain_config_locked()
1743 cmd->ch_bit_map1, cmd->ch_bit_map2); wlcore_cmd_regdomain_config_locked()
1745 ret = wl1271_cmd_send(wl, CMD_DFS_CHANNEL_CONFIG, cmd, sizeof(*cmd), 0); wlcore_cmd_regdomain_config_locked()
1765 kfree(cmd); wlcore_cmd_regdomain_config_locked()
1771 struct wl12xx_cmd_config_fwlog *cmd; wl12xx_cmd_config_fwlog() local
1774 wl1271_debug(DEBUG_CMD, "cmd config firmware logger"); wl12xx_cmd_config_fwlog()
1776 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_config_fwlog()
1777 if (!cmd) { wl12xx_cmd_config_fwlog()
1782 cmd->logger_mode = wl->conf.fwlog.mode; wl12xx_cmd_config_fwlog()
1783 cmd->log_severity = wl->conf.fwlog.severity; wl12xx_cmd_config_fwlog()
1784 cmd->timestamp = wl->conf.fwlog.timestamp; wl12xx_cmd_config_fwlog()
1785 cmd->output = wl->conf.fwlog.output; wl12xx_cmd_config_fwlog()
1786 cmd->threshold = wl->conf.fwlog.threshold; wl12xx_cmd_config_fwlog()
1788 ret = wl1271_cmd_send(wl, CMD_CONFIG_FWLOGGER, cmd, sizeof(*cmd), 0); wl12xx_cmd_config_fwlog()
1795 kfree(cmd); wl12xx_cmd_config_fwlog()
1803 struct wl12xx_cmd_start_fwlog *cmd; wl12xx_cmd_start_fwlog() local
1806 wl1271_debug(DEBUG_CMD, "cmd start firmware logger"); wl12xx_cmd_start_fwlog()
1808 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_start_fwlog()
1809 if (!cmd) { wl12xx_cmd_start_fwlog()
1814 ret = wl1271_cmd_send(wl, CMD_START_FWLOGGER, cmd, sizeof(*cmd), 0); wl12xx_cmd_start_fwlog()
1821 kfree(cmd); wl12xx_cmd_start_fwlog()
1829 struct wl12xx_cmd_stop_fwlog *cmd; wl12xx_cmd_stop_fwlog() local
1832 wl1271_debug(DEBUG_CMD, "cmd stop firmware logger"); wl12xx_cmd_stop_fwlog()
1834 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_stop_fwlog()
1835 if (!cmd) { wl12xx_cmd_stop_fwlog()
1840 ret = wl1271_cmd_send(wl, CMD_STOP_FWLOGGER, cmd, sizeof(*cmd), 0); wl12xx_cmd_stop_fwlog()
1847 kfree(cmd); wl12xx_cmd_stop_fwlog()
1856 struct wl12xx_cmd_roc *cmd; wl12xx_cmd_roc() local
1859 wl1271_debug(DEBUG_CMD, "cmd roc %d (%d)", channel, role_id); wl12xx_cmd_roc()
1864 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_roc()
1865 if (!cmd) { wl12xx_cmd_roc()
1870 cmd->role_id = role_id; wl12xx_cmd_roc()
1871 cmd->channel = channel; wl12xx_cmd_roc()
1874 cmd->band = WLCORE_BAND_2_4GHZ; wl12xx_cmd_roc()
1877 cmd->band = WLCORE_BAND_5GHZ; wl12xx_cmd_roc()
1886 ret = wl1271_cmd_send(wl, CMD_REMAIN_ON_CHANNEL, cmd, sizeof(*cmd), 0); wl12xx_cmd_roc()
1893 kfree(cmd); wl12xx_cmd_roc()
1901 struct wl12xx_cmd_croc *cmd; wl12xx_cmd_croc() local
1904 wl1271_debug(DEBUG_CMD, "cmd croc (%d)", role_id); wl12xx_cmd_croc()
1906 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_croc()
1907 if (!cmd) { wl12xx_cmd_croc()
1911 cmd->role_id = role_id; wl12xx_cmd_croc()
1913 ret = wl1271_cmd_send(wl, CMD_CANCEL_REMAIN_ON_CHANNEL, cmd, wl12xx_cmd_croc()
1914 sizeof(*cmd), 0); wl12xx_cmd_croc()
1921 kfree(cmd); wl12xx_cmd_croc()
1970 struct wl12xx_cmd_stop_channel_switch *cmd; wl12xx_cmd_stop_channel_switch() local
1973 wl1271_debug(DEBUG_ACX, "cmd stop channel switch"); wl12xx_cmd_stop_channel_switch()
1975 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wl12xx_cmd_stop_channel_switch()
1976 if (!cmd) { wl12xx_cmd_stop_channel_switch()
1981 cmd->role_id = wlvif->role_id; wl12xx_cmd_stop_channel_switch()
1983 ret = wl1271_cmd_send(wl, CMD_STOP_CHANNEL_SWICTH, cmd, sizeof(*cmd), 0); wl12xx_cmd_stop_channel_switch()
1990 kfree(cmd); wl12xx_cmd_stop_channel_switch()
2072 struct wlcore_cmd_generic_cfg *cmd; wlcore_cmd_generic_cfg() local
2076 "cmd generic cfg (role %d feature %d enable %d value %d)", wlcore_cmd_generic_cfg()
2079 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wlcore_cmd_generic_cfg()
2080 if (!cmd) wlcore_cmd_generic_cfg()
2083 cmd->role_id = wlvif->role_id; wlcore_cmd_generic_cfg()
2084 cmd->feature = feature; wlcore_cmd_generic_cfg()
2085 cmd->enable = enable; wlcore_cmd_generic_cfg()
2086 cmd->value = value; wlcore_cmd_generic_cfg()
2088 ret = wl1271_cmd_send(wl, CMD_GENERIC_CFG, cmd, sizeof(*cmd), 0); wlcore_cmd_generic_cfg()
2094 kfree(cmd); wlcore_cmd_generic_cfg()
H A Dspi.c89 u8 *cmd; wl12xx_spi_reset() local
93 cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); wl12xx_spi_reset()
94 if (!cmd) { wl12xx_spi_reset()
96 "could not allocate cmd for spi reset\n"); wl12xx_spi_reset()
103 memset(cmd, 0xff, WSPI_INIT_CMD_LEN); wl12xx_spi_reset()
105 t.tx_buf = cmd; wl12xx_spi_reset()
111 kfree(cmd); wl12xx_spi_reset()
119 u8 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); wl12xx_spi_init() local
121 if (!cmd) { wl12xx_spi_init()
123 "could not allocate cmd for spi init\n"); wl12xx_spi_init()
134 cmd[0] = 0xff; wl12xx_spi_init()
135 cmd[1] = 0xff; wl12xx_spi_init()
136 cmd[2] = WSPI_INIT_CMD_START | WSPI_INIT_CMD_TX; wl12xx_spi_init()
137 cmd[3] = 0; wl12xx_spi_init()
138 cmd[4] = 0; wl12xx_spi_init()
139 cmd[5] = HW_ACCESS_WSPI_INIT_CMD_MASK << 3; wl12xx_spi_init()
140 cmd[5] |= HW_ACCESS_WSPI_FIXED_BUSY_LEN & WSPI_INIT_CMD_FIXEDBUSY_LEN; wl12xx_spi_init()
142 cmd[6] = WSPI_INIT_CMD_IOD | WSPI_INIT_CMD_IP | WSPI_INIT_CMD_CS wl12xx_spi_init()
146 cmd[6] |= WSPI_INIT_CMD_DIS_FIXEDBUSY; wl12xx_spi_init()
148 cmd[6] |= WSPI_INIT_CMD_EN_FIXEDBUSY; wl12xx_spi_init()
150 cmd[7] = crc7_be(0, cmd+2, WSPI_INIT_CMD_CRC_LEN) | WSPI_INIT_CMD_END; wl12xx_spi_init()
155 __swab32s((u32 *)cmd); wl12xx_spi_init()
156 __swab32s((u32 *)cmd+1); wl12xx_spi_init()
158 t.tx_buf = cmd; wl12xx_spi_init()
163 kfree(cmd); wl12xx_spi_init()
211 u32 *cmd; wl12xx_spi_raw_read() local
217 cmd = &wl->buffer_cmd; wl12xx_spi_raw_read()
220 *cmd = 0; wl12xx_spi_raw_read()
221 *cmd |= WSPI_CMD_READ; wl12xx_spi_raw_read()
222 *cmd |= (chunk_len << WSPI_CMD_BYTE_LENGTH_OFFSET) & wl12xx_spi_raw_read()
224 *cmd |= addr & WSPI_CMD_BYTE_ADDR; wl12xx_spi_raw_read()
227 *cmd |= WSPI_CMD_FIXED; wl12xx_spi_raw_read()
232 t[0].tx_buf = cmd; wl12xx_spi_raw_read()
278 u32 *cmd; wl12xx_spi_raw_write() local
287 cmd = &commands[0]; wl12xx_spi_raw_write()
292 *cmd = 0; wl12xx_spi_raw_write()
293 *cmd |= WSPI_CMD_WRITE; wl12xx_spi_raw_write()
294 *cmd |= (chunk_len << WSPI_CMD_BYTE_LENGTH_OFFSET) & wl12xx_spi_raw_write()
296 *cmd |= addr & WSPI_CMD_BYTE_ADDR; wl12xx_spi_raw_write()
299 *cmd |= WSPI_CMD_FIXED; wl12xx_spi_raw_write()
301 t[i].tx_buf = cmd; wl12xx_spi_raw_write()
302 t[i].len = sizeof(*cmd); wl12xx_spi_raw_write()
313 cmd++; wl12xx_spi_raw_write()
H A DMakefile1 wlcore-objs = main.o cmd.o io.o event.o tx.o rx.o ps.o acx.o \
H A Dscan.c28 #include "cmd.h"
383 struct wl1271_cmd_sched_scan_ssid_list *cmd = NULL; wlcore_scan_sched_scan_ssid_list() local
388 wl1271_debug((DEBUG_CMD | DEBUG_SCAN), "cmd sched scan ssid list"); wlcore_scan_sched_scan_ssid_list()
403 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); wlcore_scan_sched_scan_ssid_list()
404 if (!cmd) { wlcore_scan_sched_scan_ssid_list()
409 cmd->role_id = wlvif->role_id; wlcore_scan_sched_scan_ssid_list()
415 cmd->ssids[cmd->n_ssids].type = (ssids[i].ssid_len) ? wlcore_scan_sched_scan_ssid_list()
417 cmd->ssids[cmd->n_ssids].len = ssids[i].ssid_len; wlcore_scan_sched_scan_ssid_list()
418 memcpy(cmd->ssids[cmd->n_ssids].ssid, ssids[i].ssid, wlcore_scan_sched_scan_ssid_list()
420 cmd->n_ssids++; wlcore_scan_sched_scan_ssid_list()
431 cmd->ssids[cmd->n_ssids].type = SCAN_SSID_TYPE_PUBLIC; wlcore_scan_sched_scan_ssid_list()
432 cmd->ssids[cmd->n_ssids].len = sets[i].ssid.ssid_len; wlcore_scan_sched_scan_ssid_list()
433 memcpy(cmd->ssids[cmd->n_ssids].ssid, wlcore_scan_sched_scan_ssid_list()
435 cmd->n_ssids++; wlcore_scan_sched_scan_ssid_list()
447 for (j = 0; j < cmd->n_ssids; j++) wlcore_scan_sched_scan_ssid_list()
449 cmd->ssids[j].len) && wlcore_scan_sched_scan_ssid_list()
451 cmd->ssids[j].ssid, wlcore_scan_sched_scan_ssid_list()
453 cmd->ssids[j].type = wlcore_scan_sched_scan_ssid_list()
458 if (j == cmd->n_ssids) { wlcore_scan_sched_scan_ssid_list()
466 ret = wl1271_cmd_send(wl, CMD_CONNECTION_SCAN_SSID_CFG, cmd, wlcore_scan_sched_scan_ssid_list()
467 sizeof(*cmd), 0); wlcore_scan_sched_scan_ssid_list()
469 wl1271_error("cmd sched scan ssid list failed"); wlcore_scan_sched_scan_ssid_list()
474 kfree(cmd); wlcore_scan_sched_scan_ssid_list()
/linux-4.4.14/drivers/misc/ibmasm/
H A Dcommand.c36 struct command *cmd; ibmasm_new_command() local
41 cmd = kzalloc(sizeof(struct command), GFP_KERNEL); ibmasm_new_command()
42 if (cmd == NULL) ibmasm_new_command()
46 cmd->buffer = kzalloc(buffer_size, GFP_KERNEL); ibmasm_new_command()
47 if (cmd->buffer == NULL) { ibmasm_new_command()
48 kfree(cmd); ibmasm_new_command()
51 cmd->buffer_size = buffer_size; ibmasm_new_command()
53 kref_init(&cmd->kref); ibmasm_new_command()
54 cmd->lock = &sp->lock; ibmasm_new_command()
56 cmd->status = IBMASM_CMD_PENDING; ibmasm_new_command()
57 init_waitqueue_head(&cmd->wait); ibmasm_new_command()
58 INIT_LIST_HEAD(&cmd->queue_node); ibmasm_new_command()
63 return cmd; ibmasm_new_command()
68 struct command *cmd = to_command(kref); ibmasm_free_command() local
70 list_del(&cmd->queue_node); ibmasm_free_command()
73 kfree(cmd->buffer); ibmasm_free_command()
74 kfree(cmd); ibmasm_free_command()
77 static void enqueue_command(struct service_processor *sp, struct command *cmd) enqueue_command() argument
79 list_add_tail(&cmd->queue_node, &sp->command_queue); enqueue_command()
84 struct command *cmd; dequeue_command() local
92 cmd = list_entry(next, struct command, queue_node); dequeue_command()
94 return cmd; dequeue_command()
119 void ibmasm_exec_command(struct service_processor *sp, struct command *cmd) ibmasm_exec_command() argument
129 sp->current_command = cmd; ibmasm_exec_command()
134 enqueue_command(sp, cmd); ibmasm_exec_command()
162 void ibmasm_wait_for_response(struct command *cmd, int timeout) ibmasm_wait_for_response() argument
164 wait_event_interruptible_timeout(cmd->wait, ibmasm_wait_for_response()
165 cmd->status == IBMASM_CMD_COMPLETE || ibmasm_wait_for_response()
166 cmd->status == IBMASM_CMD_FAILED, ibmasm_wait_for_response()
177 struct command *cmd = sp->current_command; ibmasm_receive_command_response() local
182 memcpy_fromio(cmd->buffer, response, min(size, cmd->buffer_size)); ibmasm_receive_command_response()
183 cmd->status = IBMASM_CMD_COMPLETE; ibmasm_receive_command_response()
H A Ddot_command.h55 struct dot_command_header *cmd = (struct dot_command_header *)buffer; get_dot_command_size() local
56 return sizeof(struct dot_command_header) + cmd->command_size + cmd->data_size; get_dot_command_size()
62 unsigned char *cmd = buffer + sizeof(struct dot_command_header); get_dot_command_timeout() local
67 if ((cmd[0] == 6) && (cmd[1] == 3) && (cmd[2] == 1)) get_dot_command_timeout()
70 if ((cmd[0] == 7) && (cmd[1] == 1)) get_dot_command_timeout()
72 if (cmd[0] == 8) get_dot_command_timeout()
H A Dr_heartbeat.c63 struct command *cmd; ibmasm_start_reverse_heartbeat() local
67 cmd = ibmasm_new_command(sp, sizeof rhb_dot_cmd); ibmasm_start_reverse_heartbeat()
68 if (!cmd) ibmasm_start_reverse_heartbeat()
72 memcpy(cmd->buffer, (void *)&rhb_dot_cmd, sizeof rhb_dot_cmd); ibmasm_start_reverse_heartbeat()
73 cmd->status = IBMASM_CMD_PENDING; ibmasm_start_reverse_heartbeat()
74 ibmasm_exec_command(sp, cmd); ibmasm_start_reverse_heartbeat()
75 ibmasm_wait_for_response(cmd, IBMASM_CMD_TIMEOUT_NORMAL); ibmasm_start_reverse_heartbeat()
77 if (cmd->status != IBMASM_CMD_COMPLETE) ibmasm_start_reverse_heartbeat()
89 command_put(cmd); ibmasm_start_reverse_heartbeat()
/linux-4.4.14/drivers/target/tcm_fc/
H A Dtfc_cmd.c43 * Dump cmd state for debugging.
45 static void _ft_dump_cmd(struct ft_cmd *cmd, const char *caller) _ft_dump_cmd() argument
53 se_cmd = &cmd->se_cmd; _ft_dump_cmd()
54 pr_debug("%s: cmd %p sess %p seq %p se_cmd %p\n", _ft_dump_cmd()
55 caller, cmd, cmd->sess, cmd->seq, se_cmd); _ft_dump_cmd()
57 pr_debug("%s: cmd %p data_nents %u len %u se_cmd_flags <0x%x>\n", _ft_dump_cmd()
58 caller, cmd, se_cmd->t_data_nents, _ft_dump_cmd()
62 pr_debug("%s: cmd %p sg %p page %p " _ft_dump_cmd()
64 caller, cmd, sg, _ft_dump_cmd()
67 sp = cmd->seq; _ft_dump_cmd()
70 pr_debug("%s: cmd %p sid %x did %x " _ft_dump_cmd()
72 caller, cmd, ep->sid, ep->did, ep->oxid, ep->rxid, _ft_dump_cmd()
77 void ft_dump_cmd(struct ft_cmd *cmd, const char *caller) ft_dump_cmd() argument
80 _ft_dump_cmd(cmd, caller); ft_dump_cmd()
83 static void ft_free_cmd(struct ft_cmd *cmd) ft_free_cmd() argument
89 if (!cmd) ft_free_cmd()
91 sess = cmd->sess; ft_free_cmd()
92 fp = cmd->req_frame; ft_free_cmd()
97 percpu_ida_free(&sess->se_sess->sess_tag_pool, cmd->se_cmd.map_tag); ft_free_cmd()
103 struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); ft_release_cmd() local
105 ft_free_cmd(cmd); ft_release_cmd()
119 struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); ft_queue_status() local
127 if (cmd->aborted) ft_queue_status()
129 ft_dump_cmd(cmd, __func__); ft_queue_status()
130 ep = fc_seq_exch(cmd->seq); ft_queue_status()
165 cmd->seq = lport->tt.seq_start_next(cmd->seq); ft_queue_status()
169 rc = lport->tt.seq_send(lport, cmd->seq, fp); ft_queue_status()
181 lport->tt.exch_done(cmd->seq); ft_queue_status()
187 struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); ft_write_pending_status() local
189 return cmd->write_data_len != se_cmd->data_length; ft_write_pending_status()
197 struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); ft_write_pending() local
205 ft_dump_cmd(cmd, __func__); ft_write_pending()
207 if (cmd->aborted) ft_write_pending()
209 ep = fc_seq_exch(cmd->seq); ft_write_pending()
219 cmd->seq = lport->tt.seq_start_next(cmd->seq); ft_write_pending()
237 cmd->was_ddp_setup = 1; ft_write_pending()
240 lport->tt.seq_send(lport, cmd->seq, fp); ft_write_pending()
254 struct ft_cmd *cmd = arg; ft_recv_seq() local
258 /* XXX need to find cmd if queued */ ft_recv_seq()
259 cmd->seq = NULL; ft_recv_seq()
260 cmd->aborted = true; ft_recv_seq()
268 ft_recv_write_data(cmd, fp); ft_recv_seq()
276 ft_invl_hw_context(cmd); ft_recv_seq()
278 transport_generic_free_cmd(&cmd->se_cmd, 0); ft_recv_seq()
331 static void ft_send_resp_code(struct ft_cmd *cmd, ft_send_resp_code() argument
334 ft_send_resp_status(cmd->sess->tport->lport, ft_send_resp_code()
335 cmd->req_frame, SAM_STAT_GOOD, code); ft_send_resp_code()
341 * Always frees the cmd and associated state.
343 static void ft_send_resp_code_and_free(struct ft_cmd *cmd, ft_send_resp_code_and_free() argument
346 ft_send_resp_code(cmd, code); ft_send_resp_code_and_free()
347 ft_free_cmd(cmd); ft_send_resp_code_and_free()
353 static void ft_send_tm(struct ft_cmd *cmd) ft_send_tm() argument
359 fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); ft_send_tm()
383 ft_send_resp_code_and_free(cmd, FCP_CMND_FIELDS_INVALID); ft_send_tm()
388 rc = target_submit_tmr(&cmd->se_cmd, cmd->sess->se_sess, ft_send_tm()
389 &cmd->ft_sense_buffer[0], scsilun_to_int(&fcp->fc_lun), ft_send_tm()
390 cmd, tm_func, GFP_KERNEL, 0, 0); ft_send_tm()
392 ft_send_resp_code_and_free(cmd, FCP_TMF_FAILED); ft_send_tm()
400 struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); ft_queue_tm_resp() local
404 if (cmd->aborted) ft_queue_tm_resp()
424 ft_send_resp_code(cmd, code); ft_queue_tm_resp()
439 struct ft_cmd *cmd; ft_recv_cmd() local
448 cmd = &((struct ft_cmd *)se_sess->sess_cmd_map)[tag]; ft_recv_cmd()
449 memset(cmd, 0, sizeof(struct ft_cmd)); ft_recv_cmd()
451 cmd->se_cmd.map_tag = tag; ft_recv_cmd()
452 cmd->sess = sess; ft_recv_cmd()
453 cmd->seq = lport->tt.seq_assign(lport, fp); ft_recv_cmd()
454 if (!cmd->seq) { ft_recv_cmd()
458 cmd->req_frame = fp; /* hold frame during cmd */ ft_recv_cmd()
460 INIT_WORK(&cmd->work, ft_send_work); ft_recv_cmd()
461 queue_work(sess->tport->tpg->workqueue, &cmd->work); ft_recv_cmd()
465 pr_debug("cmd or seq allocation failure - sending BUSY\n"); ft_recv_cmd()
503 struct ft_cmd *cmd = container_of(work, struct ft_cmd, work); ft_send_work() local
504 struct fc_frame_header *fh = fc_frame_header_get(cmd->req_frame); ft_send_work()
509 fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); ft_send_work()
520 ft_send_tm(cmd); ft_send_work()
555 fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd); ft_send_work()
556 cmd->se_cmd.tag = fc_seq_exch(cmd->seq)->rxid; ft_send_work()
561 if (target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, fcp->fc_cdb, ft_send_work()
562 &cmd->ft_sense_buffer[0], scsilun_to_int(&fcp->fc_lun), ft_send_work()
570 ft_send_resp_code_and_free(cmd, FCP_CMND_FIELDS_INVALID); ft_send_work()
H A Dtfc_io.c56 struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); ft_queue_data_in() local
77 if (cmd->aborted) ft_queue_data_in()
83 ep = fc_seq_exch(cmd->seq); ft_queue_data_in()
85 cmd->seq = lport->tt.seq_start_next(cmd->seq); ft_queue_data_in()
104 struct fc_seq *seq = cmd->seq; ft_queue_data_in()
124 cmd->sess->max_frame; ft_queue_data_in()
138 fr_max_payload(fp) = cmd->sess->max_frame; ft_queue_data_in()
201 struct ft_cmd *cmd = container_of(work, struct ft_cmd, work); ft_execute_work() local
203 target_execute_cmd(&cmd->se_cmd); ft_execute_work()
209 void ft_recv_write_data(struct ft_cmd *cmd, struct fc_frame *fp) ft_recv_write_data() argument
211 struct se_cmd *se_cmd = &cmd->se_cmd; ft_recv_write_data()
212 struct fc_seq *seq = cmd->seq; ft_recv_write_data()
236 if (cmd->was_ddp_setup) { ft_recv_write_data()
245 pr_err("%s: xid 0x%x, f_ctl 0x%x, cmd->sg %p, " ft_recv_write_data()
246 "cmd->sg_cnt 0x%x. DDP was setup" ft_recv_write_data()
257 ft_invl_hw_context(cmd); ft_recv_write_data()
327 cmd->write_data_len += tlen; ft_recv_write_data()
330 if (cmd->write_data_len == se_cmd->data_length) { ft_recv_write_data()
331 INIT_WORK(&cmd->work, ft_execute_work); ft_recv_write_data()
332 queue_work(cmd->sess->tport->tpg->workqueue, &cmd->work); ft_recv_write_data()
342 void ft_invl_hw_context(struct ft_cmd *cmd) ft_invl_hw_context() argument
348 BUG_ON(!cmd); ft_invl_hw_context()
349 seq = cmd->seq; ft_invl_hw_context()
352 if (cmd->was_ddp_setup && seq) { ft_invl_hw_context()
361 cmd->write_data_len = lport->tt.ddp_done(lport, ft_invl_hw_context()
370 cmd->was_ddp_setup = 0; ft_invl_hw_context()
/linux-4.4.14/drivers/macintosh/
H A Dsmu.c16 * - maybe avoid some data copies with i2c by directly using the smu cmd
68 u8 cmd; member in struct:smu_cmd_buf
112 struct smu_cmd *cmd; smu_start_cmd() local
118 cmd = list_entry(smu->cmd_list.next, struct smu_cmd, link); smu_start_cmd()
119 smu->cmd_cur = cmd; smu_start_cmd()
120 list_del(&cmd->link); smu_start_cmd()
122 DPRINTK("SMU: starting cmd %x, %d bytes data\n", cmd->cmd, smu_start_cmd()
123 cmd->data_len); smu_start_cmd()
124 DPRINTK("SMU: data buffer: %8ph\n", cmd->data_buf); smu_start_cmd()
127 smu->cmd_buf->cmd = cmd->cmd; smu_start_cmd()
128 smu->cmd_buf->length = cmd->data_len; smu_start_cmd()
129 memcpy(smu->cmd_buf->data, cmd->data_buf, cmd->data_len); smu_start_cmd()
163 struct smu_cmd *cmd; smu_db_intr() local
164 void (*done)(struct smu_cmd *cmd, void *misc) = NULL; smu_db_intr()
180 cmd = smu->cmd_cur; smu_db_intr()
182 if (cmd == NULL) smu_db_intr()
199 ack = (~cmd->cmd) & 0xff; smu_db_intr()
200 if (ack != smu->cmd_buf->cmd) { smu_db_intr()
202 ack, smu->cmd_buf->cmd); smu_db_intr()
207 if (reply_len > cmd->reply_len) { smu_db_intr()
210 reply_len, cmd->reply_len); smu_db_intr()
211 reply_len = cmd->reply_len; smu_db_intr()
213 cmd->reply_len = reply_len; smu_db_intr()
214 if (cmd->reply_buf && reply_len) smu_db_intr()
215 memcpy(cmd->reply_buf, smu->cmd_buf->data, reply_len); smu_db_intr()
221 done = cmd->done; smu_db_intr()
222 misc = cmd->misc; smu_db_intr()
224 cmd->status = rc; smu_db_intr()
236 done(cmd, misc); smu_db_intr()
262 int smu_queue_cmd(struct smu_cmd *cmd) smu_queue_cmd() argument
268 if (cmd->data_len > SMU_MAX_DATA || smu_queue_cmd()
269 cmd->reply_len > SMU_MAX_DATA) smu_queue_cmd()
272 cmd->status = 1; smu_queue_cmd()
274 list_add_tail(&cmd->link, &smu->cmd_list); smu_queue_cmd()
281 smu_spinwait_cmd(cmd); smu_queue_cmd()
290 void (*done)(struct smu_cmd *cmd, void *misc), smu_queue_simple()
293 struct smu_cmd *cmd = &scmd->cmd; smu_queue_simple() local
301 cmd->cmd = command; smu_queue_simple()
302 cmd->data_len = data_len; smu_queue_simple()
303 cmd->data_buf = scmd->buffer; smu_queue_simple()
304 cmd->reply_len = sizeof(scmd->buffer); smu_queue_simple()
305 cmd->reply_buf = scmd->buffer; smu_queue_simple()
306 cmd->done = done; smu_queue_simple()
307 cmd->misc = misc; smu_queue_simple()
314 return smu_queue_cmd(cmd); smu_queue_simple()
333 void smu_done_complete(struct smu_cmd *cmd, void *misc) smu_done_complete() argument
342 void smu_spinwait_cmd(struct smu_cmd *cmd) smu_spinwait_cmd() argument
344 while(cmd->status == 1) smu_spinwait_cmd()
366 cmd_buf->cmd = 0x8e; smu_fill_set_rtc_cmd()
381 struct smu_simple_cmd cmd; smu_get_rtc_time() local
388 rc = smu_queue_simple(&cmd, SMU_CMD_RTC_COMMAND, 1, NULL, NULL, smu_get_rtc_time()
392 smu_spinwait_simple(&cmd); smu_get_rtc_time()
394 time->tm_sec = bcd2hex(cmd.buffer[0]); smu_get_rtc_time()
395 time->tm_min = bcd2hex(cmd.buffer[1]); smu_get_rtc_time()
396 time->tm_hour = bcd2hex(cmd.buffer[2]); smu_get_rtc_time()
397 time->tm_wday = bcd2hex(cmd.buffer[3]); smu_get_rtc_time()
398 time->tm_mday = bcd2hex(cmd.buffer[4]); smu_get_rtc_time()
399 time->tm_mon = bcd2hex(cmd.buffer[5]) - 1; smu_get_rtc_time()
400 time->tm_year = bcd2hex(cmd.buffer[6]) + 100; smu_get_rtc_time()
408 struct smu_simple_cmd cmd; smu_set_rtc_time() local
414 rc = smu_queue_simple(&cmd, SMU_CMD_RTC_COMMAND, 8, NULL, NULL, smu_set_rtc_time()
425 smu_spinwait_simple(&cmd); smu_set_rtc_time()
433 struct smu_simple_cmd cmd; smu_shutdown() local
438 if (smu_queue_simple(&cmd, SMU_CMD_POWER_COMMAND, 9, NULL, NULL, smu_shutdown()
441 smu_spinwait_simple(&cmd); smu_shutdown()
449 struct smu_simple_cmd cmd; smu_restart() local
454 if (smu_queue_simple(&cmd, SMU_CMD_POWER_COMMAND, 8, NULL, NULL, smu_restart()
457 smu_spinwait_simple(&cmd); smu_restart()
700 static void smu_i2c_complete_command(struct smu_i2c_cmd *cmd, int fail) smu_i2c_complete_command() argument
702 void (*done)(struct smu_i2c_cmd *cmd, void *misc) = cmd->done; smu_i2c_complete_command()
703 void *misc = cmd->misc; smu_i2c_complete_command()
707 if (!fail && cmd->read) { smu_i2c_complete_command()
708 if (cmd->pdata[0] < 1) smu_i2c_complete_command()
711 memcpy(cmd->info.data, &cmd->pdata[1], smu_i2c_complete_command()
712 cmd->info.datalen); smu_i2c_complete_command()
724 cmd->status = fail ? -EIO : 0; smu_i2c_complete_command()
734 list_del(&cmd->link); smu_i2c_complete_command()
737 list_add_tail(&cmd->scmd.link, &smu->cmd_list); smu_i2c_complete_command()
745 done(cmd, misc); smu_i2c_complete_command()
752 struct smu_i2c_cmd *cmd = smu->cmd_i2c_cur; smu_i2c_retry() local
757 cmd->pdata[0] = 0xff; smu_i2c_retry()
758 cmd->scmd.reply_len = sizeof(cmd->pdata); smu_i2c_retry()
759 smu_queue_cmd(&cmd->scmd); smu_i2c_retry()
765 struct smu_i2c_cmd *cmd = misc; smu_i2c_low_completion() local
769 cmd->stage, scmd->status, cmd->pdata[0], scmd->reply_len); smu_i2c_low_completion()
774 else if (cmd->read) { smu_i2c_low_completion()
775 if (cmd->stage == 0) smu_i2c_low_completion()
776 fail = cmd->pdata[0] != 0; smu_i2c_low_completion()
778 fail = cmd->pdata[0] >= 0x80; smu_i2c_low_completion()
780 fail = cmd->pdata[0] != 0; smu_i2c_low_completion()
785 if (fail && --cmd->retries > 0) { smu_i2c_low_completion()
787 BUG_ON(cmd != smu->cmd_i2c_cur); smu_i2c_low_completion()
798 if (fail || cmd->stage != 0) { smu_i2c_low_completion()
799 smu_i2c_complete_command(cmd, fail); smu_i2c_low_completion()
806 scmd->reply_buf = cmd->pdata; smu_i2c_low_completion()
807 scmd->reply_len = sizeof(cmd->pdata); smu_i2c_low_completion()
808 scmd->data_buf = cmd->pdata; smu_i2c_low_completion()
810 cmd->pdata[0] = 0; smu_i2c_low_completion()
811 cmd->stage = 1; smu_i2c_low_completion()
812 cmd->retries = 20; smu_i2c_low_completion()
817 int smu_queue_i2c(struct smu_i2c_cmd *cmd) smu_queue_i2c() argument
825 cmd->scmd.cmd = SMU_CMD_I2C_COMMAND; smu_queue_i2c()
826 cmd->scmd.done = smu_i2c_low_completion; smu_queue_i2c()
827 cmd->scmd.misc = cmd; smu_queue_i2c()
828 cmd->scmd.reply_buf = cmd->pdata; smu_queue_i2c()
829 cmd->scmd.reply_len = sizeof(cmd->pdata); smu_queue_i2c()
830 cmd->scmd.data_buf = (u8 *)(char *)&cmd->info; smu_queue_i2c()
831 cmd->scmd.status = 1; smu_queue_i2c()
832 cmd->stage = 0; smu_queue_i2c()
833 cmd->pdata[0] = 0xff; smu_queue_i2c()
834 cmd->retries = 20; smu_queue_i2c()
835 cmd->status = 1; smu_queue_i2c()
840 cmd->info.caddr = cmd->info.devaddr; smu_queue_i2c()
841 cmd->read = cmd->info.devaddr & 0x01; smu_queue_i2c()
842 switch(cmd->info.type) { smu_queue_i2c()
844 memset(&cmd->info.sublen, 0, 4); smu_queue_i2c()
847 cmd->info.devaddr &= 0xfe; smu_queue_i2c()
849 if (cmd->info.sublen > 3) smu_queue_i2c()
858 if (cmd->read) { smu_queue_i2c()
859 if (cmd->info.datalen > SMU_I2C_READ_MAX) smu_queue_i2c()
861 memset(cmd->info.data, 0xff, cmd->info.datalen); smu_queue_i2c()
862 cmd->scmd.data_len = 9; smu_queue_i2c()
864 if (cmd->info.datalen > SMU_I2C_WRITE_MAX) smu_queue_i2c()
866 cmd->scmd.data_len = 9 + cmd->info.datalen; smu_queue_i2c()
871 cmd->read ? "read" : "write", cmd->info.datalen, smu_queue_i2c()
872 cmd->info.bus, cmd->info.caddr, smu_queue_i2c()
873 cmd->info.subaddr[0], cmd->info.type); smu_queue_i2c()
881 smu->cmd_i2c_cur = cmd; smu_queue_i2c()
882 list_add_tail(&cmd->scmd.link, &smu->cmd_list); smu_queue_i2c()
886 list_add_tail(&cmd->link, &smu->cmd_i2c_list); smu_queue_i2c()
900 struct smu_cmd cmd; smu_read_datablock() local
912 cmd.cmd = SMU_CMD_MISC_ee_COMMAND; smu_read_datablock()
913 cmd.data_len = 7; smu_read_datablock()
914 cmd.data_buf = params; smu_read_datablock()
915 cmd.reply_len = chunk; smu_read_datablock()
916 cmd.reply_buf = dest; smu_read_datablock()
917 cmd.done = smu_done_complete; smu_read_datablock()
918 cmd.misc = &comp; smu_read_datablock()
924 rc = smu_queue_cmd(&cmd); smu_read_datablock()
928 if (cmd.status != 0) smu_read_datablock()
930 if (cmd.reply_len != clen) { smu_read_datablock()
933 cmd.reply_len, clen); smu_read_datablock()
946 struct smu_simple_cmd cmd; smu_create_sdb_partition() local
953 smu_queue_simple(&cmd, SMU_CMD_PARTITION_COMMAND, 2, smu_create_sdb_partition()
958 cmd.cmd.status, cmd.cmd.reply_len); smu_create_sdb_partition()
961 if (cmd.cmd.status != 0 || cmd.cmd.reply_len != 6) smu_create_sdb_partition()
965 addr = *((u16 *)cmd.buffer); smu_create_sdb_partition()
966 len = cmd.buffer[3] << 2; smu_create_sdb_partition()
1068 struct smu_cmd cmd; member in struct:smu_private
1098 static void smu_user_cmd_done(struct smu_cmd *cmd, void *misc) smu_user_cmd_done() argument
1123 part = __smu_get_sdb_partition(hdr.cmd, NULL, 1); smu_write()
1142 pp->cmd.status = 1; smu_write()
1150 pp->cmd.cmd = hdr.cmd; smu_write()
1151 pp->cmd.data_len = hdr.data_len; smu_write()
1152 pp->cmd.reply_len = SMU_MAX_DATA; smu_write()
1153 pp->cmd.data_buf = pp->buffer; smu_write()
1154 pp->cmd.reply_buf = pp->buffer; smu_write()
1155 pp->cmd.done = smu_user_cmd_done; smu_write()
1156 pp->cmd.misc = pp; smu_write()
1157 rc = smu_queue_cmd(&pp->cmd); smu_write()
1177 if (pp->cmd.status == 1) { smu_read_command()
1186 if (pp->cmd.status != 1) smu_read_command()
1201 if (pp->cmd.status != 0) smu_read_command()
1202 pp->cmd.reply_len = 0; smu_read_command()
1203 size = sizeof(hdr) + pp->cmd.reply_len; smu_read_command()
1207 hdr.status = pp->cmd.status; smu_read_command()
1208 hdr.reply_len = pp->cmd.reply_len; smu_read_command()
1255 if (pp->busy && pp->cmd.status != 1) smu_fpoll()
1282 if (busy && pp->cmd.status == 1) { smu_release()
1288 if (pp->cmd.status != 1) smu_release()
288 smu_queue_simple(struct smu_simple_cmd *scmd, u8 command, unsigned int data_len, void (*done)(struct smu_cmd *cmd, void *misc), void *misc, ...) smu_queue_simple() argument
/linux-4.4.14/fs/ocfs2/
H A Dioctl.h13 long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
14 long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg);
/linux-4.4.14/drivers/net/wireless/ath/carl9170/
H A DMakefile1 carl9170-objs := main.o usb.o cmd.o mac.o phy.o led.o fw.o tx.o rx.o
/linux-4.4.14/drivers/net/wireless/iwlwifi/dvm/
H A Dpower.c61 struct iwl_powertable_cmd cmd; member in struct:iwl_power_vec_entry
160 struct iwl_powertable_cmd *cmd, iwl_static_sleep_cmd()
184 memset(cmd, 0, sizeof(*cmd)); iwl_static_sleep_cmd()
186 *cmd = table[lvl].cmd; iwl_static_sleep_cmd()
197 max_sleep[i] = le32_to_cpu(cmd->sleep_interval[i]); iwl_static_sleep_cmd()
201 slp_itrvl = le32_to_cpu(cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1]); iwl_static_sleep_cmd()
204 cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1] = iwl_static_sleep_cmd()
207 slp_itrvl = le32_to_cpu(cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1]); iwl_static_sleep_cmd()
209 cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1] = iwl_static_sleep_cmd()
213 cmd->flags |= IWL_POWER_SLEEP_OVER_DTIM_MSK; iwl_static_sleep_cmd()
215 cmd->flags &= ~IWL_POWER_SLEEP_OVER_DTIM_MSK; iwl_static_sleep_cmd()
218 cmd->flags |= IWL_POWER_SHADOW_REG_ENA; iwl_static_sleep_cmd()
220 cmd->flags &= ~IWL_POWER_SHADOW_REG_ENA; iwl_static_sleep_cmd()
224 cmd->flags |= IWL_POWER_BT_SCO_ENA; iwl_static_sleep_cmd()
226 cmd->flags &= ~IWL_POWER_BT_SCO_ENA; iwl_static_sleep_cmd()
230 slp_itrvl = le32_to_cpu(cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1]); iwl_static_sleep_cmd()
232 cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1] = iwl_static_sleep_cmd()
237 if (le32_to_cpu(cmd->sleep_interval[i]) > iwl_static_sleep_cmd()
239 cmd->sleep_interval[i] = iwl_static_sleep_cmd()
242 if (le32_to_cpu(cmd->sleep_interval[i]) > iwl_static_sleep_cmd()
243 le32_to_cpu(cmd->sleep_interval[i+1])) iwl_static_sleep_cmd()
244 cmd->sleep_interval[i] = iwl_static_sleep_cmd()
245 cmd->sleep_interval[i+1]; iwl_static_sleep_cmd()
250 cmd->flags |= IWL_POWER_PCI_PM_MSK; iwl_static_sleep_cmd()
252 cmd->flags &= ~IWL_POWER_PCI_PM_MSK; iwl_static_sleep_cmd()
262 struct iwl_powertable_cmd *cmd) iwl_power_sleep_cam_cmd()
264 memset(cmd, 0, sizeof(*cmd)); iwl_power_sleep_cam_cmd()
267 cmd->flags |= IWL_POWER_PCI_PM_MSK; iwl_power_sleep_cam_cmd()
272 static int iwl_set_power(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd) iwl_set_power() argument
275 IWL_DEBUG_POWER(priv, "Flags value = 0x%08X\n", cmd->flags); iwl_set_power()
276 IWL_DEBUG_POWER(priv, "Tx timeout = %u\n", le32_to_cpu(cmd->tx_data_timeout)); iwl_set_power()
277 IWL_DEBUG_POWER(priv, "Rx timeout = %u\n", le32_to_cpu(cmd->rx_data_timeout)); iwl_set_power()
279 le32_to_cpu(cmd->sleep_interval[0]), iwl_set_power()
280 le32_to_cpu(cmd->sleep_interval[1]), iwl_set_power()
281 le32_to_cpu(cmd->sleep_interval[2]), iwl_set_power()
282 le32_to_cpu(cmd->sleep_interval[3]), iwl_set_power()
283 le32_to_cpu(cmd->sleep_interval[4])); iwl_set_power()
286 sizeof(struct iwl_powertable_cmd), cmd); iwl_set_power()
290 struct iwl_powertable_cmd *cmd) iwl_power_build_cmd()
296 iwl_power_sleep_cam_cmd(priv, cmd); iwl_power_build_cmd()
303 iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, dtimper); iwl_power_build_cmd()
306 iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, 20); iwl_power_build_cmd()
309 iwl_static_sleep_cmd(priv, cmd, iwl_power_build_cmd()
312 iwl_power_sleep_cam_cmd(priv, cmd); iwl_power_build_cmd()
314 iwl_static_sleep_cmd(priv, cmd, iwl_power_build_cmd()
322 iwl_static_sleep_cmd(priv, cmd, iwl_power_build_cmd()
325 iwl_static_sleep_cmd(priv, cmd, iwl_power_build_cmd()
330 int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, iwl_power_set_mode() argument
342 if (!memcmp(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force) iwl_power_set_mode()
349 memcpy(&priv->power_data.sleep_cmd_next, cmd, sizeof(*cmd)); iwl_power_set_mode()
355 if (cmd->flags & IWL_POWER_DRIVER_ALLOW_SLEEP_MSK) iwl_power_set_mode()
358 ret = iwl_set_power(priv, cmd); iwl_power_set_mode()
360 if (!(cmd->flags & IWL_POWER_DRIVER_ALLOW_SLEEP_MSK)) iwl_power_set_mode()
371 memcpy(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)); iwl_power_set_mode()
380 struct iwl_powertable_cmd cmd; iwl_power_update_mode() local
382 iwl_power_build_cmd(priv, &cmd); iwl_power_update_mode()
383 return iwl_power_set_mode(priv, &cmd, force); iwl_power_update_mode()
159 iwl_static_sleep_cmd(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, enum iwl_power_level lvl, int period) iwl_static_sleep_cmd() argument
261 iwl_power_sleep_cam_cmd(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd) iwl_power_sleep_cam_cmd() argument
289 iwl_power_build_cmd(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd) iwl_power_build_cmd() argument
H A Ducode.c63 struct iwl_calib_xtal_freq_cmd cmd; iwl_set_Xtal_calib() local
66 iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD); iwl_set_Xtal_calib()
67 cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]); iwl_set_Xtal_calib()
68 cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]); iwl_set_Xtal_calib()
69 return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd)); iwl_set_Xtal_calib()
74 struct iwl_calib_temperature_offset_cmd cmd; iwl_set_temperature_offset_calib() local
76 memset(&cmd, 0, sizeof(cmd)); iwl_set_temperature_offset_calib()
77 iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); iwl_set_temperature_offset_calib()
78 cmd.radio_sensor_offset = priv->nvm_data->raw_temperature; iwl_set_temperature_offset_calib()
79 if (!(cmd.radio_sensor_offset)) iwl_set_temperature_offset_calib()
80 cmd.radio_sensor_offset = DEFAULT_RADIO_SENSOR_OFFSET; iwl_set_temperature_offset_calib()
83 le16_to_cpu(cmd.radio_sensor_offset)); iwl_set_temperature_offset_calib()
84 return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd)); iwl_set_temperature_offset_calib()
89 struct iwl_calib_temperature_offset_v2_cmd cmd; iwl_set_temperature_offset_calib_v2() local
91 memset(&cmd, 0, sizeof(cmd)); iwl_set_temperature_offset_calib_v2()
92 iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); iwl_set_temperature_offset_calib_v2()
93 cmd.radio_sensor_offset_high = priv->nvm_data->kelvin_temperature; iwl_set_temperature_offset_calib_v2()
94 cmd.radio_sensor_offset_low = priv->nvm_data->raw_temperature; iwl_set_temperature_offset_calib_v2()
95 if (!cmd.radio_sensor_offset_low) { iwl_set_temperature_offset_calib_v2()
97 cmd.radio_sensor_offset_low = DEFAULT_RADIO_SENSOR_OFFSET; iwl_set_temperature_offset_calib_v2()
98 cmd.radio_sensor_offset_high = DEFAULT_RADIO_SENSOR_OFFSET; iwl_set_temperature_offset_calib_v2()
100 cmd.burntVoltageRef = priv->nvm_data->calib_voltage; iwl_set_temperature_offset_calib_v2()
103 le16_to_cpu(cmd.radio_sensor_offset_high)); iwl_set_temperature_offset_calib_v2()
105 le16_to_cpu(cmd.radio_sensor_offset_low)); iwl_set_temperature_offset_calib_v2()
107 le16_to_cpu(cmd.burntVoltageRef)); iwl_set_temperature_offset_calib_v2()
109 return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd)); iwl_set_temperature_offset_calib_v2()
115 struct iwl_host_cmd cmd = { iwl_send_calib_cfg() local
128 return iwl_dvm_send_cmd(priv, &cmd); iwl_send_calib_cfg()
393 if (pkt->hdr.cmd != CALIBRATION_RES_NOTIFICATION) { iwlagn_wait_calib()
394 WARN_ON(pkt->hdr.cmd != CALIBRATION_COMPLETE_NOTIFICATION); iwlagn_wait_calib()
/linux-4.4.14/drivers/net/wireless/libertas/
H A Dcmd.c15 #include "cmd.h"
63 * @cmd: the command ID
67 static u8 is_command_allowed_in_ps(u16 cmd) is_command_allowed_in_ps() argument
69 switch (cmd) { is_command_allowed_in_ps()
90 struct cmd_ds_get_hw_spec cmd; lbs_update_hw_spec() local
96 memset(&cmd, 0, sizeof(cmd)); lbs_update_hw_spec()
97 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_update_hw_spec()
98 memcpy(cmd.permanentaddr, priv->current_addr, ETH_ALEN); lbs_update_hw_spec()
99 ret = lbs_cmd_with_response(priv, CMD_GET_HW_SPEC, &cmd); lbs_update_hw_spec()
103 priv->fwcapinfo = le32_to_cpu(cmd.fwcapinfo); lbs_update_hw_spec()
107 priv->fwrelease = le32_to_cpu(cmd.fwrelease); lbs_update_hw_spec()
116 cmd.permanentaddr, lbs_update_hw_spec()
123 cmd.hwifversion, cmd.version); lbs_update_hw_spec()
133 priv->regioncode = (le16_to_cpu(cmd.regioncode) >> 8) & 0xFF; lbs_update_hw_spec()
135 priv->regioncode = le16_to_cpu(cmd.regioncode) & 0xFF; lbs_update_hw_spec()
151 memmove(priv->current_addr, cmd.permanentaddr, ETH_ALEN); lbs_update_hw_spec()
236 struct cmd_ds_802_11_ps_mode cmd; lbs_set_ps_mode() local
241 memset(&cmd, 0, sizeof(cmd)); lbs_set_ps_mode()
242 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_set_ps_mode()
243 cmd.action = cpu_to_le16(cmd_action); lbs_set_ps_mode()
247 cmd.multipledtim = cpu_to_le16(1); /* Default DTIM multiple */ lbs_set_ps_mode()
260 ret = lbs_cmd_with_response(priv, CMD_802_11_PS_MODE, &cmd); lbs_set_ps_mode()
262 lbs_cmd_async(priv, CMD_802_11_PS_MODE, &cmd.hdr, sizeof (cmd)); lbs_set_ps_mode()
272 struct cmd_ds_802_11_sleep_params cmd; lbs_cmd_802_11_sleep_params() local
278 memset(&cmd, 0, sizeof(cmd)); lbs_cmd_802_11_sleep_params()
280 cmd.error = cpu_to_le16(sp->sp_error); lbs_cmd_802_11_sleep_params()
281 cmd.offset = cpu_to_le16(sp->sp_offset); lbs_cmd_802_11_sleep_params()
282 cmd.stabletime = cpu_to_le16(sp->sp_stabletime); lbs_cmd_802_11_sleep_params()
283 cmd.calcontrol = sp->sp_calcontrol; lbs_cmd_802_11_sleep_params()
284 cmd.externalsleepclk = sp->sp_extsleepclk; lbs_cmd_802_11_sleep_params()
285 cmd.reserved = cpu_to_le16(sp->sp_reserved); lbs_cmd_802_11_sleep_params()
287 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_cmd_802_11_sleep_params()
288 cmd.action = cpu_to_le16(cmd_action); lbs_cmd_802_11_sleep_params()
290 ret = lbs_cmd_with_response(priv, CMD_802_11_SLEEP_PARAMS, &cmd); lbs_cmd_802_11_sleep_params()
295 le16_to_cpu(cmd.error), le16_to_cpu(cmd.offset), lbs_cmd_802_11_sleep_params()
296 le16_to_cpu(cmd.stabletime), cmd.calcontrol, lbs_cmd_802_11_sleep_params()
297 cmd.externalsleepclk); lbs_cmd_802_11_sleep_params()
299 sp->sp_error = le16_to_cpu(cmd.error); lbs_cmd_802_11_sleep_params()
300 sp->sp_offset = le16_to_cpu(cmd.offset); lbs_cmd_802_11_sleep_params()
301 sp->sp_stabletime = le16_to_cpu(cmd.stabletime); lbs_cmd_802_11_sleep_params()
302 sp->sp_calcontrol = cmd.calcontrol; lbs_cmd_802_11_sleep_params()
303 sp->sp_extsleepclk = cmd.externalsleepclk; lbs_cmd_802_11_sleep_params()
304 sp->sp_reserved = le16_to_cpu(cmd.reserved); lbs_cmd_802_11_sleep_params()
367 struct cmd_header *cmd) lbs_ret_host_sleep_activate()
378 struct cmd_header cmd; lbs_set_host_sleep() local
386 memset(&cmd, 0, sizeof(cmd)); lbs_set_host_sleep()
398 &cmd, lbs_set_host_sleep()
399 sizeof(cmd), lbs_set_host_sleep()
438 struct cmd_ds_802_11_snmp_mib cmd; lbs_set_snmp_mib() local
443 memset(&cmd, 0, sizeof (cmd)); lbs_set_snmp_mib()
444 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_set_snmp_mib()
445 cmd.action = cpu_to_le16(CMD_ACT_SET); lbs_set_snmp_mib()
446 cmd.oid = cpu_to_le16((u16) oid); lbs_set_snmp_mib()
450 cmd.bufsize = cpu_to_le16(sizeof(u8)); lbs_set_snmp_mib()
451 cmd.value[0] = val; lbs_set_snmp_mib()
458 cmd.bufsize = cpu_to_le16(sizeof(u16)); lbs_set_snmp_mib()
459 *((__le16 *)(&cmd.value)) = cpu_to_le16(val); lbs_set_snmp_mib()
468 le16_to_cpu(cmd.oid), le16_to_cpu(cmd.bufsize), val); lbs_set_snmp_mib()
470 ret = lbs_cmd_with_response(priv, CMD_802_11_SNMP_MIB, &cmd); lbs_set_snmp_mib()
488 struct cmd_ds_802_11_snmp_mib cmd; lbs_get_snmp_mib() local
493 memset(&cmd, 0, sizeof (cmd)); lbs_get_snmp_mib()
494 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_get_snmp_mib()
495 cmd.action = cpu_to_le16(CMD_ACT_GET); lbs_get_snmp_mib()
496 cmd.oid = cpu_to_le16(oid); lbs_get_snmp_mib()
498 ret = lbs_cmd_with_response(priv, CMD_802_11_SNMP_MIB, &cmd); lbs_get_snmp_mib()
502 switch (le16_to_cpu(cmd.bufsize)) { lbs_get_snmp_mib()
504 *out_val = cmd.value[0]; lbs_get_snmp_mib()
507 *out_val = le16_to_cpu(*((__le16 *)(&cmd.value))); lbs_get_snmp_mib()
511 oid, le16_to_cpu(cmd.bufsize)); lbs_get_snmp_mib()
533 struct cmd_ds_802_11_rf_tx_power cmd; lbs_get_tx_power() local
538 memset(&cmd, 0, sizeof(cmd)); lbs_get_tx_power()
539 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_get_tx_power()
540 cmd.action = cpu_to_le16(CMD_ACT_GET); lbs_get_tx_power()
542 ret = lbs_cmd_with_response(priv, CMD_802_11_RF_TX_POWER, &cmd); lbs_get_tx_power()
544 *curlevel = le16_to_cpu(cmd.curlevel); lbs_get_tx_power()
546 *minlevel = cmd.minlevel; lbs_get_tx_power()
548 *maxlevel = cmd.maxlevel; lbs_get_tx_power()
565 struct cmd_ds_802_11_rf_tx_power cmd; lbs_set_tx_power() local
570 memset(&cmd, 0, sizeof(cmd)); lbs_set_tx_power()
571 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_set_tx_power()
572 cmd.action = cpu_to_le16(CMD_ACT_SET); lbs_set_tx_power()
573 cmd.curlevel = cpu_to_le16(dbm); lbs_set_tx_power()
577 ret = lbs_cmd_with_response(priv, CMD_802_11_RF_TX_POWER, &cmd); lbs_set_tx_power()
594 struct cmd_ds_802_11_monitor_mode cmd; lbs_set_monitor_mode() local
597 memset(&cmd, 0, sizeof(cmd)); lbs_set_monitor_mode()
598 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_set_monitor_mode()
599 cmd.action = cpu_to_le16(CMD_ACT_SET); lbs_set_monitor_mode()
601 cmd.mode = cpu_to_le16(0x1); lbs_set_monitor_mode()
605 ret = lbs_cmd_with_response(priv, CMD_802_11_MONITOR_MODE, &cmd); lbs_set_monitor_mode()
624 struct cmd_ds_802_11_rf_channel cmd; lbs_get_channel() local
629 memset(&cmd, 0, sizeof(cmd)); lbs_get_channel()
630 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_get_channel()
631 cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_GET); lbs_get_channel()
633 ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, &cmd); lbs_get_channel()
637 ret = le16_to_cpu(cmd.channel); lbs_get_channel()
671 struct cmd_ds_802_11_rf_channel cmd; lbs_set_channel() local
679 memset(&cmd, 0, sizeof(cmd)); lbs_set_channel()
680 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_set_channel()
681 cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_SET); lbs_set_channel()
682 cmd.channel = cpu_to_le16(channel); lbs_set_channel()
684 ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, &cmd); lbs_set_channel()
688 priv->channel = (uint8_t) le16_to_cpu(cmd.channel); lbs_set_channel()
708 struct cmd_ds_802_11_rssi cmd; lbs_get_rssi() local
716 memset(&cmd, 0, sizeof(cmd)); lbs_get_rssi()
717 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_get_rssi()
719 cmd.n_or_snr = cpu_to_le16(8); lbs_get_rssi()
721 ret = lbs_cmd_with_response(priv, CMD_802_11_RSSI, &cmd); lbs_get_rssi()
723 *nf = CAL_NF(le16_to_cpu(cmd.nf)); lbs_get_rssi()
724 *rssi = CAL_RSSI(le16_to_cpu(cmd.n_or_snr), le16_to_cpu(cmd.nf)); lbs_get_rssi()
743 struct cmd_ds_802_11d_domain_info cmd; lbs_set_11d_domain_info() local
744 struct mrvl_ie_domain_param_set *domain = &cmd.domain; lbs_set_11d_domain_info()
759 memset(&cmd, 0, sizeof(cmd)); lbs_set_11d_domain_info()
760 cmd.action = cpu_to_le16(CMD_ACT_SET); lbs_set_11d_domain_info()
840 (u8 *) &cmd.domain.country_code, lbs_set_11d_domain_info()
843 cmd.hdr.size = cpu_to_le16(sizeof(cmd.hdr) + lbs_set_11d_domain_info()
844 sizeof(cmd.action) + lbs_set_11d_domain_info()
845 sizeof(cmd.domain.header) + lbs_set_11d_domain_info()
846 sizeof(cmd.domain.country_code) + lbs_set_11d_domain_info()
849 ret = lbs_cmd_with_response(priv, CMD_802_11D_DOMAIN_INFO, &cmd); lbs_set_11d_domain_info()
869 struct cmd_ds_reg_access cmd; lbs_get_reg() local
876 memset(&cmd, 0, sizeof(cmd)); lbs_get_reg()
877 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_get_reg()
878 cmd.action = cpu_to_le16(CMD_ACT_GET); lbs_get_reg()
879 cmd.offset = cpu_to_le16(offset); lbs_get_reg()
888 ret = lbs_cmd_with_response(priv, reg, &cmd); lbs_get_reg()
891 *value = cmd.value.bbp_rf; lbs_get_reg()
893 *value = le32_to_cpu(cmd.value.mac); lbs_get_reg()
914 struct cmd_ds_reg_access cmd; lbs_set_reg() local
919 memset(&cmd, 0, sizeof(cmd)); lbs_set_reg()
920 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_set_reg()
921 cmd.action = cpu_to_le16(CMD_ACT_SET); lbs_set_reg()
922 cmd.offset = cpu_to_le16(offset); lbs_set_reg()
925 cmd.value.bbp_rf = (u8) (value & 0xFF); lbs_set_reg()
927 cmd.value.mac = cpu_to_le32(value); lbs_set_reg()
933 ret = lbs_cmd_with_response(priv, reg, &cmd); lbs_set_reg()
953 lbs_deb_host("DNLD_CMD: cmd size is zero\n"); lbs_queue_cmd()
991 struct cmd_header *cmd; lbs_submit_command() local
999 cmd = cmdnode->cmdbuf; lbs_submit_command()
1003 cmd->seqnum = cpu_to_le16(priv->seqnum); lbs_submit_command()
1007 cmdsize = le16_to_cpu(cmd->size); lbs_submit_command()
1008 command = le16_to_cpu(cmd->command); lbs_submit_command()
1015 command, le16_to_cpu(cmd->seqnum), cmdsize); lbs_submit_command()
1018 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); lbs_submit_command()
1075 void __lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, __lbs_complete_command() argument
1084 list_del_init(&cmd->list); __lbs_complete_command()
1086 cmd->result = result; __lbs_complete_command()
1087 cmd->cmdwaitqwoken = 1; __lbs_complete_command()
1088 wake_up(&cmd->cmdwait_q); __lbs_complete_command()
1090 if (!cmd->callback || cmd->callback == lbs_cmd_async_callback) __lbs_complete_command()
1091 __lbs_cleanup_and_insert_cmd(priv, cmd); __lbs_complete_command()
1096 void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, lbs_complete_command() argument
1101 __lbs_complete_command(priv, cmd, result); lbs_complete_command()
1107 struct cmd_ds_802_11_radio_control cmd; lbs_set_radio() local
1112 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_set_radio()
1113 cmd.action = cpu_to_le16(CMD_ACT_SET); lbs_set_radio()
1114 cmd.control = 0; lbs_set_radio()
1122 cmd.control = cpu_to_le16(preamble); lbs_set_radio()
1130 cmd.control |= cpu_to_le16(0x1); lbs_set_radio()
1132 cmd.control &= cpu_to_le16(~0x1); lbs_set_radio()
1141 ret = lbs_cmd_with_response(priv, CMD_802_11_RADIO_CONTROL, &cmd); lbs_set_radio()
1150 struct cmd_ds_mac_control cmd; lbs_set_mac_control() local
1154 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_set_mac_control()
1155 cmd.action = cpu_to_le16(priv->mac_control); lbs_set_mac_control()
1156 cmd.reserved = 0; lbs_set_mac_control()
1158 lbs_cmd_async(priv, CMD_MAC_CONTROL, &cmd.hdr, sizeof(cmd)); lbs_set_mac_control()
1165 struct cmd_ds_mac_control cmd; lbs_set_mac_control_sync() local
1170 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_set_mac_control_sync()
1171 cmd.action = cpu_to_le16(priv->mac_control); lbs_set_mac_control_sync()
1172 cmd.reserved = 0; lbs_set_mac_control_sync()
1173 ret = lbs_cmd_with_response(priv, CMD_MAC_CONTROL, &cmd); lbs_set_mac_control_sync()
1240 /* need to check if cmd array is allocated or not */ lbs_free_cmd_buffer()
1314 struct cmd_header *cmd; lbs_execute_next_command() local
1341 cmd = cmdnode->cmdbuf; lbs_execute_next_command()
1343 if (is_command_allowed_in_ps(le16_to_cpu(cmd->command))) { lbs_execute_next_command()
1347 "EXEC_NEXT_CMD: cannot send cmd 0x%04x in psstate %d\n", lbs_execute_next_command()
1348 le16_to_cpu(cmd->command), lbs_execute_next_command()
1355 le16_to_cpu(cmd->command), priv->psstate); lbs_execute_next_command()
1368 if (cmd->command != cpu_to_le16(CMD_802_11_PS_MODE)) { lbs_execute_next_command()
1390 struct cmd_ds_802_11_ps_mode *psm = (void *)&cmd[1]; lbs_execute_next_command()
1393 "EXEC_NEXT_CMD: PS cmd, action 0x%02x\n", lbs_execute_next_command()
1398 "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); lbs_execute_next_command()
1408 "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); lbs_execute_next_command()
1424 le16_to_cpu(cmd->command)); lbs_execute_next_command()
1569 struct cmd_ds_802_11_tpc_cfg cmd; lbs_set_tpc_cfg() local
1572 memset(&cmd, 0, sizeof(cmd)); lbs_set_tpc_cfg()
1573 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_set_tpc_cfg()
1574 cmd.action = cpu_to_le16(CMD_ACT_SET); lbs_set_tpc_cfg()
1575 cmd.enable = !!enable; lbs_set_tpc_cfg()
1576 cmd.usesnr = !!usesnr; lbs_set_tpc_cfg()
1577 cmd.P0 = p0; lbs_set_tpc_cfg()
1578 cmd.P1 = p1; lbs_set_tpc_cfg()
1579 cmd.P2 = p2; lbs_set_tpc_cfg()
1581 ret = lbs_cmd_with_response(priv, CMD_802_11_TPC_CFG, &cmd); lbs_set_tpc_cfg()
1601 struct cmd_ds_802_11_pa_cfg cmd; lbs_set_power_adapt_cfg() local
1604 memset(&cmd, 0, sizeof(cmd)); lbs_set_power_adapt_cfg()
1605 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_set_power_adapt_cfg()
1606 cmd.action = cpu_to_le16(CMD_ACT_SET); lbs_set_power_adapt_cfg()
1607 cmd.enable = !!enable; lbs_set_power_adapt_cfg()
1608 cmd.P0 = p0; lbs_set_power_adapt_cfg()
1609 cmd.P1 = p1; lbs_set_power_adapt_cfg()
1610 cmd.P2 = p2; lbs_set_power_adapt_cfg()
1612 ret = lbs_cmd_with_response(priv, CMD_802_11_PA_CFG , &cmd); lbs_set_power_adapt_cfg()
365 lbs_ret_host_sleep_activate(struct lbs_private *priv, unsigned long dummy, struct cmd_header *cmd) lbs_ret_host_sleep_activate() argument
H A Dethtool.c7 #include "cmd.h"
41 struct cmd_ds_802_11_eeprom_access cmd; lbs_ethtool_get_eeprom() local
52 cmd.hdr.size = cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) - lbs_ethtool_get_eeprom()
54 cmd.action = cpu_to_le16(CMD_ACT_GET); lbs_ethtool_get_eeprom()
55 cmd.offset = cpu_to_le16(eeprom->offset); lbs_ethtool_get_eeprom()
56 cmd.len = cpu_to_le16(eeprom->len); lbs_ethtool_get_eeprom()
57 ret = lbs_cmd_with_response(priv, CMD_802_11_EEPROM_ACCESS, &cmd); lbs_ethtool_get_eeprom()
59 memcpy(bytes, cmd.value, eeprom->len); lbs_ethtool_get_eeprom()
H A Dcfg.c21 #include "cmd.h"
878 struct cmd_ds_802_11_set_wep cmd; lbs_remove_wep_keys() local
883 memset(&cmd, 0, sizeof(cmd)); lbs_remove_wep_keys()
884 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_remove_wep_keys()
885 cmd.keyindex = cpu_to_le16(priv->wep_tx_key); lbs_remove_wep_keys()
886 cmd.action = cpu_to_le16(CMD_ACT_REMOVE); lbs_remove_wep_keys()
888 ret = lbs_cmd_with_response(priv, CMD_802_11_SET_WEP, &cmd); lbs_remove_wep_keys()
899 struct cmd_ds_802_11_set_wep cmd; lbs_set_wep_keys() local
927 memset(&cmd, 0, sizeof(cmd)); lbs_set_wep_keys()
928 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_set_wep_keys()
929 cmd.keyindex = cpu_to_le16(priv->wep_tx_key); lbs_set_wep_keys()
930 cmd.action = cpu_to_le16(CMD_ACT_ADD); lbs_set_wep_keys()
935 cmd.keytype[i] = CMD_TYPE_WEP_40_BIT; lbs_set_wep_keys()
938 cmd.keytype[i] = CMD_TYPE_WEP_104_BIT; lbs_set_wep_keys()
941 cmd.keytype[i] = 0; lbs_set_wep_keys()
944 memcpy(cmd.keymaterial[i], priv->wep_key[i], lbs_set_wep_keys()
948 ret = lbs_cmd_with_response(priv, CMD_802_11_SET_WEP, &cmd); lbs_set_wep_keys()
964 struct cmd_ds_802_11_enable_rsn cmd; lbs_enable_rsn() local
970 * cmd 2f 00 lbs_enable_rsn()
977 memset(&cmd, 0, sizeof(cmd)); lbs_enable_rsn()
978 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_enable_rsn()
979 cmd.action = cpu_to_le16(CMD_ACT_SET); lbs_enable_rsn()
980 cmd.enable = cpu_to_le16(enable); lbs_enable_rsn()
982 ret = lbs_cmd_with_response(priv, CMD_802_11_ENABLE_RSN, &cmd); lbs_enable_rsn()
1009 struct cmd_key_material cmd; lbs_set_key_material() local
1017 * cmd 5e 00 lbs_set_key_material()
1029 memset(&cmd, 0, sizeof(cmd)); lbs_set_key_material()
1030 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_set_key_material()
1031 cmd.action = cpu_to_le16(CMD_ACT_SET); lbs_set_key_material()
1032 cmd.param.type = cpu_to_le16(TLV_TYPE_KEY_MATERIAL); lbs_set_key_material()
1033 cmd.param.length = cpu_to_le16(sizeof(cmd.param) - 4); lbs_set_key_material()
1034 cmd.param.keytypeid = cpu_to_le16(key_type); lbs_set_key_material()
1035 cmd.param.keyinfo = cpu_to_le16(key_info); lbs_set_key_material()
1036 cmd.param.keylen = cpu_to_le16(key_len); lbs_set_key_material()
1038 memcpy(cmd.param.key, key, key_len); lbs_set_key_material()
1040 ret = lbs_cmd_with_response(priv, CMD_802_11_KEY_MATERIAL, &cmd); lbs_set_key_material()
1056 struct cmd_ds_802_11_authenticate cmd; lbs_set_authtype() local
1062 * cmd 11 00 lbs_set_authtype()
1070 memset(&cmd, 0, sizeof(cmd)); lbs_set_authtype()
1071 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_set_authtype()
1073 memcpy(cmd.bssid, sme->bssid, ETH_ALEN); lbs_set_authtype()
1079 cmd.authtype = ret; lbs_set_authtype()
1080 ret = lbs_cmd_with_response(priv, CMD_802_11_AUTHENTICATE, &cmd); lbs_set_authtype()
1105 struct cmd_ds_802_11_associate *cmd = kzalloc(LBS_ASSOC_MAX_CMD_SIZE, lbs_associate() local
1111 u8 *pos = &(cmd->iebuf[0]); lbs_associate()
1116 if (!cmd) { lbs_associate()
1122 * cmd 50 00 lbs_associate()
1133 cmd->hdr.command = cpu_to_le16(CMD_802_11_ASSOCIATE); lbs_associate()
1136 memcpy(cmd->bssid, bss->bssid, ETH_ALEN); lbs_associate()
1137 cmd->listeninterval = cpu_to_le16(MRVDRV_DEFAULT_LISTEN_INTERVAL); lbs_associate()
1138 cmd->capability = cpu_to_le16(bss->capability); lbs_associate()
1171 len = (sizeof(*cmd) - sizeof(cmd->iebuf)) + lbs_associate()
1172 (u16)(pos - (u8 *) &cmd->iebuf); lbs_associate()
1173 cmd->hdr.size = cpu_to_le16(len); lbs_associate()
1175 lbs_deb_hex(LBS_DEB_ASSOC, "ASSOC_CMD", (u8 *) cmd, lbs_associate()
1176 le16_to_cpu(cmd->hdr.size)); lbs_associate()
1181 ret = lbs_cmd_with_response(priv, CMD_802_11_ASSOCIATE, cmd); lbs_associate()
1187 resp = (void *) cmd; /* recast for easier field access */ lbs_associate()
1257 kfree(cmd); lbs_associate()
1445 struct cmd_ds_802_11_deauthenticate cmd; lbs_disconnect() local
1448 memset(&cmd, 0, sizeof(cmd)); lbs_disconnect()
1449 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_disconnect()
1451 memcpy(cmd.macaddr, &priv->assoc_bss, ETH_ALEN); lbs_disconnect()
1452 cmd.reasoncode = cpu_to_le16(reason); lbs_disconnect()
1454 ret = lbs_cmd_with_response(priv, CMD_802_11_DEAUTHENTICATE, &cmd); lbs_disconnect()
1783 struct cmd_ds_802_11_ad_hoc_join cmd; lbs_ibss_join_existing() local
1824 memset(&cmd, 0, sizeof(cmd)); lbs_ibss_join_existing()
1825 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_ibss_join_existing()
1827 memcpy(cmd.bss.bssid, bss->bssid, ETH_ALEN); lbs_ibss_join_existing()
1828 memcpy(cmd.bss.ssid, params->ssid, params->ssid_len); lbs_ibss_join_existing()
1829 cmd.bss.type = CMD_BSS_TYPE_IBSS; lbs_ibss_join_existing()
1830 cmd.bss.beaconperiod = cpu_to_le16(params->beacon_interval); lbs_ibss_join_existing()
1831 cmd.bss.ds.header.id = WLAN_EID_DS_PARAMS; lbs_ibss_join_existing()
1832 cmd.bss.ds.header.len = 1; lbs_ibss_join_existing()
1833 cmd.bss.ds.channel = params->chandef.chan->hw_value; lbs_ibss_join_existing()
1834 cmd.bss.ibss.header.id = WLAN_EID_IBSS_PARAMS; lbs_ibss_join_existing()
1835 cmd.bss.ibss.header.len = 2; lbs_ibss_join_existing()
1836 cmd.bss.ibss.atimwindow = 0; lbs_ibss_join_existing()
1837 cmd.bss.capability = cpu_to_le16(bss->capability & CAPINFO_MASK); lbs_ibss_join_existing()
1844 lbs_add_rates(cmd.bss.rates); lbs_ibss_join_existing()
1848 u8 *rates = cmd.bss.rates; lbs_ibss_join_existing()
1866 cmd.failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); lbs_ibss_join_existing()
1867 cmd.probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME); lbs_ibss_join_existing()
1869 ret = lbs_cmd_with_response(priv, CMD_802_11_AD_HOC_JOIN, &cmd); lbs_ibss_join_existing()
1894 struct cmd_ds_802_11_ad_hoc_start cmd; lbs_ibss_start_new() local
1896 (struct cmd_ds_802_11_ad_hoc_result *) &cmd; lbs_ibss_start_new()
1935 memset(&cmd, 0, sizeof(cmd)); lbs_ibss_start_new()
1936 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_ibss_start_new()
1937 memcpy(cmd.ssid, params->ssid, params->ssid_len); lbs_ibss_start_new()
1938 cmd.bsstype = CMD_BSS_TYPE_IBSS; lbs_ibss_start_new()
1939 cmd.beaconperiod = cpu_to_le16(params->beacon_interval); lbs_ibss_start_new()
1940 cmd.ibss.header.id = WLAN_EID_IBSS_PARAMS; lbs_ibss_start_new()
1941 cmd.ibss.header.len = 2; lbs_ibss_start_new()
1942 cmd.ibss.atimwindow = 0; lbs_ibss_start_new()
1943 cmd.ds.header.id = WLAN_EID_DS_PARAMS; lbs_ibss_start_new()
1944 cmd.ds.header.len = 1; lbs_ibss_start_new()
1945 cmd.ds.channel = params->chandef.chan->hw_value; lbs_ibss_start_new()
1948 cmd.probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME); lbs_ibss_start_new()
1951 cmd.capability = cpu_to_le16(capability); lbs_ibss_start_new()
1952 lbs_add_rates(cmd.rates); lbs_ibss_start_new()
1955 ret = lbs_cmd_with_response(priv, CMD_802_11_AD_HOC_START, &cmd); lbs_ibss_start_new()
2020 struct cmd_ds_802_11_ad_hoc_stop cmd; lbs_leave_ibss() local
2028 memset(&cmd, 0, sizeof(cmd)); lbs_leave_ibss()
2029 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); lbs_leave_ibss()
2030 ret = lbs_cmd_with_response(priv, CMD_802_11_AD_HOC_STOP, &cmd); lbs_leave_ibss()
/linux-4.4.14/include/trace/events/
H A Dscsi.h203 TP_PROTO(struct scsi_cmnd *cmd),
205 TP_ARGS(cmd),
217 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
221 __entry->host_no = cmd->device->host->host_no;
222 __entry->channel = cmd->device->channel;
223 __entry->id = cmd->device->id;
224 __entry->lun = cmd->device->lun;
225 __entry->opcode = cmd->cmnd[0];
226 __entry->cmd_len = cmd->cmd_len;
227 __entry->data_sglen = scsi_sg_count(cmd);
228 __entry->prot_sglen = scsi_prot_sg_count(cmd);
229 __entry->prot_op = scsi_get_prot_op(cmd);
230 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
245 TP_PROTO(struct scsi_cmnd *cmd, int rtn),
247 TP_ARGS(cmd, rtn),
260 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
264 __entry->host_no = cmd->device->host->host_no;
265 __entry->channel = cmd->device->channel;
266 __entry->id = cmd->device->id;
267 __entry->lun = cmd->device->lun;
269 __entry->opcode = cmd->cmnd[0];
270 __entry->cmd_len = cmd->cmd_len;
271 __entry->data_sglen = scsi_sg_count(cmd);
272 __entry->prot_sglen = scsi_prot_sg_count(cmd);
273 __entry->prot_op = scsi_get_prot_op(cmd);
274 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
290 TP_PROTO(struct scsi_cmnd *cmd),
292 TP_ARGS(cmd),
305 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
309 __entry->host_no = cmd->device->host->host_no;
310 __entry->channel = cmd->device->channel;
311 __entry->id = cmd->device->id;
312 __entry->lun = cmd->device->lun;
313 __entry->result = cmd->result;
314 __entry->opcode = cmd->cmnd[0];
315 __entry->cmd_len = cmd->cmd_len;
316 __entry->data_sglen = scsi_sg_count(cmd);
317 __entry->prot_sglen = scsi_prot_sg_count(cmd);
318 __entry->prot_op = scsi_get_prot_op(cmd);
319 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
338 TP_PROTO(struct scsi_cmnd *cmd),
339 TP_ARGS(cmd));
342 TP_PROTO(struct scsi_cmnd *cmd),
343 TP_ARGS(cmd));
H A Dtarget.h133 TP_PROTO(struct se_cmd *cmd),
135 TP_ARGS(cmd),
143 __string( initiator, cmd->se_sess->se_node_acl->initiatorname )
147 __entry->unpacked_lun = cmd->orig_fe_lun;
148 __entry->opcode = cmd->t_task_cdb[0];
149 __entry->data_length = cmd->data_length;
150 __entry->task_attribute = cmd->sam_task_attr;
151 memcpy(__entry->cdb, cmd->t_task_cdb, TCM_MAX_COMMAND_SIZE);
152 __assign_str(initiator, cmd->se_sess->se_node_acl->initiatorname);
168 TP_PROTO(struct se_cmd *cmd),
170 TP_ARGS(cmd),
181 __string(initiator, cmd->se_sess->se_node_acl->initiatorname)
185 __entry->unpacked_lun = cmd->orig_fe_lun;
186 __entry->opcode = cmd->t_task_cdb[0];
187 __entry->data_length = cmd->data_length;
188 __entry->task_attribute = cmd->sam_task_attr;
189 __entry->scsi_status = cmd->scsi_status;
190 __entry->sense_length = cmd->scsi_status == SAM_STAT_CHECK_CONDITION ?
191 min(18, ((u8 *) cmd->sense_buffer)[SPC_ADD_SENSE_LEN_OFFSET] + 8) : 0;
192 memcpy(__entry->cdb, cmd->t_task_cdb, TCM_MAX_COMMAND_SIZE);
193 memcpy(__entry->sense_data, cmd->sense_buffer, __entry->sense_length);
194 __assign_str(initiator, cmd->se_sess->se_node_acl->initiatorname);
/linux-4.4.14/drivers/net/ethernet/qlogic/netxen/
H A Dnetxen_nic_ctx.c49 netxen_issue_cmd(struct netxen_adapter *adapter, struct netxen_cmd_args *cmd) netxen_issue_cmd() argument
63 NXWR32(adapter, NX_ARG1_CRB_OFFSET, cmd->req.arg1); netxen_issue_cmd()
65 NXWR32(adapter, NX_ARG2_CRB_OFFSET, cmd->req.arg2); netxen_issue_cmd()
67 NXWR32(adapter, NX_ARG3_CRB_OFFSET, cmd->req.arg3); netxen_issue_cmd()
69 NXWR32(adapter, NX_CDRP_CRB_OFFSET, NX_CDRP_FORM_CMD(cmd->req.cmd)); netxen_issue_cmd()
84 cmd->rsp.cmd = NX_RCODE_SUCCESS; netxen_issue_cmd()
85 if (cmd->rsp.arg2) netxen_issue_cmd()
86 cmd->rsp.arg2 = NXRD32(adapter, NX_ARG2_CRB_OFFSET); netxen_issue_cmd()
87 if (cmd->rsp.arg3) netxen_issue_cmd()
88 cmd->rsp.arg3 = NXRD32(adapter, NX_ARG3_CRB_OFFSET); netxen_issue_cmd()
91 if (cmd->rsp.arg1) netxen_issue_cmd()
92 cmd->rsp.arg1 = NXRD32(adapter, NX_ARG1_CRB_OFFSET); netxen_issue_cmd()
102 struct netxen_cmd_args cmd; netxen_get_minidump_template_size() local
103 memset(&cmd, 0, sizeof(cmd)); netxen_get_minidump_template_size()
104 cmd.req.cmd = NX_CDRP_CMD_TEMP_SIZE; netxen_get_minidump_template_size()
105 memset(&cmd.rsp, 1, sizeof(struct _cdrp_cmd)); netxen_get_minidump_template_size()
106 netxen_issue_cmd(adapter, &cmd); netxen_get_minidump_template_size()
107 if (cmd.rsp.cmd != NX_RCODE_SUCCESS) { netxen_get_minidump_template_size()
109 "Can't get template size %d\n", cmd.rsp.cmd); netxen_get_minidump_template_size()
112 adapter->mdump.md_template_size = cmd.rsp.arg2; netxen_get_minidump_template_size()
113 adapter->mdump.md_template_ver = cmd.rsp.arg3; netxen_get_minidump_template_size()
123 struct netxen_cmd_args cmd; netxen_get_minidump_template() local
138 memset(&cmd, 0, sizeof(cmd)); netxen_get_minidump_template()
139 memset(&cmd.rsp, 1, sizeof(struct _cdrp_cmd)); netxen_get_minidump_template()
140 cmd.req.cmd = NX_CDRP_CMD_GET_TEMP_HDR; netxen_get_minidump_template()
141 cmd.req.arg1 = LSD(md_template_addr); netxen_get_minidump_template()
142 cmd.req.arg2 = MSD(md_template_addr); netxen_get_minidump_template()
143 cmd.req.arg3 |= size; netxen_get_minidump_template()
144 netxen_issue_cmd(adapter, &cmd); netxen_get_minidump_template()
146 if ((cmd.rsp.cmd == NX_RCODE_SUCCESS) && (size == cmd.rsp.arg2)) { netxen_get_minidump_template()
151 cmd.rsp.cmd, size, cmd.rsp.arg2); netxen_get_minidump_template()
241 struct netxen_cmd_args cmd; nx_fw_cmd_set_mtu() local
243 memset(&cmd, 0, sizeof(cmd)); nx_fw_cmd_set_mtu()
244 cmd.req.cmd = NX_CDRP_CMD_SET_MTU; nx_fw_cmd_set_mtu()
245 cmd.req.arg1 = recv_ctx->context_id; nx_fw_cmd_set_mtu()
246 cmd.req.arg2 = mtu; nx_fw_cmd_set_mtu()
247 cmd.req.arg3 = 0; nx_fw_cmd_set_mtu()
250 netxen_issue_cmd(adapter, &cmd); nx_fw_cmd_set_mtu()
262 struct netxen_cmd_args cmd; nx_fw_cmd_set_gbe_port() local
264 memset(&cmd, 0, sizeof(cmd)); nx_fw_cmd_set_gbe_port()
265 cmd.req.cmd = NX_CDRP_CMD_CONFIG_GBE_PORT; nx_fw_cmd_set_gbe_port()
266 cmd.req.arg1 = speed; nx_fw_cmd_set_gbe_port()
267 cmd.req.arg2 = duplex; nx_fw_cmd_set_gbe_port()
268 cmd.req.arg3 = autoneg; nx_fw_cmd_set_gbe_port()
269 return netxen_issue_cmd(adapter, &cmd); nx_fw_cmd_set_gbe_port()
284 struct netxen_cmd_args cmd; nx_fw_cmd_create_rx_ctx() local
367 memset(&cmd, 0, sizeof(cmd)); nx_fw_cmd_create_rx_ctx()
368 cmd.req.arg1 = (u32)(phys_addr >> 32); nx_fw_cmd_create_rx_ctx()
369 cmd.req.arg2 = (u32)(phys_addr & 0xffffffff); nx_fw_cmd_create_rx_ctx()
370 cmd.req.arg3 = rq_size; nx_fw_cmd_create_rx_ctx()
371 cmd.req.cmd = NX_CDRP_CMD_CREATE_RX_CTX; nx_fw_cmd_create_rx_ctx()
372 err = netxen_issue_cmd(adapter, &cmd); nx_fw_cmd_create_rx_ctx()
421 struct netxen_cmd_args cmd; nx_fw_cmd_destroy_rx_ctx() local
423 memset(&cmd, 0, sizeof(cmd)); nx_fw_cmd_destroy_rx_ctx()
424 cmd.req.arg1 = recv_ctx->context_id; nx_fw_cmd_destroy_rx_ctx()
425 cmd.req.arg2 = NX_DESTROY_CTX_RESET; nx_fw_cmd_destroy_rx_ctx()
426 cmd.req.arg3 = 0; nx_fw_cmd_destroy_rx_ctx()
427 cmd.req.cmd = NX_CDRP_CMD_DESTROY_RX_CTX; nx_fw_cmd_destroy_rx_ctx()
429 if (netxen_issue_cmd(adapter, &cmd)) { nx_fw_cmd_destroy_rx_ctx()
450 struct netxen_cmd_args cmd; nx_fw_cmd_create_tx_ctx() local
494 memset(&cmd, 0, sizeof(cmd)); nx_fw_cmd_create_tx_ctx()
495 cmd.req.arg1 = (u32)(phys_addr >> 32); nx_fw_cmd_create_tx_ctx()
496 cmd.req.arg2 = ((u32)phys_addr & 0xffffffff); nx_fw_cmd_create_tx_ctx()
497 cmd.req.arg3 = rq_size; nx_fw_cmd_create_tx_ctx()
498 cmd.req.cmd = NX_CDRP_CMD_CREATE_TX_CTX; nx_fw_cmd_create_tx_ctx()
499 err = netxen_issue_cmd(adapter, &cmd); nx_fw_cmd_create_tx_ctx()
528 struct netxen_cmd_args cmd; nx_fw_cmd_destroy_tx_ctx() local
530 memset(&cmd, 0, sizeof(cmd)); nx_fw_cmd_destroy_tx_ctx()
531 cmd.req.arg1 = adapter->tx_context_id; nx_fw_cmd_destroy_tx_ctx()
532 cmd.req.arg2 = NX_DESTROY_CTX_RESET; nx_fw_cmd_destroy_tx_ctx()
533 cmd.req.arg3 = 0; nx_fw_cmd_destroy_tx_ctx()
534 cmd.req.cmd = NX_CDRP_CMD_DESTROY_TX_CTX; nx_fw_cmd_destroy_tx_ctx()
535 if (netxen_issue_cmd(adapter, &cmd)) { nx_fw_cmd_destroy_tx_ctx()
546 struct netxen_cmd_args cmd; nx_fw_cmd_query_phy() local
548 memset(&cmd, 0, sizeof(cmd)); nx_fw_cmd_query_phy()
549 cmd.req.arg1 = reg; nx_fw_cmd_query_phy()
550 cmd.req.arg2 = 0; nx_fw_cmd_query_phy()
551 cmd.req.arg3 = 0; nx_fw_cmd_query_phy()
552 cmd.req.cmd = NX_CDRP_CMD_READ_PHY; nx_fw_cmd_query_phy()
553 cmd.rsp.arg1 = 1; nx_fw_cmd_query_phy()
554 rcode = netxen_issue_cmd(adapter, &cmd); nx_fw_cmd_query_phy()
561 *val = cmd.rsp.arg1; nx_fw_cmd_query_phy()
569 struct netxen_cmd_args cmd; nx_fw_cmd_set_phy() local
571 memset(&cmd, 0, sizeof(cmd)); nx_fw_cmd_set_phy()
572 cmd.req.arg1 = reg; nx_fw_cmd_set_phy()
573 cmd.req.arg2 = val; nx_fw_cmd_set_phy()
574 cmd.req.arg3 = 0; nx_fw_cmd_set_phy()
575 cmd.req.cmd = NX_CDRP_CMD_WRITE_PHY; nx_fw_cmd_set_phy()
576 rcode = netxen_issue_cmd(adapter, &cmd); nx_fw_cmd_set_phy()
788 /* cmd desc ring */ netxen_alloc_hw_resources()
/linux-4.4.14/drivers/infiniband/core/
H A Duverbs_cmd.c291 struct ib_uverbs_get_context cmd; ib_uverbs_get_context() local
304 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_get_context()
314 INIT_UDATA(&udata, buf + sizeof cmd, ib_uverbs_get_context()
315 (unsigned long) cmd.response + sizeof resp, ib_uverbs_get_context()
316 in_len - sizeof cmd, out_len - sizeof resp); ib_uverbs_get_context()
366 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_get_context()
448 struct ib_uverbs_query_device cmd; ib_uverbs_query_device() local
456 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_query_device()
466 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_query_device()
478 struct ib_uverbs_query_port cmd; ib_uverbs_query_port() local
486 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_query_port()
489 ret = ib_query_port(ib_dev, cmd.port_num, &attr); ib_uverbs_query_port()
515 cmd.port_num); ib_uverbs_query_port()
517 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_query_port()
529 struct ib_uverbs_alloc_pd cmd; ib_uverbs_alloc_pd() local
539 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_alloc_pd()
542 INIT_UDATA(&udata, buf + sizeof cmd, ib_uverbs_alloc_pd()
543 (unsigned long) cmd.response + sizeof resp, ib_uverbs_alloc_pd()
544 in_len - sizeof cmd, out_len - sizeof resp); ib_uverbs_alloc_pd()
572 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_alloc_pd()
604 struct ib_uverbs_dealloc_pd cmd; ib_uverbs_dealloc_pd() local
609 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_dealloc_pd()
612 uobj = idr_write_uobj(&ib_uverbs_pd_idr, cmd.pd_handle, file->ucontext); ib_uverbs_dealloc_pd()
735 struct ib_uverbs_open_xrcd cmd; ib_uverbs_open_xrcd() local
748 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_open_xrcd()
751 INIT_UDATA(&udata, buf + sizeof cmd, ib_uverbs_open_xrcd()
752 (unsigned long) cmd.response + sizeof resp, ib_uverbs_open_xrcd()
753 in_len - sizeof cmd, out_len - sizeof resp); ib_uverbs_open_xrcd()
757 if (cmd.fd != -1) { ib_uverbs_open_xrcd()
759 f = fdget(cmd.fd); ib_uverbs_open_xrcd()
767 if (!xrcd && !(cmd.oflags & O_CREAT)) { ib_uverbs_open_xrcd()
773 if (xrcd && cmd.oflags & O_EXCL) { ib_uverbs_open_xrcd()
823 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_open_xrcd()
872 struct ib_uverbs_close_xrcd cmd; ib_uverbs_close_xrcd() local
880 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_close_xrcd()
884 uobj = idr_write_uobj(&ib_uverbs_xrcd_idr, cmd.xrcd_handle, file->ucontext); ib_uverbs_close_xrcd()
950 struct ib_uverbs_reg_mr cmd; ib_uverbs_reg_mr() local
961 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_reg_mr()
964 INIT_UDATA(&udata, buf + sizeof cmd, ib_uverbs_reg_mr()
965 (unsigned long) cmd.response + sizeof resp, ib_uverbs_reg_mr()
966 in_len - sizeof cmd, out_len - sizeof resp); ib_uverbs_reg_mr()
968 if ((cmd.start & ~PAGE_MASK) != (cmd.hca_va & ~PAGE_MASK)) ib_uverbs_reg_mr()
971 ret = ib_check_mr_access(cmd.access_flags); ib_uverbs_reg_mr()
982 pd = idr_read_pd(cmd.pd_handle, file->ucontext); ib_uverbs_reg_mr()
988 if (cmd.access_flags & IB_ACCESS_ON_DEMAND) { ib_uverbs_reg_mr()
1000 mr = pd->device->reg_user_mr(pd, cmd.start, cmd.length, cmd.hca_va, ib_uverbs_reg_mr()
1001 cmd.access_flags, &udata); ib_uverbs_reg_mr()
1023 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_reg_mr()
1060 struct ib_uverbs_rereg_mr cmd; ib_uverbs_rereg_mr() local
1072 if (copy_from_user(&cmd, buf, sizeof(cmd))) ib_uverbs_rereg_mr()
1075 INIT_UDATA(&udata, buf + sizeof(cmd), ib_uverbs_rereg_mr()
1076 (unsigned long) cmd.response + sizeof(resp), ib_uverbs_rereg_mr()
1077 in_len - sizeof(cmd), out_len - sizeof(resp)); ib_uverbs_rereg_mr()
1079 if (cmd.flags & ~IB_MR_REREG_SUPPORTED || !cmd.flags) ib_uverbs_rereg_mr()
1082 if ((cmd.flags & IB_MR_REREG_TRANS) && ib_uverbs_rereg_mr()
1083 (!cmd.start || !cmd.hca_va || 0 >= cmd.length || ib_uverbs_rereg_mr()
1084 (cmd.start & ~PAGE_MASK) != (cmd.hca_va & ~PAGE_MASK))) ib_uverbs_rereg_mr()
1087 uobj = idr_write_uobj(&ib_uverbs_mr_idr, cmd.mr_handle, ib_uverbs_rereg_mr()
1095 if (cmd.flags & IB_MR_REREG_ACCESS) { ib_uverbs_rereg_mr()
1096 ret = ib_check_mr_access(cmd.access_flags); ib_uverbs_rereg_mr()
1101 if (cmd.flags & IB_MR_REREG_PD) { ib_uverbs_rereg_mr()
1102 pd = idr_read_pd(cmd.pd_handle, file->ucontext); ib_uverbs_rereg_mr()
1115 ret = mr->device->rereg_user_mr(mr, cmd.flags, cmd.start, ib_uverbs_rereg_mr()
1116 cmd.length, cmd.hca_va, ib_uverbs_rereg_mr()
1117 cmd.access_flags, pd, &udata); ib_uverbs_rereg_mr()
1119 if (cmd.flags & IB_MR_REREG_PD) { ib_uverbs_rereg_mr()
1132 if (copy_to_user((void __user *)(unsigned long)cmd.response, ib_uverbs_rereg_mr()
1139 if (cmd.flags & IB_MR_REREG_PD) ib_uverbs_rereg_mr()
1154 struct ib_uverbs_dereg_mr cmd; ib_uverbs_dereg_mr() local
1159 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_dereg_mr()
1162 uobj = idr_write_uobj(&ib_uverbs_mr_idr, cmd.mr_handle, file->ucontext); ib_uverbs_dereg_mr()
1193 struct ib_uverbs_alloc_mw cmd; ib_uverbs_alloc_mw() local
1203 if (copy_from_user(&cmd, buf, sizeof(cmd))) ib_uverbs_alloc_mw()
1213 pd = idr_read_pd(cmd.pd_handle, file->ucontext); ib_uverbs_alloc_mw()
1219 mw = pd->device->alloc_mw(pd, cmd.mw_type); ib_uverbs_alloc_mw()
1239 if (copy_to_user((void __user *)(unsigned long)cmd.response, ib_uverbs_alloc_mw()
1276 struct ib_uverbs_dealloc_mw cmd; ib_uverbs_dealloc_mw() local
1281 if (copy_from_user(&cmd, buf, sizeof(cmd))) ib_uverbs_dealloc_mw()
1284 uobj = idr_write_uobj(&ib_uverbs_mw_idr, cmd.mw_handle, file->ucontext); ib_uverbs_dealloc_mw()
1315 struct ib_uverbs_create_comp_channel cmd; ib_uverbs_create_comp_channel() local
1323 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_create_comp_channel()
1337 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_create_comp_channel()
1352 struct ib_uverbs_ex_create_cq *cmd, create_cq()
1368 if (cmd->comp_vector >= file->device->num_comp_vectors) create_cq()
1375 init_uobj(&obj->uobject, cmd->user_handle, file->ucontext, &cq_lock_class); create_cq()
1378 if (cmd->comp_channel >= 0) { create_cq()
1379 ev_file = ib_uverbs_lookup_comp_file(cmd->comp_channel); create_cq()
1392 attr.cqe = cmd->cqe; create_cq()
1393 attr.comp_vector = cmd->comp_vector; create_cq()
1395 if (cmd_sz > offsetof(typeof(*cmd), flags) + sizeof(cmd->flags)) create_cq()
1396 attr.flags = cmd->flags; create_cq()
1470 struct ib_uverbs_create_cq cmd; ib_uverbs_create_cq() local
1480 if (copy_from_user(&cmd, buf, sizeof(cmd))) ib_uverbs_create_cq()
1483 INIT_UDATA(&ucore, buf, (unsigned long)cmd.response, sizeof(cmd), sizeof(resp)); ib_uverbs_create_cq()
1485 INIT_UDATA(&uhw, buf + sizeof(cmd), ib_uverbs_create_cq()
1486 (unsigned long)cmd.response + sizeof(resp), ib_uverbs_create_cq()
1487 in_len - sizeof(cmd), out_len - sizeof(resp)); ib_uverbs_create_cq()
1490 cmd_ex.user_handle = cmd.user_handle; ib_uverbs_create_cq()
1491 cmd_ex.cqe = cmd.cqe; ib_uverbs_create_cq()
1492 cmd_ex.comp_vector = cmd.comp_vector; ib_uverbs_create_cq()
1493 cmd_ex.comp_channel = cmd.comp_channel; ib_uverbs_create_cq()
1497 sizeof(cmd.comp_channel), ib_uverbs_create_cq_cb, ib_uverbs_create_cq()
1523 struct ib_uverbs_ex_create_cq cmd; ib_uverbs_ex_create_cq() local
1527 if (ucore->inlen < sizeof(cmd)) ib_uverbs_ex_create_cq()
1530 err = ib_copy_from_udata(&cmd, ucore, sizeof(cmd)); ib_uverbs_ex_create_cq()
1534 if (cmd.comp_mask) ib_uverbs_ex_create_cq()
1537 if (cmd.reserved) ib_uverbs_ex_create_cq()
1544 obj = create_cq(file, ib_dev, ucore, uhw, &cmd, ib_uverbs_ex_create_cq()
1545 min(ucore->inlen, sizeof(cmd)), ib_uverbs_ex_create_cq()
1559 struct ib_uverbs_resize_cq cmd; ib_uverbs_resize_cq() local
1565 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_resize_cq()
1568 INIT_UDATA(&udata, buf + sizeof cmd, ib_uverbs_resize_cq()
1569 (unsigned long) cmd.response + sizeof resp, ib_uverbs_resize_cq()
1570 in_len - sizeof cmd, out_len - sizeof resp); ib_uverbs_resize_cq()
1572 cq = idr_read_cq(cmd.cq_handle, file->ucontext, 0); ib_uverbs_resize_cq()
1576 ret = cq->device->resize_cq(cq, cmd.cqe, &udata); ib_uverbs_resize_cq()
1582 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_resize_cq()
1623 struct ib_uverbs_poll_cq cmd; ib_uverbs_poll_cq() local
1631 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_poll_cq()
1634 cq = idr_read_cq(cmd.cq_handle, file->ucontext, 0); ib_uverbs_poll_cq()
1639 header_ptr = (void __user *)(unsigned long) cmd.response; ib_uverbs_poll_cq()
1643 while (resp.count < cmd.ne) { ib_uverbs_poll_cq()
1675 struct ib_uverbs_req_notify_cq cmd; ib_uverbs_req_notify_cq() local
1678 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_req_notify_cq()
1681 cq = idr_read_cq(cmd.cq_handle, file->ucontext, 0); ib_uverbs_req_notify_cq()
1685 ib_req_notify_cq(cq, cmd.solicited_only ? ib_uverbs_req_notify_cq()
1698 struct ib_uverbs_destroy_cq cmd; ib_uverbs_destroy_cq() local
1706 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_destroy_cq()
1709 uobj = idr_write_uobj(&ib_uverbs_cq_idr, cmd.cq_handle, file->ucontext); ib_uverbs_destroy_cq()
1739 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_destroy_cq()
1749 struct ib_uverbs_ex_create_qp *cmd, create_qp()
1769 if (cmd->qp_type == IB_QPT_RAW_PACKET && !capable(CAP_NET_RAW)) create_qp()
1776 init_uobj(&obj->uevent.uobject, cmd->user_handle, file->ucontext, create_qp()
1780 if (cmd->qp_type == IB_QPT_XRC_TGT) { create_qp()
1781 xrcd = idr_read_xrcd(cmd->pd_handle, file->ucontext, create_qp()
1789 if (cmd->qp_type == IB_QPT_XRC_INI) { create_qp()
1790 cmd->max_recv_wr = 0; create_qp()
1791 cmd->max_recv_sge = 0; create_qp()
1793 if (cmd->is_srq) { create_qp()
1794 srq = idr_read_srq(cmd->srq_handle, create_qp()
1802 if (cmd->recv_cq_handle != cmd->send_cq_handle) { create_qp()
1803 rcq = idr_read_cq(cmd->recv_cq_handle, create_qp()
1812 scq = idr_read_cq(cmd->send_cq_handle, file->ucontext, !!rcq); create_qp()
1814 pd = idr_read_pd(cmd->pd_handle, file->ucontext); create_qp()
1829 attr.sq_sig_type = cmd->sq_sig_all ? IB_SIGNAL_ALL_WR : create_qp()
1831 attr.qp_type = cmd->qp_type; create_qp()
1834 attr.cap.max_send_wr = cmd->max_send_wr; create_qp()
1835 attr.cap.max_recv_wr = cmd->max_recv_wr; create_qp()
1836 attr.cap.max_send_sge = cmd->max_send_sge; create_qp()
1837 attr.cap.max_recv_sge = cmd->max_recv_sge; create_qp()
1838 attr.cap.max_inline_data = cmd->max_inline_data; create_qp()
1844 if (cmd_sz >= offsetof(typeof(*cmd), create_flags) + create_qp()
1845 sizeof(cmd->create_flags)) create_qp()
1846 attr.create_flags = cmd->create_flags; create_qp()
1853 buf = (void *)cmd + sizeof(*cmd); create_qp()
1854 if (cmd_sz > sizeof(*cmd)) create_qp()
1856 cmd_sz - sizeof(*cmd) - 1))) { create_qp()
1861 if (cmd->qp_type == IB_QPT_XRC_TGT) create_qp()
1871 if (cmd->qp_type != IB_QPT_XRC_TGT) { create_qp()
1974 struct ib_uverbs_create_qp cmd; ib_uverbs_create_qp() local
1984 if (copy_from_user(&cmd, buf, sizeof(cmd))) ib_uverbs_create_qp()
1987 INIT_UDATA(&ucore, buf, (unsigned long)cmd.response, sizeof(cmd), ib_uverbs_create_qp()
1989 INIT_UDATA(&uhw, buf + sizeof(cmd), ib_uverbs_create_qp()
1990 (unsigned long)cmd.response + resp_size, ib_uverbs_create_qp()
1991 in_len - sizeof(cmd), out_len - resp_size); ib_uverbs_create_qp()
1994 cmd_ex.user_handle = cmd.user_handle; ib_uverbs_create_qp()
1995 cmd_ex.pd_handle = cmd.pd_handle; ib_uverbs_create_qp()
1996 cmd_ex.send_cq_handle = cmd.send_cq_handle; ib_uverbs_create_qp()
1997 cmd_ex.recv_cq_handle = cmd.recv_cq_handle; ib_uverbs_create_qp()
1998 cmd_ex.srq_handle = cmd.srq_handle; ib_uverbs_create_qp()
1999 cmd_ex.max_send_wr = cmd.max_send_wr; ib_uverbs_create_qp()
2000 cmd_ex.max_recv_wr = cmd.max_recv_wr; ib_uverbs_create_qp()
2001 cmd_ex.max_send_sge = cmd.max_send_sge; ib_uverbs_create_qp()
2002 cmd_ex.max_recv_sge = cmd.max_recv_sge; ib_uverbs_create_qp()
2003 cmd_ex.max_inline_data = cmd.max_inline_data; ib_uverbs_create_qp()
2004 cmd_ex.sq_sig_all = cmd.sq_sig_all; ib_uverbs_create_qp()
2005 cmd_ex.qp_type = cmd.qp_type; ib_uverbs_create_qp()
2006 cmd_ex.is_srq = cmd.is_srq; ib_uverbs_create_qp()
2010 sizeof(cmd.is_srq), ib_uverbs_create_qp_cb, ib_uverbs_create_qp()
2035 struct ib_uverbs_ex_create_qp cmd = {0}; ib_uverbs_ex_create_qp() local
2038 if (ucore->inlen < (offsetof(typeof(cmd), comp_mask) + ib_uverbs_ex_create_qp()
2039 sizeof(cmd.comp_mask))) ib_uverbs_ex_create_qp()
2042 err = ib_copy_from_udata(&cmd, ucore, min(sizeof(cmd), ucore->inlen)); ib_uverbs_ex_create_qp()
2046 if (cmd.comp_mask) ib_uverbs_ex_create_qp()
2049 if (cmd.reserved) ib_uverbs_ex_create_qp()
2056 err = create_qp(file, ucore, uhw, &cmd, ib_uverbs_ex_create_qp()
2057 min(ucore->inlen, sizeof(cmd)), ib_uverbs_ex_create_qp()
2070 struct ib_uverbs_open_qp cmd; ib_uverbs_open_qp() local
2083 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_open_qp()
2086 INIT_UDATA(&udata, buf + sizeof cmd, ib_uverbs_open_qp()
2087 (unsigned long) cmd.response + sizeof resp, ib_uverbs_open_qp()
2088 in_len - sizeof cmd, out_len - sizeof resp); ib_uverbs_open_qp()
2094 init_uobj(&obj->uevent.uobject, cmd.user_handle, file->ucontext, &qp_lock_class); ib_uverbs_open_qp()
2097 xrcd = idr_read_xrcd(cmd.pd_handle, file->ucontext, &xrcd_uobj); ib_uverbs_open_qp()
2105 attr.qp_num = cmd.qpn; ib_uverbs_open_qp()
2106 attr.qp_type = cmd.qp_type; ib_uverbs_open_qp()
2129 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_open_qp()
2166 struct ib_uverbs_query_qp cmd; ib_uverbs_query_qp() local
2173 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_query_qp()
2183 qp = idr_read_qp(cmd.qp_handle, file->ucontext); ib_uverbs_query_qp()
2189 ret = ib_query_qp(qp, attr, cmd.attr_mask, init_attr); ib_uverbs_query_qp()
2251 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_query_qp()
2281 struct ib_uverbs_modify_qp cmd; ib_uverbs_modify_qp() local
2287 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_modify_qp()
2290 INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, ib_uverbs_modify_qp()
2297 qp = idr_read_qp(cmd.qp_handle, file->ucontext); ib_uverbs_modify_qp()
2303 attr->qp_state = cmd.qp_state; ib_uverbs_modify_qp()
2304 attr->cur_qp_state = cmd.cur_qp_state; ib_uverbs_modify_qp()
2305 attr->path_mtu = cmd.path_mtu; ib_uverbs_modify_qp()
2306 attr->path_mig_state = cmd.path_mig_state; ib_uverbs_modify_qp()
2307 attr->qkey = cmd.qkey; ib_uverbs_modify_qp()
2308 attr->rq_psn = cmd.rq_psn; ib_uverbs_modify_qp()
2309 attr->sq_psn = cmd.sq_psn; ib_uverbs_modify_qp()
2310 attr->dest_qp_num = cmd.dest_qp_num; ib_uverbs_modify_qp()
2311 attr->qp_access_flags = cmd.qp_access_flags; ib_uverbs_modify_qp()
2312 attr->pkey_index = cmd.pkey_index; ib_uverbs_modify_qp()
2313 attr->alt_pkey_index = cmd.alt_pkey_index; ib_uverbs_modify_qp()
2314 attr->en_sqd_async_notify = cmd.en_sqd_async_notify; ib_uverbs_modify_qp()
2315 attr->max_rd_atomic = cmd.max_rd_atomic; ib_uverbs_modify_qp()
2316 attr->max_dest_rd_atomic = cmd.max_dest_rd_atomic; ib_uverbs_modify_qp()
2317 attr->min_rnr_timer = cmd.min_rnr_timer; ib_uverbs_modify_qp()
2318 attr->port_num = cmd.port_num; ib_uverbs_modify_qp()
2319 attr->timeout = cmd.timeout; ib_uverbs_modify_qp()
2320 attr->retry_cnt = cmd.retry_cnt; ib_uverbs_modify_qp()
2321 attr->rnr_retry = cmd.rnr_retry; ib_uverbs_modify_qp()
2322 attr->alt_port_num = cmd.alt_port_num; ib_uverbs_modify_qp()
2323 attr->alt_timeout = cmd.alt_timeout; ib_uverbs_modify_qp()
2325 memcpy(attr->ah_attr.grh.dgid.raw, cmd.dest.dgid, 16); ib_uverbs_modify_qp()
2326 attr->ah_attr.grh.flow_label = cmd.dest.flow_label; ib_uverbs_modify_qp()
2327 attr->ah_attr.grh.sgid_index = cmd.dest.sgid_index; ib_uverbs_modify_qp()
2328 attr->ah_attr.grh.hop_limit = cmd.dest.hop_limit; ib_uverbs_modify_qp()
2329 attr->ah_attr.grh.traffic_class = cmd.dest.traffic_class; ib_uverbs_modify_qp()
2330 attr->ah_attr.dlid = cmd.dest.dlid; ib_uverbs_modify_qp()
2331 attr->ah_attr.sl = cmd.dest.sl; ib_uverbs_modify_qp()
2332 attr->ah_attr.src_path_bits = cmd.dest.src_path_bits; ib_uverbs_modify_qp()
2333 attr->ah_attr.static_rate = cmd.dest.static_rate; ib_uverbs_modify_qp()
2334 attr->ah_attr.ah_flags = cmd.dest.is_global ? IB_AH_GRH : 0; ib_uverbs_modify_qp()
2335 attr->ah_attr.port_num = cmd.dest.port_num; ib_uverbs_modify_qp()
2337 memcpy(attr->alt_ah_attr.grh.dgid.raw, cmd.alt_dest.dgid, 16); ib_uverbs_modify_qp()
2338 attr->alt_ah_attr.grh.flow_label = cmd.alt_dest.flow_label; ib_uverbs_modify_qp()
2339 attr->alt_ah_attr.grh.sgid_index = cmd.alt_dest.sgid_index; ib_uverbs_modify_qp()
2340 attr->alt_ah_attr.grh.hop_limit = cmd.alt_dest.hop_limit; ib_uverbs_modify_qp()
2341 attr->alt_ah_attr.grh.traffic_class = cmd.alt_dest.traffic_class; ib_uverbs_modify_qp()
2342 attr->alt_ah_attr.dlid = cmd.alt_dest.dlid; ib_uverbs_modify_qp()
2343 attr->alt_ah_attr.sl = cmd.alt_dest.sl; ib_uverbs_modify_qp()
2344 attr->alt_ah_attr.src_path_bits = cmd.alt_dest.src_path_bits; ib_uverbs_modify_qp()
2345 attr->alt_ah_attr.static_rate = cmd.alt_dest.static_rate; ib_uverbs_modify_qp()
2346 attr->alt_ah_attr.ah_flags = cmd.alt_dest.is_global ? IB_AH_GRH : 0; ib_uverbs_modify_qp()
2347 attr->alt_ah_attr.port_num = cmd.alt_dest.port_num; ib_uverbs_modify_qp()
2350 ret = ib_resolve_eth_dmac(qp, attr, &cmd.attr_mask); ib_uverbs_modify_qp()
2354 modify_qp_mask(qp->qp_type, cmd.attr_mask), &udata); ib_uverbs_modify_qp()
2356 ret = ib_modify_qp(qp, attr, modify_qp_mask(qp->qp_type, cmd.attr_mask)); ib_uverbs_modify_qp()
2378 struct ib_uverbs_destroy_qp cmd; ib_uverbs_destroy_qp() local
2385 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_destroy_qp()
2390 uobj = idr_write_uobj(&ib_uverbs_qp_idr, cmd.qp_handle, file->ucontext); ib_uverbs_destroy_qp()
2425 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_destroy_qp()
2443 struct ib_uverbs_post_send cmd; ib_uverbs_post_send() local
2453 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_post_send()
2456 if (in_len < sizeof cmd + cmd.wqe_size * cmd.wr_count + ib_uverbs_post_send()
2457 cmd.sge_count * sizeof (struct ib_uverbs_sge)) ib_uverbs_post_send()
2460 if (cmd.wqe_size < sizeof (struct ib_uverbs_send_wr)) ib_uverbs_post_send()
2463 user_wr = kmalloc(cmd.wqe_size, GFP_KERNEL); ib_uverbs_post_send()
2467 qp = idr_read_qp(cmd.qp_handle, file->ucontext); ib_uverbs_post_send()
2474 for (i = 0; i < cmd.wr_count; ++i) { ib_uverbs_post_send()
2476 buf + sizeof cmd + i * cmd.wqe_size, ib_uverbs_post_send()
2477 cmd.wqe_size)) { ib_uverbs_post_send()
2482 if (user_wr->num_sge + sg_ind > cmd.sge_count) { ib_uverbs_post_send()
2584 buf + sizeof cmd + ib_uverbs_post_send()
2585 cmd.wr_count * cmd.wqe_size + ib_uverbs_post_send()
2605 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_post_send()
2716 struct ib_uverbs_post_recv cmd; ib_uverbs_post_recv() local
2722 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_post_recv()
2725 wr = ib_uverbs_unmarshall_recv(buf + sizeof cmd, ib_uverbs_post_recv()
2726 in_len - sizeof cmd, cmd.wr_count, ib_uverbs_post_recv()
2727 cmd.sge_count, cmd.wqe_size); ib_uverbs_post_recv()
2731 qp = idr_read_qp(cmd.qp_handle, file->ucontext); ib_uverbs_post_recv()
2747 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_post_recv()
2766 struct ib_uverbs_post_srq_recv cmd; ib_uverbs_post_srq_recv() local
2772 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_post_srq_recv()
2775 wr = ib_uverbs_unmarshall_recv(buf + sizeof cmd, ib_uverbs_post_srq_recv()
2776 in_len - sizeof cmd, cmd.wr_count, ib_uverbs_post_srq_recv()
2777 cmd.sge_count, cmd.wqe_size); ib_uverbs_post_srq_recv()
2781 srq = idr_read_srq(cmd.srq_handle, file->ucontext); ib_uverbs_post_srq_recv()
2797 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_post_srq_recv()
2816 struct ib_uverbs_create_ah cmd; ib_uverbs_create_ah() local
2827 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_create_ah()
2834 init_uobj(uobj, cmd.user_handle, file->ucontext, &ah_lock_class); ib_uverbs_create_ah()
2837 pd = idr_read_pd(cmd.pd_handle, file->ucontext); ib_uverbs_create_ah()
2843 attr.dlid = cmd.attr.dlid; ib_uverbs_create_ah()
2844 attr.sl = cmd.attr.sl; ib_uverbs_create_ah()
2845 attr.src_path_bits = cmd.attr.src_path_bits; ib_uverbs_create_ah()
2846 attr.static_rate = cmd.attr.static_rate; ib_uverbs_create_ah()
2847 attr.ah_flags = cmd.attr.is_global ? IB_AH_GRH : 0; ib_uverbs_create_ah()
2848 attr.port_num = cmd.attr.port_num; ib_uverbs_create_ah()
2849 attr.grh.flow_label = cmd.attr.grh.flow_label; ib_uverbs_create_ah()
2850 attr.grh.sgid_index = cmd.attr.grh.sgid_index; ib_uverbs_create_ah()
2851 attr.grh.hop_limit = cmd.attr.grh.hop_limit; ib_uverbs_create_ah()
2852 attr.grh.traffic_class = cmd.attr.grh.traffic_class; ib_uverbs_create_ah()
2854 memcpy(attr.grh.dgid.raw, cmd.attr.grh.dgid, 16); ib_uverbs_create_ah()
2871 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_create_ah()
2907 struct ib_uverbs_destroy_ah cmd; ib_uverbs_destroy_ah() local
2912 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_destroy_ah()
2915 uobj = idr_write_uobj(&ib_uverbs_ah_idr, cmd.ah_handle, file->ucontext); ib_uverbs_destroy_ah()
2945 struct ib_uverbs_attach_mcast cmd; ib_uverbs_attach_mcast() local
2951 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_attach_mcast()
2954 qp = idr_write_qp(cmd.qp_handle, file->ucontext); ib_uverbs_attach_mcast()
2961 if (cmd.mlid == mcast->lid && ib_uverbs_attach_mcast()
2962 !memcmp(cmd.gid, mcast->gid.raw, sizeof mcast->gid.raw)) { ib_uverbs_attach_mcast()
2973 mcast->lid = cmd.mlid; ib_uverbs_attach_mcast()
2974 memcpy(mcast->gid.raw, cmd.gid, sizeof mcast->gid.raw); ib_uverbs_attach_mcast()
2976 ret = ib_attach_mcast(qp, &mcast->gid, cmd.mlid); ib_uverbs_attach_mcast()
2993 struct ib_uverbs_detach_mcast cmd; ib_uverbs_detach_mcast() local
2999 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_detach_mcast()
3002 qp = idr_write_qp(cmd.qp_handle, file->ucontext); ib_uverbs_detach_mcast()
3006 ret = ib_detach_mcast(qp, (union ib_gid *) cmd.gid, cmd.mlid); ib_uverbs_detach_mcast()
3013 if (cmd.mlid == mcast->lid && ib_uverbs_detach_mcast()
3014 !memcmp(cmd.gid, mcast->gid.raw, sizeof mcast->gid.raw)) { ib_uverbs_detach_mcast()
3074 struct ib_uverbs_create_flow cmd; ib_uverbs_ex_create_flow() local
3086 if (ucore->inlen < sizeof(cmd)) ib_uverbs_ex_create_flow()
3092 err = ib_copy_from_udata(&cmd, ucore, sizeof(cmd)); ib_uverbs_ex_create_flow()
3096 ucore->inbuf += sizeof(cmd); ib_uverbs_ex_create_flow()
3097 ucore->inlen -= sizeof(cmd); ib_uverbs_ex_create_flow()
3099 if (cmd.comp_mask) ib_uverbs_ex_create_flow()
3102 if ((cmd.flow_attr.type == IB_FLOW_ATTR_SNIFFER && ib_uverbs_ex_create_flow()
3106 if (cmd.flow_attr.num_of_specs > IB_FLOW_SPEC_SUPPORT_LAYERS) ib_uverbs_ex_create_flow()
3109 if (cmd.flow_attr.size > ucore->inlen || ib_uverbs_ex_create_flow()
3110 cmd.flow_attr.size > ib_uverbs_ex_create_flow()
3111 (cmd.flow_attr.num_of_specs * sizeof(struct ib_uverbs_flow_spec))) ib_uverbs_ex_create_flow()
3114 if (cmd.flow_attr.reserved[0] || ib_uverbs_ex_create_flow()
3115 cmd.flow_attr.reserved[1]) ib_uverbs_ex_create_flow()
3118 if (cmd.flow_attr.num_of_specs) { ib_uverbs_ex_create_flow()
3119 kern_flow_attr = kmalloc(sizeof(*kern_flow_attr) + cmd.flow_attr.size, ib_uverbs_ex_create_flow()
3124 memcpy(kern_flow_attr, &cmd.flow_attr, sizeof(*kern_flow_attr)); ib_uverbs_ex_create_flow()
3126 cmd.flow_attr.size); ib_uverbs_ex_create_flow()
3130 kern_flow_attr = &cmd.flow_attr; ib_uverbs_ex_create_flow()
3141 qp = idr_read_qp(cmd.qp_handle, file->ucontext); ib_uverbs_ex_create_flow()
3147 flow_attr = kmalloc(sizeof(*flow_attr) + cmd.flow_attr.size, GFP_KERNEL); ib_uverbs_ex_create_flow()
3163 cmd.flow_attr.size > offsetof(struct ib_uverbs_flow_spec, reserved) && ib_uverbs_ex_create_flow()
3164 cmd.flow_attr.size >= ib_uverbs_ex_create_flow()
3171 cmd.flow_attr.size -= ((struct ib_uverbs_flow_spec *)kern_spec)->size; ib_uverbs_ex_create_flow()
3175 if (cmd.flow_attr.size || (i != flow_attr->num_of_specs)) { ib_uverbs_ex_create_flow()
3176 pr_warn("create flow failed, flow %d: %d bytes left from uverb cmd\n", ib_uverbs_ex_create_flow()
3177 i, cmd.flow_attr.size); ib_uverbs_ex_create_flow()
3211 if (cmd.flow_attr.num_of_specs) ib_uverbs_ex_create_flow()
3225 if (cmd.flow_attr.num_of_specs) ib_uverbs_ex_create_flow()
3235 struct ib_uverbs_destroy_flow cmd; ib_uverbs_ex_destroy_flow() local
3240 if (ucore->inlen < sizeof(cmd)) ib_uverbs_ex_destroy_flow()
3243 ret = ib_copy_from_udata(&cmd, ucore, sizeof(cmd)); ib_uverbs_ex_destroy_flow()
3247 if (cmd.comp_mask) ib_uverbs_ex_destroy_flow()
3250 uobj = idr_write_uobj(&ib_uverbs_rule_idr, cmd.flow_handle, ib_uverbs_ex_destroy_flow()
3275 struct ib_uverbs_create_xsrq *cmd, __uverbs_create_xsrq()
3290 init_uobj(&obj->uevent.uobject, cmd->user_handle, file->ucontext, &srq_lock_class); __uverbs_create_xsrq()
3293 if (cmd->srq_type == IB_SRQT_XRC) { __uverbs_create_xsrq()
3294 attr.ext.xrc.xrcd = idr_read_xrcd(cmd->xrcd_handle, file->ucontext, &xrcd_uobj); __uverbs_create_xsrq()
3303 attr.ext.xrc.cq = idr_read_cq(cmd->cq_handle, file->ucontext, 0); __uverbs_create_xsrq()
3310 pd = idr_read_pd(cmd->pd_handle, file->ucontext); __uverbs_create_xsrq()
3318 attr.srq_type = cmd->srq_type; __uverbs_create_xsrq()
3319 attr.attr.max_wr = cmd->max_wr; __uverbs_create_xsrq()
3320 attr.attr.max_sge = cmd->max_sge; __uverbs_create_xsrq()
3321 attr.attr.srq_limit = cmd->srq_limit; __uverbs_create_xsrq()
3334 srq->srq_type = cmd->srq_type; __uverbs_create_xsrq()
3339 if (cmd->srq_type == IB_SRQT_XRC) { __uverbs_create_xsrq()
3358 if (cmd->srq_type == IB_SRQT_XRC) __uverbs_create_xsrq()
3361 if (copy_to_user((void __user *) (unsigned long) cmd->response, __uverbs_create_xsrq()
3367 if (cmd->srq_type == IB_SRQT_XRC) { __uverbs_create_xsrq()
3393 if (cmd->srq_type == IB_SRQT_XRC) __uverbs_create_xsrq()
3397 if (cmd->srq_type == IB_SRQT_XRC) { __uverbs_create_xsrq()
3412 struct ib_uverbs_create_srq cmd; ib_uverbs_create_srq() local
3421 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_create_srq()
3424 xcmd.response = cmd.response; ib_uverbs_create_srq()
3425 xcmd.user_handle = cmd.user_handle; ib_uverbs_create_srq()
3427 xcmd.pd_handle = cmd.pd_handle; ib_uverbs_create_srq()
3428 xcmd.max_wr = cmd.max_wr; ib_uverbs_create_srq()
3429 xcmd.max_sge = cmd.max_sge; ib_uverbs_create_srq()
3430 xcmd.srq_limit = cmd.srq_limit; ib_uverbs_create_srq()
3432 INIT_UDATA(&udata, buf + sizeof cmd, ib_uverbs_create_srq()
3433 (unsigned long) cmd.response + sizeof resp, ib_uverbs_create_srq()
3434 in_len - sizeof cmd, out_len - sizeof resp); ib_uverbs_create_srq()
3447 struct ib_uverbs_create_xsrq cmd; ib_uverbs_create_xsrq() local
3455 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_create_xsrq()
3458 INIT_UDATA(&udata, buf + sizeof cmd, ib_uverbs_create_xsrq()
3459 (unsigned long) cmd.response + sizeof resp, ib_uverbs_create_xsrq()
3460 in_len - sizeof cmd, out_len - sizeof resp); ib_uverbs_create_xsrq()
3462 ret = __uverbs_create_xsrq(file, ib_dev, &cmd, &udata); ib_uverbs_create_xsrq()
3474 struct ib_uverbs_modify_srq cmd; ib_uverbs_modify_srq() local
3480 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_modify_srq()
3483 INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, ib_uverbs_modify_srq()
3486 srq = idr_read_srq(cmd.srq_handle, file->ucontext); ib_uverbs_modify_srq()
3490 attr.max_wr = cmd.max_wr; ib_uverbs_modify_srq()
3491 attr.srq_limit = cmd.srq_limit; ib_uverbs_modify_srq()
3493 ret = srq->device->modify_srq(srq, &attr, cmd.attr_mask, &udata); ib_uverbs_modify_srq()
3505 struct ib_uverbs_query_srq cmd; ib_uverbs_query_srq() local
3514 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_query_srq()
3517 srq = idr_read_srq(cmd.srq_handle, file->ucontext); ib_uverbs_query_srq()
3534 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_query_srq()
3546 struct ib_uverbs_destroy_srq cmd; ib_uverbs_destroy_srq() local
3555 if (copy_from_user(&cmd, buf, sizeof cmd)) ib_uverbs_destroy_srq()
3558 uobj = idr_write_uobj(&ib_uverbs_srq_idr, cmd.srq_handle, file->ucontext); ib_uverbs_destroy_srq()
3592 if (copy_to_user((void __user *) (unsigned long) cmd.response, ib_uverbs_destroy_srq()
3605 struct ib_uverbs_ex_query_device cmd; ib_uverbs_ex_query_device() local
3609 if (ucore->inlen < sizeof(cmd)) ib_uverbs_ex_query_device()
3612 err = ib_copy_from_udata(&cmd, ucore, sizeof(cmd)); ib_uverbs_ex_query_device()
3616 if (cmd.comp_mask) ib_uverbs_ex_query_device()
3619 if (cmd.reserved) ib_uverbs_ex_query_device()
1348 create_cq(struct ib_uverbs_file *file, struct ib_device *ib_dev, struct ib_udata *ucore, struct ib_udata *uhw, struct ib_uverbs_ex_create_cq *cmd, size_t cmd_sz, int (*cb)(struct ib_uverbs_file *file, struct ib_ucq_object *obj, struct ib_uverbs_ex_create_cq_resp *resp, struct ib_udata *udata, void *context), void *context) create_cq() argument
1746 create_qp(struct ib_uverbs_file *file, struct ib_udata *ucore, struct ib_udata *uhw, struct ib_uverbs_ex_create_qp *cmd, size_t cmd_sz, int (*cb)(struct ib_uverbs_file *file, struct ib_uverbs_ex_create_qp_resp *resp, struct ib_udata *udata), void *context) create_qp() argument
3273 __uverbs_create_xsrq(struct ib_uverbs_file *file, struct ib_device *ib_dev, struct ib_uverbs_create_xsrq *cmd, struct ib_udata *udata) __uverbs_create_xsrq() argument
H A Ducm.c390 struct ib_ucm_event_get cmd; ib_ucm_event() local
397 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_event()
428 if (copy_to_user((void __user *)(unsigned long)cmd.response, ib_ucm_event()
435 if (cmd.data_len < uevent->data_len) { ib_ucm_event()
439 if (copy_to_user((void __user *)(unsigned long)cmd.data, ib_ucm_event()
447 if (cmd.info_len < uevent->info_len) { ib_ucm_event()
451 if (copy_to_user((void __user *)(unsigned long)cmd.info, ib_ucm_event()
474 struct ib_ucm_create_id cmd; ib_ucm_create_id() local
482 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_create_id()
491 ctx->uid = cmd.uid; ib_ucm_create_id()
500 if (copy_to_user((void __user *)(unsigned long)cmd.response, ib_ucm_create_id()
521 struct ib_ucm_destroy_id cmd; ib_ucm_destroy_id() local
529 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_destroy_id()
533 ctx = idr_find(&ctx_id_table, cmd.id); ib_ucm_destroy_id()
554 if (copy_to_user((void __user *)(unsigned long)cmd.response, ib_ucm_destroy_id()
567 struct ib_ucm_attr_id cmd; ib_ucm_attr_id() local
574 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_attr_id()
577 ctx = ib_ucm_ctx_get(file, cmd.id); ib_ucm_attr_id()
586 if (copy_to_user((void __user *)(unsigned long)cmd.response, ib_ucm_attr_id()
599 struct ib_ucm_init_qp_attr cmd; ib_ucm_init_qp_attr() local
607 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_init_qp_attr()
610 ctx = ib_ucm_ctx_get(file, cmd.id); ib_ucm_init_qp_attr()
616 qp_attr.qp_state = cmd.qp_state; ib_ucm_init_qp_attr()
623 if (copy_to_user((void __user *)(unsigned long)cmd.response, ib_ucm_init_qp_attr()
647 struct ib_ucm_listen cmd; ib_ucm_listen() local
651 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_listen()
654 ctx = ib_ucm_ctx_get(file, cmd.id); ib_ucm_listen()
658 result = ucm_validate_listen(cmd.service_id, cmd.service_mask); ib_ucm_listen()
662 result = ib_cm_listen(ctx->cm_id, cmd.service_id, cmd.service_mask); ib_ucm_listen()
672 struct ib_ucm_notify cmd; ib_ucm_notify() local
676 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_notify()
679 ctx = ib_ucm_ctx_get(file, cmd.id); ib_ucm_notify()
683 result = ib_cm_notify(ctx->cm_id, (enum ib_event_type) cmd.event); ib_ucm_notify()
737 struct ib_ucm_req cmd; ib_ucm_send_req() local
744 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_send_req()
747 result = ib_ucm_alloc_data(&param.private_data, cmd.data, cmd.len); ib_ucm_send_req()
751 result = ib_ucm_path_get(&param.primary_path, cmd.primary_path); ib_ucm_send_req()
755 result = ib_ucm_path_get(&param.alternate_path, cmd.alternate_path); ib_ucm_send_req()
759 param.private_data_len = cmd.len; ib_ucm_send_req()
760 param.service_id = cmd.sid; ib_ucm_send_req()
761 param.qp_num = cmd.qpn; ib_ucm_send_req()
762 param.qp_type = cmd.qp_type; ib_ucm_send_req()
763 param.starting_psn = cmd.psn; ib_ucm_send_req()
764 param.peer_to_peer = cmd.peer_to_peer; ib_ucm_send_req()
765 param.responder_resources = cmd.responder_resources; ib_ucm_send_req()
766 param.initiator_depth = cmd.initiator_depth; ib_ucm_send_req()
767 param.remote_cm_response_timeout = cmd.remote_cm_response_timeout; ib_ucm_send_req()
768 param.flow_control = cmd.flow_control; ib_ucm_send_req()
769 param.local_cm_response_timeout = cmd.local_cm_response_timeout; ib_ucm_send_req()
770 param.retry_count = cmd.retry_count; ib_ucm_send_req()
771 param.rnr_retry_count = cmd.rnr_retry_count; ib_ucm_send_req()
772 param.max_cm_retries = cmd.max_cm_retries; ib_ucm_send_req()
773 param.srq = cmd.srq; ib_ucm_send_req()
775 ctx = ib_ucm_ctx_get(file, cmd.id); ib_ucm_send_req()
795 struct ib_ucm_rep cmd; ib_ucm_send_rep() local
800 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_send_rep()
803 result = ib_ucm_alloc_data(&param.private_data, cmd.data, cmd.len); ib_ucm_send_rep()
807 param.qp_num = cmd.qpn; ib_ucm_send_rep()
808 param.starting_psn = cmd.psn; ib_ucm_send_rep()
809 param.private_data_len = cmd.len; ib_ucm_send_rep()
810 param.responder_resources = cmd.responder_resources; ib_ucm_send_rep()
811 param.initiator_depth = cmd.initiator_depth; ib_ucm_send_rep()
812 param.failover_accepted = cmd.failover_accepted; ib_ucm_send_rep()
813 param.flow_control = cmd.flow_control; ib_ucm_send_rep()
814 param.rnr_retry_count = cmd.rnr_retry_count; ib_ucm_send_rep()
815 param.srq = cmd.srq; ib_ucm_send_rep()
817 ctx = ib_ucm_ctx_get(file, cmd.id); ib_ucm_send_rep()
819 ctx->uid = cmd.uid; ib_ucm_send_rep()
835 struct ib_ucm_private_data cmd; ib_ucm_send_private_data() local
840 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_send_private_data()
843 result = ib_ucm_alloc_data(&private_data, cmd.data, cmd.len); ib_ucm_send_private_data()
847 ctx = ib_ucm_ctx_get(file, cmd.id); ib_ucm_send_private_data()
849 result = func(ctx->cm_id, private_data, cmd.len); ib_ucm_send_private_data()
889 struct ib_ucm_info cmd; ib_ucm_send_info() local
894 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_send_info()
897 result = ib_ucm_alloc_data(&data, cmd.data, cmd.data_len); ib_ucm_send_info()
901 result = ib_ucm_alloc_data(&info, cmd.info, cmd.info_len); ib_ucm_send_info()
905 ctx = ib_ucm_ctx_get(file, cmd.id); ib_ucm_send_info()
907 result = func(ctx->cm_id, cmd.status, info, cmd.info_len, ib_ucm_send_info()
908 data, cmd.data_len); ib_ucm_send_info()
938 struct ib_ucm_mra cmd; ib_ucm_send_mra() local
942 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_send_mra()
945 result = ib_ucm_alloc_data(&data, cmd.data, cmd.len); ib_ucm_send_mra()
949 ctx = ib_ucm_ctx_get(file, cmd.id); ib_ucm_send_mra()
951 result = ib_send_cm_mra(ctx->cm_id, cmd.timeout, data, cmd.len); ib_ucm_send_mra()
966 struct ib_ucm_lap cmd; ib_ucm_send_lap() local
970 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_send_lap()
973 result = ib_ucm_alloc_data(&data, cmd.data, cmd.len); ib_ucm_send_lap()
977 result = ib_ucm_path_get(&path, cmd.path); ib_ucm_send_lap()
981 ctx = ib_ucm_ctx_get(file, cmd.id); ib_ucm_send_lap()
983 result = ib_send_cm_lap(ctx->cm_id, path, data, cmd.len); ib_ucm_send_lap()
1000 struct ib_ucm_sidr_req cmd; ib_ucm_send_sidr_req() local
1006 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_send_sidr_req()
1009 result = ib_ucm_alloc_data(&param.private_data, cmd.data, cmd.len); ib_ucm_send_sidr_req()
1013 result = ib_ucm_path_get(&param.path, cmd.path); ib_ucm_send_sidr_req()
1017 param.private_data_len = cmd.len; ib_ucm_send_sidr_req()
1018 param.service_id = cmd.sid; ib_ucm_send_sidr_req()
1019 param.timeout_ms = cmd.timeout; ib_ucm_send_sidr_req()
1020 param.max_cm_retries = cmd.max_cm_retries; ib_ucm_send_sidr_req()
1022 ctx = ib_ucm_ctx_get(file, cmd.id); ib_ucm_send_sidr_req()
1040 struct ib_ucm_sidr_rep cmd; ib_ucm_send_sidr_rep() local
1046 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ib_ucm_send_sidr_rep()
1050 cmd.data, cmd.data_len); ib_ucm_send_sidr_rep()
1054 result = ib_ucm_alloc_data(&param.info, cmd.info, cmd.info_len); ib_ucm_send_sidr_rep()
1058 param.qp_num = cmd.qpn; ib_ucm_send_sidr_rep()
1059 param.qkey = cmd.qkey; ib_ucm_send_sidr_rep()
1060 param.status = cmd.status; ib_ucm_send_sidr_rep()
1061 param.info_length = cmd.info_len; ib_ucm_send_sidr_rep()
1062 param.private_data_len = cmd.data_len; ib_ucm_send_sidr_rep()
1064 ctx = ib_ucm_ctx_get(file, cmd.id); ib_ucm_send_sidr_rep()
1116 if (hdr.cmd >= ARRAY_SIZE(ucm_cmd_table)) ib_ucm_write()
1122 result = ucm_cmd_table[hdr.cmd](file, buf + sizeof(hdr), ib_ucm_write()
H A Ducma.c378 struct rdma_ucm_get_event cmd; ucma_get_event() local
385 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_get_event()
416 if (copy_to_user((void __user *)(unsigned long)cmd.response, ucma_get_event()
432 static int ucma_get_qp_type(struct rdma_ucm_create_id *cmd, enum ib_qp_type *qp_type) ucma_get_qp_type() argument
434 switch (cmd->ps) { ucma_get_qp_type()
443 *qp_type = cmd->qp_type; ucma_get_qp_type()
453 struct rdma_ucm_create_id cmd; ucma_create_id() local
462 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_create_id()
465 ret = ucma_get_qp_type(&cmd, &qp_type); ucma_create_id()
475 ctx->uid = cmd.uid; ucma_create_id()
477 ucma_event_handler, ctx, cmd.ps, qp_type); ucma_create_id()
484 if (copy_to_user((void __user *)(unsigned long)cmd.response, ucma_create_id()
571 struct rdma_ucm_destroy_id cmd; ucma_destroy_id() local
579 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_destroy_id()
583 ctx = _ucma_find_context(cmd.id, file); ucma_destroy_id()
609 if (copy_to_user((void __user *)(unsigned long)cmd.response, ucma_destroy_id()
619 struct rdma_ucm_bind_ip cmd; ucma_bind_ip() local
623 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_bind_ip()
626 ctx = ucma_get_ctx(file, cmd.id); ucma_bind_ip()
630 ret = rdma_bind_addr(ctx->cm_id, (struct sockaddr *) &cmd.addr); ucma_bind_ip()
638 struct rdma_ucm_bind cmd; ucma_bind() local
643 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_bind()
646 addr = (struct sockaddr *) &cmd.addr; ucma_bind()
647 if (cmd.reserved || !cmd.addr_size || (cmd.addr_size != rdma_addr_size(addr))) ucma_bind()
650 ctx = ucma_get_ctx(file, cmd.id); ucma_bind()
663 struct rdma_ucm_resolve_ip cmd; ucma_resolve_ip() local
667 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_resolve_ip()
670 ctx = ucma_get_ctx(file, cmd.id); ucma_resolve_ip()
674 ret = rdma_resolve_addr(ctx->cm_id, (struct sockaddr *) &cmd.src_addr, ucma_resolve_ip()
675 (struct sockaddr *) &cmd.dst_addr, ucma_resolve_ip()
676 cmd.timeout_ms); ucma_resolve_ip()
685 struct rdma_ucm_resolve_addr cmd; ucma_resolve_addr() local
690 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_resolve_addr()
693 src = (struct sockaddr *) &cmd.src_addr; ucma_resolve_addr()
694 dst = (struct sockaddr *) &cmd.dst_addr; ucma_resolve_addr()
695 if (cmd.reserved || (cmd.src_size && (cmd.src_size != rdma_addr_size(src))) || ucma_resolve_addr()
696 !cmd.dst_size || (cmd.dst_size != rdma_addr_size(dst))) ucma_resolve_addr()
699 ctx = ucma_get_ctx(file, cmd.id); ucma_resolve_addr()
703 ret = rdma_resolve_addr(ctx->cm_id, src, dst, cmd.timeout_ms); ucma_resolve_addr()
712 struct rdma_ucm_resolve_route cmd; ucma_resolve_route() local
716 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_resolve_route()
719 ctx = ucma_get_ctx(file, cmd.id); ucma_resolve_route()
723 ret = rdma_resolve_route(ctx->cm_id, cmd.timeout_ms); ucma_resolve_route()
796 struct rdma_ucm_query cmd; ucma_query_route() local
805 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_query_route()
808 ctx = ucma_get_ctx(file, cmd.id); ucma_query_route()
835 if (copy_to_user((void __user *)(unsigned long)cmd.response, ucma_query_route()
965 struct rdma_ucm_query cmd; ucma_query() local
970 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_query()
973 response = (void __user *)(unsigned long) cmd.response; ucma_query()
974 ctx = ucma_get_ctx(file, cmd.id); ucma_query()
978 switch (cmd.option) { ucma_query()
1016 struct rdma_ucm_connect cmd; ucma_connect() local
1021 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_connect()
1024 if (!cmd.conn_param.valid) ucma_connect()
1027 ctx = ucma_get_ctx(file, cmd.id); ucma_connect()
1031 ucma_copy_conn_param(ctx->cm_id, &conn_param, &cmd.conn_param); ucma_connect()
1040 struct rdma_ucm_listen cmd; ucma_listen() local
1044 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_listen()
1047 ctx = ucma_get_ctx(file, cmd.id); ucma_listen()
1051 ctx->backlog = cmd.backlog > 0 && cmd.backlog < max_backlog ? ucma_listen()
1052 cmd.backlog : max_backlog; ucma_listen()
1061 struct rdma_ucm_accept cmd; ucma_accept() local
1066 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_accept()
1069 ctx = ucma_get_ctx(file, cmd.id); ucma_accept()
1073 if (cmd.conn_param.valid) { ucma_accept()
1074 ucma_copy_conn_param(ctx->cm_id, &conn_param, &cmd.conn_param); ucma_accept()
1078 ctx->uid = cmd.uid; ucma_accept()
1090 struct rdma_ucm_reject cmd; ucma_reject() local
1094 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_reject()
1097 ctx = ucma_get_ctx(file, cmd.id); ucma_reject()
1101 ret = rdma_reject(ctx->cm_id, cmd.private_data, cmd.private_data_len); ucma_reject()
1109 struct rdma_ucm_disconnect cmd; ucma_disconnect() local
1113 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_disconnect()
1116 ctx = ucma_get_ctx(file, cmd.id); ucma_disconnect()
1129 struct rdma_ucm_init_qp_attr cmd; ucma_init_qp_attr() local
1138 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_init_qp_attr()
1141 ctx = ucma_get_ctx(file, cmd.id); ucma_init_qp_attr()
1147 qp_attr.qp_state = cmd.qp_state; ucma_init_qp_attr()
1153 if (copy_to_user((void __user *)(unsigned long)cmd.response, ucma_init_qp_attr()
1265 struct rdma_ucm_set_option cmd; ucma_set_option() local
1270 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_set_option()
1273 ctx = ucma_get_ctx(file, cmd.id); ucma_set_option()
1277 optval = memdup_user((void __user *) (unsigned long) cmd.optval, ucma_set_option()
1278 cmd.optlen); ucma_set_option()
1284 ret = ucma_set_option_level(ctx, cmd.level, cmd.optname, optval, ucma_set_option()
1285 cmd.optlen); ucma_set_option()
1296 struct rdma_ucm_notify cmd; ucma_notify() local
1300 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_notify()
1303 ctx = ucma_get_ctx(file, cmd.id); ucma_notify()
1307 ret = rdma_notify(ctx->cm_id, (enum ib_event_type) cmd.event); ucma_notify()
1313 struct rdma_ucm_join_mcast *cmd, int out_len) ucma_process_join()
1324 addr = (struct sockaddr *) &cmd->addr; ucma_process_join()
1325 if (cmd->reserved || !cmd->addr_size || (cmd->addr_size != rdma_addr_size(addr))) ucma_process_join()
1328 ctx = ucma_get_ctx(file, cmd->id); ucma_process_join()
1339 mc->uid = cmd->uid; ucma_process_join()
1340 memcpy(&mc->addr, addr, cmd->addr_size); ucma_process_join()
1346 if (copy_to_user((void __user *)(unsigned long) cmd->response, ucma_process_join()
1375 struct rdma_ucm_join_ip_mcast cmd; ucma_join_ip_multicast() local
1378 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_join_ip_multicast()
1381 join_cmd.response = cmd.response; ucma_join_ip_multicast()
1382 join_cmd.uid = cmd.uid; ucma_join_ip_multicast()
1383 join_cmd.id = cmd.id; ucma_join_ip_multicast()
1384 join_cmd.addr_size = rdma_addr_size((struct sockaddr *) &cmd.addr); ucma_join_ip_multicast()
1386 memcpy(&join_cmd.addr, &cmd.addr, join_cmd.addr_size); ucma_join_ip_multicast()
1395 struct rdma_ucm_join_mcast cmd; ucma_join_multicast() local
1397 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_join_multicast()
1400 return ucma_process_join(file, &cmd, out_len); ucma_join_multicast()
1407 struct rdma_ucm_destroy_id cmd; ucma_leave_multicast() local
1415 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_leave_multicast()
1419 mc = idr_find(&multicast_idr, cmd.id); ucma_leave_multicast()
1445 if (copy_to_user((void __user *)(unsigned long)cmd.response, ucma_leave_multicast()
1488 struct rdma_ucm_migrate_id cmd; ucma_migrate_id() local
1495 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) ucma_migrate_id()
1499 f = fdget(cmd.fd); ucma_migrate_id()
1504 ctx = ucma_get_ctx(f.file->private_data, cmd.id); ucma_migrate_id()
1532 if (copy_to_user((void __user *)(unsigned long)cmd.response, ucma_migrate_id()
1586 if (hdr.cmd >= ARRAY_SIZE(ucma_cmd_table)) ucma_write()
1592 if (!ucma_cmd_table[hdr.cmd]) ucma_write()
1595 ret = ucma_cmd_table[hdr.cmd](file, buf + sizeof(hdr), hdr.in, hdr.out); ucma_write()
1312 ucma_process_join(struct ucma_file *file, struct rdma_ucm_join_mcast *cmd, int out_len) ucma_process_join() argument
/linux-4.4.14/drivers/net/wireless/ath/ath10k/
H A Dbmi.c32 struct bmi_cmd cmd; ath10k_bmi_done() local
33 u32 cmdlen = sizeof(cmd.id) + sizeof(cmd.done); ath10k_bmi_done()
44 cmd.id = __cpu_to_le32(BMI_DONE); ath10k_bmi_done()
46 ret = ath10k_hif_exchange_bmi_msg(ar, &cmd, cmdlen, NULL, NULL); ath10k_bmi_done()
58 struct bmi_cmd cmd; ath10k_bmi_get_target_info() local
60 u32 cmdlen = sizeof(cmd.id) + sizeof(cmd.get_target_info); ath10k_bmi_get_target_info()
71 cmd.id = __cpu_to_le32(BMI_GET_TARGET_INFO); ath10k_bmi_get_target_info()
73 ret = ath10k_hif_exchange_bmi_msg(ar, &cmd, cmdlen, &resp, &resplen); ath10k_bmi_get_target_info()
94 struct bmi_cmd cmd; ath10k_bmi_read_memory() local
96 u32 cmdlen = sizeof(cmd.id) + sizeof(cmd.read_mem); ath10k_bmi_read_memory()
111 cmd.id = __cpu_to_le32(BMI_READ_MEMORY); ath10k_bmi_read_memory()
112 cmd.read_mem.addr = __cpu_to_le32(address); ath10k_bmi_read_memory()
113 cmd.read_mem.len = __cpu_to_le32(rxlen); ath10k_bmi_read_memory()
115 ret = ath10k_hif_exchange_bmi_msg(ar, &cmd, cmdlen, ath10k_bmi_read_memory()
135 struct bmi_cmd cmd; ath10k_bmi_write_memory() local
136 u32 hdrlen = sizeof(cmd.id) + sizeof(cmd.write_mem); ath10k_bmi_write_memory()
152 memcpy(cmd.write_mem.payload, buffer, txlen); ath10k_bmi_write_memory()
155 cmd.id = __cpu_to_le32(BMI_WRITE_MEMORY); ath10k_bmi_write_memory()
156 cmd.write_mem.addr = __cpu_to_le32(address); ath10k_bmi_write_memory()
157 cmd.write_mem.len = __cpu_to_le32(txlen); ath10k_bmi_write_memory()
159 ret = ath10k_hif_exchange_bmi_msg(ar, &cmd, hdrlen + txlen, ath10k_bmi_write_memory()
180 struct bmi_cmd cmd; ath10k_bmi_execute() local
182 u32 cmdlen = sizeof(cmd.id) + sizeof(cmd.execute); ath10k_bmi_execute()
194 cmd.id = __cpu_to_le32(BMI_EXECUTE); ath10k_bmi_execute()
195 cmd.execute.addr = __cpu_to_le32(address); ath10k_bmi_execute()
196 cmd.execute.param = __cpu_to_le32(param); ath10k_bmi_execute()
198 ret = ath10k_hif_exchange_bmi_msg(ar, &cmd, cmdlen, &resp, &resplen); ath10k_bmi_execute()
219 struct bmi_cmd cmd; ath10k_bmi_lz_data() local
220 u32 hdrlen = sizeof(cmd.id) + sizeof(cmd.lz_data); ath10k_bmi_lz_data()
237 cmd.id = __cpu_to_le32(BMI_LZ_DATA); ath10k_bmi_lz_data()
238 cmd.lz_data.len = __cpu_to_le32(txlen); ath10k_bmi_lz_data()
239 memcpy(cmd.lz_data.payload, buffer, txlen); ath10k_bmi_lz_data()
241 ret = ath10k_hif_exchange_bmi_msg(ar, &cmd, hdrlen + txlen, ath10k_bmi_lz_data()
257 struct bmi_cmd cmd; ath10k_bmi_lz_stream_start() local
258 u32 cmdlen = sizeof(cmd.id) + sizeof(cmd.lz_start); ath10k_bmi_lz_stream_start()
269 cmd.id = __cpu_to_le32(BMI_LZ_STREAM_START); ath10k_bmi_lz_stream_start()
270 cmd.lz_start.addr = __cpu_to_le32(address); ath10k_bmi_lz_stream_start()
272 ret = ath10k_hif_exchange_bmi_msg(ar, &cmd, cmdlen, NULL, NULL); ath10k_bmi_lz_stream_start()
H A Dwmi-tlv.c1229 struct wmi_tlv_pdev_suspend *cmd; ath10k_wmi_tlv_op_gen_pdev_suspend() local
1233 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_pdev_suspend()
1239 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_pdev_suspend()
1240 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_pdev_suspend()
1241 cmd->opt = __cpu_to_le32(opt); ath10k_wmi_tlv_op_gen_pdev_suspend()
1250 struct wmi_tlv_resume_cmd *cmd; ath10k_wmi_tlv_op_gen_pdev_resume() local
1254 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_pdev_resume()
1260 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_pdev_resume()
1261 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_pdev_resume()
1262 cmd->reserved = __cpu_to_le32(0); ath10k_wmi_tlv_op_gen_pdev_resume()
1274 struct wmi_tlv_pdev_set_rd_cmd *cmd; ath10k_wmi_tlv_op_gen_pdev_set_rd() local
1278 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_pdev_set_rd()
1284 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_pdev_set_rd()
1285 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_pdev_set_rd()
1286 cmd->regd = __cpu_to_le32(rd); ath10k_wmi_tlv_op_gen_pdev_set_rd()
1287 cmd->regd_2ghz = __cpu_to_le32(rd2g); ath10k_wmi_tlv_op_gen_pdev_set_rd()
1288 cmd->regd_5ghz = __cpu_to_le32(rd5g); ath10k_wmi_tlv_op_gen_pdev_set_rd()
1289 cmd->conform_limit_2ghz = __cpu_to_le32(rd2g); ath10k_wmi_tlv_op_gen_pdev_set_rd()
1290 cmd->conform_limit_5ghz = __cpu_to_le32(rd5g); ath10k_wmi_tlv_op_gen_pdev_set_rd()
1305 struct wmi_tlv_pdev_set_param_cmd *cmd; ath10k_wmi_tlv_op_gen_pdev_set_param() local
1309 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_pdev_set_param()
1315 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_pdev_set_param()
1316 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_pdev_set_param()
1317 cmd->param_id = __cpu_to_le32(param_id); ath10k_wmi_tlv_op_gen_pdev_set_param()
1318 cmd->param_value = __cpu_to_le32(param_value); ath10k_wmi_tlv_op_gen_pdev_set_param()
1328 struct wmi_tlv_init_cmd *cmd; ath10k_wmi_tlv_op_gen_init() local
1335 len = (sizeof(*tlv) + sizeof(*cmd)) + ath10k_wmi_tlv_op_gen_init()
1347 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_init()
1348 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_init()
1350 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_init()
1367 cmd->abi.abi_ver0 = __cpu_to_le32(WMI_TLV_ABI_VER0); ath10k_wmi_tlv_op_gen_init()
1368 cmd->abi.abi_ver1 = __cpu_to_le32(WMI_TLV_ABI_VER1); ath10k_wmi_tlv_op_gen_init()
1369 cmd->abi.abi_ver_ns0 = __cpu_to_le32(WMI_TLV_ABI_VER_NS0); ath10k_wmi_tlv_op_gen_init()
1370 cmd->abi.abi_ver_ns1 = __cpu_to_le32(WMI_TLV_ABI_VER_NS1); ath10k_wmi_tlv_op_gen_init()
1371 cmd->abi.abi_ver_ns2 = __cpu_to_le32(WMI_TLV_ABI_VER_NS2); ath10k_wmi_tlv_op_gen_init()
1372 cmd->abi.abi_ver_ns3 = __cpu_to_le32(WMI_TLV_ABI_VER_NS3); ath10k_wmi_tlv_op_gen_init()
1373 cmd->num_host_mem_chunks = __cpu_to_le32(ar->wmi.num_mem_chunks); ath10k_wmi_tlv_op_gen_init()
1432 struct wmi_tlv_start_scan_cmd *cmd; ath10k_wmi_tlv_op_gen_start_scan() local
1450 len = (sizeof(*tlv) + sizeof(*cmd)) + ath10k_wmi_tlv_op_gen_start_scan()
1463 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_start_scan()
1464 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_start_scan()
1466 ath10k_wmi_put_start_scan_common(&cmd->common, arg); ath10k_wmi_tlv_op_gen_start_scan()
1467 cmd->burst_duration_ms = __cpu_to_le32(arg->burst_duration_ms); ath10k_wmi_tlv_op_gen_start_scan()
1468 cmd->num_channels = __cpu_to_le32(arg->n_channels); ath10k_wmi_tlv_op_gen_start_scan()
1469 cmd->num_ssids = __cpu_to_le32(arg->n_ssids); ath10k_wmi_tlv_op_gen_start_scan()
1470 cmd->num_bssids = __cpu_to_le32(arg->n_bssids); ath10k_wmi_tlv_op_gen_start_scan()
1471 cmd->ie_len = __cpu_to_le32(arg->ie_len); ath10k_wmi_tlv_op_gen_start_scan()
1472 cmd->num_probes = __cpu_to_le32(3); ath10k_wmi_tlv_op_gen_start_scan()
1477 cmd->common.scan_ctrl_flags ^= __cpu_to_le32(WMI_SCAN_FILTER_PROBE_REQ); ath10k_wmi_tlv_op_gen_start_scan()
1480 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_start_scan()
1530 struct wmi_stop_scan_cmd *cmd; ath10k_wmi_tlv_op_gen_stop_scan() local
1541 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_stop_scan()
1553 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_stop_scan()
1554 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_stop_scan()
1555 cmd->req_type = __cpu_to_le32(arg->req_type); ath10k_wmi_tlv_op_gen_stop_scan()
1556 cmd->vdev_id = __cpu_to_le32(arg->u.vdev_id); ath10k_wmi_tlv_op_gen_stop_scan()
1557 cmd->scan_id = __cpu_to_le32(scan_id); ath10k_wmi_tlv_op_gen_stop_scan()
1558 cmd->scan_req_id = __cpu_to_le32(req_id); ath10k_wmi_tlv_op_gen_stop_scan()
1571 struct wmi_vdev_create_cmd *cmd; ath10k_wmi_tlv_op_gen_vdev_create() local
1575 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_create()
1581 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_create()
1582 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_vdev_create()
1583 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_vdev_create()
1584 cmd->vdev_type = __cpu_to_le32(vdev_type); ath10k_wmi_tlv_op_gen_vdev_create()
1585 cmd->vdev_subtype = __cpu_to_le32(vdev_subtype); ath10k_wmi_tlv_op_gen_vdev_create()
1586 ether_addr_copy(cmd->vdev_macaddr.addr, mac_addr); ath10k_wmi_tlv_op_gen_vdev_create()
1595 struct wmi_vdev_delete_cmd *cmd; ath10k_wmi_tlv_op_gen_vdev_delete() local
1599 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_delete()
1605 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_delete()
1606 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_vdev_delete()
1607 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_vdev_delete()
1618 struct wmi_tlv_vdev_start_cmd *cmd; ath10k_wmi_tlv_op_gen_vdev_start() local
1629 if (WARN_ON(arg->ssid_len > sizeof(cmd->ssid.ssid))) ath10k_wmi_tlv_op_gen_vdev_start()
1632 len = (sizeof(*tlv) + sizeof(*cmd)) + ath10k_wmi_tlv_op_gen_vdev_start()
1648 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_start()
1649 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_vdev_start()
1650 cmd->vdev_id = __cpu_to_le32(arg->vdev_id); ath10k_wmi_tlv_op_gen_vdev_start()
1651 cmd->bcn_intval = __cpu_to_le32(arg->bcn_intval); ath10k_wmi_tlv_op_gen_vdev_start()
1652 cmd->dtim_period = __cpu_to_le32(arg->dtim_period); ath10k_wmi_tlv_op_gen_vdev_start()
1653 cmd->flags = __cpu_to_le32(flags); ath10k_wmi_tlv_op_gen_vdev_start()
1654 cmd->bcn_tx_rate = __cpu_to_le32(arg->bcn_tx_rate); ath10k_wmi_tlv_op_gen_vdev_start()
1655 cmd->bcn_tx_power = __cpu_to_le32(arg->bcn_tx_power); ath10k_wmi_tlv_op_gen_vdev_start()
1656 cmd->disable_hw_ack = __cpu_to_le32(arg->disable_hw_ack); ath10k_wmi_tlv_op_gen_vdev_start()
1659 cmd->ssid.ssid_len = __cpu_to_le32(arg->ssid_len); ath10k_wmi_tlv_op_gen_vdev_start()
1660 memcpy(cmd->ssid.ssid, arg->ssid, arg->ssid_len); ath10k_wmi_tlv_op_gen_vdev_start()
1664 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_vdev_start()
1694 struct wmi_vdev_stop_cmd *cmd; ath10k_wmi_tlv_op_gen_vdev_stop() local
1698 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_stop()
1704 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_stop()
1705 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_vdev_stop()
1706 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_vdev_stop()
1717 struct wmi_vdev_up_cmd *cmd; ath10k_wmi_tlv_op_gen_vdev_up() local
1721 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_up()
1727 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_up()
1728 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_vdev_up()
1729 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_vdev_up()
1730 cmd->vdev_assoc_id = __cpu_to_le32(aid); ath10k_wmi_tlv_op_gen_vdev_up()
1731 ether_addr_copy(cmd->vdev_bssid.addr, bssid); ath10k_wmi_tlv_op_gen_vdev_up()
1740 struct wmi_vdev_down_cmd *cmd; ath10k_wmi_tlv_op_gen_vdev_down() local
1744 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_down()
1750 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_down()
1751 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_vdev_down()
1752 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_vdev_down()
1762 struct wmi_vdev_set_param_cmd *cmd; ath10k_wmi_tlv_op_gen_vdev_set_param() local
1766 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_set_param()
1772 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_set_param()
1773 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_vdev_set_param()
1774 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_vdev_set_param()
1775 cmd->param_id = __cpu_to_le32(param_id); ath10k_wmi_tlv_op_gen_vdev_set_param()
1776 cmd->param_value = __cpu_to_le32(param_value); ath10k_wmi_tlv_op_gen_vdev_set_param()
1786 struct wmi_vdev_install_key_cmd *cmd; ath10k_wmi_tlv_op_gen_vdev_install_key() local
1797 len = sizeof(*tlv) + sizeof(*cmd) + ath10k_wmi_tlv_op_gen_vdev_install_key()
1806 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_install_key()
1807 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_vdev_install_key()
1808 cmd->vdev_id = __cpu_to_le32(arg->vdev_id); ath10k_wmi_tlv_op_gen_vdev_install_key()
1809 cmd->key_idx = __cpu_to_le32(arg->key_idx); ath10k_wmi_tlv_op_gen_vdev_install_key()
1810 cmd->key_flags = __cpu_to_le32(arg->key_flags); ath10k_wmi_tlv_op_gen_vdev_install_key()
1811 cmd->key_cipher = __cpu_to_le32(arg->key_cipher); ath10k_wmi_tlv_op_gen_vdev_install_key()
1812 cmd->key_len = __cpu_to_le32(arg->key_len); ath10k_wmi_tlv_op_gen_vdev_install_key()
1813 cmd->key_txmic_len = __cpu_to_le32(arg->key_txmic_len); ath10k_wmi_tlv_op_gen_vdev_install_key()
1814 cmd->key_rxmic_len = __cpu_to_le32(arg->key_rxmic_len); ath10k_wmi_tlv_op_gen_vdev_install_key()
1817 ether_addr_copy(cmd->peer_macaddr.addr, arg->macaddr); ath10k_wmi_tlv_op_gen_vdev_install_key()
1820 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_vdev_install_key()
1866 struct wmi_sta_uapsd_auto_trig_cmd_fixed_param *cmd; ath10k_wmi_tlv_op_gen_vdev_sta_uapsd() local
1876 len = sizeof(*tlv) + sizeof(*cmd) + ath10k_wmi_tlv_op_gen_vdev_sta_uapsd()
1885 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_sta_uapsd()
1886 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_vdev_sta_uapsd()
1887 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_vdev_sta_uapsd()
1888 cmd->num_ac = __cpu_to_le32(num_ac); ath10k_wmi_tlv_op_gen_vdev_sta_uapsd()
1889 ether_addr_copy(cmd->peer_macaddr.addr, peer_addr); ath10k_wmi_tlv_op_gen_vdev_sta_uapsd()
1892 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_vdev_sta_uapsd()
1926 struct wmi_tlv_vdev_set_wmm_cmd *cmd; ath10k_wmi_tlv_op_gen_vdev_wmm_conf() local
1932 len = sizeof(*tlv) + sizeof(*cmd); ath10k_wmi_tlv_op_gen_vdev_wmm_conf()
1940 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_vdev_wmm_conf()
1941 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_vdev_wmm_conf()
1942 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_vdev_wmm_conf()
1944 ath10k_wmi_set_wmm_param(&cmd->vdev_wmm_params[0].params, &arg->ac_be); ath10k_wmi_tlv_op_gen_vdev_wmm_conf()
1945 ath10k_wmi_set_wmm_param(&cmd->vdev_wmm_params[1].params, &arg->ac_bk); ath10k_wmi_tlv_op_gen_vdev_wmm_conf()
1946 ath10k_wmi_set_wmm_param(&cmd->vdev_wmm_params[2].params, &arg->ac_vi); ath10k_wmi_tlv_op_gen_vdev_wmm_conf()
1947 ath10k_wmi_set_wmm_param(&cmd->vdev_wmm_params[3].params, &arg->ac_vo); ath10k_wmi_tlv_op_gen_vdev_wmm_conf()
1957 struct wmi_tlv_sta_keepalive_cmd *cmd; ath10k_wmi_tlv_op_gen_sta_keepalive() local
1964 len = sizeof(*tlv) + sizeof(*cmd) + ath10k_wmi_tlv_op_gen_sta_keepalive()
1973 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_sta_keepalive()
1974 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_sta_keepalive()
1975 cmd->vdev_id = __cpu_to_le32(arg->vdev_id); ath10k_wmi_tlv_op_gen_sta_keepalive()
1976 cmd->enabled = __cpu_to_le32(arg->enabled); ath10k_wmi_tlv_op_gen_sta_keepalive()
1977 cmd->method = __cpu_to_le32(arg->method); ath10k_wmi_tlv_op_gen_sta_keepalive()
1978 cmd->interval = __cpu_to_le32(arg->interval); ath10k_wmi_tlv_op_gen_sta_keepalive()
1981 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_sta_keepalive()
2002 struct wmi_tlv_peer_create_cmd *cmd; ath10k_wmi_tlv_op_gen_peer_create() local
2006 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_peer_create()
2012 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_peer_create()
2013 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_peer_create()
2014 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_peer_create()
2015 cmd->peer_type = __cpu_to_le32(peer_type); ath10k_wmi_tlv_op_gen_peer_create()
2016 ether_addr_copy(cmd->peer_addr.addr, peer_addr); ath10k_wmi_tlv_op_gen_peer_create()
2026 struct wmi_peer_delete_cmd *cmd; ath10k_wmi_tlv_op_gen_peer_delete() local
2030 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_peer_delete()
2036 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_peer_delete()
2037 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_peer_delete()
2038 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_peer_delete()
2039 ether_addr_copy(cmd->peer_macaddr.addr, peer_addr); ath10k_wmi_tlv_op_gen_peer_delete()
2049 struct wmi_peer_flush_tids_cmd *cmd; ath10k_wmi_tlv_op_gen_peer_flush() local
2053 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_peer_flush()
2059 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_peer_flush()
2060 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_peer_flush()
2061 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_peer_flush()
2062 cmd->peer_tid_bitmap = __cpu_to_le32(tid_bitmap); ath10k_wmi_tlv_op_gen_peer_flush()
2063 ether_addr_copy(cmd->peer_macaddr.addr, peer_addr); ath10k_wmi_tlv_op_gen_peer_flush()
2075 struct wmi_peer_set_param_cmd *cmd; ath10k_wmi_tlv_op_gen_peer_set_param() local
2079 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_peer_set_param()
2085 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_peer_set_param()
2086 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_peer_set_param()
2087 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_peer_set_param()
2088 cmd->param_id = __cpu_to_le32(param_id); ath10k_wmi_tlv_op_gen_peer_set_param()
2089 cmd->param_value = __cpu_to_le32(param_value); ath10k_wmi_tlv_op_gen_peer_set_param()
2090 ether_addr_copy(cmd->peer_macaddr.addr, peer_addr); ath10k_wmi_tlv_op_gen_peer_set_param()
2100 struct wmi_tlv_peer_assoc_cmd *cmd; ath10k_wmi_tlv_op_gen_peer_assoc() local
2117 len = (sizeof(*tlv) + sizeof(*cmd)) + ath10k_wmi_tlv_op_gen_peer_assoc()
2128 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_peer_assoc()
2129 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_peer_assoc()
2131 cmd->vdev_id = __cpu_to_le32(arg->vdev_id); ath10k_wmi_tlv_op_gen_peer_assoc()
2132 cmd->new_assoc = __cpu_to_le32(arg->peer_reassoc ? 0 : 1); ath10k_wmi_tlv_op_gen_peer_assoc()
2133 cmd->assoc_id = __cpu_to_le32(arg->peer_aid); ath10k_wmi_tlv_op_gen_peer_assoc()
2134 cmd->flags = __cpu_to_le32(arg->peer_flags); ath10k_wmi_tlv_op_gen_peer_assoc()
2135 cmd->caps = __cpu_to_le32(arg->peer_caps); ath10k_wmi_tlv_op_gen_peer_assoc()
2136 cmd->listen_intval = __cpu_to_le32(arg->peer_listen_intval); ath10k_wmi_tlv_op_gen_peer_assoc()
2137 cmd->ht_caps = __cpu_to_le32(arg->peer_ht_caps); ath10k_wmi_tlv_op_gen_peer_assoc()
2138 cmd->max_mpdu = __cpu_to_le32(arg->peer_max_mpdu); ath10k_wmi_tlv_op_gen_peer_assoc()
2139 cmd->mpdu_density = __cpu_to_le32(arg->peer_mpdu_density); ath10k_wmi_tlv_op_gen_peer_assoc()
2140 cmd->rate_caps = __cpu_to_le32(arg->peer_rate_caps); ath10k_wmi_tlv_op_gen_peer_assoc()
2141 cmd->nss = __cpu_to_le32(arg->peer_num_spatial_streams); ath10k_wmi_tlv_op_gen_peer_assoc()
2142 cmd->vht_caps = __cpu_to_le32(arg->peer_vht_caps); ath10k_wmi_tlv_op_gen_peer_assoc()
2143 cmd->phy_mode = __cpu_to_le32(arg->peer_phymode); ath10k_wmi_tlv_op_gen_peer_assoc()
2144 cmd->num_legacy_rates = __cpu_to_le32(arg->peer_legacy_rates.num_rates); ath10k_wmi_tlv_op_gen_peer_assoc()
2145 cmd->num_ht_rates = __cpu_to_le32(arg->peer_ht_rates.num_rates); ath10k_wmi_tlv_op_gen_peer_assoc()
2146 ether_addr_copy(cmd->mac_addr.addr, arg->addr); ath10k_wmi_tlv_op_gen_peer_assoc()
2149 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_peer_assoc()
2190 struct wmi_sta_powersave_mode_cmd *cmd; ath10k_wmi_tlv_op_gen_set_psmode() local
2194 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_set_psmode()
2200 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_set_psmode()
2201 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_set_psmode()
2202 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_set_psmode()
2203 cmd->sta_ps_mode = __cpu_to_le32(psmode); ath10k_wmi_tlv_op_gen_set_psmode()
2214 struct wmi_sta_powersave_param_cmd *cmd; ath10k_wmi_tlv_op_gen_set_sta_ps() local
2218 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_set_sta_ps()
2224 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_set_sta_ps()
2225 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_set_sta_ps()
2226 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_set_sta_ps()
2227 cmd->param_id = __cpu_to_le32(param_id); ath10k_wmi_tlv_op_gen_set_sta_ps()
2228 cmd->param_value = __cpu_to_le32(param_value); ath10k_wmi_tlv_op_gen_set_sta_ps()
2238 struct wmi_ap_ps_peer_cmd *cmd; ath10k_wmi_tlv_op_gen_set_ap_ps() local
2245 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_set_ap_ps()
2251 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_set_ap_ps()
2252 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_set_ap_ps()
2253 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_set_ap_ps()
2254 cmd->param_id = __cpu_to_le32(param_id); ath10k_wmi_tlv_op_gen_set_ap_ps()
2255 cmd->param_value = __cpu_to_le32(value); ath10k_wmi_tlv_op_gen_set_ap_ps()
2256 ether_addr_copy(cmd->peer_macaddr.addr, mac); ath10k_wmi_tlv_op_gen_set_ap_ps()
2266 struct wmi_tlv_scan_chan_list_cmd *cmd; ath10k_wmi_tlv_op_gen_scan_chan_list() local
2276 len = (sizeof(*tlv) + sizeof(*cmd)) + ath10k_wmi_tlv_op_gen_scan_chan_list()
2286 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_scan_chan_list()
2287 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_scan_chan_list()
2288 cmd->num_scan_chans = __cpu_to_le32(arg->n_channels); ath10k_wmi_tlv_op_gen_scan_chan_list()
2291 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_scan_chan_list()
2326 struct wmi_bcn_tx_ref_cmd *cmd; ath10k_wmi_tlv_op_gen_beacon_dma() local
2332 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_beacon_dma()
2341 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_beacon_dma()
2342 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_beacon_dma()
2343 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_beacon_dma()
2344 cmd->data_len = __cpu_to_le32(bcn_len); ath10k_wmi_tlv_op_gen_beacon_dma()
2345 cmd->data_ptr = __cpu_to_le32(bcn_paddr); ath10k_wmi_tlv_op_gen_beacon_dma()
2346 cmd->msdu_id = 0; ath10k_wmi_tlv_op_gen_beacon_dma()
2347 cmd->frame_control = __cpu_to_le32(fc); ath10k_wmi_tlv_op_gen_beacon_dma()
2348 cmd->flags = 0; ath10k_wmi_tlv_op_gen_beacon_dma()
2351 cmd->flags |= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DTIM_ZERO); ath10k_wmi_tlv_op_gen_beacon_dma()
2354 cmd->flags |= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DELIVER_CAB); ath10k_wmi_tlv_op_gen_beacon_dma()
2364 struct wmi_tlv_pdev_set_wmm_cmd *cmd; ath10k_wmi_tlv_op_gen_pdev_set_wmm() local
2371 len = (sizeof(*tlv) + sizeof(*cmd)) + ath10k_wmi_tlv_op_gen_pdev_set_wmm()
2381 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_pdev_set_wmm()
2382 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_pdev_set_wmm()
2387 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_pdev_set_wmm()
2401 struct wmi_request_stats_cmd *cmd; ath10k_wmi_tlv_op_gen_request_stats() local
2405 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_request_stats()
2411 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_request_stats()
2412 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_request_stats()
2413 cmd->stats_id = __cpu_to_le32(stats_mask); ath10k_wmi_tlv_op_gen_request_stats()
2424 struct wmi_force_fw_hang_cmd *cmd; ath10k_wmi_tlv_op_gen_force_fw_hang() local
2428 skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); ath10k_wmi_tlv_op_gen_force_fw_hang()
2434 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_force_fw_hang()
2435 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_force_fw_hang()
2436 cmd->type = __cpu_to_le32(type); ath10k_wmi_tlv_op_gen_force_fw_hang()
2437 cmd->delay_ms = __cpu_to_le32(delay_ms); ath10k_wmi_tlv_op_gen_force_fw_hang()
2446 struct wmi_tlv_dbglog_cmd *cmd; ath10k_wmi_tlv_op_gen_dbglog_cfg() local
2464 len = sizeof(*tlv) + sizeof(*cmd) + sizeof(*tlv) + bmap_len; ath10k_wmi_tlv_op_gen_dbglog_cfg()
2473 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_dbglog_cfg()
2474 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_dbglog_cfg()
2475 cmd->param = __cpu_to_le32(WMI_TLV_DBGLOG_PARAM_LOG_LEVEL); ath10k_wmi_tlv_op_gen_dbglog_cfg()
2476 cmd->value = __cpu_to_le32(value); ath10k_wmi_tlv_op_gen_dbglog_cfg()
2479 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_dbglog_cfg()
2497 struct wmi_tlv_pktlog_enable *cmd; ath10k_wmi_tlv_op_gen_pktlog_enable() local
2503 len = sizeof(*tlv) + sizeof(*cmd); ath10k_wmi_tlv_op_gen_pktlog_enable()
2511 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_pktlog_enable()
2512 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_pktlog_enable()
2513 cmd->filter = __cpu_to_le32(filter); ath10k_wmi_tlv_op_gen_pktlog_enable()
2516 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_pktlog_enable()
2526 struct wmi_tlv_pktlog_disable *cmd; ath10k_wmi_tlv_op_gen_pktlog_disable() local
2532 len = sizeof(*tlv) + sizeof(*cmd); ath10k_wmi_tlv_op_gen_pktlog_disable()
2540 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_pktlog_disable()
2541 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_pktlog_disable()
2544 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_pktlog_disable()
2556 struct wmi_tlv_bcn_tmpl_cmd *cmd; ath10k_wmi_tlv_op_gen_bcn_tmpl() local
2566 len = sizeof(*tlv) + sizeof(*cmd) + ath10k_wmi_tlv_op_gen_bcn_tmpl()
2576 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_bcn_tmpl()
2577 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_bcn_tmpl()
2578 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_bcn_tmpl()
2579 cmd->tim_ie_offset = __cpu_to_le32(tim_ie_offset); ath10k_wmi_tlv_op_gen_bcn_tmpl()
2580 cmd->buf_len = __cpu_to_le32(bcn->len); ath10k_wmi_tlv_op_gen_bcn_tmpl()
2583 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_bcn_tmpl()
2618 struct wmi_tlv_prb_tmpl_cmd *cmd; ath10k_wmi_tlv_op_gen_prb_tmpl() local
2625 len = sizeof(*tlv) + sizeof(*cmd) + ath10k_wmi_tlv_op_gen_prb_tmpl()
2635 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_prb_tmpl()
2636 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_prb_tmpl()
2637 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_prb_tmpl()
2638 cmd->buf_len = __cpu_to_le32(prb->len); ath10k_wmi_tlv_op_gen_prb_tmpl()
2641 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_prb_tmpl()
2667 struct wmi_tlv_p2p_go_bcn_ie *cmd; ath10k_wmi_tlv_op_gen_p2p_go_bcn_ie() local
2673 len = sizeof(*tlv) + sizeof(*cmd) + ath10k_wmi_tlv_op_gen_p2p_go_bcn_ie()
2682 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_p2p_go_bcn_ie()
2683 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_p2p_go_bcn_ie()
2684 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_p2p_go_bcn_ie()
2685 cmd->ie_len = __cpu_to_le32(p2p_ie[1] + 2); ath10k_wmi_tlv_op_gen_p2p_go_bcn_ie()
2688 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_p2p_go_bcn_ie()
2707 struct wmi_tdls_set_state_cmd *cmd; ath10k_wmi_tlv_op_gen_update_fw_tdls_state() local
2717 len = sizeof(*tlv) + sizeof(*cmd); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2725 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2727 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2728 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2729 cmd->state = __cpu_to_le32(state); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2730 cmd->notification_interval_ms = __cpu_to_le32(5000); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2731 cmd->tx_discovery_threshold = __cpu_to_le32(100); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2732 cmd->tx_teardown_threshold = __cpu_to_le32(5); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2733 cmd->rssi_teardown_threshold = __cpu_to_le32(-75); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2734 cmd->rssi_delta = __cpu_to_le32(-20); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2735 cmd->tdls_options = __cpu_to_le32(options); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2736 cmd->tdls_peer_traffic_ind_window = __cpu_to_le32(2); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2737 cmd->tdls_peer_traffic_response_timeout_ms = __cpu_to_le32(5000); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2738 cmd->tdls_puapsd_mask = __cpu_to_le32(0xf); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2739 cmd->tdls_puapsd_inactivity_time_ms = __cpu_to_le32(0); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2740 cmd->tdls_puapsd_rx_frame_threshold = __cpu_to_le32(10); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2743 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_update_fw_tdls_state()
2774 struct wmi_tdls_peer_update_cmd *cmd; ath10k_wmi_tlv_op_gen_tdls_peer_update() local
2784 len = sizeof(*tlv) + sizeof(*cmd) + ath10k_wmi_tlv_op_gen_tdls_peer_update()
2795 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_tdls_peer_update()
2797 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_tdls_peer_update()
2798 cmd->vdev_id = __cpu_to_le32(arg->vdev_id); ath10k_wmi_tlv_op_gen_tdls_peer_update()
2799 ether_addr_copy(cmd->peer_macaddr.addr, arg->addr); ath10k_wmi_tlv_op_gen_tdls_peer_update()
2800 cmd->peer_state = __cpu_to_le32(arg->peer_state); ath10k_wmi_tlv_op_gen_tdls_peer_update()
2803 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_tdls_peer_update()
2855 struct wmi_tlv_wow_enable_cmd *cmd; ath10k_wmi_tlv_op_gen_wow_enable() local
2860 len = sizeof(*tlv) + sizeof(*cmd); ath10k_wmi_tlv_op_gen_wow_enable()
2867 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_wow_enable()
2868 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_wow_enable()
2870 cmd->enable = __cpu_to_le32(1); ath10k_wmi_tlv_op_gen_wow_enable()
2882 struct wmi_tlv_wow_add_del_event_cmd *cmd; ath10k_wmi_tlv_op_gen_wow_add_wakeup_event() local
2887 len = sizeof(*tlv) + sizeof(*cmd); ath10k_wmi_tlv_op_gen_wow_add_wakeup_event()
2894 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_wow_add_wakeup_event()
2895 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_wow_add_wakeup_event()
2897 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_wow_add_wakeup_event()
2898 cmd->is_add = __cpu_to_le32(enable); ath10k_wmi_tlv_op_gen_wow_add_wakeup_event()
2899 cmd->event_bitmap = __cpu_to_le32(1 << event); ath10k_wmi_tlv_op_gen_wow_add_wakeup_event()
2909 struct wmi_tlv_wow_host_wakeup_ind *cmd; ath10k_wmi_tlv_gen_wow_host_wakeup_ind() local
2914 len = sizeof(*tlv) + sizeof(*cmd); ath10k_wmi_tlv_gen_wow_host_wakeup_ind()
2921 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_gen_wow_host_wakeup_ind()
2922 cmd = (void *)tlv->value; ath10k_wmi_tlv_gen_wow_host_wakeup_ind()
2934 struct wmi_tlv_wow_add_pattern_cmd *cmd; ath10k_wmi_tlv_op_gen_wow_add_pattern() local
2941 len = sizeof(*tlv) + sizeof(*cmd) + ath10k_wmi_tlv_op_gen_wow_add_pattern()
2954 /* cmd */ ath10k_wmi_tlv_op_gen_wow_add_pattern()
2958 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_wow_add_pattern()
2959 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_wow_add_pattern()
2961 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_wow_add_pattern()
2962 cmd->pattern_id = __cpu_to_le32(pattern_id); ath10k_wmi_tlv_op_gen_wow_add_pattern()
2963 cmd->pattern_type = __cpu_to_le32(WOW_BITMAP_PATTERN); ath10k_wmi_tlv_op_gen_wow_add_pattern()
2966 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_wow_add_pattern()
3032 struct wmi_tlv_wow_del_pattern_cmd *cmd; ath10k_wmi_tlv_op_gen_wow_del_pattern() local
3037 len = sizeof(*tlv) + sizeof(*cmd); ath10k_wmi_tlv_op_gen_wow_del_pattern()
3044 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_wow_del_pattern()
3045 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_wow_del_pattern()
3047 cmd->vdev_id = __cpu_to_le32(vdev_id); ath10k_wmi_tlv_op_gen_wow_del_pattern()
3048 cmd->pattern_id = __cpu_to_le32(pattern_id); ath10k_wmi_tlv_op_gen_wow_del_pattern()
3049 cmd->pattern_type = __cpu_to_le32(WOW_BITMAP_PATTERN); ath10k_wmi_tlv_op_gen_wow_del_pattern()
3059 struct wmi_tlv_adaptive_qcs *cmd; ath10k_wmi_tlv_op_gen_adaptive_qcs() local
3065 len = sizeof(*tlv) + sizeof(*cmd); ath10k_wmi_tlv_op_gen_adaptive_qcs()
3073 tlv->len = __cpu_to_le16(sizeof(*cmd)); ath10k_wmi_tlv_op_gen_adaptive_qcs()
3074 cmd = (void *)tlv->value; ath10k_wmi_tlv_op_gen_adaptive_qcs()
3075 cmd->enable = __cpu_to_le32(enable ? 1 : 0); ath10k_wmi_tlv_op_gen_adaptive_qcs()
3078 ptr += sizeof(*cmd); ath10k_wmi_tlv_op_gen_adaptive_qcs()
3494 ar->wmi.cmd = &wmi_tlv_cmd_map; ath10k_wmi_tlv_attach()
/linux-4.4.14/drivers/net/ethernet/apm/xgene/
H A Dxgene_enet_ethtool.c57 static int xgene_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd) xgene_get_settings() argument
66 return phy_ethtool_gset(phydev, cmd); xgene_get_settings()
68 cmd->supported = SUPPORTED_1000baseT_Full | xgene_get_settings()
70 cmd->advertising = cmd->supported; xgene_get_settings()
71 ethtool_cmd_speed_set(cmd, SPEED_1000); xgene_get_settings()
72 cmd->duplex = DUPLEX_FULL; xgene_get_settings()
73 cmd->port = PORT_MII; xgene_get_settings()
74 cmd->transceiver = XCVR_INTERNAL; xgene_get_settings()
75 cmd->autoneg = AUTONEG_ENABLE; xgene_get_settings()
77 cmd->supported = SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE; xgene_get_settings()
78 cmd->advertising = cmd->supported; xgene_get_settings()
79 ethtool_cmd_speed_set(cmd, SPEED_10000); xgene_get_settings()
80 cmd->duplex = DUPLEX_FULL; xgene_get_settings()
81 cmd->port = PORT_FIBRE; xgene_get_settings()
82 cmd->transceiver = XCVR_INTERNAL; xgene_get_settings()
83 cmd->autoneg = AUTONEG_DISABLE; xgene_get_settings()
89 static int xgene_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd) xgene_set_settings() argument
98 return phy_ethtool_sset(phydev, cmd); xgene_set_settings()
/linux-4.4.14/drivers/infiniband/hw/ocrdma/
H A Docrdma_hw.c404 struct ocrdma_delete_q_req *cmd = dev->mbx_cmd; ocrdma_mbx_delete_q() local
419 memset(cmd, 0, sizeof(*cmd)); ocrdma_mbx_delete_q()
420 ocrdma_init_mch(&cmd->req, opcode, OCRDMA_SUBSYS_COMMON, sizeof(*cmd)); ocrdma_mbx_delete_q()
421 cmd->id = q->id; ocrdma_mbx_delete_q()
424 cmd, sizeof(*cmd), NULL, NULL); ocrdma_mbx_delete_q()
433 struct ocrdma_create_eq_req *cmd = dev->mbx_cmd; ocrdma_mbx_create_eq() local
436 memset(cmd, 0, sizeof(*cmd)); ocrdma_mbx_create_eq()
437 ocrdma_init_mch(&cmd->req, OCRDMA_CMD_CREATE_EQ, OCRDMA_SUBSYS_COMMON, ocrdma_mbx_create_eq()
438 sizeof(*cmd)); ocrdma_mbx_create_eq()
440 cmd->req.rsvd_version = 2; ocrdma_mbx_create_eq()
441 cmd->num_pages = 4; ocrdma_mbx_create_eq()
442 cmd->valid = OCRDMA_CREATE_EQ_VALID; ocrdma_mbx_create_eq()
443 cmd->cnt = 4 << OCRDMA_CREATE_EQ_CNT_SHIFT; ocrdma_mbx_create_eq()
445 ocrdma_build_q_pages(&cmd->pa[0], cmd->num_pages, eq->q.dma, ocrdma_mbx_create_eq()
447 status = be_roce_mcc_cmd(dev->nic_info.netdev, cmd, sizeof(*cmd), NULL, ocrdma_mbx_create_eq()
524 struct ocrdma_create_cq_cmd *cmd = dev->mbx_cmd; ocrdma_mbx_mq_cq_create() local
528 memset(cmd, 0, sizeof(*cmd)); ocrdma_mbx_mq_cq_create()
529 ocrdma_init_mch(&cmd->req, OCRDMA_CMD_CREATE_CQ, ocrdma_mbx_mq_cq_create()
530 OCRDMA_SUBSYS_COMMON, sizeof(*cmd)); ocrdma_mbx_mq_cq_create()
532 cmd->req.rsvd_version = OCRDMA_CREATE_CQ_VER2; ocrdma_mbx_mq_cq_create()
533 cmd->pgsz_pgcnt = (cq->size / OCRDMA_MIN_Q_PAGE_SIZE) << ocrdma_mbx_mq_cq_create()
535 cmd->pgsz_pgcnt |= PAGES_4K_SPANNED(cq->va, cq->size); ocrdma_mbx_mq_cq_create()
537 cmd->ev_cnt_flags = OCRDMA_CREATE_CQ_DEF_FLAGS; ocrdma_mbx_mq_cq_create()
538 cmd->eqn = eq->id; ocrdma_mbx_mq_cq_create()
539 cmd->pdid_cqecnt = cq->size / sizeof(struct ocrdma_mcqe); ocrdma_mbx_mq_cq_create()
541 ocrdma_build_q_pages(&cmd->pa[0], cq->size / OCRDMA_MIN_Q_PAGE_SIZE, ocrdma_mbx_mq_cq_create()
544 cmd, sizeof(*cmd), NULL, NULL); ocrdma_mbx_mq_cq_create()
566 struct ocrdma_create_mq_req *cmd = dev->mbx_cmd; ocrdma_mbx_create_mq() local
570 memset(cmd, 0, sizeof(*cmd)); ocrdma_mbx_create_mq()
573 ocrdma_init_mch(&cmd->req, OCRDMA_CMD_CREATE_MQ_EXT, ocrdma_mbx_create_mq()
574 OCRDMA_SUBSYS_COMMON, sizeof(*cmd)); ocrdma_mbx_create_mq()
575 cmd->req.rsvd_version = 1; ocrdma_mbx_create_mq()
576 cmd->cqid_pages = num_pages; ocrdma_mbx_create_mq()
577 cmd->cqid_pages |= (cq->id << OCRDMA_CREATE_MQ_CQ_ID_SHIFT); ocrdma_mbx_create_mq()
578 cmd->async_cqid_valid = OCRDMA_CREATE_MQ_ASYNC_CQ_VALID; ocrdma_mbx_create_mq()
580 cmd->async_event_bitmap = BIT(OCRDMA_ASYNC_GRP5_EVE_CODE); ocrdma_mbx_create_mq()
581 cmd->async_event_bitmap |= BIT(OCRDMA_ASYNC_RDMA_EVE_CODE); ocrdma_mbx_create_mq()
583 cmd->async_event_bitmap |= BIT(OCRDMA_ASYNC_LINK_EVE_CODE); ocrdma_mbx_create_mq()
585 cmd->async_cqid_ringsize = cq->id; ocrdma_mbx_create_mq()
586 cmd->async_cqid_ringsize |= (ocrdma_encoded_q_len(mq->len) << ocrdma_mbx_create_mq()
588 cmd->valid = OCRDMA_CREATE_MQ_VALID; ocrdma_mbx_create_mq()
589 pa = &cmd->pa[0]; ocrdma_mbx_create_mq()
593 cmd, sizeof(*cmd), NULL, NULL); ocrdma_mbx_create_mq()
1036 static void ocrdma_post_mqe(struct ocrdma_dev *dev, struct ocrdma_mqe *cmd) ocrdma_post_mqe() argument
1043 cmd->hdr.tag_lo = dev->mq.sq.head; ocrdma_post_mqe()
1044 ocrdma_copy_cpu_to_le32(mqe, cmd, sizeof(*mqe)); ocrdma_post_mqe()
1234 struct ocrdma_mqe *cmd; ocrdma_mbx_query_fw_ver() local
1237 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_GET_FW_VER, sizeof(*cmd)); ocrdma_mbx_query_fw_ver()
1238 if (!cmd) ocrdma_mbx_query_fw_ver()
1240 ocrdma_init_mch((struct ocrdma_mbx_hdr *)&cmd->u.cmd[0], ocrdma_mbx_query_fw_ver()
1242 OCRDMA_SUBSYS_COMMON, sizeof(*cmd)); ocrdma_mbx_query_fw_ver()
1244 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_query_fw_ver()
1247 rsp = (struct ocrdma_fw_ver_rsp *)cmd; ocrdma_mbx_query_fw_ver()
1253 kfree(cmd); ocrdma_mbx_query_fw_ver()
1261 struct ocrdma_mqe *cmd; ocrdma_mbx_query_fw_config() local
1264 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_GET_FW_CONFIG, sizeof(*cmd)); ocrdma_mbx_query_fw_config()
1265 if (!cmd) ocrdma_mbx_query_fw_config()
1267 ocrdma_init_mch((struct ocrdma_mbx_hdr *)&cmd->u.cmd[0], ocrdma_mbx_query_fw_config()
1269 OCRDMA_SUBSYS_COMMON, sizeof(*cmd)); ocrdma_mbx_query_fw_config()
1270 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_query_fw_config()
1273 rsp = (struct ocrdma_fw_conf_rsp *)cmd; ocrdma_mbx_query_fw_config()
1276 kfree(cmd); ocrdma_mbx_query_fw_config()
1375 struct ocrdma_mqe *cmd; ocrdma_mbx_query_dev() local
1377 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_QUERY_CONFIG, sizeof(*cmd)); ocrdma_mbx_query_dev()
1378 if (!cmd) ocrdma_mbx_query_dev()
1380 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_query_dev()
1383 rsp = (struct ocrdma_mbx_query_config *)cmd; ocrdma_mbx_query_dev()
1386 kfree(cmd); ocrdma_mbx_query_dev()
1395 struct ocrdma_mqe *cmd; ocrdma_mbx_get_link_speed() local
1397 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_QUERY_NTWK_LINK_CONFIG_V1, ocrdma_mbx_get_link_speed()
1398 sizeof(*cmd)); ocrdma_mbx_get_link_speed()
1399 if (!cmd) ocrdma_mbx_get_link_speed()
1401 ocrdma_init_mch((struct ocrdma_mbx_hdr *)&cmd->u.cmd[0], ocrdma_mbx_get_link_speed()
1403 OCRDMA_SUBSYS_COMMON, sizeof(*cmd)); ocrdma_mbx_get_link_speed()
1405 ((struct ocrdma_mbx_hdr *)cmd->u.cmd)->rsvd_version = 0x1; ocrdma_mbx_get_link_speed()
1407 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_get_link_speed()
1411 rsp = (struct ocrdma_get_link_speed_rsp *)cmd; ocrdma_mbx_get_link_speed()
1419 kfree(cmd); ocrdma_mbx_get_link_speed()
1426 struct ocrdma_mqe *cmd; ocrdma_mbx_get_phy_info() local
1429 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_PHY_DETAILS, sizeof(*cmd)); ocrdma_mbx_get_phy_info()
1430 if (!cmd) ocrdma_mbx_get_phy_info()
1433 ocrdma_init_mch((struct ocrdma_mbx_hdr *)&cmd->u.cmd[0], ocrdma_mbx_get_phy_info()
1435 sizeof(*cmd)); ocrdma_mbx_get_phy_info()
1437 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_get_phy_info()
1441 rsp = (struct ocrdma_get_phy_info_rsp *)cmd; ocrdma_mbx_get_phy_info()
1453 kfree(cmd); ocrdma_mbx_get_phy_info()
1460 struct ocrdma_alloc_pd *cmd; ocrdma_mbx_alloc_pd() local
1463 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_ALLOC_PD, sizeof(*cmd)); ocrdma_mbx_alloc_pd()
1464 if (!cmd) ocrdma_mbx_alloc_pd()
1467 cmd->enable_dpp_rsvd |= OCRDMA_ALLOC_PD_ENABLE_DPP; ocrdma_mbx_alloc_pd()
1468 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_alloc_pd()
1471 rsp = (struct ocrdma_alloc_pd_rsp *)cmd; ocrdma_mbx_alloc_pd()
1482 kfree(cmd); ocrdma_mbx_alloc_pd()
1489 struct ocrdma_dealloc_pd *cmd; ocrdma_mbx_dealloc_pd() local
1491 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_DEALLOC_PD, sizeof(*cmd)); ocrdma_mbx_dealloc_pd()
1492 if (!cmd) ocrdma_mbx_dealloc_pd()
1494 cmd->id = pd->id; ocrdma_mbx_dealloc_pd()
1495 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_dealloc_pd()
1496 kfree(cmd); ocrdma_mbx_dealloc_pd()
1505 struct ocrdma_alloc_pd_range *cmd; ocrdma_mbx_alloc_pd_range() local
1510 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_ALLOC_PD_RANGE, ocrdma_mbx_alloc_pd_range()
1511 sizeof(*cmd)); ocrdma_mbx_alloc_pd_range()
1512 if (!cmd) ocrdma_mbx_alloc_pd_range()
1514 cmd->pd_count = dev->attr.max_dpp_pds; ocrdma_mbx_alloc_pd_range()
1515 cmd->enable_dpp_rsvd |= OCRDMA_ALLOC_PD_ENABLE_DPP; ocrdma_mbx_alloc_pd_range()
1516 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_alloc_pd_range()
1517 rsp = (struct ocrdma_alloc_pd_range_rsp *)cmd; ocrdma_mbx_alloc_pd_range()
1531 kfree(cmd); ocrdma_mbx_alloc_pd_range()
1534 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_ALLOC_PD_RANGE, sizeof(*cmd)); ocrdma_mbx_alloc_pd_range()
1535 if (!cmd) ocrdma_mbx_alloc_pd_range()
1538 cmd->pd_count = dev->attr.max_pd - dev->attr.max_dpp_pds; ocrdma_mbx_alloc_pd_range()
1539 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_alloc_pd_range()
1540 rsp = (struct ocrdma_alloc_pd_range_rsp *)cmd; ocrdma_mbx_alloc_pd_range()
1549 kfree(cmd); ocrdma_mbx_alloc_pd_range()
1561 struct ocrdma_dealloc_pd_range *cmd; ocrdma_mbx_dealloc_pd_range() local
1564 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_DEALLOC_PD_RANGE, sizeof(*cmd)); ocrdma_mbx_dealloc_pd_range()
1565 if (!cmd) ocrdma_mbx_dealloc_pd_range()
1569 cmd->start_pd_id = dev->pd_mgr->pd_norm_start; ocrdma_mbx_dealloc_pd_range()
1570 cmd->pd_count = dev->pd_mgr->max_normal_pd; ocrdma_mbx_dealloc_pd_range()
1571 ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_dealloc_pd_range()
1575 kfree(cmd); ocrdma_mbx_dealloc_pd_range()
1577 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_DEALLOC_PD_RANGE, ocrdma_mbx_dealloc_pd_range()
1578 sizeof(*cmd)); ocrdma_mbx_dealloc_pd_range()
1579 if (!cmd) ocrdma_mbx_dealloc_pd_range()
1582 cmd->start_pd_id = dev->pd_mgr->pd_dpp_start; ocrdma_mbx_dealloc_pd_range()
1583 cmd->pd_count = dev->pd_mgr->max_dpp_pd; ocrdma_mbx_dealloc_pd_range()
1584 ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_dealloc_pd_range()
1587 kfree(cmd); ocrdma_mbx_dealloc_pd_range()
1644 struct ocrdma_create_ah_tbl *cmd; ocrdma_mbx_create_ah_tbl() local
1650 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_CREATE_AH_TBL, sizeof(*cmd)); ocrdma_mbx_create_ah_tbl()
1651 if (!cmd) ocrdma_mbx_create_ah_tbl()
1658 cmd->ah_conf = (OCRDMA_AH_TBL_PAGES << ocrdma_mbx_create_ah_tbl()
1667 cmd->ah_conf |= (i << OCRDMA_CREATE_AH_PAGE_SIZE_SHIFT) & ocrdma_mbx_create_ah_tbl()
1671 cmd->ah_conf |= (sizeof(struct ocrdma_av) << ocrdma_mbx_create_ah_tbl()
1695 cmd->tbl_addr[0].lo = (u32)(dev->av_tbl.pbl.pa & 0xFFFFFFFF); ocrdma_mbx_create_ah_tbl()
1696 cmd->tbl_addr[0].hi = (u32)upper_32_bits(dev->av_tbl.pbl.pa); ocrdma_mbx_create_ah_tbl()
1697 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_create_ah_tbl()
1700 rsp = (struct ocrdma_create_ah_tbl_rsp *)cmd; ocrdma_mbx_create_ah_tbl()
1702 kfree(cmd); ocrdma_mbx_create_ah_tbl()
1715 kfree(cmd); ocrdma_mbx_create_ah_tbl()
1721 struct ocrdma_delete_ah_tbl *cmd; ocrdma_mbx_delete_ah_tbl() local
1727 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_DELETE_AH_TBL, sizeof(*cmd)); ocrdma_mbx_delete_ah_tbl()
1728 if (!cmd) ocrdma_mbx_delete_ah_tbl()
1730 cmd->ahid = dev->av_tbl.ahid; ocrdma_mbx_delete_ah_tbl()
1732 ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_delete_ah_tbl()
1738 kfree(cmd); ocrdma_mbx_delete_ah_tbl()
1785 struct ocrdma_create_cq *cmd; ocrdma_mbx_create_cq() local
1811 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_CREATE_CQ, sizeof(*cmd)); ocrdma_mbx_create_cq()
1812 if (!cmd) ocrdma_mbx_create_cq()
1814 ocrdma_init_mch(&cmd->cmd.req, OCRDMA_CMD_CREATE_CQ, ocrdma_mbx_create_cq()
1815 OCRDMA_SUBSYS_COMMON, sizeof(*cmd)); ocrdma_mbx_create_cq()
1823 cmd->cmd.pgsz_pgcnt = (page_size / OCRDMA_MIN_Q_PAGE_SIZE) << ocrdma_mbx_create_cq()
1825 cmd->cmd.pgsz_pgcnt |= hw_pages; ocrdma_mbx_create_cq()
1826 cmd->cmd.ev_cnt_flags = OCRDMA_CREATE_CQ_DEF_FLAGS; ocrdma_mbx_create_cq()
1829 cmd->cmd.req.rsvd_version = OCRDMA_CREATE_CQ_VER3; ocrdma_mbx_create_cq()
1834 cmd->cmd.ev_cnt_flags |= (0x3 << OCRDMA_CREATE_CQ_CNT_SHIFT); ocrdma_mbx_create_cq()
1850 cmd->cmd.ev_cnt_flags |= (count << OCRDMA_CREATE_CQ_CNT_SHIFT); ocrdma_mbx_create_cq()
1853 cmd->cmd.eqn = cq->eqn; ocrdma_mbx_create_cq()
1856 cmd->cmd.pgsz_pgcnt |= OCRDMA_CREATE_CQ_DPP << ocrdma_mbx_create_cq()
1859 cmd->cmd.pdid_cqecnt = (cq->len / cqe_size); ocrdma_mbx_create_cq()
1861 cmd->cmd.pdid_cqecnt = (cq->len / cqe_size) - 1; ocrdma_mbx_create_cq()
1862 cmd->cmd.ev_cnt_flags |= OCRDMA_CREATE_CQ_FLAGS_AUTO_VALID; ocrdma_mbx_create_cq()
1867 cmd->cmd.pdid_cqecnt |= (pd_id << ocrdma_mbx_create_cq()
1869 ocrdma_build_q_pages(&cmd->cmd.pa[0], hw_pages, cq->pa, page_size); ocrdma_mbx_create_cq()
1870 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_create_cq()
1874 rsp = (struct ocrdma_create_cq_rsp *)cmd; ocrdma_mbx_create_cq()
1876 kfree(cmd); ocrdma_mbx_create_cq()
1882 kfree(cmd); ocrdma_mbx_create_cq()
1889 struct ocrdma_destroy_cq *cmd; ocrdma_mbx_destroy_cq() local
1891 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_DELETE_CQ, sizeof(*cmd)); ocrdma_mbx_destroy_cq()
1892 if (!cmd) ocrdma_mbx_destroy_cq()
1894 ocrdma_init_mch(&cmd->req, OCRDMA_CMD_DELETE_CQ, ocrdma_mbx_destroy_cq()
1895 OCRDMA_SUBSYS_COMMON, sizeof(*cmd)); ocrdma_mbx_destroy_cq()
1897 cmd->bypass_flush_qid |= ocrdma_mbx_destroy_cq()
1901 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_destroy_cq()
1904 kfree(cmd); ocrdma_mbx_destroy_cq()
1912 struct ocrdma_alloc_lkey *cmd; ocrdma_mbx_alloc_lkey() local
1915 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_ALLOC_LKEY, sizeof(*cmd)); ocrdma_mbx_alloc_lkey()
1916 if (!cmd) ocrdma_mbx_alloc_lkey()
1918 cmd->pdid = pdid; ocrdma_mbx_alloc_lkey()
1919 cmd->pbl_sz_flags |= addr_check; ocrdma_mbx_alloc_lkey()
1920 cmd->pbl_sz_flags |= (hwmr->fr_mr << OCRDMA_ALLOC_LKEY_FMR_SHIFT); ocrdma_mbx_alloc_lkey()
1921 cmd->pbl_sz_flags |= ocrdma_mbx_alloc_lkey()
1923 cmd->pbl_sz_flags |= ocrdma_mbx_alloc_lkey()
1925 cmd->pbl_sz_flags |= ocrdma_mbx_alloc_lkey()
1927 cmd->pbl_sz_flags |= ocrdma_mbx_alloc_lkey()
1929 cmd->pbl_sz_flags |= ocrdma_mbx_alloc_lkey()
1932 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_alloc_lkey()
1935 rsp = (struct ocrdma_alloc_lkey_rsp *)cmd; ocrdma_mbx_alloc_lkey()
1938 kfree(cmd); ocrdma_mbx_alloc_lkey()
1945 struct ocrdma_dealloc_lkey *cmd; ocrdma_mbx_dealloc_lkey() local
1947 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_DEALLOC_LKEY, sizeof(*cmd)); ocrdma_mbx_dealloc_lkey()
1948 if (!cmd) ocrdma_mbx_dealloc_lkey()
1950 cmd->lkey = lkey; ocrdma_mbx_dealloc_lkey()
1951 cmd->rsvd_frmr = fr_mr ? 1 : 0; ocrdma_mbx_dealloc_lkey()
1952 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_dealloc_lkey()
1956 kfree(cmd); ocrdma_mbx_dealloc_lkey()
1965 struct ocrdma_reg_nsmr *cmd; ocrdma_mbx_reg_mr() local
1968 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_REGISTER_NSMR, sizeof(*cmd)); ocrdma_mbx_reg_mr()
1969 if (!cmd) ocrdma_mbx_reg_mr()
1971 cmd->num_pbl_pdid = ocrdma_mbx_reg_mr()
1973 cmd->fr_mr = hwmr->fr_mr; ocrdma_mbx_reg_mr()
1975 cmd->flags_hpage_pbe_sz |= (hwmr->remote_wr << ocrdma_mbx_reg_mr()
1977 cmd->flags_hpage_pbe_sz |= (hwmr->remote_rd << ocrdma_mbx_reg_mr()
1979 cmd->flags_hpage_pbe_sz |= (hwmr->local_wr << ocrdma_mbx_reg_mr()
1981 cmd->flags_hpage_pbe_sz |= (hwmr->remote_atomic << ocrdma_mbx_reg_mr()
1983 cmd->flags_hpage_pbe_sz |= (hwmr->mw_bind << ocrdma_mbx_reg_mr()
1985 cmd->flags_hpage_pbe_sz |= (last << OCRDMA_REG_NSMR_LAST_SHIFT); ocrdma_mbx_reg_mr()
1987 cmd->flags_hpage_pbe_sz |= (hwmr->pbe_size / OCRDMA_MIN_HPAGE_SIZE); ocrdma_mbx_reg_mr()
1988 cmd->flags_hpage_pbe_sz |= (hwmr->pbl_size / OCRDMA_MIN_HPAGE_SIZE) << ocrdma_mbx_reg_mr()
1990 cmd->totlen_low = hwmr->len; ocrdma_mbx_reg_mr()
1991 cmd->totlen_high = upper_32_bits(hwmr->len); ocrdma_mbx_reg_mr()
1992 cmd->fbo_low = (u32) (hwmr->fbo & 0xffffffff); ocrdma_mbx_reg_mr()
1993 cmd->fbo_high = (u32) upper_32_bits(hwmr->fbo); ocrdma_mbx_reg_mr()
1994 cmd->va_loaddr = (u32) hwmr->va; ocrdma_mbx_reg_mr()
1995 cmd->va_hiaddr = (u32) upper_32_bits(hwmr->va); ocrdma_mbx_reg_mr()
1998 cmd->pbl[i].lo = (u32) (hwmr->pbl_table[i].pa & 0xffffffff); ocrdma_mbx_reg_mr()
1999 cmd->pbl[i].hi = upper_32_bits(hwmr->pbl_table[i].pa); ocrdma_mbx_reg_mr()
2001 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_reg_mr()
2004 rsp = (struct ocrdma_reg_nsmr_rsp *)cmd; ocrdma_mbx_reg_mr()
2007 kfree(cmd); ocrdma_mbx_reg_mr()
2017 struct ocrdma_reg_nsmr_cont *cmd; ocrdma_mbx_reg_mr_cont() local
2019 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_REGISTER_NSMR_CONT, sizeof(*cmd)); ocrdma_mbx_reg_mr_cont()
2020 if (!cmd) ocrdma_mbx_reg_mr_cont()
2022 cmd->lrkey = hwmr->lkey; ocrdma_mbx_reg_mr_cont()
2023 cmd->num_pbl_offset = (pbl_cnt << OCRDMA_REG_NSMR_CONT_NUM_PBL_SHIFT) | ocrdma_mbx_reg_mr_cont()
2025 cmd->last = last << OCRDMA_REG_NSMR_CONT_LAST_SHIFT; ocrdma_mbx_reg_mr_cont()
2028 cmd->pbl[i].lo = ocrdma_mbx_reg_mr_cont()
2030 cmd->pbl[i].hi = ocrdma_mbx_reg_mr_cont()
2033 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_reg_mr_cont()
2037 kfree(cmd); ocrdma_mbx_reg_mr_cont()
2185 static int ocrdma_set_create_qp_sq_cmd(struct ocrdma_create_qp_req *cmd, ocrdma_set_create_qp_sq_cmd() argument
2219 ocrdma_build_q_pages(&cmd->wq_addr[0], hw_pages, pa, hw_page_size); ocrdma_set_create_qp_sq_cmd()
2221 cmd->type_pgsz_pdn |= (ilog2(hw_page_size / OCRDMA_MIN_Q_PAGE_SIZE) ocrdma_set_create_qp_sq_cmd()
2223 cmd->num_wq_rq_pages |= (hw_pages << ocrdma_set_create_qp_sq_cmd()
2226 cmd->max_sge_send_write |= (max_sges << ocrdma_set_create_qp_sq_cmd()
2229 cmd->max_sge_send_write |= (max_sges << ocrdma_set_create_qp_sq_cmd()
2232 cmd->max_wqe_rqe |= (ilog2(qp->sq.max_cnt) << ocrdma_set_create_qp_sq_cmd()
2235 cmd->wqe_rqe_size |= (dev->attr.wqe_size << ocrdma_set_create_qp_sq_cmd()
2241 static int ocrdma_set_create_qp_rq_cmd(struct ocrdma_create_qp_req *cmd, ocrdma_set_create_qp_rq_cmd() argument
2271 ocrdma_build_q_pages(&cmd->rq_addr[0], hw_pages, pa, hw_page_size); ocrdma_set_create_qp_rq_cmd()
2272 cmd->type_pgsz_pdn |= (ilog2(hw_page_size / OCRDMA_MIN_Q_PAGE_SIZE) << ocrdma_set_create_qp_rq_cmd()
2274 cmd->num_wq_rq_pages |= ocrdma_set_create_qp_rq_cmd()
2277 cmd->max_sge_recv_flags |= (attrs->cap.max_recv_sge << ocrdma_set_create_qp_rq_cmd()
2280 cmd->max_wqe_rqe |= (ilog2(qp->rq.max_cnt) << ocrdma_set_create_qp_rq_cmd()
2283 cmd->wqe_rqe_size |= (dev->attr.rqe_size << ocrdma_set_create_qp_rq_cmd()
2289 static void ocrdma_set_create_qp_dpp_cmd(struct ocrdma_create_qp_req *cmd, ocrdma_set_create_qp_dpp_cmd() argument
2296 cmd->max_sge_recv_flags |= OCRDMA_CREATE_QP_REQ_ENABLE_DPP_MASK; ocrdma_set_create_qp_dpp_cmd()
2299 cmd->max_sge_recv_flags |= OCRDMA_CREATE_QP_REQ_ENABLE_DPP_MASK; ocrdma_set_create_qp_dpp_cmd()
2300 cmd->dpp_credits_cqid = dpp_cq_id; ocrdma_set_create_qp_dpp_cmd()
2301 cmd->dpp_credits_cqid |= OCRDMA_CREATE_QP_REQ_DPP_CREDIT_LIMIT << ocrdma_set_create_qp_dpp_cmd()
2305 static int ocrdma_set_create_qp_ird_cmd(struct ocrdma_create_qp_req *cmd, ocrdma_set_create_qp_ird_cmd() argument
2325 ocrdma_build_q_pages(&cmd->ird_addr[0], dev->attr.num_ird_pages, ocrdma_set_create_qp_ird_cmd()
2384 struct ocrdma_create_qp_req *cmd; ocrdma_mbx_create_qp() local
2402 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_CREATE_QP, sizeof(*cmd)); ocrdma_mbx_create_qp()
2403 if (!cmd) ocrdma_mbx_create_qp()
2405 cmd->type_pgsz_pdn |= (qptype << OCRDMA_CREATE_QP_REQ_QPT_SHIFT) & ocrdma_mbx_create_qp()
2407 status = ocrdma_set_create_qp_sq_cmd(cmd, attrs, qp); ocrdma_mbx_create_qp()
2413 cmd->max_sge_recv_flags |= OCRDMA_CREATE_QP_REQ_USE_SRQ_MASK; ocrdma_mbx_create_qp()
2414 cmd->rq_addr[0].lo = srq->id; ocrdma_mbx_create_qp()
2417 status = ocrdma_set_create_qp_rq_cmd(cmd, attrs, qp); ocrdma_mbx_create_qp()
2422 status = ocrdma_set_create_qp_ird_cmd(cmd, qp); ocrdma_mbx_create_qp()
2426 cmd->type_pgsz_pdn |= (pd->id << OCRDMA_CREATE_QP_REQ_PD_ID_SHIFT) & ocrdma_mbx_create_qp()
2431 cmd->max_sge_recv_flags |= flags; ocrdma_mbx_create_qp()
2432 cmd->max_ord_ird |= (dev->attr.max_ord_per_qp << ocrdma_mbx_create_qp()
2435 cmd->max_ord_ird |= (dev->attr.max_ird_per_qp << ocrdma_mbx_create_qp()
2439 cmd->wq_rq_cqid |= (cq->id << OCRDMA_CREATE_QP_REQ_WQ_CQID_SHIFT) & ocrdma_mbx_create_qp()
2443 cmd->wq_rq_cqid |= (cq->id << OCRDMA_CREATE_QP_REQ_RQ_CQID_SHIFT) & ocrdma_mbx_create_qp()
2449 ocrdma_set_create_qp_dpp_cmd(cmd, pd, qp, enable_dpp_cq, ocrdma_mbx_create_qp()
2453 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_create_qp()
2456 rsp = (struct ocrdma_create_qp_rsp *)cmd; ocrdma_mbx_create_qp()
2459 kfree(cmd); ocrdma_mbx_create_qp()
2469 kfree(cmd); ocrdma_mbx_create_qp()
2477 struct ocrdma_query_qp *cmd; ocrdma_mbx_query_qp() local
2480 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_QUERY_QP, sizeof(*rsp)); ocrdma_mbx_query_qp()
2481 if (!cmd) ocrdma_mbx_query_qp()
2483 cmd->qp_id = qp->id; ocrdma_mbx_query_qp()
2484 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_query_qp()
2487 rsp = (struct ocrdma_query_qp_rsp *)cmd; ocrdma_mbx_query_qp()
2490 kfree(cmd); ocrdma_mbx_query_qp()
2495 struct ocrdma_modify_qp *cmd, ocrdma_set_av_params()
2511 cmd->params.tclass_sq_psn |= ocrdma_set_av_params()
2513 cmd->params.rnt_rc_sl_fl |= ocrdma_set_av_params()
2515 cmd->params.rnt_rc_sl_fl |= (ah_attr->sl << OCRDMA_QP_PARAMS_SL_SHIFT); ocrdma_set_av_params()
2516 cmd->params.hop_lmt_rq_psn |= ocrdma_set_av_params()
2518 cmd->flags |= OCRDMA_QP_PARA_FLOW_LBL_VALID; ocrdma_set_av_params()
2519 memcpy(&cmd->params.dgid[0], &ah_attr->grh.dgid.raw[0], ocrdma_set_av_params()
2520 sizeof(cmd->params.dgid)); ocrdma_set_av_params()
2535 memcpy(&cmd->params.sgid[0], &sgid.raw[0], sizeof(cmd->params.sgid)); ocrdma_set_av_params()
2539 cmd->params.dmac_b0_to_b3 = mac_addr[0] | (mac_addr[1] << 8) | ocrdma_set_av_params()
2542 ocrdma_cpu_to_le32(&cmd->params.dgid[0], sizeof(cmd->params.dgid)); ocrdma_set_av_params()
2543 ocrdma_cpu_to_le32(&cmd->params.sgid[0], sizeof(cmd->params.sgid)); ocrdma_set_av_params()
2544 cmd->params.vlan_dmac_b4_to_b5 = mac_addr[4] | (mac_addr[5] << 8); ocrdma_set_av_params()
2555 cmd->params.vlan_dmac_b4_to_b5 |= ocrdma_set_av_params()
2557 cmd->flags |= OCRDMA_QP_PARA_VLAN_EN_VALID; ocrdma_set_av_params()
2558 cmd->params.rnt_rc_sl_fl |= ocrdma_set_av_params()
2566 struct ocrdma_modify_qp *cmd, ocrdma_set_qp_params()
2573 cmd->params.path_mtu_pkey_indx |= (attrs->pkey_index & ocrdma_set_qp_params()
2575 cmd->flags |= OCRDMA_QP_PARA_PKEY_VALID; ocrdma_set_qp_params()
2579 cmd->params.qkey = attrs->qkey; ocrdma_set_qp_params()
2580 cmd->flags |= OCRDMA_QP_PARA_QKEY_VALID; ocrdma_set_qp_params()
2583 status = ocrdma_set_av_params(qp, cmd, attrs, attr_mask); ocrdma_set_qp_params()
2588 cmd->params.dmac_b0_to_b3 = dev->nic_info.mac_addr[0] | ocrdma_set_qp_params()
2592 cmd->params.vlan_dmac_b4_to_b5 = dev->nic_info.mac_addr[4] | ocrdma_set_qp_params()
2597 cmd->params.max_sge_recv_flags |= ocrdma_set_qp_params()
2599 cmd->flags |= OCRDMA_QP_PARA_DST_QPN_VALID; ocrdma_set_qp_params()
2602 cmd->params.ack_to_rnr_rtc_dest_qpn |= (attrs->dest_qp_num & ocrdma_set_qp_params()
2604 cmd->flags |= OCRDMA_QP_PARA_DST_QPN_VALID; ocrdma_set_qp_params()
2614 cmd->params.path_mtu_pkey_indx |= ocrdma_set_qp_params()
2618 cmd->flags |= OCRDMA_QP_PARA_PMTU_VALID; ocrdma_set_qp_params()
2621 cmd->params.ack_to_rnr_rtc_dest_qpn |= attrs->timeout << ocrdma_set_qp_params()
2623 cmd->flags |= OCRDMA_QP_PARA_ACK_TO_VALID; ocrdma_set_qp_params()
2626 cmd->params.rnt_rc_sl_fl |= (attrs->retry_cnt << ocrdma_set_qp_params()
2629 cmd->flags |= OCRDMA_QP_PARA_RETRY_CNT_VALID; ocrdma_set_qp_params()
2632 cmd->params.rnt_rc_sl_fl |= (attrs->min_rnr_timer << ocrdma_set_qp_params()
2635 cmd->flags |= OCRDMA_QP_PARA_RNT_VALID; ocrdma_set_qp_params()
2638 cmd->params.ack_to_rnr_rtc_dest_qpn |= (attrs->rnr_retry << ocrdma_set_qp_params()
2641 cmd->flags |= OCRDMA_QP_PARA_RRC_VALID; ocrdma_set_qp_params()
2644 cmd->params.tclass_sq_psn |= (attrs->sq_psn & 0x00ffffff); ocrdma_set_qp_params()
2645 cmd->flags |= OCRDMA_QP_PARA_SQPSN_VALID; ocrdma_set_qp_params()
2648 cmd->params.hop_lmt_rq_psn |= (attrs->rq_psn & 0x00ffffff); ocrdma_set_qp_params()
2649 cmd->flags |= OCRDMA_QP_PARA_RQPSN_VALID; ocrdma_set_qp_params()
2657 cmd->flags |= OCRDMA_QP_PARA_MAX_ORD_VALID; ocrdma_set_qp_params()
2665 cmd->flags |= OCRDMA_QP_PARA_MAX_IRD_VALID; ocrdma_set_qp_params()
2667 cmd->params.max_ord_ird = (qp->max_ord << ocrdma_set_qp_params()
2678 struct ocrdma_modify_qp *cmd; ocrdma_mbx_modify_qp() local
2680 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_MODIFY_QP, sizeof(*cmd)); ocrdma_mbx_modify_qp()
2681 if (!cmd) ocrdma_mbx_modify_qp()
2684 cmd->params.id = qp->id; ocrdma_mbx_modify_qp()
2685 cmd->flags = 0; ocrdma_mbx_modify_qp()
2687 cmd->params.max_sge_recv_flags |= ocrdma_mbx_modify_qp()
2691 cmd->flags |= OCRDMA_QP_PARA_QPS_VALID; ocrdma_mbx_modify_qp()
2693 cmd->params.max_sge_recv_flags |= ocrdma_mbx_modify_qp()
2698 status = ocrdma_set_qp_params(qp, cmd, attrs, attr_mask); ocrdma_mbx_modify_qp()
2701 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_modify_qp()
2706 kfree(cmd); ocrdma_mbx_modify_qp()
2713 struct ocrdma_destroy_qp *cmd; ocrdma_mbx_destroy_qp() local
2716 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_DELETE_QP, sizeof(*cmd)); ocrdma_mbx_destroy_qp()
2717 if (!cmd) ocrdma_mbx_destroy_qp()
2719 cmd->qp_id = qp->id; ocrdma_mbx_destroy_qp()
2720 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_destroy_qp()
2725 kfree(cmd); ocrdma_mbx_destroy_qp()
2743 struct ocrdma_create_srq *cmd; ocrdma_mbx_create_srq() local
2748 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_CREATE_SRQ, sizeof(*cmd)); ocrdma_mbx_create_srq()
2749 if (!cmd) ocrdma_mbx_create_srq()
2752 cmd->pgsz_pdid = pd->id & OCRDMA_CREATE_SRQ_PD_ID_MASK; ocrdma_mbx_create_srq()
2769 ocrdma_build_q_pages(&cmd->rq_addr[0], hw_pages, pa, hw_page_size); ocrdma_mbx_create_srq()
2776 cmd->max_sge_rqe = ilog2(max_rqe_allocated); ocrdma_mbx_create_srq()
2777 cmd->max_sge_rqe |= srq_attr->attr.max_sge << ocrdma_mbx_create_srq()
2780 cmd->pgsz_pdid |= (ilog2(hw_page_size / OCRDMA_MIN_Q_PAGE_SIZE) ocrdma_mbx_create_srq()
2782 cmd->pages_rqe_sz |= (dev->attr.rqe_size ocrdma_mbx_create_srq()
2785 cmd->pages_rqe_sz |= hw_pages << OCRDMA_CREATE_SRQ_NUM_RQ_PAGES_SHIFT; ocrdma_mbx_create_srq()
2787 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_create_srq()
2790 rsp = (struct ocrdma_create_srq_rsp *)cmd; ocrdma_mbx_create_srq()
2806 kfree(cmd); ocrdma_mbx_create_srq()
2813 struct ocrdma_modify_srq *cmd; ocrdma_mbx_modify_srq() local
2817 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_MODIFY_SRQ, sizeof(*cmd)); ocrdma_mbx_modify_srq()
2818 if (!cmd) ocrdma_mbx_modify_srq()
2820 cmd->id = srq->id; ocrdma_mbx_modify_srq()
2821 cmd->limit_max_rqe |= srq_attr->srq_limit << ocrdma_mbx_modify_srq()
2823 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_modify_srq()
2824 kfree(cmd); ocrdma_mbx_modify_srq()
2831 struct ocrdma_query_srq *cmd; ocrdma_mbx_query_srq() local
2834 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_QUERY_SRQ, sizeof(*cmd)); ocrdma_mbx_query_srq()
2835 if (!cmd) ocrdma_mbx_query_srq()
2837 cmd->id = srq->rq.dbid; ocrdma_mbx_query_srq()
2838 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_query_srq()
2841 (struct ocrdma_query_srq_rsp *)cmd; ocrdma_mbx_query_srq()
2850 kfree(cmd); ocrdma_mbx_query_srq()
2857 struct ocrdma_destroy_srq *cmd; ocrdma_mbx_destroy_srq() local
2859 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_DELETE_SRQ, sizeof(*cmd)); ocrdma_mbx_destroy_srq()
2860 if (!cmd) ocrdma_mbx_destroy_srq()
2862 cmd->id = srq->id; ocrdma_mbx_destroy_srq()
2863 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_destroy_srq()
2867 kfree(cmd); ocrdma_mbx_destroy_srq()
2876 struct ocrdma_mqe cmd; ocrdma_mbx_get_dcbx_config() local
2881 struct ocrdma_mqe_sge *mqe_sge = cmd.u.nonemb_req.sge; ocrdma_mbx_get_dcbx_config()
2883 memset(&cmd, 0, sizeof(struct ocrdma_mqe)); ocrdma_mbx_get_dcbx_config()
2884 cmd.hdr.pyld_len = max_t (u32, sizeof(struct ocrdma_get_dcbx_cfg_rsp), ocrdma_mbx_get_dcbx_config()
2886 req = dma_alloc_coherent(&pdev->dev, cmd.hdr.pyld_len, &pa, GFP_KERNEL); ocrdma_mbx_get_dcbx_config()
2892 cmd.hdr.spcl_sge_cnt_emb |= (1 << OCRDMA_MQE_HDR_SGE_CNT_SHIFT) & ocrdma_mbx_get_dcbx_config()
2896 mqe_sge->len = cmd.hdr.pyld_len; ocrdma_mbx_get_dcbx_config()
2900 OCRDMA_SUBSYS_DCBX, cmd.hdr.pyld_len); ocrdma_mbx_get_dcbx_config()
2903 status = ocrdma_mbx_cmd(dev, &cmd); ocrdma_mbx_get_dcbx_config()
2912 dma_free_coherent(&pdev->dev, cmd.hdr.pyld_len, req, pa); ocrdma_mbx_get_dcbx_config()
3117 struct ocrdma_modify_eqd_req *cmd; ocrdma_mbx_modify_eqd() local
3119 cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_MODIFY_EQ_DELAY, sizeof(*cmd)); ocrdma_mbx_modify_eqd()
3120 if (!cmd) ocrdma_mbx_modify_eqd()
3123 ocrdma_init_mch(&cmd->cmd.req, OCRDMA_CMD_MODIFY_EQ_DELAY, ocrdma_mbx_modify_eqd()
3124 OCRDMA_SUBSYS_COMMON, sizeof(*cmd)); ocrdma_mbx_modify_eqd()
3126 cmd->cmd.num_eq = num; ocrdma_mbx_modify_eqd()
3128 cmd->cmd.set_eqd[i].eq_id = eq[i].q.id; ocrdma_mbx_modify_eqd()
3129 cmd->cmd.set_eqd[i].phase = 0; ocrdma_mbx_modify_eqd()
3130 cmd->cmd.set_eqd[i].delay_multiplier = ocrdma_mbx_modify_eqd()
3133 status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); ocrdma_mbx_modify_eqd()
3137 kfree(cmd); ocrdma_mbx_modify_eqd()
2494 ocrdma_set_av_params(struct ocrdma_qp *qp, struct ocrdma_modify_qp *cmd, struct ib_qp_attr *attrs, int attr_mask) ocrdma_set_av_params() argument
2565 ocrdma_set_qp_params(struct ocrdma_qp *qp, struct ocrdma_modify_qp *cmd, struct ib_qp_attr *attrs, int attr_mask) ocrdma_set_qp_params() argument
/linux-4.4.14/drivers/isdn/sc/
H A Devent.c43 isdn_ctrl cmd; indicate_status() local
54 memcpy(&cmd.parm.length, Data, sizeof(cmd.parm.length)); indicate_status()
57 memcpy(&cmd.parm.setup, Data, sizeof(cmd.parm.setup)); indicate_status()
60 strlcpy(cmd.parm.num, Data, sizeof(cmd.parm.num)); indicate_status()
64 cmd.command = event; indicate_status()
65 cmd.driver = sc_adapter[card]->driverId; indicate_status()
66 cmd.arg = Channel; indicate_status()
67 return sc_adapter[card]->card->statcallb(&cmd); indicate_status()
/linux-4.4.14/drivers/net/ethernet/qlogic/qlcnic/
H A Dqlcnic_sriov_pf.c29 u32 cmd; member in struct:qlcnic_sriov_fw_cmd_handler
37 struct qlcnic_cmd_args cmd; qlcnic_sriov_pf_set_vport_info() local
40 if (qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_NIC_INFO)) qlcnic_sriov_pf_set_vport_info()
43 cmd.req.arg[1] = (vport_id << 16) | 0x1; qlcnic_sriov_pf_set_vport_info()
44 cmd.req.arg[2] = npar_info->bit_offsets; qlcnic_sriov_pf_set_vport_info()
45 cmd.req.arg[2] |= npar_info->min_tx_bw << 16; qlcnic_sriov_pf_set_vport_info()
46 cmd.req.arg[3] = npar_info->max_tx_bw | (npar_info->max_tx_ques << 16); qlcnic_sriov_pf_set_vport_info()
47 cmd.req.arg[4] = npar_info->max_tx_mac_filters; qlcnic_sriov_pf_set_vport_info()
48 cmd.req.arg[4] |= npar_info->max_rx_mcast_mac_filters << 16; qlcnic_sriov_pf_set_vport_info()
49 cmd.req.arg[5] = npar_info->max_rx_ucast_mac_filters | qlcnic_sriov_pf_set_vport_info()
51 cmd.req.arg[6] = npar_info->max_rx_lro_flow | qlcnic_sriov_pf_set_vport_info()
53 cmd.req.arg[7] = npar_info->max_rx_buf_rings | qlcnic_sriov_pf_set_vport_info()
55 cmd.req.arg[8] = npar_info->max_tx_vlan_keys; qlcnic_sriov_pf_set_vport_info()
56 cmd.req.arg[8] |= npar_info->max_local_ipv6_addrs << 16; qlcnic_sriov_pf_set_vport_info()
57 cmd.req.arg[9] = npar_info->max_remote_ipv6_addrs; qlcnic_sriov_pf_set_vport_info()
59 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_sriov_pf_set_vport_info()
64 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_pf_set_vport_info()
179 struct qlcnic_cmd_args cmd; qlcnic_sriov_get_pf_info() local
181 if (qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_NIC_INFO)) qlcnic_sriov_get_pf_info()
184 cmd.req.arg[1] = 0x2; qlcnic_sriov_get_pf_info()
185 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_sriov_get_pf_info()
192 npar_info->total_pf = cmd.rsp.arg[2] & 0xff; qlcnic_sriov_get_pf_info()
193 npar_info->total_rss_engines = (cmd.rsp.arg[2] >> 8) & 0xff; qlcnic_sriov_get_pf_info()
194 npar_info->max_vports = MSW(cmd.rsp.arg[2]); qlcnic_sriov_get_pf_info()
195 npar_info->max_tx_ques = LSW(cmd.rsp.arg[3]); qlcnic_sriov_get_pf_info()
196 npar_info->max_tx_mac_filters = MSW(cmd.rsp.arg[3]); qlcnic_sriov_get_pf_info()
197 npar_info->max_rx_mcast_mac_filters = LSW(cmd.rsp.arg[4]); qlcnic_sriov_get_pf_info()
198 npar_info->max_rx_ucast_mac_filters = MSW(cmd.rsp.arg[4]); qlcnic_sriov_get_pf_info()
199 npar_info->max_rx_ip_addr = LSW(cmd.rsp.arg[5]); qlcnic_sriov_get_pf_info()
200 npar_info->max_rx_lro_flow = MSW(cmd.rsp.arg[5]); qlcnic_sriov_get_pf_info()
201 npar_info->max_rx_status_rings = LSW(cmd.rsp.arg[6]); qlcnic_sriov_get_pf_info()
202 npar_info->max_rx_buf_rings = MSW(cmd.rsp.arg[6]); qlcnic_sriov_get_pf_info()
203 npar_info->max_rx_ques = LSW(cmd.rsp.arg[7]); qlcnic_sriov_get_pf_info()
204 npar_info->max_tx_vlan_keys = MSW(cmd.rsp.arg[7]); qlcnic_sriov_get_pf_info()
205 npar_info->max_local_ipv6_addrs = LSW(cmd.rsp.arg[8]); qlcnic_sriov_get_pf_info()
206 npar_info->max_remote_ipv6_addrs = MSW(cmd.rsp.arg[8]); qlcnic_sriov_get_pf_info()
229 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_get_pf_info()
292 struct qlcnic_cmd_args cmd; qlcnic_sriov_pf_config_vport() local
296 if (qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIG_VPORT)) qlcnic_sriov_pf_config_vport()
300 cmd.req.arg[3] = func << 8; qlcnic_sriov_pf_config_vport()
307 cmd.req.arg[3] = ((vpid & 0xffff) << 8) | 1; qlcnic_sriov_pf_config_vport()
310 ret = qlcnic_issue_cmd(adapter, &cmd); qlcnic_sriov_pf_config_vport()
319 vpid = cmd.rsp.arg[2] & 0xffff; qlcnic_sriov_pf_config_vport()
326 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_pf_config_vport()
333 struct qlcnic_cmd_args cmd; qlcnic_sriov_pf_cfg_vlan_filtering() local
336 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_NIC_INFO); qlcnic_sriov_pf_cfg_vlan_filtering()
340 cmd.req.arg[1] = 0x4; qlcnic_sriov_pf_cfg_vlan_filtering()
343 cmd.req.arg[1] |= BIT_16; qlcnic_sriov_pf_cfg_vlan_filtering()
345 cmd.req.arg[1] |= QLC_SRIOV_ALLOW_VLAN0; qlcnic_sriov_pf_cfg_vlan_filtering()
350 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_sriov_pf_cfg_vlan_filtering()
355 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_pf_cfg_vlan_filtering()
362 struct qlcnic_cmd_args cmd; qlcnic_sriov_pf_cfg_flood() local
365 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_NIC_INFO); qlcnic_sriov_pf_cfg_flood()
369 cmd.req.arg[1] = QLC_FLOOD_MODE | QLC_VF_FLOOD_BIT; qlcnic_sriov_pf_cfg_flood()
371 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_sriov_pf_cfg_flood()
377 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_pf_cfg_flood()
384 struct qlcnic_cmd_args cmd; qlcnic_sriov_pf_cfg_eswitch() local
387 if (qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_TOGGLE_ESWITCH)) qlcnic_sriov_pf_cfg_eswitch()
390 cmd.req.arg[0] |= (3 << 29); qlcnic_sriov_pf_cfg_eswitch()
391 cmd.req.arg[1] = ((func & 0xf) << 2) | BIT_6 | BIT_1; qlcnic_sriov_pf_cfg_eswitch()
393 cmd.req.arg[1] |= BIT_0; qlcnic_sriov_pf_cfg_eswitch()
395 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_sriov_pf_cfg_eswitch()
403 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_pf_cfg_eswitch()
685 struct qlcnic_cmd_args cmd; qlcnic_sriov_set_vf_acl() local
695 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_NIC_INFO); qlcnic_sriov_set_vf_acl()
699 cmd.req.arg[1] = 0x3 | func << 16; qlcnic_sriov_set_vf_acl()
702 cmd.req.arg[2] |= BIT_1 | BIT_3 | BIT_8; qlcnic_sriov_set_vf_acl()
703 cmd.req.arg[4] = mac[5] | mac[4] << 8 | mac[3] << 16 | qlcnic_sriov_set_vf_acl()
705 cmd.req.arg[5] = mac[1] | mac[0] << 8; qlcnic_sriov_set_vf_acl()
709 cmd.req.arg[2] |= BIT_6; qlcnic_sriov_set_vf_acl()
710 cmd.req.arg[3] |= vp->pvid << 8; qlcnic_sriov_set_vf_acl()
713 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_sriov_set_vf_acl()
718 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_set_vf_acl()
740 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_channel_cfg_cmd()
773 cmd->rsp.arg[0] |= (1 << 25); qlcnic_sriov_pf_channel_cfg_cmd()
783 cmd->rsp.arg[0] |= (2 << 25); qlcnic_sriov_pf_channel_cfg_cmd()
791 struct qlcnic_cmd_args *cmd; qlcnic_sriov_cfg_vf_def_mac() local
801 cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC); qlcnic_sriov_cfg_vf_def_mac()
802 if (!cmd) qlcnic_sriov_cfg_vf_def_mac()
805 err = qlcnic_alloc_mbx_args(cmd, adapter, QLCNIC_CMD_CONFIG_MAC_VLAN); qlcnic_sriov_cfg_vf_def_mac()
809 cmd->type = QLC_83XX_MBX_CMD_NO_WAIT; qlcnic_sriov_cfg_vf_def_mac()
820 cmd->req.arg[1] = op | (1 << 8) | (3 << 6); qlcnic_sriov_cfg_vf_def_mac()
821 cmd->req.arg[1] |= ((vpid & 0xffff) << 16) | BIT_31; qlcnic_sriov_cfg_vf_def_mac()
831 buf = &cmd->req.arg[2]; qlcnic_sriov_cfg_vf_def_mac()
834 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_cfg_vf_def_mac()
840 qlcnic_free_mbx_args(cmd); qlcnic_sriov_cfg_vf_def_mac()
842 kfree(cmd); qlcnic_sriov_cfg_vf_def_mac()
846 static int qlcnic_sriov_validate_create_rx_ctx(struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_create_rx_ctx() argument
848 if ((cmd->req.arg[0] >> 29) != 0x3) qlcnic_sriov_validate_create_rx_ctx()
884 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_create_rx_ctx_cmd()
891 err = qlcnic_sriov_validate_create_rx_ctx(cmd); qlcnic_sriov_pf_create_rx_ctx_cmd()
893 cmd->rsp.arg[0] |= (0x6 << 25); qlcnic_sriov_pf_create_rx_ctx_cmd()
897 cmd->req.arg[6] = vf->vp->handle; qlcnic_sriov_pf_create_rx_ctx_cmd()
898 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_create_rx_ctx_cmd()
901 mbx_out = (struct qlcnic_rcv_mbx_out *)&cmd->rsp.arg[1]; qlcnic_sriov_pf_create_rx_ctx_cmd()
912 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_mac_address_cmd()
917 type = cmd->req.arg[1]; qlcnic_sriov_pf_mac_address_cmd()
921 cmd->rsp.arg[0] = (2 << 25); qlcnic_sriov_pf_mac_address_cmd()
924 cmd->rsp.arg[0] = (1 << 25); qlcnic_sriov_pf_mac_address_cmd()
926 cmd->rsp.arg[2] = mac[1] | ((mac[0] << 8) & 0xff00); qlcnic_sriov_pf_mac_address_cmd()
927 cmd->rsp.arg[1] = mac[5] | ((mac[4] << 8) & 0xff00) | qlcnic_sriov_pf_mac_address_cmd()
935 static int qlcnic_sriov_validate_create_tx_ctx(struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_create_tx_ctx() argument
937 if ((cmd->req.arg[0] >> 29) != 0x3) qlcnic_sriov_validate_create_tx_ctx()
944 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_create_tx_ctx_cmd()
951 err = qlcnic_sriov_validate_create_tx_ctx(cmd); qlcnic_sriov_pf_create_tx_ctx_cmd()
953 cmd->rsp.arg[0] |= (0x6 << 25); qlcnic_sriov_pf_create_tx_ctx_cmd()
957 cmd->req.arg[5] |= vf->vp->handle << 16; qlcnic_sriov_pf_create_tx_ctx_cmd()
958 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_create_tx_ctx_cmd()
960 mbx_out = (struct qlcnic_tx_mbx_out *)&cmd->rsp.arg[2]; qlcnic_sriov_pf_create_tx_ctx_cmd()
970 struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_del_rx_ctx()
972 if ((cmd->req.arg[0] >> 29) != 0x3) qlcnic_sriov_validate_del_rx_ctx()
975 if ((cmd->req.arg[1] & 0xffff) != vf->rx_ctx_id) qlcnic_sriov_validate_del_rx_ctx()
982 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_del_rx_ctx_cmd()
988 err = qlcnic_sriov_validate_del_rx_ctx(vf, cmd); qlcnic_sriov_pf_del_rx_ctx_cmd()
990 cmd->rsp.arg[0] |= (0x6 << 25); qlcnic_sriov_pf_del_rx_ctx_cmd()
995 cmd->req.arg[1] |= vf->vp->handle << 16; qlcnic_sriov_pf_del_rx_ctx_cmd()
996 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_del_rx_ctx_cmd()
1005 struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_del_tx_ctx()
1007 if ((cmd->req.arg[0] >> 29) != 0x3) qlcnic_sriov_validate_del_tx_ctx()
1010 if ((cmd->req.arg[1] & 0xffff) != vf->tx_ctx_id) qlcnic_sriov_validate_del_tx_ctx()
1017 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_del_tx_ctx_cmd()
1023 err = qlcnic_sriov_validate_del_tx_ctx(vf, cmd); qlcnic_sriov_pf_del_tx_ctx_cmd()
1025 cmd->rsp.arg[0] |= (0x6 << 25); qlcnic_sriov_pf_del_tx_ctx_cmd()
1029 cmd->req.arg[1] |= vf->vp->handle << 16; qlcnic_sriov_pf_del_tx_ctx_cmd()
1030 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_del_tx_ctx_cmd()
1039 struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_cfg_lro()
1041 if ((cmd->req.arg[1] >> 16) != vf->rx_ctx_id) qlcnic_sriov_validate_cfg_lro()
1048 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_lro_cmd()
1054 err = qlcnic_sriov_validate_cfg_lro(vf, cmd); qlcnic_sriov_pf_cfg_lro_cmd()
1056 cmd->rsp.arg[0] |= (0x6 << 25); qlcnic_sriov_pf_cfg_lro_cmd()
1060 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_cfg_lro_cmd()
1065 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_ip_cmd()
1072 op = cmd->req.arg[1] & 0xff; qlcnic_sriov_pf_cfg_ip_cmd()
1074 cmd->req.arg[1] |= vf->vp->handle << 16; qlcnic_sriov_pf_cfg_ip_cmd()
1075 cmd->req.arg[1] |= BIT_31; qlcnic_sriov_pf_cfg_ip_cmd()
1077 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_cfg_ip_cmd()
1082 struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_cfg_intrpt()
1084 if (((cmd->req.arg[1] >> 8) & 0xff) != vf->pci_func) qlcnic_sriov_validate_cfg_intrpt()
1087 if (!(cmd->req.arg[1] & BIT_16)) qlcnic_sriov_validate_cfg_intrpt()
1090 if ((cmd->req.arg[1] & 0xff) != 0x1) qlcnic_sriov_validate_cfg_intrpt()
1097 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_intrpt_cmd()
1103 err = qlcnic_sriov_validate_cfg_intrpt(vf, cmd); qlcnic_sriov_pf_cfg_intrpt_cmd()
1105 cmd->rsp.arg[0] |= (0x6 << 25); qlcnic_sriov_pf_cfg_intrpt_cmd()
1107 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_cfg_intrpt_cmd()
1114 struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_mtu()
1116 if (cmd->req.arg[1] != vf->rx_ctx_id) qlcnic_sriov_validate_mtu()
1119 if (cmd->req.arg[2] > adapter->ahw->max_mtu) qlcnic_sriov_validate_mtu()
1126 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_set_mtu_cmd()
1132 err = qlcnic_sriov_validate_mtu(adapter, vf, cmd); qlcnic_sriov_pf_set_mtu_cmd()
1134 cmd->rsp.arg[0] |= (0x6 << 25); qlcnic_sriov_pf_set_mtu_cmd()
1136 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_set_mtu_cmd()
1142 struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_get_nic_info()
1144 if (cmd->req.arg[1] & BIT_31) { qlcnic_sriov_validate_get_nic_info()
1145 if (((cmd->req.arg[1] >> 16) & 0x7fff) != vf->pci_func) qlcnic_sriov_validate_get_nic_info()
1148 cmd->req.arg[1] |= vf->vp->handle << 16; qlcnic_sriov_validate_get_nic_info()
1155 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_get_nic_info_cmd()
1161 err = qlcnic_sriov_validate_get_nic_info(vf, cmd); qlcnic_sriov_pf_get_nic_info_cmd()
1163 cmd->rsp.arg[0] |= (0x6 << 25); qlcnic_sriov_pf_get_nic_info_cmd()
1167 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_get_nic_info_cmd()
1172 struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_cfg_rss()
1174 if (cmd->req.arg[1] != vf->rx_ctx_id) qlcnic_sriov_validate_cfg_rss()
1181 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_rss_cmd()
1187 err = qlcnic_sriov_validate_cfg_rss(vf, cmd); qlcnic_sriov_pf_cfg_rss_cmd()
1189 cmd->rsp.arg[0] |= (0x6 << 25); qlcnic_sriov_pf_cfg_rss_cmd()
1191 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_cfg_rss_cmd()
1198 struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_cfg_intrcoal()
1205 type = cmd->req.arg[1] & QLC_INTR_COAL_TYPE_MASK; qlcnic_sriov_validate_cfg_intrcoal()
1206 ctx_id = cmd->req.arg[1] >> 16; qlcnic_sriov_validate_cfg_intrcoal()
1207 pkts = cmd->req.arg[2] & 0xffff; qlcnic_sriov_validate_cfg_intrcoal()
1208 time = cmd->req.arg[2] >> 16; qlcnic_sriov_validate_cfg_intrcoal()
1240 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_intrcoal_cmd()
1246 err = qlcnic_sriov_validate_cfg_intrcoal(adapter, vf, cmd); qlcnic_sriov_pf_cfg_intrcoal_cmd()
1248 cmd->rsp.arg[0] |= (0x6 << 25); qlcnic_sriov_pf_cfg_intrcoal_cmd()
1252 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_cfg_intrcoal_cmd()
1258 struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_cfg_macvlan()
1263 if (!(cmd->req.arg[1] & BIT_8)) qlcnic_sriov_validate_cfg_macvlan()
1266 cmd->req.arg[1] |= (vf->vp->handle << 16); qlcnic_sriov_validate_cfg_macvlan()
1267 cmd->req.arg[1] |= BIT_31; qlcnic_sriov_validate_cfg_macvlan()
1270 op = cmd->req.arg[1] & 0x7; qlcnic_sriov_validate_cfg_macvlan()
1271 cmd->req.arg[1] &= ~0x7; qlcnic_sriov_validate_cfg_macvlan()
1274 cmd->req.arg[3] |= vp->pvid << 16; qlcnic_sriov_validate_cfg_macvlan()
1275 cmd->req.arg[1] |= new_op; qlcnic_sriov_validate_cfg_macvlan()
1282 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_macvlan_cmd()
1288 err = qlcnic_sriov_validate_cfg_macvlan(adapter, vf, cmd); qlcnic_sriov_pf_cfg_macvlan_cmd()
1290 cmd->rsp.arg[0] |= (0x6 << 25); qlcnic_sriov_pf_cfg_macvlan_cmd()
1294 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_cfg_macvlan_cmd()
1299 struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_linkevent()
1301 if ((cmd->req.arg[1] >> 16) != vf->rx_ctx_id) qlcnic_sriov_validate_linkevent()
1308 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_linkevent_cmd()
1314 err = qlcnic_sriov_validate_linkevent(vf, cmd); qlcnic_sriov_pf_linkevent_cmd()
1316 cmd->rsp.arg[0] |= (0x6 << 25); qlcnic_sriov_pf_linkevent_cmd()
1320 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_linkevent_cmd()
1325 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_promisc_cmd()
1331 cmd->req.arg[1] |= vf->vp->handle << 16; qlcnic_sriov_pf_cfg_promisc_cmd()
1332 cmd->req.arg[1] |= BIT_31; qlcnic_sriov_pf_cfg_promisc_cmd()
1333 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_cfg_promisc_cmd()
1338 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_get_acl_cmd()
1350 cmd->rsp.arg[0] |= 1 << 25; qlcnic_sriov_pf_get_acl_cmd()
1360 cmd->rsp.arg[1] = mode | 1 << 8; qlcnic_sriov_pf_get_acl_cmd()
1361 cmd->rsp.arg[2] = sriov->num_allowed_vlans << 16; qlcnic_sriov_pf_get_acl_cmd()
1364 cmd->rsp.arg[1] = mode | 1 << 8 | vp->pvid << 16; qlcnic_sriov_pf_get_acl_cmd()
1373 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_del_guest_vlan()
1381 vlan = cmd->req.arg[1] >> 16; qlcnic_sriov_pf_del_guest_vlan()
1398 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_add_guest_vlan()
1407 vlan = cmd->req.arg[1] >> 16; qlcnic_sriov_pf_add_guest_vlan()
1435 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_guest_vlan_cmd()
1444 cmd->rsp.arg[0] |= 2 << 25; qlcnic_sriov_pf_cfg_guest_vlan_cmd()
1448 op = cmd->req.arg[1] & 0xf; qlcnic_sriov_pf_cfg_guest_vlan_cmd()
1451 err = qlcnic_sriov_pf_add_guest_vlan(adapter, vf, cmd); qlcnic_sriov_pf_cfg_guest_vlan_cmd()
1453 err = qlcnic_sriov_pf_del_guest_vlan(adapter, vf, cmd); qlcnic_sriov_pf_cfg_guest_vlan_cmd()
1455 cmd->rsp.arg[0] |= err ? 2 << 25 : 1 << 25; qlcnic_sriov_pf_cfg_guest_vlan_cmd()
1494 struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_process_bc_cmd()
1503 qlcnic_pf_bc_cmd_hdlr[cmd_op].fn(trans, cmd); qlcnic_sriov_pf_process_bc_cmd()
1510 if (cmd_op == qlcnic_pf_fw_cmd_hdlr[i].cmd) { qlcnic_sriov_pf_process_bc_cmd()
1511 qlcnic_pf_fw_cmd_hdlr[i].fn(trans, cmd); qlcnic_sriov_pf_process_bc_cmd()
1519 qlcnic_issue_cmd(adapter, cmd); qlcnic_sriov_pf_process_bc_cmd()
1525 cmd->rsp.arg[0] |= (0x9 << 25); qlcnic_sriov_pf_process_bc_cmd()
1601 struct qlcnic_cmd_args cmd; qlcnic_sriov_del_rx_ctx() local
1607 if (qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DESTROY_RX_CTX)) qlcnic_sriov_del_rx_ctx()
1612 cmd.req.arg[1] = vf->rx_ctx_id | (vpid & 0xffff) << 16; qlcnic_sriov_del_rx_ctx()
1613 if (qlcnic_issue_cmd(adapter, &cmd)) qlcnic_sriov_del_rx_ctx()
1621 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_del_rx_ctx()
1627 struct qlcnic_cmd_args cmd; qlcnic_sriov_del_tx_ctx() local
1633 if (qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DESTROY_TX_CTX)) qlcnic_sriov_del_tx_ctx()
1638 cmd.req.arg[1] |= vf->tx_ctx_id | (vpid & 0xffff) << 16; qlcnic_sriov_del_tx_ctx()
1639 if (qlcnic_issue_cmd(adapter, &cmd)) qlcnic_sriov_del_tx_ctx()
1647 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_del_tx_ctx()
739 qlcnic_sriov_pf_channel_cfg_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_channel_cfg_cmd() argument
883 qlcnic_sriov_pf_create_rx_ctx_cmd(struct qlcnic_bc_trans *tran, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_create_rx_ctx_cmd() argument
911 qlcnic_sriov_pf_mac_address_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_mac_address_cmd() argument
943 qlcnic_sriov_pf_create_tx_ctx_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_create_tx_ctx_cmd() argument
969 qlcnic_sriov_validate_del_rx_ctx(struct qlcnic_vf_info *vf, struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_del_rx_ctx() argument
981 qlcnic_sriov_pf_del_rx_ctx_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_del_rx_ctx_cmd() argument
1004 qlcnic_sriov_validate_del_tx_ctx(struct qlcnic_vf_info *vf, struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_del_tx_ctx() argument
1016 qlcnic_sriov_pf_del_tx_ctx_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_del_tx_ctx_cmd() argument
1038 qlcnic_sriov_validate_cfg_lro(struct qlcnic_vf_info *vf, struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_cfg_lro() argument
1047 qlcnic_sriov_pf_cfg_lro_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_lro_cmd() argument
1064 qlcnic_sriov_pf_cfg_ip_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_ip_cmd() argument
1081 qlcnic_sriov_validate_cfg_intrpt(struct qlcnic_vf_info *vf, struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_cfg_intrpt() argument
1096 qlcnic_sriov_pf_cfg_intrpt_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_intrpt_cmd() argument
1112 qlcnic_sriov_validate_mtu(struct qlcnic_adapter *adapter, struct qlcnic_vf_info *vf, struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_mtu() argument
1125 qlcnic_sriov_pf_set_mtu_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_set_mtu_cmd() argument
1141 qlcnic_sriov_validate_get_nic_info(struct qlcnic_vf_info *vf, struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_get_nic_info() argument
1154 qlcnic_sriov_pf_get_nic_info_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_get_nic_info_cmd() argument
1171 qlcnic_sriov_validate_cfg_rss(struct qlcnic_vf_info *vf, struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_cfg_rss() argument
1180 qlcnic_sriov_pf_cfg_rss_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_rss_cmd() argument
1196 qlcnic_sriov_validate_cfg_intrcoal(struct qlcnic_adapter *adapter, struct qlcnic_vf_info *vf, struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_cfg_intrcoal() argument
1239 qlcnic_sriov_pf_cfg_intrcoal_cmd(struct qlcnic_bc_trans *tran, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_intrcoal_cmd() argument
1256 qlcnic_sriov_validate_cfg_macvlan(struct qlcnic_adapter *adapter, struct qlcnic_vf_info *vf, struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_cfg_macvlan() argument
1281 qlcnic_sriov_pf_cfg_macvlan_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_macvlan_cmd() argument
1298 qlcnic_sriov_validate_linkevent(struct qlcnic_vf_info *vf, struct qlcnic_cmd_args *cmd) qlcnic_sriov_validate_linkevent() argument
1307 qlcnic_sriov_pf_linkevent_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_linkevent_cmd() argument
1324 qlcnic_sriov_pf_cfg_promisc_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_promisc_cmd() argument
1337 qlcnic_sriov_pf_get_acl_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_get_acl_cmd() argument
1371 qlcnic_sriov_pf_del_guest_vlan(struct qlcnic_adapter *adapter, struct qlcnic_vf_info *vf, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_del_guest_vlan() argument
1396 qlcnic_sriov_pf_add_guest_vlan(struct qlcnic_adapter *adapter, struct qlcnic_vf_info *vf, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_add_guest_vlan() argument
1434 qlcnic_sriov_pf_cfg_guest_vlan_cmd(struct qlcnic_bc_trans *tran, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_cfg_guest_vlan_cmd() argument
1492 qlcnic_sriov_pf_process_bc_cmd(struct qlcnic_adapter *adapter, struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) qlcnic_sriov_pf_process_bc_cmd() argument
H A Dqlcnic_ctx.c62 if (type == mbx_tbl[i].cmd) { qlcnic_82xx_alloc_mbx_args()
84 void qlcnic_free_mbx_args(struct qlcnic_cmd_args *cmd) qlcnic_free_mbx_args() argument
86 kfree(cmd->req.arg); qlcnic_free_mbx_args()
87 cmd->req.arg = NULL; qlcnic_free_mbx_args()
88 kfree(cmd->rsp.arg); qlcnic_free_mbx_args()
89 cmd->rsp.arg = NULL; qlcnic_free_mbx_args()
112 struct qlcnic_cmd_args *cmd) qlcnic_82xx_issue_cmd()
125 cmd->rsp.arg[0] = QLCNIC_RCODE_TIMEOUT; qlcnic_82xx_issue_cmd()
126 return cmd->rsp.arg[0]; qlcnic_82xx_issue_cmd()
130 for (i = 1; i < cmd->req.num; i++) qlcnic_82xx_issue_cmd()
131 QLCWR32(adapter, QLCNIC_CDRP_ARG(i), cmd->req.arg[i]); qlcnic_82xx_issue_cmd()
133 QLCNIC_CDRP_FORM_CMD(cmd->req.arg[0])); qlcnic_82xx_issue_cmd()
138 cmd->rsp.arg[0] = QLCNIC_RCODE_TIMEOUT; qlcnic_82xx_issue_cmd()
140 cmd->rsp.arg[0] = QLCRD32(adapter, QLCNIC_CDRP_ARG(1), &err); qlcnic_82xx_issue_cmd()
141 switch (cmd->rsp.arg[0]) { qlcnic_82xx_issue_cmd()
153 fmt = "CDRP invalid or unknown cmd received: [%d]\n"; qlcnic_82xx_issue_cmd()
162 dev_err(&pdev->dev, fmt, cmd->rsp.arg[0]); qlcnic_82xx_issue_cmd()
163 qlcnic_dump_mbx(adapter, cmd); qlcnic_82xx_issue_cmd()
165 cmd->rsp.arg[0] = QLCNIC_RCODE_SUCCESS; qlcnic_82xx_issue_cmd()
167 for (i = 1; i < cmd->rsp.num; i++) qlcnic_82xx_issue_cmd()
168 cmd->rsp.arg[i] = QLCRD32(adapter, QLCNIC_CDRP_ARG(i), &err); qlcnic_82xx_issue_cmd()
172 return cmd->rsp.arg[0]; qlcnic_82xx_issue_cmd()
177 struct qlcnic_cmd_args cmd; qlcnic_fw_cmd_set_drv_version() local
187 err = qlcnic_alloc_mbx_args(&cmd, adapter, fw_cmd); qlcnic_fw_cmd_set_drv_version()
195 cmd.req.arg[1] = arg1; qlcnic_fw_cmd_set_drv_version()
196 cmd.req.arg[2] = arg2; qlcnic_fw_cmd_set_drv_version()
197 cmd.req.arg[3] = arg3; qlcnic_fw_cmd_set_drv_version()
199 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_fw_cmd_set_drv_version()
205 qlcnic_free_mbx_args(&cmd); qlcnic_fw_cmd_set_drv_version()
213 struct qlcnic_cmd_args cmd; qlcnic_fw_cmd_set_mtu() local
218 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_MTU); qlcnic_fw_cmd_set_mtu()
222 cmd.req.arg[1] = recv_ctx->context_id; qlcnic_fw_cmd_set_mtu()
223 cmd.req.arg[2] = mtu; qlcnic_fw_cmd_set_mtu()
225 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_fw_cmd_set_mtu()
230 qlcnic_free_mbx_args(&cmd); qlcnic_fw_cmd_set_mtu()
250 struct qlcnic_cmd_args cmd; qlcnic_82xx_fw_cmd_create_rx_ctx() local
338 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CREATE_RX_CTX); qlcnic_82xx_fw_cmd_create_rx_ctx()
342 cmd.req.arg[1] = MSD(phys_addr); qlcnic_82xx_fw_cmd_create_rx_ctx()
343 cmd.req.arg[2] = LSD(phys_addr); qlcnic_82xx_fw_cmd_create_rx_ctx()
344 cmd.req.arg[3] = rq_size; qlcnic_82xx_fw_cmd_create_rx_ctx()
345 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_82xx_fw_cmd_create_rx_ctx()
382 qlcnic_free_mbx_args(&cmd); qlcnic_82xx_fw_cmd_create_rx_ctx()
396 struct qlcnic_cmd_args cmd; qlcnic_82xx_fw_cmd_del_rx_ctx() local
399 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DESTROY_RX_CTX); qlcnic_82xx_fw_cmd_del_rx_ctx()
403 cmd.req.arg[1] = recv_ctx->context_id; qlcnic_82xx_fw_cmd_del_rx_ctx()
404 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_82xx_fw_cmd_del_rx_ctx()
410 qlcnic_free_mbx_args(&cmd); qlcnic_82xx_fw_cmd_del_rx_ctx()
422 struct qlcnic_cmd_args cmd; qlcnic_82xx_fw_cmd_create_tx_ctx() local
484 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CREATE_TX_CTX); qlcnic_82xx_fw_cmd_create_tx_ctx()
488 cmd.req.arg[1] = MSD(phys_addr); qlcnic_82xx_fw_cmd_create_tx_ctx()
489 cmd.req.arg[2] = LSD(phys_addr); qlcnic_82xx_fw_cmd_create_tx_ctx()
490 cmd.req.arg[3] = rq_size; qlcnic_82xx_fw_cmd_create_tx_ctx()
491 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_82xx_fw_cmd_create_tx_ctx()
513 qlcnic_free_mbx_args(&cmd); qlcnic_82xx_fw_cmd_create_tx_ctx()
527 struct qlcnic_cmd_args cmd; qlcnic_82xx_fw_cmd_del_tx_ctx() local
530 ret = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DESTROY_TX_CTX); qlcnic_82xx_fw_cmd_del_tx_ctx()
534 cmd.req.arg[1] = tx_ring->ctx_id; qlcnic_82xx_fw_cmd_del_tx_ctx()
535 if (qlcnic_issue_cmd(adapter, &cmd)) qlcnic_82xx_fw_cmd_del_tx_ctx()
538 qlcnic_free_mbx_args(&cmd); qlcnic_82xx_fw_cmd_del_tx_ctx()
545 struct qlcnic_cmd_args cmd; qlcnic_fw_cmd_set_port() local
547 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIG_PORT); qlcnic_fw_cmd_set_port()
551 cmd.req.arg[1] = config; qlcnic_fw_cmd_set_port()
552 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_fw_cmd_set_port()
553 qlcnic_free_mbx_args(&cmd); qlcnic_fw_cmd_set_port()
580 /* cmd desc ring */ qlcnic_alloc_hw_resources()
770 struct qlcnic_cmd_args cmd; qlcnic_82xx_config_intrpt() local
775 err = qlcnic_alloc_mbx_args(&cmd, adapter, qlcnic_82xx_config_intrpt()
783 cmd.req.arg[1] = val; qlcnic_82xx_config_intrpt()
784 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_82xx_config_intrpt()
789 qlcnic_free_mbx_args(&cmd); qlcnic_82xx_config_intrpt()
792 val = cmd.rsp.arg[1]; qlcnic_82xx_config_intrpt()
802 ahw->intr_tbl[i].src = cmd.rsp.arg[2]; qlcnic_82xx_config_intrpt()
808 qlcnic_free_mbx_args(&cmd); qlcnic_82xx_config_intrpt()
818 struct qlcnic_cmd_args cmd; qlcnic_82xx_get_mac_address() local
821 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_MAC_ADDRESS); qlcnic_82xx_get_mac_address()
825 cmd.req.arg[1] = function | BIT_8; qlcnic_82xx_get_mac_address()
826 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_82xx_get_mac_address()
829 mac_low = cmd.rsp.arg[1]; qlcnic_82xx_get_mac_address()
830 mac_high = cmd.rsp.arg[2]; qlcnic_82xx_get_mac_address()
841 qlcnic_free_mbx_args(&cmd); qlcnic_82xx_get_mac_address()
853 struct qlcnic_cmd_args cmd; qlcnic_82xx_get_nic_info() local
863 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_NIC_INFO); qlcnic_82xx_get_nic_info()
867 cmd.req.arg[1] = MSD(nic_dma_t); qlcnic_82xx_get_nic_info()
868 cmd.req.arg[2] = LSD(nic_dma_t); qlcnic_82xx_get_nic_info()
869 cmd.req.arg[3] = (func_id << 16 | nic_size); qlcnic_82xx_get_nic_info()
870 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_82xx_get_nic_info()
888 qlcnic_free_mbx_args(&cmd); qlcnic_82xx_get_nic_info()
903 struct qlcnic_cmd_args cmd; qlcnic_82xx_set_nic_info() local
928 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_NIC_INFO); qlcnic_82xx_set_nic_info()
932 cmd.req.arg[1] = MSD(nic_dma_t); qlcnic_82xx_set_nic_info()
933 cmd.req.arg[2] = LSD(nic_dma_t); qlcnic_82xx_set_nic_info()
934 cmd.req.arg[3] = ((nic->pci_func << 16) | nic_size); qlcnic_82xx_set_nic_info()
935 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_82xx_set_nic_info()
943 qlcnic_free_mbx_args(&cmd); qlcnic_82xx_set_nic_info()
960 struct qlcnic_cmd_args cmd; qlcnic_82xx_get_pci_info() local
971 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_PCI_INFO); qlcnic_82xx_get_pci_info()
975 cmd.req.arg[1] = MSD(pci_info_dma_t); qlcnic_82xx_get_pci_info()
976 cmd.req.arg[2] = LSD(pci_info_dma_t); qlcnic_82xx_get_pci_info()
977 cmd.req.arg[3] = pci_size; qlcnic_82xx_get_pci_info()
978 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_82xx_get_pci_info()
1012 qlcnic_free_mbx_args(&cmd); qlcnic_82xx_get_pci_info()
1025 struct qlcnic_cmd_args cmd; qlcnic_config_port_mirroring() local
1039 err = qlcnic_alloc_mbx_args(&cmd, adapter, qlcnic_config_port_mirroring()
1044 cmd.req.arg[1] = arg1; qlcnic_config_port_mirroring()
1045 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_config_port_mirroring()
1053 qlcnic_free_mbx_args(&cmd); qlcnic_config_port_mirroring()
1066 struct qlcnic_cmd_args cmd; qlcnic_get_port_stats() local
1087 err = qlcnic_alloc_mbx_args(&cmd, adapter, qlcnic_get_port_stats()
1092 cmd.req.arg[1] = arg1; qlcnic_get_port_stats()
1093 cmd.req.arg[2] = MSD(stats_dma_t); qlcnic_get_port_stats()
1094 cmd.req.arg[3] = LSD(stats_dma_t); qlcnic_get_port_stats()
1095 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_get_port_stats()
1113 qlcnic_free_mbx_args(&cmd); qlcnic_get_port_stats()
1126 struct qlcnic_cmd_args cmd; qlcnic_get_mac_stats() local
1140 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_MAC_STATS); qlcnic_get_mac_stats()
1144 cmd.req.arg[1] = stats_size << 16; qlcnic_get_mac_stats()
1145 cmd.req.arg[2] = MSD(stats_dma_t); qlcnic_get_mac_stats()
1146 cmd.req.arg[3] = LSD(stats_dma_t); qlcnic_get_mac_stats()
1147 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_get_mac_stats()
1174 qlcnic_free_mbx_args(&cmd); qlcnic_get_mac_stats()
1241 struct qlcnic_cmd_args cmd; qlcnic_clear_esw_stats() local
1264 err = qlcnic_alloc_mbx_args(&cmd, adapter, qlcnic_clear_esw_stats()
1269 cmd.req.arg[1] = arg1; qlcnic_clear_esw_stats()
1270 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_clear_esw_stats()
1271 qlcnic_free_mbx_args(&cmd); qlcnic_clear_esw_stats()
1285 struct qlcnic_cmd_args cmd; __qlcnic_get_eswitch_port_config() local
1289 err = qlcnic_alloc_mbx_args(&cmd, adapter, __qlcnic_get_eswitch_port_config()
1294 cmd.req.arg[1] = *arg1; __qlcnic_get_eswitch_port_config()
1295 err = qlcnic_issue_cmd(adapter, &cmd); __qlcnic_get_eswitch_port_config()
1296 *arg1 = cmd.rsp.arg[1]; __qlcnic_get_eswitch_port_config()
1297 *arg2 = cmd.rsp.arg[2]; __qlcnic_get_eswitch_port_config()
1298 qlcnic_free_mbx_args(&cmd); __qlcnic_get_eswitch_port_config()
1319 struct qlcnic_cmd_args cmd; qlcnic_config_switch_port() local
1378 err = qlcnic_alloc_mbx_args(&cmd, adapter, qlcnic_config_switch_port()
1383 cmd.req.arg[1] = arg1; qlcnic_config_switch_port()
1384 cmd.req.arg[2] = arg2; qlcnic_config_switch_port()
1385 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_config_switch_port()
1386 qlcnic_free_mbx_args(&cmd); qlcnic_config_switch_port()
111 qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) qlcnic_82xx_issue_cmd() argument
H A Dqlcnic_83xx_hw.c449 struct qlcnic_cmd_args *cmd) qlcnic_83xx_get_mbx_data()
453 if (cmd->op_type == QLC_83XX_MBX_POST_BC_OP) qlcnic_83xx_get_mbx_data()
456 for (i = 0; i < cmd->rsp.num; i++) qlcnic_83xx_get_mbx_data()
457 cmd->rsp.arg[i] = readl(QLCNIC_MBX_FW(adapter->ahw, i)); qlcnic_83xx_get_mbx_data()
798 struct qlcnic_cmd_args *cmd) qlcnic_dump_mbx()
802 if (cmd->op_type == QLC_83XX_MBX_POST_BC_OP) qlcnic_dump_mbx()
806 "Host MBX regs(%d)\n", cmd->req.num); qlcnic_dump_mbx()
807 for (i = 0; i < cmd->req.num; i++) { qlcnic_dump_mbx()
810 pr_info("%08x ", cmd->req.arg[i]); qlcnic_dump_mbx()
814 "FW MBX regs(%d)\n", cmd->rsp.num); qlcnic_dump_mbx()
815 for (i = 0; i < cmd->rsp.num; i++) { qlcnic_dump_mbx()
818 pr_info("%08x ", cmd->rsp.arg[i]); qlcnic_dump_mbx()
824 struct qlcnic_cmd_args *cmd) qlcnic_83xx_poll_for_mbx_completion()
827 int opcode = LSW(cmd->req.arg[0]); qlcnic_83xx_poll_for_mbx_completion()
830 max_loops = cmd->total_cmds * QLC_83XX_MBX_CMD_LOOP; qlcnic_83xx_poll_for_mbx_completion()
833 if (atomic_read(&cmd->rsp_status) == qlcnic_83xx_poll_for_mbx_completion()
842 __func__, opcode, cmd->type, ahw->pci_func, ahw->op_mode); qlcnic_83xx_poll_for_mbx_completion()
848 struct qlcnic_cmd_args *cmd) qlcnic_83xx_issue_cmd()
858 opcode = LSW(cmd->req.arg[0]); qlcnic_83xx_issue_cmd()
859 cmd_type = cmd->type; qlcnic_83xx_issue_cmd()
860 err = mbx->ops->enqueue_cmd(adapter, cmd, &timeout); qlcnic_83xx_issue_cmd()
864 __func__, opcode, cmd->type, ahw->pci_func, qlcnic_83xx_issue_cmd()
871 if (!wait_for_completion_timeout(&cmd->completion, timeout)) { qlcnic_83xx_issue_cmd()
882 qlcnic_83xx_poll_for_mbx_completion(adapter, cmd); qlcnic_83xx_issue_cmd()
892 return cmd->rsp_opcode; qlcnic_83xx_issue_cmd()
906 if (type == mbx_tbl[i].cmd) { qlcnic_83xx_alloc_mbx_args()
936 struct qlcnic_cmd_args cmd; qlcnic_83xx_idc_aen_work() local
940 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_IDC_ACK); qlcnic_83xx_idc_aen_work()
945 cmd.req.arg[i] = adapter->ahw->mbox_aen[i]; qlcnic_83xx_idc_aen_work()
947 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_idc_aen_work()
951 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_idc_aen_work()
1069 struct qlcnic_cmd_args cmd; qlcnic_83xx_add_rings() local
1079 ahw->hw_ops->alloc_mbx_args(&cmd, adapter, qlcnic_83xx_add_rings()
1081 cmd.req.arg[1] = 0 | (num_sds << 8) | (context_id << 16); qlcnic_83xx_add_rings()
1104 buf = &cmd.req.arg[index]; qlcnic_83xx_add_rings()
1110 err = ahw->hw_ops->mbx_cmd(adapter, &cmd); qlcnic_83xx_add_rings()
1117 mbx_out = (struct qlcnic_add_rings_mbx_out *)&cmd.rsp.arg[1]; qlcnic_83xx_add_rings()
1133 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_add_rings()
1141 struct qlcnic_cmd_args cmd; qlcnic_83xx_del_rx_ctx() local
1144 if (qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DESTROY_RX_CTX)) qlcnic_83xx_del_rx_ctx()
1148 cmd.req.arg[0] |= (0x3 << 29); qlcnic_83xx_del_rx_ctx()
1153 cmd.req.arg[1] = recv_ctx->context_id | temp; qlcnic_83xx_del_rx_ctx()
1154 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_del_rx_ctx()
1160 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_del_rx_ctx()
1172 struct qlcnic_cmd_args cmd; qlcnic_83xx_create_rx_ctx() local
1191 err = qlcnic_alloc_mbx_args(&cmd, adapter, qlcnic_83xx_create_rx_ctx()
1197 cmd.req.arg[0] |= (0x3 << 29); qlcnic_83xx_create_rx_ctx()
1199 cmd.req.arg[1] = cap; qlcnic_83xx_create_rx_ctx()
1200 cmd.req.arg[5] = 1 | (num_rds << 5) | (num_sds << 8) | qlcnic_83xx_create_rx_ctx()
1205 &cmd.req.arg[6]); qlcnic_83xx_create_rx_ctx()
1225 buf = &cmd.req.arg[index]; qlcnic_83xx_create_rx_ctx()
1245 buf = &cmd.req.arg[index]; qlcnic_83xx_create_rx_ctx()
1249 err = ahw->hw_ops->mbx_cmd(adapter, &cmd); qlcnic_83xx_create_rx_ctx()
1255 mbx_out = (struct qlcnic_rcv_mbx_out *)&cmd.rsp.arg[1]; qlcnic_83xx_create_rx_ctx()
1285 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_create_rx_ctx()
1292 struct qlcnic_cmd_args cmd; qlcnic_83xx_del_tx_ctx() local
1295 if (qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DESTROY_TX_CTX)) qlcnic_83xx_del_tx_ctx()
1299 cmd.req.arg[0] |= (0x3 << 29); qlcnic_83xx_del_tx_ctx()
1304 cmd.req.arg[1] = tx_ring->ctx_id | temp; qlcnic_83xx_del_tx_ctx()
1305 if (qlcnic_issue_cmd(adapter, &cmd)) qlcnic_83xx_del_tx_ctx()
1308 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_del_tx_ctx()
1317 struct qlcnic_cmd_args cmd; qlcnic_83xx_create_tx_ctx() local
1352 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CREATE_TX_CTX); qlcnic_83xx_create_tx_ctx()
1357 cmd.req.arg[0] |= (0x3 << 29); qlcnic_83xx_create_tx_ctx()
1362 cmd.req.arg[1] = QLCNIC_CAP0_LEGACY_CONTEXT; qlcnic_83xx_create_tx_ctx()
1363 cmd.req.arg[5] = QLCNIC_SINGLE_RING | temp; qlcnic_83xx_create_tx_ctx()
1365 buf = &cmd.req.arg[6]; qlcnic_83xx_create_tx_ctx()
1368 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_create_tx_ctx()
1374 mbx_out = (struct qlcnic_tx_mbx_out *)&cmd.rsp.arg[2]; qlcnic_83xx_create_tx_ctx()
1386 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_create_tx_ctx()
1484 struct qlcnic_cmd_args cmd; qlcnic_83xx_get_beacon_state() local
1488 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_LED_CONFIG); qlcnic_83xx_get_beacon_state()
1490 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_get_beacon_state()
1492 beacon_state = cmd.rsp.arg[4]; qlcnic_83xx_get_beacon_state()
1503 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_get_beacon_state()
1511 struct qlcnic_cmd_args cmd; qlcnic_83xx_config_led() local
1517 status = qlcnic_alloc_mbx_args(&cmd, adapter, qlcnic_83xx_config_led()
1522 status = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_config_led()
1529 adapter->ahw->mbox_reg[i] = cmd.rsp.arg[i+1]; qlcnic_83xx_config_led()
1531 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_config_led()
1535 status = qlcnic_alloc_mbx_args(&cmd, adapter, qlcnic_83xx_config_led()
1540 cmd.req.arg[1] = mbx_in; qlcnic_83xx_config_led()
1541 cmd.req.arg[2] = mbx_in; qlcnic_83xx_config_led()
1542 cmd.req.arg[3] = mbx_in; qlcnic_83xx_config_led()
1544 cmd.req.arg[4] = QLC_83XX_ENABLE_BEACON; qlcnic_83xx_config_led()
1545 status = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_config_led()
1551 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_config_led()
1556 status = qlcnic_alloc_mbx_args(&cmd, adapter, qlcnic_83xx_config_led()
1561 cmd.req.arg[1] = adapter->ahw->mbox_reg[0]; qlcnic_83xx_config_led()
1562 cmd.req.arg[2] = adapter->ahw->mbox_reg[1]; qlcnic_83xx_config_led()
1563 cmd.req.arg[3] = adapter->ahw->mbox_reg[2]; qlcnic_83xx_config_led()
1565 cmd.req.arg[4] = adapter->ahw->mbox_reg[3]; qlcnic_83xx_config_led()
1566 status = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_config_led()
1570 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_config_led()
1622 struct qlcnic_cmd_args cmd; qlcnic_83xx_initialize_nic() local
1629 status = qlcnic_alloc_mbx_args(&cmd, adapter, qlcnic_83xx_initialize_nic()
1632 status = qlcnic_alloc_mbx_args(&cmd, adapter, qlcnic_83xx_initialize_nic()
1638 cmd.req.arg[1] = QLC_REGISTER_LB_IDC | QLC_INIT_FW_RESOURCES; qlcnic_83xx_initialize_nic()
1641 cmd.req.arg[1] |= QLC_REGISTER_DCB_AEN; qlcnic_83xx_initialize_nic()
1643 status = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_initialize_nic()
1649 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_initialize_nic()
1654 struct qlcnic_cmd_args cmd; qlcnic_83xx_set_port_config() local
1657 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_PORT_CONFIG); qlcnic_83xx_set_port_config()
1661 cmd.req.arg[1] = adapter->ahw->port_config; qlcnic_83xx_set_port_config()
1662 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_set_port_config()
1665 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_set_port_config()
1671 struct qlcnic_cmd_args cmd; qlcnic_83xx_get_port_config() local
1674 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_PORT_CONFIG); qlcnic_83xx_get_port_config()
1678 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_get_port_config()
1682 adapter->ahw->port_config = cmd.rsp.arg[1]; qlcnic_83xx_get_port_config()
1683 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_get_port_config()
1691 struct qlcnic_cmd_args cmd; qlcnic_83xx_setup_link_event() local
1693 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_LINK_EVENT); qlcnic_83xx_setup_link_event()
1698 cmd.req.arg[1] = (enable ? 1 : 0) | BIT_8 | temp; qlcnic_83xx_setup_link_event()
1699 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_setup_link_event()
1703 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_setup_link_event()
1722 struct qlcnic_cmd_args *cmd = NULL; qlcnic_83xx_nic_set_promisc() local
1729 cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC); qlcnic_83xx_nic_set_promisc()
1730 if (!cmd) qlcnic_83xx_nic_set_promisc()
1733 err = qlcnic_alloc_mbx_args(cmd, adapter, qlcnic_83xx_nic_set_promisc()
1738 cmd->type = QLC_83XX_MBX_CMD_NO_WAIT; qlcnic_83xx_nic_set_promisc()
1744 cmd->req.arg[1] = mode | temp; qlcnic_83xx_nic_set_promisc()
1745 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_83xx_nic_set_promisc()
1749 qlcnic_free_mbx_args(cmd); qlcnic_83xx_nic_set_promisc()
1752 kfree(cmd); qlcnic_83xx_nic_set_promisc()
1976 struct qlcnic_cmd_args cmd; qlcnic_83xx_config_ipaddr() local
1978 err = qlcnic_alloc_mbx_args(&cmd, adapter, qlcnic_83xx_config_ipaddr()
1986 cmd.req.arg[1] = 1 | temp; qlcnic_83xx_config_ipaddr()
1988 cmd.req.arg[1] = 2 | temp; qlcnic_83xx_config_ipaddr()
1999 memcpy(&cmd.req.arg[2], &temp_ip, sizeof(u32)); qlcnic_83xx_config_ipaddr()
2000 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_config_ipaddr()
2006 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_config_ipaddr()
2013 struct qlcnic_cmd_args cmd; qlcnic_83xx_config_hw_lro() local
2021 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIGURE_HW_LRO); qlcnic_83xx_config_hw_lro()
2027 cmd.req.arg[1] = arg1; qlcnic_83xx_config_hw_lro()
2029 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_config_hw_lro()
2032 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_config_hw_lro()
2041 struct qlcnic_cmd_args cmd; qlcnic_83xx_config_rss() local
2046 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIGURE_RSS); qlcnic_83xx_config_rss()
2062 cmd.req.arg[1] = (adapter->recv_ctx->context_id); qlcnic_83xx_config_rss()
2063 cmd.req.arg[2] = word; qlcnic_83xx_config_rss()
2064 memcpy(&cmd.req.arg[4], key, sizeof(key)); qlcnic_83xx_config_rss()
2066 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_config_rss()
2070 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_config_rss()
2090 struct qlcnic_cmd_args *cmd = NULL; qlcnic_83xx_sre_macaddr_change() local
2098 cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC); qlcnic_83xx_sre_macaddr_change()
2099 if (!cmd) qlcnic_83xx_sre_macaddr_change()
2102 err = qlcnic_alloc_mbx_args(cmd, adapter, QLCNIC_CMD_CONFIG_MAC_VLAN); qlcnic_83xx_sre_macaddr_change()
2106 cmd->type = QLC_83XX_MBX_CMD_NO_WAIT; qlcnic_83xx_sre_macaddr_change()
2112 cmd->req.arg[1] = op | (1 << 8); qlcnic_83xx_sre_macaddr_change()
2114 cmd->req.arg[1] |= temp; qlcnic_83xx_sre_macaddr_change()
2122 buf = &cmd->req.arg[2]; qlcnic_83xx_sre_macaddr_change()
2124 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_83xx_sre_macaddr_change()
2128 qlcnic_free_mbx_args(cmd); qlcnic_83xx_sre_macaddr_change()
2130 kfree(cmd); qlcnic_83xx_sre_macaddr_change()
2143 u8 type, struct qlcnic_cmd_args *cmd) qlcnic_83xx_configure_mac()
2148 memcpy(&cmd->req.arg[2], mac, sizeof(u32)); qlcnic_83xx_configure_mac()
2149 memcpy(&cmd->req.arg[3], &mac[4], sizeof(u16)); qlcnic_83xx_configure_mac()
2152 cmd->req.arg[1] = type; qlcnic_83xx_configure_mac()
2159 struct qlcnic_cmd_args cmd; qlcnic_83xx_get_mac_address() local
2163 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_MAC_ADDRESS); qlcnic_83xx_get_mac_address()
2167 qlcnic_83xx_configure_mac(adapter, mac, QLCNIC_GET_CURRENT_MAC, &cmd); qlcnic_83xx_get_mac_address()
2168 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_get_mac_address()
2171 mac_low = cmd.rsp.arg[1]; qlcnic_83xx_get_mac_address()
2172 mac_high = cmd.rsp.arg[2]; qlcnic_83xx_get_mac_address()
2183 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_get_mac_address()
2190 struct qlcnic_cmd_args cmd; qlcnic_83xx_set_rx_intr_coal() local
2194 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIG_INTR_COAL); qlcnic_83xx_set_rx_intr_coal()
2199 cmd.req.arg[1] = QLCNIC_INTR_COAL_TYPE_RX | temp << 16; qlcnic_83xx_set_rx_intr_coal()
2201 cmd.req.arg[2] = coal->rx_packets | temp << 16; qlcnic_83xx_set_rx_intr_coal()
2202 cmd.req.arg[3] = coal->flag; qlcnic_83xx_set_rx_intr_coal()
2204 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_set_rx_intr_coal()
2209 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_set_rx_intr_coal()
2217 struct qlcnic_cmd_args cmd; qlcnic_83xx_set_tx_intr_coal() local
2221 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIG_INTR_COAL); qlcnic_83xx_set_tx_intr_coal()
2226 cmd.req.arg[1] = QLCNIC_INTR_COAL_TYPE_TX | temp << 16; qlcnic_83xx_set_tx_intr_coal()
2228 cmd.req.arg[2] = coal->tx_packets | temp << 16; qlcnic_83xx_set_tx_intr_coal()
2229 cmd.req.arg[3] = coal->flag; qlcnic_83xx_set_tx_intr_coal()
2231 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_set_tx_intr_coal()
2236 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_set_tx_intr_coal()
2373 struct qlcnic_cmd_args cmd; qlcnic_83xx_set_nic_info() local
2382 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_NIC_INFO); qlcnic_83xx_set_nic_info()
2386 cmd.req.arg[1] = (nic->pci_func << 16); qlcnic_83xx_set_nic_info()
2387 cmd.req.arg[2] = 0x1 << 16; qlcnic_83xx_set_nic_info()
2388 cmd.req.arg[3] = nic->phys_port | (nic->switch_mode << 16); qlcnic_83xx_set_nic_info()
2389 cmd.req.arg[4] = nic->capabilities; qlcnic_83xx_set_nic_info()
2390 cmd.req.arg[5] = (nic->max_mac_filters & 0xFF) | ((nic->max_mtu) << 16); qlcnic_83xx_set_nic_info()
2391 cmd.req.arg[6] = (nic->max_tx_ques) | ((nic->max_rx_ques) << 16); qlcnic_83xx_set_nic_info()
2392 cmd.req.arg[7] = (nic->min_tx_bw) | ((nic->max_tx_bw) << 16); qlcnic_83xx_set_nic_info()
2394 cmd.req.arg[i] = 0; qlcnic_83xx_set_nic_info()
2396 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_set_nic_info()
2404 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_set_nic_info()
2415 struct qlcnic_cmd_args cmd; qlcnic_83xx_get_nic_info() local
2418 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_NIC_INFO); qlcnic_83xx_get_nic_info()
2424 cmd.req.arg[1] = op | BIT_31 | temp; qlcnic_83xx_get_nic_info()
2426 cmd.req.arg[1] = ahw->pci_func << 16; qlcnic_83xx_get_nic_info()
2428 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_get_nic_info()
2435 npar_info->op_type = cmd.rsp.arg[1]; qlcnic_83xx_get_nic_info()
2436 npar_info->pci_func = cmd.rsp.arg[2] & 0xFFFF; qlcnic_83xx_get_nic_info()
2437 npar_info->op_mode = (cmd.rsp.arg[2] & 0xFFFF0000) >> 16; qlcnic_83xx_get_nic_info()
2438 npar_info->phys_port = cmd.rsp.arg[3] & 0xFFFF; qlcnic_83xx_get_nic_info()
2439 npar_info->switch_mode = (cmd.rsp.arg[3] & 0xFFFF0000) >> 16; qlcnic_83xx_get_nic_info()
2440 npar_info->capabilities = cmd.rsp.arg[4]; qlcnic_83xx_get_nic_info()
2441 npar_info->max_mac_filters = cmd.rsp.arg[5] & 0xFF; qlcnic_83xx_get_nic_info()
2442 npar_info->max_mtu = (cmd.rsp.arg[5] & 0xFFFF0000) >> 16; qlcnic_83xx_get_nic_info()
2443 npar_info->max_tx_ques = cmd.rsp.arg[6] & 0xFFFF; qlcnic_83xx_get_nic_info()
2444 npar_info->max_rx_ques = (cmd.rsp.arg[6] & 0xFFFF0000) >> 16; qlcnic_83xx_get_nic_info()
2445 npar_info->min_tx_bw = cmd.rsp.arg[7] & 0xFFFF; qlcnic_83xx_get_nic_info()
2446 npar_info->max_tx_bw = (cmd.rsp.arg[7] & 0xFFFF0000) >> 16; qlcnic_83xx_get_nic_info()
2447 if (cmd.rsp.arg[8] & 0x1) qlcnic_83xx_get_nic_info()
2448 npar_info->max_bw_reg_offset = (cmd.rsp.arg[8] & 0x7FFE) >> 1; qlcnic_83xx_get_nic_info()
2449 if (cmd.rsp.arg[8] & 0x10000) { qlcnic_83xx_get_nic_info()
2450 temp = (cmd.rsp.arg[8] & 0x7FFE0000) >> 17; qlcnic_83xx_get_nic_info()
2454 memcpy(ahw->extra_capability, &cmd.rsp.arg[16], qlcnic_83xx_get_nic_info()
2458 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_get_nic_info()
2493 struct qlcnic_cmd_args cmd; qlcnic_83xx_get_pci_info() local
2497 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_PCI_INFO); qlcnic_83xx_get_pci_info()
2501 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_get_pci_info()
2505 ahw->max_pci_func = cmd.rsp.arg[1] & 0xFF; qlcnic_83xx_get_pci_info()
2507 pci_info->id = cmd.rsp.arg[i] & 0xFFFF; qlcnic_83xx_get_pci_info()
2508 pci_info->active = (cmd.rsp.arg[i] & 0xFFFF0000) >> 16; qlcnic_83xx_get_pci_info()
2514 pci_info->type = cmd.rsp.arg[i] & 0xFFFF; qlcnic_83xx_get_pci_info()
2517 temp = (cmd.rsp.arg[i] & 0xFFFF0000) >> 16; qlcnic_83xx_get_pci_info()
2520 pci_info->tx_min_bw = cmd.rsp.arg[i] & 0xFFFF; qlcnic_83xx_get_pci_info()
2521 temp = (cmd.rsp.arg[i] & 0xFFFF0000) >> 16; qlcnic_83xx_get_pci_info()
2524 memcpy(pci_info->mac, &cmd.rsp.arg[i], ETH_ALEN - 2); qlcnic_83xx_get_pci_info()
2526 memcpy(pci_info->mac + sizeof(u32), &cmd.rsp.arg[i], 2); qlcnic_83xx_get_pci_info()
2541 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_get_pci_info()
2551 struct qlcnic_cmd_args cmd; qlcnic_83xx_config_intrpt() local
2554 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIG_INTRPT); qlcnic_83xx_config_intrpt()
2558 cmd.req.arg[1] = max_ints; qlcnic_83xx_config_intrpt()
2561 cmd.req.arg[1] |= (adapter->ahw->pci_func << 8) | BIT_16; qlcnic_83xx_config_intrpt()
2568 cmd.req.arg[index++] = val; qlcnic_83xx_config_intrpt()
2570 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_config_intrpt()
2577 max_ints = cmd.rsp.arg[1]; qlcnic_83xx_config_intrpt()
2579 val = cmd.rsp.arg[index]; qlcnic_83xx_config_intrpt()
2589 temp = cmd.rsp.arg[index + 1]; qlcnic_83xx_config_intrpt()
2598 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_config_intrpt()
2720 u32 cmd; qlcnic_83xx_enable_flash_write() local
2721 cmd = adapter->ahw->fdt.write_statusreg_cmd; qlcnic_83xx_enable_flash_write()
2723 (QLC_83XX_FLASH_FDT_WRITE_DEF_SIG | cmd)); qlcnic_83xx_enable_flash_write()
2805 u32 reversed_addr, addr1, addr2, cmd; qlcnic_83xx_erase_flash_sector() local
2836 cmd = QLC_83XX_FLASH_FDT_ERASE_DEF_SIG | adapter->ahw->fdt.erase_cmd; qlcnic_83xx_erase_flash_sector()
2838 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, cmd); qlcnic_83xx_erase_flash_sector()
3177 struct qlcnic_cmd_args cmd; qlcnic_83xx_test_link() local
3191 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_LINK_STATUS); qlcnic_83xx_test_link()
3195 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_test_link()
3201 config = cmd.rsp.arg[1]; qlcnic_83xx_test_link()
3219 config = cmd.rsp.arg[3]; qlcnic_83xx_test_link()
3252 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_test_link()
3411 static inline u64 *qlcnic_83xx_copy_stats(struct qlcnic_cmd_args *cmd, qlcnic_83xx_copy_stats() argument
3417 low = cmd->rsp.arg[index]; qlcnic_83xx_copy_stats()
3418 hi = cmd->rsp.arg[index + 1]; qlcnic_83xx_copy_stats()
3425 struct qlcnic_cmd_args *cmd, u64 *data, qlcnic_83xx_fill_stats()
3431 err = qlcnic_issue_cmd(adapter, cmd); qlcnic_83xx_fill_stats()
3438 total_regs = cmd->rsp.num; qlcnic_83xx_fill_stats()
3443 data = qlcnic_83xx_copy_stats(cmd, data, k); qlcnic_83xx_fill_stats()
3447 data = qlcnic_83xx_copy_stats(cmd, data, k); qlcnic_83xx_fill_stats()
3451 data = qlcnic_83xx_copy_stats(cmd, data, k); qlcnic_83xx_fill_stats()
3454 data = qlcnic_83xx_copy_stats(cmd, data, k); qlcnic_83xx_fill_stats()
3458 data = qlcnic_83xx_copy_stats(cmd, data, k); qlcnic_83xx_fill_stats()
3461 data = qlcnic_83xx_copy_stats(cmd, data, k); qlcnic_83xx_fill_stats()
3464 data = qlcnic_83xx_copy_stats(cmd, data, k); qlcnic_83xx_fill_stats()
3468 data = qlcnic_83xx_copy_stats(cmd, data, k); qlcnic_83xx_fill_stats()
3471 data = qlcnic_83xx_copy_stats(cmd, data, k); qlcnic_83xx_fill_stats()
3482 struct qlcnic_cmd_args cmd; qlcnic_83xx_get_stats() local
3486 ret = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_STATISTICS); qlcnic_83xx_get_stats()
3490 cmd.req.arg[1] = BIT_1 | (adapter->tx_ring->ctx_id << 16); qlcnic_83xx_get_stats()
3491 cmd.rsp.num = QLC_83XX_TX_STAT_REGS; qlcnic_83xx_get_stats()
3492 data = qlcnic_83xx_fill_stats(adapter, &cmd, data, qlcnic_83xx_get_stats()
3499 cmd.req.arg[1] = BIT_2 | (adapter->portnum << 16); qlcnic_83xx_get_stats()
3500 cmd.rsp.num = QLC_83XX_MAC_STAT_REGS; qlcnic_83xx_get_stats()
3501 memset(cmd.rsp.arg, 0, sizeof(u32) * cmd.rsp.num); qlcnic_83xx_get_stats()
3502 data = qlcnic_83xx_fill_stats(adapter, &cmd, data, qlcnic_83xx_get_stats()
3509 cmd.req.arg[1] = adapter->recv_ctx->context_id << 16; qlcnic_83xx_get_stats()
3510 cmd.rsp.num = QLC_83XX_RX_STAT_REGS; qlcnic_83xx_get_stats()
3511 memset(cmd.rsp.arg, 0, sizeof(u32) * cmd.rsp.num); qlcnic_83xx_get_stats()
3512 data = qlcnic_83xx_fill_stats(adapter, &cmd, data, qlcnic_83xx_get_stats()
3517 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_get_stats()
3525 struct qlcnic_cmd_args cmd; qlcnic_83xx_extend_md_capab() local
3528 err = qlcnic_alloc_mbx_args(&cmd, adapter, qlcnic_83xx_extend_md_capab()
3533 cmd.req.arg[1] = (QLCNIC_83XX_ADD_PORT0 | QLCNIC_83XX_ADD_PORT1); qlcnic_83xx_extend_md_capab()
3534 cmd.req.arg[2] = QLCNIC_83XX_EXTENDED_MEM_SIZE; qlcnic_83xx_extend_md_capab()
3535 cmd.req.arg[3] = QLCNIC_83XX_EXTENDED_MEM_SIZE; qlcnic_83xx_extend_md_capab()
3537 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_extend_md_capab()
3586 struct qlcnic_cmd_args cmd; qlcnic_83xx_interrupt_test() local
3609 ret = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_INTRPT_TEST); qlcnic_83xx_interrupt_test()
3618 cmd.req.arg[1] = 1; qlcnic_83xx_interrupt_test()
3619 cmd.req.arg[2] = intrpt_id; qlcnic_83xx_interrupt_test()
3620 cmd.req.arg[3] = BIT_0; qlcnic_83xx_interrupt_test()
3622 ret = qlcnic_issue_cmd(adapter, &cmd); qlcnic_83xx_interrupt_test()
3623 data = cmd.rsp.arg[2]; qlcnic_83xx_interrupt_test()
3640 qlcnic_free_mbx_args(&cmd); qlcnic_83xx_interrupt_test()
3835 struct qlcnic_cmd_args *cmd) qlcnic_83xx_notify_cmd_completion()
3837 atomic_set(&cmd->rsp_status, QLC_83XX_MBX_RESPONSE_ARRIVED); qlcnic_83xx_notify_cmd_completion()
3839 if (cmd->type == QLC_83XX_MBX_CMD_NO_WAIT) { qlcnic_83xx_notify_cmd_completion()
3840 qlcnic_free_mbx_args(cmd); qlcnic_83xx_notify_cmd_completion()
3841 kfree(cmd); qlcnic_83xx_notify_cmd_completion()
3844 complete(&cmd->completion); qlcnic_83xx_notify_cmd_completion()
3851 struct qlcnic_cmd_args *cmd = NULL; qlcnic_83xx_flush_mbx_queue() local
3856 cmd = list_entry(head->next, struct qlcnic_cmd_args, list); qlcnic_83xx_flush_mbx_queue()
3858 __func__, cmd->cmd_op); qlcnic_83xx_flush_mbx_queue()
3859 list_del(&cmd->list); qlcnic_83xx_flush_mbx_queue()
3861 qlcnic_83xx_notify_cmd_completion(adapter, cmd); qlcnic_83xx_flush_mbx_queue()
3896 struct qlcnic_cmd_args *cmd) qlcnic_83xx_dequeue_mbx_cmd()
3902 list_del(&cmd->list); qlcnic_83xx_dequeue_mbx_cmd()
3907 qlcnic_83xx_notify_cmd_completion(adapter, cmd); qlcnic_83xx_dequeue_mbx_cmd()
3911 struct qlcnic_cmd_args *cmd) qlcnic_83xx_encode_mbx_cmd()
3917 if (cmd->op_type != QLC_83XX_MBX_POST_BC_OP) { qlcnic_83xx_encode_mbx_cmd()
3918 mbx_cmd = cmd->req.arg[0]; qlcnic_83xx_encode_mbx_cmd()
3920 for (i = 1; i < cmd->req.num; i++) qlcnic_83xx_encode_mbx_cmd()
3921 writel(cmd->req.arg[i], QLCNIC_MBX_HOST(ahw, i)); qlcnic_83xx_encode_mbx_cmd()
3925 total_size = cmd->pay_size + hdr_size; qlcnic_83xx_encode_mbx_cmd()
3934 mbx_cmd |= cmd->func_num << 5; qlcnic_83xx_encode_mbx_cmd()
3939 writel(*(cmd->hdr++), QLCNIC_MBX_HOST(ahw, i)); qlcnic_83xx_encode_mbx_cmd()
3940 for (j = 0; j < cmd->pay_size; j++, i++) qlcnic_83xx_encode_mbx_cmd()
3941 writel(*(cmd->pay++), QLCNIC_MBX_HOST(ahw, i)); qlcnic_83xx_encode_mbx_cmd()
3960 struct qlcnic_cmd_args *cmd, qlcnic_83xx_enqueue_mbx_cmd()
3966 atomic_set(&cmd->rsp_status, QLC_83XX_MBX_RESPONSE_WAIT); qlcnic_83xx_enqueue_mbx_cmd()
3967 init_completion(&cmd->completion); qlcnic_83xx_enqueue_mbx_cmd()
3968 cmd->rsp_opcode = QLC_83XX_MBX_RESPONSE_UNKNOWN; qlcnic_83xx_enqueue_mbx_cmd()
3972 list_add_tail(&cmd->list, &mbx->cmd_q); qlcnic_83xx_enqueue_mbx_cmd()
3974 cmd->total_cmds = mbx->num_cmds; qlcnic_83xx_enqueue_mbx_cmd()
3975 *timeout = cmd->total_cmds * QLC_83XX_MBX_TIMEOUT; qlcnic_83xx_enqueue_mbx_cmd()
3987 struct qlcnic_cmd_args *cmd) qlcnic_83xx_check_mac_rcode()
3992 if (cmd->cmd_op == QLCNIC_CMD_CONFIG_MAC_VLAN) { qlcnic_83xx_check_mac_rcode()
3998 cmd->rsp_opcode = QLCNIC_RCODE_SUCCESS; qlcnic_83xx_check_mac_rcode()
4007 struct qlcnic_cmd_args *cmd) qlcnic_83xx_decode_mbx_rsp()
4016 qlcnic_83xx_get_mbx_data(adapter, cmd); qlcnic_83xx_decode_mbx_rsp()
4021 cmd->rsp_opcode = QLCNIC_RCODE_SUCCESS; qlcnic_83xx_decode_mbx_rsp()
4024 if (!qlcnic_83xx_check_mac_rcode(adapter, cmd)) qlcnic_83xx_decode_mbx_rsp()
4028 __func__, cmd->cmd_op, cmd->type, ahw->pci_func, qlcnic_83xx_decode_mbx_rsp()
4030 cmd->rsp_opcode = QLC_83XX_MBX_RESPONSE_FAILED; qlcnic_83xx_decode_mbx_rsp()
4031 qlcnic_dump_mbx(adapter, cmd); qlcnic_83xx_decode_mbx_rsp()
4059 struct qlcnic_cmd_args *cmd = NULL; qlcnic_83xx_mailbox_worker() local
4080 cmd = list_entry(head->next, struct qlcnic_cmd_args, list); qlcnic_83xx_mailbox_worker()
4084 mbx_ops->encode_cmd(adapter, cmd); qlcnic_83xx_mailbox_worker()
4089 mbx_ops->decode_resp(adapter, cmd); qlcnic_83xx_mailbox_worker()
4093 __func__, cmd->cmd_op, cmd->type, ahw->pci_func, qlcnic_83xx_mailbox_worker()
4097 qlcnic_83xx_get_mbx_data(adapter, cmd); qlcnic_83xx_mailbox_worker()
4098 qlcnic_dump_mbx(adapter, cmd); qlcnic_83xx_mailbox_worker()
4101 cmd->rsp_opcode = QLCNIC_RCODE_TIMEOUT; qlcnic_83xx_mailbox_worker()
4103 mbx_ops->dequeue_cmd(adapter, cmd); qlcnic_83xx_mailbox_worker()
448 qlcnic_83xx_get_mbx_data(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) qlcnic_83xx_get_mbx_data() argument
797 qlcnic_dump_mbx(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) qlcnic_dump_mbx() argument
823 qlcnic_83xx_poll_for_mbx_completion(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) qlcnic_83xx_poll_for_mbx_completion() argument
847 qlcnic_83xx_issue_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) qlcnic_83xx_issue_cmd() argument
2142 qlcnic_83xx_configure_mac(struct qlcnic_adapter *adapter, u8 *mac, u8 type, struct qlcnic_cmd_args *cmd) qlcnic_83xx_configure_mac() argument
3424 qlcnic_83xx_fill_stats(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd, u64 *data, int type, int *ret) qlcnic_83xx_fill_stats() argument
3834 qlcnic_83xx_notify_cmd_completion(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) qlcnic_83xx_notify_cmd_completion() argument
3895 qlcnic_83xx_dequeue_mbx_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) qlcnic_83xx_dequeue_mbx_cmd() argument
3910 qlcnic_83xx_encode_mbx_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) qlcnic_83xx_encode_mbx_cmd() argument
3959 qlcnic_83xx_enqueue_mbx_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd, unsigned long *timeout) qlcnic_83xx_enqueue_mbx_cmd() argument
3986 qlcnic_83xx_check_mac_rcode(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) qlcnic_83xx_check_mac_rcode() argument
4006 qlcnic_83xx_decode_mbx_rsp(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) qlcnic_83xx_decode_mbx_rsp() argument
H A Dqlcnic_sriov_common.c233 struct qlcnic_cmd_args cmd; qlcnic_sriov_cleanup_list() local
243 cmd.req.arg = (u32 *)trans->req_pay; qlcnic_sriov_cleanup_list()
244 cmd.rsp.arg = (u32 *)trans->rsp_pay; qlcnic_sriov_cleanup_list()
245 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_cleanup_list()
307 struct qlcnic_cmd_args cmd; qlcnic_sriov_post_bc_msg() local
311 memset(&cmd, 0, sizeof(struct qlcnic_cmd_args)); qlcnic_sriov_post_bc_msg()
312 cmd.hdr = hdr; qlcnic_sriov_post_bc_msg()
313 cmd.pay = pay; qlcnic_sriov_post_bc_msg()
314 cmd.pay_size = size; qlcnic_sriov_post_bc_msg()
315 cmd.func_num = pci_func; qlcnic_sriov_post_bc_msg()
316 cmd.op_type = QLC_83XX_MBX_POST_BC_OP; qlcnic_sriov_post_bc_msg()
317 cmd.cmd_op = ((struct qlcnic_bc_hdr *)hdr)->cmd_op; qlcnic_sriov_post_bc_msg()
319 err = mbx->ops->enqueue_cmd(adapter, &cmd, &timeout); qlcnic_sriov_post_bc_msg()
323 __func__, cmd.cmd_op, cmd.type, ahw->pci_func, qlcnic_sriov_post_bc_msg()
328 if (!wait_for_completion_timeout(&cmd.completion, timeout)) { qlcnic_sriov_post_bc_msg()
331 __func__, cmd.cmd_op, cmd.type, ahw->pci_func, qlcnic_sriov_post_bc_msg()
336 return cmd.rsp_opcode; qlcnic_sriov_post_bc_msg()
353 struct qlcnic_cmd_args cmd; qlcnic_sriov_get_vf_vport_info() local
357 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_NIC_INFO); qlcnic_sriov_get_vf_vport_info()
361 cmd.req.arg[1] = vport_id << 16 | 0x1; qlcnic_sriov_get_vf_vport_info()
362 err = qlcnic_issue_cmd(adapter, &cmd); qlcnic_sriov_get_vf_vport_info()
366 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_get_vf_vport_info()
370 status = cmd.rsp.arg[2] & 0xffff; qlcnic_sriov_get_vf_vport_info()
372 npar_info->min_tx_bw = MSW(cmd.rsp.arg[2]); qlcnic_sriov_get_vf_vport_info()
374 npar_info->max_tx_bw = LSW(cmd.rsp.arg[3]); qlcnic_sriov_get_vf_vport_info()
376 npar_info->max_tx_ques = MSW(cmd.rsp.arg[3]); qlcnic_sriov_get_vf_vport_info()
378 npar_info->max_tx_mac_filters = LSW(cmd.rsp.arg[4]); qlcnic_sriov_get_vf_vport_info()
380 npar_info->max_rx_mcast_mac_filters = MSW(cmd.rsp.arg[4]); qlcnic_sriov_get_vf_vport_info()
382 npar_info->max_rx_ucast_mac_filters = LSW(cmd.rsp.arg[5]); qlcnic_sriov_get_vf_vport_info()
384 npar_info->max_rx_ip_addr = MSW(cmd.rsp.arg[5]); qlcnic_sriov_get_vf_vport_info()
386 npar_info->max_rx_lro_flow = LSW(cmd.rsp.arg[6]); qlcnic_sriov_get_vf_vport_info()
388 npar_info->max_rx_status_rings = MSW(cmd.rsp.arg[6]); qlcnic_sriov_get_vf_vport_info()
390 npar_info->max_rx_buf_rings = LSW(cmd.rsp.arg[7]); qlcnic_sriov_get_vf_vport_info()
392 npar_info->max_rx_ques = MSW(cmd.rsp.arg[7]); qlcnic_sriov_get_vf_vport_info()
393 npar_info->max_tx_vlan_keys = LSW(cmd.rsp.arg[8]); qlcnic_sriov_get_vf_vport_info()
394 npar_info->max_local_ipv6_addrs = MSW(cmd.rsp.arg[8]); qlcnic_sriov_get_vf_vport_info()
395 npar_info->max_remote_ipv6_addrs = LSW(cmd.rsp.arg[9]); qlcnic_sriov_get_vf_vport_info()
412 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_get_vf_vport_info()
417 struct qlcnic_cmd_args *cmd) qlcnic_sriov_set_pvid_mode()
419 adapter->rx_pvid = MSW(cmd->rsp.arg[1]) & 0xffff; qlcnic_sriov_set_pvid_mode()
425 struct qlcnic_cmd_args *cmd) qlcnic_sriov_set_guest_vlan_mode()
434 sriov->any_vlan = cmd->rsp.arg[2] & 0xf; qlcnic_sriov_set_guest_vlan_mode()
435 sriov->num_allowed_vlans = cmd->rsp.arg[2] >> 16; qlcnic_sriov_set_guest_vlan_mode()
449 vlans = (u16 *)&cmd->rsp.arg[3]; qlcnic_sriov_set_guest_vlan_mode()
459 struct qlcnic_cmd_args cmd; qlcnic_sriov_get_vf_acl() local
462 memset(&cmd, 0, sizeof(cmd)); qlcnic_sriov_get_vf_acl()
463 ret = qlcnic_sriov_alloc_bc_mbx_args(&cmd, QLCNIC_BC_CMD_GET_ACL); qlcnic_sriov_get_vf_acl()
467 ret = qlcnic_issue_cmd(adapter, &cmd); qlcnic_sriov_get_vf_acl()
472 sriov->vlan_mode = cmd.rsp.arg[1] & 0x3; qlcnic_sriov_get_vf_acl()
475 ret = qlcnic_sriov_set_guest_vlan_mode(adapter, &cmd); qlcnic_sriov_get_vf_acl()
478 ret = qlcnic_sriov_set_pvid_mode(adapter, &cmd); qlcnic_sriov_get_vf_acl()
483 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_get_vf_acl()
717 if (type == mbx_tbl[i].cmd) { qlcnic_sriov_alloc_bc_mbx_args()
742 struct qlcnic_cmd_args *cmd, qlcnic_sriov_prepare_bc_hdr()
753 trans->req_pay = (struct qlcnic_bc_payload *)cmd->req.arg; qlcnic_sriov_prepare_bc_hdr()
754 trans->rsp_pay = (struct qlcnic_bc_payload *)cmd->rsp.arg; qlcnic_sriov_prepare_bc_hdr()
755 num_regs = cmd->req.num; qlcnic_sriov_prepare_bc_hdr()
757 num_regs = cmd->rsp.num; qlcnic_sriov_prepare_bc_hdr()
759 cmd_op = cmd->req.arg[0] & 0xff; qlcnic_sriov_prepare_bc_hdr()
776 cmd->req.arg = (u32 *)trans->req_pay; qlcnic_sriov_prepare_bc_hdr()
777 cmd->rsp.arg = (u32 *)trans->rsp_pay; qlcnic_sriov_prepare_bc_hdr()
778 cmd_op = cmd->req.arg[0] & 0xff; qlcnic_sriov_prepare_bc_hdr()
779 cmd->cmd_op = cmd_op; qlcnic_sriov_prepare_bc_hdr()
784 cmd->req.num = trans->req_pay_size / 4; qlcnic_sriov_prepare_bc_hdr()
785 cmd->rsp.num = trans->rsp_pay_size / 4; qlcnic_sriov_prepare_bc_hdr()
787 cmd->op_type = trans->req_hdr->op_type; qlcnic_sriov_prepare_bc_hdr()
795 hdr[i].op_type = cmd->op_type; qlcnic_sriov_prepare_bc_hdr()
1031 struct qlcnic_cmd_args *cmd) __qlcnic_sriov_process_bc_cmd()
1035 qlcnic_sriov_pf_process_bc_cmd(adapter, trans, cmd); __qlcnic_sriov_process_bc_cmd()
1039 cmd->rsp.arg[0] |= (0x9 << 25); __qlcnic_sriov_process_bc_cmd()
1049 struct qlcnic_cmd_args cmd; qlcnic_sriov_process_bc_cmd() local
1058 memset(&cmd, 0, sizeof(struct qlcnic_cmd_args)); qlcnic_sriov_process_bc_cmd()
1063 if (qlcnic_sriov_prepare_bc_hdr(trans, &cmd, trans->req_hdr->seq_id, qlcnic_sriov_process_bc_cmd()
1067 __qlcnic_sriov_process_bc_cmd(adapter, trans, &cmd); qlcnic_sriov_process_bc_cmd()
1072 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_process_bc_cmd()
1190 struct qlcnic_cmd_args cmd; qlcnic_sriov_handle_bc_cmd() local
1208 memset(&cmd, 0, sizeof(struct qlcnic_cmd_args)); qlcnic_sriov_handle_bc_cmd()
1214 err = qlcnic_sriov_alloc_bc_mbx_args(&cmd, cmd_op); qlcnic_sriov_handle_bc_cmd()
1216 err = qlcnic_alloc_mbx_args(&cmd, adapter, cmd_op); qlcnic_sriov_handle_bc_cmd()
1223 cmd.op_type = hdr->op_type; qlcnic_sriov_handle_bc_cmd()
1224 if (qlcnic_sriov_prepare_bc_hdr(trans, &cmd, hdr->seq_id, qlcnic_sriov_handle_bc_cmd()
1226 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_handle_bc_cmd()
1247 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_handle_bc_cmd()
1322 struct qlcnic_cmd_args cmd; qlcnic_sriov_cfg_bc_intr() local
1328 if (qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_BC_EVENT_SETUP)) qlcnic_sriov_cfg_bc_intr()
1332 cmd.req.arg[1] = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7); qlcnic_sriov_cfg_bc_intr()
1334 err = qlcnic_83xx_issue_cmd(adapter, &cmd); qlcnic_sriov_cfg_bc_intr()
1342 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_cfg_bc_intr()
1367 struct qlcnic_cmd_args *cmd) __qlcnic_sriov_issue_cmd()
1382 rsp = qlcnic_sriov_prepare_bc_hdr(trans, cmd, seq, QLC_BC_COMMAND); __qlcnic_sriov_issue_cmd()
1389 QLCDB(adapter, DRV, "MBX not Ready!(cmd 0x%x) for VF 0x%x\n", __qlcnic_sriov_issue_cmd()
1390 QLCNIC_MBX_RSP(cmd->req.arg[0]), func); __qlcnic_sriov_issue_cmd()
1397 (cmd->req.arg[0] & 0xffff), func); __qlcnic_sriov_issue_cmd()
1410 rsp_data = cmd->rsp.arg[0]; __qlcnic_sriov_issue_cmd()
1412 opcode = QLCNIC_MBX_RSP(cmd->req.arg[0]); __qlcnic_sriov_issue_cmd()
1418 if (cmd->type == QLC_83XX_MBX_CMD_NO_WAIT) { __qlcnic_sriov_issue_cmd()
1442 if (cmd->type == QLC_83XX_MBX_CMD_NO_WAIT) { __qlcnic_sriov_issue_cmd()
1443 qlcnic_free_mbx_args(cmd); __qlcnic_sriov_issue_cmd()
1444 kfree(cmd); __qlcnic_sriov_issue_cmd()
1452 struct qlcnic_cmd_args *cmd) qlcnic_sriov_issue_cmd()
1454 if (cmd->type == QLC_83XX_MBX_CMD_NO_WAIT) qlcnic_sriov_issue_cmd()
1455 return qlcnic_sriov_async_issue_cmd(adapter, cmd); qlcnic_sriov_issue_cmd()
1457 return __qlcnic_sriov_issue_cmd(adapter, cmd); qlcnic_sriov_issue_cmd()
1462 struct qlcnic_cmd_args cmd; qlcnic_sriov_channel_cfg_cmd() local
1466 memset(&cmd, 0, sizeof(cmd)); qlcnic_sriov_channel_cfg_cmd()
1467 if (qlcnic_sriov_alloc_bc_mbx_args(&cmd, cmd_op)) qlcnic_sriov_channel_cfg_cmd()
1470 ret = qlcnic_issue_cmd(adapter, &cmd); qlcnic_sriov_channel_cfg_cmd()
1478 cmd_op = (cmd.rsp.arg[0] & 0xff); qlcnic_sriov_channel_cfg_cmd()
1479 if (cmd.rsp.arg[0] >> 25 == 2) qlcnic_sriov_channel_cfg_cmd()
1487 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_channel_cfg_cmd()
1592 struct qlcnic_cmd_args *cmd; qlcnic_sriov_handle_async_issue_cmd() local
1596 cmd = entry->cmd; qlcnic_sriov_handle_async_issue_cmd()
1597 __qlcnic_sriov_issue_cmd(adapter, cmd); qlcnic_sriov_handle_async_issue_cmd()
1629 struct qlcnic_cmd_args *cmd) qlcnic_sriov_schedule_async_cmd()
1638 entry->cmd = cmd; qlcnic_sriov_schedule_async_cmd()
1644 struct qlcnic_cmd_args *cmd) qlcnic_sriov_async_issue_cmd()
1653 adapter, cmd); qlcnic_sriov_async_issue_cmd()
2039 struct qlcnic_cmd_args cmd; qlcnic_sriov_cfg_vf_guest_vlan() local
2042 memset(&cmd, 0, sizeof(cmd)); qlcnic_sriov_cfg_vf_guest_vlan()
2051 ret = qlcnic_sriov_alloc_bc_mbx_args(&cmd, qlcnic_sriov_cfg_vf_guest_vlan()
2056 cmd.req.arg[1] = (enable & 1) | vid << 16; qlcnic_sriov_cfg_vf_guest_vlan()
2059 ret = qlcnic_issue_cmd(adapter, &cmd); qlcnic_sriov_cfg_vf_guest_vlan()
2078 qlcnic_free_mbx_args(&cmd); qlcnic_sriov_cfg_vf_guest_vlan()
416 qlcnic_sriov_set_pvid_mode(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) qlcnic_sriov_set_pvid_mode() argument
424 qlcnic_sriov_set_guest_vlan_mode(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) qlcnic_sriov_set_guest_vlan_mode() argument
741 qlcnic_sriov_prepare_bc_hdr(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd, u16 seq, u8 msg_type) qlcnic_sriov_prepare_bc_hdr() argument
1029 __qlcnic_sriov_process_bc_cmd(struct qlcnic_adapter *adapter, struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) __qlcnic_sriov_process_bc_cmd() argument
1366 __qlcnic_sriov_issue_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) __qlcnic_sriov_issue_cmd() argument
1451 qlcnic_sriov_issue_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) qlcnic_sriov_issue_cmd() argument
1627 qlcnic_sriov_schedule_async_cmd(struct qlcnic_back_channel *bc, work_func_t func, void *data, struct qlcnic_cmd_args *cmd) qlcnic_sriov_schedule_async_cmd() argument
1643 qlcnic_sriov_async_issue_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) qlcnic_sriov_async_issue_cmd() argument
/linux-4.4.14/arch/powerpc/platforms/powermac/
H A Dpfunc_core.c95 static u32 pmf_next32(struct pmf_cmd *cmd) pmf_next32() argument
98 if ((cmd->cmdend - cmd->cmdptr) < 4) { pmf_next32()
99 cmd->error = 1; pmf_next32()
102 value = *((u32 *)cmd->cmdptr); pmf_next32()
103 cmd->cmdptr += 4; pmf_next32()
107 static const void* pmf_next_blob(struct pmf_cmd *cmd, int count) pmf_next_blob() argument
110 if ((cmd->cmdend - cmd->cmdptr) < count) { pmf_next_blob()
111 cmd->error = 1; pmf_next_blob()
114 value = cmd->cmdptr; pmf_next_blob()
115 cmd->cmdptr += count; pmf_next_blob()
123 #define PMF_PARSE_CALL(name, cmd, handlers, p...) \
125 if (cmd->error) \
130 return handlers->name(cmd->func, cmd->instdata, \
131 cmd->args, p); \
136 static int pmf_parser_write_gpio(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_write_gpio() argument
138 u8 value = (u8)pmf_next32(cmd); pmf_parser_write_gpio()
139 u8 mask = (u8)pmf_next32(cmd); pmf_parser_write_gpio()
143 PMF_PARSE_CALL(write_gpio, cmd, h, value, mask); pmf_parser_write_gpio()
146 static int pmf_parser_read_gpio(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_read_gpio() argument
148 u8 mask = (u8)pmf_next32(cmd); pmf_parser_read_gpio()
149 int rshift = (int)pmf_next32(cmd); pmf_parser_read_gpio()
150 u8 xor = (u8)pmf_next32(cmd); pmf_parser_read_gpio()
155 PMF_PARSE_CALL(read_gpio, cmd, h, mask, rshift, xor); pmf_parser_read_gpio()
158 static int pmf_parser_write_reg32(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_write_reg32() argument
160 u32 offset = pmf_next32(cmd); pmf_parser_write_reg32()
161 u32 value = pmf_next32(cmd); pmf_parser_write_reg32()
162 u32 mask = pmf_next32(cmd); pmf_parser_write_reg32()
167 PMF_PARSE_CALL(write_reg32, cmd, h, offset, value, mask); pmf_parser_write_reg32()
170 static int pmf_parser_read_reg32(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_read_reg32() argument
172 u32 offset = pmf_next32(cmd); pmf_parser_read_reg32()
176 PMF_PARSE_CALL(read_reg32, cmd, h, offset); pmf_parser_read_reg32()
180 static int pmf_parser_write_reg16(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_write_reg16() argument
182 u32 offset = pmf_next32(cmd); pmf_parser_write_reg16()
183 u16 value = (u16)pmf_next32(cmd); pmf_parser_write_reg16()
184 u16 mask = (u16)pmf_next32(cmd); pmf_parser_write_reg16()
189 PMF_PARSE_CALL(write_reg16, cmd, h, offset, value, mask); pmf_parser_write_reg16()
192 static int pmf_parser_read_reg16(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_read_reg16() argument
194 u32 offset = pmf_next32(cmd); pmf_parser_read_reg16()
198 PMF_PARSE_CALL(read_reg16, cmd, h, offset); pmf_parser_read_reg16()
202 static int pmf_parser_write_reg8(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_write_reg8() argument
204 u32 offset = pmf_next32(cmd); pmf_parser_write_reg8()
205 u8 value = (u16)pmf_next32(cmd); pmf_parser_write_reg8()
206 u8 mask = (u16)pmf_next32(cmd); pmf_parser_write_reg8()
211 PMF_PARSE_CALL(write_reg8, cmd, h, offset, value, mask); pmf_parser_write_reg8()
214 static int pmf_parser_read_reg8(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_read_reg8() argument
216 u32 offset = pmf_next32(cmd); pmf_parser_read_reg8()
220 PMF_PARSE_CALL(read_reg8, cmd, h, offset); pmf_parser_read_reg8()
223 static int pmf_parser_delay(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_delay() argument
225 u32 duration = pmf_next32(cmd); pmf_parser_delay()
229 PMF_PARSE_CALL(delay, cmd, h, duration); pmf_parser_delay()
232 static int pmf_parser_wait_reg32(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_wait_reg32() argument
234 u32 offset = pmf_next32(cmd); pmf_parser_wait_reg32()
235 u32 value = pmf_next32(cmd); pmf_parser_wait_reg32()
236 u32 mask = pmf_next32(cmd); pmf_parser_wait_reg32()
241 PMF_PARSE_CALL(wait_reg32, cmd, h, offset, value, mask); pmf_parser_wait_reg32()
244 static int pmf_parser_wait_reg16(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_wait_reg16() argument
246 u32 offset = pmf_next32(cmd); pmf_parser_wait_reg16()
247 u16 value = (u16)pmf_next32(cmd); pmf_parser_wait_reg16()
248 u16 mask = (u16)pmf_next32(cmd); pmf_parser_wait_reg16()
253 PMF_PARSE_CALL(wait_reg16, cmd, h, offset, value, mask); pmf_parser_wait_reg16()
256 static int pmf_parser_wait_reg8(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_wait_reg8() argument
258 u32 offset = pmf_next32(cmd); pmf_parser_wait_reg8()
259 u8 value = (u8)pmf_next32(cmd); pmf_parser_wait_reg8()
260 u8 mask = (u8)pmf_next32(cmd); pmf_parser_wait_reg8()
265 PMF_PARSE_CALL(wait_reg8, cmd, h, offset, value, mask); pmf_parser_wait_reg8()
268 static int pmf_parser_read_i2c(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_read_i2c() argument
270 u32 bytes = pmf_next32(cmd); pmf_parser_read_i2c()
274 PMF_PARSE_CALL(read_i2c, cmd, h, bytes); pmf_parser_read_i2c()
277 static int pmf_parser_write_i2c(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_write_i2c() argument
279 u32 bytes = pmf_next32(cmd); pmf_parser_write_i2c()
280 const void *blob = pmf_next_blob(cmd, bytes); pmf_parser_write_i2c()
285 PMF_PARSE_CALL(write_i2c, cmd, h, bytes, blob); pmf_parser_write_i2c()
289 static int pmf_parser_rmw_i2c(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_rmw_i2c() argument
291 u32 maskbytes = pmf_next32(cmd); pmf_parser_rmw_i2c()
292 u32 valuesbytes = pmf_next32(cmd); pmf_parser_rmw_i2c()
293 u32 totalbytes = pmf_next32(cmd); pmf_parser_rmw_i2c()
294 const void *maskblob = pmf_next_blob(cmd, maskbytes); pmf_parser_rmw_i2c()
295 const void *valuesblob = pmf_next_blob(cmd, valuesbytes); pmf_parser_rmw_i2c()
303 PMF_PARSE_CALL(rmw_i2c, cmd, h, maskbytes, valuesbytes, totalbytes, pmf_parser_rmw_i2c()
307 static int pmf_parser_read_cfg(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_read_cfg() argument
309 u32 offset = pmf_next32(cmd); pmf_parser_read_cfg()
310 u32 bytes = pmf_next32(cmd); pmf_parser_read_cfg()
314 PMF_PARSE_CALL(read_cfg, cmd, h, offset, bytes); pmf_parser_read_cfg()
318 static int pmf_parser_write_cfg(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_write_cfg() argument
320 u32 offset = pmf_next32(cmd); pmf_parser_write_cfg()
321 u32 bytes = pmf_next32(cmd); pmf_parser_write_cfg()
322 const void *blob = pmf_next_blob(cmd, bytes); pmf_parser_write_cfg()
327 PMF_PARSE_CALL(write_cfg, cmd, h, offset, bytes, blob); pmf_parser_write_cfg()
330 static int pmf_parser_rmw_cfg(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_rmw_cfg() argument
332 u32 offset = pmf_next32(cmd); pmf_parser_rmw_cfg()
333 u32 maskbytes = pmf_next32(cmd); pmf_parser_rmw_cfg()
334 u32 valuesbytes = pmf_next32(cmd); pmf_parser_rmw_cfg()
335 u32 totalbytes = pmf_next32(cmd); pmf_parser_rmw_cfg()
336 const void *maskblob = pmf_next_blob(cmd, maskbytes); pmf_parser_rmw_cfg()
337 const void *valuesblob = pmf_next_blob(cmd, valuesbytes); pmf_parser_rmw_cfg()
345 PMF_PARSE_CALL(rmw_cfg, cmd, h, offset, maskbytes, valuesbytes, pmf_parser_rmw_cfg()
350 static int pmf_parser_read_i2c_sub(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_read_i2c_sub() argument
352 u8 subaddr = (u8)pmf_next32(cmd); pmf_parser_read_i2c_sub()
353 u32 bytes = pmf_next32(cmd); pmf_parser_read_i2c_sub()
358 PMF_PARSE_CALL(read_i2c_sub, cmd, h, subaddr, bytes); pmf_parser_read_i2c_sub()
361 static int pmf_parser_write_i2c_sub(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_write_i2c_sub() argument
363 u8 subaddr = (u8)pmf_next32(cmd); pmf_parser_write_i2c_sub()
364 u32 bytes = pmf_next32(cmd); pmf_parser_write_i2c_sub()
365 const void *blob = pmf_next_blob(cmd, bytes); pmf_parser_write_i2c_sub()
371 PMF_PARSE_CALL(write_i2c_sub, cmd, h, subaddr, bytes, blob); pmf_parser_write_i2c_sub()
374 static int pmf_parser_set_i2c_mode(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_set_i2c_mode() argument
376 u32 mode = pmf_next32(cmd); pmf_parser_set_i2c_mode()
380 PMF_PARSE_CALL(set_i2c_mode, cmd, h, mode); pmf_parser_set_i2c_mode()
384 static int pmf_parser_rmw_i2c_sub(struct pmf_cmd *cmd, struct pmf_handlers *h) pmf_parser_rmw_i2c_sub() argument
386 u8 subaddr = (u8)pmf_next32(cmd); pmf_parser_rmw_i2c_sub()
387 u32 maskbytes = pmf_next32(cmd); pmf_parser_rmw_i2c_sub()
388 u32 valuesbytes = pmf_next32(cmd); pmf_parser_rmw_i2c_sub()
389 u32 totalbytes = pmf_next32(cmd); pmf_parser_rmw_i2c_sub()
390 const void *maskblob = pmf_next_blob(cmd, maskbytes); pmf_parser_rmw_i2c_sub()
391 const void *valuesblob = pmf_next_blob(cmd, valuesbytes); pmf_parser_rmw_i2c_sub()
399 PMF_PARSE_CALL(rmw_i2c_sub, cmd, h, subaddr, maskbytes, valuesbytes, pmf_parser_rmw_i2c_sub()
403 static int pmf_parser_read_reg32_msrx(struct pmf_cmd *cmd, pmf_parser_read_reg32_msrx() argument
406 u32 offset = pmf_next32(cmd); pmf_parser_read_reg32_msrx()
407 u32 mask = pmf_next32(cmd); pmf_parser_read_reg32_msrx()
408 u32 shift = pmf_next32(cmd); pmf_parser_read_reg32_msrx()
409 u32 xor = pmf_next32(cmd); pmf_parser_read_reg32_msrx()
414 PMF_PARSE_CALL(read_reg32_msrx, cmd, h, offset, mask, shift, xor); pmf_parser_read_reg32_msrx()
417 static int pmf_parser_read_reg16_msrx(struct pmf_cmd *cmd, pmf_parser_read_reg16_msrx() argument
420 u32 offset = pmf_next32(cmd); pmf_parser_read_reg16_msrx()
421 u32 mask = pmf_next32(cmd); pmf_parser_read_reg16_msrx()
422 u32 shift = pmf_next32(cmd); pmf_parser_read_reg16_msrx()
423 u32 xor = pmf_next32(cmd); pmf_parser_read_reg16_msrx()
428 PMF_PARSE_CALL(read_reg16_msrx, cmd, h, offset, mask, shift, xor); pmf_parser_read_reg16_msrx()
430 static int pmf_parser_read_reg8_msrx(struct pmf_cmd *cmd, pmf_parser_read_reg8_msrx() argument
433 u32 offset = pmf_next32(cmd); pmf_parser_read_reg8_msrx()
434 u32 mask = pmf_next32(cmd); pmf_parser_read_reg8_msrx()
435 u32 shift = pmf_next32(cmd); pmf_parser_read_reg8_msrx()
436 u32 xor = pmf_next32(cmd); pmf_parser_read_reg8_msrx()
441 PMF_PARSE_CALL(read_reg8_msrx, cmd, h, offset, mask, shift, xor); pmf_parser_read_reg8_msrx()
444 static int pmf_parser_write_reg32_slm(struct pmf_cmd *cmd, pmf_parser_write_reg32_slm() argument
447 u32 offset = pmf_next32(cmd); pmf_parser_write_reg32_slm()
448 u32 shift = pmf_next32(cmd); pmf_parser_write_reg32_slm()
449 u32 mask = pmf_next32(cmd); pmf_parser_write_reg32_slm()
454 PMF_PARSE_CALL(write_reg32_slm, cmd, h, offset, shift, mask); pmf_parser_write_reg32_slm()
457 static int pmf_parser_write_reg16_slm(struct pmf_cmd *cmd, pmf_parser_write_reg16_slm() argument
460 u32 offset = pmf_next32(cmd); pmf_parser_write_reg16_slm()
461 u32 shift = pmf_next32(cmd); pmf_parser_write_reg16_slm()
462 u32 mask = pmf_next32(cmd); pmf_parser_write_reg16_slm()
467 PMF_PARSE_CALL(write_reg16_slm, cmd, h, offset, shift, mask); pmf_parser_write_reg16_slm()
470 static int pmf_parser_write_reg8_slm(struct pmf_cmd *cmd, pmf_parser_write_reg8_slm() argument
473 u32 offset = pmf_next32(cmd); pmf_parser_write_reg8_slm()
474 u32 shift = pmf_next32(cmd); pmf_parser_write_reg8_slm()
475 u32 mask = pmf_next32(cmd); pmf_parser_write_reg8_slm()
480 PMF_PARSE_CALL(write_reg8_slm, cmd, h, offset, shift, mask); pmf_parser_write_reg8_slm()
483 static int pmf_parser_mask_and_compare(struct pmf_cmd *cmd, pmf_parser_mask_and_compare() argument
486 u32 bytes = pmf_next32(cmd); pmf_parser_mask_and_compare()
487 const void *maskblob = pmf_next_blob(cmd, bytes); pmf_parser_mask_and_compare()
488 const void *valuesblob = pmf_next_blob(cmd, bytes); pmf_parser_mask_and_compare()
494 PMF_PARSE_CALL(mask_and_compare, cmd, h, pmf_parser_mask_and_compare()
499 typedef int (*pmf_cmd_parser_t)(struct pmf_cmd *cmd, struct pmf_handlers *h);
582 struct pmf_cmd cmd; pmf_parse_one() local
586 cmd.cmdptr = func->data; pmf_parse_one()
587 cmd.cmdend = func->data + func->length; pmf_parse_one()
588 cmd.func = func; pmf_parse_one()
589 cmd.instdata = instdata; pmf_parse_one()
590 cmd.args = args; pmf_parse_one()
591 cmd.error = 0; pmf_parse_one()
600 while(count-- && cmd.cmdptr < cmd.cmdend) { pmf_parse_one()
602 ccode = pmf_next32(&cmd); pmf_parse_one()
605 count = pmf_next32(&cmd) - 1; pmf_parse_one()
606 ccode = pmf_next32(&cmd); pmf_parse_one()
608 if (cmd.error) { pmf_parse_one()
620 rc = pmf_parsers[ccode](&cmd, handlers); pmf_parse_one()
630 func->length = cmd.cmdptr - func->data; pmf_parse_one()
/linux-4.4.14/include/scsi/
H A Dscsi_cmnd.h147 static inline void *scsi_cmd_priv(struct scsi_cmnd *cmd) scsi_cmd_priv() argument
149 return cmd + 1; scsi_cmd_priv()
153 static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) scsi_cmd_to_driver() argument
155 return *(struct scsi_driver **)cmd->request->rq_disk->private_data; scsi_cmd_to_driver()
160 extern void scsi_finish_command(struct scsi_cmnd *cmd);
166 extern int scsi_init_io(struct scsi_cmnd *cmd);
168 extern int scsi_dma_map(struct scsi_cmnd *cmd);
169 extern void scsi_dma_unmap(struct scsi_cmnd *cmd);
171 static inline unsigned scsi_sg_count(struct scsi_cmnd *cmd) scsi_sg_count() argument
173 return cmd->sdb.table.nents; scsi_sg_count()
176 static inline struct scatterlist *scsi_sglist(struct scsi_cmnd *cmd) scsi_sglist() argument
178 return cmd->sdb.table.sgl; scsi_sglist()
181 static inline unsigned scsi_bufflen(struct scsi_cmnd *cmd) scsi_bufflen() argument
183 return cmd->sdb.length; scsi_bufflen()
186 static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid) scsi_set_resid() argument
188 cmd->sdb.resid = resid; scsi_set_resid()
191 static inline int scsi_get_resid(struct scsi_cmnd *cmd) scsi_get_resid() argument
193 return cmd->sdb.resid; scsi_get_resid()
196 #define scsi_for_each_sg(cmd, sg, nseg, __i) \
197 for_each_sg(scsi_sglist(cmd), sg, nseg, __i)
199 static inline int scsi_bidi_cmnd(struct scsi_cmnd *cmd) scsi_bidi_cmnd() argument
201 return blk_bidi_rq(cmd->request) && scsi_bidi_cmnd()
202 (cmd->request->next_rq->special != NULL); scsi_bidi_cmnd()
205 static inline struct scsi_data_buffer *scsi_in(struct scsi_cmnd *cmd) scsi_in() argument
207 return scsi_bidi_cmnd(cmd) ? scsi_in()
208 cmd->request->next_rq->special : &cmd->sdb; scsi_in()
211 static inline struct scsi_data_buffer *scsi_out(struct scsi_cmnd *cmd) scsi_out() argument
213 return &cmd->sdb; scsi_out()
216 static inline int scsi_sg_copy_from_buffer(struct scsi_cmnd *cmd, scsi_sg_copy_from_buffer() argument
219 return sg_copy_from_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), scsi_sg_copy_from_buffer()
223 static inline int scsi_sg_copy_to_buffer(struct scsi_cmnd *cmd, scsi_sg_copy_to_buffer() argument
226 return sg_copy_to_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), scsi_sg_copy_to_buffer()
308 static inline unsigned scsi_prot_sg_count(struct scsi_cmnd *cmd) scsi_prot_sg_count() argument
310 return cmd->prot_sdb ? cmd->prot_sdb->table.nents : 0; scsi_prot_sg_count()
313 static inline struct scatterlist *scsi_prot_sglist(struct scsi_cmnd *cmd) scsi_prot_sglist() argument
315 return cmd->prot_sdb ? cmd->prot_sdb->table.sgl : NULL; scsi_prot_sglist()
318 static inline struct scsi_data_buffer *scsi_prot(struct scsi_cmnd *cmd) scsi_prot() argument
320 return cmd->prot_sdb; scsi_prot()
323 #define scsi_for_each_prot_sg(cmd, sg, nseg, __i) \
324 for_each_sg(scsi_prot_sglist(cmd), sg, nseg, __i)
326 static inline void set_msg_byte(struct scsi_cmnd *cmd, char status) set_msg_byte() argument
328 cmd->result = (cmd->result & 0xffff00ff) | (status << 8); set_msg_byte()
331 static inline void set_host_byte(struct scsi_cmnd *cmd, char status) set_host_byte() argument
333 cmd->result = (cmd->result & 0xff00ffff) | (status << 16); set_host_byte()
336 static inline void set_driver_byte(struct scsi_cmnd *cmd, char status) set_driver_byte() argument
338 cmd->result = (cmd->result & 0x00ffffff) | (status << 24); set_driver_byte()
/linux-4.4.14/drivers/net/wireless/iwlwifi/mvm/
H A Dpower.c84 struct iwl_beacon_filter_cmd *cmd, iwl_mvm_beacon_filter_send_cmd()
88 le32_to_cpu(cmd->ba_enable_beacon_abort)); iwl_mvm_beacon_filter_send_cmd()
90 le32_to_cpu(cmd->ba_escape_timer)); iwl_mvm_beacon_filter_send_cmd()
92 le32_to_cpu(cmd->bf_debug_flag)); iwl_mvm_beacon_filter_send_cmd()
94 le32_to_cpu(cmd->bf_enable_beacon_filter)); iwl_mvm_beacon_filter_send_cmd()
96 le32_to_cpu(cmd->bf_energy_delta)); iwl_mvm_beacon_filter_send_cmd()
98 le32_to_cpu(cmd->bf_escape_timer)); iwl_mvm_beacon_filter_send_cmd()
100 le32_to_cpu(cmd->bf_roaming_energy_delta)); iwl_mvm_beacon_filter_send_cmd()
102 le32_to_cpu(cmd->bf_roaming_state)); iwl_mvm_beacon_filter_send_cmd()
104 le32_to_cpu(cmd->bf_temp_threshold)); iwl_mvm_beacon_filter_send_cmd()
106 le32_to_cpu(cmd->bf_temp_fast_filter)); iwl_mvm_beacon_filter_send_cmd()
108 le32_to_cpu(cmd->bf_temp_slow_filter)); iwl_mvm_beacon_filter_send_cmd()
111 sizeof(struct iwl_beacon_filter_cmd), cmd); iwl_mvm_beacon_filter_send_cmd()
117 struct iwl_beacon_filter_cmd *cmd, iwl_mvm_beacon_filter_set_cqm_params()
123 cmd->bf_energy_delta = iwl_mvm_beacon_filter_set_cqm_params()
126 cmd->bf_roaming_state = iwl_mvm_beacon_filter_set_cqm_params()
129 cmd->ba_enable_beacon_abort = cpu_to_le32(mvmvif->bf_data.ba_enabled); iwl_mvm_beacon_filter_set_cqm_params()
133 struct iwl_mac_power_cmd *cmd) iwl_mvm_power_log()
137 cmd->id_and_color, iwlmvm_mod_params.power_scheme, iwl_mvm_power_log()
138 le16_to_cpu(cmd->flags)); iwl_mvm_power_log()
140 le16_to_cpu(cmd->keep_alive_seconds)); iwl_mvm_power_log()
142 if (!(cmd->flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK))) { iwl_mvm_power_log()
148 le32_to_cpu(cmd->rx_data_timeout)); iwl_mvm_power_log()
150 le32_to_cpu(cmd->tx_data_timeout)); iwl_mvm_power_log()
151 if (cmd->flags & cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK)) iwl_mvm_power_log()
153 cmd->skip_dtim_periods); iwl_mvm_power_log()
154 if (cmd->flags & cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK)) iwl_mvm_power_log()
156 cmd->lprx_rssi_threshold); iwl_mvm_power_log()
157 if (cmd->flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK)) { iwl_mvm_power_log()
160 le32_to_cpu(cmd->rx_data_timeout_uapsd)); iwl_mvm_power_log()
162 le32_to_cpu(cmd->tx_data_timeout_uapsd)); iwl_mvm_power_log()
163 IWL_DEBUG_POWER(mvm, "QNDP TID = %d\n", cmd->qndp_tid); iwl_mvm_power_log()
164 IWL_DEBUG_POWER(mvm, "ACs flags = 0x%x\n", cmd->uapsd_ac_flags); iwl_mvm_power_log()
165 IWL_DEBUG_POWER(mvm, "Max SP = %d\n", cmd->uapsd_max_sp); iwl_mvm_power_log()
171 struct iwl_mac_power_cmd *cmd) iwl_mvm_power_configure_uapsd()
182 cmd->flags |= iwl_mvm_power_configure_uapsd()
185 cmd->uapsd_ac_flags |= BIT(ac); iwl_mvm_power_configure_uapsd()
192 cmd->qndp_tid = 6; iwl_mvm_power_configure_uapsd()
195 cmd->qndp_tid = 5; iwl_mvm_power_configure_uapsd()
198 cmd->qndp_tid = 0; iwl_mvm_power_configure_uapsd()
201 cmd->qndp_tid = 1; iwl_mvm_power_configure_uapsd()
207 if (!(cmd->flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK))) { iwl_mvm_power_configure_uapsd()
211 cmd->flags |= iwl_mvm_power_configure_uapsd()
217 cmd->flags |= cpu_to_le16(POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK); iwl_mvm_power_configure_uapsd()
219 if (cmd->uapsd_ac_flags == (BIT(IEEE80211_AC_VO) | iwl_mvm_power_configure_uapsd()
223 cmd->flags |= cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK); iwl_mvm_power_configure_uapsd()
224 cmd->snooze_interval = cpu_to_le16(IWL_MVM_PS_SNOOZE_INTERVAL); iwl_mvm_power_configure_uapsd()
225 cmd->snooze_window = (mvm->cur_ucode == IWL_UCODE_WOWLAN) ? iwl_mvm_power_configure_uapsd()
230 cmd->uapsd_max_sp = IWL_UAPSD_MAX_SP; iwl_mvm_power_configure_uapsd()
232 if (mvm->cur_ucode == IWL_UCODE_WOWLAN || cmd->flags & iwl_mvm_power_configure_uapsd()
234 cmd->rx_data_timeout_uapsd = iwl_mvm_power_configure_uapsd()
236 cmd->tx_data_timeout_uapsd = iwl_mvm_power_configure_uapsd()
239 cmd->rx_data_timeout_uapsd = iwl_mvm_power_configure_uapsd()
241 cmd->tx_data_timeout_uapsd = iwl_mvm_power_configure_uapsd()
245 if (cmd->flags & cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK)) { iwl_mvm_power_configure_uapsd()
246 cmd->heavy_tx_thld_packets = iwl_mvm_power_configure_uapsd()
248 cmd->heavy_rx_thld_packets = iwl_mvm_power_configure_uapsd()
251 cmd->heavy_tx_thld_packets = iwl_mvm_power_configure_uapsd()
253 cmd->heavy_rx_thld_packets = iwl_mvm_power_configure_uapsd()
256 cmd->heavy_tx_thld_percentage = iwl_mvm_power_configure_uapsd()
258 cmd->heavy_rx_thld_percentage = iwl_mvm_power_configure_uapsd()
313 struct iwl_mac_power_cmd *cmd, iwl_mvm_power_config_skip_dtim()
320 cmd->skip_dtim_periods = 0; iwl_mvm_power_config_skip_dtim()
321 cmd->flags &= ~cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK); iwl_mvm_power_config_skip_dtim()
345 cmd->skip_dtim_periods = 1 + skip; iwl_mvm_power_config_skip_dtim()
346 cmd->flags |= cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK); iwl_mvm_power_config_skip_dtim()
351 struct iwl_mac_power_cmd *cmd, iwl_mvm_power_build_cmd()
359 cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, iwl_mvm_power_build_cmd()
373 cmd->keep_alive_seconds = cpu_to_le16(keep_alive); iwl_mvm_power_build_cmd()
378 cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK); iwl_mvm_power_build_cmd()
389 cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK); iwl_mvm_power_build_cmd()
394 cmd->flags |= cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK); iwl_mvm_power_build_cmd()
395 cmd->lprx_rssi_threshold = POWER_LPRX_RSSI_THRESHOLD; iwl_mvm_power_build_cmd()
398 iwl_mvm_power_config_skip_dtim(mvm, vif, cmd, host_awake); iwl_mvm_power_build_cmd()
401 cmd->rx_data_timeout = iwl_mvm_power_build_cmd()
403 cmd->tx_data_timeout = iwl_mvm_power_build_cmd()
408 cmd->tx_data_timeout = iwl_mvm_power_build_cmd()
410 cmd->rx_data_timeout = iwl_mvm_power_build_cmd()
413 cmd->rx_data_timeout = iwl_mvm_power_build_cmd()
415 cmd->tx_data_timeout = iwl_mvm_power_build_cmd()
420 iwl_mvm_power_configure_uapsd(mvm, vif, cmd); iwl_mvm_power_build_cmd()
424 cmd->keep_alive_seconds = iwl_mvm_power_build_cmd()
428 cmd->flags |= iwl_mvm_power_build_cmd()
431 cmd->flags &= iwl_mvm_power_build_cmd()
435 cmd->rx_data_timeout = iwl_mvm_power_build_cmd()
438 cmd->tx_data_timeout = iwl_mvm_power_build_cmd()
441 cmd->skip_dtim_periods = mvmvif->dbgfs_pm.skip_dtim_periods; iwl_mvm_power_build_cmd()
444 cmd->flags |= cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK); iwl_mvm_power_build_cmd()
446 cmd->flags &= cpu_to_le16(~POWER_FLAGS_LPRX_ENA_MSK); iwl_mvm_power_build_cmd()
449 cmd->lprx_rssi_threshold = mvmvif->dbgfs_pm.lprx_rssi_threshold; iwl_mvm_power_build_cmd()
452 cmd->flags |= iwl_mvm_power_build_cmd()
455 cmd->flags &= iwl_mvm_power_build_cmd()
461 cmd->flags |= cpu_to_le16(flag); iwl_mvm_power_build_cmd()
463 cmd->flags &= cpu_to_le16(flag); iwl_mvm_power_build_cmd()
471 struct iwl_mac_power_cmd cmd = {}; iwl_mvm_power_send_cmd() local
473 iwl_mvm_power_build_cmd(mvm, vif, &cmd, iwl_mvm_power_send_cmd()
475 iwl_mvm_power_log(mvm, &cmd); iwl_mvm_power_send_cmd()
477 memcpy(&iwl_mvm_vif_from_mac80211(vif)->mac_pwr_cmd, &cmd, sizeof(cmd)); iwl_mvm_power_send_cmd()
481 sizeof(cmd), &cmd); iwl_mvm_power_send_cmd()
486 struct iwl_device_power_cmd cmd = { iwl_mvm_power_update_device() local
494 cmd.flags |= cpu_to_le16(DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK); iwl_mvm_power_update_device()
499 cmd.flags &= iwl_mvm_power_update_device()
504 cmd.flags); iwl_mvm_power_update_device()
506 return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, 0, sizeof(cmd), iwl_mvm_power_update_device()
507 &cmd); iwl_mvm_power_update_device()
714 struct iwl_mac_power_cmd cmd = {}; iwl_mvm_power_mac_dbgfs_read() local
718 memcpy(&cmd, &mvmvif->mac_pwr_cmd, sizeof(cmd)); iwl_mvm_power_mac_dbgfs_read()
724 le16_to_cpu(cmd.flags)); iwl_mvm_power_mac_dbgfs_read()
726 le16_to_cpu(cmd.keep_alive_seconds)); iwl_mvm_power_mac_dbgfs_read()
728 if (!(cmd.flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK))) iwl_mvm_power_mac_dbgfs_read()
732 (cmd.flags & iwl_mvm_power_mac_dbgfs_read()
735 cmd.skip_dtim_periods); iwl_mvm_power_mac_dbgfs_read()
736 if (!(cmd.flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK))) { iwl_mvm_power_mac_dbgfs_read()
738 le32_to_cpu(cmd.rx_data_timeout)); iwl_mvm_power_mac_dbgfs_read()
740 le32_to_cpu(cmd.tx_data_timeout)); iwl_mvm_power_mac_dbgfs_read()
742 if (cmd.flags & cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK)) iwl_mvm_power_mac_dbgfs_read()
745 cmd.lprx_rssi_threshold); iwl_mvm_power_mac_dbgfs_read()
747 if (!(cmd.flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK))) iwl_mvm_power_mac_dbgfs_read()
751 le32_to_cpu(cmd.rx_data_timeout_uapsd)); iwl_mvm_power_mac_dbgfs_read()
753 le32_to_cpu(cmd.tx_data_timeout_uapsd)); iwl_mvm_power_mac_dbgfs_read()
754 pos += scnprintf(buf+pos, bufsz-pos, "qndp_tid = %d\n", cmd.qndp_tid); iwl_mvm_power_mac_dbgfs_read()
756 cmd.uapsd_ac_flags); iwl_mvm_power_mac_dbgfs_read()
758 cmd.uapsd_max_sp); iwl_mvm_power_mac_dbgfs_read()
760 cmd.heavy_tx_thld_packets); iwl_mvm_power_mac_dbgfs_read()
762 cmd.heavy_rx_thld_packets); iwl_mvm_power_mac_dbgfs_read()
764 cmd.heavy_tx_thld_percentage); iwl_mvm_power_mac_dbgfs_read()
766 cmd.heavy_rx_thld_percentage); iwl_mvm_power_mac_dbgfs_read()
768 (cmd.flags & iwl_mvm_power_mac_dbgfs_read()
772 if (!(cmd.flags & cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK))) iwl_mvm_power_mac_dbgfs_read()
776 cmd.snooze_interval); iwl_mvm_power_mac_dbgfs_read()
778 cmd.snooze_window); iwl_mvm_power_mac_dbgfs_read()
785 struct iwl_beacon_filter_cmd *cmd) iwl_mvm_beacon_filter_debugfs_parameters()
791 cmd->bf_energy_delta = cpu_to_le32(dbgfs_bf->bf_energy_delta); iwl_mvm_beacon_filter_debugfs_parameters()
793 cmd->bf_roaming_energy_delta = iwl_mvm_beacon_filter_debugfs_parameters()
796 cmd->bf_roaming_state = cpu_to_le32(dbgfs_bf->bf_roaming_state); iwl_mvm_beacon_filter_debugfs_parameters()
798 cmd->bf_temp_threshold = iwl_mvm_beacon_filter_debugfs_parameters()
801 cmd->bf_temp_fast_filter = iwl_mvm_beacon_filter_debugfs_parameters()
804 cmd->bf_temp_slow_filter = iwl_mvm_beacon_filter_debugfs_parameters()
807 cmd->bf_debug_flag = cpu_to_le32(dbgfs_bf->bf_debug_flag); iwl_mvm_beacon_filter_debugfs_parameters()
809 cmd->bf_escape_timer = cpu_to_le32(dbgfs_bf->bf_escape_timer); iwl_mvm_beacon_filter_debugfs_parameters()
811 cmd->ba_escape_timer = cpu_to_le32(dbgfs_bf->ba_escape_timer); iwl_mvm_beacon_filter_debugfs_parameters()
813 cmd->ba_enable_beacon_abort = iwl_mvm_beacon_filter_debugfs_parameters()
820 struct iwl_beacon_filter_cmd *cmd, _iwl_mvm_enable_beacon_filter()
831 iwl_mvm_beacon_filter_set_cqm_params(mvm, vif, cmd, d0i3); _iwl_mvm_enable_beacon_filter()
833 iwl_mvm_beacon_filter_debugfs_parameters(vif, cmd); _iwl_mvm_enable_beacon_filter()
834 ret = iwl_mvm_beacon_filter_send_cmd(mvm, cmd, cmd_flags); _iwl_mvm_enable_beacon_filter()
847 struct iwl_beacon_filter_cmd cmd = { iwl_mvm_enable_beacon_filter() local
852 return _iwl_mvm_enable_beacon_filter(mvm, vif, &cmd, flags, false); iwl_mvm_enable_beacon_filter()
860 struct iwl_beacon_filter_cmd cmd = { iwl_mvm_update_beacon_abort() local
869 cmd.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER_D3); iwl_mvm_update_beacon_abort()
872 return _iwl_mvm_enable_beacon_filter(mvm, vif, &cmd, 0, false); iwl_mvm_update_beacon_abort()
879 struct iwl_beacon_filter_cmd cmd = {}; iwl_mvm_disable_beacon_filter() local
886 ret = iwl_mvm_beacon_filter_send_cmd(mvm, &cmd, flags); iwl_mvm_disable_beacon_filter()
1002 struct iwl_mac_power_cmd cmd = {}; iwl_mvm_update_d0i3_power_mode() local
1010 iwl_mvm_power_build_cmd(mvm, vif, &cmd, !enable); iwl_mvm_update_d0i3_power_mode()
1012 iwl_mvm_power_log(mvm, &cmd); iwl_mvm_update_d0i3_power_mode()
1014 memcpy(&mvmvif->mac_pwr_cmd, &cmd, sizeof(cmd)); iwl_mvm_update_d0i3_power_mode()
1017 sizeof(cmd), &cmd); iwl_mvm_update_d0i3_power_mode()
83 iwl_mvm_beacon_filter_send_cmd(struct iwl_mvm *mvm, struct iwl_beacon_filter_cmd *cmd, u32 flags) iwl_mvm_beacon_filter_send_cmd() argument
115 iwl_mvm_beacon_filter_set_cqm_params(struct iwl_mvm *mvm, struct ieee80211_vif *vif, struct iwl_beacon_filter_cmd *cmd, bool d0i3) iwl_mvm_beacon_filter_set_cqm_params() argument
132 iwl_mvm_power_log(struct iwl_mvm *mvm, struct iwl_mac_power_cmd *cmd) iwl_mvm_power_log() argument
169 iwl_mvm_power_configure_uapsd(struct iwl_mvm *mvm, struct ieee80211_vif *vif, struct iwl_mac_power_cmd *cmd) iwl_mvm_power_configure_uapsd() argument
311 iwl_mvm_power_config_skip_dtim(struct iwl_mvm *mvm, struct ieee80211_vif *vif, struct iwl_mac_power_cmd *cmd, bool host_awake) iwl_mvm_power_config_skip_dtim() argument
349 iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif, struct iwl_mac_power_cmd *cmd, bool host_awake) iwl_mvm_power_build_cmd() argument
784 iwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif, struct iwl_beacon_filter_cmd *cmd) iwl_mvm_beacon_filter_debugfs_parameters() argument
818 _iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm, struct ieee80211_vif *vif, struct iwl_beacon_filter_cmd *cmd, u32 cmd_flags, bool d0i3) _iwl_mvm_enable_beacon_filter() argument
H A Doffloading.c70 struct iwl_wowlan_config_cmd *cmd) iwl_mvm_set_wowlan_qos_seq()
82 cmd->qos_seq[i] = cpu_to_le16(seq); iwl_mvm_set_wowlan_qos_seq()
96 } cmd = {}; iwl_mvm_send_proto_offload() local
100 .data[0] = &cmd, iwl_mvm_send_proto_offload()
118 nsc = cmd.v3s.ns_config; iwl_mvm_send_proto_offload()
120 addrs = cmd.v3s.targ_addrs; iwl_mvm_send_proto_offload()
123 nsc = cmd.v3l.ns_config; iwl_mvm_send_proto_offload()
125 addrs = cmd.v3l.targ_addrs; iwl_mvm_send_proto_offload()
158 cmd.v3s.num_valid_ipv6_addrs = cpu_to_le32(i); iwl_mvm_send_proto_offload()
160 cmd.v3l.num_valid_ipv6_addrs = cpu_to_le32(i); iwl_mvm_send_proto_offload()
164 memcpy(cmd.v2.ndp_mac_addr, vif->addr, ETH_ALEN); iwl_mvm_send_proto_offload()
167 BUILD_BUG_ON(sizeof(cmd.v2.target_ipv6_addr[0]) != iwl_mvm_send_proto_offload()
172 memcpy(cmd.v2.target_ipv6_addr[i], iwl_mvm_send_proto_offload()
174 sizeof(cmd.v2.target_ipv6_addr[i])); iwl_mvm_send_proto_offload()
178 memcpy(cmd.v1.ndp_mac_addr, vif->addr, ETH_ALEN); iwl_mvm_send_proto_offload()
181 BUILD_BUG_ON(sizeof(cmd.v1.target_ipv6_addr[0]) != iwl_mvm_send_proto_offload()
186 memcpy(cmd.v1.target_ipv6_addr[i], iwl_mvm_send_proto_offload()
188 sizeof(cmd.v1.target_ipv6_addr[i])); iwl_mvm_send_proto_offload()
193 common = &cmd.v3s.common; iwl_mvm_send_proto_offload()
194 size = sizeof(cmd.v3s); iwl_mvm_send_proto_offload()
196 common = &cmd.v3l.common; iwl_mvm_send_proto_offload()
197 size = sizeof(cmd.v3l); iwl_mvm_send_proto_offload()
199 common = &cmd.v2.common; iwl_mvm_send_proto_offload()
200 size = sizeof(cmd.v2); iwl_mvm_send_proto_offload()
202 common = &cmd.v1.common; iwl_mvm_send_proto_offload()
203 size = sizeof(cmd.v1); iwl_mvm_send_proto_offload()
69 iwl_mvm_set_wowlan_qos_seq(struct iwl_mvm_sta *mvm_ap_sta, struct iwl_wowlan_config_cmd *cmd) iwl_mvm_set_wowlan_qos_seq() argument
/linux-4.4.14/drivers/misc/cxl/
H A Dtrace.h308 TP_PROTO(struct cxl_context *ctx, u64 cmd),
310 TP_ARGS(ctx, cmd),
316 __field(u64, cmd)
323 __entry->cmd = cmd;
326 TP_printk("afu%i.%i pe=%i cmd=%s",
330 __print_symbolic_u64(__entry->cmd, LLCMD_NAMES)
335 TP_PROTO(struct cxl_context *ctx, u64 cmd, int rc),
337 TP_ARGS(ctx, cmd, rc),
343 __field(u64, cmd)
352 __entry->cmd = cmd;
355 TP_printk("afu%i.%i pe=%i cmd=%s rc=%i",
359 __print_symbolic_u64(__entry->cmd, LLCMD_NAMES),
365 TP_PROTO(struct cxl_afu *afu, u64 cmd),
367 TP_ARGS(afu, cmd),
372 __field(u64, cmd)
378 __entry->cmd = cmd;
381 TP_printk("afu%i.%i cmd=%s",
384 __print_symbolic_u64(__entry->cmd, AFU_COMMANDS)
389 TP_PROTO(struct cxl_afu *afu, u64 cmd, int rc),
391 TP_ARGS(afu, cmd, rc),
396 __field(u64, cmd)
404 __entry->cmd = cmd;
407 TP_printk("afu%i.%i cmd=%s rc=%i",
410 __print_symbolic_u64(__entry->cmd, AFU_COMMANDS),
416 TP_PROTO(struct cxl_afu *afu, u64 cmd),
417 TP_ARGS(afu, cmd)
421 TP_PROTO(struct cxl_afu *afu, u64 cmd, int rc),
422 TP_ARGS(afu, cmd, rc)
426 TP_PROTO(struct cxl_afu *afu, u64 cmd),
427 TP_ARGS(afu, cmd),
429 TP_printk("psl%i.%i cmd=%s",
432 __print_symbolic_u64(__entry->cmd, PSL_COMMANDS)
437 TP_PROTO(struct cxl_afu *afu, u64 cmd, int rc),
438 TP_ARGS(afu, cmd, rc),
440 TP_printk("psl%i.%i cmd=%s rc=%i",
443 __print_symbolic_u64(__entry->cmd, PSL_COMMANDS),
/linux-4.4.14/arch/arc/include/asm/
H A Dmcip.h25 unsigned int pad:8, param:16, cmd:8; member in struct:mcip_cmd
27 unsigned int cmd:8, param:16, pad:8;
61 * - Simple commands write {cmd:8,param:16} to MCIP_CMD aux reg
63 * - More involved commands setup MCIP_WDATA with cmd specific data
66 static inline void __mcip_cmd(unsigned int cmd, unsigned int param) __mcip_cmd() argument
71 buf.cmd = cmd; __mcip_cmd()
78 * Setup additional data for a cmd
81 static inline void __mcip_cmd_data(unsigned int cmd, unsigned int param, __mcip_cmd_data() argument
86 __mcip_cmd(cmd, param); __mcip_cmd_data()
/linux-4.4.14/tools/perf/
H A Dbuiltin-data.c18 #define for_each_cmd(cmd) \
19 for (cmd = data_cmds; cmd && cmd->name; cmd++)
34 struct data_cmd *cmd; print_usage() local
40 for_each_cmd(cmd) { for_each_cmd()
41 printf("\t %s\t- %s\n", cmd->name, cmd->summary); for_each_cmd()
98 struct data_cmd *cmd; cmd_data() local
112 for_each_cmd(cmd) { for_each_cmd()
113 if (strcmp(cmd->name, cmdstr)) for_each_cmd()
116 return cmd->fn(argc, argv, prefix); for_each_cmd()
H A Dperf.c34 const char *cmd; member in struct:cmd_struct
72 const char *cmd; member in struct:pager_config
79 if (!prefixcmp(var, "pager.") && !strcmp(var + 6, c->cmd)) pager_command_config()
85 int check_pager_config(const char *cmd) check_pager_config() argument
88 c.cmd = cmd; check_pager_config()
97 if (!prefixcmp(var, "tui.") && !strcmp(var + 4, c->cmd)) browser_command_config()
99 if (!prefixcmp(var, "gtk.") && !strcmp(var + 4, c->cmd)) browser_command_config()
108 static int check_browser_config(const char *cmd) check_browser_config() argument
111 c.cmd = cmd; check_browser_config()
153 const char *cmd = (*argv)[0]; handle_options() local
154 if (cmd[0] != '-') handle_options()
162 if (!strcmp(cmd, "--help") || !strcmp(cmd, "--version")) handle_options()
169 if (!strcmp(cmd, "-h")) { handle_options()
174 if (!strcmp(cmd, "-v")) { handle_options()
182 if (!prefixcmp(cmd, CMD_EXEC_PATH)) { handle_options()
183 cmd += strlen(CMD_EXEC_PATH); handle_options()
184 if (*cmd == '=') handle_options()
185 perf_set_argv_exec_path(cmd + 1); handle_options()
190 } else if (!strcmp(cmd, "--html-path")) { handle_options()
193 } else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) { handle_options()
195 } else if (!strcmp(cmd, "--no-pager")) { handle_options()
199 } else if (!strcmp(cmd, "--perf-dir")) { handle_options()
210 } else if (!prefixcmp(cmd, CMD_PERF_DIR)) { handle_options()
211 setenv(PERF_DIR_ENVIRONMENT, cmd + strlen(CMD_PERF_DIR), 1); handle_options()
214 } else if (!strcmp(cmd, "--work-tree")) { handle_options()
224 } else if (!prefixcmp(cmd, CMD_WORK_TREE)) { handle_options()
225 setenv(PERF_WORK_TREE_ENVIRONMENT, cmd + strlen(CMD_WORK_TREE), 1); handle_options()
228 } else if (!strcmp(cmd, "--debugfs-dir")) { handle_options()
238 } else if (!strcmp(cmd, "--buildid-dir")) { handle_options()
248 } else if (!prefixcmp(cmd, CMD_DEBUGFS_DIR)) { handle_options()
249 tracing_path_set(cmd + strlen(CMD_DEBUGFS_DIR)); handle_options()
253 } else if (!strcmp(cmd, "--list-cmds")) { handle_options()
258 printf("%s ", p->cmd); handle_options()
262 } else if (!strcmp(cmd, "--list-opts")) { handle_options()
271 } else if (!strcmp(cmd, "--debug")) { handle_options()
282 fprintf(stderr, "Unknown option: %s\n", cmd); handle_options()
378 use_browser = check_browser_config(p->cmd); run_builtin()
381 use_pager = check_pager_config(p->cmd); run_builtin()
424 const char *cmd = argv[0]; handle_internal_command() local
432 argv[0] = cmd = argv0; handle_internal_command()
437 /* Turn "perf cmd --help" into "perf help cmd" */ handle_internal_command()
440 argv[0] = cmd = "help"; handle_internal_command()
445 if (strcmp(p->cmd, cmd)) handle_internal_command()
453 struct strbuf cmd = STRBUF_INIT; execv_dashed_external() local
457 strbuf_addf(&cmd, "perf-%s", argv[0]); execv_dashed_external()
466 argv[0] = cmd.buf; execv_dashed_external()
482 strbuf_release(&cmd); execv_dashed_external()
528 const char *cmd; main() local
535 cmd = perf_extract_argv0_path(argv[0]); main()
536 if (!cmd) main()
537 cmd = "perf-help"; main()
552 if (!prefixcmp(cmd, "perf-")) { main()
553 cmd += 5; main()
554 argv[0] = cmd; main()
556 fprintf(stderr, "cannot handle %s internally", cmd); main()
559 if (!prefixcmp(cmd, "trace")) { main()
588 cmd = argv[0]; main()
616 cmd, argv[0]); main()
620 cmd = argv[0] = help_unknown_cmd(cmd); main()
627 cmd, strerror_r(errno, sbuf, sizeof(sbuf))); main()
/linux-4.4.14/drivers/gpu/drm/vmwgfx/
H A Dvmwgfx_gmr.c45 uint32_t *cmd; vmw_gmr2_bind() local
47 uint32_t define_size = sizeof(define_cmd) + sizeof(*cmd); vmw_gmr2_bind()
49 uint32_t remap_size = VMW_PPN_SIZE * num_pages + (sizeof(remap_cmd) + sizeof(*cmd)) * remap_num; vmw_gmr2_bind()
54 cmd_orig = cmd = vmw_fifo_reserve(dev_priv, cmd_size); vmw_gmr2_bind()
55 if (unlikely(cmd == NULL)) vmw_gmr2_bind()
61 *cmd++ = SVGA_CMD_DEFINE_GMR2; vmw_gmr2_bind()
62 memcpy(cmd, &define_cmd, sizeof(define_cmd)); vmw_gmr2_bind()
63 cmd += sizeof(define_cmd) / sizeof(*cmd); vmw_gmr2_bind()
71 remap_cmd.flags = (VMW_PPN_SIZE > sizeof(*cmd)) ? vmw_gmr2_bind()
80 *cmd++ = SVGA_CMD_REMAP_GMR2; vmw_gmr2_bind()
81 memcpy(cmd, &remap_cmd, sizeof(remap_cmd)); vmw_gmr2_bind()
82 cmd += sizeof(remap_cmd) / sizeof(*cmd); vmw_gmr2_bind()
86 *cmd = vmw_piter_dma_addr(iter) >> PAGE_SHIFT; vmw_gmr2_bind()
88 *((uint64_t *)cmd) = vmw_piter_dma_addr(iter) >> vmw_gmr2_bind()
91 cmd += VMW_PPN_SIZE / sizeof(*cmd); vmw_gmr2_bind()
99 BUG_ON(cmd != cmd_orig + cmd_size / sizeof(*cmd)); vmw_gmr2_bind()
111 uint32_t *cmd; vmw_gmr2_unbind() local
113 cmd = vmw_fifo_reserve(dev_priv, define_size); vmw_gmr2_unbind()
114 if (unlikely(cmd == NULL)) { vmw_gmr2_unbind()
121 *cmd++ = SVGA_CMD_DEFINE_GMR2; vmw_gmr2_unbind()
122 memcpy(cmd, &define_cmd, sizeof(define_cmd)); vmw_gmr2_unbind()
H A Dvmwgfx_context.c138 } *cmd; vmw_hw_context_destroy() local
158 cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); vmw_hw_context_destroy()
159 if (unlikely(cmd == NULL)) { vmw_hw_context_destroy()
165 cmd->header.id = SVGA_3D_CMD_CONTEXT_DESTROY; vmw_hw_context_destroy()
166 cmd->header.size = sizeof(cmd->body); vmw_hw_context_destroy()
167 cmd->body.cid = res->id; vmw_hw_context_destroy()
169 vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_hw_context_destroy()
244 } *cmd; vmw_context_init() local
263 cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); vmw_context_init()
264 if (unlikely(cmd == NULL)) { vmw_context_init()
270 cmd->header.id = SVGA_3D_CMD_CONTEXT_DEFINE; vmw_context_init()
271 cmd->header.size = sizeof(cmd->body); vmw_context_init()
272 cmd->body.cid = res->id; vmw_context_init()
274 vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_context_init()
299 } *cmd; vmw_gb_context_create() local
315 cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); vmw_gb_context_create()
316 if (unlikely(cmd == NULL)) { vmw_gb_context_create()
323 cmd->header.id = SVGA_3D_CMD_DEFINE_GB_CONTEXT; vmw_gb_context_create()
324 cmd->header.size = sizeof(cmd->body); vmw_gb_context_create()
325 cmd->body.cid = res->id; vmw_gb_context_create()
326 vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_gb_context_create()
344 } *cmd; vmw_gb_context_bind() local
349 cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); vmw_gb_context_bind()
350 if (unlikely(cmd == NULL)) { vmw_gb_context_bind()
355 cmd->header.id = SVGA_3D_CMD_BIND_GB_CONTEXT; vmw_gb_context_bind()
356 cmd->header.size = sizeof(cmd->body); vmw_gb_context_bind()
357 cmd->body.cid = res->id; vmw_gb_context_bind()
358 cmd->body.mobid = bo->mem.start; vmw_gb_context_bind()
359 cmd->body.validContents = res->backup_dirty; vmw_gb_context_bind()
361 vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_gb_context_bind()
385 uint8_t *cmd; vmw_gb_context_unbind() local
395 cmd = vmw_fifo_reserve(dev_priv, submit_size); vmw_gb_context_unbind()
396 if (unlikely(cmd == NULL)) { vmw_gb_context_unbind()
403 cmd2 = (void *) cmd; vmw_gb_context_unbind()
405 cmd1 = (void *) cmd; vmw_gb_context_unbind()
440 } *cmd; vmw_gb_context_destroy() local
445 cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); vmw_gb_context_destroy()
446 if (unlikely(cmd == NULL)) { vmw_gb_context_destroy()
452 cmd->header.id = SVGA_3D_CMD_DESTROY_GB_CONTEXT; vmw_gb_context_destroy()
453 cmd->header.size = sizeof(cmd->body); vmw_gb_context_destroy()
454 cmd->body.cid = res->id; vmw_gb_context_destroy()
455 vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_gb_context_destroy()
475 } *cmd; vmw_dx_context_create() local
491 cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); vmw_dx_context_create()
492 if (unlikely(cmd == NULL)) { vmw_dx_context_create()
499 cmd->header.id = SVGA_3D_CMD_DX_DEFINE_CONTEXT; vmw_dx_context_create()
500 cmd->header.size = sizeof(cmd->body); vmw_dx_context_create()
501 cmd->body.cid = res->id; vmw_dx_context_create()
502 vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_dx_context_create()
520 } *cmd; vmw_dx_context_bind() local
525 cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); vmw_dx_context_bind()
526 if (unlikely(cmd == NULL)) { vmw_dx_context_bind()
532 cmd->header.id = SVGA_3D_CMD_DX_BIND_CONTEXT; vmw_dx_context_bind()
533 cmd->header.size = sizeof(cmd->body); vmw_dx_context_bind()
534 cmd->body.cid = res->id; vmw_dx_context_bind()
535 cmd->body.mobid = bo->mem.start; vmw_dx_context_bind()
536 cmd->body.validContents = res->backup_dirty; vmw_dx_context_bind()
538 vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_dx_context_bind()
602 uint8_t *cmd; vmw_dx_context_unbind() local
619 cmd = vmw_fifo_reserve(dev_priv, submit_size); vmw_dx_context_unbind()
620 if (unlikely(cmd == NULL)) { vmw_dx_context_unbind()
627 cmd2 = (void *) cmd; vmw_dx_context_unbind()
629 cmd1 = (void *) cmd; vmw_dx_context_unbind()
664 } *cmd; vmw_dx_context_destroy() local
669 cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); vmw_dx_context_destroy()
670 if (unlikely(cmd == NULL)) { vmw_dx_context_destroy()
676 cmd->header.id = SVGA_3D_CMD_DX_DESTROY_CONTEXT; vmw_dx_context_destroy()
677 cmd->header.size = sizeof(cmd->body); vmw_dx_context_destroy()
678 cmd->body.cid = res->id; vmw_dx_context_destroy()
679 vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_dx_context_destroy()
H A Dvmwgfx_binding.c500 } *cmd; vmw_binding_scrub_shader() local
502 cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); vmw_binding_scrub_shader()
503 if (unlikely(cmd == NULL)) { vmw_binding_scrub_shader()
509 cmd->header.id = SVGA_3D_CMD_SET_SHADER; vmw_binding_scrub_shader()
510 cmd->header.size = sizeof(cmd->body); vmw_binding_scrub_shader()
511 cmd->body.cid = bi->ctx->id; vmw_binding_scrub_shader()
512 cmd->body.type = binding->shader_slot + SVGA3D_SHADERTYPE_MIN; vmw_binding_scrub_shader()
513 cmd->body.shid = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID); vmw_binding_scrub_shader()
514 vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_binding_scrub_shader()
535 } *cmd; vmw_binding_scrub_render_target() local
537 cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); vmw_binding_scrub_render_target()
538 if (unlikely(cmd == NULL)) { vmw_binding_scrub_render_target()
544 cmd->header.id = SVGA_3D_CMD_SETRENDERTARGET; vmw_binding_scrub_render_target()
545 cmd->header.size = sizeof(cmd->body); vmw_binding_scrub_render_target()
546 cmd->body.cid = bi->ctx->id; vmw_binding_scrub_render_target()
547 cmd->body.type = binding->slot; vmw_binding_scrub_render_target()
548 cmd->body.target.sid = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID); vmw_binding_scrub_render_target()
549 cmd->body.target.face = 0; vmw_binding_scrub_render_target()
550 cmd->body.target.mipmap = 0; vmw_binding_scrub_render_target()
551 vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_binding_scrub_render_target()
577 } *cmd; vmw_binding_scrub_texture() local
579 cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); vmw_binding_scrub_texture()
580 if (unlikely(cmd == NULL)) { vmw_binding_scrub_texture()
586 cmd->header.id = SVGA_3D_CMD_SETTEXTURESTATE; vmw_binding_scrub_texture()
587 cmd->header.size = sizeof(cmd->body); vmw_binding_scrub_texture()
588 cmd->body.c.cid = bi->ctx->id; vmw_binding_scrub_texture()
589 cmd->body.s1.stage = binding->texture_stage; vmw_binding_scrub_texture()
590 cmd->body.s1.name = SVGA3D_TS_BIND_TEXTURE; vmw_binding_scrub_texture()
591 cmd->body.s1.value = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID); vmw_binding_scrub_texture()
592 vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_binding_scrub_texture()
611 } *cmd; vmw_binding_scrub_dx_shader() local
613 cmd = vmw_fifo_reserve_dx(dev_priv, sizeof(*cmd), bi->ctx->id); vmw_binding_scrub_dx_shader()
614 if (unlikely(cmd == NULL)) { vmw_binding_scrub_dx_shader()
619 cmd->header.id = SVGA_3D_CMD_DX_SET_SHADER; vmw_binding_scrub_dx_shader()
620 cmd->header.size = sizeof(cmd->body); vmw_binding_scrub_dx_shader()
621 cmd->body.type = binding->shader_slot + SVGA3D_SHADERTYPE_MIN; vmw_binding_scrub_dx_shader()
622 cmd->body.shaderId = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID); vmw_binding_scrub_dx_shader()
623 vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_binding_scrub_dx_shader()
642 } *cmd; vmw_binding_scrub_cb() local
644 cmd = vmw_fifo_reserve_dx(dev_priv, sizeof(*cmd), bi->ctx->id); vmw_binding_scrub_cb()
645 if (unlikely(cmd == NULL)) { vmw_binding_scrub_cb()
651 cmd->header.id = SVGA_3D_CMD_DX_SET_SINGLE_CONSTANT_BUFFER; vmw_binding_scrub_cb()
652 cmd->header.size = sizeof(cmd->body); vmw_binding_scrub_cb()
653 cmd->body.slot = binding->slot; vmw_binding_scrub_cb()
654 cmd->body.type = binding->shader_slot + SVGA3D_SHADERTYPE_MIN; vmw_binding_scrub_cb()
656 cmd->body.offsetInBytes = binding->offset; vmw_binding_scrub_cb()
657 cmd->body.sizeInBytes = binding->size; vmw_binding_scrub_cb()
658 cmd->body.sid = bi->res->id; vmw_binding_scrub_cb()
660 cmd->body.offsetInBytes = 0; vmw_binding_scrub_cb()
661 cmd->body.sizeInBytes = 0; vmw_binding_scrub_cb()
662 cmd->body.sid = SVGA3D_INVALID_ID; vmw_binding_scrub_cb()
664 vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_binding_scrub_cb()
759 } *cmd; vmw_emit_set_sr() local
770 cmd_size = sizeof(*cmd) + view_id_size; vmw_emit_set_sr()
771 cmd = vmw_fifo_reserve_dx(ctx->dev_priv, cmd_size, ctx->id); vmw_emit_set_sr()
772 if (unlikely(cmd == NULL)) { vmw_emit_set_sr()
778 cmd->header.id = SVGA_3D_CMD_DX_SET_SHADER_RESOURCES; vmw_emit_set_sr()
779 cmd->header.size = sizeof(cmd->body) + view_id_size; vmw_emit_set_sr()
780 cmd->body.type = shader_slot + SVGA3D_SHADERTYPE_MIN; vmw_emit_set_sr()
781 cmd->body.startView = cbs->bind_first_slot; vmw_emit_set_sr()
783 memcpy(&cmd[1], cbs->bind_cmd_buffer, view_id_size); vmw_emit_set_sr()
803 } *cmd; vmw_emit_set_rt() local
809 cmd_size = sizeof(*cmd) + view_id_size; vmw_emit_set_rt()
810 cmd = vmw_fifo_reserve_dx(ctx->dev_priv, cmd_size, ctx->id); vmw_emit_set_rt()
811 if (unlikely(cmd == NULL)) { vmw_emit_set_rt()
817 cmd->header.id = SVGA_3D_CMD_DX_SET_RENDERTARGETS; vmw_emit_set_rt()
818 cmd->header.size = sizeof(cmd->body) + view_id_size; vmw_emit_set_rt()
821 cmd->body.depthStencilViewId = cbs->ds_view.bi.res->id; vmw_emit_set_rt()
823 cmd->body.depthStencilViewId = SVGA3D_INVALID_ID; vmw_emit_set_rt()
825 memcpy(&cmd[1], cbs->bind_cmd_buffer, view_id_size); vmw_emit_set_rt()
887 } *cmd; vmw_emit_set_so() local
896 cmd_size = sizeof(*cmd) + so_target_size; vmw_emit_set_so()
897 cmd = vmw_fifo_reserve_dx(ctx->dev_priv, cmd_size, ctx->id); vmw_emit_set_so()
898 if (unlikely(cmd == NULL)) { vmw_emit_set_so()
904 cmd->header.id = SVGA_3D_CMD_DX_SET_SOTARGETS; vmw_emit_set_so()
905 cmd->header.size = sizeof(cmd->body) + so_target_size; vmw_emit_set_so()
906 memcpy(&cmd[1], cbs->bind_cmd_buffer, so_target_size); vmw_emit_set_so()
1003 } *cmd; vmw_emit_set_vb() local
1013 cmd_size = sizeof(*cmd) + set_vb_size; vmw_emit_set_vb()
1014 cmd = vmw_fifo_reserve_dx(ctx->dev_priv, cmd_size, ctx->id); vmw_emit_set_vb()
1015 if (unlikely(cmd == NULL)) { vmw_emit_set_vb()
1021 cmd->header.id = SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS; vmw_emit_set_vb()
1022 cmd->header.size = sizeof(cmd->body) + set_vb_size; vmw_emit_set_vb()
1023 cmd->body.startBuffer = cbs->bind_first_slot; vmw_emit_set_vb()
1025 memcpy(&cmd[1], cbs->bind_cmd_buffer, set_vb_size); vmw_emit_set_vb()
1168 } *cmd; vmw_binding_scrub_ib() local
1170 cmd = vmw_fifo_reserve_dx(dev_priv, sizeof(*cmd), bi->ctx->id); vmw_binding_scrub_ib()
1171 if (unlikely(cmd == NULL)) { vmw_binding_scrub_ib()
1176 cmd->header.id = SVGA_3D_CMD_DX_SET_INDEX_BUFFER; vmw_binding_scrub_ib()
1177 cmd->header.size = sizeof(cmd->body); vmw_binding_scrub_ib()
1179 cmd->body.sid = bi->res->id; vmw_binding_scrub_ib()
1180 cmd->body.format = binding->format; vmw_binding_scrub_ib()
1181 cmd->body.offset = binding->offset; vmw_binding_scrub_ib()
1183 cmd->body.sid = SVGA3D_INVALID_ID; vmw_binding_scrub_ib()
1184 cmd->body.format = 0; vmw_binding_scrub_ib()
1185 cmd->body.offset = 0; vmw_binding_scrub_ib()
1188 vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_binding_scrub_ib()
/linux-4.4.14/drivers/block/rsxx/
H A Dcregs.c33 struct creg_cmd *cmd,
112 static void creg_issue_cmd(struct rsxx_cardinfo *card, struct creg_cmd *cmd) creg_issue_cmd() argument
119 iowrite32(cmd->addr, card->regmap + CREG_ADD); creg_issue_cmd()
120 iowrite32(cmd->cnt8, card->regmap + CREG_CNT); creg_issue_cmd()
122 if (cmd->op == CREG_OP_WRITE) { creg_issue_cmd()
123 if (cmd->buf) { creg_issue_cmd()
124 st = copy_to_creg_data(card, cmd->cnt8, creg_issue_cmd()
125 cmd->buf, cmd->stream); creg_issue_cmd()
135 iowrite32(cmd->op, card->regmap + CREG_CMD); creg_issue_cmd()
170 struct creg_cmd *cmd; creg_queue_cmd() local
182 cmd = kmem_cache_alloc(creg_cmd_pool, GFP_KERNEL); creg_queue_cmd()
183 if (!cmd) creg_queue_cmd()
186 INIT_LIST_HEAD(&cmd->list); creg_queue_cmd()
188 cmd->op = op; creg_queue_cmd()
189 cmd->addr = addr; creg_queue_cmd()
190 cmd->cnt8 = cnt8; creg_queue_cmd()
191 cmd->buf = buf; creg_queue_cmd()
192 cmd->stream = stream; creg_queue_cmd()
193 cmd->cb = callback; creg_queue_cmd()
194 cmd->cb_private = cb_private; creg_queue_cmd()
195 cmd->status = 0; creg_queue_cmd()
198 list_add_tail(&cmd->list, &card->creg_ctrl.queue); creg_queue_cmd()
209 struct creg_cmd *cmd; creg_cmd_timed_out() local
212 cmd = card->creg_ctrl.active_cmd; creg_cmd_timed_out()
216 if (cmd == NULL) { creg_cmd_timed_out()
223 if (cmd->cb) creg_cmd_timed_out()
224 cmd->cb(card, cmd, -ETIMEDOUT); creg_cmd_timed_out()
226 kmem_cache_free(creg_cmd_pool, cmd); creg_cmd_timed_out()
239 struct creg_cmd *cmd; creg_cmd_done() local
253 cmd = card->creg_ctrl.active_cmd; creg_cmd_done()
257 if (cmd == NULL) { creg_cmd_done()
264 cmd->status = card->creg_ctrl.creg_stats.stat; creg_cmd_done()
265 if ((cmd->status & CREG_STAT_STATUS_MASK) == 0) { creg_cmd_done()
275 } else if (cmd->status & CREG_STAT_ERROR) { creg_cmd_done()
279 if ((cmd->op == CREG_OP_READ)) { creg_cmd_done()
283 if (!cmd->buf) { creg_cmd_done()
289 if (cnt8 != cmd->cnt8) { creg_cmd_done()
296 st = copy_from_creg_data(card, cnt8, cmd->buf, cmd->stream); creg_cmd_done()
300 if (cmd->cb) creg_cmd_done()
301 cmd->cb(card, cmd, st); creg_cmd_done()
303 kmem_cache_free(creg_cmd_pool, cmd); creg_cmd_done()
313 struct creg_cmd *cmd = NULL; creg_reset() local
334 list_for_each_entry_safe(cmd, tmp, &card->creg_ctrl.queue, list) { creg_reset()
335 list_del(&cmd->list); creg_reset()
337 if (cmd->cb) creg_reset()
338 cmd->cb(card, cmd, -ECANCELED); creg_reset()
339 kmem_cache_free(creg_cmd_pool, cmd); creg_reset()
342 cmd = card->creg_ctrl.active_cmd; creg_reset()
344 if (cmd) { creg_reset()
348 if (cmd->cb) creg_reset()
349 cmd->cb(card, cmd, -ECANCELED); creg_reset()
350 kmem_cache_free(creg_cmd_pool, cmd); creg_reset()
372 struct creg_cmd *cmd, creg_cmd_done_cb()
377 cmd_completion = cmd->cb_private; creg_cmd_done_cb()
381 cmd_completion->creg_status = cmd->status; creg_cmd_done_cb()
535 int rsxx_issue_card_cmd(struct rsxx_cardinfo *card, u32 cmd) rsxx_issue_card_cmd() argument
538 sizeof(cmd), &cmd, 0); rsxx_issue_card_cmd()
610 struct creg_cmd *cmd, read_hw_log_done()
619 buf = cmd->buf; read_hw_log_done()
626 while (off < cmd->cnt8) { read_hw_log_done()
628 cnt = min(cmd->cnt8 - off, LOG_BUF_SIZE8 - card->log.buf_len); read_hw_log_done()
648 if (cmd->status & CREG_STAT_LOG_PENDING) read_hw_log_done()
668 struct rsxx_reg_access *cmd, issue_reg_cmd()
673 return __issue_creg_rw(card, op, cmd->addr, cmd->cnt, cmd->data, issue_reg_cmd()
674 cmd->stream, &cmd->stat); issue_reg_cmd()
681 struct rsxx_reg_access cmd; rsxx_reg_access() local
684 st = copy_from_user(&cmd, ucmd, sizeof(cmd)); rsxx_reg_access()
688 if (cmd.cnt > RSXX_MAX_REG_CNT) rsxx_reg_access()
691 st = issue_reg_cmd(card, &cmd, read); rsxx_reg_access()
695 st = put_user(cmd.stat, &ucmd->stat); rsxx_reg_access()
700 st = copy_to_user(ucmd->data, cmd.data, cmd.cnt); rsxx_reg_access()
710 struct creg_cmd *cmd = NULL; rsxx_eeh_save_issued_creg() local
712 cmd = card->creg_ctrl.active_cmd; rsxx_eeh_save_issued_creg()
715 if (cmd) { rsxx_eeh_save_issued_creg()
719 list_add(&cmd->list, &card->creg_ctrl.queue); rsxx_eeh_save_issued_creg()
756 struct creg_cmd *cmd; rsxx_creg_destroy() local
762 list_for_each_entry_safe(cmd, tmp, &card->creg_ctrl.queue, list) { rsxx_creg_destroy()
763 list_del(&cmd->list); rsxx_creg_destroy()
764 if (cmd->cb) rsxx_creg_destroy()
765 cmd->cb(card, cmd, -ECANCELED); rsxx_creg_destroy()
766 kmem_cache_free(creg_cmd_pool, cmd); rsxx_creg_destroy()
774 cmd = card->creg_ctrl.active_cmd; rsxx_creg_destroy()
776 if (cmd) { rsxx_creg_destroy()
780 if (cmd->cb) rsxx_creg_destroy()
781 cmd->cb(card, cmd, -ECANCELED); rsxx_creg_destroy()
784 kmem_cache_free(creg_cmd_pool, cmd); rsxx_creg_destroy()
371 creg_cmd_done_cb(struct rsxx_cardinfo *card, struct creg_cmd *cmd, int st) creg_cmd_done_cb() argument
609 read_hw_log_done(struct rsxx_cardinfo *card, struct creg_cmd *cmd, int st) read_hw_log_done() argument
667 issue_reg_cmd(struct rsxx_cardinfo *card, struct rsxx_reg_access *cmd, int read) issue_reg_cmd() argument
/linux-4.4.14/drivers/s390/char/
H A Dhmcdrv_ftp.c28 * @cmd: FTP transfer function
37 static enum hmcdrv_ftp_cmdid hmcdrv_ftp_cmd_getid(const char *cmd, int len);
38 static int hmcdrv_ftp_parse(char *cmd, struct hmcdrv_ftp_cmdspec *ftp);
46 * @cmd: FTP command string (NOT zero-terminated)
47 * @len: length of FTP command string in @cmd
49 static enum hmcdrv_ftp_cmdid hmcdrv_ftp_cmd_getid(const char *cmd, int len) hmcdrv_ftp_cmd_getid() argument
54 enum hmcdrv_ftp_cmdid cmd; /* associated command as enum */ hmcdrv_ftp_cmd_getid() member in struct:hmcdrv_ftp_cmd_desc
69 .cmd = HMCDRV_FTP_GET}, hmcdrv_ftp_cmd_getid()
71 .cmd = HMCDRV_FTP_DIR}, hmcdrv_ftp_cmd_getid()
73 .cmd = HMCDRV_FTP_DELETE}, hmcdrv_ftp_cmd_getid()
75 .cmd = HMCDRV_FTP_NLIST}, hmcdrv_ftp_cmd_getid()
77 .cmd = HMCDRV_FTP_PUT}, hmcdrv_ftp_cmd_getid()
79 .cmd = HMCDRV_FTP_APPEND}, hmcdrv_ftp_cmd_getid()
90 crc = crc16(crc, cmd, len); hmcdrv_ftp_cmd_getid()
93 cmd, crc, (crc % ARRAY_SIZE(ftpcmds))); hmcdrv_ftp_cmd_getid()
95 if (!pdesc->str || strncmp(pdesc->str, cmd, len)) hmcdrv_ftp_cmd_getid()
99 pdesc->str, pdesc->cmd); hmcdrv_ftp_cmd_getid()
101 return pdesc->cmd; hmcdrv_ftp_cmd_getid()
106 * @cmd: FTP command string "<cmd> <filename>"
111 static int hmcdrv_ftp_parse(char *cmd, struct hmcdrv_ftp_cmdspec *ftp) hmcdrv_ftp_parse() argument
119 while (*cmd != '\0') { hmcdrv_ftp_parse()
121 while (isspace(*cmd)) hmcdrv_ftp_parse()
122 ++cmd; hmcdrv_ftp_parse()
124 if (*cmd == '\0') hmcdrv_ftp_parse()
127 start = cmd; hmcdrv_ftp_parse()
131 while ((*cmd != '\0') && !isspace(*cmd)) hmcdrv_ftp_parse()
132 ++cmd; hmcdrv_ftp_parse()
133 ftp->id = hmcdrv_ftp_cmd_getid(start, cmd - start); hmcdrv_ftp_parse()
136 while ((*cmd != '\0') && !iscntrl(*cmd)) hmcdrv_ftp_parse()
137 ++cmd; hmcdrv_ftp_parse()
141 *cmd = '\0'; hmcdrv_ftp_parse()
167 pr_debug("starting transfer, cmd %d for '%s' at %lld with %zd bytes\n", hmcdrv_ftp_do()
227 * @cmd: FTP command string "<cmd> <filename>"
236 ssize_t hmcdrv_ftp_cmd(char __kernel *cmd, loff_t offset, hmcdrv_ftp_cmd() argument
242 ssize_t retlen = hmcdrv_ftp_parse(cmd, &ftp); hmcdrv_ftp_cmd()
/linux-4.4.14/arch/x86/include/asm/
H A Dintel_pmc_ipc.h28 int intel_pmc_ipc_simple_command(int cmd, int sub);
29 int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen,
31 int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen,
36 static inline int intel_pmc_ipc_simple_command(int cmd, int sub) intel_pmc_ipc_simple_command() argument
41 static inline int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen, intel_pmc_ipc_raw_cmd() argument
47 static inline int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen, intel_pmc_ipc_command() argument
/linux-4.4.14/drivers/usb/gadget/legacy/
H A Dtcm_usb_gadget.c35 static inline void usbg_cleanup_cmd(struct usbg_cmd *cmd) usbg_cleanup_cmd() argument
37 kref_put(&cmd->ref, usbg_cmd_release); usbg_cleanup_cmd()
49 ret = usb_ep_queue(fu->ep_out, fu->cmd.req, GFP_ATOMIC); bot_enqueue_cmd_cbw()
57 struct usbg_cmd *cmd = req->context; bot_status_complete() local
58 struct f_uas *fu = cmd->fu; bot_status_complete()
60 usbg_cleanup_cmd(cmd); bot_status_complete()
70 static void bot_enqueue_sense_code(struct f_uas *fu, struct usbg_cmd *cmd) bot_enqueue_sense_code() argument
77 csw_stat = cmd->csw_code; bot_enqueue_sense_code()
84 sense = cmd->sense_iu.sense; bot_enqueue_sense_code()
86 csw->Tag = cmd->bot_tag; bot_enqueue_sense_code()
88 fu->bot_status.req->context = cmd; bot_enqueue_sense_code()
96 struct usbg_cmd *cmd = req->context; bot_err_compl() local
97 struct f_uas *fu = cmd->fu; bot_err_compl()
102 if (cmd->data_len) { bot_err_compl()
103 if (cmd->data_len > ep->maxpacket) { bot_err_compl()
105 cmd->data_len -= ep->maxpacket; bot_err_compl()
107 req->length = cmd->data_len; bot_err_compl()
108 cmd->data_len = 0; bot_err_compl()
114 bot_enqueue_sense_code(fu, cmd); bot_err_compl()
117 static void bot_send_bad_status(struct usbg_cmd *cmd) bot_send_bad_status() argument
119 struct f_uas *fu = cmd->fu; bot_send_bad_status()
124 csw->Residue = cpu_to_le32(cmd->data_len); bot_send_bad_status()
126 if (cmd->data_len) { bot_send_bad_status()
127 if (cmd->is_read) { bot_send_bad_status()
135 if (cmd->data_len > fu->ep_in->maxpacket) { bot_send_bad_status()
137 cmd->data_len -= ep->maxpacket; bot_send_bad_status()
139 req->length = cmd->data_len; bot_send_bad_status()
140 cmd->data_len = 0; bot_send_bad_status()
143 req->context = cmd; bot_send_bad_status()
144 req->buf = fu->cmd.buf; bot_send_bad_status()
147 bot_enqueue_sense_code(fu, cmd); bot_send_bad_status()
151 static int bot_send_status(struct usbg_cmd *cmd, bool moved_data) bot_send_status() argument
153 struct f_uas *fu = cmd->fu; bot_send_status()
157 if (cmd->se_cmd.scsi_status == SAM_STAT_GOOD) { bot_send_status()
158 if (!moved_data && cmd->data_len) { bot_send_status()
163 cmd->csw_code = US_BULK_STAT_OK; bot_send_status()
164 bot_send_bad_status(cmd); bot_send_status()
168 csw->Tag = cmd->bot_tag; bot_send_status()
171 fu->bot_status.req->context = cmd; bot_send_status()
177 cmd->csw_code = US_BULK_STAT_FAIL; bot_send_status()
178 bot_send_bad_status(cmd); bot_send_status()
187 static int bot_send_status_response(struct usbg_cmd *cmd) bot_send_status_response() argument
191 if (!cmd->is_read) bot_send_status_response()
193 return bot_send_status(cmd, moved_data); bot_send_status_response()
199 struct usbg_cmd *cmd = req->context; bot_read_compl() local
204 bot_send_status(cmd, true); bot_read_compl()
207 static int bot_send_read_response(struct usbg_cmd *cmd) bot_send_read_response() argument
209 struct f_uas *fu = cmd->fu; bot_send_read_response()
210 struct se_cmd *se_cmd = &cmd->se_cmd; bot_send_read_response()
214 if (!cmd->data_len) { bot_send_read_response()
215 cmd->csw_code = US_BULK_STAT_PHASE; bot_send_read_response()
216 bot_send_bad_status(cmd); bot_send_read_response()
221 cmd->data_buf = kmalloc(se_cmd->data_length, GFP_ATOMIC); bot_send_read_response()
222 if (!cmd->data_buf) bot_send_read_response()
227 cmd->data_buf, bot_send_read_response()
230 fu->bot_req_in->buf = cmd->data_buf; bot_send_read_response()
239 fu->bot_req_in->context = cmd; bot_send_read_response()
249 static int bot_send_write_request(struct usbg_cmd *cmd) bot_send_write_request() argument
251 struct f_uas *fu = cmd->fu; bot_send_write_request()
252 struct se_cmd *se_cmd = &cmd->se_cmd; bot_send_write_request()
256 init_completion(&cmd->write_complete); bot_send_write_request()
257 cmd->fu = fu; bot_send_write_request()
259 if (!cmd->data_len) { bot_send_write_request()
260 cmd->csw_code = US_BULK_STAT_PHASE; bot_send_write_request()
265 cmd->data_buf = kmalloc(se_cmd->data_length, GFP_KERNEL); bot_send_write_request()
266 if (!cmd->data_buf) bot_send_write_request()
269 fu->bot_req_out->buf = cmd->data_buf; bot_send_write_request()
278 fu->bot_req_out->context = cmd; bot_send_write_request()
280 ret = usbg_prepare_w_request(cmd, fu->bot_req_out); bot_send_write_request()
287 wait_for_completion(&cmd->write_complete); bot_send_write_request()
322 fu->cmd.req = usb_ep_alloc_request(fu->ep_out, GFP_KERNEL); bot_prepare_reqs()
323 if (!fu->cmd.req) bot_prepare_reqs()
335 fu->cmd.buf = kmalloc(fu->ep_out->maxpacket, GFP_KERNEL); bot_prepare_reqs()
336 if (!fu->cmd.buf) bot_prepare_reqs()
339 fu->cmd.req->complete = bot_cmd_complete; bot_prepare_reqs()
340 fu->cmd.req->buf = fu->cmd.buf; bot_prepare_reqs()
341 fu->cmd.req->length = fu->ep_out->maxpacket; bot_prepare_reqs()
342 fu->cmd.req->context = fu; bot_prepare_reqs()
349 kfree(fu->cmd.buf); bot_prepare_reqs()
350 fu->cmd.buf = NULL; bot_prepare_reqs()
354 usb_ep_free_request(fu->ep_out, fu->cmd.req); bot_prepare_reqs()
355 fu->cmd.req = NULL; bot_prepare_reqs()
380 usb_ep_free_request(fu->ep_out, fu->cmd.req); bot_cleanup_old_alt()
383 kfree(fu->cmd.buf); bot_cleanup_old_alt()
387 fu->cmd.req = NULL; bot_cleanup_old_alt()
389 fu->cmd.buf = NULL; bot_cleanup_old_alt()
492 usb_ep_free_request(fu->ep_cmd, fu->cmd.req); uasp_free_cmdreq()
493 kfree(fu->cmd.buf); uasp_free_cmdreq()
494 fu->cmd.req = NULL; uasp_free_cmdreq()
495 fu->cmd.buf = NULL; uasp_free_cmdreq()
517 static int uasp_prepare_r_request(struct usbg_cmd *cmd) uasp_prepare_r_request() argument
519 struct se_cmd *se_cmd = &cmd->se_cmd; uasp_prepare_r_request()
520 struct f_uas *fu = cmd->fu; uasp_prepare_r_request()
522 struct uas_stream *stream = cmd->stream; uasp_prepare_r_request()
525 cmd->data_buf = kmalloc(se_cmd->data_length, GFP_ATOMIC); uasp_prepare_r_request()
526 if (!cmd->data_buf) uasp_prepare_r_request()
531 cmd->data_buf, uasp_prepare_r_request()
534 stream->req_in->buf = cmd->data_buf; uasp_prepare_r_request()
543 stream->req_in->context = cmd; uasp_prepare_r_request()
545 cmd->state = UASP_SEND_STATUS; uasp_prepare_r_request()
549 static void uasp_prepare_status(struct usbg_cmd *cmd) uasp_prepare_status() argument
551 struct se_cmd *se_cmd = &cmd->se_cmd; uasp_prepare_status()
552 struct sense_iu *iu = &cmd->sense_iu; uasp_prepare_status()
553 struct uas_stream *stream = cmd->stream; uasp_prepare_status()
555 cmd->state = UASP_QUEUE_COMMAND; uasp_prepare_status()
557 iu->tag = cpu_to_be16(cmd->tag); uasp_prepare_status()
564 stream->req_status->context = cmd; uasp_prepare_status()
572 struct usbg_cmd *cmd = req->context; uasp_status_data_cmpl() local
573 struct uas_stream *stream = cmd->stream; uasp_status_data_cmpl()
574 struct f_uas *fu = cmd->fu; uasp_status_data_cmpl()
580 switch (cmd->state) { uasp_status_data_cmpl()
582 ret = uasp_prepare_r_request(cmd); uasp_status_data_cmpl()
591 ret = usbg_prepare_w_request(cmd, stream->req_out); uasp_status_data_cmpl()
600 uasp_prepare_status(cmd); uasp_status_data_cmpl()
608 usbg_cleanup_cmd(cmd); uasp_status_data_cmpl()
609 usb_ep_queue(fu->ep_cmd, fu->cmd.req, GFP_ATOMIC); uasp_status_data_cmpl()
618 usbg_cleanup_cmd(cmd); uasp_status_data_cmpl()
621 static int uasp_send_status_response(struct usbg_cmd *cmd) uasp_send_status_response() argument
623 struct f_uas *fu = cmd->fu; uasp_send_status_response()
624 struct uas_stream *stream = cmd->stream; uasp_send_status_response()
625 struct sense_iu *iu = &cmd->sense_iu; uasp_send_status_response()
627 iu->tag = cpu_to_be16(cmd->tag); uasp_send_status_response()
629 stream->req_status->context = cmd; uasp_send_status_response()
630 cmd->fu = fu; uasp_send_status_response()
631 uasp_prepare_status(cmd); uasp_send_status_response()
635 static int uasp_send_read_response(struct usbg_cmd *cmd) uasp_send_read_response() argument
637 struct f_uas *fu = cmd->fu; uasp_send_read_response()
638 struct uas_stream *stream = cmd->stream; uasp_send_read_response()
639 struct sense_iu *iu = &cmd->sense_iu; uasp_send_read_response()
642 cmd->fu = fu; uasp_send_read_response()
644 iu->tag = cpu_to_be16(cmd->tag); uasp_send_read_response()
647 ret = uasp_prepare_r_request(cmd); uasp_send_read_response()
653 kfree(cmd->data_buf); uasp_send_read_response()
654 cmd->data_buf = NULL; uasp_send_read_response()
660 iu->tag = cpu_to_be16(cmd->tag); uasp_send_read_response()
663 stream->req_status->context = cmd; uasp_send_read_response()
665 cmd->state = UASP_SEND_DATA; uasp_send_read_response()
678 static int uasp_send_write_request(struct usbg_cmd *cmd) uasp_send_write_request() argument
680 struct f_uas *fu = cmd->fu; uasp_send_write_request()
681 struct se_cmd *se_cmd = &cmd->se_cmd; uasp_send_write_request()
682 struct uas_stream *stream = cmd->stream; uasp_send_write_request()
683 struct sense_iu *iu = &cmd->sense_iu; uasp_send_write_request()
686 init_completion(&cmd->write_complete); uasp_send_write_request()
687 cmd->fu = fu; uasp_send_write_request()
689 iu->tag = cpu_to_be16(cmd->tag); uasp_send_write_request()
693 ret = usbg_prepare_w_request(cmd, stream->req_out); uasp_send_write_request()
703 iu->tag = cpu_to_be16(cmd->tag); uasp_send_write_request()
706 stream->req_status->context = cmd; uasp_send_write_request()
708 cmd->state = UASP_RECEIVE_DATA; uasp_send_write_request()
718 wait_for_completion(&cmd->write_complete); uasp_send_write_request()
743 usb_ep_queue(fu->ep_cmd, fu->cmd.req, GFP_ATOMIC); uasp_cmd_complete()
773 fu->cmd.req = usb_ep_alloc_request(fu->ep_cmd, GFP_KERNEL); uasp_alloc_cmd()
774 if (!fu->cmd.req) uasp_alloc_cmd()
777 fu->cmd.buf = kmalloc(fu->ep_cmd->maxpacket, GFP_KERNEL); uasp_alloc_cmd()
778 if (!fu->cmd.buf) uasp_alloc_cmd()
781 fu->cmd.req->complete = uasp_cmd_complete; uasp_alloc_cmd()
782 fu->cmd.req->buf = fu->cmd.buf; uasp_alloc_cmd()
783 fu->cmd.req->length = fu->ep_cmd->maxpacket; uasp_alloc_cmd()
784 fu->cmd.req->context = fu; uasp_alloc_cmd()
788 usb_ep_free_request(fu->ep_cmd, fu->cmd.req); uasp_alloc_cmd()
828 ret = usb_ep_queue(fu->ep_cmd, fu->cmd.req, GFP_ATOMIC); uasp_prepare_reqs()
960 struct usbg_cmd *cmd = req->context; usbg_data_write_cmpl() local
961 struct se_cmd *se_cmd = &cmd->se_cmd; usbg_data_write_cmpl()
964 pr_err("%s() state %d transfer failed\n", __func__, cmd->state); usbg_data_write_cmpl()
971 cmd->data_buf, usbg_data_write_cmpl()
975 complete(&cmd->write_complete); usbg_data_write_cmpl()
979 usbg_cleanup_cmd(cmd); usbg_data_write_cmpl()
982 static int usbg_prepare_w_request(struct usbg_cmd *cmd, struct usb_request *req) usbg_prepare_w_request() argument
984 struct se_cmd *se_cmd = &cmd->se_cmd; usbg_prepare_w_request()
985 struct f_uas *fu = cmd->fu; usbg_prepare_w_request()
989 cmd->data_buf = kmalloc(se_cmd->data_length, GFP_ATOMIC); usbg_prepare_w_request()
990 if (!cmd->data_buf) usbg_prepare_w_request()
993 req->buf = cmd->data_buf; usbg_prepare_w_request()
1002 req->context = cmd; usbg_prepare_w_request()
1008 struct usbg_cmd *cmd = container_of(se_cmd, struct usbg_cmd, usbg_send_status_response() local
1010 struct f_uas *fu = cmd->fu; usbg_send_status_response()
1013 return bot_send_status_response(cmd); usbg_send_status_response()
1015 return uasp_send_status_response(cmd); usbg_send_status_response()
1020 struct usbg_cmd *cmd = container_of(se_cmd, struct usbg_cmd, usbg_send_write_request() local
1022 struct f_uas *fu = cmd->fu; usbg_send_write_request()
1025 return bot_send_write_request(cmd); usbg_send_write_request()
1027 return uasp_send_write_request(cmd); usbg_send_write_request()
1032 struct usbg_cmd *cmd = container_of(se_cmd, struct usbg_cmd, usbg_send_read_response() local
1034 struct f_uas *fu = cmd->fu; usbg_send_read_response()
1037 return bot_send_read_response(cmd); usbg_send_read_response()
1039 return uasp_send_read_response(cmd); usbg_send_read_response()
1044 struct usbg_cmd *cmd = container_of(work, struct usbg_cmd, work); usbg_cmd_work() local
1050 se_cmd = &cmd->se_cmd; usbg_cmd_work()
1051 tpg = cmd->fu->tpg; usbg_cmd_work()
1053 dir = get_cmd_dir(cmd->cmd_buf); usbg_cmd_work()
1057 tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, usbg_cmd_work()
1058 cmd->prio_attr, cmd->sense_iu.sense); usbg_cmd_work()
1063 cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, usbg_cmd_work()
1064 0, cmd->prio_attr, dir, TARGET_SCF_UNKNOWN_SIZE) < 0) usbg_cmd_work()
1072 usbg_cleanup_cmd(cmd); usbg_cmd_work()
1079 struct usbg_cmd *cmd; usbg_submit_command() local
1091 cmd = kzalloc(sizeof *cmd, GFP_ATOMIC); usbg_submit_command()
1092 if (!cmd) usbg_submit_command()
1095 cmd->fu = fu; usbg_submit_command()
1098 kref_init(&cmd->ref); usbg_submit_command()
1099 kref_get(&cmd->ref); usbg_submit_command()
1106 memcpy(cmd->cmd_buf, cmd_iu->cdb, cmd_len); usbg_submit_command()
1108 cmd->tag = be16_to_cpup(&cmd_iu->tag); usbg_submit_command()
1109 cmd->se_cmd.tag = cmd->tag; usbg_submit_command()
1111 if (cmd->tag > UASP_SS_EP_COMP_NUM_STREAMS) usbg_submit_command()
1113 if (!cmd->tag) usbg_submit_command()
1114 cmd->stream = &fu->stream[0]; usbg_submit_command()
1116 cmd->stream = &fu->stream[cmd->tag - 1]; usbg_submit_command()
1118 cmd->stream = &fu->stream[0]; usbg_submit_command()
1129 cmd->prio_attr = TCM_HEAD_TAG; usbg_submit_command()
1132 cmd->prio_attr = TCM_ORDERED_TAG; usbg_submit_command()
1135 cmd->prio_attr = TCM_ACA_TAG; usbg_submit_command()
1141 cmd->prio_attr = TCM_SIMPLE_TAG; usbg_submit_command()
1145 se_cmd = &cmd->se_cmd; usbg_submit_command()
1146 cmd->unpacked_lun = scsilun_to_int(&cmd_iu->lun); usbg_submit_command()
1148 INIT_WORK(&cmd->work, usbg_cmd_work); usbg_submit_command()
1149 ret = queue_work(tpg->workqueue, &cmd->work); usbg_submit_command()
1155 kfree(cmd); usbg_submit_command()
1161 struct usbg_cmd *cmd = container_of(work, struct usbg_cmd, work); bot_cmd_work() local
1167 se_cmd = &cmd->se_cmd; bot_cmd_work()
1168 tpg = cmd->fu->tpg; bot_cmd_work()
1170 dir = get_cmd_dir(cmd->cmd_buf); bot_cmd_work()
1174 tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, bot_cmd_work()
1175 cmd->prio_attr, cmd->sense_iu.sense); bot_cmd_work()
1180 cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, bot_cmd_work()
1181 cmd->data_len, cmd->prio_attr, dir, 0) < 0) bot_cmd_work()
1189 usbg_cleanup_cmd(cmd); bot_cmd_work()
1196 struct usbg_cmd *cmd; bot_submit_command() local
1216 cmd = kzalloc(sizeof *cmd, GFP_ATOMIC); bot_submit_command()
1217 if (!cmd) bot_submit_command()
1220 cmd->fu = fu; bot_submit_command()
1223 kref_init(&cmd->ref); bot_submit_command()
1224 kref_get(&cmd->ref); bot_submit_command()
1228 memcpy(cmd->cmd_buf, cbw->CDB, cmd_len); bot_submit_command()
1230 cmd->bot_tag = cbw->Tag; bot_submit_command()
1238 cmd->prio_attr = TCM_SIMPLE_TAG; bot_submit_command()
1239 se_cmd = &cmd->se_cmd; bot_submit_command()
1240 cmd->unpacked_lun = cbw->Lun; bot_submit_command()
1241 cmd->is_read = cbw->Flags & US_BULK_FLAG_IN ? 1 : 0; bot_submit_command()
1242 cmd->data_len = le32_to_cpu(cbw->DataTransferLength); bot_submit_command()
1243 cmd->se_cmd.tag = le32_to_cpu(cmd->bot_tag); bot_submit_command()
1245 INIT_WORK(&cmd->work, bot_cmd_work); bot_submit_command()
1246 ret = queue_work(tpg->workqueue, &cmd->work); bot_submit_command()
1252 kfree(cmd); bot_submit_command()
1296 struct usbg_cmd *cmd = container_of(ref, struct usbg_cmd, usbg_cmd_release() local
1299 transport_generic_free_cmd(&cmd->se_cmd, 0); usbg_cmd_release()
1304 struct usbg_cmd *cmd = container_of(se_cmd, struct usbg_cmd, usbg_release_cmd() local
1306 kfree(cmd->data_buf); usbg_release_cmd()
1307 kfree(cmd); usbg_release_cmd()
1695 struct usbg_cmd *cmd = container_of(se_cmd, struct usbg_cmd, usbg_check_stop_free() local
1698 kref_put(&cmd->ref, usbg_cmd_release); usbg_check_stop_free()
/linux-4.4.14/drivers/media/usb/dvb-usb/
H A Dvp702x-fe.c148 u8 *cmd; vp702x_fe_set_frontend() local
152 cmd = dst->buf; vp702x_fe_set_frontend()
153 memset(cmd, 0, 10); vp702x_fe_set_frontend()
155 cmd[0] = (freq >> 8) & 0x7f; vp702x_fe_set_frontend()
156 cmd[1] = freq & 0xff; vp702x_fe_set_frontend()
157 cmd[2] = 1; /* divrate == 4 -> frequencyRef[1] -> 1 here */ vp702x_fe_set_frontend()
161 cmd[3] = (sr >> 12) & 0xff; vp702x_fe_set_frontend()
162 cmd[4] = (sr >> 4) & 0xff; vp702x_fe_set_frontend()
163 cmd[5] = (sr << 4) & 0xf0; vp702x_fe_set_frontend()
170 cmd[6] |= 0x80; */ vp702x_fe_set_frontend()
173 cmd[6] |= 0x40; vp702x_fe_set_frontend()
176 cmd[6] |= 0x20; vp702x_fe_set_frontend()
179 cmd[6] |= 0x04; vp702x_fe_set_frontend()
182 cmd[6] |= 0x01;*/ vp702x_fe_set_frontend()
184 cmd[7] = vp702x_chksum(cmd,0,7); vp702x_fe_set_frontend()
189 vp702x_usb_inout_op(st->d, cmd, 8, cmd, 10, 100); vp702x_fe_set_frontend()
191 if (cmd[2] == 0 && cmd[3] == 0) vp702x_fe_set_frontend()
218 u8 *cmd; vp702x_fe_send_diseqc_msg() local
229 cmd = dst->buf; vp702x_fe_send_diseqc_msg()
230 cmd[1] = SET_DISEQC_CMD; vp702x_fe_send_diseqc_msg()
231 cmd[2] = m->msg_len; vp702x_fe_send_diseqc_msg()
232 memcpy(&cmd[3], m->msg, m->msg_len); vp702x_fe_send_diseqc_msg()
233 cmd[7] = vp702x_chksum(cmd, 0, 7); vp702x_fe_send_diseqc_msg()
235 vp702x_usb_inout_op(st->d, cmd, 8, cmd, 10, 100); vp702x_fe_send_diseqc_msg()
237 if (cmd[2] == 0 && cmd[3] == 0) vp702x_fe_send_diseqc_msg()
238 deb_fe("diseqc cmd failed.\n"); vp702x_fe_send_diseqc_msg()
240 deb_fe("diseqc cmd succeeded.\n"); vp702x_fe_send_diseqc_msg()
279 deb_fe("set_tone cmd failed.\n"); vp702x_fe_set_tone()
281 deb_fe("set_tone cmd succeeded.\n"); vp702x_fe_set_tone()
312 deb_fe("set_voltage cmd failed.\n"); vp702x_fe_set_voltage()
314 deb_fe("set_voltage cmd succeeded.\n"); vp702x_fe_set_voltage()
H A Dgp8psk-fe.c121 u8 cmd[10]; gp8psk_fe_set_frontend() local
127 cmd[4] = freq & 0xff; gp8psk_fe_set_frontend()
128 cmd[5] = (freq >> 8) & 0xff; gp8psk_fe_set_frontend()
129 cmd[6] = (freq >> 16) & 0xff; gp8psk_fe_set_frontend()
130 cmd[7] = (freq >> 24) & 0xff; gp8psk_fe_set_frontend()
158 cmd[0] = c->symbol_rate & 0xff; gp8psk_fe_set_frontend()
159 cmd[1] = (c->symbol_rate >> 8) & 0xff; gp8psk_fe_set_frontend()
160 cmd[2] = (c->symbol_rate >> 16) & 0xff; gp8psk_fe_set_frontend()
161 cmd[3] = (c->symbol_rate >> 24) & 0xff; gp8psk_fe_set_frontend()
169 cmd[9] = 0; break; gp8psk_fe_set_frontend()
171 cmd[9] = 1; break; gp8psk_fe_set_frontend()
173 cmd[9] = 2; break; gp8psk_fe_set_frontend()
175 cmd[9] = 3; break; gp8psk_fe_set_frontend()
177 cmd[9] = 4; break; gp8psk_fe_set_frontend()
179 cmd[9] = 5; break; gp8psk_fe_set_frontend()
181 cmd[9] = 5; break; gp8psk_fe_set_frontend()
184 cmd[8] = ADV_MOD_TURBO_QPSK; gp8psk_fe_set_frontend()
186 cmd[8] = ADV_MOD_DVB_QPSK; gp8psk_fe_set_frontend()
189 cmd[8] = ADV_MOD_TURBO_8PSK; gp8psk_fe_set_frontend()
192 cmd[9] = 0; break; gp8psk_fe_set_frontend()
194 cmd[9] = 1; break; gp8psk_fe_set_frontend()
196 cmd[9] = 2; break; gp8psk_fe_set_frontend()
198 cmd[9] = 3; break; gp8psk_fe_set_frontend()
200 cmd[9] = 4; break; gp8psk_fe_set_frontend()
202 cmd[9] = 0; break; gp8psk_fe_set_frontend()
206 cmd[8] = ADV_MOD_TURBO_16QAM; gp8psk_fe_set_frontend()
207 cmd[9] = 0; gp8psk_fe_set_frontend()
217 gp8psk_usb_out_op(state->d, TUNE_8PSK, 0, 0, cmd, 10); gp8psk_fe_set_frontend()
244 u8 cmd; gp8psk_fe_send_diseqc_burst() local
249 cmd = (burst == SEC_MINI_A) ? 0x00 : 0x01; gp8psk_fe_send_diseqc_burst()
251 if (gp8psk_usb_out_op(st->d,SEND_DISEQC_COMMAND, cmd, 0, gp8psk_fe_send_diseqc_burst()
252 &cmd, 0)) { gp8psk_fe_send_diseqc_burst()
291 u8 cmd = sw_cmd & 0x7f; gp8psk_fe_send_legacy_dish_cmd() local
293 if (gp8psk_usb_out_op(state->d,SET_DN_SWITCH, cmd, 0, gp8psk_fe_send_legacy_dish_cmd()
/linux-4.4.14/include/linux/input/
H A Dlm8333.h20 extern int lm8333_read8(struct lm8333 *lm8333, u8 cmd);
21 extern int lm8333_write8(struct lm8333 *lm8333, u8 cmd, u8 val);
22 extern int lm8333_read_block(struct lm8333 *lm8333, u8 cmd, u8 len, u8 *buf);
/linux-4.4.14/drivers/net/wireless/
H A Dmwl8k.c439 static const char *mwl8k_cmd_name(__le16 cmd, char *buf, int bufsize) mwl8k_cmd_name() argument
441 u16 command = le16_to_cpu(cmd); mwl8k_cmd_name()
480 snprintf(buf, bufsize, "0x%x", cmd); mwl8k_cmd_name()
638 struct mwl8k_cmd_pkt *cmd; mwl8k_load_fw_image() local
642 cmd = kmalloc(sizeof(*cmd) + 256, GFP_KERNEL); mwl8k_load_fw_image()
643 if (cmd == NULL) mwl8k_load_fw_image()
646 cmd->code = cpu_to_le16(MWL8K_CMD_CODE_DNLD); mwl8k_load_fw_image()
647 cmd->seq_num = 0; mwl8k_load_fw_image()
648 cmd->macid = 0; mwl8k_load_fw_image()
649 cmd->result = 0; mwl8k_load_fw_image()
655 memcpy(cmd->payload, data + done, block_size); mwl8k_load_fw_image()
656 cmd->length = cpu_to_le16(block_size); mwl8k_load_fw_image()
658 rc = mwl8k_send_fw_load_cmd(priv, cmd, mwl8k_load_fw_image()
659 sizeof(*cmd) + block_size); mwl8k_load_fw_image()
668 cmd->length = 0; mwl8k_load_fw_image()
669 rc = mwl8k_send_fw_load_cmd(priv, cmd, sizeof(*cmd)); mwl8k_load_fw_image()
672 kfree(cmd); mwl8k_load_fw_image()
2189 static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd) mwl8k_post_cmd() argument
2202 mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), cmd->macid); mwl8k_post_cmd()
2214 switch (le16_to_cpu(cmd->code)) { mwl8k_post_cmd()
2228 cmd->result = (__force __le16) 0xffff; mwl8k_post_cmd()
2229 dma_size = le16_to_cpu(cmd->length); mwl8k_post_cmd()
2230 dma_addr = pci_map_single(priv->pdev, cmd, dma_size, mwl8k_post_cmd()
2253 mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), mwl8k_post_cmd()
2261 rc = cmd->result ? -EINVAL : 0; mwl8k_post_cmd()
2264 mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), mwl8k_post_cmd()
2265 le16_to_cpu(cmd->result)); mwl8k_post_cmd()
2268 mwl8k_cmd_name(cmd->code, mwl8k_post_cmd()
2283 struct mwl8k_cmd_pkt *cmd) mwl8k_post_pervif_cmd()
2286 cmd->macid = MWL8K_VIF(vif)->macid; mwl8k_post_pervif_cmd()
2287 return mwl8k_post_cmd(hw, cmd); mwl8k_post_pervif_cmd()
2444 struct mwl8k_cmd_get_hw_spec_sta *cmd; mwl8k_cmd_get_hw_spec_sta() local
2448 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_get_hw_spec_sta()
2449 if (cmd == NULL) mwl8k_cmd_get_hw_spec_sta()
2452 cmd->header.code = cpu_to_le16(MWL8K_CMD_GET_HW_SPEC); mwl8k_cmd_get_hw_spec_sta()
2453 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_get_hw_spec_sta()
2455 memset(cmd->perm_addr, 0xff, sizeof(cmd->perm_addr)); mwl8k_cmd_get_hw_spec_sta()
2456 cmd->ps_cookie = cpu_to_le32(priv->cookie_dma); mwl8k_cmd_get_hw_spec_sta()
2457 cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rxd_dma); mwl8k_cmd_get_hw_spec_sta()
2458 cmd->num_tx_queues = cpu_to_le32(mwl8k_tx_queues(priv)); mwl8k_cmd_get_hw_spec_sta()
2460 cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[i].txd_dma); mwl8k_cmd_get_hw_spec_sta()
2461 cmd->num_tx_desc_per_queue = cpu_to_le32(MWL8K_TX_DESCS); mwl8k_cmd_get_hw_spec_sta()
2462 cmd->total_rxd = cpu_to_le32(MWL8K_RX_DESCS); mwl8k_cmd_get_hw_spec_sta()
2464 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_get_hw_spec_sta()
2467 SET_IEEE80211_PERM_ADDR(hw, cmd->perm_addr); mwl8k_cmd_get_hw_spec_sta()
2468 priv->num_mcaddrs = le16_to_cpu(cmd->num_mcaddrs); mwl8k_cmd_get_hw_spec_sta()
2469 priv->fw_rev = le32_to_cpu(cmd->fw_rev); mwl8k_cmd_get_hw_spec_sta()
2470 priv->hw_rev = cmd->hw_rev; mwl8k_cmd_get_hw_spec_sta()
2471 mwl8k_set_caps(hw, le32_to_cpu(cmd->caps)); mwl8k_cmd_get_hw_spec_sta()
2476 kfree(cmd); mwl8k_cmd_get_hw_spec_sta()
2509 struct mwl8k_cmd_get_hw_spec_ap *cmd; mwl8k_cmd_get_hw_spec_ap() local
2513 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_get_hw_spec_ap()
2514 if (cmd == NULL) mwl8k_cmd_get_hw_spec_ap()
2517 cmd->header.code = cpu_to_le16(MWL8K_CMD_GET_HW_SPEC); mwl8k_cmd_get_hw_spec_ap()
2518 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_get_hw_spec_ap()
2520 memset(cmd->perm_addr, 0xff, sizeof(cmd->perm_addr)); mwl8k_cmd_get_hw_spec_ap()
2521 cmd->ps_cookie = cpu_to_le32(priv->cookie_dma); mwl8k_cmd_get_hw_spec_ap()
2523 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_get_hw_spec_ap()
2528 api_version = le32_to_cpu(cmd->fw_api_version); mwl8k_cmd_get_hw_spec_ap()
2538 SET_IEEE80211_PERM_ADDR(hw, cmd->perm_addr); mwl8k_cmd_get_hw_spec_ap()
2539 priv->num_mcaddrs = le16_to_cpu(cmd->num_mcaddrs); mwl8k_cmd_get_hw_spec_ap()
2540 priv->fw_rev = le32_to_cpu(cmd->fw_rev); mwl8k_cmd_get_hw_spec_ap()
2541 priv->hw_rev = cmd->hw_rev; mwl8k_cmd_get_hw_spec_ap()
2542 mwl8k_set_caps(hw, le32_to_cpu(cmd->caps)); mwl8k_cmd_get_hw_spec_ap()
2545 priv->num_ampdu_queues = le32_to_cpu(cmd->num_of_ampdu_queues); mwl8k_cmd_get_hw_spec_ap()
2553 off = le32_to_cpu(cmd->rxwrptr) & 0xffff; mwl8k_cmd_get_hw_spec_ap()
2556 off = le32_to_cpu(cmd->rxrdptr) & 0xffff; mwl8k_cmd_get_hw_spec_ap()
2559 priv->txq_offset[0] = le32_to_cpu(cmd->wcbbase0) & 0xffff; mwl8k_cmd_get_hw_spec_ap()
2560 priv->txq_offset[1] = le32_to_cpu(cmd->wcbbase1) & 0xffff; mwl8k_cmd_get_hw_spec_ap()
2561 priv->txq_offset[2] = le32_to_cpu(cmd->wcbbase2) & 0xffff; mwl8k_cmd_get_hw_spec_ap()
2562 priv->txq_offset[3] = le32_to_cpu(cmd->wcbbase3) & 0xffff; mwl8k_cmd_get_hw_spec_ap()
2566 le32_to_cpu(cmd->wcbbase_ampdu[i]) & 0xffff; mwl8k_cmd_get_hw_spec_ap()
2570 kfree(cmd); mwl8k_cmd_get_hw_spec_ap()
2611 struct mwl8k_cmd_set_hw_spec *cmd; mwl8k_cmd_set_hw_spec() local
2615 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_set_hw_spec()
2616 if (cmd == NULL) mwl8k_cmd_set_hw_spec()
2619 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_HW_SPEC); mwl8k_cmd_set_hw_spec()
2620 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_set_hw_spec()
2622 cmd->ps_cookie = cpu_to_le32(priv->cookie_dma); mwl8k_cmd_set_hw_spec()
2623 cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rxd_dma); mwl8k_cmd_set_hw_spec()
2624 cmd->num_tx_queues = cpu_to_le32(mwl8k_tx_queues(priv)); mwl8k_cmd_set_hw_spec()
2634 cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[j].txd_dma); mwl8k_cmd_set_hw_spec()
2637 cmd->flags = cpu_to_le32(MWL8K_SET_HW_SPEC_FLAG_HOST_DECR_MGMT | mwl8k_cmd_set_hw_spec()
2642 cmd->num_tx_desc_per_queue = cpu_to_le32(MWL8K_TX_DESCS); mwl8k_cmd_set_hw_spec()
2643 cmd->total_rxd = cpu_to_le32(MWL8K_RX_DESCS); mwl8k_cmd_set_hw_spec()
2645 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_set_hw_spec()
2646 kfree(cmd); mwl8k_cmd_set_hw_spec()
2671 struct mwl8k_cmd_mac_multicast_adr *cmd; __mwl8k_cmd_mac_multicast_adr() local
2683 size = sizeof(*cmd) + mc_count * ETH_ALEN; __mwl8k_cmd_mac_multicast_adr()
2685 cmd = kzalloc(size, GFP_ATOMIC); __mwl8k_cmd_mac_multicast_adr()
2686 if (cmd == NULL) __mwl8k_cmd_mac_multicast_adr()
2689 cmd->header.code = cpu_to_le16(MWL8K_CMD_MAC_MULTICAST_ADR); __mwl8k_cmd_mac_multicast_adr()
2690 cmd->header.length = cpu_to_le16(size); __mwl8k_cmd_mac_multicast_adr()
2691 cmd->action = cpu_to_le16(MWL8K_ENABLE_RX_DIRECTED | __mwl8k_cmd_mac_multicast_adr()
2695 cmd->action |= cpu_to_le16(MWL8K_ENABLE_RX_ALL_MULTICAST); __mwl8k_cmd_mac_multicast_adr()
2700 cmd->action |= cpu_to_le16(MWL8K_ENABLE_RX_MULTICAST); __mwl8k_cmd_mac_multicast_adr()
2701 cmd->numaddr = cpu_to_le16(mc_count); netdev_hw_addr_list_for_each()
2703 memcpy(cmd->addr[i], ha->addr, ETH_ALEN); netdev_hw_addr_list_for_each()
2707 return &cmd->header;
2726 struct mwl8k_cmd_get_stat *cmd; mwl8k_cmd_get_stat() local
2729 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_get_stat()
2730 if (cmd == NULL) mwl8k_cmd_get_stat()
2733 cmd->header.code = cpu_to_le16(MWL8K_CMD_GET_STAT); mwl8k_cmd_get_stat()
2734 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_get_stat()
2736 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_get_stat()
2739 le32_to_cpu(cmd->stats[MWL8K_STAT_ACK_FAILURE]); mwl8k_cmd_get_stat()
2741 le32_to_cpu(cmd->stats[MWL8K_STAT_RTS_FAILURE]); mwl8k_cmd_get_stat()
2743 le32_to_cpu(cmd->stats[MWL8K_STAT_FCS_ERROR]); mwl8k_cmd_get_stat()
2745 le32_to_cpu(cmd->stats[MWL8K_STAT_RTS_SUCCESS]); mwl8k_cmd_get_stat()
2747 kfree(cmd); mwl8k_cmd_get_stat()
2766 struct mwl8k_cmd_radio_control *cmd; mwl8k_cmd_radio_control() local
2772 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_radio_control()
2773 if (cmd == NULL) mwl8k_cmd_radio_control()
2776 cmd->header.code = cpu_to_le16(MWL8K_CMD_RADIO_CONTROL); mwl8k_cmd_radio_control()
2777 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_radio_control()
2778 cmd->action = cpu_to_le16(MWL8K_CMD_SET); mwl8k_cmd_radio_control()
2779 cmd->control = cpu_to_le16(priv->radio_short_preamble ? 3 : 1); mwl8k_cmd_radio_control()
2780 cmd->radio_on = cpu_to_le16(enable ? 0x0001 : 0x0000); mwl8k_cmd_radio_control()
2782 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_radio_control()
2783 kfree(cmd); mwl8k_cmd_radio_control()
2827 struct mwl8k_cmd_rf_tx_power *cmd; mwl8k_cmd_rf_tx_power() local
2830 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_rf_tx_power()
2831 if (cmd == NULL) mwl8k_cmd_rf_tx_power()
2834 cmd->header.code = cpu_to_le16(MWL8K_CMD_RF_TX_POWER); mwl8k_cmd_rf_tx_power()
2835 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_rf_tx_power()
2836 cmd->action = cpu_to_le16(MWL8K_CMD_SET); mwl8k_cmd_rf_tx_power()
2837 cmd->support_level = cpu_to_le16(dBm); mwl8k_cmd_rf_tx_power()
2839 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_rf_tx_power()
2840 kfree(cmd); mwl8k_cmd_rf_tx_power()
2867 struct mwl8k_cmd_tx_power *cmd; mwl8k_cmd_tx_power() local
2871 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_tx_power()
2872 if (cmd == NULL) mwl8k_cmd_tx_power()
2875 cmd->header.code = cpu_to_le16(MWL8K_CMD_TX_POWER); mwl8k_cmd_tx_power()
2876 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_tx_power()
2877 cmd->action = cpu_to_le16(MWL8K_CMD_SET_LIST); mwl8k_cmd_tx_power()
2880 cmd->band = cpu_to_le16(0x1); mwl8k_cmd_tx_power()
2882 cmd->band = cpu_to_le16(0x4); mwl8k_cmd_tx_power()
2884 cmd->channel = cpu_to_le16(channel->hw_value); mwl8k_cmd_tx_power()
2888 cmd->bw = cpu_to_le16(0x2); mwl8k_cmd_tx_power()
2890 cmd->bw = cpu_to_le16(0x4); mwl8k_cmd_tx_power()
2892 cmd->sub_ch = cpu_to_le16(0x3); mwl8k_cmd_tx_power()
2894 cmd->sub_ch = cpu_to_le16(0x1); mwl8k_cmd_tx_power()
2898 cmd->power_level_list[i] = cpu_to_le16(pwr); mwl8k_cmd_tx_power()
2900 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_tx_power()
2901 kfree(cmd); mwl8k_cmd_tx_power()
2921 struct mwl8k_cmd_rf_antenna *cmd; mwl8k_cmd_rf_antenna() local
2924 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_rf_antenna()
2925 if (cmd == NULL) mwl8k_cmd_rf_antenna()
2928 cmd->header.code = cpu_to_le16(MWL8K_CMD_RF_ANTENNA); mwl8k_cmd_rf_antenna()
2929 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_rf_antenna()
2930 cmd->antenna = cpu_to_le16(antenna); mwl8k_cmd_rf_antenna()
2931 cmd->mode = cpu_to_le16(mask); mwl8k_cmd_rf_antenna()
2933 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_rf_antenna()
2934 kfree(cmd); mwl8k_cmd_rf_antenna()
2951 struct mwl8k_cmd_set_beacon *cmd; mwl8k_cmd_set_beacon() local
2954 cmd = kzalloc(sizeof(*cmd) + len, GFP_KERNEL); mwl8k_cmd_set_beacon()
2955 if (cmd == NULL) mwl8k_cmd_set_beacon()
2958 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_BEACON); mwl8k_cmd_set_beacon()
2959 cmd->header.length = cpu_to_le16(sizeof(*cmd) + len); mwl8k_cmd_set_beacon()
2960 cmd->beacon_len = cpu_to_le16(len); mwl8k_cmd_set_beacon()
2961 memcpy(cmd->beacon, beacon, len); mwl8k_cmd_set_beacon()
2963 rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); mwl8k_cmd_set_beacon()
2964 kfree(cmd); mwl8k_cmd_set_beacon()
2978 struct mwl8k_cmd_set_pre_scan *cmd; mwl8k_cmd_set_pre_scan() local
2981 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_set_pre_scan()
2982 if (cmd == NULL) mwl8k_cmd_set_pre_scan()
2985 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_PRE_SCAN); mwl8k_cmd_set_pre_scan()
2986 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_set_pre_scan()
2988 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_set_pre_scan()
2989 kfree(cmd); mwl8k_cmd_set_pre_scan()
3011 struct mwl8k_cmd_bbp_reg_access *cmd; mwl8k_cmd_bbp_reg_access() local
3014 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_bbp_reg_access()
3015 if (cmd == NULL) mwl8k_cmd_bbp_reg_access()
3018 cmd->header.code = cpu_to_le16(MWL8K_CMD_BBP_REG_ACCESS); mwl8k_cmd_bbp_reg_access()
3019 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_bbp_reg_access()
3020 cmd->action = cpu_to_le16(action); mwl8k_cmd_bbp_reg_access()
3021 cmd->offset = cpu_to_le16(offset); mwl8k_cmd_bbp_reg_access()
3023 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_bbp_reg_access()
3026 *value = cmd->value; mwl8k_cmd_bbp_reg_access()
3030 kfree(cmd); mwl8k_cmd_bbp_reg_access()
3047 struct mwl8k_cmd_set_post_scan *cmd; mwl8k_cmd_set_post_scan() local
3050 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_set_post_scan()
3051 if (cmd == NULL) mwl8k_cmd_set_post_scan()
3054 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_POST_SCAN); mwl8k_cmd_set_post_scan()
3055 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_set_post_scan()
3056 cmd->isibss = 0; mwl8k_cmd_set_post_scan()
3057 memcpy(cmd->bssid, mac, ETH_ALEN); mwl8k_cmd_set_post_scan()
3059 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_set_post_scan()
3060 kfree(cmd); mwl8k_cmd_set_post_scan()
3139 struct mwl8k_cmd_set_rf_channel *cmd; mwl8k_cmd_set_rf_channel() local
3143 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_set_rf_channel()
3144 if (cmd == NULL) mwl8k_cmd_set_rf_channel()
3147 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_RF_CHANNEL); mwl8k_cmd_set_rf_channel()
3148 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_set_rf_channel()
3149 cmd->action = cpu_to_le16(MWL8K_CMD_SET); mwl8k_cmd_set_rf_channel()
3150 cmd->current_channel = channel->hw_value; mwl8k_cmd_set_rf_channel()
3153 cmd->channel_flags |= cpu_to_le32(0x00000001); mwl8k_cmd_set_rf_channel()
3155 cmd->channel_flags |= cpu_to_le32(0x00000004); mwl8k_cmd_set_rf_channel()
3160 cmd->channel_flags |= cpu_to_le32(0x00000080); mwl8k_cmd_set_rf_channel()
3162 cmd->channel_flags |= cpu_to_le32(0x000001900); mwl8k_cmd_set_rf_channel()
3164 cmd->channel_flags |= cpu_to_le32(0x000000900); mwl8k_cmd_set_rf_channel()
3166 cmd->channel_flags |= cpu_to_le32(0x00000080); mwl8k_cmd_set_rf_channel()
3181 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_set_rf_channel()
3182 kfree(cmd); mwl8k_cmd_set_rf_channel()
3225 struct mwl8k_cmd_update_set_aid *cmd; mwl8k_cmd_set_aid() local
3229 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_set_aid()
3230 if (cmd == NULL) mwl8k_cmd_set_aid()
3233 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_AID); mwl8k_cmd_set_aid()
3234 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_set_aid()
3235 cmd->aid = cpu_to_le16(vif->bss_conf.aid); mwl8k_cmd_set_aid()
3236 memcpy(cmd->bssid, vif->bss_conf.bssid, ETH_ALEN); mwl8k_cmd_set_aid()
3254 cmd->protection_mode = cpu_to_le16(prot_mode); mwl8k_cmd_set_aid()
3256 legacy_rate_mask_to_array(cmd->supp_rates, legacy_rate_mask); mwl8k_cmd_set_aid()
3258 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_set_aid()
3259 kfree(cmd); mwl8k_cmd_set_aid()
3280 struct mwl8k_cmd_set_rate *cmd; mwl8k_cmd_set_rate() local
3283 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_set_rate()
3284 if (cmd == NULL) mwl8k_cmd_set_rate()
3287 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_RATE); mwl8k_cmd_set_rate()
3288 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_set_rate()
3289 legacy_rate_mask_to_array(cmd->legacy_rates, legacy_rate_mask); mwl8k_cmd_set_rate()
3290 memcpy(cmd->mcs_set, mcs_rates, 16); mwl8k_cmd_set_rate()
3292 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_set_rate()
3293 kfree(cmd); mwl8k_cmd_set_rate()
3312 struct mwl8k_cmd_finalize_join *cmd; mwl8k_cmd_finalize_join() local
3317 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_finalize_join()
3318 if (cmd == NULL) mwl8k_cmd_finalize_join()
3321 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_FINALIZE_JOIN); mwl8k_cmd_finalize_join()
3322 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_finalize_join()
3323 cmd->sleep_interval = cpu_to_le32(dtim ? dtim : 1); mwl8k_cmd_finalize_join()
3331 memcpy(cmd->beacon_data, &payload->u.beacon, payload_len); mwl8k_cmd_finalize_join()
3333 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_finalize_join()
3334 kfree(cmd); mwl8k_cmd_finalize_join()
3351 struct mwl8k_cmd_set_rts_threshold *cmd; mwl8k_cmd_set_rts_threshold() local
3354 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_set_rts_threshold()
3355 if (cmd == NULL) mwl8k_cmd_set_rts_threshold()
3358 cmd->header.code = cpu_to_le16(MWL8K_CMD_RTS_THRESHOLD); mwl8k_cmd_set_rts_threshold()
3359 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_set_rts_threshold()
3360 cmd->action = cpu_to_le16(MWL8K_CMD_SET); mwl8k_cmd_set_rts_threshold()
3361 cmd->threshold = cpu_to_le16(rts_thresh); mwl8k_cmd_set_rts_threshold()
3363 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_set_rts_threshold()
3364 kfree(cmd); mwl8k_cmd_set_rts_threshold()
3380 struct mwl8k_cmd_set_slot *cmd; mwl8k_cmd_set_slot() local
3383 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_set_slot()
3384 if (cmd == NULL) mwl8k_cmd_set_slot()
3387 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_SLOT); mwl8k_cmd_set_slot()
3388 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_set_slot()
3389 cmd->action = cpu_to_le16(MWL8K_CMD_SET); mwl8k_cmd_set_slot()
3390 cmd->short_slot = short_slot_time; mwl8k_cmd_set_slot()
3392 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_set_slot()
3393 kfree(cmd); mwl8k_cmd_set_slot()
3454 struct mwl8k_cmd_set_edca_params *cmd; mwl8k_cmd_set_edca_params() local
3457 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_set_edca_params()
3458 if (cmd == NULL) mwl8k_cmd_set_edca_params()
3461 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_EDCA_PARAMS); mwl8k_cmd_set_edca_params()
3462 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_set_edca_params()
3463 cmd->action = cpu_to_le16(MWL8K_SET_EDCA_ALL); mwl8k_cmd_set_edca_params()
3464 cmd->txop = cpu_to_le16(txop); mwl8k_cmd_set_edca_params()
3466 cmd->ap.log_cw_max = cpu_to_le32(ilog2(cw_max + 1)); mwl8k_cmd_set_edca_params()
3467 cmd->ap.log_cw_min = cpu_to_le32(ilog2(cw_min + 1)); mwl8k_cmd_set_edca_params()
3468 cmd->ap.aifs = aifs; mwl8k_cmd_set_edca_params()
3469 cmd->ap.txq = qnum; mwl8k_cmd_set_edca_params()
3471 cmd->sta.log_cw_max = (u8)ilog2(cw_max + 1); mwl8k_cmd_set_edca_params()
3472 cmd->sta.log_cw_min = (u8)ilog2(cw_min + 1); mwl8k_cmd_set_edca_params()
3473 cmd->sta.aifs = aifs; mwl8k_cmd_set_edca_params()
3474 cmd->sta.txq = qnum; mwl8k_cmd_set_edca_params()
3477 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_set_edca_params()
3478 kfree(cmd); mwl8k_cmd_set_edca_params()
3494 struct mwl8k_cmd_set_wmm_mode *cmd; mwl8k_cmd_set_wmm_mode() local
3497 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_set_wmm_mode()
3498 if (cmd == NULL) mwl8k_cmd_set_wmm_mode()
3501 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_WMM_MODE); mwl8k_cmd_set_wmm_mode()
3502 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_set_wmm_mode()
3503 cmd->action = cpu_to_le16(!!enable); mwl8k_cmd_set_wmm_mode()
3505 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_set_wmm_mode()
3506 kfree(cmd); mwl8k_cmd_set_wmm_mode()
3526 struct mwl8k_cmd_mimo_config *cmd; mwl8k_cmd_mimo_config() local
3529 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_mimo_config()
3530 if (cmd == NULL) mwl8k_cmd_mimo_config()
3533 cmd->header.code = cpu_to_le16(MWL8K_CMD_MIMO_CONFIG); mwl8k_cmd_mimo_config()
3534 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_mimo_config()
3535 cmd->action = cpu_to_le32((u32)MWL8K_CMD_SET); mwl8k_cmd_mimo_config()
3536 cmd->rx_antenna_map = rx; mwl8k_cmd_mimo_config()
3537 cmd->tx_antenna_map = tx; mwl8k_cmd_mimo_config()
3539 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_mimo_config()
3540 kfree(cmd); mwl8k_cmd_mimo_config()
3569 struct mwl8k_cmd_use_fixed_rate_sta *cmd; mwl8k_cmd_use_fixed_rate_sta() local
3572 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_use_fixed_rate_sta()
3573 if (cmd == NULL) mwl8k_cmd_use_fixed_rate_sta()
3576 cmd->header.code = cpu_to_le16(MWL8K_CMD_USE_FIXED_RATE); mwl8k_cmd_use_fixed_rate_sta()
3577 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_use_fixed_rate_sta()
3578 cmd->action = cpu_to_le32(MWL8K_USE_AUTO_RATE); mwl8k_cmd_use_fixed_rate_sta()
3579 cmd->rate_type = cpu_to_le32(MWL8K_UCAST_RATE); mwl8k_cmd_use_fixed_rate_sta()
3581 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_use_fixed_rate_sta()
3582 kfree(cmd); mwl8k_cmd_use_fixed_rate_sta()
3609 struct mwl8k_cmd_use_fixed_rate_ap *cmd; mwl8k_cmd_use_fixed_rate_ap() local
3612 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_use_fixed_rate_ap()
3613 if (cmd == NULL) mwl8k_cmd_use_fixed_rate_ap()
3616 cmd->header.code = cpu_to_le16(MWL8K_CMD_USE_FIXED_RATE); mwl8k_cmd_use_fixed_rate_ap()
3617 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_use_fixed_rate_ap()
3618 cmd->action = cpu_to_le32(MWL8K_USE_AUTO_RATE); mwl8k_cmd_use_fixed_rate_ap()
3619 cmd->multicast_rate = mcast; mwl8k_cmd_use_fixed_rate_ap()
3620 cmd->management_rate = mgmt; mwl8k_cmd_use_fixed_rate_ap()
3622 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_use_fixed_rate_ap()
3623 kfree(cmd); mwl8k_cmd_use_fixed_rate_ap()
3638 struct mwl8k_cmd_enable_sniffer *cmd; mwl8k_cmd_enable_sniffer() local
3641 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_enable_sniffer()
3642 if (cmd == NULL) mwl8k_cmd_enable_sniffer()
3645 cmd->header.code = cpu_to_le16(MWL8K_CMD_ENABLE_SNIFFER); mwl8k_cmd_enable_sniffer()
3646 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_enable_sniffer()
3647 cmd->action = cpu_to_le32(!!enable); mwl8k_cmd_enable_sniffer()
3649 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_enable_sniffer()
3650 kfree(cmd); mwl8k_cmd_enable_sniffer()
3676 struct mwl8k_cmd_update_mac_addr *cmd; mwl8k_cmd_update_mac_addr() local
3696 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_update_mac_addr()
3697 if (cmd == NULL) mwl8k_cmd_update_mac_addr()
3701 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_MAC_ADDR); mwl8k_cmd_update_mac_addr()
3703 cmd->header.code = cpu_to_le16(MWL8K_CMD_DEL_MAC_ADDR); mwl8k_cmd_update_mac_addr()
3705 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_update_mac_addr()
3707 cmd->mbss.mac_type = cpu_to_le16(mac_type); mwl8k_cmd_update_mac_addr()
3708 memcpy(cmd->mbss.mac_addr, mac, ETH_ALEN); mwl8k_cmd_update_mac_addr()
3710 memcpy(cmd->mac_addr, mac, ETH_ALEN); mwl8k_cmd_update_mac_addr()
3713 rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); mwl8k_cmd_update_mac_addr()
3714 kfree(cmd); mwl8k_cmd_update_mac_addr()
3748 struct mwl8k_cmd_set_rate_adapt_mode *cmd; mwl8k_cmd_set_rateadapt_mode() local
3751 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_set_rateadapt_mode()
3752 if (cmd == NULL) mwl8k_cmd_set_rateadapt_mode()
3755 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_RATEADAPT_MODE); mwl8k_cmd_set_rateadapt_mode()
3756 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_set_rateadapt_mode()
3757 cmd->action = cpu_to_le16(MWL8K_CMD_SET); mwl8k_cmd_set_rateadapt_mode()
3758 cmd->mode = cpu_to_le16(mode); mwl8k_cmd_set_rateadapt_mode()
3760 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_set_rateadapt_mode()
3761 kfree(cmd); mwl8k_cmd_set_rateadapt_mode()
3776 struct mwl8k_cmd_get_watchdog_bitmap *cmd; mwl8k_cmd_get_watchdog_bitmap() local
3779 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_get_watchdog_bitmap()
3780 if (cmd == NULL) mwl8k_cmd_get_watchdog_bitmap()
3783 cmd->header.code = cpu_to_le16(MWL8K_CMD_GET_WATCHDOG_BITMAP); mwl8k_cmd_get_watchdog_bitmap()
3784 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_get_watchdog_bitmap()
3786 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_get_watchdog_bitmap()
3788 *bitmap = cmd->bitmap; mwl8k_cmd_get_watchdog_bitmap()
3790 kfree(cmd); mwl8k_cmd_get_watchdog_bitmap()
3857 struct mwl8k_cmd_bss_start *cmd; mwl8k_cmd_bss_start() local
3868 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_bss_start()
3869 if (cmd == NULL) mwl8k_cmd_bss_start()
3872 cmd->header.code = cpu_to_le16(MWL8K_CMD_BSS_START); mwl8k_cmd_bss_start()
3873 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_bss_start()
3874 cmd->enable = cpu_to_le32(enable); mwl8k_cmd_bss_start()
3876 rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); mwl8k_cmd_bss_start()
3877 kfree(cmd); mwl8k_cmd_bss_start()
3957 struct mwl8k_cmd_bastream *cmd; mwl8k_check_ba() local
3960 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_check_ba()
3961 if (cmd == NULL) mwl8k_check_ba()
3964 cmd->header.code = cpu_to_le16(MWL8K_CMD_BASTREAM); mwl8k_check_ba()
3965 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_check_ba()
3967 cmd->action = cpu_to_le32(MWL8K_BA_CHECK); mwl8k_check_ba()
3969 cmd->create_params.queue_id = stream->idx; mwl8k_check_ba()
3970 memcpy(&cmd->create_params.peer_mac_addr[0], stream->sta->addr, mwl8k_check_ba()
3972 cmd->create_params.tid = stream->tid; mwl8k_check_ba()
3974 cmd->create_params.flags = mwl8k_check_ba()
3978 rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); mwl8k_check_ba()
3980 kfree(cmd); mwl8k_check_ba()
3989 struct mwl8k_cmd_bastream *cmd; mwl8k_create_ba() local
3992 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_create_ba()
3993 if (cmd == NULL) mwl8k_create_ba()
3997 cmd->header.code = cpu_to_le16(MWL8K_CMD_BASTREAM); mwl8k_create_ba()
3998 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_create_ba()
4000 cmd->action = cpu_to_le32(MWL8K_BA_CREATE); mwl8k_create_ba()
4002 cmd->create_params.bar_thrs = cpu_to_le32((u32)buf_size); mwl8k_create_ba()
4003 cmd->create_params.window_size = cpu_to_le32((u32)buf_size); mwl8k_create_ba()
4004 cmd->create_params.queue_id = stream->idx; mwl8k_create_ba()
4006 memcpy(cmd->create_params.peer_mac_addr, stream->sta->addr, ETH_ALEN); mwl8k_create_ba()
4007 cmd->create_params.tid = stream->tid; mwl8k_create_ba()
4008 cmd->create_params.curr_seq_no = cpu_to_le16(0); mwl8k_create_ba()
4009 cmd->create_params.reset_seq_no_flag = 1; mwl8k_create_ba()
4011 cmd->create_params.param_info = mwl8k_create_ba()
4017 cmd->create_params.flags = mwl8k_create_ba()
4021 rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); mwl8k_create_ba()
4025 kfree(cmd); mwl8k_create_ba()
4033 struct mwl8k_cmd_bastream *cmd; mwl8k_destroy_ba() local
4035 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_destroy_ba()
4036 if (cmd == NULL) mwl8k_destroy_ba()
4039 cmd->header.code = cpu_to_le16(MWL8K_CMD_BASTREAM); mwl8k_destroy_ba()
4040 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_destroy_ba()
4041 cmd->action = cpu_to_le32(MWL8K_BA_DESTROY); mwl8k_destroy_ba()
4043 cmd->destroy_params.ba_context = cpu_to_le32(idx); mwl8k_destroy_ba()
4044 mwl8k_post_cmd(hw, &cmd->header); mwl8k_destroy_ba()
4048 kfree(cmd); mwl8k_destroy_ba()
4083 struct mwl8k_cmd_set_new_stn *cmd; mwl8k_cmd_set_new_stn_add() local
4087 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_set_new_stn_add()
4088 if (cmd == NULL) mwl8k_cmd_set_new_stn_add()
4091 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_NEW_STN); mwl8k_cmd_set_new_stn_add()
4092 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_set_new_stn_add()
4093 cmd->aid = cpu_to_le16(sta->aid); mwl8k_cmd_set_new_stn_add()
4094 memcpy(cmd->mac_addr, sta->addr, ETH_ALEN); mwl8k_cmd_set_new_stn_add()
4095 cmd->stn_id = cpu_to_le16(sta->aid); mwl8k_cmd_set_new_stn_add()
4096 cmd->action = cpu_to_le16(MWL8K_STA_ACTION_ADD); mwl8k_cmd_set_new_stn_add()
4101 cmd->legacy_rates = cpu_to_le32(rates); mwl8k_cmd_set_new_stn_add()
4103 cmd->ht_rates[0] = sta->ht_cap.mcs.rx_mask[0]; mwl8k_cmd_set_new_stn_add()
4104 cmd->ht_rates[1] = sta->ht_cap.mcs.rx_mask[1]; mwl8k_cmd_set_new_stn_add()
4105 cmd->ht_rates[2] = sta->ht_cap.mcs.rx_mask[2]; mwl8k_cmd_set_new_stn_add()
4106 cmd->ht_rates[3] = sta->ht_cap.mcs.rx_mask[3]; mwl8k_cmd_set_new_stn_add()
4107 cmd->ht_capabilities_info = cpu_to_le16(sta->ht_cap.cap); mwl8k_cmd_set_new_stn_add()
4108 cmd->mac_ht_param_info = (sta->ht_cap.ampdu_factor & 3) | mwl8k_cmd_set_new_stn_add()
4110 cmd->is_qos_sta = 1; mwl8k_cmd_set_new_stn_add()
4113 rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); mwl8k_cmd_set_new_stn_add()
4114 kfree(cmd); mwl8k_cmd_set_new_stn_add()
4122 struct mwl8k_cmd_set_new_stn *cmd; mwl8k_cmd_set_new_stn_add_self() local
4125 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_set_new_stn_add_self()
4126 if (cmd == NULL) mwl8k_cmd_set_new_stn_add_self()
4129 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_NEW_STN); mwl8k_cmd_set_new_stn_add_self()
4130 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_set_new_stn_add_self()
4131 memcpy(cmd->mac_addr, vif->addr, ETH_ALEN); mwl8k_cmd_set_new_stn_add_self()
4133 rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); mwl8k_cmd_set_new_stn_add_self()
4134 kfree(cmd); mwl8k_cmd_set_new_stn_add_self()
4142 struct mwl8k_cmd_set_new_stn *cmd; mwl8k_cmd_set_new_stn_del() local
4168 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_set_new_stn_del()
4169 if (cmd == NULL) mwl8k_cmd_set_new_stn_del()
4172 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_NEW_STN); mwl8k_cmd_set_new_stn_del()
4173 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_set_new_stn_del()
4174 memcpy(cmd->mac_addr, addr, ETH_ALEN); mwl8k_cmd_set_new_stn_del()
4175 cmd->action = cpu_to_le16(MWL8K_STA_ACTION_REMOVE); mwl8k_cmd_set_new_stn_del()
4177 rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); mwl8k_cmd_set_new_stn_del()
4178 kfree(cmd); mwl8k_cmd_set_new_stn_del()
4250 struct mwl8k_cmd_update_encryption *cmd; mwl8k_cmd_update_encryption_enable() local
4253 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_update_encryption_enable()
4254 if (cmd == NULL) mwl8k_cmd_update_encryption_enable()
4257 cmd->header.code = cpu_to_le16(MWL8K_CMD_UPDATE_ENCRYPTION); mwl8k_cmd_update_encryption_enable()
4258 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_update_encryption_enable()
4259 cmd->action = cpu_to_le32(MWL8K_ENCR_ENABLE); mwl8k_cmd_update_encryption_enable()
4260 memcpy(cmd->mac_addr, addr, ETH_ALEN); mwl8k_cmd_update_encryption_enable()
4261 cmd->encr_type = encr_type; mwl8k_cmd_update_encryption_enable()
4263 rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); mwl8k_cmd_update_encryption_enable()
4264 kfree(cmd); mwl8k_cmd_update_encryption_enable()
4269 static int mwl8k_encryption_set_cmd_info(struct mwl8k_cmd_set_key *cmd, mwl8k_encryption_set_cmd_info() argument
4273 cmd->header.code = cpu_to_le16(MWL8K_CMD_UPDATE_ENCRYPTION); mwl8k_encryption_set_cmd_info()
4274 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_encryption_set_cmd_info()
4275 cmd->length = cpu_to_le16(sizeof(*cmd) - mwl8k_encryption_set_cmd_info()
4277 cmd->key_id = cpu_to_le32(key->keyidx); mwl8k_encryption_set_cmd_info()
4278 cmd->key_len = cpu_to_le16(key->keylen); mwl8k_encryption_set_cmd_info()
4279 memcpy(cmd->mac_addr, addr, ETH_ALEN); mwl8k_encryption_set_cmd_info()
4284 cmd->key_type_id = cpu_to_le16(MWL8K_ALG_WEP); mwl8k_encryption_set_cmd_info()
4286 cmd->key_info = cpu_to_le32(MWL8K_KEY_FLAG_WEP_TXKEY); mwl8k_encryption_set_cmd_info()
4290 cmd->key_type_id = cpu_to_le16(MWL8K_ALG_TKIP); mwl8k_encryption_set_cmd_info()
4291 cmd->key_info = (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) mwl8k_encryption_set_cmd_info()
4294 cmd->key_info |= cpu_to_le32(MWL8K_KEY_FLAG_MICKEY_VALID mwl8k_encryption_set_cmd_info()
4298 cmd->key_type_id = cpu_to_le16(MWL8K_ALG_CCMP); mwl8k_encryption_set_cmd_info()
4299 cmd->key_info = (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) mwl8k_encryption_set_cmd_info()
4315 struct mwl8k_cmd_set_key *cmd; mwl8k_cmd_encryption_set_key() local
4322 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_encryption_set_key()
4323 if (cmd == NULL) mwl8k_cmd_encryption_set_key()
4326 rc = mwl8k_encryption_set_cmd_info(cmd, addr, key); mwl8k_cmd_encryption_set_key()
4360 memcpy(cmd->key_material, key->key, keymlen); mwl8k_cmd_encryption_set_key()
4361 cmd->action = cpu_to_le32(action); mwl8k_cmd_encryption_set_key()
4363 rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); mwl8k_cmd_encryption_set_key()
4365 kfree(cmd); mwl8k_cmd_encryption_set_key()
4375 struct mwl8k_cmd_set_key *cmd; mwl8k_cmd_encryption_remove_key() local
4379 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_encryption_remove_key()
4380 if (cmd == NULL) mwl8k_cmd_encryption_remove_key()
4383 rc = mwl8k_encryption_set_cmd_info(cmd, addr, key); mwl8k_cmd_encryption_remove_key()
4391 cmd->action = cpu_to_le32(MWL8K_ENCR_REMOVE_KEY); mwl8k_cmd_encryption_remove_key()
4393 rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); mwl8k_cmd_encryption_remove_key()
4395 kfree(cmd); mwl8k_cmd_encryption_remove_key()
4511 struct mwl8k_cmd_update_stadb *cmd; mwl8k_cmd_update_stadb_add() local
4516 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_update_stadb_add()
4517 if (cmd == NULL) mwl8k_cmd_update_stadb_add()
4520 cmd->header.code = cpu_to_le16(MWL8K_CMD_UPDATE_STADB); mwl8k_cmd_update_stadb_add()
4521 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_update_stadb_add()
4522 cmd->action = cpu_to_le32(MWL8K_STA_DB_MODIFY_ENTRY); mwl8k_cmd_update_stadb_add()
4523 memcpy(cmd->peer_addr, sta->addr, ETH_ALEN); mwl8k_cmd_update_stadb_add()
4525 p = &cmd->peer_info; mwl8k_cmd_update_stadb_add()
4541 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_update_stadb_add()
4544 kfree(cmd); mwl8k_cmd_update_stadb_add()
4552 struct mwl8k_cmd_update_stadb *cmd; mwl8k_cmd_update_stadb_del() local
4555 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); mwl8k_cmd_update_stadb_del()
4556 if (cmd == NULL) mwl8k_cmd_update_stadb_del()
4559 cmd->header.code = cpu_to_le16(MWL8K_CMD_UPDATE_STADB); mwl8k_cmd_update_stadb_del()
4560 cmd->header.length = cpu_to_le16(sizeof(*cmd)); mwl8k_cmd_update_stadb_del()
4561 cmd->action = cpu_to_le32(MWL8K_STA_DB_DEL_ENTRY); mwl8k_cmd_update_stadb_del()
4562 memcpy(cmd->peer_addr, addr, ETH_ALEN); mwl8k_cmd_update_stadb_del()
4564 rc = mwl8k_post_cmd(hw, &cmd->header); mwl8k_cmd_update_stadb_del()
4565 kfree(cmd); mwl8k_cmd_update_stadb_del()
5157 struct mwl8k_cmd_pkt *cmd; mwl8k_prepare_multicast() local
5166 cmd = __mwl8k_cmd_mac_multicast_adr(hw, 0, mc_list); mwl8k_prepare_multicast()
5168 return (unsigned long)cmd; mwl8k_prepare_multicast()
5217 struct mwl8k_cmd_pkt *cmd = (void *)(unsigned long)multicast; mwl8k_configure_filter() local
5225 kfree(cmd); mwl8k_configure_filter()
5235 kfree(cmd); mwl8k_configure_filter()
5243 kfree(cmd); mwl8k_configure_filter()
5287 kfree(cmd); mwl8k_configure_filter()
5288 cmd = __mwl8k_cmd_mac_multicast_adr(hw, 1, NULL); mwl8k_configure_filter()
5291 if (cmd != NULL) { mwl8k_configure_filter()
5292 mwl8k_post_cmd(hw, cmd); mwl8k_configure_filter()
5293 kfree(cmd); mwl8k_configure_filter()
2281 mwl8k_post_pervif_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct mwl8k_cmd_pkt *cmd) mwl8k_post_pervif_cmd() argument
/linux-4.4.14/arch/arm/mach-omap2/
H A Dam33xx-restart.c17 * @cmd: passed from the userspace program rebooting the system (if provided)
19 * Resets the SoC. For @cmd, see the 'reboot' syscall in
22 void am33xx_restart(enum reboot_mode mode, const char *cmd) am33xx_restart() argument
24 /* TODO: Handle mode and cmd if necessary */ am33xx_restart()
H A Domap4-restart.c18 * @cmd: passed from the userspace program rebooting the system (if provided)
20 * Resets the SoC. For @cmd, see the 'reboot' syscall in
23 void omap44xx_restart(enum reboot_mode mode, const char *cmd) omap44xx_restart() argument
25 /* XXX Should save 'cmd' into scratchpad for use after reboot */ omap44xx_restart()
H A Domap3-restart.c26 * @cmd: passed from the userspace program rebooting the system (if provided)
28 * Resets the SoC. For @cmd, see the 'reboot' syscall in
31 void omap3xxx_restart(enum reboot_mode mode, const char *cmd) omap3xxx_restart() argument
33 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0)); omap3xxx_restart()
/linux-4.4.14/drivers/staging/comedi/
H A Dcomedi_compat32.c90 static int translated_ioctl(struct file *file, unsigned int cmd, translated_ioctl() argument
94 return file->f_op->unlocked_ioctl(file, cmd, arg); translated_ioctl()
164 /* Copy 32-bit cmd structure to native cmd structure. */ get_compat_cmd()
165 static int get_compat_cmd(struct comedi_cmd __user *cmd, get_compat_cmd() argument
174 /* Copy cmd structure. */ get_compat_cmd()
176 !access_ok(VERIFY_WRITE, cmd, sizeof(*cmd))) get_compat_cmd()
181 err |= __put_user(temp.uint, &cmd->subdev); get_compat_cmd()
183 err |= __put_user(temp.uint, &cmd->flags); get_compat_cmd()
185 err |= __put_user(temp.uint, &cmd->start_src); get_compat_cmd()
187 err |= __put_user(temp.uint, &cmd->start_arg); get_compat_cmd()
189 err |= __put_user(temp.uint, &cmd->scan_begin_src); get_compat_cmd()
191 err |= __put_user(temp.uint, &cmd->scan_begin_arg); get_compat_cmd()
193 err |= __put_user(temp.uint, &cmd->convert_src); get_compat_cmd()
195 err |= __put_user(temp.uint, &cmd->convert_arg); get_compat_cmd()
197 err |= __put_user(temp.uint, &cmd->scan_end_src); get_compat_cmd()
199 err |= __put_user(temp.uint, &cmd->scan_end_arg); get_compat_cmd()
201 err |= __put_user(temp.uint, &cmd->stop_src); get_compat_cmd()
203 err |= __put_user(temp.uint, &cmd->stop_arg); get_compat_cmd()
206 &cmd->chanlist); get_compat_cmd()
208 err |= __put_user(temp.uint, &cmd->chanlist_len); get_compat_cmd()
210 err |= __put_user(compat_ptr(temp.uptr), &cmd->data); get_compat_cmd()
212 err |= __put_user(temp.uint, &cmd->data_len); get_compat_cmd()
216 /* Copy native cmd structure to 32-bit cmd structure. */ put_compat_cmd()
218 struct comedi_cmd __user *cmd) put_compat_cmd()
224 * Copy back most of cmd structure. put_compat_cmd()
229 if (!access_ok(VERIFY_READ, cmd, sizeof(*cmd)) || put_compat_cmd()
234 err |= __get_user(temp, &cmd->subdev); put_compat_cmd()
236 err |= __get_user(temp, &cmd->flags); put_compat_cmd()
238 err |= __get_user(temp, &cmd->start_src); put_compat_cmd()
240 err |= __get_user(temp, &cmd->start_arg); put_compat_cmd()
242 err |= __get_user(temp, &cmd->scan_begin_src); put_compat_cmd()
244 err |= __get_user(temp, &cmd->scan_begin_arg); put_compat_cmd()
246 err |= __get_user(temp, &cmd->convert_src); put_compat_cmd()
248 err |= __get_user(temp, &cmd->convert_arg); put_compat_cmd()
250 err |= __get_user(temp, &cmd->scan_end_src); put_compat_cmd()
252 err |= __get_user(temp, &cmd->scan_end_arg); put_compat_cmd()
254 err |= __get_user(temp, &cmd->stop_src); put_compat_cmd()
256 err |= __get_user(temp, &cmd->stop_arg); put_compat_cmd()
259 err |= __get_user(temp, &cmd->chanlist_len); put_compat_cmd()
262 err |= __get_user(temp, &cmd->data_len); put_compat_cmd()
270 struct comedi_cmd __user *cmd; compat_cmd() local
275 cmd = compat_alloc_user_space(sizeof(*cmd)); compat_cmd()
277 rc = get_compat_cmd(cmd, cmd32); compat_cmd()
281 rc = translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd); compat_cmd()
283 /* Special case: copy cmd back to user. */ compat_cmd()
284 err = put_compat_cmd(cmd32, cmd); compat_cmd()
295 struct comedi_cmd __user *cmd; compat_cmdtest() local
300 cmd = compat_alloc_user_space(sizeof(*cmd)); compat_cmdtest()
302 rc = get_compat_cmd(cmd, cmd32); compat_cmdtest()
306 rc = translated_ioctl(file, COMEDI_CMDTEST, (unsigned long)cmd); compat_cmdtest()
310 err = put_compat_cmd(cmd32, cmd); compat_cmdtest()
418 long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) comedi_compat_ioctl() argument
422 switch (cmd) { comedi_compat_ioctl()
430 rc = translated_ioctl(file, cmd, arg); comedi_compat_ioctl()
439 rc = translated_ioctl(file, cmd, arg); comedi_compat_ioctl()
217 put_compat_cmd(struct comedi32_cmd_struct __user *cmd32, struct comedi_cmd __user *cmd) put_compat_cmd() argument
/linux-4.4.14/drivers/net/ethernet/mellanox/mlx5/core/
H A Dcmd.c78 static struct mlx5_cmd_work_ent *alloc_cmd(struct mlx5_cmd *cmd, alloc_cmd() argument
98 ent->cmd = cmd; alloc_cmd()
104 static u8 alloc_token(struct mlx5_cmd *cmd) alloc_token() argument
108 spin_lock(&cmd->token_lock); alloc_token()
109 cmd->token++; alloc_token()
110 if (cmd->token == 0) alloc_token()
111 cmd->token++; alloc_token()
112 token = cmd->token; alloc_token()
113 spin_unlock(&cmd->token_lock); alloc_token()
118 static int alloc_ent(struct mlx5_cmd *cmd) alloc_ent() argument
123 spin_lock_irqsave(&cmd->alloc_lock, flags); alloc_ent()
124 ret = find_first_bit(&cmd->bitmask, cmd->max_reg_cmds); alloc_ent()
125 if (ret < cmd->max_reg_cmds) alloc_ent()
126 clear_bit(ret, &cmd->bitmask); alloc_ent()
127 spin_unlock_irqrestore(&cmd->alloc_lock, flags); alloc_ent()
129 return ret < cmd->max_reg_cmds ? ret : -ENOMEM; alloc_ent()
132 static void free_ent(struct mlx5_cmd *cmd, int idx) free_ent() argument
136 spin_lock_irqsave(&cmd->alloc_lock, flags); free_ent()
137 set_bit(idx, &cmd->bitmask); free_ent()
138 spin_unlock_irqrestore(&cmd->alloc_lock, flags); free_ent()
141 static struct mlx5_cmd_layout *get_inst(struct mlx5_cmd *cmd, int idx) get_inst() argument
143 return cmd->cmd_buf + (idx << cmd->log_stride); get_inst()
622 struct mlx5_cmd *cmd = ent->cmd; cmd_work_handler() local
623 struct mlx5_core_dev *dev = container_of(cmd, struct mlx5_core_dev, cmd); cmd_work_handler()
628 sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem; cmd_work_handler()
631 ent->idx = alloc_ent(cmd); cmd_work_handler()
638 ent->idx = cmd->max_reg_cmds; cmd_work_handler()
639 spin_lock_irqsave(&cmd->alloc_lock, flags); cmd_work_handler()
640 clear_bit(ent->idx, &cmd->bitmask); cmd_work_handler()
641 spin_unlock_irqrestore(&cmd->alloc_lock, flags); cmd_work_handler()
644 ent->token = alloc_token(cmd); cmd_work_handler()
645 cmd->ent_arr[ent->idx] = ent; cmd_work_handler()
646 lay = get_inst(cmd, ent->idx); cmd_work_handler()
660 set_signature(ent, !cmd->checksum_disabled); cmd_work_handler()
670 if (cmd->mode == CMD_MODE_POLLING) { cmd_work_handler()
718 struct mlx5_cmd *cmd = &dev->cmd; wait_func() local
721 if (cmd->mode == CMD_MODE_POLLING) { wait_func()
760 struct mlx5_cmd *cmd = &dev->cmd; mlx5_cmd_invoke() local
770 ent = alloc_cmd(cmd, in, out, uout, uout_size, callback, context, mlx5_cmd_invoke()
781 } else if (!queue_work(cmd->wq, &ent->work)) { mlx5_cmd_invoke()
794 if (op < ARRAY_SIZE(cmd->stats)) { mlx5_cmd_invoke()
795 stats = &cmd->stats[op]; mlx5_cmd_invoke()
820 struct mlx5_cmd_debug *dbg = &dev->cmd.dbg; dbg_write()
921 mailbox->buf = pci_pool_alloc(dev->cmd.pool, flags, alloc_cmd_box()
937 pci_pool_free(dev->cmd.pool, mailbox->buf, mailbox->dma); free_cmd_box()
1006 struct mlx5_cmd_debug *dbg = &dev->cmd.dbg; data_write()
1041 struct mlx5_cmd_debug *dbg = &dev->cmd.dbg; data_read()
1070 struct mlx5_cmd_debug *dbg = &dev->cmd.dbg; outlen_read()
1093 struct mlx5_cmd_debug *dbg = &dev->cmd.dbg; outlen_write()
1136 struct mlx5_cmd *cmd = &dev->cmd; set_wqname() local
1138 snprintf(cmd->wq_name, sizeof(cmd->wq_name), "mlx5_cmd_%s", set_wqname()
1144 struct mlx5_cmd_debug *dbg = &dev->cmd.dbg; clean_debug_files()
1155 struct mlx5_cmd_debug *dbg = &dev->cmd.dbg; create_debugfs_files()
1161 dbg->dbg_root = debugfs_create_dir("cmd", dev->priv.dbg_root); create_debugfs_files()
1200 struct mlx5_cmd *cmd = &dev->cmd; mlx5_cmd_use_events() local
1203 for (i = 0; i < cmd->max_reg_cmds; i++) mlx5_cmd_use_events()
1204 down(&cmd->sem); mlx5_cmd_use_events()
1206 down(&cmd->pages_sem); mlx5_cmd_use_events()
1208 flush_workqueue(cmd->wq); mlx5_cmd_use_events()
1210 cmd->mode = CMD_MODE_EVENTS; mlx5_cmd_use_events()
1212 up(&cmd->pages_sem); mlx5_cmd_use_events()
1213 for (i = 0; i < cmd->max_reg_cmds; i++) mlx5_cmd_use_events()
1214 up(&cmd->sem); mlx5_cmd_use_events()
1219 struct mlx5_cmd *cmd = &dev->cmd; mlx5_cmd_use_polling() local
1222 for (i = 0; i < cmd->max_reg_cmds; i++) mlx5_cmd_use_polling()
1223 down(&cmd->sem); mlx5_cmd_use_polling()
1225 down(&cmd->pages_sem); mlx5_cmd_use_polling()
1227 flush_workqueue(cmd->wq); mlx5_cmd_use_polling()
1228 cmd->mode = CMD_MODE_POLLING; mlx5_cmd_use_polling()
1230 up(&cmd->pages_sem); mlx5_cmd_use_polling()
1231 for (i = 0; i < cmd->max_reg_cmds; i++) mlx5_cmd_use_polling()
1232 up(&cmd->sem); mlx5_cmd_use_polling()
1250 struct mlx5_cmd *cmd = &dev->cmd; mlx5_cmd_comp_handler() local
1263 for (i = 0; i < (1 << cmd->log_sz); i++) { mlx5_cmd_comp_handler()
1267 ent = cmd->ent_arr[i]; mlx5_cmd_comp_handler()
1269 sem = &cmd->pages_sem; mlx5_cmd_comp_handler()
1271 sem = &cmd->sem; mlx5_cmd_comp_handler()
1276 if (!cmd->checksum_disabled) mlx5_cmd_comp_handler()
1288 free_ent(cmd, ent->idx); mlx5_cmd_comp_handler()
1292 if (ent->op < ARRAY_SIZE(cmd->stats)) { mlx5_cmd_comp_handler()
1293 stats = &cmd->stats[ent->op]; mlx5_cmd_comp_handler()
1332 struct mlx5_cmd *cmd = &dev->cmd; alloc_msg() local
1336 ent = &cmd->cache.large; alloc_msg()
1338 ent = &cmd->cache.med; alloc_msg()
1450 struct mlx5_cmd *cmd = &dev->cmd; destroy_msg_cache() local
1454 list_for_each_entry_safe(msg, n, &cmd->cache.large.head, list) { destroy_msg_cache()
1459 list_for_each_entry_safe(msg, n, &cmd->cache.med.head, list) { destroy_msg_cache()
1467 struct mlx5_cmd *cmd = &dev->cmd; create_msg_cache() local
1472 spin_lock_init(&cmd->cache.large.lock); create_msg_cache()
1473 INIT_LIST_HEAD(&cmd->cache.large.head); create_msg_cache()
1474 spin_lock_init(&cmd->cache.med.lock); create_msg_cache()
1475 INIT_LIST_HEAD(&cmd->cache.med.head); create_msg_cache()
1483 msg->cache = &cmd->cache.large; create_msg_cache()
1484 list_add_tail(&msg->list, &cmd->cache.large.head); create_msg_cache()
1493 msg->cache = &cmd->cache.med; create_msg_cache()
1494 list_add_tail(&msg->list, &cmd->cache.med.head); create_msg_cache()
1504 static int alloc_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd) alloc_cmd_page() argument
1508 cmd->cmd_alloc_buf = dma_zalloc_coherent(ddev, MLX5_ADAPTER_PAGE_SIZE, alloc_cmd_page()
1509 &cmd->alloc_dma, GFP_KERNEL); alloc_cmd_page()
1510 if (!cmd->cmd_alloc_buf) alloc_cmd_page()
1514 if (!((uintptr_t)cmd->cmd_alloc_buf & (MLX5_ADAPTER_PAGE_SIZE - 1))) { alloc_cmd_page()
1515 cmd->cmd_buf = cmd->cmd_alloc_buf; alloc_cmd_page()
1516 cmd->dma = cmd->alloc_dma; alloc_cmd_page()
1517 cmd->alloc_size = MLX5_ADAPTER_PAGE_SIZE; alloc_cmd_page()
1521 dma_free_coherent(ddev, MLX5_ADAPTER_PAGE_SIZE, cmd->cmd_alloc_buf, alloc_cmd_page()
1522 cmd->alloc_dma); alloc_cmd_page()
1523 cmd->cmd_alloc_buf = dma_zalloc_coherent(ddev, alloc_cmd_page()
1525 &cmd->alloc_dma, GFP_KERNEL); alloc_cmd_page()
1526 if (!cmd->cmd_alloc_buf) alloc_cmd_page()
1529 cmd->cmd_buf = PTR_ALIGN(cmd->cmd_alloc_buf, MLX5_ADAPTER_PAGE_SIZE); alloc_cmd_page()
1530 cmd->dma = ALIGN(cmd->alloc_dma, MLX5_ADAPTER_PAGE_SIZE); alloc_cmd_page()
1531 cmd->alloc_size = 2 * MLX5_ADAPTER_PAGE_SIZE - 1; alloc_cmd_page()
1535 static void free_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd) free_cmd_page() argument
1539 dma_free_coherent(ddev, cmd->alloc_size, cmd->cmd_alloc_buf, free_cmd_page()
1540 cmd->alloc_dma); free_cmd_page()
1547 struct mlx5_cmd *cmd = &dev->cmd; mlx5_cmd_init() local
1553 memset(cmd, 0, sizeof(*cmd)); mlx5_cmd_init()
1562 cmd->pool = pci_pool_create("mlx5_cmd", dev->pdev, size, align, 0); mlx5_cmd_init()
1563 if (!cmd->pool) mlx5_cmd_init()
1566 err = alloc_cmd_page(dev, cmd); mlx5_cmd_init()
1571 cmd->log_sz = cmd_l >> 4 & 0xf; mlx5_cmd_init()
1572 cmd->log_stride = cmd_l & 0xf; mlx5_cmd_init()
1573 if (1 << cmd->log_sz > MLX5_MAX_COMMANDS) { mlx5_cmd_init()
1575 1 << cmd->log_sz); mlx5_cmd_init()
1580 if (cmd->log_sz + cmd->log_stride > MLX5_ADAPTER_PAGE_SHIFT) { mlx5_cmd_init()
1586 cmd->checksum_disabled = 1; mlx5_cmd_init()
1587 cmd->max_reg_cmds = (1 << cmd->log_sz) - 1; mlx5_cmd_init()
1588 cmd->bitmask = (1 << cmd->max_reg_cmds) - 1; mlx5_cmd_init()
1590 cmd->cmdif_rev = ioread32be(&dev->iseg->cmdif_rev_fw_sub) >> 16; mlx5_cmd_init()
1591 if (cmd->cmdif_rev > CMD_IF_REV) { mlx5_cmd_init()
1593 CMD_IF_REV, cmd->cmdif_rev); mlx5_cmd_init()
1598 spin_lock_init(&cmd->alloc_lock); mlx5_cmd_init()
1599 spin_lock_init(&cmd->token_lock); mlx5_cmd_init()
1600 for (i = 0; i < ARRAY_SIZE(cmd->stats); i++) mlx5_cmd_init()
1601 spin_lock_init(&cmd->stats[i].lock); mlx5_cmd_init()
1603 sema_init(&cmd->sem, cmd->max_reg_cmds); mlx5_cmd_init()
1604 sema_init(&cmd->pages_sem, 1); mlx5_cmd_init()
1606 cmd_h = (u32)((u64)(cmd->dma) >> 32); mlx5_cmd_init()
1607 cmd_l = (u32)(cmd->dma); mlx5_cmd_init()
1620 mlx5_core_dbg(dev, "descriptor at dma 0x%llx\n", (unsigned long long)(cmd->dma)); mlx5_cmd_init()
1622 cmd->mode = CMD_MODE_POLLING; mlx5_cmd_init()
1631 cmd->wq = create_singlethread_workqueue(cmd->wq_name); mlx5_cmd_init()
1632 if (!cmd->wq) { mlx5_cmd_init()
1647 destroy_workqueue(cmd->wq); mlx5_cmd_init()
1653 free_cmd_page(dev, cmd); mlx5_cmd_init()
1656 pci_pool_destroy(cmd->pool); mlx5_cmd_init()
1664 struct mlx5_cmd *cmd = &dev->cmd; mlx5_cmd_cleanup() local
1667 destroy_workqueue(cmd->wq); mlx5_cmd_cleanup()
1669 free_cmd_page(dev, cmd); mlx5_cmd_cleanup()
1670 pci_pool_destroy(cmd->pool); mlx5_cmd_cleanup()
H A DMakefile3 mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
/linux-4.4.14/drivers/staging/comedi/drivers/
H A Dcomedi_test.c189 struct comedi_cmd *cmd = &async->cmd; waveform_ai_timer() local
202 unsigned int chanspec = cmd->chanlist[async->cur_chan]; waveform_ai_timer()
214 cmd->scan_end_arg; waveform_ai_timer()
223 if (cmd->stop_src == TRIG_COUNT && async->scans_done >= cmd->stop_arg) { waveform_ai_timer()
240 struct comedi_cmd *cmd) waveform_ai_cmdtest()
247 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); waveform_ai_cmdtest()
248 err |= comedi_check_trigger_src(&cmd->scan_begin_src, waveform_ai_cmdtest()
250 err |= comedi_check_trigger_src(&cmd->convert_src, waveform_ai_cmdtest()
252 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); waveform_ai_cmdtest()
253 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); waveform_ai_cmdtest()
260 err |= comedi_check_trigger_is_unique(cmd->convert_src); waveform_ai_cmdtest()
261 err |= comedi_check_trigger_is_unique(cmd->stop_src); waveform_ai_cmdtest()
265 if (cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_NOW) waveform_ai_cmdtest()
273 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); waveform_ai_cmdtest()
275 if (cmd->convert_src == TRIG_NOW) { waveform_ai_cmdtest()
276 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); waveform_ai_cmdtest()
277 } else { /* cmd->convert_src == TRIG_TIMER */ waveform_ai_cmdtest()
278 if (cmd->scan_begin_src == TRIG_FOLLOW) { waveform_ai_cmdtest()
279 err |= comedi_check_trigger_arg_min(&cmd->convert_arg, waveform_ai_cmdtest()
284 if (cmd->scan_begin_src == TRIG_FOLLOW) { waveform_ai_cmdtest()
285 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); waveform_ai_cmdtest()
286 } else { /* cmd->scan_begin_src == TRIG_TIMER */ waveform_ai_cmdtest()
287 err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, waveform_ai_cmdtest()
291 err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); waveform_ai_cmdtest()
292 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, waveform_ai_cmdtest()
293 cmd->chanlist_len); waveform_ai_cmdtest()
295 if (cmd->stop_src == TRIG_COUNT) waveform_ai_cmdtest()
296 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); waveform_ai_cmdtest()
297 else /* cmd->stop_src == TRIG_NONE */ waveform_ai_cmdtest()
298 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); waveform_ai_cmdtest()
305 if (cmd->convert_src == TRIG_TIMER) { waveform_ai_cmdtest()
307 arg = cmd->convert_arg; waveform_ai_cmdtest()
311 if (cmd->scan_begin_arg == TRIG_TIMER) { waveform_ai_cmdtest()
313 limit = UINT_MAX / cmd->scan_end_arg; waveform_ai_cmdtest()
317 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); waveform_ai_cmdtest()
320 if (cmd->scan_begin_src == TRIG_TIMER) { waveform_ai_cmdtest()
322 arg = cmd->scan_begin_arg; waveform_ai_cmdtest()
326 if (cmd->convert_src == TRIG_TIMER) { waveform_ai_cmdtest()
328 arg = max(arg, cmd->convert_arg * cmd->scan_end_arg); waveform_ai_cmdtest()
330 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); waveform_ai_cmdtest()
343 struct comedi_cmd *cmd = &s->async->cmd; waveform_ai_cmd() local
347 if (cmd->flags & CMDF_PRIORITY) { waveform_ai_cmd()
353 if (cmd->convert_src == TRIG_NOW) waveform_ai_cmd()
355 else /* cmd->convert_src == TRIG_TIMER */ waveform_ai_cmd()
356 devpriv->ai_convert_period = cmd->convert_arg / NSEC_PER_USEC; waveform_ai_cmd()
358 if (cmd->scan_begin_src == TRIG_FOLLOW) { waveform_ai_cmd()
360 cmd->scan_end_arg; waveform_ai_cmd()
361 } else { /* cmd->scan_begin_src == TRIG_TIMER */ waveform_ai_cmd()
362 devpriv->ai_scan_period = cmd->scan_begin_arg / NSEC_PER_USEC; waveform_ai_cmd()
373 if (cmd->scan_begin_src == TRIG_TIMER) waveform_ai_cmd()
434 struct comedi_cmd *cmd = &async->cmd; waveform_ao_timer() local
460 comedi_samples_to_bytes(s, cmd->scan_end_arg * waveform_ao_timer()
472 for (i = 0; i < cmd->scan_end_arg; i++) { waveform_ao_timer()
473 unsigned int chan = CR_CHAN(cmd->chanlist[i]); waveform_ao_timer()
489 if (cmd->stop_src == TRIG_COUNT && async->scans_done >= cmd->stop_arg) { waveform_ao_timer()
511 struct comedi_cmd *cmd = &async->cmd; waveform_ao_inttrig_start() local
513 if (trig_num != cmd->start_arg) waveform_ao_inttrig_start()
533 struct comedi_cmd *cmd) waveform_ao_cmdtest()
540 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_INT); waveform_ao_cmdtest()
541 err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); waveform_ao_cmdtest()
542 err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); waveform_ao_cmdtest()
543 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); waveform_ao_cmdtest()
544 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); waveform_ao_cmdtest()
551 err |= comedi_check_trigger_is_unique(cmd->stop_src); waveform_ao_cmdtest()
560 err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, waveform_ao_cmdtest()
562 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); waveform_ao_cmdtest()
563 err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); waveform_ao_cmdtest()
564 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, waveform_ao_cmdtest()
565 cmd->chanlist_len); waveform_ao_cmdtest()
566 if (cmd->stop_src == TRIG_COUNT) waveform_ao_cmdtest()
567 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); waveform_ao_cmdtest()
568 else /* cmd->stop_src == TRIG_NONE */ waveform_ao_cmdtest()
569 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); waveform_ao_cmdtest()
577 arg = cmd->scan_begin_arg; waveform_ao_cmdtest()
580 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); waveform_ao_cmdtest()
592 struct comedi_cmd *cmd = &s->async->cmd; waveform_ao_cmd() local
594 if (cmd->flags & CMDF_PRIORITY) { waveform_ao_cmd()
600 devpriv->ao_scan_period = cmd->scan_begin_arg / NSEC_PER_USEC; waveform_ao_cmd()
238 waveform_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) waveform_ai_cmdtest() argument
531 waveform_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) waveform_ao_cmdtest() argument
H A Dni_tiocmd.c91 struct comedi_cmd *cmd = &s->async->cmd; ni_tio_input_inttrig() local
95 if (trig_num != cmd->start_arg) ni_tio_input_inttrig()
118 struct comedi_cmd *cmd = &async->cmd; ni_tio_input_cmd() local
139 if (cmd->start_src == TRIG_INT) { ni_tio_input_cmd()
145 if (cmd->start_src == TRIG_NOW) ni_tio_input_cmd()
147 else if (cmd->start_src == TRIG_EXT) ni_tio_input_cmd()
148 ret = ni_tio_arm(counter, 1, cmd->start_arg); ni_tio_input_cmd()
164 struct comedi_cmd *cmd = &s->async->cmd; ni_tio_cmd_setup() local
171 if (cmd->scan_begin_src == TRIG_EXT) { ni_tio_cmd_setup()
173 gate_source = cmd->scan_begin_arg; ni_tio_cmd_setup()
174 } else if (cmd->convert_src == TRIG_EXT) { ni_tio_cmd_setup()
176 gate_source = cmd->convert_arg; ni_tio_cmd_setup()
180 if (cmd->flags & CMDF_WAKE_EOS) { ni_tio_cmd_setup()
192 struct comedi_cmd *cmd = &async->cmd; ni_tio_cmd() local
206 if (cmd->flags & CMDF_WRITE) ni_tio_cmd()
219 struct comedi_cmd *cmd) ni_tio_cmdtest()
230 err |= comedi_check_trigger_src(&cmd->start_src, sources); ni_tio_cmdtest()
232 err |= comedi_check_trigger_src(&cmd->scan_begin_src, ni_tio_cmdtest()
234 err |= comedi_check_trigger_src(&cmd->convert_src, ni_tio_cmdtest()
236 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); ni_tio_cmdtest()
237 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_NONE); ni_tio_cmdtest()
244 err |= comedi_check_trigger_is_unique(cmd->start_src); ni_tio_cmdtest()
245 err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); ni_tio_cmdtest()
246 err |= comedi_check_trigger_is_unique(cmd->convert_src); ni_tio_cmdtest()
250 if (cmd->convert_src != TRIG_NOW && cmd->scan_begin_src != TRIG_FOLLOW) ni_tio_cmdtest()
258 switch (cmd->start_src) { ni_tio_cmdtest()
262 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); ni_tio_cmdtest()
269 if (cmd->scan_begin_src != TRIG_EXT) ni_tio_cmdtest()
270 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); ni_tio_cmdtest()
272 if (cmd->convert_src != TRIG_EXT) ni_tio_cmdtest()
273 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); ni_tio_cmdtest()
275 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, ni_tio_cmdtest()
276 cmd->chanlist_len); ni_tio_cmdtest()
277 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); ni_tio_cmdtest()
217 ni_tio_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) ni_tio_cmdtest() argument
H A Dni_labpc_common.c279 static bool labpc_use_continuous_mode(const struct comedi_cmd *cmd, labpc_use_continuous_mode() argument
282 if (mode == MODE_SINGLE_CHAN || cmd->scan_begin_src == TRIG_FOLLOW) labpc_use_continuous_mode()
288 static unsigned int labpc_ai_convert_period(const struct comedi_cmd *cmd, labpc_ai_convert_period() argument
291 if (cmd->convert_src != TRIG_TIMER) labpc_ai_convert_period()
294 if (mode == MODE_SINGLE_CHAN && cmd->scan_begin_src == TRIG_TIMER) labpc_ai_convert_period()
295 return cmd->scan_begin_arg; labpc_ai_convert_period()
297 return cmd->convert_arg; labpc_ai_convert_period()
300 static void labpc_set_ai_convert_period(struct comedi_cmd *cmd, labpc_set_ai_convert_period() argument
303 if (cmd->convert_src != TRIG_TIMER) labpc_set_ai_convert_period()
307 cmd->scan_begin_src == TRIG_TIMER) { labpc_set_ai_convert_period()
308 cmd->scan_begin_arg = ns; labpc_set_ai_convert_period()
309 if (cmd->convert_arg > cmd->scan_begin_arg) labpc_set_ai_convert_period()
310 cmd->convert_arg = cmd->scan_begin_arg; labpc_set_ai_convert_period()
312 cmd->convert_arg = ns; labpc_set_ai_convert_period()
316 static unsigned int labpc_ai_scan_period(const struct comedi_cmd *cmd, labpc_ai_scan_period() argument
319 if (cmd->scan_begin_src != TRIG_TIMER) labpc_ai_scan_period()
322 if (mode == MODE_SINGLE_CHAN && cmd->convert_src == TRIG_TIMER) labpc_ai_scan_period()
325 return cmd->scan_begin_arg; labpc_ai_scan_period()
328 static void labpc_set_ai_scan_period(struct comedi_cmd *cmd, labpc_set_ai_scan_period() argument
331 if (cmd->scan_begin_src != TRIG_TIMER) labpc_set_ai_scan_period()
334 if (mode == MODE_SINGLE_CHAN && cmd->convert_src == TRIG_TIMER) labpc_set_ai_scan_period()
337 cmd->scan_begin_arg = ns; labpc_set_ai_scan_period()
341 static void labpc_adc_timing(struct comedi_device *dev, struct comedi_cmd *cmd, labpc_adc_timing() argument
345 unsigned int convert_period = labpc_ai_convert_period(cmd, mode); labpc_adc_timing()
346 unsigned int scan_period = labpc_ai_scan_period(cmd, mode); labpc_adc_timing()
369 switch (cmd->flags & CMDF_ROUND_MASK) { labpc_adc_timing()
396 labpc_set_ai_convert_period(cmd, mode, labpc_adc_timing()
398 labpc_set_ai_scan_period(cmd, mode, labpc_adc_timing()
407 cmd->flags); labpc_adc_timing()
408 labpc_set_ai_scan_period(cmd, mode, scan_period); labpc_adc_timing()
416 cmd->flags); labpc_adc_timing()
419 labpc_set_ai_convert_period(cmd, mode, convert_period); labpc_adc_timing()
423 static enum scan_mode labpc_ai_scan_mode(const struct comedi_cmd *cmd) labpc_ai_scan_mode() argument
428 if (cmd->chanlist_len == 1) labpc_ai_scan_mode()
432 if (!cmd->chanlist) labpc_ai_scan_mode()
435 chan0 = CR_CHAN(cmd->chanlist[0]); labpc_ai_scan_mode()
436 chan1 = CR_CHAN(cmd->chanlist[1]); labpc_ai_scan_mode()
449 struct comedi_cmd *cmd) labpc_ai_check_chanlist()
451 enum scan_mode mode = labpc_ai_scan_mode(cmd); labpc_ai_check_chanlist()
452 unsigned int chan0 = CR_CHAN(cmd->chanlist[0]); labpc_ai_check_chanlist()
453 unsigned int range0 = CR_RANGE(cmd->chanlist[0]); labpc_ai_check_chanlist()
454 unsigned int aref0 = CR_AREF(cmd->chanlist[0]); labpc_ai_check_chanlist()
457 for (i = 0; i < cmd->chanlist_len; i++) { labpc_ai_check_chanlist()
458 unsigned int chan = CR_CHAN(cmd->chanlist[i]); labpc_ai_check_chanlist()
459 unsigned int range = CR_RANGE(cmd->chanlist[i]); labpc_ai_check_chanlist()
460 unsigned int aref = CR_AREF(cmd->chanlist[i]); labpc_ai_check_chanlist()
480 if (chan != (cmd->chanlist_len - i - 1)) { labpc_ai_check_chanlist()
505 struct comedi_subdevice *s, struct comedi_cmd *cmd) labpc_ai_cmdtest()
515 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); labpc_ai_cmdtest()
516 err |= comedi_check_trigger_src(&cmd->scan_begin_src, labpc_ai_cmdtest()
518 err |= comedi_check_trigger_src(&cmd->convert_src, labpc_ai_cmdtest()
520 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); labpc_ai_cmdtest()
525 err |= comedi_check_trigger_src(&cmd->stop_src, stop_mask); labpc_ai_cmdtest()
532 err |= comedi_check_trigger_is_unique(cmd->start_src); labpc_ai_cmdtest()
533 err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); labpc_ai_cmdtest()
534 err |= comedi_check_trigger_is_unique(cmd->convert_src); labpc_ai_cmdtest()
535 err |= comedi_check_trigger_is_unique(cmd->stop_src); labpc_ai_cmdtest()
540 if (cmd->start_src == TRIG_EXT && cmd->stop_src == TRIG_EXT) labpc_ai_cmdtest()
548 switch (cmd->start_src) { labpc_ai_cmdtest()
550 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); labpc_ai_cmdtest()
557 if (!cmd->chanlist_len) labpc_ai_cmdtest()
559 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, labpc_ai_cmdtest()
560 cmd->chanlist_len); labpc_ai_cmdtest()
562 if (cmd->convert_src == TRIG_TIMER) { labpc_ai_cmdtest()
563 err |= comedi_check_trigger_arg_min(&cmd->convert_arg, labpc_ai_cmdtest()
568 if (cmd->scan_begin_src == TRIG_TIMER) { labpc_ai_cmdtest()
569 if (cmd->convert_src == TRIG_TIMER) { labpc_ai_cmdtest()
570 err |= comedi_check_trigger_arg_min(&cmd-> labpc_ai_cmdtest()
572 cmd->convert_arg * labpc_ai_cmdtest()
573 cmd->chanlist_len); labpc_ai_cmdtest()
575 err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, labpc_ai_cmdtest()
577 cmd->chanlist_len); labpc_ai_cmdtest()
580 switch (cmd->stop_src) { labpc_ai_cmdtest()
582 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); labpc_ai_cmdtest()
585 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); labpc_ai_cmdtest()
600 tmp = cmd->convert_arg; labpc_ai_cmdtest()
601 tmp2 = cmd->scan_begin_arg; labpc_ai_cmdtest()
602 mode = labpc_ai_scan_mode(cmd); labpc_ai_cmdtest()
603 labpc_adc_timing(dev, cmd, mode); labpc_ai_cmdtest()
604 if (tmp != cmd->convert_arg || tmp2 != cmd->scan_begin_arg) labpc_ai_cmdtest()
611 if (cmd->chanlist && cmd->chanlist_len > 0) labpc_ai_cmdtest()
612 err |= labpc_ai_check_chanlist(dev, s, cmd); labpc_ai_cmdtest()
625 struct comedi_cmd *cmd = &async->cmd; labpc_ai_cmd() local
626 enum scan_mode mode = labpc_ai_scan_mode(cmd); labpc_ai_cmd()
628 cmd->chanlist[cmd->chanlist_len - 1] : labpc_ai_cmd()
629 cmd->chanlist[0]; labpc_ai_cmd()
640 if (cmd->stop_src == TRIG_COUNT) labpc_ai_cmd()
641 devpriv->count = cmd->stop_arg * cmd->chanlist_len; labpc_ai_cmd()
644 if (cmd->stop_src == TRIG_EXT) { labpc_ai_cmd()
661 (cmd->flags & (CMDF_WAKE_EOS | CMDF_PRIORITY)) == 0) labpc_ai_cmd()
666 (cmd->flags & CMDF_WAKE_EOS) == 0 && labpc_ai_cmd()
668 (cmd->stop_src != TRIG_COUNT || devpriv->count > 256)) labpc_ai_cmd()
677 (cmd->stop_src == TRIG_EXT)); labpc_ai_cmd()
689 devpriv->write_byte(dev, cmd->chanlist_len, INTERVAL_COUNT_REG); labpc_ai_cmd()
693 if (cmd->convert_src == TRIG_TIMER || labpc_ai_cmd()
694 cmd->scan_begin_src == TRIG_TIMER) { labpc_ai_cmd()
706 if (labpc_ai_convert_period(cmd, mode)) labpc_ai_cmd()
710 if (labpc_ai_scan_period(cmd, mode)) labpc_ai_cmd()
729 if (cmd->convert_src != TRIG_EXT) labpc_ai_cmd()
733 if (!labpc_use_continuous_mode(cmd, mode)) { labpc_ai_cmd()
735 if (cmd->scan_begin_src == TRIG_EXT) labpc_ai_cmd()
751 if (cmd->start_src == TRIG_EXT) labpc_ai_cmd()
755 if (cmd->stop_src == TRIG_EXT) labpc_ai_cmd()
770 struct comedi_cmd *cmd = &async->cmd; labpc_drain_fifo() local
780 if (cmd->stop_src == TRIG_COUNT) { labpc_drain_fifo()
818 struct comedi_cmd *cmd; labpc_interrupt() local
826 cmd = &async->cmd; labpc_interrupt()
869 if (cmd->stop_src == TRIG_EXT) { labpc_interrupt()
877 if (cmd->stop_src == TRIG_COUNT) { labpc_interrupt()
447 labpc_ai_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) labpc_ai_check_chanlist() argument
504 labpc_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) labpc_ai_cmdtest() argument
H A Dadl_pci9118.c21 * AI subdevice supports cmd and insn interface,
24 * - If cmd->scan_begin_src=TRIG_EXT then trigger input is TGIN (pin 46).
25 * - If cmd->convert_src=TRIG_EXT then trigger input is EXTTRG (pin 44).
26 * - If cmd->start_src/stop_src=TRIG_EXT then trigger input is TGIN (pin 46).
27 * - It is not necessary to have cmd.scan_end_arg=cmd.chanlist_len but
28 * cmd.scan_end_arg modulo cmd.chanlist_len must by 0.
37 * so there is some problems if cmd->chanlist_len is odd. This driver tries
39 * it on output but this can't be used if cmd->scan_begin_src=TRIG_FOLLOW
43 * cmd->scan_begin_src=TRIG_FOLLOW.
288 struct comedi_cmd *cmd) pci9118_ai_check_chanlist()
291 unsigned int range0 = CR_RANGE(cmd->chanlist[0]); pci9118_ai_check_chanlist()
292 unsigned int aref0 = CR_AREF(cmd->chanlist[0]); pci9118_ai_check_chanlist()
296 if (cmd->chanlist_len == 1) pci9118_ai_check_chanlist()
299 for (i = 1; i < cmd->chanlist_len; i++) { pci9118_ai_check_chanlist()
300 unsigned int chan = CR_CHAN(cmd->chanlist[i]); pci9118_ai_check_chanlist()
301 unsigned int range = CR_RANGE(cmd->chanlist[i]); pci9118_ai_check_chanlist()
302 unsigned int aref = CR_AREF(cmd->chanlist[i]); pci9118_ai_check_chanlist()
409 struct comedi_cmd *cmd = &s->async->cmd; pci9118_ai_samples_ready() local
411 unsigned int stop_pos = start_pos + cmd->chanlist_len; pci9118_ai_samples_ready()
416 if (span_len == cmd->chanlist_len) pci9118_ai_samples_ready()
427 n_samples = whole_spans * cmd->chanlist_len; pci9118_ai_samples_ready()
466 struct comedi_cmd *cmd = &s->async->cmd; pci9118_ai_dma_xfer() local
468 unsigned int stop_pos = start_pos + cmd->chanlist_len; pci9118_ai_dma_xfer()
473 if (span_len == cmd->chanlist_len) { pci9118_ai_dma_xfer()
536 struct comedi_cmd *cmd = &s->async->cmd; pci9118_calc_divisors() local
546 if (cmd->convert_src == TRIG_NOW && !chnsshfront) { pci9118_calc_divisors()
621 struct comedi_cmd *cmd = &s->async->cmd; pci9118_ai_get_onesample() local
629 if (s->async->scans_done >= cmd->stop_arg) pci9118_ai_get_onesample()
638 struct comedi_cmd *cmd = &s->async->cmd; pci9118_ai_get_dma() local
660 if (s->async->scans_done >= cmd->stop_arg) pci9118_ai_get_dma()
786 struct comedi_cmd *cmd = &s->async->cmd; pci9118_ai_inttrig() local
788 if (trig_num != cmd->start_arg) pci9118_ai_inttrig()
801 struct comedi_cmd *cmd = &s->async->cmd; pci9118_ai_setup_dma() local
880 cmd->stop_arg; pci9118_ai_setup_dma()
919 struct comedi_cmd *cmd = &s->async->cmd; pci9118_ai_cmd() local
924 devpriv->ai_flags = cmd->flags; pci9118_ai_cmd()
929 if (cmd->start_src == TRIG_EXT) pci9118_ai_cmd()
931 if (cmd->stop_src == TRIG_EXT) { pci9118_ai_cmd()
935 if (cmd->stop_src == TRIG_NONE) pci9118_ai_cmd()
937 if (cmd->stop_src == TRIG_COUNT) pci9118_ai_cmd()
948 if ((cmd->flags & CMDF_WAKE_EOS) && pci9118_ai_cmd()
949 (cmd->scan_end_arg == 1)) { pci9118_ai_cmd()
950 if (cmd->convert_src == TRIG_NOW) pci9118_ai_cmd()
952 if (cmd->convert_src == TRIG_TIMER) { pci9118_ai_cmd()
960 if ((cmd->flags & CMDF_WAKE_EOS) && pci9118_ai_cmd()
961 (cmd->scan_end_arg & 1) && pci9118_ai_cmd()
962 (cmd->scan_end_arg > 1)) { pci9118_ai_cmd()
963 if (cmd->scan_begin_src == TRIG_FOLLOW) { pci9118_ai_cmd()
983 if (cmd->convert_src == TRIG_NOW && devpriv->softsshdelay) { pci9118_ai_cmd()
990 if (cmd->convert_arg < devpriv->ai_ns_min) pci9118_ai_cmd()
991 cmd->convert_arg = devpriv->ai_ns_min; pci9118_ai_cmd()
992 addchans = devpriv->softsshdelay / cmd->convert_arg; pci9118_ai_cmd()
993 if (devpriv->softsshdelay % cmd->convert_arg) pci9118_ai_cmd()
1000 cmd->chanlist_len + pci9118_ai_cmd()
1007 scanlen = devpriv->ai_add_front + cmd->chanlist_len + pci9118_ai_cmd()
1010 * what we must take from card in real to have cmd->scan_end_arg pci9118_ai_cmd()
1014 (cmd->scan_end_arg / cmd->chanlist_len); pci9118_ai_cmd()
1026 pci9118_set_chanlist(dev, s, cmd->chanlist_len, cmd->chanlist, pci9118_ai_cmd()
1031 if (cmd->scan_begin_src != TRIG_TIMER && pci9118_ai_cmd()
1032 cmd->convert_src == TRIG_TIMER) { pci9118_ai_cmd()
1034 if (cmd->scan_begin_src == TRIG_EXT) pci9118_ai_cmd()
1039 comedi_8254_cascade_ns_to_timer(pacer, &cmd->convert_arg, pci9118_ai_cmd()
1051 if (cmd->scan_begin_src == TRIG_EXT) { pci9118_ai_cmd()
1062 if (cmd->scan_begin_src == TRIG_TIMER && pci9118_ai_cmd()
1063 cmd->convert_src != TRIG_EXT) { pci9118_ai_cmd()
1066 "cmd->scan_begin_src=TRIG_TIMER works only with bus mastering!\n"); pci9118_ai_cmd()
1074 &cmd->scan_begin_arg, &cmd->convert_arg, pci9118_ai_cmd()
1083 if (cmd->convert_src == TRIG_NOW && !devpriv->softsshdelay) pci9118_ai_cmd()
1089 if (cmd->scan_begin_src == TRIG_FOLLOW && pci9118_ai_cmd()
1090 cmd->convert_src == TRIG_EXT) { pci9118_ai_cmd()
1128 if (cmd->start_src == TRIG_NOW) pci9118_ai_cmd()
1130 else if (cmd->start_src == TRIG_INT) pci9118_ai_cmd()
1134 if (cmd->start_src == TRIG_EXT || cmd->stop_src == TRIG_EXT) pci9118_ai_cmd()
1142 struct comedi_cmd *cmd) pci9118_ai_cmdtest()
1151 err |= comedi_check_trigger_src(&cmd->start_src, pci9118_ai_cmdtest()
1157 err |= comedi_check_trigger_src(&cmd->scan_begin_src, flags); pci9118_ai_cmdtest()
1162 err |= comedi_check_trigger_src(&cmd->convert_src, flags); pci9118_ai_cmdtest()
1164 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); pci9118_ai_cmdtest()
1165 err |= comedi_check_trigger_src(&cmd->stop_src, pci9118_ai_cmdtest()
1173 err |= comedi_check_trigger_is_unique(cmd->start_src); pci9118_ai_cmdtest()
1174 err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); pci9118_ai_cmdtest()
1175 err |= comedi_check_trigger_is_unique(cmd->convert_src); pci9118_ai_cmdtest()
1176 err |= comedi_check_trigger_is_unique(cmd->stop_src); pci9118_ai_cmdtest()
1180 if (cmd->start_src == TRIG_EXT && cmd->scan_begin_src == TRIG_EXT) pci9118_ai_cmdtest()
1183 if ((cmd->scan_begin_src & (TRIG_TIMER | TRIG_EXT)) && pci9118_ai_cmdtest()
1184 (!(cmd->convert_src & (TRIG_TIMER | TRIG_NOW)))) pci9118_ai_cmdtest()
1187 if ((cmd->scan_begin_src == TRIG_FOLLOW) && pci9118_ai_cmdtest()
1188 (!(cmd->convert_src & (TRIG_TIMER | TRIG_EXT)))) pci9118_ai_cmdtest()
1191 if (cmd->stop_src == TRIG_EXT && cmd->scan_begin_src == TRIG_EXT) pci9118_ai_cmdtest()
1199 switch (cmd->start_src) { pci9118_ai_cmdtest()
1202 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); pci9118_ai_cmdtest()
1209 if (cmd->scan_begin_src & (TRIG_FOLLOW | TRIG_EXT)) pci9118_ai_cmdtest()
1210 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); pci9118_ai_cmdtest()
1212 if ((cmd->scan_begin_src == TRIG_TIMER) && pci9118_ai_cmdtest()
1213 (cmd->convert_src == TRIG_TIMER) && (cmd->scan_end_arg == 1)) { pci9118_ai_cmdtest()
1214 cmd->scan_begin_src = TRIG_FOLLOW; pci9118_ai_cmdtest()
1215 cmd->convert_arg = cmd->scan_begin_arg; pci9118_ai_cmdtest()
1216 cmd->scan_begin_arg = 0; pci9118_ai_cmdtest()
1219 if (cmd->scan_begin_src == TRIG_TIMER) { pci9118_ai_cmdtest()
1220 err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, pci9118_ai_cmdtest()
1224 if (cmd->scan_begin_src == TRIG_EXT) { pci9118_ai_cmdtest()
1225 if (cmd->scan_begin_arg) { pci9118_ai_cmdtest()
1226 cmd->scan_begin_arg = 0; pci9118_ai_cmdtest()
1228 err |= comedi_check_trigger_arg_max(&cmd->scan_end_arg, pci9118_ai_cmdtest()
1233 if (cmd->convert_src & (TRIG_TIMER | TRIG_NOW)) { pci9118_ai_cmdtest()
1234 err |= comedi_check_trigger_arg_min(&cmd->convert_arg, pci9118_ai_cmdtest()
1238 if (cmd->convert_src == TRIG_EXT) pci9118_ai_cmdtest()
1239 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); pci9118_ai_cmdtest()
1241 if (cmd->stop_src == TRIG_COUNT) pci9118_ai_cmdtest()
1242 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); pci9118_ai_cmdtest()
1244 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); pci9118_ai_cmdtest()
1246 err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); pci9118_ai_cmdtest()
1248 err |= comedi_check_trigger_arg_min(&cmd->scan_end_arg, pci9118_ai_cmdtest()
1249 cmd->chanlist_len); pci9118_ai_cmdtest()
1251 if ((cmd->scan_end_arg % cmd->chanlist_len)) { pci9118_ai_cmdtest()
1252 cmd->scan_end_arg = pci9118_ai_cmdtest()
1253 cmd->chanlist_len * (cmd->scan_end_arg / cmd->chanlist_len); pci9118_ai_cmdtest()
1262 if (cmd->scan_begin_src == TRIG_TIMER) { pci9118_ai_cmdtest()
1263 arg = cmd->scan_begin_arg; pci9118_ai_cmdtest()
1264 comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); pci9118_ai_cmdtest()
1265 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); pci9118_ai_cmdtest()
1268 if (cmd->convert_src & (TRIG_TIMER | TRIG_NOW)) { pci9118_ai_cmdtest()
1269 arg = cmd->convert_arg; pci9118_ai_cmdtest()
1270 comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); pci9118_ai_cmdtest()
1271 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); pci9118_ai_cmdtest()
1273 if (cmd->scan_begin_src == TRIG_TIMER && pci9118_ai_cmdtest()
1274 cmd->convert_src == TRIG_NOW) { pci9118_ai_cmdtest()
1275 if (cmd->convert_arg == 0) { pci9118_ai_cmdtest()
1277 (cmd->scan_end_arg + 2); pci9118_ai_cmdtest()
1279 arg = cmd->convert_arg * cmd->chanlist_len; pci9118_ai_cmdtest()
1281 err |= comedi_check_trigger_arg_min(&cmd-> pci9118_ai_cmdtest()
1292 if (cmd->chanlist) pci9118_ai_cmdtest()
1293 err |= pci9118_ai_check_chanlist(dev, s, cmd); pci9118_ai_cmdtest()
286 pci9118_ai_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) pci9118_ai_check_chanlist() argument
1140 pci9118_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) pci9118_ai_cmdtest() argument
H A Dme4000.c545 struct comedi_cmd *cmd) me4000_ai_check_chanlist()
547 unsigned int aref0 = CR_AREF(cmd->chanlist[0]); me4000_ai_check_chanlist()
550 for (i = 0; i < cmd->chanlist_len; i++) { me4000_ai_check_chanlist()
551 unsigned int chan = CR_CHAN(cmd->chanlist[i]); me4000_ai_check_chanlist()
552 unsigned int range = CR_RANGE(cmd->chanlist[i]); me4000_ai_check_chanlist()
553 unsigned int aref = CR_AREF(cmd->chanlist[i]); me4000_ai_check_chanlist()
587 struct comedi_cmd *cmd) me4000_ai_round_cmd_args()
596 if (cmd->start_arg) { me4000_ai_round_cmd_args()
597 devpriv->ai_init_ticks = (cmd->start_arg * 33) / 1000; me4000_ai_round_cmd_args()
598 rest = (cmd->start_arg * 33) % 1000; me4000_ai_round_cmd_args()
600 if ((cmd->flags & CMDF_ROUND_MASK) == CMDF_ROUND_NEAREST) { me4000_ai_round_cmd_args()
603 } else if ((cmd->flags & CMDF_ROUND_MASK) == CMDF_ROUND_UP) { me4000_ai_round_cmd_args()
609 if (cmd->scan_begin_arg) { me4000_ai_round_cmd_args()
610 devpriv->ai_scan_ticks = (cmd->scan_begin_arg * 33) / 1000; me4000_ai_round_cmd_args()
611 rest = (cmd->scan_begin_arg * 33) % 1000; me4000_ai_round_cmd_args()
613 if ((cmd->flags & CMDF_ROUND_MASK) == CMDF_ROUND_NEAREST) { me4000_ai_round_cmd_args()
616 } else if ((cmd->flags & CMDF_ROUND_MASK) == CMDF_ROUND_UP) { me4000_ai_round_cmd_args()
622 if (cmd->convert_arg) { me4000_ai_round_cmd_args()
623 devpriv->ai_chan_ticks = (cmd->convert_arg * 33) / 1000; me4000_ai_round_cmd_args()
624 rest = (cmd->convert_arg * 33) % 1000; me4000_ai_round_cmd_args()
626 if ((cmd->flags & CMDF_ROUND_MASK) == CMDF_ROUND_NEAREST) { me4000_ai_round_cmd_args()
629 } else if ((cmd->flags & CMDF_ROUND_MASK) == CMDF_ROUND_UP) { me4000_ai_round_cmd_args()
638 struct comedi_cmd *cmd) me4000_ai_write_chanlist()
642 for (i = 0; i < cmd->chanlist_len; i++) { me4000_ai_write_chanlist()
643 unsigned int chan = CR_CHAN(cmd->chanlist[i]); me4000_ai_write_chanlist()
644 unsigned int range = CR_RANGE(cmd->chanlist[i]); me4000_ai_write_chanlist()
645 unsigned int aref = CR_AREF(cmd->chanlist[i]); me4000_ai_write_chanlist()
653 if (i == (cmd->chanlist_len - 1)) me4000_ai_write_chanlist()
664 struct comedi_cmd *cmd = &s->async->cmd; me4000_ai_do_cmd() local
689 if (cmd->stop_src == TRIG_COUNT) { me4000_ai_do_cmd()
690 outl(cmd->chanlist_len * cmd->stop_arg, me4000_ai_do_cmd()
693 } else if (cmd->stop_src == TRIG_NONE && me4000_ai_do_cmd()
694 cmd->scan_end_src == TRIG_COUNT) { me4000_ai_do_cmd()
695 outl(cmd->scan_end_arg, me4000_ai_do_cmd()
705 me4000_ai_write_chanlist(dev, s, cmd); me4000_ai_do_cmd()
715 struct comedi_cmd *cmd) me4000_ai_do_cmd_test()
722 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); me4000_ai_do_cmd_test()
723 err |= comedi_check_trigger_src(&cmd->scan_begin_src, me4000_ai_do_cmd_test()
725 err |= comedi_check_trigger_src(&cmd->convert_src, me4000_ai_do_cmd_test()
727 err |= comedi_check_trigger_src(&cmd->scan_end_src, me4000_ai_do_cmd_test()
729 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_NONE | TRIG_COUNT); me4000_ai_do_cmd_test()
736 err |= comedi_check_trigger_is_unique(cmd->start_src); me4000_ai_do_cmd_test()
737 err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); me4000_ai_do_cmd_test()
738 err |= comedi_check_trigger_is_unique(cmd->convert_src); me4000_ai_do_cmd_test()
739 err |= comedi_check_trigger_is_unique(cmd->scan_end_src); me4000_ai_do_cmd_test()
740 err |= comedi_check_trigger_is_unique(cmd->stop_src); me4000_ai_do_cmd_test()
744 if (cmd->start_src == TRIG_NOW && me4000_ai_do_cmd_test()
745 cmd->scan_begin_src == TRIG_TIMER && me4000_ai_do_cmd_test()
746 cmd->convert_src == TRIG_TIMER) { me4000_ai_do_cmd_test()
748 } else if (cmd->start_src == TRIG_NOW && me4000_ai_do_cmd_test()
749 cmd->scan_begin_src == TRIG_FOLLOW && me4000_ai_do_cmd_test()
750 cmd->convert_src == TRIG_TIMER) { me4000_ai_do_cmd_test()
752 } else if (cmd->start_src == TRIG_EXT && me4000_ai_do_cmd_test()
753 cmd->scan_begin_src == TRIG_TIMER && me4000_ai_do_cmd_test()
754 cmd->convert_src == TRIG_TIMER) { me4000_ai_do_cmd_test()
756 } else if (cmd->start_src == TRIG_EXT && me4000_ai_do_cmd_test()
757 cmd->scan_begin_src == TRIG_FOLLOW && me4000_ai_do_cmd_test()
758 cmd->convert_src == TRIG_TIMER) { me4000_ai_do_cmd_test()
760 } else if (cmd->start_src == TRIG_EXT && me4000_ai_do_cmd_test()
761 cmd->scan_begin_src == TRIG_EXT && me4000_ai_do_cmd_test()
762 cmd->convert_src == TRIG_TIMER) { me4000_ai_do_cmd_test()
764 } else if (cmd->start_src == TRIG_EXT && me4000_ai_do_cmd_test()
765 cmd->scan_begin_src == TRIG_EXT && me4000_ai_do_cmd_test()
766 cmd->convert_src == TRIG_EXT) { me4000_ai_do_cmd_test()
778 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); me4000_ai_do_cmd_test()
780 if (cmd->chanlist_len < 1) { me4000_ai_do_cmd_test()
781 cmd->chanlist_len = 1; me4000_ai_do_cmd_test()
786 me4000_ai_round_cmd_args(dev, s, cmd); me4000_ai_do_cmd_test()
789 cmd->start_arg = 2000; me4000_ai_do_cmd_test()
793 cmd->scan_begin_arg = 2031; me4000_ai_do_cmd_test()
797 cmd->convert_arg = 2000; me4000_ai_do_cmd_test()
801 if (cmd->stop_src == TRIG_COUNT) me4000_ai_do_cmd_test()
802 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); me4000_ai_do_cmd_test()
804 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); me4000_ai_do_cmd_test()
812 if (cmd->start_src == TRIG_NOW && me4000_ai_do_cmd_test()
813 cmd->scan_begin_src == TRIG_TIMER && me4000_ai_do_cmd_test()
814 cmd->convert_src == TRIG_TIMER) { me4000_ai_do_cmd_test()
818 cmd->start_arg = 2000; /* 66 ticks at least */ me4000_ai_do_cmd_test()
823 cmd->convert_arg = 2000; /* 66 ticks at least */ me4000_ai_do_cmd_test()
827 cmd->chanlist_len * devpriv->ai_chan_ticks) { me4000_ai_do_cmd_test()
831 cmd->scan_end_arg = 2000 * cmd->chanlist_len + 31; me4000_ai_do_cmd_test()
834 } else if (cmd->start_src == TRIG_NOW && me4000_ai_do_cmd_test()
835 cmd->scan_begin_src == TRIG_FOLLOW && me4000_ai_do_cmd_test()
836 cmd->convert_src == TRIG_TIMER) { me4000_ai_do_cmd_test()
840 cmd->start_arg = 2000; /* 66 ticks at least */ me4000_ai_do_cmd_test()
845 cmd->convert_arg = 2000; /* 66 ticks at least */ me4000_ai_do_cmd_test()
848 } else if (cmd->start_src == TRIG_EXT && me4000_ai_do_cmd_test()
849 cmd->scan_begin_src == TRIG_TIMER && me4000_ai_do_cmd_test()
850 cmd->convert_src == TRIG_TIMER) { me4000_ai_do_cmd_test()
854 cmd->start_arg = 2000; /* 66 ticks at least */ me4000_ai_do_cmd_test()
859 cmd->convert_arg = 2000; /* 66 ticks at least */ me4000_ai_do_cmd_test()
863 cmd->chanlist_len * devpriv->ai_chan_ticks) { me4000_ai_do_cmd_test()
867 cmd->scan_end_arg = 2000 * cmd->chanlist_len + 31; me4000_ai_do_cmd_test()
870 } else if (cmd->start_src == TRIG_EXT && me4000_ai_do_cmd_test()
871 cmd->scan_begin_src == TRIG_FOLLOW && me4000_ai_do_cmd_test()
872 cmd->convert_src == TRIG_TIMER) { me4000_ai_do_cmd_test()
876 cmd->start_arg = 2000; /* 66 ticks at least */ me4000_ai_do_cmd_test()
881 cmd->convert_arg = 2000; /* 66 ticks at least */ me4000_ai_do_cmd_test()
884 } else if (cmd->start_src == TRIG_EXT && me4000_ai_do_cmd_test()
885 cmd->scan_begin_src == TRIG_EXT && me4000_ai_do_cmd_test()
886 cmd->convert_src == TRIG_TIMER) { me4000_ai_do_cmd_test()
890 cmd->start_arg = 2000; /* 66 ticks at least */ me4000_ai_do_cmd_test()
895 cmd->convert_arg = 2000; /* 66 ticks at least */ me4000_ai_do_cmd_test()
898 } else if (cmd->start_src == TRIG_EXT && me4000_ai_do_cmd_test()
899 cmd->scan_begin_src == TRIG_EXT && me4000_ai_do_cmd_test()
900 cmd->convert_src == TRIG_EXT) { me4000_ai_do_cmd_test()
904 cmd->start_arg = 2000; /* 66 ticks at least */ me4000_ai_do_cmd_test()
908 if (cmd->scan_end_src == TRIG_COUNT) { me4000_ai_do_cmd_test()
909 if (cmd->scan_end_arg == 0) { me4000_ai_do_cmd_test()
911 cmd->scan_end_arg = 1; me4000_ai_do_cmd_test()
920 if (cmd->chanlist && cmd->chanlist_len > 0) me4000_ai_do_cmd_test()
921 err |= me4000_ai_check_chanlist(dev, s, cmd); me4000_ai_do_cmd_test()
543 me4000_ai_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) me4000_ai_check_chanlist() argument
585 me4000_ai_round_cmd_args(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) me4000_ai_round_cmd_args() argument
636 me4000_ai_write_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) me4000_ai_write_chanlist() argument
713 me4000_ai_do_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) me4000_ai_do_cmd_test() argument
H A Dcb_pcidas.c659 struct comedi_cmd *cmd) cb_pcidas_ai_check_chanlist()
661 unsigned int chan0 = CR_CHAN(cmd->chanlist[0]); cb_pcidas_ai_check_chanlist()
662 unsigned int range0 = CR_RANGE(cmd->chanlist[0]); cb_pcidas_ai_check_chanlist()
665 for (i = 1; i < cmd->chanlist_len; i++) { cb_pcidas_ai_check_chanlist()
666 unsigned int chan = CR_CHAN(cmd->chanlist[i]); cb_pcidas_ai_check_chanlist()
667 unsigned int range = CR_RANGE(cmd->chanlist[i]); cb_pcidas_ai_check_chanlist()
686 struct comedi_cmd *cmd) cb_pcidas_ai_cmdtest()
694 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); cb_pcidas_ai_cmdtest()
695 err |= comedi_check_trigger_src(&cmd->scan_begin_src, cb_pcidas_ai_cmdtest()
697 err |= comedi_check_trigger_src(&cmd->convert_src, cb_pcidas_ai_cmdtest()
699 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); cb_pcidas_ai_cmdtest()
700 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); cb_pcidas_ai_cmdtest()
707 err |= comedi_check_trigger_is_unique(cmd->start_src); cb_pcidas_ai_cmdtest()
708 err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); cb_pcidas_ai_cmdtest()
709 err |= comedi_check_trigger_is_unique(cmd->convert_src); cb_pcidas_ai_cmdtest()
710 err |= comedi_check_trigger_is_unique(cmd->stop_src); cb_pcidas_ai_cmdtest()
714 if (cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_NOW) cb_pcidas_ai_cmdtest()
716 if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->convert_src != TRIG_NOW) cb_pcidas_ai_cmdtest()
718 if (cmd->start_src == TRIG_EXT && cb_pcidas_ai_cmdtest()
719 (cmd->convert_src == TRIG_EXT || cmd->scan_begin_src == TRIG_EXT)) cb_pcidas_ai_cmdtest()
727 switch (cmd->start_src) { cb_pcidas_ai_cmdtest()
729 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); cb_pcidas_ai_cmdtest()
733 if ((cmd->start_arg cb_pcidas_ai_cmdtest()
735 cmd->start_arg &= ~(CR_FLAGS_MASK & cb_pcidas_ai_cmdtest()
739 if (!board->is_1602 && (cmd->start_arg & CR_INVERT)) { cb_pcidas_ai_cmdtest()
740 cmd->start_arg &= (CR_FLAGS_MASK & ~CR_INVERT); cb_pcidas_ai_cmdtest()
746 if (cmd->scan_begin_src == TRIG_TIMER) { cb_pcidas_ai_cmdtest()
747 err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, cb_pcidas_ai_cmdtest()
749 cmd->chanlist_len); cb_pcidas_ai_cmdtest()
752 if (cmd->convert_src == TRIG_TIMER) { cb_pcidas_ai_cmdtest()
753 err |= comedi_check_trigger_arg_min(&cmd->convert_arg, cb_pcidas_ai_cmdtest()
757 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, cb_pcidas_ai_cmdtest()
758 cmd->chanlist_len); cb_pcidas_ai_cmdtest()
760 if (cmd->stop_src == TRIG_COUNT) cb_pcidas_ai_cmdtest()
761 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); cb_pcidas_ai_cmdtest()
763 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); cb_pcidas_ai_cmdtest()
770 if (cmd->scan_begin_src == TRIG_TIMER) { cb_pcidas_ai_cmdtest()
771 arg = cmd->scan_begin_arg; cb_pcidas_ai_cmdtest()
772 comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); cb_pcidas_ai_cmdtest()
773 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); cb_pcidas_ai_cmdtest()
775 if (cmd->convert_src == TRIG_TIMER) { cb_pcidas_ai_cmdtest()
776 arg = cmd->convert_arg; cb_pcidas_ai_cmdtest()
777 comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); cb_pcidas_ai_cmdtest()
778 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); cb_pcidas_ai_cmdtest()
785 if (cmd->chanlist && cmd->chanlist_len > 0) cb_pcidas_ai_cmdtest()
786 err |= cb_pcidas_ai_check_chanlist(dev, s, cmd); cb_pcidas_ai_cmdtest()
800 struct comedi_cmd *cmd = &async->cmd; cb_pcidas_ai_cmd() local
801 unsigned int range0 = CR_RANGE(cmd->chanlist[0]); cb_pcidas_ai_cmd()
813 bits = PCIDAS_AI_FIRST(CR_CHAN(cmd->chanlist[0])) | cb_pcidas_ai_cmd()
814 PCIDAS_AI_LAST(CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1])) | cb_pcidas_ai_cmd()
820 if (CR_AREF(cmd->chanlist[0]) != AREF_DIFF) cb_pcidas_ai_cmd()
823 if (cmd->convert_src == TRIG_EXT || cmd->scan_begin_src == TRIG_EXT) cb_pcidas_ai_cmd()
830 if (cmd->scan_begin_src == TRIG_TIMER || cb_pcidas_ai_cmd()
831 cmd->convert_src == TRIG_TIMER) { cb_pcidas_ai_cmd()
840 if (cmd->flags & CMDF_WAKE_EOS) { cb_pcidas_ai_cmd()
841 if (cmd->convert_src == TRIG_NOW && cmd->chanlist_len > 1) { cb_pcidas_ai_cmd()
861 if (cmd->start_src == TRIG_NOW) { cb_pcidas_ai_cmd()
866 if (cmd->start_arg & CR_INVERT) cb_pcidas_ai_cmd()
868 if (cmd->start_arg & CR_EDGE) cb_pcidas_ai_cmd()
872 if (cmd->convert_src == TRIG_NOW && cmd->chanlist_len > 1) cb_pcidas_ai_cmd()
881 struct comedi_cmd *cmd) cb_pcidas_ao_check_chanlist()
883 unsigned int chan0 = CR_CHAN(cmd->chanlist[0]); cb_pcidas_ao_check_chanlist()
885 if (cmd->chanlist_len > 1) { cb_pcidas_ao_check_chanlist()
886 unsigned int chan1 = CR_CHAN(cmd->chanlist[1]); cb_pcidas_ao_check_chanlist()
900 struct comedi_cmd *cmd) cb_pcidas_ao_cmdtest()
908 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_INT); cb_pcidas_ao_cmdtest()
909 err |= comedi_check_trigger_src(&cmd->scan_begin_src, cb_pcidas_ao_cmdtest()
911 err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); cb_pcidas_ao_cmdtest()
912 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); cb_pcidas_ao_cmdtest()
913 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); cb_pcidas_ao_cmdtest()
920 err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); cb_pcidas_ao_cmdtest()
921 err |= comedi_check_trigger_is_unique(cmd->stop_src); cb_pcidas_ao_cmdtest()
930 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); cb_pcidas_ao_cmdtest()
932 if (cmd->scan_begin_src == TRIG_TIMER) { cb_pcidas_ao_cmdtest()
933 err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, cb_pcidas_ao_cmdtest()
937 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, cb_pcidas_ao_cmdtest()
938 cmd->chanlist_len); cb_pcidas_ao_cmdtest()
940 if (cmd->stop_src == TRIG_COUNT) cb_pcidas_ao_cmdtest()
941 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); cb_pcidas_ao_cmdtest()
943 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); cb_pcidas_ao_cmdtest()
950 if (cmd->scan_begin_src == TRIG_TIMER) { cb_pcidas_ao_cmdtest()
951 unsigned int arg = cmd->scan_begin_arg; cb_pcidas_ao_cmdtest()
954 &arg, cmd->flags); cb_pcidas_ao_cmdtest()
955 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); cb_pcidas_ao_cmdtest()
962 if (cmd->chanlist && cmd->chanlist_len > 0) cb_pcidas_ao_cmdtest()
963 err |= cb_pcidas_ao_check_chanlist(dev, s, cmd); cb_pcidas_ao_cmdtest()
1012 struct comedi_cmd *cmd = &async->cmd; cb_pcidas_ao_inttrig() local
1015 if (trig_num != cmd->start_arg) cb_pcidas_ao_inttrig()
1044 struct comedi_cmd *cmd = &async->cmd; cb_pcidas_ao_cmd() local
1050 for (i = 0; i < cmd->chanlist_len; i++) { cb_pcidas_ao_cmd()
1051 unsigned int chan = CR_CHAN(cmd->chanlist[i]); cb_pcidas_ao_cmd()
1052 unsigned int range = CR_RANGE(cmd->chanlist[i]); cb_pcidas_ao_cmd()
1068 if (cmd->scan_begin_src == TRIG_TIMER) { cb_pcidas_ao_cmd()
1075 switch (cmd->scan_begin_src) { cb_pcidas_ao_cmd()
1120 struct comedi_cmd *cmd = &async->cmd; cb_pcidas_ao_interrupt() local
1127 if (cmd->stop_src == TRIG_COUNT && cb_pcidas_ao_interrupt()
1128 async->scans_done >= cmd->stop_arg) { cb_pcidas_ao_interrupt()
1153 struct comedi_cmd *cmd = &async->cmd; cb_pcidas_ai_interrupt() local
1167 if (cmd->stop_src == TRIG_COUNT && cb_pcidas_ai_interrupt()
1168 async->scans_done >= cmd->stop_arg) cb_pcidas_ai_interrupt()
1186 if (cmd->stop_src == TRIG_COUNT && cb_pcidas_ai_interrupt()
1187 async->scans_done >= cmd->stop_arg) { cb_pcidas_ai_interrupt()
657 cb_pcidas_ai_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) cb_pcidas_ai_check_chanlist() argument
684 cb_pcidas_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) cb_pcidas_ai_cmdtest() argument
879 cb_pcidas_ao_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) cb_pcidas_ao_check_chanlist() argument
898 cb_pcidas_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) cb_pcidas_ao_cmdtest() argument
H A Ddas16m1.c52 irq can be omitted, although the cmd interface will not work without it.
151 struct comedi_cmd *cmd) das16m1_ai_check_chanlist()
155 if (cmd->chanlist_len == 1) das16m1_ai_check_chanlist()
158 if ((cmd->chanlist_len % 2) != 0) { das16m1_ai_check_chanlist()
164 for (i = 0; i < cmd->chanlist_len; i++) { das16m1_ai_check_chanlist()
165 unsigned int chan = CR_CHAN(cmd->chanlist[i]); das16m1_ai_check_chanlist()
178 struct comedi_subdevice *s, struct comedi_cmd *cmd) das16m1_cmd_test()
184 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); das16m1_cmd_test()
185 err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); das16m1_cmd_test()
186 err |= comedi_check_trigger_src(&cmd->convert_src, das16m1_cmd_test()
188 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); das16m1_cmd_test()
189 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); das16m1_cmd_test()
196 err |= comedi_check_trigger_is_unique(cmd->start_src); das16m1_cmd_test()
197 err |= comedi_check_trigger_is_unique(cmd->convert_src); das16m1_cmd_test()
198 err |= comedi_check_trigger_is_unique(cmd->stop_src); das16m1_cmd_test()
207 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); das16m1_cmd_test()
209 if (cmd->scan_begin_src == TRIG_FOLLOW) /* internal trigger */ das16m1_cmd_test()
210 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); das16m1_cmd_test()
212 if (cmd->convert_src == TRIG_TIMER) das16m1_cmd_test()
213 err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 1000); das16m1_cmd_test()
215 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, das16m1_cmd_test()
216 cmd->chanlist_len); das16m1_cmd_test()
218 if (cmd->stop_src == TRIG_COUNT) das16m1_cmd_test()
219 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); das16m1_cmd_test()
221 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); das16m1_cmd_test()
228 if (cmd->convert_src == TRIG_TIMER) { das16m1_cmd_test()
229 unsigned int arg = cmd->convert_arg; das16m1_cmd_test()
231 comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); das16m1_cmd_test()
232 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); das16m1_cmd_test()
239 if (cmd->chanlist && cmd->chanlist_len > 0) das16m1_cmd_test()
240 err |= das16m1_ai_check_chanlist(dev, s, cmd); das16m1_cmd_test()
253 struct comedi_cmd *cmd = &async->cmd; das16m1_cmd_exec() local
278 for (i = 0; i < cmd->chanlist_len; i++) { das16m1_cmd_exec()
281 Q_CHAN(CR_CHAN(cmd->chanlist[i])) | das16m1_cmd_exec()
282 Q_RANGE(CR_RANGE(cmd->chanlist[i])); das16m1_cmd_exec()
288 if (cmd->convert_src == TRIG_TIMER) { das16m1_cmd_exec()
300 if (cmd->start_src == TRIG_EXT && cmd->convert_src != TRIG_EXT) das16m1_cmd_exec()
402 struct comedi_cmd *cmd; das16m1_handler() local
408 cmd = &async->cmd; das16m1_handler()
429 if (cmd->stop_src == TRIG_COUNT) { das16m1_handler()
430 if (num_samples > cmd->stop_arg * cmd->chanlist_len) das16m1_handler()
431 num_samples = cmd->stop_arg * cmd->chanlist_len; das16m1_handler()
441 if (cmd->stop_src == TRIG_COUNT) { das16m1_handler()
442 if (devpriv->adc_count >= cmd->stop_arg * cmd->chanlist_len) { das16m1_handler()
149 das16m1_ai_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) das16m1_ai_check_chanlist() argument
177 das16m1_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) das16m1_cmd_test() argument
H A Ddmm32at.c242 struct comedi_cmd *cmd) dmm32at_ai_check_chanlist()
244 unsigned int chan0 = CR_CHAN(cmd->chanlist[0]); dmm32at_ai_check_chanlist()
245 unsigned int range0 = CR_RANGE(cmd->chanlist[0]); dmm32at_ai_check_chanlist()
248 for (i = 1; i < cmd->chanlist_len; i++) { dmm32at_ai_check_chanlist()
249 unsigned int chan = CR_CHAN(cmd->chanlist[i]); dmm32at_ai_check_chanlist()
250 unsigned int range = CR_RANGE(cmd->chanlist[i]); dmm32at_ai_check_chanlist()
269 struct comedi_cmd *cmd) dmm32at_ai_cmdtest()
276 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); dmm32at_ai_cmdtest()
277 err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); dmm32at_ai_cmdtest()
278 err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER); dmm32at_ai_cmdtest()
279 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); dmm32at_ai_cmdtest()
280 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); dmm32at_ai_cmdtest()
287 err |= comedi_check_trigger_is_unique(cmd->stop_src); dmm32at_ai_cmdtest()
296 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); dmm32at_ai_cmdtest()
298 err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, 1000000); dmm32at_ai_cmdtest()
299 err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, 1000000000); dmm32at_ai_cmdtest()
301 if (cmd->convert_arg >= 17500) dmm32at_ai_cmdtest()
302 cmd->convert_arg = 20000; dmm32at_ai_cmdtest()
303 else if (cmd->convert_arg >= 12500) dmm32at_ai_cmdtest()
304 cmd->convert_arg = 15000; dmm32at_ai_cmdtest()
305 else if (cmd->convert_arg >= 7500) dmm32at_ai_cmdtest()
306 cmd->convert_arg = 10000; dmm32at_ai_cmdtest()
308 cmd->convert_arg = 5000; dmm32at_ai_cmdtest()
310 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, dmm32at_ai_cmdtest()
311 cmd->chanlist_len); dmm32at_ai_cmdtest()
313 if (cmd->stop_src == TRIG_COUNT) dmm32at_ai_cmdtest()
314 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); dmm32at_ai_cmdtest()
316 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); dmm32at_ai_cmdtest()
323 arg = cmd->convert_arg * cmd->scan_end_arg; dmm32at_ai_cmdtest()
324 err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, arg); dmm32at_ai_cmdtest()
330 if (cmd->chanlist && cmd->chanlist_len > 0) dmm32at_ai_cmdtest()
331 err |= dmm32at_ai_check_chanlist(dev, s, cmd); dmm32at_ai_cmdtest()
373 struct comedi_cmd *cmd = &s->async->cmd; dmm32at_ai_cmd() local
376 dmm32at_ai_set_chanspec(dev, s, cmd->chanlist[0], cmd->chanlist_len); dmm32at_ai_cmd()
390 if (cmd->stop_src == TRIG_NONE || cmd->stop_arg > 1) { dmm32at_ai_cmd()
392 dmm32at_setaitimer(dev, cmd->scan_begin_arg); dmm32at_ai_cmd()
426 struct comedi_cmd *cmd = &s->async->cmd; dmm32at_isr() local
428 for (i = 0; i < cmd->chanlist_len; i++) { dmm32at_isr()
433 if (cmd->stop_src == TRIG_COUNT && dmm32at_isr()
434 s->async->scans_done >= cmd->stop_arg) dmm32at_isr()
240 dmm32at_ai_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) dmm32at_ai_check_chanlist() argument
267 dmm32at_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) dmm32at_ai_cmdtest() argument
H A Dadl_pci9111.c212 struct comedi_cmd *cmd) pci9111_ai_check_chanlist()
214 unsigned int range0 = CR_RANGE(cmd->chanlist[0]); pci9111_ai_check_chanlist()
215 unsigned int aref0 = CR_AREF(cmd->chanlist[0]); pci9111_ai_check_chanlist()
218 for (i = 1; i < cmd->chanlist_len; i++) { pci9111_ai_check_chanlist()
219 unsigned int chan = CR_CHAN(cmd->chanlist[i]); pci9111_ai_check_chanlist()
220 unsigned int range = CR_RANGE(cmd->chanlist[i]); pci9111_ai_check_chanlist()
221 unsigned int aref = CR_AREF(cmd->chanlist[i]); pci9111_ai_check_chanlist()
247 struct comedi_cmd *cmd) pci9111_ai_do_cmd_test()
254 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); pci9111_ai_do_cmd_test()
255 err |= comedi_check_trigger_src(&cmd->scan_begin_src, pci9111_ai_do_cmd_test()
257 err |= comedi_check_trigger_src(&cmd->convert_src, pci9111_ai_do_cmd_test()
259 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); pci9111_ai_do_cmd_test()
260 err |= comedi_check_trigger_src(&cmd->stop_src, pci9111_ai_do_cmd_test()
268 err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); pci9111_ai_do_cmd_test()
269 err |= comedi_check_trigger_is_unique(cmd->convert_src); pci9111_ai_do_cmd_test()
270 err |= comedi_check_trigger_is_unique(cmd->stop_src); pci9111_ai_do_cmd_test()
274 if (cmd->scan_begin_src != TRIG_FOLLOW) { pci9111_ai_do_cmd_test()
275 if (cmd->scan_begin_src != cmd->convert_src) pci9111_ai_do_cmd_test()
284 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); pci9111_ai_do_cmd_test()
286 if (cmd->convert_src == TRIG_TIMER) { pci9111_ai_do_cmd_test()
287 err |= comedi_check_trigger_arg_min(&cmd->convert_arg, pci9111_ai_do_cmd_test()
290 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); pci9111_ai_do_cmd_test()
293 if (cmd->scan_begin_src == TRIG_TIMER) { pci9111_ai_do_cmd_test()
294 err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, pci9111_ai_do_cmd_test()
297 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); pci9111_ai_do_cmd_test()
300 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, pci9111_ai_do_cmd_test()
301 cmd->chanlist_len); pci9111_ai_do_cmd_test()
303 if (cmd->stop_src == TRIG_COUNT) pci9111_ai_do_cmd_test()
304 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); pci9111_ai_do_cmd_test()
306 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); pci9111_ai_do_cmd_test()
313 if (cmd->convert_src == TRIG_TIMER) { pci9111_ai_do_cmd_test()
314 arg = cmd->convert_arg; pci9111_ai_do_cmd_test()
315 comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); pci9111_ai_do_cmd_test()
316 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); pci9111_ai_do_cmd_test()
323 if (cmd->scan_begin_src == TRIG_TIMER) { pci9111_ai_do_cmd_test()
324 arg = cmd->chanlist_len * cmd->convert_arg; pci9111_ai_do_cmd_test()
326 if (arg < cmd->scan_begin_arg) pci9111_ai_do_cmd_test()
327 arg *= (cmd->scan_begin_arg / arg); pci9111_ai_do_cmd_test()
329 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); pci9111_ai_do_cmd_test()
336 if (cmd->chanlist && cmd->chanlist_len > 0) pci9111_ai_do_cmd_test()
337 err |= pci9111_ai_check_chanlist(dev, s, cmd); pci9111_ai_do_cmd_test()
349 struct comedi_cmd *cmd = &s->async->cmd; pci9111_ai_do_cmd() local
350 unsigned int last_chan = CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1]); pci9111_ai_do_cmd()
351 unsigned int range0 = CR_RANGE(cmd->chanlist[0]); pci9111_ai_do_cmd()
358 if (cmd->chanlist_len > 1) pci9111_ai_do_cmd()
368 if (cmd->convert_src == TRIG_TIMER) { pci9111_ai_do_cmd()
378 if (cmd->scan_begin_src == TRIG_TIMER) { pci9111_ai_do_cmd()
379 dev_private->scan_delay = (cmd->scan_begin_arg / pci9111_ai_do_cmd()
380 (cmd->convert_arg * cmd->chanlist_len)) - 1; pci9111_ai_do_cmd()
393 dev_private->chunk_num_samples = cmd->chanlist_len * pci9111_ai_do_cmd()
419 struct comedi_cmd *cmd = &s->async->cmd; pci9111_handle_fifo_half_full() local
433 if (devpriv->chunk_counter < cmd->chanlist_len) { pci9111_handle_fifo_half_full()
434 to_read = cmd->chanlist_len - pci9111_handle_fifo_half_full()
465 struct comedi_cmd *cmd; pci9111_interrupt() local
477 cmd = &async->cmd; pci9111_interrupt()
513 if (cmd->stop_src == TRIG_COUNT && async->scans_done >= cmd->stop_arg) pci9111_interrupt()
210 pci9111_ai_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) pci9111_ai_check_chanlist() argument
245 pci9111_ai_do_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) pci9111_ai_do_cmd_test() argument
H A Ddt3000.c236 static void dt3k_send_cmd(struct comedi_device *dev, unsigned int cmd) dt3k_send_cmd() argument
241 writew(cmd, dev->mmio + DPR_CMD_MBX); dt3k_send_cmd()
387 struct comedi_subdevice *s, struct comedi_cmd *cmd) dt3k_ai_cmdtest()
395 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); dt3k_ai_cmdtest()
396 err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); dt3k_ai_cmdtest()
397 err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER); dt3k_ai_cmdtest()
398 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); dt3k_ai_cmdtest()
399 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT); dt3k_ai_cmdtest()
409 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); dt3k_ai_cmdtest()
411 if (cmd->scan_begin_src == TRIG_TIMER) { dt3k_ai_cmdtest()
412 err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, dt3k_ai_cmdtest()
414 err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, dt3k_ai_cmdtest()
418 if (cmd->convert_src == TRIG_TIMER) { dt3k_ai_cmdtest()
419 err |= comedi_check_trigger_arg_min(&cmd->convert_arg, dt3k_ai_cmdtest()
421 err |= comedi_check_trigger_arg_max(&cmd->convert_arg, dt3k_ai_cmdtest()
425 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, dt3k_ai_cmdtest()
426 cmd->chanlist_len); dt3k_ai_cmdtest()
428 if (cmd->stop_src == TRIG_COUNT) dt3k_ai_cmdtest()
429 err |= comedi_check_trigger_arg_max(&cmd->stop_arg, 0x00ffffff); dt3k_ai_cmdtest()
431 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); dt3k_ai_cmdtest()
438 if (cmd->scan_begin_src == TRIG_TIMER) { dt3k_ai_cmdtest()
439 arg = cmd->scan_begin_arg; dt3k_ai_cmdtest()
440 dt3k_ns_to_timer(100, &arg, cmd->flags); dt3k_ai_cmdtest()
441 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); dt3k_ai_cmdtest()
444 if (cmd->convert_src == TRIG_TIMER) { dt3k_ai_cmdtest()
445 arg = cmd->convert_arg; dt3k_ai_cmdtest()
446 dt3k_ns_to_timer(50, &arg, cmd->flags); dt3k_ai_cmdtest()
447 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); dt3k_ai_cmdtest()
449 if (cmd->scan_begin_src == TRIG_TIMER) { dt3k_ai_cmdtest()
450 arg = cmd->convert_arg * cmd->scan_end_arg; dt3k_ai_cmdtest()
451 err |= comedi_check_trigger_arg_min(&cmd-> dt3k_ai_cmdtest()
465 struct comedi_cmd *cmd = &s->async->cmd; dt3k_ai_cmd() local
471 for (i = 0; i < cmd->chanlist_len; i++) { dt3k_ai_cmd()
472 chan = CR_CHAN(cmd->chanlist[i]); dt3k_ai_cmd()
473 range = CR_RANGE(cmd->chanlist[i]); dt3k_ai_cmd()
477 aref = CR_AREF(cmd->chanlist[0]); dt3k_ai_cmd()
479 writew(cmd->scan_end_arg, dev->mmio + DPR_PARAMS(0)); dt3k_ai_cmd()
481 if (cmd->convert_src == TRIG_TIMER) { dt3k_ai_cmd()
482 divider = dt3k_ns_to_timer(50, &cmd->convert_arg, cmd->flags); dt3k_ai_cmd()
487 if (cmd->scan_begin_src == TRIG_TIMER) { dt3k_ai_cmd()
488 tscandiv = dt3k_ns_to_timer(100, &cmd->scan_begin_arg, dt3k_ai_cmd()
489 cmd->flags); dt3k_ai_cmd()
386 dt3k_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) dt3k_ai_cmdtest() argument
H A Daddi_apci_2032.c88 struct comedi_cmd *cmd) apci2032_int_cmdtest()
94 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); apci2032_int_cmdtest()
95 err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); apci2032_int_cmdtest()
96 err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); apci2032_int_cmdtest()
97 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); apci2032_int_cmdtest()
98 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); apci2032_int_cmdtest()
104 err |= comedi_check_trigger_is_unique(cmd->stop_src); apci2032_int_cmdtest()
113 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); apci2032_int_cmdtest()
114 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); apci2032_int_cmdtest()
115 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); apci2032_int_cmdtest()
116 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, apci2032_int_cmdtest()
117 cmd->chanlist_len); apci2032_int_cmdtest()
118 if (cmd->stop_src == TRIG_COUNT) apci2032_int_cmdtest()
119 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); apci2032_int_cmdtest()
121 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); apci2032_int_cmdtest()
136 struct comedi_cmd *cmd = &s->async->cmd; apci2032_int_cmd() local
143 for (n = 0; n < cmd->chanlist_len; n++) apci2032_int_cmd()
144 enabled_isns |= 1 << CR_CHAN(cmd->chanlist[n]); apci2032_int_cmd()
175 struct comedi_cmd *cmd = &s->async->cmd; apci2032_interrupt() local
204 for (i = 0; i < cmd->chanlist_len; i++) { apci2032_interrupt()
205 unsigned int chan = CR_CHAN(cmd->chanlist[i]); apci2032_interrupt()
213 if (cmd->stop_src == TRIG_COUNT && apci2032_interrupt()
214 s->async->scans_done >= cmd->stop_arg) apci2032_interrupt()
86 apci2032_int_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) apci2032_int_cmdtest() argument
H A Ddt2814.c123 struct comedi_subdevice *s, struct comedi_cmd *cmd) dt2814_ai_cmdtest()
130 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); dt2814_ai_cmdtest()
131 err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); dt2814_ai_cmdtest()
132 err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); dt2814_ai_cmdtest()
133 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); dt2814_ai_cmdtest()
134 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); dt2814_ai_cmdtest()
141 err |= comedi_check_trigger_is_unique(cmd->stop_src); dt2814_ai_cmdtest()
150 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); dt2814_ai_cmdtest()
152 err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, 1000000000); dt2814_ai_cmdtest()
153 err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, dt2814_ai_cmdtest()
156 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, dt2814_ai_cmdtest()
157 cmd->chanlist_len); dt2814_ai_cmdtest()
159 if (cmd->stop_src == TRIG_COUNT) dt2814_ai_cmdtest()
160 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 2); dt2814_ai_cmdtest()
162 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); dt2814_ai_cmdtest()
169 arg = cmd->scan_begin_arg; dt2814_ai_cmdtest()
170 dt2814_ns_to_timer(&arg, cmd->flags); dt2814_ai_cmdtest()
171 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); dt2814_ai_cmdtest()
182 struct comedi_cmd *cmd = &s->async->cmd; dt2814_ai_cmd() local
186 trigvar = dt2814_ns_to_timer(&cmd->scan_begin_arg, cmd->flags); dt2814_ai_cmd()
188 chan = CR_CHAN(cmd->chanlist[0]); dt2814_ai_cmd()
190 devpriv->ntrig = cmd->stop_arg; dt2814_ai_cmd()
122 dt2814_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) dt2814_ai_cmdtest() argument
H A Dpcl711.c195 struct comedi_cmd *cmd = &s->async->cmd; pcl711_interrupt() local
209 if (cmd->stop_src == TRIG_COUNT && pcl711_interrupt()
210 s->async->scans_done >= cmd->stop_arg) pcl711_interrupt()
283 struct comedi_subdevice *s, struct comedi_cmd *cmd) pcl711_ai_cmdtest()
289 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); pcl711_ai_cmdtest()
290 err |= comedi_check_trigger_src(&cmd->scan_begin_src, pcl711_ai_cmdtest()
292 err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); pcl711_ai_cmdtest()
293 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); pcl711_ai_cmdtest()
294 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); pcl711_ai_cmdtest()
301 err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); pcl711_ai_cmdtest()
302 err |= comedi_check_trigger_is_unique(cmd->stop_src); pcl711_ai_cmdtest()
311 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); pcl711_ai_cmdtest()
313 if (cmd->scan_begin_src == TRIG_EXT) { pcl711_ai_cmdtest()
314 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); pcl711_ai_cmdtest()
317 err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, pcl711_ai_cmdtest()
321 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); pcl711_ai_cmdtest()
322 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, pcl711_ai_cmdtest()
323 cmd->chanlist_len); pcl711_ai_cmdtest()
325 if (cmd->stop_src == TRIG_COUNT) pcl711_ai_cmdtest()
326 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); pcl711_ai_cmdtest()
328 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); pcl711_ai_cmdtest()
335 if (cmd->scan_begin_src == TRIG_TIMER) { pcl711_ai_cmdtest()
336 unsigned int arg = cmd->scan_begin_arg; pcl711_ai_cmdtest()
338 comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); pcl711_ai_cmdtest()
339 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); pcl711_ai_cmdtest()
350 struct comedi_cmd *cmd = &s->async->cmd; pcl711_ai_cmd() local
352 pcl711_set_changain(dev, s, cmd->chanlist[0]); pcl711_ai_cmd()
354 if (cmd->scan_begin_src == TRIG_TIMER) { pcl711_ai_cmd()
282 pcl711_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) pcl711_ai_cmdtest() argument
H A Damplc_pci224.c484 struct comedi_cmd *cmd = &s->async->cmd; pci224_ao_start() local
491 if (cmd->stop_src == TRIG_EXT) pci224_ao_start()
507 struct comedi_cmd *cmd = &s->async->cmd; pci224_ao_handle_fifo() local
518 if (cmd->stop_src == TRIG_COUNT && pci224_ao_handle_fifo()
519 s->async->scans_done >= cmd->stop_arg) { pci224_ao_handle_fifo()
545 room /= cmd->chanlist_len; pci224_ao_handle_fifo()
554 cmd->chanlist_len); pci224_ao_handle_fifo()
555 for (i = 0; i < cmd->chanlist_len; i++) { pci224_ao_handle_fifo()
560 if (cmd->stop_src == TRIG_COUNT && pci224_ao_handle_fifo()
561 s->async->scans_done >= cmd->stop_arg) { pci224_ao_handle_fifo()
587 if (cmd->scan_begin_src == TRIG_TIMER) { pci224_ao_handle_fifo()
590 /* cmd->scan_begin_src == TRIG_EXT */ pci224_ao_handle_fifo()
591 if (cmd->scan_begin_arg & CR_INVERT) pci224_ao_handle_fifo()
608 struct comedi_cmd *cmd = &s->async->cmd; pci224_ao_inttrig_start() local
610 if (trig_num != cmd->start_arg) pci224_ao_inttrig_start()
621 struct comedi_cmd *cmd) pci224_ao_check_chanlist()
628 range_check_0 = board->ao_range_check[CR_RANGE(cmd->chanlist[0])]; pci224_ao_check_chanlist()
629 for (i = 0; i < cmd->chanlist_len; i++) { pci224_ao_check_chanlist()
630 unsigned int chan = CR_CHAN(cmd->chanlist[i]); pci224_ao_check_chanlist()
640 if (board->ao_range_check[CR_RANGE(cmd->chanlist[i])] != pci224_ao_check_chanlist()
661 struct comedi_cmd *cmd) pci224_ao_cmdtest()
668 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_INT | TRIG_EXT); pci224_ao_cmdtest()
669 err |= comedi_check_trigger_src(&cmd->scan_begin_src, pci224_ao_cmdtest()
671 err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); pci224_ao_cmdtest()
672 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); pci224_ao_cmdtest()
673 err |= comedi_check_trigger_src(&cmd->stop_src, pci224_ao_cmdtest()
681 err |= comedi_check_trigger_is_unique(cmd->start_src); pci224_ao_cmdtest()
682 err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); pci224_ao_cmdtest()
683 err |= comedi_check_trigger_is_unique(cmd->stop_src); pci224_ao_cmdtest()
692 if (cmd->start_src & TRIG_EXT) pci224_ao_cmdtest()
694 if (cmd->scan_begin_src & TRIG_EXT) pci224_ao_cmdtest()
696 if (cmd->stop_src & TRIG_EXT) pci224_ao_cmdtest()
706 switch (cmd->start_src) { pci224_ao_cmdtest()
708 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); pci224_ao_cmdtest()
712 if (cmd->start_arg & ~CR_FLAGS_MASK) { pci224_ao_cmdtest()
713 cmd->start_arg = pci224_ao_cmdtest()
714 COMBINE(cmd->start_arg, 0, ~CR_FLAGS_MASK); pci224_ao_cmdtest()
718 if (cmd->start_arg & CR_FLAGS_MASK & ~CR_EDGE) { pci224_ao_cmdtest()
719 cmd->start_arg = COMBINE(cmd->start_arg, 0, pci224_ao_cmdtest()
726 switch (cmd->scan_begin_src) { pci224_ao_cmdtest()
728 err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, pci224_ao_cmdtest()
731 arg = cmd->chanlist_len * CONVERT_PERIOD; pci224_ao_cmdtest()
734 err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, arg); pci224_ao_cmdtest()
738 if (cmd->scan_begin_arg & ~CR_FLAGS_MASK) { pci224_ao_cmdtest()
739 cmd->scan_begin_arg = pci224_ao_cmdtest()
740 COMBINE(cmd->scan_begin_arg, 0, ~CR_FLAGS_MASK); pci224_ao_cmdtest()
744 if (cmd->scan_begin_arg & CR_FLAGS_MASK & pci224_ao_cmdtest()
746 cmd->scan_begin_arg = pci224_ao_cmdtest()
747 COMBINE(cmd->scan_begin_arg, 0, pci224_ao_cmdtest()
754 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); pci224_ao_cmdtest()
755 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, pci224_ao_cmdtest()
756 cmd->chanlist_len); pci224_ao_cmdtest()
758 switch (cmd->stop_src) { pci224_ao_cmdtest()
760 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); pci224_ao_cmdtest()
764 if (cmd->stop_arg & ~CR_FLAGS_MASK) { pci224_ao_cmdtest()
765 cmd->stop_arg = pci224_ao_cmdtest()
766 COMBINE(cmd->stop_arg, 0, ~CR_FLAGS_MASK); pci224_ao_cmdtest()
770 if (cmd->stop_arg & CR_FLAGS_MASK & ~CR_EDGE) { pci224_ao_cmdtest()
771 cmd->stop_arg = pci224_ao_cmdtest()
772 COMBINE(cmd->stop_arg, 0, CR_FLAGS_MASK & ~CR_EDGE); pci224_ao_cmdtest()
776 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); pci224_ao_cmdtest()
785 if (cmd->scan_begin_src == TRIG_TIMER) { pci224_ao_cmdtest()
786 arg = cmd->scan_begin_arg; pci224_ao_cmdtest()
788 comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); pci224_ao_cmdtest()
789 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); pci224_ao_cmdtest()
796 if (cmd->chanlist && cmd->chanlist_len > 0) pci224_ao_cmdtest()
797 err |= pci224_ao_check_chanlist(dev, s, cmd); pci224_ao_cmdtest()
831 struct comedi_cmd *cmd = &s->async->cmd; pci224_ao_cmd() local
839 if (!cmd->chanlist || cmd->chanlist_len == 0) pci224_ao_cmd()
845 for (i = 0; i < cmd->chanlist_len; i++) { pci224_ao_cmd()
846 ch = CR_CHAN(cmd->chanlist[i]); pci224_ao_cmd()
849 for (j = 0; j < cmd->chanlist_len; j++) { pci224_ao_cmd()
850 if (CR_CHAN(cmd->chanlist[j]) < ch) pci224_ao_cmd()
860 range = CR_RANGE(cmd->chanlist[0]); pci224_ao_cmd()
879 if (cmd->scan_begin_src == TRIG_TIMER) { pci224_ao_cmd()
885 if (cmd->start_src == TRIG_INT) { pci224_ao_cmd()
915 struct comedi_cmd *cmd = &s->async->cmd; pci224_ao_munge() local
925 if ((board->ao_hwrange[CR_RANGE(cmd->chanlist[0])] & pci224_ao_munge()
946 struct comedi_cmd *cmd; pci224_interrupt() local
964 cmd = &s->async->cmd; pci224_interrupt()
967 if (cmd->start_src == TRIG_EXT) pci224_interrupt()
969 else if (cmd->stop_src == TRIG_EXT) pci224_interrupt()
619 pci224_ao_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) pci224_ao_check_chanlist() argument
660 pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) pci224_ao_cmdtest() argument
H A Ddas6402.c186 struct comedi_cmd *cmd = &async->cmd; das6402_interrupt() local
201 if (cmd->stop_src == TRIG_COUNT && das6402_interrupt()
202 async->scans_done >= cmd->stop_arg) das6402_interrupt()
234 struct comedi_cmd *cmd = &s->async->cmd; das6402_ai_cmd() local
235 unsigned int chan_lo = CR_CHAN(cmd->chanlist[0]); das6402_ai_cmd()
236 unsigned int chan_hi = CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1]); das6402_ai_cmd()
238 das6402_ai_set_mode(dev, s, cmd->chanlist[0], DAS6402_MODE_FIFONEPTY); das6402_ai_cmd()
257 struct comedi_cmd *cmd) das6402_ai_check_chanlist()
259 unsigned int chan0 = CR_CHAN(cmd->chanlist[0]); das6402_ai_check_chanlist()
260 unsigned int range0 = CR_RANGE(cmd->chanlist[0]); das6402_ai_check_chanlist()
261 unsigned int aref0 = CR_AREF(cmd->chanlist[0]); das6402_ai_check_chanlist()
264 for (i = 1; i < cmd->chanlist_len; i++) { das6402_ai_check_chanlist()
265 unsigned int chan = CR_CHAN(cmd->chanlist[i]); das6402_ai_check_chanlist()
266 unsigned int range = CR_RANGE(cmd->chanlist[i]); das6402_ai_check_chanlist()
267 unsigned int aref = CR_AREF(cmd->chanlist[i]); das6402_ai_check_chanlist()
298 struct comedi_cmd *cmd) das6402_ai_cmdtest()
305 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); das6402_ai_cmdtest()
306 err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); das6402_ai_cmdtest()
307 err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER); das6402_ai_cmdtest()
308 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); das6402_ai_cmdtest()
309 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); das6402_ai_cmdtest()
316 err |= comedi_check_trigger_is_unique(cmd->stop_src); das6402_ai_cmdtest()
325 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); das6402_ai_cmdtest()
326 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); das6402_ai_cmdtest()
327 err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 10000); das6402_ai_cmdtest()
328 err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); das6402_ai_cmdtest()
329 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, das6402_ai_cmdtest()
330 cmd->chanlist_len); das6402_ai_cmdtest()
332 if (cmd->stop_src == TRIG_COUNT) das6402_ai_cmdtest()
333 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); das6402_ai_cmdtest()
335 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); das6402_ai_cmdtest()
342 arg = cmd->convert_arg; das6402_ai_cmdtest()
343 comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); das6402_ai_cmdtest()
344 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); das6402_ai_cmdtest()
350 if (cmd->chanlist && cmd->chanlist_len > 0) das6402_ai_cmdtest()
351 err |= das6402_ai_check_chanlist(dev, s, cmd); das6402_ai_cmdtest()
255 das6402_ai_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) das6402_ai_check_chanlist() argument
296 das6402_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) das6402_ai_cmdtest() argument
H A Dcb_pcidas64.c1260 const struct comedi_cmd *cmd) enable_ai_interrupts()
1273 if (cmd->flags & CMDF_WAKE_EOS) { enable_ai_interrupts()
2015 * sets cmd members appropriately.
2019 static void check_adc_timing(struct comedi_device *dev, struct comedi_cmd *cmd) check_adc_timing() argument
2030 if (cmd->convert_src == TRIG_TIMER) { check_adc_timing()
2032 cmd->convert_arg = 0; check_adc_timing()
2034 convert_divisor = get_divisor(cmd->convert_arg, check_adc_timing()
2035 cmd->flags); check_adc_timing()
2040 cmd->convert_arg = convert_divisor * TIMER_BASE; check_adc_timing()
2042 } else if (cmd->convert_src == TRIG_NOW) { check_adc_timing()
2043 cmd->convert_arg = 0; check_adc_timing()
2046 if (cmd->scan_begin_src == TRIG_TIMER) { check_adc_timing()
2047 scan_divisor = get_divisor(cmd->scan_begin_arg, cmd->flags); check_adc_timing()
2048 if (cmd->convert_src == TRIG_TIMER) { check_adc_timing()
2049 min_scan_divisor = convert_divisor * cmd->chanlist_len; check_adc_timing()
2051 (convert_divisor * cmd->chanlist_len - 1) + check_adc_timing()
2061 cmd->scan_begin_arg = scan_divisor * TIMER_BASE; check_adc_timing()
2067 struct comedi_cmd *cmd) cb_pcidas64_ai_check_chanlist()
2070 unsigned int aref0 = CR_AREF(cmd->chanlist[0]); cb_pcidas64_ai_check_chanlist()
2073 for (i = 1; i < cmd->chanlist_len; i++) { cb_pcidas64_ai_check_chanlist()
2074 unsigned int aref = CR_AREF(cmd->chanlist[i]); cb_pcidas64_ai_check_chanlist()
2084 unsigned int chan0 = CR_CHAN(cmd->chanlist[0]); cb_pcidas64_ai_check_chanlist()
2086 for (i = 1; i < cmd->chanlist_len; i++) { cb_pcidas64_ai_check_chanlist()
2087 unsigned int chan = CR_CHAN(cmd->chanlist[i]); cb_pcidas64_ai_check_chanlist()
2095 if (cmd->chanlist_len == 3) { cb_pcidas64_ai_check_chanlist()
2106 struct comedi_cmd *cmd) ai_cmdtest()
2115 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); ai_cmdtest()
2122 err |= comedi_check_trigger_src(&cmd->scan_begin_src, triggers); ai_cmdtest()
2129 err |= comedi_check_trigger_src(&cmd->convert_src, triggers); ai_cmdtest()
2130 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); ai_cmdtest()
2131 err |= comedi_check_trigger_src(&cmd->stop_src, ai_cmdtest()
2139 err |= comedi_check_trigger_is_unique(cmd->start_src); ai_cmdtest()
2140 err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); ai_cmdtest()
2141 err |= comedi_check_trigger_is_unique(cmd->convert_src); ai_cmdtest()
2142 err |= comedi_check_trigger_is_unique(cmd->stop_src); ai_cmdtest()
2146 if (cmd->convert_src == TRIG_EXT && cmd->scan_begin_src == TRIG_TIMER) ai_cmdtest()
2154 switch (cmd->start_src) { ai_cmdtest()
2156 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); ai_cmdtest()
2166 if (cmd->convert_src == TRIG_TIMER) { ai_cmdtest()
2168 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, ai_cmdtest()
2171 err |= comedi_check_trigger_arg_min(&cmd->convert_arg, ai_cmdtest()
2177 if (cmd->scan_begin_src == TRIG_TIMER) { ai_cmdtest()
2179 &cmd->scan_begin_arg, ai_cmdtest()
2180 cmd->convert_arg * ai_cmdtest()
2181 cmd->chanlist_len); ai_cmdtest()
2186 err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); ai_cmdtest()
2187 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, ai_cmdtest()
2188 cmd->chanlist_len); ai_cmdtest()
2190 switch (cmd->stop_src) { ai_cmdtest()
2194 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); ai_cmdtest()
2197 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); ai_cmdtest()
2208 if (cmd->convert_src == TRIG_TIMER) { ai_cmdtest()
2209 tmp_arg = cmd->convert_arg; ai_cmdtest()
2210 tmp_arg2 = cmd->scan_begin_arg; ai_cmdtest()
2211 check_adc_timing(dev, cmd); ai_cmdtest()
2212 if (tmp_arg != cmd->convert_arg) ai_cmdtest()
2214 if (tmp_arg2 != cmd->scan_begin_arg) ai_cmdtest()
2222 if (cmd->chanlist && cmd->chanlist_len > 0) ai_cmdtest()
2223 err |= cb_pcidas64_ai_check_chanlist(dev, s, cmd); ai_cmdtest()
2231 static int use_hw_sample_counter(struct comedi_cmd *cmd) use_hw_sample_counter() argument
2236 if (cmd->stop_src == TRIG_COUNT && cmd->stop_arg <= max_counter_value) use_hw_sample_counter()
2243 struct comedi_cmd *cmd) setup_sample_counters()
2248 if (use_hw_sample_counter(cmd)) { setup_sample_counters()
2249 writew(cmd->stop_arg & 0xffff, setup_sample_counters()
2251 writew((cmd->stop_arg >> 16) & 0xff, setup_sample_counters()
2273 const struct comedi_cmd *cmd) ai_convert_counter_6xxx()
2276 return cmd->convert_arg / TIMER_BASE - 3; ai_convert_counter_6xxx()
2280 struct comedi_cmd *cmd) ai_scan_counter_6xxx()
2285 switch (cmd->scan_begin_src) { ai_scan_counter_6xxx()
2287 count = (cmd->scan_begin_arg - ai_scan_counter_6xxx()
2288 (cmd->convert_arg * (cmd->chanlist_len - 1))) / ai_scan_counter_6xxx()
2292 count = cmd->convert_arg / TIMER_BASE; ai_scan_counter_6xxx()
2301 struct comedi_cmd *cmd) ai_convert_counter_4020()
2306 switch (cmd->scan_begin_src) { ai_convert_counter_4020()
2308 divisor = cmd->scan_begin_arg / TIMER_BASE; ai_convert_counter_4020()
2324 const struct comedi_cmd *cmd) select_master_clock_4020()
2330 if (cmd->scan_begin_src == TRIG_OTHER) { select_master_clock_4020()
2345 const struct comedi_cmd *cmd) select_master_clock()
2351 select_master_clock_4020(dev, cmd); select_master_clock()
2377 static void set_ai_pacing(struct comedi_device *dev, struct comedi_cmd *cmd) set_ai_pacing() argument
2383 check_adc_timing(dev, cmd); set_ai_pacing()
2385 select_master_clock(dev, cmd); set_ai_pacing()
2388 convert_counter = ai_convert_counter_4020(dev, cmd); set_ai_pacing()
2390 convert_counter = ai_convert_counter_6xxx(dev, cmd); set_ai_pacing()
2391 scan_counter = ai_scan_counter_6xxx(dev, cmd); set_ai_pacing()
2408 static int use_internal_queue_6xxx(const struct comedi_cmd *cmd) use_internal_queue_6xxx() argument
2412 for (i = 0; i + 1 < cmd->chanlist_len; i++) { use_internal_queue_6xxx()
2413 if (CR_CHAN(cmd->chanlist[i + 1]) != use_internal_queue_6xxx()
2414 CR_CHAN(cmd->chanlist[i]) + 1) use_internal_queue_6xxx()
2416 if (CR_RANGE(cmd->chanlist[i + 1]) != use_internal_queue_6xxx()
2417 CR_RANGE(cmd->chanlist[i])) use_internal_queue_6xxx()
2419 if (CR_AREF(cmd->chanlist[i + 1]) != CR_AREF(cmd->chanlist[i])) use_internal_queue_6xxx()
2426 const struct comedi_cmd *cmd) setup_channel_queue()
2434 if (use_internal_queue_6xxx(cmd)) { setup_channel_queue()
2440 bits |= adc_chan_bits(CR_CHAN(cmd->chanlist[0])); setup_channel_queue()
2443 CR_RANGE(cmd->chanlist[0])); setup_channel_queue()
2446 CR_AREF(cmd->chanlist[0]) == setup_channel_queue()
2448 if (CR_AREF(cmd->chanlist[0]) == AREF_COMMON) setup_channel_queue()
2452 (CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1])), setup_channel_queue()
2472 for (i = 0; i < cmd->chanlist_len; i++) { setup_channel_queue()
2475 bits |= adc_chan_bits(CR_CHAN(cmd-> setup_channel_queue()
2479 CR_RANGE(cmd-> setup_channel_queue()
2484 CR_AREF(cmd-> setup_channel_queue()
2487 if (CR_AREF(cmd->chanlist[i]) == AREF_COMMON) setup_channel_queue()
2490 if (i == cmd->chanlist_len - 1) setup_channel_queue()
2512 for (i = 0; i < cmd->chanlist_len; i++) { setup_channel_queue()
2513 unsigned int channel = CR_CHAN(cmd->chanlist[i]); setup_channel_queue()
2514 unsigned int range = CR_RANGE(cmd->chanlist[i]); setup_channel_queue()
2574 struct comedi_cmd *cmd = &async->cmd; ai_cmd() local
2583 retval = setup_channel_queue(dev, cmd); ai_cmd()
2590 set_ai_pacing(dev, cmd); ai_cmd()
2592 setup_sample_counters(dev, cmd); ai_cmd()
2594 enable_ai_interrupts(dev, cmd); ai_cmd()
2602 if (cmd->convert_src == TRIG_EXT) ai_cmd()
2610 if (cmd->chanlist_len == 4) ai_cmd()
2612 else if (cmd->chanlist_len == 2) ai_cmd()
2616 adc_lo_chan_4020_bits(CR_CHAN(cmd->chanlist[0])); ai_cmd()
2619 adc_hi_chan_4020_bits(CR_CHAN(cmd->chanlist ai_cmd()
2620 [cmd->chanlist_len - 1])); ai_cmd()
2629 if ((cmd->flags & CMDF_WAKE_EOS) == 0 || ai_cmd()
2652 if (cmd->start_src == TRIG_EXT && CR_CHAN(cmd->start_arg)) ai_cmd()
2654 if (cmd->stop_src == TRIG_EXT && CR_CHAN(cmd->stop_arg)) ai_cmd()
2663 if (cmd->flags & CMDF_WAKE_EOS) ai_cmd()
2666 if (cmd->start_src == TRIG_EXT) { ai_cmd()
2668 if (cmd->start_arg & CR_INVERT) ai_cmd()
2670 } else if (cmd->start_src == TRIG_NOW) { ai_cmd()
2673 if (use_hw_sample_counter(cmd)) ai_cmd()
2682 if (cmd->start_src == TRIG_NOW) ai_cmd()
2838 struct comedi_cmd *cmd = &async->cmd; handle_ai_interrupt() local
2861 ((cmd->flags & CMDF_WAKE_EOS) && handle_ai_interrupt()
2873 if ((cmd->stop_src == TRIG_COUNT && handle_ai_interrupt()
2874 async->scans_done >= cmd->stop_arg) || handle_ai_interrupt()
2875 (cmd->stop_src == TRIG_EXT && (status & ADC_STOP_BIT))) handle_ai_interrupt()
2953 const struct comedi_cmd *cmd) load_ao_dma_buffer()
2988 static void load_ao_dma(struct comedi_device *dev, const struct comedi_cmd *cmd) load_ao_dma() argument
3007 num_bytes = load_ao_dma_buffer(dev, cmd); load_ao_dma()
3017 struct comedi_cmd *cmd; handle_ao_interrupt() local
3025 cmd = &async->cmd; handle_ao_interrupt()
3040 load_ao_dma(dev, cmd); handle_ao_interrupt()
3050 if ((cmd->stop_src == TRIG_COUNT && handle_ao_interrupt()
3051 async->scans_done >= cmd->stop_arg) || handle_ao_interrupt()
3144 const struct comedi_cmd *cmd) set_dac_control0_reg()
3150 if (cmd->start_src == TRIG_EXT) { set_dac_control0_reg()
3152 if (cmd->start_arg & CR_INVERT) set_dac_control0_reg()
3157 if (cmd->scan_begin_src == TRIG_EXT) { set_dac_control0_reg()
3159 if (cmd->scan_begin_arg & CR_INVERT) set_dac_control0_reg()
3166 const struct comedi_cmd *cmd) set_dac_control1_reg()
3171 for (i = 0; i < cmd->chanlist_len; i++) { set_dac_control1_reg()
3174 channel = CR_CHAN(cmd->chanlist[i]); set_dac_control1_reg()
3175 range = CR_RANGE(cmd->chanlist[i]); set_dac_control1_reg()
3185 const struct comedi_cmd *cmd) set_dac_select_reg()
3191 first_channel = CR_CHAN(cmd->chanlist[0]); set_dac_select_reg()
3192 last_channel = CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1]); set_dac_select_reg()
3208 const struct comedi_cmd *cmd) set_dac_interval_regs()
3213 if (cmd->scan_begin_src != TRIG_TIMER) set_dac_interval_regs()
3216 divisor = get_ao_divisor(cmd->scan_begin_arg, cmd->flags); set_dac_interval_regs()
3227 static int prep_ao_dma(struct comedi_device *dev, const struct comedi_cmd *cmd) prep_ao_dma() argument
3253 if (cmd->stop_src == TRIG_COUNT && prep_ao_dma()
3254 s->async->scans_done >= cmd->stop_arg) prep_ao_dma()
3257 nbytes = load_ao_dma_buffer(dev, cmd); prep_ao_dma()
3260 load_ao_dma(dev, cmd); prep_ao_dma()
3269 struct comedi_cmd *cmd) external_ai_queue_in_use()
3277 else if (use_internal_queue_6xxx(cmd)) external_ai_queue_in_use()
3286 struct comedi_cmd *cmd = &s->async->cmd; ao_inttrig() local
3289 if (trig_num != cmd->start_arg) ao_inttrig()
3292 retval = prep_ao_dma(dev, cmd); ao_inttrig()
3296 set_dac_control0_reg(dev, cmd); ao_inttrig()
3298 if (cmd->start_src == TRIG_INT) ao_inttrig()
3309 struct comedi_cmd *cmd = &s->async->cmd; ao_cmd() local
3311 if (external_ai_queue_in_use(dev, s, cmd)) { ao_cmd()
3320 set_dac_select_reg(dev, cmd); ao_cmd()
3321 set_dac_interval_regs(dev, cmd); ao_cmd()
3325 set_dac_control1_reg(dev, cmd); ao_cmd()
3333 struct comedi_cmd *cmd) cb_pcidas64_ao_check_chanlist()
3335 unsigned int chan0 = CR_CHAN(cmd->chanlist[0]); cb_pcidas64_ao_check_chanlist()
3338 for (i = 1; i < cmd->chanlist_len; i++) { cb_pcidas64_ao_check_chanlist()
3339 unsigned int chan = CR_CHAN(cmd->chanlist[i]); cb_pcidas64_ao_check_chanlist()
3352 struct comedi_cmd *cmd) ao_cmdtest()
3360 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_INT | TRIG_EXT); ao_cmdtest()
3361 err |= comedi_check_trigger_src(&cmd->scan_begin_src, ao_cmdtest()
3363 err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); ao_cmdtest()
3364 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); ao_cmdtest()
3365 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_NONE); ao_cmdtest()
3372 err |= comedi_check_trigger_is_unique(cmd->start_src); ao_cmdtest()
3373 err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); ao_cmdtest()
3377 if (cmd->convert_src == TRIG_EXT && cmd->scan_begin_src == TRIG_TIMER) ao_cmdtest()
3379 if (cmd->stop_src != TRIG_COUNT && ao_cmdtest()
3380 cmd->stop_src != TRIG_NONE && cmd->stop_src != TRIG_EXT) ao_cmdtest()
3388 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); ao_cmdtest()
3390 if (cmd->scan_begin_src == TRIG_TIMER) { ao_cmdtest()
3391 err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, ao_cmdtest()
3393 if (get_ao_divisor(cmd->scan_begin_arg, cmd->flags) > ao_cmdtest()
3395 cmd->scan_begin_arg = (max_counter_value + 2) * ao_cmdtest()
3401 err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); ao_cmdtest()
3402 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, ao_cmdtest()
3403 cmd->chanlist_len); ao_cmdtest()
3410 if (cmd->scan_begin_src == TRIG_TIMER) { ao_cmdtest()
3411 tmp_arg = cmd->scan_begin_arg; ao_cmdtest()
3412 cmd->scan_begin_arg = get_divisor(cmd->scan_begin_arg, ao_cmdtest()
3413 cmd->flags) * TIMER_BASE; ao_cmdtest()
3414 if (tmp_arg != cmd->scan_begin_arg) ao_cmdtest()
3422 if (cmd->chanlist && cmd->chanlist_len > 0) ao_cmdtest()
3423 err |= cb_pcidas64_ao_check_chanlist(dev, s, cmd); ao_cmdtest()
1259 enable_ai_interrupts(struct comedi_device *dev, const struct comedi_cmd *cmd) enable_ai_interrupts() argument
2065 cb_pcidas64_ai_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) cb_pcidas64_ai_check_chanlist() argument
2105 ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) ai_cmdtest() argument
2242 setup_sample_counters(struct comedi_device *dev, struct comedi_cmd *cmd) setup_sample_counters() argument
2272 ai_convert_counter_6xxx(const struct comedi_device *dev, const struct comedi_cmd *cmd) ai_convert_counter_6xxx() argument
2279 ai_scan_counter_6xxx(struct comedi_device *dev, struct comedi_cmd *cmd) ai_scan_counter_6xxx() argument
2300 ai_convert_counter_4020(struct comedi_device *dev, struct comedi_cmd *cmd) ai_convert_counter_4020() argument
2323 select_master_clock_4020(struct comedi_device *dev, const struct comedi_cmd *cmd) select_master_clock_4020() argument
2344 select_master_clock(struct comedi_device *dev, const struct comedi_cmd *cmd) select_master_clock() argument
2425 setup_channel_queue(struct comedi_device *dev, const struct comedi_cmd *cmd) setup_channel_queue() argument
2952 load_ao_dma_buffer(struct comedi_device *dev, const struct comedi_cmd *cmd) load_ao_dma_buffer() argument
3143 set_dac_control0_reg(struct comedi_device *dev, const struct comedi_cmd *cmd) set_dac_control0_reg() argument
3165 set_dac_control1_reg(struct comedi_device *dev, const struct comedi_cmd *cmd) set_dac_control1_reg() argument
3184 set_dac_select_reg(struct comedi_device *dev, const struct comedi_cmd *cmd) set_dac_select_reg() argument
3207 set_dac_interval_regs(struct comedi_device *dev, const struct comedi_cmd *cmd) set_dac_interval_regs() argument
3267 external_ai_queue_in_use(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) external_ai_queue_in_use() argument
3331 cb_pcidas64_ao_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) cb_pcidas64_ao_check_chanlist() argument
3351 ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) ao_cmdtest() argument
H A Ddas1800.c73 irq can be omitted, although the cmd interface will not work without it.
75 analog input cmd triggers supported:
483 struct comedi_cmd *cmd = &s->async->cmd; das1800_handle_fifo_not_empty() local
495 if (cmd->stop_src == TRIG_COUNT && das1800_handle_fifo_not_empty()
496 s->async->scans_done >= cmd->stop_arg) das1800_handle_fifo_not_empty()
592 struct comedi_cmd *cmd = &async->cmd; das1800_ai_handler() local
627 } else if (cmd->stop_src == TRIG_COUNT && das1800_ai_handler()
628 async->scans_done >= cmd->stop_arg) { das1800_ai_handler()
708 struct comedi_cmd *cmd) das1800_ai_check_chanlist()
710 unsigned int unipolar0 = CR_RANGE(cmd->chanlist[0]) & UNIPOLAR; das1800_ai_check_chanlist()
713 for (i = 1; i < cmd->chanlist_len; i++) { das1800_ai_check_chanlist()
714 unsigned int unipolar = CR_RANGE(cmd->chanlist[i]) & UNIPOLAR; das1800_ai_check_chanlist()
726 /* test analog input cmd */ das1800_ai_do_cmdtest()
729 struct comedi_cmd *cmd) das1800_ai_do_cmdtest()
737 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); das1800_ai_do_cmdtest()
738 err |= comedi_check_trigger_src(&cmd->scan_begin_src, das1800_ai_do_cmdtest()
740 err |= comedi_check_trigger_src(&cmd->convert_src, das1800_ai_do_cmdtest()
742 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); das1800_ai_do_cmdtest()
743 err |= comedi_check_trigger_src(&cmd->stop_src, das1800_ai_do_cmdtest()
751 err |= comedi_check_trigger_is_unique(cmd->start_src); das1800_ai_do_cmdtest()
752 err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); das1800_ai_do_cmdtest()
753 err |= comedi_check_trigger_is_unique(cmd->convert_src); das1800_ai_do_cmdtest()
754 err |= comedi_check_trigger_is_unique(cmd->stop_src); das1800_ai_do_cmdtest()
758 if (cmd->scan_begin_src != TRIG_FOLLOW && das1800_ai_do_cmdtest()
759 cmd->convert_src != TRIG_TIMER) das1800_ai_do_cmdtest()
767 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); das1800_ai_do_cmdtest()
769 if (cmd->convert_src == TRIG_TIMER) { das1800_ai_do_cmdtest()
770 err |= comedi_check_trigger_arg_min(&cmd->convert_arg, das1800_ai_do_cmdtest()
774 err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); das1800_ai_do_cmdtest()
775 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, das1800_ai_do_cmdtest()
776 cmd->chanlist_len); das1800_ai_do_cmdtest()
778 switch (cmd->stop_src) { das1800_ai_do_cmdtest()
780 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); das1800_ai_do_cmdtest()
783 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); das1800_ai_do_cmdtest()
794 if (cmd->scan_begin_src == TRIG_FOLLOW && das1800_ai_do_cmdtest()
795 cmd->convert_src == TRIG_TIMER) { das1800_ai_do_cmdtest()
797 arg = cmd->convert_arg; das1800_ai_do_cmdtest()
798 comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); das1800_ai_do_cmdtest()
799 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); das1800_ai_do_cmdtest()
800 } else if (cmd->convert_src == TRIG_TIMER) { das1800_ai_do_cmdtest()
802 arg = burst_convert_arg(cmd->convert_arg, cmd->flags); das1800_ai_do_cmdtest()
803 err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); das1800_ai_do_cmdtest()
805 if (cmd->scan_begin_src == TRIG_TIMER) { das1800_ai_do_cmdtest()
806 arg = cmd->convert_arg * cmd->chanlist_len; das1800_ai_do_cmdtest()
807 err |= comedi_check_trigger_arg_max(&cmd-> das1800_ai_do_cmdtest()
811 arg = cmd->scan_begin_arg; das1800_ai_do_cmdtest()
813 cmd->flags); das1800_ai_do_cmdtest()
814 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, das1800_ai_do_cmdtest()
823 if (cmd->chanlist && cmd->chanlist_len > 0) das1800_ai_do_cmdtest()
824 err |= das1800_ai_check_chanlist(dev, s, cmd); das1800_ai_do_cmdtest()
833 static int control_a_bits(const struct comedi_cmd *cmd) control_a_bits() argument
838 if (cmd->stop_src == TRIG_EXT) control_a_bits()
840 switch (cmd->start_src) { control_a_bits()
855 static int control_c_bits(const struct comedi_cmd *cmd) control_c_bits() argument
863 aref = CR_AREF(cmd->chanlist[0]); control_c_bits()
870 if (CR_RANGE(cmd->chanlist[0]) & UNIPOLAR) control_c_bits()
872 switch (cmd->scan_begin_src) { control_c_bits()
874 switch (cmd->convert_src) { control_c_bits()
907 struct comedi_cmd *cmd = &s->async->cmd; das1800_ai_transfer_size() local
914 switch (cmd->scan_begin_src) { das1800_ai_transfer_size()
916 if (cmd->convert_src == TRIG_TIMER) das1800_ai_transfer_size()
917 samples = ns / cmd->convert_arg; das1800_ai_transfer_size()
920 samples = ns / (cmd->scan_begin_arg * cmd->chanlist_len); das1800_ai_transfer_size()
965 const struct comedi_cmd *cmd) program_chanlist()
972 n = cmd->chanlist_len; program_chanlist()
980 CR_CHAN(cmd->chanlist[i]) | program_chanlist()
981 ((CR_RANGE(cmd->chanlist[i]) & range_mask) << program_chanlist()
996 const struct comedi_cmd *cmd = &async->cmd; das1800_ai_do_cmd() local
1000 if (cmd->flags & (CMDF_WAKE_EOS | CMDF_PRIORITY)) das1800_ai_do_cmd()
1005 if (cmd->flags & CMDF_WAKE_EOS) { das1800_ai_do_cmd()
1016 control_a = control_a_bits(cmd); das1800_ai_do_cmd()
1017 control_c = control_c_bits(cmd); das1800_ai_do_cmd()
1020 program_chanlist(dev, cmd); das1800_ai_do_cmd()
1023 if ((cmd->scan_begin_src == TRIG_FOLLOW || das1800_ai_do_cmd()
1024 cmd->scan_begin_src == TRIG_TIMER) && das1800_ai_do_cmd()
1025 cmd->convert_src == TRIG_TIMER) { das1800_ai_do_cmd()
1031 if (cmd->stop_src == TRIG_EXT) das1800_ai_do_cmd()
1039 outb(cmd->convert_arg / 1000 - 1, das1800_ai_do_cmd()
1041 outb(cmd->chanlist_len - 1, dev->iobase + DAS1800_BURST_LENGTH); das1800_ai_do_cmd()
706 das1800_ai_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) das1800_ai_check_chanlist() argument
727 das1800_ai_do_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) das1800_ai_do_cmdtest() argument
964 program_chanlist(struct comedi_device *dev, const struct comedi_cmd *cmd) program_chanlist() argument
H A Dni_at_a2150.c160 struct comedi_cmd *cmd = &async->cmd; a2150_interrupt() local
195 if (devpriv->count < num_points && cmd->stop_src == TRIG_COUNT) a2150_interrupt()
200 if (cmd->stop_src == TRIG_NONE) { a2150_interrupt()
220 if (cmd->stop_src == TRIG_COUNT) { a2150_interrupt()
373 struct comedi_cmd *cmd) a2150_ai_check_chanlist()
375 unsigned int chan0 = CR_CHAN(cmd->chanlist[0]); a2150_ai_check_chanlist()
376 unsigned int aref0 = CR_AREF(cmd->chanlist[0]); a2150_ai_check_chanlist()
379 if (cmd->chanlist_len == 2 && (chan0 == 1 || chan0 == 3)) { a2150_ai_check_chanlist()
385 if (cmd->chanlist_len == 3) { a2150_ai_check_chanlist()
391 for (i = 1; i < cmd->chanlist_len; i++) { a2150_ai_check_chanlist()
392 unsigned int chan = CR_CHAN(cmd->chanlist[i]); a2150_ai_check_chanlist()
393 unsigned int aref = CR_AREF(cmd->chanlist[i]); a2150_ai_check_chanlist()
414 struct comedi_subdevice *s, struct comedi_cmd *cmd) a2150_ai_cmdtest()
422 err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); a2150_ai_cmdtest()
423 err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); a2150_ai_cmdtest()
424 err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); a2150_ai_cmdtest()
425 err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); a2150_ai_cmdtest()
426 err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); a2150_ai_cmdtest()
433 err |= comedi_check_trigger_is_unique(cmd->start_src); a2150_ai_cmdtest()
434 err |= comedi_check_trigger_is_unique(cmd->stop_src); a2150_ai_cmdtest()
443 err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); a2150_ai_cmdtest()
445 if (cmd->convert_src == TRIG_TIMER) { a2150_ai_cmdtest()
446 err |= comedi_check_trigger_arg_min(&cmd->convert_arg, a2150_ai_cmdtest()
450 err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); a2150_ai_cmdtest()
451 err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, a2150_ai_cmdtest()
452 cmd->chanlist_len); a2150_ai_cmdtest()
454 if (cmd->stop_src == TRIG_COUNT) a2150_ai_cmdtest()
455 err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); a2150_ai_cmdtest()
457 err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); a2150_ai_cmdtest()
464 if (cmd->scan_begin_src == TRIG_TIMER) { a2150_ai_cmdtest()
465 arg = cmd->scan_begin_arg; a2150_ai_cmdtest()
466 a2150_get_timing(dev, &arg, cmd->flags); a2150_ai_cmdtest()
467 err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); a2150_ai_cmdtest()
474 if (cmd->chanlist && cmd->chanlist_len > 0) a2150_ai_cmdtest()
475 err |= a2150_ai_check_chanlist(dev, s, cmd); a2150_ai_cmdtest()
489 struct comedi_cmd *cmd = &async->cmd; a2150_ai_cmd() local
493 if (cmd->flags & CMDF_PRIORITY) { a2150_ai_cmd()
502 if (a2150_set_chanlist(dev, CR_CHAN(cmd->chanlist[0]), a2150_ai_cmd()
503 cmd->chanlist_len) < 0) a2150_ai_cmd()
507 if (CR_AREF(cmd->chanlist[0]) == AREF_OTHER) a2150_ai_cmd()
511 if (CR_AREF(cmd->chanlist[2]) == AREF_OTHER) a2150_ai_cmd()
517 a2150_get_timing(dev, &cmd->scan_begin_arg, cmd->flags); a2150_ai_cmd()
523 devpriv->count = cmd->stop_arg * cmd->chanlist_len; a2150_ai_cmd()
529 desc->size = comedi_bytes_per_sample(s) * cmd->chanlist_len * a2150_ai_cmd()
530 ONE_THIRD_SECOND / cmd->scan_begin_arg; a2150_ai_cmd()
553 if (cmd->start_src == TRIG_NOW && a2150_ai_cmd()
563 if (cmd->start_src == TRIG_EXT) { a2150_ai_cmd()
565 } else if (cmd->start_src == TRIG_OTHER) { a2150_ai_cmd()
573 if (cmd->start_src == TRIG_NOW) a2150_ai_cmd()
371 a2150_ai_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) a2150_ai_check_chanlist() argument
413 a2150_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) a2150_ai_cmdtest() argument
/linux-4.4.14/net/nfc/hci/
H A Dhcp.c31 * counted from the moment the cmd is sent to the transport.
40 struct hci_msg *cmd; nfc_hci_hcp_message_tx() local
45 cmd = kzalloc(sizeof(struct hci_msg), GFP_KERNEL); nfc_hci_hcp_message_tx()
46 if (cmd == NULL) nfc_hci_hcp_message_tx()
49 INIT_LIST_HEAD(&cmd->msg_l); nfc_hci_hcp_message_tx()
50 skb_queue_head_init(&cmd->msg_frags); nfc_hci_hcp_message_tx()
51 cmd->wait_response = (type == NFC_HCI_HCP_COMMAND) ? true : false; nfc_hci_hcp_message_tx()
52 cmd->cb = cb; nfc_hci_hcp_message_tx()
53 cmd->cb_context = cb_context; nfc_hci_hcp_message_tx()
54 cmd->completion_delay = completion_delay; nfc_hci_hcp_message_tx()
102 skb_queue_tail(&cmd->msg_frags, skb); nfc_hci_hcp_message_tx()
113 list_add_tail(&cmd->msg_l, &hdev->msg_tx_queue); nfc_hci_hcp_message_tx()
121 skb_queue_purge(&cmd->msg_frags); nfc_hci_hcp_message_tx()
122 kfree(cmd); nfc_hci_hcp_message_tx()
128 * Receive hcp message for pipe, with type and cmd.
/linux-4.4.14/drivers/s390/cio/
H A Ddevice_status.c80 cdev->private->irb.scsw.cmd.ectl = 0; ccw_device_accumulate_ecw()
81 if ((irb->scsw.cmd.stctl & SCSW_STCTL_ALERT_STATUS) && ccw_device_accumulate_ecw()
82 !(irb->scsw.cmd.stctl & SCSW_STCTL_INTER_STATUS)) ccw_device_accumulate_ecw()
83 cdev->private->irb.scsw.cmd.ectl = irb->scsw.cmd.ectl; ccw_device_accumulate_ecw()
85 if (!cdev->private->irb.scsw.cmd.ectl) ccw_device_accumulate_ecw()
97 if (!irb->scsw.cmd.eswf && ccw_device_accumulate_esw_valid()
98 (irb->scsw.cmd.stctl == SCSW_STCTL_STATUS_PEND)) ccw_device_accumulate_esw_valid()
100 if (irb->scsw.cmd.stctl == ccw_device_accumulate_esw_valid()
102 !(irb->scsw.cmd.actl & SCSW_ACTL_SUSPENDED)) ccw_device_accumulate_esw_valid()
125 if (irb->scsw.cmd.eswf) { ccw_device_accumulate_esw()
134 if (irb->scsw.cmd.cstat & (SCHN_STAT_CHN_DATA_CHK | ccw_device_accumulate_esw()
155 if (irb->scsw.cmd.cstat & SCHN_STAT_INTF_CTRL_CHK) ccw_device_accumulate_esw()
227 if (irb->scsw.cmd.fctl & SCSW_FCTL_CLEAR_FUNC) ccw_device_accumulate_irb()
231 if (irb->scsw.cmd.fctl & SCSW_FCTL_START_FUNC) { ccw_device_accumulate_irb()
233 cdev_irb->scsw.cmd.key = irb->scsw.cmd.key; ccw_device_accumulate_irb()
235 cdev_irb->scsw.cmd.sctl = irb->scsw.cmd.sctl; ccw_device_accumulate_irb()
237 cdev_irb->scsw.cmd.cc |= irb->scsw.cmd.cc; ccw_device_accumulate_irb()
239 cdev_irb->scsw.cmd.fmt = irb->scsw.cmd.fmt; ccw_device_accumulate_irb()
241 cdev_irb->scsw.cmd.pfch = irb->scsw.cmd.pfch; ccw_device_accumulate_irb()
243 cdev_irb->scsw.cmd.isic = irb->scsw.cmd.isic; ccw_device_accumulate_irb()
245 cdev_irb->scsw.cmd.alcc = irb->scsw.cmd.alcc; ccw_device_accumulate_irb()
247 cdev_irb->scsw.cmd.ssi = irb->scsw.cmd.ssi; ccw_device_accumulate_irb()
254 cdev_irb->scsw.cmd.fctl |= irb->scsw.cmd.fctl; ccw_device_accumulate_irb()
256 cdev_irb->scsw.cmd.actl = irb->scsw.cmd.actl; ccw_device_accumulate_irb()
258 cdev_irb->scsw.cmd.stctl |= irb->scsw.cmd.stctl; ccw_device_accumulate_irb()
263 if ((irb->scsw.cmd.stctl & SCSW_STCTL_PRIM_STATUS) || ccw_device_accumulate_irb()
264 ((irb->scsw.cmd.stctl == ccw_device_accumulate_irb()
266 (irb->scsw.cmd.actl & SCSW_ACTL_DEVACT) && ccw_device_accumulate_irb()
267 (irb->scsw.cmd.actl & SCSW_ACTL_SCHACT)) || ccw_device_accumulate_irb()
268 (irb->scsw.cmd.actl & SCSW_ACTL_SUSPENDED)) ccw_device_accumulate_irb()
269 cdev_irb->scsw.cmd.cpa = irb->scsw.cmd.cpa; ccw_device_accumulate_irb()
271 cdev_irb->scsw.cmd.dstat &= ~DEV_STAT_BUSY; ccw_device_accumulate_irb()
273 if (irb->scsw.cmd.stctl & ccw_device_accumulate_irb()
276 cdev_irb->scsw.cmd.dstat |= irb->scsw.cmd.dstat; ccw_device_accumulate_irb()
278 cdev_irb->scsw.cmd.cstat |= irb->scsw.cmd.cstat; ccw_device_accumulate_irb()
280 if ((irb->scsw.cmd.stctl & SCSW_STCTL_PRIM_STATUS) && ccw_device_accumulate_irb()
281 (irb->scsw.cmd.cstat & ~(SCHN_STAT_PCI | SCHN_STAT_INCORR_LEN)) ccw_device_accumulate_irb()
283 cdev_irb->scsw.cmd.count = irb->scsw.cmd.count; ccw_device_accumulate_irb()
300 if ((cdev_irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) && ccw_device_accumulate_irb()
363 if (!(irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) && ccw_device_accumulate_basic_sense()
364 (irb->scsw.cmd.dstat & DEV_STAT_CHN_END)) { ccw_device_accumulate_basic_sense()
382 if ((irb->scsw.cmd.actl & (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)) != 0) ccw_device_accumulate_and_sense()
386 !(irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK)) { ccw_device_accumulate_and_sense()
/linux-4.4.14/drivers/media/pci/ivtv/
H A Divtv-mailbox.c37 #define API_RESULT (1 << 1) /* Allow 1 second for this cmd to end */
38 #define API_FAST_RESULT (3 << 1) /* Allow 0.1 second for this cmd to end */
189 static void write_mailbox(volatile struct ivtv_mailbox __iomem *mbox, int cmd, int args, u32 data[]) write_mailbox() argument
193 write_sync(cmd, &mbox->cmd); write_mailbox()
207 IVTV_DEBUG_WARN("Clearing mailbox %d: cmd 0x%08x flags 0x%08x\n", clear_all_mailboxes()
208 i, readl(&mbdata->mbox[i].cmd), readl(&mbdata->mbox[i].flags)); clear_all_mailboxes()
214 static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[]) ivtv_api_call() argument
216 struct ivtv_mailbox_data *mbdata = (cmd >= 128) ? &itv->enc_mbox : &itv->dec_mbox; ivtv_api_call()
228 cmd < 0 || cmd > 255 || api_info[cmd].name == NULL) { ivtv_api_call()
229 IVTV_ERR("Invalid MB call: cmd = 0x%02x, args = %d\n", cmd, args); ivtv_api_call()
233 if (api_info[cmd].flags & API_HIGH_VOL) { ivtv_api_call()
234 IVTV_DEBUG_HI_MB("MB Call: %s\n", api_info[cmd].name); ivtv_api_call()
237 IVTV_DEBUG_MB("MB Call: %s\n", api_info[cmd].name); ivtv_api_call()
247 if (itv->api_cache[cmd].last_jiffies && ivtv_api_call()
249 itv->api_cache[cmd].last_jiffies + ivtv_api_call()
251 !memcmp(data, itv->api_cache[cmd].data, sizeof(itv->api_cache[cmd].data))) { ivtv_api_call()
252 itv->api_cache[cmd].last_jiffies = jiffies; ivtv_api_call()
256 flags = api_info[cmd].flags; ivtv_api_call()
262 write_mailbox(&mbdata->mbox[mb], cmd, args, data); ivtv_api_call()
267 api_info[cmd].name, mb, readl(&mbdata->mbox[mb].flags)); ivtv_api_call()
269 IVTV_WARN("Could not find free DMA mailbox for %s\n", api_info[cmd].name); ivtv_api_call()
279 IVTV_DEBUG_WARN("No free mailbox found (%s)\n", api_info[cmd].name); ivtv_api_call()
284 write_mailbox(mbox, cmd, args, data); ivtv_api_call()
286 memcpy(itv->api_cache[cmd].data, data, sizeof(itv->api_cache[cmd].data)); ivtv_api_call()
287 itv->api_cache[cmd].last_jiffies = jiffies; ivtv_api_call()
306 IVTV_DEBUG_WARN("Could not get result (%s)\n", api_info[cmd].name); ivtv_api_call()
319 api_info[cmd].name, ivtv_api_call()
329 int ivtv_api(struct ivtv *itv, int cmd, int args, u32 data[]) ivtv_api() argument
331 int res = ivtv_api_call(itv, cmd, args, data); ivtv_api()
336 return (res == -EBUSY) ? ivtv_api_call(itv, cmd, args, data) : res; ivtv_api()
339 int ivtv_api_func(void *priv, u32 cmd, int in, int out, u32 data[CX2341X_MBOX_MAX_DATA]) ivtv_api_func() argument
341 return ivtv_api(priv, cmd, in, data); ivtv_api_func()
344 int ivtv_vapi_result(struct ivtv *itv, u32 data[CX2341X_MBOX_MAX_DATA], int cmd, int args, ...) ivtv_vapi_result() argument
354 return ivtv_api(itv, cmd, args, data); ivtv_vapi_result()
357 int ivtv_vapi(struct ivtv *itv, int cmd, int args, ...) ivtv_vapi() argument
368 return ivtv_api(itv, cmd, args, data); ivtv_vapi()
/linux-4.4.14/net/nfc/
H A Ddigital_core.c117 struct digital_cmd *cmd; digital_wq_cmd_complete() local
124 cmd = list_first_entry_or_null(&ddev->cmd_queue, struct digital_cmd, digital_wq_cmd_complete()
126 if (!cmd) { digital_wq_cmd_complete()
131 list_del(&cmd->queue); digital_wq_cmd_complete()
135 if (!IS_ERR(cmd->resp)) digital_wq_cmd_complete()
137 cmd->resp->data, cmd->resp->len, false); digital_wq_cmd_complete()
139 cmd->cmd_cb(ddev, cmd->cb_context, cmd->resp); digital_wq_cmd_complete()
141 kfree(cmd->mdaa_params); digital_wq_cmd_complete()
142 kfree(cmd); digital_wq_cmd_complete()
150 struct digital_cmd *cmd = arg; digital_send_cmd_complete() local
152 cmd->resp = resp; digital_send_cmd_complete()
160 struct digital_cmd *cmd; digital_wq_cmd() local
168 cmd = list_first_entry_or_null(&ddev->cmd_queue, struct digital_cmd, digital_wq_cmd()
170 if (!cmd || cmd->pending) { digital_wq_cmd()
177 if (cmd->req) digital_wq_cmd()
179 cmd->req->data, cmd->req->len, false); digital_wq_cmd()
181 switch (cmd->type) { digital_wq_cmd()
183 rc = ddev->ops->in_send_cmd(ddev, cmd->req, cmd->timeout, digital_wq_cmd()
184 digital_send_cmd_complete, cmd); digital_wq_cmd()
188 rc = ddev->ops->tg_send_cmd(ddev, cmd->req, cmd->timeout, digital_wq_cmd()
189 digital_send_cmd_complete, cmd); digital_wq_cmd()
193 rc = ddev->ops->tg_listen(ddev, cmd->timeout, digital_wq_cmd()
194 digital_send_cmd_complete, cmd); digital_wq_cmd()
198 params = cmd->mdaa_params; digital_wq_cmd()
200 rc = ddev->ops->tg_listen_mdaa(ddev, params, cmd->timeout, digital_wq_cmd()
201 digital_send_cmd_complete, cmd); digital_wq_cmd()
205 rc = ddev->ops->tg_listen_md(ddev, cmd->timeout, digital_wq_cmd()
206 digital_send_cmd_complete, cmd); digital_wq_cmd()
210 pr_err("Unknown cmd type %d\n", cmd->type); digital_wq_cmd()
220 list_del(&cmd->queue); digital_wq_cmd()
223 kfree_skb(cmd->req); digital_wq_cmd()
224 kfree(cmd->mdaa_params); digital_wq_cmd()
225 kfree(cmd); digital_wq_cmd()
235 struct digital_cmd *cmd; digital_send_cmd() local
237 cmd = kzalloc(sizeof(struct digital_cmd), GFP_KERNEL); digital_send_cmd()
238 if (!cmd) digital_send_cmd()
241 cmd->type = cmd_type; digital_send_cmd()
242 cmd->timeout = timeout; digital_send_cmd()
243 cmd->req = skb; digital_send_cmd()
244 cmd->mdaa_params = params; digital_send_cmd()
245 cmd->cmd_cb = cmd_cb; digital_send_cmd()
246 cmd->cb_context = cb_context; digital_send_cmd()
247 INIT_LIST_HEAD(&cmd->queue); digital_send_cmd()
250 list_add_tail(&cmd->queue, &ddev->cmd_queue); digital_send_cmd()
826 struct digital_cmd *cmd, *n; nfc_digital_unregister_device() local
838 list_for_each_entry_safe(cmd, n, &ddev->cmd_queue, queue) { nfc_digital_unregister_device()
839 list_del(&cmd->queue); nfc_digital_unregister_device()
840 kfree(cmd->mdaa_params); nfc_digital_unregister_device()
841 kfree(cmd); nfc_digital_unregister_device()
/linux-4.4.14/drivers/crypto/vmx/
H A DMakefile14 $(call cmd,perl)
17 $(call cmd,perl)
/linux-4.4.14/drivers/xen/
H A Dfallback.c8 int xen_event_channel_op_compat(int cmd, void *arg) xen_event_channel_op_compat() argument
13 op.cmd = cmd; xen_event_channel_op_compat()
17 switch (cmd) { xen_event_channel_op_compat()
47 int xen_physdev_op_compat(int cmd, void *arg) xen_physdev_op_compat() argument
52 op.cmd = cmd; xen_physdev_op_compat()
56 switch (cmd) { xen_physdev_op_compat()
/linux-4.4.14/tools/testing/selftests/membarrier/
H A Dmembarrier_test.c16 static int sys_membarrier(int cmd, int flags) sys_membarrier() argument
18 return syscall(__NR_membarrier, cmd, flags); sys_membarrier()
23 int cmd = -1, flags = 0; test_membarrier_cmd_fail() local
25 if (sys_membarrier(cmd, flags) != -1) { test_membarrier_cmd_fail()
34 int cmd = MEMBARRIER_CMD_QUERY, flags = 1; test_membarrier_flags_fail() local
36 if (sys_membarrier(cmd, flags) != -1) { test_membarrier_flags_fail()
45 int cmd = MEMBARRIER_CMD_SHARED, flags = 0; test_membarrier_success() local
47 if (sys_membarrier(cmd, flags) != 0) { test_membarrier_success()
/linux-4.4.14/drivers/video/fbdev/savage/
H A Dsavagefb_accel.c36 int cmd; savagefb_copyarea() local
41 cmd = BCI_CMD_RECT | BCI_CMD_DEST_GBD | BCI_CMD_SRC_GBD; savagefb_copyarea()
42 BCI_CMD_SET_ROP(cmd, savagefb_rop[0]); savagefb_copyarea()
45 cmd |= BCI_CMD_RECT_XP; savagefb_copyarea()
52 cmd |= BCI_CMD_RECT_YP; savagefb_copyarea()
59 BCI_SEND(cmd); savagefb_copyarea()
68 int cmd, color; savagefb_fillrect() local
78 cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP | savagefb_fillrect()
83 BCI_CMD_SET_ROP(cmd, savagefb_rop[rect->rop]); savagefb_fillrect()
86 BCI_SEND(cmd); savagefb_fillrect()
96 int cmd; savagefb_imageblit() local
115 cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP | savagefb_imageblit()
120 BCI_CMD_SET_ROP(cmd, savagefb_rop[0]); savagefb_imageblit()
127 BCI_SEND(cmd); savagefb_imageblit()
/linux-4.4.14/arch/powerpc/kernel/
H A Dsmp-tbsync.c26 volatile int cmd; member in struct:__anon2367
46 int cmd; smp_generic_take_timebase() local
61 cmd = tbsync->cmd; smp_generic_take_timebase()
65 if (cmd == kExit) smp_generic_take_timebase()
70 if (cmd == kSetAndTest) smp_generic_take_timebase()
77 static int start_contest(int cmd, long offset, int num) start_contest() argument
83 tbsync->cmd = cmd; start_contest()
161 tbsync->cmd = kExit; smp_generic_give_timebase()
/linux-4.4.14/arch/cris/arch-v10/kernel/
H A Ddma.c231 *R_DMA_CH0_CMD = IO_STATE(R_DMA_CH0_CMD, cmd, reset); cris_free_dma()
232 while (IO_EXTRACT(R_DMA_CH0_CMD, cmd, *R_DMA_CH0_CMD) == cris_free_dma()
233 IO_STATE_VALUE(R_DMA_CH0_CMD, cmd, reset)); cris_free_dma()
236 *R_DMA_CH1_CMD = IO_STATE(R_DMA_CH1_CMD, cmd, reset); cris_free_dma()
237 while (IO_EXTRACT(R_DMA_CH1_CMD, cmd, *R_DMA_CH1_CMD) == cris_free_dma()
238 IO_STATE_VALUE(R_DMA_CH1_CMD, cmd, reset)); cris_free_dma()
241 *R_DMA_CH2_CMD = IO_STATE(R_DMA_CH2_CMD, cmd, reset); cris_free_dma()
242 while (IO_EXTRACT(R_DMA_CH2_CMD, cmd, *R_DMA_CH2_CMD) == cris_free_dma()
243 IO_STATE_VALUE(R_DMA_CH2_CMD, cmd, reset)); cris_free_dma()
246 *R_DMA_CH3_CMD = IO_STATE(R_DMA_CH3_CMD, cmd, reset); cris_free_dma()
247 while (IO_EXTRACT(R_DMA_CH3_CMD, cmd, *R_DMA_CH3_CMD) == cris_free_dma()
248 IO_STATE_VALUE(R_DMA_CH3_CMD, cmd, reset)); cris_free_dma()
251 *R_DMA_CH4_CMD = IO_STATE(R_DMA_CH4_CMD, cmd, reset); cris_free_dma()
252 while (IO_EXTRACT(R_DMA_CH4_CMD, cmd, *R_DMA_CH4_CMD) == cris_free_dma()
253 IO_STATE_VALUE(R_DMA_CH4_CMD, cmd, reset)); cris_free_dma()
256 *R_DMA_CH5_CMD = IO_STATE(R_DMA_CH5_CMD, cmd, reset); cris_free_dma()
257 while (IO_EXTRACT(R_DMA_CH5_CMD, cmd, *R_DMA_CH5_CMD) == cris_free_dma()
258 IO_STATE_VALUE(R_DMA_CH5_CMD, cmd, reset)); cris_free_dma()
261 *R_DMA_CH6_CMD = IO_STATE(R_DMA_CH6_CMD, cmd, reset); cris_free_dma()
262 while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *R_DMA_CH6_CMD) == cris_free_dma()
263 IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset)); cris_free_dma()
266 *R_DMA_CH7_CMD = IO_STATE(R_DMA_CH7_CMD, cmd, reset); cris_free_dma()
267 while (IO_EXTRACT(R_DMA_CH7_CMD, cmd, *R_DMA_CH7_CMD) == cris_free_dma()
268 IO_STATE_VALUE(R_DMA_CH7_CMD, cmd, reset)); cris_free_dma()
271 *R_DMA_CH8_CMD = IO_STATE(R_DMA_CH8_CMD, cmd, reset); cris_free_dma()
272 while (IO_EXTRACT(R_DMA_CH8_CMD, cmd, *R_DMA_CH8_CMD) == cris_free_dma()
273 IO_STATE_VALUE(R_DMA_CH8_CMD, cmd, reset)); cris_free_dma()
276 *R_DMA_CH9_CMD = IO_STATE(R_DMA_CH9_CMD, cmd, reset); cris_free_dma()
277 while (IO_EXTRACT(R_DMA_CH9_CMD, cmd, *R_DMA_CH9_CMD) == cris_free_dma()
278 IO_STATE_VALUE(R_DMA_CH9_CMD, cmd, reset)); cris_free_dma()
/linux-4.4.14/drivers/crypto/ccp/
H A Dccp-dev.c37 struct ccp_cmd *cmd; member in struct:ccp_tasklet_data
73 * @cmd: ccp_cmd struct to be processed
75 * Queue a cmd to be processed by the CCP. If queueing the cmd
76 * would exceed the defined length of the cmd queue the cmd will
81 * called to notify the caller of completion (if the cmd was not
82 * backlogged) or advancement out of the backlog. If the cmd has
87 * The cmd has been successfully queued if:
91 int ccp_enqueue_cmd(struct ccp_cmd *cmd) ccp_enqueue_cmd() argument
102 if (!cmd->callback) ccp_enqueue_cmd()
105 cmd->ccp = ccp; ccp_enqueue_cmd()
113 if (cmd->flags & CCP_CMD_MAY_BACKLOG) ccp_enqueue_cmd()
114 list_add_tail(&cmd->entry, &ccp->backlog); ccp_enqueue_cmd()
118 list_add_tail(&cmd->entry, &ccp->cmd); ccp_enqueue_cmd()
143 struct ccp_cmd *cmd = container_of(work, struct ccp_cmd, work); ccp_do_cmd_backlog() local
144 struct ccp_device *ccp = cmd->ccp; ccp_do_cmd_backlog()
148 cmd->callback(cmd->data, -EINPROGRESS); ccp_do_cmd_backlog()
153 list_add_tail(&cmd->entry, &ccp->cmd); ccp_do_cmd_backlog()
173 struct ccp_cmd *cmd = NULL; ccp_dequeue_cmd() local
193 cmd = list_first_entry(&ccp->cmd, struct ccp_cmd, entry); ccp_dequeue_cmd()
194 list_del(&cmd->entry); ccp_dequeue_cmd()
212 return cmd; ccp_dequeue_cmd()
218 struct ccp_cmd *cmd = tdata->cmd; ccp_do_cmd_complete() local
220 cmd->callback(cmd->data, cmd->ret); ccp_do_cmd_complete()
227 struct ccp_cmd *cmd; ccp_cmd_queue_thread() local
239 cmd = ccp_dequeue_cmd(cmd_q); ccp_cmd_queue_thread()
240 if (!cmd) ccp_cmd_queue_thread()
246 cmd->ret = ccp_run_cmd(cmd_q, cmd); ccp_cmd_queue_thread()
249 tdata.cmd = cmd; ccp_cmd_queue_thread()
303 INIT_LIST_HEAD(&ccp->cmd); ccp_alloc_struct()
470 struct ccp_cmd *cmd; ccp_destroy() local
506 /* Flush the cmd and backlog queue */ ccp_destroy()
507 while (!list_empty(&ccp->cmd)) { ccp_destroy()
509 cmd = list_first_entry(&ccp->cmd, struct ccp_cmd, entry); ccp_destroy()
510 list_del(&cmd->entry); ccp_destroy()
511 cmd->callback(cmd->data, -ENODEV); ccp_destroy()
515 cmd = list_first_entry(&ccp->backlog, struct ccp_cmd, entry); ccp_destroy()
516 list_del(&cmd->entry); ccp_destroy()
517 cmd->callback(cmd->data, -ENODEV); ccp_destroy()
H A Dccp-crypto-main.c42 * than one cmd at a time. Therefore we must maintain a cmd list to insure
59 struct ccp_cmd *cmd; member in struct:ccp_crypto_cmd
98 /* Held cmds will be after the current cmd in the queue so start ccp_crypto_cmd_complete()
99 * searching for a cmd with a matching tfm for submission. ccp_crypto_cmd_complete()
110 * Because cmds can be executed from any point in the cmd list ccp_crypto_cmd_complete()
114 /* Skip over this cmd if it is the next backlog cmd */ ccp_crypto_cmd_complete()
122 /* Skip over this cmd if it is now the next backlog cmd */ ccp_crypto_cmd_complete()
127 /* Remove the cmd entry from the list of cmds */ ccp_crypto_cmd_complete()
155 * the completion callbacks and retrieve the next cmd (cmd with ccp_crypto_complete()
174 /* Submit the next cmd */ ccp_crypto_complete()
176 /* Since we have already queued the cmd, we must indicate that ccp_crypto_complete()
179 held->cmd->flags |= CCP_CMD_MAY_BACKLOG; ccp_crypto_complete()
180 ret = ccp_enqueue_cmd(held->cmd); ccp_crypto_complete()
212 /* Check if the cmd can/should be queued */ ccp_crypto_enqueue_cmd()
215 if (!(crypto_cmd->cmd->flags & CCP_CMD_MAY_BACKLOG)) ccp_crypto_enqueue_cmd()
219 /* Look for an entry with the same tfm. If there is a cmd ccp_crypto_enqueue_cmd()
220 * with the same tfm in the list then the current cmd cannot ccp_crypto_enqueue_cmd()
232 ret = ccp_enqueue_cmd(crypto_cmd->cmd); ccp_crypto_enqueue_cmd()
236 !(crypto_cmd->cmd->flags & CCP_CMD_MAY_BACKLOG)) ccp_crypto_enqueue_cmd()
266 * @cmd: ccp_cmd struct to be sent to the CCP
269 struct ccp_cmd *cmd) ccp_crypto_enqueue_request()
285 crypto_cmd->cmd = cmd; ccp_crypto_enqueue_request()
289 cmd->callback = ccp_crypto_complete; ccp_crypto_enqueue_request()
290 cmd->data = crypto_cmd; ccp_crypto_enqueue_request()
293 cmd->flags |= CCP_CMD_MAY_BACKLOG; ccp_crypto_enqueue_request()
295 cmd->flags &= ~CCP_CMD_MAY_BACKLOG; ccp_crypto_enqueue_request()
268 ccp_crypto_enqueue_request(struct crypto_async_request *req, struct ccp_cmd *cmd) ccp_crypto_enqueue_request() argument
/linux-4.4.14/drivers/gpu/drm/udl/
H A Dudl_transfer.c115 * the rlx command simply assumes alternating raw and rl spans within one cmd.
131 uint8_t *cmd = *command_buffer_ptr; udl_compress_hline16() local
134 (cmd_buffer_end - MIN_RLX_CMD_BYTES > cmd)) { udl_compress_hline16()
141 prefetchw((void *) cmd); /* pull in one cache line at least */ udl_compress_hline16()
143 *cmd++ = 0xaf; udl_compress_hline16()
144 *cmd++ = 0x6b; udl_compress_hline16()
145 *cmd++ = (uint8_t) ((dev_addr >> 16) & 0xFF); udl_compress_hline16()
146 *cmd++ = (uint8_t) ((dev_addr >> 8) & 0xFF); udl_compress_hline16()
147 *cmd++ = (uint8_t) ((dev_addr) & 0xFF); udl_compress_hline16()
149 cmd_pixels_count_byte = cmd++; /* we'll know this later */ udl_compress_hline16()
152 raw_pixels_count_byte = cmd++; /* we'll know this later */ udl_compress_hline16()
157 (int)(cmd_buffer_end - cmd) / 2))) * bpp; udl_compress_hline16()
166 *(uint16_t *)cmd = cpu_to_be16(pixel_val16); udl_compress_hline16()
168 cmd += 2; udl_compress_hline16()
184 *cmd++ = (((pixel - start) / bpp) - 1) & 0xFF; udl_compress_hline16()
188 raw_pixels_count_byte = cmd++; udl_compress_hline16()
201 if (cmd_buffer_end <= MIN_RLX_CMD_BYTES + cmd) { udl_compress_hline16()
203 if (cmd_buffer_end > cmd) udl_compress_hline16()
204 memset(cmd, 0xAF, cmd_buffer_end - cmd); udl_compress_hline16()
205 cmd = (uint8_t *) cmd_buffer_end; udl_compress_hline16()
208 *command_buffer_ptr = cmd; udl_compress_hline16()
230 u8 *cmd = *urb_buf_ptr; udl_render_hline() local
243 (u8 **) &cmd, (u8 *) cmd_end, bpp); udl_render_hline()
245 if (cmd >= cmd_end) { udl_render_hline()
246 int len = cmd - (u8 *) urb->transfer_buffer; udl_render_hline()
254 cmd = urb->transfer_buffer; udl_render_hline()
255 cmd_end = &cmd[urb->transfer_buffer_length]; udl_render_hline()
259 *urb_buf_ptr = cmd; udl_render_hline()
/linux-4.4.14/drivers/char/tpm/
H A Dtpm2-cmd.c252 struct tpm2_cmd cmd; tpm2_pcr_read() local
258 cmd.header.in = tpm2_pcrread_header; tpm2_pcr_read()
259 cmd.params.pcrread_in.pcr_selects_cnt = cpu_to_be32(1); tpm2_pcr_read()
260 cmd.params.pcrread_in.hash_alg = cpu_to_be16(TPM2_ALG_SHA1); tpm2_pcr_read()
261 cmd.params.pcrread_in.pcr_select_size = TPM2_PCR_SELECT_MIN; tpm2_pcr_read()
263 memset(cmd.params.pcrread_in.pcr_select, 0, tpm2_pcr_read()
264 sizeof(cmd.params.pcrread_in.pcr_select)); tpm2_pcr_read()
265 cmd.params.pcrread_in.pcr_select[pcr_idx >> 3] = 1 << (pcr_idx & 0x7); tpm2_pcr_read()
267 rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), tpm2_pcr_read()
270 buf = cmd.params.pcrread_out.digest; tpm2_pcr_read()
299 struct tpm2_cmd cmd; tpm2_pcr_extend() local
302 cmd.header.in = tpm2_pcrextend_header; tpm2_pcr_extend()
303 cmd.params.pcrextend_in.pcr_idx = cpu_to_be32(pcr_idx); tpm2_pcr_extend()
304 cmd.params.pcrextend_in.auth_area_size = tpm2_pcr_extend()
306 cmd.params.pcrextend_in.auth_area.handle = tpm2_pcr_extend()
308 cmd.params.pcrextend_in.auth_area.nonce_size = 0; tpm2_pcr_extend()
309 cmd.params.pcrextend_in.auth_area.attributes = 0; tpm2_pcr_extend()
310 cmd.params.pcrextend_in.auth_area.auth_size = 0; tpm2_pcr_extend()
311 cmd.params.pcrextend_in.digest_cnt = cpu_to_be32(1); tpm2_pcr_extend()
312 cmd.params.pcrextend_in.hash_alg = cpu_to_be16(TPM2_ALG_SHA1); tpm2_pcr_extend()
313 memcpy(cmd.params.pcrextend_in.digest, hash, TPM_DIGEST_SIZE); tpm2_pcr_extend()
315 rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), tpm2_pcr_extend()
343 struct tpm2_cmd cmd; tpm2_get_random() local
351 num_bytes = min_t(u32, max, sizeof(cmd.params.getrandom_out.buffer)); tpm2_get_random()
354 max > sizeof(cmd.params.getrandom_out.buffer)) tpm2_get_random()
358 cmd.header.in = tpm2_getrandom_header; tpm2_get_random()
359 cmd.params.getrandom_in.size = cpu_to_be16(num_bytes); tpm2_get_random()
361 err = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), tpm2_get_random()
366 recd = min_t(u32, be16_to_cpu(cmd.params.getrandom_out.size), tpm2_get_random()
368 memcpy(dest, cmd.params.getrandom_out.buffer, recd); tpm2_get_random()
650 struct tpm2_cmd cmd; tpm2_get_tpm_pt() local
653 cmd.header.in = tpm2_get_tpm_pt_header; tpm2_get_tpm_pt()
654 cmd.params.get_tpm_pt_in.cap_id = cpu_to_be32(TPM2_CAP_TPM_PROPERTIES); tpm2_get_tpm_pt()
655 cmd.params.get_tpm_pt_in.property_id = cpu_to_be32(property_id); tpm2_get_tpm_pt()
656 cmd.params.get_tpm_pt_in.property_cnt = cpu_to_be32(1); tpm2_get_tpm_pt()
658 rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), desc); tpm2_get_tpm_pt()
660 *value = cmd.params.get_tpm_pt_out.value; tpm2_get_tpm_pt()
687 struct tpm2_cmd cmd; tpm2_startup() local
689 cmd.header.in = tpm2_startup_header; tpm2_startup()
691 cmd.params.startup_in.startup_type = cpu_to_be16(startup_type); tpm2_startup()
692 return tpm_transmit_cmd(chip, &cmd, sizeof(cmd), tpm2_startup()
715 struct tpm2_cmd cmd; tpm2_shutdown() local
718 cmd.header.in = tpm2_shutdown_header; tpm2_shutdown()
719 cmd.params.startup_in.startup_type = cpu_to_be16(shutdown_type); tpm2_shutdown()
721 rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), "stopping the TPM"); tpm2_shutdown()
782 struct tpm2_cmd cmd; tpm2_start_selftest() local
784 cmd.header.in = tpm2_selftest_header; tpm2_start_selftest()
785 cmd.params.selftest_in.full_test = full; tpm2_start_selftest()
787 rc = tpm_transmit_cmd(chip, &cmd, TPM2_SELF_TEST_IN_SIZE, tpm2_start_selftest()
818 struct tpm2_cmd cmd; tpm2_do_selftest() local
831 cmd.header.in = tpm2_pcrread_header; tpm2_do_selftest()
832 cmd.params.pcrread_in.pcr_selects_cnt = cpu_to_be32(1); tpm2_do_selftest()
833 cmd.params.pcrread_in.hash_alg = cpu_to_be16(TPM2_ALG_SHA1); tpm2_do_selftest()
834 cmd.params.pcrread_in.pcr_select_size = TPM2_PCR_SELECT_MIN; tpm2_do_selftest()
835 cmd.params.pcrread_in.pcr_select[0] = 0x01; tpm2_do_selftest()
836 cmd.params.pcrread_in.pcr_select[1] = 0x00; tpm2_do_selftest()
837 cmd.params.pcrread_in.pcr_select[2] = 0x00; tpm2_do_selftest()
839 rc = tpm_transmit_cmd(chip, (u8 *) &cmd, sizeof(cmd), NULL); tpm2_do_selftest()
843 rc = be32_to_cpu(cmd.header.out.return_code); tpm2_do_selftest()
880 struct tpm2_cmd cmd; tpm2_probe() local
883 cmd.header.in = tpm2_get_tpm_pt_header; tpm2_probe()
884 cmd.params.get_tpm_pt_in.cap_id = cpu_to_be32(TPM2_CAP_TPM_PROPERTIES); tpm2_probe()
885 cmd.params.get_tpm_pt_in.property_id = cpu_to_be32(0x100); tpm2_probe()
886 cmd.params.get_tpm_pt_in.property_cnt = cpu_to_be32(1); tpm2_probe()
888 rc = tpm_transmit(chip, (const char *) &cmd, sizeof(cmd)); tpm2_probe()
894 if (be16_to_cpu(cmd.header.out.tag) == TPM2_ST_NO_SESSIONS) tpm2_probe()
/linux-4.4.14/drivers/w1/
H A Dw1_netlink.c47 struct w1_netlink_cmd *cmd; /* advances as cmds are appened */ member in struct:w1_cb_block
109 block->cmd = NULL; w1_reply_make_space()
148 /* Append cmd to msg, include cmd->data as well. This is because
153 struct w1_netlink_cmd *cmd) w1_netlink_queue_cmd()
157 sizeof(struct w1_netlink_msg) + sizeof(*cmd) + cmd->len); w1_netlink_queue_cmd()
160 * in trying to bundle this cmd after an existing one, because w1_netlink_queue_cmd()
167 block->cmd = (struct w1_netlink_cmd *)(block->msg->data); w1_netlink_queue_cmd()
169 space = sizeof(*cmd) + cmd->len; w1_netlink_queue_cmd()
170 if (block->cmd != cmd) w1_netlink_queue_cmd()
171 memcpy(block->cmd, cmd, space); w1_netlink_queue_cmd()
192 struct w1_netlink_cmd *cmd = (struct w1_netlink_cmd *)block->msg->data; w1_netlink_queue_status() local
193 memcpy(cmd, req_cmd, sizeof(*cmd)); w1_netlink_queue_status()
194 block->cn->len += sizeof(*cmd); w1_netlink_queue_status()
195 block->msg->len += sizeof(*cmd); w1_netlink_queue_status()
196 cmd->len = 0; w1_netlink_queue_status()
256 struct w1_netlink_cmd *cache_cmd = block->cmd; w1_send_slave()
261 /* Add cmd back if the packet was sent */ w1_send_slave()
262 if (!block->cmd) { w1_send_slave()
267 data = (u64 *)(block->cmd->data + block->cmd->len); w1_send_slave()
272 block->cmd->len += sizeof(*data); w1_send_slave()
291 if (req_cmd->cmd == W1_CMD_LIST_SLAVES) { w1_get_slaves()
300 w1_search_process_cb(dev, req_cmd->cmd == W1_CMD_ALARM_SEARCH ? w1_get_slaves()
308 struct w1_netlink_cmd *cmd) w1_process_command_io()
312 switch (cmd->cmd) { w1_process_command_io()
314 w1_touch_block(dev, cmd->data, cmd->len); w1_process_command_io()
315 w1_netlink_queue_cmd(dev->priv, cmd); w1_process_command_io()
318 w1_read_block(dev, cmd->data, cmd->len); w1_process_command_io()
319 w1_netlink_queue_cmd(dev->priv, cmd); w1_process_command_io()
322 w1_write_block(dev, cmd->data, cmd->len); w1_process_command_io()
333 struct w1_netlink_cmd *cmd) w1_process_command_addremove()
339 if (cmd->len != sizeof(*id)) w1_process_command_addremove()
342 id = (struct w1_reg_num *)cmd->data; w1_process_command_addremove()
345 switch (cmd->cmd) { w1_process_command_addremove()
374 switch (req_cmd->cmd) { w1_process_command_master()
407 struct w1_netlink_cmd *cmd) w1_process_command_slave()
409 dev_dbg(&sl->master->dev, "%s: %02x.%012llx.%02x: cmd=%02x, len=%u.\n", w1_process_command_slave()
411 sl->reg_num.crc, cmd->cmd, cmd->len); w1_process_command_slave()
413 return w1_process_command_io(sl->master, cmd); w1_process_command_slave()
469 struct w1_netlink_cmd *cmd = (struct w1_netlink_cmd *)node->msg->data; w1_process_cb() local
478 if (cmd->len + sizeof(struct w1_netlink_cmd) > mlen) { w1_process_cb()
484 err = w1_process_command_slave(sl, cmd); w1_process_cb()
486 err = w1_process_command_master(dev, cmd); w1_process_cb()
489 w1_netlink_queue_status(node->block, node->msg, cmd, err); w1_process_cb()
492 len = sizeof(*cmd) + cmd->len; w1_process_cb()
493 cmd = (struct w1_netlink_cmd *)((u8 *)cmd + len); w1_process_cb()
497 if (!cmd || err) w1_process_cb()
498 w1_netlink_queue_status(node->block, node->msg, cmd, err); w1_process_cb()
520 struct w1_netlink_cmd *cmd = (struct w1_netlink_cmd *)msg->data; w1_list_count_cmds() local
525 if (cmd->len + sizeof(struct w1_netlink_cmd) > mlen) w1_list_count_cmds()
528 switch (cmd->cmd) { w1_list_count_cmds()
535 len = sizeof(*cmd) + cmd->len; w1_list_count_cmds()
536 cmd = (struct w1_netlink_cmd *)((u8 *)cmd + len); w1_list_count_cmds()
611 * one node per cmd to point into the original message, w1_cn_callback()
152 w1_netlink_queue_cmd(struct w1_cb_block *block, struct w1_netlink_cmd *cmd) w1_netlink_queue_cmd() argument
307 w1_process_command_io(struct w1_master *dev, struct w1_netlink_cmd *cmd) w1_process_command_io() argument
332 w1_process_command_addremove(struct w1_master *dev, struct w1_netlink_cmd *cmd) w1_process_command_addremove() argument
406 w1_process_command_slave(struct w1_slave *sl, struct w1_netlink_cmd *cmd) w1_process_command_slave() argument
/linux-4.4.14/include/linux/reset/
H A Dbcm63xx_pmb.h45 u32 cmd; __bpcm_do_op() local
47 cmd = (PMC_PMBM_START | op | (addr & 0xff) << 12 | off); __bpcm_do_op()
48 writel(cmd, master + PMB_CTRL); __bpcm_do_op()
50 cmd = readl(master + PMB_CTRL); __bpcm_do_op()
51 if (!(cmd & PMC_PMBM_START)) __bpcm_do_op()
54 if (cmd & PMC_PMBM_SLAVE_ERR) __bpcm_do_op()
57 if (cmd & PMC_PMBM_TIMEOUT) __bpcm_do_op()
/linux-4.4.14/sound/pci/hda/
H A Dhda_controller_trace.h15 TP_PROTO(struct azx *chip, struct azx_dev *dev, int cmd),
17 TP_ARGS(chip, dev, cmd),
22 __field( int, cmd )
28 __entry->cmd = cmd;
31 TP_printk("[%d:%d] cmd=%d", __entry->card, __entry->idx, __entry->cmd)
/linux-4.4.14/drivers/net/ethernet/mellanox/mlx4/
H A Den_ethtool.c729 struct ethtool_cmd *cmd) ethtool_get_ptys_settings()
757 cmd->supported = 0; ethtool_get_ptys_settings()
758 cmd->advertising = 0; ethtool_get_ptys_settings()
760 cmd->supported |= ptys_get_supported_port(&ptys_reg); ethtool_get_ptys_settings()
763 cmd->supported |= ptys2ethtool_link_modes(eth_proto, SUPPORTED); ethtool_get_ptys_settings()
766 cmd->advertising |= ptys2ethtool_link_modes(eth_proto, ADVERTISED); ethtool_get_ptys_settings()
768 cmd->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause; ethtool_get_ptys_settings()
769 cmd->advertising |= (priv->prof->tx_pause) ? ADVERTISED_Pause : 0; ethtool_get_ptys_settings()
771 cmd->advertising |= (priv->prof->tx_pause ^ priv->prof->rx_pause) ? ethtool_get_ptys_settings()
774 cmd->port = ptys_get_active_port(&ptys_reg); ethtool_get_ptys_settings()
775 cmd->transceiver = (SUPPORTED_TP & cmd->supported) ? ethtool_get_ptys_settings()
779 cmd->supported |= SUPPORTED_Autoneg; ethtool_get_ptys_settings()
780 cmd->advertising |= ADVERTISED_Autoneg; ethtool_get_ptys_settings()
783 cmd->autoneg = (priv->port_state.flags & MLX4_EN_PORT_ANC) ? ethtool_get_ptys_settings()
787 cmd->lp_advertising = ptys2ethtool_link_modes(eth_proto, ADVERTISED); ethtool_get_ptys_settings()
789 cmd->lp_advertising |= (priv->port_state.flags & MLX4_EN_PORT_ANC) ? ethtool_get_ptys_settings()
792 cmd->phy_address = 0; ethtool_get_ptys_settings()
793 cmd->mdio_support = 0; ethtool_get_ptys_settings()
794 cmd->maxtxpkt = 0; ethtool_get_ptys_settings()
795 cmd->maxrxpkt = 0; ethtool_get_ptys_settings()
796 cmd->eth_tp_mdix = ETH_TP_MDI_INVALID; ethtool_get_ptys_settings()
797 cmd->eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO; ethtool_get_ptys_settings()
803 struct ethtool_cmd *cmd) ethtool_get_default_settings()
808 cmd->autoneg = AUTONEG_DISABLE; ethtool_get_default_settings()
809 cmd->supported = SUPPORTED_10000baseT_Full; ethtool_get_default_settings()
810 cmd->advertising = ADVERTISED_10000baseT_Full; ethtool_get_default_settings()
814 cmd->port = PORT_FIBRE; ethtool_get_default_settings()
815 cmd->transceiver = XCVR_EXTERNAL; ethtool_get_default_settings()
816 cmd->supported |= SUPPORTED_FIBRE; ethtool_get_default_settings()
817 cmd->advertising |= ADVERTISED_FIBRE; ethtool_get_default_settings()
819 cmd->port = PORT_TP; ethtool_get_default_settings()
820 cmd->transceiver = XCVR_INTERNAL; ethtool_get_default_settings()
821 cmd->supported |= SUPPORTED_TP; ethtool_get_default_settings()
822 cmd->advertising |= ADVERTISED_TP; ethtool_get_default_settings()
824 cmd->port = -1; ethtool_get_default_settings()
825 cmd->transceiver = -1; ethtool_get_default_settings()
829 static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) mlx4_en_get_settings() argument
842 ret = ethtool_get_ptys_settings(dev, cmd); mlx4_en_get_settings()
844 ethtool_get_default_settings(dev, cmd); mlx4_en_get_settings()
847 ethtool_cmd_speed_set(cmd, priv->port_state.link_speed); mlx4_en_get_settings()
848 cmd->duplex = DUPLEX_FULL; mlx4_en_get_settings()
850 ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN); mlx4_en_get_settings()
851 cmd->duplex = DUPLEX_UNKNOWN; mlx4_en_get_settings()
875 static int mlx4_en_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) mlx4_en_set_settings() argument
882 u32 ptys_adv = ethtool2ptys_link_modes(cmd->advertising, ADVERTISED); mlx4_en_set_settings()
883 int speed = ethtool_cmd_speed(cmd); mlx4_en_set_settings()
886 speed, cmd->advertising, cmd->autoneg, cmd->duplex); mlx4_en_set_settings()
889 (cmd->duplex == DUPLEX_HALF)) mlx4_en_set_settings()
903 proto_admin = cmd->autoneg == AUTONEG_ENABLE ? mlx4_en_set_settings()
1225 struct ethtool_rxnfc *cmd) mlx4_en_validate_flow()
1231 if (cmd->fs.location >= MAX_NUM_OF_FS_RULES) mlx4_en_validate_flow()
1234 if (cmd->fs.flow_type & FLOW_MAC_EXT) { mlx4_en_validate_flow()
1236 if (!is_broadcast_ether_addr(cmd->fs.m_ext.h_dest)) mlx4_en_validate_flow()
1240 switch (cmd->fs.flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) { mlx4_en_validate_flow()
1243 if (cmd->fs.m_u.tcp_ip4_spec.tos) mlx4_en_validate_flow()
1245 l4_mask = &cmd->fs.m_u.tcp_ip4_spec; mlx4_en_validate_flow()
1254 l3_mask = &cmd->fs.m_u.usr_ip4_spec; mlx4_en_validate_flow()
1256 cmd->fs.h_u.usr_ip4_spec.ip_ver != ETH_RX_NFC_IP4 || mlx4_en_validate_flow()
1263 eth_mask = &cmd->fs.m_u.ether_spec; mlx4_en_validate_flow()
1279 if ((cmd->fs.flow_type & FLOW_EXT)) { mlx4_en_validate_flow()
1280 if (cmd->fs.m_ext.vlan_etype || mlx4_en_validate_flow()
1281 !((cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK)) == mlx4_en_validate_flow()
1283 (cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK)) == mlx4_en_validate_flow()
1287 if (cmd->fs.m_ext.vlan_tci) { mlx4_en_validate_flow()
1288 if (be16_to_cpu(cmd->fs.h_ext.vlan_tci) >= VLAN_N_VID) mlx4_en_validate_flow()
1297 static int mlx4_en_ethtool_add_mac_rule(struct ethtool_rxnfc *cmd, mlx4_en_ethtool_add_mac_rule() argument
1309 if ((cmd->fs.flow_type & FLOW_EXT) && mlx4_en_ethtool_add_mac_rule()
1310 (cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK))) { mlx4_en_ethtool_add_mac_rule()
1311 spec_l2->eth.vlan_id = cmd->fs.h_ext.vlan_tci; mlx4_en_ethtool_add_mac_rule()
1321 struct ethtool_rxnfc *cmd, mlx4_en_ethtool_add_mac_rule_by_ipv4()
1330 if (cmd->fs.flow_type & FLOW_MAC_EXT) mlx4_en_ethtool_add_mac_rule_by_ipv4()
1331 memcpy(&mac, cmd->fs.h_ext.h_dest, ETH_ALEN); mlx4_en_ethtool_add_mac_rule_by_ipv4()
1338 return mlx4_en_ethtool_add_mac_rule(cmd, rule_list_h, spec_l2, &mac[0]); mlx4_en_ethtool_add_mac_rule_by_ipv4()
1345 struct ethtool_rxnfc *cmd, add_ip_rule()
1351 struct ethtool_usrip4_spec *l3_mask = &cmd->fs.m_u.usr_ip4_spec; add_ip_rule()
1360 err = mlx4_en_ethtool_add_mac_rule_by_ipv4(priv, cmd, list_h, spec_l2, add_ip_rule()
1361 cmd->fs.h_u. add_ip_rule()
1366 spec_l3->ipv4.src_ip = cmd->fs.h_u.usr_ip4_spec.ip4src; add_ip_rule()
1369 spec_l3->ipv4.dst_ip = cmd->fs.h_u.usr_ip4_spec.ip4dst; add_ip_rule()
1383 struct ethtool_rxnfc *cmd, add_tcp_udp_rule()
1390 struct ethtool_tcpip4_spec *l4_mask = &cmd->fs.m_u.tcp_ip4_spec; add_tcp_udp_rule()
1403 err = mlx4_en_ethtool_add_mac_rule_by_ipv4(priv, cmd, list_h, add_tcp_udp_rule()
1405 cmd->fs.h_u. add_tcp_udp_rule()
1410 spec_l3->ipv4.src_ip = cmd->fs.h_u.tcp_ip4_spec.ip4src; add_tcp_udp_rule()
1411 spec_l3->ipv4.dst_ip = cmd->fs.h_u.tcp_ip4_spec.ip4dst; add_tcp_udp_rule()
1412 spec_l4->tcp_udp.src_port = cmd->fs.h_u.tcp_ip4_spec.psrc; add_tcp_udp_rule()
1413 spec_l4->tcp_udp.dst_port = cmd->fs.h_u.tcp_ip4_spec.pdst; add_tcp_udp_rule()
1415 err = mlx4_en_ethtool_add_mac_rule_by_ipv4(priv, cmd, list_h, add_tcp_udp_rule()
1417 cmd->fs.h_u. add_tcp_udp_rule()
1422 spec_l3->ipv4.src_ip = cmd->fs.h_u.udp_ip4_spec.ip4src; add_tcp_udp_rule()
1423 spec_l3->ipv4.dst_ip = cmd->fs.h_u.udp_ip4_spec.ip4dst; add_tcp_udp_rule()
1424 spec_l4->tcp_udp.src_port = cmd->fs.h_u.udp_ip4_spec.psrc; add_tcp_udp_rule()
1425 spec_l4->tcp_udp.dst_port = cmd->fs.h_u.udp_ip4_spec.pdst; add_tcp_udp_rule()
1451 struct ethtool_rxnfc *cmd, mlx4_en_ethtool_to_net_trans_rule()
1459 err = mlx4_en_validate_flow(dev, cmd); mlx4_en_ethtool_to_net_trans_rule()
1463 switch (cmd->fs.flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) { mlx4_en_ethtool_to_net_trans_rule()
1469 eth_spec = &cmd->fs.h_u.ether_spec; mlx4_en_ethtool_to_net_trans_rule()
1470 mlx4_en_ethtool_add_mac_rule(cmd, rule_list_h, spec_l2, mlx4_en_ethtool_to_net_trans_rule()
1477 err = add_ip_rule(priv, cmd, rule_list_h); mlx4_en_ethtool_to_net_trans_rule()
1480 err = add_tcp_udp_rule(priv, cmd, rule_list_h, TCP_V4_FLOW); mlx4_en_ethtool_to_net_trans_rule()
1483 err = add_tcp_udp_rule(priv, cmd, rule_list_h, UDP_V4_FLOW); mlx4_en_ethtool_to_net_trans_rule()
1491 struct ethtool_rxnfc *cmd) mlx4_en_flow_replace()
1508 rule.priority = MLX4_DOMAIN_ETHTOOL | cmd->fs.location; mlx4_en_flow_replace()
1512 if (cmd->fs.ring_cookie == RX_CLS_FLOW_DISC) mlx4_en_flow_replace()
1514 else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) { mlx4_en_flow_replace()
1515 qpn = cmd->fs.ring_cookie & (EN_ETHTOOL_QP_ATTACH - 1); mlx4_en_flow_replace()
1517 if (cmd->fs.ring_cookie >= priv->rx_ring_num) { mlx4_en_flow_replace()
1519 cmd->fs.ring_cookie); mlx4_en_flow_replace()
1522 qpn = priv->rss_map.qps[cmd->fs.ring_cookie].qpn; mlx4_en_flow_replace()
1525 cmd->fs.ring_cookie); mlx4_en_flow_replace()
1530 err = mlx4_en_ethtool_to_net_trans_rule(dev, cmd, &rule.list); mlx4_en_flow_replace()
1534 loc_rule = &priv->ethtool_rules[cmd->fs.location]; mlx4_en_flow_replace()
1539 cmd->fs.location, loc_rule->id); mlx4_en_flow_replace()
1550 cmd->fs.location); mlx4_en_flow_replace()
1554 memcpy(&loc_rule->flow_spec, &cmd->fs, mlx4_en_flow_replace()
1567 struct ethtool_rxnfc *cmd) mlx4_en_flow_detach()
1573 if (cmd->fs.location >= MAX_NUM_OF_FS_RULES) mlx4_en_flow_detach()
1576 rule = &priv->ethtool_rules[cmd->fs.location]; mlx4_en_flow_detach()
1585 cmd->fs.location, rule->id); mlx4_en_flow_detach()
1596 static int mlx4_en_get_flow(struct net_device *dev, struct ethtool_rxnfc *cmd, mlx4_en_get_flow() argument
1608 memcpy(&cmd->fs, &rule->flow_spec, mlx4_en_get_flow()
1628 static int mlx4_en_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, mlx4_en_get_rxnfc() argument
1636 if ((cmd->cmd == ETHTOOL_GRXCLSRLCNT || mlx4_en_get_rxnfc()
1637 cmd->cmd == ETHTOOL_GRXCLSRULE || mlx4_en_get_rxnfc()
1638 cmd->cmd == ETHTOOL_GRXCLSRLALL) && mlx4_en_get_rxnfc()
1643 switch (cmd->cmd) { mlx4_en_get_rxnfc()
1645 cmd->data = priv->rx_ring_num; mlx4_en_get_rxnfc()
1648 cmd->rule_cnt = mlx4_en_get_num_flows(priv); mlx4_en_get_rxnfc()
1651 err = mlx4_en_get_flow(dev, cmd, cmd->fs.location); mlx4_en_get_rxnfc()
1654 while ((!err || err == -ENOENT) && priority < cmd->rule_cnt) { mlx4_en_get_rxnfc()
1655 err = mlx4_en_get_flow(dev, cmd, i); mlx4_en_get_rxnfc()
1670 static int mlx4_en_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) mlx4_en_set_rxnfc() argument
1680 switch (cmd->cmd) { mlx4_en_set_rxnfc()
1682 err = mlx4_en_flow_replace(dev, cmd); mlx4_en_set_rxnfc()
1685 err = mlx4_en_flow_detach(dev, cmd); mlx4_en_set_rxnfc()
1688 en_warn(priv, "Unsupported ethtool command. (%d)\n", cmd->cmd); mlx4_en_set_rxnfc()
728 ethtool_get_ptys_settings(struct net_device *dev, struct ethtool_cmd *cmd) ethtool_get_ptys_settings() argument
802 ethtool_get_default_settings(struct net_device *dev, struct ethtool_cmd *cmd) ethtool_get_default_settings() argument
1224 mlx4_en_validate_flow(struct net_device *dev, struct ethtool_rxnfc *cmd) mlx4_en_validate_flow() argument
1320 mlx4_en_ethtool_add_mac_rule_by_ipv4(struct mlx4_en_priv *priv, struct ethtool_rxnfc *cmd, struct list_head *rule_list_h, struct mlx4_spec_list *spec_l2, __be32 ipv4_dst) mlx4_en_ethtool_add_mac_rule_by_ipv4() argument
1344 add_ip_rule(struct mlx4_en_priv *priv, struct ethtool_rxnfc *cmd, struct list_head *list_h) add_ip_rule() argument
1382 add_tcp_udp_rule(struct mlx4_en_priv *priv, struct ethtool_rxnfc *cmd, struct list_head *list_h, int proto) add_tcp_udp_rule() argument
1450 mlx4_en_ethtool_to_net_trans_rule(struct net_device *dev, struct ethtool_rxnfc *cmd, struct list_head *rule_list_h) mlx4_en_ethtool_to_net_trans_rule() argument
1490 mlx4_en_flow_replace(struct net_device *dev, struct ethtool_rxnfc *cmd) mlx4_en_flow_replace() argument
1566 mlx4_en_flow_detach(struct net_device *dev, struct ethtool_rxnfc *cmd) mlx4_en_flow_detach() argument
/linux-4.4.14/arch/cris/arch-v32/drivers/pci/
H A Dbios.c53 u16 cmd, old_cmd; pcibios_enable_resources() local
57 pci_read_config_word(dev, PCI_COMMAND, &cmd); pcibios_enable_resources()
58 old_cmd = cmd; pcibios_enable_resources()
70 cmd |= PCI_COMMAND_IO; pcibios_enable_resources()
72 cmd |= PCI_COMMAND_MEMORY; pcibios_enable_resources()
75 cmd |= PCI_COMMAND_MEMORY; pcibios_enable_resources()
76 if (cmd != old_cmd) { pcibios_enable_resources()
77 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd); pcibios_enable_resources()
78 pci_write_config_word(dev, PCI_COMMAND, cmd); pcibios_enable_resources()
/linux-4.4.14/drivers/nfc/
H A Dmei_phy.c28 u8 cmd; member in struct:mei_nfc_hdr
99 pr_debug("cmd=%02d status=%d req_id=%d rsvd=%d size=%d\n", \
100 (_hdr)->cmd, (_hdr)->status, (_hdr)->req_id, \
107 struct mei_nfc_cmd cmd; mei_nfc_if_version() local
115 memset(&cmd, 0, sizeof(struct mei_nfc_cmd)); mei_nfc_if_version()
116 cmd.hdr.cmd = MEI_NFC_CMD_MAINTENANCE; mei_nfc_if_version()
117 cmd.hdr.data_size = 1; mei_nfc_if_version()
118 cmd.sub_command = MEI_NFC_SUBCMD_IF_VERSION; mei_nfc_if_version()
120 MEI_DUMP_NFC_HDR("version", &cmd.hdr); mei_nfc_if_version()
121 r = mei_cldev_send(phy->cldev, (u8 *)&cmd, sizeof(struct mei_nfc_cmd)); mei_nfc_if_version()
123 pr_err("Could not send IF version cmd\n"); mei_nfc_if_version()
155 struct mei_nfc_cmd *cmd, *reply; mei_nfc_connect() local
169 cmd = kzalloc(connect_length, GFP_KERNEL); mei_nfc_connect()
170 if (!cmd) mei_nfc_connect()
172 connect = (struct mei_nfc_connect *)cmd->data; mei_nfc_connect()
176 kfree(cmd); mei_nfc_connect()
182 cmd->hdr.cmd = MEI_NFC_CMD_MAINTENANCE; mei_nfc_connect()
183 cmd->hdr.data_size = 3; mei_nfc_connect()
184 cmd->sub_command = MEI_NFC_SUBCMD_CONNECT; mei_nfc_connect()
188 MEI_DUMP_NFC_HDR("connect request", &cmd->hdr); mei_nfc_connect()
189 r = mei_cldev_send(phy->cldev, (u8 *)cmd, connect_length); mei_nfc_connect()
191 pr_err("Could not send connect cmd %d\n", r); mei_nfc_connect()
216 kfree(cmd); mei_nfc_connect()
233 hdr->cmd = MEI_NFC_CMD_HCI_SEND; mei_nfc_send()
289 if (hdr->cmd == MEI_NFC_CMD_HCI_SEND) { mei_nfc_recv()
/linux-4.4.14/drivers/net/ethernet/chelsio/cxgb3/
H A Dcxgb3_ioctl.h53 uint32_t cmd; member in struct:ch_reg
59 uint32_t cmd; member in struct:ch_cntxt
69 uint32_t cmd; member in struct:ch_desc
77 uint32_t cmd; member in struct:ch_mem_range
86 uint32_t cmd; member in struct:ch_qset_params
100 uint32_t cmd; member in struct:ch_pktsched_params
118 uint32_t cmd; member in struct:ch_mtus
124 uint32_t cmd; member in struct:ch_pm
133 uint32_t cmd; member in struct:ch_tcam
141 uint32_t cmd; member in struct:ch_tcb
147 uint32_t cmd; member in struct:ch_tcam_word
153 uint32_t cmd; member in struct:ch_trace
/linux-4.4.14/include/target/
H A Dtarget_core_backend.h26 void (*transport_complete)(struct se_cmd *cmd,
30 sense_reason_t (*parse_cdb)(struct se_cmd *cmd);
48 sense_reason_t (*execute_rw)(struct se_cmd *cmd, struct scatterlist *,
50 sense_reason_t (*execute_sync_cache)(struct se_cmd *cmd);
51 sense_reason_t (*execute_write_same)(struct se_cmd *cmd);
52 sense_reason_t (*execute_unmap)(struct se_cmd *cmd,
62 sense_reason_t spc_parse_cdb(struct se_cmd *cmd, unsigned int *size);
63 sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd);
67 sense_reason_t sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops);
70 sector_t sbc_get_write_same_sectors(struct se_cmd *cmd);
93 sense_reason_t passthrough_parse_cdb(struct se_cmd *cmd,
94 sense_reason_t (*exec_cmd)(struct se_cmd *cmd));
/linux-4.4.14/arch/sparc/kernel/
H A Dreboot.c39 void machine_restart(char *cmd) machine_restart() argument
46 if (cmd) machine_restart()
47 prom_reboot(cmd); machine_restart()
H A Dleon_pci.c54 u16 cmd; pcibios_fixup_bus() local
76 pci_bus_read_config_word(pbus, dev->devfn, PCI_COMMAND, &cmd); pcibios_fixup_bus()
77 if (has_io && !(cmd & PCI_COMMAND_IO)) { pcibios_fixup_bus()
82 cmd |= PCI_COMMAND_IO; pcibios_fixup_bus()
84 cmd); pcibios_fixup_bus()
86 if (has_mem && !(cmd & PCI_COMMAND_MEMORY)) { pcibios_fixup_bus()
91 cmd |= PCI_COMMAND_MEMORY; pcibios_fixup_bus()
93 cmd); pcibios_fixup_bus()
/linux-4.4.14/arch/mips/lasat/
H A Dpicvue.c172 static void pvc_funcset(u8 cmd) pvc_funcset() argument
174 pvc_write(FUNC_SET_CMD | (cmd & (EIGHT_BYTE|TWO_LINES|LARGE_FONT)), pvc_funcset()
183 static void pvc_entrymode(u8 cmd) pvc_entrymode() argument
185 pvc_write(ENTRYMODE_CMD | (cmd & (AUTO_INC|CURSOR_FOLLOWS_DISP)), pvc_entrymode()
194 void pvc_dispcnt(u8 cmd) pvc_dispcnt() argument
196 pvc_write(DISP_CNT_CMD | (cmd & (DISP_ON|CUR_ON|CUR_BLINK)), MODE_INST); pvc_dispcnt()
204 void pvc_move(u8 cmd) pvc_move() argument
206 pvc_write(MOVE_CMD | (cmd & (DISPLAY|RIGHT)), MODE_INST); pvc_move()
223 u8 cmd = EIGHT_BYTE; pvc_init() local
226 cmd |= (SMALL_FONT|TWO_LINES); pvc_init()
228 cmd |= (LARGE_FONT|ONE_LINE); pvc_init()
229 pvc_funcset(cmd); pvc_init()
/linux-4.4.14/drivers/net/ethernet/samsung/sxgbe/
H A Dsxgbe_ethtool.c186 struct ethtool_cmd *cmd) sxgbe_getsettings()
191 return phy_ethtool_gset(priv->phydev, cmd); sxgbe_getsettings()
196 static int sxgbe_setsettings(struct net_device *dev, struct ethtool_cmd *cmd) sxgbe_setsettings() argument
201 return phy_ethtool_sset(priv->phydev, cmd); sxgbe_setsettings()
334 struct ethtool_rxnfc *cmd) sxgbe_get_rss_hash_opts()
336 cmd->data = 0; sxgbe_get_rss_hash_opts()
339 switch (cmd->flow_type) { sxgbe_get_rss_hash_opts()
342 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; sxgbe_get_rss_hash_opts()
348 cmd->data |= RXH_IP_SRC | RXH_IP_DST; sxgbe_get_rss_hash_opts()
352 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; sxgbe_get_rss_hash_opts()
358 cmd->data |= RXH_IP_SRC | RXH_IP_DST; sxgbe_get_rss_hash_opts()
367 static int sxgbe_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, sxgbe_get_rxnfc() argument
373 switch (cmd->cmd) { sxgbe_get_rxnfc()
375 ret = sxgbe_get_rss_hash_opts(priv, cmd); sxgbe_get_rxnfc()
385 struct ethtool_rxnfc *cmd) sxgbe_set_rss_hash_opt()
392 if (cmd->data & ~(RXH_IP_SRC | RXH_IP_DST | sxgbe_set_rss_hash_opt()
396 switch (cmd->flow_type) { sxgbe_set_rss_hash_opt()
399 if (!(cmd->data & RXH_IP_SRC) || sxgbe_set_rss_hash_opt()
400 !(cmd->data & RXH_IP_DST) || sxgbe_set_rss_hash_opt()
401 !(cmd->data & RXH_L4_B_0_1) || sxgbe_set_rss_hash_opt()
402 !(cmd->data & RXH_L4_B_2_3)) sxgbe_set_rss_hash_opt()
408 if (!(cmd->data & RXH_IP_SRC) || sxgbe_set_rss_hash_opt()
409 !(cmd->data & RXH_IP_DST) || sxgbe_set_rss_hash_opt()
410 !(cmd->data & RXH_L4_B_0_1) || sxgbe_set_rss_hash_opt()
411 !(cmd->data & RXH_L4_B_2_3)) sxgbe_set_rss_hash_opt()
425 if (!(cmd->data & RXH_IP_SRC) || sxgbe_set_rss_hash_opt()
426 !(cmd->data & RXH_IP_DST) || sxgbe_set_rss_hash_opt()
427 (cmd->data & RXH_L4_B_0_1) || sxgbe_set_rss_hash_opt()
428 (cmd->data & RXH_L4_B_2_3)) sxgbe_set_rss_hash_opt()
444 static int sxgbe_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) sxgbe_set_rxnfc() argument
449 switch (cmd->cmd) { sxgbe_set_rxnfc()
451 ret = sxgbe_set_rss_hash_opt(priv, cmd); sxgbe_set_rxnfc()
185 sxgbe_getsettings(struct net_device *dev, struct ethtool_cmd *cmd) sxgbe_getsettings() argument
333 sxgbe_get_rss_hash_opts(struct sxgbe_priv_data *priv, struct ethtool_rxnfc *cmd) sxgbe_get_rss_hash_opts() argument
384 sxgbe_set_rss_hash_opt(struct sxgbe_priv_data *priv, struct ethtool_rxnfc *cmd) sxgbe_set_rss_hash_opt() argument
/linux-4.4.14/drivers/staging/mt29f_spinand/
H A Dmt29f_spinand.c73 static int spinand_cmd(struct spi_device *spi, struct spinand_cmd *cmd) spinand_cmd() argument
83 x[0].tx_buf = &cmd->cmd; spinand_cmd()
86 if (cmd->n_addr) { spinand_cmd()
87 x[1].len = cmd->n_addr; spinand_cmd()
88 x[1].tx_buf = cmd->addr; spinand_cmd()
92 if (cmd->n_dummy) { spinand_cmd()
93 x[2].len = cmd->n_dummy; spinand_cmd()
98 if (cmd->n_tx) { spinand_cmd()
99 x[3].len = cmd->n_tx; spinand_cmd()
100 x[3].tx_buf = cmd->tx_buf; spinand_cmd()
104 if (cmd->n_rx) { spinand_cmd()
105 x[3].len = cmd->n_rx; spinand_cmd()
106 x[3].rx_buf = cmd->rx_buf; spinand_cmd()
122 struct spinand_cmd cmd = {0}; spinand_read_id() local
124 cmd.cmd = CMD_READ_ID; spinand_read_id()
125 cmd.n_rx = 3; spinand_read_id()
126 cmd.rx_buf = &nand_id[0]; spinand_read_id()
128 retval = spinand_cmd(spi_nand, &cmd); spinand_read_id()
150 struct spinand_cmd cmd = {0}; spinand_read_status() local
153 cmd.cmd = CMD_READ_REG; spinand_read_status()
154 cmd.n_addr = 1; spinand_read_status()
155 cmd.addr[0] = REG_STATUS; spinand_read_status()
156 cmd.n_rx = 1; spinand_read_status()
157 cmd.rx_buf = status; spinand_read_status()
159 ret = spinand_cmd(spi_nand, &cmd); spinand_read_status()
199 struct spinand_cmd cmd = {0}; spinand_get_otp() local
202 cmd.cmd = CMD_READ_REG; spinand_get_otp()
203 cmd.n_addr = 1; spinand_get_otp()
204 cmd.addr[0] = REG_OTP; spinand_get_otp()
205 cmd.n_rx = 1; spinand_get_otp()
206 cmd.rx_buf = otp; spinand_get_otp()
208 retval = spinand_cmd(spi_nand, &cmd); spinand_get_otp()
224 struct spinand_cmd cmd = {0}; spinand_set_otp() local
226 cmd.cmd = CMD_WRITE_REG, spinand_set_otp()
227 cmd.n_addr = 1, spinand_set_otp()
228 cmd.addr[0] = REG_OTP, spinand_set_otp()
229 cmd.n_tx = 1, spinand_set_otp()
230 cmd.tx_buf = otp, spinand_set_otp()
232 retval = spinand_cmd(spi_nand, &cmd); spinand_set_otp()
296 struct spinand_cmd cmd = {0}; spinand_write_enable() local
298 cmd.cmd = CMD_WR_ENABLE; spinand_write_enable()
299 return spinand_cmd(spi_nand, &cmd); spinand_write_enable()
304 struct spinand_cmd cmd = {0}; spinand_read_page_to_cache() local
308 cmd.cmd = CMD_READ; spinand_read_page_to_cache()
309 cmd.n_addr = 3; spinand_read_page_to_cache()
310 cmd.addr[1] = (u8)((row & 0xff00) >> 8); spinand_read_page_to_cache()
311 cmd.addr[2] = (u8)(row & 0x00ff); spinand_read_page_to_cache()
313 return spinand_cmd(spi_nand, &cmd); spinand_read_page_to_cache()
327 struct spinand_cmd cmd = {0}; spinand_read_from_cache() local
331 cmd.cmd = CMD_READ_RDM; spinand_read_from_cache()
332 cmd.n_addr = 3; spinand_read_from_cache()
333 cmd.addr[0] = (u8)((column & 0xff00) >> 8); spinand_read_from_cache()
334 cmd.addr[0] |= (u8)(((page_id >> 6) & 0x1) << 4); spinand_read_from_cache()
335 cmd.addr[1] = (u8)(column & 0x00ff); spinand_read_from_cache()
336 cmd.addr[2] = (u8)(0xff); spinand_read_from_cache()
337 cmd.n_dummy = 0; spinand_read_from_cache()
338 cmd.n_rx = len; spinand_read_from_cache()
339 cmd.rx_buf = rbuf; spinand_read_from_cache()
341 return spinand_cmd(spi_nand, &cmd); spinand_read_from_cache()
426 struct spinand_cmd cmd = {0}; spinand_program_data_to_cache() local
430 cmd.cmd = CMD_PROG_PAGE_CLRCACHE; spinand_program_data_to_cache()
431 cmd.n_addr = 2; spinand_program_data_to_cache()
432 cmd.addr[0] = (u8)((column & 0xff00) >> 8); spinand_program_data_to_cache()
433 cmd.addr[0] |= (u8)(((page_id >> 6) & 0x1) << 4); spinand_program_data_to_cache()
434 cmd.addr[1] = (u8)(column & 0x00ff); spinand_program_data_to_cache()
435 cmd.n_tx = len; spinand_program_data_to_cache()
436 cmd.tx_buf = wbuf; spinand_program_data_to_cache()
438 return spinand_cmd(spi_nand, &cmd); spinand_program_data_to_cache()
452 struct spinand_cmd cmd = {0}; spinand_program_execute() local
456 cmd.cmd = CMD_PROG_PAGE_EXC; spinand_program_execute()
457 cmd.n_addr = 3; spinand_program_execute()
458 cmd.addr[1] = (u8)((row & 0xff00) >> 8); spinand_program_execute()
459 cmd.addr[2] = (u8)(row & 0x00ff); spinand_program_execute()
461 return spinand_cmd(spi_nand, &cmd); spinand_program_execute()
560 struct spinand_cmd cmd = {0}; spinand_erase_block_erase() local
564 cmd.cmd = CMD_ERASE_BLK; spinand_erase_block_erase()
565 cmd.n_addr = 3; spinand_erase_block_erase()
566 cmd.addr[1] = (u8)((row & 0xff00) >> 8); spinand_erase_block_erase()
567 cmd.addr[2] = (u8)(row & 0x00ff); spinand_erase_block_erase()
569 return spinand_cmd(spi_nand, &cmd); spinand_erase_block_erase()
730 struct spinand_cmd cmd = {0}; spinand_reset() local
732 cmd.cmd = CMD_RESET; spinand_reset()
734 if (spinand_cmd(spi_nand, &cmd) < 0) spinand_reset()
803 /* a minimum of 250us must elapse before issuing RESET cmd*/ spinand_cmdfunc()
821 struct spinand_cmd cmd = {0}; spinand_lock_block() local
827 cmd.cmd = CMD_WRITE_REG; spinand_lock_block()
828 cmd.n_addr = 1; spinand_lock_block()
829 cmd.addr[0] = REG_BLOCK_LOCK; spinand_lock_block()
830 cmd.n_tx = 1; spinand_lock_block()
831 cmd.tx_buf = &lock; spinand_lock_block()
833 ret = spinand_cmd(spi_nand, &cmd); spinand_lock_block()
/linux-4.4.14/drivers/i2c/busses/
H A Di2c-pmcmsp.c413 dev_dbg(&pmcmsptwi_adapter.dev, "Writing cmd reg 0x%08x\n", reg); pmcmsptwi_do_xfer()
433 static inline u32 pmcmsptwi_cmd_to_reg(const struct pmcmsptwi_cmd *cmd) pmcmsptwi_cmd_to_reg() argument
435 return ((cmd->type & 0x3) << 8) | pmcmsptwi_cmd_to_reg()
436 (((cmd->write_len - 1) & 0x7) << 4) | pmcmsptwi_cmd_to_reg()
437 ((cmd->read_len - 1) & 0x7); pmcmsptwi_cmd_to_reg()
444 struct pmcmsptwi_cmd *cmd, pmcmsptwi_xfer_cmd()
449 if ((cmd->type == MSP_TWI_CMD_WRITE && cmd->write_len == 0) || pmcmsptwi_xfer_cmd()
450 (cmd->type == MSP_TWI_CMD_READ && cmd->read_len == 0) || pmcmsptwi_xfer_cmd()
451 (cmd->type == MSP_TWI_CMD_WRITE_READ && pmcmsptwi_xfer_cmd()
452 (cmd->read_len == 0 || cmd->write_len == 0))) { pmcmsptwi_xfer_cmd()
461 "Setting address to 0x%04x\n", cmd->addr); pmcmsptwi_xfer_cmd()
462 pmcmsptwi_writel(cmd->addr, data->iobase + MSP_TWI_ADD_REG_OFFSET); pmcmsptwi_xfer_cmd()
464 if (cmd->type == MSP_TWI_CMD_WRITE || pmcmsptwi_xfer_cmd()
465 cmd->type == MSP_TWI_CMD_WRITE_READ) { pmcmsptwi_xfer_cmd()
466 u64 tmp = be64_to_cpup((__be64 *)cmd->write_data); pmcmsptwi_xfer_cmd()
467 tmp >>= (MSP_MAX_BYTES_PER_RW - cmd->write_len) * 8; pmcmsptwi_xfer_cmd()
471 if (cmd->write_len > 4) pmcmsptwi_xfer_cmd()
476 retval = pmcmsptwi_do_xfer(pmcmsptwi_cmd_to_reg(cmd), data); pmcmsptwi_xfer_cmd()
480 if (cmd->type == MSP_TWI_CMD_READ || pmcmsptwi_xfer_cmd()
481 cmd->type == MSP_TWI_CMD_WRITE_READ) { pmcmsptwi_xfer_cmd()
483 u64 rmsk = ~(0xffffffffffffffffLL << (cmd->read_len * 8)); pmcmsptwi_xfer_cmd()
486 if (cmd->read_len > 4) pmcmsptwi_xfer_cmd()
492 for (i = 0; i < cmd->read_len; i++) pmcmsptwi_xfer_cmd()
493 cmd->read_data[i] = tmp >> i; pmcmsptwi_xfer_cmd()
511 struct pmcmsptwi_cmd cmd; pmcmsptwi_master_xfer() local
518 cmd.type = MSP_TWI_CMD_WRITE_READ; pmcmsptwi_master_xfer()
519 cmd.write_len = msg->len; pmcmsptwi_master_xfer()
520 cmd.write_data = msg->buf; pmcmsptwi_master_xfer()
521 cmd.read_len = nextmsg->len; pmcmsptwi_master_xfer()
522 cmd.read_data = nextmsg->buf; pmcmsptwi_master_xfer()
524 cmd.type = MSP_TWI_CMD_READ; pmcmsptwi_master_xfer()
525 cmd.read_len = msg->len; pmcmsptwi_master_xfer()
526 cmd.read_data = msg->buf; pmcmsptwi_master_xfer()
527 cmd.write_len = 0; pmcmsptwi_master_xfer()
528 cmd.write_data = NULL; pmcmsptwi_master_xfer()
530 cmd.type = MSP_TWI_CMD_WRITE; pmcmsptwi_master_xfer()
531 cmd.read_len = 0; pmcmsptwi_master_xfer()
532 cmd.read_data = NULL; pmcmsptwi_master_xfer()
533 cmd.write_len = msg->len; pmcmsptwi_master_xfer()
534 cmd.write_data = msg->buf; pmcmsptwi_master_xfer()
542 cmd.addr = msg->addr; pmcmsptwi_master_xfer()
555 ret = pmcmsptwi_xfer_cmd(&cmd, data); pmcmsptwi_master_xfer()
443 pmcmsptwi_xfer_cmd( struct pmcmsptwi_cmd *cmd, struct pmcmsptwi_data *data) pmcmsptwi_xfer_cmd() argument
/linux-4.4.14/drivers/net/wireless/mwifiex/
H A Dsta_cmd.c48 struct host_cmd_ds_command *cmd, u16 cmd_action) mwifiex_cmd_802_11_rssi_info()
50 cmd->command = cpu_to_le16(HostCmd_CMD_RSSI_INFO); mwifiex_cmd_802_11_rssi_info()
51 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_rssi_info) + mwifiex_cmd_802_11_rssi_info()
53 cmd->params.rssi_info.action = cpu_to_le16(cmd_action); mwifiex_cmd_802_11_rssi_info()
54 cmd->params.rssi_info.ndata = cpu_to_le16(priv->data_avg_factor); mwifiex_cmd_802_11_rssi_info()
55 cmd->params.rssi_info.nbcn = cpu_to_le16(priv->bcn_avg_factor); mwifiex_cmd_802_11_rssi_info()
78 struct host_cmd_ds_command *cmd, mwifiex_cmd_mac_control()
81 struct host_cmd_ds_mac_control *mac_ctrl = &cmd->params.mac_ctrl; mwifiex_cmd_mac_control()
85 "mac_control: only support set cmd\n"); mwifiex_cmd_mac_control()
89 cmd->command = cpu_to_le16(HostCmd_CMD_MAC_CONTROL); mwifiex_cmd_mac_control()
90 cmd->size = mwifiex_cmd_mac_control()
113 struct host_cmd_ds_command *cmd, mwifiex_cmd_802_11_snmp_mib()
117 struct host_cmd_ds_802_11_snmp_mib *snmp_mib = &cmd->params.smib; mwifiex_cmd_802_11_snmp_mib()
120 "cmd: SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid); mwifiex_cmd_802_11_snmp_mib()
121 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_SNMP_MIB); mwifiex_cmd_802_11_snmp_mib()
122 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_snmp_mib) mwifiex_cmd_802_11_snmp_mib()
129 le16_add_cpu(&cmd->size, MAX_SNMP_BUF_SIZE); mwifiex_cmd_802_11_snmp_mib()
134 le16_add_cpu(&cmd->size, sizeof(u16)); mwifiex_cmd_802_11_snmp_mib()
138 "cmd: SNMP_CMD: Action=0x%x, OID=0x%x,\t" mwifiex_cmd_802_11_snmp_mib()
153 mwifiex_cmd_802_11_get_log(struct host_cmd_ds_command *cmd) mwifiex_cmd_802_11_get_log() argument
155 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_GET_LOG); mwifiex_cmd_802_11_get_log()
156 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_get_log) + mwifiex_cmd_802_11_get_log()
171 struct host_cmd_ds_command *cmd, mwifiex_cmd_tx_rate_cfg()
174 struct host_cmd_ds_tx_rate_cfg *rate_cfg = &cmd->params.tx_rate_cfg; mwifiex_cmd_tx_rate_cfg()
179 cmd->command = cpu_to_le16(HostCmd_CMD_TX_RATE_CFG); mwifiex_cmd_tx_rate_cfg()
229 cmd->size = mwifiex_cmd_tx_rate_cfg()
246 static int mwifiex_cmd_tx_power_cfg(struct host_cmd_ds_command *cmd, mwifiex_cmd_tx_power_cfg() argument
251 struct host_cmd_ds_txpwr_cfg *cmd_txp_cfg = &cmd->params.txp_cfg; mwifiex_cmd_tx_power_cfg()
253 cmd->command = cpu_to_le16(HostCmd_CMD_TXPWR_CFG); mwifiex_cmd_tx_power_cfg()
254 cmd->size = mwifiex_cmd_tx_power_cfg()
270 cmd->size = cpu_to_le16(le16_to_cpu(cmd->size) + mwifiex_cmd_tx_power_cfg()
290 struct host_cmd_ds_command *cmd, mwifiex_cmd_rf_tx_power()
293 struct host_cmd_ds_rf_tx_pwr *txp = &cmd->params.txp; mwifiex_cmd_rf_tx_power()
295 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_rf_tx_pwr) mwifiex_cmd_rf_tx_power()
297 cmd->command = cpu_to_le16(HostCmd_CMD_RF_TX_PWR); mwifiex_cmd_rf_tx_power()
307 struct host_cmd_ds_command *cmd, mwifiex_cmd_rf_antenna()
311 struct host_cmd_ds_rf_ant_mimo *ant_mimo = &cmd->params.ant_mimo; mwifiex_cmd_rf_antenna()
312 struct host_cmd_ds_rf_ant_siso *ant_siso = &cmd->params.ant_siso; mwifiex_cmd_rf_antenna()
314 cmd->command = cpu_to_le16(HostCmd_CMD_RF_ANTENNA); mwifiex_cmd_rf_antenna()
320 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_rf_ant_mimo) + mwifiex_cmd_rf_antenna()
327 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_rf_ant_siso) + mwifiex_cmd_rf_antenna()
347 struct host_cmd_ds_command *cmd, mwifiex_cmd_802_11_hs_cfg()
352 struct host_cmd_ds_802_11_hs_cfg_enh *hs_cfg = &cmd->params.opt_hs_cfg; mwifiex_cmd_802_11_hs_cfg()
358 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH); mwifiex_cmd_802_11_hs_cfg()
365 "cmd: Attach %d bytes ArpFilter to HSCfg cmd\n", mwifiex_cmd_802_11_hs_cfg()
370 cmd->size = cpu_to_le16 mwifiex_cmd_802_11_hs_cfg()
375 cmd->size = cpu_to_le16(S_DS_GEN + sizeof(struct mwifiex_cmd_802_11_hs_cfg()
387 "cmd: HS_CFG_CMD: condition:0x%x gpio:0x%x gap:0x%x\n", mwifiex_cmd_802_11_hs_cfg()
405 struct host_cmd_ds_command *cmd, mwifiex_cmd_802_11_mac_address()
408 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_MAC_ADDRESS); mwifiex_cmd_802_11_mac_address()
409 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_mac_address) + mwifiex_cmd_802_11_mac_address()
411 cmd->result = 0; mwifiex_cmd_802_11_mac_address()
413 cmd->params.mac_addr.action = cpu_to_le16(cmd_action); mwifiex_cmd_802_11_mac_address()
416 memcpy(cmd->params.mac_addr.mac_addr, priv->curr_addr, mwifiex_cmd_802_11_mac_address()
430 mwifiex_cmd_mac_multicast_adr(struct host_cmd_ds_command *cmd, mwifiex_cmd_mac_multicast_adr() argument
434 struct host_cmd_ds_mac_multicast_adr *mcast_addr = &cmd->params.mc_addr; mwifiex_cmd_mac_multicast_adr()
436 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_mac_multicast_adr) + mwifiex_cmd_mac_multicast_adr()
438 cmd->command = cpu_to_le16(HostCmd_CMD_MAC_MULTICAST_ADR); mwifiex_cmd_mac_multicast_adr()
458 struct host_cmd_ds_command *cmd, mwifiex_cmd_802_11_deauthenticate()
461 struct host_cmd_ds_802_11_deauthenticate *deauth = &cmd->params.deauth; mwifiex_cmd_802_11_deauthenticate()
463 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_DEAUTHENTICATE); mwifiex_cmd_802_11_deauthenticate()
464 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_deauthenticate) mwifiex_cmd_802_11_deauthenticate()
470 mwifiex_dbg(priv->adapter, CMD, "cmd: Deauth: %pM\n", deauth->mac_addr); mwifiex_cmd_802_11_deauthenticate()
484 static int mwifiex_cmd_802_11_ad_hoc_stop(struct host_cmd_ds_command *cmd) mwifiex_cmd_802_11_ad_hoc_stop() argument
486 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_AD_HOC_STOP); mwifiex_cmd_802_11_ad_hoc_stop()
487 cmd->size = cpu_to_le16(S_DS_GEN); mwifiex_cmd_802_11_ad_hoc_stop()
562 struct host_cmd_ds_command *cmd, mwifiex_set_aes_key_v2()
600 cmd->size = cpu_to_le16(size); mwifiex_set_aes_key_v2()
615 struct host_cmd_ds_command *cmd, mwifiex_cmd_802_11_key_material_v2()
623 &cmd->params.key_material_v2; mwifiex_cmd_802_11_key_material_v2()
625 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_KEY_MATERIAL); mwifiex_cmd_802_11_key_material_v2()
646 cmd->size = cpu_to_le16(sizeof(struct mwifiex_ie_types_header) + mwifiex_cmd_802_11_key_material_v2()
664 cmd->size = cpu_to_le16(sizeof(struct mwifiex_ie_types_header) + mwifiex_cmd_802_11_key_material_v2()
709 cmd->size = cpu_to_le16(sizeof(struct mwifiex_ie_types_header) + mwifiex_cmd_802_11_key_material_v2()
737 cmd->size = cpu_to_le16(sizeof(struct mwifiex_ie_types_header) + mwifiex_cmd_802_11_key_material_v2()
757 return mwifiex_set_aes_key_v2(priv, cmd, enc_key, km); mwifiex_cmd_802_11_key_material_v2()
773 cmd->size = cpu_to_le16(sizeof(struct mwifiex_ie_types_header) + mwifiex_cmd_802_11_key_material_v2()
792 struct host_cmd_ds_command *cmd, mwifiex_cmd_802_11_key_material_v1()
797 &cmd->params.key_material; mwifiex_cmd_802_11_key_material_v1()
802 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_KEY_MATERIAL); mwifiex_cmd_802_11_key_material_v1()
806 cmd->size = mwifiex_cmd_802_11_key_material_v1()
818 cmd->size = cpu_to_le16(key_param_len + mwifiex_cmd_802_11_key_material_v1()
865 cmd->size = cpu_to_le16(sizeof(key_material->action) mwifiex_cmd_802_11_key_material_v1()
871 mwifiex_dbg(priv->adapter, CMD, "cmd: CMAC_AES\n"); mwifiex_cmd_802_11_key_material_v1()
884 mwifiex_dbg(priv->adapter, CMD, "cmd: WPA_AES\n"); mwifiex_cmd_802_11_key_material_v1()
903 mwifiex_dbg(priv->adapter, CMD, "cmd: WPA_TKIP\n"); mwifiex_cmd_802_11_key_material_v1()
950 cmd->size = cpu_to_le16(sizeof(key_material->action) + S_DS_GEN mwifiex_cmd_802_11_key_material_v1()
967 cmd->size = cpu_to_le16(cmd_size); mwifiex_cmd_802_11_key_material_v1()
976 struct host_cmd_ds_command *cmd, mwifiex_cmd_802_11_key_material()
981 return mwifiex_cmd_802_11_key_material_v2(priv, cmd, mwifiex_cmd_802_11_key_material()
986 return mwifiex_cmd_802_11_key_material_v1(priv, cmd, mwifiex_cmd_802_11_key_material()
1000 struct host_cmd_ds_command *cmd, mwifiex_cmd_802_11d_domain_info()
1005 &cmd->params.domain_info; mwifiex_cmd_802_11d_domain_info()
1013 cmd->command = cpu_to_le16(HostCmd_CMD_802_11D_DOMAIN_INFO); mwifiex_cmd_802_11d_domain_info()
1016 cmd->size = cpu_to_le16(sizeof(domain_info->action) + S_DS_GEN); mwifiex_cmd_802_11d_domain_info()
1035 cmd->size = cpu_to_le16(sizeof(domain_info->action) + mwifiex_cmd_802_11d_domain_info()
1040 cmd->size = cpu_to_le16(sizeof(domain_info->action) + S_DS_GEN); mwifiex_cmd_802_11d_domain_info()
1054 static int mwifiex_cmd_ibss_coalescing_status(struct host_cmd_ds_command *cmd, mwifiex_cmd_ibss_coalescing_status() argument
1058 &(cmd->params.ibss_coalescing); mwifiex_cmd_ibss_coalescing_status()
1060 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_IBSS_COALESCING_STATUS); mwifiex_cmd_ibss_coalescing_status()
1061 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_ibss_status) + mwifiex_cmd_ibss_coalescing_status()
1063 cmd->result = 0; mwifiex_cmd_ibss_coalescing_status()
1086 mwifiex_cmd_mem_access(struct host_cmd_ds_command *cmd, u16 cmd_action, mwifiex_cmd_mem_access() argument
1090 struct host_cmd_ds_mem_access *mem_access = (void *)&cmd->params.mem; mwifiex_cmd_mem_access()
1092 cmd->command = cpu_to_le16(HostCmd_CMD_MEM_ACCESS); mwifiex_cmd_mem_access()
1093 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_mem_access) + mwifiex_cmd_mem_access()
1120 static int mwifiex_cmd_reg_access(struct host_cmd_ds_command *cmd, mwifiex_cmd_reg_access() argument
1125 switch (le16_to_cpu(cmd->command)) { mwifiex_cmd_reg_access()
1130 cmd->size = cpu_to_le16(sizeof(*mac_reg) + S_DS_GEN); mwifiex_cmd_reg_access()
1131 mac_reg = &cmd->params.mac_reg; mwifiex_cmd_reg_access()
1142 cmd->size = cpu_to_le16(sizeof(*bbp_reg) + S_DS_GEN); mwifiex_cmd_reg_access()
1143 bbp_reg = &cmd->params.bbp_reg; mwifiex_cmd_reg_access()
1154 cmd->size = cpu_to_le16(sizeof(*rf_reg) + S_DS_GEN); mwifiex_cmd_reg_access()
1155 rf_reg = &cmd->params.rf_reg; mwifiex_cmd_reg_access()
1165 cmd->size = cpu_to_le16(sizeof(*pmic_reg) + S_DS_GEN); mwifiex_cmd_reg_access()
1166 pmic_reg = &cmd->params.pmic_reg; mwifiex_cmd_reg_access()
1177 cmd->size = cpu_to_le16(sizeof(*cau_reg) + S_DS_GEN); mwifiex_cmd_reg_access()
1178 cau_reg = &cmd->params.rf_reg; mwifiex_cmd_reg_access()
1189 &cmd->params.eeprom; mwifiex_cmd_reg_access()
1191 cmd->size = cpu_to_le16(sizeof(*cmd_eeprom) + S_DS_GEN); mwifiex_cmd_reg_access()
1216 struct host_cmd_ds_command *cmd, u16 action) mwifiex_cmd_pcie_host_spec()
1219 &cmd->params.pcie_host_spec; mwifiex_cmd_pcie_host_spec()
1222 cmd->command = cpu_to_le16(HostCmd_CMD_PCIE_DESC_DETAILS); mwifiex_cmd_pcie_host_spec()
1223 cmd->size = cpu_to_le16(sizeof(struct mwifiex_cmd_pcie_host_spec()
1225 cmd->result = 0; mwifiex_cmd_pcie_host_spec()
1263 struct host_cmd_ds_command *cmd, mwifiex_cmd_802_11_subsc_evt()
1266 struct host_cmd_ds_802_11_subsc_evt *subsc_evt = &cmd->params.subsc_evt; mwifiex_cmd_802_11_subsc_evt()
1271 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_SUBSCRIBE_EVENT); mwifiex_cmd_802_11_subsc_evt()
1272 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_subsc_evt) + mwifiex_cmd_802_11_subsc_evt()
1277 "cmd: action: %d\n", subsc_evt_cfg->action); mwifiex_cmd_802_11_subsc_evt()
1286 mwifiex_dbg(priv->adapter, CMD, "cmd: event bitmap : %16x\n", mwifiex_cmd_802_11_subsc_evt()
1326 le16_add_cpu(&cmd->size, mwifiex_cmd_802_11_subsc_evt()
1347 le16_add_cpu(&cmd->size, mwifiex_cmd_802_11_subsc_evt()
1403 struct host_cmd_ds_command *cmd, mwifiex_cmd_mef_cfg()
1406 struct host_cmd_ds_mef_cfg *mef_cfg = &cmd->params.mef_cfg; mwifiex_cmd_mef_cfg()
1411 cmd->command = cpu_to_le16(HostCmd_CMD_MEF_CFG); mwifiex_cmd_mef_cfg()
1430 cmd->size = cpu_to_le16((u16) (pos - (u8 *)mef_cfg) + S_DS_GEN); mwifiex_cmd_mef_cfg()
1470 /* property header is 6 bytes, data must fit in cmd buffer */ for_each_property_of_node()
1486 struct host_cmd_ds_command *cmd, void *data_buf) mwifiex_cmd_cfg_data()
1491 u8 *data = (u8 *)cmd + S_DS_GEN; mwifiex_cmd_cfg_data()
1512 cmd->command = cpu_to_le16(HostCmd_CMD_CFG_DATA); mwifiex_cmd_cfg_data()
1513 cmd->size = cpu_to_le16(S_DS_GEN + len); mwifiex_cmd_cfg_data()
1520 struct host_cmd_ds_command *cmd, mwifiex_cmd_set_mc_policy()
1523 struct host_cmd_ds_multi_chan_policy *mc_pol = &cmd->params.mc_policy; mwifiex_cmd_set_mc_policy()
1528 cmd->command = cpu_to_le16(HostCmd_CMD_MC_POLICY); mwifiex_cmd_set_mc_policy()
1529 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_multi_chan_policy) + mwifiex_cmd_set_mc_policy()
1535 struct host_cmd_ds_command *cmd, mwifiex_cmd_robust_coex()
1538 struct host_cmd_ds_robust_coex *coex = &cmd->params.coex; mwifiex_cmd_robust_coex()
1541 cmd->command = cpu_to_le16(HostCmd_CMD_ROBUST_COEX); mwifiex_cmd_robust_coex()
1542 cmd->size = cpu_to_le16(sizeof(*coex) + sizeof(*coex_tlv) + S_DS_GEN); mwifiex_cmd_robust_coex()
1563 struct host_cmd_ds_command *cmd, mwifiex_cmd_coalesce_cfg()
1567 &cmd->params.coalesce_cfg; mwifiex_cmd_coalesce_cfg()
1573 cmd->command = cpu_to_le16(HostCmd_CMD_COALESCE_CFG); mwifiex_cmd_coalesce_cfg()
1574 cmd->size = cpu_to_le16(S_DS_GEN); mwifiex_cmd_coalesce_cfg()
1613 le16_add_cpu(&cmd->size, le16_to_cpu(rule->header.len) + mwifiex_cmd_coalesce_cfg()
1620 le16_add_cpu(&cmd->size, sizeof(u16) + sizeof(u16)); mwifiex_cmd_coalesce_cfg()
1627 struct host_cmd_ds_command *cmd, mwifiex_cmd_tdls_config()
1630 struct host_cmd_ds_tdls_config *tdls_config = &cmd->params.tdls_config; mwifiex_cmd_tdls_config()
1635 cmd->command = cpu_to_le16(HostCmd_CMD_TDLS_CONFIG); mwifiex_cmd_tdls_config()
1636 cmd->size = cpu_to_le16(S_DS_GEN); mwifiex_cmd_tdls_config()
1638 le16_add_cpu(&cmd->size, sizeof(tdls_config->tdls_action)); mwifiex_cmd_tdls_config()
1665 le16_add_cpu(&cmd->size, len); mwifiex_cmd_tdls_config()
1671 struct host_cmd_ds_command *cmd, mwifiex_cmd_tdls_oper()
1674 struct host_cmd_ds_tdls_oper *tdls_oper = &cmd->params.tdls_oper; mwifiex_cmd_tdls_oper()
1688 cmd->command = cpu_to_le16(HostCmd_CMD_TDLS_OPER); mwifiex_cmd_tdls_oper()
1689 cmd->size = cpu_to_le16(S_DS_GEN); mwifiex_cmd_tdls_oper()
1690 le16_add_cpu(&cmd->size, sizeof(struct host_cmd_ds_tdls_oper)); mwifiex_cmd_tdls_oper()
1793 le16_add_cpu(&cmd->size, config_len); mwifiex_cmd_tdls_oper()
1799 static int mwifiex_cmd_sdio_rx_aggr_cfg(struct host_cmd_ds_command *cmd, mwifiex_cmd_sdio_rx_aggr_cfg() argument
1803 &cmd->params.sdio_rx_aggr_cfg; mwifiex_cmd_sdio_rx_aggr_cfg()
1805 cmd->command = cpu_to_le16(HostCmd_CMD_SDIO_SP_RX_AGGR_CFG); mwifiex_cmd_sdio_rx_aggr_cfg()
1806 cmd->size = mwifiex_cmd_sdio_rx_aggr_cfg()
1997 "cmd: WMM: WMM_GET_STATUS cmd sent\n"); mwifiex_sta_prepare_cmd()
2076 "PREP_CMD: unknown cmd- %#x\n", cmd_no); mwifiex_sta_prepare_cmd()
2258 /* Send cmd to FW to enable/disable 11D function */ mwifiex_sta_init_cmd()
2268 /* Send cmd to FW to configure 11n specific configuration mwifiex_sta_init_cmd()
47 mwifiex_cmd_802_11_rssi_info(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action) mwifiex_cmd_802_11_rssi_info() argument
77 mwifiex_cmd_mac_control(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action, u16 *action) mwifiex_cmd_mac_control() argument
112 mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action, u32 cmd_oid, u16 *ul_temp) mwifiex_cmd_802_11_snmp_mib() argument
170 mwifiex_cmd_tx_rate_cfg(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action, u16 *pbitmap_rates) mwifiex_cmd_tx_rate_cfg() argument
289 mwifiex_cmd_rf_tx_power(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action, void *data_buf) mwifiex_cmd_rf_tx_power() argument
306 mwifiex_cmd_rf_antenna(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action, struct mwifiex_ds_ant_cfg *ant_cfg) mwifiex_cmd_rf_antenna() argument
346 mwifiex_cmd_802_11_hs_cfg(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action, struct mwifiex_hs_config_param *hscfg_param) mwifiex_cmd_802_11_hs_cfg() argument
404 mwifiex_cmd_802_11_mac_address(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action) mwifiex_cmd_802_11_mac_address() argument
457 mwifiex_cmd_802_11_deauthenticate(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u8 *mac) mwifiex_cmd_802_11_deauthenticate() argument
561 mwifiex_set_aes_key_v2(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, struct mwifiex_ds_encrypt_key *enc_key, struct host_cmd_ds_802_11_key_material_v2 *km) mwifiex_set_aes_key_v2() argument
614 mwifiex_cmd_802_11_key_material_v2(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action, u32 cmd_oid, struct mwifiex_ds_encrypt_key *enc_key) mwifiex_cmd_802_11_key_material_v2() argument
791 mwifiex_cmd_802_11_key_material_v1(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action, u32 cmd_oid, struct mwifiex_ds_encrypt_key *enc_key) mwifiex_cmd_802_11_key_material_v1() argument
975 mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action, u32 cmd_oid, struct mwifiex_ds_encrypt_key *enc_key) mwifiex_cmd_802_11_key_material() argument
999 mwifiex_cmd_802_11d_domain_info(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action) mwifiex_cmd_802_11d_domain_info() argument
1215 mwifiex_cmd_pcie_host_spec(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 action) mwifiex_cmd_pcie_host_spec() argument
1262 mwifiex_cmd_802_11_subsc_evt(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, struct mwifiex_ds_misc_subsc_evt *subsc_evt_cfg) mwifiex_cmd_802_11_subsc_evt() argument
1402 mwifiex_cmd_mef_cfg(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, struct mwifiex_ds_mef_cfg *mef) mwifiex_cmd_mef_cfg() argument
1485 mwifiex_cmd_cfg_data(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, void *data_buf) mwifiex_cmd_cfg_data() argument
1519 mwifiex_cmd_set_mc_policy(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action, void *data_buf) mwifiex_cmd_set_mc_policy() argument
1534 mwifiex_cmd_robust_coex(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action, bool *is_timeshare) mwifiex_cmd_robust_coex() argument
1562 mwifiex_cmd_coalesce_cfg(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action, void *data_buf) mwifiex_cmd_coalesce_cfg() argument
1626 mwifiex_cmd_tdls_config(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u16 cmd_action, void *data_buf) mwifiex_cmd_tdls_config() argument
1670 mwifiex_cmd_tdls_oper(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, void *data_buf) mwifiex_cmd_tdls_oper() argument
/linux-4.4.14/drivers/android/
H A Dbinder_trace.h31 TP_PROTO(unsigned int cmd, unsigned long arg),
32 TP_ARGS(cmd, arg),
35 __field(unsigned int, cmd)
39 __entry->cmd = cmd;
42 TP_printk("cmd=0x%x arg=0x%lx", __entry->cmd, __entry->arg)
292 TP_PROTO(uint32_t cmd),
293 TP_ARGS(cmd),
295 __field(uint32_t, cmd)
298 __entry->cmd = cmd;
300 TP_printk("cmd=0x%x %s",
301 __entry->cmd,
302 _IOC_NR(__entry->cmd) < ARRAY_SIZE(binder_command_strings) ?
303 binder_command_strings[_IOC_NR(__entry->cmd)] :
308 TP_PROTO(uint32_t cmd),
309 TP_ARGS(cmd),
311 __field(uint32_t, cmd)
314 __entry->cmd = cmd;
316 TP_printk("cmd=0x%x %s",
317 __entry->cmd,
318 _IOC_NR(__entry->cmd) < ARRAY_SIZE(binder_return_strings) ?
319 binder_return_strings[_IOC_NR(__entry->cmd)] :
/linux-4.4.14/arch/powerpc/platforms/82xx/
H A Dpq2.h4 void pq2_restart(char *cmd);
/linux-4.4.14/fs/ext2/
H A Dioctl.c20 long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ext2_ioctl() argument
28 ext2_debug ("cmd = %u, arg = %lu\n", cmd, arg); ext2_ioctl()
30 switch (cmd) { ext2_ioctl()
167 long ext2_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ext2_compat_ioctl() argument
170 switch (cmd) { ext2_compat_ioctl()
172 cmd = EXT2_IOC_GETFLAGS; ext2_compat_ioctl()
175 cmd = EXT2_IOC_SETFLAGS; ext2_compat_ioctl()
178 cmd = EXT2_IOC_GETVERSION; ext2_compat_ioctl()
181 cmd = EXT2_IOC_SETVERSION; ext2_compat_ioctl()
186 return ext2_ioctl(file, cmd, (unsigned long) compat_ptr(arg)); ext2_compat_ioctl()
/linux-4.4.14/drivers/scsi/qla2xxx/
H A Dqla_target.c108 *cmd, struct atio_from_isp *atio, int ha_locked);
112 struct qla_tgt_cmd *cmd);
1298 struct qla_tgt_cmd *cmd; abort_cmd_for_tag() local
1310 list_for_each_entry(cmd, &vha->qla_cmd_list, cmd_list) { abort_cmd_for_tag()
1311 if (tag == cmd->atio.u.isp24.exchange_addr) { abort_cmd_for_tag()
1312 cmd->state = QLA_TGT_STATE_ABORTED; abort_cmd_for_tag()
1331 struct qla_tgt_cmd *cmd; abort_cmds_for_lun() local
1346 list_for_each_entry(cmd, &vha->qla_cmd_list, cmd_list) { abort_cmds_for_lun()
1350 cmd_key = sid_to_key(cmd->atio.u.isp24.fcp_hdr.s_id); abort_cmds_for_lun()
1352 (struct scsi_lun *)&cmd->atio.u.isp24.fcp_cmnd.lun); abort_cmds_for_lun()
1354 cmd->state = QLA_TGT_STATE_ABORTED; abort_cmds_for_lun()
1373 struct qla_tgt_cmd *cmd = __qlt_24xx_handle_abts() local
1376 lun = cmd->unpacked_lun; __qlt_24xx_handle_abts()
1383 /* cmd not in LIO lists, look in qla list */ __qlt_24xx_handle_abts()
1391 "unable to find cmd in driver or LIO for tag 0x%x\n", __qlt_24xx_handle_abts()
1404 "qla_target(%d): %s: Allocation of ABORT cmd failed", __qlt_24xx_handle_abts()
1604 struct qla_tgt_cmd *cmd = prm->cmd; qlt_pci_map_calc_cnt() local
1606 BUG_ON(cmd->sg_cnt == 0); qlt_pci_map_calc_cnt()
1608 prm->sg = (struct scatterlist *)cmd->sg; qlt_pci_map_calc_cnt()
1609 prm->seg_cnt = pci_map_sg(prm->tgt->ha->pdev, cmd->sg, qlt_pci_map_calc_cnt()
1610 cmd->sg_cnt, cmd->dma_data_direction); qlt_pci_map_calc_cnt()
1614 prm->cmd->sg_mapped = 1; qlt_pci_map_calc_cnt()
1616 if (cmd->se_cmd.prot_op == TARGET_PROT_NORMAL) { qlt_pci_map_calc_cnt()
1627 if ((cmd->se_cmd.prot_op == TARGET_PROT_DIN_INSERT) || qlt_pci_map_calc_cnt()
1628 (cmd->se_cmd.prot_op == TARGET_PROT_DOUT_STRIP)) { qlt_pci_map_calc_cnt()
1629 prm->seg_cnt = DIV_ROUND_UP(cmd->bufflen, cmd->blk_sz); qlt_pci_map_calc_cnt()
1634 if (cmd->prot_sg_cnt) { qlt_pci_map_calc_cnt()
1635 prm->prot_sg = cmd->prot_sg; qlt_pci_map_calc_cnt()
1637 cmd->prot_sg, cmd->prot_sg_cnt, qlt_pci_map_calc_cnt()
1638 cmd->dma_data_direction); qlt_pci_map_calc_cnt()
1642 if ((cmd->se_cmd.prot_op == TARGET_PROT_DIN_INSERT) || qlt_pci_map_calc_cnt()
1643 (cmd->se_cmd.prot_op == TARGET_PROT_DOUT_STRIP)) { qlt_pci_map_calc_cnt()
1645 prm->prot_seg_cnt = DIV_ROUND_UP(cmd->bufflen, qlt_pci_map_calc_cnt()
1646 cmd->blk_sz); qlt_pci_map_calc_cnt()
1656 ql_dbg(ql_dbg_tgt, prm->cmd->vha, 0xe04d, qlt_pci_map_calc_cnt()
1658 0, prm->cmd->sg_cnt); qlt_pci_map_calc_cnt()
1662 static void qlt_unmap_sg(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd) qlt_unmap_sg() argument
1666 if (!cmd->sg_mapped) qlt_unmap_sg()
1669 pci_unmap_sg(ha->pdev, cmd->sg, cmd->sg_cnt, cmd->dma_data_direction); qlt_unmap_sg()
1670 cmd->sg_mapped = 0; qlt_unmap_sg()
1672 if (cmd->prot_sg_cnt) qlt_unmap_sg()
1673 pci_unmap_sg(ha->pdev, cmd->prot_sg, cmd->prot_sg_cnt, qlt_unmap_sg()
1674 cmd->dma_data_direction); qlt_unmap_sg()
1676 if (cmd->ctx_dsd_alloced) qlt_unmap_sg()
1677 qla2x00_clean_dsd_pool(ha, NULL, cmd); qlt_unmap_sg()
1679 if (cmd->ctx) qlt_unmap_sg()
1680 dma_pool_free(ha->dl_dma_pool, cmd->ctx, cmd->ctx->crc_ctx_dma); qlt_unmap_sg()
1734 /* always increment cmd handle */ qlt_make_handle()
1742 "empty cmd slots in ha %p\n", vha->vp_idx, ha); qlt_make_handle()
1763 struct atio_from_isp *atio = &prm->cmd->atio; qlt_24xx_build_ctio_pkt()
1783 ha->tgt.cmds[h-1] = prm->cmd; qlt_24xx_build_ctio_pkt()
1786 pkt->nport_handle = prm->cmd->loop_id; qlt_24xx_build_ctio_pkt()
1795 pkt->u.status0.relative_offset = cpu_to_le32(prm->cmd->offset); qlt_24xx_build_ctio_pkt()
1871 pkt24->u.status0.transfer_length = cpu_to_le32(prm->cmd->bufflen); qlt_load_data_segments()
1908 static inline int qlt_has_data(struct qla_tgt_cmd *cmd) qlt_has_data() argument
1910 return cmd->bufflen > 0; qlt_has_data()
1916 static int qlt_pre_xmit_response(struct qla_tgt_cmd *cmd, qlt_pre_xmit_response() argument
1920 struct qla_tgt *tgt = cmd->tgt; qlt_pre_xmit_response()
1923 struct se_cmd *se_cmd = &cmd->se_cmd; qlt_pre_xmit_response()
1925 prm->cmd = cmd; qlt_pre_xmit_response()
1928 prm->sense_buffer = &cmd->sense_buffer[0]; qlt_pre_xmit_response()
1939 if ((xmit_type & QLA_TGT_XMIT_DATA) && qlt_has_data(cmd)) { qlt_pre_xmit_response()
1952 cmd->bufflen, prm->rq_result); qlt_pre_xmit_response()
1959 se_cmd->t_task_cdb[0] : 0, cmd->bufflen, prm->rq_result); qlt_pre_xmit_response()
1968 if (qlt_has_data(cmd)) { qlt_pre_xmit_response()
1982 struct qla_tgt_cmd *cmd, int sending_sense) qlt_need_explicit_conf()
1988 return cmd->conf_compl_supported; qlt_need_explicit_conf()
1991 cmd->conf_compl_supported; qlt_need_explicit_conf()
2025 static void qlt_check_srr_debug(struct qla_tgt_cmd *cmd, int *xmit_type) qlt_check_srr_debug() argument
2031 ql_dbg(ql_dbg_tgt_mgt, cmd->vha, 0xf015, qlt_check_srr_debug()
2032 "Dropping cmd %p (tag %d) status", cmd, se_cmd->tag); qlt_check_srr_debug()
2039 if (cmd->dma_data_direction != DMA_FROM_DEVICE) qlt_check_srr_debug()
2042 if (qlt_has_data(cmd) && (cmd->sg_cnt > 1) && qlt_check_srr_debug()
2048 leave = qlt_srr_random() % cmd->sg_cnt; qlt_check_srr_debug()
2051 tot_len += cmd->sg[i].length; qlt_check_srr_debug()
2053 ql_dbg(ql_dbg_tgt_mgt, cmd->vha, 0xf016, qlt_check_srr_debug()
2054 "Cutting cmd %p (tag %d) buffer" qlt_check_srr_debug()
2055 " tail to len %d, sg_cnt %d (cmd->bufflen %d," qlt_check_srr_debug()
2056 " cmd->sg_cnt %d)", cmd, se_cmd->tag, tot_len, leave, qlt_check_srr_debug()
2057 cmd->bufflen, cmd->sg_cnt); qlt_check_srr_debug()
2059 cmd->bufflen = tot_len; qlt_check_srr_debug()
2060 cmd->sg_cnt = leave; qlt_check_srr_debug()
2063 if (qlt_has_data(cmd) && ((qlt_srr_random() % 100) == 70)) { qlt_check_srr_debug()
2064 unsigned int offset = qlt_srr_random() % cmd->bufflen; qlt_check_srr_debug()
2066 ql_dbg(ql_dbg_tgt_mgt, cmd->vha, 0xf017, qlt_check_srr_debug()
2067 "Cutting cmd %p (tag %d) buffer head " qlt_check_srr_debug()
2068 "to offset %d (cmd->bufflen %d)", cmd, se_cmd->tag, offset, qlt_check_srr_debug()
2069 cmd->bufflen); qlt_check_srr_debug()
2072 else if (qlt_set_data_offset(cmd, offset)) { qlt_check_srr_debug()
2073 ql_dbg(ql_dbg_tgt_mgt, cmd->vha, 0xf018, qlt_check_srr_debug()
2079 static inline void qlt_check_srr_debug(struct qla_tgt_cmd *cmd, int *xmit_type) qlt_check_srr_debug() argument
2089 if (qlt_need_explicit_conf(prm->tgt->ha, prm->cmd, 0)) { qlt_24xx_init_ctio_to_isp()
2099 if (qlt_need_explicit_conf(prm->tgt->ha, prm->cmd, 1)) { qlt_24xx_init_ctio_to_isp()
2100 if (prm->cmd->se_cmd.scsi_status != 0) { qlt_24xx_init_ctio_to_isp()
2101 ql_dbg(ql_dbg_tgt, prm->cmd->vha, 0xe017, qlt_24xx_init_ctio_to_isp()
2157 if (!sp->cmd->prot_chk) qlt_hba_err_chk_enabled()
2190 /* wait til Mode Sense/Select cmd, modepage Ah, subpage 2 qlt_set_t10dif_tags()
2271 struct qla_tgt_cmd *cmd = prm->cmd; qlt_build_ctio_crc2_pkt() local
2272 struct se_cmd *se_cmd = &cmd->se_cmd; qlt_build_ctio_crc2_pkt()
2274 struct atio_from_isp *atio = &prm->cmd->atio; qlt_build_ctio_crc2_pkt()
2284 "qla_target(%d):%s: se_cmd[%p] CRC2 prot_op[0x%x] cmd prot sg:cnt[%p:%x] lba[%llu]\n", qlt_build_ctio_crc2_pkt()
2293 data_bytes = cmd->bufflen; qlt_build_ctio_crc2_pkt()
2294 dif_bytes = (data_bytes / cmd->blk_sz) * 8; qlt_build_ctio_crc2_pkt()
2361 ha->tgt.cmds[h-1] = prm->cmd; qlt_build_ctio_crc2_pkt()
2365 pkt->nport_handle = prm->cmd->loop_id; qlt_build_ctio_crc2_pkt()
2378 pkt->relative_offset = cpu_to_le32(prm->cmd->offset); qlt_build_ctio_crc2_pkt()
2381 if (cmd->dma_data_direction == DMA_TO_DEVICE) qlt_build_ctio_crc2_pkt()
2383 else if (cmd->dma_data_direction == DMA_FROM_DEVICE) qlt_build_ctio_crc2_pkt()
2395 crc_ctx_pkt = cmd->ctx = qlt_build_ctio_crc2_pkt()
2433 crc_ctx_pkt->blk_size = cpu_to_le16(cmd->blk_sz); qlt_build_ctio_crc2_pkt()
2444 prm->tot_dsds, cmd)) qlt_build_ctio_crc2_pkt()
2447 (prm->tot_dsds - prm->prot_seg_cnt), cmd)) qlt_build_ctio_crc2_pkt()
2456 prm->prot_seg_cnt, cmd)) qlt_build_ctio_crc2_pkt()
2472 int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, qlt_xmit_response() argument
2475 struct scsi_qla_host *vha = cmd->vha; qlt_xmit_response()
2484 if (cmd->sess && cmd->sess->deleted == QLA_SESS_DELETION_IN_PROGRESS) { qlt_xmit_response()
2485 cmd->state = QLA_TGT_STATE_PROCESSED; qlt_xmit_response()
2486 if (cmd->sess->logout_completed) qlt_xmit_response()
2488 qlt_abort_cmd_on_host_reset(cmd->vha, cmd); qlt_xmit_response()
2490 qlt_send_term_exchange(vha, cmd, &cmd->atio, 1); qlt_xmit_response()
2497 qlt_check_srr_debug(cmd, &xmit_type); qlt_xmit_response()
2499 ql_dbg(ql_dbg_tgt, cmd->vha, 0xe018, qlt_xmit_response()
2500 "is_send_status=%d, cmd->bufflen=%d, cmd->sg_cnt=%d, cmd->dma_data_direction=%d se_cmd[%p]\n", qlt_xmit_response()
2502 1 : 0, cmd->bufflen, cmd->sg_cnt, cmd->dma_data_direction, qlt_xmit_response()
2503 &cmd->se_cmd); qlt_xmit_response()
2505 res = qlt_pre_xmit_response(cmd, &prm, xmit_type, scsi_status, qlt_xmit_response()
2513 if (qla2x00_reset_active(vha) || cmd->reset_count != ha->chip_reset) { qlt_xmit_response()
2518 cmd->state = QLA_TGT_STATE_PROCESSED; qlt_xmit_response()
2519 qlt_abort_cmd_on_host_reset(cmd->vha, cmd); qlt_xmit_response()
2522 qla2x00_reset_active(vha), cmd->reset_count, qlt_xmit_response()
2533 if (cmd->se_cmd.prot_op && (xmit_type & QLA_TGT_XMIT_DATA)) qlt_xmit_response()
2544 if (qlt_has_data(cmd) && (xmit_type & QLA_TGT_XMIT_DATA)) { qlt_xmit_response()
2549 if (cmd->se_cmd.prot_op == TARGET_PROT_NORMAL) qlt_xmit_response()
2560 if (qlt_need_explicit_conf(ha, cmd, 0)) { qlt_xmit_response()
2610 cmd->state = QLA_TGT_STATE_PROCESSED; /* Mid-level is done processing */ qlt_xmit_response()
2611 cmd->cmd_sent_to_fw = 1; qlt_xmit_response()
2621 qlt_unmap_sg(vha, cmd); qlt_xmit_response()
2628 int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd) qlt_rdy_to_xfer() argument
2631 struct scsi_qla_host *vha = cmd->vha; qlt_rdy_to_xfer()
2633 struct qla_tgt *tgt = cmd->tgt; qlt_rdy_to_xfer()
2639 prm.cmd = cmd; qlt_rdy_to_xfer()
2654 if (qla2x00_reset_active(vha) || (cmd->reset_count != ha->chip_reset) || qlt_rdy_to_xfer()
2655 (cmd->sess && cmd->sess->deleted == QLA_SESS_DELETION_IN_PROGRESS)) { qlt_rdy_to_xfer()
2660 cmd->state = QLA_TGT_STATE_NEED_DATA; qlt_rdy_to_xfer()
2661 qlt_abort_cmd_on_host_reset(cmd->vha, cmd); qlt_rdy_to_xfer()
2664 qla2x00_reset_active(vha), cmd->reset_count, qlt_rdy_to_xfer()
2674 if (cmd->se_cmd.prot_op) qlt_rdy_to_xfer()
2688 if (cmd->se_cmd.prot_op == TARGET_PROT_NORMAL) qlt_rdy_to_xfer()
2691 cmd->state = QLA_TGT_STATE_NEED_DATA; qlt_rdy_to_xfer()
2692 cmd->cmd_sent_to_fw = 1; qlt_rdy_to_xfer()
2702 qlt_unmap_sg(vha, cmd); qlt_rdy_to_xfer()
2715 qlt_handle_dif_error(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd, qlt_handle_dif_error() argument
2723 uint64_t lba = cmd->se_cmd.t_task_lba; qlt_handle_dif_error()
2738 cmd->atio.u.isp24.fcp_cmnd.cdb[0], lba, qlt_handle_dif_error()
2747 ((cmd->se_cmd.prot_type != TARGET_DIF_TYPE3_PROT) || qlt_handle_dif_error()
2753 cmd->se_cmd.bad_sector = e_ref_tag; qlt_handle_dif_error()
2754 cmd->se_cmd.pi_err = 0; qlt_handle_dif_error()
2759 if (cmd->prot_sg_cnt) { qlt_handle_dif_error()
2764 sgl = cmd->prot_sg; qlt_handle_dif_error()
2767 for_each_sg(sgl, sg, cmd->prot_sg_cnt, i) { qlt_handle_dif_error()
2794 if (cmd->se_cmd.prot_type == SCSI_PROT_DIF_TYPE3) qlt_handle_dif_error()
2804 cmd->se_cmd.pi_err = TCM_LOGICAL_BLOCK_GUARD_CHECK_FAILED; qlt_handle_dif_error()
2805 cmd->se_cmd.bad_sector = cmd->se_cmd.t_task_lba; qlt_handle_dif_error()
2808 "Guard ERR: cdb 0x%x lba 0x%llx: [Actual|Expected] Ref Tag[0x%x|0x%x], App Tag [0x%x|0x%x], Guard [0x%x|0x%x] cmd=%p\n", qlt_handle_dif_error()
2809 cmd->atio.u.isp24.fcp_cmnd.cdb[0], lba, qlt_handle_dif_error()
2811 a_guard, e_guard, cmd); qlt_handle_dif_error()
2817 cmd->se_cmd.pi_err = TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED; qlt_handle_dif_error()
2818 cmd->se_cmd.bad_sector = e_ref_tag; qlt_handle_dif_error()
2821 "Ref Tag ERR: cdb 0x%x lba 0x%llx: [Actual|Expected] Ref Tag[0x%x|0x%x], App Tag [0x%x|0x%x], Guard [0x%x|0x%x] cmd=%p\n", qlt_handle_dif_error()
2822 cmd->atio.u.isp24.fcp_cmnd.cdb[0], lba, qlt_handle_dif_error()
2824 a_guard, e_guard, cmd); qlt_handle_dif_error()
2830 cmd->se_cmd.pi_err = TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED; qlt_handle_dif_error()
2831 cmd->se_cmd.bad_sector = cmd->se_cmd.t_task_lba; qlt_handle_dif_error()
2834 "App Tag ERR: cdb 0x%x lba 0x%llx: [Actual|Expected] Ref Tag[0x%x|0x%x], App Tag [0x%x|0x%x], Guard [0x%x|0x%x] cmd=%p\n", qlt_handle_dif_error()
2835 cmd->atio.u.isp24.fcp_cmnd.cdb[0], lba, qlt_handle_dif_error()
2837 a_guard, e_guard, cmd); qlt_handle_dif_error()
2931 struct qla_tgt_cmd *cmd, __qlt_send_term_exchange()
2950 if (cmd != NULL) { __qlt_send_term_exchange()
2951 if (cmd->state < QLA_TGT_STATE_PROCESSED) { __qlt_send_term_exchange()
2953 "qla_target(%d): Terminating cmd %p with " __qlt_send_term_exchange()
2954 "incorrect state %d\n", vha->vp_idx, cmd, __qlt_send_term_exchange()
2955 cmd->state); __qlt_send_term_exchange()
2965 ctio24->nport_handle = cmd ? cmd->loop_id : CTIO7_NHANDLE_UNRECOGNIZED; __qlt_send_term_exchange()
2992 struct qla_tgt_cmd *cmd, struct atio_from_isp *atio, int ha_locked) qlt_send_term_exchange()
3001 rc = __qlt_send_term_exchange(vha, cmd, atio); qlt_send_term_exchange()
3007 rc = __qlt_send_term_exchange(vha, cmd, atio); qlt_send_term_exchange()
3012 if (cmd && ((cmd->state != QLA_TGT_STATE_ABORTED) || qlt_send_term_exchange()
3013 !cmd->cmd_sent_to_fw)) { qlt_send_term_exchange()
3014 if (cmd->sg_mapped) qlt_send_term_exchange()
3015 qlt_unmap_sg(vha, cmd); qlt_send_term_exchange()
3016 vha->hw->tgt.tgt_ops->free_cmd(cmd); qlt_send_term_exchange()
3028 struct qla_tgt_cmd *cmd, *tcmd; qlt_init_term_exchange() local
3033 cmd = tcmd = NULL; qlt_init_term_exchange()
3038 list_for_each_entry_safe(cmd, tcmd, &free_list, cmd_list) { qlt_init_term_exchange()
3039 list_del(&cmd->cmd_list); qlt_init_term_exchange()
3040 /* This cmd was never sent to TCM. There is no need qlt_init_term_exchange()
3043 qlt_free_cmd(cmd); qlt_init_term_exchange()
3072 void qlt_abort_cmd(struct qla_tgt_cmd *cmd) qlt_abort_cmd() argument
3074 struct qla_tgt *tgt = cmd->tgt; qlt_abort_cmd()
3076 struct se_cmd *se_cmd = &cmd->se_cmd; qlt_abort_cmd()
3079 "qla_target(%d): terminating exchange for aborted cmd=%p " qlt_abort_cmd()
3080 "(se_cmd=%p, tag=%llu)", vha->vp_idx, cmd, &cmd->se_cmd, qlt_abort_cmd()
3083 cmd->state = QLA_TGT_STATE_ABORTED; qlt_abort_cmd()
3084 cmd->cmd_flags |= BIT_6; qlt_abort_cmd()
3086 qlt_send_term_exchange(vha, cmd, &cmd->atio, 0); qlt_abort_cmd()
3090 void qlt_free_cmd(struct qla_tgt_cmd *cmd) qlt_free_cmd() argument
3092 struct qla_tgt_sess *sess = cmd->sess; qlt_free_cmd()
3094 ql_dbg(ql_dbg_tgt, cmd->vha, 0xe074, qlt_free_cmd()
3096 __func__, &cmd->se_cmd, qlt_free_cmd()
3097 be16_to_cpu(cmd->atio.u.isp24.fcp_hdr.ox_id)); qlt_free_cmd()
3099 BUG_ON(cmd->cmd_in_wq); qlt_free_cmd()
3101 if (!cmd->q_full) qlt_free_cmd()
3102 qlt_decr_num_pend_cmds(cmd->vha); qlt_free_cmd()
3104 BUG_ON(cmd->sg_mapped); qlt_free_cmd()
3105 cmd->jiffies_at_free = get_jiffies_64(); qlt_free_cmd()
3106 if (unlikely(cmd->free_sg)) qlt_free_cmd()
3107 kfree(cmd->sg); qlt_free_cmd()
3113 cmd->jiffies_at_free = get_jiffies_64(); qlt_free_cmd()
3114 percpu_ida_free(&sess->se_sess->sess_tag_pool, cmd->se_cmd.map_tag); qlt_free_cmd()
3120 struct qla_tgt_cmd *cmd, void *ctio) qlt_prepare_srr_ctio()
3127 cmd->cmd_flags |= BIT_15; qlt_prepare_srr_ctio()
3141 sc->cmd = cmd; qlt_prepare_srr_ctio()
3206 struct qla_tgt_cmd *cmd, uint32_t status) qlt_term_ctio_exchange()
3218 qlt_send_term_exchange(vha, cmd, &cmd->atio, 1); qlt_term_ctio_exchange()
3231 struct qla_tgt_cmd *cmd = ha->tgt.cmds[handle]; qlt_get_cmd() local
3233 return cmd; qlt_get_cmd()
3242 struct qla_tgt_cmd *cmd = NULL; qlt_ctio_to_cmd() local
3259 cmd = qlt_get_cmd(vha, handle); qlt_ctio_to_cmd()
3260 if (unlikely(cmd == NULL)) { qlt_ctio_to_cmd()
3275 return cmd; qlt_ctio_to_cmd()
3280 qlt_abort_cmd_on_host_reset(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd) qlt_abort_cmd_on_host_reset() argument
3285 if (cmd->sg_mapped) qlt_abort_cmd_on_host_reset()
3286 qlt_unmap_sg(vha, cmd); qlt_abort_cmd_on_host_reset()
3291 if (cmd->state == QLA_TGT_STATE_PROCESSED) { qlt_abort_cmd_on_host_reset()
3294 } else if (cmd->state == QLA_TGT_STATE_NEED_DATA) { qlt_abort_cmd_on_host_reset()
3295 cmd->write_data_transferred = 0; qlt_abort_cmd_on_host_reset()
3296 cmd->state = QLA_TGT_STATE_DATA_IN; qlt_abort_cmd_on_host_reset()
3301 ha->tgt.tgt_ops->handle_data(cmd); qlt_abort_cmd_on_host_reset()
3303 } else if (cmd->state == QLA_TGT_STATE_ABORTED) { qlt_abort_cmd_on_host_reset()
3309 cmd->state); qlt_abort_cmd_on_host_reset()
3313 cmd->cmd_flags |= BIT_17; qlt_abort_cmd_on_host_reset()
3314 ha->tgt.tgt_ops->free_cmd(cmd); qlt_abort_cmd_on_host_reset()
3320 struct qla_tgt_cmd *cmd; qlt_host_reset_handler() local
3342 cmd = qlt_get_cmd(base_vha, i); qlt_host_reset_handler()
3343 if (!cmd) qlt_host_reset_handler()
3346 vha = cmd->vha; qlt_host_reset_handler()
3347 qlt_abort_cmd_on_host_reset(vha, cmd); qlt_host_reset_handler()
3361 struct qla_tgt_cmd *cmd; qlt_do_ctio_completion() local
3373 cmd = qlt_ctio_to_cmd(vha, handle, ctio); qlt_do_ctio_completion()
3374 if (cmd == NULL) qlt_do_ctio_completion()
3377 se_cmd = &cmd->se_cmd; qlt_do_ctio_completion()
3378 cmd->cmd_sent_to_fw = 0; qlt_do_ctio_completion()
3380 qlt_unmap_sg(vha, cmd); qlt_do_ctio_completion()
3396 status, cmd->state, se_cmd); qlt_do_ctio_completion()
3405 status, cmd->state, se_cmd); qlt_do_ctio_completion()
3412 vha->vp_idx, status, cmd->state, se_cmd); qlt_do_ctio_completion()
3413 if (qlt_prepare_srr_ctio(vha, cmd, ctio) != 0) qlt_do_ctio_completion()
3423 vha->vp_idx, status, cmd->state, se_cmd, qlt_do_ctio_completion()
3427 if (qlt_handle_dif_error(vha, cmd, ctio)) { qlt_do_ctio_completion()
3428 if (cmd->state == QLA_TGT_STATE_NEED_DATA) { qlt_do_ctio_completion()
3436 cmd->state = QLA_TGT_STATE_PROCESSED; qlt_do_ctio_completion()
3437 ha->tgt.tgt_ops->handle_dif_err(cmd); qlt_do_ctio_completion()
3452 vha->vp_idx, status, cmd->state, se_cmd); qlt_do_ctio_completion()
3457 /* "cmd->state == QLA_TGT_STATE_ABORTED" means qlt_do_ctio_completion()
3458 * cmd is already aborted/terminated, we don't qlt_do_ctio_completion()
3463 if ((cmd->state != QLA_TGT_STATE_NEED_DATA) && qlt_do_ctio_completion()
3464 (cmd->state != QLA_TGT_STATE_ABORTED)) { qlt_do_ctio_completion()
3465 cmd->cmd_flags |= BIT_13; qlt_do_ctio_completion()
3466 if (qlt_term_ctio_exchange(vha, ctio, cmd, status)) qlt_do_ctio_completion()
3472 if (cmd->state == QLA_TGT_STATE_PROCESSED) { qlt_do_ctio_completion()
3473 cmd->cmd_flags |= BIT_12; qlt_do_ctio_completion()
3474 } else if (cmd->state == QLA_TGT_STATE_NEED_DATA) { qlt_do_ctio_completion()
3475 cmd->state = QLA_TGT_STATE_DATA_IN; qlt_do_ctio_completion()
3478 cmd->write_data_transferred = 1; qlt_do_ctio_completion()
3480 ha->tgt.tgt_ops->handle_data(cmd); qlt_do_ctio_completion()
3482 } else if (cmd->state == QLA_TGT_STATE_ABORTED) { qlt_do_ctio_completion()
3483 cmd->cmd_flags |= BIT_18; qlt_do_ctio_completion()
3485 "Aborted command %p (tag %lld) finished\n", cmd, se_cmd->tag); qlt_do_ctio_completion()
3487 cmd->cmd_flags |= BIT_19; qlt_do_ctio_completion()
3490 "not return a CTIO complete\n", vha->vp_idx, cmd->state); qlt_do_ctio_completion()
3494 (cmd->state != QLA_TGT_STATE_ABORTED)) { qlt_do_ctio_completion()
3499 ha->tgt.tgt_ops->free_cmd(cmd); qlt_do_ctio_completion()
3539 static void __qlt_do_work(struct qla_tgt_cmd *cmd) __qlt_do_work() argument
3541 scsi_qla_host_t *vha = cmd->vha; __qlt_do_work()
3544 struct qla_tgt_sess *sess = cmd->sess; __qlt_do_work()
3545 struct atio_from_isp *atio = &cmd->atio; __qlt_do_work()
3551 cmd->cmd_in_wq = 0; __qlt_do_work()
3552 cmd->cmd_flags |= BIT_1; __qlt_do_work()
3556 if (cmd->state == QLA_TGT_STATE_ABORTED) { __qlt_do_work()
3558 "cmd with tag %u is aborted\n", __qlt_do_work()
3559 cmd->atio.u.isp24.exchange_addr); __qlt_do_work()
3564 cmd->se_cmd.tag = atio->u.isp24.exchange_addr; __qlt_do_work()
3565 cmd->unpacked_lun = scsilun_to_int( __qlt_do_work()
3585 ret = ha->tgt.tgt_ops->handle_cmd(vha, cmd, cdb, data_length, __qlt_do_work()
3598 ql_dbg(ql_dbg_io, vha, 0x3060, "Terminating work cmd %p", cmd); __qlt_do_work()
3600 * cmd has not sent to target yet, so pass NULL as the second __qlt_do_work()
3603 cmd->cmd_flags |= BIT_2; __qlt_do_work()
3605 qlt_send_term_exchange(vha, NULL, &cmd->atio, 1); __qlt_do_work()
3608 percpu_ida_free(&sess->se_sess->sess_tag_pool, cmd->se_cmd.map_tag); __qlt_do_work()
3615 struct qla_tgt_cmd *cmd = container_of(work, struct qla_tgt_cmd, work); qlt_do_work() local
3616 scsi_qla_host_t *vha = cmd->vha; qlt_do_work()
3620 list_del(&cmd->cmd_list); qlt_do_work()
3623 __qlt_do_work(cmd); qlt_do_work()
3631 struct qla_tgt_cmd *cmd; qlt_get_tag() local
3638 cmd = &((struct qla_tgt_cmd *)se_sess->sess_cmd_map)[tag]; qlt_get_tag()
3639 memset(cmd, 0, sizeof(struct qla_tgt_cmd)); qlt_get_tag()
3641 memcpy(&cmd->atio, atio, sizeof(*atio)); qlt_get_tag()
3642 cmd->state = QLA_TGT_STATE_NEW; qlt_get_tag()
3643 cmd->tgt = vha->vha_tgt.qla_tgt; qlt_get_tag()
3645 cmd->vha = vha; qlt_get_tag()
3646 cmd->se_cmd.map_tag = tag; qlt_get_tag()
3647 cmd->sess = sess; qlt_get_tag()
3648 cmd->loop_id = sess->loop_id; qlt_get_tag()
3649 cmd->conf_compl_supported = sess->conf_compl_supported; qlt_get_tag()
3651 cmd->cmd_flags = 0; qlt_get_tag()
3652 cmd->jiffies_at_alloc = get_jiffies_64(); qlt_get_tag()
3654 cmd->reset_count = vha->hw->chip_reset; qlt_get_tag()
3656 return cmd; qlt_get_tag()
3669 struct qla_tgt_cmd *cmd; qlt_create_sess_from_atio() local
3707 cmd = qlt_get_tag(vha, sess, &op->atio); qlt_create_sess_from_atio()
3708 if (!cmd) { qlt_create_sess_from_atio()
3720 __qlt_do_work(cmd); qlt_create_sess_from_atio()
3739 struct qla_tgt_cmd *cmd; qlt_handle_cmd_for_atio() local
3780 cmd = qlt_get_tag(vha, sess, atio); qlt_handle_cmd_for_atio()
3781 if (!cmd) { qlt_handle_cmd_for_atio()
3783 "qla_target(%d): Allocation of cmd failed\n", vha->vp_idx); qlt_handle_cmd_for_atio()
3788 cmd->cmd_in_wq = 1; qlt_handle_cmd_for_atio()
3789 cmd->cmd_flags |= BIT_0; qlt_handle_cmd_for_atio()
3792 list_add_tail(&cmd->cmd_list, &vha->qla_cmd_list); qlt_handle_cmd_for_atio()
3795 INIT_WORK(&cmd->work, qlt_do_work); qlt_handle_cmd_for_atio()
3796 queue_work(qla_tgt_wq, &cmd->work); qlt_handle_cmd_for_atio()
3956 "qla_target(%d): %s: Allocation of ABORT cmd failed\n", __qlt_abort_task()
4103 struct qla_tgt_cmd *cmd; abort_cmds_for_s_id() local
4119 list_for_each_entry(cmd, &vha->qla_cmd_list, cmd_list) { abort_cmds_for_s_id()
4120 uint32_t cmd_key = sid_to_key(cmd->atio.u.isp24.fcp_hdr.s_id); abort_cmds_for_s_id()
4122 cmd->state = QLA_TGT_STATE_ABORTED; abort_cmds_for_s_id()
4308 static int qlt_set_data_offset(struct qla_tgt_cmd *cmd, uint32_t offset) qlt_set_data_offset() argument
4322 ql_dbg(ql_dbg_tgt, cmd->vha, 0xe023, qlt_set_data_offset()
4323 "Entering qla_tgt_set_data_offset: cmd: %p, cmd->sg: %p, " qlt_set_data_offset()
4324 "cmd->sg_cnt: %u, direction: %d\n", qlt_set_data_offset()
4325 cmd, cmd->sg, cmd->sg_cnt, cmd->dma_data_direction); qlt_set_data_offset()
4327 if (!cmd->sg || !cmd->sg_cnt) { qlt_set_data_offset()
4328 ql_dbg(ql_dbg_tgt, cmd->vha, 0xe055, qlt_set_data_offset()
4329 "Missing cmd->sg or zero cmd->sg_cnt in" qlt_set_data_offset()
4334 * Walk the current cmd->sg list until we locate the new sg_srr_start qlt_set_data_offset()
4336 for_each_sg(cmd->sg, sg, cmd->sg_cnt, i) { qlt_set_data_offset()
4337 ql_dbg(ql_dbg_tgt, cmd->vha, 0xe024, qlt_set_data_offset()
4344 ql_dbg(ql_dbg_tgt, cmd->vha, 0xe025, qlt_set_data_offset()
4355 ql_dbg(ql_dbg_tgt, cmd->vha, 0xe056, qlt_set_data_offset()
4359 sg_srr_cnt = (cmd->sg_cnt - i); qlt_set_data_offset()
4363 ql_dbg(ql_dbg_tgt, cmd->vha, 0xe057, qlt_set_data_offset()
4388 cmd->sg = sg_srr; qlt_set_data_offset()
4389 cmd->sg_cnt = sg_srr_cnt; qlt_set_data_offset()
4390 cmd->bufflen = bufflen; qlt_set_data_offset()
4391 cmd->offset += offset; qlt_set_data_offset()
4392 cmd->free_sg = 1; qlt_set_data_offset()
4394 ql_dbg(ql_dbg_tgt, cmd->vha, 0xe026, "New cmd->sg: %p\n", cmd->sg); qlt_set_data_offset()
4395 ql_dbg(ql_dbg_tgt, cmd->vha, 0xe027, "New cmd->sg_cnt: %u\n", qlt_set_data_offset()
4396 cmd->sg_cnt); qlt_set_data_offset()
4397 ql_dbg(ql_dbg_tgt, cmd->vha, 0xe028, "New cmd->bufflen: %u\n", qlt_set_data_offset()
4398 cmd->bufflen); qlt_set_data_offset()
4399 ql_dbg(ql_dbg_tgt, cmd->vha, 0xe029, "New cmd->offset: %u\n", qlt_set_data_offset()
4400 cmd->offset); qlt_set_data_offset()
4402 if (cmd->sg_cnt < 0) qlt_set_data_offset()
4405 if (cmd->bufflen < 0) qlt_set_data_offset()
4412 static inline int qlt_srr_adjust_data(struct qla_tgt_cmd *cmd, qlt_srr_adjust_data() argument
4417 rel_offs = srr_rel_offs - cmd->offset; qlt_srr_adjust_data()
4418 ql_dbg(ql_dbg_tgt_mgt, cmd->vha, 0xf027, "srr_rel_offs=%d, rel_offs=%d", qlt_srr_adjust_data()
4424 ql_dbg(ql_dbg_tgt_mgt, cmd->vha, 0xf062, qlt_srr_adjust_data()
4426 cmd->vha->vp_idx, rel_offs); qlt_srr_adjust_data()
4428 } else if (rel_offs == cmd->bufflen) qlt_srr_adjust_data()
4431 res = qlt_set_data_offset(cmd, rel_offs); qlt_srr_adjust_data()
4443 struct qla_tgt_cmd *cmd = sctio->cmd; qlt_handle_srr() local
4444 struct se_cmd *se_cmd = &cmd->se_cmd; qlt_handle_srr()
4453 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf028, "SRR cmd %p, srr_ui %x\n", qlt_handle_srr()
4454 cmd, srr_ui); qlt_handle_srr()
4466 if (!cmd->sg || !cmd->sg_cnt) { qlt_handle_srr()
4469 " missing cmd->sg, state: %d\n", cmd->state); qlt_handle_srr()
4479 cmd->bufflen = se_cmd->data_length; qlt_handle_srr()
4481 if (qlt_has_data(cmd)) { qlt_handle_srr()
4482 if (qlt_srr_adjust_data(cmd, offset, &xmit_type) != 0) qlt_handle_srr()
4491 "qla_target(%d): SRR for in data for cmd without them (tag %lld, SCSI status %d), reject", qlt_handle_srr()
4493 cmd->se_cmd.scsi_status); qlt_handle_srr()
4498 if (!cmd->sg || !cmd->sg_cnt) { qlt_handle_srr()
4501 " missing cmd->sg\n"); qlt_handle_srr()
4511 cmd->bufflen = se_cmd->data_length; qlt_handle_srr()
4513 if (qlt_has_data(cmd)) { qlt_handle_srr()
4514 if (qlt_srr_adjust_data(cmd, offset, &xmit_type) != 0) qlt_handle_srr()
4521 cmd->cmd_flags |= BIT_8; qlt_handle_srr()
4522 qlt_rdy_to_xfer(cmd); qlt_handle_srr()
4526 "qla_target(%d): SRR for out data for cmd without them (tag %lld, SCSI status %d), reject", qlt_handle_srr()
4527 vha->vp_idx, se_cmd->tag, cmd->se_cmd.scsi_status); qlt_handle_srr()
4540 cmd->cmd_flags |= BIT_7; qlt_handle_srr()
4541 qlt_xmit_response(cmd, xmit_type, se_cmd->scsi_status); qlt_handle_srr()
4552 if (cmd->state == QLA_TGT_STATE_NEED_DATA) { qlt_handle_srr()
4553 cmd->state = QLA_TGT_STATE_DATA_IN; qlt_handle_srr()
4556 cmd->cmd_flags |= BIT_9; qlt_handle_srr()
4557 qlt_send_term_exchange(vha, cmd, &cmd->atio, 1); qlt_handle_srr()
4600 struct qla_tgt_cmd *cmd; qlt_handle_srr_work() local
4634 cmd = sctio->cmd; qlt_handle_srr_work()
4640 cmd->offset = 0; qlt_handle_srr_work()
4641 if (cmd->free_sg) { qlt_handle_srr_work()
4642 kfree(cmd->sg); qlt_handle_srr_work()
4643 cmd->sg = NULL; qlt_handle_srr_work()
4644 cmd->free_sg = 0; qlt_handle_srr_work()
4646 se_cmd = &cmd->se_cmd; qlt_handle_srr_work()
4648 cmd->sg_cnt = se_cmd->t_data_nents; qlt_handle_srr_work()
4649 cmd->sg = se_cmd->t_data_sg; qlt_handle_srr_work()
4652 "SRR cmd %p (se_cmd %p, tag %lld, op %x), sg_cnt=%d, offset=%d", qlt_handle_srr_work()
4653 cmd, &cmd->se_cmd, se_cmd->tag, se_cmd->t_task_cdb ? qlt_handle_srr_work()
4654 se_cmd->t_task_cdb[0] : 0, cmd->sg_cnt, cmd->offset); qlt_handle_srr_work()
4735 qlt_send_term_exchange(vha, sctio->cmd, qlt_prepare_srr_imm()
4736 &sctio->cmd->atio, 1); qlt_prepare_srr_imm()
4960 struct qla_tgt_cmd *cmd; qlt_alloc_qfull_cmd() local
4996 cmd = &((struct qla_tgt_cmd *)se_sess->sess_cmd_map)[tag]; qlt_alloc_qfull_cmd()
4997 if (!cmd) { qlt_alloc_qfull_cmd()
4999 "qla_target(%d): %s: Allocation of cmd failed\n", qlt_alloc_qfull_cmd()
5012 memset(cmd, 0, sizeof(struct qla_tgt_cmd)); qlt_alloc_qfull_cmd()
5015 INIT_LIST_HEAD(&cmd->cmd_list); qlt_alloc_qfull_cmd()
5016 memcpy(&cmd->atio, atio, sizeof(*atio)); qlt_alloc_qfull_cmd()
5018 cmd->tgt = vha->vha_tgt.qla_tgt; qlt_alloc_qfull_cmd()
5019 cmd->vha = vha; qlt_alloc_qfull_cmd()
5020 cmd->reset_count = vha->hw->chip_reset; qlt_alloc_qfull_cmd()
5021 cmd->q_full = 1; qlt_alloc_qfull_cmd()
5024 cmd->q_full = 1; qlt_alloc_qfull_cmd()
5026 cmd->state = status; qlt_alloc_qfull_cmd()
5028 cmd->term_exchg = 1; qlt_alloc_qfull_cmd()
5030 list_add_tail(&cmd->cmd_list, &vha->hw->tgt.q_full_list); qlt_alloc_qfull_cmd()
5044 struct qla_tgt_cmd *cmd, *tcmd; qlt_free_qfull_cmds() local
5060 list_for_each_entry_safe(cmd, tcmd, &ha->tgt.q_full_list, cmd_list) { qlt_free_qfull_cmds()
5061 if (cmd->q_full) qlt_free_qfull_cmds()
5062 /* cmd->state is a borrowed field to hold status */ qlt_free_qfull_cmds()
5063 rc = __qlt_send_busy(vha, &cmd->atio, cmd->state); qlt_free_qfull_cmds()
5064 else if (cmd->term_exchg) qlt_free_qfull_cmds()
5065 rc = __qlt_send_term_exchange(vha, NULL, &cmd->atio); qlt_free_qfull_cmds()
5070 if (cmd->q_full) qlt_free_qfull_cmds()
5073 be16_to_cpu(cmd->atio.u.isp24.fcp_hdr.ox_id)); qlt_free_qfull_cmds()
5074 else if (cmd->term_exchg) qlt_free_qfull_cmds()
5077 be16_to_cpu(cmd->atio.u.isp24.fcp_hdr.ox_id)); qlt_free_qfull_cmds()
5080 "%s: Unexpected cmd in QFull list %p\n", __func__, qlt_free_qfull_cmds()
5081 cmd); qlt_free_qfull_cmds()
5083 list_del(&cmd->cmd_list); qlt_free_qfull_cmds()
5084 list_add_tail(&cmd->cmd_list, &free_list); qlt_free_qfull_cmds()
5091 cmd = NULL; qlt_free_qfull_cmds()
5093 list_for_each_entry_safe(cmd, tcmd, &free_list, cmd_list) { qlt_free_qfull_cmds()
5094 list_del(&cmd->cmd_list); qlt_free_qfull_cmds()
5095 /* This cmd was never sent to TCM. There is no need qlt_free_qfull_cmds()
5098 qlt_free_cmd(cmd); qlt_free_qfull_cmds()
6478 qlt_update_vp_map(struct scsi_qla_host *vha, int cmd) qlt_update_vp_map() argument
6483 switch (cmd) { qlt_update_vp_map()
1981 qlt_need_explicit_conf(struct qla_hw_data *ha, struct qla_tgt_cmd *cmd, int sending_sense) qlt_need_explicit_conf() argument
2930 __qlt_send_term_exchange(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd, struct atio_from_isp *atio) __qlt_send_term_exchange() argument
2991 qlt_send_term_exchange(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd, struct atio_from_isp *atio, int ha_locked) qlt_send_term_exchange() argument
3119 qlt_prepare_srr_ctio(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd, void *ctio) qlt_prepare_srr_ctio() argument
3205 qlt_term_ctio_exchange(struct scsi_qla_host *vha, void *ctio, struct qla_tgt_cmd *cmd, uint32_t status) qlt_term_ctio_exchange() argument
/linux-4.4.14/drivers/media/rc/img-ir/
H A Dimg-ir-sharp.c18 unsigned int addr, cmd, exp, chk; img_ir_sharp_scancode() local
24 cmd = (raw >> 5) & 0xff; img_ir_sharp_scancode()
36 request->scancode = addr << 8 | cmd; img_ir_sharp_scancode()
44 unsigned int addr, cmd, exp = 0, chk = 0; img_ir_sharp_filter() local
49 cmd = (in->data >> 0) & 0xff; img_ir_sharp_filter()
60 cmd << 5 | img_ir_sharp_filter()
/linux-4.4.14/drivers/net/wireless/ath/wil6210/
H A Dwmi.c180 } __packed cmd = { __wmi_send() local
184 .len = cpu_to_le16(sizeof(cmd.wmi) + len), __wmi_send()
198 if (sizeof(cmd) + len > r->entry_size) { __wmi_send()
200 (int)(sizeof(cmd) + len), r->entry_size); __wmi_send()
247 cmd.hdr.seq = cpu_to_le16(++wil->wmi_seq); __wmi_send()
250 wil_hex_dump_wmi("Cmd ", DUMP_PREFIX_OFFSET, 16, 1, &cmd, __wmi_send()
251 sizeof(cmd), true); __wmi_send()
252 wil_hex_dump_wmi("cmd ", DUMP_PREFIX_OFFSET, 16, 1, buf, __wmi_send()
254 wil_memcpy_toio_32(dst, &cmd, sizeof(cmd)); __wmi_send()
255 wil_memcpy_toio_32(dst + sizeof(cmd), buf, len); __wmi_send()
262 trace_wil6210_wmi_cmd(&cmd.wmi, buf, len); __wmi_send()
722 u8 *cmd; wmi_recv_cmd() local
743 /* read cmd descriptor from tail */ wmi_recv_cmd()
751 /* read cmd header from descriptor */ wmi_recv_cmd()
762 /* read cmd buffer from descriptor */ wmi_recv_cmd()
772 cmd = (void *)&evt->event.wmi; wmi_recv_cmd()
773 wil_memcpy_fromio_32(cmd, src, len); wmi_recv_cmd()
847 struct wmi_echo_cmd cmd = { wmi_echo() local
851 return wmi_call(wil, WMI_ECHO_CMDID, &cmd, sizeof(cmd), wmi_echo()
857 struct wmi_set_mac_address_cmd cmd; wmi_set_mac_address() local
859 ether_addr_copy(cmd.mac, addr); wmi_set_mac_address()
863 return wmi_send(wil, WMI_SET_MAC_ADDRESS_CMDID, &cmd, sizeof(cmd)); wmi_set_mac_address()
871 struct wmi_pcp_start_cmd cmd = { wmi_pcp_start() local
885 cmd.disable_sec = 1; wmi_pcp_start()
887 if ((cmd.pcp_max_assoc_sta > WIL6210_MAX_CID) || wmi_pcp_start()
888 (cmd.pcp_max_assoc_sta <= 0)) { wmi_pcp_start()
892 cmd.pcp_max_assoc_sta = WIL6210_MAX_CID; wmi_pcp_start()
899 rc = wmi_call(wil, WMI_PCP_START_CMDID, &cmd, sizeof(cmd), wmi_pcp_start()
918 struct wmi_set_ssid_cmd cmd = { wmi_set_ssid() local
922 if (ssid_len > sizeof(cmd.ssid)) wmi_set_ssid()
925 memcpy(cmd.ssid, ssid, ssid_len); wmi_set_ssid()
927 return wmi_send(wil, WMI_SET_SSID_CMDID, &cmd, sizeof(cmd)); wmi_set_ssid()
935 struct wmi_set_ssid_cmd cmd; wmi_get_ssid() member in struct:__anon8221
937 int len; /* reply.cmd.ssid_len in CPU order */ wmi_get_ssid()
944 len = le32_to_cpu(reply.cmd.ssid_len); wmi_get_ssid()
945 if (len > sizeof(reply.cmd.ssid)) wmi_get_ssid()
949 memcpy(ssid, reply.cmd.ssid, len); wmi_get_ssid()
956 struct wmi_set_pcp_channel_cmd cmd = { wmi_set_channel() local
960 return wmi_send(wil, WMI_SET_PCP_CHANNEL_CMDID, &cmd, sizeof(cmd)); wmi_set_channel()
968 struct wmi_set_pcp_channel_cmd cmd; wmi_get_channel() member in struct:__anon8222
976 if (reply.cmd.channel > 3) wmi_get_channel()
979 *channel = reply.cmd.channel + 1; wmi_get_channel()
986 struct wmi_p2p_cfg_cmd cmd = { wmi_p2p_cfg() local
991 return wmi_send(wil, WMI_P2P_CFG_CMDID, &cmd, sizeof(cmd)); wmi_p2p_cfg()
997 struct wmi_delete_cipher_key_cmd cmd = { wmi_del_cipher_key() local
1002 memcpy(cmd.mac, mac_addr, WMI_MAC_LEN); wmi_del_cipher_key()
1004 return wmi_send(wil, WMI_DELETE_CIPHER_KEY_CMDID, &cmd, sizeof(cmd)); wmi_del_cipher_key()
1011 struct wmi_add_cipher_key_cmd cmd = { wmi_add_cipher_key() local
1017 if (!key || (key_len > sizeof(cmd.key))) wmi_add_cipher_key()
1020 memcpy(cmd.key, key, key_len); wmi_add_cipher_key()
1022 memcpy(cmd.mac, mac_addr, WMI_MAC_LEN); wmi_add_cipher_key()
1024 return wmi_send(wil, WMI_ADD_CIPHER_KEY_CMDID, &cmd, sizeof(cmd)); wmi_add_cipher_key()
1038 struct wmi_set_appie_cmd *cmd = kzalloc(len, GFP_KERNEL); wmi_set_ie() local
1040 if (!cmd) { wmi_set_ie()
1047 cmd->mgmt_frm_type = type; wmi_set_ie()
1049 cmd->ie_len = cpu_to_le16(ie_len); wmi_set_ie()
1050 memcpy(cmd->ie_info, ie, ie_len); wmi_set_ie()
1051 rc = wmi_send(wil, WMI_SET_APPIE_CMDID, cmd, len); wmi_set_ie()
1052 kfree(cmd); wmi_set_ie()
1099 struct wmi_cfg_rx_chain_cmd cmd = { wmi_rx_chain_add() local
1120 cmd.sniffer_cfg.mode = cpu_to_le32(WMI_SNIFFER_ON); wmi_rx_chain_add()
1122 cmd.sniffer_cfg.channel = ch->hw_value - 1; wmi_rx_chain_add()
1123 cmd.sniffer_cfg.phy_info_mode = wmi_rx_chain_add()
1125 cmd.sniffer_cfg.phy_support = wmi_rx_chain_add()
1133 cmd.l3_l4_ctrl |= (1 << L3_L4_CTRL_TCPIP_CHECKSUM_EN_POS); wmi_rx_chain_add()
1137 cmd.l2_802_3_offload_ctrl |= wmi_rx_chain_add()
1141 rc = wmi_call(wil, WMI_CFG_RX_CHAIN_CMDID, &cmd, sizeof(cmd), wmi_rx_chain_add()
1160 struct wmi_temp_sense_cmd cmd = { wmi_get_temperature() local
1170 rc = wmi_call(wil, WMI_TEMP_SENSE_CMDID, &cmd, sizeof(cmd), wmi_get_temperature()
1187 struct wmi_disconnect_sta_cmd cmd = { wmi_disconnect_sta() local
1195 ether_addr_copy(cmd.dst_mac, mac); wmi_disconnect_sta()
1199 rc = wmi_call(wil, WMI_DISCONNECT_STA_CMDID, &cmd, sizeof(cmd), wmi_disconnect_sta()
1225 struct wmi_vring_ba_en_cmd cmd = { wmi_addba() local
1235 return wmi_send(wil, WMI_VRING_BA_EN_CMDID, &cmd, sizeof(cmd)); wmi_addba()
1240 struct wmi_vring_ba_dis_cmd cmd = { wmi_delba_tx() local
1248 return wmi_send(wil, WMI_VRING_BA_DIS_CMDID, &cmd, sizeof(cmd)); wmi_delba_tx()
1253 struct wmi_rcp_delba_cmd cmd = { wmi_delba_rx() local
1261 return wmi_send(wil, WMI_RCP_DELBA_CMDID, &cmd, sizeof(cmd)); wmi_delba_rx()
1268 struct wmi_rcp_addba_resp_cmd cmd = { wmi_addba_rx_resp() local
1290 rc = wmi_call(wil, WMI_RCP_ADDBA_RESP_CMDID, &cmd, sizeof(cmd), wmi_addba_rx_resp()
/linux-4.4.14/include/net/
H A Dwext.h9 int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
11 int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
17 static inline int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, wext_handle_ioctl() argument
22 static inline int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, compat_wext_handle_ioctl() argument
45 unsigned int cmd, struct iw_request_info *info,
48 unsigned int cmd, struct iw_request_info *info,
/linux-4.4.14/drivers/net/ethernet/chelsio/cxgb4vf/
H A Dt4vf_hw.c99 * @cmd: the command to write
116 int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size, t4vf_wr_mbox_core() argument
160 for (i = 0, p = cmd; i < size; i += 8) t4vf_wr_mbox_core()
213 WARN_ON((be32_to_cpu(*(const __be32 *)cmd) t4vf_wr_mbox_core()
347 struct fw_reset_cmd cmd; t4vf_fw_reset() local
349 memset(&cmd, 0, sizeof(cmd)); t4vf_fw_reset()
350 cmd.op_to_write = cpu_to_be32(FW_CMD_OP_V(FW_RESET_CMD) | t4vf_fw_reset()
352 cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); t4vf_fw_reset()
353 return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL); t4vf_fw_reset()
370 struct fw_params_cmd cmd, rpl; t4vf_query_params() local
377 memset(&cmd, 0, sizeof(cmd)); t4vf_query_params()
378 cmd.op_to_vfn = cpu_to_be32(FW_CMD_OP_V(FW_PARAMS_CMD) | t4vf_query_params()
383 cmd.retval_len16 = cpu_to_be32(FW_CMD_LEN16_V(len16)); t4vf_query_params()
384 for (i = 0, p = &cmd.param[0]; i < nparams; i++, p++) t4vf_query_params()
387 ret = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl); t4vf_query_params()
408 struct fw_params_cmd cmd; t4vf_set_params() local
415 memset(&cmd, 0, sizeof(cmd)); t4vf_set_params()
416 cmd.op_to_vfn = cpu_to_be32(FW_CMD_OP_V(FW_PARAMS_CMD) | t4vf_set_params()
421 cmd.retval_len16 = cpu_to_be32(FW_CMD_LEN16_V(len16)); t4vf_set_params()
422 for (i = 0, p = &cmd.param[0]; i < nparams; i++, p++) { t4vf_set_params()
427 return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL); t4vf_set_params()
703 struct fw_rss_glb_config_cmd cmd, rpl; t4vf_get_rss_glb_config() local
710 memset(&cmd, 0, sizeof(cmd)); t4vf_get_rss_glb_config()
711 cmd.op_to_write = cpu_to_be32(FW_CMD_OP_V(FW_RSS_GLB_CONFIG_CMD) | t4vf_get_rss_glb_config()
714 cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); t4vf_get_rss_glb_config()
715 v = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl); t4vf_get_rss_glb_config()
778 struct fw_pfvf_cmd cmd, rpl; t4vf_get_vfres() local
786 memset(&cmd, 0, sizeof(cmd)); t4vf_get_vfres()
787 cmd.op_to_vfn = cpu_to_be32(FW_CMD_OP_V(FW_PFVF_CMD) | t4vf_get_vfres()
790 cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); t4vf_get_vfres()
791 v = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl); t4vf_get_vfres()
831 struct fw_rss_vi_config_cmd cmd, rpl; t4vf_read_rss_vi_config() local
834 memset(&cmd, 0, sizeof(cmd)); t4vf_read_rss_vi_config()
835 cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_RSS_VI_CONFIG_CMD) | t4vf_read_rss_vi_config()
839 cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); t4vf_read_rss_vi_config()
840 v = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl); t4vf_read_rss_vi_config()
882 struct fw_rss_vi_config_cmd cmd, rpl; t4vf_write_rss_vi_config() local
884 memset(&cmd, 0, sizeof(cmd)); t4vf_write_rss_vi_config()
885 cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_RSS_VI_CONFIG_CMD) | t4vf_write_rss_vi_config()
889 cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); t4vf_write_rss_vi_config()
906 cmd.u.basicvirtual.defaultq_to_udpen = cpu_to_be32(word); t4vf_write_rss_vi_config()
914 return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl); t4vf_write_rss_vi_config()
937 struct fw_rss_ind_tbl_cmd cmd; t4vf_config_rss_range() local
942 memset(&cmd, 0, sizeof(cmd)); t4vf_config_rss_range()
943 cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_RSS_IND_TBL_CMD) | t4vf_config_rss_range()
947 cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); t4vf_config_rss_range()
956 __be32 *qp = &cmd.iq0_to_iq2; t4vf_config_rss_range()
964 cmd.niqid = cpu_to_be16(nq); t4vf_config_rss_range()
965 cmd.startidx = cpu_to_be16(start); t4vf_config_rss_range()
1006 ret = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL); t4vf_config_rss_range()
1024 struct fw_vi_cmd cmd, rpl; t4vf_alloc_vi() local
1031 memset(&cmd, 0, sizeof(cmd)); t4vf_alloc_vi()
1032 cmd.op_to_vfn = cpu_to_be32(FW_CMD_OP_V(FW_VI_CMD) | t4vf_alloc_vi()
1036 cmd.alloc_to_len16 = cpu_to_be32(FW_LEN16(cmd) | t4vf_alloc_vi()
1038 cmd.portid_pkd = FW_VI_CMD_PORTID_V(port_id); t4vf_alloc_vi()
1039 v = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl); t4vf_alloc_vi()
1056 struct fw_vi_cmd cmd; t4vf_free_vi() local
1061 memset(&cmd, 0, sizeof(cmd)); t4vf_free_vi()
1062 cmd.op_to_vfn = cpu_to_be32(FW_CMD_OP_V(FW_VI_CMD) | t4vf_free_vi()
1065 cmd.alloc_to_len16 = cpu_to_be32(FW_LEN16(cmd) | t4vf_free_vi()
1067 cmd.type_viid = cpu_to_be16(FW_VI_CMD_VIID_V(viid)); t4vf_free_vi()
1068 return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL); t4vf_free_vi()
1083 struct fw_vi_enable_cmd cmd; t4vf_enable_vi() local
1085 memset(&cmd, 0, sizeof(cmd)); t4vf_enable_vi()
1086 cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_ENABLE_CMD) | t4vf_enable_vi()
1090 cmd.ien_to_len16 = cpu_to_be32(FW_VI_ENABLE_CMD_IEN_V(rx_en) | t4vf_enable_vi()
1092 FW_LEN16(cmd)); t4vf_enable_vi()
1093 return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL); t4vf_enable_vi()
1107 struct fw_vi_enable_cmd cmd; t4vf_identify_port() local
1109 memset(&cmd, 0, sizeof(cmd)); t4vf_identify_port()
1110 cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_ENABLE_CMD) | t4vf_identify_port()
1114 cmd.ien_to_len16 = cpu_to_be32(FW_VI_ENABLE_CMD_LED_F | t4vf_identify_port()
1115 FW_LEN16(cmd)); t4vf_identify_port()
1116 cmd.blinkdur = cpu_to_be16(nblinks); t4vf_identify_port()
1117 return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL); t4vf_identify_port()
1137 struct fw_vi_rxmode_cmd cmd; t4vf_set_rxmode() local
1151 memset(&cmd, 0, sizeof(cmd)); t4vf_set_rxmode()
1152 cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_RXMODE_CMD) | t4vf_set_rxmode()
1156 cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); t4vf_set_rxmode()
1157 cmd.mtu_to_vlanexen = t4vf_set_rxmode()
1163 return t4vf_wr_mbox_core(adapter, &cmd, sizeof(cmd), NULL, sleep_ok); t4vf_set_rxmode()
1194 struct fw_vi_mac_cmd cmd, rpl; t4vf_alloc_mac_filt() local
1201 unsigned int fw_naddr = (rem < ARRAY_SIZE(cmd.u.exact) t4vf_alloc_mac_filt()
1203 : ARRAY_SIZE(cmd.u.exact)); t4vf_alloc_mac_filt()
1209 memset(&cmd, 0, sizeof(cmd)); t4vf_alloc_mac_filt()
1210 cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_MAC_CMD) | t4vf_alloc_mac_filt()
1215 cmd.freemacs_to_len16 = t4vf_alloc_mac_filt()
1219 for (i = 0, p = cmd.u.exact; i < fw_naddr; i++, p++) { t4vf_alloc_mac_filt()
1227 ret = t4vf_wr_mbox_core(adapter, &cmd, sizeof(cmd), &rpl, t4vf_alloc_mac_filt()
1283 struct fw_vi_mac_cmd cmd, rpl; t4vf_change_mac() local
1284 struct fw_vi_mac_exact *p = &cmd.u.exact[0]; t4vf_change_mac()
1296 memset(&cmd, 0, sizeof(cmd)); t4vf_change_mac()
1297 cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_MAC_CMD) | t4vf_change_mac()
1301 cmd.freemacs_to_len16 = cpu_to_be32(FW_CMD_LEN16_V(len16)); t4vf_change_mac()
1306 ret = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl); t4vf_change_mac()
1329 struct fw_vi_mac_cmd cmd; t4vf_set_addr_hash() local
1333 memset(&cmd, 0, sizeof(cmd)); t4vf_set_addr_hash()
1334 cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_MAC_CMD) | t4vf_set_addr_hash()
1338 cmd.freemacs_to_len16 = cpu_to_be32(FW_VI_MAC_CMD_HASHVECEN_F | t4vf_set_addr_hash()
1341 cmd.u.hash.hashvec = cpu_to_be64(vec); t4vf_set_addr_hash()
1342 return t4vf_wr_mbox_core(adapter, &cmd, sizeof(cmd), NULL, sleep_ok); t4vf_set_addr_hash()
1369 struct fw_vi_stats_cmd cmd, rpl; t4vf_get_port_stats() local
1375 memset(&cmd, 0, sizeof(cmd)); t4vf_get_port_stats()
1376 cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_STATS_CMD) | t4vf_get_port_stats()
1380 cmd.retval_len16 = cpu_to_be32(FW_CMD_LEN16_V(len16)); t4vf_get_port_stats()
1381 cmd.u.ctl.nstats_ix = t4vf_get_port_stats()
1384 ret = t4vf_wr_mbox_ns(adapter, &cmd, len, &rpl); t4vf_get_port_stats()
1432 struct fw_iq_cmd cmd; t4vf_iq_free() local
1434 memset(&cmd, 0, sizeof(cmd)); t4vf_iq_free()
1435 cmd.op_to_vfn = cpu_to_be32(FW_CMD_OP_V(FW_IQ_CMD) | t4vf_iq_free()
1438 cmd.alloc_to_len16 = cpu_to_be32(FW_IQ_CMD_FREE_F | t4vf_iq_free()
1439 FW_LEN16(cmd)); t4vf_iq_free()
1440 cmd.type_to_iqandstindex = t4vf_iq_free()
1443 cmd.iqid = cpu_to_be16(iqid); t4vf_iq_free()
1444 cmd.fl0id = cpu_to_be16(fl0id); t4vf_iq_free()
1445 cmd.fl1id = cpu_to_be16(fl1id); t4vf_iq_free()
1446 return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL); t4vf_iq_free()
1458 struct fw_eq_eth_cmd cmd; t4vf_eth_eq_free() local
1460 memset(&cmd, 0, sizeof(cmd)); t4vf_eth_eq_free()
1461 cmd.op_to_vfn = cpu_to_be32(FW_CMD_OP_V(FW_EQ_ETH_CMD) | t4vf_eth_eq_free()
1464 cmd.alloc_to_len16 = cpu_to_be32(FW_EQ_ETH_CMD_FREE_F | t4vf_eth_eq_free()
1465 FW_LEN16(cmd)); t4vf_eth_eq_free()
1466 cmd.eqid_pkd = cpu_to_be32(FW_EQ_ETH_CMD_EQID_V(eqid)); t4vf_eth_eq_free()
1467 return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL); t4vf_eth_eq_free()
/linux-4.4.14/drivers/isdn/act2000/
H A Dcapi.c100 if ((hdr->cmd.cmd == valid_msg[i].cmd.cmd) && actcapi_chkhdr()
101 (hdr->cmd.subcmd == valid_msg[i].cmd.subcmd)) { actcapi_chkhdr()
113 m->hdr.cmd.cmd = c; \
114 m->hdr.cmd.subcmd = s; \
573 msg->hdr.cmd.cmd = 0x86; actcapi_data_b3_ind()
574 msg->hdr.cmd.subcmd = 0x03; actcapi_data_b3_ind()
639 isdn_ctrl cmd; actcapi_dispatch() local
645 ccmd = ((msg->hdr.cmd.cmd << 8) | msg->hdr.cmd.subcmd); actcapi_dispatch()
662 cmd.driver = card->myid; actcapi_dispatch()
663 cmd.command = ISDN_STAT_BSENT; actcapi_dispatch()
664 cmd.arg = chan; actcapi_dispatch()
665 cmd.parm.length = len; actcapi_dispatch()
666 card->interface.statcallb(&cmd); actcapi_dispatch()
676 cmd.driver = card->myid; actcapi_dispatch()
677 cmd.command = ISDN_STAT_DHUP; actcapi_dispatch()
678 cmd.arg = chan; actcapi_dispatch()
679 card->interface.statcallb(&cmd); actcapi_dispatch()
695 cmd.driver = card->myid; actcapi_dispatch()
696 cmd.command = ISDN_STAT_ICALL; actcapi_dispatch()
697 cmd.arg = chan; actcapi_dispatch()
698 cmd.parm.setup.si1 = msg->msg.connect_ind.si1; actcapi_dispatch()
699 cmd.parm.setup.si2 = msg->msg.connect_ind.si2; actcapi_dispatch()
701 strcpy(cmd.parm.setup.eazmsn, actcapi_dispatch()
704 cmd.parm.setup.eazmsn[0] = msg->msg.connect_ind.eaz; actcapi_dispatch()
705 cmd.parm.setup.eazmsn[1] = 0; actcapi_dispatch()
707 memset(cmd.parm.setup.phone, 0, sizeof(cmd.parm.setup.phone)); actcapi_dispatch()
708 memcpy(cmd.parm.setup.phone, msg->msg.connect_ind.addr.num, actcapi_dispatch()
710 cmd.parm.setup.plan = msg->msg.connect_ind.addr.tnp; actcapi_dispatch()
711 cmd.parm.setup.screen = 0; actcapi_dispatch()
712 if (card->interface.statcallb(&cmd) == 2) actcapi_dispatch()
747 cmd.driver = card->myid; actcapi_dispatch()
748 cmd.command = ISDN_STAT_BCONN; actcapi_dispatch()
749 cmd.arg = chan; actcapi_dispatch()
750 card->interface.statcallb(&cmd); actcapi_dispatch()
762 cmd.driver = card->myid; actcapi_dispatch()
763 cmd.command = ISDN_STAT_BHUP; actcapi_dispatch()
764 cmd.arg = chan; actcapi_dispatch()
765 card->interface.statcallb(&cmd); actcapi_dispatch()
770 cmd.driver = card->myid; actcapi_dispatch()
771 cmd.command = ISDN_STAT_BHUP; actcapi_dispatch()
772 cmd.arg = chan; actcapi_dispatch()
773 card->interface.statcallb(&cmd); actcapi_dispatch()
785 cmd.driver = card->myid; actcapi_dispatch()
786 cmd.command = ISDN_STAT_DHUP; actcapi_dispatch()
787 cmd.arg = chan; actcapi_dispatch()
788 card->interface.statcallb(&cmd); actcapi_dispatch()
807 cmd.driver = card->myid; actcapi_dispatch()
808 cmd.command = ISDN_STAT_DHUP; actcapi_dispatch()
809 cmd.arg = chan; actcapi_dispatch()
810 card->interface.statcallb(&cmd); actcapi_dispatch()
827 cmd.driver = card->myid; actcapi_dispatch()
828 cmd.command = ISDN_STAT_DHUP; actcapi_dispatch()
829 cmd.arg = chan; actcapi_dispatch()
830 card->interface.statcallb(&cmd); actcapi_dispatch()
845 cmd.driver = card->myid; actcapi_dispatch()
846 cmd.command = ISDN_STAT_DHUP; actcapi_dispatch()
847 cmd.arg = chan; actcapi_dispatch()
848 card->interface.statcallb(&cmd); actcapi_dispatch()
856 cmd.driver = card->myid; actcapi_dispatch()
857 cmd.command = ISDN_STAT_DCONN; actcapi_dispatch()
858 cmd.arg = chan; actcapi_dispatch()
859 card->interface.statcallb(&cmd); actcapi_dispatch()
862 cmd.driver = card->myid; actcapi_dispatch()
863 cmd.command = ISDN_STAT_DHUP; actcapi_dispatch()
864 cmd.arg = chan; actcapi_dispatch()
865 card->interface.statcallb(&cmd); actcapi_dispatch()
877 cmd.driver = card->myid; actcapi_dispatch()
878 cmd.command = ISDN_STAT_DHUP; actcapi_dispatch()
879 cmd.arg = chan; actcapi_dispatch()
880 card->interface.statcallb(&cmd); actcapi_dispatch()
921 cmd.command = ISDN_STAT_RUN; actcapi_dispatch()
922 cmd.driver = card->myid; actcapi_dispatch()
923 cmd.arg = 0; actcapi_dispatch()
927 card->interface.statcallb(&cmd); actcapi_dispatch()
1020 if (msg->hdr.cmd.cmd == 0x86) actcapi_debug_msg()
1028 if ((msg->hdr.cmd.cmd == valid_msg[i].cmd.cmd) && actcapi_debug_msg()
1029 (msg->hdr.cmd.subcmd == valid_msg[i].cmd.subcmd)) { actcapi_debug_msg()
1037 printk(KERN_DEBUG " Cmd = 0x%02x\n", msg->hdr.cmd.cmd); actcapi_debug_msg()
1038 printk(KERN_DEBUG " SubCmd = 0x%02x\n", msg->hdr.cmd.subcmd); actcapi_debug_msg()
/linux-4.4.14/net/tipc/
H A Dnetlink.c72 .cmd = TIPC_NL_BEARER_DISABLE,
77 .cmd = TIPC_NL_BEARER_ENABLE,
82 .cmd = TIPC_NL_BEARER_GET,
88 .cmd = TIPC_NL_BEARER_SET,
93 .cmd = TIPC_NL_SOCK_GET,
98 .cmd = TIPC_NL_PUBL_GET,
103 .cmd = TIPC_NL_LINK_GET,
109 .cmd = TIPC_NL_LINK_SET,
114 .cmd = TIPC_NL_LINK_RESET_STATS,
119 .cmd = TIPC_NL_MEDIA_GET,
125 .cmd = TIPC_NL_MEDIA_SET,
130 .cmd = TIPC_NL_NODE_GET,
135 .cmd = TIPC_NL_NET_GET,
140 .cmd = TIPC_NL_NET_SET,
145 .cmd = TIPC_NL_NAME_TABLE_GET,
/linux-4.4.14/drivers/scsi/bfa/
H A Dbfad_bsg.c26 bfad_iocmd_ioc_enable(struct bfad_s *bfad, void *cmd) bfad_iocmd_ioc_enable() argument
28 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_ioc_enable()
49 bfad_iocmd_ioc_disable(struct bfad_s *bfad, void *cmd) bfad_iocmd_ioc_disable() argument
51 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_ioc_disable()
79 bfad_iocmd_ioc_get_info(struct bfad_s *bfad, void *cmd) bfad_iocmd_ioc_get_info() argument
82 struct bfa_bsg_ioc_info_s *iocmd = (struct bfa_bsg_ioc_info_s *)cmd; bfad_iocmd_ioc_get_info()
118 bfad_iocmd_ioc_get_attr(struct bfad_s *bfad, void *cmd) bfad_iocmd_ioc_get_attr() argument
120 struct bfa_bsg_ioc_attr_s *iocmd = (struct bfa_bsg_ioc_attr_s *)cmd; bfad_iocmd_ioc_get_attr()
147 bfad_iocmd_ioc_get_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_ioc_get_stats() argument
149 struct bfa_bsg_ioc_stats_s *iocmd = (struct bfa_bsg_ioc_stats_s *)cmd; bfad_iocmd_ioc_get_stats()
157 bfad_iocmd_ioc_get_fwstats(struct bfad_s *bfad, void *cmd, bfad_iocmd_ioc_get_fwstats() argument
161 (struct bfa_bsg_ioc_fwstats_s *)cmd; bfad_iocmd_ioc_get_fwstats()
187 bfad_iocmd_ioc_reset_stats(struct bfad_s *bfad, void *cmd, unsigned int v_cmd) bfad_iocmd_ioc_reset_stats() argument
189 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_ioc_reset_stats()
205 bfad_iocmd_ioc_set_name(struct bfad_s *bfad, void *cmd, unsigned int v_cmd) bfad_iocmd_ioc_set_name() argument
207 struct bfa_bsg_ioc_name_s *iocmd = (struct bfa_bsg_ioc_name_s *) cmd; bfad_iocmd_ioc_set_name()
219 bfad_iocmd_iocfc_get_attr(struct bfad_s *bfad, void *cmd) bfad_iocmd_iocfc_get_attr() argument
221 struct bfa_bsg_iocfc_attr_s *iocmd = (struct bfa_bsg_iocfc_attr_s *)cmd; bfad_iocmd_iocfc_get_attr()
230 bfad_iocmd_ioc_fw_sig_inv(struct bfad_s *bfad, void *cmd) bfad_iocmd_ioc_fw_sig_inv() argument
232 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_ioc_fw_sig_inv()
242 bfad_iocmd_iocfc_set_intr(struct bfad_s *bfad, void *cmd) bfad_iocmd_iocfc_set_intr() argument
244 struct bfa_bsg_iocfc_intr_s *iocmd = (struct bfa_bsg_iocfc_intr_s *)cmd; bfad_iocmd_iocfc_set_intr()
255 bfad_iocmd_port_enable(struct bfad_s *bfad, void *cmd) bfad_iocmd_port_enable() argument
257 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_port_enable()
276 bfad_iocmd_port_disable(struct bfad_s *bfad, void *cmd) bfad_iocmd_port_disable() argument
278 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_port_disable()
298 bfad_iocmd_port_get_attr(struct bfad_s *bfad, void *cmd) bfad_iocmd_port_get_attr() argument
300 struct bfa_bsg_port_attr_s *iocmd = (struct bfa_bsg_port_attr_s *)cmd; bfad_iocmd_port_get_attr()
326 bfad_iocmd_port_get_stats(struct bfad_s *bfad, void *cmd, bfad_iocmd_port_get_stats() argument
329 struct bfa_bsg_port_stats_s *iocmd = (struct bfa_bsg_port_stats_s *)cmd; bfad_iocmd_port_get_stats()
360 bfad_iocmd_port_reset_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_port_reset_stats() argument
362 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_port_reset_stats()
383 struct bfa_bsg_port_cfg_s *cmd = (struct bfa_bsg_port_cfg_s *)iocmd; bfad_iocmd_set_port_cfg() local
388 cmd->status = bfa_fcport_cfg_topology(&bfad->bfa, cmd->param); bfad_iocmd_set_port_cfg()
390 cmd->status = bfa_fcport_cfg_speed(&bfad->bfa, cmd->param); bfad_iocmd_set_port_cfg()
392 cmd->status = bfa_fcport_cfg_hardalpa(&bfad->bfa, cmd->param); bfad_iocmd_set_port_cfg()
394 cmd->status = bfa_fcport_clr_hardalpa(&bfad->bfa); bfad_iocmd_set_port_cfg()
401 bfad_iocmd_port_cfg_maxfrsize(struct bfad_s *bfad, void *cmd) bfad_iocmd_port_cfg_maxfrsize() argument
404 (struct bfa_bsg_port_cfg_maxfrsize_s *)cmd; bfad_iocmd_port_cfg_maxfrsize()
415 bfad_iocmd_port_cfg_bbcr(struct bfad_s *bfad, unsigned int cmd, void *pcmd) bfad_iocmd_port_cfg_bbcr() argument
423 if (cmd == IOCMD_PORT_BBCR_ENABLE) bfad_iocmd_port_cfg_bbcr()
425 else if (cmd == IOCMD_PORT_BBCR_DISABLE) bfad_iocmd_port_cfg_bbcr()
453 bfad_iocmd_lport_get_attr(struct bfad_s *bfad, void *cmd) bfad_iocmd_lport_get_attr() argument
456 struct bfa_bsg_lport_attr_s *iocmd = (struct bfa_bsg_lport_attr_s *)cmd; bfad_iocmd_lport_get_attr()
476 bfad_iocmd_lport_get_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_lport_get_stats() argument
480 (struct bfa_bsg_lport_stats_s *)cmd; bfad_iocmd_lport_get_stats()
500 bfad_iocmd_lport_reset_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_lport_reset_stats() argument
504 (struct bfa_bsg_reset_stats_s *)cmd; bfad_iocmd_lport_reset_stats()
534 bfad_iocmd_lport_get_iostats(struct bfad_s *bfad, void *cmd) bfad_iocmd_lport_get_iostats() argument
538 (struct bfa_bsg_lport_iostats_s *)cmd; bfad_iocmd_lport_get_iostats()
559 bfad_iocmd_lport_get_rports(struct bfad_s *bfad, void *cmd, bfad_iocmd_lport_get_rports() argument
563 (struct bfa_bsg_lport_get_rports_s *)cmd; bfad_iocmd_lport_get_rports()
601 bfad_iocmd_rport_get_attr(struct bfad_s *bfad, void *cmd) bfad_iocmd_rport_get_attr() argument
603 struct bfa_bsg_rport_attr_s *iocmd = (struct bfa_bsg_rport_attr_s *)cmd; bfad_iocmd_rport_get_attr()
638 bfad_iocmd_rport_get_addr(struct bfad_s *bfad, void *cmd) bfad_iocmd_rport_get_addr() argument
641 (struct bfa_bsg_rport_scsi_addr_s *)cmd; bfad_iocmd_rport_get_addr()
687 bfad_iocmd_rport_get_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_rport_get_stats() argument
690 (struct bfa_bsg_rport_stats_s *)cmd; bfad_iocmd_rport_get_stats()
728 bfad_iocmd_rport_clr_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_rport_clr_stats() argument
731 (struct bfa_bsg_rport_reset_stats_s *)cmd; bfad_iocmd_rport_clr_stats()
764 bfad_iocmd_rport_set_speed(struct bfad_s *bfad, void *cmd) bfad_iocmd_rport_set_speed() argument
767 (struct bfa_bsg_rport_set_speed_s *)cmd; bfad_iocmd_rport_set_speed()
800 bfad_iocmd_vport_get_attr(struct bfad_s *bfad, void *cmd) bfad_iocmd_vport_get_attr() argument
803 struct bfa_bsg_vport_attr_s *iocmd = (struct bfa_bsg_vport_attr_s *)cmd; bfad_iocmd_vport_get_attr()
823 bfad_iocmd_vport_get_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_vport_get_stats() argument
827 (struct bfa_bsg_vport_stats_s *)cmd; bfad_iocmd_vport_get_stats()
851 bfad_iocmd_vport_clr_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_vport_clr_stats() argument
855 (struct bfa_bsg_reset_stats_s *)cmd; bfad_iocmd_vport_clr_stats()
876 bfad_iocmd_fabric_get_lports(struct bfad_s *bfad, void *cmd, bfad_iocmd_fabric_get_lports() argument
880 (struct bfa_bsg_fabric_get_lports_s *)cmd; bfad_iocmd_fabric_get_lports()
931 bfad_iocmd_ratelim(struct bfad_s *bfad, unsigned int cmd, void *pcmd) bfad_iocmd_ratelim() argument
943 if (cmd == IOCMD_RATELIM_ENABLE) bfad_iocmd_ratelim()
945 else if (cmd == IOCMD_RATELIM_DISABLE) bfad_iocmd_ratelim()
960 bfad_iocmd_ratelim_speed(struct bfad_s *bfad, unsigned int cmd, void *pcmd) bfad_iocmd_ratelim_speed() argument
989 bfad_iocmd_cfg_fcpim(struct bfad_s *bfad, void *cmd) bfad_iocmd_cfg_fcpim() argument
991 struct bfa_bsg_fcpim_s *iocmd = (struct bfa_bsg_fcpim_s *)cmd; bfad_iocmd_cfg_fcpim()
1002 bfad_iocmd_fcpim_get_modstats(struct bfad_s *bfad, void *cmd) bfad_iocmd_fcpim_get_modstats() argument
1005 (struct bfa_bsg_fcpim_modstats_s *)cmd; bfad_iocmd_fcpim_get_modstats()
1024 bfad_iocmd_fcpim_clr_modstats(struct bfad_s *bfad, void *cmd) bfad_iocmd_fcpim_clr_modstats() argument
1027 (struct bfa_bsg_fcpim_modstatsclr_s *)cmd; bfad_iocmd_fcpim_clr_modstats()
1046 bfad_iocmd_fcpim_get_del_itn_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_fcpim_get_del_itn_stats() argument
1049 (struct bfa_bsg_fcpim_del_itn_stats_s *)cmd; bfad_iocmd_fcpim_get_del_itn_stats()
1063 bfad_iocmd_itnim_get_attr(struct bfad_s *bfad, void *cmd) bfad_iocmd_itnim_get_attr() argument
1065 struct bfa_bsg_itnim_attr_s *iocmd = (struct bfa_bsg_itnim_attr_s *)cmd; bfad_iocmd_itnim_get_attr()
1082 bfad_iocmd_itnim_get_iostats(struct bfad_s *bfad, void *cmd) bfad_iocmd_itnim_get_iostats() argument
1085 (struct bfa_bsg_itnim_iostats_s *)cmd; bfad_iocmd_itnim_get_iostats()
1113 bfad_iocmd_itnim_reset_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_itnim_reset_stats() argument
1116 (struct bfa_bsg_rport_reset_stats_s *)cmd; bfad_iocmd_itnim_reset_stats()
1142 bfad_iocmd_itnim_get_itnstats(struct bfad_s *bfad, void *cmd) bfad_iocmd_itnim_get_itnstats() argument
1145 (struct bfa_bsg_itnim_itnstats_s *)cmd; bfad_iocmd_itnim_get_itnstats()
1171 bfad_iocmd_fcport_enable(struct bfad_s *bfad, void *cmd) bfad_iocmd_fcport_enable() argument
1173 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_fcport_enable()
1184 bfad_iocmd_fcport_disable(struct bfad_s *bfad, void *cmd) bfad_iocmd_fcport_disable() argument
1186 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_fcport_disable()
1197 bfad_iocmd_ioc_get_pcifn_cfg(struct bfad_s *bfad, void *cmd) bfad_iocmd_ioc_get_pcifn_cfg() argument
1199 struct bfa_bsg_pcifn_cfg_s *iocmd = (struct bfa_bsg_pcifn_cfg_s *)cmd; bfad_iocmd_ioc_get_pcifn_cfg()
1219 bfad_iocmd_pcifn_create(struct bfad_s *bfad, void *cmd) bfad_iocmd_pcifn_create() argument
1221 struct bfa_bsg_pcifn_s *iocmd = (struct bfa_bsg_pcifn_s *)cmd; bfad_iocmd_pcifn_create()
1242 bfad_iocmd_pcifn_delete(struct bfad_s *bfad, void *cmd) bfad_iocmd_pcifn_delete() argument
1244 struct bfa_bsg_pcifn_s *iocmd = (struct bfa_bsg_pcifn_s *)cmd; bfad_iocmd_pcifn_delete()
1264 bfad_iocmd_pcifn_bw(struct bfad_s *bfad, void *cmd) bfad_iocmd_pcifn_bw() argument
1266 struct bfa_bsg_pcifn_s *iocmd = (struct bfa_bsg_pcifn_s *)cmd; bfad_iocmd_pcifn_bw()
1288 bfad_iocmd_adapter_cfg_mode(struct bfad_s *bfad, void *cmd) bfad_iocmd_adapter_cfg_mode() argument
1291 (struct bfa_bsg_adapter_cfg_mode_s *)cmd; bfad_iocmd_adapter_cfg_mode()
1311 bfad_iocmd_port_cfg_mode(struct bfad_s *bfad, void *cmd) bfad_iocmd_port_cfg_mode() argument
1314 (struct bfa_bsg_port_cfg_mode_s *)cmd; bfad_iocmd_port_cfg_mode()
1335 bfad_iocmd_ablk_optrom(struct bfad_s *bfad, unsigned int cmd, void *pcmd) bfad_iocmd_ablk_optrom() argument
1343 if (cmd == IOCMD_FLASH_ENABLE_OPTROM) bfad_iocmd_ablk_optrom()
1361 bfad_iocmd_faa_query(struct bfad_s *bfad, void *cmd) bfad_iocmd_faa_query() argument
1363 struct bfa_bsg_faa_attr_s *iocmd = (struct bfa_bsg_faa_attr_s *)cmd; bfad_iocmd_faa_query()
1384 bfad_iocmd_cee_attr(struct bfad_s *bfad, void *cmd, unsigned int payload_len) bfad_iocmd_cee_attr() argument
1387 (struct bfa_bsg_cee_attr_s *)cmd; bfad_iocmd_cee_attr()
1420 bfad_iocmd_cee_get_stats(struct bfad_s *bfad, void *cmd, bfad_iocmd_cee_get_stats() argument
1424 (struct bfa_bsg_cee_stats_s *)cmd; bfad_iocmd_cee_get_stats()
1457 bfad_iocmd_cee_reset_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_cee_reset_stats() argument
1459 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_cee_reset_stats()
1471 bfad_iocmd_sfp_media(struct bfad_s *bfad, void *cmd) bfad_iocmd_sfp_media() argument
1473 struct bfa_bsg_sfp_media_s *iocmd = (struct bfa_bsg_sfp_media_s *)cmd; bfad_iocmd_sfp_media()
1493 bfad_iocmd_sfp_speed(struct bfad_s *bfad, void *cmd) bfad_iocmd_sfp_speed() argument
1495 struct bfa_bsg_sfp_speed_s *iocmd = (struct bfa_bsg_sfp_speed_s *)cmd; bfad_iocmd_sfp_speed()
1514 bfad_iocmd_flash_get_attr(struct bfad_s *bfad, void *cmd) bfad_iocmd_flash_get_attr() argument
1517 (struct bfa_bsg_flash_attr_s *)cmd; bfad_iocmd_flash_get_attr()
1535 bfad_iocmd_flash_erase_part(struct bfad_s *bfad, void *cmd) bfad_iocmd_flash_erase_part() argument
1537 struct bfa_bsg_flash_s *iocmd = (struct bfa_bsg_flash_s *)cmd; bfad_iocmd_flash_erase_part()
1555 bfad_iocmd_flash_update_part(struct bfad_s *bfad, void *cmd, bfad_iocmd_flash_update_part() argument
1558 struct bfa_bsg_flash_s *iocmd = (struct bfa_bsg_flash_s *)cmd; bfad_iocmd_flash_update_part()
1587 bfad_iocmd_flash_read_part(struct bfad_s *bfad, void *cmd, bfad_iocmd_flash_read_part() argument
1590 struct bfa_bsg_flash_s *iocmd = (struct bfa_bsg_flash_s *)cmd; bfad_iocmd_flash_read_part()
1619 bfad_iocmd_diag_temp(struct bfad_s *bfad, void *cmd) bfad_iocmd_diag_temp() argument
1622 (struct bfa_bsg_diag_get_temp_s *)cmd; bfad_iocmd_diag_temp()
1641 bfad_iocmd_diag_memtest(struct bfad_s *bfad, void *cmd) bfad_iocmd_diag_memtest() argument
1644 (struct bfa_bsg_diag_memtest_s *)cmd; bfad_iocmd_diag_memtest()
1664 bfad_iocmd_diag_loopback(struct bfad_s *bfad, void *cmd) bfad_iocmd_diag_loopback() argument
1667 (struct bfa_bsg_diag_loopback_s *)cmd; bfad_iocmd_diag_loopback()
1687 bfad_iocmd_diag_fwping(struct bfad_s *bfad, void *cmd) bfad_iocmd_diag_fwping() argument
1690 (struct bfa_bsg_diag_fwping_s *)cmd; bfad_iocmd_diag_fwping()
1711 bfad_iocmd_diag_queuetest(struct bfad_s *bfad, void *cmd) bfad_iocmd_diag_queuetest() argument
1713 struct bfa_bsg_diag_qtest_s *iocmd = (struct bfa_bsg_diag_qtest_s *)cmd; bfad_iocmd_diag_queuetest()
1732 bfad_iocmd_diag_sfp(struct bfad_s *bfad, void *cmd) bfad_iocmd_diag_sfp() argument
1735 (struct bfa_bsg_sfp_show_s *)cmd; bfad_iocmd_diag_sfp()
1755 bfad_iocmd_diag_led(struct bfad_s *bfad, void *cmd) bfad_iocmd_diag_led() argument
1757 struct bfa_bsg_diag_led_s *iocmd = (struct bfa_bsg_diag_led_s *)cmd; bfad_iocmd_diag_led()
1768 bfad_iocmd_diag_beacon_lport(struct bfad_s *bfad, void *cmd) bfad_iocmd_diag_beacon_lport() argument
1771 (struct bfa_bsg_diag_beacon_s *)cmd; bfad_iocmd_diag_beacon_lport()
1783 bfad_iocmd_diag_lb_stat(struct bfad_s *bfad, void *cmd) bfad_iocmd_diag_lb_stat() argument
1786 (struct bfa_bsg_diag_lb_stat_s *)cmd; bfad_iocmd_diag_lb_stat()
1880 bfad_iocmd_phy_get_attr(struct bfad_s *bfad, void *cmd) bfad_iocmd_phy_get_attr() argument
1883 (struct bfa_bsg_phy_attr_s *)cmd; bfad_iocmd_phy_get_attr()
1901 bfad_iocmd_phy_get_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_phy_get_stats() argument
1904 (struct bfa_bsg_phy_stats_s *)cmd; bfad_iocmd_phy_get_stats()
1922 bfad_iocmd_phy_read(struct bfad_s *bfad, void *cmd, unsigned int payload_len) bfad_iocmd_phy_read() argument
1924 struct bfa_bsg_phy_s *iocmd = (struct bfa_bsg_phy_s *)cmd; bfad_iocmd_phy_read()
1954 bfad_iocmd_vhba_query(struct bfad_s *bfad, void *cmd) bfad_iocmd_vhba_query() argument
1957 (struct bfa_bsg_vhba_attr_s *)cmd; bfad_iocmd_vhba_query()
1973 bfad_iocmd_phy_update(struct bfad_s *bfad, void *cmd, unsigned int payload_len) bfad_iocmd_phy_update() argument
1975 struct bfa_bsg_phy_s *iocmd = (struct bfa_bsg_phy_s *)cmd; bfad_iocmd_phy_update()
2003 bfad_iocmd_porglog_get(struct bfad_s *bfad, void *cmd) bfad_iocmd_porglog_get() argument
2005 struct bfa_bsg_debug_s *iocmd = (struct bfa_bsg_debug_s *)cmd; bfad_iocmd_porglog_get()
2023 bfad_iocmd_debug_fw_core(struct bfad_s *bfad, void *cmd, bfad_iocmd_debug_fw_core() argument
2026 struct bfa_bsg_debug_s *iocmd = (struct bfa_bsg_debug_s *)cmd; bfad_iocmd_debug_fw_core()
2057 bfad_iocmd_debug_ctl(struct bfad_s *bfad, void *cmd, unsigned int v_cmd) bfad_iocmd_debug_ctl() argument
2059 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_debug_ctl()
2078 bfad_iocmd_porglog_ctl(struct bfad_s *bfad, void *cmd) bfad_iocmd_porglog_ctl() argument
2080 struct bfa_bsg_portlogctl_s *iocmd = (struct bfa_bsg_portlogctl_s *)cmd; bfad_iocmd_porglog_ctl()
2092 bfad_iocmd_fcpim_cfg_profile(struct bfad_s *bfad, void *cmd, unsigned int v_cmd) bfad_iocmd_fcpim_cfg_profile() argument
2095 (struct bfa_bsg_fcpim_profile_s *)cmd; bfad_iocmd_fcpim_cfg_profile()
2111 bfad_iocmd_itnim_get_ioprofile(struct bfad_s *bfad, void *cmd) bfad_iocmd_itnim_get_ioprofile() argument
2114 (struct bfa_bsg_itnim_ioprofile_s *)cmd; bfad_iocmd_itnim_get_ioprofile()
2138 bfad_iocmd_fcport_get_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_fcport_get_stats() argument
2141 (struct bfa_bsg_fcport_stats_s *)cmd; bfad_iocmd_fcport_get_stats()
2163 bfad_iocmd_fcport_reset_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_fcport_reset_stats() argument
2165 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_fcport_reset_stats()
2187 bfad_iocmd_boot_cfg(struct bfad_s *bfad, void *cmd) bfad_iocmd_boot_cfg() argument
2189 struct bfa_bsg_boot_s *iocmd = (struct bfa_bsg_boot_s *)cmd; bfad_iocmd_boot_cfg()
2209 bfad_iocmd_boot_query(struct bfad_s *bfad, void *cmd) bfad_iocmd_boot_query() argument
2211 struct bfa_bsg_boot_s *iocmd = (struct bfa_bsg_boot_s *)cmd; bfad_iocmd_boot_query()
2231 bfad_iocmd_preboot_query(struct bfad_s *bfad, void *cmd) bfad_iocmd_preboot_query() argument
2233 struct bfa_bsg_preboot_s *iocmd = (struct bfa_bsg_preboot_s *)cmd; bfad_iocmd_preboot_query()
2250 bfad_iocmd_ethboot_cfg(struct bfad_s *bfad, void *cmd) bfad_iocmd_ethboot_cfg() argument
2252 struct bfa_bsg_ethboot_s *iocmd = (struct bfa_bsg_ethboot_s *)cmd; bfad_iocmd_ethboot_cfg()
2273 bfad_iocmd_ethboot_query(struct bfad_s *bfad, void *cmd) bfad_iocmd_ethboot_query() argument
2275 struct bfa_bsg_ethboot_s *iocmd = (struct bfa_bsg_ethboot_s *)cmd; bfad_iocmd_ethboot_query()
2296 bfad_iocmd_cfg_trunk(struct bfad_s *bfad, void *cmd, unsigned int v_cmd) bfad_iocmd_cfg_trunk() argument
2298 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_cfg_trunk()
2336 bfad_iocmd_trunk_get_attr(struct bfad_s *bfad, void *cmd) bfad_iocmd_trunk_get_attr() argument
2338 struct bfa_bsg_trunk_attr_s *iocmd = (struct bfa_bsg_trunk_attr_s *)cmd; bfad_iocmd_trunk_get_attr()
2359 bfad_iocmd_qos(struct bfad_s *bfad, void *cmd, unsigned int v_cmd) bfad_iocmd_qos() argument
2361 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_qos()
2387 bfad_iocmd_qos_get_attr(struct bfad_s *bfad, void *cmd) bfad_iocmd_qos_get_attr() argument
2389 struct bfa_bsg_qos_attr_s *iocmd = (struct bfa_bsg_qos_attr_s *)cmd; bfad_iocmd_qos_get_attr()
2413 bfad_iocmd_qos_get_vc_attr(struct bfad_s *bfad, void *cmd) bfad_iocmd_qos_get_vc_attr() argument
2416 (struct bfa_bsg_qos_vc_attr_s *)cmd; bfad_iocmd_qos_get_vc_attr()
2445 bfad_iocmd_qos_get_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_qos_get_stats() argument
2448 (struct bfa_bsg_fcport_stats_s *)cmd; bfad_iocmd_qos_get_stats()
2477 bfad_iocmd_qos_reset_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_qos_reset_stats() argument
2479 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; bfad_iocmd_qos_reset_stats()
2508 bfad_iocmd_vf_get_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_vf_get_stats() argument
2511 (struct bfa_bsg_vf_stats_s *)cmd; bfad_iocmd_vf_get_stats()
2531 bfad_iocmd_vf_clr_stats(struct bfad_s *bfad, void *cmd) bfad_iocmd_vf_clr_stats() argument
2534 (struct bfa_bsg_vf_reset_stats_s *)cmd; bfad_iocmd_vf_clr_stats()
2591 bfad_iocmd_fcpim_lunmask_query(struct bfad_s *bfad, void *cmd) bfad_iocmd_fcpim_lunmask_query() argument
2594 (struct bfa_bsg_fcpim_lunmask_query_s *)cmd; bfad_iocmd_fcpim_lunmask_query()
2605 bfad_iocmd_fcpim_cfg_lunmask(struct bfad_s *bfad, void *cmd, unsigned int v_cmd) bfad_iocmd_fcpim_cfg_lunmask() argument
2608 (struct bfa_bsg_fcpim_lunmask_s *)cmd; bfad_iocmd_fcpim_cfg_lunmask()
2624 bfad_iocmd_fcpim_throttle_query(struct bfad_s *bfad, void *cmd) bfad_iocmd_fcpim_throttle_query() argument
2627 (struct bfa_bsg_fcpim_throttle_s *)cmd; bfad_iocmd_fcpim_throttle_query()
2639 bfad_iocmd_fcpim_throttle_set(struct bfad_s *bfad, void *cmd) bfad_iocmd_fcpim_throttle_set() argument
2642 (struct bfa_bsg_fcpim_throttle_s *)cmd; bfad_iocmd_fcpim_throttle_set()
2654 bfad_iocmd_tfru_read(struct bfad_s *bfad, void *cmd) bfad_iocmd_tfru_read() argument
2657 (struct bfa_bsg_tfru_s *)cmd; bfad_iocmd_tfru_read()
2676 bfad_iocmd_tfru_write(struct bfad_s *bfad, void *cmd) bfad_iocmd_tfru_write() argument
2679 (struct bfa_bsg_tfru_s *)cmd; bfad_iocmd_tfru_write()
2698 bfad_iocmd_fruvpd_read(struct bfad_s *bfad, void *cmd) bfad_iocmd_fruvpd_read() argument
2701 (struct bfa_bsg_fruvpd_s *)cmd; bfad_iocmd_fruvpd_read()
2720 bfad_iocmd_fruvpd_update(struct bfad_s *bfad, void *cmd) bfad_iocmd_fruvpd_update() argument
2723 (struct bfa_bsg_fruvpd_s *)cmd; bfad_iocmd_fruvpd_update()
2742 bfad_iocmd_fruvpd_get_max_size(struct bfad_s *bfad, void *cmd) bfad_iocmd_fruvpd_get_max_size() argument
2745 (struct bfa_bsg_fruvpd_max_size_s *)cmd; bfad_iocmd_fruvpd_get_max_size()
2757 bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, bfad_iocmd_handler() argument
2762 switch (cmd) { bfad_iocmd_handler()
2783 rc = bfad_iocmd_ioc_reset_stats(bfad, iocmd, cmd); bfad_iocmd_handler()
2787 rc = bfad_iocmd_ioc_set_name(bfad, iocmd, cmd); bfad_iocmd_handler()
2814 rc = bfad_iocmd_set_port_cfg(bfad, iocmd, cmd); bfad_iocmd_handler()
2821 rc = bfad_iocmd_port_cfg_bbcr(bfad, cmd, iocmd); bfad_iocmd_handler()
2870 rc = bfad_iocmd_ratelim(bfad, cmd, iocmd); bfad_iocmd_handler()
2873 rc = bfad_iocmd_ratelim_speed(bfad, cmd, iocmd); bfad_iocmd_handler()
2928 rc = bfad_iocmd_ablk_optrom(bfad, cmd, iocmd); bfad_iocmd_handler()
3024 rc = bfad_iocmd_debug_ctl(bfad, iocmd, cmd); bfad_iocmd_handler()
3031 rc = bfad_iocmd_fcpim_cfg_profile(bfad, iocmd, cmd); bfad_iocmd_handler()
3059 rc = bfad_iocmd_cfg_trunk(bfad, iocmd, cmd); bfad_iocmd_handler()
3066 rc = bfad_iocmd_qos(bfad, iocmd, cmd); bfad_iocmd_handler()
3092 rc = bfad_iocmd_lunmask(bfad, iocmd, cmd); bfad_iocmd_handler()
3099 rc = bfad_iocmd_fcpim_cfg_lunmask(bfad, iocmd, cmd); bfad_iocmd_handler()
3413 /* Check if the port is online before sending FC Passthru cmd */ bfad_im_bsg_els_ct_request()
/linux-4.4.14/drivers/isdn/isdnloop/
H A Disdnloop.c59 isdn_ctrl cmd; isdnloop_bchan_send() local
67 cmd.driver = card->myid; isdnloop_bchan_send()
68 cmd.arg = ch; isdnloop_bchan_send()
76 cmd.command = ISDN_STAT_BSENT; isdnloop_bchan_send()
77 cmd.parm.length = len; isdnloop_bchan_send()
78 card->interface.statcallb(&cmd); isdnloop_bchan_send()
119 * cmd = pointer to struct to be filled.
122 isdnloop_parse_setup(char *setup, isdn_ctrl *cmd) isdnloop_parse_setup() argument
128 strlcpy(cmd->parm.setup.phone, t, sizeof(cmd->parm.setup.phone)); isdnloop_parse_setup()
132 cmd->parm.setup.si1 = 0; isdnloop_parse_setup()
134 cmd->parm.setup.si1 = simple_strtoul(t, NULL, 10); isdnloop_parse_setup()
138 cmd->parm.setup.si2 = 0; isdnloop_parse_setup()
140 cmd->parm.setup.si2 = isdnloop_parse_setup()
142 strlcpy(cmd->parm.setup.eazmsn, s, sizeof(cmd->parm.setup.eazmsn)); isdnloop_parse_setup()
143 cmd->parm.setup.plan = 0; isdnloop_parse_setup()
144 cmd->parm.setup.screen = 0; isdnloop_parse_setup()
189 isdn_ctrl cmd; isdnloop_parse_status() local
193 cmd.command = s->command; isdnloop_parse_status()
201 cmd.driver = card->myid; isdnloop_parse_status()
202 cmd.arg = channel; isdnloop_parse_status()
217 isdnloop_parse_setup(status + 6, &cmd); isdnloop_parse_status()
221 sprintf(cmd.parm.setup.phone, "LEASED%d", card->myid); isdnloop_parse_status()
222 sprintf(cmd.parm.setup.eazmsn, "%d", channel + 1); isdnloop_parse_status()
223 cmd.parm.setup.si1 = 7; isdnloop_parse_status()
224 cmd.parm.setup.si2 = 0; isdnloop_parse_status()
225 cmd.parm.setup.plan = 0; isdnloop_parse_status()
226 cmd.parm.setup.screen = 0; isdnloop_parse_status()
230 strlcpy(cmd.parm.num, status + 3, sizeof(cmd.parm.num)); isdnloop_parse_status()
234 snprintf(cmd.parm.num, sizeof(cmd.parm.num), "%d", isdnloop_parse_status()
241 snprintf(cmd.parm.num, sizeof(cmd.parm.num), "%s%c%c", isdnloop_parse_status()
244 strlcpy(cmd.parm.num, status + 1, sizeof(cmd.parm.num)); isdnloop_parse_status()
250 cmd.arg = 0; isdnloop_parse_status()
251 cmd.driver = card->myid; isdnloop_parse_status()
252 card->interface.statcallb(&cmd); isdnloop_parse_status()
253 cmd.command = ISDN_STAT_DHUP; isdnloop_parse_status()
254 cmd.arg = 0; isdnloop_parse_status()
255 cmd.driver = card->myid; isdnloop_parse_status()
256 card->interface.statcallb(&cmd); isdnloop_parse_status()
257 cmd.command = ISDN_STAT_BHUP; isdnloop_parse_status()
260 cmd.arg = 1; isdnloop_parse_status()
261 cmd.driver = card->myid; isdnloop_parse_status()
262 card->interface.statcallb(&cmd); isdnloop_parse_status()
263 cmd.command = ISDN_STAT_DHUP; isdnloop_parse_status()
264 cmd.arg = 1; isdnloop_parse_status()
265 cmd.driver = card->myid; isdnloop_parse_status()
268 card->interface.statcallb(&cmd); isdnloop_parse_status()
318 isdn_ctrl cmd; isdnloop_polldchan() local
365 cmd.command = ISDN_STAT_STAVAIL; isdnloop_polldchan()
366 cmd.driver = card->myid; isdnloop_polldchan()
367 cmd.arg = avail; isdnloop_polldchan()
368 card->interface.statcallb(&cmd); isdnloop_polldchan()
658 * cmd = pointer to struct to be filled when parsing setup.
666 isdnloop_try_call(isdnloop_card *card, char *p, int lch, isdn_ctrl *cmd) isdnloop_try_call() argument
676 isdnloop_parse_setup(p, cmd); isdnloop_try_call()
686 if (!(strcmp(cc->s0num[i], cmd->parm.setup.phone))) isdnloop_try_call()
693 if (!(strcmp(nbuf, cmd->parm.setup.phone))) isdnloop_try_call()
703 if (!(si2bit[cmd->parm.setup.si1] & cc->sil[ch])) { isdnloop_try_call()
780 isdn_ctrl cmd; isdnloop_parse_cmd() local
865 switch (isdnloop_try_call(card, p, ch - 1, &cmd)) { isdnloop_parse_cmd()
870 isdnloop_vstphone(card, cmd.parm.setup.eazmsn, 1), isdnloop_parse_cmd()
871 cmd.parm.setup.si1, isdnloop_parse_cmd()
872 cmd.parm.setup.si2, isdnloop_parse_cmd()
874 cmd.parm.setup.phone, 0)); isdnloop_parse_cmd()
970 isdn_ctrl cmd; isdnloop_writecmd() local
1005 cmd.command = ISDN_STAT_STAVAIL; isdnloop_writecmd()
1006 cmd.driver = card->myid; isdnloop_writecmd()
1007 cmd.arg = ocount; isdnloop_writecmd()
1008 card->interface.statcallb(&cmd); isdnloop_writecmd()
1019 isdn_ctrl cmd; isdnloop_stopcard() local
1028 cmd.command = ISDN_STAT_STOP; isdnloop_stopcard()
1029 cmd.driver = card->myid; isdnloop_stopcard()
1030 card->interface.statcallb(&cmd); isdnloop_stopcard()
1135 isdn_ctrl cmd; isdnloop_command() local
1168 cmd.command = ISDN_STAT_RUN; isdnloop_command()
1169 cmd.driver = card->myid; isdnloop_command()
1170 cmd.arg = 0; isdnloop_command()
1171 card->interface.statcallb(&cmd); isdnloop_command()
1181 cmd.command = ISDN_STAT_RUN; isdnloop_command()
1182 cmd.driver = card->myid; isdnloop_command()
1183 cmd.arg = 0; isdnloop_command()
1184 card->interface.statcallb(&cmd); isdnloop_command()
1510 isdn_ctrl cmd; isdnloop_exit() local
1517 cmd.command = ISDN_STAT_UNLOAD; isdnloop_exit()
1518 cmd.driver = card->myid; isdnloop_exit()
1519 card->interface.statcallb(&cmd); isdnloop_exit()
/linux-4.4.14/drivers/scsi/libsas/
H A Dsas_scsi_host.c148 static struct sas_task *sas_create_task(struct scsi_cmnd *cmd, sas_create_task() argument
158 task->uldd_task = cmd; sas_create_task()
159 ASSIGN_SAS_TASK(cmd, task); sas_create_task()
165 int_to_scsilun(cmd->device->lun, &lun); sas_create_task()
168 task->ssp_task.cmd = cmd; sas_create_task()
170 task->scatter = scsi_sglist(cmd); sas_create_task()
171 task->num_scatter = scsi_sg_count(cmd); sas_create_task()
172 task->total_xfer_len = scsi_bufflen(cmd); sas_create_task()
173 task->data_dir = cmd->sc_data_direction; sas_create_task()
180 int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) sas_queuecommand() argument
183 struct domain_device *dev = cmd_to_domain_dev(cmd); sas_queuecommand()
189 cmd->result = DID_BAD_TARGET << 16; sas_queuecommand()
195 res = ata_sas_queuecmd(cmd, dev->sata_dev.ap); sas_queuecommand()
200 task = sas_create_task(cmd, dev, GFP_ATOMIC); sas_queuecommand()
211 ASSIGN_SAS_TASK(cmd, NULL); sas_queuecommand()
214 cmd->result = DID_SOFT_ERROR << 16; /* retry */ sas_queuecommand()
216 cmd->result = DID_ERROR << 16; sas_queuecommand()
218 cmd->scsi_done(cmd); sas_queuecommand()
222 static void sas_eh_finish_cmd(struct scsi_cmnd *cmd) sas_eh_finish_cmd() argument
224 struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(cmd->device->host); sas_eh_finish_cmd()
225 struct sas_task *task = TO_SAS_TASK(cmd); sas_eh_finish_cmd()
231 sas_end_task(cmd, task); sas_eh_finish_cmd()
237 scsi_eh_finish_cmd(cmd, &sas_ha->eh_done_q); sas_eh_finish_cmd()
240 static void sas_eh_defer_cmd(struct scsi_cmnd *cmd) sas_eh_defer_cmd() argument
242 struct domain_device *dev = cmd_to_domain_dev(cmd); sas_eh_defer_cmd()
244 struct sas_task *task = TO_SAS_TASK(cmd); sas_eh_defer_cmd()
247 sas_eh_finish_cmd(cmd); sas_eh_defer_cmd()
252 sas_end_task(cmd, task); sas_eh_defer_cmd()
253 list_move_tail(&cmd->eh_entry, &ha->eh_ata_q); sas_eh_defer_cmd()
258 struct scsi_cmnd *cmd, *n; sas_scsi_clear_queue_lu() local
260 list_for_each_entry_safe(cmd, n, error_q, eh_entry) { list_for_each_entry_safe()
261 if (cmd->device->sdev_target == my_cmd->device->sdev_target && list_for_each_entry_safe()
262 cmd->device->lun == my_cmd->device->lun) list_for_each_entry_safe()
263 sas_eh_defer_cmd(cmd); list_for_each_entry_safe()
270 struct scsi_cmnd *cmd, *n; sas_scsi_clear_queue_I_T() local
272 list_for_each_entry_safe(cmd, n, error_q, eh_entry) { list_for_each_entry_safe()
273 struct domain_device *x = cmd_to_domain_dev(cmd); list_for_each_entry_safe()
276 sas_eh_finish_cmd(cmd); list_for_each_entry_safe()
283 struct scsi_cmnd *cmd, *n; sas_scsi_clear_queue_port() local
285 list_for_each_entry_safe(cmd, n, error_q, eh_entry) { list_for_each_entry_safe()
286 struct domain_device *dev = cmd_to_domain_dev(cmd); list_for_each_entry_safe()
290 sas_eh_finish_cmd(cmd); list_for_each_entry_safe()
350 static int sas_recover_lu(struct domain_device *dev, struct scsi_cmnd *cmd) sas_recover_lu() argument
357 int_to_scsilun(cmd->device->lun, &lun); sas_recover_lu()
361 cmd->device->lun); sas_recover_lu()
487 int sas_eh_abort_handler(struct scsi_cmnd *cmd) sas_eh_abort_handler() argument
490 struct sas_task *task = TO_SAS_TASK(cmd); sas_eh_abort_handler()
491 struct Scsi_Host *host = cmd->device->host; sas_eh_abort_handler()
509 int sas_eh_device_reset_handler(struct scsi_cmnd *cmd) sas_eh_device_reset_handler() argument
513 struct Scsi_Host *host = cmd->device->host; sas_eh_device_reset_handler()
514 struct domain_device *dev = cmd_to_domain_dev(cmd); sas_eh_device_reset_handler()
518 return sas_queue_reset(dev, SAS_DEV_LU_RESET, cmd->device->lun, 0); sas_eh_device_reset_handler()
520 int_to_scsilun(cmd->device->lun, &lun); sas_eh_device_reset_handler()
532 int sas_eh_bus_reset_handler(struct scsi_cmnd *cmd) sas_eh_bus_reset_handler() argument
535 struct Scsi_Host *host = cmd->device->host; sas_eh_bus_reset_handler()
536 struct domain_device *dev = cmd_to_domain_dev(cmd); sas_eh_bus_reset_handler()
554 static int try_to_reset_cmd_device(struct scsi_cmnd *cmd) try_to_reset_cmd_device() argument
557 struct Scsi_Host *shost = cmd->device->host; try_to_reset_cmd_device()
562 res = shost->hostt->eh_device_reset_handler(cmd); try_to_reset_cmd_device()
568 return shost->hostt->eh_bus_reset_handler(cmd); try_to_reset_cmd_device()
575 struct scsi_cmnd *cmd, *n; sas_eh_handle_sas_errors() local
584 list_for_each_entry_safe(cmd, n, work_q, eh_entry) { list_for_each_entry_safe()
585 struct domain_device *dev = cmd_to_domain_dev(cmd); list_for_each_entry_safe()
593 task = TO_SAS_TASK(cmd); list_for_each_entry_safe()
597 list_move_tail(&cmd->eh_entry, &done); list_for_each_entry_safe()
601 list_for_each_entry_safe(cmd, n, work_q, eh_entry) { list_for_each_entry_safe()
602 struct sas_task *task = TO_SAS_TASK(cmd); list_for_each_entry_safe()
604 list_del_init(&cmd->eh_entry); list_for_each_entry_safe()
619 cmd->eh_eflags = 0; list_for_each_entry_safe()
625 sas_eh_defer_cmd(cmd); list_for_each_entry_safe()
630 sas_eh_defer_cmd(cmd); list_for_each_entry_safe()
635 tmf_resp = sas_recover_lu(task->dev, cmd); list_for_each_entry_safe()
640 cmd->device->lun); list_for_each_entry_safe()
641 sas_eh_defer_cmd(cmd); list_for_each_entry_safe()
642 sas_scsi_clear_queue_lu(work_q, cmd); list_for_each_entry_safe()
656 sas_eh_finish_cmd(cmd); list_for_each_entry_safe()
661 try_to_reset_cmd_device(cmd); list_for_each_entry_safe()
670 sas_eh_finish_cmd(cmd); list_for_each_entry_safe()
682 sas_eh_finish_cmd(cmd); list_for_each_entry_safe()
693 cmd->device->lun); list_for_each_entry_safe()
695 sas_eh_finish_cmd(cmd); list_for_each_entry_safe()
706 list_for_each_entry_safe(cmd, n, work_q, eh_entry)
707 sas_eh_finish_cmd(cmd);
806 enum blk_eh_timer_return sas_scsi_timed_out(struct scsi_cmnd *cmd) sas_scsi_timed_out() argument
808 scmd_dbg(cmd, "command %p timed out\n", cmd); sas_scsi_timed_out()
813 int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) sas_ioctl() argument
818 return ata_sas_scsi_ioctl(dev->sata_dev.ap, sdev, cmd, arg); sas_ioctl()
/linux-4.4.14/drivers/media/platform/exynos4-is/
H A Dfimc-is-param.c296 isp->aa.cmd = ISP_AA_COMMAND_START; __is_set_init_isp_aa()
311 void __is_set_isp_flash(struct fimc_is *is, u32 cmd, u32 redeye) __is_set_isp_flash() argument
316 isp->flash.cmd = cmd; __is_set_isp_flash()
323 void __is_set_isp_awb(struct fimc_is *is, u32 cmd, u32 val) __is_set_isp_awb() argument
330 isp->awb.cmd = cmd; __is_set_isp_awb()
337 void __is_set_isp_effect(struct fimc_is *is, u32 cmd) __is_set_isp_effect() argument
344 isp->effect.cmd = cmd; __is_set_isp_effect()
350 void __is_set_isp_iso(struct fimc_is *is, u32 cmd, u32 val) __is_set_isp_iso() argument
357 isp->iso.cmd = cmd; __is_set_isp_iso()
364 void __is_set_isp_adjust(struct fimc_is *is, u32 cmd, u32 val) __is_set_isp_adjust() argument
373 switch (cmd) { __is_set_isp_adjust()
403 isp->adjust.cmd = cmd; __is_set_isp_adjust()
407 isp->adjust.cmd |= cmd; __is_set_isp_adjust()
422 isp->metering.cmd = val; __is_set_isp_metering()
446 void __is_set_isp_afc(struct fimc_is *is, u32 cmd, u32 val) __is_set_isp_afc() argument
453 isp->afc.cmd = cmd; __is_set_isp_afc()
481 fd->control.cmd = val; __is_set_fd_control()
499 fd->config.cmd = FD_CONFIG_COMMAND_MAXIMUM_NUMBER; __is_set_fd_config_maxface()
503 fd->config.cmd |= FD_CONFIG_COMMAND_MAXIMUM_NUMBER; __is_set_fd_config_maxface()
519 fd->config.cmd = FD_CONFIG_COMMAND_ROLL_ANGLE; __is_set_fd_config_rollangle()
523 fd->config.cmd |= FD_CONFIG_COMMAND_ROLL_ANGLE; __is_set_fd_config_rollangle()
539 fd->config.cmd = FD_CONFIG_COMMAND_YAW_ANGLE; __is_set_fd_config_yawangle()
543 fd->config.cmd |= FD_CONFIG_COMMAND_YAW_ANGLE; __is_set_fd_config_yawangle()
559 fd->config.cmd = FD_CONFIG_COMMAND_SMILE_MODE; __is_set_fd_config_smilemode()
563 fd->config.cmd |= FD_CONFIG_COMMAND_SMILE_MODE; __is_set_fd_config_smilemode()
579 fd->config.cmd = FD_CONFIG_COMMAND_BLINK_MODE; __is_set_fd_config_blinkmode()
583 fd->config.cmd |= FD_CONFIG_COMMAND_BLINK_MODE; __is_set_fd_config_blinkmode()
599 fd->config.cmd = FD_CONFIG_COMMAND_EYES_DETECT; __is_set_fd_config_eyedetect()
603 fd->config.cmd |= FD_CONFIG_COMMAND_EYES_DETECT; __is_set_fd_config_eyedetect()
619 fd->config.cmd = FD_CONFIG_COMMAND_MOUTH_DETECT; __is_set_fd_config_mouthdetect()
623 fd->config.cmd |= FD_CONFIG_COMMAND_MOUTH_DETECT; __is_set_fd_config_mouthdetect()
639 fd->config.cmd = FD_CONFIG_COMMAND_ORIENTATION; __is_set_fd_config_orientation()
643 fd->config.cmd |= FD_CONFIG_COMMAND_ORIENTATION; __is_set_fd_config_orientation()
659 fd->config.cmd = FD_CONFIG_COMMAND_ORIENTATION_VALUE; __is_set_fd_config_orientation_val()
663 fd->config.cmd |= FD_CONFIG_COMMAND_ORIENTATION_VALUE; __is_set_fd_config_orientation_val()
684 global->shotmode.cmd = 1; fimc_is_set_initial_params()
688 isp->control.cmd = CONTROL_COMMAND_START; fimc_is_set_initial_params()
693 isp->otf_input.cmd = OTF_INPUT_COMMAND_ENABLE; fimc_is_set_initial_params()
709 isp->dma1_input.cmd = DMA_INPUT_COMMAND_DISABLE; fimc_is_set_initial_params()
721 isp->dma2_input.cmd = DMA_INPUT_COMMAND_DISABLE; fimc_is_set_initial_params()
733 isp->aa.cmd = ISP_AA_COMMAND_START; fimc_is_set_initial_params()
772 isp->otf_output.cmd = OTF_OUTPUT_COMMAND_ENABLE; fimc_is_set_initial_params()
784 isp->dma1_output.cmd = DMA_OUTPUT_COMMAND_DISABLE; fimc_is_set_initial_params()
800 isp->dma2_output.cmd = DMA_OUTPUT_COMMAND_DISABLE; fimc_is_set_initial_params()
822 drc->control.cmd = CONTROL_COMMAND_START; fimc_is_set_initial_params()
825 drc->otf_input.cmd = OTF_INPUT_COMMAND_ENABLE; fimc_is_set_initial_params()
836 drc->dma_input.cmd = DMA_INPUT_COMMAND_DISABLE; fimc_is_set_initial_params()
848 drc->otf_output.cmd = OTF_OUTPUT_COMMAND_ENABLE; fimc_is_set_initial_params()
863 fd->otf_input.cmd = OTF_INPUT_COMMAND_ENABLE; fimc_is_set_initial_params()
875 fd->dma_input.cmd = DMA_INPUT_COMMAND_DISABLE; fimc_is_set_initial_params()
/linux-4.4.14/drivers/block/
H A Dnull_blk.c168 static void free_cmd(struct nullb_cmd *cmd) free_cmd() argument
170 put_tag(cmd->nq, cmd->tag); free_cmd()
177 struct nullb_cmd *cmd; __alloc_cmd() local
182 cmd = &nq->cmds[tag]; __alloc_cmd()
183 cmd->tag = tag; __alloc_cmd()
184 cmd->nq = nq; __alloc_cmd()
186 hrtimer_init(&cmd->timer, CLOCK_MONOTONIC, __alloc_cmd()
188 cmd->timer.function = null_cmd_timer_expired; __alloc_cmd()
190 return cmd; __alloc_cmd()
198 struct nullb_cmd *cmd; alloc_cmd() local
201 cmd = __alloc_cmd(nq); alloc_cmd()
202 if (cmd || !can_wait) alloc_cmd()
203 return cmd; alloc_cmd()
207 cmd = __alloc_cmd(nq); alloc_cmd()
208 if (cmd) alloc_cmd()
215 return cmd; alloc_cmd()
218 static void end_cmd(struct nullb_cmd *cmd) end_cmd() argument
222 if (cmd->rq) end_cmd()
223 q = cmd->rq->q; end_cmd()
227 blk_mq_end_request(cmd->rq, 0); end_cmd()
230 INIT_LIST_HEAD(&cmd->rq->queuelist); end_cmd()
231 blk_end_request_all(cmd->rq, 0); end_cmd()
234 bio_endio(cmd->bio); end_cmd()
238 free_cmd(cmd); end_cmd()
257 static void null_cmd_end_timer(struct nullb_cmd *cmd) null_cmd_end_timer() argument
261 hrtimer_start(&cmd->timer, kt, HRTIMER_MODE_REL); null_cmd_end_timer()
272 static inline void null_handle_cmd(struct nullb_cmd *cmd) null_handle_cmd() argument
279 blk_mq_complete_request(cmd->rq, cmd->rq->errors); null_handle_cmd()
282 blk_complete_request(cmd->rq); null_handle_cmd()
288 end_cmd(cmd); null_handle_cmd()
293 end_cmd(cmd); null_handle_cmd()
296 null_cmd_end_timer(cmd); null_handle_cmd()
315 struct nullb_cmd *cmd; null_queue_bio() local
317 cmd = alloc_cmd(nq, 1); null_queue_bio()
318 cmd->bio = bio; null_queue_bio()
320 null_handle_cmd(cmd); null_queue_bio()
328 struct nullb_cmd *cmd; null_rq_prep_fn() local
330 cmd = alloc_cmd(nq, 0); null_rq_prep_fn()
331 if (cmd) { null_rq_prep_fn()
332 cmd->rq = req; null_rq_prep_fn()
333 req->special = cmd; null_rq_prep_fn()
346 struct nullb_cmd *cmd = rq->special; null_request_fn() local
349 null_handle_cmd(cmd); null_request_fn()
357 struct nullb_cmd *cmd = blk_mq_rq_to_pdu(bd->rq); null_queue_rq() local
360 hrtimer_init(&cmd->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); null_queue_rq()
361 cmd->timer.function = null_cmd_timer_expired; null_queue_rq()
363 cmd->rq = bd->rq; null_queue_rq()
364 cmd->nq = hctx->driver_data; null_queue_rq()
368 null_handle_cmd(cmd); null_queue_rq()
589 struct nullb_cmd *cmd; setup_commands() local
592 nq->cmds = kzalloc(nq->queue_depth * sizeof(*cmd), GFP_KERNEL); setup_commands()
604 cmd = &nq->cmds[i]; setup_commands()
605 INIT_LIST_HEAD(&cmd->list); setup_commands()
606 cmd->ll_list.next = NULL; setup_commands()
607 cmd->tag = -1U; setup_commands()
/linux-4.4.14/drivers/irqchip/
H A Dirq-gic-v3-its.c176 static void its_encode_cmd(struct its_cmd_block *cmd, u8 cmd_nr) its_encode_cmd() argument
178 cmd->raw_cmd[0] &= ~0xffUL; its_encode_cmd()
179 cmd->raw_cmd[0] |= cmd_nr; its_encode_cmd()
182 static void its_encode_devid(struct its_cmd_block *cmd, u32 devid) its_encode_devid() argument
184 cmd->raw_cmd[0] &= BIT_ULL(32) - 1; its_encode_devid()
185 cmd->raw_cmd[0] |= ((u64)devid) << 32; its_encode_devid()
188 static void its_encode_event_id(struct its_cmd_block *cmd, u32 id) its_encode_event_id() argument
190 cmd->raw_cmd[1] &= ~0xffffffffUL; its_encode_event_id()
191 cmd->raw_cmd[1] |= id; its_encode_event_id()
194 static void its_encode_phys_id(struct its_cmd_block *cmd, u32 phys_id) its_encode_phys_id() argument
196 cmd->raw_cmd[1] &= 0xffffffffUL; its_encode_phys_id()
197 cmd->raw_cmd[1] |= ((u64)phys_id) << 32; its_encode_phys_id()
200 static void its_encode_size(struct its_cmd_block *cmd, u8 size) its_encode_size() argument
202 cmd->raw_cmd[1] &= ~0x1fUL; its_encode_size()
203 cmd->raw_cmd[1] |= size & 0x1f; its_encode_size()
206 static void its_encode_itt(struct its_cmd_block *cmd, u64 itt_addr) its_encode_itt() argument
208 cmd->raw_cmd[2] &= ~0xffffffffffffUL; its_encode_itt()
209 cmd->raw_cmd[2] |= itt_addr & 0xffffffffff00UL; its_encode_itt()
212 static void its_encode_valid(struct its_cmd_block *cmd, int valid) its_encode_valid() argument
214 cmd->raw_cmd[2] &= ~(1UL << 63); its_encode_valid()
215 cmd->raw_cmd[2] |= ((u64)!!valid) << 63; its_encode_valid()
218 static void its_encode_target(struct its_cmd_block *cmd, u64 target_addr) its_encode_target() argument
220 cmd->raw_cmd[2] &= ~(0xffffffffUL << 16); its_encode_target()
221 cmd->raw_cmd[2] |= (target_addr & (0xffffffffUL << 16)); its_encode_target()
224 static void its_encode_collection(struct its_cmd_block *cmd, u16 col) its_encode_collection() argument
226 cmd->raw_cmd[2] &= ~0xffffUL; its_encode_collection()
227 cmd->raw_cmd[2] |= col; its_encode_collection()
230 static inline void its_fixup_cmd(struct its_cmd_block *cmd) its_fixup_cmd() argument
233 cmd->raw_cmd[0] = cpu_to_le64(cmd->raw_cmd[0]); its_fixup_cmd()
234 cmd->raw_cmd[1] = cpu_to_le64(cmd->raw_cmd[1]); its_fixup_cmd()
235 cmd->raw_cmd[2] = cpu_to_le64(cmd->raw_cmd[2]); its_fixup_cmd()
236 cmd->raw_cmd[3] = cpu_to_le64(cmd->raw_cmd[3]); its_fixup_cmd()
239 static struct its_collection *its_build_mapd_cmd(struct its_cmd_block *cmd, its_build_mapd_cmd() argument
248 its_encode_cmd(cmd, GITS_CMD_MAPD); its_build_mapd_cmd()
249 its_encode_devid(cmd, desc->its_mapd_cmd.dev->device_id); its_build_mapd_cmd()
250 its_encode_size(cmd, size - 1); its_build_mapd_cmd()
251 its_encode_itt(cmd, itt_addr); its_build_mapd_cmd()
252 its_encode_valid(cmd, desc->its_mapd_cmd.valid); its_build_mapd_cmd()
254 its_fixup_cmd(cmd); its_build_mapd_cmd()
259 static struct its_collection *its_build_mapc_cmd(struct its_cmd_block *cmd, its_build_mapc_cmd() argument
262 its_encode_cmd(cmd, GITS_CMD_MAPC); its_build_mapc_cmd()
263 its_encode_collection(cmd, desc->its_mapc_cmd.col->col_id); its_build_mapc_cmd()
264 its_encode_target(cmd, desc->its_mapc_cmd.col->target_address); its_build_mapc_cmd()
265 its_encode_valid(cmd, desc->its_mapc_cmd.valid); its_build_mapc_cmd()
267 its_fixup_cmd(cmd); its_build_mapc_cmd()
272 static struct its_collection *its_build_mapvi_cmd(struct its_cmd_block *cmd, its_build_mapvi_cmd() argument
280 its_encode_cmd(cmd, GITS_CMD_MAPVI); its_build_mapvi_cmd()
281 its_encode_devid(cmd, desc->its_mapvi_cmd.dev->device_id); its_build_mapvi_cmd()
282 its_encode_event_id(cmd, desc->its_mapvi_cmd.event_id); its_build_mapvi_cmd()
283 its_encode_phys_id(cmd, desc->its_mapvi_cmd.phys_id); its_build_mapvi_cmd()
284 its_encode_collection(cmd, col->col_id); its_build_mapvi_cmd()
286 its_fixup_cmd(cmd); its_build_mapvi_cmd()
291 static struct its_collection *its_build_movi_cmd(struct its_cmd_block *cmd, its_build_movi_cmd() argument
299 its_encode_cmd(cmd, GITS_CMD_MOVI); its_build_movi_cmd()
300 its_encode_devid(cmd, desc->its_movi_cmd.dev->device_id); its_build_movi_cmd()
301 its_encode_event_id(cmd, desc->its_movi_cmd.event_id); its_build_movi_cmd()
302 its_encode_collection(cmd, desc->its_movi_cmd.col->col_id); its_build_movi_cmd()
304 its_fixup_cmd(cmd); its_build_movi_cmd()
309 static struct its_collection *its_build_discard_cmd(struct its_cmd_block *cmd, its_build_discard_cmd() argument
317 its_encode_cmd(cmd, GITS_CMD_DISCARD); its_build_discard_cmd()
318 its_encode_devid(cmd, desc->its_discard_cmd.dev->device_id); its_build_discard_cmd()
319 its_encode_event_id(cmd, desc->its_discard_cmd.event_id); its_build_discard_cmd()
321 its_fixup_cmd(cmd); its_build_discard_cmd()
326 static struct its_collection *its_build_inv_cmd(struct its_cmd_block *cmd, its_build_inv_cmd() argument
334 its_encode_cmd(cmd, GITS_CMD_INV); its_build_inv_cmd()
335 its_encode_devid(cmd, desc->its_inv_cmd.dev->device_id); its_build_inv_cmd()
336 its_encode_event_id(cmd, desc->its_inv_cmd.event_id); its_build_inv_cmd()
338 its_fixup_cmd(cmd); its_build_inv_cmd()
343 static struct its_collection *its_build_invall_cmd(struct its_cmd_block *cmd, its_build_invall_cmd() argument
346 its_encode_cmd(cmd, GITS_CMD_INVALL); its_build_invall_cmd()
347 its_encode_collection(cmd, desc->its_mapc_cmd.col->col_id); its_build_invall_cmd()
349 its_fixup_cmd(cmd); its_build_invall_cmd()
377 struct its_cmd_block *cmd; its_allocate_entry() local
390 cmd = its->cmd_write++; its_allocate_entry()
396 return cmd; its_allocate_entry()
408 static void its_flush_cmd(struct its_node *its, struct its_cmd_block *cmd) its_flush_cmd() argument
415 __flush_dcache_area(cmd, sizeof(*cmd)); its_flush_cmd()
449 struct its_cmd_block *cmd, *sync_cmd, *next_cmd; its_send_single_command() local
455 cmd = its_allocate_entry(its); its_send_single_command()
456 if (!cmd) { /* We're soooooo screewed... */ its_send_single_command()
461 sync_col = builder(cmd, desc); its_send_single_command()
462 its_flush_cmd(its, cmd); its_send_single_command()
480 its_wait_for_range_completion(its, cmd, next_cmd); its_send_single_command()
1512 pr_info("ITS: using cache flushing for cmd queue\n"); its_probe()
/linux-4.4.14/drivers/scsi/esas2r/
H A Desas2r_vda.c102 if (vi->cmd.flash.sub_func != VDA_FLASH_FREAD esas2r_process_vda_ioctl()
103 && vi->cmd.flash.sub_func != VDA_FLASH_FWRITE esas2r_process_vda_ioctl()
104 && vi->cmd.flash.sub_func != VDA_FLASH_FINFO) { esas2r_process_vda_ioctl()
109 if (vi->cmd.flash.sub_func != VDA_FLASH_FINFO) esas2r_process_vda_ioctl()
113 rq->vrq->flash.sub_func = vi->cmd.flash.sub_func; esas2r_process_vda_ioctl()
116 vi->cmd.flash.data.file.file_name, esas2r_process_vda_ioctl()
117 sizeof(vi->cmd.flash.data.file.file_name)); esas2r_process_vda_ioctl()
127 cpu_to_le32(vi->cmd.cli.cmd_rsp_len); esas2r_process_vda_ioctl()
137 + offsetof(struct atto_ioctl_vda, cmd) esas2r_process_vda_ioctl()
150 if (vi->cmd.mgt.mgt_func == VDAMGT_DEV_HEALTH_REQ esas2r_process_vda_ioctl()
151 || vi->cmd.mgt.mgt_func == VDAMGT_DEV_METRICS) { esas2r_process_vda_ioctl()
157 datalen = vi->cmd.mgt.data_length; esas2r_process_vda_ioctl()
158 } else if (vi->cmd.mgt.mgt_func == VDAMGT_DEV_INFO2 esas2r_process_vda_ioctl()
159 || vi->cmd.mgt.mgt_func == esas2r_process_vda_ioctl()
185 datalen = vi->cmd.mgt.data_length; esas2r_process_vda_ioctl()
198 rq->vrq->mgt.mgt_func = vi->cmd.mgt.mgt_func; esas2r_process_vda_ioctl()
199 rq->vrq->mgt.scan_generation = vi->cmd.mgt.scan_generation; esas2r_process_vda_ioctl()
201 cpu_to_le32(vi->cmd.mgt.dev_index); esas2r_process_vda_ioctl()
203 esas2r_nuxi_mgt_data(rq->vrq->mgt.mgt_func, &vi->cmd.mgt.data); esas2r_process_vda_ioctl()
210 || vi->cmd.cfg.data_length == 0) { esas2r_process_vda_ioctl()
215 if (vi->cmd.cfg.cfg_func == VDA_CFG_INIT) { esas2r_process_vda_ioctl()
220 rq->vrq->cfg.sub_func = vi->cmd.cfg.cfg_func; esas2r_process_vda_ioctl()
221 rq->vrq->cfg.length = cpu_to_le32(vi->cmd.cfg.data_length); esas2r_process_vda_ioctl()
223 if (vi->cmd.cfg.cfg_func == VDA_CFG_GET_INIT) { esas2r_process_vda_ioctl()
225 &vi->cmd.cfg.data, esas2r_process_vda_ioctl()
226 vi->cmd.cfg.data_length); esas2r_process_vda_ioctl()
240 vi->cmd.gsv.rsp_len = vercnt; esas2r_process_vda_ioctl()
242 memcpy(vi->cmd.gsv.version_info, esas2r_vdaioctl_versions, esas2r_process_vda_ioctl()
279 if (vi->cmd.flash.sub_func == VDA_FLASH_FINFO esas2r_complete_vda_ioctl()
280 || vi->cmd.flash.sub_func == VDA_FLASH_FREAD) esas2r_complete_vda_ioctl()
281 vi->cmd.flash.data.file.file_size = esas2r_complete_vda_ioctl()
288 vi->cmd.mgt.scan_generation = esas2r_complete_vda_ioctl()
290 vi->cmd.mgt.dev_index = le16_to_cpu( esas2r_complete_vda_ioctl()
294 vi->cmd.mgt.data_length = esas2r_complete_vda_ioctl()
297 esas2r_nuxi_mgt_data(rq->vrq->mgt.mgt_func, &vi->cmd.mgt.data); esas2r_complete_vda_ioctl()
302 if (vi->cmd.cfg.cfg_func == VDA_CFG_GET_INIT) { esas2r_complete_vda_ioctl()
303 struct atto_ioctl_vda_cfg_cmd *cfg = &vi->cmd.cfg; esas2r_complete_vda_ioctl()
328 &vi->cmd.cfg.data); esas2r_complete_vda_ioctl()
335 vi->cmd.cli.cmd_rsp_len = esas2r_complete_vda_ioctl()
/linux-4.4.14/drivers/nvdimm/
H A Ddimm_devs.c64 struct nd_cmd_get_config_size *cmd = &ndd->nsarea; nvdimm_init_nsarea() local
72 if (cmd->config_size) nvdimm_init_nsarea()
75 memset(cmd, 0, sizeof(*cmd)); nvdimm_init_nsarea()
78 ND_CMD_GET_CONFIG_SIZE, cmd, sizeof(*cmd)); nvdimm_init_nsarea()
84 struct nd_cmd_get_config_data_hdr *cmd; nvdimm_init_config_data() local
111 cmd = kzalloc(max_cmd_size + sizeof(*cmd), GFP_KERNEL); nvdimm_init_config_data()
112 if (!cmd) nvdimm_init_config_data()
117 config_size; config_size -= cmd->in_length, nvdimm_init_config_data()
118 offset += cmd->in_length) { nvdimm_init_config_data()
119 cmd->in_length = min(config_size, max_cmd_size); nvdimm_init_config_data()
120 cmd->in_offset = offset; nvdimm_init_config_data()
122 ND_CMD_GET_CONFIG_DATA, cmd, nvdimm_init_config_data()
123 cmd->in_length + sizeof(*cmd)); nvdimm_init_config_data()
124 if (rc || cmd->status) { nvdimm_init_config_data()
128 memcpy(ndd->data + offset, cmd->out_buf, cmd->in_length); nvdimm_init_config_data()
131 kfree(cmd); nvdimm_init_config_data()
141 struct nd_cmd_set_config_hdr *cmd; nvdimm_set_config_data() local
156 cmd = kzalloc(max_cmd_size + sizeof(*cmd) + sizeof(u32), GFP_KERNEL); nvdimm_set_config_data()
157 if (!cmd) nvdimm_set_config_data()
160 for (buf_offset = 0; len; len -= cmd->in_length, nvdimm_set_config_data()
161 buf_offset += cmd->in_length) { nvdimm_set_config_data()
165 cmd->in_offset = offset + buf_offset; nvdimm_set_config_data()
166 cmd->in_length = min(max_cmd_size, len); nvdimm_set_config_data()
167 memcpy(cmd->in_buf, buf + buf_offset, cmd->in_length); nvdimm_set_config_data()
170 cmd_size = sizeof(*cmd) + cmd->in_length + sizeof(u32); nvdimm_set_config_data()
171 status = ((void *) cmd) + cmd_size - sizeof(u32); nvdimm_set_config_data()
174 ND_CMD_SET_CONFIG_DATA, cmd, cmd_size); nvdimm_set_config_data()
180 kfree(cmd); nvdimm_set_config_data()
278 int cmd, len = 0; commands_show() local
283 for_each_set_bit(cmd, nvdimm->dsm_mask, BITS_PER_LONG) commands_show()
284 len += sprintf(buf + len, "%s ", nvdimm_cmd_name(cmd)); commands_show()
/linux-4.4.14/drivers/firmware/
H A Dqcom_scm-32.c111 struct qcom_scm_command *cmd; alloc_qcom_scm_command() local
112 size_t len = sizeof(*cmd) + sizeof(struct qcom_scm_response) + cmd_size + alloc_qcom_scm_command()
116 cmd = kzalloc(PAGE_ALIGN(len), GFP_KERNEL); alloc_qcom_scm_command()
117 if (cmd) { alloc_qcom_scm_command()
118 cmd->len = cpu_to_le32(len); alloc_qcom_scm_command()
120 cmd->buf_offset = cpu_to_le32(offset); alloc_qcom_scm_command()
121 cmd->resp_hdr_offset = cpu_to_le32(offset + cmd_size); alloc_qcom_scm_command()
123 return cmd; alloc_qcom_scm_command()
128 * @cmd: command to free
132 static inline void free_qcom_scm_command(struct qcom_scm_command *cmd) free_qcom_scm_command() argument
134 kfree(cmd); free_qcom_scm_command()
139 * @cmd: command
144 const struct qcom_scm_command *cmd) qcom_scm_command_to_response()
146 return (void *)cmd + le32_to_cpu(cmd->resp_hdr_offset); qcom_scm_command_to_response()
151 * @cmd: command
155 static inline void *qcom_scm_get_command_buffer(const struct qcom_scm_command *cmd) qcom_scm_get_command_buffer() argument
157 return (void *)cmd->buf; qcom_scm_get_command_buffer()
212 static int __qcom_scm_call(const struct qcom_scm_command *cmd) __qcom_scm_call() argument
215 u32 cmd_addr = virt_to_phys(cmd); __qcom_scm_call()
221 secure_flush_area(cmd, cmd->len); __qcom_scm_call()
271 struct qcom_scm_command *cmd; qcom_scm_call() local
275 cmd = alloc_qcom_scm_command(cmd_len, resp_len); qcom_scm_call()
276 if (!cmd) qcom_scm_call()
279 cmd->id = cpu_to_le32((svc_id << 10) | cmd_id); qcom_scm_call()
281 memcpy(qcom_scm_get_command_buffer(cmd), cmd_buf, cmd_len); qcom_scm_call()
284 ret = __qcom_scm_call(cmd); qcom_scm_call()
289 rsp = qcom_scm_command_to_response(cmd); qcom_scm_call()
302 free_qcom_scm_command(cmd); qcom_scm_call()
308 #define SCM_ATOMIC(svc, cmd, n) (((((svc) << 10)|((cmd) & 0x3ff)) << 12) | \
322 static s32 qcom_scm_call_atomic1(u32 svc, u32 cmd, u32 arg1) qcom_scm_call_atomic1() argument
326 register u32 r0 asm("r0") = SCM_ATOMIC(svc, cmd, 1); qcom_scm_call_atomic1()
389 } cmd; qcom_scm_set_boot_addr() local
391 cmd.addr = cpu_to_le32(addr); qcom_scm_set_boot_addr()
392 cmd.flags = cpu_to_le32(flags); qcom_scm_set_boot_addr()
394 &cmd, sizeof(cmd), NULL, 0); qcom_scm_set_boot_addr()
143 qcom_scm_command_to_response( const struct qcom_scm_command *cmd) qcom_scm_command_to_response() argument
/linux-4.4.14/drivers/media/pci/ngene/
H A Dngene-i2c.c53 com.cmd.hdr.Opcode = CMD_I2C_READ; ngene_command_i2c_read()
54 com.cmd.hdr.Length = outlen + 3; ngene_command_i2c_read()
55 com.cmd.I2CRead.Device = adr << 1; ngene_command_i2c_read()
56 memcpy(com.cmd.I2CRead.Data, out, outlen); ngene_command_i2c_read()
57 com.cmd.I2CRead.Data[outlen] = inlen; ngene_command_i2c_read()
58 com.cmd.I2CRead.Data[outlen + 1] = 0; ngene_command_i2c_read()
65 if ((com.cmd.raw8[0] >> 1) != adr) ngene_command_i2c_read()
69 memcpy(in, com.cmd.raw8, inlen + 1); ngene_command_i2c_read()
71 memcpy(in, com.cmd.raw8 + 1, inlen); ngene_command_i2c_read()
81 com.cmd.hdr.Opcode = CMD_I2C_WRITE; ngene_command_i2c_write()
82 com.cmd.hdr.Length = outlen + 1; ngene_command_i2c_write()
83 com.cmd.I2CRead.Device = adr << 1; ngene_command_i2c_write()
84 memcpy(com.cmd.I2CRead.Data, out, outlen); ngene_command_i2c_write()
91 if (com.cmd.raw8[0] == 1) ngene_command_i2c_write()
/linux-4.4.14/tools/usb/usbip/src/
H A Dusbip.c107 const struct command *cmd; usbip_help() local
122 for (cmd = cmds; cmd->name != NULL; cmd++) usbip_help()
123 if (cmd->help != NULL) usbip_help()
124 printf(" %-10s %s\n", cmd->name, cmd->help); usbip_help()
139 static int run_command(const struct command *cmd, int argc, char *argv[]) run_command() argument
141 dbg("running command: `%s'", cmd->name); run_command()
142 return cmd->fn(argc, argv); run_command()
154 char *cmd; main() local
185 cmd = argv[optind]; main()
186 if (cmd) { main()
188 if (!strcmp(cmds[i].name, cmd)) { main()
/linux-4.4.14/drivers/iio/pressure/
H A Dms5611_spi.c20 u8 cmd = MS5611_RESET; ms5611_spi_reset() local
23 return spi_write_then_read(st->client, &cmd, 1, NULL, 0); ms5611_spi_reset()
58 u8 cmd; ms5611_spi_read_adc_temp_and_pressure() local
62 cmd = MS5611_START_TEMP_CONV; ms5611_spi_read_adc_temp_and_pressure()
63 ret = spi_write_then_read(st->client, &cmd, 1, NULL, 0); ms5611_spi_read_adc_temp_and_pressure()
73 cmd = MS5611_START_PRESSURE_CONV; ms5611_spi_read_adc_temp_and_pressure()
74 ret = spi_write_then_read(st->client, &cmd, 1, NULL, 0); ms5611_spi_read_adc_temp_and_pressure()
/linux-4.4.14/net/nfc/nci/
H A Dcore.c47 struct nci_core_conn_create_cmd *cmd; member in struct:core_conn_create_data
165 struct nci_core_reset_cmd cmd; nci_reset_req() local
167 cmd.reset_type = NCI_RESET_TYPE_RESET_CONFIG; nci_reset_req()
168 nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 1, &cmd); nci_reset_req()
178 struct nci_rf_disc_map_cmd cmd; nci_init_complete_req() local
179 struct disc_map_config *cfg = cmd.mapping_configs; nci_init_complete_req()
180 __u8 *num = &cmd.num_mapping_configs; nci_init_complete_req()
209 (1 + ((*num) * sizeof(struct disc_map_config))), &cmd); nci_init_complete_req()
221 struct nci_core_set_config_cmd cmd; nci_set_config_req() local
225 cmd.num_params = 1; nci_set_config_req()
226 cmd.param.id = param->id; nci_set_config_req()
227 cmd.param.len = param->len; nci_set_config_req()
228 memcpy(cmd.param.val, param->val, param->len); nci_set_config_req()
230 nci_send_cmd(ndev, NCI_OP_CORE_SET_CONFIG_CMD, (3 + param->len), &cmd); nci_set_config_req()
242 struct nci_rf_disc_cmd cmd; nci_rf_discover_req() local
244 cmd.num_disc_configs = 0; nci_rf_discover_req()
246 if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && nci_rf_discover_req()
251 cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = nci_rf_discover_req()
253 cmd.disc_configs[cmd.num_disc_configs].frequency = 1; nci_rf_discover_req()
254 cmd.num_disc_configs++; nci_rf_discover_req()
257 if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && nci_rf_discover_req()
259 cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = nci_rf_discover_req()
261 cmd.disc_configs[cmd.num_disc_configs].frequency = 1; nci_rf_discover_req()
262 cmd.num_disc_configs++; nci_rf_discover_req()
265 if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && nci_rf_discover_req()
268 cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = nci_rf_discover_req()
270 cmd.disc_configs[cmd.num_disc_configs].frequency = 1; nci_rf_discover_req()
271 cmd.num_disc_configs++; nci_rf_discover_req()
274 if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && nci_rf_discover_req()
276 cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = nci_rf_discover_req()
278 cmd.disc_configs[cmd.num_disc_configs].frequency = 1; nci_rf_discover_req()
279 cmd.num_disc_configs++; nci_rf_discover_req()
282 if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS - 1) && nci_rf_discover_req()
284 cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = nci_rf_discover_req()
286 cmd.disc_configs[cmd.num_disc_configs].frequency = 1; nci_rf_discover_req()
287 cmd.num_disc_configs++; nci_rf_discover_req()
288 cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = nci_rf_discover_req()
290 cmd.disc_configs[cmd.num_disc_configs].frequency = 1; nci_rf_discover_req()
291 cmd.num_disc_configs++; nci_rf_discover_req()
295 (1 + (cmd.num_disc_configs * sizeof(struct disc_config))), nci_rf_discover_req()
296 &cmd); nci_rf_discover_req()
308 struct nci_rf_discover_select_cmd cmd; nci_rf_discover_select_req() local
310 cmd.rf_discovery_id = param->rf_discovery_id; nci_rf_discover_select_req()
311 cmd.rf_protocol = param->rf_protocol; nci_rf_discover_select_req()
313 switch (cmd.rf_protocol) { nci_rf_discover_select_req()
315 cmd.rf_interface = NCI_RF_INTERFACE_ISO_DEP; nci_rf_discover_select_req()
319 cmd.rf_interface = NCI_RF_INTERFACE_NFC_DEP; nci_rf_discover_select_req()
323 cmd.rf_interface = NCI_RF_INTERFACE_FRAME; nci_rf_discover_select_req()
328 sizeof(struct nci_rf_discover_select_cmd), &cmd); nci_rf_discover_select_req()
333 struct nci_rf_deactivate_cmd cmd; nci_rf_deactivate_req() local
335 cmd.type = opt; nci_rf_deactivate_req()
338 sizeof(struct nci_rf_deactivate_cmd), &cmd); nci_rf_deactivate_req()
498 /* Flush cmd wq */ nci_close_device()
559 struct nci_nfcee_discover_cmd cmd; nci_nfcee_discover_req() local
562 cmd.discovery_action = action; nci_nfcee_discover_req()
564 nci_send_cmd(ndev, NCI_OP_NFCEE_DISCOVER_CMD, 1, &cmd); nci_nfcee_discover_req()
576 struct nci_nfcee_mode_set_cmd *cmd = nci_nfcee_mode_set_req() local
580 sizeof(struct nci_nfcee_mode_set_cmd), cmd); nci_nfcee_mode_set_req()
585 struct nci_nfcee_mode_set_cmd cmd; nci_nfcee_mode_set() local
587 cmd.nfcee_id = nfcee_id; nci_nfcee_mode_set()
588 cmd.nfcee_mode = nfcee_mode; nci_nfcee_mode_set()
591 (unsigned long)&cmd, nci_nfcee_mode_set()
601 nci_send_cmd(ndev, NCI_OP_CORE_CONN_CREATE_CMD, data->length, data->cmd); nci_core_conn_create_req()
610 struct nci_core_conn_create_cmd *cmd; nci_core_conn_create() local
614 cmd = kzalloc(data.length, GFP_KERNEL); nci_core_conn_create()
615 if (!cmd) nci_core_conn_create()
621 cmd->destination_type = destination_type; nci_core_conn_create()
622 cmd->number_destination_params = number_destination_params; nci_core_conn_create()
623 memcpy(cmd->params, params, params_len); nci_core_conn_create()
625 data.cmd = cmd; nci_core_conn_create()
635 kfree(cmd); nci_core_conn_create()
1447 pr_debug("NCI TX: MT=cmd, PBF=%d, GID=0x%x, OID=0x%x, plen=%d\n", nci_cmd_work()

Completed in 6437 milliseconds

1234567891011>>