Lines Matching refs:aq
25 static void __ap_flush_queue(struct ap_queue *aq);
31 static inline bool ap_q_supported_in_se(struct ap_queue *aq) in ap_q_supported_in_se() argument
33 return aq->card->hwinfo.ep11 || aq->card->hwinfo.accel; in ap_q_supported_in_se()
36 static inline bool ap_q_supports_bind(struct ap_queue *aq) in ap_q_supports_bind() argument
38 return aq->card->hwinfo.ep11 || aq->card->hwinfo.accel; in ap_q_supports_bind()
41 static inline bool ap_q_supports_assoc(struct ap_queue *aq) in ap_q_supports_assoc() argument
43 return aq->card->hwinfo.ep11; in ap_q_supports_assoc()
46 static inline bool ap_q_needs_bind(struct ap_queue *aq) in ap_q_needs_bind() argument
48 return ap_q_supports_bind(aq) && ap_sb_available(); in ap_q_needs_bind()
60 static int ap_queue_enable_irq(struct ap_queue *aq, void *ind) in ap_queue_enable_irq() argument
67 status = ap_aqic(aq->qid, qirqctrl, virt_to_phys(ind)); in ap_queue_enable_irq()
79 AP_QID_CARD(aq->qid), in ap_queue_enable_irq()
80 AP_QID_QUEUE(aq->qid)); in ap_queue_enable_irq()
121 static enum ap_sm_wait ap_sm_nop(struct ap_queue *aq) in ap_sm_nop() argument
133 static struct ap_queue_status ap_sm_recv(struct ap_queue *aq) in ap_sm_recv() argument
150 status = ap_dqap(aq->qid, &aq->reply->psmid, in ap_sm_recv()
151 aq->reply->msg, aq->reply->bufsize, in ap_sm_recv()
152 &aq->reply->len, &reslen, &resgr0); in ap_sm_recv()
156 trace_s390_ap_dqap(AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid), in ap_sm_recv()
157 status.value, aq->reply->psmid); in ap_sm_recv()
162 aq->reply->msg, aq->reply->len, false); in ap_sm_recv()
163 aq->queue_count = max_t(int, 0, aq->queue_count - 1); in ap_sm_recv()
164 if (!status.queue_empty && !aq->queue_count) in ap_sm_recv()
165 aq->queue_count++; in ap_sm_recv()
166 if (aq->queue_count > 0) in ap_sm_recv()
167 mod_timer(&aq->timeout, in ap_sm_recv()
168 jiffies + aq->request_timeout); in ap_sm_recv()
169 list_for_each_entry(ap_msg, &aq->pendingq, list) { in ap_sm_recv()
170 if (ap_msg->psmid != aq->reply->psmid) in ap_sm_recv()
173 aq->pendingq_count--; in ap_sm_recv()
176 ap_msg->receive(aq, ap_msg, NULL); in ap_sm_recv()
178 ap_msg->receive(aq, ap_msg, aq->reply); in ap_sm_recv()
185 __func__, aq->reply->psmid, in ap_sm_recv()
186 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_recv()
190 if (!status.queue_empty || aq->queue_count <= 0) in ap_sm_recv()
193 aq->queue_count = 0; in ap_sm_recv()
194 list_splice_init(&aq->pendingq, &aq->requestq); in ap_sm_recv()
195 aq->requestq_count += aq->pendingq_count; in ap_sm_recv()
197 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid), in ap_sm_recv()
198 aq->pendingq_count, aq->requestq_count); in ap_sm_recv()
199 aq->pendingq_count = 0; in ap_sm_recv()
213 static enum ap_sm_wait ap_sm_read(struct ap_queue *aq) in ap_sm_read() argument
217 if (!aq->reply) in ap_sm_read()
219 status = ap_sm_recv(aq); in ap_sm_read()
224 if (aq->queue_count > 0) { in ap_sm_read()
225 aq->sm_state = AP_SM_STATE_WORKING; in ap_sm_read()
228 aq->sm_state = AP_SM_STATE_IDLE; in ap_sm_read()
231 if (aq->queue_count > 0) in ap_sm_read()
234 aq->sm_state = AP_SM_STATE_IDLE; in ap_sm_read()
237 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_read()
238 aq->last_err_rc = status.response_code; in ap_sm_read()
241 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_read()
248 if (lsi_ptr && ap_queue_enable_irq(aq, lsi_ptr) == 0) { in ap_sm_read()
249 aq->sm_state = AP_SM_STATE_SETIRQ_WAIT; in ap_sm_read()
262 static enum ap_sm_wait ap_sm_write(struct ap_queue *aq) in ap_sm_write() argument
266 ap_qid_t qid = aq->qid; in ap_sm_write()
268 if (aq->requestq_count <= 0) in ap_sm_write()
272 ap_msg = list_entry(aq->requestq.next, struct ap_message, list); in ap_sm_write()
282 aq->queue_count = max_t(int, 1, aq->queue_count + 1); in ap_sm_write()
283 if (aq->queue_count == 1) in ap_sm_write()
284 mod_timer(&aq->timeout, jiffies + aq->request_timeout); in ap_sm_write()
285 list_move_tail(&ap_msg->list, &aq->pendingq); in ap_sm_write()
286 aq->requestq_count--; in ap_sm_write()
287 aq->pendingq_count++; in ap_sm_write()
288 if (aq->queue_count < aq->card->hwinfo.qd + 1) { in ap_sm_write()
289 aq->sm_state = AP_SM_STATE_WORKING; in ap_sm_write()
294 aq->sm_state = AP_SM_STATE_QUEUE_FULL; in ap_sm_write()
298 aq->sm_state = AP_SM_STATE_RESET_WAIT; in ap_sm_write()
306 aq->requestq_count--; in ap_sm_write()
308 ap_msg->receive(aq, ap_msg, NULL); in ap_sm_write()
311 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_write()
312 aq->last_err_rc = status.response_code; in ap_sm_write()
315 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_write()
326 static enum ap_sm_wait ap_sm_read_write(struct ap_queue *aq) in ap_sm_read_write() argument
328 return min(ap_sm_read(aq), ap_sm_write(aq)); in ap_sm_read_write()
337 static enum ap_sm_wait ap_sm_reset(struct ap_queue *aq) in ap_sm_reset() argument
341 status = ap_rapq(aq->qid, aq->rapq_fbit); in ap_sm_reset()
347 aq->sm_state = AP_SM_STATE_RESET_WAIT; in ap_sm_reset()
348 aq->rapq_fbit = 0; in ap_sm_reset()
351 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_reset()
352 aq->last_err_rc = status.response_code; in ap_sm_reset()
355 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_reset()
366 static enum ap_sm_wait ap_sm_reset_wait(struct ap_queue *aq) in ap_sm_reset_wait() argument
373 status = ap_test_queue(aq->qid, 1, &hwinfo); in ap_sm_reset_wait()
377 aq->se_bstate = hwinfo.bs; in ap_sm_reset_wait()
379 if (lsi_ptr && ap_queue_enable_irq(aq, lsi_ptr) == 0) in ap_sm_reset_wait()
380 aq->sm_state = AP_SM_STATE_SETIRQ_WAIT; in ap_sm_reset_wait()
382 aq->sm_state = (aq->queue_count > 0) ? in ap_sm_reset_wait()
392 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_reset_wait()
393 aq->last_err_rc = status.response_code; in ap_sm_reset_wait()
396 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_reset_wait()
407 static enum ap_sm_wait ap_sm_setirq_wait(struct ap_queue *aq) in ap_sm_setirq_wait() argument
411 if (aq->queue_count > 0 && aq->reply) in ap_sm_setirq_wait()
413 status = ap_sm_recv(aq); in ap_sm_setirq_wait()
416 status = ap_tapq(aq->qid, NULL); in ap_sm_setirq_wait()
420 aq->sm_state = (aq->queue_count > 0) ? in ap_sm_setirq_wait()
426 if (aq->queue_count > 0) in ap_sm_setirq_wait()
432 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_setirq_wait()
433 aq->last_err_rc = status.response_code; in ap_sm_setirq_wait()
436 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_setirq_wait()
446 static enum ap_sm_wait ap_sm_assoc_wait(struct ap_queue *aq) in ap_sm_assoc_wait() argument
451 status = ap_test_queue(aq->qid, 1, &hwinfo); in ap_sm_assoc_wait()
454 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_assoc_wait()
455 aq->last_err_rc = status.response_code; in ap_sm_assoc_wait()
458 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_assoc_wait()
462 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_assoc_wait()
463 aq->last_err_rc = status.response_code; in ap_sm_assoc_wait()
466 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_assoc_wait()
471 aq->se_bstate = hwinfo.bs; in ap_sm_assoc_wait()
477 aq->sm_state = AP_SM_STATE_IDLE; in ap_sm_assoc_wait()
479 AP_QID_CARD(aq->qid), in ap_sm_assoc_wait()
480 AP_QID_QUEUE(aq->qid), aq->assoc_idx); in ap_sm_assoc_wait()
487 aq->assoc_idx = ASSOC_IDX_INVALID; in ap_sm_assoc_wait()
488 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_assoc_wait()
489 aq->last_err_rc = status.response_code; in ap_sm_assoc_wait()
492 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_assoc_wait()
531 enum ap_sm_wait ap_sm_event(struct ap_queue *aq, enum ap_sm_event event) in ap_sm_event() argument
533 if (aq->config && !aq->chkstop && in ap_sm_event()
534 aq->dev_state > AP_DEV_STATE_UNINITIATED) in ap_sm_event()
535 return ap_jumptable[aq->sm_state][event](aq); in ap_sm_event()
540 enum ap_sm_wait ap_sm_event_loop(struct ap_queue *aq, enum ap_sm_event event) in ap_sm_event_loop() argument
544 while ((wait = ap_sm_event(aq, event)) == AP_SM_WAIT_AGAIN) in ap_sm_event_loop()
556 struct ap_queue *aq = to_ap_queue(dev); in request_count_show() local
560 spin_lock_bh(&aq->lock); in request_count_show()
561 if (aq->dev_state > AP_DEV_STATE_UNINITIATED) { in request_count_show()
562 req_cnt = aq->total_request_count; in request_count_show()
565 spin_unlock_bh(&aq->lock); in request_count_show()
577 struct ap_queue *aq = to_ap_queue(dev); in request_count_store() local
579 spin_lock_bh(&aq->lock); in request_count_store()
580 aq->total_request_count = 0; in request_count_store()
581 spin_unlock_bh(&aq->lock); in request_count_store()
591 struct ap_queue *aq = to_ap_queue(dev); in requestq_count_show() local
594 spin_lock_bh(&aq->lock); in requestq_count_show()
595 if (aq->dev_state > AP_DEV_STATE_UNINITIATED) in requestq_count_show()
596 reqq_cnt = aq->requestq_count; in requestq_count_show()
597 spin_unlock_bh(&aq->lock); in requestq_count_show()
606 struct ap_queue *aq = to_ap_queue(dev); in pendingq_count_show() local
609 spin_lock_bh(&aq->lock); in pendingq_count_show()
610 if (aq->dev_state > AP_DEV_STATE_UNINITIATED) in pendingq_count_show()
611 penq_cnt = aq->pendingq_count; in pendingq_count_show()
612 spin_unlock_bh(&aq->lock); in pendingq_count_show()
621 struct ap_queue *aq = to_ap_queue(dev); in reset_show() local
624 spin_lock_bh(&aq->lock); in reset_show()
625 switch (aq->sm_state) { in reset_show()
637 spin_unlock_bh(&aq->lock); in reset_show()
645 struct ap_queue *aq = to_ap_queue(dev); in reset_store() local
647 spin_lock_bh(&aq->lock); in reset_store()
648 __ap_flush_queue(aq); in reset_store()
649 aq->sm_state = AP_SM_STATE_RESET_START; in reset_store()
650 ap_wait(ap_sm_event(aq, AP_SM_EVENT_POLL)); in reset_store()
651 spin_unlock_bh(&aq->lock); in reset_store()
654 __func__, AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in reset_store()
664 struct ap_queue *aq = to_ap_queue(dev); in interrupt_show() local
668 spin_lock_bh(&aq->lock); in interrupt_show()
669 if (aq->sm_state == AP_SM_STATE_SETIRQ_WAIT) { in interrupt_show()
672 status = ap_tapq(aq->qid, NULL); in interrupt_show()
678 spin_unlock_bh(&aq->lock); in interrupt_show()
688 struct ap_queue *aq = to_ap_queue(dev); in config_show() local
691 spin_lock_bh(&aq->lock); in config_show()
692 rc = sysfs_emit(buf, "%d\n", aq->config ? 1 : 0); in config_show()
693 spin_unlock_bh(&aq->lock); in config_show()
702 struct ap_queue *aq = to_ap_queue(dev); in chkstop_show() local
705 spin_lock_bh(&aq->lock); in chkstop_show()
706 rc = sysfs_emit(buf, "%d\n", aq->chkstop ? 1 : 0); in chkstop_show()
707 spin_unlock_bh(&aq->lock); in chkstop_show()
716 struct ap_queue *aq = to_ap_queue(dev); in ap_functions_show() local
720 status = ap_test_queue(aq->qid, 1, &hwinfo); in ap_functions_show()
724 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_functions_show()
737 struct ap_queue *aq = to_ap_queue(dev); in driver_override_show() local
738 struct ap_device *ap_dev = &aq->ap_dev; in driver_override_show()
755 struct ap_queue *aq = to_ap_queue(dev); in driver_override_store() local
756 struct ap_device *ap_dev = &aq->ap_dev; in driver_override_store()
789 struct ap_queue *aq = to_ap_queue(dev); in states_show() local
792 spin_lock_bh(&aq->lock); in states_show()
794 switch (aq->dev_state) { in states_show()
811 if (aq->dev_state) { in states_show()
812 switch (aq->sm_state) { in states_show()
838 spin_unlock_bh(&aq->lock); in states_show()
847 struct ap_queue *aq = to_ap_queue(dev); in last_err_rc_show() local
850 spin_lock_bh(&aq->lock); in last_err_rc_show()
851 rc = aq->last_err_rc; in last_err_rc_show()
852 spin_unlock_bh(&aq->lock); in last_err_rc_show()
922 struct ap_queue *aq = to_ap_queue(dev); in se_bind_show() local
926 if (!ap_q_supports_bind(aq)) in se_bind_show()
929 status = ap_test_queue(aq->qid, 1, &hwinfo); in se_bind_show()
933 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_bind_show()
938 spin_lock_bh(&aq->lock); in se_bind_show()
939 aq->se_bstate = hwinfo.bs; in se_bind_show()
940 spin_unlock_bh(&aq->lock); in se_bind_show()
955 struct ap_queue *aq = to_ap_queue(dev); in se_bind_store() local
961 if (!ap_q_supports_bind(aq)) in se_bind_store()
971 spin_lock_bh(&aq->lock); in se_bind_store()
972 __ap_flush_queue(aq); in se_bind_store()
973 aq->rapq_fbit = 1; in se_bind_store()
974 _ap_queue_init_state(aq); in se_bind_store()
980 status = ap_test_queue(aq->qid, 1, &hwinfo); in se_bind_store()
984 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_bind_store()
989 spin_lock_bh(&aq->lock); in se_bind_store()
990 aq->se_bstate = hwinfo.bs; in se_bind_store()
994 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_bind_store()
1000 if (aq->sm_state < AP_SM_STATE_IDLE) { in se_bind_store()
1006 status = ap_bapq(aq->qid); in se_bind_store()
1010 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_bind_store()
1014 aq->assoc_idx = ASSOC_IDX_INVALID; in se_bind_store()
1017 status = ap_test_queue(aq->qid, 1, &hwinfo); in se_bind_store()
1021 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_bind_store()
1025 aq->se_bstate = hwinfo.bs; in se_bind_store()
1030 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_bind_store()
1037 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_bind_store()
1041 spin_unlock_bh(&aq->lock); in se_bind_store()
1050 struct ap_queue *aq = to_ap_queue(dev); in se_associate_show() local
1054 if (!ap_q_supports_assoc(aq)) in se_associate_show()
1057 status = ap_test_queue(aq->qid, 1, &hwinfo); in se_associate_show()
1061 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_associate_show()
1066 spin_lock_bh(&aq->lock); in se_associate_show()
1067 aq->se_bstate = hwinfo.bs; in se_associate_show()
1068 spin_unlock_bh(&aq->lock); in se_associate_show()
1072 if (aq->assoc_idx == ASSOC_IDX_INVALID) { in se_associate_show()
1076 return sysfs_emit(buf, "associated %u\n", aq->assoc_idx); in se_associate_show()
1078 if (aq->assoc_idx != ASSOC_IDX_INVALID) in se_associate_show()
1090 struct ap_queue *aq = to_ap_queue(dev); in se_associate_store() local
1096 if (!ap_q_supports_assoc(aq)) in se_associate_store()
1107 status = ap_test_queue(aq->qid, 1, &hwinfo); in se_associate_store()
1111 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_associate_store()
1114 spin_lock_bh(&aq->lock); in se_associate_store()
1115 aq->se_bstate = hwinfo.bs; in se_associate_store()
1119 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_associate_store()
1125 if (aq->sm_state != AP_SM_STATE_IDLE) { in se_associate_store()
1131 status = ap_aapq(aq->qid, value); in se_associate_store()
1135 aq->sm_state = AP_SM_STATE_ASSOC_WAIT; in se_associate_store()
1136 aq->assoc_idx = value; in se_associate_store()
1137 ap_wait(ap_sm_event(aq, AP_SM_EVENT_POLL)); in se_associate_store()
1142 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_associate_store()
1150 spin_unlock_bh(&aq->lock); in se_associate_store()
1173 struct ap_queue *aq = to_ap_queue(dev); in ap_queue_device_release() local
1176 hash_del(&aq->hnode); in ap_queue_device_release()
1179 kfree(aq); in ap_queue_device_release()
1184 struct ap_queue *aq; in ap_queue_create() local
1186 aq = kzalloc_obj(*aq); in ap_queue_create()
1187 if (!aq) in ap_queue_create()
1189 aq->card = ac; in ap_queue_create()
1190 aq->ap_dev.device.release = ap_queue_device_release; in ap_queue_create()
1191 aq->ap_dev.device.type = &ap_queue_type; in ap_queue_create()
1192 aq->ap_dev.device_type = ac->ap_dev.device_type; in ap_queue_create()
1194 if (ap_is_se_guest() && ap_q_supported_in_se(aq)) in ap_queue_create()
1195 aq->ap_dev.device.groups = ap_queue_dev_sb_attr_groups; in ap_queue_create()
1196 aq->qid = qid; in ap_queue_create()
1197 spin_lock_init(&aq->lock); in ap_queue_create()
1198 INIT_LIST_HEAD(&aq->pendingq); in ap_queue_create()
1199 INIT_LIST_HEAD(&aq->requestq); in ap_queue_create()
1200 timer_setup(&aq->timeout, ap_request_timeout, 0); in ap_queue_create()
1202 return aq; in ap_queue_create()
1205 void ap_queue_init_reply(struct ap_queue *aq, struct ap_message *reply) in ap_queue_init_reply() argument
1207 aq->reply = reply; in ap_queue_init_reply()
1209 spin_lock_bh(&aq->lock); in ap_queue_init_reply()
1210 ap_wait(ap_sm_event(aq, AP_SM_EVENT_POLL)); in ap_queue_init_reply()
1211 spin_unlock_bh(&aq->lock); in ap_queue_init_reply()
1220 int ap_queue_message(struct ap_queue *aq, struct ap_message *ap_msg) in ap_queue_message() argument
1227 spin_lock_bh(&aq->lock); in ap_queue_message()
1230 if (aq->dev_state == AP_DEV_STATE_OPERATING) { in ap_queue_message()
1231 list_add_tail(&ap_msg->list, &aq->requestq); in ap_queue_message()
1232 aq->requestq_count++; in ap_queue_message()
1233 aq->total_request_count++; in ap_queue_message()
1234 atomic64_inc(&aq->card->total_request_count); in ap_queue_message()
1240 ap_wait(ap_sm_event_loop(aq, AP_SM_EVENT_POLL)); in ap_queue_message()
1242 spin_unlock_bh(&aq->lock); in ap_queue_message()
1256 bool ap_queue_usable(struct ap_queue *aq) in ap_queue_usable() argument
1260 spin_lock_bh(&aq->lock); in ap_queue_usable()
1263 if (!aq->config || aq->chkstop) { in ap_queue_usable()
1269 if (aq->dev_state != AP_DEV_STATE_OPERATING) { in ap_queue_usable()
1276 if (!ap_q_supported_in_se(aq)) { in ap_queue_usable()
1280 if (ap_q_needs_bind(aq) && in ap_queue_usable()
1281 !(aq->se_bstate == AP_BS_Q_USABLE || in ap_queue_usable()
1282 aq->se_bstate == AP_BS_Q_USABLE_NO_SECURE_KEY)) in ap_queue_usable()
1287 spin_unlock_bh(&aq->lock); in ap_queue_usable()
1302 void ap_cancel_message(struct ap_queue *aq, struct ap_message *ap_msg) in ap_cancel_message() argument
1306 spin_lock_bh(&aq->lock); in ap_cancel_message()
1308 list_for_each_entry(tmp, &aq->pendingq, list) in ap_cancel_message()
1310 aq->pendingq_count--; in ap_cancel_message()
1313 aq->requestq_count--; in ap_cancel_message()
1317 spin_unlock_bh(&aq->lock); in ap_cancel_message()
1327 static void __ap_flush_queue(struct ap_queue *aq) in __ap_flush_queue() argument
1331 list_for_each_entry_safe(ap_msg, next, &aq->pendingq, list) { in __ap_flush_queue()
1333 aq->pendingq_count--; in __ap_flush_queue()
1335 ap_msg->receive(aq, ap_msg, NULL); in __ap_flush_queue()
1337 list_for_each_entry_safe(ap_msg, next, &aq->requestq, list) { in __ap_flush_queue()
1339 aq->requestq_count--; in __ap_flush_queue()
1341 ap_msg->receive(aq, ap_msg, NULL); in __ap_flush_queue()
1343 aq->queue_count = 0; in __ap_flush_queue()
1346 void ap_flush_queue(struct ap_queue *aq) in ap_flush_queue() argument
1348 spin_lock_bh(&aq->lock); in ap_flush_queue()
1349 __ap_flush_queue(aq); in ap_flush_queue()
1350 spin_unlock_bh(&aq->lock); in ap_flush_queue()
1354 void ap_queue_prepare_remove(struct ap_queue *aq) in ap_queue_prepare_remove() argument
1356 spin_lock_bh(&aq->lock); in ap_queue_prepare_remove()
1358 __ap_flush_queue(aq); in ap_queue_prepare_remove()
1360 aq->dev_state = AP_DEV_STATE_SHUTDOWN; in ap_queue_prepare_remove()
1361 spin_unlock_bh(&aq->lock); in ap_queue_prepare_remove()
1362 timer_delete_sync(&aq->timeout); in ap_queue_prepare_remove()
1365 void ap_queue_remove(struct ap_queue *aq) in ap_queue_remove() argument
1373 spin_lock_bh(&aq->lock); in ap_queue_remove()
1374 ap_zapq(aq->qid, 0); in ap_queue_remove()
1375 aq->dev_state = AP_DEV_STATE_UNINITIATED; in ap_queue_remove()
1376 spin_unlock_bh(&aq->lock); in ap_queue_remove()
1379 void _ap_queue_init_state(struct ap_queue *aq) in _ap_queue_init_state() argument
1381 aq->dev_state = AP_DEV_STATE_OPERATING; in _ap_queue_init_state()
1382 aq->sm_state = AP_SM_STATE_RESET_START; in _ap_queue_init_state()
1383 aq->last_err_rc = 0; in _ap_queue_init_state()
1384 aq->assoc_idx = ASSOC_IDX_INVALID; in _ap_queue_init_state()
1385 ap_wait(ap_sm_event(aq, AP_SM_EVENT_POLL)); in _ap_queue_init_state()
1388 void ap_queue_init_state(struct ap_queue *aq) in ap_queue_init_state() argument
1390 spin_lock_bh(&aq->lock); in ap_queue_init_state()
1391 _ap_queue_init_state(aq); in ap_queue_init_state()
1392 spin_unlock_bh(&aq->lock); in ap_queue_init_state()