ENGR00156850 gpu-viv: add gpu-viv driver source
[wandboard.git] / drivers / mxc / gpu-viv / hal / os / linux / kernel / gc_hal_kernel_linux.h
blob067c7400859c1bd071f8679e30899eba546fa464
1 /****************************************************************************
3 * Copyright (C) 2005 - 2011 by Vivante Corp.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the license, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *****************************************************************************/
24 #ifndef __gc_hal_kernel_linux_h_
25 #define __gc_hal_kernel_linux_h_
27 #include <linux/version.h>
28 #include <linux/init.h>
29 #include <linux/module.h>
30 #include <linux/fs.h>
31 #include <linux/mm.h>
32 #include <linux/sched.h>
33 #include <linux/signal.h>
34 #ifdef FLAREON
35 # include <asm/arch-realview/dove_gpio_irq.h>
36 #endif
37 #include <linux/interrupt.h>
38 #include <linux/vmalloc.h>
39 #include <linux/dma-mapping.h>
40 #include <linux/kthread.h>
42 #ifdef MODVERSIONS
43 # include <linux/modversions.h>
44 #endif
45 #include <asm/io.h>
46 #include <asm/uaccess.h>
48 #if ENABLE_GPU_CLOCK_BY_DRIVER && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
49 #include <linux/clk.h>
50 #endif
52 #define NTSTRSAFE_NO_CCH_FUNCTIONS
53 #include "gc_hal.h"
54 #include "gc_hal_driver.h"
55 #include "gc_hal_kernel.h"
56 #include "gc_hal_kernel_device.h"
57 #include "gc_hal_kernel_os.h"
59 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
60 #define FIND_TASK_BY_PID(x) pid_task(find_vpid(x), PIDTYPE_PID)
61 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
62 #define FIND_TASK_BY_PID(x) find_task_by_vpid(x)
63 #else
64 #define FIND_TASK_BY_PID(x) find_task_by_pid(x)
65 #endif
67 #define _WIDE(string) L##string
68 #define WIDE(string) _WIDE(string)
70 #define countof(a) (sizeof(a) / sizeof(a[0]))
72 #define DRV_NAME "galcore"
74 #define GetPageCount(size, offset) ((((size) + ((offset) & ~PAGE_CACHE_MASK)) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT)
76 static inline gctINT
77 GetOrder(
78 IN gctINT numPages
81 gctINT order = 0;
83 while ((1 << order) < numPages) order++;
85 return order;
88 #endif /* __gc_hal_kernel_linux_h_ */