Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sys/contrib/dev/athk/ath11k/dbring.h
106751 views
1
/* SPDX-License-Identifier: BSD-3-Clause-Clear */
2
/*
3
* Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
4
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
5
*/
6
7
#ifndef ATH11K_DBRING_H
8
#define ATH11K_DBRING_H
9
10
#include <linux/types.h>
11
#include <linux/idr.h>
12
#include <linux/spinlock.h>
13
#include "dp.h"
14
15
struct ath11k_dbring_element {
16
dma_addr_t paddr;
17
u8 *payload;
18
};
19
20
struct ath11k_dbring_data {
21
void *data;
22
u32 data_sz;
23
struct wmi_dma_buf_release_meta_data meta;
24
};
25
26
struct ath11k_dbring_buf_release_event {
27
struct ath11k_wmi_dma_buf_release_fixed_param fixed;
28
#if defined(__linux__)
29
struct wmi_dma_buf_release_entry *buf_entry;
30
struct wmi_dma_buf_release_meta_data *meta_data;
31
#elif defined(__FreeBSD__)
32
const struct wmi_dma_buf_release_entry *buf_entry;
33
const struct wmi_dma_buf_release_meta_data *meta_data;
34
#endif
35
u32 num_buf_entry;
36
u32 num_meta;
37
};
38
39
struct ath11k_dbring_cap {
40
u32 pdev_id;
41
enum wmi_direct_buffer_module id;
42
u32 min_elem;
43
u32 min_buf_sz;
44
u32 min_buf_align;
45
};
46
47
struct ath11k_dbring {
48
struct dp_srng refill_srng;
49
struct idr bufs_idr;
50
/* Protects bufs_idr */
51
spinlock_t idr_lock;
52
dma_addr_t tp_addr;
53
dma_addr_t hp_addr;
54
int bufs_max;
55
u32 pdev_id;
56
u32 buf_sz;
57
u32 buf_align;
58
u32 num_resp_per_event;
59
u32 event_timeout_ms;
60
int (*handler)(struct ath11k *, struct ath11k_dbring_data *);
61
};
62
63
int ath11k_dbring_set_cfg(struct ath11k *ar,
64
struct ath11k_dbring *ring,
65
u32 num_resp_per_event,
66
u32 event_timeout_ms,
67
int (*handler)(struct ath11k *,
68
struct ath11k_dbring_data *));
69
int ath11k_dbring_wmi_cfg_setup(struct ath11k *ar,
70
struct ath11k_dbring *ring,
71
enum wmi_direct_buffer_module id);
72
int ath11k_dbring_buf_setup(struct ath11k *ar,
73
struct ath11k_dbring *ring,
74
struct ath11k_dbring_cap *db_cap);
75
int ath11k_dbring_srng_setup(struct ath11k *ar, struct ath11k_dbring *ring,
76
int ring_num, int num_entries);
77
int ath11k_dbring_buffer_release_event(struct ath11k_base *ab,
78
struct ath11k_dbring_buf_release_event *ev);
79
int ath11k_dbring_get_cap(struct ath11k_base *ab,
80
u8 pdev_idx,
81
enum wmi_direct_buffer_module id,
82
struct ath11k_dbring_cap *db_cap);
83
void ath11k_dbring_srng_cleanup(struct ath11k *ar, struct ath11k_dbring *ring);
84
void ath11k_dbring_buf_cleanup(struct ath11k *ar, struct ath11k_dbring *ring);
85
int ath11k_dbring_validate_buffer(struct ath11k *ar, void *data, u32 size);
86
87
#endif /* ATH11K_DBRING_H */
88
89