From 8d929d4862fdfc4a524fd4c799b8dfa3b187fe8c Mon Sep 17 00:00:00 2001 From: Alexander Usyskin Date: Tue, 13 May 2014 01:30:53 +0300 Subject: mei: add per device configuration Add mei_cfg structure that holds per device configuration data and hooks, as the first step we add firmware status register offsets Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler Signed-off-by: Greg Kroah-Hartman --- drivers/misc/mei/mei_dev.h | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'drivers/misc/mei/mei_dev.h') diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index 1aaaf0b6681c..909d13de17e9 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h @@ -379,6 +379,22 @@ enum mei_pg_state { MEI_PG_ON = 1, }; +/* + * mei_cfg + * + * @fw_status - FW status + */ +struct mei_cfg { + const struct mei_fw_status fw_status; +}; + + +#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 @@ -390,6 +406,7 @@ enum mei_pg_state { * @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 pci_dev *pdev; /* pointer to pci device struct */ @@ -500,6 +517,7 @@ struct mei_device { const struct mei_hw_ops *ops; + const struct mei_cfg *cfg; char hw[0] __aligned(sizeof(void *)); }; @@ -532,7 +550,7 @@ static inline u32 mei_slots2data(int slots) /* * mei init function prototypes */ -void mei_device_init(struct mei_device *dev); +void mei_device_init(struct mei_device *dev, const struct mei_cfg *cfg); int mei_reset(struct mei_device *dev); int mei_start(struct mei_device *dev); int mei_restart(struct mei_device *dev); @@ -611,6 +629,7 @@ void mei_watchdog_unregister(struct mei_device *dev); * Register Access Function */ + static inline void mei_hw_config(struct mei_device *dev) { dev->ops->hw_config(dev); @@ -698,11 +717,7 @@ static inline int mei_count_full_read_slots(struct mei_device *dev) return dev->ops->rdbuf_full_slots(dev); } -static inline int mei_fw_status(struct mei_device *dev, - struct mei_fw_status *fw_status) -{ - return dev->ops->fw_status(dev, fw_status); -} +int mei_fw_status(struct mei_device *dev, struct mei_fw_status *fw_status); #define FW_STS_FMT "%08X %08X" #define FW_STS_PRM(fw_status) \ -- cgit v1.2.3