Duy Truong | e833aca | 2013-02-12 13:35:08 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2002,2008-2011, The Linux Foundation. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 | * |
| 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 | |
| 16 | extern 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 Dwivedi | a9eb7cb | 2012-03-26 15:21:38 -0600 | [diff] [blame] | 51 | #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 Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 61 | #define KGSL_DRV_INFO(_dev, fmt, args...) \ |
| 62 | KGSL_LOG_INFO(_dev->dev, _dev->drv_log, fmt, ##args) |
| 63 | #define KGSL_DRV_WARN(_dev, fmt, args...) \ |
| 64 | KGSL_LOG_WARN(_dev->dev, _dev->drv_log, fmt, ##args) |
| 65 | #define KGSL_DRV_ERR(_dev, fmt, args...) \ |
| 66 | KGSL_LOG_ERR(_dev->dev, _dev->drv_log, fmt, ##args) |
| 67 | #define KGSL_DRV_CRIT(_dev, fmt, args...) \ |
| 68 | KGSL_LOG_CRIT(_dev->dev, _dev->drv_log, fmt, ##args) |
| 69 | |
| 70 | #define KGSL_CMD_INFO(_dev, fmt, args...) \ |
| 71 | KGSL_LOG_INFO(_dev->dev, _dev->cmd_log, fmt, ##args) |
| 72 | #define KGSL_CMD_WARN(_dev, fmt, args...) \ |
| 73 | KGSL_LOG_WARN(_dev->dev, _dev->cmd_log, fmt, ##args) |
| 74 | #define KGSL_CMD_ERR(_dev, fmt, args...) \ |
| 75 | KGSL_LOG_ERR(_dev->dev, _dev->cmd_log, fmt, ##args) |
| 76 | #define KGSL_CMD_CRIT(_dev, fmt, args...) \ |
| 77 | KGSL_LOG_CRIT(_dev->dev, _dev->cmd_log, fmt, ##args) |
| 78 | |
| 79 | #define KGSL_CTXT_INFO(_dev, fmt, args...) \ |
| 80 | KGSL_LOG_INFO(_dev->dev, _dev->ctxt_log, fmt, ##args) |
| 81 | #define KGSL_CTXT_WARN(_dev, fmt, args...) \ |
| 82 | KGSL_LOG_WARN(_dev->dev, _dev->ctxt_log, fmt, ##args) |
| 83 | #define KGSL_CTXT_ERR(_dev, fmt, args...) \ |
| 84 | KGSL_LOG_ERR(_dev->dev, _dev->ctxt_log, fmt, ##args) |
| 85 | #define KGSL_CTXT_CRIT(_dev, fmt, args...) \ |
| 86 | KGSL_LOG_CRIT(_dev->dev, _dev->ctxt_log, fmt, ##args) |
| 87 | |
| 88 | #define KGSL_MEM_INFO(_dev, fmt, args...) \ |
| 89 | KGSL_LOG_INFO(_dev->dev, _dev->mem_log, fmt, ##args) |
| 90 | #define KGSL_MEM_WARN(_dev, fmt, args...) \ |
| 91 | KGSL_LOG_WARN(_dev->dev, _dev->mem_log, fmt, ##args) |
| 92 | #define KGSL_MEM_ERR(_dev, fmt, args...) \ |
| 93 | KGSL_LOG_ERR(_dev->dev, _dev->mem_log, fmt, ##args) |
| 94 | #define KGSL_MEM_CRIT(_dev, fmt, args...) \ |
| 95 | KGSL_LOG_CRIT(_dev->dev, _dev->mem_log, fmt, ##args) |
| 96 | |
| 97 | #define KGSL_PWR_INFO(_dev, fmt, args...) \ |
| 98 | KGSL_LOG_INFO(_dev->dev, _dev->pwr_log, fmt, ##args) |
| 99 | #define KGSL_PWR_WARN(_dev, fmt, args...) \ |
| 100 | KGSL_LOG_WARN(_dev->dev, _dev->pwr_log, fmt, ##args) |
| 101 | #define KGSL_PWR_ERR(_dev, fmt, args...) \ |
| 102 | KGSL_LOG_ERR(_dev->dev, _dev->pwr_log, fmt, ##args) |
| 103 | #define KGSL_PWR_CRIT(_dev, fmt, args...) \ |
| 104 | KGSL_LOG_CRIT(_dev->dev, _dev->pwr_log, fmt, ##args) |
| 105 | |
Tarun Karra | d20d71a | 2013-01-25 15:38:57 -0800 | [diff] [blame] | 106 | #define KGSL_FT_INFO(_dev, fmt, args...) \ |
| 107 | KGSL_LOG_INFO(_dev->dev, _dev->ft_log, fmt, ##args) |
| 108 | #define KGSL_FT_WARN(_dev, fmt, args...) \ |
| 109 | KGSL_LOG_WARN(_dev->dev, _dev->ft_log, fmt, ##args) |
| 110 | #define KGSL_FT_ERR(_dev, fmt, args...) \ |
| 111 | KGSL_LOG_ERR(_dev->dev, _dev->ft_log, fmt, ##args) |
| 112 | #define KGSL_FT_CRIT(_dev, fmt, args...) \ |
| 113 | KGSL_LOG_CRIT(_dev->dev, _dev->ft_log, fmt, ##args) |
| 114 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 115 | /* 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...) \ |
| 119 | pr_err("kgsl: %s: " fmt, __func__, ##args) |
| 120 | |
| 121 | #endif /* __KGSL_LOG_H */ |