2 * Freescale Layerscape MC I/O wrapper
4 * Copyright (C) 2013-2015 Freescale Semiconductor, Inc.
5 * Author: German Rivera <German.Rivera@freescale.com>
7 * SPDX-License-Identifier: GPL-2.0+
11 * @brief Data Path Buffer Pool API
17 #define DPBP_VER_MAJOR 2
18 #define DPBP_VER_MINOR 0
21 #define DPBP_CMDID_CLOSE 0x800
22 #define DPBP_CMDID_OPEN 0x804
24 #define DPBP_CMDID_ENABLE 0x002
25 #define DPBP_CMDID_DISABLE 0x003
26 #define DPBP_CMDID_GET_ATTR 0x004
27 #define DPBP_CMDID_RESET 0x005
29 /* cmd, param, offset, width, type, arg_name */
30 #define DPBP_CMD_OPEN(cmd, dpbp_id) \
31 MC_CMD_OP(cmd, 0, 0, 32, int, dpbp_id)
33 /* cmd, param, offset, width, type, arg_name */
34 #define DPBP_RSP_GET_ATTRIBUTES(cmd, attr) \
36 MC_RSP_OP(cmd, 0, 16, 16, uint16_t, attr->bpid); \
37 MC_RSP_OP(cmd, 0, 32, 32, int, attr->id);\
38 MC_RSP_OP(cmd, 1, 0, 16, uint16_t, attr->version.major);\
39 MC_RSP_OP(cmd, 1, 16, 16, uint16_t, attr->version.minor);\
42 /* Data Path Buffer Pool API
43 * Contains initialization APIs and runtime control APIs for DPBP
49 * dpbp_open() - Open a control session for the specified object.
50 * @mc_io: Pointer to MC portal's I/O object
51 * @dpbp_id: DPBP unique ID
52 * @token: Returned token; use in subsequent API calls
54 * This function can be used to open a control session for an
55 * already created object; an object may have been declared in
56 * the DPL or by calling the dpbp_create function.
57 * This function returns a unique authentication token,
58 * associated with the specific object ID and the specific MC
59 * portal; this token must be used in all subsequent commands for
60 * this specific object
62 * Return: '0' on Success; Error code otherwise.
64 int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token);
67 * dpbp_close() - Close the control session of the object
68 * @mc_io: Pointer to MC portal's I/O object
69 * @token: Token of DPBP object
71 * After this function is called, no further operations are
72 * allowed on the object without opening a new control session.
74 * Return: '0' on Success; Error code otherwise.
76 int dpbp_close(struct fsl_mc_io *mc_io, uint16_t token);
79 * dpbp_enable() - Enable the DPBP.
80 * @mc_io: Pointer to MC portal's I/O object
81 * @token: Token of DPBP object
83 * Return: '0' on Success; Error code otherwise.
86 int dpbp_enable(struct fsl_mc_io *mc_io, uint16_t token);
89 * dpbp_disable() - Disable the DPBP.
90 * @mc_io: Pointer to MC portal's I/O object
91 * @token: Token of DPBP object
93 * Return: '0' on Success; Error code otherwise.
95 int dpbp_disable(struct fsl_mc_io *mc_io, uint16_t token);
98 * dpbp_reset() - Reset the DPBP, returns the object to initial state.
99 * @mc_io: Pointer to MC portal's I/O object
100 * @token: Token of DPBP object
102 * Return: '0' on Success; Error code otherwise.
104 int dpbp_reset(struct fsl_mc_io *mc_io, uint16_t token);
107 * struct dpbp_attr - Structure representing DPBP attributes
108 * @id: DPBP object ID
109 * @version: DPBP version
110 * @bpid: Hardware buffer pool ID; should be used as an argument in
111 * acquire/release operations on buffers
116 * struct version - Structure representing DPBP version
117 * @major: DPBP major version
118 * @minor: DPBP minor version
129 * dpbp_get_attributes - Retrieve DPBP attributes.
131 * @mc_io: Pointer to MC portal's I/O object
132 * @token: Token of DPBP object
133 * @attr: Returned object's attributes
135 * Return: '0' on Success; Error code otherwise.
137 int dpbp_get_attributes(struct fsl_mc_io *mc_io,
139 struct dpbp_attr *attr);
143 #endif /* __FSL_DPBP_H */