packaging: update the changelog
[profile/ivi/intel-emgd-kmod.git] / emgd / include / debug.h
1 /*
2  *-----------------------------------------------------------------------------
3  * Filename: debug.h
4  * $Revision: 1.9 $
5  *-----------------------------------------------------------------------------
6  * Copyright (c) 2002-2010, Intel Corporation.
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy
9  * of this software and associated documentation files (the "Software"), to deal
10  * in the Software without restriction, including without limitation the rights
11  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12  * copies of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24  * THE SOFTWARE.
25  *
26  *-----------------------------------------------------------------------------
27  * Description:
28  *  Contains debug macros
29  *-----------------------------------------------------------------------------
30  */
31 #ifndef __DEBUG_H
32 #define __DEBUG_H
33
34
35
36 #define IGD_PRINTK_PALETTE(p) \
37 { \
38         EMGD_DEBUG("Palette Struct:"); \
39         EMGD_DEBUG_S("    [%4d].id",    (unsigned int) p->palette_id); \
40         EMGD_DEBUG_S("    [%4d].type",  (unsigned int) p->palette_type); \
41         EMGD_DEBUG_S("    [%4d].size",  (unsigned int) p->size); \
42 }
43
44 #define IGD_PRINTK_3DSTRETCH(p, s, d, f) \
45 { \
46         EMGD_DEBUG("Ring Buffer Struct:"); \
47         EMGD_DEBUG_S("    Priority = [%8d]",       (unsigned int) p); \
48         EMGD_DEBUG_S("    Flags    = [%08x]",      (unsigned int) f); \
49         EMGD_DEBUG_S("    --------------"); \
50         EMGD_DEBUG_S("    Source surface"); \
51         EMGD_DEBUG_S("    --------------"); \
52         EMGD_DEBUG_S("    [%08x].addr",            (unsigned int) s->addr); \
53         EMGD_DEBUG_S("    [%8d].height",           (unsigned int) s->height); \
54         EMGD_DEBUG_S("    [%8d].width",            (unsigned int) s->width); \
55         EMGD_DEBUG_S("    [%8d].pitch",            (unsigned int) s->pitch); \
56         EMGD_DEBUG_S("    [%08x].pixel_format",    (unsigned int) s->pixel_format); \
57         EMGD_DEBUG_S("    -------------------"); \
58         EMGD_DEBUG_S("    Destination surface"); \
59         EMGD_DEBUG_S("    -------------------"); \
60         EMGD_DEBUG_S("    [%8d].offset",           (unsigned int) d->offset); \
61         EMGD_DEBUG_S("    [%8d].pitch",            (unsigned int) d->pitch); \
62         EMGD_DEBUG_S("    [%8d].x1",               (unsigned int) d->x1); \
63         EMGD_DEBUG_S("    [%8d].y1",               (unsigned int) d->y1); \
64         EMGD_DEBUG_S("    [%8d].x2",               (unsigned int) d->x2); \
65         EMGD_DEBUG_S("    [%8d].y2",               (unsigned int) d->y2); \
66         EMGD_DEBUG_S("    [%08x].pixel_format",    (unsigned int) d->pixel_format); \
67         EMGD_DEBUG_S("    [%08x].byte_mask",       (unsigned int) d->byte_mask); \
68 }
69
70 #define IGD_PRINT_RB_BUFFER(a) \
71 { \
72         EMGD_DEBUG("Ring Buffer Struct:"); \
73         EMGD_DEBUG_S("    [%08x].id",              (unsigned int) a->id); \
74         EMGD_DEBUG_S("    [%08x].size",            (unsigned int) a->size); \
75         EMGD_DEBUG_S("    [%08x].addr",            (unsigned int) a->addr); \
76         EMGD_DEBUG_S("    [%p].virt",             a->virt); \
77         EMGD_DEBUG_S("    [%p].start  = [%08x]",  a->start, (unsigned int) EMGD_READ32(a->start)); \
78         EMGD_DEBUG_S("    [%p].head   = [%08x]",  a->head,  (0x001ffffc & ((unsigned int) EMGD_READ32(a->head)))); \
79         EMGD_DEBUG_S("    [%p].tail   = [%08x]",  a->tail,  (0x001ffff8 & (unsigned int) EMGD_READ32(a->tail))); \
80         EMGD_DEBUG_S("    [%p].ctrl   = [%08x]",  a->ctrl,  (unsigned int) EMGD_READ32(a->ctrl)); \
81         EMGD_DEBUG_S("    [%08x].res",             (unsigned int) a->reservation); \
82 }
83
84 #define IGD_PRINTK_DISPLAY(display_context) \
85 { \
86         EMGD_DEBUG("Display Context:"); \
87         EMGD_DEBUG_S("    [%8d].plane",  (int) display_context->plane); \
88         EMGD_DEBUG_S("    [%8d].blend",  (int) display_context->blend_operation); \
89         EMGD_DEBUG_S("    [%8d].pipe",   (int) display_context->pipe); \
90         EMGD_DEBUG_S("    [%8d].port",   (int) display_context->port); \
91         EMGD_DEBUG_S("    [%8d].graph",  (int) display_context->alloc_type); \
92         EMGD_DEBUG_S("    [%8d].mode_n", (int) display_context->mode_number); \
93         EMGD_DEBUG_S("    [%8d].ref",    (int) display_context->refresh); \
94         EMGD_DEBUG_S("    [%8d].enable", (int) display_context->enable); \
95         EMGD_DEBUG_S("    [%8d].ulPipe", (int) display_context->ulPipe); \
96         EMGD_DEBUG_S("    [%8d].ulMode", (int) display_context->ulModeNumber); \
97         EMGD_DEBUG_S("    [%8d].ulRef",  (int) display_context->ulRefresh); \
98 }
99
100 #define IGD_PRINTK_FBINFO(fb_info) \
101 { \
102         EMGD_DEBUG("FrameBuffer Info:"); \
103         EMGD_DEBUG_S("    [%8d].width",  (int) fb_info->width); \
104         EMGD_DEBUG_S("    [%8d].height",  (int) fb_info->height); \
105         EMGD_DEBUG_S("    [%8d].screen_pitch",  (int) fb_info->screen_pitch); \
106         EMGD_DEBUG_S("    [%8x].fb_base_offset",  (unsigned int) fb_info->fb_base_offset); \
107         EMGD_DEBUG_S("    [%8x].pixel_format",  (unsigned int) fb_info->pixel_format); \
108 }
109
110 #define IGD_PRINTK_PTINFO(pt_info) \
111 { \
112         EMGD_DEBUG("Port Info:"); \
113         EMGD_DEBUG_S("    [%8d].width",  (int) pt_info->width); \
114         EMGD_DEBUG_S("    [%8d].height",  (int) pt_info->height); \
115         EMGD_DEBUG_S("    [%8d].x_offset",  (int) pt_info->x_offset); \
116         EMGD_DEBUG_S("    [%8d].y_offset",  (int) pt_info->y_offset); \
117         EMGD_DEBUG_S("    [%8d].refresh",  (int) pt_info->refresh); \
118         EMGD_DEBUG_S("    [%8d].hsync_start",  (unsigned int) pt_info->hsync_start); \
119         EMGD_DEBUG_S("    [%8d].hsync_end",  (unsigned int) pt_info->hsync_end); \
120         EMGD_DEBUG_S("    [%8d].hblank_start",  (unsigned int) pt_info->hblank_start); \
121         EMGD_DEBUG_S("    [%8d].hblank_end",  (unsigned int) pt_info->hblank_end); \
122         EMGD_DEBUG_S("    [%8d].vsync_start",  (unsigned int) pt_info->vsync_start); \
123         EMGD_DEBUG_S("    [%8d].vsync_end",  (unsigned int) pt_info->vsync_end); \
124         EMGD_DEBUG_S("    [%8d].vblank_start",  (unsigned int) pt_info->vblank_start); \
125         EMGD_DEBUG_S("    [%8d].vblank_end",  (unsigned int) pt_info->vblank_end); \
126         EMGD_DEBUG_S("    [%8x].flags",  (unsigned int) pt_info->flags); \
127 }
128
129 #define IGD_PRINTK_FBINFO_2(a,b) \
130 { \
131         EMGD_DEBUG("FrameBuffer Info:"); \
132         EMGD_DEBUG_S("    a=[%8d] b=[%8d].width",  (int) (a)->width, (int) (b)->width); \
133         EMGD_DEBUG_S("    a=[%8d] b=[%8d].height",  (int) (a)->height, (int) (b)->height); \
134         EMGD_DEBUG_S("    a=[%8d] b=[%8d].screen_pitch",  (int) (a)->screen_pitch, (int) (b)->screen_pitch); \
135         EMGD_DEBUG_S("    a=[%8x] b=[%8x].fb_base_offset",  (unsigned int) (a)->fb_base_offset, (unsigned int) (b)->fb_base_offset); \
136         EMGD_DEBUG_S("    a=[%8x] b=[%8x].pixel_format",  (unsigned int) (a)->pixel_format, (unsigned int) (b)->pixel_format); \
137 }
138
139 #define IGD_PRINTK_PTINFO_2(a,b) \
140 { \
141         EMGD_DEBUG("Port Info:"); \
142         EMGD_DEBUG_S("    a=[%8d] b=[%8d].width",  (int) a->width, (int) b->width); \
143         EMGD_DEBUG_S("    a=[%8d] b=[%8d].height",  (int) a->height, (int) b->height); \
144         EMGD_DEBUG_S("    a=[%8d] b=[%8d].x_offset",  (int) a->x_offset, (int) b->x_offset); \
145         EMGD_DEBUG_S("    a=[%8d] b=[%8d].y_offset",  (int) a->y_offset, (int) b->y_offset); \
146         EMGD_DEBUG_S("    a=[%8d] b=[%8d].refresh",  (int) a->refresh, (int) b->refresh); \
147         EMGD_DEBUG_S("    a=[%8d] b=[%8d].hsync_start",  (unsigned int) a->hsync_start, (unsigned int) b->hsync_start); \
148         EMGD_DEBUG_S("    a=[%8d] b=[%8d].hsync_end",  (unsigned int) a->hsync_end, (unsigned int) b->hsync_end); \
149         EMGD_DEBUG_S("    a=[%8d] b=[%8d].hblank_start",  (unsigned int) a->hblank_start, (unsigned int) b->hblank_start); \
150         EMGD_DEBUG_S("    a=[%8d] b=[%8d].hblank_end",  (unsigned int) a->hblank_end, (unsigned int) b->hblank_end); \
151         EMGD_DEBUG_S("    a=[%8d] b=[%8d].vsync_start",  (unsigned int) a->vsync_start, (unsigned int) b->vsync_start); \
152         EMGD_DEBUG_S("    a=[%8d] b=[%8d].vsync_end",  (unsigned int) a->vsync_end, (unsigned int) b->vsync_end); \
153         EMGD_DEBUG_S("    a=[%8d] b=[%8d].vblank_start",  (unsigned int) a->vblank_start, (unsigned int) b->vblank_start); \
154         EMGD_DEBUG_S("    a=[%8d] b=[%8d].vblank_end",  (unsigned int) a->vblank_end, (unsigned int) b->vblank_end); \
155         EMGD_DEBUG_S("    a=[%8x] b=[%8x].flags",  (unsigned int) a->flags, (unsigned int) b->flags); \
156 }
157
158 #define IGD_PRINT_ICH_GPIO(ich_gpio_base) \
159 { \
160         EMGD_DEBUG("GPIO_USE_SEL = 0x%lx", EMGD_READ_PORT32(ich_gpio_base + 0x0)); \
161         EMGD_DEBUG("GPIO_IO_SEL = 0x%lx", EMGD_READ_PORT32(ich_gpio_base + 0x4)); \
162         EMGD_DEBUG("GPIO_LVL = 0x%lx", EMGD_READ_PORT32(ich_gpio_base + 0xc)); \
163         EMGD_DEBUG("GPIO_INV = 0x%lx", EMGD_READ_PORT32(ich_gpio_base + 0x2c)); \
164         EMGD_DEBUG("GPIO_USE_SEL2 = 0x%lx", EMGD_READ_PORT32(ich_gpio_base + 0x30));\
165         EMGD_DEBUG("GPIO_IO_SEL2 = 0x%lx", EMGD_READ_PORT32(ich_gpio_base + 0x34)); \
166         EMGD_DEBUG("GPIO_LVL2 = 0x%lx", EMGD_READ_PORT32(ich_gpio_base + 0x38)); \
167 }
168
169 #endif