Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
0002 /*
0003  * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
0004  */
0005 
0006 #ifndef ATH11K_DBRING_H
0007 #define ATH11K_DBRING_H
0008 
0009 #include <linux/types.h>
0010 #include <linux/idr.h>
0011 #include <linux/spinlock.h>
0012 #include "dp.h"
0013 
0014 struct ath11k_dbring_element {
0015     dma_addr_t paddr;
0016     u8 *payload;
0017 };
0018 
0019 struct ath11k_dbring_data {
0020     void *data;
0021     u32 data_sz;
0022     struct wmi_dma_buf_release_meta_data meta;
0023 };
0024 
0025 struct ath11k_dbring_buf_release_event {
0026     struct ath11k_wmi_dma_buf_release_fixed_param fixed;
0027     struct wmi_dma_buf_release_entry *buf_entry;
0028     struct wmi_dma_buf_release_meta_data *meta_data;
0029     u32 num_buf_entry;
0030     u32 num_meta;
0031 };
0032 
0033 struct ath11k_dbring_cap {
0034     u32 pdev_id;
0035     enum wmi_direct_buffer_module id;
0036     u32 min_elem;
0037     u32 min_buf_sz;
0038     u32 min_buf_align;
0039 };
0040 
0041 struct ath11k_dbring {
0042     struct dp_srng refill_srng;
0043     struct idr bufs_idr;
0044     /* Protects bufs_idr */
0045     spinlock_t idr_lock;
0046     dma_addr_t tp_addr;
0047     dma_addr_t hp_addr;
0048     int bufs_max;
0049     u32 pdev_id;
0050     u32 buf_sz;
0051     u32 buf_align;
0052     u32 num_resp_per_event;
0053     u32 event_timeout_ms;
0054     int (*handler)(struct ath11k *, struct ath11k_dbring_data *);
0055 };
0056 
0057 int ath11k_dbring_set_cfg(struct ath11k *ar,
0058               struct ath11k_dbring *ring,
0059               u32 num_resp_per_event,
0060               u32 event_timeout_ms,
0061               int (*handler)(struct ath11k *,
0062                      struct ath11k_dbring_data *));
0063 int ath11k_dbring_wmi_cfg_setup(struct ath11k *ar,
0064                 struct ath11k_dbring *ring,
0065                 enum wmi_direct_buffer_module id);
0066 int ath11k_dbring_buf_setup(struct ath11k *ar,
0067                 struct ath11k_dbring *ring,
0068                 struct ath11k_dbring_cap *db_cap);
0069 int ath11k_dbring_srng_setup(struct ath11k *ar, struct ath11k_dbring *ring,
0070                  int ring_num, int num_entries);
0071 int ath11k_dbring_buffer_release_event(struct ath11k_base *ab,
0072                        struct ath11k_dbring_buf_release_event *ev);
0073 int ath11k_dbring_get_cap(struct ath11k_base *ab,
0074               u8 pdev_idx,
0075               enum wmi_direct_buffer_module id,
0076               struct ath11k_dbring_cap *db_cap);
0077 void ath11k_dbring_srng_cleanup(struct ath11k *ar, struct ath11k_dbring *ring);
0078 void ath11k_dbring_buf_cleanup(struct ath11k *ar, struct ath11k_dbring *ring);
0079 int ath11k_dbring_validate_buffer(struct ath11k *ar, void *data, u32 size);
0080 
0081 #endif /* ATH11K_DBRING_H */