Skip to content

Commit

Permalink
staging: mei: Organize the initialization state machine.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Oren Weil authored and Greg Kroah-Hartman committed Sep 27, 2011
1 parent 8f019bf commit abc51b6
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 24 deletions.
30 changes: 8 additions & 22 deletions drivers/staging/mei/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

/**
Expand Down
34 changes: 33 additions & 1 deletion drivers/staging/mei/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/mei/mei_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit abc51b6

Please sign in to comment.