mei: remove pci dependency from mei module
Subsystems (2)
cover mei: remove pci dependency from mei module
In order to support testing hw module we remove dependency on pci from mei module
Tomas Winkler (6):
mei: push all standard settings into mei_device_init
mei: get rid of most of the pci dependencies in mei
mei: move fw_status back to hw ops handlers
mei: remove the reference to pdev from mei_deivce
mei: push pci cfg structure me hw
mei: remove include to pci header from mei module files
drivers/misc/mei/amthif.c | 70 +++++++++++++-------------- drivers/misc/mei/bus.c | 11 ++--- drivers/misc/mei/client.c | 48 +++++++++---------- drivers/misc/mei/client.h | 4 +- drivers/misc/mei/debugfs.c | 7 ++- drivers/misc/mei/hbm.c | 71 ++++++++++++++-------------- drivers/misc/mei/hw-me.c | 70 ++++++++++++++++++--------- drivers/misc/mei/hw-me.h | 26 ++++++++++- drivers/misc/mei/hw-txe.c | 109 +++++++++++++++++++++++++------------------ drivers/misc/mei/hw-txe.h | 5 +- drivers/misc/mei/init.c | 78 +++++++++++++------------------ drivers/misc/mei/interrupt.c | 46 +++++++++--------- drivers/misc/mei/main.c | 42 ++++++++--------- drivers/misc/mei/mei_dev.h | 37 ++++++--------- drivers/misc/mei/nfc.c | 46 +++++++++--------- drivers/misc/mei/pci-me.c | 4 +- drivers/misc/mei/pci-txe.c | 10 ++-- drivers/misc/mei/wd.c | 35 ++++++-------- include/linux/mei_cl_bus.h | 1 + 19 files changed, 377 insertions(+), 343 deletions(-)
Signature · 1 line
1.9.3
PATCH 1/6 mei: push all standard settings into mei_device_init
Setting of hw_ops and device has should be inmei_device_init.
We add reference to the parent device and remove
pci dependent cfg
--- drivers/misc/mei/hw-me.c | 6 ++---- drivers/misc/mei/hw-txe.c | 5 ++--- drivers/misc/mei/init.c | 14 ++++++++++++-- drivers/misc/mei/mei_dev.h | 6 +++++- 4 files changed, 21 insertions(+), 10 deletions(-)
drivers/misc/mei/hw-me.c +2 -4
@@ -824,10 +824,8 @@ struct mei_device *mei_me_dev_init(struct pci_dev *pdev,if (!dev)return NULL ; -mei_device_init (dev, cfg); - - dev->ops = &mei_me_hw_ops; - +mei_device_init (dev, &pdev->dev, &mei_me_hw_ops); + dev->cfg = cfg; dev->pdev = pdev;return dev; }
drivers/misc/mei/hw-txe.c +2 -3
@@ -1123,14 +1123,13 @@ struct mei_device *mei_txe_dev_init(struct pci_dev *pdev,if (!dev)return NULL ; -mei_device_init (dev, cfg); +mei_device_init (dev, &pdev->dev, &mei_txe_hw_ops); hw =to_txe_hw (dev);init_waitqueue_head (&hw->wait_aliveness_resp); - dev->ops = &mei_txe_hw_ops; - + dev->cfg = cfg; dev->pdev = pdev;return dev; }
drivers/misc/mei/init.c +12 -2
@@ -365,7 +365,16 @@ int mei_fw_status(struct mei_device *dev, struct mei_fw_status *fw_status) }EXPORT_SYMBOL_GPL (mei_fw_status); -void mei_device_init (struct mei_device *dev,const struct mei_cfg *cfg) +/** +* mei_device_init -- initialize mei_device structure +* +* @dev: the mei device +* @device: the device structure +* @hw_ops: hw operations +*/ +void mei_device_init (struct mei_device *dev, +struct device *device, +const struct mei_hw_ops *hw_ops) {/* setup our list array */ INIT_LIST_HEAD (&dev->file_list);
@@ -404,7 +413,8 @@ void mei_device_init(struct mei_device *dev, const struct mei_cfg *cfg)bitmap_set (dev->host_clients_map,0 ,1 ); dev->pg_event =MEI_PG_EVENT_IDLE ; - dev->cfg = cfg; + dev->ops = hw_ops; + dev->dev = device; }EXPORT_SYMBOL_GPL (mei_device_init);
drivers/misc/mei/mei_dev.h +5 -1
@@ -399,6 +399,7 @@ struct mei_cfg {* struct mei_device - MEI private device struct * @pdev - pointer to pci device struct +* @dev - device on a bus * @cdev - character device * @minor - minor number allocated for device *
@@ -417,6 +418,7 @@ struct mei_cfg {*/ struct mei_device {struct pci_dev *pdev;/* pointer to pci device struct */ +struct device *dev;struct cdev cdev;int minor;
@@ -560,7 +562,9 @@ static inline u32 mei_slots2data(int slots)/* * mei init function prototypes */ -void mei_device_init (struct mei_device *dev,const struct mei_cfg *cfg); +void mei_device_init (struct mei_device *dev, +struct device *device, +const struct mei_hw_ops *hw_ops);int mei_reset (struct mei_device *dev);int mei_start (struct mei_device *dev);int mei_restart (struct mei_device *dev);
Signature · 1 line
1.9.3
Greg KH
maintainerRe: [char-misc-next 1/6] mei: push all standard settings into mei_device_init
Quoted 7 lines · Tomas Winkler
Setting of
hw_opsand device has should be inmei_device_init.
We add reference to the parent device and remove
pci dependent cfgSigned-off-by Tomas Winkler <[email protected]>Signed-off-by Alexander Usyskin <[email protected]>
This series didn't apply, can you fix it up and resend?
thanks,
greg k-h
PATCH 2/6 mei: get rid of most of the pci dependencies in mei
In reply to Tomas WinklerFor purpose of adding testing HW we would like to get rid of pci dependency in generic mei code This patch provides only straight forward changes FW status and prob quirks need to be handled separately
--- drivers/misc/mei/amthif.c | 68 ++++++++++++++++++++++---------------------- drivers/misc/mei/bus.c | 10 +++---- drivers/misc/mei/client.c | 46 +++++++++++++++--------------- drivers/misc/mei/client.h | 4 +-- drivers/misc/mei/debugfs.c | 6 ++-- drivers/misc/mei/hbm.c | 66 +++++++++++++++++++++--------------------- drivers/misc/mei/hw-me.c | 30 +++++++++---------- drivers/misc/mei/hw-txe.c | 53 ++++++++++++++++------------------ drivers/misc/mei/init.c | 42 +++++++++++++-------------- drivers/misc/mei/interrupt.c | 44 ++++++++++++++-------------- drivers/misc/mei/main.c | 40 +++++++++++++------------- drivers/misc/mei/nfc.c | 43 +++++++++++++--------------- drivers/misc/mei/pci-me.c | 2 +- drivers/misc/mei/pci-txe.c | 2 +- drivers/misc/mei/wd.c | 34 ++++++++++------------ 15 files changed, 239 insertions(+), 251 deletions(-)
drivers/misc/mei/amthif.c +34 -34
@@ -78,7 +78,7 @@ int mei_amthif_host_init(struct mei_device *dev) me_cl =mei_me_cl_by_uuid (dev, &mei_amthif_guid);if (!me_cl) { -dev_info (&dev->pdev->dev,"amthif: failed to find the client" ); +dev_info (dev->dev,"amthif: failed to find the client" );return -ENOTTY ; }
@@ -88,7 +88,7 @@ int mei_amthif_host_init(struct mei_device *dev)/* Assign iamthif_mtu to the value received from ME */ dev->iamthif_mtu = me_cl->props.max_msg_length; -dev_dbg (&dev->pdev->dev,"IAMTHIF_MTU = %d\n" , dev->iamthif_mtu); +dev_dbg (dev->dev,"IAMTHIF_MTU = %d\n" , dev->iamthif_mtu);kfree (dev->iamthif_msg_buf); dev->iamthif_msg_buf =NULL ;
@@ -104,7 +104,7 @@ int mei_amthif_host_init(struct mei_device *dev) ret =mei_cl_link (cl,MEI_IAMTHIF_HOST_CLIENT_ID );if (ret <0 ) { -dev_err (&dev->pdev->dev, +dev_err (dev->dev,"amthif: failed link client %d\n" , ret);return ret; }
@@ -164,11 +164,11 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,/* Only possible if we are in timeout */ if (!cl) { -dev_err (&dev->pdev->dev,"bad file ext.\n" ); +dev_err (dev->dev,"bad file ext.\n" );return -ETIME ; } -dev_dbg (&dev->pdev->dev,"checking amthif data\n" ); +dev_dbg (dev->dev,"checking amthif data\n" ); cb =mei_amthif_find_read_list_entry (dev, file);/* Check for if we can block or not*/
@@ -176,7 +176,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,return -EAGAIN ; -dev_dbg (&dev->pdev->dev,"waiting for amthif data\n" ); +dev_dbg (dev->dev,"waiting for amthif data\n" );while (cb ==NULL ) {/* unlock the Mutex */ mutex_unlock (&dev->device_lock);
@@ -190,21 +190,21 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,if (wait_ret)return -ERESTARTSYS ; -dev_dbg (&dev->pdev->dev,"woke up from sleep\n" ); +dev_dbg (dev->dev,"woke up from sleep\n" ); } -dev_dbg (&dev->pdev->dev,"Got amthif data\n" ); +dev_dbg (dev->dev,"Got amthif data\n" ); dev->iamthif_timer =0 ;if (cb) { timeout = cb->read_time +mei_secs_to_jiffies (MEI_IAMTHIF_READ_TIMER ); -dev_dbg (&dev->pdev->dev,"amthif timeout = %lud\n" , +dev_dbg (dev->dev,"amthif timeout = %lud\n" , timeout);if (time_after (jiffies, timeout)) { -dev_dbg (&dev->pdev->dev,"amthif Time out\n" ); +dev_dbg (dev->dev,"amthif Time out\n" );/* 15 sec for the message has expired */ list_del (&cb->list); rets = -ETIME ;
@@ -224,16 +224,16 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,* remove message from deletion list */ -dev_dbg (&dev->pdev->dev,"amthif cb->response_buffer size - %d\n" , +dev_dbg (dev->dev,"amthif cb->response_buffer size - %d\n" , cb->response_buffer.size); -dev_dbg (&dev->pdev->dev,"amthif cb->buf_idx - %lu\n" , cb->buf_idx); +dev_dbg (dev->dev,"amthif cb->buf_idx - %lu\n" , cb->buf_idx);/* length is being truncated to PAGE_SIZE, however, * the buf_idx may point beyond */ length =min_t (size_t, length, (cb->buf_idx - *offset));if (copy_to_user (ubuf, cb->response_buffer.data + *offset, length)) { -dev_dbg (&dev->pdev->dev,"failed to copy data to userland\n" ); +dev_dbg (dev->dev,"failed to copy data to userland\n" ); rets = -EFAULT ; }else { rets = length;
@@ -243,7 +243,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, } } free: -dev_dbg (&dev->pdev->dev,"free amthif cb memory.\n" ); +dev_dbg (dev->dev,"free amthif cb memory.\n" ); *offset =0 ;mei_io_cb_free (cb); out:
@@ -267,7 +267,7 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)if (!dev || !cb)return -ENODEV ; -dev_dbg (&dev->pdev->dev,"write data to amthif client.\n" ); +dev_dbg (dev->dev,"write data to amthif client.\n" ); dev->iamthif_state =MEI_IAMTHIF_WRITING ; dev->iamthif_current_cb = cb;
@@ -306,12 +306,12 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)return -EIO ; dev->iamthif_flow_control_pending = true; dev->iamthif_state =MEI_IAMTHIF_FLOW_CONTROL ; -dev_dbg (&dev->pdev->dev,"add amthif cb to write waiting list\n" ); +dev_dbg (dev->dev,"add amthif cb to write waiting list\n" ); dev->iamthif_current_cb = cb; dev->iamthif_file_object = cb->file_object;list_add_tail (&cb->list, &dev->write_waiting_list.list); }else { -dev_dbg (&dev->pdev->dev,"message does not complete, so add amthif cb to write list.\n" ); +dev_dbg (dev->dev,"message does not complete, so add amthif cb to write list.\n" );list_add_tail (&cb->list, &dev->write_list.list); } }else {
@@ -344,9 +344,9 @@ int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb)if (!list_empty (&dev->amthif_cmd_list.list) || dev->iamthif_state !=MEI_IAMTHIF_IDLE ) { -dev_dbg (&dev->pdev->dev, +dev_dbg (dev->dev,"amthif state = %d\n" , dev->iamthif_state); -dev_dbg (&dev->pdev->dev,"AMTHIF: add cb to the wait list\n" ); +dev_dbg (dev->dev,"AMTHIF: add cb to the wait list\n" );list_add_tail (&cb->list, &dev->amthif_cmd_list.list);return 0 ; }
@@ -376,7 +376,7 @@ void mei_amthif_run_next_cmd(struct mei_device *dev) dev->iamthif_timer =0 ; dev->iamthif_file_object =NULL ; -dev_dbg (&dev->pdev->dev,"complete amthif cmd_list cb.\n" ); +dev_dbg (dev->dev,"complete amthif cmd_list cb.\n" );list_for_each_entry_safe (cb, next, &dev->amthif_cmd_list.list, list) {list_del (&cb->list);
@@ -384,7 +384,7 @@ void mei_amthif_run_next_cmd(struct mei_device *dev)continue ; status =mei_amthif_send_cmd (dev, cb);if (status) -dev_warn (&dev->pdev->dev,"amthif write failed status = %d\n" , +dev_warn (dev->dev,"amthif write failed status = %d\n" , status);break ; }
@@ -407,7 +407,7 @@ unsigned int mei_amthif_poll(struct mei_device *dev, dev->iamthif_file_object == file) { mask |= (POLLIN |POLLRDNORM ); -dev_dbg (&dev->pdev->dev,"run next amthif cb\n" ); +dev_dbg (dev->dev,"run next amthif cb\n" );mei_amthif_run_next_cmd (dev); }mutex_unlock (&dev->device_lock);
@@ -467,7 +467,7 @@ int mei_amthif_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,return 0 ; } -dev_dbg (&dev->pdev->dev,MEI_HDR_FMT ,MEI_HDR_PRM (&mei_hdr)); +dev_dbg (dev->dev,MEI_HDR_FMT ,MEI_HDR_PRM (&mei_hdr)); rets =mei_write_message (dev, &mei_hdr, dev->iamthif_msg_buf + dev->iamthif_msg_buf_index);
@@ -529,10 +529,10 @@ int mei_amthif_irq_read_msg(struct mei_device *dev,if (!mei_hdr->msg_complete)return 0 ; -dev_dbg (&dev->pdev->dev,"amthif_message_buffer_index =%d\n" , +dev_dbg (dev->dev,"amthif_message_buffer_index =%d\n" , mei_hdr->length); -dev_dbg (&dev->pdev->dev,"completed amthif read.\n " ); +dev_dbg (dev->dev,"completed amthif read.\n " );if (!dev->iamthif_current_cb)return -ENODEV ;
@@ -547,8 +547,8 @@ int mei_amthif_irq_read_msg(struct mei_device *dev, cb->read_time = jiffies;if (dev->iamthif_ioctl) {/* found the iamthif cb */ -dev_dbg (&dev->pdev->dev,"complete the amthif read cb.\n " ); -dev_dbg (&dev->pdev->dev,"add the amthif read cb to complete.\n " ); +dev_dbg (dev->dev,"complete the amthif read cb.\n " ); +dev_dbg (dev->dev,"add the amthif read cb to complete.\n " );list_add_tail (&cb->list, &complete_list->list); }return 0 ;
@@ -572,11 +572,11 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots) *slots -= msg_slots;if (mei_hbm_cl_flow_control_req (dev, &dev->iamthif_cl)) { -dev_dbg (&dev->pdev->dev,"iamthif flow control failed\n" ); +dev_dbg (dev->dev,"iamthif flow control failed\n" );return -EIO ; } -dev_dbg (&dev->pdev->dev,"iamthif flow control success\n" ); +dev_dbg (dev->dev,"iamthif flow control success\n" ); dev->iamthif_state =MEI_IAMTHIF_READING ; dev->iamthif_flow_control_pending = false; dev->iamthif_msg_buf_index =0 ;
@@ -601,15 +601,15 @@ void mei_amthif_complete(struct mei_device *dev, struct mei_cl_cb *cb) dev->iamthif_msg_buf, dev->iamthif_msg_buf_index);list_add_tail (&cb->list, &dev->amthif_rd_complete_list.list); -dev_dbg (&dev->pdev->dev,"amthif read completed\n" ); +dev_dbg (dev->dev,"amthif read completed\n" ); dev->iamthif_timer = jiffies; -dev_dbg (&dev->pdev->dev,"dev->iamthif_timer = %ld\n" , +dev_dbg (dev->dev,"dev->iamthif_timer = %ld\n" , dev->iamthif_timer); }else {mei_amthif_run_next_cmd (dev); } -dev_dbg (&dev->pdev->dev,"completing amthif call back.\n" ); +dev_dbg (dev->dev,"completing amthif call back.\n" );wake_up_interruptible (&dev->iamthif_cl.wait); }
@@ -715,11 +715,11 @@ int mei_amthif_release(struct mei_device *dev, struct file *file)if (dev->iamthif_file_object == file && dev->iamthif_state !=MEI_IAMTHIF_IDLE ) { -dev_dbg (&dev->pdev->dev,"amthif canceled iamthif state %d\n" , +dev_dbg (dev->dev,"amthif canceled iamthif state %d\n" , dev->iamthif_state); dev->iamthif_canceled = true;if (dev->iamthif_state ==MEI_IAMTHIF_READ_COMPLETE ) { -dev_dbg (&dev->pdev->dev,"run next amthif iamthif cb\n" ); +dev_dbg (dev->dev,"run next amthif iamthif cb\n" );mei_amthif_run_next_cmd (dev); } }
drivers/misc/mei/bus.c +5 -5
@@ -172,7 +172,7 @@ struct mei_cl_device *mei_cl_add_device(struct mei_device *dev, device->cl = cl; device->ops = ops; - device->dev.parent = &dev->pdev->dev; + device->dev.parent = dev->dev; device->dev.bus = &mei_cl_bus_type; device->dev.type = &mei_cl_device_type;
@@ -180,7 +180,7 @@ struct mei_cl_device *mei_cl_add_device(struct mei_device *dev, status =device_register (&device->dev);if (status) { -dev_err (&dev->pdev->dev,"Failed to register MEI device\n" ); +dev_err (dev->dev,"Failed to register MEI device\n" );kfree (device);return NULL ; }
@@ -430,7 +430,7 @@ int mei_cl_enable_device(struct mei_cl_device *device) err =mei_cl_connect (cl,NULL );if (err <0 ) {mutex_unlock (&dev->device_lock); -dev_err (&dev->pdev->dev,"Could not connect to the ME client" ); +dev_err (dev->dev,"Could not connect to the ME client" );return err; }
@@ -462,7 +462,7 @@ int mei_cl_disable_device(struct mei_cl_device *device)if (cl->state !=MEI_FILE_CONNECTED ) {mutex_unlock (&dev->device_lock); -dev_err (&dev->pdev->dev,"Already disconnected" ); +dev_err (dev->dev,"Already disconnected" );return 0 ; }
@@ -472,7 +472,7 @@ int mei_cl_disable_device(struct mei_cl_device *device) err =mei_cl_disconnect (cl);if (err <0 ) {mutex_unlock (&dev->device_lock); -dev_err (&dev->pdev->dev, +dev_err (dev->dev,"Could not disconnect from the ME client" );return err;
drivers/misc/mei/client.c +23 -23
125 lines not on this page · raw message
drivers/misc/mei/client.h +2 -2
@@ -110,9 +110,9 @@ void mei_cl_all_write_clear(struct mei_device *dev);#define MEI_CL_PRM (cl) (cl)->host_client_id, (cl)->me_client_id #define cl_dbg(dev, cl, format, arg...) \ - dev_dbg(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg) + dev_dbg((dev)->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg) #define cl_err(dev, cl, format, arg...) \ - dev_err(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg) + dev_err((dev)->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)#endif /* _MEI_CLIENT_H_ */
drivers/misc/mei/debugfs.c +3 -3
@@ -187,19 +187,19 @@ int mei_dbgfs_register(struct mei_device *dev, const char *name) f =debugfs_create_file ("meclients" ,S_IRUSR , dir, dev, &mei_dbgfs_fops_meclients);if (!f) { -dev_err (&dev->pdev->dev,"meclients: registration failed\n" ); +dev_err (dev->dev,"meclients: registration failed\n" ); goto err; } f =debugfs_create_file ("active" ,S_IRUSR , dir, dev, &mei_dbgfs_fops_active);if (!f) { -dev_err (&dev->pdev->dev,"meclients: registration failed\n" ); +dev_err (dev->dev,"meclients: registration failed\n" ); goto err; } f =debugfs_create_file ("devstate" ,S_IRUSR , dir, dev, &mei_dbgfs_fops_devstate);if (!f) { -dev_err (&dev->pdev->dev,"devstate: registration failed\n" ); +dev_err (dev->dev,"devstate: registration failed\n" ); goto err; } dev->dbgfs_dir = dir;
drivers/misc/mei/hbm.c +33 -33
243 lines not on this page · raw message
drivers/misc/mei/hw-me.c +15 -15
@@ -217,10 +217,10 @@ static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable) hcsr =mei_hcsr_read (hw);if ((hcsr &H_RST ) ==0 ) -dev_warn (&dev->pdev->dev,"H_RST is not set = 0x%08X" , hcsr); +dev_warn (dev->dev,"H_RST is not set = 0x%08X" , hcsr);if ((hcsr &H_RDY ) ==H_RDY ) -dev_warn (&dev->pdev->dev,"H_RDY is not cleared 0x%08X" , hcsr); +dev_warn (dev->dev,"H_RDY is not cleared 0x%08X" , hcsr);if (intr_enable == false)mei_me_hw_reset_release (dev);
@@ -279,7 +279,7 @@ static int mei_me_hw_ready_wait(struct mei_device *dev) mei_secs_to_jiffies(MEI_HW_READY_TIMEOUT));mutex_lock (&dev->device_lock);if (!dev->recvd_hw_ready) { -dev_err (&dev->pdev->dev,"wait hw ready failed\n" ); +dev_err (dev->dev,"wait hw ready failed\n" );return -ETIME ; }
@@ -293,7 +293,7 @@ static int mei_me_hw_start(struct mei_device *dev)if (ret)return ret; -dev_dbg (&dev->pdev->dev,"hw is ready\n" ); +dev_dbg (dev->dev,"hw is ready\n" );mei_me_host_set_ready (dev);return ret;
@@ -381,10 +381,10 @@ static int mei_me_write_message(struct mei_device *dev,int i;int empty_slots; -dev_dbg (&dev->pdev->dev,MEI_HDR_FMT ,MEI_HDR_PRM (header)); +dev_dbg (dev->dev,MEI_HDR_FMT ,MEI_HDR_PRM (header)); empty_slots =mei_hbuf_empty_slots (dev); -dev_dbg (&dev->pdev->dev,"empty slots = %hu.\n" , empty_slots); +dev_dbg (dev->dev,"empty slots = %hu.\n" , empty_slots); dw_cnt =mei_data2slots (length);if (empty_slots <0 || dw_cnt > empty_slots)
@@ -434,7 +434,7 @@ static int mei_me_count_full_read_slots(struct mei_device *dev)if (filled_slots > buffer_depth)return -EOVERFLOW ; -dev_dbg (&dev->pdev->dev,"filled_slots =%08x\n" , filled_slots); +dev_dbg (dev->dev,"filled_slots =%08x\n" , filled_slots);return (int )filled_slots; }
@@ -591,7 +591,7 @@ static bool mei_me_pg_is_enabled(struct mei_device *dev)return true; notsupported: - dev_dbg(&dev->pdev->dev, "pg: not supported: HGP = %d hbm version %d.%d ?= %d.%d\n", + dev_dbg(dev->dev, "pg: not supported: HGP = %d hbm version %d.%d ?= %d.%d\n", !!(reg & ME_PGIC_HRA), dev->version.major_version, dev->version.minor_version,
@@ -642,7 +642,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)s32 slots;int rets =0 ; -dev_dbg (&dev->pdev->dev,"function called after ISR to handle the interrupt processing.\n" ); +dev_dbg (dev->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);
@@ -654,7 +654,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)/* check if ME wants a reset */ if (!mei_hw_is_ready (dev) && dev->dev_state !=MEI_DEV_RESETTING ) { -dev_warn (&dev->pdev->dev,"FW not ready: resetting.\n" ); +dev_warn (dev->dev,"FW not ready: resetting.\n" );schedule_work (&dev->reset_work); goto end; }
@@ -663,19 +663,19 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)if (!mei_host_is_ready (dev)) {if (mei_hw_is_ready (dev)) {mei_me_hw_reset_release (dev); -dev_dbg (&dev->pdev->dev,"we need to start the dev.\n" ); +dev_dbg (dev->dev,"we need to start the dev.\n" ); dev->recvd_hw_ready = true;wake_up (&dev->wait_hw_ready); }else { -dev_dbg (&dev->pdev->dev,"Spurious Interrupt\n" ); +dev_dbg (dev->dev,"Spurious Interrupt\n" ); } goto end; }/* check slots available for reading */ slots =mei_count_full_read_slots (dev);while (slots >0 ) { -dev_dbg (&dev->pdev->dev,"slots to read = %08x\n" , slots); +dev_dbg (dev->dev,"slots to read = %08x\n" , slots); rets =mei_irq_read_handler (dev, &complete_list, &slots);/* There is a race between ME write and interrupt delivery: * Not all data is always available immediately after the
@@ -685,7 +685,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)break ;if (rets && dev->dev_state !=MEI_DEV_RESETTING ) { -dev_err (&dev->pdev->dev,"mei_irq_read_handler ret = %d.\n" , +dev_err (dev->dev,"mei_irq_read_handler ret = %d.\n" , rets);schedule_work (&dev->reset_work); goto end;
@@ -707,7 +707,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)mei_irq_compl_handler (dev, &complete_list); end: -dev_dbg (&dev->pdev->dev,"interrupt thread end ret = %d\n" , rets); +dev_dbg (dev->dev,"interrupt thread end ret = %d\n" , rets);mutex_unlock (&dev->device_lock);return IRQ_HANDLED ; }
drivers/misc/mei/hw-txe.c +25 -28
194 lines not on this page · raw message
drivers/misc/mei/init.c +21 -21
148 lines not on this page · raw message
drivers/misc/mei/interrupt.c +22 -22
153 lines not on this page · raw message
drivers/misc/mei/main.c +20 -20
@@ -63,7 +63,7 @@ static int mei_open(struct inode *inode, struct file *file) err = -ENODEV ;if (dev->dev_state !=MEI_DEV_ENABLED ) { -dev_dbg (&dev->pdev->dev,"dev_state != MEI_ENABLED dev_state = %s\n" , +dev_dbg (dev->dev,"dev_state != MEI_ENABLED dev_state = %s\n" ,mei_dev_state_str (dev->dev_state)); goto err_unlock; }
@@ -211,7 +211,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf, err =mei_cl_read_start (cl, length);if (err && err != -EBUSY ) { -dev_dbg (&dev->pdev->dev, +dev_dbg (dev->dev,"mei start read failure with status = %d\n" , err); rets = err; goto out;
@@ -254,7 +254,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf, }/* now copy the data to user space */ copy_buffer: -dev_dbg (&dev->pdev->dev,"buf.size = %d buf.idx= %ld\n" , +dev_dbg (dev->dev,"buf.size = %d buf.idx= %ld\n" , cb->response_buffer.size, cb->buf_idx);if (length ==0 || ubuf ==NULL || *offset > cb->buf_idx) { rets = -EMSGSIZE ;
@@ -266,7 +266,7 @@ copy_buffer: length =min_t (size_t, length, cb->buf_idx - *offset);if (copy_to_user (ubuf, cb->response_buffer.data + *offset, length)) { -dev_dbg (&dev->pdev->dev,"failed to copy data to userland\n" ); +dev_dbg (dev->dev,"failed to copy data to userland\n" ); rets = -EFAULT ; goto free; }
@@ -285,7 +285,7 @@ free: cl->reading_state =MEI_IDLE ; cl->read_cb =NULL ; out: -dev_dbg (&dev->pdev->dev,"end mei read rets= %d\n" , rets); +dev_dbg (dev->dev,"end mei read rets= %d\n" , rets);mutex_unlock (&dev->device_lock);return rets; }
@@ -338,7 +338,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, }if (cl->state !=MEI_FILE_CONNECTED ) { -dev_err (&dev->pdev->dev,"host client = %d, is not connected to ME client = %d" , +dev_err (dev->dev,"host client = %d, is not connected to ME client = %d" , cl->host_client_id, cl->me_client_id); rets = -ENODEV ; goto out;
@@ -386,7 +386,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, rets =copy_from_user (write_cb->request_buffer.data, ubuf, length);if (rets) { -dev_dbg (&dev->pdev->dev,"failed to copy data from userland\n" ); +dev_dbg (dev->dev,"failed to copy data from userland\n" ); rets = -EFAULT ; goto out; }
@@ -395,7 +395,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, rets =mei_amthif_write (dev, write_cb);if (rets) { -dev_err (&dev->pdev->dev, +dev_err (dev->dev,"amthif write failed with status = %d\n" , rets); goto out; }
@@ -448,7 +448,7 @@ static int mei_ioctl_connect_client(struct file *file,/* find ME client we're trying to connect to */ me_cl =mei_me_cl_by_uuid (dev, &data->in_client_uuid);if (!me_cl || me_cl->props.fixed_address) { -dev_dbg (&dev->pdev->dev,"Cannot connect to FW Client UUID = %pUl\n" , +dev_dbg (dev->dev,"Cannot connect to FW Client UUID = %pUl\n" , &data->in_client_uuid); rets = -ENOTTY ; goto end;
@@ -457,18 +457,18 @@ static int mei_ioctl_connect_client(struct file *file, cl->me_client_id = me_cl->client_id; cl->cl_uuid = me_cl->props.protocol_name; -dev_dbg (&dev->pdev->dev,"Connect to FW Client ID = %d\n" , +dev_dbg (dev->dev,"Connect to FW Client ID = %d\n" , cl->me_client_id); -dev_dbg (&dev->pdev->dev,"FW Client - Protocol Version = %d\n" , +dev_dbg (dev->dev,"FW Client - Protocol Version = %d\n" , me_cl->props.protocol_version); -dev_dbg (&dev->pdev->dev,"FW Client - Max Msg Len = %d\n" , +dev_dbg (dev->dev,"FW Client - Max Msg Len = %d\n" , me_cl->props.max_msg_length);/* if we're connecting to amthif client then we will use the * existing connection */ if (uuid_le_cmp (data->in_client_uuid, mei_amthif_guid) ==0 ) { -dev_dbg (&dev->pdev->dev,"FW Client is amthi\n" ); +dev_dbg (dev->dev,"FW Client is amthi\n" );if (dev->iamthif_cl.state !=MEI_FILE_CONNECTED ) { rets = -ENODEV ; goto end;
@@ -493,7 +493,7 @@ static int mei_ioctl_connect_client(struct file *file, client = &data->out_client_properties; client->max_msg_length = me_cl->props.max_msg_length; client->protocol_version = me_cl->props.protocol_version; -dev_dbg (&dev->pdev->dev,"Can connect?\n" ); +dev_dbg (dev->dev,"Can connect?\n" ); rets =mei_cl_connect (cl, file);
@@ -524,7 +524,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data) dev = cl->dev; -dev_dbg (&dev->pdev->dev,"IOCTL cmd = 0x%x" , cmd); +dev_dbg (dev->dev,"IOCTL cmd = 0x%x" , cmd);mutex_lock (&dev->device_lock);if (dev->dev_state !=MEI_DEV_ENABLED ) {
@@ -534,10 +534,10 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)switch (cmd) {case IOCTL_MEI_CONNECT_CLIENT : -dev_dbg (&dev->pdev->dev,": IOCTL_MEI_CONNECT_CLIENT.\n" ); +dev_dbg (dev->dev,": IOCTL_MEI_CONNECT_CLIENT.\n" );if (copy_from_user (&connect_data, (char __user *)data,sizeof (struct mei_connect_client_data ))) { -dev_dbg (&dev->pdev->dev,"failed to copy data from userland\n" ); +dev_dbg (dev->dev,"failed to copy data from userland\n" ); rets = -EFAULT ; goto out; }
@@ -549,7 +549,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)/* if all is ok, copying the data back to user. */ if (copy_to_user ((char __user *)data, &connect_data,sizeof (struct mei_connect_client_data ))) { -dev_dbg (&dev->pdev->dev,"failed to copy data to userland\n" ); +dev_dbg (dev->dev,"failed to copy data to userland\n" ); rets = -EFAULT ; goto out; }
@@ -557,7 +557,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)break ;default : -dev_err (&dev->pdev->dev,": unsupported ioctl %d.\n" , cmd); +dev_err (dev->dev,": unsupported ioctl %d.\n" , cmd); rets = -ENOIOCTLCMD ; }
@@ -671,7 +671,7 @@ static int mei_minor_get(struct mei_device *dev)if (ret >=0 ) dev->minor = ret;else if (ret == -ENOSPC ) -dev_err (&dev->pdev->dev,"too many mei devices\n" ); +dev_err (dev->dev,"too many mei devices\n" );mutex_unlock (&mei_minor_lock);return ret;
drivers/misc/mei/nfc.c +19 -24
147 lines not on this page · raw message
drivers/misc/mei/pci-me.c +1 -1
@@ -451,7 +451,7 @@ static inline void mei_me_set_pm_domain(struct mei_device *dev)static inline void mei_me_unset_pm_domain (struct mei_device *dev) {/* stop using pm callbacks if any */ - dev->pdev->dev.pm_domain =NULL ; + dev->dev->pm_domain =NULL ; }#endif /* CONFIG_PM_RUNTIME */
drivers/misc/mei/pci-txe.c +1 -1
@@ -399,7 +399,7 @@ static inline void mei_txe_set_pm_domain(struct mei_device *dev)static inline void mei_txe_unset_pm_domain (struct mei_device *dev) {/* stop using pm callbacks if any */ - dev->pdev->dev.pm_domain =NULL ; + dev->dev->pm_domain =NULL ; }#endif /* CONFIG_PM_RUNTIME */
drivers/misc/mei/wd.c +15 -19
@@ -42,7 +42,7 @@ const uuid_le mei_wd_guid = UUID_LE(0x05B79A6F, 0x4628, 0x4D7F, 0x89,static void mei_wd_set_start_timeout (struct mei_device *dev,u16 timeout) { -dev_dbg (&dev->pdev->dev,"wd: set timeout=%d.\n" , timeout); +dev_dbg (dev->dev,"wd: set timeout=%d.\n" , timeout);memcpy (dev->wd_data, mei_start_wd_params,MEI_WD_HDR_SIZE );memcpy (dev->wd_data +MEI_WD_HDR_SIZE , &timeout,sizeof (u16)); }
@@ -71,7 +71,7 @@ int mei_wd_host_init(struct mei_device *dev)/* check for valid client id */ me_cl =mei_me_cl_by_uuid (dev, &mei_wd_guid);if (!me_cl) { -dev_info (&dev->pdev->dev,"wd: failed to find the client\n" ); +dev_info (dev->dev,"wd: failed to find the client\n" );return -ENOTTY ; }
@@ -81,14 +81,14 @@ int mei_wd_host_init(struct mei_device *dev) ret =mei_cl_link (cl,MEI_WD_HOST_CLIENT_ID );if (ret <0 ) { -dev_info (&dev->pdev->dev,"wd: failed link client\n" ); +dev_info (dev->dev,"wd: failed link client\n" );return ret; } ret =mei_cl_connect (cl,NULL );if (ret) { -dev_err (&dev->pdev->dev,"wd: failed to connect = %d\n" , ret); +dev_err (dev->dev,"wd: failed to connect = %d\n" , ret);mei_cl_unlink (cl);return ret; }
@@ -128,19 +128,19 @@ int mei_wd_send(struct mei_device *dev)else if (!memcmp (dev->wd_data, mei_stop_wd_params,MEI_WD_HDR_SIZE )) hdr.length =MEI_WD_STOP_MSG_SIZE ;else { -dev_err (&dev->pdev->dev,"wd: invalid message is to be sent, aborting\n" ); +dev_err (dev->dev,"wd: invalid message is to be sent, aborting\n" );return -EINVAL ; } ret =mei_write_message (dev, &hdr, dev->wd_data);if (ret) { -dev_err (&dev->pdev->dev,"wd: write message failed\n" ); +dev_err (dev->dev,"wd: write message failed\n" );return ret; } ret =mei_cl_flow_ctrl_reduce (cl);if (ret) { -dev_err (&dev->pdev->dev,"wd: flow_ctrl_reduce failed.\n" ); +dev_err (dev->dev,"wd: flow_ctrl_reduce failed.\n" );return ret; }
@@ -193,11 +193,10 @@ int mei_wd_stop(struct mei_device *dev)if (dev->wd_state !=MEI_WD_IDLE ) {/* timeout */ ret = -ETIME ; -dev_warn (&dev->pdev->dev, -"wd: stop failed to complete ret=%d.\n" , ret); +dev_warn (dev->dev,"wd: stop failed to complete ret=%d\n" , ret); goto err; } -dev_dbg (&dev->pdev->dev,"wd: stop completed after %u msec\n" , +dev_dbg (dev->dev,"wd: stop completed after %u msec\n" ,MEI_WD_STOP_TIMEOUT -jiffies_to_msecs (ret));return 0 ; err:
@@ -223,15 +222,13 @@ static int mei_wd_ops_start(struct watchdog_device *wd_dev)mutex_lock (&dev->device_lock);if (dev->dev_state !=MEI_DEV_ENABLED ) { -dev_dbg (&dev->pdev->dev, -"wd: dev_state != MEI_DEV_ENABLED dev_state = %s\n" , +dev_dbg (dev->dev,"wd: dev_state != MEI_DEV_ENABLED dev_state = %s\n" ,mei_dev_state_str (dev->dev_state)); goto end_unlock; }if (dev->wd_cl.state !=MEI_FILE_CONNECTED ) { -dev_dbg (&dev->pdev->dev, -"MEI Driver is not connected to Watchdog Client\n" ); +dev_dbg (dev->dev,"MEI Driver is not connected to Watchdog Client\n" ); goto end_unlock; }
@@ -284,7 +281,7 @@ static int mei_wd_ops_ping(struct watchdog_device *wd_dev)mutex_lock (&dev->device_lock);if (dev->wd_cl.state !=MEI_FILE_CONNECTED ) { -dev_err (&dev->pdev->dev,"wd: not connected.\n" ); +dev_err (dev->dev,"wd: not connected.\n" ); ret = -ENODEV ; goto end; }
@@ -297,7 +294,7 @@ static int mei_wd_ops_ping(struct watchdog_device *wd_dev)/* Check if we can send the ping to HW*/ if (ret &&mei_hbuf_acquire (dev)) { -dev_dbg (&dev->pdev->dev,"wd: sending ping\n" ); +dev_dbg (dev->dev,"wd: sending ping\n" ); ret =mei_wd_send (dev);if (ret)
@@ -380,13 +377,12 @@ int mei_watchdog_register(struct mei_device *dev) ret =watchdog_register_device (&amt_wd_dev);mutex_lock (&dev->device_lock);if (ret) { -dev_err (&dev->pdev->dev,"wd: unable to register watchdog device = %d.\n" , +dev_err (dev->dev,"wd: unable to register watchdog device = %d.\n" , ret);return ret; } -dev_dbg (&dev->pdev->dev, -"wd: successfully register watchdog interface.\n" ); +dev_dbg (dev->dev,"wd: successfully register watchdog interface.\n" );watchdog_set_drvdata (&amt_wd_dev, dev);return 0 ; }
Signature · 1 line
1.9.3
PATCH 3/6 mei: move fw_status back to hw ops handlers
In reply to Tomas Winklerfw status retrieval has pci specific implementation so we push it back to the hw layer
--- drivers/misc/mei/hw-me.c | 28 ++++++++++++++++++++++++++++ drivers/misc/mei/hw-txe.c | 30 ++++++++++++++++++++++++++++++ drivers/misc/mei/init.c | 21 --------------------- drivers/misc/mei/mei_dev.h | 9 ++++++++- 4 files changed, 66 insertions(+), 22 deletions(-)
drivers/misc/mei/hw-me.c +28 -0
@@ -101,6 +101,33 @@ static inline void mei_hcsr_set(struct mei_me_hw *hw, u32 hcsr)mei_me_reg_write (hw,H_CSR , hcsr); } +/** +* mei_me_fw_status - read fw status register from pci config space +* +* @dev: mei device +* @fw_status: fw status register values +*/ +static int mei_me_fw_status (struct mei_device *dev, +struct mei_fw_status *fw_status) +{ +const struct mei_fw_status *fw_src = &dev->cfg->fw_status; +struct pci_dev *pdev =to_pci_dev (dev->dev); +int ret; +int i; + +if (!fw_status) +return -EINVAL ; + + fw_status->count = fw_src->count; +for (i =0 ; i < fw_src->count && i <MEI_FW_STATUS_MAX ; i++) { + ret =pci_read_config_dword (pdev, + fw_src->status[i], &fw_status->status[i]); +if (ret) +return ret; + } + +return 0 ; +}/** * mei_me_hw_config - configure hw dependent settings
@@ -714,6 +741,7 @@ end:static const struct mei_hw_ops mei_me_hw_ops = { + .fw_status = mei_me_fw_status, .pg_state = mei_me_pg_state, .host_is_ready = mei_me_host_is_ready,
drivers/misc/mei/hw-txe.c +30 -0
@@ -573,6 +573,35 @@ static int mei_txe_readiness_wait(struct mei_device *dev)return 0 ; } + +/** +* mei_txe_fw_status - read fw status register from pci config space +* +* @dev: mei device +* @fw_status: fw status register values +*/ +static int mei_txe_fw_status (struct mei_device *dev, +struct mei_fw_status *fw_status) +{ +const struct mei_fw_status *fw_src = &dev->cfg->fw_status; +struct pci_dev *pdev =to_pci_dev (dev->dev); +int ret; +int i; + +if (!fw_status) +return -EINVAL ; + + fw_status->count = fw_src->count; +for (i =0 ; i < fw_src->count && i <MEI_FW_STATUS_MAX ; i++) { + ret =pci_read_config_dword (pdev, + fw_src->status[i], &fw_status->status[i]); +if (ret) +return ret; + } + +return 0 ; +} +/** * mei_txe_hw_config - configure hardware at the start of the devices *
@@ -1064,6 +1093,7 @@ static const struct mei_hw_ops mei_txe_hw_ops = { .host_is_ready = mei_txe_host_is_ready, + .fw_status = mei_txe_fw_status, .pg_state = mei_txe_pg_state, .hw_is_ready = mei_txe_hw_is_ready,
drivers/misc/mei/init.c +0 -21
@@ -344,27 +344,6 @@ bool mei_write_is_idle(struct mei_device *dev) }EXPORT_SYMBOL_GPL (mei_write_is_idle); -int mei_fw_status (struct mei_device *dev,struct mei_fw_status *fw_status) -{ -const struct mei_fw_status *fw_src = &dev->cfg->fw_status; -int ret; -int i; - -if (!fw_status) -return -EINVAL ; - - fw_status->count = fw_src->count; -for (i =0 ; i < fw_src->count && i <MEI_FW_STATUS_MAX ; i++) { - ret =pci_read_config_dword (dev->pdev, - fw_src->status[i], &fw_status->status[i]); -if (ret) -return ret; - } - -return 0 ; -} -EXPORT_SYMBOL_GPL (mei_fw_status); -/** * mei_device_init -- initialize mei_device structure *
drivers/misc/mei/mei_dev.h +8 -1
@@ -233,6 +233,7 @@ struct mei_cl {* @hw_start - start hw after reset * @hw_config - configure hw +* @fw_status - get fw status registers * @pg_state - power gating state of the device * @pg_is_enabled - is power gating enabled
@@ -260,6 +261,8 @@ struct mei_hw_ops {int (*hw_start)(struct mei_device *dev);void (*hw_config)(struct mei_device *dev); + +int (*fw_status)(struct mei_device *dev,struct mei_fw_status *fw_sts);enum mei_pg_state (*pg_state)(struct mei_device *dev);bool (*pg_is_enabled)(struct mei_device *dev);
@@ -731,7 +734,11 @@ static inline int mei_count_full_read_slots(struct mei_device *dev)return dev->ops->rdbuf_full_slots (dev); } -int mei_fw_status (struct mei_device *dev,struct mei_fw_status *fw_status); +static inline int mei_fw_status (struct mei_device *dev, +struct mei_fw_status *fw_status) +{ +return dev->ops->fw_status (dev, fw_status); +}#define FW_STS_FMT "%08X %08X"#define FW_STS_PRM (fw_status) \
Signature · 1 line
1.9.3
PATCH 4/6 mei: remove the reference to pdev from mei_deivce
In reply to Tomas WinklerFor purpose of adding testing HW we would like
to get rid of pci dependency in generic mei code.
--- drivers/misc/mei/hw-me.c | 3 +-- drivers/misc/mei/hw-txe.c | 3 +-- drivers/misc/mei/mei_dev.h | 2 -- drivers/misc/mei/pci-me.c | 2 +- drivers/misc/mei/pci-txe.c | 2 +- 5 files changed, 4 insertions(+), 8 deletions(-)
drivers/misc/mei/hw-me.c +1 -2
@@ -676,7 +676,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)/* Ack the interrupt here * In case of MSI we don't go through the quick handler */ -if (pci_dev_msi_enabled (dev->pdev)) +if (pci_dev_msi_enabled (to_pci_dev (dev->dev)))mei_clear_interrupts (dev);/* check if ME wants a reset */
@@ -854,7 +854,6 @@ struct mei_device *mei_me_dev_init(struct pci_dev *pdev,mei_device_init (dev, &pdev->dev, &mei_me_hw_ops); dev->cfg = cfg; - dev->pdev = pdev;return dev; }
drivers/misc/mei/hw-txe.c +1 -2
@@ -998,7 +998,7 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id)mutex_lock (&dev->device_lock);mei_io_list_init (&complete_list); -if (pci_dev_msi_enabled (dev->pdev)) +if (pci_dev_msi_enabled (to_pci_dev (dev->dev)))mei_txe_check_and_ack_intrs (dev, true);/* show irq events */
@@ -1157,7 +1157,6 @@ struct mei_device *mei_txe_dev_init(struct pci_dev *pdev,init_waitqueue_head (&hw->wait_aliveness_resp); dev->cfg = cfg; - dev->pdev = pdev;return dev; }
drivers/misc/mei/mei_dev.h +0 -2
@@ -401,7 +401,6 @@ struct mei_cfg {/** * struct mei_device - MEI private device struct -* @pdev - pointer to pci device struct * @dev - device on a bus * @cdev - character device * @minor - minor number allocated for device
@@ -420,7 +419,6 @@ struct mei_cfg {* @cfg - per device generation config and ops */ struct mei_device { -struct pci_dev *pdev;/* pointer to pci device struct */ struct device *dev;struct cdev cdev;int minor;
drivers/misc/mei/pci-me.c +1 -1
@@ -430,7 +430,7 @@ static int mei_me_pm_runtime_resume(struct device *device)*/ static inline void mei_me_set_pm_domain (struct mei_device *dev) { -struct pci_dev *pdev = dev->pdev; +struct pci_dev *pdev =to_pci_dev (dev->dev);if (pdev->dev.bus && pdev->dev.bus->pm) { dev->pg_domain.ops = *pdev->dev.bus->pm;
drivers/misc/mei/pci-txe.c +1 -1
@@ -378,7 +378,7 @@ static int mei_txe_pm_runtime_resume(struct device *device)*/ static inline void mei_txe_set_pm_domain (struct mei_device *dev) { -struct pci_dev *pdev = dev->pdev; +struct pci_dev *pdev =to_pci_dev (dev->dev);if (pdev->dev.bus && pdev->dev.bus->pm) { dev->pg_domain.ops = *pdev->dev.bus->pm;
Signature · 1 line
1.9.3
PATCH 5/6 mei: push pci cfg structure me hw
In reply to Tomas WinklerDevice specific configurations are currently only needed by me hw so we can remove it from txe
--- drivers/misc/mei/hw-me.c | 7 +++++-- drivers/misc/mei/hw-me.h | 26 +++++++++++++++++++++++++- drivers/misc/mei/hw-txe.c | 22 +++++++--------------- drivers/misc/mei/hw-txe.h | 5 +---- drivers/misc/mei/mei_dev.h | 20 -------------------- drivers/misc/mei/pci-txe.c | 6 +++--- 6 files changed, 41 insertions(+), 45 deletions(-)
drivers/misc/mei/hw-me.c +5 -2
@@ -110,8 +110,9 @@ static inline void mei_hcsr_set(struct mei_me_hw *hw, u32 hcsr)static int mei_me_fw_status (struct mei_device *dev,struct mei_fw_status *fw_status) { -const struct mei_fw_status *fw_src = &dev->cfg->fw_status;struct pci_dev *pdev =to_pci_dev (dev->dev); +struct mei_me_hw *hw =to_me_hw (dev); +const struct mei_fw_status *fw_src = &hw->cfg->fw_status;int ret;int i;
@@ -846,14 +847,16 @@ struct mei_device *mei_me_dev_init(struct pci_dev *pdev, const struct mei_cfg *cfg) {struct mei_device *dev; +struct mei_me_hw *hw; dev =kzalloc (sizeof (struct mei_device ) +sizeof (struct mei_me_hw ),GFP_KERNEL );if (!dev)return NULL ; + hw =to_me_hw (dev);mei_device_init (dev, &pdev->dev, &mei_me_hw_ops); - dev->cfg = cfg; + hw->cfg = cfg;return dev; }
drivers/misc/mei/hw-me.h +25 -1
@@ -19,14 +19,38 @@ #ifndef _MEI_INTERFACE_H_ #define _MEI_INTERFACE_H_ -#include <linux/mei.h> #include <linux/irqreturn.h> +#include <linux/pci.h> +#include <linux/mei.h> + #include "mei_dev.h" #include "client.h" +/* + * mei_cfg - mei device configuration + * + * @fw_status: FW status + * @quirk_probe: device exclusion quirk + */ +struct mei_cfg { + const struct mei_fw_status fw_status; + bool (*quirk_probe)(struct pci_dev *pdev); +}; + + +#define MEI_PCI_DEVICE(dev, cfg) \ + .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \ + .driver_data = (kernel_ulong_t)&(cfg) + + #define MEI_ME_RPM_TIMEOUT 500 /* ms */ +/** + * @cfg: per device generation config and ops + */ struct mei_me_hw { + const struct mei_cfg *cfg; void __iomem *mem_addr; /* * hw states of host and fw(ME)
drivers/misc/mei/hw-txe.c +7 -15
@@ -573,6 +573,11 @@ static int mei_txe_readiness_wait(struct mei_device *dev)return 0 ; } +const struct mei_fw_status mei_txe_fw_sts = { + .count =2 , + .status[0 ] =PCI_CFG_TXE_FW_STS0 , + .status[1 ] =PCI_CFG_TXE_FW_STS1 +};/** * mei_txe_fw_status - read fw status register from pci config space
@@ -583,7 +588,7 @@ static int mei_txe_readiness_wait(struct mei_device *dev)static int mei_txe_fw_status (struct mei_device *dev,struct mei_fw_status *fw_status) { -const struct mei_fw_status *fw_src = &dev->cfg->fw_status; +const struct mei_fw_status *fw_src = &mei_txe_fw_sts;struct pci_dev *pdev =to_pci_dev (dev->dev);int ret;int i;
@@ -1120,27 +1125,15 @@ static const struct mei_hw_ops mei_txe_hw_ops = { }; -#define MEI_CFG_TXE_FW_STS \ - .fw_status.count = 2, \ - .fw_status.status[0] = PCI_CFG_TXE_FW_STS0, \ - .fw_status.status[1] = PCI_CFG_TXE_FW_STS1 - -const struct mei_cfg mei_txe_cfg = { -MEI_CFG_TXE_FW_STS , -}; - -/** * mei_txe_dev_init - allocates and initializes txe hardware specific structure * * @pdev - pci device -* @cfg - per device generation config * * returns struct mei_device * on success or NULL; * */ -struct mei_device *mei_txe_dev_init (struct pci_dev *pdev, -const struct mei_cfg *cfg) +struct mei_device *mei_txe_dev_init (struct pci_dev *pdev) {struct mei_device *dev;struct mei_txe_hw *hw;
@@ -1156,7 +1149,6 @@ struct mei_device *mei_txe_dev_init(struct pci_dev *pdev,init_waitqueue_head (&hw->wait_aliveness_resp); - dev->cfg = cfg;return dev; }
drivers/misc/mei/hw-txe.h +1 -4
@@ -61,10 +61,7 @@ static inline struct mei_device *hw_txe_to_mei(struct mei_txe_hw *hw) return container_of((void *)hw, struct mei_device, hw); } -extern const struct mei_cfg mei_txe_cfg; - -struct mei_device *mei_txe_dev_init (struct pci_dev *pdev, -const struct mei_cfg *cfg); +struct mei_device *mei_txe_dev_init (struct pci_dev *pdev);irqreturn_t mei_txe_irq_quick_handler (int irq,void *dev_id);irqreturn_t mei_txe_irq_thread_handler (int irq,void *dev_id);
drivers/misc/mei/mei_dev.h +0 -20
@@ -380,24 +380,6 @@ enum mei_pg_state {const char *mei_pg_state_str (enum mei_pg_state state); -/* -* mei_cfg -* -* @fw_status - FW status -* @quirk_probe - device exclusion quirk -*/ -struct mei_cfg { -const struct mei_fw_status fw_status; -bool (*quirk_probe)(struct pci_dev *pdev); -}; - - -#define MEI_PCI_DEVICE (dev, cfg) \ - .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ - .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \ - .driver_data = (kernel_ulong_t)&(cfg) - -/** * struct mei_device - MEI private device struct
@@ -416,7 +398,6 @@ struct mei_cfg {* @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 -* @cfg - per device generation config and ops */ struct mei_device {struct device *dev;
@@ -530,7 +511,6 @@ struct mei_device {const struct mei_hw_ops *ops; -const struct mei_cfg *cfg;char hw[0 ]__aligned(sizeof(void *)) ; };
drivers/misc/mei/pci-txe.c +3 -3
@@ -36,7 +36,8 @@#include "hw-txe.h" static const struct pci_device_id mei_txe_pci_tbl[] = { - {MEI_PCI_DEVICE (0x0F18 , mei_txe_cfg)},/* Baytrail */ + {PCI_VDEVICE (INTEL ,0x0F18 )},/* Baytrail */ + {0 , } };MODULE_DEVICE_TABLE (pci, mei_txe_pci_tbl);
@@ -70,7 +71,6 @@ static void mei_txe_pci_iounmap(struct pci_dev *pdev, struct mei_txe_hw *hw)*/ static int mei_txe_probe (struct pci_dev *pdev,const struct pci_device_id *ent) { -const struct mei_cfg *cfg = (struct mei_cfg *)(ent->driver_data);struct mei_device *dev;struct mei_txe_hw *hw;int err;
@@ -101,7 +101,7 @@ static int mei_txe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) }/* allocates and initializes the mei dev structure */ - dev =mei_txe_dev_init (pdev, cfg); + dev =mei_txe_dev_init (pdev);if (!dev) { err = -ENOMEM ; goto release_regions;
Signature · 1 line
1.9.3
PATCH 6/6 mei: remove include to pci header from mei module files
In reply to Tomas WinklerRemove inclusion of linux/pci.h in mei layer however we need to include the headers that before got included implicitly from linux/pci.h.
--- drivers/misc/mei/amthif.c | 2 +- drivers/misc/mei/bus.c | 1 - drivers/misc/mei/client.c | 2 +- drivers/misc/mei/debugfs.c | 1 - drivers/misc/mei/hbm.c | 5 +++-- drivers/misc/mei/init.c | 1 - drivers/misc/mei/interrupt.c | 2 +- drivers/misc/mei/main.c | 2 +- drivers/misc/mei/nfc.c | 3 ++- drivers/misc/mei/wd.c | 1 - include/linux/mei_cl_bus.h | 1 + 11 files changed, 10 insertions(+), 11 deletions(-)
drivers/misc/mei/amthif.c +1 -1
@@ -20,7 +20,6 @@#include <linux/types.h> #include <linux/fcntl.h> #include <linux/aio.h> -#include <linux/pci.h> #include <linux/ioctl.h> #include <linux/cdev.h> #include <linux/list.h>
@@ -29,6 +28,7 @@#include <linux/uuid.h> #include <linux/jiffies.h> #include <linux/uaccess.h> +#include <linux/slab.h> #include <linux/mei.h>
drivers/misc/mei/bus.c +0 -1
@@ -22,7 +22,6 @@#include <linux/slab.h> #include <linux/mutex.h> #include <linux/interrupt.h> -#include <linux/pci.h> #include <linux/mei_cl_bus.h> #include "mei_dev.h"
drivers/misc/mei/client.c +1 -1
@@ -14,10 +14,10 @@* */ -#include <linux/pci.h> #include <linux/sched.h> #include <linux/wait.h> #include <linux/delay.h> +#include <linux/slab.h> #include <linux/pm_runtime.h> #include <linux/mei.h>
drivers/misc/mei/debugfs.c +0 -1
@@ -17,7 +17,6 @@#include <linux/kernel.h> #include <linux/device.h> #include <linux/debugfs.h> -#include <linux/pci.h> #include <linux/mei.h>
drivers/misc/mei/hbm.c +3 -2
@@ -15,11 +15,12 @@*/ #include <linux/export.h> -#include <linux/pci.h> #include <linux/sched.h> #include <linux/wait.h> -#include <linux/mei.h> #include <linux/pm_runtime.h> +#include <linux/slab.h> + +#include <linux/mei.h> #include "mei_dev.h" #include "hbm.h"
drivers/misc/mei/init.c +0 -1
@@ -15,7 +15,6 @@*/ #include <linux/export.h> -#include <linux/pci.h> #include <linux/sched.h> #include <linux/wait.h> #include <linux/delay.h>
drivers/misc/mei/interrupt.c +1 -1
@@ -16,11 +16,11 @@#include <linux/export.h> -#include <linux/pci.h> #include <linux/kthread.h> #include <linux/interrupt.h> #include <linux/fs.h> #include <linux/jiffies.h> +#include <linux/slab.h> #include <linux/mei.h>
drivers/misc/mei/main.c +1 -1
@@ -17,12 +17,12 @@#include <linux/moduleparam.h> #include <linux/kernel.h> #include <linux/device.h> +#include <linux/slab.h> #include <linux/fs.h> #include <linux/errno.h> #include <linux/types.h> #include <linux/fcntl.h> #include <linux/aio.h> -#include <linux/pci.h> #include <linux/poll.h> #include <linux/init.h> #include <linux/ioctl.h>
drivers/misc/mei/nfc.c +2 -1
@@ -19,7 +19,8 @@#include <linux/module.h> #include <linux/moduleparam.h> #include <linux/device.h> -#include <linux/pci.h> +#include <linux/slab.h> +#include <linux/mei_cl_bus.h> #include "mei_dev.h"
drivers/misc/mei/wd.c +0 -1
@@ -17,7 +17,6 @@#include <linux/module.h> #include <linux/moduleparam.h> #include <linux/device.h> -#include <linux/pci.h> #include <linux/sched.h> #include <linux/watchdog.h>
include/linux/mei_cl_bus.h +1 -0
@@ -3,6 +3,7 @@#include <linux/device.h> #include <linux/uuid.h> +#include <linux/mod_devicetable.h> struct mei_cl_device ;
Signature · 1 line
1.9.3