MEI and ME separation
Subsystems (2)
cover MEI and ME separation
We are about to introduce new under laying hardware that supports MEI interface. For that purpose we split the driver into interface hand hardware specific layers
Tomas Winkler (6):
mei: sperate interface and pci code into two files
mei: initial extract of ME hw specifics from mei_device
mei: separate compilation of the ME hardware specifics
mei: move interrupt handlers to be me hw specific
mei: rename to mei_host_buffer_is_empty to hbuf_is_ready
mei: move clients cleanup code from init.c to client.c
drivers/misc/mei/Kconfig | 17 ++- drivers/misc/mei/Makefile | 5 +- drivers/misc/mei/amthif.c | 12 +- drivers/misc/mei/client.c | 64 ++++++- drivers/misc/mei/client.h | 5 + drivers/misc/mei/hw-me.c | 376 ++++++++++++++++++++++++++++++---------- drivers/misc/mei/hw-me.h | 30 ++-- drivers/misc/mei/init.c | 58 +------ drivers/misc/mei/interrupt.c | 130 +------------- drivers/misc/mei/main.c | 363 ++------------------------------------ drivers/misc/mei/mei_dev.h | 168 +++++++++++++++--- drivers/misc/mei/pci-me.c | 396 ++++++++++++++++++++++++++++++++++++++++++ drivers/misc/mei/wd.c | 9 +- 13 files changed, 960 insertions(+), 673 deletions(-) create mode 100644 drivers/misc/mei/pci-me.c
Signature · 1 line
1.7.4.4
PATCH 1/6 mei: sperate interface and pci code into two files
leave misc file operations in the main
and move PCI related code into pci-me
--- drivers/misc/mei/Makefile | 1 + drivers/misc/mei/main.c | 354 ++-------------------------------------- drivers/misc/mei/mei_dev.h | 3 + drivers/misc/mei/pci-me.c | 393 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 409 insertions(+), 342 deletions(-) create mode 100644 drivers/misc/mei/pci-me.c
drivers/misc/mei/Makefile +1 -0
@@ -11,3 +11,4 @@ mei-objs += main.o mei-objs += amthif.o mei-objs += wd.o mei-objs += client.o +mei-objs += pci-me.o
drivers/misc/mei/main.c +12 -342
390 lines not on this page · raw message
drivers/misc/mei/mei_dev.h +3 -0
@@ -401,6 +401,9 @@ bool mei_me_is_ready(struct mei_device *dev); +int mei_register (struct device *dev); +void mei_deregister (void ); +#define MEI_HDR_FMT "hdr:host=%02d me=%02d len=%d comp=%1d"#define MEI_HDR_PRM (hdr) \ (hdr)->host_addr, (hdr)->me_addr, \
drivers/misc/mei/pci-me.c new file +393 -0
393 lines not on this page · raw message
Signature · 1 line
1.7.4.4
PATCH 2/6 mei: initial extract of ME hw specifics from mei_device
In reply to Tomas WinklerThis is initial step of move the ME hw specifics
out of mei_device structure into mei_me_hw
--- drivers/misc/mei/hw-me.c | 131 +++++++++++++++++++++++++++++--------------- drivers/misc/mei/hw-me.h | 12 ++++ drivers/misc/mei/init.c | 28 +--------- drivers/misc/mei/mei_dev.h | 10 +-- drivers/misc/mei/pci-me.c | 21 ++++--- 5 files changed, 114 insertions(+), 88 deletions(-)
drivers/misc/mei/hw-me.c +86 -45
@@ -28,10 +28,10 @@* * returns register value (u32) */ -static inline u32 mei_reg_read (const struct mei_device *dev, +static inline u32 mei_reg_read (const struct mei_me_hw *hw,unsigned long offset) { -return ioread32 (dev->mem_addr + offset); +return ioread32 (hw->mem_addr + offset); }
@@ -42,10 +42,10 @@ static inline u32 mei_reg_read(const struct mei_device *dev,* @offset: offset from which to write the data * @value: register value to write (u32) */ -static inline void mei_reg_write (const struct mei_device *dev, +static inline void mei_reg_write (const struct mei_me_hw *hw,unsigned long offset,u32 value) { -iowrite32 (value, dev->mem_addr + offset); +iowrite32 (value, hw->mem_addr + offset); }/**
@@ -58,7 +58,7 @@ static inline void mei_reg_write(const struct mei_device *dev,*/ u32 mei_mecbrw_read (const struct mei_device *dev) { -return mei_reg_read (dev,ME_CB_RW ); +return mei_reg_read (to_me_hw (dev),ME_CB_RW ); }/** * mei_mecsr_read - Reads 32bit data from the ME CSR
@@ -67,9 +67,9 @@ u32 mei_mecbrw_read(const struct mei_device *dev)* * returns ME_CSR_HA register value (u32) */ -static inline u32 mei_mecsr_read (const struct mei_device *dev) +static inline u32 mei_mecsr_read (const struct mei_me_hw *hw) { -return mei_reg_read (dev,ME_CSR_HA ); +return mei_reg_read (hw,ME_CSR_HA ); }/**
@@ -79,9 +79,9 @@ static inline u32 mei_mecsr_read(const struct mei_device *dev)* * returns H_CSR register value (u32) */ -static inline u32 mei_hcsr_read (const struct mei_device *dev) +static inline u32 mei_hcsr_read (const struct mei_me_hw *hw) { -return mei_reg_read (dev,H_CSR ); +return mei_reg_read (hw,H_CSR ); }/**
@@ -90,10 +90,10 @@ static inline u32 mei_hcsr_read(const struct mei_device *dev)* * @dev: the device structure */ -static inline void mei_hcsr_set (struct mei_device *dev,u32 hcsr) +static inline void mei_hcsr_set (struct mei_me_hw *hw,u32 hcsr) { hcsr &= ~H_IS ; -mei_reg_write (dev,H_CSR , hcsr); +mei_reg_write (hw,H_CSR , hcsr); }
@@ -104,7 +104,7 @@ static inline void mei_hcsr_set(struct mei_device *dev, u32 hcsr)*/ void mei_hw_config (struct mei_device *dev) { -u32 hcsr =mei_hcsr_read (dev); +u32 hcsr =mei_hcsr_read (to_me_hw (dev));/* Doesn't change in runtime */ dev->hbuf_depth = (hcsr &H_CBD ) >>24 ; }
@@ -115,9 +115,10 @@ void mei_hw_config(struct mei_device *dev)*/ void mei_clear_interrupts (struct mei_device *dev) { -u32 hcsr =mei_hcsr_read (dev); +struct mei_me_hw *hw =to_me_hw (dev); +u32 hcsr =mei_hcsr_read (hw);if ((hcsr &H_IS ) ==H_IS ) -mei_reg_write (dev,H_CSR , hcsr); +mei_reg_write (hw,H_CSR , hcsr); }/**
@@ -127,9 +128,10 @@ void mei_clear_interrupts(struct mei_device *dev)*/ void mei_enable_interrupts (struct mei_device *dev) { -u32 hcsr =mei_hcsr_read (dev); +struct mei_me_hw *hw =to_me_hw (dev); +u32 hcsr =mei_hcsr_read (hw); hcsr |=H_IE ; -mei_hcsr_set (dev, hcsr); +mei_hcsr_set (hw, hcsr); }/**
@@ -139,9 +141,10 @@ void mei_enable_interrupts(struct mei_device *dev)*/ void mei_disable_interrupts (struct mei_device *dev) { -u32 hcsr =mei_hcsr_read (dev); +struct mei_me_hw *hw =to_me_hw (dev); +u32 hcsr =mei_hcsr_read (hw); hcsr &= ~H_IE ; -mei_hcsr_set (dev, hcsr); +mei_hcsr_set (hw, hcsr); }/**
@@ -152,7 +155,8 @@ void mei_disable_interrupts(struct mei_device *dev)*/ void mei_hw_reset (struct mei_device *dev,bool intr_enable) { -u32 hcsr =mei_hcsr_read (dev); +struct mei_me_hw *hw =to_me_hw (dev); +u32 hcsr =mei_hcsr_read (hw);dev_dbg (&dev->pdev->dev,"before reset HCSR = 0x%08x.\n" , hcsr);
@@ -163,14 +167,14 @@ void mei_hw_reset(struct mei_device *dev, bool intr_enable)else hcsr &= ~H_IE ; -mei_hcsr_set (dev, hcsr); +mei_hcsr_set (hw, hcsr); - hcsr =mei_hcsr_read (dev) |H_IG ; + hcsr =mei_hcsr_read (hw) |H_IG ; hcsr &= ~H_RST ; -mei_hcsr_set (dev, hcsr); +mei_hcsr_set (hw, hcsr); - hcsr =mei_hcsr_read (dev); + hcsr =mei_hcsr_read (hw);dev_dbg (&dev->pdev->dev,"current HCSR = 0x%08x.\n" , hcsr); }
@@ -184,8 +188,9 @@ void mei_hw_reset(struct mei_device *dev, bool intr_enable)void mei_host_set_ready (struct mei_device *dev) { - dev->host_hw_state |=H_IE |H_IG |H_RDY ; -mei_hcsr_set (dev, dev->host_hw_state); +struct mei_me_hw *hw =to_me_hw (dev); + hw->host_hw_state |=H_IE |H_IG |H_RDY ; +mei_hcsr_set (hw, hw->host_hw_state); }/** * mei_host_is_ready - check whether the host has turned ready
@@ -195,8 +200,9 @@ void mei_host_set_ready(struct mei_device *dev)*/ bool mei_host_is_ready (struct mei_device *dev) { - dev->host_hw_state =mei_hcsr_read (dev); -return (dev->host_hw_state &H_RDY ) ==H_RDY ; +struct mei_me_hw *hw =to_me_hw (dev); + hw->host_hw_state =mei_hcsr_read (hw); +return (hw->host_hw_state &H_RDY ) ==H_RDY ; }/**
@@ -207,8 +213,9 @@ bool mei_host_is_ready(struct mei_device *dev)*/ bool mei_me_is_ready (struct mei_device *dev) { - dev->me_hw_state =mei_mecsr_read (dev); -return (dev->me_hw_state &ME_RDY_HRA ) ==ME_RDY_HRA ; +struct mei_me_hw *hw =to_me_hw (dev); + hw->me_hw_state =mei_mecsr_read (hw); +return (hw->me_hw_state &ME_RDY_HRA ) ==ME_RDY_HRA ; }/**
@@ -222,13 +229,14 @@ bool mei_me_is_ready(struct mei_device *dev)irqreturn_t mei_interrupt_quick_handler (int irq,void *dev_id) {struct mei_device *dev = (struct mei_device *) dev_id; -u32 csr_reg =mei_hcsr_read (dev); +struct mei_me_hw *hw =to_me_hw (dev); +u32 csr_reg =mei_hcsr_read (hw);if ((csr_reg &H_IS ) !=H_IS )return IRQ_NONE ;/* clear H_IS bit in H_CSR */ -mei_reg_write (dev,H_CSR , csr_reg); +mei_reg_write (hw,H_CSR , csr_reg);return IRQ_WAKE_THREAD ; }
@@ -242,12 +250,13 @@ irqreturn_t mei_interrupt_quick_handler(int irq, void *dev_id)*/ static unsigned char mei_hbuf_filled_slots (struct mei_device *dev) { +struct mei_me_hw *hw =to_me_hw (dev);char read_ptr, write_ptr; - dev->host_hw_state =mei_hcsr_read (dev); + hw->host_hw_state =mei_hcsr_read (hw); - read_ptr = (char ) ((dev->host_hw_state &H_CBRP ) >>8 ); - write_ptr = (char ) ((dev->host_hw_state &H_CBWP ) >>16 ); + read_ptr = (char ) ((hw->host_hw_state &H_CBRP ) >>8 ); + write_ptr = (char ) ((hw->host_hw_state &H_CBWP ) >>16 );return (unsigned char ) (write_ptr - read_ptr); }
@@ -297,6 +306,7 @@ int mei_hbuf_empty_slots(struct mei_device *dev)int mei_write_message (struct mei_device *dev,struct mei_msg_hdr *header,unsigned char *buf) { +struct mei_me_hw *hw =to_me_hw (dev);unsigned long rem, dw_cnt;unsigned long length = header->length;u32 *reg_buf = (u32 *)buf;
@@ -313,20 +323,20 @@ int mei_write_message(struct mei_device *dev, struct mei_msg_hdr *header,if (empty_slots <0 || dw_cnt > empty_slots)return -EIO ; -mei_reg_write (dev,H_CB_WW , *((u32 *) header)); +mei_reg_write (hw,H_CB_WW , *((u32 *) header));for (i =0 ; i < length /4 ; i++) -mei_reg_write (dev,H_CB_WW , reg_buf[i]); +mei_reg_write (hw,H_CB_WW , reg_buf[i]); rem = length &0x3 ;if (rem >0 ) {u32 reg =0 ;memcpy (®, &buf[length - rem], rem); -mei_reg_write (dev,H_CB_WW , reg); +mei_reg_write (hw,H_CB_WW , reg); } - hcsr =mei_hcsr_read (dev) |H_IG ; -mei_hcsr_set (dev, hcsr); + hcsr =mei_hcsr_read (hw) |H_IG ; +mei_hcsr_set (hw, hcsr);if (!mei_me_is_ready (dev))return -EIO ;
@@ -342,13 +352,14 @@ int mei_write_message(struct mei_device *dev, struct mei_msg_hdr *header,*/ int mei_count_full_read_slots (struct mei_device *dev) { +struct mei_me_hw *hw =to_me_hw (dev);char read_ptr, write_ptr;unsigned char buffer_depth, filled_slots; - dev->me_hw_state =mei_mecsr_read (dev); - buffer_depth = (unsigned char )((dev->me_hw_state &ME_CBD_HRA ) >>24 ); - read_ptr = (char ) ((dev->me_hw_state &ME_CBRP_HRA ) >>8 ); - write_ptr = (char ) ((dev->me_hw_state &ME_CBWP_HRA ) >>16 ); + hw->me_hw_state =mei_mecsr_read (hw); + buffer_depth = (unsigned char )((hw->me_hw_state &ME_CBD_HRA ) >>24 ); + read_ptr = (char ) ((hw->me_hw_state &ME_CBRP_HRA ) >>8 ); + write_ptr = (char ) ((hw->me_hw_state &ME_CBWP_HRA ) >>16 ); filled_slots = (unsigned char ) (write_ptr - read_ptr);/* check for overflow */
@@ -369,6 +380,7 @@ int mei_count_full_read_slots(struct mei_device *dev)void mei_read_slots (struct mei_device *dev,unsigned char *buffer,unsigned long buffer_length) { +struct mei_me_hw *hw =to_me_hw (dev);u32 *reg_buf = (u32 *)buffer;u32 hcsr;
@@ -380,7 +392,36 @@ void mei_read_slots(struct mei_device *dev, unsigned char *buffer,memcpy (reg_buf, ®, buffer_length); } - hcsr =mei_hcsr_read (dev) |H_IG ; -mei_hcsr_set (dev, hcsr); + hcsr =mei_hcsr_read (hw) |H_IG ; +mei_hcsr_set (hw, hcsr); } +/** +* init_mei_device - allocates and initializes the mei device structure +* +* @pdev: The pci device structure +* +* returns The mei_device_device pointer on success, NULL on failure. +*/ +struct mei_device *mei_me_dev_init (struct pci_dev *pdev) +{ +struct mei_device *dev; + + dev =kzalloc (sizeof (struct mei_device ) + +sizeof (struct mei_me_hw ),GFP_KERNEL ); +if (!dev) +return NULL ; + +mei_device_init (dev); + +INIT_LIST_HEAD (&dev->wd_cl.link); +INIT_LIST_HEAD (&dev->iamthif_cl.link); +mei_io_list_init (&dev->amthif_cmd_list); +mei_io_list_init (&dev->amthif_rd_complete_list); + +INIT_DELAYED_WORK (&dev->timer_work, mei_timer); +INIT_WORK (&dev->init_work, mei_host_client_init); + + dev->pdev = pdev; +return dev; +}
drivers/misc/mei/hw-me.h +12 -0
@@ -21,8 +21,20 @@#include <linux/mei.h> #include "mei_dev.h" +#include "client.h" +struct mei_me_hw { +void __iomem *mem_addr; +/* +* hw states of host and fw(ME) +*/ +u32 host_hw_state; +u32 me_hw_state; +}; +#define to_me_hw (dev) (struct mei_me_hw *)((dev)->hw) + +struct mei_device *mei_me_dev_init (struct pci_dev *pdev); void mei_read_slots(struct mei_device *dev, unsigned char *buffer,
drivers/misc/mei/init.c +1 -27
@@ -42,28 +42,10 @@ const char *mei_dev_state_str(int state)#undef MEI_DEV_STATE } - - - -/** -* init_mei_device - allocates and initializes the mei device structure -* -* @pdev: The pci device structure -* -* returns The mei_device_device pointer on success, NULL on failure. -*/ -struct mei_device *mei_device_init (struct pci_dev *pdev) +void mei_device_init (struct mei_device *dev) { -struct mei_device *dev; - - dev =kzalloc (sizeof (struct mei_device ),GFP_KERNEL ); -if (!dev) -return NULL ; -/* setup our list array */ INIT_LIST_HEAD (&dev->file_list); -INIT_LIST_HEAD (&dev->wd_cl.link); -INIT_LIST_HEAD (&dev->iamthif_cl.link);mutex_init (&dev->device_lock);init_waitqueue_head (&dev->wait_recvd_msg);init_waitqueue_head (&dev->wait_stop_wd);
@@ -74,14 +56,6 @@ struct mei_device *mei_device_init(struct pci_dev *pdev)mei_io_list_init (&dev->write_waiting_list);mei_io_list_init (&dev->ctrl_wr_list);mei_io_list_init (&dev->ctrl_rd_list); -mei_io_list_init (&dev->amthif_cmd_list); -mei_io_list_init (&dev->amthif_rd_complete_list); - -INIT_DELAYED_WORK (&dev->timer_work, mei_timer); -INIT_WORK (&dev->init_work, mei_host_client_init); - - dev->pdev = pdev; -return dev; }/**
drivers/misc/mei/mei_dev.h +3 -7
@@ -235,18 +235,13 @@ struct mei_device {struct list_head file_list;long open_handle_count; -void __iomem *mem_addr;/* * lock for the device */ struct mutex device_lock;/* device lock */ struct delayed_work timer_work;/* MEI timer delayed work (timeouts) */ bool recvd_msg; -/* -* hw states of host and fw(ME) -*/ -u32 host_hw_state; -u32 me_hw_state; +u8 hbuf_depth;/* * waiting queue for receive message from FW
@@ -311,6 +306,7 @@ struct mei_device {bool iamthif_canceled;struct work_struct init_work; +char hw[0 ]__aligned(sizeof(void *)) ; };static inline unsigned long mei_secs_to_jiffies (unsigned long sec)
@@ -322,7 +318,7 @@ static inline unsigned long mei_secs_to_jiffies(unsigned long sec)/* * mei init function prototypes */ -struct mei_device *mei_device_init (struct pci_dev *pdev); +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);
drivers/misc/mei/pci-me.c +12 -9
@@ -90,7 +90,6 @@ MODULE_DEVICE_TABLE(pci, mei_pci_tbl);static DEFINE_MUTEX (mei_mutex); -/** * mei_quirk_probe - probe for devices that doesn't valid ME interface * @pdev: PCI device structure
@@ -120,10 +119,10 @@ static bool mei_quirk_probe(struct pci_dev *pdev,* * returns 0 on success, <0 on failure. */ -static int mei_probe (struct pci_dev *pdev, -const struct pci_device_id *ent) +static int mei_probe (struct pci_dev *pdev,const struct pci_device_id *ent) {struct mei_device *dev; +struct mei_me_hw *hw;int err;mutex_lock (&mei_mutex);
@@ -152,14 +151,15 @@ static int mei_probe(struct pci_dev *pdev, goto disable_device; }/* allocates and initializes the mei dev structure */ - dev =mei_device_init (pdev); + dev =mei_me_dev_init (pdev);if (!dev) { err = -ENOMEM ; goto release_regions; } + hw =to_me_hw (dev);/* mapping IO device memory */ - dev->mem_addr =pci_iomap (pdev,0 ,0 ); -if (!dev->mem_addr) { + hw->mem_addr =pci_iomap (pdev,0 ,0 ); +if (!hw->mem_addr) {dev_err (&pdev->dev,"mapping I/O device memory failure.\n" ); err = -ENOMEM ; goto free_device;
@@ -212,7 +212,7 @@ release_irq:free_irq (pdev->irq, dev); disable_msi:pci_disable_msi (pdev); -pci_iounmap (pdev, dev->mem_addr); +pci_iounmap (pdev, hw->mem_addr); free_device:kfree (dev); release_regions:
@@ -236,6 +236,7 @@ end:static void mei_remove (struct pci_dev *pdev) {struct mei_device *dev; +struct mei_me_hw *hw;if (mei_pdev != pdev)return ;
@@ -244,6 +245,8 @@ static void mei_remove(struct pci_dev *pdev)if (!dev)return ; + hw =to_me_hw (dev); +mutex_lock (&dev->device_lock);cancel_delayed_work (&dev->timer_work);
@@ -289,8 +292,8 @@ static void mei_remove(struct pci_dev *pdev)pci_disable_msi (pdev);pci_set_drvdata (pdev,NULL ); -if (dev->mem_addr) -pci_iounmap (pdev, dev->mem_addr); +if (hw->mem_addr) +pci_iounmap (pdev, hw->mem_addr);kfree (dev);
Signature · 1 line
1.7.4.4
PATCH 3/6 mei: separate compilation of the ME hardware specifics
In reply to Tomas WinklerWe add struct mei_hw_ops to virtualize access to hw specific configurations. This allows us to separate the compilation of the ME interface from the ME hardware specifics
--- drivers/misc/mei/Kconfig | 17 ++++- drivers/misc/mei/Makefile | 6 +- drivers/misc/mei/amthif.c | 6 +- drivers/misc/mei/hw-me.c | 87 +++++++++++++++++++--------- drivers/misc/mei/hw-me.h | 19 ------ drivers/misc/mei/init.c | 2 +- drivers/misc/mei/interrupt.c | 10 ++-- drivers/misc/mei/main.c | 5 +- drivers/misc/mei/mei_dev.h | 132 ++++++++++++++++++++++++++++++++++++++--- 9 files changed, 210 insertions(+), 74 deletions(-)
drivers/misc/mei/Kconfig +13 -4
@@ -1,11 +1,22 @@ config INTEL_MEI - tristate "Intel Management Engine Interface (Intel MEI)" - depends on X86 && PCI && WATCHDOG_CORE + tristate "Intel Management Engine Interface" + depends on X86 && PCI help The Intel Management Engine (Intel ME) provides Manageability, Security and Media services for system containing Intel chipsets. if selected /dev/mei misc device will be created. + For more information see + <http://software.intel.com/en-us/manageability/> + +config INTEL_MEI_ME + bool "ME Enabled Intel Chipsets" + depends on INTEL_MEI + depends on X86 && PCI && WATCHDOG_CORE + default y + help + MEI support for ME Enabled Intel chipsets. + Supported Chipsets are: 7 Series Chipset Family 6 Series Chipset Family
@@ -24,5 +35,3 @@ config INTEL_MEI 82Q33 Express 82X38/X48 Express - For more information see - <http://software.intel.com/en-us/manageability/>
drivers/misc/mei/Makefile +3 -3
@@ -6,9 +6,9 @@ obj-$(CONFIG_INTEL_MEI) += mei.o mei-objs := init.o mei-objs += hbm.o mei-objs += interrupt.o -mei-objs += hw-me.o +mei-objs += client.o mei-objs += main.o mei-objs += amthif.o mei-objs += wd.o -mei-objs += client.o -mei-objs += pci-me.o +mei-$(CONFIG_INTEL_MEI_ME) += pci-me.o +mei-$(CONFIG_INTEL_MEI_ME) += hw-me.o
drivers/misc/mei/amthif.c +3 -3
@@ -300,8 +300,8 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)if (ret && dev->mei_host_buffer_is_empty) { ret =0 ; dev->mei_host_buffer_is_empty = false; -if (cb->request_buffer.size >mei_hbuf_max_data (dev)) { - mei_hdr.length =mei_hbuf_max_data (dev); +if (cb->request_buffer.size >mei_hbuf_max_len (dev)) { + mei_hdr.length =mei_hbuf_max_len (dev); mei_hdr.msg_complete =0 ; }else { mei_hdr.length = cb->request_buffer.size;
@@ -583,7 +583,7 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots) dev->iamthif_msg_buf_index =0 ; dev->iamthif_msg_buf_size =0 ; dev->iamthif_stall_timer =MEI_IAMTHIF_STALL_TIMER ; - dev->mei_host_buffer_is_empty =mei_hbuf_is_empty (dev); + dev->mei_host_buffer_is_empty =mei_hbuf_is_ready (dev);return 0 ; }
drivers/misc/mei/hw-me.c +60 -27
239 lines not on this page · raw message
drivers/misc/mei/hw-me.h +0 -19
@@ -36,29 +36,10 @@ struct mei_me_hw {struct mei_device *mei_me_dev_init (struct pci_dev *pdev); -void mei_read_slots (struct mei_device *dev, -unsigned char *buffer, -unsigned long buffer_length); - -int mei_write_message (struct mei_device *dev, -struct mei_msg_hdr *header, -unsigned char *buf); - -bool mei_hbuf_is_empty (struct mei_device *dev); - -int mei_hbuf_empty_slots (struct mei_device *dev); - -static inline size_t mei_hbuf_max_data (const struct mei_device *dev) -{ -return dev->hbuf_depth *sizeof (u32) -sizeof (struct mei_msg_hdr ); -} -/* get slots (dwords) from a message length + header (bytes) */ static inline unsigned char mei_data2slots (size_t length) {return DIV_ROUND_UP (sizeof (struct mei_msg_hdr ) + length,4 ); } -int mei_count_full_read_slots (struct mei_device *dev); -#endif /* _MEI_INTERFACE_H_ */
drivers/misc/mei/init.c +1 -1
@@ -104,7 +104,7 @@ int mei_hw_init(struct mei_device *dev) goto err; } -if (!mei_me_is_ready (dev)) { +if (!mei_hw_is_ready (dev)) {dev_err (&dev->pdev->dev,"ME is not ready.\n" ); goto err; }
drivers/misc/mei/interrupt.c +5 -5
@@ -329,7 +329,7 @@ static int mei_irq_thread_read_handler(struct mei_cl_cb *cmpl_list,int ret =0 ;if (!dev->rd_msg_hdr) { - dev->rd_msg_hdr =mei_mecbrw_read (dev); + dev->rd_msg_hdr =mei_read_hdr (dev);dev_dbg (&dev->pdev->dev,"slots =%08x.\n" , *slots); (*slots)--;dev_dbg (&dev->pdev->dev,"slots =%08x.\n" , *slots);
@@ -430,7 +430,7 @@ static int mei_irq_thread_write_handler(struct mei_device *dev,s32 slots;int ret; -if (!mei_hbuf_is_empty (dev)) { +if (!mei_hbuf_is_ready (dev)) {dev_dbg (&dev->pdev->dev,"host buffer is not empty.\n" );return 0 ; }
@@ -698,7 +698,7 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id)mei_clear_interrupts (dev);/* check if ME wants a reset */ -if (!mei_me_is_ready (dev) && +if (!mei_hw_is_ready (dev) && dev->dev_state !=MEI_DEV_RESETING && dev->dev_state !=MEI_DEV_INITIALIZING ) {dev_dbg (&dev->pdev->dev,"FW not ready.\n" );
@@ -709,7 +709,7 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id)/* check if we need to start the dev */ if (!mei_host_is_ready (dev)) { -if (mei_me_is_ready (dev)) { +if (mei_hw_is_ready (dev)) {dev_dbg (&dev->pdev->dev,"we need to start the dev.\n" );mei_host_set_ready (dev);
@@ -743,7 +743,7 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id) rets =mei_irq_thread_write_handler (dev, &complete_list); end:dev_dbg (&dev->pdev->dev,"end of bottom half function.\n" ); - dev->mei_host_buffer_is_empty =mei_hbuf_is_empty (dev); + dev->mei_host_buffer_is_empty =mei_hbuf_is_ready (dev); bus_message_received = false;if (dev->recvd_msg &&waitqueue_active (&dev->wait_recvd_msg)) {
drivers/misc/mei/main.c +3 -2
@@ -462,8 +462,8 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, } dev->mei_host_buffer_is_empty = false; -if (length >mei_hbuf_max_data (dev)) { - mei_hdr.length =mei_hbuf_max_data (dev); +if (length >mei_hbuf_max_len (dev)) { + mei_hdr.length =mei_hbuf_max_len (dev); mei_hdr.msg_complete =0 ; }else { mei_hdr.length = length;
@@ -765,4 +765,5 @@ void mei_deregister(void) mei_misc_device.parent =NULL ; } +MODULE_LICENSE ("GPL v2" );
drivers/misc/mei/mei_dev.h +122 -10
160 lines not on this page · raw message
Signature · 1 line
1.7.4.4
PATCH 4/6 mei: move interrupt handlers to be me hw specific
In reply to Tomas Winklerinterrupt handler are platform specifics so we move them to hw-mei.c. For sake of that we need to export write, read, and complete handlers from the interrupt.c
--- drivers/misc/mei/hw-me.c | 164 +++++++++++++++++++++++++++++++++++------ drivers/misc/mei/hw-me.h | 3 + drivers/misc/mei/interrupt.c | 126 ++------------------------------ drivers/misc/mei/mei_dev.h | 9 ++- drivers/misc/mei/pci-me.c | 12 ++-- 5 files changed, 164 insertions(+), 150 deletions(-)
drivers/misc/mei/hw-me.c +140 -24
@@ -15,11 +15,16 @@*/ #include <linux/pci.h> -#include <linux/mei.h> + +#include <linux/kthread.h> +#include <linux/interrupt.h> #include "mei_dev.h" #include "hw-me.h" +#include "hbm.h" + +/** * mei_reg_read - Reads 32bit data from the mei device *
@@ -218,29 +223,6 @@ static bool mei_me_hw_is_ready(struct mei_device *dev) }/** -* mei_interrupt_quick_handler - The ISR of the MEI device -* -* @irq: The irq number -* @dev_id: pointer to the device structure -* -* returns irqreturn_t -*/ -irqreturn_t mei_interrupt_quick_handler (int irq,void *dev_id) -{ -struct mei_device *dev = (struct mei_device *) dev_id; -struct mei_me_hw *hw =to_me_hw (dev); -u32 csr_reg =mei_hcsr_read (hw); - -if ((csr_reg &H_IS ) !=H_IS ) -return IRQ_NONE ; - -/* clear H_IS bit in H_CSR */ -mei_reg_write (hw,H_CSR , csr_reg); - -return IRQ_WAKE_THREAD ; -} - -/** * mei_hbuf_filled_slots - gets number of device filled buffer slots * * @dev: the device structure
@@ -403,6 +385,139 @@ static int mei_me_read_slots(struct mei_device *dev, unsigned char *buffer,return 0 ; } +/** +* mei_me_irq_quick_handler - The ISR of the MEI device +* +* @irq: The irq number +* @dev_id: pointer to the device structure +* +* returns irqreturn_t +*/ + +irqreturn_t mei_me_irq_quick_handler (int irq,void *dev_id) +{ +struct mei_device *dev = (struct mei_device *) dev_id; +struct mei_me_hw *hw =to_me_hw (dev); +u32 csr_reg =mei_hcsr_read (hw); + +if ((csr_reg &H_IS ) !=H_IS ) +return IRQ_NONE ; + +/* clear H_IS bit in H_CSR */ +mei_reg_write (hw,H_CSR , csr_reg); + +return IRQ_WAKE_THREAD ; +} + +/** +* mei_me_irq_thread_handler - function called after ISR to handle the interrupt +* processing. +* +* @irq: The irq number +* @dev_id: pointer to the device structure +* +* returns irqreturn_t +* +*/ +irqreturn_t mei_me_irq_thread_handler (int irq,void *dev_id) +{ +struct mei_device *dev = (struct mei_device *) dev_id; +struct mei_cl_cb complete_list; +struct mei_cl_cb *cb_pos =NULL , *cb_next =NULL ; +struct mei_cl *cl; +s32 slots; +int rets; +bool bus_message_received; + + +dev_dbg (&dev->pdev->dev,"function called after ISR to handle the interrupt processing.\n" ); +/* initialize our complete list */ +mutex_lock (&dev->device_lock); +mei_io_list_init (&complete_list); + +/* Ack the interrupt here +* In case of MSI we don't go through the quick handler */ +if (pci_dev_msi_enabled (dev->pdev)) +mei_clear_interrupts (dev); + +/* check if ME wants a reset */ +if (!mei_hw_is_ready (dev) && + dev->dev_state !=MEI_DEV_RESETING && + dev->dev_state !=MEI_DEV_INITIALIZING ) { +dev_dbg (&dev->pdev->dev,"FW not ready.\n" ); +mei_reset (dev,1 ); +mutex_unlock (&dev->device_lock); +return IRQ_HANDLED ; + } + +/* check if we need to start the dev */ +if (!mei_host_is_ready (dev)) { +if (mei_hw_is_ready (dev)) { +dev_dbg (&dev->pdev->dev,"we need to start the dev.\n" ); + +mei_host_set_ready (dev); + +dev_dbg (&dev->pdev->dev,"link is established start sending messages.\n" ); +/* link is established * start sending messages. */ + + dev->dev_state =MEI_DEV_INIT_CLIENTS ; + +mei_hbm_start_req (dev); +mutex_unlock (&dev->device_lock); +return IRQ_HANDLED ; + }else { +dev_dbg (&dev->pdev->dev,"FW not ready.\n" ); +mutex_unlock (&dev->device_lock); +return IRQ_HANDLED ; + } + } +/* check slots available for reading */ + slots =mei_count_full_read_slots (dev); +while (slots >0 ) { +/* we have urgent data to send so break the read */ +if (dev->wr_ext_msg.hdr.length) +break ; +dev_dbg (&dev->pdev->dev,"slots =%08x\n" , slots); +dev_dbg (&dev->pdev->dev,"call mei_irq_read_handler.\n" ); + rets =mei_irq_read_handler (dev, &complete_list, &slots); +if (rets) + goto end; + } + rets =mei_irq_write_handler (dev, &complete_list); +end: +dev_dbg (&dev->pdev->dev,"end of bottom half function.\n" ); + dev->mei_host_buffer_is_empty =mei_hbuf_is_ready (dev); + + bus_message_received = false; +if (dev->recvd_msg &&waitqueue_active (&dev->wait_recvd_msg)) { +dev_dbg (&dev->pdev->dev,"received waiting bus message\n" ); + bus_message_received = true; + } +mutex_unlock (&dev->device_lock); +if (bus_message_received) { +dev_dbg (&dev->pdev->dev,"wake up dev->wait_recvd_msg\n" ); +wake_up_interruptible (&dev->wait_recvd_msg); + bus_message_received = false; + } +if (list_empty (&complete_list.list)) +return IRQ_HANDLED ; + + +list_for_each_entry_safe (cb_pos, cb_next, &complete_list.list, list) { + cl = cb_pos->cl; +list_del (&cb_pos->list); +if (cl) { +if (cl != &dev->iamthif_cl) { +dev_dbg (&dev->pdev->dev,"completing call back.\n" ); +mei_irq_complete_handler (cl, cb_pos); + cb_pos =NULL ; + }else if (cl == &dev->iamthif_cl) { +mei_amthif_complete (dev, cb_pos); + } + } + } +return IRQ_HANDLED ; +}static const struct mei_hw_ops mei_me_hw_ops = { .host_set_ready = mei_me_host_set_ready,
@@ -458,3 +573,4 @@ struct mei_device *mei_me_dev_init(struct pci_dev *pdev) dev->pdev = pdev;return dev; } +
drivers/misc/mei/hw-me.h +3 -0
@@ -42,4 +42,7 @@ static inline unsigned char mei_data2slots(size_t length) return DIV_ROUND_UP(sizeof(struct mei_msg_hdr) + length, 4); } +irqreturn_t mei_me_irq_quick_handler (int irq,void *dev_id); +irqreturn_t mei_me_irq_thread_handler (int irq,void *dev_id); +#endif /* _MEI_INTERFACE_H_ */
drivers/misc/mei/interrupt.c +8 -118
162 lines not on this page · raw message
drivers/misc/mei/mei_dev.h +7 -2
@@ -379,9 +379,14 @@ int mei_hw_init(struct mei_device *dev);/* * MEI interrupt functions prototype */ -irqreturn_t mei_interrupt_quick_handler (int irq,void *dev_id); -irqreturn_t mei_interrupt_thread_handler (int irq,void *dev_id); +void mei_timer (struct work_struct *work); +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);/* * AMTHIF - AMT Host Interface Functions
drivers/misc/mei/pci-me.c +6 -6
@@ -170,12 +170,12 @@ static int mei_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (pci_dev_msi_enabled (pdev)) err =request_threaded_irq (pdev->irq,NULL , - mei_interrupt_thread_handler, + mei_me_irq_thread_handler,IRQF_ONESHOT ,KBUILD_MODNAME , dev);else err =request_threaded_irq (pdev->irq, - mei_interrupt_quick_handler, - mei_interrupt_thread_handler, + mei_me_irq_quick_handler, + mei_me_irq_thread_handler,IRQF_SHARED ,KBUILD_MODNAME , dev);if (err) {
@@ -348,12 +348,12 @@ static int mei_pci_resume(struct device *device)if (pci_dev_msi_enabled (pdev)) err =request_threaded_irq (pdev->irq,NULL , - mei_interrupt_thread_handler, + mei_me_irq_thread_handler,IRQF_ONESHOT ,KBUILD_MODNAME , dev);else err =request_threaded_irq (pdev->irq, - mei_interrupt_quick_handler, - mei_interrupt_thread_handler, + mei_me_irq_quick_handler, + mei_me_irq_thread_handler,IRQF_SHARED ,KBUILD_MODNAME , dev);if (err) {
Signature · 1 line
1.7.4.4
PATCH 5/6 mei: rename to mei_host_buffer_is_empty to hbuf_is_ready
In reply to Tomas Winklerwe rename the mei_host_buffer_is_empty to keep naming convention of hbuf and also make the query more generic to be correct also for other under laying hardware
--- drivers/misc/mei/amthif.c | 8 ++++---- drivers/misc/mei/client.c | 13 ++++++------- drivers/misc/mei/hw-me.c | 2 +- drivers/misc/mei/main.c | 4 ++-- drivers/misc/mei/mei_dev.h | 14 ++++++++++---- drivers/misc/mei/wd.c | 9 ++++----- 6 files changed, 27 insertions(+), 23 deletions(-)
drivers/misc/mei/amthif.c +4 -4
@@ -297,9 +297,9 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)if (ret <0 )return ret; -if (ret && dev->mei_host_buffer_is_empty) { +if (ret && dev->hbuf_is_ready) { ret =0 ; - dev->mei_host_buffer_is_empty = false; + dev->hbuf_is_ready = false;if (cb->request_buffer.size >mei_hbuf_max_len (dev)) { mei_hdr.length =mei_hbuf_max_len (dev); mei_hdr.msg_complete =0 ;
@@ -330,7 +330,7 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)list_add_tail (&cb->list, &dev->write_list.list); } }else { -if (!(dev->mei_host_buffer_is_empty)) +if (!dev->hbuf_is_ready)dev_dbg (&dev->pdev->dev,"host buffer is not empty" );dev_dbg (&dev->pdev->dev,"No flow control credentials, so add iamthif cb to write list.\n" );
@@ -583,7 +583,7 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots) dev->iamthif_msg_buf_index =0 ; dev->iamthif_msg_buf_size =0 ; dev->iamthif_stall_timer =MEI_IAMTHIF_STALL_TIMER ; - dev->mei_host_buffer_is_empty =mei_hbuf_is_ready (dev); + dev->hbuf_is_ready =mei_hbuf_is_ready (dev);return 0 ; }
drivers/misc/mei/client.c +6 -7
@@ -393,8 +393,8 @@ int mei_cl_disconnect(struct mei_cl *cl)return -ENOMEM ; cb->fop_type =MEI_FOP_CLOSE ; -if (dev->mei_host_buffer_is_empty) { - dev->mei_host_buffer_is_empty = false; +if (dev->hbuf_is_ready) { + dev->hbuf_is_ready = false;if (mei_hbm_cl_disconnect_req (dev, cl)) { rets = -ENODEV ;dev_err (&dev->pdev->dev,"failed to disconnect.\n" );
@@ -496,9 +496,8 @@ int mei_cl_connect(struct mei_cl *cl, struct file *file) cb->fop_type =MEI_FOP_IOCTL ; -if (dev->mei_host_buffer_is_empty && - !mei_cl_is_other_connecting (cl)) { - dev->mei_host_buffer_is_empty = false; +if (dev->hbuf_is_ready && !mei_cl_is_other_connecting (cl)) { + dev->hbuf_is_ready = false;if (mei_hbm_cl_connect_req (dev, cl)) { rets = -ENODEV ;
@@ -661,8 +660,8 @@ int mei_cl_read_start(struct mei_cl *cl) cb->fop_type =MEI_FOP_READ ; cl->read_cb = cb; -if (dev->mei_host_buffer_is_empty) { - dev->mei_host_buffer_is_empty = false; +if (dev->hbuf_is_ready) { + dev->hbuf_is_ready = false;if (mei_hbm_cl_flow_control_req (dev, cl)) { rets = -ENODEV ; goto err;
drivers/misc/mei/hw-me.c +1 -1
@@ -486,7 +486,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id) rets =mei_irq_write_handler (dev, &complete_list); end:dev_dbg (&dev->pdev->dev,"end of bottom half function.\n" ); - dev->mei_host_buffer_is_empty =mei_hbuf_is_ready (dev); + dev->hbuf_is_ready =mei_hbuf_is_ready (dev); bus_message_received = false;if (dev->recvd_msg &&waitqueue_active (&dev->wait_recvd_msg)) {
drivers/misc/mei/main.c +2 -2
@@ -454,14 +454,14 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,if (rets <0 ) goto err; -if (rets ==0 || dev->mei_host_buffer_is_empty == false) { +if (rets ==0 || !dev->hbuf_is_ready) { write_cb->buf_idx =0 ; mei_hdr.msg_complete =0 ; cl->writing_state =MEI_WRITING ; goto out; } - dev->mei_host_buffer_is_empty = false; + dev->hbuf_is_ready = false;if (length >mei_hbuf_max_len (dev)) { mei_hdr.length =mei_hbuf_max_len (dev); mei_hdr.msg_complete =0 ;
drivers/misc/mei/mei_dev.h +10 -4
@@ -265,9 +265,13 @@ struct mei_hw_ops {/** * struct mei_device - MEI private device struct +* @mem_addr - mem mapped base register address -* @hbuf_depth - depth of host(write) buffer -* @wr_ext_msg - buffer for hbm control responses (set in read cycle) + +* @hbuf_depth - depth of hardware host/write buffer is slots +* @hbuf_is_ready - query if the host host/write buffer is ready +* @wr_msg - the buffer for hbm control messages +* @wr_ext_msg - the buffer for hbm control responses (set in read cycle) */ struct mei_device {struct pci_dev *pdev;/* pointer to pci device struct */
@@ -294,7 +298,6 @@ struct mei_device {struct delayed_work timer_work;/* MEI timer delayed work (timeouts) */ bool recvd_msg; -u8 hbuf_depth;/* * waiting queue for receive message from FW */
@@ -311,6 +314,10 @@ struct mei_device {unsigned char rd_msg_buf[MEI_RD_MSG_BUF_SIZE ];/* control messages */ u32 rd_msg_hdr; +/* write buffer */ +u8 hbuf_depth; +bool hbuf_is_ready; +/* used for control messages */ struct {struct mei_msg_hdr hdr;
@@ -330,7 +337,6 @@ struct mei_device {u8 me_clients_num;u8 me_client_presentation_num;u8 me_client_index; -bool mei_host_buffer_is_empty;struct mei_cl wd_cl;enum mei_wd_states wd_state;
drivers/misc/mei/wd.c +4 -5
@@ -157,9 +157,9 @@ int mei_wd_stop(struct mei_device *dev)if (ret <0 ) goto out; -if (ret && dev->mei_host_buffer_is_empty) { +if (ret && dev->hbuf_is_ready) { ret =0 ; - dev->mei_host_buffer_is_empty = false; + dev->hbuf_is_ready = false;if (!mei_wd_send (dev)) { ret =mei_cl_flow_ctrl_reduce (&dev->wd_cl);
@@ -282,10 +282,9 @@ static int mei_wd_ops_ping(struct watchdog_device *wd_dev) dev->wd_state =MEI_WD_RUNNING ;/* Check if we can send the ping to HW*/ -if (dev->mei_host_buffer_is_empty && -mei_cl_flow_ctrl_creds (&dev->wd_cl) >0 ) { +if (dev->hbuf_is_ready &&mei_cl_flow_ctrl_creds (&dev->wd_cl) >0 ) { - dev->mei_host_buffer_is_empty = false; + dev->hbuf_is_ready = false;dev_dbg (&dev->pdev->dev,"wd: sending ping\n" );if (mei_wd_send (dev)) {
Signature · 1 line
1.7.4.4
PATCH 6/6 mei: move clients cleanup code from init.c to client.c
In reply to Tomas Winklerduring reset we clean up client data structures
we move that code into wrappers in client
and call the wrappers
--- drivers/misc/mei/client.c | 51 +++++++++++++++++++++++++++++++++++++++++++++ drivers/misc/mei/client.h | 5 ++++ drivers/misc/mei/init.c | 28 +++++------------------- 3 files changed, 62 insertions(+), 22 deletions(-)
drivers/misc/mei/client.c +51 -0
@@ -676,3 +676,54 @@ err:return rets; } +/** +* mei_cl_all_disconnect - disconnect forcefully all connected clients +* +* @dev - mei device +*/ + +void mei_cl_all_disconnect (struct mei_device *dev) +{ +struct mei_cl *cl, *next; + +list_for_each_entry_safe (cl, next, &dev->file_list, link) { + cl->state =MEI_FILE_DISCONNECTED ; + cl->mei_flow_ctrl_creds =0 ; + cl->read_cb =NULL ; + cl->timer_count =0 ; + } +} + + +/** +* mei_cl_all_read_wakeup - wake up all readings so they can be interrupted +* +* @dev - mei device +*/ +void mei_cl_all_read_wakeup (struct mei_device *dev) +{ +struct mei_cl *cl, *next; +list_for_each_entry_safe (cl, next, &dev->file_list, link) { +if (waitqueue_active (&cl->rx_wait)) { +dev_dbg (&dev->pdev->dev,"Waking up client!\n" ); +wake_up_interruptible (&cl->rx_wait); + } + } +} + +/** +* mei_cl_all_write_clear - clear all pending writes + +* @dev - mei device +*/ +void mei_cl_all_write_clear (struct mei_device *dev) +{ +struct mei_cl_cb *cb, *next; + +list_for_each_entry_safe (cb, next, &dev->write_list.list, list) { +list_del (&cb->list); +mei_io_cb_free (cb); + } +} + +
drivers/misc/mei/client.h +5 -0
@@ -94,4 +94,9 @@ int mei_cl_connect(struct mei_cl *cl, struct file *file);void mei_host_client_init (struct work_struct *work); +void mei_cl_all_disconnect (struct mei_device *dev); +void mei_cl_all_read_wakeup (struct mei_device *dev); +void mei_cl_all_write_clear (struct mei_device *dev); + +#endif /* _MEI_CLIENT_H_ */
drivers/misc/mei/init.c +6 -22
@@ -135,10 +135,6 @@ err:*/ void mei_reset (struct mei_device *dev,int interrupts_enabled) { -struct mei_cl *cl_pos =NULL ; -struct mei_cl *cl_next =NULL ; -struct mei_cl_cb *cb_pos =NULL ; -struct mei_cl_cb *cb_next =NULL ;bool unexpected;if (dev->dev_state ==MEI_DEV_RECOVERING_FROM_RESET )
@@ -157,13 +153,8 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) dev->dev_state != MEI_DEV_POWER_DOWN) dev->dev_state =MEI_DEV_RESETING ; -list_for_each_entry_safe (cl_pos, - cl_next, &dev->file_list, link) { - cl_pos->state =MEI_FILE_DISCONNECTED ; - cl_pos->mei_flow_ctrl_creds =0 ; - cl_pos->read_cb =NULL ; - cl_pos->timer_count =0 ; - } +mei_cl_all_disconnect (dev); +/* remove entry if already in list */ dev_dbg (&dev->pdev->dev,"remove iamthif and wd from the file list.\n" );mei_cl_unlink (&dev->wd_cl);
@@ -185,18 +176,11 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)dev_warn (&dev->pdev->dev,"unexpected reset: dev_state = %s\n" ,mei_dev_state_str (dev->dev_state)); -/* Wake up all readings so they can be interrupted */ -list_for_each_entry_safe (cl_pos, cl_next, &dev->file_list, link) { -if (waitqueue_active (&cl_pos->rx_wait)) { -dev_dbg (&dev->pdev->dev,"Waking up client!\n" ); -wake_up_interruptible (&cl_pos->rx_wait); - } - } +/* wake up all readings so they can be interrupted */ +mei_cl_all_read_wakeup (dev); +/* remove all waiting requests */ -list_for_each_entry_safe (cb_pos, cb_next, &dev->write_list.list, list) { -list_del (&cb_pos->list); -mei_io_cb_free (cb_pos); - } +mei_cl_all_write_clear (dev); }
Signature · 1 line
1.7.4.4