aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/init.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2012-12-25 12:06:07 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-07 13:31:29 -0500
commitbb1b0133b3780987c2c74f267e294d016f9fa04c (patch)
treea13c23f34c8d2bb65b79d48cbfb7b4a404e3e85b /drivers/misc/mei/init.c
parent3a65dd4ea32c3e3a3befec58ad20d1c96580834e (diff)
mei: move host bus message handling to hbm.c
for sake of more layered design we move host bus message handling to the new hbm.c file Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/init.c')
-rw-r--r--drivers/misc/mei/init.c111
1 files changed, 0 insertions, 111 deletions
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c
index eb180555d282..0536170ff856 100644
--- a/drivers/misc/mei/init.c
+++ b/drivers/misc/mei/init.c
@@ -320,70 +320,6 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
320} 320}
321 321
322 322
323
324/**
325 * host_start_message - mei host sends start message.
326 *
327 * @dev: the device structure
328 *
329 * returns none.
330 */
331void mei_host_start_message(struct mei_device *dev)
332{
333 struct mei_msg_hdr *mei_hdr;
334 struct hbm_host_version_request *start_req;
335 const size_t len = sizeof(struct hbm_host_version_request);
336
337 mei_hdr = mei_hbm_hdr(&dev->wr_msg_buf[0], len);
338
339 /* host start message */
340 start_req = (struct hbm_host_version_request *)&dev->wr_msg_buf[1];
341 memset(start_req, 0, len);
342 start_req->hbm_cmd = HOST_START_REQ_CMD;
343 start_req->host_version.major_version = HBM_MAJOR_VERSION;
344 start_req->host_version.minor_version = HBM_MINOR_VERSION;
345
346 dev->recvd_msg = false;
347 if (mei_write_message(dev, mei_hdr, (unsigned char *)start_req)) {
348 dev_dbg(&dev->pdev->dev, "write send version message to FW fail.\n");
349 dev->dev_state = MEI_DEV_RESETING;
350 mei_reset(dev, 1);
351 }
352 dev->init_clients_state = MEI_START_MESSAGE;
353 dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT;
354 return ;
355}
356
357/**
358 * host_enum_clients_message - host sends enumeration client request message.
359 *
360 * @dev: the device structure
361 *
362 * returns none.
363 */
364void mei_host_enum_clients_message(struct mei_device *dev)
365{
366 struct mei_msg_hdr *mei_hdr;
367 struct hbm_host_enum_request *enum_req;
368 const size_t len = sizeof(struct hbm_host_enum_request);
369 /* enumerate clients */
370 mei_hdr = mei_hbm_hdr(&dev->wr_msg_buf[0], len);
371
372 enum_req = (struct hbm_host_enum_request *) &dev->wr_msg_buf[1];
373 memset(enum_req, 0, sizeof(struct hbm_host_enum_request));
374 enum_req->hbm_cmd = HOST_ENUM_REQ_CMD;
375
376 if (mei_write_message(dev, mei_hdr, (unsigned char *)enum_req)) {
377 dev->dev_state = MEI_DEV_RESETING;
378 dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n");
379 mei_reset(dev, 1);
380 }
381 dev->init_clients_state = MEI_ENUM_CLIENTS_MESSAGE;
382 dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT;
383 return;
384}
385
386
387/** 323/**
388 * allocate_me_clients_storage - allocates storage for me clients 324 * allocate_me_clients_storage - allocates storage for me clients
389 * 325 *
@@ -457,53 +393,6 @@ void mei_host_client_init(struct work_struct *work)
457 mutex_unlock(&dev->device_lock); 393 mutex_unlock(&dev->device_lock);
458} 394}
459 395
460int mei_host_client_enumerate(struct mei_device *dev)
461{
462
463 struct mei_msg_hdr *mei_hdr;
464 struct hbm_props_request *prop_req;
465 const size_t len = sizeof(struct hbm_props_request);
466 unsigned long next_client_index;
467 u8 client_num;
468
469
470 client_num = dev->me_client_presentation_num;
471
472 next_client_index = find_next_bit(dev->me_clients_map, MEI_CLIENTS_MAX,
473 dev->me_client_index);
474
475 /* We got all client properties */
476 if (next_client_index == MEI_CLIENTS_MAX) {
477 schedule_work(&dev->init_work);
478
479 return 0;
480 }
481
482 dev->me_clients[client_num].client_id = next_client_index;
483 dev->me_clients[client_num].mei_flow_ctrl_creds = 0;
484
485 mei_hdr = mei_hbm_hdr(&dev->wr_msg_buf[0], len);
486 prop_req = (struct hbm_props_request *)&dev->wr_msg_buf[1];
487
488 memset(prop_req, 0, sizeof(struct hbm_props_request));
489
490
491 prop_req->hbm_cmd = HOST_CLIENT_PROPERTIES_REQ_CMD;
492 prop_req->address = next_client_index;
493
494 if (mei_write_message(dev, mei_hdr, (unsigned char *) prop_req)) {
495 dev->dev_state = MEI_DEV_RESETING;
496 dev_err(&dev->pdev->dev, "Properties request command failed\n");
497 mei_reset(dev, 1);
498
499 return -EIO;
500 }
501
502 dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT;
503 dev->me_client_index = next_client_index;
504
505 return 0;
506}
507 396
508/** 397/**
509 * mei_init_file_private - initializes private file structure. 398 * mei_init_file_private - initializes private file structure.