Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame^] | 1 | /* Copyright (c) 2002,2008-2011, Code Aurora Forum. All rights reserved. |
| 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 | |
| 51 | #define KGSL_DRV_INFO(_dev, fmt, args...) \ |
| 52 | KGSL_LOG_INFO(_dev->dev, _dev->drv_log, fmt, ##args) |
| 53 | #define KGSL_DRV_WARN(_dev, fmt, args...) \ |
| 54 | KGSL_LOG_WARN(_dev->dev, _dev->drv_log, fmt, ##args) |
| 55 | #define KGSL_DRV_ERR(_dev, fmt, args...) \ |
| 56 | KGSL_LOG_ERR(_dev->dev, _dev->drv_log, fmt, ##args) |
| 57 | #define KGSL_DRV_CRIT(_dev, fmt, args...) \ |
| 58 | KGSL_LOG_CRIT(_dev->dev, _dev->drv_log, fmt, ##args) |
| 59 | |
| 60 | #define KGSL_CMD_INFO(_dev, fmt, args...) \ |
| 61 | KGSL_LOG_INFO(_dev->dev, _dev->cmd_log, fmt, ##args) |
| 62 | #define KGSL_CMD_WARN(_dev, fmt, args...) \ |
| 63 | KGSL_LOG_WARN(_dev->dev, _dev->cmd_log, fmt, ##args) |
| 64 | #define KGSL_CMD_ERR(_dev, fmt, args...) \ |
| 65 | KGSL_LOG_ERR(_dev->dev, _dev->cmd_log, fmt, ##args) |
| 66 | #define KGSL_CMD_CRIT(_dev, fmt, args...) \ |
| 67 | KGSL_LOG_CRIT(_dev->dev, _dev->cmd_log, fmt, ##args) |
| 68 | |
| 69 | #define KGSL_CTXT_INFO(_dev, fmt, args...) \ |
| 70 | KGSL_LOG_INFO(_dev->dev, _dev->ctxt_log, fmt, ##args) |
| 71 | #define KGSL_CTXT_WARN(_dev, fmt, args...) \ |
| 72 | KGSL_LOG_WARN(_dev->dev, _dev->ctxt_log, fmt, ##args) |
| 73 | #define KGSL_CTXT_ERR(_dev, fmt, args...) \ |
| 74 | KGSL_LOG_ERR(_dev->dev, _dev->ctxt_log, fmt, ##args) |
| 75 | #define KGSL_CTXT_CRIT(_dev, fmt, args...) \ |
| 76 | KGSL_LOG_CRIT(_dev->dev, _dev->ctxt_log, fmt, ##args) |
| 77 | |
| 78 | #define KGSL_MEM_INFO(_dev, fmt, args...) \ |
| 79 | KGSL_LOG_INFO(_dev->dev, _dev->mem_log, fmt, ##args) |
| 80 | #define KGSL_MEM_WARN(_dev, fmt, args...) \ |
| 81 | KGSL_LOG_WARN(_dev->dev, _dev->mem_log, fmt, ##args) |
| 82 | #define KGSL_MEM_ERR(_dev, fmt, args...) \ |
| 83 | KGSL_LOG_ERR(_dev->dev, _dev->mem_log, fmt, ##args) |
| 84 | #define KGSL_MEM_CRIT(_dev, fmt, args...) \ |
| 85 | KGSL_LOG_CRIT(_dev->dev, _dev->mem_log, fmt, ##args) |
| 86 | |
| 87 | #define KGSL_PWR_INFO(_dev, fmt, args...) \ |
| 88 | KGSL_LOG_INFO(_dev->dev, _dev->pwr_log, fmt, ##args) |
| 89 | #define KGSL_PWR_WARN(_dev, fmt, args...) \ |
| 90 | KGSL_LOG_WARN(_dev->dev, _dev->pwr_log, fmt, ##args) |
| 91 | #define KGSL_PWR_ERR(_dev, fmt, args...) \ |
| 92 | KGSL_LOG_ERR(_dev->dev, _dev->pwr_log, fmt, ##args) |
| 93 | #define KGSL_PWR_CRIT(_dev, fmt, args...) \ |
| 94 | KGSL_LOG_CRIT(_dev->dev, _dev->pwr_log, fmt, ##args) |
| 95 | |
| 96 | /* Core error messages - these are for core KGSL functions that have |
| 97 | no device associated with them (such as memory) */ |
| 98 | |
| 99 | #define KGSL_CORE_ERR(fmt, args...) \ |
| 100 | pr_err("kgsl: %s: " fmt, __func__, ##args) |
| 101 | |
| 102 | #endif /* __KGSL_LOG_H */ |