update gpu kernel driver to 2.5.3.2.1
author杜坤明 <dkm@rockchip.com>
Mon, 21 Feb 2011 02:02:53 +0000 (10:02 +0800)
committer杜坤明 <dkm@rockchip.com>
Mon, 21 Feb 2011 02:04:49 +0000 (10:04 +0800)
drivers/staging/rk29/vivante/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c
drivers/staging/rk29/vivante/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.h [changed mode: 0644->0755]
drivers/staging/rk29/vivante/hal/inc/gc_hal_enum.h [changed mode: 0644->0755]
drivers/staging/rk29/vivante/hal/inc/gc_hal_options.h [changed mode: 0644->0755]
drivers/staging/rk29/vivante/hal/inc/gc_hal_raster.h [changed mode: 0644->0755]
drivers/staging/rk29/vivante/hal/kernel/gc_hal_kernel_command.c [changed mode: 0644->0755]
drivers/staging/rk29/vivante/hal/os/libGAL.def.mak [changed mode: 0644->0755]
drivers/staging/rk29/vivante/hal/os/linux/kernel/gc_hal_kernel_device.c [changed mode: 0644->0755]
drivers/staging/rk29/vivante/hal/os/linux/kernel/gc_hal_kernel_driver.c
drivers/staging/rk29/vivante/hal/os/linux/kernel/gc_hal_kernel_os.c
drivers/staging/rk29/vivante/hal/os/linux/kernel/gc_hal_kernel_os.h

index faa00f92cf6fb74b1ff2c5c6e2001e404cd62903..59516271291e824c3f218068b9aad0a979a5fbad 100755 (executable)
@@ -1,6 +1,6 @@
 /****************************************************************************
 *
-*    Copyright (C) 2005 - 2010 by Vivante Corp.
+*    Copyright (C) 2005 - 2011 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
 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *****************************************************************************/
+
+
+
+
 #include "gc_hal.h"
 #include "gc_hal_kernel.h"
 
