diff options
| author | Tomas Winkler <tomas.winkler@intel.com> | 2015-02-10 03:39:33 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-01 22:36:59 -0500 |
| commit | a0a927d06d79d59c55ae7ac0b2fd7f3c0ea3c14c (patch) | |
| tree | fbdf32fe867cd96dfef623b2b6650aa68e921ede /drivers/misc | |
| parent | 381a58c70985ca1256b0f51aa6694f79662bb166 (diff) | |
mei: me: add io register tracing
To make debugging a bit easier we add me register
access tracing
<debugfs>/tracing/events/mei/mei_reg_{read,write}
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
| -rw-r--r-- | drivers/misc/mei/Makefile | 3 | ||||
| -rw-r--r-- | drivers/misc/mei/hw-me.c | 31 | ||||
| -rw-r--r-- | drivers/misc/mei/mei-trace.c | 25 | ||||
| -rw-r--r-- | drivers/misc/mei/mei-trace.h | 74 |
4 files changed, 129 insertions, 4 deletions
diff --git a/drivers/misc/mei/Makefile b/drivers/misc/mei/Makefile index 8ebc6cda1373..518914a82b83 100644 --- a/drivers/misc/mei/Makefile +++ b/drivers/misc/mei/Makefile | |||
| @@ -21,3 +21,6 @@ mei-me-objs += hw-me.o | |||
| 21 | obj-$(CONFIG_INTEL_MEI_TXE) += mei-txe.o | 21 | obj-$(CONFIG_INTEL_MEI_TXE) += mei-txe.o |
| 22 | mei-txe-objs := pci-txe.o | 22 | mei-txe-objs := pci-txe.o |
| 23 | mei-txe-objs += hw-txe.o | 23 | mei-txe-objs += hw-txe.o |
| 24 | |||
| 25 | mei-$(CONFIG_EVENT_TRACING) += mei-trace.o | ||
| 26 | CFLAGS_mei-trace.o = -I$(src) | ||
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c index ac82b56ccbb5..d3aef82a6c89 100644 --- a/drivers/misc/mei/hw-me.c +++ b/drivers/misc/mei/hw-me.c | |||
| @@ -25,6 +25,8 @@ | |||
| 25 | #include "hw-me.h" | 25 | #include "hw-me.h" |
| 26 | #include "hw-me-regs.h" | 26 | #include "hw-me-regs.h" |
| 27 | 27 | ||
| 28 | #include "mei-trace.h" | ||
| 29 | |||
| 28 | /** | 30 | /** |
| 29 | * mei_me_reg_read - Reads 32bit data from the mei device | 31 | * mei_me_reg_read - Reads 32bit data from the mei device |
| 30 | * | 32 | * |
| @@ -86,7 +88,12 @@ static inline void mei_me_hcbww_write(struct mei_device *dev, u32 data) | |||
| 86 | */ | 88 | */ |
| 87 | static inline u32 mei_me_mecsr_read(const struct mei_device *dev) | 89 | static inline u32 mei_me_mecsr_read(const struct mei_device *dev) |
| 88 | { | 90 | { |
| 89 | return mei_me_reg_read(to_me_hw(dev), ME_CSR_HA); | 91 | u32 reg; |
| 92 | |||
| 93 | reg = mei_me_reg_read(to_me_hw(dev), ME_CSR_HA); | ||
| 94 | trace_mei_reg_read(dev->dev, "ME_CSR_HA", ME_CSR_HA, reg); | ||
| 95 | |||
| 96 | return reg; | ||
| 90 | } | 97 | } |
| 91 | 98 | ||
| 92 | /** | 99 | /** |
| @@ -98,7 +105,12 @@ static inline u32 mei_me_mecsr_read(const struct mei_device *dev) | |||
| 98 | */ | 105 | */ |
| 99 | static inline u32 mei_hcsr_read(const struct mei_device *dev) | 106 | static inline u32 mei_hcsr_read(const struct mei_device *dev) |
| 100 | { | 107 | { |
| 101 | return mei_me_reg_read(to_me_hw(dev), H_CSR); | 108 | u32 reg; |
| 109 | |||
| 110 | reg = mei_me_reg_read(to_me_hw(dev), H_CSR); | ||
| 111 | trace_mei_reg_read(dev->dev, "H_CSR", H_CSR, reg); | ||
| 112 | |||
| 113 | return reg; | ||
| 102 | } | 114 | } |
| 103 | 115 | ||
| 104 | /** | 116 | /** |
| @@ -109,6 +121,7 @@ static inline u32 mei_hcsr_read(const struct mei_device *dev) | |||
| 109 | */ | 121 | */ |
| 110 | static inline void mei_hcsr_write(struct mei_device *dev, u32 reg) | 122 | static inline void mei_hcsr_write(struct mei_device *dev, u32 reg) |
| 111 | { | 123 | { |
| 124 | trace_mei_reg_write(dev->dev, "H_CSR", H_CSR, reg); | ||
| 112 | mei_me_reg_write(to_me_hw(dev), H_CSR, reg); | 125 | mei_me_reg_write(to_me_hw(dev), H_CSR, reg); |
| 113 | } | 126 | } |
| 114 | 127 | ||
| @@ -555,9 +568,14 @@ static int mei_me_read_slots(struct mei_device *dev, unsigned char *buffer, | |||
| 555 | static void mei_me_pg_enter(struct mei_device *dev) | 568 | static void mei_me_pg_enter(struct mei_device *dev) |
| 556 | { | 569 | { |
| 557 | struct mei_me_hw *hw = to_me_hw(dev); | 570 | struct mei_me_hw *hw = to_me_hw(dev); |
| 558 | u32 reg = mei_me_reg_read(hw, H_HPG_CSR); | 571 | u32 reg; |
| 572 | |||
| 573 | reg = mei_me_reg_read(hw, H_HPG_CSR); | ||
| 574 | trace_mei_reg_read(dev->dev, "H_HPG_CSR", H_HPG_CSR, reg); | ||
| 559 | 575 | ||
| 560 | reg |= H_HPG_CSR_PGI; | 576 | reg |= H_HPG_CSR_PGI; |
| 577 | |||
| 578 | trace_mei_reg_write(dev->dev, "H_HPG_CSR", H_HPG_CSR, reg); | ||
| 561 | mei_me_reg_write(hw, H_HPG_CSR, reg); | 579 | mei_me_reg_write(hw, H_HPG_CSR, reg); |
| 562 | } | 580 | } |
| 563 | 581 | ||
| @@ -569,11 +587,16 @@ static void mei_me_pg_enter(struct mei_device *dev) | |||
| 569 | static void mei_me_pg_exit(struct mei_device *dev) | 587 | static void mei_me_pg_exit(struct mei_device *dev) |
| 570 | { | 588 | { |
| 571 | struct mei_me_hw *hw = to_me_hw(dev); | 589 | struct mei_me_hw *hw = to_me_hw(dev); |
| 572 | u32 reg = mei_me_reg_read(hw, H_HPG_CSR); | 590 | u32 reg; |
| 591 | |||
| 592 | reg = mei_me_reg_read(hw, H_HPG_CSR); | ||
| 593 | trace_mei_reg_read(dev->dev, "H_HPG_CSR", H_HPG_CSR, reg); | ||
| 573 | 594 | ||
| 574 | WARN(!(reg & H_HPG_CSR_PGI), "PGI is not set\n"); | 595 | WARN(!(reg & H_HPG_CSR_PGI), "PGI is not set\n"); |
| 575 | 596 | ||
| 576 | reg |= H_HPG_CSR_PGIHEXR; | 597 | reg |= H_HPG_CSR_PGIHEXR; |
| 598 | |||
| 599 | trace_mei_reg_write(dev->dev, "H_HPG_CSR", H_HPG_CSR, reg); | ||
| 577 | mei_me_reg_write(hw, H_HPG_CSR, reg); | 600 | mei_me_reg_write(hw, H_HPG_CSR, reg); |
| 578 | } | 601 | } |
| 579 | 602 | ||
diff --git a/drivers/misc/mei/mei-trace.c b/drivers/misc/mei/mei-trace.c new file mode 100644 index 000000000000..388efb519138 --- /dev/null +++ b/drivers/misc/mei/mei-trace.c | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | /* | ||
| 2 | * | ||
| 3 | * Intel Management Engine Interface (Intel MEI) Linux driver | ||
| 4 | * Copyright (c) 2015, Intel Corporation. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms and conditions of the GNU General Public License, | ||
| 8 | * version 2, as published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 13 | * more details. | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | #include <linux/module.h> | ||
| 17 | |||
| 18 | /* sparse doesn't like tracepoint macros */ | ||
| 19 | #ifndef __CHECKER__ | ||
| 20 | #define CREATE_TRACE_POINTS | ||
| 21 | #include "mei-trace.h" | ||
| 22 | |||
| 23 | EXPORT_TRACEPOINT_SYMBOL(mei_reg_read); | ||
| 24 | EXPORT_TRACEPOINT_SYMBOL(mei_reg_write); | ||
| 25 | #endif /* __CHECKER__ */ | ||
diff --git a/drivers/misc/mei/mei-trace.h b/drivers/misc/mei/mei-trace.h new file mode 100644 index 000000000000..d5c38d15cdd9 --- /dev/null +++ b/drivers/misc/mei/mei-trace.h | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | /* | ||
| 2 | * | ||
| 3 | * Intel Management Engine Interface (Intel MEI) Linux driver | ||
| 4 | * Copyright (c) 2015, Intel Corporation. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms and conditions of the GNU General Public License, | ||
| 8 | * version 2, as published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 13 | * more details. | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | #if !defined(_MEI_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) | ||
| 18 | #define _MEI_TRACE_H_ | ||
| 19 | |||
| 20 | #include <linux/stringify.h> | ||
| 21 | #include <linux/types.h> | ||
| 22 | #include <linux/tracepoint.h> | ||
| 23 | |||
| 24 | #undef TRACE_SYSTEM | ||
| 25 | |||
| 26 | #define TRACE_SYSTEM mei | ||
| 27 | #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM) | ||
| 28 | |||
| 29 | TRACE_EVENT(mei_reg_read, | ||
| 30 | TP_PROTO(const struct device *dev, const char *reg, u32 offs, u32 val), | ||
| 31 | TP_ARGS(dev, reg, offs, val), | ||
| 32 | TP_STRUCT__entry( | ||
| 33 | __string(dev, dev_name(dev)) | ||
| 34 | __field(const char *, reg) | ||
| 35 | __field(u32, offs) | ||
| 36 | __field(u32, val) | ||
| 37 | ), | ||
| 38 | TP_fast_assign( | ||
| 39 | __assign_str(dev, dev_name(dev)) | ||
| 40 | __entry->reg = reg; | ||
| 41 | __entry->offs = offs; | ||
| 42 | __entry->val = val; | ||
| 43 | ), | ||
| 44 | TP_printk("[%s] read %s:[%#x] = %#x", | ||
| 45 | __get_str(dev), __entry->reg, __entry->offs, __entry->val) | ||
| 46 | ); | ||
| 47 | |||
| 48 | TRACE_EVENT(mei_reg_write, | ||
| 49 | TP_PROTO(const struct device *dev, const char *reg, u32 offs, u32 val), | ||
| 50 | TP_ARGS(dev, reg, offs, val), | ||
| 51 | TP_STRUCT__entry( | ||
| 52 | __string(dev, dev_name(dev)) | ||
| 53 | __field(const char *, reg) | ||
| 54 | __field(u32, offs) | ||
| 55 | __field(u32, val) | ||
| 56 | ), | ||
| 57 | TP_fast_assign( | ||
| 58 | __assign_str(dev, dev_name(dev)) | ||
| 59 | __entry->reg = reg; | ||
| 60 | __entry->offs = offs; | ||
| 61 | __entry->val = val; | ||
| 62 | ), | ||
| 63 | TP_printk("[%s] write %s[%#x] = %#x)", | ||
| 64 | __get_str(dev), __entry->reg, __entry->offs, __entry->val) | ||
| 65 | ); | ||
| 66 | |||
| 67 | #endif /* _MEI_TRACE_H_ */ | ||
| 68 | |||
| 69 | /* This part must be outside protection */ | ||
| 70 | #undef TRACE_INCLUDE_PATH | ||
| 71 | #undef TRACE_INCLUDE_FILE | ||
| 72 | #define TRACE_INCLUDE_PATH . | ||
| 73 | #define TRACE_INCLUDE_FILE mei-trace | ||
| 74 | #include <trace/define_trace.h> | ||
