mei: drop RECOVERING_FROM_RESET device state
[sfrench/cifs-2.6.git] / drivers / misc / mei / mei_dev.h
index cb80166161f0f82ad725e1073baf1bc607fcc6bf..091f50af18a4a05888974e006cdb12f5935dfc20 100644 (file)
@@ -97,7 +97,6 @@ enum mei_dev_state {
        MEI_DEV_ENABLED,
        MEI_DEV_RESETING,
        MEI_DEV_DISABLED,
-       MEI_DEV_RECOVERING_FROM_RESET,
        MEI_DEV_POWER_DOWN,
        MEI_DEV_POWER_UP
 };
@@ -213,11 +212,11 @@ struct mei_cl {
 
 /** struct mei_hw_ops
  *
- * @host_set_ready   - notify FW that host side is ready
  * @host_is_ready    - query for host readiness
 
  * @hw_is_ready      - query if hw is ready
  * @hw_reset         - reset hw
+ * @hw_start         - start hw after reset
  * @hw_config        - configure hw
 
  * @intr_clear       - clear pending interrupts
@@ -237,11 +236,11 @@ struct mei_cl {
  */
 struct mei_hw_ops {
 
-       void (*host_set_ready) (struct mei_device *dev);
        bool (*host_is_ready) (struct mei_device *dev);
 
        bool (*hw_is_ready) (struct mei_device *dev);
        void (*hw_reset) (struct mei_device *dev, bool enable);
+       int  (*hw_start) (struct mei_device *dev);
        void (*hw_config) (struct mei_device *dev);
 
        void (*intr_clear) (struct mei_device *dev);
@@ -296,11 +295,14 @@ struct mei_device {
         */
        struct mutex device_lock; /* device lock */
        struct delayed_work timer_work; /* MEI timer delayed work (timeouts) */
+
+       bool recvd_hw_ready;
        bool recvd_msg;
 
        /*
         * waiting queue for receive message from FW
         */
+       wait_queue_head_t wait_hw_ready;
        wait_queue_head_t wait_recvd_msg;
        wait_queue_head_t wait_stop_wd;
 
@@ -374,6 +376,17 @@ static inline unsigned long mei_secs_to_jiffies(unsigned long sec)
        return msecs_to_jiffies(sec * MSEC_PER_SEC);
 }
 
+/**
+ * mei_data2slots - get slots - number of (dwords) from a message length
+ *     + size of the mei header
+ * @length - size of the messages in bytes
+ * returns  - number of slots
+ */
+static inline u32 mei_data2slots(size_t length)
+{
+       return DIV_ROUND_UP(sizeof(struct mei_msg_hdr) + length, 4);
+}
+
 
 /*
  * mei init function prototypes
@@ -381,6 +394,7 @@ static inline unsigned long mei_secs_to_jiffies(unsigned long sec)
 void mei_device_init(struct mei_device *dev);
 void mei_reset(struct mei_device *dev, int interrupts);
 int mei_hw_init(struct mei_device *dev);
+void mei_stop(struct mei_device *dev);
 
 /*
  *  MEI interrupt functions prototype
@@ -391,8 +405,7 @@ int mei_irq_read_handler(struct mei_device *dev,
                struct mei_cl_cb *cmpl_list, s32 *slots);
 
 int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list);
-
-void mei_irq_complete_handler(struct mei_cl *cl, struct mei_cl_cb *cb_pos);
+void mei_irq_compl_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list);
 
 /*
  * AMTHIF - AMT Host Interface Functions
@@ -454,6 +467,11 @@ static inline void mei_hw_reset(struct mei_device *dev, bool enable)
        dev->ops->hw_reset(dev, enable);
 }
 
+static inline void mei_hw_start(struct mei_device *dev)
+{
+       dev->ops->hw_start(dev);
+}
+
 static inline void mei_clear_interrupts(struct mei_device *dev)
 {
        dev->ops->intr_clear(dev);
@@ -469,10 +487,6 @@ static inline void mei_disable_interrupts(struct mei_device *dev)
        dev->ops->intr_disable(dev);
 }
 
-static inline void mei_host_set_ready(struct mei_device *dev)
-{
-       dev->ops->host_set_ready(dev);
-}
 static inline bool mei_host_is_ready(struct mei_device *dev)
 {
        return dev->ops->host_is_ready(dev);