staging: mei: Organize the initialization state machine.

moving the final state, clearing of the client maps and
updating of mei state out from mei_host_client_properties function.

Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Oren Weil 2011-09-21 16:45:30 +03:00 committed by Greg Kroah-Hartman
parent 8f019bfe0a
commit abc51b6de5
3 changed files with 42 additions and 24 deletions

View file

@ -470,9 +470,12 @@ void mei_allocate_me_clients_storage(struct mei_device *dev)
*
* @dev: the device structure
*
* returns none.
* returns:
* < 0 - Error.
* = 0 - no more clients.
* = 1 - still have clients to send properties request.
*/
void mei_host_client_properties(struct mei_device *dev)
int mei_host_client_properties(struct mei_device *dev)
{
struct mei_msg_hdr *mei_header;
struct hbm_props_request *host_cli_req;
@ -504,32 +507,15 @@ void mei_host_client_properties(struct mei_device *dev)
dev->mei_state = MEI_RESETING;
dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n");
mei_reset(dev, 1);
return;
return -EIO;
}
dev->init_clients_timer = INIT_CLIENTS_TIMEOUT;
dev->me_client_index = b;
return;
return 1;
}
/*
* Clear Map for indicating now ME clients
* with associated host client
*/
bitmap_zero(dev->host_clients_map, MEI_CLIENTS_MAX);
dev->open_handle_count = 0;
bitmap_set(dev->host_clients_map, 0, 3);
dev->mei_state = MEI_ENABLED;
/* if wd initialization fails, initialization the AMTHI client,
* otherwise the AMTHI client will be initialized after the WD client connect response
* will be received
*/
if (mei_wd_host_init(dev))
mei_host_init_iamthif(dev);
return;
return 0;
}
/**

View file

@ -653,6 +653,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
struct hbm_host_enum_response *enum_res;
struct hbm_client_disconnect_request *disconnect_req;
struct hbm_host_stop_request *host_stop_req;
int res;
unsigned char *buffer;
@ -746,7 +747,38 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
MEI_CLIENT_PROPERTIES_MESSAGE) {
dev->me_client_index++;
dev->me_client_presentation_num++;
mei_host_client_properties(dev);
/** Send Client Propeties request **/
res = mei_host_client_properties(dev);
if (res < 0) {
dev_dbg(&dev->pdev->dev, "mei_host_client_properties() failed");
return;
} else if (!res) {
/*
* No more clients to send to.
* Clear Map for indicating now ME clients
* with associated host client
*/
bitmap_zero(dev->host_clients_map, MEI_CLIENTS_MAX);
dev->open_handle_count = 0;
/*
* Reserving the first three client IDs
* Client Id 0 - Reserved for MEI Bus Message communications
* Client Id 1 - Reserved for Watchdog
* Client ID 2 - Reserved for AMTHI
*/
bitmap_set(dev->host_clients_map, 0, 3);
dev->mei_state = MEI_ENABLED;
/* if wd initialization fails, initialization the AMTHI client,
* otherwise the AMTHI client will be initialized after the WD client connect response
* will be received
*/
if (mei_wd_host_init(dev))
mei_host_init_iamthif(dev);
}
} else {
dev_dbg(&dev->pdev->dev, "reset due to received host client properties response bus message");
mei_reset(dev, 1);

View file

@ -329,7 +329,7 @@ static inline bool mei_cl_cmp_id(const struct mei_cl *cl1,
*/
void mei_host_start_message(struct mei_device *dev);
void mei_host_enum_clients_message(struct mei_device *dev);
void mei_host_client_properties(struct mei_device *dev);
int mei_host_client_properties(struct mei_device *dev);
/*
* MEI interrupt functions prototype