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