@@ -418,7 +422,10 @@ gckHARDWARE_Construct(
     gcmkONERROR(gckHARDWARE_SetFastClear(hardware, -1, -1));
 
     /* Set power state to ON. */
-    hardware->chipPowerState = gcvPOWER_ON;
+    hardware->chipPowerState    = gcvPOWER_ON;
+    hardware->broadcast         = gcvFALSE;
+    hardware->settingPowerState = gcvFALSE;
+
     hardware->lastWaitLink   = ~0U;
 
     gcmkONERROR(gckOS_CreateMutex(Os, &hardware->powerMutex));
@@ -2858,10 +2865,8 @@ gckHARDWARE_SetPowerManagementState(
     gckCOMMAND command = gcvNULL;
     gckOS os;
     gctUINT flag, clock;
-#if 0      // dkm del  
     gctPOINTER buffer;
     gctSIZE_T bytes, requested;
-#endif
     gctBOOL acquired = gcvFALSE;
     gctBOOL reserved = gcvFALSE;
     gctBOOL mutexAcquired = gcvFALSE;
@@ -2959,6 +2964,13 @@ gckHARDWARE_SetPowerManagementState(
     /* Convert the broadcast power state. */
     switch (State)
     {
+    case gcvPOWER_ON_BROADCAST:
+        /* Convert to ON and and not we are inside broadcast. */
+        State     = gcvPOWER_ON;
+        stall     = gcvFALSE;
+        broadcast = gcvTRUE;
+        break;
+
     case gcvPOWER_SUSPEND_ATPOWERON:
         /* Convert to SUSPEND and don't wait for STALL. */
         State = gcvPOWER_SUSPEND;
@@ -2972,25 +2984,25 @@ gckHARDWARE_SetPowerManagementState(
         break;
 
     case gcvPOWER_IDLE_BROADCAST:
-        /* Convert to IDLE and note we are inside breoadcast. */
+        /* Convert to IDLE and note we are inside broadcast. */
         State     = gcvPOWER_IDLE;
         broadcast = gcvTRUE;
         break;
 
     case gcvPOWER_SUSPEND_BROADCAST:
-        /* Convert to SUSPEND and note we are inside breoadcast. */
+        /* Convert to SUSPEND and note we are inside broadcast. */
         State     = gcvPOWER_SUSPEND;
         broadcast = gcvTRUE;
         break;
 
     case gcvPOWER_OFF_BROADCAST:
-        /* Convert to OFF and note we are inside breoadcast. */
+        /* Convert to OFF and note we are inside broadcast. */
         State     = gcvPOWER_OFF;
         broadcast = gcvTRUE;
         break;
 
     case gcvPOWER_OFF_RECOVERY:
-        /* Convert to OFF and note we are inside breoadcast. */
+        /* Convert to OFF and note we are inside broadcast. */
         State     = gcvPOWER_OFF;
         stall     = gcvFALSE;
         broadcast = gcvTRUE;
@@ -3046,7 +3058,7 @@ gckHARDWARE_SetPowerManagementState(
     flag  = flags[Hardware->chipPowerState][State];
     clock = clocks[State];
 
-    if (flag == 0)
+    if ((flag == 0) || (Hardware->settingPowerState))
     {
         /* Release the power mutex. */
         gcmkONERROR(gckOS_ReleaseMutex(os, Hardware->powerMutex));
@@ -3056,6 +3068,20 @@ gckHARDWARE_SetPowerManagementState(
         return gcvSTATUS_OK;
     }
 
+    if (broadcast && !Hardware->broadcast
+    &&  (Hardware->chipPowerState == gcvPOWER_OFF)
+    )
+    {
+        /* Release the power mutex. */
+        gcmkONERROR(gckOS_ReleaseMutex(os, Hardware->powerMutex));
+
+        /* No broadcast while GPU is forced power off. */
+        gcmkFOOTER_NO();
+        return gcvSTATUS_CHIP_NOT_READY;
+    }
+
+    Hardware->settingPowerState = gcvTRUE;
+
     gcmkASSERT(Hardware->kernel          != gcvNULL);
     gcmkASSERT(Hardware->kernel->command != gcvNULL);
     command = Hardware->kernel->command;
@@ -3097,7 +3123,6 @@ gckHARDWARE_SetPowerManagementState(
 
         else
         {
-#if 0      // dkm del    
             /* Get the size of the flush command. */
             gcmkONERROR(gckHARDWARE_Flush(Hardware,
                                           gcvFLUSH_ALL,
@@ -3122,7 +3147,6 @@ gckHARDWARE_SetPowerManagementState(
 
             /* Wait to finish all commands. */
             gcmkONERROR(gckCOMMAND_Stall(command));
-#endif  
         }
     }
 
@@ -3195,7 +3219,9 @@ gckHARDWARE_SetPowerManagementState(
     }
 
     /* Save the new power state. */
-    Hardware->chipPowerState = State;
+    Hardware->chipPowerState    = State;
+    Hardware->broadcast         = broadcast;
+    Hardware->settingPowerState = gcvFALSE;
 
     /* Release the power mutex. */
     gcmkONERROR(gckOS_ReleaseMutex(os, Hardware->powerMutex));
@@ -3220,6 +3246,8 @@ OnError:
 
     if (mutexAcquired)
     {
+        Hardware->settingPowerState = gcvFALSE;
+
         gcmkVERIFY_OK(gckOS_ReleaseMutex(Hardware->os, Hardware->powerMutex));
     }
 
old mode 100644 (file)
new mode 100755 (executable)
index 70e659f..2b8592a
@@ -1,6 +1,6 @@
 /****************************************************************************
 *
-*    Copyright (C) 2005 - 2010 by Vivante Corp.
+*    Copyright (C) 2005 - 2011 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
@@ -66,6 +66,8 @@ struct _gckHARDWARE
     gctUINT32                   powerProcess;
     gctUINT32                   powerThread;
     gceCHIPPOWERSTATE           chipPowerState;
+    gctBOOL                     broadcast;
+    gctBOOL                     settingPowerState;
     gctUINT32                   lastWaitLink;
 };
 
old mode 100644 (file)
new mode 100755 (executable)
index 18cfd70..d1cba5c
@@ -1,6 +1,6 @@
 /****************************************************************************
 *
-*    Copyright (C) 2005 - 2010 by Vivante Corp.
+*    Copyright (C) 2005 - 2011 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
@@ -94,6 +94,8 @@ typedef enum _gceFEATURE
     gcvFEATURE_VG_DOUBLE_BUFFER,
     gcvFEATURE_MC20,
     gcvFEATURE_SUPER_TILED,
+    gcvFEATURE_2D_DITHER,
+    gcvFEATURE_WIDE_LINE,
 }
 gceFEATURE;
 
@@ -104,6 +106,7 @@ typedef enum _gceCHIPPOWERSTATE
     gcvPOWER_OFF,
     gcvPOWER_IDLE,
     gcvPOWER_SUSPEND,
+    gcvPOWER_ON_BROADCAST,
     gcvPOWER_SUSPEND_ATPOWERON,
     gcvPOWER_OFF_ATPOWERON,
     gcvPOWER_IDLE_BROADCAST,
old mode 100644 (file)
new mode 100755 (executable)
index 3e1ea98..69f502a
 */
 #define gcdENABLE_AUTO_FREQ                 0
 
+
+/*
+    gcdENABLE_MEM_CACHE
+
+    ÅäÖÃGPUËùʹÓõÄmemoryÊÇ·ñ±»ARM Cacheס
+*/
+#define gcdENABLE_MEM_CACHE                 1
+
 #endif /* __gc_hal_options_h_ */
 
old mode 100644 (file)
new mode 100755 (executable)
index 64f897f..4ff9c22
@@ -1,6 +1,6 @@
 /****************************************************************************
 *
-*    Copyright (C) 2005 - 2010 by Vivante Corp.
+*    Copyright (C) 2005 - 2011 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
@@ -773,6 +773,13 @@ gco2D_ProfileEngine(
        OPTIONAL gcs2D_PROFILE_PTR Profile
        );
 
+/* Enable or disable 2D dithering. */
+gceSTATUS
+gco2D_EnableDither(
+       IN gco2D Engine,
+       IN gctBOOL Enable
+       );
+
 #ifdef __cplusplus
 }
 #endif
old mode 100644 (file)
new mode 100755 (executable)
index 0f45f26..5a0a977
@@ -1,6 +1,6 @@
 /****************************************************************************
 *
-*    Copyright (C) 2005 - 2010 by Vivante Corp.
+*    Copyright (C) 2005 - 2011 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
@@ -758,6 +758,7 @@ gckCOMMAND_Commit(
     gctBOOL semaAcquired = gcvFALSE;
     gctINT32 atomValue;
     gctBOOL atomIncremented = gcvFALSE;
+    gctUINT32 process, thread;
     gctBOOL powerAcquired = gcvFALSE;
 
     gcmkHEADER_ARG("Command=0x%x CommandBuffer=0x%x Context=0x%x",
@@ -791,10 +792,40 @@ gckCOMMAND_Commit(
     hardware = Command->kernel->hardware;
     gcmkVERIFY_OBJECT(hardware, gcvOBJ_HARDWARE);
 
-    /* Grab the power mutex. */
-    gcmkONERROR(
-        gckOS_AcquireMutex(Command->os, hardware->powerMutex, gcvINFINITE));
-    powerAcquired = gcvTRUE;
+    /* Get current process and thread IDs. */
+    gcmkONERROR(gckOS_GetProcessID(&process));
+    gcmkONERROR(gckOS_GetThreadID(&thread));
+
+    /* Try to acquire the power mutex. */
+    status = gckOS_AcquireMutex(Command->os, hardware->powerMutex, 0);
+
+    if (status == gcvSTATUS_OK)
+    {
+        hardware->powerProcess = process;
+        hardware->powerThread  = thread;
+        powerAcquired = gcvTRUE;
+    }
+    else if (status == gcvSTATUS_TIMEOUT)
+    {
+        /* Check if we already own this mutex. */
+        if ((hardware->powerProcess != process)
+        ||  (hardware->powerThread  != thread)
+        )
+        {
+            /* Acquire the power mutex. */
+            gcmkONERROR(
+                gckOS_AcquireMutex(Command->os,
+                                   hardware->powerMutex, gcvINFINITE));
+
+            hardware->powerProcess = process;
+            hardware->powerThread  = thread;
+            powerAcquired = gcvTRUE;
+        }
+    }
+    else
+    {
+        gcmkONERROR(status);
+    }
 
     /* Increment the commit atom. */
     gcmkONERROR(gckOS_AtomIncrement(Command->os,
@@ -802,9 +833,12 @@ gckCOMMAND_Commit(
                                     &atomValue));
     atomIncremented = gcvTRUE;
 
-    /* Release the power mutex. */
-    gcmkONERROR(gckOS_ReleaseMutex(Command->os, hardware->powerMutex));
-    powerAcquired = gcvFALSE;
+    if (powerAcquired)
+    {
+        /* Release the power mutex. */
+        gcmkONERROR(gckOS_ReleaseMutex(Command->os, hardware->powerMutex));
+        powerAcquired = gcvFALSE;
+    }
 
     /* Notify the system the GPU has a commit. */
     gcmkONERROR(gckOS_Broadcast(Command->os,
@@ -1371,8 +1405,10 @@ gckCOMMAND_Reserve(
     gctSIZE_T requiredBytes, bytes;
     gctBOOL acquired = gcvFALSE;
     gctBOOL semaAcquired = gcvTRUE;
+    gckHARDWARE hardware = gcvNULL;
     gctINT32 atomValue;
     gctBOOL atomIncremented = gcvFALSE;
+    gctUINT32 process, thread;
     gctBOOL powerAcquired = gcvFALSE;
 
     gcmkHEADER_ARG("Command=0x%x RequestedBytes=%lu", Command, RequestedBytes);
@@ -1380,21 +1416,57 @@ gckCOMMAND_Reserve(
     /* Verify the arguments. */
     gcmkVERIFY_OBJECT(Command, gcvOBJ_COMMAND);
 
-    /* Grab the power mutex. */
-    gcmkONERROR(gckOS_AcquireMutex(Command->os,
-                                   Command->kernel->hardware->powerMutex,
-                                   gcvINFINITE));
-    powerAcquired = gcvTRUE;
+    /* Extract the gckHARDWARE objects. */
+    hardware = Command->kernel->hardware;
+    gcmkVERIFY_OBJECT(hardware, gcvOBJ_HARDWARE);
+
+    /* Get current process and thread IDs. */
+    gcmkONERROR(gckOS_GetProcessID(&process));
+    gcmkONERROR(gckOS_GetThreadID(&thread));
+
+    /* Try to acquire the power mutex. */
+    status = gckOS_AcquireMutex(Command->os, hardware->powerMutex, 0);
+
+    if (status == gcvSTATUS_OK)
+    {
+        hardware->powerProcess = process;
+        hardware->powerThread  = thread;
+        powerAcquired = gcvTRUE;
+    }
+    else if (status == gcvSTATUS_TIMEOUT)
+    {
+        /* Check if we already own this mutex. */
+        if ((hardware->powerProcess != process)
+        ||  (hardware->powerThread  != thread)
+        )
+        {
+            /* Acquire the power mutex. */
+            gcmkONERROR(
+                gckOS_AcquireMutex(Command->os,
+                                   hardware->powerMutex, gcvINFINITE));
+
+            hardware->powerProcess = process;
+            hardware->powerThread  = thread;
+            powerAcquired = gcvTRUE;
+        }
+    }
+    else
+    {
+        gcmkONERROR(status);
+    }
 
     /* Increment the commit atom. */
     gcmkONERROR(
         gckOS_AtomIncrement(Command->os, Command->atomCommit, &atomValue));
     atomIncremented = gcvTRUE;
 
-    /* Release the power mutex. */
-    gcmkONERROR(gckOS_ReleaseMutex(Command->os,
-                                   Command->kernel->hardware->powerMutex));
-    powerAcquired = gcvFALSE;
+    if (powerAcquired)
+    {
+        /* Release the power mutex. */
+        gcmkONERROR(gckOS_ReleaseMutex(Command->os,
+                                       Command->kernel->hardware->powerMutex));
+        powerAcquired = gcvFALSE;
+    }
 
     /* Notify the system the GPU has a commit. */
     gcmkONERROR(gckOS_Broadcast(Command->os,
old mode 100644 (file)
new mode 100755 (executable)
index f8f4563..eb56599
@@ -1,16 +1,16 @@
 ##############################################################################
 #  
-#    Copyright (c) 2005 - 2010 by Vivante Corp.  All rights reserved.
+#    Copyright (c) 2005 - 2011 by Vivante Corp.  All rights reserved.
 #  
 #    The material in this file is confidential and contains trade secrets
 #    of Vivante Corporation. This is proprietary information owned by
-#    Vivante Corporation. No part of this work may be disclosed, 
-#    reproduced, copied, transmitted, or used in any way for any purpose, 
+#    Vivante Corporation. No part of this work may be disclosed,
+#    reproduced, copied, transmitted, or used in any way for any purpose,
 #    without the express written permission of Vivante Corporation.
 #  
 ##############################################################################
 #  
-#    Auto-generated file on 12/17/2010. Do not edit!!!
+#    Auto-generated file on 1/7/2011. Do not edit!!!
 #  
 ##############################################################################
 
@@ -279,6 +279,7 @@ EXPORTS
        gco2D_SetAutoFlushCycles
        gco2D_ProfileEngine
        gco2D_GetMaximumDataCount
+       gco2D_EnableDither
 
 
 !IFNDEF VIVANTE_NO_3D
old mode 100644 (file)
new mode 100755 (executable)
index 752d858..bf3e657
@@ -577,8 +577,13 @@ gckGALDEVICE_Construct(
         {
             /* map internal memory */
             device->internalPhysical  = (gctPHYS_ADDR)physical;
+#if gcdENABLE_MEM_CACHE
+            device->internalLogical   = (gctPOINTER)ioremap_cached(
+                    physical, device->internalSize);
+#else
             device->internalLogical   = (gctPOINTER)ioremap_nocache(
                     physical, device->internalSize);
+#endif
 
             gcmkASSERT(device->internalLogical != NULL);
 
@@ -605,9 +610,13 @@ gckGALDEVICE_Construct(
         {
             /* map internal memory */
             device->externalPhysical = (gctPHYS_ADDR)physical;
+#if gcdENABLE_MEM_CACHE
+            device->externalLogical = (gctPOINTER)ioremap_cached(
+                    physical, device->externalSize);
+#else
             device->externalLogical = (gctPOINTER)ioremap_nocache(
                     physical, device->externalSize);
-
+#endif
             gcmkASSERT(device->externalLogical != NULL);
 
             physical += device->externalSize;
@@ -719,7 +728,11 @@ gckGALDEVICE_Construct(
 
             device->contiguousPhysical = (gctPHYS_ADDR) ContiguousBase;
             device->contiguousSize     = ContiguousSize;
+#if gcdENABLE_MEM_CACHE
+            device->contiguousBase     = (gctPOINTER) ioremap_cached(ContiguousBase, ContiguousSize);
+#else
             device->contiguousBase     = (gctPOINTER) ioremap_nocache(ContiguousBase, ContiguousSize);
+#endif
             device->contiguousMapped   = gcvTRUE;
 
             if (device->contiguousBase == gcvNULL)
index c8a95446946bd0650dcad1bf10c6db86dfb7e433..09eff0c3cd9ee27c62fdb77eae911143c84d6a74 100755 (executable)
@@ -1,6 +1,6 @@
 /****************************************************************************
 *
-*    Copyright (C) 2005 - 2010 by Vivante Corp.
+*    Copyright (C) 2005 - 2011 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
@@ -25,7 +25,6 @@
 #include <linux/miscdevice.h>
 #include <linux/slab.h>
 
-
 #include "gc_hal_kernel_linux.h"
 #include "gc_hal_driver.h"
 #include "gc_hal_user_context.h"
@@ -138,10 +137,10 @@ void gputimer_callback(unsigned long arg)
 
     if(freq!=last_freq) {
         last_freq = freq;
-        set_nextfreq(freq);
+        //set_nextfreq(freq);
     }
     
-    //printk("%8d /%8d = %3d %%, needfreq = %dM (%d)\n", (int)run, (int)(run+idle), precent, freq, power_cnt);
+    printk("%8d /%8d = %3d %%, needfreq = %dM (%d)\n", (int)run, (int)(run+idle), precent, freq, power_cnt);
 }
 #endif
 
@@ -211,7 +210,7 @@ int drv_release(struct inode* inode, struct file* filp)
        FreeAllMemoryRecord(galDevice->os, &private->memoryRecordList);
 
 #ifdef ANDROID
-       gcmkVERIFY_OK(gckOS_Delay(galDevice->os, 1000));
+       /* gcmkVERIFY_OK(gckOS_Delay(galDevice->os, 1000)); */
 #else
        gcmkVERIFY_OK(gckCOMMAND_Stall(device->kernel->command));
 #endif
@@ -467,7 +466,9 @@ static int drv_mmap(struct file * filp, struct vm_area_struct * vma)
         return -ENOTTY;
     }
 
+#if !gcdENABLE_MEM_CACHE
     vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+#endif
     vma->vm_flags    |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND;
     vma->vm_pgoff     = 0;
 
@@ -812,10 +813,27 @@ static int __devinit gpu_resume(struct platform_device *dev)
        return 0;
 }
 
+static void __devinit gpu_shutdown(struct platform_device *dev)
+{
+       gceSTATUS status;
+       gckGALDEVICE device;
+    
+    printk("Enter %s \n", __func__);
+
+       device = platform_get_drvdata(dev);
+
+       status = gckHARDWARE_SetPowerManagementState(device->kernel->hardware, gcvPOWER_OFF);
+
+       if (gcmIS_ERROR(status))
+       {
+           printk("%s fail!\n", __func__);
+       }
+}
+
 static struct platform_driver gpu_driver = {
        .probe          = gpu_probe,
        .remove         = gpu_remove,
-
+    .shutdown   = gpu_shutdown,
        .suspend        = gpu_suspend,
        .resume         = gpu_resume,
 
index 0e339dbab1a73cbf84ea5384ebd1d43720192c97..4ff31449956a077ee0bc685522454e1d9e92d33c 100755 (executable)
@@ -1,6 +1,6 @@
 /****************************************************************************
 *
-*    Copyright (C) 2005 - 2010 by Vivante Corp.
+*    Copyright (C) 2005 - 2011 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
@@ -1022,7 +1022,10 @@ gckOS_MapMemory(
             return gcvSTATUS_OUT_OF_RESOURCES;
         }
 #else
+
+#if !gcdENABLE_MEM_CACHE
         mdlMap->vma->vm_page_prot = pgprot_noncached(mdlMap->vma->vm_page_prot);
+#endif
         mdlMap->vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED;
         mdlMap->vma->vm_pgoff = 0;
 
@@ -1257,7 +1260,11 @@ gckOS_AllocateNonPagedMemory(
     }
 
     vaddr           = (gctPOINTER)page_address(page);
+#if gcdENABLE_MEM_CACHE
+    addr            = ioremap_cached(virt_to_phys(vaddr), size);
+#else
     addr            = ioremap_nocache(virt_to_phys(vaddr), size);
+#endif
     mdl->dmaHandle  = virt_to_phys(vaddr);
     mdl->kaddr      = vaddr;
 
@@ -1386,7 +1393,10 @@ gckOS_AllocateNonPagedMemory(
             return gcvSTATUS_OUT_OF_RESOURCES;
         }
 #else
+
+#if !gcdENABLE_MEM_CACHE
         mdlMap->vma->vm_page_prot = pgprot_noncached(mdlMap->vma->vm_page_prot);
+#endif
         mdlMap->vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED;
         mdlMap->vma->vm_pgoff = 0;
 
@@ -1943,8 +1953,11 @@ gceSTATUS gckOS_MapPhysical(
     {
         /* Map memory as cached memory. */
         request_mem_region(physical, Bytes, "MapRegion");
+#if gcdENABLE_MEM_CACHE
+        logical = (gctPOINTER) ioremap_cached(physical, Bytes);
+#else
         logical = (gctPOINTER) ioremap_nocache(physical, Bytes);
-
+#endif
         if (logical == NULL)
         {
             gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_OS,
@@ -3001,7 +3014,9 @@ gceSTATUS gckOS_LockPages(
 
         mdlMap->vma->vm_flags |= VM_RESERVED;
         /* Make this mapping non-cached. */
+#if !gcdENABLE_MEM_CACHE
         mdlMap->vma->vm_page_prot = pgprot_noncached(mdlMap->vma->vm_page_prot);
+#endif
 
         addr = mdl->addr;
 
@@ -5388,6 +5403,9 @@ gckOS_CacheFlush(
     IN gctSIZE_T Bytes
     )
 {
+#if gcdENABLE_MEM_CACHE
+    dmac_clean_range(Logical, Logical+Bytes);
+#endif
     return gcvSTATUS_OK;
 }
 
@@ -5421,6 +5439,9 @@ gckOS_CacheInvalidate(
     IN gctSIZE_T Bytes
     )
 {
+#if gcdENABLE_MEM_CACHE
+    dmac_flush_range(Logical, Logical+Bytes);
+#endif
     return gcvSTATUS_OK;
 }
 
@@ -5515,7 +5536,8 @@ gckOS_Broadcast(
 
         /* Put GPU ON. */
         gcmkONERROR(
-            gckHARDWARE_SetPowerManagementState(Hardware, gcvPOWER_ON));
+            gckHARDWARE_SetPowerManagementState(Hardware,
+                                                gcvPOWER_ON_BROADCAST));
         break;
 
     case gcvBROADCAST_GPU_STUCK:
index aedeef628f5ce7501dfdcc4e4acbbf9567028444..c436cd9e9bdf5c0773e1acf62d82d975cb0d268b 100644 (file)
@@ -1,6 +1,6 @@
 /****************************************************************************
 *
-*    Copyright (C) 2005 - 2010 by Vivante Corp.
+*    Copyright (C) 2005 - 2011 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