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 1
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 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
52 * @dpbp_id: DPBP unique ID
53 * @token: Returned token; use in subsequent API calls
55 * This function can be used to open a control session for an
56 * already created object; an object may have been declared in
57 * the DPL or by calling the dpbp_create function.
58 * This function returns a unique authentication token,
59 * associated with the specific object ID and the specific MC
60 * portal; this token must be used in all subsequent commands for
61 * this specific object
63 * Return: '0' on Success; Error code otherwise.
65 int dpbp_open(struct fsl_mc_io *mc_io,
71 * dpbp_close() - Close the control session of the object
72 * @mc_io: Pointer to MC portal's I/O object
73 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
74 * @token: Token of DPBP object
76 * After this function is called, no further operations are
77 * allowed on the object without opening a new control session.
79 * Return: '0' on Success; Error code otherwise.
81 int dpbp_close(struct fsl_mc_io *mc_io,
86 * dpbp_enable() - Enable the DPBP.
87 * @mc_io: Pointer to MC portal's I/O object
88 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
89 * @token: Token of DPBP object
91 * Return: '0' on Success; Error code otherwise.
93 int dpbp_enable(struct fsl_mc_io *mc_io,
98 * dpbp_disable() - Disable the DPBP.
99 * @mc_io: Pointer to MC portal's I/O object
100 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
101 * @token: Token of DPBP object
103 * Return: '0' on Success; Error code otherwise.
105 int dpbp_disable(struct fsl_mc_io *mc_io,
110 * dpbp_is_enabled() - Check if the DPBP is enabled.
111 * @mc_io: Pointer to MC portal's I/O object
112 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
113 * @token: Token of DPBP object
114 * @en: Returns '1' if object is enabled; '0' otherwise
116 * Return: '0' on Success; Error code otherwise.
118 int dpbp_is_enabled(struct fsl_mc_io *mc_io,
124 * dpbp_reset() - Reset the DPBP, returns the object to initial state.
125 * @mc_io: Pointer to MC portal's I/O object
126 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
127 * @token: Token of DPBP object
129 * Return: '0' on Success; Error code otherwise.
131 int dpbp_reset(struct fsl_mc_io *mc_io,
137 * struct dpbp_attr - Structure representing DPBP attributes
138 * @id: DPBP object ID
139 * @version: DPBP version
140 * @bpid: Hardware buffer pool ID; should be used as an argument in
141 * acquire/release operations on buffers
146 * struct version - Structure representing DPBP version
147 * @major: DPBP major version
148 * @minor: DPBP minor version
158 * dpbp_get_attributes - Retrieve DPBP attributes.
160 * @mc_io: Pointer to MC portal's I/O object
161 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
162 * @token: Token of DPBP object
163 * @attr: Returned object's attributes
165 * Return: '0' on Success; Error code otherwise.
167 int dpbp_get_attributes(struct fsl_mc_io *mc_io,
170 struct dpbp_attr *attr);
174 #endif /* __FSL_DPBP_H */