interrupts_enabled = state != MEI_DEV_POWER_DOWN;
dev->dev_state = MEI_DEV_RESETTING;
+ dev->reset_count++;
+ if (dev->reset_count > MEI_MAX_CONSEC_RESET) {
+ dev_err(&dev->pdev->dev, "reset: reached maximal consecutive resets: disabling the device\n");
+ dev->dev_state = MEI_DEV_DISABLED;
+ return -ENODEV;
+ }
+
ret = mei_hw_reset(dev, interrupts_enabled);
/* fall through and remove the sw state even if hw reset has failed */
dev_dbg(&dev->pdev->dev, "reset in start the mei device.\n");
dev->dev_state = MEI_DEV_INITIALIZING;
+ dev->reset_count = 0;
mei_reset(dev);
if (dev->dev_state == MEI_DEV_DISABLED) {
mei_clear_interrupts(dev);
dev->dev_state = MEI_DEV_POWER_UP;
+ dev->reset_count = 0;
err = mei_reset(dev);
init_waitqueue_head(&dev->wait_recvd_msg);
init_waitqueue_head(&dev->wait_stop_wd);
dev->dev_state = MEI_DEV_INITIALIZING;
+ dev->reset_count = 0;
mei_io_list_init(&dev->read_list);
mei_io_list_init(&dev->write_list);
*/
#define MEI_CLIENTS_MAX 256
+/*
+ * maximum number of consecutive resets
+ */
+#define MEI_MAX_CONSEC_RESET 3
+
/*
* Number of File descriptors/handles
* that can be opened to the driver.
/**
* struct mei_device - MEI private device struct
+ * @reset_count - limits the number of consecutive resets
* @hbm_state - state of host bus message protocol
* @mem_addr - mem mapped base register address
/*
* mei device states
*/
+ unsigned long reset_count;
enum mei_dev_state dev_state;
enum mei_hbm_state hbm_state;
u16 init_clients_timer;