diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2014-09-29 09:31:45 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-29 11:56:01 -0400 |
commit | 4ad96db6ccdd8b777cff5fd4aa74ec1e86f1afce (patch) | |
tree | 1752b434d40b77db0784e17959fab3c3d2227ab1 | |
parent | d08b8fc0dbdbe9bf7edeb46f7a856f993630664f (diff) |
mei: push pci cfg structure me hw
Device specific configurations are currently only needed by me hw
so we can remove it from txe
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/misc/mei/hw-me.c | 7 | ||||
-rw-r--r-- | drivers/misc/mei/hw-me.h | 26 | ||||
-rw-r--r-- | drivers/misc/mei/hw-txe.c | 22 | ||||
-rw-r--r-- | drivers/misc/mei/hw-txe.h | 5 | ||||
-rw-r--r-- | drivers/misc/mei/mei_dev.h | 20 | ||||
-rw-r--r-- | drivers/misc/mei/pci-txe.c | 6 |
6 files changed, 41 insertions, 45 deletions
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c index da86310d7899..77166ea30a4d 100644 --- a/drivers/misc/mei/hw-me.c +++ b/drivers/misc/mei/hw-me.c | |||
@@ -110,8 +110,9 @@ static inline void mei_hcsr_set(struct mei_me_hw *hw, u32 hcsr) | |||
110 | static int mei_me_fw_status(struct mei_device *dev, | 110 | static int mei_me_fw_status(struct mei_device *dev, |
111 | struct mei_fw_status *fw_status) | 111 | struct mei_fw_status *fw_status) |
112 | { | 112 | { |
113 | const struct mei_fw_status *fw_src = &dev->cfg->fw_status; | ||
114 | struct pci_dev *pdev = to_pci_dev(dev->dev); | 113 | struct pci_dev *pdev = to_pci_dev(dev->dev); |
114 | struct mei_me_hw *hw = to_me_hw(dev); | ||
115 | const struct mei_fw_status *fw_src = &hw->cfg->fw_status; | ||
115 | int ret; | 116 | int ret; |
116 | int i; | 117 | int i; |
117 | 118 | ||
@@ -846,14 +847,16 @@ struct mei_device *mei_me_dev_init(struct pci_dev *pdev, | |||
846 | const struct mei_cfg *cfg) | 847 | const struct mei_cfg *cfg) |
847 | { | 848 | { |
848 | struct mei_device *dev; | 849 | struct mei_device *dev; |
850 | struct mei_me_hw *hw; | ||
849 | 851 | ||
850 | dev = kzalloc(sizeof(struct mei_device) + | 852 | dev = kzalloc(sizeof(struct mei_device) + |
851 | sizeof(struct mei_me_hw), GFP_KERNEL); | 853 | sizeof(struct mei_me_hw), GFP_KERNEL); |
852 | if (!dev) | 854 | if (!dev) |
853 | return NULL; | 855 | return NULL; |
856 | hw = to_me_hw(dev); | ||
854 | 857 | ||
855 | mei_device_init(dev, &pdev->dev, &mei_me_hw_ops); | 858 | mei_device_init(dev, &pdev->dev, &mei_me_hw_ops); |
856 | dev->cfg = cfg; | 859 | hw->cfg = cfg; |
857 | return dev; | 860 | return dev; |
858 | } | 861 | } |
859 | 862 | ||
diff --git a/drivers/misc/mei/hw-me.h b/drivers/misc/mei/hw-me.h index 12b0f4bbe1f1..b0001b3a0fb5 100644 --- a/drivers/misc/mei/hw-me.h +++ b/drivers/misc/mei/hw-me.h | |||
@@ -19,14 +19,38 @@ | |||
19 | #ifndef _MEI_INTERFACE_H_ | 19 | #ifndef _MEI_INTERFACE_H_ |
20 | #define _MEI_INTERFACE_H_ | 20 | #define _MEI_INTERFACE_H_ |
21 | 21 | ||
22 | #include <linux/mei.h> | ||
23 | #include <linux/irqreturn.h> | 22 | #include <linux/irqreturn.h> |
23 | #include <linux/pci.h> | ||
24 | #include <linux/mei.h> | ||
25 | |||
24 | #include "mei_dev.h" | 26 | #include "mei_dev.h" |
25 | #include "client.h" | 27 | #include "client.h" |
26 | 28 | ||
29 | /* | ||
30 | * mei_cfg - mei device configuration | ||
31 | * | ||
32 | * @fw_status: FW status | ||
33 | * @quirk_probe: device exclusion quirk | ||
34 | */ | ||
35 | struct mei_cfg { | ||
36 | const struct mei_fw_status fw_status; | ||
37 | bool (*quirk_probe)(struct pci_dev *pdev); | ||
38 | }; | ||
39 | |||
40 | |||
41 | #define MEI_PCI_DEVICE(dev, cfg) \ | ||
42 | .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ | ||
43 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \ | ||
44 | .driver_data = (kernel_ulong_t)&(cfg) | ||
45 | |||
46 | |||
27 | #define MEI_ME_RPM_TIMEOUT 500 /* ms */ | 47 | #define MEI_ME_RPM_TIMEOUT 500 /* ms */ |
28 | 48 | ||
49 | /** | ||
50 | * @cfg: per device generation config and ops | ||
51 | */ | ||
29 | struct mei_me_hw { | 52 | struct mei_me_hw { |
53 | const struct mei_cfg *cfg; | ||
30 | void __iomem *mem_addr; | 54 | void __iomem *mem_addr; |
31 | /* | 55 | /* |
32 | * hw states of host and fw(ME) | 56 | * hw states of host and fw(ME) |
diff --git a/drivers/misc/mei/hw-txe.c b/drivers/misc/mei/hw-txe.c index 6eef6766f0a5..f33fbcbcdf63 100644 --- a/drivers/misc/mei/hw-txe.c +++ b/drivers/misc/mei/hw-txe.c | |||
@@ -573,6 +573,11 @@ static int mei_txe_readiness_wait(struct mei_device *dev) | |||
573 | return 0; | 573 | return 0; |
574 | } | 574 | } |
575 | 575 | ||
576 | const struct mei_fw_status mei_txe_fw_sts = { | ||
577 | .count = 2, | ||
578 | .status[0] = PCI_CFG_TXE_FW_STS0, | ||
579 | .status[1] = PCI_CFG_TXE_FW_STS1 | ||
580 | }; | ||
576 | 581 | ||
577 | /** | 582 | /** |
578 | * mei_txe_fw_status - read fw status register from pci config space | 583 | * 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) | |||
583 | static int mei_txe_fw_status(struct mei_device *dev, | 588 | static int mei_txe_fw_status(struct mei_device *dev, |
584 | struct mei_fw_status *fw_status) | 589 | struct mei_fw_status *fw_status) |
585 | { | 590 | { |
586 | const struct mei_fw_status *fw_src = &dev->cfg->fw_status; | 591 | const struct mei_fw_status *fw_src = &mei_txe_fw_sts; |
587 | struct pci_dev *pdev = to_pci_dev(dev->dev); | 592 | struct pci_dev *pdev = to_pci_dev(dev->dev); |
588 | int ret; | 593 | int ret; |
589 | int i; | 594 | int i; |
@@ -1120,27 +1125,15 @@ static const struct mei_hw_ops mei_txe_hw_ops = { | |||
1120 | 1125 | ||
1121 | }; | 1126 | }; |
1122 | 1127 | ||
1123 | #define MEI_CFG_TXE_FW_STS \ | ||
1124 | .fw_status.count = 2, \ | ||
1125 | .fw_status.status[0] = PCI_CFG_TXE_FW_STS0, \ | ||
1126 | .fw_status.status[1] = PCI_CFG_TXE_FW_STS1 | ||
1127 | |||
1128 | const struct mei_cfg mei_txe_cfg = { | ||
1129 | MEI_CFG_TXE_FW_STS, | ||
1130 | }; | ||
1131 | |||
1132 | |||
1133 | /** | 1128 | /** |
1134 | * mei_txe_dev_init - allocates and initializes txe hardware specific structure | 1129 | * mei_txe_dev_init - allocates and initializes txe hardware specific structure |
1135 | * | 1130 | * |
1136 | * @pdev - pci device | 1131 | * @pdev - pci device |
1137 | * @cfg - per device generation config | ||
1138 | * | 1132 | * |
1139 | * returns struct mei_device * on success or NULL; | 1133 | * returns struct mei_device * on success or NULL; |
1140 | * | 1134 | * |
1141 | */ | 1135 | */ |
1142 | struct mei_device *mei_txe_dev_init(struct pci_dev *pdev, | 1136 | struct mei_device *mei_txe_dev_init(struct pci_dev *pdev) |
1143 | const struct mei_cfg *cfg) | ||
1144 | { | 1137 | { |
1145 | struct mei_device *dev; | 1138 | struct mei_device *dev; |
1146 | struct mei_txe_hw *hw; | 1139 | struct mei_txe_hw *hw; |
@@ -1156,7 +1149,6 @@ struct mei_device *mei_txe_dev_init(struct pci_dev *pdev, | |||
1156 | 1149 | ||
1157 | init_waitqueue_head(&hw->wait_aliveness_resp); | 1150 | init_waitqueue_head(&hw->wait_aliveness_resp); |
1158 | 1151 | ||
1159 | dev->cfg = cfg; | ||
1160 | return dev; | 1152 | return dev; |
1161 | } | 1153 | } |
1162 | 1154 | ||
diff --git a/drivers/misc/mei/hw-txe.h b/drivers/misc/mei/hw-txe.h index e244af79167f..e8dd2d165c25 100644 --- a/drivers/misc/mei/hw-txe.h +++ b/drivers/misc/mei/hw-txe.h | |||
@@ -61,10 +61,7 @@ static inline struct mei_device *hw_txe_to_mei(struct mei_txe_hw *hw) | |||
61 | return container_of((void *)hw, struct mei_device, hw); | 61 | return container_of((void *)hw, struct mei_device, hw); |
62 | } | 62 | } |
63 | 63 | ||
64 | extern const struct mei_cfg mei_txe_cfg; | 64 | struct mei_device *mei_txe_dev_init(struct pci_dev *pdev); |
65 | |||
66 | struct mei_device *mei_txe_dev_init(struct pci_dev *pdev, | ||
67 | const struct mei_cfg *cfg); | ||
68 | 65 | ||
69 | irqreturn_t mei_txe_irq_quick_handler(int irq, void *dev_id); | 66 | irqreturn_t mei_txe_irq_quick_handler(int irq, void *dev_id); |
70 | irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id); | 67 | irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id); |
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index 5a16cc46f8d6..fed4c96da0fa 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h | |||
@@ -380,24 +380,6 @@ enum mei_pg_state { | |||
380 | 380 | ||
381 | const char *mei_pg_state_str(enum mei_pg_state state); | 381 | const char *mei_pg_state_str(enum mei_pg_state state); |
382 | 382 | ||
383 | /* | ||
384 | * mei_cfg | ||
385 | * | ||
386 | * @fw_status - FW status | ||
387 | * @quirk_probe - device exclusion quirk | ||
388 | */ | ||
389 | struct mei_cfg { | ||
390 | const struct mei_fw_status fw_status; | ||
391 | bool (*quirk_probe)(struct pci_dev *pdev); | ||
392 | }; | ||
393 | |||
394 | |||
395 | #define MEI_PCI_DEVICE(dev, cfg) \ | ||
396 | .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ | ||
397 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \ | ||
398 | .driver_data = (kernel_ulong_t)&(cfg) | ||
399 | |||
400 | |||
401 | /** | 383 | /** |
402 | * struct mei_device - MEI private device struct | 384 | * struct mei_device - MEI private device struct |
403 | 385 | ||
@@ -416,7 +398,6 @@ struct mei_cfg { | |||
416 | * @hbuf_depth - depth of hardware host/write buffer is slots | 398 | * @hbuf_depth - depth of hardware host/write buffer is slots |
417 | * @hbuf_is_ready - query if the host host/write buffer is ready | 399 | * @hbuf_is_ready - query if the host host/write buffer is ready |
418 | * @wr_msg - the buffer for hbm control messages | 400 | * @wr_msg - the buffer for hbm control messages |
419 | * @cfg - per device generation config and ops | ||
420 | */ | 401 | */ |
421 | struct mei_device { | 402 | struct mei_device { |
422 | struct device *dev; | 403 | struct device *dev; |
@@ -530,7 +511,6 @@ struct mei_device { | |||
530 | 511 | ||
531 | 512 | ||
532 | const struct mei_hw_ops *ops; | 513 | const struct mei_hw_ops *ops; |
533 | const struct mei_cfg *cfg; | ||
534 | char hw[0] __aligned(sizeof(void *)); | 514 | char hw[0] __aligned(sizeof(void *)); |
535 | }; | 515 | }; |
536 | 516 | ||
diff --git a/drivers/misc/mei/pci-txe.c b/drivers/misc/mei/pci-txe.c index cd9dda705006..69eb999ae803 100644 --- a/drivers/misc/mei/pci-txe.c +++ b/drivers/misc/mei/pci-txe.c | |||
@@ -36,7 +36,8 @@ | |||
36 | #include "hw-txe.h" | 36 | #include "hw-txe.h" |
37 | 37 | ||
38 | static const struct pci_device_id mei_txe_pci_tbl[] = { | 38 | static const struct pci_device_id mei_txe_pci_tbl[] = { |
39 | {MEI_PCI_DEVICE(0x0F18, mei_txe_cfg)}, /* Baytrail */ | 39 | {PCI_VDEVICE(INTEL, 0x0F18)}, /* Baytrail */ |
40 | |||
40 | {0, } | 41 | {0, } |
41 | }; | 42 | }; |
42 | MODULE_DEVICE_TABLE(pci, mei_txe_pci_tbl); | 43 | 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) | |||
70 | */ | 71 | */ |
71 | static int mei_txe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 72 | static int mei_txe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
72 | { | 73 | { |
73 | const struct mei_cfg *cfg = (struct mei_cfg *)(ent->driver_data); | ||
74 | struct mei_device *dev; | 74 | struct mei_device *dev; |
75 | struct mei_txe_hw *hw; | 75 | struct mei_txe_hw *hw; |
76 | int err; | 76 | int err; |
@@ -101,7 +101,7 @@ static int mei_txe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
101 | } | 101 | } |
102 | 102 | ||
103 | /* allocates and initializes the mei dev structure */ | 103 | /* allocates and initializes the mei dev structure */ |
104 | dev = mei_txe_dev_init(pdev, cfg); | 104 | dev = mei_txe_dev_init(pdev); |
105 | if (!dev) { | 105 | if (!dev) { |
106 | err = -ENOMEM; | 106 | err = -ENOMEM; |
107 | goto release_regions; | 107 | goto release_regions; |