xref: /freebsd/sys/dev/dpaa2/dpaa2_swp_if.m (revision a90b9d0159070121c221b966469c3e36d912bf82)
1#-
2# SPDX-License-Identifier: BSD-2-Clause
3#
4# Copyright © 2021-2022 Dmitry Salychev
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in the
13#    documentation and/or other materials provided with the distribution.
14#
15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
27
28#include <machine/bus.h>
29#include <dev/dpaa2/dpaa2_mc.h>
30#include <dev/dpaa2/dpaa2_swp.h>
31#include <dev/dpaa2/dpaa2_bp.h>
32
33/**
34 * @brief QBMan software portal interface.
35 *
36 * Software portals are used by data path software executing on a processor core
37 * to communicate with the Queue Manager (QMan) which acts as a central resource
38 * in DPAA2, managing the queueing of data between multiple processor cores,
39 * network interfaces, and hardware accelerators in a multicore SoC.
40 */
41INTERFACE dpaa2_swp;
42
43/**
44 * @brief Enqueue multiple frames to a frame queue using one Frame Queue ID.
45 *
46 * dev:		DPIO device.
47 * fqid:	Frame Queue ID.
48 * fd:		Frame descriptor to enqueue.
49 * frames_n:	Number of frames to enqueue.
50 */
51METHOD int enq_multiple_fq {
52	device_t		 dev;
53	uint32_t		 fqid;
54	struct dpaa2_fd		*fd;
55	int			 frames_n;
56}
57
58/**
59 * @brief Configure the channel data availability notification (CDAN)
60 * in a particular WQ channel paired with DPIO.
61 *
62 * dev:		DPIO device.
63 * ctx:		Context to configure data availability notifications (CDAN).
64 */
65METHOD int conf_wq_channel {
66	device_t		 dev;
67	struct dpaa2_io_notif_ctx *ctx;
68};
69
70/**
71 * @brief Release one or more buffer pointers to a QBMan buffer pool.
72 *
73 * dev:		DPIO device.
74 * bpid:	Buffer pool ID.
75 * buf:		Array of buffers physical addresses.
76 * buf_num:	Number of the buffers in the array.
77 */
78METHOD int release_bufs {
79	device_t		 dev;
80	uint16_t		 bpid;
81	bus_addr_t		*buf;
82	uint32_t		 buf_num;
83};
84
85/**
86 * @brief Query current configuration/state of the buffer pool.
87 *
88 * dev:		DPIO device.
89 * bpid:	Buffer pool ID.
90 * conf:	Configuration/state of the buffer pool.
91 */
92METHOD int query_bp {
93	device_t		 dev;
94	uint16_t		 bpid;
95	struct dpaa2_bp_conf	*conf;
96}
97