blob: 83d14f79cc7f956b7e0ef70a851e06b517b5ceb1 [file] [log] [blame]
Duy Truonge833aca2013-02-12 13:35:08 -08001/* Copyright (c) 2002,2008-2011, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#ifndef __KGSL_LOG_H
14#define __KGSL_LOG_H
15
16extern unsigned int kgsl_cff_dump_enable;
17
18#define KGSL_LOG_INFO(dev, lvl, fmt, args...) \
19 do { \
20 if ((lvl) >= 6) \
21 dev_info(dev, "|%s| " fmt, \
22 __func__, ##args);\
23 } while (0)
24
25#define KGSL_LOG_WARN(dev, lvl, fmt, args...) \
26 do { \
27 if ((lvl) >= 4) \
28 dev_warn(dev, "|%s| " fmt, \
29 __func__, ##args);\
30 } while (0)
31
32#define KGSL_LOG_ERR(dev, lvl, fmt, args...) \
33 do { \
34 if ((lvl) >= 3) \
35 dev_err(dev, "|%s| " fmt, \
36 __func__, ##args);\
37 } while (0)
38
39#define KGSL_LOG_CRIT(dev, lvl, fmt, args...) \
40 do { \
41 if ((lvl) >= 2) \
42 dev_crit(dev, "|%s| " fmt, \
43 __func__, ##args);\
44 } while (0)
45
46#define KGSL_LOG_POSTMORTEM_WRITE(_dev, fmt, args...) \
47 do { dev_crit(_dev->dev, fmt, ##args); } while (0)
48
49#define KGSL_LOG_DUMP(_dev, fmt, args...) dev_err(_dev->dev, fmt, ##args)
50
Harsh Vardhan Dwivedia9eb7cb2012-03-26 15:21:38 -060051#define KGSL_DEV_ERR_ONCE(_dev, fmt, args...) \
52({ \
53 static bool kgsl_dev_err_once; \
54 \
55 if (!kgsl_dev_err_once) { \
56 kgsl_dev_err_once = true; \
57 dev_crit(_dev->dev, "|%s| " fmt, __func__, ##args); \
58 } \
59})
60
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070061#define KGSL_DRV_INFO(_dev, fmt, args...) \
62KGSL_LOG_INFO(_dev->dev, _dev->drv_log, fmt, ##args)
63#define KGSL_DRV_WARN(_dev, fmt, args...) \
64KGSL_LOG_WARN(_dev->dev, _dev->drv_log, fmt, ##args)
65#define KGSL_DRV_ERR(_dev, fmt, args...) \
66KGSL_LOG_ERR(_dev->dev, _dev->drv_log, fmt, ##args)
67#define KGSL_DRV_CRIT(_dev, fmt, args...) \
68KGSL_LOG_CRIT(_dev->dev, _dev->drv_log, fmt, ##args)
69
70#define KGSL_CMD_INFO(_dev, fmt, args...) \
71KGSL_LOG_INFO(_dev->dev, _dev->cmd_log, fmt, ##args)
72#define KGSL_CMD_WARN(_dev, fmt, args...) \
73KGSL_LOG_WARN(_dev->dev, _dev->cmd_log, fmt, ##args)
74#define KGSL_CMD_ERR(_dev, fmt, args...) \
75KGSL_LOG_ERR(_dev->dev, _dev->cmd_log, fmt, ##args)
76#define KGSL_CMD_CRIT(_dev, fmt, args...) \
77KGSL_LOG_CRIT(_dev->dev, _dev->cmd_log, fmt, ##args)
78
79#define KGSL_CTXT_INFO(_dev, fmt, args...) \
80KGSL_LOG_INFO(_dev->dev, _dev->ctxt_log, fmt, ##args)
81#define KGSL_CTXT_WARN(_dev, fmt, args...) \
82KGSL_LOG_WARN(_dev->dev, _dev->ctxt_log, fmt, ##args)
83#define KGSL_CTXT_ERR(_dev, fmt, args...) \
84KGSL_LOG_ERR(_dev->dev, _dev->ctxt_log, fmt, ##args)
85#define KGSL_CTXT_CRIT(_dev, fmt, args...) \
86KGSL_LOG_CRIT(_dev->dev, _dev->ctxt_log, fmt, ##args)
87
88#define KGSL_MEM_INFO(_dev, fmt, args...) \
89KGSL_LOG_INFO(_dev->dev, _dev->mem_log, fmt, ##args)
90#define KGSL_MEM_WARN(_dev, fmt, args...) \
91KGSL_LOG_WARN(_dev->dev, _dev->mem_log, fmt, ##args)
92#define KGSL_MEM_ERR(_dev, fmt, args...) \
93KGSL_LOG_ERR(_dev->dev, _dev->mem_log, fmt, ##args)
94#define KGSL_MEM_CRIT(_dev, fmt, args...) \
95KGSL_LOG_CRIT(_dev->dev, _dev->mem_log, fmt, ##args)
96
97#define KGSL_PWR_INFO(_dev, fmt, args...) \
98KGSL_LOG_INFO(_dev->dev, _dev->pwr_log, fmt, ##args)
99#define KGSL_PWR_WARN(_dev, fmt, args...) \
100KGSL_LOG_WARN(_dev->dev, _dev->pwr_log, fmt, ##args)
101#define KGSL_PWR_ERR(_dev, fmt, args...) \
102KGSL_LOG_ERR(_dev->dev, _dev->pwr_log, fmt, ##args)
103#define KGSL_PWR_CRIT(_dev, fmt, args...) \
104KGSL_LOG_CRIT(_dev->dev, _dev->pwr_log, fmt, ##args)
105
Tarun Karrad20d71a2013-01-25 15:38:57 -0800106#define KGSL_FT_INFO(_dev, fmt, args...) \
107KGSL_LOG_INFO(_dev->dev, _dev->ft_log, fmt, ##args)
108#define KGSL_FT_WARN(_dev, fmt, args...) \
109KGSL_LOG_WARN(_dev->dev, _dev->ft_log, fmt, ##args)
110#define KGSL_FT_ERR(_dev, fmt, args...) \
111KGSL_LOG_ERR(_dev->dev, _dev->ft_log, fmt, ##args)
112#define KGSL_FT_CRIT(_dev, fmt, args...) \
113KGSL_LOG_CRIT(_dev->dev, _dev->ft_log, fmt, ##args)
114
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700115/* Core error messages - these are for core KGSL functions that have
116 no device associated with them (such as memory) */
117
118#define KGSL_CORE_ERR(fmt, args...) \
119pr_err("kgsl: %s: " fmt, __func__, ##args)
120
121#endif /* __KGSL_LOG_H */