New upstream version 18.11-rc1
[deb_dpdk.git] / drivers / bus / fslmc / mc / fsl_dpbp.h
1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
2  *
3  * Copyright 2013-2016 Freescale Semiconductor Inc.
4  * Copyright 2016-2017 NXP
5  *
6  */
7 #ifndef __FSL_DPBP_H
8 #define __FSL_DPBP_H
9
10 /*
11  * Data Path Buffer Pool API
12  * Contains initialization APIs and runtime control APIs for DPBP
13  */
14
15 struct fsl_mc_io;
16
17 int dpbp_open(struct fsl_mc_io *mc_io,
18               uint32_t cmd_flags,
19               int dpbp_id,
20               uint16_t *token);
21
22 int dpbp_close(struct fsl_mc_io *mc_io,
23                uint32_t cmd_flags,
24                uint16_t token);
25
26 /**
27  * struct dpbp_cfg - Structure representing DPBP configuration
28  * @options:    place holder
29  */
30 struct dpbp_cfg {
31         uint32_t options;
32 };
33
34 int dpbp_create(struct fsl_mc_io *mc_io,
35                 uint16_t dprc_token,
36                 uint32_t cmd_flags,
37                 const struct dpbp_cfg *cfg,
38                 uint32_t *obj_id);
39
40 int dpbp_destroy(struct fsl_mc_io *mc_io,
41                  uint16_t dprc_token,
42                  uint32_t cmd_flags,
43                  uint32_t obj_id);
44
45 int dpbp_enable(struct fsl_mc_io *mc_io,
46                 uint32_t cmd_flags,
47                 uint16_t token);
48
49 int dpbp_disable(struct fsl_mc_io *mc_io,
50                  uint32_t cmd_flags,
51                  uint16_t token);
52
53 int dpbp_is_enabled(struct fsl_mc_io *mc_io,
54                     uint32_t cmd_flags,
55                     uint16_t token,
56                     int *en);
57
58 int dpbp_reset(struct fsl_mc_io *mc_io,
59                uint32_t cmd_flags,
60                uint16_t token);
61
62 /**
63  * struct dpbp_attr - Structure representing DPBP attributes
64  * @id:         DPBP object ID
65  * @bpid:       Hardware buffer pool ID; should be used as an argument in
66  *              acquire/release operations on buffers
67  */
68 struct dpbp_attr {
69         int id;
70         uint16_t bpid;
71 };
72
73 int dpbp_get_attributes(struct fsl_mc_io *mc_io,
74                         uint32_t cmd_flags,
75                         uint16_t token,
76                         struct dpbp_attr *attr);
77
78 /**
79  *  DPBP notifications options
80  */
81
82 /**
83  * BPSCN write will attempt to allocate into a cache (coherent write)
84  */
85 #define DPBP_NOTIF_OPT_COHERENT_WRITE   0x00000001
86 int dpbp_get_api_version(struct fsl_mc_io *mc_io,
87                          uint32_t cmd_flags,
88                          uint16_t *major_ver,
89                          uint16_t *minor_ver);
90
91 int dpbp_get_num_free_bufs(struct fsl_mc_io *mc_io,
92                            uint32_t cmd_flags,
93                            uint16_t token,
94                            uint32_t *num_free_bufs);
95
96 #endif /* __FSL_DPBP_H */