diff options
-rw-r--r-- | drivers/misc/mei/hw-me.c | 28 | ||||
-rw-r--r-- | drivers/misc/mei/hw-txe.c | 30 | ||||
-rw-r--r-- | drivers/misc/mei/init.c | 21 | ||||
-rw-r--r-- | drivers/misc/mei/mei_dev.h | 9 |
4 files changed, 66 insertions, 22 deletions
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c index 1247be706216..678531c08c6d 100644 --- a/drivers/misc/mei/hw-me.c +++ b/drivers/misc/mei/hw-me.c | |||
@@ -101,6 +101,33 @@ static inline void mei_hcsr_set(struct mei_me_hw *hw, u32 hcsr) | |||
101 | mei_me_reg_write(hw, H_CSR, hcsr); | 101 | mei_me_reg_write(hw, H_CSR, hcsr); |
102 | } | 102 | } |
103 | 103 | ||
104 | /** | ||
105 | * mei_me_fw_status - read fw status register from pci config space | ||
106 | * | ||
107 | * @dev: mei device | ||
108 | * @fw_status: fw status register values | ||
109 | */ | ||
110 | static int mei_me_fw_status(struct mei_device *dev, | ||
111 | struct mei_fw_status *fw_status) | ||
112 | { | ||
113 | const struct mei_fw_status *fw_src = &dev->cfg->fw_status; | ||
114 | struct pci_dev *pdev = to_pci_dev(dev->dev); | ||
115 | int ret; | ||
116 | int i; | ||
117 | |||
118 | if (!fw_status) | ||
119 | return -EINVAL; | ||
120 | |||
121 | fw_status->count = fw_src->count; | ||
122 | for (i = 0; i < fw_src->count && i < MEI_FW_STATUS_MAX; i++) { | ||
123 | ret = pci_read_config_dword(pdev, | ||
124 | fw_src->status[i], &fw_status->status[i]); | ||
125 | if (ret) | ||
126 | return ret; | ||
127 | } | ||
128 | |||
129 | return 0; | ||
130 | } | ||
104 | 131 | ||
105 | /** | 132 | /** |
106 | * mei_me_hw_config - configure hw dependent settings | 133 | * mei_me_hw_config - configure hw dependent settings |
@@ -714,6 +741,7 @@ end: | |||
714 | 741 | ||
715 | static const struct mei_hw_ops mei_me_hw_ops = { | 742 | static const struct mei_hw_ops mei_me_hw_ops = { |
716 | 743 | ||
744 | .fw_status = mei_me_fw_status, | ||
717 | .pg_state = mei_me_pg_state, | 745 | .pg_state = mei_me_pg_state, |
718 | 746 | ||
719 | .host_is_ready = mei_me_host_is_ready, | 747 | .host_is_ready = mei_me_host_is_ready, |
diff --git a/drivers/misc/mei/hw-txe.c b/drivers/misc/mei/hw-txe.c index acc475eec150..e4cb9dc2d198 100644 --- a/drivers/misc/mei/hw-txe.c +++ b/drivers/misc/mei/hw-txe.c | |||
@@ -573,6 +573,35 @@ static int mei_txe_readiness_wait(struct mei_device *dev) | |||
573 | return 0; | 573 | return 0; |
574 | } | 574 | } |
575 | 575 | ||
576 | |||
577 | /** | ||
578 | * mei_txe_fw_status - read fw status register from pci config space | ||
579 | * | ||
580 | * @dev: mei device | ||
581 | * @fw_status: fw status register values | ||
582 | */ | ||
583 | static int mei_txe_fw_status(struct mei_device *dev, | ||
584 | struct mei_fw_status *fw_status) | ||
585 | { | ||
586 | const struct mei_fw_status *fw_src = &dev->cfg->fw_status; | ||
587 | struct pci_dev *pdev = to_pci_dev(dev->dev); | ||
588 | int ret; | ||
589 | int i; | ||
590 | |||
591 | if (!fw_status) | ||
592 | return -EINVAL; | ||
593 | |||
594 | fw_status->count = fw_src->count; | ||
595 | for (i = 0; i < fw_src->count && i < MEI_FW_STATUS_MAX; i++) { | ||
596 | ret = pci_read_config_dword(pdev, | ||
597 | fw_src->status[i], &fw_status->status[i]); | ||
598 | if (ret) | ||
599 | return ret; | ||
600 | } | ||
601 | |||
602 | return 0; | ||
603 | } | ||
604 | |||
576 | /** | 605 | /** |
577 | * mei_txe_hw_config - configure hardware at the start of the devices | 606 | * mei_txe_hw_config - configure hardware at the start of the devices |
578 | * | 607 | * |
@@ -1064,6 +1093,7 @@ static const struct mei_hw_ops mei_txe_hw_ops = { | |||
1064 | 1093 | ||
1065 | .host_is_ready = mei_txe_host_is_ready, | 1094 | .host_is_ready = mei_txe_host_is_ready, |
1066 | 1095 | ||
1096 | .fw_status = mei_txe_fw_status, | ||
1067 | .pg_state = mei_txe_pg_state, | 1097 | .pg_state = mei_txe_pg_state, |
1068 | 1098 | ||
1069 | .hw_is_ready = mei_txe_hw_is_ready, | 1099 | .hw_is_ready = mei_txe_hw_is_ready, |
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c index 29aae7b7a304..dd233fd43178 100644 --- a/drivers/misc/mei/init.c +++ b/drivers/misc/mei/init.c | |||
@@ -344,27 +344,6 @@ bool mei_write_is_idle(struct mei_device *dev) | |||
344 | } | 344 | } |
345 | EXPORT_SYMBOL_GPL(mei_write_is_idle); | 345 | EXPORT_SYMBOL_GPL(mei_write_is_idle); |
346 | 346 | ||
347 | int mei_fw_status(struct mei_device *dev, struct mei_fw_status *fw_status) | ||
348 | { | ||
349 | const struct mei_fw_status *fw_src = &dev->cfg->fw_status; | ||
350 | int ret; | ||
351 | int i; | ||
352 | |||
353 | if (!fw_status) | ||
354 | return -EINVAL; | ||
355 | |||
356 | fw_status->count = fw_src->count; | ||
357 | for (i = 0; i < fw_src->count && i < MEI_FW_STATUS_MAX; i++) { | ||
358 | ret = pci_read_config_dword(dev->pdev, | ||
359 | fw_src->status[i], &fw_status->status[i]); | ||
360 | if (ret) | ||
361 | return ret; | ||
362 | } | ||
363 | |||
364 | return 0; | ||
365 | } | ||
366 | EXPORT_SYMBOL_GPL(mei_fw_status); | ||
367 | |||
368 | /** | 347 | /** |
369 | * mei_device_init -- initialize mei_device structure | 348 | * mei_device_init -- initialize mei_device structure |
370 | * | 349 | * |
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index 705143023255..7080fff11595 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h | |||
@@ -233,6 +233,7 @@ struct mei_cl { | |||
233 | * @hw_start - start hw after reset | 233 | * @hw_start - start hw after reset |
234 | * @hw_config - configure hw | 234 | * @hw_config - configure hw |
235 | 235 | ||
236 | * @fw_status - get fw status registers | ||
236 | * @pg_state - power gating state of the device | 237 | * @pg_state - power gating state of the device |
237 | * @pg_is_enabled - is power gating enabled | 238 | * @pg_is_enabled - is power gating enabled |
238 | 239 | ||
@@ -260,6 +261,8 @@ struct mei_hw_ops { | |||
260 | int (*hw_start)(struct mei_device *dev); | 261 | int (*hw_start)(struct mei_device *dev); |
261 | void (*hw_config)(struct mei_device *dev); | 262 | void (*hw_config)(struct mei_device *dev); |
262 | 263 | ||
264 | |||
265 | int (*fw_status)(struct mei_device *dev, struct mei_fw_status *fw_sts); | ||
263 | enum mei_pg_state (*pg_state)(struct mei_device *dev); | 266 | enum mei_pg_state (*pg_state)(struct mei_device *dev); |
264 | bool (*pg_is_enabled)(struct mei_device *dev); | 267 | bool (*pg_is_enabled)(struct mei_device *dev); |
265 | 268 | ||
@@ -731,7 +734,11 @@ static inline int mei_count_full_read_slots(struct mei_device *dev) | |||
731 | return dev->ops->rdbuf_full_slots(dev); | 734 | return dev->ops->rdbuf_full_slots(dev); |
732 | } | 735 | } |
733 | 736 | ||
734 | int mei_fw_status(struct mei_device *dev, struct mei_fw_status *fw_status); | 737 | static inline int mei_fw_status(struct mei_device *dev, |
738 | struct mei_fw_status *fw_status) | ||
739 | { | ||
740 | return dev->ops->fw_status(dev, fw_status); | ||
741 | } | ||
735 | 742 | ||
736 | #define FW_STS_FMT "%08X %08X" | 743 | #define FW_STS_FMT "%08X %08X" |
737 | #define FW_STS_PRM(fw_status) \ | 744 | #define FW_STS_PRM(fw_status) \ |