Lines Matching +full:ese +full:- +full:present

1 // SPDX-License-Identifier: GPL-2.0-only
43 /* If TA is present bit 0 is set */
45 /* If TB is present bit 1 is set */
56 td = ST21NFCA_ATR_GET_Y_FROM_TD(info->se_info.atr[i]); in st21nfca_se_get_bwi()
61 return info->se_info.atr[i] >> 4; in st21nfca_se_get_bwi()
78 if (skb->len <= ST21NFCA_ESE_MAX_LENGTH) { in st21nfca_se_get_atr()
79 memcpy(info->se_info.atr, skb->data, skb->len); in st21nfca_se_get_atr()
80 info->se_info.wt_timeout = in st21nfca_se_get_atr()
100 info->se_info.count_pipes = 0; in st21nfca_hci_control_se()
101 info->se_info.expected_pipes = ST21NFCA_SE_COUNT_PIPE_UICC; in st21nfca_hci_control_se()
108 info->se_info.count_pipes = 0; in st21nfca_hci_control_se()
109 info->se_info.expected_pipes = ST21NFCA_SE_COUNT_PIPE_EMBEDDED; in st21nfca_hci_control_se()
112 return -EINVAL; in st21nfca_hci_control_se()
119 reinit_completion(&info->se_info.req_completion); in st21nfca_hci_control_se()
125 mod_timer(&info->se_info.se_active_timer, jiffies + in st21nfca_hci_control_se()
127 info->se_info.se_active = true; in st21nfca_hci_control_se()
130 wait_for_completion_interruptible(&info->se_info.req_completion); in st21nfca_hci_control_se()
138 for (i = 0; i < sk_host_list->len && in st21nfca_hci_control_se()
139 sk_host_list->data[i] != se_idx; i++) in st21nfca_hci_control_se()
141 host_id = sk_host_list->data[i]; in st21nfca_hci_control_se()
149 return -1; in st21nfca_hci_control_se()
157 if (test_bit(ST21NFCA_FACTORY_MODE, &hdev->quirks)) in st21nfca_hci_discover_se()
160 if (info->se_status->is_uicc_present) { in st21nfca_hci_discover_se()
161 nfc_add_se(hdev->ndev, NFC_HCI_UICC_HOST_ID, NFC_SE_UICC); in st21nfca_hci_discover_se()
165 if (info->se_status->is_ese_present) { in st21nfca_hci_discover_se()
166 nfc_add_se(hdev->ndev, ST21NFCA_ESE_HOST_ID, NFC_SE_EMBEDDED); in st21nfca_hci_discover_se()
180 * info->se_status->is_uicc_enable is true should never happen. in st21nfca_hci_enable_se()
181 * Same for eSE. in st21nfca_hci_enable_se()
195 nfc_remove_se(hdev->ndev, se_idx); in st21nfca_hci_enable_se()
209 * info->se_status->is_uicc_enable is true should never happen in st21nfca_hci_disable_se()
210 * Same for eSE. in st21nfca_hci_disable_se()
230 info->se_info.cb = cb; in st21nfca_hci_se_io()
231 info->se_info.cb_context = cb_context; in st21nfca_hci_se_io()
232 mod_timer(&info->se_info.bwi_timer, jiffies + in st21nfca_hci_se_io()
233 msecs_to_jiffies(info->se_info.wt_timeout)); in st21nfca_hci_se_io()
234 info->se_info.bwi_active = true; in st21nfca_hci_se_io()
239 return -ENODEV; in st21nfca_hci_se_io()
261 info->se_info.bwi_active = false; in st21nfca_se_wt_work()
263 if (!info->se_info.xch_error) { in st21nfca_se_wt_work()
264 info->se_info.xch_error = true; in st21nfca_se_wt_work()
265 nfc_hci_send_event(info->hdev, ST21NFCA_APDU_READER_GATE, in st21nfca_se_wt_work()
268 info->se_info.xch_error = false; in st21nfca_se_wt_work()
269 nfc_hci_send_event(info->hdev, ST21NFCA_DEVICE_MGNT_GATE, in st21nfca_se_wt_work()
272 info->se_info.cb(info->se_info.cb_context, NULL, 0, -ETIME); in st21nfca_se_wt_work()
279 schedule_work(&info->se_info.timeout_work); in st21nfca_se_wt_timeout()
287 info->se_info.se_active = false; in st21nfca_se_activation_timeout()
289 complete(&info->se_info.req_completion); in st21nfca_se_activation_timeout()
301 struct device *dev = &hdev->ndev->dev; in st21nfca_connectivity_event_received()
310 r = nfc_se_connectivity(hdev->ndev, host); in st21nfca_connectivity_event_received()
324 * size in bytes: 1 1 5-16 1 1 0-255 in st21nfca_connectivity_event_received()
327 * example: 0x81 5-16 X 0x82 0-255 X in st21nfca_connectivity_event_received()
329 if (skb->len < 2 || skb->data[0] != NFC_EVT_TRANSACTION_AID_TAG) in st21nfca_connectivity_event_received()
330 return -EPROTO; in st21nfca_connectivity_event_received()
332 aid_len = skb->data[1]; in st21nfca_connectivity_event_received()
334 if (skb->len < aid_len + 4 || aid_len > sizeof(transaction->aid)) in st21nfca_connectivity_event_received()
335 return -EPROTO; in st21nfca_connectivity_event_received()
337 params_len = skb->data[aid_len + 3]; in st21nfca_connectivity_event_received()
342 if ((skb->data[aid_len + 2] != NFC_EVT_TRANSACTION_PARAMS_TAG) || in st21nfca_connectivity_event_received()
343 (skb->len < aid_len + 4 + params_len)) in st21nfca_connectivity_event_received()
344 return -EPROTO; in st21nfca_connectivity_event_received()
348 return -ENOMEM; in st21nfca_connectivity_event_received()
350 transaction->aid_len = aid_len; in st21nfca_connectivity_event_received()
351 transaction->params_len = params_len; in st21nfca_connectivity_event_received()
353 memcpy(transaction->aid, &skb->data[2], aid_len); in st21nfca_connectivity_event_received()
354 memcpy(transaction->params, &skb->data[aid_len + 4], params_len); in st21nfca_connectivity_event_received()
356 r = nfc_se_transaction(hdev->ndev, host, transaction); in st21nfca_connectivity_event_received()
359 nfc_err(&hdev->ndev->dev, "Unexpected event on connectivity gate\n"); in st21nfca_connectivity_event_received()
377 del_timer_sync(&info->se_info.bwi_timer); in st21nfca_apdu_reader_event_received()
378 cancel_work_sync(&info->se_info.timeout_work); in st21nfca_apdu_reader_event_received()
379 info->se_info.bwi_active = false; in st21nfca_apdu_reader_event_received()
385 info->se_info.cb(info->se_info.cb_context, in st21nfca_apdu_reader_event_received()
386 skb->data, skb->len, 0); in st21nfca_apdu_reader_event_received()
389 mod_timer(&info->se_info.bwi_timer, jiffies + in st21nfca_apdu_reader_event_received()
390 msecs_to_jiffies(info->se_info.wt_timeout)); in st21nfca_apdu_reader_event_received()
393 nfc_err(&hdev->ndev->dev, "Unexpected event on apdu reader gate\n"); in st21nfca_apdu_reader_event_received()
407 init_completion(&info->se_info.req_completion); in st21nfca_se_init()
408 INIT_WORK(&info->se_info.timeout_work, st21nfca_se_wt_work); in st21nfca_se_init()
410 timer_setup(&info->se_info.bwi_timer, st21nfca_se_wt_timeout, 0); in st21nfca_se_init()
411 info->se_info.bwi_active = false; in st21nfca_se_init()
413 timer_setup(&info->se_info.se_active_timer, in st21nfca_se_init()
415 info->se_info.se_active = false; in st21nfca_se_init()
417 info->se_info.count_pipes = 0; in st21nfca_se_init()
418 info->se_info.expected_pipes = 0; in st21nfca_se_init()
420 info->se_info.xch_error = false; in st21nfca_se_init()
422 info->se_info.wt_timeout = in st21nfca_se_init()
431 if (info->se_info.bwi_active) in st21nfca_se_deinit()
432 del_timer_sync(&info->se_info.bwi_timer); in st21nfca_se_deinit()
433 if (info->se_info.se_active) in st21nfca_se_deinit()
434 del_timer_sync(&info->se_info.se_active_timer); in st21nfca_se_deinit()
436 cancel_work_sync(&info->se_info.timeout_work); in st21nfca_se_deinit()
437 info->se_info.bwi_active = false; in st21nfca_se_deinit()
438 info->se_info.se_active = false; in st21nfca_se_deinit()