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