1 /* Copyright 2013-2015 Freescale Semiconductor Inc.
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
5 * * Redistributions of source code must retain the above copyright
6 * notice, this list of conditions and the following disclaimer.
7 * * Redistributions in binary form must reproduce the above copyright
8 * notice, this list of conditions and the following disclaimer in the
9 * documentation and/or other materials provided with the distribution.
10 * * Neither the name of the above-listed copyright holders nor the
11 * names of any contributors may be used to endorse or promote products
12 * derived from this software without specific prior written permission.
15 * ALTERNATIVELY, this software may be distributed under the terms of the
16 * GNU General Public License ("GPL") as published by the Free Software
17 * Foundation, either version 2 of that License or (at your option) any
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
35 /* Data Path Buffer Pool API
36 * Contains initialization APIs and runtime control APIs for DPBP
41 int dpbp_open(struct fsl_mc_io *mc_io,
46 int dpbp_close(struct fsl_mc_io *mc_io,
51 * struct dpbp_cfg - Structure representing DPBP configuration
52 * @options: place holder
58 int dpbp_create(struct fsl_mc_io *mc_io,
60 const struct dpbp_cfg *cfg,
63 int dpbp_destroy(struct fsl_mc_io *mc_io,
67 int dpbp_enable(struct fsl_mc_io *mc_io,
71 int dpbp_disable(struct fsl_mc_io *mc_io,
75 int dpbp_is_enabled(struct fsl_mc_io *mc_io,
80 int dpbp_reset(struct fsl_mc_io *mc_io,
85 * struct dpbp_irq_cfg - IRQ configuration
86 * @addr: Address that must be written to signal a message-based interrupt
87 * @val: Value to write into irq_addr address
88 * @irq_num: A user defined number associated with this IRQ
96 int dpbp_set_irq(struct fsl_mc_io *mc_io,
100 struct dpbp_irq_cfg *irq_cfg);
102 int dpbp_get_irq(struct fsl_mc_io *mc_io,
107 struct dpbp_irq_cfg *irq_cfg);
109 int dpbp_set_irq_enable(struct fsl_mc_io *mc_io,
115 int dpbp_get_irq_enable(struct fsl_mc_io *mc_io,
121 int dpbp_set_irq_mask(struct fsl_mc_io *mc_io,
127 int dpbp_get_irq_mask(struct fsl_mc_io *mc_io,
133 int dpbp_get_irq_status(struct fsl_mc_io *mc_io,
139 int dpbp_clear_irq_status(struct fsl_mc_io *mc_io,
146 * struct dpbp_attr - Structure representing DPBP attributes
147 * @id: DPBP object ID
148 * @version: DPBP version
149 * @bpid: Hardware buffer pool ID; should be used as an argument in
150 * acquire/release operations on buffers
155 * struct version - Structure representing DPBP version
156 * @major: DPBP major version
157 * @minor: DPBP minor version
166 int dpbp_get_attributes(struct fsl_mc_io *mc_io,
169 struct dpbp_attr *attr);
172 * DPBP notifications options
176 * BPSCN write will attempt to allocate into a cache (coherent write)
178 #define DPBP_NOTIF_OPT_COHERENT_WRITE 0x00000001
181 * struct dpbp_notification_cfg - Structure representing DPBP notifications
183 * @depletion_entry: below this threshold the pool is "depleted";
184 * set it to '0' to disable it
185 * @depletion_exit: greater than or equal to this threshold the pool exit its
187 * @surplus_entry: above this threshold the pool is in "surplus" state;
188 * set it to '0' to disable it
189 * @surplus_exit: less than or equal to this threshold the pool exit its
191 * @message_iova: MUST be given if either 'depletion_entry' or 'surplus_entry'
192 * is not '0' (enable); I/O virtual address (must be in DMA-able memory),
193 * must be 16B aligned.
194 * @message_ctx: The context that will be part of the BPSCN message and will
195 * be written to 'message_iova'
196 * @options: Mask of available options; use 'DPBP_NOTIF_OPT_<X>' values
198 struct dpbp_notification_cfg {
208 int dpbp_set_notifications(struct fsl_mc_io *mc_io,
211 struct dpbp_notification_cfg *cfg);
213 int dpbp_get_notifications(struct fsl_mc_io *mc_io,
216 struct dpbp_notification_cfg *cfg);
220 #endif /* __FSL_DPBP_H */