diff options
author | Xinyu Chen <xinyu.chen@freescale.com> | 2012-10-24 16:22:41 +0800 |
---|---|---|
committer | Xinyu Chen <xinyu.chen@freescale.com> | 2012-10-24 16:22:41 +0800 |
commit | 798b3e92093efbaedb29cda77ed06f81d2763f93 (patch) | |
tree | be2a858abc91486ebd099615915ace2faaac4b49 | |
parent | 5b53e2720902c5dd9fbfc9b2644484173a5146aa (diff) |
Revert "ENGR00229321 Integrate GPU 4.6.9p8 kernel part driver"
This reverts commit 515c4d4486a167a7741bcae804cbb357bc0d7fc1.
23 files changed, 163 insertions, 569 deletions
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 ec5d85887b70..4670a503ceb4 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 @@ -362,8 +362,6 @@ gckVGHARDWARE_Construct( /* Set default event mask. */ hardware->eventMask = 0xFFFFFFFF; - gcmkERR_BREAK(gckOS_AtomConstruct(Os, &hardware->pageTableDirty)); - /* Set fast clear to auto. */ gcmkVERIFY_OK(gckVGHARDWARE_SetFastClear(hardware, -1)); @@ -386,11 +384,6 @@ gckVGHARDWARE_Construct( } while (gcvFALSE); - if (hardware->pageTableDirty != gcvNULL) - { - gcmkVERIFY_OK(gckOS_AtomDestroy(Os, hardware->pageTableDirty)); - } - if (hardware != gcvNULL) { gcmkVERIFY_OK(gckOS_Free(Os, hardware)); @@ -446,11 +439,6 @@ gckVGHARDWARE_Destroy( Hardware->os, Hardware->idleSignal)); } - if (Hardware->pageTableDirty != gcvNULL) - { - gcmkVERIFY_OK(gckOS_AtomDestroy(Hardware->os, Hardware->pageTableDirty)); - } - /* Free the object. */ status = gckOS_Free(Hardware->os, Hardware); gcmkFOOTER(); @@ -1289,6 +1277,26 @@ gceSTATUS gckVGHARDWARE_FlushMMU( | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 2:2) - (0 ? 2:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 2:2) - (0 ? 2:2) + 1))))))) << (0 ? 2:2))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 2:2) - (0 ? 2:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 2:2) - (0 ? 2:2) + 1))))))) << (0 ? 2:2))) | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 3:3) - (0 ? 3:3) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 3:3) - (0 ? 3:3) + 1))))))) << (0 ? 3:3))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 3:3) - (0 ? 3:3) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 3:3) - (0 ? 3:3) + 1))))))) << (0 ? 3:3))) | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))); +#if gcdPOWER_MANAGEMENT + /* Acquire the power management semaphore. */ + gcmkERR_BREAK(gckOS_AcquireSemaphore(Hardware->os, + command->powerSemaphore)); + + status = gckVGCOMMAND_Execute( + command, + commandBuffer + ); + /* Acquire the power management semaphore. */ + gcmkVERIFY_OK(gckOS_ReleaseSemaphore(Hardware->os, + command->powerSemaphore)); + + gcmkERR_BREAK(status); +#else + gcmkERR_BREAK(gckVGCOMMAND_Execute( + command, + commandBuffer + )); +#endif } while(gcvFALSE); 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 e3714b76db77..bca6f57e0982 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 @@ -68,7 +68,7 @@ struct _gckVGHARDWARE gctUINT32 powerOffTimeout; gctTHREAD timeIdleThread; gctBOOL killThread; - gctPOINTER pageTableDirty; + }; #endif /* __gc_hal_kernel_hardware_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 d8898a376fe1..633081b09c07 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 @@ -905,12 +905,11 @@ _DestroyContext( /* Free state delta map. */ if (buffer->logical != gcvNULL) { - gcmkONERROR(gckEVENT_FreeContiguousMemory( - Context->hardware->kernel->eventObj, - Context->totalSize, + gcmkONERROR(gckOS_FreeContiguous( + Context->os, buffer->physical, buffer->logical, - gcvKERNEL_PIXEL + Context->totalSize )); buffer->logical = gcvNULL; 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 377ce32ed4c3..36b7bcfab997 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 @@ -2218,7 +2218,7 @@ gckHARDWARE_Link( /* Append LINK(bytes / 8), FetchAddress. */ link = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x08 & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) - | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) (bytes >> 3) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))); + | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) (bytes >> 3) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))); gcmkONERROR( gckOS_WriteMemory(Hardware->os, logical, link)); @@ -2846,10 +2846,10 @@ gckHARDWARE_FlushMMU( buffer[1] = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) - | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) - | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 2:2) - (0 ? 2:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 2:2) - (0 ? 2:2) + 1))))))) << (0 ? 2:2))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 2:2) - (0 ? 2:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 2:2) - (0 ? 2:2) + 1))))))) << (0 ? 2:2))) - | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 3:3) - (0 ? 3:3) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 3:3) - (0 ? 3:3) + 1))))))) << (0 ? 3:3))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 3:3) - (0 ? 3:3) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 3:3) - (0 ? 3:3) + 1))))))) << (0 ? 3:3))) - | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))); + | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) + | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 2:2) - (0 ? 2:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 2:2) - (0 ? 2:2) + 1))))))) << (0 ? 2:2))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 2:2) - (0 ? 2:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 2:2) - (0 ? 2:2) + 1))))))) << (0 ? 2:2))) + | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 3:3) - (0 ? 3:3) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 3:3) - (0 ? 3:3) + 1))))))) << (0 ? 3:3))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 3:3) - (0 ? 3:3) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 3:3) - (0 ? 3:3) + 1))))))) << (0 ? 3:3))) + | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))); gcmkONERROR(gckCOMMAND_Execute(command, 8)); } @@ -2857,9 +2857,9 @@ gckHARDWARE_FlushMMU( { flushSize = 16 * 4; - gcmkONERROR(gckCOMMAND_Reserve( + gcmkONERROR(gckCOMMAND_Reserve( command, flushSize, &pointer, &bufferSize - )); + )); buffer = (gctUINT32_PTR) pointer; @@ -2868,8 +2868,8 @@ gckHARDWARE_FlushMMU( gcmkONERROR(gckOS_GetPhysicalAddress(command->os, buffer, &physical)); /* Flush cache. */ - buffer[0] - = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x01 & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) + buffer[0] + = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x01 & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) (0x0E03) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))); @@ -2911,7 +2911,7 @@ gckHARDWARE_FlushMMU( buffer[8] = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x01 & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) (0x0061) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) - | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))); + | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))); buffer[9] = (((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))) & ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))) << (0 ? 7:7))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))) << (0 ? 7:7))) ); @@ -3468,6 +3468,62 @@ _PowerEnum(gceCHIPPOWERSTATE State) } #endif +static gceSTATUS +_GetClock( + IN gckHARDWARE Hardware, + IN gceCHIPPOWERSTATE State, + OUT gctUINT_PTR Clock +) +{ + gctUINT clock; + + /* Clocks. */ + static const gctUINT clocks[4] = + { + /* gcvPOWER_ON */ + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | (((gctUINT32) ((gctUINT32) (64) & ((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))), + + /* gcvPOWER_OFF */ + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))), + + /* gcvPOWER_IDLE */ + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))), + + /* gcvPOWER_SUSPEND */ + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | + ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))), + }; + + gcmkHEADER(); + + gcmkVERIFY_ARGUMENT(State >= gcvPOWER_ON && State <= gcvPOWER_SUSPEND); + + clock = clocks[State]; + +#if gcdENABLE_FSCALE_VAL_ADJUST + if (State == gcvPOWER_ON) + { + clock = ((((gctUINT32) (clock)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | (((gctUINT32) ((gctUINT32) (Hardware->powerOnFscaleVal) & ((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))); + } +#endif + + *Clock = clock; + + gcmkFOOTER(); + return gcvSTATUS_OK; +} + /******************************************************************************* ** ** gckHARDWARE_SetPowerManagementState @@ -3507,9 +3563,6 @@ gckHARDWARE_SetPowerManagementState( #endif gctUINT32 process, thread; gctBOOL commitEntered = gcvFALSE; - gctBOOL commandStarted = gcvFALSE; - gctBOOL isrStarted = gcvFALSE; - #if gcdENABLE_PROFILING gctUINT64 time, freq, mutexTime, onTime, stallTime, stopTime, delayTime, initTime, offTime, startTime, totalTime; @@ -3574,34 +3627,6 @@ gckHARDWARE_SetPowerManagementState( }, }; - /* Clocks. */ - static const gctUINT clocks[4] = - { - /* gcvPOWER_ON */ - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | (((gctUINT32) ((gctUINT32) (64) & ((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))), - - /* gcvPOWER_OFF */ - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))), - - /* gcvPOWER_IDLE */ - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))), - - /* gcvPOWER_SUSPEND */ - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | - ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))), - }; - gcmkHEADER_ARG("Hardware=0x%x State=%d", Hardware, State); #if gcmIS_DEBUG(gcdDEBUG_TRACE) gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE, @@ -3742,14 +3767,7 @@ gckHARDWARE_SetPowerManagementState( /* Grab control flags and clock. */ flag = flags[Hardware->chipPowerState][State]; - clock = clocks[State]; - -#if gcdENABLE_FSCALE_VAL_ADJUST - if (State == gcvPOWER_ON) - { - clock = ((((gctUINT32) (clock)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | (((gctUINT32) ((gctUINT32) (Hardware->powerOnFscaleVal) & ((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))); - } -#endif + gcmkONERROR(_GetClock(Hardware, State, &clock)); if (State == gcvPOWER_SUSPEND && Hardware->chipPowerState == gcvPOWER_OFF && broadcast) { @@ -4090,13 +4108,11 @@ gckHARDWARE_SetPowerManagementState( { /* Start the command processor. */ gcmkONERROR(gckCOMMAND_Start(command)); - commandStarted = gcvTRUE; if (Hardware->startIsr) { /* Start the Isr. */ gcmkONERROR(Hardware->startIsr(Hardware->isrContext)); - isrStarted = gcvTRUE; } /* Set NEW MMU. */ @@ -4187,16 +4203,6 @@ gckHARDWARE_SetPowerManagementState( return gcvSTATUS_OK; OnError: - if (commandStarted) - { - gcmkVERIFY_OK(gckCOMMAND_Stop(command, gcvFALSE)); - } - - if (isrStarted) - { - gcmkVERIFY_OK(Hardware->stopIsr(Hardware->isrContext)); - } - if (commitEntered) { /* Release the command queue mutex. */ @@ -4280,29 +4286,29 @@ gckHARDWARE_SetFscaleValue( gcmkVERIFY_ARGUMENT(FscaleValue > 0 && FscaleValue <= 64); + Hardware->powerOnFscaleVal = FscaleValue; + gcmkONERROR( gckOS_AcquireMutex(Hardware->os, Hardware->powerMutex, gcvINFINITE)); acquired = gcvTRUE; - Hardware->powerOnFscaleVal = FscaleValue; - if (Hardware->chipPowerState == gcvPOWER_ON) { gctUINT32 data; gcmkONERROR( - gckOS_ReadRegisterEx(Hardware->os, - Hardware->core, + gckOS_ReadRegisterEx(Hardware->os, + Hardware->core, Hardware->powerBaseAddress - + 0x00104, + + 0x00104, &data)); /* Disable all clock gating. */ gcmkONERROR( - gckOS_WriteRegisterEx(Hardware->os, - Hardware->core, + gckOS_WriteRegisterEx(Hardware->os, + Hardware->core, Hardware->powerBaseAddress - + 0x00104, + + 0x00104, ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 2:2) - (0 ? 2:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 2:2) - (0 ? 2:2) + 1))))))) << (0 ? 2:2))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 2:2) - (0 ? 2:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 2:2) - (0 ? 2:2) + 1))))))) << (0 ? 2:2))) @@ -4315,16 +4321,13 @@ gckHARDWARE_SetFscaleValue( | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))) | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 11:11) - (0 ? 11:11) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 11:11) - (0 ? 11:11) + 1))))))) << (0 ? 11:11))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 11:11) - (0 ? 11:11) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 11:11) - (0 ? 11:11) + 1))))))) << (0 ? 11:11))))); - clock = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) - | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 1:1) - (0 ? 1:1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:1) - (0 ? 1:1) + 1))))))) << (0 ? 1:1))) - | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) | (((gctUINT32) ((gctUINT32) (FscaleValue) & ((gctUINT32) ((((1 ? 8:2) - (0 ? 8:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:2) - (0 ? 8:2) + 1))))))) << (0 ? 8:2))) - | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))); + gcmkONERROR(_GetClock(Hardware, gcvPOWER_ON, &clock)); gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00000, clock)); - + /* Done loading the frequency scaler. */ gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, @@ -4333,11 +4336,12 @@ gckHARDWARE_SetFscaleValue( /* Restore all clock gating. */ gcmkONERROR( - gckOS_WriteRegisterEx(Hardware->os, - Hardware->core, + gckOS_WriteRegisterEx(Hardware->os, + Hardware->core, Hardware->powerBaseAddress - + 0x00104, + + 0x00104, data)); + } gcmkVERIFY(gckOS_ReleaseMutex(Hardware->os, Hardware->powerMutex)); @@ -4778,7 +4782,7 @@ _ResetGPU( { /* Disable clock gating. */ gcmkONERROR(gckOS_WriteRegisterEx(Os, - Core, + Core, Hardware->powerBaseAddress + 0x00104, 0x00000000)); @@ -4803,7 +4807,7 @@ _ResetGPU( gcmkONERROR(gckOS_WriteRegisterEx(Os, Core, - 0x00000, + 0x00000, ((((gctUINT32) (0x00000900)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))))); gcmkONERROR(gckOS_WriteRegisterEx(Os, 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 15ed52c75208..6db55222b9b3 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c @@ -833,12 +833,6 @@ gckKERNEL_Dispatch( case gcvHAL_FREE_NON_PAGED_MEMORY: physical = 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)); - /* Free non-paged memory. */ gcmkONERROR( gckOS_FreeNonPagedMemory(Kernel->os, @@ -885,12 +879,6 @@ gckKERNEL_Dispatch( case gcvHAL_FREE_CONTIGUOUS_MEMORY: physical = 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)); - /* Free contiguous memory. */ gcmkONERROR( gckOS_FreeContiguous(Kernel->os, @@ -1941,7 +1929,6 @@ gckKERNEL_Dispatch( status = gcvSTATUS_NOT_SUPPORTED; #endif break; - default: /* Invalid command. */ gcmkONERROR(gcvSTATUS_INVALID_ARGUMENT); @@ -2102,24 +2089,6 @@ gckKERNEL_AttachProcessEx( Kernel->db->lastProcessID = PID; } -#if gcdENABLE_VG - if (Kernel->vg == gcvNULL) -#endif - { - status = gckEVENT_Submit(Kernel->eventObj, gcvTRUE, gcvFALSE); - - if (status == gcvSTATUS_INTERRUPTED && Kernel->eventObj->submitTimer) - { - gcmkONERROR(gckOS_StartTimer(Kernel->os, - Kernel->eventObj->submitTimer, - 1)); - } - else - { - gcmkONERROR(status); - } - } - /* Decrement the number of clients attached. */ gcmkONERROR( gckOS_AtomDecrement(Kernel->os, Kernel->atomClients, &old)); 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 1f3c9ccc20a8..e4322aab2499 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h @@ -530,8 +530,6 @@ struct _gckEVENT gcsEVENT_QUEUE_PTR freeList; gcsEVENT_QUEUE repoList[gcdREPO_LIST_COUNT]; gctPOINTER eventListMutex; - - gctPOINTER submitTimer; }; /* Free all events belonging to a process. */ 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 fbaff6666a10..e05a143f41c3 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 @@ -2640,12 +2640,6 @@ gckCOMMAND_Detach( /* Construct a gckCONTEXT object. */ gcmkONERROR(gckCONTEXT_Destroy(Context)); - if (Command->currContext == Context) - { - /* Detach from gckCOMMAND object if the destoryed context is current context. */ - Command->currContext = gcvNULL; - } - /* Release the context switching mutex. */ gcmkONERROR(gckOS_ReleaseMutex(Command->os, Command->mutexContext)); acquired = gcvFALSE; 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 e5b659262a46..227ab683778e 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 @@ -97,30 +97,6 @@ gcsQUEUE_UPDATE_CONTROL; /******************************************************************************\ ********************************* Support Code ********************************* \******************************************************************************/ -static gceSTATUS -_FlushMMU( - IN gckVGCOMMAND Command - ) -{ - gceSTATUS status; - gctUINT32 oldValue; - gckVGHARDWARE hardware = Command->hardware; - - gcmkONERROR(gckOS_AtomicExchange(Command->os, - hardware->pageTableDirty, - 0, - &oldValue)); - - if (oldValue) - { - /* Page Table is upated, flush mmu before commit. */ - gcmkONERROR(gckVGHARDWARE_FlushMMU(hardware)); - } - - return gcvSTATUS_OK; -OnError: - return status; -} static gceSTATUS _WaitForIdle( @@ -601,67 +577,6 @@ _FreeTaskContainer( } } -gceSTATUS -_RemoveRecordFromProcesDB( - IN gckVGCOMMAND Command, - IN gcsTASK_HEADER_PTR Task - ) -{ - gcsTASK_PTR task = (gcsTASK_PTR)((gctUINT8_PTR)Task - sizeof(gcsTASK)); - gcsTASK_FREE_VIDEO_MEMORY_PTR freeVideoMemory; - gcsTASK_UNLOCK_VIDEO_MEMORY_PTR unlockVideoMemory; - gctINT pid; - gctUINT32 size; - - /* Get the total size of all tasks. */ - size = task->size; - - gcmkVERIFY_OK(gckOS_GetProcessID((gctUINT32_PTR)&pid)); - - do - { - switch (Task->id) - { - case gcvTASK_FREE_VIDEO_MEMORY: - freeVideoMemory = (gcsTASK_FREE_VIDEO_MEMORY_PTR)Task; - - /* Remove record from process db. */ - gcmkVERIFY_OK(gckKERNEL_RemoveProcessDB( - Command->kernel->kernel, - pid, - gcvDB_VIDEO_MEMORY, - freeVideoMemory->node)); - - /* Advance to next task. */ - size -= sizeof(gcsTASK_FREE_VIDEO_MEMORY); - Task = (gcsTASK_HEADER_PTR)(freeVideoMemory + 1); - - break; - case gcvTASK_UNLOCK_VIDEO_MEMORY: - unlockVideoMemory = (gcsTASK_UNLOCK_VIDEO_MEMORY_PTR)Task; - - /* Remove record from process db. */ - gcmkVERIFY_OK(gckKERNEL_RemoveProcessDB( - Command->kernel->kernel, - pid, - gcvDB_VIDEO_MEMORY_LOCKED, - unlockVideoMemory->node)); - - /* Advance to next task. */ - size -= sizeof(gcsTASK_UNLOCK_VIDEO_MEMORY); - Task = (gcsTASK_HEADER_PTR)(unlockVideoMemory + 1); - - break; - default: - /* Skip the whole task. */ - size = 0; - break; - } - } - while(size); - - return gcvSTATUS_OK; -} /******************************************************************************\ ********************************* Task Scheduling ****************************** @@ -786,8 +701,6 @@ _ScheduleTasks( { gcsTASK_HEADER_PTR taskHeader = (gcsTASK_HEADER_PTR) (userTask + 1); - gcmkVERIFY_OK(_RemoveRecordFromProcesDB(Command, taskHeader)); - gcmkTRACE_ZONE( gcvLEVEL_VERBOSE, gcvZONE_COMMAND, " task ID = %d, size = %d\n", @@ -3450,8 +3363,6 @@ gckVGCOMMAND_Commit( break; } #endif - gcmkERR_BREAK(_FlushMMU(Command)); - do { /* Assign a context ID if not yet assigned. */ 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 9dbb9d3cab25..d94d8e2d6704 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 @@ -1144,12 +1144,6 @@ gckKERNEL_DestroyProcessDB( break; case gcvDB_NON_PAGED: - /* Unmap user logical memory first. */ - status = gckOS_UnmapUserLogical(Kernel->os, - record->physical, - record->bytes, - record->data); - /* Free the non paged memory. */ status = gckOS_FreeNonPagedMemory(Kernel->os, record->bytes, @@ -1162,18 +1156,11 @@ gckKERNEL_DestroyProcessDB( break; case gcvDB_CONTIGUOUS: - /* Unmap user logical memory first. */ - status = gckOS_UnmapUserLogical(Kernel->os, - record->physical, - record->bytes, - record->data); - /* Free the contiguous memory. */ - status = gckEVENT_FreeContiguousMemory(Kernel->eventObj, - record->bytes, - record->physical, - record->data, - gcvKERNEL_PIXEL); + status = gckOS_FreeContiguous(Kernel->os, + record->physical, + record->data, + record->bytes); gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE, "DB: CONTIGUOUS 0x%x bytes=%lu (status=%d)", 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 d38312d3bf9b..6c518488871d 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 @@ -344,15 +344,6 @@ __RemoveRecordFromProcessDB( return gcvSTATUS_OK; } -void -_SubmitTimerFunction( - gctPOINTER Data - ) -{ - gckEVENT event = (gckEVENT)Data; - gcmkVERIFY_OK(gckEVENT_Submit(event, gcvTRUE, gcvFALSE)); -} - /******************************************************************************\ ******************************* gckEVENT API Code ******************************* \******************************************************************************/ @@ -445,11 +436,6 @@ gckEVENT_Construct( gcmkONERROR(gckOS_AtomConstruct(os, &eventObj->pending)); #endif - gcmkVERIFY_OK(gckOS_CreateTimer(os, - _SubmitTimerFunction, - (gctPOINTER)eventObj, - &eventObj->submitTimer)); - /* Return pointer to the gckEVENT object. */ *Event = eventObj; @@ -531,12 +517,6 @@ gckEVENT_Destroy( /* Verify the arguments. */ gcmkVERIFY_OBJECT(Event, gcvOBJ_EVENT); - if (Event->submitTimer != gcvNULL) - { - gcmkVERIFY_OK(gckOS_StopTimer(Event->os, Event->submitTimer)); - gcmkVERIFY_OK(gckOS_DestoryTimer(Event->os, Event->submitTimer)); - } - /* Delete the queue mutex. */ gcmkVERIFY_OK(gckOS_DeleteMutex(Event->os, Event->eventQueueMutex)); @@ -982,31 +962,6 @@ gckEVENT_AddList( queue->tail = record; } - /* Unmap user space logical address. - * Linux kernel does not support unmap the memory of other process any more since 3.5. - * Let's unmap memory of self process before submit the event to gpu. - * */ - switch(Interface->command) - { - case gcvHAL_FREE_NON_PAGED_MEMORY: - gcmkONERROR(gckOS_UnmapUserLogical( - Event->os, - Interface->u.FreeNonPagedMemory.physical, - Interface->u.FreeNonPagedMemory.bytes, - 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)); - break; - default: - break; - } - - /* Release the mutex. */ gcmkONERROR(gckOS_ReleaseMutex(Event->os, Event->eventListMutex)); 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 9012599b1bef..f7a70ac96f58 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 @@ -79,23 +79,6 @@ static gcsSharedPageTable_PTR sharedPageTable = gcvNULL; #endif static gceSTATUS -_FillPageTable( - IN gctUINT32_PTR PageTable, - IN gctUINT32 PageCount, - IN gctUINT32 EntryValue -) -{ - gctUINT i; - - for (i = 0; i < PageCount; i++) - { - PageTable[i] = EntryValue; - } - - return gcvSTATUS_OK; -} - -static gceSTATUS _Link( IN gckMMU Mmu, IN gctUINT32 Index, @@ -1053,7 +1036,7 @@ gckMMU_AllocatePages( } /* Mark node as used. */ - gcmkONERROR(_FillPageTable(&pageTable[index], PageCount, gcvMMU_USED)); + pageTable[index] = gcvMMU_USED; /* Return pointer to page table. */ *PageTable = &pageTable[index]; @@ -1129,8 +1112,6 @@ gckMMU_FreePages( ) { gctUINT32_PTR pageTable; - gceSTATUS status; - gctBOOL acquired = gcvFALSE; gcmkHEADER_ARG("Mmu=0x%x PageTable=0x%x PageCount=%lu", Mmu, PageTable, PageCount); @@ -1143,11 +1124,7 @@ gckMMU_FreePages( /* Convert the pointer. */ pageTable = (gctUINT32_PTR) PageTable; - gcmkONERROR(gckOS_AcquireMutex(Mmu->os, Mmu->pageTableMutex, gcvINFINITE)); - acquired = gcvTRUE; - #if gcdMMU_CLEAR_VALUE - if (Mmu->hardware->mmuVersion == 0) { gctUINT32 i; @@ -1173,21 +1150,9 @@ gckMMU_FreePages( /* We have free nodes. */ Mmu->freeNodes = gcvTRUE; - gcmkVERIFY_OK(gckOS_ReleaseMutex(Mmu->os, Mmu->pageTableMutex)); - acquired = gcvFALSE; - /* Success. */ gcmkFOOTER_NO(); return gcvSTATUS_OK; - -OnError: - if (acquired) - { - gcmkVERIFY_OK(gckOS_ReleaseMutex(Mmu->os, Mmu->pageTableMutex)); - } - - gcmkFOOTER(); - return status; } gceSTATUS 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 46d1761dac2c..a4a5e0c802f5 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 @@ -344,6 +344,9 @@ gceSTATUS gckVGMMU_AllocatePages( if (!allocated) { + /* Flush the MMU. */ + status = gckVGHARDWARE_FlushMMU(Mmu->hardware); + if (status >= 0) { /* Walk all entries until we find enough slots. */ @@ -503,22 +506,4 @@ gckVGMMU_SetPage( return gcvSTATUS_OK; } -gceSTATUS -gckVGMMU_Flush( - IN gckVGMMU Mmu - ) -{ - gckVGHARDWARE hardware; - - gcmkHEADER_ARG("Mmu=0x%x", Mmu); - - hardware = Mmu->hardware; - gcmkVERIFY_OK( - gckOS_AtomSet(hardware->os, hardware->pageTableDirty, 1)); - - /* Success. */ - gcmkFOOTER_NO(); - return gcvSTATUS_OK; -} - #endif /* gcdENABLE_VG */ 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 ee63e9b59373..bb5330c2bbb0 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 @@ -438,14 +438,6 @@ gceSTATUS gckVGKERNEL_Dispatch( break; case gcvHAL_FREE_NON_PAGED_MEMORY: - /* 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 - )); - /* Free non-paged memory. */ gcmkERR_BREAK(gckOS_FreeNonPagedMemory( Kernel->os, @@ -467,14 +459,6 @@ gceSTATUS gckVGKERNEL_Dispatch( break; case gcvHAL_FREE_CONTIGUOUS_MEMORY: - /* 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 - )); - /* Free contiguous memory. */ gcmkERR_BREAK(gckOS_FreeContiguous( Kernel->os, @@ -538,14 +522,6 @@ gceSTATUS gckVGKERNEL_Dispatch( kernelInterface->u.AllocateLinearVideoMemory.type, &kernelInterface->u.AllocateLinearVideoMemory.node )); - - gcmkERR_BREAK(gckKERNEL_AddProcessDB(Kernel, - processID, gcvDB_VIDEO_MEMORY, - Interface->u.AllocateLinearVideoMemory.node, - gcvNULL, - kernelInterface->u.AllocateLinearVideoMemory.bytes - )); - break; case gcvHAL_FREE_VIDEO_MEMORY: @@ -568,13 +544,6 @@ gceSTATUS gckVGKERNEL_Dispatch( gcmkERR_BREAK(gckVIDMEM_Free( Interface->u.FreeVideoMemory.node )); - - gcmkERR_BREAK(gckKERNEL_RemoveProcessDB( - Kernel, - processID, gcvDB_VIDEO_MEMORY, - Interface->u.FreeVideoMemory.node - )); - break; case gcvHAL_MAP_MEMORY: @@ -668,12 +637,6 @@ gceSTATUS gckVGKERNEL_Dispatch( Interface->u.LockVideoMemory.address = gcmPTR2INT(Interface->u.LockVideoMemory.memory); #endif - gcmkERR_BREAK( - gckKERNEL_AddProcessDB(Kernel, - processID, gcvDB_VIDEO_MEMORY_LOCKED, - Interface->u.LockVideoMemory.node, - gcvNULL, - 0)); break; case gcvHAL_UNLOCK_VIDEO_MEMORY: @@ -711,16 +674,6 @@ gceSTATUS gckVGKERNEL_Dispatch( bytes)); } #endif - - if (Interface->u.UnlockVideoMemory.asynchroneous == gcvFALSE) - { - /* There isn't a event to unlock this node, remove record now */ - gcmkERR_BREAK( - gckKERNEL_RemoveProcessDB(Kernel, - processID, gcvDB_VIDEO_MEMORY_LOCKED, - Interface->u.UnlockVideoMemory.node)); - } - break; case gcvHAL_USER_SIGNAL: #if !USE_NEW_LINUX_SIGNAL 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 dc39b3927fff..9d6da636755c 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 @@ -1830,11 +1830,7 @@ gckVIDMEM_Lock( #endif #if gcdENABLE_VG - if (Kernel->core == gcvCORE_VG) - { - gcmkONERROR(gckVGMMU_Flush(Kernel->vg->mmu)); - } - else + if (Kernel->core != gcvCORE_VG) #endif { gcmkONERROR(gckMMU_Flush(Kernel->mmu)); 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 5bf887054e04..c976f7e9b7c1 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h @@ -30,9 +30,8 @@ #include "gc_hal_base.h" #include "gc_hal_profiler.h" #include "gc_hal_driver.h" -#ifndef VIVANTE_NO_3D #include "gc_hal_statistics.h" -#endif + #ifdef __cplusplus extern "C" { @@ -506,17 +505,6 @@ gckOS_UnmapMemory( IN gctPOINTER Logical ); -/* Unmap user logical memory out of physical memory. - * This function is only supported in Linux currently. - */ -gceSTATUS -gckOS_UnmapUserLogical( - IN gckOS Os, - IN gctPHYS_ADDR Physical, - IN gctSIZE_T Bytes, - IN gctPOINTER Logical - ); - /* Create a new mutex. */ gceSTATUS gckOS_CreateMutex( @@ -1964,22 +1952,6 @@ gckHARDWARE_QueryPowerManagementState( OUT gceCHIPPOWERSTATE* State ); -#if gcdENABLE_FSCALE_VAL_ADJUST -gceSTATUS -gckHARDWARE_SetFscaleValue( - IN gckHARDWARE Hardware, - IN gctUINT32 FscaleValue - ); - -gceSTATUS -gckHARDWARE_GetFscaleValue( - IN gckHARDWARE Hardware, - IN gctUINT * FscaleValue, - IN gctUINT * MinFscaleValue, - IN gctUINT * MaxFscaleValue - ); -#endif - #if gcdPOWEROFF_TIMEOUT gceSTATUS gckHARDWARE_SetPowerOffTimeout( 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 86ab105b389a..4f8901db0ab5 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 @@ -174,16 +174,7 @@ typedef void * HALNativePixmapType; #endif -/* define DUMMY according to the system */ -#if defined(EGL_API_WL) -# define WL_DUMMY (31415926) -# define EGL_DUMMY WL_DUMMY -#elif defined(__ANDROID__) || defined(ANDROID) -# define ANDROID_DUMMY (31415926) -# define EGL_DUMMY ANDROID_DUMMY -#else -# define EGL_DUMMY (31415926) -#endif + /******************************************************************************* ** Display. ******************************************************************** @@ -258,19 +249,6 @@ gcoOS_SetDisplayVirtual( ); gceSTATUS -gcoOS_SetSwapInterval( - IN HALNativeDisplayType Display, - IN gctINT Interval -); - -gceSTATUS -gcoOS_GetSwapInterval( - IN HALNativeDisplayType Display, - IN gctINT_PTR Min, - IN gctINT_PTR Max -); - -gceSTATUS gcoOS_DisplayBufferRegions( IN HALNativeDisplayType Display, IN HALNativeWindowType Window, 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 7400b3201b91..9aa2fe596f32 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 @@ -1463,21 +1463,6 @@ gcoTEXTURE_UploadCompressed( IN gctSIZE_T Bytes ); -/* Upload compressed sub data to an gcoTEXTURE object. */ -gceSTATUS -gcoTEXTURE_UploadCompressedSub( - IN gcoTEXTURE Texture, - IN gctUINT MipMap, - IN gceTEXTURE_FACE Face, - IN gctUINT XOffset, - IN gctUINT YOffset, - IN gctUINT Width, - IN gctUINT Height, - IN gctUINT Slice, - IN gctCONST_POINTER Memory, - IN gctSIZE_T Size - ); - /* Get gcoSURF object for a mipmap level. */ gceSTATUS gcoTEXTURE_GetMipMap( 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 d951c3a965d9..b2e36a258da8 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 @@ -209,14 +209,10 @@ typedef enum _gceSURF_TYPE #if gcdANDROID_UNALIGNED_LINEAR_COMPOSITION_ADJUST gcvSURF_FLIP = 0x800, /* The Resolve Target the will been flip resolve from RT */ #endif - gcvSURF_TILE_STATUS_DIRTY = 0x1000, /* Init tile status to all dirty */ gcvSURF_RENDER_TARGET_NO_TILE_STATUS = gcvSURF_RENDER_TARGET | gcvSURF_NO_TILE_STATUS, - gcvSURF_RENDER_TARGET_TS_DIRTY = gcvSURF_RENDER_TARGET - | gcvSURF_TILE_STATUS_DIRTY, - gcvSURF_DEPTH_NO_TILE_STATUS = gcvSURF_DEPTH | gcvSURF_NO_TILE_STATUS, @@ -650,12 +646,6 @@ typedef enum _gce2D_QUERY } gce2D_QUERY; -typedef enum _gce2D_STATE -{ - gcv2D_STATE_SPECIAL_FILTER_MIRROR_MODE = 1, -} -gce2D_STATE; - #ifndef VIVANTE_NO_3D /* Texture functions. */ typedef enum _gceTEXTURE_FUNCTION 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 33fddfbbfed2..d1ddd004dc3c 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 @@ -161,14 +161,6 @@ #endif /* - gcdENABLE_FSCALE_VAL_ADJUST - When non-zero, FSCALE_VAL when gcvPOWER_ON can be adjusted externally. - */ -#ifndef gcdENABLE_FSCALE_VAL_ADJUST -# define gcdENABLE_FSCALE_VAL_ADJUST 1 -#endif - -/* gcdDUMP_IN_KERNEL When set to 1, all dumps will happen in the kernel. This is handy if @@ -773,7 +765,7 @@ limited by gcdCONTIGUOUS_SIZE_LIMIT. */ #ifndef gcdCONTIGUOUS_SIZE_LIMIT -# define gcdCONTIGUOUS_SIZE_LIMIT 4096 +# define gcdCONTIGUOUS_SIZE_LIMIT 0 #endif /* gcdALPHA_KILL_IN_SHADER 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 e3ceadfce7ee..53e9cc6e760b 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 @@ -950,13 +950,6 @@ gco2D_QueryU32( OUT gctUINT32_PTR Value ); -gceSTATUS -gco2D_SetStateU32( - IN gco2D Engine, - IN gce2D_STATE State, - IN OUT gctUINT32_PTR Value - ); - #ifdef __cplusplus } #endif 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 87311376e640..372c8ac7817f 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 @@ -895,12 +895,6 @@ gckVGMMU_SetPage( IN gctUINT32 *PageEntry ); -/* Flush MMU */ -gceSTATUS -gckVGMMU_Flush( - IN gckVGMMU Mmu - ); - #endif /* gcdENABLE_VG */ #ifdef __cplusplus 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 b326463b8133..02aaf81faf95 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 @@ -495,7 +495,7 @@ long drv_ioctl( } iface.u.ChipInfo.count = count; - iface.status = status = gcvSTATUS_OK; + status = gcvSTATUS_OK; } else { 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 a44180bfc71a..4091ccdb61d4 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 @@ -38,7 +38,6 @@ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23) #include <linux/math64.h> #endif -#include <linux/delay.h> #define _GC_OBJ_ZONE gcvZONE_OS @@ -1161,24 +1160,32 @@ _UnmapUserLogical( IN gctUINT32 Size ) { - if (unlikely(current->mm == gcvNULL)) + struct task_struct *task; + struct mm_struct *mm; + + /* Get the task_struct of the task with stored pid. */ + rcu_read_lock(); + + task = FIND_TASK_BY_PID(Pid); + + if (task == gcvNULL) { - /* Do nothing if process is exiting. */ + rcu_read_unlock(); return; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) - if (vm_munmap((unsigned long)Logical, Size) < 0) + /* Get the mm_struct. */ + mm = get_task_mm(task); + + rcu_read_unlock(); + + if (mm == gcvNULL) { - gcmkTRACE_ZONE( - gcvLEVEL_WARNING, gcvZONE_OS, - "%s(%d): vm_munmap failed", - __FUNCTION__, __LINE__ - ); + return; } -#else - down_write(¤t->mm->mmap_sem); - if (do_munmap(current->mm, (unsigned long)Logical, Size) < 0) + + down_write(&mm->mmap_sem); + if (do_munmap(mm, (unsigned long)Logical, Size) < 0) { gcmkTRACE_ZONE( gcvLEVEL_WARNING, gcvZONE_OS, @@ -1186,8 +1193,10 @@ _UnmapUserLogical( __FUNCTION__, __LINE__ ); } - up_write(¤t->mm->mmap_sem); -#endif + up_write(&mm->mmap_sem); + + /* Dereference. */ + mmput(mm); } /******************************************************************************* @@ -1976,55 +1985,6 @@ gckOS_UnmapMemoryEx( /******************************************************************************* ** -** gckOS_UnmapUserLogical -** -** Unmap user logical memory out of physical memory. -** -** INPUT: -** -** gckOS Os -** Pointer to an gckOS object. -** -** gctPHYS_ADDR Physical -** Start of physical address memory. -** -** gctSIZE_T Bytes -** Number of bytes to unmap. -** -** gctPOINTER Memory -** Pointer to a previously mapped memory region. -** -** OUTPUT: -** -** Nothing. -*/ -gceSTATUS -gckOS_UnmapUserLogical( - IN gckOS Os, - IN gctPHYS_ADDR Physical, - IN gctSIZE_T Bytes, - IN gctPOINTER Logical - ) -{ - gcmkHEADER_ARG("Os=0x%X Physical=0x%X Bytes=%lu Logical=0x%X", - Os, Physical, Bytes, Logical); - - /* Verify the arguments. */ - gcmkVERIFY_OBJECT(Os, gcvOBJ_OS); - gcmkVERIFY_ARGUMENT(Physical != 0); - gcmkVERIFY_ARGUMENT(Bytes > 0); - gcmkVERIFY_ARGUMENT(Logical != gcvNULL); - - gckOS_UnmapMemory(Os, Physical, Bytes, Logical); - - /* Success. */ - gcmkFOOTER_NO(); - return gcvSTATUS_OK; - -} - -/******************************************************************************* -** ** gckOS_AllocateNonPagedMemory ** ** Allocate a number of pages from non-paged memory. @@ -2419,8 +2379,8 @@ gceSTATUS gckOS_FreeNonPagedMemory( { if (mdlMap->vmaAddr != gcvNULL) { - /* No mapped memory exists when free nonpaged memory */ - gcmkASSERT(0); + _UnmapUserLogical(mdlMap->pid, mdlMap->vmaAddr, mdl->numPages * PAGE_SIZE); + mdlMap->vmaAddr = gcvNULL; } mdlMap = mdlMap->next; @@ -3804,14 +3764,24 @@ gckOS_Delay( if (Delay > 0) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) - ktime_t delay = ktime_set(0, Delay * NSEC_PER_MSEC); - __set_current_state(TASK_UNINTERRUPTIBLE); - schedule_hrtimeout(&delay, HRTIMER_MODE_REL); +#if gcdHIGH_PRECISION_DELAY_ENABLE + ktime_t wait = ns_to_ktime(Delay * 1000 * 1000); + set_current_state(TASK_INTERRUPTIBLE); + schedule_hrtimeout(&wait, HRTIMER_MODE_REL); #else - msleep(Delay); -#endif + struct timeval now; + unsigned long jiffies; + + /* Convert milliseconds into seconds and microseconds. */ + now.tv_sec = Delay / 1000; + now.tv_usec = (Delay % 1000) * 1000; + /* Convert timeval to jiffies. */ + jiffies = timeval_to_jiffies(&now); + + /* Schedule timeout. */ + schedule_timeout_interruptible(jiffies); +#endif } /* Success. */ @@ -5674,11 +5644,7 @@ OnError: } #if gcdENABLE_VG - if (Core == gcvCORE_VG) - { - gcmkONERROR(gckVGMMU_Flush(Os->device->kernels[Core]->vg->mmu)); - } - else + if (Core != gcvCORE_VG) #endif { gcmkONERROR(gckMMU_Flush(Os->device->kernels[Core]->mmu)); |