aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/interrupt.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2012-12-25 12:06:12 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-07 13:31:30 -0500
commit6bbda15f279ec99c4ac0d56c4ad680299d0b768b (patch)
treeed4e6f50fec81c93cd90a629ccb5a0c9f1db701f /drivers/misc/mei/interrupt.c
parent8120e7201cf9795bc98ffb2e3064b657c0f34c05 (diff)
mei: move hbm responses from interrupt.c to hbm.c
1. Add common prefix mei_hbm_ to all handlers and made them static 2. Drop now useless function same_flow_addr Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/interrupt.c')
-rw-r--r--drivers/misc/mei/interrupt.c208
1 files changed, 0 insertions, 208 deletions
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index eb744cc4f72a..a735c8b7ca82 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -173,214 +173,6 @@ static int _mei_irq_thread_close(struct mei_device *dev, s32 *slots,
173 return 0; 173 return 0;
174} 174}
175 175
176/**
177 * is_treat_specially_client - checks if the message belongs
178 * to the file private data.
179 *
180 * @cl: private data of the file object
181 * @rs: connect response bus message
182 *
183 */
184static bool is_treat_specially_client(struct mei_cl *cl,
185 struct hbm_client_connect_response *rs)
186{
187
188 if (cl->host_client_id == rs->host_addr &&
189 cl->me_client_id == rs->me_addr) {
190 if (!rs->status) {
191 cl->state = MEI_FILE_CONNECTED;
192 cl->status = 0;
193
194 } else {
195 cl->state = MEI_FILE_DISCONNECTED;
196 cl->status = -ENODEV;
197 }
198 cl->timer_count = 0;
199
200 return true;
201 }
202 return false;
203}
204
205/**
206 * mei_client_connect_response - connects to response irq routine
207 *
208 * @dev: the device structure
209 * @rs: connect response bus message
210 */
211void mei_client_connect_response(struct mei_device *dev,
212 struct hbm_client_connect_response *rs)
213{
214
215 struct mei_cl *cl;
216 struct mei_cl_cb *pos = NULL, *next = NULL;
217
218 dev_dbg(&dev->pdev->dev,
219 "connect_response:\n"
220 "ME Client = %d\n"
221 "Host Client = %d\n"
222 "Status = %d\n",
223 rs->me_addr,
224 rs->host_addr,
225 rs->status);
226
227 /* if WD or iamthif client treat specially */
228
229 if (is_treat_specially_client(&(dev->wd_cl), rs)) {
230 dev_dbg(&dev->pdev->dev, "successfully connected to WD client.\n");
231 mei_watchdog_register(dev);
232
233 return;
234 }
235
236 if (is_treat_specially_client(&(dev->iamthif_cl), rs)) {
237 dev->iamthif_state = MEI_IAMTHIF_IDLE;
238 return;
239 }
240 list_for_each_entry_safe(pos, next, &dev->ctrl_rd_list.list, list) {
241
242 cl = pos->cl;
243 if (!cl) {
244 list_del(&pos->list);
245 return;
246 }
247 if (pos->fop_type == MEI_FOP_IOCTL) {
248 if (is_treat_specially_client(cl, rs)) {
249 list_del(&pos->list);
250 cl->status = 0;
251 cl->timer_count = 0;
252 break;
253 }
254 }
255 }
256}
257
258/**
259 * mei_client_disconnect_response - disconnects from response irq routine
260 *
261 * @dev: the device structure
262 * @rs: disconnect response bus message
263 */
264void mei_client_disconnect_response(struct mei_device *dev,
265 struct hbm_client_connect_response *rs)
266{
267 struct mei_cl *cl;
268 struct mei_cl_cb *pos = NULL, *next = NULL;
269
270 dev_dbg(&dev->pdev->dev,
271 "disconnect_response:\n"
272 "ME Client = %d\n"
273 "Host Client = %d\n"
274 "Status = %d\n",
275 rs->me_addr,
276 rs->host_addr,
277 rs->status);
278
279 list_for_each_entry_safe(pos, next, &dev->ctrl_rd_list.list, list) {
280 cl = pos->cl;
281
282 if (!cl) {
283 list_del(&pos->list);
284 return;
285 }
286
287 dev_dbg(&dev->pdev->dev, "list_for_each_entry_safe in ctrl_rd_list.\n");
288 if (cl->host_client_id == rs->host_addr &&
289 cl->me_client_id == rs->me_addr) {
290
291 list_del(&pos->list);
292 if (!rs->status)
293 cl->state = MEI_FILE_DISCONNECTED;
294
295 cl->status = 0;
296 cl->timer_count = 0;
297 break;
298 }
299 }
300}
301
302/**
303 * same_flow_addr - tells if they have the same address.
304 *
305 * @file: private data of the file object.
306 * @flow: flow control.
307 *
308 * returns !=0, same; 0,not.
309 */
310static int same_flow_addr(struct mei_cl *cl, struct hbm_flow_control *flow)
311{
312 return (cl->host_client_id == flow->host_addr &&
313 cl->me_client_id == flow->me_addr);
314}
315
316/**
317 * add_single_flow_creds - adds single buffer credentials.
318 *
319 * @file: private data ot the file object.
320 * @flow: flow control.
321 */
322static void add_single_flow_creds(struct mei_device *dev,
323 struct hbm_flow_control *flow)
324{
325 struct mei_me_client *client;
326 int i;
327
328 for (i = 0; i < dev->me_clients_num; i++) {
329 client = &dev->me_clients[i];
330 if (client && flow->me_addr == client->client_id) {
331 if (client->props.single_recv_buf) {
332 client->mei_flow_ctrl_creds++;
333 dev_dbg(&dev->pdev->dev, "recv flow ctrl msg ME %d (single).\n",
334 flow->me_addr);
335 dev_dbg(&dev->pdev->dev, "flow control credentials =%d.\n",
336 client->mei_flow_ctrl_creds);
337 } else {
338 BUG(); /* error in flow control */
339 }
340 }
341 }
342}
343
344/**
345 * mei_client_flow_control_response - flow control response irq routine
346 *
347 * @dev: the device structure
348 * @flow_control: flow control response bus message
349 */
350void mei_client_flow_control_response(struct mei_device *dev,
351 struct hbm_flow_control *flow_control)
352{
353 struct mei_cl *cl_pos = NULL;
354 struct mei_cl *cl_next = NULL;
355
356 if (!flow_control->host_addr) {
357 /* single receive buffer */
358 add_single_flow_creds(dev, flow_control);
359 } else {
360 /* normal connection */
361 list_for_each_entry_safe(cl_pos, cl_next,
362 &dev->file_list, link) {
363 dev_dbg(&dev->pdev->dev, "list_for_each_entry_safe in file_list\n");
364
365 dev_dbg(&dev->pdev->dev, "cl of host client %d ME client %d.\n",
366 cl_pos->host_client_id,
367 cl_pos->me_client_id);
368 dev_dbg(&dev->pdev->dev, "flow ctrl msg for host %d ME %d.\n",
369 flow_control->host_addr,
370 flow_control->me_addr);
371 if (same_flow_addr(cl_pos, flow_control)) {
372 dev_dbg(&dev->pdev->dev, "recv ctrl msg for host %d ME %d.\n",
373 flow_control->host_addr,
374 flow_control->me_addr);
375 cl_pos->mei_flow_ctrl_creds++;
376 dev_dbg(&dev->pdev->dev, "flow control credentials = %d.\n",
377 cl_pos->mei_flow_ctrl_creds);
378 break;
379 }
380 }
381 }
382}
383
384 176
385/** 177/**
386 * _mei_hb_read - processes read related operation. 178 * _mei_hb_read - processes read related operation.