Marcel Holtmann | 6a98e38 | 2021-10-27 16:58:38 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
| 3 | * BlueZ - Bluetooth protocol stack for Linux |
| 4 | * |
| 5 | * Copyright (C) 2021 Intel Corporation |
| 6 | */ |
| 7 | |
| 8 | typedef int (*hci_cmd_sync_work_func_t)(struct hci_dev *hdev, void *data); |
| 9 | typedef void (*hci_cmd_sync_work_destroy_t)(struct hci_dev *hdev, void *data, |
| 10 | int err); |
| 11 | |
| 12 | struct hci_cmd_sync_work_entry { |
| 13 | struct list_head list; |
| 14 | hci_cmd_sync_work_func_t func; |
| 15 | void *data; |
| 16 | hci_cmd_sync_work_destroy_t destroy; |
| 17 | }; |
| 18 | |
| 19 | /* Function with sync suffix shall not be called with hdev->lock held as they |
| 20 | * wait the command to complete and in the meantime an event could be received |
| 21 | * which could attempt to acquire hdev->lock causing a deadlock. |
| 22 | */ |
| 23 | struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, |
| 24 | const void *param, u32 timeout); |
| 25 | struct sk_buff *hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, |
| 26 | const void *param, u32 timeout); |
| 27 | struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, |
| 28 | const void *param, u8 event, u32 timeout); |
| 29 | struct sk_buff *__hci_cmd_sync_sk(struct hci_dev *hdev, u16 opcode, u32 plen, |
| 30 | const void *param, u8 event, u32 timeout, |
| 31 | struct sock *sk); |
| 32 | int __hci_cmd_sync_status(struct hci_dev *hdev, u16 opcode, u32 plen, |
| 33 | const void *param, u32 timeout); |
| 34 | int __hci_cmd_sync_status_sk(struct hci_dev *hdev, u16 opcode, u32 plen, |
| 35 | const void *param, u8 event, u32 timeout, |
| 36 | struct sock *sk); |
| 37 | |
| 38 | void hci_cmd_sync_init(struct hci_dev *hdev); |
| 39 | void hci_cmd_sync_clear(struct hci_dev *hdev); |
| 40 | |
| 41 | int hci_cmd_sync_queue(struct hci_dev *hdev, hci_cmd_sync_work_func_t func, |
| 42 | void *data, hci_cmd_sync_work_destroy_t destroy); |
Luiz Augusto von Dentz | 161510c | 2021-10-27 16:58:39 -0700 | [diff] [blame] | 43 | |
| 44 | int hci_update_eir_sync(struct hci_dev *hdev); |
| 45 | int hci_update_class_sync(struct hci_dev *hdev); |
Luiz Augusto von Dentz | cba6b75 | 2021-10-27 16:58:40 -0700 | [diff] [blame] | 46 | |
| 47 | int hci_update_eir_sync(struct hci_dev *hdev); |
| 48 | int hci_update_class_sync(struct hci_dev *hdev); |
| 49 | |
| 50 | int hci_update_random_address_sync(struct hci_dev *hdev, bool require_privacy, |
| 51 | bool rpa, u8 *own_addr_type); |
| 52 | |
| 53 | int hci_update_scan_rsp_data_sync(struct hci_dev *hdev, u8 instance); |
| 54 | int hci_update_adv_data_sync(struct hci_dev *hdev, u8 instance); |
| 55 | int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance, |
| 56 | bool force); |
| 57 | |
| 58 | int hci_setup_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance); |
| 59 | int hci_start_ext_adv_sync(struct hci_dev *hdev, u8 instance); |
| 60 | int hci_enable_ext_advertising_sync(struct hci_dev *hdev, u8 instance); |
| 61 | int hci_enable_advertising_sync(struct hci_dev *hdev); |
Luiz Augusto von Dentz | abfeea4 | 2021-10-27 16:58:45 -0700 | [diff] [blame] | 62 | int hci_enable_advertising(struct hci_dev *hdev); |
Luiz Augusto von Dentz | cba6b75 | 2021-10-27 16:58:40 -0700 | [diff] [blame] | 63 | |
| 64 | int hci_remove_advertising_sync(struct hci_dev *hdev, struct sock *sk, |
| 65 | u8 instance, bool force); |
| 66 | int hci_disable_advertising_sync(struct hci_dev *hdev); |
Luiz Augusto von Dentz | e8907f7 | 2021-10-27 16:58:41 -0700 | [diff] [blame] | 67 | |
| 68 | int hci_update_passive_scan_sync(struct hci_dev *hdev); |
Luiz Augusto von Dentz | ad383c2 | 2021-10-27 16:58:42 -0700 | [diff] [blame] | 69 | int hci_update_passive_scan(struct hci_dev *hdev); |
Brian Gix | 47db6b4 | 2021-10-27 16:58:48 -0700 | [diff] [blame] | 70 | int hci_read_rssi_sync(struct hci_dev *hdev, __le16 handle); |
| 71 | int hci_read_tx_power_sync(struct hci_dev *hdev, __le16 handle, u8 type); |
Brian Gix | 2f2eb0c | 2021-10-27 16:58:49 -0700 | [diff] [blame] | 72 | int hci_write_sc_support_sync(struct hci_dev *hdev, u8 val); |
Brian Gix | 5a75013 | 2021-10-27 16:58:50 -0700 | [diff] [blame] | 73 | int hci_read_clock_sync(struct hci_dev *hdev, struct hci_cp_read_clock *cp); |
Luiz Augusto von Dentz | cf75ad8 | 2021-10-27 16:58:44 -0700 | [diff] [blame] | 74 | |
Brian Gix | 353a024 | 2021-10-27 16:58:46 -0700 | [diff] [blame] | 75 | int hci_write_fast_connectable_sync(struct hci_dev *hdev, bool enable); |
Brian Gix | 451d95a | 2021-10-27 16:58:47 -0700 | [diff] [blame] | 76 | int hci_update_scan_sync(struct hci_dev *hdev); |
Brian Gix | 353a024 | 2021-10-27 16:58:46 -0700 | [diff] [blame] | 77 | |
Brian Gix | d81a494 | 2021-10-27 16:58:51 -0700 | [diff] [blame^] | 78 | int hci_write_le_host_supported_sync(struct hci_dev *hdev, u8 le, u8 simul); |
| 79 | int hci_remove_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance, |
| 80 | struct sock *sk); |
| 81 | |
Luiz Augusto von Dentz | cf75ad8 | 2021-10-27 16:58:44 -0700 | [diff] [blame] | 82 | int hci_dev_open_sync(struct hci_dev *hdev); |
| 83 | int hci_dev_close_sync(struct hci_dev *hdev); |
| 84 | |
| 85 | int hci_powered_update_sync(struct hci_dev *hdev); |
| 86 | int hci_set_powered_sync(struct hci_dev *hdev, u8 val); |
Luiz Augusto von Dentz | abfeea4 | 2021-10-27 16:58:45 -0700 | [diff] [blame] | 87 | |
| 88 | int hci_start_discovery_sync(struct hci_dev *hdev); |
| 89 | int hci_stop_discovery_sync(struct hci_dev *hdev); |