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