Patchwork [meta-fsl-arm-extra,1/2] linux-wandboard: Remove usused patch and INC_PR

login
register
mail settings
Submitter Otavio Salvador
Date July 22, 2013, 9:50 p.m.
Message ID <1374529840-29832-1-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/54199/
State Accepted
Delegated to: Otavio Salvador
Headers show

Comments

Otavio Salvador - July 22, 2013, 9:50 p.m.
The kernel is based on Freescale 3.0.35-4.0.0 kernel and has the
4.6.9p11 Vivante GPU code applied so the patch is unused but was
leftover.

The INC_PR were not being used so this has been dropped as well.

Change-Id: I24b39fa3302760d15edb49ffe889a5b3e017f595
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 ...1005-gpu-4.6.9p11-kernel-code-integration.patch | 6294 --------------------
 recipes-kernel/linux/linux-wandboard.inc           |    2 -
 2 files changed, 6296 deletions(-)
 delete mode 100644 recipes-kernel/linux/linux-wandboard-3.0.35/0001-ENGR00251005-gpu-4.6.9p11-kernel-code-integration.patch

Patch

diff --git a/recipes-kernel/linux/linux-wandboard-3.0.35/0001-ENGR00251005-gpu-4.6.9p11-kernel-code-integration.patch b/recipes-kernel/linux/linux-wandboard-3.0.35/0001-ENGR00251005-gpu-4.6.9p11-kernel-code-integration.patch
deleted file mode 100644
index 1e64c4f..0000000
--- a/recipes-kernel/linux/linux-wandboard-3.0.35/0001-ENGR00251005-gpu-4.6.9p11-kernel-code-integration.patch
+++ /dev/null
@@ -1,6294 +0,0 @@ 
-From 9af09f417b8f9d2205087f23e88931f64d649995 Mon Sep 17 00:00:00 2001
-From: Loren Huang <b02279@freescale.com>
-Date: Fri, 15 Feb 2013 23:34:51 +0800
-Subject: [PATCH] ENGR00251005 [gpu]4.6.9p11 kernel code integration
-
--4.6.9p11 kernel code integration
--Additionally release runtime pm and regulator when destory gpu driver
-to avoid reference count mismatch.
-
-Upstream-Status: Pending
-
-Signed-off-by: Loren Huang <b02279@freescale.com>
-Acked-by: Lily Zhang
----
- drivers/mxc/gpu-viv/Kbuild                         |   3 +-
- .../hal/kernel/gc_hal_kernel_hardware_command_vg.c |   4 +-
- .../hal/kernel/gc_hal_kernel_hardware_command_vg.h |   5 +-
- .../GC350/hal/kernel/gc_hal_kernel_hardware_vg.c   |   4 +-
- .../GC350/hal/kernel/gc_hal_kernel_hardware_vg.h   |   5 +-
- .../arch/XAQ2/hal/kernel/gc_hal_kernel_context.c   |  19 +-
- .../arch/XAQ2/hal/kernel/gc_hal_kernel_context.h   |   4 +-
- .../arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c  | 217 ++++++-
- .../arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.h  |   4 +-
- drivers/mxc/gpu-viv/config                         |   2 +-
- drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c     | 700 +++++++++++++++++----
- drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h     |  86 ++-
- .../mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c |  24 +-
- .../gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c  |  18 +-
- drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c  |  57 +-
- .../mxc/gpu-viv/hal/kernel/gc_hal_kernel_debug.c   |   4 +-
- .../mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c   | 163 ++---
- .../mxc/gpu-viv/hal/kernel/gc_hal_kernel_heap.c    |   4 +-
- .../hal/kernel/gc_hal_kernel_interrupt_vg.c        |   4 +-
- drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c |  23 +-
- .../mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu_vg.c  |   4 +-
- .../mxc/gpu-viv/hal/kernel/gc_hal_kernel_power.c   | 347 ++++++++++
- .../mxc/gpu-viv/hal/kernel/gc_hal_kernel_precomp.h |   4 +-
- drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_vg.c  | 130 ++--
- drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_vg.h  |   5 +-
- .../hal/kernel/gc_hal_kernel_video_memory.c        |   4 +-
- drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h        | 125 +++-
- drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h   |  62 +-
- .../mxc/gpu-viv/hal/kernel/inc/gc_hal_compiler.h   |  27 +-
- drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h | 270 ++++----
- .../mxc/gpu-viv/hal/kernel/inc/gc_hal_driver_vg.h  |   9 +-
- drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_dump.h   |   3 +-
- .../gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h    |   4 +-
- .../hal/kernel/inc/gc_hal_eglplatform_type.h       |   3 +-
- drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h |  39 +-
- .../mxc/gpu-viv/hal/kernel/inc/gc_hal_engine_vg.h  |  11 +-
- drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h   |  16 +-
- .../gpu-viv/hal/kernel/inc/gc_hal_kernel_buffer.h  |  49 +-
- drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_mem.h    |  16 +-
- .../mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h    |  25 +-
- .../mxc/gpu-viv/hal/kernel/inc/gc_hal_profiler.h   |   2 +-
- drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_raster.h |   4 +-
- drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_rename.h |   4 +-
- .../mxc/gpu-viv/hal/kernel/inc/gc_hal_statistics.h |   3 +-
- drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_types.h  |  27 +-
- .../mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h    |   6 +-
- drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h     |   7 +-
- .../hal/os/linux/kernel/gc_hal_kernel_debug.h      |   4 +-
- .../hal/os/linux/kernel/gc_hal_kernel_debugfs.c    |   2 +-
- .../hal/os/linux/kernel/gc_hal_kernel_debugfs.h    |   4 +-
- .../hal/os/linux/kernel/gc_hal_kernel_device.c     |  59 +-
- .../hal/os/linux/kernel/gc_hal_kernel_device.h     |   7 +-
- .../hal/os/linux/kernel/gc_hal_kernel_driver.c     |  27 +-
- .../hal/os/linux/kernel/gc_hal_kernel_linux.c      |  20 +-
- .../hal/os/linux/kernel/gc_hal_kernel_linux.h      |   4 +-
- .../hal/os/linux/kernel/gc_hal_kernel_math.c       |   4 +-
- .../gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | 158 ++++-
- .../gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h |  12 +-
- 58 files changed, 2170 insertions(+), 687 deletions(-)
- create mode 100644 drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_power.c
-
-diff --git a/drivers/mxc/gpu-viv/Kbuild b/drivers/mxc/gpu-viv/Kbuild
-index bc5ec02..0b18a7b 100644
---- a/drivers/mxc/gpu-viv/Kbuild
-+++ b/drivers/mxc/gpu-viv/Kbuild
-@@ -54,7 +54,8 @@ OBJS += $(HAL_KERNEL_DIR)/gc_hal_kernel.o \
-         $(HAL_KERNEL_DIR)/gc_hal_kernel_event.o \
-         $(HAL_KERNEL_DIR)/gc_hal_kernel_heap.o \
-         $(HAL_KERNEL_DIR)/gc_hal_kernel_mmu.o \
--        $(HAL_KERNEL_DIR)/gc_hal_kernel_video_memory.o
-+        $(HAL_KERNEL_DIR)/gc_hal_kernel_video_memory.o \
-+        $(HAL_KERNEL_DIR)/gc_hal_kernel_power.o
- 
- OBJS += $(ARCH_KERNEL_DIR)/gc_hal_kernel_context.o \
-         $(ARCH_KERNEL_DIR)/gc_hal_kernel_hardware.o
-diff --git a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_command_vg.c b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_command_vg.c
-index a8b9922..cf40e3f 100644
---- a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_command_vg.c
-+++ b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_command_vg.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal.h"
- #include "gc_hal_kernel.h"
- 
-diff --git a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_command_vg.h b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_command_vg.h
-index e2a9f8e..aa767ee 100644
---- a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_command_vg.h
-+++ b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_command_vg.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,9 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
--
- #ifndef __gc_hal_kernel_hardware_command_vg_h_
- #define __gc_hal_kernel_hardware_command_vg_h_
- 
-diff --git a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.c b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.c
-index 29b3e8c..4a6010d 100644
---- a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.c
-+++ b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal.h"
- #include "gc_hal_kernel.h"
- #include "gc_hal_kernel_hardware_command_vg.h"
-diff --git a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.h b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.h
-index e3714b7..83a603e 100644
---- a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.h
-+++ b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,9 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
--
- #ifndef __gc_hal_kernel_hardware_vg_h_
- #define __gc_hal_kernel_hardware_vg_h_
- 
-diff --git a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c
-index a52c1c8..22e1f27 100644
---- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c
-+++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,9 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
--
- #include "gc_hal.h"
- #include "gc_hal_kernel.h"
- #include "gc_hal_kernel_context.h"
-@@ -474,7 +471,7 @@ _InitializeContextBuffer(
-     index += _SwitchPipe(Context, index, gcvPIPE_3D);
- 
-     /* Current context pointer. */
--#if gcdDEBUG && 1
-+#if gcdDEBUG 
-     index += _State(Context, index, 0x03850 >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE);
- #endif
- 
-@@ -1257,11 +1254,11 @@ gckCONTEXT_Construct(
-             }
- 
-             /* Copy the current context. */
--            gcmkONERROR(gckOS_MemCopy(
-+            gckOS_MemCopy(
-                 tempContext->logical,
-                 currContext->logical,
-                 context->totalSize
--                ));
-+                );
- 
-             /* Get the next context buffer. */
-             tempContext = tempContext->next;
-@@ -1442,7 +1439,7 @@ gckCONTEXT_Update(
-             gcmkONERROR(gckKERNEL_OpenUserData(
-                 kernel, needCopy,
-                 Context->recordArray,
--                kDelta->recordArray, Context->recordArraySize,
-+                gcmUINT64_TO_PTR(kDelta->recordArray), Context->recordArraySize,
-                 (gctPOINTER *) &recordArray
-                 ));
- 
-@@ -1551,13 +1548,13 @@ gckCONTEXT_Update(
-             gcmkASSERT(kDelta->refCount >= 0);
- 
-             /* Get the next state delta. */
--            nDelta = kDelta->next;
-+            nDelta = gcmUINT64_TO_PTR(kDelta->next);
- 
-             /* Get access to the state records. */
-             gcmkONERROR(gckKERNEL_CloseUserData(
-                 kernel, needCopy,
-                 gcvFALSE,
--                kDelta->recordArray, Context->recordArraySize,
-+                gcmUINT64_TO_PTR(kDelta->recordArray), Context->recordArraySize,
-                 (gctPOINTER *) &recordArray
-                 ));
- 
-@@ -1704,7 +1701,7 @@ OnError:
-         gcmkVERIFY_OK(gckKERNEL_CloseUserData(
-             kernel, needCopy,
-             gcvFALSE,
--            kDelta->recordArray, Context->recordArraySize,
-+            gcmUINT64_TO_PTR(kDelta->recordArray), Context->recordArraySize,
-             (gctPOINTER *) &recordArray
-             ));
- 	}
-diff --git a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.h b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.h
-index a5030de..7554045 100644
---- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.h
-+++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_kernel_context_h_
- #define __gc_hal_kernel_context_h_
- 
-diff --git a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c
-index d3624d1..a87259e 100644
---- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c
-+++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal.h"
- #include "gc_hal_kernel.h"
- 
-@@ -258,6 +256,13 @@ _IdentifyHardware(
-             = ((((gctUINT32) (Identity->chipMinorFeatures2)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 5:5) - (0 ? 5:5) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:5) - (0 ? 5:5) + 1))))))) << (0 ? 5:5))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 5:5) - (0 ? 5:5) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:5) - (0 ? 5:5) + 1))))))) << (0 ? 5:5)));
-     }
- 
-+    if ((Identity->chipModel == gcv800) && (Identity->chipRevision == 0x4605))
-+    {
-+        /* Correct feature bit: RTL does not have such feature. */
-+        Identity->chipFeatures
-+            = ((((gctUINT32) (Identity->chipFeatures)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:31) - (0 ? 31:31) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:31) - (0 ? 31:31) + 1))))))) << (0 ? 31:31))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 31:31) - (0 ? 31:31) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:31) - (0 ? 31:31) + 1))))))) << (0 ? 31:31)));
-+    }
-+
-     gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE,
-                    "Identity: chipFeatures=0x%08X",
-                    Identity->chipFeatures);
-@@ -819,7 +824,7 @@ OnError:
-         if (hardware->powerOffTimer != gcvNULL)
-         {
-             gcmkVERIFY_OK(gckOS_StopTimer(Os, hardware->powerOffTimer));
--            gcmkVERIFY_OK(gckOS_DestoryTimer(Os, hardware->powerOffTimer));
-+            gcmkVERIFY_OK(gckOS_DestroyTimer(Os, hardware->powerOffTimer));
-         }
- #endif
- 
-@@ -872,7 +877,7 @@ gckHARDWARE_Destroy(
- 
- #if gcdPOWEROFF_TIMEOUT
-     gcmkVERIFY_OK(gckOS_StopTimer(Hardware->os, Hardware->powerOffTimer));
--    gcmkVERIFY_OK(gckOS_DestoryTimer(Hardware->os, Hardware->powerOffTimer));
-+    gcmkVERIFY_OK(gckOS_DestroyTimer(Hardware->os, Hardware->powerOffTimer));
- #endif
- 
-     gcmkVERIFY_OK(gckOS_AtomDestroy(Hardware->os, Hardware->pageTableDirty));
-@@ -4399,6 +4404,13 @@ gckHARDWARE_SetPowerManagementState(
-     /* Save the new power state. */
-     Hardware->chipPowerState = State;
- 
-+#if gcdDVFS
-+    if (State == gcvPOWER_ON && Hardware->kernel->dvfs)
-+    {
-+        gckDVFS_Start(Hardware->kernel->dvfs);
-+    }
-+#endif
-+
- #if gcdPOWEROFF_TIMEOUT
-     /* Reset power off time */
-     gcmkONERROR(gckOS_GetTicks(&currentTime));
-@@ -5476,7 +5488,9 @@ gckHARDWARE_IsFeatureAvailable(
-         available = ((((gctUINT32) (Hardware->identity.chipMinorFeatures)) >> (0 ? 22:22) & ((gctUINT32) ((((1 ? 22:22) - (0 ? 22:22) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 22:22) - (0 ? 22:22) + 1)))))) == (0x1  & ((gctUINT32) ((((1 ? 22:22) - (0 ? 22:22) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 22:22) - (0 ? 22:22) + 1)))))));
-         break;
-     case gcvFEATURE_DYNAMIC_FREQUENCY_SCALING:
--        available = ((((gctUINT32) (Hardware->identity.chipMinorFeatures2)) >> (0 ? 14:14) & ((gctUINT32) ((((1 ? 14:14) - (0 ? 14:14) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 14:14) - (0 ? 14:14) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 14:14) - (0 ? 14:14) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 14:14) - (0 ? 14:14) + 1)))))));
-+        /* This feature doesn't apply for 2D cores. */
-+        available = ((((gctUINT32) (Hardware->identity.chipMinorFeatures2)) >> (0 ? 14:14) & ((gctUINT32) ((((1 ? 14:14) - (0 ? 14:14) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 14:14) - (0 ? 14:14) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 14:14) - (0 ? 14:14) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 14:14) - (0 ? 14:14) + 1)))))))
-+            &&      ((((gctUINT32) (Hardware->identity.chipFeatures)) >> (0 ? 2:2) & ((gctUINT32) ((((1 ? 2:2) - (0 ? 2:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 2:2) - (0 ? 2:2) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 2:2) - (0 ? 2:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 2:2) - (0 ? 2:2) + 1)))))));
-         break;
- 
-     default:
-@@ -6231,3 +6245,194 @@ OnError:
- }
- #endif
- 
-+#if gcdDVFS
-+#define READ_FROM_EATER1 0
-+
-+gceSTATUS
-+gckHARDWARE_QueryLoad(
-+    IN gckHARDWARE Hardware,
-+    OUT gctUINT32 * Load
-+    )
-+{
-+    gctUINT32 debug1;
-+    gceSTATUS status;
-+    gcmkHEADER_ARG("Hardware=0x%X", Hardware);
-+
-+    gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
-+    gcmkVERIFY_ARGUMENT(Load != gcvNULL);
-+
-+    gckOS_AcquireMutex(Hardware->os, Hardware->powerMutex, gcvINFINITE);
-+
-+    if (Hardware->chipPowerState == gcvPOWER_ON)
-+    {
-+        gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os,
-+                                         Hardware->core,
-+                                         0x00110,
-+                                         Load));
-+#if READ_FROM_EATER1
-+        gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os,
-+                                         Hardware->core,
-+                                         0x00134,
-+                                         Load));
-+#endif
-+
-+        gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os,
-+                                         Hardware->core,
-+                                         0x00114,
-+                                         &debug1));
-+
-+        /* Patch result of 0x110 with result of 0x114. */
-+        if ((debug1 & 0xFF) == 1)
-+        {
-+            *Load &= ~0xFF;
-+            *Load |= 1;
-+        }
-+
-+        if (((debug1 & 0xFF00) >> 8) == 1)
-+        {
-+            *Load &= ~(0xFF << 8);
-+            *Load |= 1 << 8;
-+        }
-+
-+        if (((debug1 & 0xFF0000) >> 16) == 1)
-+        {
-+            *Load &= ~(0xFF << 16);
-+            *Load |= 1 << 16;
-+        }
-+
-+        if (((debug1 & 0xFF000000) >> 24) == 1)
-+        {
-+            *Load &= ~(0xFF << 24);
-+            *Load |= 1 << 24;
-+        }
-+    }
-+    else
-+    {
-+        status = gcvSTATUS_INVALID_REQUEST;
-+    }
-+
-+OnError:
-+
-+    gckOS_ReleaseMutex(Hardware->os, Hardware->powerMutex);
-+
-+    gcmkFOOTER();
-+    return status;
-+}
-+
-+gceSTATUS
-+gckHARDWARE_SetDVFSPeroid(
-+    IN gckHARDWARE Hardware,
-+    OUT gctUINT32 Frequency
-+    )
-+{
-+    gceSTATUS status;
-+    gctUINT32 period;
-+    gctUINT32 eater;
-+
-+#if READ_FROM_EATER1
-+    gctUINT32 period1;
-+    gctUINT32 eater1;
-+#endif
-+
-+    gcmkHEADER_ARG("Hardware=0x%X Frequency=%d", Hardware, Frequency);
-+
-+    gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
-+
-+    period = 0;
-+
-+    while((64 << period) < (gcdDVFS_ANAYLSE_WINDOW * Frequency * 1000) )
-+    {
-+        period++;
-+    }
-+
-+#if READ_FROM_EATER1
-+    /*
-+    *  Peroid = F * 1000 * 1000 / (60 * 16 * 1024);
-+    */
-+    period1 = Frequency * 6250 / 6114;
-+#endif
-+
-+    gckOS_AcquireMutex(Hardware->os, Hardware->powerMutex, gcvINFINITE);
-+
-+    if (Hardware->chipPowerState == gcvPOWER_ON)
-+    {
-+        /* Get current configure. */
-+        gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os,
-+                                         Hardware->core,
-+                                         0x0010C,
-+                                         &eater));
-+
-+        /* Change peroid. */
-+        gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os,
-+                                          Hardware->core,
-+                                          0x0010C,
-+                                          ((((gctUINT32) (eater)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:8) - (0 ? 15:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:8) - (0 ? 15:8) + 1))))))) << (0 ? 15:8))) | (((gctUINT32) ((gctUINT32) (period) & ((gctUINT32) ((((1 ? 15:8) - (0 ? 15:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:8) - (0 ? 15:8) + 1))))))) << (0 ? 15:8)))));
-+
-+#if READ_FROM_EATER1
-+        /* Config eater1. */
-+        gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os,
-+                                         Hardware->core,
-+                                         0x00130,
-+                                         &eater1));
-+
-+        gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os,
-+                                          Hardware->core,
-+                                          0x00130,
-+                                          ((((gctUINT32) (eater1)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:16) - (0 ? 31:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:16) - (0 ? 31:16) + 1))))))) << (0 ? 31:16))) | (((gctUINT32) ((gctUINT32) (period1) & ((gctUINT32) ((((1 ? 31:16) - (0 ? 31:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:16) - (0 ? 31:16) + 1))))))) << (0 ? 31:16)))));
-+#endif
-+    }
-+    else
-+    {
-+        status = gcvSTATUS_INVALID_REQUEST;
-+    }
-+
-+OnError:
-+    gckOS_ReleaseMutex(Hardware->os, Hardware->powerMutex);
-+
-+    gcmkFOOTER();
-+    return status;
-+}
-+
-+gceSTATUS
-+gckHARDWARE_InitDVFS(
-+    IN gckHARDWARE Hardware
-+    )
-+{
-+    gceSTATUS status;
-+    gctUINT32 data;
-+
-+    gcmkHEADER_ARG("Hardware=0x%X", Hardware);
-+
-+    gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
-+
-+    gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os,
-+                                     Hardware->core,
-+                                     0x0010C,
-+                                     &data));
-+
-+    data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16)));
-+    data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 18:18) - (0 ? 18:18) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 18:18) - (0 ? 18:18) + 1))))))) << (0 ? 18:18))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 18:18) - (0 ? 18:18) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 18:18) - (0 ? 18:18) + 1))))))) << (0 ? 18:18)));
-+    data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 19:19) - (0 ? 19:19) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 19:19) - (0 ? 19:19) + 1))))))) << (0 ? 19:19))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 19:19) - (0 ? 19:19) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 19:19) - (0 ? 19:19) + 1))))))) << (0 ? 19:19)));
-+    data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 20:20) - (0 ? 20:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 20:20) - (0 ? 20:20) + 1))))))) << (0 ? 20:20))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 20:20) - (0 ? 20:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 20:20) - (0 ? 20:20) + 1))))))) << (0 ? 20:20)));
-+    data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:23) - (0 ? 23:23) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:23) - (0 ? 23:23) + 1))))))) << (0 ? 23:23))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 23:23) - (0 ? 23:23) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:23) - (0 ? 23:23) + 1))))))) << (0 ? 23:23)));
-+    data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 22:22) - (0 ? 22:22) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 22:22) - (0 ? 22:22) + 1))))))) << (0 ? 22:22))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 22:22) - (0 ? 22:22) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 22:22) - (0 ? 22:22) + 1))))))) << (0 ? 22:22)));
-+
-+    gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE,
-+                   "DVFS Configure=0x%X",
-+                   data);
-+
-+    gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os,
-+                                      Hardware->core,
-+                                      0x0010C,
-+                                      data));
-+
-+    gcmkFOOTER_NO();
-+    return gcvSTATUS_OK;
-+
-+OnError:
-+    gcmkFOOTER();
-+    return status;
-+}
-+#endif
-+
-+
-diff --git a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.h b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.h
-index 9ecfca7..517b35c 100644
---- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.h
-+++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_kernel_hardware_h_
- #define __gc_hal_kernel_hardware_h_
- 
-diff --git a/drivers/mxc/gpu-viv/config b/drivers/mxc/gpu-viv/config
-index 7e6e867..1196efa 100644
---- a/drivers/mxc/gpu-viv/config
-+++ b/drivers/mxc/gpu-viv/config
-@@ -1,6 +1,6 @@
- ##############################################################################
- #
--#    Copyright (C) 2005 - 2012 by Vivante Corp.
-+#    Copyright (C) 2005 - 2013 by Vivante Corp.
- #
- #    This program is free software; you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
-index 0cb9244..c567640 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_precomp.h"
- 
- #define _GC_OBJ_ZONE    gcvZONE_KERNEL
-@@ -176,6 +174,15 @@ gckKERNEL_Construct(
-     kernel->command      = gcvNULL;
-     kernel->eventObj     = gcvNULL;
-     kernel->mmu          = gcvNULL;
-+#if gcdDVFS
-+    kernel->dvfs         = gcvNULL;
-+#endif
-+
-+    /* Initialize the gckKERNEL object. */
-+    kernel->object.type = gcvOBJ_KERNEL;
-+    kernel->os          = Os;
-+    kernel->core        = Core;
-+
- 
-     if (SharedDB == gcvNULL)
-     {
-@@ -200,6 +207,12 @@ gckKERNEL_Construct(
- 
-         /* Construct a database mutex. */
-         gcmkONERROR(gckOS_CreateMutex(Os, &kernel->db->dbMutex));
-+
-+        /* Construct a id-pointer database. */
-+        gcmkONERROR(gckKERNEL_CreateIntegerDatabase(kernel, &kernel->db->pointerDatabase));
-+
-+        /* Construct a id-pointer database mutex. */
-+        gcmkONERROR(gckOS_CreateMutex(Os, &kernel->db->pointerDatabaseMutex));
-     }
-     else
-     {
-@@ -215,11 +228,6 @@ gckKERNEL_Construct(
- 
-     kernel->timeOut      = gcdGPU_TIMEOUT;
- 
--    /* Initialize the gckKERNEL object. */
--    kernel->object.type = gcvOBJ_KERNEL;
--    kernel->os          = Os;
--    kernel->core        = Core;
--
-     /* Save context. */
-     kernel->context = Context;
- 
-@@ -279,6 +287,16 @@ gckKERNEL_Construct(
-                               (gctTIMERFUNCTION)_ResetFinishFunction,
-                               (gctPOINTER)kernel,
-                               &kernel->resetFlagClearTimer));
-+        kernel->resetTimeStamp = 0;
-+#endif
-+
-+#if gcdDVFS
-+        if (gckHARDWARE_IsFeatureAvailable(kernel->hardware,
-+                                           gcvFEATURE_DYNAMIC_FREQUENCY_SCALING))
-+        {
-+            gcmkONERROR(gckDVFS_Construct(kernel->hardware, &kernel->dvfs));
-+            gcmkONERROR(gckDVFS_Start(kernel->dvfs));
-+        }
- #endif
-     }
- 
-@@ -346,7 +364,7 @@ OnError:
-         if (kernel->resetFlagClearTimer)
-         {
-             gcmkVERIFY_OK(gckOS_StopTimer(Os, kernel->resetFlagClearTimer));
--            gcmkVERIFY_OK(gckOS_DestoryTimer(Os, kernel->resetFlagClearTimer));
-+            gcmkVERIFY_OK(gckOS_DestroyTimer(Os, kernel->resetFlagClearTimer));
-         }
- #endif
- 
-@@ -369,6 +387,14 @@ OnError:
-         }
- #endif
- 
-+#if gcdDVFS
-+        if (kernel->dvfs)
-+        {
-+            gcmkVERIFY_OK(gckDVFS_Stop(kernel->dvfs));
-+            gcmkVERIFY_OK(gckDVFS_Destroy(kernel->dvfs));
-+        }
-+#endif
-+
-         gcmkVERIFY_OK(gcmkOS_SAFE_FREE(Os, kernel));
-     }
- 
-@@ -444,6 +470,13 @@ gckKERNEL_Destroy(
- 
-         /* Destroy the database mutex. */
-         gcmkVERIFY_OK(gckOS_DeleteMutex(Kernel->os, Kernel->db->dbMutex));
-+
-+
-+        /* Destroy id-pointer database. */
-+        gcmkVERIFY_OK(gckKERNEL_DestroyIntegerDatabase(Kernel, Kernel->db->pointerDatabase));
-+
-+        /* Destroy id-pointer database mutex. */
-+        gcmkVERIFY_OK(gckOS_DeleteMutex(Kernel->os, Kernel->db->pointerDatabaseMutex));
-     }
- 
- #if gcdENABLE_VG
-@@ -472,7 +505,7 @@ gckKERNEL_Destroy(
-         if (Kernel->resetFlagClearTimer)
-         {
-             gcmkVERIFY_OK(gckOS_StopTimer(Kernel->os, Kernel->resetFlagClearTimer));
--            gcmkVERIFY_OK(gckOS_DestoryTimer(Kernel->os, Kernel->resetFlagClearTimer));
-+            gcmkVERIFY_OK(gckOS_DestroyTimer(Kernel->os, Kernel->resetFlagClearTimer));
-         }
- #endif
-     }
-@@ -484,6 +517,14 @@ gckKERNEL_Destroy(
-     gcmkVERIFY_OK(gckOS_DeleteMutex(Kernel->os, Kernel->virtualBufferLock));
- #endif
- 
-+#if gcdDVFS
-+    if (Kernel->dvfs)
-+    {
-+        gcmkVERIFY_OK(gckDVFS_Stop(Kernel->dvfs));
-+        gcmkVERIFY_OK(gckDVFS_Destroy(Kernel->dvfs));
-+    }
-+#endif
-+
-     /* Mark the gckKERNEL object as unknown. */
-     Kernel->object.type = gcvOBJ_UNKNOWN;
- 
-@@ -848,11 +889,14 @@ gckKERNEL_Dispatch(
-     gcuVIDMEM_NODE_PTR node = gcvNULL;
-     gctBOOL locked = gcvFALSE;
-     gctPHYS_ADDR physical = gcvNULL;
-+    gctPOINTER logical = gcvNULL;
-+    gctPOINTER info = gcvNULL;
-+    gckCONTEXT context = gcvNULL;
-     gctUINT32 address;
-     gctUINT32 processID;
-+    gckKERNEL kernel = Kernel;
- #if gcdSECURE_USER
-     gcskSECURE_CACHE_PTR cache;
--    gctPOINTER logical;
- #endif
-     gctBOOL asynchronous;
-     gctPOINTER paddr = gcvNULL;
-@@ -910,156 +954,185 @@ gckKERNEL_Dispatch(
-         break;
- 
-     case gcvHAL_MAP_MEMORY:
--        physical = Interface->u.MapMemory.physical;
-+        physical = gcmINT2PTR(Interface->u.MapMemory.physical);
- 
-         /* Map memory. */
-         gcmkONERROR(
-             gckKERNEL_MapMemory(Kernel,
-                                 physical,
--                                Interface->u.MapMemory.bytes,
--                                &Interface->u.MapMemory.logical));
-+                                (gctSIZE_T) Interface->u.MapMemory.bytes,
-+                                &logical));
-+
-+        Interface->u.MapMemory.logical = gcmPTR_TO_UINT64(logical);
-+
-         gcmkVERIFY_OK(
-             gckKERNEL_AddProcessDB(Kernel,
-                                    processID, gcvDB_MAP_MEMORY,
--                                   Interface->u.MapMemory.logical,
-+                                   logical,
-                                    physical,
--                                   Interface->u.MapMemory.bytes));
-+                                   (gctSIZE_T) Interface->u.MapMemory.bytes));
-         break;
- 
-     case gcvHAL_UNMAP_MEMORY:
--        physical = Interface->u.UnmapMemory.physical;
-+        physical = gcmINT2PTR(Interface->u.UnmapMemory.physical);
- 
-         /* Unmap memory. */
-         gcmkONERROR(
-             gckKERNEL_UnmapMemory(Kernel,
-                                   physical,
--                                  Interface->u.UnmapMemory.bytes,
--                                  Interface->u.UnmapMemory.logical));
-+                                  (gctSIZE_T) Interface->u.UnmapMemory.bytes,
-+                                  gcmUINT64_TO_PTR(Interface->u.UnmapMemory.logical)));
-         gcmkVERIFY_OK(
-             gckKERNEL_RemoveProcessDB(Kernel,
-                                       processID, gcvDB_MAP_MEMORY,
--                                      Interface->u.UnmapMemory.logical));
-+                                      gcmUINT64_TO_PTR(Interface->u.UnmapMemory.logical)));
-         break;
- 
-     case gcvHAL_ALLOCATE_NON_PAGED_MEMORY:
-+        bytes = (gctSIZE_T) Interface->u.AllocateNonPagedMemory.bytes;
-+
-         /* Allocate non-paged memory. */
-         gcmkONERROR(
-             gckOS_AllocateNonPagedMemory(
-                 Kernel->os,
-                 FromUser,
--                &Interface->u.AllocateNonPagedMemory.bytes,
--                &Interface->u.AllocateNonPagedMemory.physical,
--                &Interface->u.AllocateNonPagedMemory.logical));
-+                &bytes,
-+                &physical,
-+                &logical));
-+
-+        Interface->u.AllocateNonPagedMemory.bytes    = bytes;
-+        Interface->u.AllocateNonPagedMemory.logical  = gcmPTR_TO_UINT64(logical);
-+        Interface->u.AllocateNonPagedMemory.physical = gcmPTR_TO_NAME(physical);
- 
-         gcmkVERIFY_OK(
-             gckKERNEL_AddProcessDB(Kernel,
-                                    processID, gcvDB_NON_PAGED,
--                                   Interface->u.AllocateNonPagedMemory.logical,
--                                   Interface->u.AllocateNonPagedMemory.physical,
--                                   Interface->u.AllocateNonPagedMemory.bytes));
-+                                   logical,
-+                                   gcmINT2PTR(Interface->u.AllocateNonPagedMemory.physical),
-+                                   bytes));
-+
-         break;
- 
-     case gcvHAL_ALLOCATE_VIRTUAL_COMMAND_BUFFER:
- #if gcdVIRTUAL_COMMAND_BUFFER
-+        bytes = (gctSIZE_T) Interface->u.AllocateVirtualCommandBuffer.bytes;
-+
-         gcmkONERROR(
-             gckKERNEL_AllocateVirtualCommandBuffer(
-                 Kernel,
-                 FromUser,
--                &Interface->u.AllocateVirtualCommandBuffer.bytes,
--                &Interface->u.AllocateVirtualCommandBuffer.physical,
--                &Interface->u.AllocateVirtualCommandBuffer.logical));
-+                &bytes,
-+                &physical,
-+                &logical));
-+
-+        Interface->u.AllocateVirtualCommandBuffer.bytes    = bytes;
-+        Interface->u.AllocateVirtualCommandBuffer.logical  = gcmPTR_TO_UINT64(logical);
-+        Interface->u.AllocateVirtualCommandBuffer.physical = gcmPTR_TO_NAME(physical);
- 
-         gcmkVERIFY_OK(
-             gckKERNEL_AddProcessDB(Kernel,
-                                    processID, gcvDB_COMMAND_BUFFER,
--                                   Interface->u.AllocateVirtualCommandBuffer.logical,
--                                   Interface->u.AllocateVirtualCommandBuffer.physical,
--                                   Interface->u.AllocateVirtualCommandBuffer.bytes));
-+                                   logical,
-+                                   gcmINT2PTR(Interface->u.AllocateVirtualCommandBuffer.physical),
-+                                   bytes));
- #else
-         status = gcvSTATUS_NOT_SUPPORTED;
- #endif
-         break;
- 
-     case gcvHAL_FREE_NON_PAGED_MEMORY:
--        physical = Interface->u.FreeNonPagedMemory.physical;
-+        physical = gcmNAME_TO_PTR(Interface->u.FreeNonPagedMemory.physical);
- 
-         /* Unmap user logical out of physical memory first. */
-         gcmkONERROR(gckOS_UnmapUserLogical(Kernel->os,
-                                            physical,
--                                           Interface->u.FreeNonPagedMemory.bytes,
--                                           Interface->u.FreeNonPagedMemory.logical));
-+                                           (gctSIZE_T) Interface->u.FreeNonPagedMemory.bytes,
-+                                           gcmUINT64_TO_PTR(Interface->u.FreeNonPagedMemory.logical)));
- 
-         /* Free non-paged memory. */
-         gcmkONERROR(
-             gckOS_FreeNonPagedMemory(Kernel->os,
--                                     Interface->u.FreeNonPagedMemory.bytes,
-+                                     (gctSIZE_T) Interface->u.FreeNonPagedMemory.bytes,
-                                      physical,
--                                     Interface->u.FreeNonPagedMemory.logical));
-+                                     gcmUINT64_TO_PTR(Interface->u.FreeNonPagedMemory.logical)));
- 
-         gcmkVERIFY_OK(
-             gckKERNEL_RemoveProcessDB(Kernel,
-                                       processID, gcvDB_NON_PAGED,
--                                      Interface->u.FreeNonPagedMemory.logical));
-+                                      gcmUINT64_TO_PTR(Interface->u.FreeNonPagedMemory.logical)));
- 
- #if gcdSECURE_USER
-         gcmkVERIFY_OK(gckKERNEL_FlushTranslationCache(
-             Kernel,
-             cache,
--            Interface->u.FreeNonPagedMemory.logical,
-+            gcmUINT64_TO_PTR(Interface->u.FreeNonPagedMemory.logical),
-             Interface->u.FreeNonPagedMemory.bytes));
- #endif
-+
-+        gcmRELEASE_NAME(Interface->u.FreeNonPagedMemory.physical);
-+
-         break;
- 
-     case gcvHAL_ALLOCATE_CONTIGUOUS_MEMORY:
-+        bytes = (gctSIZE_T) Interface->u.AllocateContiguousMemory.bytes;
-+
-         /* Allocate contiguous memory. */
-         gcmkONERROR(gckOS_AllocateContiguous(
-             Kernel->os,
-             FromUser,
--            &Interface->u.AllocateContiguousMemory.bytes,
--            &Interface->u.AllocateContiguousMemory.physical,
--            &Interface->u.AllocateContiguousMemory.logical));
-+            &bytes,
-+            &physical,
-+            &logical));
-+
-+        Interface->u.AllocateContiguousMemory.bytes    = bytes;
-+        Interface->u.AllocateContiguousMemory.logical  = gcmPTR_TO_UINT64(logical);
-+        Interface->u.AllocateContiguousMemory.physical = gcmPTR_TO_NAME(physical);
- 
-         gcmkONERROR(gckHARDWARE_ConvertLogical(
-             Kernel->hardware,
--            Interface->u.AllocateContiguousMemory.logical,
-+            gcmUINT64_TO_PTR(Interface->u.AllocateContiguousMemory.logical),
-             &Interface->u.AllocateContiguousMemory.address));
- 
-         gcmkVERIFY_OK(gckKERNEL_AddProcessDB(
-             Kernel,
-             processID, gcvDB_CONTIGUOUS,
--            Interface->u.AllocateContiguousMemory.logical,
--            Interface->u.AllocateContiguousMemory.physical,
--            Interface->u.AllocateContiguousMemory.bytes));
-+            logical,
-+            gcmINT2PTR(Interface->u.AllocateContiguousMemory.physical),
-+            bytes));
-+
-         break;
- 
-     case gcvHAL_FREE_CONTIGUOUS_MEMORY:
--        physical = Interface->u.FreeContiguousMemory.physical;
-+        physical = gcmNAME_TO_PTR(Interface->u.FreeContiguousMemory.physical);
- 
-         /* Unmap user logical out of physical memory first. */
-         gcmkONERROR(gckOS_UnmapUserLogical(Kernel->os,
-                                            physical,
--                                           Interface->u.FreeContiguousMemory.bytes,
--                                           Interface->u.FreeContiguousMemory.logical));
-+                                           (gctSIZE_T) Interface->u.FreeContiguousMemory.bytes,
-+                                           gcmUINT64_TO_PTR(Interface->u.FreeContiguousMemory.logical)));
- 
-         /* Free contiguous memory. */
-         gcmkONERROR(
-             gckOS_FreeContiguous(Kernel->os,
-                                  physical,
--                                 Interface->u.FreeContiguousMemory.logical,
--                                 Interface->u.FreeContiguousMemory.bytes));
-+                                 gcmUINT64_TO_PTR(Interface->u.FreeContiguousMemory.logical),
-+                                 (gctSIZE_T) Interface->u.FreeContiguousMemory.bytes));
- 
-         gcmkVERIFY_OK(
-             gckKERNEL_RemoveProcessDB(Kernel,
-                                       processID, gcvDB_CONTIGUOUS,
--                                      Interface->u.FreeNonPagedMemory.logical));
-+                                      gcmUINT64_TO_PTR(Interface->u.FreeNonPagedMemory.logical)));
- 
- #if gcdSECURE_USER
-         gcmkVERIFY_OK(gckKERNEL_FlushTranslationCache(
-             Kernel,
-             cache,
--            Interface->u.FreeContiguousMemory.logical,
-+            gcmUINT64_TO_PTR(Interface->u.FreeContiguousMemory.logical),
-             Interface->u.FreeContiguousMemory.bytes));
- #endif
-+
-+        gcmRELEASE_NAME(Interface->u.FreeContiguousMemory.physical);
-+
-         break;
- 
-     case gcvHAL_ALLOCATE_VIDEO_MEMORY:
-@@ -1076,10 +1149,8 @@ gckKERNEL_Dispatch(
-                             Interface->u.AllocateLinearVideoMemory.bytes,
-                             Interface->u.AllocateLinearVideoMemory.alignment,
-                             Interface->u.AllocateLinearVideoMemory.type,
--                            &Interface->u.AllocateLinearVideoMemory.node));
-+                            &node));
- 
--        /* Get actual size of node. */
--        node = Interface->u.AllocateLinearVideoMemory.node;
-         if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM)
-         {
-             bytes = node->VidMem.bytes;
-@@ -1092,14 +1163,17 @@ gckKERNEL_Dispatch(
-         gcmkONERROR(
-             gckKERNEL_AddProcessDB(Kernel,
-                                    processID, gcvDB_VIDEO_MEMORY,
--                                   Interface->u.AllocateLinearVideoMemory.node,
-+                                   node,
-                                    gcvNULL,
-                                    bytes));
-+
-+        /* Get the node. */
-+        Interface->u.AllocateLinearVideoMemory.node = gcmPTR_TO_UINT64(node);
-         break;
- 
-     case gcvHAL_FREE_VIDEO_MEMORY:
-+        node = gcmUINT64_TO_PTR(Interface->u.FreeVideoMemory.node);
- #ifdef __QNXNTO__
--        node = Interface->u.FreeVideoMemory.node;
-         if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM
-          && node->VidMem.logical != gcvNULL)
-         {
-@@ -1113,25 +1187,27 @@ gckKERNEL_Dispatch(
- #endif
-         /* Free video memory. */
-         gcmkONERROR(
--            gckVIDMEM_Free(Interface->u.FreeVideoMemory.node));
-+            gckVIDMEM_Free(node));
- 
-         gcmkONERROR(
-             gckKERNEL_RemoveProcessDB(Kernel,
-                                       processID, gcvDB_VIDEO_MEMORY,
--                                      Interface->u.FreeVideoMemory.node));
-+                                      node));
-+
-         break;
- 
-     case gcvHAL_LOCK_VIDEO_MEMORY:
-+        node = gcmUINT64_TO_PTR(Interface->u.LockVideoMemory.node);
-+
-         /* Lock video memory. */
-         gcmkONERROR(
-             gckVIDMEM_Lock(Kernel,
--                           Interface->u.LockVideoMemory.node,
-+                           node,
-                            Interface->u.LockVideoMemory.cacheable,
-                            &Interface->u.LockVideoMemory.address));
- 
-         locked = gcvTRUE;
- 
--        node = Interface->u.LockVideoMemory.node;
-         if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM)
-         {
-             /* Map video memory address into user space. */
-@@ -1148,18 +1224,20 @@ gckKERNEL_Dispatch(
-         }
-         gcmkASSERT(node->VidMem.logical != gcvNULL);
- 
--        Interface->u.LockVideoMemory.memory = node->VidMem.logical;
-+        Interface->u.LockVideoMemory.memory = gcmPTR_TO_UINT64(node->VidMem.logical);
- #else
-             gcmkONERROR(
-                 gckKERNEL_MapVideoMemory(Kernel,
-                                          FromUser,
-                                          Interface->u.LockVideoMemory.address,
--                                         &Interface->u.LockVideoMemory.memory));
-+                                         &logical));
-+
-+            Interface->u.LockVideoMemory.memory = gcmPTR_TO_UINT64(logical);
- #endif
-         }
-         else
-         {
--            Interface->u.LockVideoMemory.memory = node->Virtual.logical;
-+            Interface->u.LockVideoMemory.memory = gcmPTR_TO_UINT64(node->Virtual.logical);
- 
-             /* Success. */
-             status = gcvSTATUS_OK;
-@@ -1168,12 +1246,12 @@ gckKERNEL_Dispatch(
- #if gcdSECURE_USER
-         /* Return logical address as physical address. */
-         Interface->u.LockVideoMemory.address =
--            gcmPTR2INT(Interface->u.LockVideoMemory.memory);
-+            Interface->u.LockVideoMemory.memory;
- #endif
-         gcmkONERROR(
-             gckKERNEL_AddProcessDB(Kernel,
-                                    processID, gcvDB_VIDEO_MEMORY_LOCKED,
--                                   Interface->u.LockVideoMemory.node,
-+                                   node,
-                                    gcvNULL,
-                                    0));
- 
-@@ -1181,7 +1259,7 @@ gckKERNEL_Dispatch(
- 
-     case gcvHAL_UNLOCK_VIDEO_MEMORY:
-         /* Unlock video memory. */
--        node = Interface->u.UnlockVideoMemory.node;
-+        node = gcmUINT64_TO_PTR(Interface->u.UnlockVideoMemory.node);
- 
- #if gcdSECURE_USER
-         /* Save node information before it disappears. */
-@@ -1220,26 +1298,25 @@ gckKERNEL_Dispatch(
-             gcmkONERROR(
-                 gckKERNEL_RemoveProcessDB(Kernel,
-                                           processID, gcvDB_VIDEO_MEMORY_LOCKED,
--                                          Interface->u.UnlockVideoMemory.node));
-+                                          node));
-         }
--
-         break;
- 
-     case gcvHAL_EVENT_COMMIT:
-         /* Commit an event queue. */
-         gcmkONERROR(
-             gckEVENT_Commit(Kernel->eventObj,
--                            Interface->u.Event.queue));
-+                            gcmUINT64_TO_PTR(Interface->u.Event.queue)));
-         break;
- 
-     case gcvHAL_COMMIT:
-         /* Commit a command and context buffer. */
-         gcmkONERROR(
-             gckCOMMAND_Commit(Kernel->command,
--                              Interface->u.Commit.context,
--                              Interface->u.Commit.commandBuffer,
--                              Interface->u.Commit.delta,
--                              Interface->u.Commit.queue,
-+                              gcmNAME_TO_PTR(Interface->u.Commit.context),
-+                              gcmUINT64_TO_PTR(Interface->u.Commit.commandBuffer),
-+                              gcmUINT64_TO_PTR(Interface->u.Commit.delta),
-+                              gcmUINT64_TO_PTR(Interface->u.Commit.queue),
-                               processID));
-         break;
- 
-@@ -1253,42 +1330,49 @@ gckKERNEL_Dispatch(
-         gcmkONERROR(
-             gckOS_MapUserMemory(Kernel->os,
-                                 Kernel->core,
--                                Interface->u.MapUserMemory.memory,
-+                                gcmUINT64_TO_PTR(Interface->u.MapUserMemory.memory),
-                                 Interface->u.MapUserMemory.physical,
--                                Interface->u.MapUserMemory.size,
--                                &Interface->u.MapUserMemory.info,
-+                                (gctSIZE_T) Interface->u.MapUserMemory.size,
-+                                &info,
-                                 &Interface->u.MapUserMemory.address));
-+
-+        Interface->u.MapUserMemory.info = gcmPTR_TO_NAME(info);
-+
-         gcmkVERIFY_OK(
-             gckKERNEL_AddProcessDB(Kernel,
-                                    processID, gcvDB_MAP_USER_MEMORY,
--                                   Interface->u.MapUserMemory.info,
--                                   Interface->u.MapUserMemory.memory,
--                                   Interface->u.MapUserMemory.size));
-+                                   gcmINT2PTR(Interface->u.MapUserMemory.info),
-+                                   gcmUINT64_TO_PTR(Interface->u.MapUserMemory.memory),
-+                                   (gctSIZE_T) Interface->u.MapUserMemory.size));
-         break;
- 
-     case gcvHAL_UNMAP_USER_MEMORY:
-         address = Interface->u.UnmapUserMemory.address;
-+        info = gcmNAME_TO_PTR(Interface->u.UnmapUserMemory.info);
- 
-         /* Unmap user memory. */
-         gcmkONERROR(
-             gckOS_UnmapUserMemory(Kernel->os,
-                                   Kernel->core,
--                                  Interface->u.UnmapUserMemory.memory,
--                                  Interface->u.UnmapUserMemory.size,
--                                  Interface->u.UnmapUserMemory.info,
-+                                  gcmUINT64_TO_PTR(Interface->u.UnmapUserMemory.memory),
-+                                  (gctSIZE_T) Interface->u.UnmapUserMemory.size,
-+                                  info,
-                                   address));
- 
- #if gcdSECURE_USER
-         gcmkVERIFY_OK(gckKERNEL_FlushTranslationCache(
-             Kernel,
-             cache,
--            Interface->u.UnmapUserMemory.memory,
-+            gcmUINT64_TO_PTR(Interface->u.UnmapUserMemory.memory),
-             Interface->u.UnmapUserMemory.size));
- #endif
-         gcmkVERIFY_OK(
-             gckKERNEL_RemoveProcessDB(Kernel,
-                                       processID, gcvDB_MAP_USER_MEMORY,
--                                      Interface->u.UnmapUserMemory.info));
-+                                      gcmINT2PTR(Interface->u.UnmapUserMemory.info)));
-+
-+        gcmRELEASE_NAME(Interface->u.UnmapUserMemory.info);
-+
-         break;
- 
- #if !USE_NEW_LINUX_SIGNAL
-@@ -1537,7 +1621,7 @@ gckKERNEL_Dispatch(
-         gcmkONERROR(
-             gckHARDWARE_ProfileEngine2D(
-                 Kernel->hardware,
--                Interface->u.RegisterProfileData2D.hwProfile2D));
-+                gcmUINT64_TO_PTR(Interface->u.RegisterProfileData2D.hwProfile2D)));
- #else
-         status = gcvSTATUS_OK;
- #endif
-@@ -1652,14 +1736,15 @@ gckKERNEL_Dispatch(
-         break;
- 
-     case gcvHAL_CACHE:
--        if (Interface->u.Cache.node == gcvNULL)
-+        node = gcmUINT64_TO_PTR(Interface->u.Cache.node);
-+        if (node == gcvNULL)
-         {
-             /* FIXME Surface wrap some memory which is not allocated by us,
-             ** So we don't have physical address to handle outer cache, ignore it*/
-             status = gcvSTATUS_OK;
-             break;
-         }
--        else if (Interface->u.Cache.node->VidMem.memory->object.type == gcvOBJ_VIDMEM)
-+        else if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM)
-         {
-             /* Video memory has no physical handles. */
-             physical = gcvNULL;
-@@ -1667,9 +1752,11 @@ gckKERNEL_Dispatch(
-         else
-         {
-             /* Grab physical handle. */
--            physical = Interface->u.Cache.node->Virtual.physical;
-+            physical = node->Virtual.physical;
-         }
- 
-+        logical = gcmUINT64_TO_PTR(Interface->u.Cache.logical);
-+        bytes = (gctSIZE_T) Interface->u.Cache.bytes;
-         switch(Interface->u.Cache.operation)
-         {
-         case gcvCACHE_FLUSH:
-@@ -1678,8 +1765,8 @@ gckKERNEL_Dispatch(
-                                       processID,
-                                       physical,
-                                       paddr,
--                                      Interface->u.Cache.logical,
--                                      Interface->u.Cache.bytes);
-+                                      logical,
-+                                      bytes);
-             break;
-         case gcvCACHE_CLEAN:
-             /* Clean the cache. */
-@@ -1687,8 +1774,8 @@ gckKERNEL_Dispatch(
-                                       processID,
-                                       physical,
-                                       paddr,
--                                      Interface->u.Cache.logical,
--                                      Interface->u.Cache.bytes);
-+                                      logical,
-+                                      bytes);
-             break;
-         case gcvCACHE_INVALIDATE:
-             /* Invalidate the cache. */
-@@ -1696,13 +1783,13 @@ gckKERNEL_Dispatch(
-                                            processID,
-                                            physical,
-                                            paddr,
--                                           Interface->u.Cache.logical,
--                                           Interface->u.Cache.bytes);
-+                                           logical,
-+                                           bytes);
-             break;
- 
- 	case gcvCACHE_MEMORY_BARRIER:
- 	   status = gckOS_MemoryBarrier(Kernel->os,
--                                        Interface->u.Cache.logical);
-+                                        logical);
- 	   break;
-         default:
-             status = gcvSTATUS_INVALID_ARGUMENT;
-@@ -1802,14 +1889,17 @@ gckKERNEL_Dispatch(
-         /* Attach user process. */
-         gcmkONERROR(
-             gckCOMMAND_Attach(Kernel->command,
--                              &Interface->u.Attach.context,
--                              &Interface->u.Attach.stateCount,
-+                              &context,
-+                              &bytes,
-                               processID));
- 
-+        Interface->u.Attach.stateCount = bytes;
-+        Interface->u.Attach.context = gcmPTR_TO_NAME(context);
-+
-         gcmkVERIFY_OK(
-             gckKERNEL_AddProcessDB(Kernel,
-                                    processID, gcvDB_CONTEXT,
--                                   Interface->u.Attach.context,
-+                                   gcmINT2PTR(Interface->u.Attach.context),
-                                    gcvNULL,
-                                    0));
-         break;
-@@ -1818,15 +1908,18 @@ gckKERNEL_Dispatch(
-         /* Detach user process. */
-         gcmkONERROR(
-             gckCOMMAND_Detach(Kernel->command,
--                              Interface->u.Detach.context));
-+                              gcmNAME_TO_PTR(Interface->u.Detach.context)));
- 
-         gcmkVERIFY_OK(
-             gckKERNEL_RemoveProcessDB(Kernel,
-                               processID, gcvDB_CONTEXT,
--                              Interface->u.Detach.context));
-+                              gcmINT2PTR(Interface->u.Detach.context)));
-+
-+        gcmRELEASE_NAME(Interface->u.Detach.context);
-         break;
- 
-     case gcvHAL_COMPOSE:
-+        Interface->u.Compose.physical = gcmPTR_TO_UINT64(gcmNAME_TO_PTR(Interface->u.Compose.physical));
-         /* Start composition. */
-         gcmkONERROR(
-             gckEVENT_Compose(Kernel->eventObj,
-@@ -1842,11 +1935,13 @@ gckKERNEL_Dispatch(
-     case gcvHAL_GET_FRAME_INFO:
-         gcmkONERROR(gckHARDWARE_GetFrameInfo(
-             Kernel->hardware,
--            Interface->u.GetFrameInfo.frameInfo));
-+            gcmUINT64_TO_PTR(Interface->u.GetFrameInfo.frameInfo)));
-         break;
- #endif
- 
-     case gcvHAL_GET_SHARED_INFO:
-+        bytes = (gctSIZE_T) Interface->u.GetSharedInfo.size;
-+
-         if (Interface->u.GetSharedInfo.dataId != 0)
-         {
-             gcmkONERROR(gckKERNEL_FindProcessDB(Kernel,
-@@ -1857,7 +1952,7 @@ gckKERNEL_Dispatch(
-                         &record));
- 
-             /* find a record in db, check size */
--            if (record.bytes != Interface->u.GetSharedInfo.size)
-+            if (record.bytes != bytes)
-             {
-                 /* Size change is not allowed */
-                 gcmkONERROR(gcvSTATUS_INVALID_DATA);
-@@ -1867,13 +1962,13 @@ gckKERNEL_Dispatch(
-             gcmkONERROR(gckOS_CopyToUserData(
-                 Kernel->os,
-                 record.physical,
--                Interface->u.GetSharedInfo.data,
--                Interface->u.GetSharedInfo.size
-+                gcmUINT64_TO_PTR(Interface->u.GetSharedInfo.data),
-+                bytes
-                 ));
- 
-         }
- 
--        if ((node = Interface->u.GetSharedInfo.node) != gcvNULL)
-+        if ((node = gcmUINT64_TO_PTR(Interface->u.GetSharedInfo.node)) != gcvNULL)
-         {
-             switch (Interface->u.GetSharedInfo.infoType)
-                 {
-@@ -1892,7 +1987,7 @@ gckKERNEL_Dispatch(
-                          gcmkONERROR(gckOS_CopyToUserData(
-                              Kernel->os,
-                              data,
--                             Interface->u.GetSharedInfo.nodeData,
-+                             gcmUINT64_TO_PTR(Interface->u.GetSharedInfo.nodeData),
-                              sizeof(gcsVIDMEM_NODE_SHARED_INFO)
-                              ));
-                     }
-@@ -1930,7 +2025,7 @@ gckKERNEL_Dispatch(
-                         gcmkONERROR(gckOS_CopyToUserData(
-                             Kernel->os,
-                             &alignedSharedInfo,
--                            Interface->u.GetSharedInfo.nodeData,
-+                            gcmUINT64_TO_PTR(Interface->u.GetSharedInfo.nodeData),
-                             sizeof(gcsVIDMEM_NODE_SHARED_INFO)
-                             ));
- 
-@@ -1953,6 +2048,8 @@ gckKERNEL_Dispatch(
-         break;
- 
-     case gcvHAL_SET_SHARED_INFO:
-+        bytes = (gctSIZE_T) Interface->u.SetSharedInfo.size;
-+
-         if (Interface->u.SetSharedInfo.dataId != 0)
-         {
-             status = gckKERNEL_FindProcessDB(Kernel, processID, 0,
-@@ -1966,7 +2063,7 @@ gckKERNEL_Dispatch(
-                 /* Note: we count on DestoryProcessDB to free it */
-                 gcmkONERROR(gckOS_AllocateMemory(
-                     Kernel->os,
--                    Interface->u.SetSharedInfo.size,
-+                    bytes,
-                     &data
-                     ));
- 
-@@ -1975,7 +2072,7 @@ gckKERNEL_Dispatch(
-                         gcvDB_SHARED_INFO,
-                         gcmINT2PTR(Interface->u.SetSharedInfo.dataId),
-                         data,
--                        Interface->u.SetSharedInfo.size
-+                        bytes
-                         ));
-             }
-             else
-@@ -1984,7 +2081,7 @@ gckKERNEL_Dispatch(
-                 gcmkONERROR(status);
- 
-                 /* find a record in db, check size */
--                if (record.bytes != Interface->u.SetSharedInfo.size)
-+                if (record.bytes != bytes)
-                 {
-                     /* Size change is not allowed */
-                     gcmkONERROR(gcvSTATUS_INVALID_DATA);
-@@ -1997,12 +2094,12 @@ gckKERNEL_Dispatch(
-             gcmkONERROR(gckOS_CopyFromUserData(
-                 Kernel->os,
-                 data,
--                Interface->u.SetSharedInfo.data,
--                Interface->u.SetSharedInfo.size
-+                gcmUINT64_TO_PTR(Interface->u.SetSharedInfo.data),
-+                bytes
-                 ));
-         }
- 
--        if ((node = Interface->u.SetSharedInfo.node) != gcvNULL)
-+        if ((node = gcmUINT64_TO_PTR(Interface->u.SetSharedInfo.node)) != gcvNULL)
-         {
-             switch (Interface->u.SetSharedInfo.infoType)
-                 {
-@@ -2020,7 +2117,7 @@ gckKERNEL_Dispatch(
-                         gcmkONERROR(gckOS_CopyFromUserData(
-                             Kernel->os,
-                             data,
--                            Interface->u.SetSharedInfo.nodeData,
-+                            gcmUINT64_TO_PTR(Interface->u.SetSharedInfo.nodeData),
-                             sizeof(gcsVIDMEM_NODE_SHARED_INFO)
-                             ));
-                     }
-@@ -2036,7 +2133,7 @@ gckKERNEL_Dispatch(
-                         gcmkONERROR(gckOS_CopyFromUserData(
-                             Kernel->os,
-                             &newSharedInfo,
--                            Interface->u.SetSharedInfo.nodeData,
-+                            gcmUINT64_TO_PTR(Interface->u.SetSharedInfo.nodeData),
-                             gcmSIZEOF(gcsVIDMEM_NODE_SHARED_INFO)
-                             ));
- 
-@@ -2107,6 +2204,14 @@ gckKERNEL_Dispatch(
- #endif
-         break;
- 
-+    case gcvHAL_QUERY_RESET_TIME_STAMP:
-+#if gcdENABLE_RECOVERY
-+        Interface->u.QueryResetTimeStamp.timeStamp = Kernel->resetTimeStamp;
-+#else
-+        Interface->u.QueryResetTimeStamp.timeStamp = 0;
-+#endif
-+        break;
-+
-     default:
-         /* Invalid command. */
-         gcmkONERROR(gcvSTATUS_INVALID_ARGUMENT);
-@@ -2123,7 +2228,7 @@ OnError:
-             /* Roll back the lock. */
-             gcmkVERIFY_OK(
-                 gckVIDMEM_Unlock(Kernel,
--                                 Interface->u.LockVideoMemory.node,
-+                                 gcmUINT64_TO_PTR(Interface->u.LockVideoMemory.node),
-                                  gcvSURF_TYPE_UNKNOWN,
-                                  &asynchronous));
- 
-@@ -2132,7 +2237,7 @@ OnError:
-                 /* Bottom Half */
-                 gcmkVERIFY_OK(
-                     gckVIDMEM_Unlock(Kernel,
--                                     Interface->u.LockVideoMemory.node,
-+                                     gcmUINT64_TO_PTR(Interface->u.LockVideoMemory.node),
-                                      gcvSURF_TYPE_UNKNOWN,
-                                      gcvNULL));
-             }
-@@ -2910,6 +3015,8 @@ gckKERNEL_Recovery(
- #endif
-     gcmkONERROR(gckEVENT_Notify(eventObj, 2));
- 
-+    Kernel->resetTimeStamp++;
-+
-     /* Success. */
-     gcmkFOOTER_NO();
-     return gcvSTATUS_OK;
-@@ -3438,6 +3545,361 @@ gckLINKQUEUE_GetData(
- }
- #endif
- 
-+/******************************************************************************\
-+*************************** Pointer - ID translation ***************************
-+\******************************************************************************/
-+#define gcdID_TABLE_LENGTH 1024
-+typedef struct _gcsINTEGERDB * gckINTEGERDB;
-+typedef struct _gcsINTEGERDB
-+{
-+    gckOS                       os;
-+    gctPOINTER*                 table;
-+    gctPOINTER                  mutex;
-+    gctUINT32                   tableLen;
-+    gctUINT32                   currentID;
-+    gctUINT32                   unused;
-+}
-+gcsINTEGERDB;
-+
-+gceSTATUS
-+gckKERNEL_CreateIntegerDatabase(
-+    IN gckKERNEL Kernel,
-+    OUT gctPOINTER * Database
-+    )
-+{
-+    gceSTATUS status;
-+    gckINTEGERDB database = gcvNULL;
-+
-+    gcmkHEADER_ARG("Kernel=0x%08X Datbase=0x%08X", Kernel, Database);
-+
-+    gcmkVERIFY_OBJECT(Kernel, gcvOBJ_KERNEL);
-+    gcmkVERIFY_ARGUMENT(Database != gcvNULL);
-+
-+    /* Allocate a database. */
-+    gcmkONERROR(gckOS_Allocate(
-+        Kernel->os, gcmSIZEOF(gcsINTEGERDB), (gctPOINTER *)&database));
-+
-+    gckOS_ZeroMemory(database, gcmSIZEOF(gcsINTEGERDB));
-+
-+    /* Allocate a pointer table. */
-+    gcmkONERROR(gckOS_Allocate(
-+        Kernel->os, gcmSIZEOF(gctPOINTER) * gcdID_TABLE_LENGTH, (gctPOINTER *)&database->table));
-+
-+    gckOS_ZeroMemory(database->table, gcmSIZEOF(gctPOINTER) * gcdID_TABLE_LENGTH);
-+
-+    /* Allocate a database mutex. */
-+    gcmkONERROR(gckOS_CreateMutex(Kernel->os, &database->mutex));
-+
-+    /* Initialize. */
-+    database->currentID = 0;
-+    database->unused = gcdID_TABLE_LENGTH;
-+    database->os = Kernel->os;
-+    database->tableLen = gcdID_TABLE_LENGTH;
-+
-+    *Database = database;
-+
-+    gcmkFOOTER_ARG("*Database=0x%08X", *Database);
-+    return gcvSTATUS_OK;
-+
-+OnError:
-+    /* Rollback. */
-+    if (database)
-+    {
-+        if (database->table)
-+        {
-+            gcmkOS_SAFE_FREE(Kernel->os, database->table);
-+        }
-+
-+        gcmkOS_SAFE_FREE(Kernel->os, database);
-+    }
-+
-+    gcmkFOOTER();
-+    return status;
-+}
-+
-+gceSTATUS
-+gckKERNEL_DestroyIntegerDatabase(
-+    IN gckKERNEL Kernel,
-+    IN gctPOINTER Database
-+    )
-+{
-+    gckINTEGERDB database = Database;
-+
-+    gcmkHEADER_ARG("Kernel=0x%08X Datbase=0x%08X", Kernel, Database);
-+
-+    gcmkVERIFY_OBJECT(Kernel, gcvOBJ_KERNEL);
-+    gcmkVERIFY_ARGUMENT(Database != gcvNULL);
-+
-+    /* Destroy pointer table. */
-+    gcmkOS_SAFE_FREE(Kernel->os, database->table);
-+
-+    /* Destroy database mutex. */
-+    gcmkVERIFY_OK(gckOS_DeleteMutex(Kernel->os, database->mutex));
-+
-+    /* Destroy database. */
-+    gcmkOS_SAFE_FREE(Kernel->os, database);
-+
-+    gcmkFOOTER_NO();
-+    return gcvSTATUS_OK;
-+}
-+
-+gceSTATUS
-+gckKERNEL_AllocateIntegerId(
-+    IN gctPOINTER Database,
-+    IN gctPOINTER Pointer,
-+    OUT gctUINT32 * Id
-+    )
-+{
-+    gceSTATUS status;
-+    gckINTEGERDB database = Database;
-+    gctUINT32 i, unused, currentID, tableLen;
-+    gctPOINTER * table;
-+    gckOS os = database->os;
-+    gctBOOL acquired = gcvFALSE;
-+
-+    gcmkHEADER_ARG("Database=0x%08X Pointer=0x%08X", Database, Pointer);
-+
-+    gcmkVERIFY_ARGUMENT(Id != gcvNULL);
-+
-+    gcmkVERIFY_OK(gckOS_AcquireMutex(os, database->mutex, gcvINFINITE));
-+    acquired = gcvTRUE;
-+
-+    if (database->unused < 1)
-+    {
-+        /* Extend table. */
-+        gcmkONERROR(
-+            gckOS_Allocate(os,
-+                           gcmSIZEOF(gctPOINTER) * (database->tableLen + gcdID_TABLE_LENGTH),
-+                           (gctPOINTER *)&table));
-+
-+        gckOS_ZeroMemory(table + database->tableLen,
-+                         gcmSIZEOF(gctPOINTER) * gcdID_TABLE_LENGTH);
-+
-+        /* Copy data from old table. */
-+        gckOS_MemCopy(table,
-+                      database->table,
-+                      database->tableLen * gcmSIZEOF(gctPOINTER));
-+
-+        gcmkOS_SAFE_FREE(os, database->table);
-+
-+        /* Update databse with new allocated table. */
-+        database->table = table;
-+        database->currentID = database->tableLen;
-+        database->tableLen += gcdID_TABLE_LENGTH;
-+        database->unused += gcdID_TABLE_LENGTH;
-+    }
-+
-+    table = database->table;
-+    currentID = database->currentID;
-+    tableLen = database->tableLen;
-+    unused = database->unused;
-+
-+    /* Connect id with pointer. */
-+    table[currentID] = Pointer;
-+
-+    *Id = currentID + 1;
-+
-+    /* Update the currentID. */
-+    if (--unused > 0)
-+    {
-+        for (i = 0; i < tableLen; i++)
-+        {
-+            if (++currentID >= tableLen)
-+            {
-+                /* Wrap to the begin. */
-+                currentID = 0;
-+            }
-+
-+            if (table[currentID] == gcvNULL)
-+            {
-+                break;
-+            }
-+        }
-+    }
-+
-+    database->table = table;
-+    database->currentID = currentID;
-+    database->tableLen = tableLen;
-+    database->unused = unused;
-+
-+    gcmkVERIFY_OK(gckOS_ReleaseMutex(os, database->mutex));
-+    acquired = gcvFALSE;
-+
-+    gcmkFOOTER_ARG("*Id=%d", *Id);
-+    return gcvSTATUS_OK;
-+
-+OnError:
-+    if (acquired)
-+    {
-+        gcmkVERIFY_OK(gckOS_ReleaseMutex(os, database->mutex));
-+    }
-+
-+    gcmkFOOTER();
-+    return status;
-+}
-+
-+gceSTATUS
-+gckKERNEL_FreeIntegerId(
-+    IN gctPOINTER Database,
-+    IN gctUINT32 Id
-+    )
-+{
-+    gceSTATUS status;
-+    gckINTEGERDB database = Database;
-+    gckOS os = database->os;
-+    gctBOOL acquired = gcvFALSE;
-+
-+    gcmkHEADER_ARG("Database=0x%08X Id=%d", Database, Id);
-+
-+    gcmkVERIFY_OK(gckOS_AcquireMutex(os, database->mutex, gcvINFINITE));
-+    acquired = gcvTRUE;
-+
-+    if (!(Id > 0 && Id <= database->tableLen))
-+    {
-+        gcmkONERROR(gcvSTATUS_NOT_FOUND);
-+    }
-+
-+    Id -= 1;
-+
-+    database->table[Id] = gcvNULL;
-+
-+    if (database->unused++ == 0)
-+    {
-+        database->currentID = Id;
-+    }
-+
-+    gcmkVERIFY_OK(gckOS_ReleaseMutex(os, database->mutex));
-+    acquired = gcvFALSE;
-+
-+    gcmkFOOTER_NO();
-+    return gcvSTATUS_OK;
-+
-+OnError:
-+    if (acquired)
-+    {
-+        gcmkVERIFY_OK(gckOS_ReleaseMutex(os, database->mutex));
-+    }
-+
-+    gcmkFOOTER();
-+    return status;
-+}
-+
-+gceSTATUS
-+gckKERNEL_QueryIntegerId(
-+    IN gctPOINTER Database,
-+    IN gctUINT32 Id,
-+    OUT gctPOINTER * Pointer
-+    )
-+{
-+    gceSTATUS status;
-+    gckINTEGERDB database = Database;
-+    gctPOINTER pointer;
-+    gckOS os = database->os;
-+    gctBOOL acquired = gcvFALSE;
-+
-+    gcmkHEADER_ARG("Database=0x%08X Id=%d", Database, Id);
-+    gcmkVERIFY_ARGUMENT(Pointer != gcvNULL);
-+
-+    gcmkVERIFY_OK(gckOS_AcquireMutex(os, database->mutex, gcvINFINITE));
-+    acquired = gcvTRUE;
-+
-+    if (!(Id > 0 && Id <= database->tableLen))
-+    {
-+        gcmkONERROR(gcvSTATUS_NOT_FOUND);
-+    }
-+
-+    Id -= 1;
-+
-+    pointer = database->table[Id];
-+
-+    gcmkVERIFY_OK(gckOS_ReleaseMutex(os, database->mutex));
-+    acquired = gcvFALSE;
-+
-+    if (pointer)
-+    {
-+        *Pointer = pointer;
-+    }
-+    else
-+    {
-+        gcmkONERROR(gcvSTATUS_NOT_FOUND);
-+    }
-+
-+    gcmkFOOTER_ARG("*Pointer=0x%08X", *Pointer);
-+    return gcvSTATUS_OK;
-+
-+OnError:
-+    if (acquired)
-+    {
-+        gcmkVERIFY_OK(gckOS_ReleaseMutex(os, database->mutex));
-+    }
-+
-+    gcmkFOOTER();
-+    return status;
-+}
-+
-+
-+gctUINT32
-+gckKERNEL_AllocateNameFromPointer(
-+    IN gckKERNEL Kernel,
-+    IN gctPOINTER Pointer
-+    )
-+{
-+    gceSTATUS status;
-+    gctUINT32 name;
-+    gctPOINTER database = Kernel->db->pointerDatabase;
-+
-+    gcmkHEADER_ARG("Kernel=0x%X Pointer=0x%X", Kernel, Pointer);
-+
-+    gcmkONERROR(
-+        gckKERNEL_AllocateIntegerId(database, Pointer, &name));
-+
-+    gcmkFOOTER_ARG("name=%d", name);
-+    return name;
-+
-+OnError:
-+    gcmkFOOTER();
-+    return 0;
-+}
-+
-+gctPOINTER
-+gckKERNEL_QueryPointerFromName(
-+    IN gckKERNEL Kernel,
-+    IN gctUINT32 Name
-+    )
-+{
-+    gceSTATUS status;
-+    gctPOINTER pointer = gcvNULL;
-+    gctPOINTER database = Kernel->db->pointerDatabase;
-+
-+    gcmkHEADER_ARG("Kernel=0x%X Name=%d", Kernel, Name);
-+
-+    /* Lookup in database to get pointer. */
-+    gcmkONERROR(gckKERNEL_QueryIntegerId(database, Name, &pointer));
-+
-+    gcmkFOOTER_ARG("pointer=0x%X", pointer);
-+    return pointer;
-+
-+OnError:
-+    gcmkFOOTER();
-+    return gcvNULL;
-+}
-+
-+gceSTATUS
-+gckKERNEL_DeleteName(
-+    IN gckKERNEL Kernel,
-+    IN gctUINT32 Name
-+    )
-+{
-+    gctPOINTER database = Kernel->db->pointerDatabase;
-+
-+    gcmkHEADER_ARG("Kernel=0x%X Name=0x%X", Kernel, Name);
-+
-+    /* Free name if exists. */
-+    gcmkVERIFY_OK(gckKERNEL_FreeIntegerId(database, Name));
-+
-+    gcmkFOOTER_NO();
-+    return gcvSTATUS_OK;
-+}
- /*******************************************************************************
- ***** Test Code ****************************************************************
- *******************************************************************************/
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h
-index a53c8ce..1da80b7 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_kernel_h_
- #define __gc_hal_kernel_h_
- 
-@@ -194,6 +192,9 @@ typedef struct _gcsDATABASE
-     /* Secure cache. */
-     gcskSECURE_CACHE                    cache;
- #endif
-+
-+    gctPOINTER                          handleDatabase;
-+    gctPOINTER                          handleDatabaseMutex;
- }
- gcsDATABASE;
- 
-@@ -258,6 +259,57 @@ gckKERNEL_DumpProcessDB(
-     IN gckKERNEL Kernel
-     );
- 
-+/* ID database */
-+gceSTATUS
-+gckKERNEL_CreateIntegerDatabase(
-+    IN gckKERNEL Kernel,
-+    OUT gctPOINTER * Database
-+    );
-+
-+gceSTATUS
-+gckKERNEL_DestroyIntegerDatabase(
-+    IN gckKERNEL Kernel,
-+    IN gctPOINTER Database
-+    );
-+
-+gceSTATUS
-+gckKERNEL_AllocateIntegerId(
-+    IN gctPOINTER Database,
-+    IN gctPOINTER Pointer,
-+    OUT gctUINT32 * Id
-+    );
-+
-+gceSTATUS
-+gckKERNEL_FreeIntegerId(
-+    IN gctPOINTER Database,
-+    IN gctUINT32 Id
-+    );
-+
-+gceSTATUS
-+gckKERNEL_QueryIntegerId(
-+    IN gctPOINTER Database,
-+    IN gctUINT32 Id,
-+    OUT gctPOINTER * Pointer
-+    );
-+
-+gctUINT32
-+gckKERNEL_AllocateNameFromPointer(
-+    IN gckKERNEL Kernel,
-+    IN gctPOINTER Pointer
-+    );
-+
-+gctPOINTER
-+gckKERNEL_QueryPointerFromName(
-+    IN gckKERNEL Kernel,
-+    IN gctUINT32 Name
-+    );
-+
-+gceSTATUS
-+gckKERNEL_DeleteName(
-+    IN gckKERNEL Kernel,
-+    IN gctUINT32 Name
-+    );
-+
- #if gcdSECURE_USER
- /* Get secure cache from the process database. */
- gceSTATUS
-@@ -297,6 +349,9 @@ struct _gckDB
-     gctUINT64                   idleTime;
-     gctUINT64                   lastSlowdown;
-     gctUINT64                   lastSlowdownIdle;
-+    /* ID - Pointer database*/
-+    gctPOINTER                  pointerDatabase;
-+    gctPOINTER                  pointerDatabaseMutex;
- };
- 
- #if gcdVIRTUAL_COMMAND_BUFFER
-@@ -370,6 +425,7 @@ struct _gckKERNEL
- #if gcdENABLE_RECOVERY
-     gctPOINTER                  resetFlagClearTimer;
-     gctPOINTER                  resetAtom;
-+    gctUINT64                   resetTimeStamp;
- #endif
- 
-     /* Pointer to gckEVENT object. */
-@@ -385,6 +441,30 @@ struct _gckKERNEL
-     gckVIRTUAL_COMMAND_BUFFER_PTR virtualBufferTail;
-     gctPOINTER                    virtualBufferLock;
- #endif
-+
-+#if gcdDVFS
-+    gckDVFS                     dvfs;
-+#endif
-+};
-+
-+struct _FrequencyHistory
-+{
-+    gctUINT32                   frequency;
-+    gctUINT32                   count;
-+};
-+
-+/* gckDVFS object. */
-+struct _gckDVFS
-+{
-+    gckOS                       os;
-+    gckHARDWARE                 hardware;
-+    gctPOINTER                  timer;
-+    gctUINT32                   pollingTime;
-+    gctBOOL                     stop;
-+    gctUINT32                   totalConfig;
-+    gctUINT32                   loads[8];
-+    gctUINT8                    currentScale;
-+    struct _FrequencyHistory    frequencyHistory[16];
- };
- 
- /* gckCOMMAND object. */
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c
-index 952ee88..66ce0d1 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_precomp.h"
- #include "gc_hal_kernel_context.h"
- 
-@@ -250,7 +248,7 @@ _ProcessHints(
-         if (Command->hintArrayAllocated &&
-             (Command->hintArraySize < CommandBuffer->hintArraySize))
-         {
--            gcmkONERROR(gcmkOS_SAFE_FREE(Command->os, Command->hintArray));
-+            gcmkONERROR(gcmkOS_SAFE_FREE(Command->os, gcmUINT64_TO_PTR(Command->hintArray)));
-             Command->hintArraySize = gcvFALSE;
-         }
- 
-@@ -264,18 +262,18 @@ _ProcessHints(
-                 &pointer
-                 ));
- 
--            Command->hintArray          = pointer;
-+            Command->hintArray          = gcmPTR_TO_UINT64(pointer);
-             Command->hintArrayAllocated = gcvTRUE;
-             Command->hintArraySize      = CommandBuffer->hintArraySize;
-         }
- 
--        hintArray = Command->hintArray;
-+        hintArray = gcmUINT64_TO_PTR(Command->hintArray);
-         copySize   = hintCount * gcmSIZEOF(gctUINT32);
- 
-         gcmkONERROR(gckOS_CopyFromUserData(
-             Command->os,
-             hintArray,
--            CommandBuffer->hintArray,
-+            gcmUINT64_TO_PTR(CommandBuffer->hintArray),
-             copySize
-             ));
-     }
-@@ -285,7 +283,7 @@ _ProcessHints(
- 
-         gcmkONERROR(gckOS_MapUserPointer(
-             Command->os,
--            CommandBuffer->hintArray,
-+            gcmUINT64_TO_PTR(CommandBuffer->hintArray),
-             CommandBuffer->hintArraySize,
-             &pointer
-             ));
-@@ -311,7 +309,7 @@ OnError:
-     {
-         gcmkVERIFY_OK(gckOS_UnmapUserPointer(
-             Command->os,
--            CommandBuffer->hintArray,
-+            gcmUINT64_TO_PTR(CommandBuffer->hintArray),
-             CommandBuffer->hintArraySize,
-             hintArray
-             ));
-@@ -677,7 +675,7 @@ gckCOMMAND_Destroy(
-     /* Free state array. */
-     if (Command->hintArrayAllocated)
-     {
--        gcmkVERIFY_OK(gcmkOS_SAFE_FREE(Command->os, Command->hintArray));
-+        gcmkVERIFY_OK(gcmkOS_SAFE_FREE(Command->os, gcmUINT64_TO_PTR(Command->hintArray)));
-         Command->hintArrayAllocated = gcvFALSE;
-     }
- #endif
-@@ -1219,7 +1217,7 @@ gckCOMMAND_Commit(
- 
-     /* Compute the command buffer entry and the size. */
-     commandBufferLogical
--        = (gctUINT8_PTR) commandBufferObject->logical
-+        = (gctUINT8_PTR) gcmUINT64_TO_PTR(commandBufferObject->logical)
-         +                commandBufferObject->startOffset;
- 
-     gcmkONERROR(gckOS_GetPhysicalAddress(
-@@ -1892,7 +1890,7 @@ gckCOMMAND_Commit(
- 
-     /* Determine the location of the LINK command in the command buffer. */
-     commandBufferLink
--        = (gctUINT8_PTR) commandBufferObject->logical
-+        = (gctUINT8_PTR) gcmUINT64_TO_PTR(commandBufferObject->logical)
-         +                commandBufferObject->offset;
- 
-     /* Generate a LINK from the end of the command buffer being scheduled
-@@ -2034,7 +2032,7 @@ gckCOMMAND_Commit(
-             ));
- 
-         /* Next record in the queue. */
--        nextEventRecord = eventRecord->next;
-+        nextEventRecord = gcmUINT64_TO_PTR(eventRecord->next);
- 
-         if (!needCopy)
-         {
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c
-index 31dce52..af053f9 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_precomp.h"
- 
- #if gcdENABLE_VG
-@@ -630,7 +628,7 @@ _RemoveRecordFromProcesDB(
-                 Command->kernel->kernel,
-                 pid,
-                 gcvDB_VIDEO_MEMORY,
--                freeVideoMemory->node));
-+                gcmUINT64_TO_PTR(freeVideoMemory->node)));
- 
-             /* Advance to next task. */
-             size -= sizeof(gcsTASK_FREE_VIDEO_MEMORY);
-@@ -645,7 +643,7 @@ _RemoveRecordFromProcesDB(
-                 Command->kernel->kernel,
-                 pid,
-                 gcvDB_VIDEO_MEMORY_LOCKED,
--                unlockVideoMemory->node));
-+                gcmUINT64_TO_PTR(unlockVideoMemory->node)));
- 
-             /* Advance to next task. */
-             size -= sizeof(gcsTASK_UNLOCK_VIDEO_MEMORY);
-@@ -963,7 +961,7 @@ _ConvertUserCommandBufferPointer(
-         /* Translate the logical address to the kernel space. */
-         gcmkERR_BREAK(_HardwareToKernel(
-             Command->os,
--            mappedUserCommandBuffer->node,
-+            gcmUINT64_TO_PTR(mappedUserCommandBuffer->node),
-             headerAddress,
-             (gctPOINTER *) KernelCommandBuffer
-             ));
-@@ -1137,7 +1135,7 @@ _AllocateCommandBuffer(
- 
-         /* Initialize the structure. */
-         commandBuffer->completion    = gcvVACANT_BUFFER;
--        commandBuffer->node          = node;
-+        commandBuffer->node          = gcmPTR_TO_UINT64(node);
-         commandBuffer->address       = address + alignedHeaderSize;
-         commandBuffer->bufferOffset  = alignedHeaderSize;
-         commandBuffer->size          = requestedSize;
-@@ -1192,7 +1190,7 @@ _FreeCommandBuffer(
-     gceSTATUS status;
- 
-     /* Free the buffer. */
--    status = _FreeLinear(Kernel, CommandBuffer->node);
-+    status = _FreeLinear(Kernel, gcmUINT64_TO_PTR(CommandBuffer->node));
- 
-     /* Return status. */
-     return status;
-@@ -1649,7 +1647,7 @@ _TaskUnlockVideoMemory(
-         /* Unlock video memory. */
-         gcmkERR_BREAK(gckVIDMEM_Unlock(
-             Command->kernel->kernel,
--            task->node,
-+            gcmUINT64_TO_PTR(task->node),
-             gcvSURF_TYPE_UNKNOWN,
-             gcvNULL));
- 
-@@ -1680,7 +1678,7 @@ _TaskFreeVideoMemory(
-             = (gcsTASK_FREE_VIDEO_MEMORY_PTR) TaskHeader->task;
- 
-         /* Free video memory. */
--        gcmkERR_BREAK(gckVIDMEM_Free(task->node));
-+        gcmkERR_BREAK(gckVIDMEM_Free(gcmUINT64_TO_PTR(task->node)));
- 
-         /* Update the reference counter. */
-         TaskHeader->container->referenceCount -= 1;
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c
-index 50a95a1..1fb18fb 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_precomp.h"
- 
- #define _GC_OBJ_ZONE    gcvZONE_DATABASE
-@@ -1085,6 +1083,9 @@ gckKERNEL_DestroyProcessDB(
-     gcsDATABASE_PTR database;
-     gcsDATABASE_RECORD_PTR record, next;
-     gctBOOL asynchronous;
-+    gctPHYS_ADDR physical;
-+    gcuVIDMEM_NODE_PTR node;
-+    gckKERNEL kernel = Kernel;
- 
-     gcmkHEADER_ARG("Kernel=0x%x ProcessID=%d", Kernel, ProcessID);
- 
-@@ -1136,7 +1137,7 @@ gckKERNEL_DestroyProcessDB(
-         {
-         case gcvDB_VIDEO_MEMORY:
-             /* Free the video memory. */
--            status = gckVIDMEM_Free(record->data);
-+            status = gckVIDMEM_Free(gcmUINT64_TO_PTR(record->data));
- 
-             gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE,
-                            "DB: VIDEO_MEMORY 0x%x (status=%d)",
-@@ -1144,17 +1145,19 @@ gckKERNEL_DestroyProcessDB(
-             break;
- 
-         case gcvDB_NON_PAGED:
-+            physical = gcmNAME_TO_PTR(record->physical);
-             /* Unmap user logical memory first. */
-             status = gckOS_UnmapUserLogical(Kernel->os,
--                                            record->physical,
-+                                            physical,
-                                             record->bytes,
-                                             record->data);
- 
-             /* Free the non paged memory. */
-             status = gckOS_FreeNonPagedMemory(Kernel->os,
-                                               record->bytes,
--                                              record->physical,
-+                                              physical,
-                                               record->data);
-+            gcmRELEASE_NAME(record->physical);
- 
-             gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE,
-                            "DB: NON_PAGED 0x%x, bytes=%lu (status=%d)",
-@@ -1166,9 +1169,10 @@ gckKERNEL_DestroyProcessDB(
-             /* Free the command buffer. */
-             status = gckEVENT_DestroyVirtualCommandBuffer(record->kernel->eventObj,
-                                                           record->bytes,
--                                                          record->physical,
-+                                                          gcmNAME_TO_PTR(record->physical),
-                                                           record->data,
-                                                           gcvKERNEL_PIXEL);
-+            gcmRELEASE_NAME(record->physical);
- 
-             gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE,
-                            "DB: COMMAND_BUFFER 0x%x, bytes=%lu (status=%d)",
-@@ -1177,18 +1181,20 @@ gckKERNEL_DestroyProcessDB(
- #endif
- 
-         case gcvDB_CONTIGUOUS:
-+            physical = gcmNAME_TO_PTR(record->physical);
-             /* Unmap user logical memory first. */
-             status = gckOS_UnmapUserLogical(Kernel->os,
--                                            record->physical,
-+                                            physical,
-                                             record->bytes,
-                                             record->data);
- 
-             /* Free the contiguous memory. */
-             status = gckEVENT_FreeContiguousMemory(Kernel->eventObj,
-                                                    record->bytes,
--                                                   record->physical,
-+                                                   physical,
-                                                    record->data,
-                                                    gcvKERNEL_PIXEL);
-+            gcmRELEASE_NAME(record->physical);
- 
-             gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE,
-                            "DB: CONTIGUOUS 0x%x bytes=%lu (status=%d)",
-@@ -1210,9 +1216,10 @@ gckKERNEL_DestroyProcessDB(
-             break;
- 
-         case gcvDB_VIDEO_MEMORY_LOCKED:
-+            node = gcmUINT64_TO_PTR(record->data);
-             /* Unlock what we still locked */
-             status = gckVIDMEM_Unlock(record->kernel,
--                                      record->data,
-+                                      node,
-                                       gcvSURF_TYPE_UNKNOWN,
-                                       &asynchronous);
- 
-@@ -1220,19 +1227,20 @@ gckKERNEL_DestroyProcessDB(
-             {
-                 /* TODO: we maybe need to schedule a event here */
-                 status = gckVIDMEM_Unlock(record->kernel,
--                                          record->data,
-+                                          node,
-                                           gcvSURF_TYPE_UNKNOWN,
-                                           gcvNULL);
-             }
- 
-             gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE,
-                            "DB: VIDEO_MEMORY_LOCKED 0x%x (status=%d)",
--                           record->data, status);
-+                           node, status);
-             break;
- 
-         case gcvDB_CONTEXT:
-             /* TODO: Free the context */
--            status = gckCOMMAND_Detach(Kernel->command, record->data);
-+            status = gckCOMMAND_Detach(Kernel->command, gcmNAME_TO_PTR(record->data));
-+            gcmRELEASE_NAME(record->data);
- 
-             gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE,
-                            "DB: CONTEXT 0x%x (status=%d)",
-@@ -1257,8 +1265,9 @@ gckKERNEL_DestroyProcessDB(
-                                            Kernel->core,
-                                            record->physical,
-                                            record->bytes,
--                                           record->data,
-+                                           gcmNAME_TO_PTR(record->data),
-                                            0);
-+            gcmRELEASE_NAME(record->data);
- 
-             gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE,
-                            "DB: MAP USER MEMORY %d (status=%d)",
-@@ -1350,21 +1359,21 @@ gckKERNEL_QueryProcessDB(
-     switch (Type)
-     {
-     case gcvDB_VIDEO_MEMORY:
--        gcmkONERROR(gckOS_MemCopy(&Info->counters,
-+        gckOS_MemCopy(&Info->counters,
-                                   &database->vidMem,
--                                  gcmSIZEOF(database->vidMem)));
-+                                  gcmSIZEOF(database->vidMem));
-         break;
- 
-     case gcvDB_NON_PAGED:
--        gcmkONERROR(gckOS_MemCopy(&Info->counters,
-+        gckOS_MemCopy(&Info->counters,
-                                   &database->nonPaged,
--                                  gcmSIZEOF(database->vidMem)));
-+                                  gcmSIZEOF(database->vidMem));
-         break;
- 
-     case gcvDB_CONTIGUOUS:
--        gcmkONERROR(gckOS_MemCopy(&Info->counters,
-+        gckOS_MemCopy(&Info->counters,
-                                   &database->contiguous,
--                                  gcmSIZEOF(database->vidMem)));
-+                                  gcmSIZEOF(database->vidMem));
-         break;
- 
-     case gcvDB_IDLE:
-@@ -1373,15 +1382,15 @@ gckKERNEL_QueryProcessDB(
-         break;
- 
-     case gcvDB_MAP_MEMORY:
--        gcmkONERROR(gckOS_MemCopy(&Info->counters,
-+        gckOS_MemCopy(&Info->counters,
-                                   &database->mapMemory,
--                                  gcmSIZEOF(database->mapMemory)));
-+                                  gcmSIZEOF(database->mapMemory));
-         break;
- 
-     case gcvDB_MAP_USER_MEMORY:
--        gcmkONERROR(gckOS_MemCopy(&Info->counters,
-+        gckOS_MemCopy(&Info->counters,
-                                   &database->mapUserMemory,
--                                  gcmSIZEOF(database->mapUserMemory)));
-+                                  gcmSIZEOF(database->mapUserMemory));
-         break;
- 
-     default:
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_debug.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_debug.c
-index 00decd9..a689bc3 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_debug.c
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_debug.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_precomp.h"
- #include <gc_hal_kernel_debug.h>
- 
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c
-index 75647c0..f78d096 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_precomp.h"
- #include "gc_hal_kernel_buffer.h"
- 
-@@ -290,7 +288,7 @@ __RemoveRecordFromProcessDB(
-         {
-             /* TODO: Find a better place to bind signal to hardware.*/
-             gcmkVERIFY_OK(gckOS_SignalSetHardware(Event->os,
--                        Record->info.u.Signal.signal,
-+                        gcmUINT64_TO_PTR(Record->info.u.Signal.signal),
-                         Event->kernel->hardware));
-         }
- 
-@@ -308,7 +306,7 @@ __RemoveRecordFromProcessDB(
-                 Event->kernel,
-                 Record->processID,
-                 gcvDB_NON_PAGED,
--                Record->info.u.FreeNonPagedMemory.logical));
-+                gcmUINT64_TO_PTR(Record->info.u.FreeNonPagedMemory.logical)));
-             break;
- 
-         case gcvHAL_FREE_CONTIGUOUS_MEMORY:
-@@ -316,7 +314,7 @@ __RemoveRecordFromProcessDB(
-                 Event->kernel,
-                 Record->processID,
-                 gcvDB_CONTIGUOUS,
--                Record->info.u.FreeContiguousMemory.logical));
-+                gcmUINT64_TO_PTR(Record->info.u.FreeContiguousMemory.logical)));
-             break;
- 
-         case gcvHAL_FREE_VIDEO_MEMORY:
-@@ -324,7 +322,7 @@ __RemoveRecordFromProcessDB(
-                 Event->kernel,
-                 Record->processID,
-                 gcvDB_VIDEO_MEMORY,
--                Record->info.u.FreeVideoMemory.node));
-+                gcmUINT64_TO_PTR(Record->info.u.FreeVideoMemory.node)));
-             break;
- 
-         case gcvHAL_UNLOCK_VIDEO_MEMORY:
-@@ -332,7 +330,7 @@ __RemoveRecordFromProcessDB(
-                 Event->kernel,
-                 Record->processID,
-                 gcvDB_VIDEO_MEMORY_LOCKED,
--                Record->info.u.UnlockVideoMemory.node));
-+                gcmUINT64_TO_PTR(Record->info.u.UnlockVideoMemory.node)));
-             break;
- 
-         case gcvHAL_UNMAP_USER_MEMORY:
-@@ -340,7 +338,7 @@ __RemoveRecordFromProcessDB(
-                 Event->kernel,
-                 Record->processID,
-                 gcvDB_MAP_USER_MEMORY,
--                Record->info.u.UnmapUserMemory.info));
-+                gcmINT2PTR(Record->info.u.UnmapUserMemory.info)));
-             break;
- 
-         case gcvHAL_FREE_VIRTUAL_COMMAND_BUFFER:
-@@ -348,7 +346,7 @@ __RemoveRecordFromProcessDB(
-                 Event->kernel,
-                 Record->processID,
-                 gcvDB_COMMAND_BUFFER,
--                Record->info.u.FreeVirtualCommandBuffer.logical));
-+                gcmUINT64_TO_PTR(Record->info.u.FreeVirtualCommandBuffer.logical)));
-             break;
- 
-         default:
-@@ -551,7 +549,7 @@ gckEVENT_Destroy(
-     if (Event->submitTimer != gcvNULL)
-     {
-         gcmkVERIFY_OK(gckOS_StopTimer(Event->os, Event->submitTimer));
--        gcmkVERIFY_OK(gckOS_DestoryTimer(Event->os, Event->submitTimer));
-+        gcmkVERIFY_OK(gckOS_DestroyTimer(Event->os, Event->submitTimer));
-     }
- 
-     /* Delete the queue mutex. */
-@@ -908,6 +906,7 @@ gckEVENT_AddList(
-     gctBOOL acquired = gcvFALSE;
-     gcsEVENT_PTR record = gcvNULL;
-     gcsEVENT_QUEUE_PTR queue;
-+    gckKERNEL kernel = Event->kernel;
- 
-     gcmkHEADER_ARG("Event=0x%x Interface=0x%x",
-                    Event, Interface);
-@@ -951,7 +950,7 @@ gckEVENT_AddList(
-     record->fromKernel = FromKernel;
- 
-     /* Copy the event interface into the record. */
--    gcmkONERROR(gckOS_MemCopy(&record->info, Interface, gcmSIZEOF(record->info)));
-+    gckOS_MemCopy(&record->info, Interface, gcmSIZEOF(record->info));
- 
-     /* Get process ID. */
-     gcmkONERROR(gckOS_GetProcessID(&record->processID));
-@@ -1013,16 +1012,16 @@ gckEVENT_AddList(
-     case gcvHAL_FREE_NON_PAGED_MEMORY:
-         gcmkONERROR(gckOS_UnmapUserLogical(
-                         Event->os,
--                        Interface->u.FreeNonPagedMemory.physical,
--                        Interface->u.FreeNonPagedMemory.bytes,
--                        Interface->u.FreeNonPagedMemory.logical));
-+                        gcmNAME_TO_PTR(Interface->u.FreeNonPagedMemory.physical),
-+                        (gctSIZE_T) Interface->u.FreeNonPagedMemory.bytes,
-+                        gcmUINT64_TO_PTR(Interface->u.FreeNonPagedMemory.logical)));
-         break;
-     case gcvHAL_FREE_CONTIGUOUS_MEMORY:
-         gcmkONERROR(gckOS_UnmapUserLogical(
-                         Event->os,
--                        Interface->u.FreeContiguousMemory.physical,
--                        Interface->u.FreeContiguousMemory.bytes,
--                        Interface->u.FreeContiguousMemory.logical));
-+                        gcmNAME_TO_PTR(Interface->u.FreeContiguousMemory.physical),
-+                        (gctSIZE_T) Interface->u.FreeContiguousMemory.bytes,
-+                        gcmUINT64_TO_PTR(Interface->u.FreeContiguousMemory.logical)));
-         break;
-     default:
-         break;
-@@ -1098,7 +1097,7 @@ gckEVENT_Unlock(
- 
-     /* Mark the event as an unlock. */
-     iface.command                           = gcvHAL_UNLOCK_VIDEO_MEMORY;
--    iface.u.UnlockVideoMemory.node          = Node;
-+    iface.u.UnlockVideoMemory.node          = gcmPTR_TO_UINT64(Node);
-     iface.u.UnlockVideoMemory.type          = Type;
-     iface.u.UnlockVideoMemory.asynchroneous = 0;
- 
-@@ -1155,7 +1154,7 @@ gckEVENT_FreeVideoMemory(
- 
-     /* Create an event. */
-     iface.command = gcvHAL_FREE_VIDEO_MEMORY;
--    iface.u.FreeVideoMemory.node = VideoMemory;
-+    iface.u.FreeVideoMemory.node = gcmPTR_TO_UINT64(VideoMemory);
- 
-     /* Append it to the queue. */
-     gcmkONERROR(gckEVENT_AddList(Event, &iface, FromWhere, gcvFALSE, gcvTRUE));
-@@ -1204,6 +1203,7 @@ gckEVENT_FreeNonPagedMemory(
- {
-     gceSTATUS status;
-     gcsHAL_INTERFACE iface;
-+    gckKERNEL kernel = Event->kernel;
- 
-     gcmkHEADER_ARG("Event=0x%x Bytes=%lu Physical=0x%x Logical=0x%x "
-                    "FromWhere=%d",
-@@ -1218,8 +1218,8 @@ gckEVENT_FreeNonPagedMemory(
-     /* Create an event. */
-     iface.command = gcvHAL_FREE_NON_PAGED_MEMORY;
-     iface.u.FreeNonPagedMemory.bytes    = Bytes;
--    iface.u.FreeNonPagedMemory.physical = Physical;
--    iface.u.FreeNonPagedMemory.logical  = Logical;
-+    iface.u.FreeNonPagedMemory.physical = gcmPTR_TO_NAME(Physical);
-+    iface.u.FreeNonPagedMemory.logical  = gcmPTR_TO_UINT64(Logical);
- 
-     /* Append it to the queue. */
-     gcmkONERROR(gckEVENT_AddList(Event, &iface, FromWhere, gcvFALSE, gcvTRUE));
-@@ -1245,6 +1245,7 @@ gckEVENT_DestroyVirtualCommandBuffer(
- {
-     gceSTATUS status;
-     gcsHAL_INTERFACE iface;
-+    gckKERNEL kernel = Event->kernel;
- 
-     gcmkHEADER_ARG("Event=0x%x Bytes=%lu Physical=0x%x Logical=0x%x "
-                    "FromWhere=%d",
-@@ -1259,8 +1260,8 @@ gckEVENT_DestroyVirtualCommandBuffer(
-     /* Create an event. */
-     iface.command = gcvHAL_FREE_VIRTUAL_COMMAND_BUFFER;
-     iface.u.FreeVirtualCommandBuffer.bytes    = Bytes;
--    iface.u.FreeVirtualCommandBuffer.physical = Physical;
--    iface.u.FreeVirtualCommandBuffer.logical  = Logical;
-+    iface.u.FreeVirtualCommandBuffer.physical = gcmPTR_TO_NAME(Physical);
-+    iface.u.FreeVirtualCommandBuffer.logical  = gcmPTR_TO_UINT64(Logical);
- 
-     /* Append it to the queue. */
-     gcmkONERROR(gckEVENT_AddList(Event, &iface, FromWhere, gcvFALSE, gcvTRUE));
-@@ -1309,6 +1310,7 @@ gckEVENT_FreeContiguousMemory(
- {
-     gceSTATUS status;
-     gcsHAL_INTERFACE iface;
-+    gckKERNEL kernel = Event->kernel;
- 
-     gcmkHEADER_ARG("Event=0x%x Bytes=%lu Physical=0x%x Logical=0x%x "
-                    "FromWhere=%d",
-@@ -1323,8 +1325,8 @@ gckEVENT_FreeContiguousMemory(
-     /* Create an event. */
-     iface.command = gcvHAL_FREE_CONTIGUOUS_MEMORY;
-     iface.u.FreeContiguousMemory.bytes    = Bytes;
--    iface.u.FreeContiguousMemory.physical = Physical;
--    iface.u.FreeContiguousMemory.logical  = Logical;
-+    iface.u.FreeContiguousMemory.physical = gcmPTR_TO_NAME(Physical);
-+    iface.u.FreeContiguousMemory.logical  = gcmPTR_TO_UINT64(Logical);
- 
-     /* Append it to the queue. */
-     gcmkONERROR(gckEVENT_AddList(Event, &iface, FromWhere, gcvFALSE, gcvTRUE));
-@@ -1379,13 +1381,13 @@ gckEVENT_Signal(
- 
-     /* Mark the event as a signal. */
-     iface.command            = gcvHAL_SIGNAL;
--    iface.u.Signal.signal    = Signal;
-+    iface.u.Signal.signal    = gcmPTR_TO_UINT64(Signal);
- #ifdef __QNXNTO__
-     iface.u.Signal.coid      = 0;
-     iface.u.Signal.rcvid     = 0;
- #endif
--    iface.u.Signal.auxSignal = gcvNULL;
--    iface.u.Signal.process   = gcvNULL;
-+    iface.u.Signal.auxSignal = 0;
-+    iface.u.Signal.process   = 0;
- 
-     /* Append it to the queue. */
-     gcmkONERROR(gckEVENT_AddList(Event, &iface, FromWhere, gcvFALSE, gcvTRUE));
-@@ -1690,7 +1692,7 @@ gckEVENT_Commit(
-             gckEVENT_AddList(Event, &record->iface, gcvKERNEL_PIXEL, gcvTRUE, gcvFALSE));
- 
-         /* Next record in the queue. */
--        next = record->next;
-+        next = gcmUINT64_TO_PTR(record->next);
- 
-         if (!needCopy)
-         {
-@@ -1783,12 +1785,12 @@ gckEVENT_Compose(
-     tempRecord->info.u.Signal.rcvid     = Info->rcvid;
- #endif
-     tempRecord->info.u.Signal.signal    = Info->signal;
--    tempRecord->info.u.Signal.auxSignal = gcvNULL;
-+    tempRecord->info.u.Signal.auxSignal = 0;
-     tempRecord->next = gcvNULL;
-     tempRecord->processID = processID;
- 
-     /* Allocate another record for user signal #1. */
--    if (Info->userSignal1 != gcvNULL)
-+    if (gcmUINT64_TO_PTR(Info->userSignal1) != gcvNULL)
-     {
-         /* Allocate a record. */
-         gcmkONERROR(gckEVENT_AllocateRecord(Event, gcvTRUE, &tempRecord));
-@@ -1803,13 +1805,13 @@ gckEVENT_Compose(
-         tempRecord->info.u.Signal.rcvid     = Info->rcvid;
- #endif
-         tempRecord->info.u.Signal.signal    = Info->userSignal1;
--        tempRecord->info.u.Signal.auxSignal = gcvNULL;
-+        tempRecord->info.u.Signal.auxSignal = 0;
-         tempRecord->next = gcvNULL;
-         tempRecord->processID = processID;
-     }
- 
-     /* Allocate another record for user signal #2. */
--    if (Info->userSignal2 != gcvNULL)
-+    if (gcmUINT64_TO_PTR(Info->userSignal2) != gcvNULL)
-     {
-         /* Allocate a record. */
-         gcmkONERROR(gckEVENT_AllocateRecord(Event, gcvTRUE, &tempRecord));
-@@ -1824,7 +1826,7 @@ gckEVENT_Compose(
-         tempRecord->info.u.Signal.rcvid     = Info->rcvid;
- #endif
-         tempRecord->info.u.Signal.signal    = Info->userSignal2;
--        tempRecord->info.u.Signal.auxSignal = gcvNULL;
-+        tempRecord->info.u.Signal.auxSignal = 0;
-         tempRecord->next = gcvNULL;
-         tempRecord->processID = processID;
-     }
-@@ -1835,7 +1837,7 @@ gckEVENT_Compose(
-     /* Start composition. */
-     gcmkONERROR(gckHARDWARE_Compose(
-         Event->kernel->hardware, processID,
--        Info->physical, Info->logical, Info->offset, Info->size, id
-+        gcmUINT64_TO_PTR(Info->physical), gcmUINT64_TO_PTR(Info->logical), Info->offset, Info->size, id
-         ));
- 
-     /* Success. */
-@@ -1918,10 +1920,11 @@ gckEVENT_Notify(
-     gcsEVENT_QUEUE * queue;
-     gctUINT mask = 0;
-     gctBOOL acquired = gcvFALSE;
--#ifdef __QNXNTO__
-     gcuVIDMEM_NODE_PTR node;
--#endif
-+    gctPOINTER info;
-+    gctSIGNAL signal;
-     gctUINT pending;
-+    gckKERNEL kernel = Event->kernel;
- #if !gcdSMP
-     gctBOOL suspended = gcvFALSE;
- #endif
-@@ -2182,14 +2185,14 @@ gckEVENT_Notify(
-             case gcvHAL_FREE_NON_PAGED_MEMORY:
-                 gcmkTRACE_ZONE(gcvLEVEL_VERBOSE, gcvZONE_EVENT,
-                                "gcvHAL_FREE_NON_PAGED_MEMORY: 0x%x",
--                               record->info.u.FreeNonPagedMemory.physical);
-+                               gcmNAME_TO_PTR(record->info.u.FreeNonPagedMemory.physical));
- 
-                 /* Free non-paged memory. */
-                 status = gckOS_FreeNonPagedMemory(
-                             Event->os,
--                            record->info.u.FreeNonPagedMemory.bytes,
--                            record->info.u.FreeNonPagedMemory.physical,
--                            record->info.u.FreeNonPagedMemory.logical);
-+                            (gctSIZE_T) record->info.u.FreeNonPagedMemory.bytes,
-+                            gcmNAME_TO_PTR(record->info.u.FreeNonPagedMemory.physical),
-+                            gcmUINT64_TO_PTR(record->info.u.FreeNonPagedMemory.logical));
- 
-                 if (gcmIS_SUCCESS(status))
-                 {
-@@ -2197,24 +2200,25 @@ gckEVENT_Notify(
-                     gcmkVERIFY_OK(gckKERNEL_FlushTranslationCache(
-                         Event->kernel,
-                         cache,
--                        record->event.u.FreeNonPagedMemory.logical,
--                        record->event.u.FreeNonPagedMemory.bytes));
-+                        gcmUINT64_TO_PTR(record->record.u.FreeNonPagedMemory.logical),
-+                        (gctSIZE_T) record->record.u.FreeNonPagedMemory.bytes));
- #endif
-                 }
-+                gcmRELEASE_NAME(record->info.u.FreeNonPagedMemory.physical);
-                 break;
- 
-             case gcvHAL_FREE_CONTIGUOUS_MEMORY:
-                 gcmkTRACE_ZONE(
-                     gcvLEVEL_VERBOSE, gcvZONE_EVENT,
-                     "gcvHAL_FREE_CONTIGUOUS_MEMORY: 0x%x",
--                    record->info.u.FreeContiguousMemory.physical);
-+                    gcmNAME_TO_PTR(record->info.u.FreeContiguousMemory.physical));
- 
-                 /* Unmap the user memory. */
-                 status = gckOS_FreeContiguous(
-                             Event->os,
--                            record->info.u.FreeContiguousMemory.physical,
--                            record->info.u.FreeContiguousMemory.logical,
--                            record->info.u.FreeContiguousMemory.bytes);
-+                            gcmNAME_TO_PTR(record->info.u.FreeContiguousMemory.physical),
-+                            gcmUINT64_TO_PTR(record->info.u.FreeContiguousMemory.logical),
-+                            (gctSIZE_T) record->info.u.FreeContiguousMemory.bytes);
- 
-                 if (gcmIS_SUCCESS(status))
-                 {
-@@ -2222,19 +2226,19 @@ gckEVENT_Notify(
-                     gcmkVERIFY_OK(gckKERNEL_FlushTranslationCache(
-                         Event->kernel,
-                         cache,
--                        event->event.u.FreeContiguousMemory.logical,
--                        event->event.u.FreeContiguousMemory.bytes));
-+                        gcmUINT64_TO_PTR(record->record.u.FreeContiguousMemory.logical),
-+                        (gctSIZE_T) record->record.u.FreeContiguousMemory.bytes));
- #endif
-                 }
-+                gcmRELEASE_NAME(record->info.u.FreeContiguousMemory.physical);
-                 break;
- 
-             case gcvHAL_FREE_VIDEO_MEMORY:
-+                node = gcmUINT64_TO_PTR(record->info.u.FreeVideoMemory.node);
-                 gcmkTRACE_ZONE(gcvLEVEL_VERBOSE, gcvZONE_EVENT,
-                                "gcvHAL_FREE_VIDEO_MEMORY: 0x%x",
--                               record->info.u.FreeVideoMemory.node);
--
-+                               node);
- #ifdef __QNXNTO__
--                node = record->info.u.FreeVideoMemory.node;
- #if gcdUSE_VIDMEM_PER_PID
-                 /* Check if the VidMem object still exists. */
-                 if (gckKERNEL_GetVideoMemoryPoolPid(record->kernel,
-@@ -2263,7 +2267,7 @@ gckEVENT_Notify(
- 
-                 /* Free video memory. */
-                 status =
--                    gckVIDMEM_Free(record->info.u.FreeVideoMemory.node);
-+                    gckVIDMEM_Free(node);
- 
-                 break;
- 
-@@ -2298,13 +2302,14 @@ gckEVENT_Notify(
-                 break;
- 
-             case gcvHAL_UNLOCK_VIDEO_MEMORY:
-+                node = gcmUINT64_TO_PTR(record->info.u.UnlockVideoMemory.node);
-+
-                 gcmkTRACE_ZONE(gcvLEVEL_VERBOSE, gcvZONE_EVENT,
-                                "gcvHAL_UNLOCK_VIDEO_MEMORY: 0x%x",
--                               record->info.u.UnlockVideoMemory.node);
-+                               node);
- 
-                 /* Save node information before it disappears. */
- #if gcdSECURE_USER
--                node = event->event.u.UnlockVideoMemory.node;
-                 if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM)
-                 {
-                     logical = gcvNULL;
-@@ -2320,7 +2325,7 @@ gckEVENT_Notify(
-                 /* Unlock. */
-                 status = gckVIDMEM_Unlock(
-                     Event->kernel,
--                    record->info.u.UnlockVideoMemory.node,
-+                    node,
-                     record->info.u.UnlockVideoMemory.type,
-                     gcvNULL);
- 
-@@ -2337,9 +2342,10 @@ gckEVENT_Notify(
-                 break;
- 
-             case gcvHAL_SIGNAL:
-+                signal = gcmUINT64_TO_PTR(record->info.u.Signal.signal);
-                 gcmkTRACE_ZONE(gcvLEVEL_VERBOSE, gcvZONE_EVENT,
-                                "gcvHAL_SIGNAL: 0x%x",
--                               record->info.u.Signal.signal);
-+                               signal);
- 
- #ifdef __QNXNTO__
-                 if ((record->info.u.Signal.coid == 0)
-@@ -2349,7 +2355,7 @@ gckEVENT_Notify(
-                     /* Kernel signal. */
-                     gcmkERR_BREAK(
-                         gckOS_Signal(Event->os,
--                                     record->info.u.Signal.signal,
-+                                     signal,
-                                      gcvTRUE));
-                 }
-                 else
-@@ -2357,18 +2363,18 @@ gckEVENT_Notify(
-                     /* User signal. */
-                     gcmkERR_BREAK(
-                         gckOS_UserSignal(Event->os,
--                                         record->info.u.Signal.signal,
-+                                         signal,
-                                          record->info.u.Signal.rcvid,
-                                          record->info.u.Signal.coid));
-                 }
- #else
-                 /* Set signal. */
--                if (record->info.u.Signal.process == gcvNULL)
-+                if (gcmUINT64_TO_PTR(record->info.u.Signal.process) == gcvNULL)
-                 {
-                     /* Kernel signal. */
-                     gcmkERR_BREAK(
-                         gckOS_Signal(Event->os,
--                                     record->info.u.Signal.signal,
-+                                     signal,
-                                      gcvTRUE));
-                 }
-                 else
-@@ -2376,26 +2382,27 @@ gckEVENT_Notify(
-                     /* User signal. */
-                     gcmkERR_BREAK(
-                         gckOS_UserSignal(Event->os,
--                                         record->info.u.Signal.signal,
--                                         record->info.u.Signal.process));
-+                                         signal,
-+                                         gcmUINT64_TO_PTR(record->info.u.Signal.process)));
-                 }
- 
--                gcmkASSERT(record->info.u.Signal.auxSignal == gcvNULL);
-+                gcmkASSERT(record->info.u.Signal.auxSignal == 0);
- #endif
-                 break;
- 
-             case gcvHAL_UNMAP_USER_MEMORY:
-+                info = gcmNAME_TO_PTR(record->info.u.UnmapUserMemory.info);
-                 gcmkTRACE_ZONE(gcvLEVEL_VERBOSE, gcvZONE_EVENT,
-                                "gcvHAL_UNMAP_USER_MEMORY: 0x%x",
--                               record->info.u.UnmapUserMemory.info);
-+                               info);
- 
-                 /* Unmap the user memory. */
-                 status = gckOS_UnmapUserMemory(
-                     Event->os,
-                     Event->kernel->core,
--                    record->info.u.UnmapUserMemory.memory,
--                    record->info.u.UnmapUserMemory.size,
--                    record->info.u.UnmapUserMemory.info,
-+                    gcmUINT64_TO_PTR(record->info.u.UnmapUserMemory.memory),
-+                    (gctSIZE_T) record->info.u.UnmapUserMemory.size,
-+                    info,
-                     record->info.u.UnmapUserMemory.address);
- 
- #if gcdSECURE_USER
-@@ -2404,10 +2411,11 @@ gckEVENT_Notify(
-                     gcmkVERIFY_OK(gckKERNEL_FlushTranslationCache(
-                         Event->kernel,
-                         cache,
--                        event->event.u.UnmapUserMemory.memory,
--                        event->event.u.UnmapUserMemory.size));
-+                        gcmUINT64_TO_PTR(record->info.u.UnmapUserMemory.memory),
-+                        (gctSIZE_T) record->info.u.UnmapUserMemory.size));
-                 }
- #endif
-+                gcmRELEASE_NAME(record->info.u.UnmapUserMemory.info);
-                 break;
- 
-             case gcvHAL_TIMESTAMP:
-@@ -2448,10 +2456,11 @@ gckEVENT_Notify(
-              case gcvHAL_FREE_VIRTUAL_COMMAND_BUFFER:
-                  gcmkVERIFY_OK(
-                      gckKERNEL_DestroyVirtualCommandBuffer(Event->kernel,
--                         record->info.u.FreeVirtualCommandBuffer.bytes,
--                         record->info.u.FreeVirtualCommandBuffer.physical,
--                         record->info.u.FreeVirtualCommandBuffer.logical
-+                         (gctSIZE_T) record->info.u.FreeVirtualCommandBuffer.bytes,
-+                         gcmNAME_TO_PTR(record->info.u.FreeVirtualCommandBuffer.physical),
-+                         gcmUINT64_TO_PTR(record->info.u.FreeVirtualCommandBuffer.logical)
-                          ));
-+                 gcmRELEASE_NAME(record->info.u.FreeVirtualCommandBuffer.physical);
-                  break;
- #endif
- 
-@@ -2701,13 +2710,13 @@ gckEVENT_Stop(
-     record->next = gcvNULL;
-     record->processID               = ProcessID;
-     record->info.command            = gcvHAL_SIGNAL;
--    record->info.u.Signal.signal    = Signal;
-+    record->info.u.Signal.signal    = gcmPTR_TO_UINT64(Signal);
- #ifdef __QNXNTO__
-     record->info.u.Signal.coid      = 0;
-     record->info.u.Signal.rcvid     = 0;
- #endif
--    record->info.u.Signal.auxSignal = gcvNULL;
--    record->info.u.Signal.process   = gcvNULL;
-+    record->info.u.Signal.auxSignal = 0;
-+    record->info.u.Signal.process   = 0;
- 
-     /* Append the record. */
-     Event->queues[id].head      = record;
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_heap.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_heap.c
-index c68e0c1..a5affb9 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_heap.c
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_heap.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- /**
- **  @file
- **  gckHEAP object for kernel HAL layer.  The heap implemented here is an arena-
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_interrupt_vg.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_interrupt_vg.c
-index e2f84f6..8ac187b 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_interrupt_vg.c
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_interrupt_vg.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_precomp.h"
- 
- #if gcdENABLE_VG
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c
-index 7358f9c..0c71e28 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_precomp.h"
- 
- #define _GC_OBJ_ZONE    gcvZONE_MMU
-@@ -1304,8 +1302,11 @@ gckMMU_AllocatePages(
-     gctUINT32 address;
-     gctINT i;
-     gckMMU mmu;
-+    gctBOOL acquired = gcvFALSE;
-+    gctBOOL allocated = gcvFALSE;
- 
-     gckOS_AcquireMutex(Mmu->os, mirrorPageTableMutex, gcvINFINITE);
-+    acquired = gcvTRUE;
- 
-     /* Allocate page table for current MMU. */
-     for (i = 0; i < mirrorPageTable->reference; i++)
-@@ -1313,6 +1314,7 @@ gckMMU_AllocatePages(
-         if (Mmu == mirrorPageTable->mmus[i])
-         {
-             gcmkONERROR(_AllocatePages(Mmu, PageCount, PageTable, Address));
-+            allocated = gcvTRUE;
-         }
-     }
- 
-@@ -1329,9 +1331,24 @@ gckMMU_AllocatePages(
-     }
- 
-     gckOS_ReleaseMutex(Mmu->os, mirrorPageTableMutex);
-+    acquired = gcvFALSE;
- 
-     return gcvSTATUS_OK;
- OnError:
-+
-+    if (allocated)
-+    {
-+        /* Page tables for multiple GPU always keep the same. So it is impossible
-+         * the fist one allocates successfully but others fail.
-+         */
-+        gcmkASSERT(0);
-+    }
-+
-+    if (acquired)
-+    {
-+        gckOS_ReleaseMutex(Mmu->os, mirrorPageTableMutex);
-+    }
-+
-     return status;
- #else
-     return _AllocatePages(Mmu, PageCount, PageTable, Address);
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu_vg.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu_vg.c
-index 46d1761..0c20290 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu_vg.c
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu_vg.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_precomp.h"
- 
- #if gcdENABLE_VG
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_power.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_power.c
-new file mode 100644
-index 0000000..df7579d
---- /dev/null
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_power.c
-@@ -0,0 +1,347 @@
-+/****************************************************************************
-+*
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
-+*
-+*    This program is free software; you can redistribute it and/or modify
-+*    it under the terms of the GNU General Public License as published by
-+*    the Free Software Foundation; either version 2 of the license, or
-+*    (at your option) any later version.
-+*
-+*    This program is distributed in the hope that it will be useful,
-+*    but WITHOUT ANY WARRANTY; without even the implied warranty of
-+*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+*    GNU General Public License for more details.
-+*
-+*    You should have received a copy of the GNU General Public License
-+*    along with this program; if not write to the Free Software
-+*    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-+*
-+*****************************************************************************/
-+
-+
-+#include "gc_hal_kernel_precomp.h"
-+
-+#define _GC_OBJ_ZONE    gcvZONE_POWER
-+
-+/******************************************************************************\
-+************************ Dynamic Voltage Frequency Setting *********************
-+\******************************************************************************/
-+#if gcdDVFS
-+static gctUINT32
-+_GetLoadHistory(
-+    IN gckDVFS Dvfs,
-+    IN gctUINT32 Select,
-+    IN gctUINT32 Index
-+)
-+{
-+    return Dvfs->loads[Index];
-+}
-+
-+static void
-+_IncreaseScale(
-+    IN gckDVFS Dvfs,
-+    IN gctUINT32 Load,
-+    OUT gctUINT8 *Scale
-+    )
-+{
-+    if (Dvfs->currentScale < 32)
-+    {
-+        *Scale = Dvfs->currentScale + 8;
-+    }
-+    else
-+    {
-+        *Scale = Dvfs->currentScale + 8;
-+        *Scale = gcmMIN(64, *Scale);
-+    }
-+}
-+
-+static void
-+_RecordFrequencyHistory(
-+    gckDVFS Dvfs,
-+    gctUINT32 Frequency
-+    )
-+{
-+    gctUINT32 i = 0;
-+
-+    struct _FrequencyHistory *history = Dvfs->frequencyHistory;
-+
-+    for (i = 0; i < 16; i++)
-+    {
-+        if (history->frequency == Frequency)
-+        {
-+            break;
-+        }
-+
-+        if (history->frequency == 0)
-+        {
-+            history->frequency = Frequency;
-+            break;
-+        }
-+
-+        history++;
-+    }
-+
-+    if (i < 16)
-+    {
-+        history->count++;
-+    }
-+}
-+
-+static gctUINT32
-+_GetFrequencyHistory(
-+    gckDVFS Dvfs,
-+    gctUINT32 Frequency
-+    )
-+{
-+    gctUINT32 i = 0;
-+
-+    struct _FrequencyHistory * history = Dvfs->frequencyHistory;
-+
-+    for (i = 0; i < 16; i++)
-+    {
-+        if (history->frequency == Frequency)
-+        {
-+            break;
-+        }
-+
-+        history++;
-+    }
-+
-+    if (i < 16)
-+    {
-+        return history->count;
-+    }
-+
-+    return 0;
-+}
-+
-+static void
-+_Policy(
-+    IN gckDVFS Dvfs,
-+    IN gctUINT32 Load,
-+    OUT gctUINT8 *Scale
-+    )
-+{
-+    gctUINT8 load[4], nextLoad;
-+    gctUINT8 scale;
-+
-+    /* Last 4 history. */
-+    load[0] = (Load & 0xFF);
-+    load[1] = (Load & 0xFF00) >> 8;
-+    load[2] = (Load & 0xFF0000) >> 16;
-+    load[3] = (Load & 0xFF000000) >> 24;
-+
-+    /* Determine target scale. */
-+    if (load[0] > 54)
-+    {
-+        _IncreaseScale(Dvfs, Load, &scale);
-+    }
-+    else
-+    {
-+        nextLoad = (load[0] + load[1] + load[2] + load[3])/4;
-+
-+        scale = Dvfs->currentScale * (nextLoad) / 54;
-+
-+        scale = gcmMAX(1, scale);
-+        scale = gcmMIN(64, scale);
-+    }
-+
-+    Dvfs->totalConfig++;
-+
-+    Dvfs->loads[(load[0]-1)/8]++;
-+
-+    *Scale = scale;
-+
-+
-+    if (Dvfs->totalConfig % 100 == 0)
-+    {
-+        gcmkPRINT("=======================================================");
-+        gcmkPRINT("GPU Load:       %-8d %-8d %-8d %-8d %-8d %-8d %-8d %-8d",
-+                                   8, 16, 24, 32, 40, 48, 56, 64);
-+        gcmkPRINT("                %-8d %-8d %-8d %-8d %-8d %-8d %-8d %-8d",
-+                  _GetLoadHistory(Dvfs,2, 0),
-+                  _GetLoadHistory(Dvfs,2, 1),
-+                  _GetLoadHistory(Dvfs,2, 2),
-+                  _GetLoadHistory(Dvfs,2, 3),
-+                  _GetLoadHistory(Dvfs,2, 4),
-+                  _GetLoadHistory(Dvfs,2, 5),
-+                  _GetLoadHistory(Dvfs,2, 6),
-+                  _GetLoadHistory(Dvfs,2, 7)
-+                  );
-+
-+        gcmkPRINT("Frequency(MHz)  %-8d %-8d %-8d %-8d %-8d",
-+                  58, 120, 240, 360, 480);
-+        gcmkPRINT("                %-8d %-8d %-8d %-8d %-8d",
-+                  _GetFrequencyHistory(Dvfs, 58),
-+                  _GetFrequencyHistory(Dvfs,120),
-+                  _GetFrequencyHistory(Dvfs,240),
-+                  _GetFrequencyHistory(Dvfs,360),
-+                  _GetFrequencyHistory(Dvfs,480)
-+                  );
-+    }
-+}
-+
-+static void
-+_TimerFunction(
-+    gctPOINTER Data
-+    )
-+{
-+    gceSTATUS status;
-+    gckDVFS dvfs = (gckDVFS) Data;
-+    gckHARDWARE hardware = dvfs->hardware;
-+    gctUINT32 value;
-+    gctUINT32 frequency;
-+    gctUINT8 scale;
-+    gctUINT32 t1, t2, consumed;
-+
-+    gckOS_GetTicks(&t1);
-+
-+    gcmkONERROR(gckHARDWARE_QueryLoad(hardware, &value));
-+
-+    /* determine target sacle. */
-+    _Policy(dvfs, value, &scale);
-+
-+    /* Set frequency and voltage. */
-+    gcmkONERROR(gckOS_SetGPUFrequency(hardware->os, hardware->core, scale));
-+
-+    /* Query real frequency. */
-+    gcmkONERROR(
-+        gckOS_QueryGPUFrequency(hardware->os,
-+                                hardware->core,
-+                                &frequency,
-+                                &dvfs->currentScale));
-+
-+    _RecordFrequencyHistory(dvfs, frequency);
-+
-+    gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_POWER,
-+                   "Current frequency = %d",
-+                   frequency);
-+
-+    /* Set period. */
-+    gcmkONERROR(gckHARDWARE_SetDVFSPeroid(hardware, frequency));
-+
-+OnError:
-+    /* Determine next querying time. */
-+    gckOS_GetTicks(&t2);
-+
-+    consumed = gcmMIN(((long)t2 - (long)t1), 5);
-+
-+    if (dvfs->stop == gcvFALSE)
-+    {
-+        gcmkVERIFY_OK(gckOS_StartTimer(hardware->os,
-+                                       dvfs->timer,
-+                                       dvfs->pollingTime - consumed));
-+    }
-+
-+    return;
-+}
-+
-+gceSTATUS
-+gckDVFS_Construct(
-+    IN gckHARDWARE Hardware,
-+    OUT gckDVFS * Dvfs
-+    )
-+{
-+    gceSTATUS status;
-+    gctPOINTER pointer;
-+    gckDVFS dvfs = gcvNULL;
-+    gckOS os = Hardware->os;
-+
-+    gcmkHEADER_ARG("Hardware=0x%X", Hardware);
-+
-+    gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
-+    gcmkVERIFY_ARGUMENT(Dvfs != gcvNULL);
-+
-+    /* Allocate a gckDVFS manager. */
-+    gcmkONERROR(gckOS_Allocate(os, gcmSIZEOF(struct _gckDVFS), &pointer));
-+
-+    gckOS_ZeroMemory(pointer, gcmSIZEOF(struct _gckDVFS));
-+
-+    dvfs = pointer;
-+
-+    /* Initialization. */
-+    dvfs->hardware = Hardware;
-+    dvfs->pollingTime = gcdDVFS_POLLING_TIME;
-+    dvfs->os = Hardware->os;
-+    dvfs->currentScale = 64;
-+
-+    /* Create a polling timer. */
-+    gcmkONERROR(gckOS_CreateTimer(os, _TimerFunction, pointer, &dvfs->timer));
-+
-+    /* Initialize frequency and voltage adjustment helper. */
-+    gcmkONERROR(gckOS_PrepareGPUFrequency(os, Hardware->core));
-+
-+    /* Return result. */
-+    *Dvfs = dvfs;
-+
-+    gcmkFOOTER_NO();
-+    return gcvSTATUS_OK;
-+
-+OnError:
-+    /* Roll back. */
-+    if (dvfs)
-+    {
-+        if (dvfs->timer)
-+        {
-+            gcmkVERIFY_OK(gckOS_DestroyTimer(os, dvfs->timer));
-+        }
-+
-+        gcmkOS_SAFE_FREE(os, dvfs);
-+    }
-+
-+    gcmkFOOTER();
-+    return status;
-+}
-+
-+gceSTATUS
-+gckDVFS_Destroy(
-+    IN gckDVFS Dvfs
-+    )
-+{
-+    gcmkHEADER_ARG("Dvfs=0x%X", Dvfs);
-+    gcmkVERIFY_ARGUMENT(Dvfs != gcvNULL);
-+
-+    /* Deinitialize helper fuunction. */
-+    gcmkVERIFY_OK(gckOS_FinishGPUFrequency(Dvfs->os, Dvfs->hardware->core));
-+
-+    /* DestroyTimer. */
-+    gcmkVERIFY_OK(gckOS_DestroyTimer(Dvfs->os, Dvfs->timer));
-+
-+    gcmkOS_SAFE_FREE(Dvfs->os, Dvfs);
-+
-+    gcmkFOOTER_NO();
-+    return gcvSTATUS_OK;
-+}
-+
-+gceSTATUS
-+gckDVFS_Start(
-+    IN gckDVFS Dvfs
-+    )
-+{
-+    gcmkHEADER_ARG("Dvfs=0x%X", Dvfs);
-+    gcmkVERIFY_ARGUMENT(Dvfs != gcvNULL);
-+
-+    gckHARDWARE_InitDVFS(Dvfs->hardware);
-+
-+    Dvfs->stop = gcvFALSE;
-+
-+    gckOS_StartTimer(Dvfs->os, Dvfs->timer, Dvfs->pollingTime);
-+
-+    gcmkFOOTER_NO();
-+    return gcvSTATUS_OK;
-+}
-+
-+gceSTATUS
-+gckDVFS_Stop(
-+    IN gckDVFS Dvfs
-+    )
-+{
-+    gcmkHEADER_ARG("Dvfs=0x%X", Dvfs);
-+    gcmkVERIFY_ARGUMENT(Dvfs != gcvNULL);
-+
-+    Dvfs->stop = gcvTRUE;
-+
-+    gcmkFOOTER_NO();
-+    return gcvSTATUS_OK;
-+}
-+#endif
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_precomp.h b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_precomp.h
-index 004e6bd..1e764c2 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_precomp.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_precomp.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_kernel_precomp_h_
- #define __gc_hal_kernel_precomp_h_
- 
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_vg.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_vg.c
-index 72ed5b8..7d0032e 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_vg.c
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_vg.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_precomp.h"
- 
- #if gcdENABLE_VG
-@@ -397,6 +395,11 @@ gceSTATUS gckVGKERNEL_Dispatch(
-     gcsHAL_INTERFACE * kernelInterface = Interface;
-     gcuVIDMEM_NODE_PTR node;
-     gctUINT32 processID;
-+    gckKERNEL kernel = Kernel;
-+    gctPOINTER info = gcvNULL;
-+    gctPHYS_ADDR physical = gcvNULL;
-+    gctPOINTER logical = gcvNULL;
-+    gctSIZE_T bytes = 0;
- 
-     gcmkHEADER_ARG("Kernel=0x%x Interface=0x%x ", Kernel, Interface);
- 
-@@ -436,61 +439,78 @@ gceSTATUS gckVGKERNEL_Dispatch(
-             ));
-         break;
-     case gcvHAL_ALLOCATE_NON_PAGED_MEMORY:
-+        bytes = (gctSIZE_T) kernelInterface->u.AllocateNonPagedMemory.bytes;
-         /* Allocate non-paged memory. */
-         gcmkERR_BREAK(gckOS_AllocateContiguous(
-             Kernel->os,
-             gcvTRUE,
--            &kernelInterface->u.AllocateNonPagedMemory.bytes,
--            &kernelInterface->u.AllocateNonPagedMemory.physical,
--            &kernelInterface->u.AllocateNonPagedMemory.logical
-+            &bytes,
-+            &physical,
-+            &logical
-             ));
-+
-+        kernelInterface->u.AllocateNonPagedMemory.bytes    = bytes;
-+        kernelInterface->u.AllocateNonPagedMemory.logical  = gcmPTR_TO_UINT64(logical);
-+        kernelInterface->u.AllocateNonPagedMemory.physical = gcmPTR_TO_NAME(physical);
-         break;
- 
-     case gcvHAL_FREE_NON_PAGED_MEMORY:
-+        physical = gcmNAME_TO_PTR(kernelInterface->u.AllocateNonPagedMemory.physical);
-+
-         /* Unmap user logical out of physical memory first. */
-         gcmkERR_BREAK(gckOS_UnmapUserLogical(
-             Kernel->os,
--            kernelInterface->u.AllocateNonPagedMemory.physical,
--            kernelInterface->u.AllocateNonPagedMemory.bytes,
--            kernelInterface->u.AllocateNonPagedMemory.logical
-+            physical,
-+            (gctSIZE_T) kernelInterface->u.AllocateNonPagedMemory.bytes,
-+            gcmUINT64_TO_PTR(kernelInterface->u.AllocateNonPagedMemory.logical)
-             ));
- 
-         /* Free non-paged memory. */
-         gcmkERR_BREAK(gckOS_FreeNonPagedMemory(
-             Kernel->os,
--            kernelInterface->u.AllocateNonPagedMemory.bytes,
--            kernelInterface->u.AllocateNonPagedMemory.physical,
--            kernelInterface->u.AllocateNonPagedMemory.logical
-+            (gctSIZE_T) kernelInterface->u.AllocateNonPagedMemory.bytes,
-+            physical,
-+            gcmUINT64_TO_PTR(kernelInterface->u.AllocateNonPagedMemory.logical)
-             ));
-+
-+        gcmRELEASE_NAME(kernelInterface->u.AllocateNonPagedMemory.physical);
-         break;
- 
-     case gcvHAL_ALLOCATE_CONTIGUOUS_MEMORY:
-+        bytes = (gctSIZE_T) kernelInterface->u.AllocateNonPagedMemory.bytes;
-         /* Allocate contiguous memory. */
-         gcmkERR_BREAK(gckOS_AllocateContiguous(
-             Kernel->os,
-             gcvTRUE,
--            &kernelInterface->u.AllocateNonPagedMemory.bytes,
--            &kernelInterface->u.AllocateNonPagedMemory.physical,
--            &kernelInterface->u.AllocateNonPagedMemory.logical
-+            &bytes,
-+            &physical,
-+            &logical
-             ));
-+
-+        kernelInterface->u.AllocateNonPagedMemory.bytes    = bytes;
-+        kernelInterface->u.AllocateNonPagedMemory.logical  = gcmPTR_TO_UINT64(logical);
-+        kernelInterface->u.AllocateNonPagedMemory.physical = gcmPTR_TO_NAME(physical);
-         break;
- 
-     case gcvHAL_FREE_CONTIGUOUS_MEMORY:
-+        physical = gcmNAME_TO_PTR(kernelInterface->u.AllocateNonPagedMemory.physical);
-         /* Unmap user logical out of physical memory first. */
-         gcmkERR_BREAK(gckOS_UnmapUserLogical(
-             Kernel->os,
--            kernelInterface->u.AllocateNonPagedMemory.physical,
--            kernelInterface->u.AllocateNonPagedMemory.bytes,
--            kernelInterface->u.AllocateNonPagedMemory.logical
-+            physical,
-+            (gctSIZE_T) kernelInterface->u.AllocateNonPagedMemory.bytes,
-+            gcmUINT64_TO_PTR(kernelInterface->u.AllocateNonPagedMemory.logical)
-             ));
- 
-         /* Free contiguous memory. */
-         gcmkERR_BREAK(gckOS_FreeContiguous(
-             Kernel->os,
--            kernelInterface->u.AllocateNonPagedMemory.physical,
--            kernelInterface->u.AllocateNonPagedMemory.logical,
--            kernelInterface->u.AllocateNonPagedMemory.bytes
-+            physical,
-+            gcmUINT64_TO_PTR(kernelInterface->u.AllocateNonPagedMemory.logical),
-+            (gctSIZE_T) kernelInterface->u.AllocateNonPagedMemory.bytes
-             ));
-+
-+        gcmRELEASE_NAME(kernelInterface->u.AllocateNonPagedMemory.physical);
-         break;
- 
-     case gcvHAL_ALLOCATE_VIDEO_MEMORY:
-@@ -532,8 +552,10 @@ gceSTATUS gckVGKERNEL_Dispatch(
-                 bytes,
-                 64,
-                 kernelInterface->u.AllocateVideoMemory.type,
--                &kernelInterface->u.AllocateVideoMemory.node
-+                &node
-                 ));
-+
-+            kernelInterface->u.AllocateVideoMemory.node = gcmPTR_TO_UINT64(node);
-         }
-         break;
- 
-@@ -545,22 +567,23 @@ gceSTATUS gckVGKERNEL_Dispatch(
-             kernelInterface->u.AllocateLinearVideoMemory.bytes,
-             kernelInterface->u.AllocateLinearVideoMemory.alignment,
-             kernelInterface->u.AllocateLinearVideoMemory.type,
--            &kernelInterface->u.AllocateLinearVideoMemory.node
-+            &node
-             ));
- 
-         gcmkERR_BREAK(gckKERNEL_AddProcessDB(Kernel,
-            processID, gcvDB_VIDEO_MEMORY,
--           Interface->u.AllocateLinearVideoMemory.node,
-+           node,
-            gcvNULL,
-            kernelInterface->u.AllocateLinearVideoMemory.bytes
-            ));
- 
-+        kernelInterface->u.AllocateLinearVideoMemory.node = gcmPTR_TO_UINT64(node);
-         break;
- 
-     case gcvHAL_FREE_VIDEO_MEMORY:
-+        node = gcmUINT64_TO_PTR(Interface->u.FreeVideoMemory.node);
- #ifdef __QNXNTO__
-         /* Unmap the video memory */
--        node = Interface->u.FreeVideoMemory.node;
- 
-         if ((node->VidMem.memory->object.type == gcvOBJ_VIDMEM) &&
-             (node->VidMem.logical != gcvNULL))
-@@ -575,13 +598,13 @@ gceSTATUS gckVGKERNEL_Dispatch(
- 
-         /* Free video memory. */
-         gcmkERR_BREAK(gckVIDMEM_Free(
--            Interface->u.FreeVideoMemory.node
-+            node
-             ));
- 
-         gcmkERR_BREAK(gckKERNEL_RemoveProcessDB(
-             Kernel,
-             processID, gcvDB_VIDEO_MEMORY,
--            Interface->u.FreeVideoMemory.node
-+            node
-             ));
- 
-         break;
-@@ -590,19 +613,20 @@ gceSTATUS gckVGKERNEL_Dispatch(
-         /* Map memory. */
-         gcmkERR_BREAK(gckKERNEL_MapMemory(
-             Kernel,
--            kernelInterface->u.MapMemory.physical,
--            kernelInterface->u.MapMemory.bytes,
--            &kernelInterface->u.MapMemory.logical
-+            gcmINT2PTR(kernelInterface->u.MapMemory.physical),
-+            (gctSIZE_T) kernelInterface->u.MapMemory.bytes,
-+            &logical
-             ));
-+        kernelInterface->u.MapMemory.logical = gcmPTR_TO_UINT64(logical);
-         break;
- 
-     case gcvHAL_UNMAP_MEMORY:
-         /* Unmap memory. */
-         gcmkERR_BREAK(gckKERNEL_UnmapMemory(
-             Kernel,
--            kernelInterface->u.MapMemory.physical,
--            kernelInterface->u.MapMemory.bytes,
--            kernelInterface->u.MapMemory.logical
-+            gcmINT2PTR(kernelInterface->u.MapMemory.physical),
-+            (gctSIZE_T) kernelInterface->u.MapMemory.bytes,
-+            gcmUINT64_TO_PTR(kernelInterface->u.MapMemory.logical)
-             ));
-         break;
- 
-@@ -611,12 +635,14 @@ gceSTATUS gckVGKERNEL_Dispatch(
-         gcmkERR_BREAK(gckOS_MapUserMemory(
-             Kernel->os,
-             gcvCORE_VG,
--            kernelInterface->u.MapUserMemory.memory,
-+            gcmUINT64_TO_PTR(kernelInterface->u.MapUserMemory.memory),
-             kernelInterface->u.MapUserMemory.physical,
--            kernelInterface->u.MapUserMemory.size,
--            &kernelInterface->u.MapUserMemory.info,
-+            (gctSIZE_T) kernelInterface->u.MapUserMemory.size,
-+            &info,
-             &kernelInterface->u.MapUserMemory.address
-             ));
-+
-+        kernelInterface->u.MapUserMemory.info = gcmPTR_TO_NAME(info);
-         break;
- 
-     case gcvHAL_UNMAP_USER_MEMORY:
-@@ -624,21 +650,22 @@ gceSTATUS gckVGKERNEL_Dispatch(
-         gcmkERR_BREAK(gckOS_UnmapUserMemory(
-             Kernel->os,
-             gcvCORE_VG,
--            kernelInterface->u.UnmapUserMemory.memory,
--            kernelInterface->u.UnmapUserMemory.size,
--            kernelInterface->u.UnmapUserMemory.info,
-+            gcmUINT64_TO_PTR(kernelInterface->u.UnmapUserMemory.memory),
-+            (gctSIZE_T) kernelInterface->u.UnmapUserMemory.size,
-+            gcmNAME_TO_PTR(kernelInterface->u.UnmapUserMemory.info),
-             kernelInterface->u.UnmapUserMemory.address
-             ));
-         break;
-     case gcvHAL_LOCK_VIDEO_MEMORY:
-+        node = gcmUINT64_TO_PTR(Interface->u.LockVideoMemory.node);
-+
-         /* Lock video memory. */
-         gcmkERR_BREAK(
-             gckVIDMEM_Lock(Kernel,
--                           Interface->u.LockVideoMemory.node,
-+                           node,
- 						   gcvFALSE,
-                            &Interface->u.LockVideoMemory.address));
- 
--        node = Interface->u.LockVideoMemory.node;
-         if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM)
-         {
-             /* Map video memory address into user space. */
-@@ -654,19 +681,20 @@ gceSTATUS gckVGKERNEL_Dispatch(
-                                          &node->VidMem.logical));
-         }
- 
--        Interface->u.LockVideoMemory.memory = node->VidMem.logical;
-+        Interface->u.LockVideoMemory.memory = gcmPTR_TO_UINT64(node->VidMem.logical);
- #else
-             gcmkERR_BREAK(
-                 gckKERNEL_MapVideoMemoryEx(Kernel,
-                                          gcvCORE_VG,
-                                          FromUser,
-                                          Interface->u.LockVideoMemory.address,
--                                         &Interface->u.LockVideoMemory.memory));
-+                                         &logical));
-+            Interface->u.LockVideoMemory.memory = gcmPTR_TO_UINT64(logical);
- #endif
-         }
-         else
-         {
--            Interface->u.LockVideoMemory.memory = node->Virtual.logical;
-+            Interface->u.LockVideoMemory.memory = gcmPTR_TO_UINT64(node->Virtual.logical);
- 
-             /* Success. */
-             status = gcvSTATUS_OK;
-@@ -675,19 +703,19 @@ gceSTATUS gckVGKERNEL_Dispatch(
- #if gcdSECURE_USER
-         /* Return logical address as physical address. */
-         Interface->u.LockVideoMemory.address =
--            gcmPTR2INT(Interface->u.LockVideoMemory.memory);
-+            (gctUINT32)(Interface->u.LockVideoMemory.memory);
- #endif
-         gcmkERR_BREAK(
-             gckKERNEL_AddProcessDB(Kernel,
-                                    processID, gcvDB_VIDEO_MEMORY_LOCKED,
--                                   Interface->u.LockVideoMemory.node,
-+                                   node,
-                                    gcvNULL,
-                                    0));
-         break;
- 
-     case gcvHAL_UNLOCK_VIDEO_MEMORY:
-         /* Unlock video memory. */
--        node = Interface->u.UnlockVideoMemory.node;
-+        node = gcmUINT64_TO_PTR(Interface->u.UnlockVideoMemory.node);
- 
- #if gcdSECURE_USER
-         /* Save node information before it disappears. */
-@@ -727,7 +755,7 @@ gceSTATUS gckVGKERNEL_Dispatch(
-             gcmkERR_BREAK(
-                     gckKERNEL_RemoveProcessDB(Kernel,
-                         processID, gcvDB_VIDEO_MEMORY_LOCKED,
--                        Interface->u.UnlockVideoMemory.node));
-+                        node));
-         }
- 
-         break;
-@@ -789,10 +817,10 @@ gceSTATUS gckVGKERNEL_Dispatch(
-         /* Commit a command and context buffer. */
-         gcmkERR_BREAK(gckVGCOMMAND_Commit(
-             Kernel->vg->command,
--            kernelInterface->u.VGCommit.context,
--            kernelInterface->u.VGCommit.queue,
-+            gcmUINT64_TO_PTR(kernelInterface->u.VGCommit.context),
-+            gcmUINT64_TO_PTR(kernelInterface->u.VGCommit.queue),
-             kernelInterface->u.VGCommit.entryCount,
--            kernelInterface->u.VGCommit.taskTable
-+            gcmUINT64_TO_PTR(kernelInterface->u.VGCommit.taskTable)
-             ));
-         break;
-     case gcvHAL_VERSION:
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_vg.h b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_vg.h
-index b86b0c9..b6c6d7e 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_vg.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_vg.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,9 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
--
- #ifndef __gc_hal_kernel_vg_h_
- #define __gc_hal_kernel_vg_h_
- 
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c
-index b681a65..d9370e2 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c
-+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_precomp.h"
- 
- #define _GC_OBJ_ZONE    gcvZONE_VIDMEM
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h
-index dc936c7..7077412 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_h_
- #define __gc_hal_h_
- 
-@@ -67,6 +65,59 @@ extern "C" {
- )
- 
- /******************************************************************************\
-+********************************* Cast Macro **********************************
-+\******************************************************************************/
-+#define gcmNAME_TO_PTR(na) \
-+        gckKERNEL_QueryPointerFromName(kernel, gcmALL_TO_UINT32(na))
-+
-+#define gcmPTR_TO_NAME(ptr) \
-+        gckKERNEL_AllocateNameFromPointer(kernel, ptr)
-+
-+#define gcmRELEASE_NAME(na) \
-+        gckKERNEL_DeleteName(kernel, gcmALL_TO_UINT32(na))
-+
-+#ifdef __LP64__
-+
-+#define gcmALL_TO_UINT32(t) \
-+( \
-+    (gctUINT32) (gctUINTPTR_T) (t)\
-+)
-+
-+#define gcmPTR_TO_UINT64(p) \
-+( \
-+    (gctUINT64) (p)\
-+)
-+
-+#define gcmUINT64_TO_PTR(u) \
-+( \
-+    (gctPOINTER) (u)\
-+)
-+
-+#else /* 32 bit */
-+
-+#define gcmALL_TO_UINT32(t) \
-+( \
-+    (gctUINT32) (t)\
-+)
-+
-+#define gcmPTR_TO_UINT64(p) \
-+( \
-+    (gctUINT64) (gctUINTPTR_T) (p)\
-+)
-+
-+#define gcmUINT64_TO_PTR(u) \
-+( \
-+    (gctPOINTER) (gctUINTPTR_T) (u)\
-+)
-+
-+#endif
-+
-+#define gcmUINT64_TO_TYPE(u, t) \
-+( \
-+    (t) (gctUINTPTR_T) (u)\
-+)
-+
-+/******************************************************************************\
- ******************************** Useful Macro *********************************
- \******************************************************************************/
- 
-@@ -1275,6 +1326,33 @@ gckOS_ResetGPU(
-     IN gceCORE Core
-     );
- 
-+gceSTATUS
-+gckOS_PrepareGPUFrequency(
-+    IN gckOS Os,
-+    IN gceCORE Core
-+    );
-+
-+gceSTATUS
-+gckOS_FinishGPUFrequency(
-+    IN gckOS Os,
-+    IN gceCORE Core
-+    );
-+
-+gceSTATUS
-+gckOS_QueryGPUFrequency(
-+    IN gckOS Os,
-+    IN gceCORE Core,
-+    OUT gctUINT32 * Frequency,
-+    OUT gctUINT8 * Scale
-+    );
-+
-+gceSTATUS
-+gckOS_SetGPUFrequency(
-+    IN gckOS Os,
-+    IN gceCORE Core,
-+    IN gctUINT8 Scale
-+    );
-+
- /*******************************************************************************
- ** Semaphores.
- */
-@@ -1339,7 +1417,7 @@ gckOS_CreateTimer(
- 
- /* Destory a timer. */
- gceSTATUS
--gckOS_DestoryTimer(
-+gckOS_DestroyTimer(
-     IN gckOS Os,
-     IN gctPOINTER Timer
-     );
-@@ -1414,6 +1492,7 @@ gckHEAP_ProfileEnd(
- typedef struct _gckVIDMEM *         gckVIDMEM;
- typedef struct _gckKERNEL *         gckKERNEL;
- typedef struct _gckDB *             gckDB;
-+typedef struct _gckDVFS *           gckDVFS;
- 
- /* Construct a new gckVIDMEM object. */
- gceSTATUS
-@@ -1704,6 +1783,27 @@ gckKERNEL_CloseUserData(
-     OUT gctPOINTER * KernelPointer
-     );
- 
-+gceSTATUS
-+gckDVFS_Construct(
-+    IN gckHARDWARE Hardware,
-+    OUT gckDVFS * Frequency
-+    );
-+
-+gceSTATUS
-+gckDVFS_Destroy(
-+    IN gckDVFS Dvfs
-+    );
-+
-+gceSTATUS
-+gckDVFS_Start(
-+    IN gckDVFS Dvfs
-+    );
-+
-+gceSTATUS
-+gckDVFS_Stop(
-+    IN gckDVFS Dvfs
-+    );
-+
- /******************************************************************************\
- ******************************* gckHARDWARE Object *****************************
- \******************************************************************************/
-@@ -2058,6 +2158,23 @@ gckHARDWARE_DumpGPUState(
-     IN gckHARDWARE Hardware
-     );
- 
-+gceSTATUS
-+gckHARDWARE_InitDVFS(
-+    IN gckHARDWARE Hardware
-+    );
-+
-+gceSTATUS
-+gckHARDWARE_QueryLoad(
-+    IN gckHARDWARE Hardware,
-+    OUT gctUINT32 * Load
-+    );
-+
-+gceSTATUS
-+gckHARDWARE_SetDVFSPeroid(
-+    IN gckHARDWARE Hardware,
-+    IN gctUINT32 Frequency
-+    );
-+
- #if !gcdENABLE_VG
- /******************************************************************************\
- ***************************** gckINTERRUPT Object ******************************
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h
-index 7f2de33..ac86399 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_base_h_
- #define __gc_hal_base_h_
- 
-@@ -68,6 +66,11 @@ typedef struct _gcsCONTEXT_MAP *		gcsCONTEXT_MAP_PTR;
- typedef void *                          gcoVG;
- #endif
- 
-+#if gcdSYNC
-+typedef struct _gcoFENCE *              gcoFENCE;
-+typedef struct _gcsSYNC_CONTEXT  *      gcsSYNC_CONTEXT_PTR;
-+#endif
-+
- /******************************************************************************\
- ******************************* Process local storage *************************
- \******************************************************************************/
-@@ -140,6 +143,9 @@ typedef struct _gcsTLS
- #ifndef VIVANTE_NO_3D
- 	gco3D						engine3D;
- #endif
-+#if gcdSYNC
-+    gctBOOL                     fenceEnable;
-+#endif
- 	gco2D						engine2D;
-     gctBOOL                     copied;
- }
-@@ -1022,29 +1028,6 @@ gcoOS_GetPos(
-     OUT gctUINT32 * Position
-     );
- 
--/* Perform a memory copy. */
--gceSTATUS
--gcoOS_MemCopy(
--    IN gctPOINTER Destination,
--    IN gctCONST_POINTER Source,
--    IN gctSIZE_T Bytes
--    );
--
--/* Perform a memory fill. */
--gceSTATUS
--gcoOS_MemFill(
--    IN gctPOINTER Destination,
--    IN gctUINT8 Filler,
--    IN gctSIZE_T Bytes
--    );
--
--/* Zero memory. */
--gceSTATUS
--gcoOS_ZeroMemory(
--    IN gctPOINTER Memory,
--    IN gctSIZE_T Bytes
--    );
--
- /* Same as strstr. */
- gceSTATUS
- gcoOS_StrStr(
-@@ -1062,12 +1045,6 @@ gcoOS_StrFindReverse(
-     );
- 
- gceSTATUS
--gcoOS_StrLen(
--    IN gctCONST_STRING String,
--    OUT gctSIZE_T * Length
--    );
--
--gceSTATUS
- gcoOS_StrDup(
-     IN gcoOS Os,
-     IN gctCONST_STRING String,
-@@ -1113,13 +1090,15 @@ gcoOS_StrToFloat(
-     );
- 
- /* Convert hex string to integer. */
--gceSTATUS gcoOS_HexStrToInt(
-+gceSTATUS
-+gcoOS_HexStrToInt(
- 	IN gctCONST_STRING String,
- 	OUT gctINT * Int
- 	);
- 
- /* Convert hex string to float. */
--gceSTATUS gcoOS_HexStrToFloat(
-+gceSTATUS
-+gcoOS_HexStrToFloat(
- 	IN gctCONST_STRING String,
- 	OUT gctFLOAT * Float
- 	);
-@@ -1228,6 +1207,11 @@ gcoOS_DetectProcessByName(
-     IN gctCONST_STRING Name
-     );
- 
-+gceSTATUS
-+gcoOS_DetectProcessByEncryptedName(
-+    IN gctCONST_STRING Name
-+    );
-+
- /*----------------------------------------------------------------------------*/
- /*----- Atoms ----------------------------------------------------------------*/
- 
-@@ -1440,7 +1424,7 @@ gcoOS_ReadRegister(
- gceSTATUS
- gcoOS_CacheClean(
-     IN gcoOS Os,
--    IN gcuVIDMEM_NODE_PTR Node,
-+    IN gctUINT64 Node,
-     IN gctPOINTER Logical,
-     IN gctSIZE_T Bytes
-     );
-@@ -1448,7 +1432,7 @@ gcoOS_CacheClean(
- gceSTATUS
- gcoOS_CacheFlush(
-     IN gcoOS Os,
--    IN gcuVIDMEM_NODE_PTR Node,
-+    IN gctUINT64 Node,
-     IN gctPOINTER Logical,
-     IN gctSIZE_T Bytes
-     );
-@@ -1456,7 +1440,7 @@ gcoOS_CacheFlush(
- gceSTATUS
- gcoOS_CacheInvalidate(
-     IN gcoOS Os,
--    IN gcuVIDMEM_NODE_PTR Node,
-+    IN gctUINT64 Node,
-     IN gctPOINTER Logical,
-     IN gctSIZE_T Bytes
-     );
-@@ -1786,7 +1770,7 @@ gcoSURF_MapUserSurface(
- gceSTATUS
- gcoSURF_QueryVidMemNode(
-     IN gcoSURF Surface,
--    OUT gcuVIDMEM_NODE_PTR * Node,
-+    OUT gctUINT64 * Node,
-     OUT gcePOOL * Pool,
-     OUT gctUINT_PTR Bytes
-     );
-@@ -2450,6 +2434,7 @@ gcoOS_DebugTrace(
- #define gcvZONE_DEVICE          (1 << 10)
- #define gcvZONE_DATABASE        (1 << 11)
- #define gcvZONE_INTERRUPT       (1 << 12)
-+#define gcvZONE_POWER           (1 << 13)
- 
- /* User zones. */
- #define gcvZONE_HAL             (1 << 3)
-@@ -3664,6 +3649,7 @@ gckOS_DebugStatus2Name(
- #   define gcmDEBUG_VERIFY_ARGUMENT(arg)
- #   define gcmkDEBUG_VERIFY_ARGUMENT(arg)
- #endif
-+
- /*******************************************************************************
- **
- **  gcmVERIFY_ARGUMENT_RETURN
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_compiler.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_compiler.h
-index 64a8f1a..4a0870f 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_compiler.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_compiler.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- /*
- **	Include file the defines the front- and back-end compilers, as well as the
- **	objects they use.
-@@ -41,6 +39,9 @@ extern "C" {
- #define GC_ENABLE_LOADTIME_OPT      1
- #endif
- 
-+#define TEMP_OPT_CONSTANT_TEXLD_COORD    1
-+
-+#define TEMP_SHADER_PATCH            1
- /******************************* IR VERSION ******************/
- #define gcdSL_IR_VERSION gcmCC('\0','\0','\0','\1')
- 
-@@ -266,6 +267,7 @@ typedef enum _gcSL_OPCODE
- 	gcSL_ADDSAT,						/* 0x5C */  /* Integer only. */
- 	gcSL_SUBSAT,						/* 0x5D */  /* Integer only. */
- 	gcSL_MULSAT,						/* 0x5E */  /* Integer only. */
-+	gcSL_MAXOPCODE
- }
- gcSL_OPCODE;
- 
-@@ -507,8 +509,15 @@ struct _gcsHINT
-     gctUINT32   colorKillInstruction[3];
- #endif
- 
-+#if TEMP_SHADER_PATCH
-+	gctUINT32	pachedShaderIdentifier;
-+#endif
- };
- 
-+#if TEMP_SHADER_PATCH
-+#define INVALID_SHADER_IDENTIFIER 0xFFFFFFFF
-+#endif
-+
- /* gcSHADER_TYPE enumeration. */
- typedef enum _gcSHADER_TYPE
- {
-@@ -893,6 +902,16 @@ typedef struct _gcOPTIMIZER_OPTION
-           Note: n must be decimal number
-      */
-     gctUINT     featureBits;
-+
-+    /* inline level (default 2 at O1):
-+
-+          VC_OPTION=-INLINELEVEL:[0-3]
-+             0:  no inline
-+             1:  only inline the function only called once or small function
-+             2:  inline functions be called less than 5 times or medium size function
-+             3:  inline everything possible
-+     */
-+    gctUINT     inlineLevel;
- } gcOPTIMIZER_OPTION;
- 
- extern gcOPTIMIZER_OPTION theOptimizerOption;
-@@ -926,6 +945,8 @@ extern gcOPTIMIZER_OPTION theOptimizerOption;
- #define gcmOPT_PACKVARYING_triageStart()   (gcmGetOptimizerOption()->_triageStart)
- #define gcmOPT_PACKVARYING_triageEnd()     (gcmGetOptimizerOption()->_triageEnd)
- 
-+#define gcmOPT_INLINELEVEL()     (gcmGetOptimizerOption()->inlineLevel)
-+
- /* Setters */
- #define gcmOPT_SetPatchTexld(m,n) (gcmGetOptimizerOption()->patchEveryTEXLDs = (m),\
-                                    gcmGetOptimizerOption()->patchDummyTEXLDs = (n))
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h
-index e577809..028bbd1 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_driver_h_
- #define __gc_hal_driver_h_
- 
-@@ -164,7 +162,10 @@ typedef enum _gceHAL_COMMAND_CODES
- 
-     /* FSCALE_VAL. */
-     gcvHAL_SET_FSCALE_VALUE,
--    gcvHAL_GET_FSCALE_VALUE
-+    gcvHAL_GET_FSCALE_VALUE,
-+
-+    /* Reset time stamp. */
-+    gcvHAL_QUERY_RESET_TIME_STAMP,
- }
- gceHAL_COMMAND_CODES;
- 
-@@ -252,19 +253,19 @@ typedef struct _gcsHAL_COMPOSE * gcsHAL_COMPOSE_PTR;
- typedef struct _gcsHAL_COMPOSE
- {
-     /* Composition state buffer. */
--    gctPHYS_ADDR                physical;
--    gctPOINTER                  logical;
--    gctSIZE_T                   offset;
--    gctSIZE_T                   size;
-+    gctUINT64                   physical;
-+    gctUINT64                   logical;
-+    gctUINT                     offset;
-+    gctUINT                     size;
- 
-     /* Composition end signal. */
--    gctHANDLE                   process;
--    gctSIGNAL                   signal;
-+    gctUINT64                   process;
-+    gctUINT64                   signal;
- 
-     /* User signals. */
--    gctHANDLE                   userProcess;
--    gctSIGNAL                   userSignal1;
--    gctSIGNAL                   userSignal2;
-+    gctUINT64                   userProcess;
-+    gctUINT64                   userSignal1;
-+    gctUINT64                   userSignal2;
- 
- #if defined(__QNXNTO__)
-     /* Client pulse side-channel connection ID. */
-@@ -276,6 +277,7 @@ typedef struct _gcsHAL_COMPOSE
- }
- gcsHAL_COMPOSE;
- 
-+
- typedef struct _gcsHAL_INTERFACE
- {
-     /* Command code. */
-@@ -288,7 +290,7 @@ typedef struct _gcsHAL_INTERFACE
-     gceSTATUS                   status;
- 
-     /* Handle to this interface channel. */
--    gctHANDLE                   handle;
-+    gctUINT64                   handle;
- 
-     /* Pid of the client. */
-     gctUINT32                   pid;
-@@ -307,23 +309,23 @@ typedef struct _gcsHAL_INTERFACE
-         /* gcvHAL_QUERY_VIDEO_MEMORY */
-         struct _gcsHAL_QUERY_VIDEO_MEMORY
-         {
--            /* Physical memory address of internal memory. */
--            OUT gctPHYS_ADDR            internalPhysical;
-+            /* Physical memory address of internal memory. Just a name. */
-+            OUT gctUINT32               internalPhysical;
- 
--            /* Size in bytes of internal memory.*/
--            OUT gctSIZE_T               internalSize;
-+            /* Size in bytes of internal memory. */
-+            OUT gctUINT64               internalSize;
- 
--            /* Physical memory address of external memory. */
--            OUT gctPHYS_ADDR            externalPhysical;
-+            /* Physical memory address of external memory. Just a name. */
-+            OUT gctUINT32               externalPhysical;
- 
-             /* Size in bytes of external memory.*/
--            OUT gctSIZE_T               externalSize;
-+            OUT gctUINT64               externalSize;
- 
--            /* Physical memory address of contiguous memory. */
--            OUT gctPHYS_ADDR            contiguousPhysical;
-+            /* Physical memory address of contiguous memory. Just a name. */
-+            OUT gctUINT32               contiguousPhysical;
- 
-             /* Size in bytes of contiguous memory.*/
--            OUT gctSIZE_T               contiguousSize;
-+            OUT gctUINT64               contiguousSize;
-         }
-         QueryVideoMemory;
- 
-@@ -333,28 +335,28 @@ typedef struct _gcsHAL_INTERFACE
-         /* gcvHAL_MAP_MEMORY */
-         struct _gcsHAL_MAP_MEMORY
-         {
--            /* Physical memory address to map. */
--            IN gctPHYS_ADDR             physical;
-+            /* Physical memory address to map. Just a name on Linux/Qnx. */
-+            IN gctUINT32                physical;
- 
-             /* Number of bytes in physical memory to map. */
--            IN gctSIZE_T                bytes;
-+            IN gctUINT64                bytes;
- 
-             /* Address of mapped memory. */
--            OUT gctPOINTER              logical;
-+            OUT gctUINT64               logical;
-         }
-         MapMemory;
- 
-         /* gcvHAL_UNMAP_MEMORY */
-         struct _gcsHAL_UNMAP_MEMORY
-         {
--            /* Physical memory address to unmap. */
--            IN gctPHYS_ADDR             physical;
-+            /* Physical memory address to unmap. Just a name on Linux/Qnx. */
-+            IN gctUINT32                physical;
- 
-             /* Number of bytes in physical memory to unmap. */
--            IN gctSIZE_T                bytes;
-+            IN gctUINT64                bytes;
- 
-             /* Address of mapped memory to unmap. */
--            IN gctPOINTER               logical;
-+            IN gctUINT64                logical;
-         }
-         UnmapMemory;
- 
-@@ -373,8 +375,8 @@ typedef struct _gcsHAL_INTERFACE
-             /* Memory pool to allocate from. */
-             IN OUT gcePOOL              pool;
- 
--            /* Allocated video memory. */
--            OUT gcuVIDMEM_NODE_PTR      node;
-+            /* Allocated video memory in gcuVIDMEM_NODE. */
-+            OUT gctUINT64               node;
-         }
-         AllocateLinearVideoMemory;
- 
-@@ -399,24 +401,24 @@ typedef struct _gcsHAL_INTERFACE
-             /* Memory pool to allocate from. */
-             IN OUT gcePOOL              pool;
- 
--            /* Allocated video memory. */
--            OUT gcuVIDMEM_NODE_PTR      node;
-+            /* Allocated video memory in gcuVIDMEM_NODE. */
-+            OUT gctUINT64               node;
-         }
-         AllocateVideoMemory;
- 
-         /* gcvHAL_FREE_VIDEO_MEMORY */
-         struct _gcsHAL_FREE_VIDEO_MEMORY
-         {
--            /* Allocated video memory. */
--            IN gcuVIDMEM_NODE_PTR       node;
-+            /* Allocated video memory in gcuVIDMEM_NODE. */
-+            IN gctUINT64        node;
- 
- #ifdef __QNXNTO__
- /* TODO: This is part of the unlock - why is it here? */
-             /* Mapped logical address to unmap in user space. */
--            OUT gctPOINTER              memory;
-+            OUT gctUINT64       memory;
- 
-             /* Number of bytes to allocated. */
--            OUT gctSIZE_T               bytes;
-+            OUT gctUINT64       bytes;
- #endif
-         }
-         FreeVideoMemory;
-@@ -424,33 +426,33 @@ typedef struct _gcsHAL_INTERFACE
-         /* gcvHAL_LOCK_VIDEO_MEMORY */
-         struct _gcsHAL_LOCK_VIDEO_MEMORY
-         {
--            /* Allocated video memory. */
--            IN gcuVIDMEM_NODE_PTR       node;
-+            /* Allocated video memory gcuVIDMEM_NODE gcuVIDMEM_NODE. */
-+            IN gctUINT64            node;
- 
-             /* Cache configuration. */
-             /* Only gcvPOOL_CONTIGUOUS and gcvPOOL_VIRUTAL
-             ** can be configured */
--            IN gctBOOL                  cacheable;
-+            IN gctBOOL              cacheable;
- 
-             /* Hardware specific address. */
--            OUT gctUINT32               address;
-+            OUT gctUINT32           address;
- 
-             /* Mapped logical address. */
--            OUT gctPOINTER              memory;
-+            OUT gctUINT64           memory;
-         }
-         LockVideoMemory;
- 
-         /* gcvHAL_UNLOCK_VIDEO_MEMORY */
-         struct _gcsHAL_UNLOCK_VIDEO_MEMORY
-         {
--            /* Allocated video memory. */
--            IN gcuVIDMEM_NODE_PTR       node;
-+            /* Allocated video memory in gcuVIDMEM_NODE. */
-+            IN gctUINT64            node;
- 
-             /* Type of surface. */
--            IN gceSURF_TYPE             type;
-+            IN gceSURF_TYPE         type;
- 
-             /* Flag to unlock surface asynchroneously. */
--            IN OUT gctBOOL              asynchroneous;
-+            IN OUT gctBOOL          asynchroneous;
-         }
-         UnlockVideoMemory;
- 
-@@ -458,13 +460,13 @@ typedef struct _gcsHAL_INTERFACE
-         struct _gcsHAL_ALLOCATE_NON_PAGED_MEMORY
-         {
-             /* Number of bytes to allocate. */
--            IN OUT gctSIZE_T            bytes;
-+            IN OUT gctUINT64        bytes;
- 
--            /* Physical address of allocation. */
--            OUT gctPHYS_ADDR            physical;
-+            /* Physical address of allocation. Just a name. */
-+            OUT gctUINT32           physical;
- 
-             /* Logical address of allocation. */
--            OUT gctPOINTER              logical;
-+            OUT gctUINT64           logical;
-         }
-         AllocateNonPagedMemory;
- 
-@@ -472,13 +474,13 @@ typedef struct _gcsHAL_INTERFACE
-         struct _gcsHAL_FREE_NON_PAGED_MEMORY
-         {
-             /* Number of bytes allocated. */
--            IN gctSIZE_T                bytes;
-+            IN gctUINT64            bytes;
- 
--            /* Physical address of allocation. */
--            IN gctPHYS_ADDR             physical;
-+            /* Physical address of allocation. Just a name. */
-+            IN gctUINT32            physical;
- 
-             /* Logical address of allocation. */
--            IN gctPOINTER               logical;
-+            IN gctUINT64            logical;
-         }
-         FreeNonPagedMemory;
- 
-@@ -486,13 +488,13 @@ typedef struct _gcsHAL_INTERFACE
-         struct _gcsHAL_ALLOCATE_VIRTUAL_COMMAND_BUFFER
-         {
-             /* Number of bytes to allocate. */
--            IN OUT gctSIZE_T            bytes;
-+            IN OUT gctUINT64        bytes;
- 
--            /* Physical address of allocation. */
--            OUT gctPHYS_ADDR            physical;
-+            /* Physical address of allocation. Just a name. */
-+            OUT gctUINT32           physical;
- 
-             /* Logical address of allocation. */
--            OUT gctPOINTER              logical;
-+            OUT gctUINT64           logical;
-         }
-         AllocateVirtualCommandBuffer;
- 
-@@ -500,38 +502,38 @@ typedef struct _gcsHAL_INTERFACE
-         struct _gcsHAL_FREE_VIRTUAL_COMMAND_BUFFER
-         {
-             /* Number of bytes allocated. */
--            IN gctSIZE_T                bytes;
-+            IN gctUINT64            bytes;
- 
--            /* Physical address of allocation. */
--            IN gctPHYS_ADDR             physical;
-+            /* Physical address of allocation. Just a name. */
-+            IN gctUINT32            physical;
- 
-             /* Logical address of allocation. */
--            IN gctPOINTER               logical;
-+            IN gctUINT64            logical;
-         }
-         FreeVirtualCommandBuffer;
- 
-         /* gcvHAL_EVENT_COMMIT. */
-         struct _gcsHAL_EVENT_COMMIT
-         {
--            /* Event queue. */
--            IN gcsQUEUE_PTR             queue;
-+            /* Event queue in gcsQUEUE. */
-+            IN gctUINT64             queue;
-         }
-         Event;
- 
-         /* gcvHAL_COMMIT */
-         struct _gcsHAL_COMMIT
-         {
--            /* Context buffer object. */
--            IN gckCONTEXT               context;
-+            /* Context buffer object gckCONTEXT. */
-+            IN gctUINT64            context;
- 
--            /* Command buffer. */
--            IN gcoCMDBUF                commandBuffer;
-+            /* Command buffer gcoCMDBUF. */
-+            IN gctUINT64            commandBuffer;
- 
--            /* State delta buffer. */
--            gcsSTATE_DELTA_PTR          delta;
-+            /* State delta buffer in gcsSTATE_DELTA. */
-+            gctUINT64               delta;
- 
--            /* Event queue. */
--            IN gcsQUEUE_PTR             queue;
-+            /* Event queue in gcsQUEUE. */
-+            IN gctUINT64            queue;
-         }
-         Commit;
- 
-@@ -539,16 +541,16 @@ typedef struct _gcsHAL_INTERFACE
-         struct _gcsHAL_MAP_USER_MEMORY
-         {
-             /* Base address of user memory to map. */
--            IN gctPOINTER               memory;
-+            IN gctUINT64                memory;
- 
-             /* Physical address of user memory to map. */
-             IN gctUINT32                physical;
- 
-             /* Size of user memory in bytes to map. */
--            IN gctSIZE_T                size;
-+            IN gctUINT64                size;
- 
--            /* Info record required by gcvHAL_UNMAP_USER_MEMORY. */
--            OUT gctPOINTER              info;
-+            /* Info record required by gcvHAL_UNMAP_USER_MEMORY. Just a name. */
-+            OUT gctUINT32               info;
- 
-             /* Physical address of mapped memory. */
-             OUT gctUINT32               address;
-@@ -559,13 +561,13 @@ typedef struct _gcsHAL_INTERFACE
-         struct _gcsHAL_UNMAP_USER_MEMORY
-         {
-             /* Base address of user memory to unmap. */
--            IN gctPOINTER               memory;
-+            IN gctUINT64                memory;
- 
-             /* Size of user memory in bytes to unmap. */
--            IN gctSIZE_T                size;
-+            IN gctUINT64                size;
- 
--            /* Info record returned by gcvHAL_MAP_USER_MEMORY. */
--            IN gctPOINTER               info;
-+            /* Info record returned by gcvHAL_MAP_USER_MEMORY. Just a name. */
-+            IN gctUINT32                info;
- 
-             /* Physical address of mapped memory as returned by
-                gcvHAL_MAP_USER_MEMORY. */
-@@ -597,14 +599,14 @@ typedef struct _gcsHAL_INTERFACE
-         /* gcvHAL_SIGNAL. */
-         struct _gcsHAL_SIGNAL
-         {
--            /* Signal handle to signal. */
--            IN gctSIGNAL                signal;
-+            /* Signal handle to signal gctSIGNAL. */
-+            IN gctUINT64                signal;
- 
--            /* Reserved. */
--            IN gctSIGNAL                auxSignal;
-+            /* Reserved gctSIGNAL. */
-+            IN gctUINT64                auxSignal;
- 
--            /* Process owning the signal. */
--            IN gctHANDLE                process;
-+            /* Process owning the signal gctHANDLE. */
-+            IN gctUINT64                process;
- 
- #if defined(__QNXNTO__)
-             /* Client pulse side-channel connection ID. Set by client in gcoOS_CreateSignal. */
-@@ -633,16 +635,16 @@ typedef struct _gcsHAL_INTERFACE
-         struct _gcsHAL_ALLOCATE_CONTIGUOUS_MEMORY
-         {
-             /* Number of bytes to allocate. */
--            IN OUT gctSIZE_T            bytes;
-+            IN OUT gctUINT64            bytes;
- 
-             /* Hardware address of allocation. */
-             OUT gctUINT32               address;
- 
--            /* Physical address of allocation. */
--            OUT gctPHYS_ADDR            physical;
-+            /* Physical address of allocation. Just a name. */
-+            OUT gctUINT32               physical;
- 
-             /* Logical address of allocation. */
--            OUT gctPOINTER              logical;
-+            OUT gctUINT64               logical;
-         }
-         AllocateContiguousMemory;
- 
-@@ -650,13 +652,13 @@ typedef struct _gcsHAL_INTERFACE
-         struct _gcsHAL_FREE_CONTIGUOUS_MEMORY
-         {
-             /* Number of bytes allocated. */
--            IN gctSIZE_T                bytes;
-+            IN gctUINT64                bytes;
- 
--            /* Physical address of allocation. */
--            IN gctPHYS_ADDR             physical;
-+            /* Physical address of allocation. Just a name. */
-+            IN gctUINT32                physical;
- 
-             /* Logical address of allocation. */
--            IN gctPOINTER               logical;
-+            IN gctUINT64                logical;
-         }
-         FreeContiguousMemory;
- 
-@@ -726,8 +728,8 @@ typedef struct _gcsHAL_INTERFACE
-         /* gcvHAL_PROFILE_REGISTERS_2D */
-         struct _gcsHAL_PROFILE_REGISTERS_2D
-         {
--            /* Data read. */
--            OUT gcs2D_PROFILE_PTR       hwProfile2D;
-+            /* Data read in gcs2D_PROFILE. */
-+            OUT gctUINT64       hwProfile2D;
-         }
-         RegisterProfileData2D;
- #endif
-@@ -766,7 +768,7 @@ typedef struct _gcsHAL_INTERFACE
-             IN gctBOOL                  map;
- 
-             /* Physical address. */
--            IN OUT gctPHYS_ADDR         physical;
-+            IN OUT gctUINT64            physical;
-         }
-         MapPhysical;
- 
-@@ -791,10 +793,12 @@ typedef struct _gcsHAL_INTERFACE
-         struct _gcsHAL_CACHE
-         {
-             IN gceCACHEOPERATION        operation;
--            IN gctHANDLE                process;
--            IN gctPOINTER               logical;
--            IN gctSIZE_T                bytes;
--            IN gcuVIDMEM_NODE_PTR       node;
-+            /* gctHANDLE */
-+            IN gctUINT64                process;
-+            IN gctUINT64                logical;
-+            IN gctUINT64                bytes;
-+            /* gcuVIDMEM_NODE_PTR */
-+            IN gctUINT64                node;
-         }
-         Cache;
- 
-@@ -861,29 +865,30 @@ typedef struct _gcsHAL_INTERFACE
-         /* gcvHAL_ATTACH */
-         struct _gcsHAL_ATTACH
-         {
--            /* Context buffer object. */
--            OUT gckCONTEXT              context;
-+            /* Context buffer object gckCONTEXT. Just a name. */
-+            OUT gctUINT32               context;
- 
-             /* Number of states in the buffer. */
--            OUT gctSIZE_T               stateCount;
-+            OUT gctUINT64               stateCount;
-         }
-         Attach;
- 
-         /* gcvHAL_DETACH */
-         struct _gcsHAL_DETACH
-         {
--            /* Context buffer object. */
--            IN gckCONTEXT               context;
-+            /* Context buffer object gckCONTEXT. Just a name. */
-+            IN gctUINT32                context;
-         }
-         Detach;
- 
-         /* gcvHAL_COMPOSE. */
--        gcsHAL_COMPOSE                  Compose;
-+        gcsHAL_COMPOSE            Compose;
- 
-         /* gcvHAL_GET_FRAME_INFO. */
-         struct _gcsHAL_GET_FRAME_INFO
-         {
--            OUT gcsHAL_FRAME_INFO *     frameInfo;
-+            /* gcsHAL_FRAME_INFO* */
-+            OUT gctUINT64     frameInfo;
-         }
-         GetFrameInfo;
- 
-@@ -898,17 +903,17 @@ typedef struct _gcsHAL_INTERFACE
- 		/* gcvHAL_COMMIT */
- 		struct _gcsHAL_VGCOMMIT
- 		{
--			/* Context buffer. */
--			IN gcsVGCONTEXT_PTR			context;
-+			/* Context buffer in gcsVGCONTEXT. */
-+			IN gctUINT64			context;
- 
--			/* Command queue. */
--			IN gcsVGCMDQUEUE_PTR			queue;
-+			/* Command queue in gcsVGCMDQUEUE. */
-+			IN gctUINT64			queue;
- 
- 			/* Number of entries in the queue. */
--			IN gctUINT					entryCount;
-+			IN gctUINT			entryCount;
- 
--			/* Task table. */
--			IN gcsTASK_MASTER_TABLE_PTR	taskTable;
-+			/* Task table in gcsTASK_MASTER_TABLE. */
-+			IN gctUINT64	                taskTable;
- 		}
- 		VGCommit;
- 
-@@ -926,11 +931,13 @@ typedef struct _gcsHAL_INTERFACE
-         {
-             IN gctUINT32            pid;
-             IN gctUINT32            dataId;
--            IN gcuVIDMEM_NODE_PTR   node;
--            OUT gctUINT8_PTR        data;
--            /* fix size */
--            OUT gctUINT8_PTR        nodeData;
--            gctSIZE_T               size;
-+            /* gcuVIDMEM_NODE_PTR */
-+            IN gctUINT64            node;
-+            /* gctUINT8_PTR */
-+            OUT gctUINT64           data;
-+            /* fix size. gctUINT8_PTR*/
-+            OUT gctUINT64           nodeData;
-+            gctUINT64               size;
-             IN gceVIDMEM_NODE_SHARED_INFO_TYPE infoType;
-         }
-         GetSharedInfo;
-@@ -938,10 +945,13 @@ typedef struct _gcsHAL_INTERFACE
-         struct _gcsHAL_SET_SHARED_INFO
-         {
-             IN gctUINT32            dataId;
--            IN gcuVIDMEM_NODE_PTR   node;
--            IN gctUINT8_PTR         data;
--            IN gctUINT8_PTR         nodeData;
--            IN gctSIZE_T            size;
-+            /* gcuVIDMEM_NODE_PTR */
-+            IN gctUINT64   node;
-+            /* gctUINT8_PTR */
-+            IN gctUINT64         data;
-+            /* gctUINT8_PTR */
-+            IN gctUINT64         nodeData;
-+            IN gctUINT64            size;
-             IN gceVIDMEM_NODE_SHARED_INFO_TYPE infoType;
-         }
-         SetSharedInfo;
-@@ -959,6 +969,12 @@ typedef struct _gcsHAL_INTERFACE
-             OUT gctUINT             maxValue;
-         }
-         GetFscaleValue;
-+
-+        struct _gcsHAL_QUERY_RESET_TIME_STAMP
-+        {
-+            OUT gctUINT64           timeStamp;
-+        }
-+        QueryResetTimeStamp;
-     }
-     u;
- }
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver_vg.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver_vg.h
-index c447dcf..b54752f 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver_vg.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver_vg.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,9 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
--
- #ifndef __gc_hal_driver_vg_h_
- #define __gc_hal_driver_vg_h_
- 
-@@ -213,7 +210,7 @@ typedef struct _gcsTASK_UNLOCK_VIDEO_MEMORY
-     IN gceTASK                  id;
- 
-     /* Allocated video memory. */
--    IN gcuVIDMEM_NODE_PTR       node;
-+    IN gctUINT64                node;
- }
- gcsTASK_UNLOCK_VIDEO_MEMORY;
- 
-@@ -224,7 +221,7 @@ typedef struct _gcsTASK_FREE_VIDEO_MEMORY
-     IN gceTASK                  id;
- 
-     /* Allocated video memory. */
--    IN gcuVIDMEM_NODE_PTR       node;
-+    IN gctUINT64                node;
- }
- gcsTASK_FREE_VIDEO_MEMORY;
- 
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_dump.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_dump.h
-index 9b2db22..ffd45e8 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_dump.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_dump.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,7 +19,6 @@
- *****************************************************************************/
- 
- 
--
- #ifndef __gc_hal_dump_h_
- #define __gc_hal_dump_h_
- 
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h
-index 3be4c77..496276e 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_eglplatform_h_
- #define __gc_hal_eglplatform_h_
- 
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform_type.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform_type.h
-index 727758f..4f5c3ce 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform_type.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform_type.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,7 +19,6 @@
- *****************************************************************************/
- 
- 
--
- #ifndef __gc_hal_eglplatform_type_h_
- #define __gc_hal_eglplatform_type_h_
- 
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h
-index c462e57..d441d1d 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_engine_h_
- #define __gc_hal_engine_h_
- 
-@@ -391,6 +389,37 @@ gcoSURF_IsRenderable(
-     IN gcoSURF Surface
-     );
- 
-+#if gcdSYNC
-+gceSTATUS
-+gcoSURF_GetFence(
-+    IN gcoSURF Surface
-+    );
-+gceSTATUS
-+gcoSURF_WaitFence(
-+    IN gcoSURF Surface
-+    );
-+
-+gceSTATUS
-+gcoSTREAM_GetFence(
-+    IN gcoSTREAM stream
-+    );
-+
-+gceSTATUS
-+gcoSTREAM_WaitFence(
-+    IN gcoSTREAM stream
-+    );
-+
-+gceSTATUS
-+gcoINDEX_GetFence(
-+    IN gcoINDEX index
-+    );
-+
-+gceSTATUS
-+gcoINDEX_WaitFence(
-+    IN gcoINDEX index
-+    );
-+#endif
-+
- /******************************************************************************\
- ******************************** gcoINDEX Object *******************************
- \******************************************************************************/
-@@ -1976,7 +2005,7 @@ gcoHAL_GetSharedInfo(
-     IN gctUINT32 DataId,
-     OUT gctUINT8_PTR Data,
-     IN gctSIZE_T Bytes,
--    IN gcuVIDMEM_NODE_PTR Node,
-+    IN gctUINT64 Node,
-     OUT gctUINT8_PTR NodeData,
-     IN gceVIDMEM_NODE_SHARED_INFO_TYPE SharedInfoType
-     );
-@@ -1986,7 +2015,7 @@ gcoHAL_SetSharedInfo(
-     IN gctUINT32 DataId,
-     IN gctUINT8_PTR Data,
-     IN gctSIZE_T Bytes,
--    IN gcuVIDMEM_NODE_PTR Node,
-+    IN gctUINT64 Node,
-     IN gctUINT8_PTR NodeData,
-     IN gceVIDMEM_NODE_SHARED_INFO_TYPE SharedInfoType
-     );
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine_vg.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine_vg.h
-index 1526b0c..4bb6772 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine_vg.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine_vg.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,9 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
--
- #ifndef __gc_hal_engine_vg_h_
- #define __gc_hal_engine_vg_h_
- 
-@@ -527,14 +524,14 @@ gcoHAL_CombineAddress(
- gceSTATUS
- gcoHAL_ScheduleVideoMemory(
-     IN gcoHAL Hal,
--    IN gcuVIDMEM_NODE_PTR Node
-+    IN gctUINT64 Node
-     );
- 
- /* Free linear video memory allocated with gcoHAL_AllocateLinearVideoMemory. */
- gceSTATUS
- gcoHAL_FreeVideoMemory(
-     IN gcoHAL Hal,
--    IN gcuVIDMEM_NODE_PTR Node
-+    IN gctUINT64 Node
-     );
- 
- /* Query command buffer attributes. */
-@@ -550,7 +547,7 @@ gcoHAL_AllocateLinearVideoMemory(
-     IN gctUINT Size,
-     IN gctUINT Alignment,
-     IN gcePOOL Pool,
--    OUT gcuVIDMEM_NODE_PTR * Node,
-+    OUT gctUINT64 * Node,
-     OUT gctUINT32 * Address,
-     OUT gctPOINTER * Memory
-     );
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h
-index 6c71df9..cf6b425 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_enum_h_
- #define __gc_hal_enum_h_
- 
-@@ -150,6 +148,8 @@ typedef enum _gceFEATURE
-     gcvFEATURE_TEXTURE_YUV_ASSEMBLER,
-     gcvFEATURE_DYNAMIC_FREQUENCY_SCALING,
-     gcvFEATURE_BUGFIX15,
-+    gcvFEATURE_2D_MIRROR_EXTENSION,
-+    gcvFEATURE_ELEMENT_INDEX_UINT,
- }
- gceFEATURE;
- 
-@@ -351,6 +351,16 @@ typedef enum _gceSURF_FORMAT
-     gcvSURF_DXT5,
-     gcvSURF_CXV8U8,
-     gcvSURF_ETC1,
-+    gcvSURF_R11_EAC,
-+    gcvSURF_SIGNED_R11_EAC,
-+    gcvSURF_RG11_EAC,
-+    gcvSURF_SIGNED_RG11_EAC,
-+    gcvSURF_RGB8_ETC2,
-+    gcvSURF_SRGB8_ETC2,
-+    gcvSURF_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
-+    gcvSURF_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
-+    gcvSURF_RGBA8_ETC2_EAC,
-+    gcvSURF_SRGB8_ALPHA8_ETC2_EAC,
- 
-     /* YUV formats. */
-     gcvSURF_YUY2                = 500,
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_kernel_buffer.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_kernel_buffer.h
-index 24edc0b..0608e43 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_kernel_buffer.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_kernel_buffer.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_kernel_buffer_h_
- #define __gc_hal_kernel_buffer_h_
- 
-@@ -59,11 +57,6 @@ typedef struct _gcsSTATE_DELTA
-     gctUINT                     num;
- #endif
- 
--    /* For dumping. */
--#if gcdDUMP
--    gcoOS                       os;
--#endif
--
-     /* Main state delta ID. Every time state delta structure gets reinitialized,
-        main ID is incremented. If main state ID overflows, all map entry IDs get
-        reinitialized to make sure there is no potential erroneous match after
-@@ -79,22 +72,22 @@ typedef struct _gcsSTATE_DELTA
-     /* Number of states currently stored in the record array. */
-     gctUINT                     recordCount;
- 
--    /* Record array; holds all modified states. */
--    gcsSTATE_DELTA_RECORD_PTR   recordArray;
-+    /* Record array; holds all modified states in gcsSTATE_DELTA_RECORD. */
-+    gctUINT64                   recordArray;
- 
-     /* Map entry ID is used for map entry validation. If map entry ID does not
-        match the main state delta ID, the entry and the corresponding state are
-        considered not in use. */
--    gctUINT_PTR                 mapEntryID;
-+    gctUINT64                   mapEntryID;
-     gctUINT                     mapEntryIDSize;
- 
-     /* If the map entry ID matches the main state delta ID, index points to
-        the state record in the record array. */
--    gctUINT_PTR                 mapEntryIndex;
-+    gctUINT64                   mapEntryIndex;
- 
--    /* Previous and next state deltas. */
--    gcsSTATE_DELTA_PTR          prev;
--    gcsSTATE_DELTA_PTR          next;
-+    /* Previous and next state deltas in gcsSTATE_DELTA. */
-+    gctUINT64                   prev;
-+    gctUINT64                   next;
- }
- gcsSTATE_DELTA;
- 
-@@ -114,38 +107,38 @@ struct _gcoCMDBUF
-     gctBOOL                     usingFilterBlit;
-     gctBOOL                     usingPalette;
- 
--    /* Physical address of command buffer. */
--    gctPHYS_ADDR                physical;
-+    /* Physical address of command buffer. Just a name. */
-+    gctUINT32                   physical;
- 
-     /* Logical address of command buffer. */
--    gctPOINTER                  logical;
-+    gctUINT64                   logical;
- 
-     /* Number of bytes in command buffer. */
--    gctSIZE_T                   bytes;
-+    gctUINT                     bytes;
- 
-     /* Start offset into the command buffer. */
--    gctUINT32                   startOffset;
-+    gctUINT                     startOffset;
- 
-     /* Current offset into the command buffer. */
--    gctUINT32                   offset;
-+    gctUINT                     offset;
- 
-     /* Number of free bytes in command buffer. */
--    gctSIZE_T                   free;
-+    gctUINT                     free;
- 
-     /* Location of the last reserved area. */
--    gctPOINTER                  lastReserve;
-+    gctUINT64                   lastReserve;
-     gctUINT                     lastOffset;
- 
- #if gcdSECURE_USER
-     /* Hint array for the current command buffer. */
-     gctUINT                     hintArraySize;
--    gctUINT32_PTR               hintArray;
--    gctUINT32_PTR               hintArrayTail;
-+    gctUINT64                   hintArray;
-+    gctUINT64                   hintArrayTail;
- #endif
- 
- #if gcmIS_DEBUG(gcdDEBUG_CODE)
-     /* Last load state command location and hardware address. */
--    gctUINT32_PTR               lastLoadStatePtr;
-+    gctUINT64                   lastLoadStatePtr;
-     gctUINT32                   lastLoadStateAddress;
-     gctUINT32                   lastLoadStateCount;
- #endif
-@@ -153,8 +146,8 @@ struct _gcoCMDBUF
- 
- typedef struct _gcsQUEUE
- {
--    /* Pointer to next gcsQUEUE structure. */
--    gcsQUEUE_PTR                next;
-+    /* Pointer to next gcsQUEUE structure in gcsQUEUE. */
-+    gctUINT64                   next;
- 
-     /* Event information. */
-     gcsHAL_INTERFACE            iface;
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_mem.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_mem.h
-index e64f7e7..9e32878 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_mem.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_mem.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- /*
- **	Include file for the local memory management.
- */
-@@ -176,7 +174,7 @@ Prefix##_CAllocate##TypeName( \
- 	gceSTATUS				status; \
-     gcmHEADER_ARG("MemPool=0x%x Pointer=0x%x", MemPool, Pointer); \
- 	gcmERR_RETURN(gcfMEM_FSMemPoolGetANode(MemPool, (gctPOINTER *) Pointer)); \
--	gcmVERIFY_OK(gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, gcmSIZEOF(Type))); \
-+	gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, gcmSIZEOF(Type)); \
-     gcmFOOTER(); \
- 	return gcvSTATUS_OK; \
- } \
-@@ -233,7 +231,7 @@ gceSTATUS \
- 	gceSTATUS				status; \
-     gcmHEADER_ARG("MemPool=0x%x Pointer=0x%x Size=%u", MemPool, Pointer, Size); \
- 	gcmERR_RETURN(gcfMEM_VSMemPoolGetANode(MemPool, Size, (gctPOINTER *) Pointer)); \
--	gcmVERIFY_OK(gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, size)); \
-+	gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, size); \
-     gcmFOOTER(); \
- 	return gcvSTATUS_OK; \
- } \
-@@ -276,7 +274,7 @@ Prefix##_CAllocate##TypeName( \
- 	gceSTATUS				status; \
-     gcmHEADER_ARG("MemPool=0x%x Pointer=0x%x Count=%u", MemPool, Pointer, Count); \
- 	gcmERR_RETURN(gcfMEM_AFSMemPoolGetANode(MemPool, Count, (gctPOINTER *) Pointer)); \
--	gcmVERIFY_OK(gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, Count * gcmSIZEOF(Type))); \
-+	gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, Count * gcmSIZEOF(Type)); \
-     gcmFOOTER(); \
- 	return gcvSTATUS_OK; \
- } \
-@@ -323,7 +321,7 @@ Prefix##_CAllocate##TypeName( \
- 	gcmERR_RETURN(gcoOS_Allocate(MemPool, \
- 							gcmSIZEOF(Type), \
- 							(gctPOINTER *) Pointer)); \
--	gcmVERIFY_OK(gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, gcmSIZEOF(Type))); \
-+	gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, gcmSIZEOF(Type)); \
-     gcmFOOTER(); \
- 	return gcvSTATUS_OK; \
- } \
-@@ -370,7 +368,7 @@ Prefix##_CAllocate##TypeName( \
- 	gcmERR_RETURN(gcoOS_Allocate(MemPool, \
- 							Size, \
- 							(gctPOINTER *) Pointer)); \
--	gcmVERIFY_OK(gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, Size)); \
-+	gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, Size); \
-     gcmFOOTER(); \
- 	return gcvSTATUS_OK; \
- } \
-@@ -417,7 +415,7 @@ Prefix##_CAllocate##TypeName( \
- 	gcmERR_RETURN(gcoOS_Allocate(MemPool, \
- 							Count * gcmSIZEOF(Type), \
- 							(gctPOINTER *) Pointer)); \
--	gcmVERIFY_OK(gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, Count * gcmSIZEOF(Type))); \
-+	gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, Count * gcmSIZEOF(Type)); \
-     gcmFOOTER(); \
- 	return gcvSTATUS_OK; \
- } \
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h
-index 8478745..86e9133 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_options_h_
- #define __gc_hal_options_h_
- 
-@@ -755,6 +753,10 @@
- #   define  gcdANDROID_UNALIGNED_LINEAR_COMPOSITION_ADJUST    0
- #endif
- 
-+#ifndef gcdENABLE_PE_DITHER_FIX
-+#   define gcdENABLE_PE_DITHER_FIX              1
-+#endif
-+
- #ifndef gcdSHARED_PAGETABLE
- #   define gcdSHARED_PAGETABLE                  1
- #endif
-@@ -839,4 +841,21 @@
- #define gcdUSE_NPOT_PATCH                       1
- #endif
- 
-+
-+#ifndef gcdSYNC
-+#   define gcdSYNC                              1
-+#endif
-+
-+/*
-+    gcdDVFS
-+
-+        When non-zero, software will make use of dynamic voltage and
-+        frequency feature.
-+ */
-+#ifndef gcdDVFS
-+#   define gcdDVFS                               0
-+#   define gcdDVFS_ANAYLSE_WINDOW                4
-+#   define gcdDVFS_POLLING_TIME                  (gcdDVFS_ANAYLSE_WINDOW * 4)
-+#endif
-+
- #endif /* __gc_hal_options_h_ */
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_profiler.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_profiler.h
-index d486b53..3e450ba 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_profiler.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_profiler.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_raster.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_raster.h
-index d9b2993..bc4171e 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_raster.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_raster.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_raster_h_
- #define __gc_hal_raster_h_
- 
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_rename.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_rename.h
-index ed6718d..6c10fbf 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_rename.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_rename.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_rename_h_
- #define __gc_hal_rename_h_
- 
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_statistics.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_statistics.h
-index 1e85458..82336e8 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_statistics.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_statistics.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,7 +19,6 @@
- *****************************************************************************/
- 
- 
--
- #ifndef __gc_hal_statistics_h_
- #define __gc_hal_statistics_h_
- 
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_types.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_types.h
-index 70c4b4f..5c0877d 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_types.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_types.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_types_h_
- #define __gc_hal_types_h_
- 
-@@ -588,13 +586,13 @@ gceSTATUS;
- #if gcmIS_DEBUG(gcdDEBUG_CODE)
- 
- #   define gcmSTORELOADSTATE(CommandBuffer, Memory, Address, Count) \
--        CommandBuffer->lastLoadStatePtr     = Memory; \
-+        CommandBuffer->lastLoadStatePtr     = gcmPTR_TO_UINT64(Memory); \
-         CommandBuffer->lastLoadStateAddress = Address; \
-         CommandBuffer->lastLoadStateCount   = Count
- 
- #   define gcmVERIFYLOADSTATE(CommandBuffer, Memory, Address) \
-         gcmASSERT( \
--            (gctUINT) (Memory  - CommandBuffer->lastLoadStatePtr - 1) \
-+            (gctUINT) (Memory  - gcmUINT64_TO_TYPE(CommandBuffer->lastLoadStatePtr, gctUINT32_PTR) - 1) \
-             == \
-             (gctUINT) (Address - CommandBuffer->lastLoadStateAddress) \
-             ); \
-@@ -623,10 +621,10 @@ gceSTATUS;
- #   define gcmBEGINSECUREUSER() \
-         __secure_user_offset__ = reserve->lastOffset; \
-         \
--        __secure_user_hintArray__ = reserve->hintArrayTail
-+        __secure_user_hintArray__ = gcmUINT64_TO_PTR(reserve->hintArrayTail)
- 
- #   define gcmENDSECUREUSER() \
--        reserve->hintArrayTail = __secure_user_hintArray__
-+        reserve->hintArrayTail = gcmPTR_TO_UINT64(__secure_user_hintArray__)
- 
- #   define gcmSKIPSECUREUSER() \
-         __secure_user_offset__ += gcmSIZEOF(gctUINT32)
-@@ -682,7 +680,7 @@ gceSTATUS;
-         Hardware->buffer, ReserveSize, gcvTRUE, &CommandBuffer \
-         )); \
-     \
--    Memory = (gctUINT32_PTR) CommandBuffer->lastReserve; \
-+    Memory =  gcmUINT64_TO_PTR(CommandBuffer->lastReserve); \
-     \
-     StateDelta = Hardware->delta; \
-     \
-@@ -694,7 +692,7 @@ gceSTATUS;
-     gcmENDSECUREUSER(); \
-     \
-     gcmASSERT( \
--        ((gctUINT8_PTR) CommandBuffer->lastReserve) + ReserveSize \
-+        gcmUINT64_TO_TYPE(CommandBuffer->lastReserve, gctUINT8_PTR) + ReserveSize \
-         == \
-          (gctUINT8_PTR) Memory \
-         ); \
-@@ -704,7 +702,8 @@ gceSTATUS;
- 
- #define gcmBEGINSTATEBATCH(CommandBuffer, Memory, FixedPoint, Address, Count) \
- { \
--    gcmASSERT(((Memory - (gctUINT32_PTR) CommandBuffer->lastReserve) & 1) == 0); \
-+    gcmASSERT(((Memory - gcmUINT64_TO_TYPE(CommandBuffer->lastReserve, gctUINT32_PTR)) & 1) == 0); \
-+    gcmASSERT((gctUINT32)Count <= 1024); \
-     \
-     gcmVERIFYLOADSTATEDONE(CommandBuffer); \
-     \
-@@ -723,7 +722,7 @@ gceSTATUS;
- { \
-     gcmVERIFYLOADSTATEDONE(CommandBuffer); \
-     \
--    gcmASSERT(((Memory - (gctUINT32_PTR) CommandBuffer->lastReserve) & 1) == 0); \
-+    gcmASSERT(((Memory - gcmUINT64_TO_TYPE(CommandBuffer->lastReserve, gctUINT32_PTR)) & 1) == 0); \
- }
- 
- /*----------------------------------------------------------------------------*/
-@@ -902,13 +901,13 @@ gceSTATUS;
- typedef struct _gcsDATABASE_COUNTERS
- {
-     /* Number of currently allocated bytes. */
--    gctSIZE_T                   bytes;
-+    gctUINT64                   bytes;
- 
-     /* Maximum number of bytes allocated (memory footprint). */
--    gctSIZE_T                   maxBytes;
-+    gctUINT64                   maxBytes;
- 
-     /* Total number of bytes allocated. */
--    gctSIZE_T                   totalBytes;
-+    gctUINT64                   totalBytes;
- }
- gcsDATABASE_COUNTERS;
- 
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h
-index f98742e..2881604 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_version_h_
- #define __gc_hal_version_h_
- 
-@@ -30,7 +28,7 @@
- 
- #define gcvVERSION_PATCH        9
- 
--#define gcvVERSION_BUILD        1478
-+#define gcvVERSION_BUILD     1210
- 
- #define gcvVERSION_DATE      __DATE__
- 
-diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h
-index 8731137..5ff0281 100644
---- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h
-+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,9 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
--
- #ifndef __gc_hal_vg_h_
- #define __gc_hal_vg_h_
- 
-@@ -588,7 +585,7 @@ typedef struct _gcsCMDBUFFER
-     /* The user sets this to the node of the container buffer whitin which
-        this particular command buffer resides. The kernel sets this to the
-        node of the internally allocated buffer. */
--    gcuVIDMEM_NODE_PTR          node;
-+    gctUINT64                   node;
- 
-     /* Command buffer hardware address. */
-     gctUINT32                   address;
-diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debug.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debug.h
-index a6754fe..339dff4 100644
---- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debug.h
-+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debug.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_kernel_debug_h_
- #define __gc_hal_kernel_debug_h_
- 
-diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debugfs.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debugfs.c
-index 99d7d9a..6bdc5a6 100644
---- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debugfs.c
-+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debugfs.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debugfs.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debugfs.h
-index e0b6142..78d8199 100644
---- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debugfs.h
-+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debugfs.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include <stdarg.h>
- 
- #ifndef __gc_hal_kernel_debugfs_h_
-diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c
-index 7690bb2..7168f0e 100644
---- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c
-+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_linux.h"
- #include <linux/pagemap.h>
- #include <linux/seq_file.h>
-@@ -320,6 +318,7 @@ gckGALDEVICE_Construct(
-     gctINT32 i;
-     gceHARDWARE_TYPE type;
-     gckDB sharedDB = gcvNULL;
-+    gckKERNEL kernel = gcvNULL;
- 
-     gcmkHEADER_ARG("IrqLine=%d RegisterMemBase=0x%08x RegisterMemSize=%u "
-                    "IrqLine2D=%d RegisterMemBase2D=0x%08x RegisterMemSize2D=%u "
-@@ -692,6 +691,16 @@ gckGALDEVICE_Construct(
-     }
- 
- 
-+    /* Grab the first availiable kernel */
-+    for (i = 0; i < gcdMAX_GPU_COUNT; i++)
-+    {
-+        if (device->irqLines[i] != -1)
-+        {
-+            kernel = device->kernels[i];
-+            break;
-+        }
-+    }
-+
-     /* Set up the internal memory region. */
-     if (device->internalSize > 0)
-     {
-@@ -718,6 +727,7 @@ gckGALDEVICE_Construct(
-             }
- 
-             device->internalPhysical = (gctPHYS_ADDR)(gctUINTPTR_T) physical;
-+            device->internalPhysicalName = gcmPTR_TO_NAME(device->internalPhysical);
-             physical += device->internalSize;
-         }
-     }
-@@ -748,6 +758,7 @@ gckGALDEVICE_Construct(
-             }
- 
-             device->externalPhysical = (gctPHYS_ADDR)(gctUINTPTR_T) physical;
-+            device->externalPhysicalName = gcmPTR_TO_NAME(device->externalPhysical);
-             physical += device->externalSize;
-         }
-     }
-@@ -772,6 +783,7 @@ gckGALDEVICE_Construct(
- 
-                 if (gcmIS_SUCCESS(status))
-                 {
-+                    device->contiguousPhysicalName = gcmPTR_TO_NAME(device->contiguousPhysical);
-                     status = gckVIDMEM_Construct(
-                         device->os,
-                         physAddr | device->systemMemoryBaseAddress,
-@@ -792,6 +804,7 @@ gckGALDEVICE_Construct(
-                         device->contiguousPhysical
-                         ));
- 
-+                    gcmRELEASE_NAME(device->contiguousPhysicalName);
-                     device->contiguousBase     = gcvNULL;
-                     device->contiguousPhysical = gcvNULL;
-                 }
-@@ -864,6 +877,7 @@ gckGALDEVICE_Construct(
- #endif
- 
-                 device->contiguousPhysical = gcvNULL;
-+                device->contiguousPhysicalName = 0;
-                 device->contiguousSize     = ContiguousSize;
-                 device->contiguousMapped   = gcvTRUE;
-             }
-@@ -908,11 +922,38 @@ gckGALDEVICE_Destroy(
- {
-     gctINT i;
-     gceSTATUS status = gcvSTATUS_OK;
-+    gckKERNEL kernel = gcvNULL;
- 
-     gcmkHEADER_ARG("Device=0x%x", Device);
- 
-     if (Device != gcvNULL)
-     {
-+        /* Grab the first availiable kernel */
-+        for (i = 0; i < gcdMAX_GPU_COUNT; i++)
-+        {
-+            if (Device->irqLines[i] != -1)
-+            {
-+                kernel = Device->kernels[i];
-+                break;
-+            }
-+        }
-+        if (Device->internalPhysicalName != 0)
-+        {
-+            gcmRELEASE_NAME(Device->internalPhysicalName);
-+            Device->internalPhysicalName = 0;
-+        }
-+        if (Device->externalPhysicalName != 0)
-+        {
-+            gcmRELEASE_NAME(Device->externalPhysicalName);
-+            Device->externalPhysicalName = 0;
-+        }
-+        if (Device->contiguousPhysicalName != 0)
-+        {
-+            gcmRELEASE_NAME(Device->contiguousPhysicalName);
-+            Device->contiguousPhysicalName = 0;
-+        }
-+
-+
-         for (i = 0; i < gcdMAX_GPU_COUNT; i++)
-         {
-             if (Device->kernels[i] != gcvNULL)
-@@ -1050,7 +1091,19 @@ gckGALDEVICE_Destroy(
-            Device->clk_vg_axi = NULL;
-         }
- 
-+#ifdef CONFIG_PM
-+        if(Device->pmdev)
-+            pm_runtime_disable(Device->pmdev);
-+#endif
- 
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
-+        /*NULL*/
-+#else
-+        if (Device->gpu_regulator) {
-+           regulator_put(Device->gpu_regulator);
-+           Device->gpu_regulator = NULL;
-+        }
-+#endif
- 
-         /* Destroy the gckOS object. */
-         if (Device->os != gcvNULL)
-diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h
-index f990adf..460f022 100644
---- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h
-+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_kernel_device_h_
- #define __gc_hal_kernel_device_h_
- 
-@@ -37,15 +35,18 @@ typedef struct _gckGALDEVICE
-     /* Attributes. */
-     gctSIZE_T           internalSize;
-     gctPHYS_ADDR        internalPhysical;
-+    gctUINT32           internalPhysicalName;
-     gctPOINTER          internalLogical;
-     gckVIDMEM           internalVidMem;
-     gctSIZE_T           externalSize;
-     gctPHYS_ADDR        externalPhysical;
-+    gctUINT32           externalPhysicalName;
-     gctPOINTER          externalLogical;
-     gckVIDMEM           externalVidMem;
-     gckVIDMEM           contiguousVidMem;
-     gctPOINTER          contiguousBase;
-     gctPHYS_ADDR        contiguousPhysical;
-+    gctUINT32           contiguousPhysicalName;
-     gctSIZE_T           contiguousSize;
-     gctBOOL             contiguousMapped;
-     gctPOINTER          contiguousMappedUser;
-diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c
-index c691b35..4e3819c 100644
---- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c
-+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *    Copyright (C) 2011-2012 Freescale Semiconductor, Inc.
- *
- *    This program is free software; you can redistribute it and/or modify
-@@ -20,8 +20,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include <linux/device.h>
- #include <linux/slab.h>
- #include <linux/notifier.h>
-@@ -180,6 +178,9 @@ static struct file_operations driver_fops =
-     .open       = drv_open,
-     .release    = drv_release,
-     .unlocked_ioctl = drv_ioctl,
-+#ifdef HAVE_COMPAT_IOCTL
-+    .compat_ioctl = drv_ioctl,
-+#endif
-     .mmap       = drv_mmap,
- };
- 
-@@ -492,7 +493,7 @@ long drv_ioctl(
-     }
- 
-     copyLen = copy_from_user(
--        &iface, drvArgs.InputBuffer, sizeof(gcsHAL_INTERFACE)
-+        &iface, gcmUINT64_TO_PTR(drvArgs.InputBuffer), sizeof(gcsHAL_INTERFACE)
-         );
- 
-     if (copyLen != 0)
-@@ -570,25 +571,26 @@ long drv_ioctl(
- 
-     if (gcmIS_SUCCESS(status) && (iface.command == gcvHAL_LOCK_VIDEO_MEMORY))
-     {
-+        gcuVIDMEM_NODE_PTR node = gcmUINT64_TO_PTR(iface.u.LockVideoMemory.node);
-         /* Special case for mapped memory. */
-         if ((data->mappedMemory != gcvNULL)
--        &&  (iface.u.LockVideoMemory.node->VidMem.memory->object.type == gcvOBJ_VIDMEM)
-+        &&  (node->VidMem.memory->object.type == gcvOBJ_VIDMEM)
-         )
-         {
-             /* Compute offset into mapped memory. */
-             gctUINT32 offset
--                = (gctUINT8 *) iface.u.LockVideoMemory.memory
-+                = (gctUINT8 *) gcmUINT64_TO_PTR(iface.u.LockVideoMemory.memory)
-                 - (gctUINT8 *) device->contiguousBase;
- 
-             /* Compute offset into user-mapped region. */
-             iface.u.LockVideoMemory.memory =
--                (gctUINT8 *) data->mappedMemory + offset;
-+                gcmPTR_TO_UINT64((gctUINT8 *) data->mappedMemory + offset);
-         }
-     }
- 
-     /* Copy data back to the user. */
-     copyLen = copy_to_user(
--        drvArgs.OutputBuffer, &iface, sizeof(gcsHAL_INTERFACE)
-+        gcmUINT64_TO_PTR(drvArgs.OutputBuffer), &iface, sizeof(gcsHAL_INTERFACE)
-         );
- 
-     if (copyLen != 0)
-@@ -616,7 +618,7 @@ static int drv_mmap(
-     struct vm_area_struct* vma
-     )
- {
--    gceSTATUS status;
-+    gceSTATUS status = gcvSTATUS_OK;
-     gcsHAL_PRIVATE_DATA_PTR data;
-     gckGALDEVICE device;
- 
-@@ -704,11 +706,12 @@ static int drv_mmap(
-         }
- 
-         data->mappedMemory = (gctPOINTER) vma->vm_start;
-+
-+        /* Success. */
-+        gcmkFOOTER_NO();
-+        return 0;
-     }
- 
--    /* Success. */
--    gcmkFOOTER_NO();
--    return 0;
- 
- OnError:
-     gcmkFOOTER();
-diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.c
-index cba2040..22c4071 100644
---- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.c
-+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_linux.h"
- 
- #define _GC_OBJ_ZONE    gcvZONE_KERNEL
-@@ -65,15 +63,15 @@ gckKERNEL_QueryVideoMemory(
- 
-     /* Get internal memory size and physical address. */
-     Interface->u.QueryVideoMemory.internalSize = device->internalSize;
--    Interface->u.QueryVideoMemory.internalPhysical = device->internalPhysical;
-+    Interface->u.QueryVideoMemory.internalPhysical = device->internalPhysicalName;
- 
-     /* Get external memory size and physical address. */
-     Interface->u.QueryVideoMemory.externalSize = device->externalSize;
--    Interface->u.QueryVideoMemory.externalPhysical = device->externalPhysical;
-+    Interface->u.QueryVideoMemory.externalPhysical = device->externalPhysicalName;
- 
-     /* Get contiguous memory size and physical address. */
-     Interface->u.QueryVideoMemory.contiguousSize = device->contiguousSize;
--    Interface->u.QueryVideoMemory.contiguousPhysical = device->contiguousPhysical;
-+    Interface->u.QueryVideoMemory.contiguousPhysical = device->contiguousPhysicalName;
- 
-     /* Success. */
-     gcmkFOOTER_NO();
-@@ -181,7 +179,10 @@ gckKERNEL_MapMemory(
-     OUT gctPOINTER * Logical
-     )
- {
--    return gckOS_MapMemory(Kernel->os, Physical, Bytes, Logical);
-+    gckKERNEL kernel = Kernel;
-+    gctPHYS_ADDR physical = gcmNAME_TO_PTR(Physical);
-+
-+    return gckOS_MapMemory(Kernel->os, physical, Bytes, Logical);
- }
- 
- /*******************************************************************************
-@@ -216,7 +217,10 @@ gckKERNEL_UnmapMemory(
-     IN gctPOINTER Logical
-     )
- {
--    return gckOS_UnmapMemory(Kernel->os, Physical, Bytes, Logical);
-+    gckKERNEL kernel = Kernel;
-+    gctPHYS_ADDR physical = gcmNAME_TO_PTR(Physical);
-+
-+    return gckOS_UnmapMemory(Kernel->os, physical, Bytes, Logical);
- }
- 
- /*******************************************************************************
-diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h
-index a6ed03f..9c0bcd5 100644
---- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h
-+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_kernel_linux_h_
- #define __gc_hal_kernel_linux_h_
- 
-diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_math.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_math.c
-index a4cb717..992aeff 100644
---- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_math.c
-+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_math.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_linux.h"
- 
- gctINT
-diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
-index af20f0b..c07ded8 100644
---- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
-+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #include "gc_hal_kernel_linux.h"
- 
- #include <linux/pagemap.h>
-@@ -1873,12 +1871,14 @@ gckOS_AllocateNonPagedMemory(
-     mdl->kaddr      = vaddr;
-     mdl->u.contiguousPages = page;
- 
-+#if !defined(CONFIG_PPC)
-     /* Cache invalidate. */
-     dma_sync_single_for_device(
-                 gcvNULL,
-                 page_to_phys(page),
-                 bytes,
-                 DMA_FROM_DEVICE);
-+#endif
- 
-     while (size > 0)
-     {
-@@ -3851,7 +3851,7 @@ gckOS_AllocatePagedMemoryEx(
-         {
-             gcmkVERIFY_OK(
-                 gckOS_CacheFlush(Os, _GetProcessID(), gcvNULL,
--                                 (gctPOINTER)page_to_phys(page),
-+                                 (gctPOINTER)(gctUINTPTR_T)page_to_phys(page),
-                                  page_address(page),
-                                  PAGE_SIZE));
-         }
-@@ -5333,7 +5333,7 @@ OnError:
-             {
-                 /* Flush(clean) the data cache. */
-                 gcmkONERROR(gckOS_CacheFlush(Os, _GetProcessID(), gcvNULL,
--                                 (gctPOINTER)page_to_phys(pages[i]),
-+                                 (gctPOINTER)(gctUINTPTR_T)page_to_phys(pages[i]),
-                                  (gctPOINTER)(memory & PAGE_MASK) + i*PAGE_SIZE,
-                                  PAGE_SIZE));
-             }
-@@ -6020,6 +6020,10 @@ gckOS_CacheClean(
- 
-     dma_cache_wback((unsigned long) Logical, Bytes);
- 
-+#elif defined(CONFIG_PPC)
-+
-+    /* TODO */
-+
- #else
-     dma_sync_single_for_device(
-               gcvNULL,
-@@ -6097,6 +6101,8 @@ gckOS_CacheInvalidate(
- 
- #elif defined(CONFIG_MIPS)
-     dma_cache_inv((unsigned long) Logical, Bytes);
-+#elif defined(CONFIG_PPC)
-+    /* TODO */
- #else
-     dma_sync_single_for_device(
-               gcvNULL,
-@@ -6169,6 +6175,8 @@ gckOS_CacheFlush(
- 
- #elif defined(CONFIG_MIPS)
-     dma_cache_wback_inv((unsigned long) Logical, Bytes);
-+#elif defined(CONFIG_PPC)
-+    /* TODO */
- #else
-     dma_sync_single_for_device(
-               gcvNULL,
-@@ -6921,6 +6929,134 @@ gckOS_ResetGPU(
-     return gcvSTATUS_OK;
- }
- 
-+/*******************************************************************************
-+**
-+**  gckOS_PrepareGPUFrequency
-+**
-+**  Prepare to set GPU frequency and voltage.
-+**
-+**  INPUT:
-+**
-+**      gckOS Os
-+**          Pointer to a gckOS object.
-+**
-+**      gckCORE Core
-+**          GPU whose frequency and voltage will be set.
-+**
-+**  OUTPUT:
-+**
-+**      Nothing.
-+*/
-+gceSTATUS
-+gckOS_PrepareGPUFrequency(
-+    IN gckOS Os,
-+    IN gceCORE Core
-+    )
-+{
-+    return gcvSTATUS_OK;
-+}
-+
-+/*******************************************************************************
-+**
-+**  gckOS_FinishGPUFrequency
-+**
-+**  Finish GPU frequency setting.
-+**
-+**  INPUT:
-+**
-+**      gckOS Os
-+**          Pointer to a gckOS object.
-+**
-+**      gckCORE Core
-+**          GPU whose frequency and voltage is set.
-+**
-+**  OUTPUT:
-+**
-+**      Nothing.
-+*/
-+gceSTATUS
-+gckOS_FinishGPUFrequency(
-+    IN gckOS Os,
-+    IN gceCORE Core
-+    )
-+{
-+    return gcvSTATUS_OK;
-+}
-+
-+/*******************************************************************************
-+**
-+**  gckOS_QueryGPUFrequency
-+**
-+**  Query the current frequency of the GPU.
-+**
-+**  INPUT:
-+**
-+**      gckOS Os
-+**          Pointer to a gckOS object.
-+**
-+**      gckCORE Core
-+**          GPU whose power is set.
-+**
-+**      gctUINT32 * Frequency
-+**          Pointer to a gctUINT32 to obtain current frequency, in MHz.
-+**
-+**      gctUINT8 * Scale
-+**          Pointer to a gctUINT8 to obtain current scale(1 - 64).
-+**
-+**  OUTPUT:
-+**
-+**      Nothing.
-+*/
-+gceSTATUS
-+gckOS_QueryGPUFrequency(
-+    IN gckOS Os,
-+    IN gceCORE Core,
-+    OUT gctUINT32 * Frequency,
-+    OUT gctUINT8 * Scale
-+    )
-+{
-+    return gcvSTATUS_OK;
-+}
-+
-+/*******************************************************************************
-+**
-+**  gckOS_SetGPUFrequency
-+**
-+**  Set frequency and voltage of the GPU.
-+**
-+**      1. DVFS manager gives the target scale of full frequency, BSP must find
-+**         a real frequency according to this scale and board's configure.
-+**
-+**      2. BSP should find a suitable voltage for this frequency.
-+**
-+**      3. BSP must make sure setting take effect before this function returns.
-+**
-+**  INPUT:
-+**
-+**      gckOS Os
-+**          Pointer to a gckOS object.
-+**
-+**      gckCORE Core
-+**          GPU whose power is set.
-+**
-+**      gctUINT8 Scale
-+**          Target scale of full frequency, range is [1, 64]. 1 means 1/64 of
-+**          full frequency and 64 means 64/64 of full frequency.
-+**
-+**  OUTPUT:
-+**
-+**      Nothing.
-+*/
-+gceSTATUS
-+gckOS_SetGPUFrequency(
-+    IN gckOS Os,
-+    IN gceCORE Core,
-+    IN gctUINT8 Scale
-+    )
-+{
-+    return gcvSTATUS_OK;
-+}
-+
- /*----------------------------------------------------------------------------*/
- /*----- Profile --------------------------------------------------------------*/
- 
-@@ -7669,8 +7805,14 @@ gckOS_CreateUserSignal(
-     OUT gctINT * SignalID
-     )
- {
-+    gceSTATUS status;
-+    gctSIZE_T signal;
-+
-     /* Create a new signal. */
--    return gckOS_CreateSignal(Os, ManualReset, (gctSIGNAL *) SignalID);
-+    status = gckOS_CreateSignal(Os, ManualReset, (gctSIGNAL *) &signal);
-+    *SignalID = (gctINT) signal;
-+
-+    return status;
- }
- 
- /*******************************************************************************
-@@ -8102,7 +8244,7 @@ OnError:
- 
- /*******************************************************************************
- **
--**  gckOS_DestoryTimer
-+**  gckOS_DestroyTimer
- **
- **  Destory a software timer.
- **
-@@ -8119,7 +8261,7 @@ OnError:
- **      Nothing.
- */
- gceSTATUS
--gckOS_DestoryTimer(
-+gckOS_DestroyTimer(
-     IN gckOS Os,
-     IN gctPOINTER Timer
-     )
-diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h
-index 577fb38..e970477 100644
---- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h
-+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h
-@@ -1,6 +1,6 @@
- /****************************************************************************
- *
--*    Copyright (C) 2005 - 2012 by Vivante Corp.
-+*    Copyright (C) 2005 - 2013 by Vivante Corp.
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
-@@ -19,8 +19,6 @@
- *****************************************************************************/
- 
- 
--
--
- #ifndef __gc_hal_kernel_os_h_
- #define __gc_hal_kernel_os_h_
- 
-@@ -71,10 +69,10 @@ FindMdlMap(
- 
- typedef struct _DRIVER_ARGS
- {
--    gctPOINTER              InputBuffer;
--    gctUINT32               InputBufferSize;
--    gctPOINTER              OutputBuffer;
--    gctUINT32               OutputBufferSize;
-+    gctUINT64               InputBuffer;
-+    gctUINT64               InputBufferSize;
-+    gctUINT64               OutputBuffer;
-+    gctUINT64               OutputBufferSize;
- }
- DRIVER_ARGS;
- 
--- 
-1.8.3.1
-
diff --git a/recipes-kernel/linux/linux-wandboard.inc b/recipes-kernel/linux/linux-wandboard.inc
index 38d3666..be95648 100644
--- a/recipes-kernel/linux/linux-wandboard.inc
+++ b/recipes-kernel/linux/linux-wandboard.inc
@@ -7,8 +7,6 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
 
 require recipes-kernel/linux/linux-imx.inc
 
-INC_PR = "r1"
-
 # Put a local version until we have a true SRCREV to point to
 LOCALVERSION ?= "+yocto"
 SCMVERSION ?= "y"