Lines Matching refs:token

44 	int i, token = -EBUSY;
51 token = i;
57 return token;
61 * Note: If the returned token is used in an opal call and opal returns
68 int token;
70 /* Wait until a token is available */
74 token = __opal_async_get_token();
75 if (token < 0)
78 return token;
82 static int __opal_async_release_token(int token)
87 if (token < 0 || token >= opal_max_async_tokens) {
88 pr_err("%s: Passed token is out of range, token %d\n",
89 __func__, token);
94 switch (opal_async_tokens[token].state) {
97 opal_async_tokens[token].state = ASYNC_TOKEN_UNALLOCATED;
102 * Mark a DISPATCHED token as ABANDONED so that the response handling
106 opal_async_tokens[token].state = ASYNC_TOKEN_ABANDONED;
116 int opal_async_release_token(int token)
120 ret = __opal_async_release_token(token);
128 int opal_async_wait_response(uint64_t token, struct opal_msg *msg)
130 if (token >= opal_max_async_tokens) {
131 pr_err("%s: Invalid token passed\n", __func__);
141 * There is no need to mark the token as dispatched, wait_event()
142 * will block until the token completes.
149 wait_event(opal_async_wait, opal_async_tokens[token].state
151 memcpy(msg, &opal_async_tokens[token].response, sizeof(*msg));
157 int opal_async_wait_response_interruptible(uint64_t token, struct opal_msg *msg)
162 if (token >= opal_max_async_tokens) {
163 pr_err("%s: Invalid token passed\n", __func__);
173 * The first time this gets called we mark the token as DISPATCHED
175 * caller frees the token, we know not to actually free the token
178 * Only change if the token is ALLOCATED - it may have been
182 * There is also a dirty great comment at the token allocation
186 * token.
188 if (opal_async_tokens[token].state == ASYNC_TOKEN_ALLOCATED) {
190 if (opal_async_tokens[token].state == ASYNC_TOKEN_ALLOCATED)
191 opal_async_tokens[token].state = ASYNC_TOKEN_DISPATCHED;
202 opal_async_tokens[token].state ==
205 memcpy(msg, &opal_async_tokens[token].response, sizeof(*msg));
218 uint64_t token;
223 token = be64_to_cpu(comp_msg->params[0]);
225 state = opal_async_tokens[token].state;
226 opal_async_tokens[token].state = ASYNC_TOKEN_COMPLETED;
230 /* Free the token, no one else will */
231 opal_async_release_token(token);
234 memcpy(&opal_async_tokens[token].response, comp_msg, sizeof(*comp_msg));