• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2013 Google, Inc.
3  *
4  * This software is licensed under the terms of the GNU General Public
5  * License version 2, as published by the Free Software Foundation, and
6  * may be copied, distributed, and modified under those terms.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  */
14 
15 #undef TRACE_SYSTEM
16 #define TRACE_SYSTEM mmc
17 
18 #if !defined(_TRACE_MMC_H) || defined(TRACE_HEADER_MULTI_READ)
19 #define _TRACE_MMC_H
20 
21 #include <linux/tracepoint.h>
22 #include <linux/mmc/mmc.h>
23 #include <linux/mmc/core.h>
24 
25 /*
26  * Unconditional logging of mmc block erase operations,
27  * including cmd, address, size
28  */
29 DECLARE_EVENT_CLASS(mmc_blk_erase_class,
30 	TP_PROTO(unsigned int cmd, unsigned int addr, unsigned int size),
31 	TP_ARGS(cmd, addr, size),
32 	TP_STRUCT__entry(
33 		__field(unsigned int, cmd)
34 		__field(unsigned int, addr)
35 		__field(unsigned int, size)
36 	),
37 	TP_fast_assign(
38 		__entry->cmd = cmd;
39 		__entry->addr = addr;
40 		__entry->size = size;
41 	),
42 	TP_printk("cmd=%u,addr=0x%08x,size=0x%08x",
43 		  __entry->cmd, __entry->addr, __entry->size)
44 );
45 
46 DEFINE_EVENT(mmc_blk_erase_class, mmc_blk_erase_start,
47 	TP_PROTO(unsigned int cmd, unsigned int addr, unsigned int size),
48 	TP_ARGS(cmd, addr, size));
49 
50 DEFINE_EVENT(mmc_blk_erase_class, mmc_blk_erase_end,
51 	TP_PROTO(unsigned int cmd, unsigned int addr, unsigned int size),
52 	TP_ARGS(cmd, addr, size));
53 
54 /*
55  * Logging of start of read or write mmc block operation,
56  * including cmd, address, size
57  */
58 DECLARE_EVENT_CLASS(mmc_blk_rw_class,
59 	TP_PROTO(unsigned int cmd, unsigned int addr, struct mmc_data *data),
60 	TP_ARGS(cmd, addr, data),
61 	TP_STRUCT__entry(
62 		__field(unsigned int, cmd)
63 		__field(unsigned int, addr)
64 		__field(unsigned int, size)
65 	),
66 	TP_fast_assign(
67 		__entry->cmd = cmd;
68 		__entry->addr = addr;
69 		__entry->size = data->blocks;
70 	),
71 	TP_printk("cmd=%u,addr=0x%08x,size=0x%08x",
72 		  __entry->cmd, __entry->addr, __entry->size)
73 );
74 
75 DEFINE_EVENT_CONDITION(mmc_blk_rw_class, mmc_blk_rw_start,
76 	TP_PROTO(unsigned int cmd, unsigned int addr, struct mmc_data *data),
77 	TP_ARGS(cmd, addr, data),
78 	TP_CONDITION(((cmd == MMC_READ_MULTIPLE_BLOCK) ||
79 		      (cmd == MMC_WRITE_MULTIPLE_BLOCK)) &&
80 		      data));
81 
82 DEFINE_EVENT_CONDITION(mmc_blk_rw_class, mmc_blk_rw_end,
83 	TP_PROTO(unsigned int cmd, unsigned int addr, struct mmc_data *data),
84 	TP_ARGS(cmd, addr, data),
85 	TP_CONDITION(((cmd == MMC_READ_MULTIPLE_BLOCK) ||
86 		      (cmd == MMC_WRITE_MULTIPLE_BLOCK)) &&
87 		      data));
88 #endif /* _TRACE_MMC_H */
89 
90 /* This part must be outside protection */
91 #include <trace/define_trace.h>
92