diff options
author | b02279 <b02279@b02279-Ubuntu64.(none)> | 2012-02-17 16:17:30 +0800 |
---|---|---|
committer | b02279 <b02279@b02279-Ubuntu64.(none)> | 2012-02-21 15:44:35 +0800 |
commit | 18b85d67cc31211a0ef7ef0302be7acbe49f6536 (patch) | |
tree | 3dfd6d405788684ee65fcc33bd901f742c8fb213 /drivers/mxc/gpu-viv/hal/os/linux/kernel | |
parent | d515de560f6f29c7ffe0e6cce811d6625b7a94b5 (diff) |
ENGR00174654 Update gpu kernel driver to vivante 4.6.5 release
Signed-off-by: Loren Huang <b02279@freescale.com>
Acked-by: Lily Zhang
Diffstat (limited to 'drivers/mxc/gpu-viv/hal/os/linux/kernel')
9 files changed, 262 insertions, 185 deletions
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 d6ceba73e41e..5bbc893c4894 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 - 2011 by Vivante Corp. +* Copyright (C) 2005 - 2012 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_device.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c index 8b25b9fdc533..62aac98194ed 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 - 2011 by Vivante Corp. +* Copyright (C) 2005 - 2012 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 @@ -22,7 +22,7 @@ #include "gc_hal_kernel_linux.h" -#include <linux/pagemap.h> +/*#include <linux/pagemap.h>*/ #include <linux/seq_file.h> #include <linux/mm.h> #include <linux/mman.h> @@ -136,9 +136,9 @@ static int threadRoutine(void *ctxt) for (;;) { - static int down; - + int down; down = down_interruptible(&device->semas[gcvCORE_MAJOR]); + if (down); device->dataReadys[gcvCORE_MAJOR] = gcvFALSE; if (device->killThread == gcvTRUE) @@ -188,9 +188,10 @@ static int threadRoutine2D(void *ctxt) for (;;) { - static int down; + int down; down = down_interruptible(&device->semas[gcvCORE_2D]); + if (down); device->dataReadys[gcvCORE_2D] = gcvFALSE; if (device->killThread == gcvTRUE) @@ -238,9 +239,10 @@ static int threadRoutineVG(void *ctxt) for (;;) { - static int down; + int down; down = down_interruptible(&device->semas[gcvCORE_VG]); + if (down); device->dataReadys[gcvCORE_VG] = gcvFALSE; if (device->killThread == gcvTRUE) @@ -564,20 +566,12 @@ gckGALDEVICE_Construct( /* Start the command queue. */ gcmkONERROR(gckCOMMAND_Start(device->kernels[gcvCORE_2D]->command)); #endif - -#if gcdMULTICORE_MAPPING - device->kernels[gcvCORE_2D]->anotherKernel = device->kernels[gcvCORE_MAJOR]; -#endif } else { device->kernels[gcvCORE_2D] = gcvNULL; } -#if gcdMULTICORE_MAPPING - device->kernels[gcvCORE_MAJOR]->anotherKernel = device->kernels[gcvCORE_2D]; -#endif - if (IrqLineVG != -1) { #if gcdENABLE_VG 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 86333ba34732..923978daf507 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 - 2011 by Vivante Corp. +* Copyright (C) 2005 - 2012 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 @@ -82,6 +82,9 @@ typedef struct _gckGALDEVICE /* Core mapping */ gceCORE coreMapping[8]; + /* States before suspend. */ + gceCHIPPOWERSTATE statesStored[gcdCORE_COUNT]; + /* Clock management.*/ struct clk *clk_3d_core; struct clk *clk_3d_shader; 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 b1c82e0ef311..5db0626dda59 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 - 2011 by Vivante Corp. +* Copyright (C) 2005 - 2012 by Vivante Corp. * Copyright (C) 2011 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or modify @@ -479,6 +479,20 @@ long drv_ioctl( } else { + if (iface.command == gcvHAL_CACHE) + { + if (device->contiguousMapped + && iface.u.Cache.node->VidMem.memory->object.type == gcvOBJ_VIDMEM) + { + iface.u.Cache.physical = (gctPOINTER)device->contiguousVidMem->baseAddress + + (iface.u.Cache.logical - data->mappedMemory); + } + else + { + iface.u.Cache.physical = 0; + } + } + if (iface.hardwareType < 0 || iface.hardwareType > 7) { gcmkTRACE_ZONE( @@ -976,6 +990,23 @@ static int __devinit gpu_suspend(struct platform_device *dev, pm_message_t state { if (device->kernels[i] != gcvNULL) { + /* Store states. */ +#if gcdENABLE_VG + if (i == gcvCORE_VG) + { + status = gckVGHARDWARE_QueryPowerManagementState(device->kernels[i]->vg->hardware, &device->statesStored[i]); + } + else +#endif + { + status = gckHARDWARE_QueryPowerManagementState(device->kernels[i]->hardware, &device->statesStored[i]); + } + + if (gcmIS_ERROR(status)) + { + return -1; + } + #if gcdENABLE_VG if (i == gcvCORE_VG) { @@ -1004,6 +1035,7 @@ static int __devinit gpu_resume(struct platform_device *dev) gceSTATUS status; gckGALDEVICE device; gctINT i; + gceCHIPPOWERSTATE statesStored; device = platform_get_drvdata(dev); @@ -1026,6 +1058,43 @@ static int __devinit gpu_resume(struct platform_device *dev) { return -1; } + + /* Convert global state to crossponding internal state. */ + switch(device->statesStored[i]) + { + case gcvPOWER_OFF: + statesStored = gcvPOWER_OFF_BROADCAST; + break; + case gcvPOWER_IDLE: + statesStored = gcvPOWER_IDLE_BROADCAST; + break; + case gcvPOWER_SUSPEND: + statesStored = gcvPOWER_SUSPEND_BROADCAST; + break; + case gcvPOWER_ON: + statesStored = gcvPOWER_ON_AUTO; + break; + default: + statesStored = device->statesStored[i]; + break; + } + + /* Restore states. */ +#if gcdENABLE_VG + if (i == gcvCORE_VG) + { + status = gckVGHARDWARE_SetPowerManagementState(device->kernels[i]->vg->hardware, statesStored); + } + else +#endif + { + status = gckHARDWARE_SetPowerManagementState(device->kernels[i]->hardware, statesStored); + } + + if (gcmIS_ERROR(status)) + { + return -1; + } } } 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 497cf5571d85..cba2040e8eb3 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 - 2011 by Vivante Corp. +* Copyright (C) 2005 - 2012 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_linux.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h index 067c7400859c..6b69f0cec08b 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 - 2011 by Vivante Corp. +* Copyright (C) 2005 - 2012 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_math.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_math.c index 80e449576349..a4cb7176e564 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 - 2011 by Vivante Corp. +* Copyright (C) 2005 - 2012 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_os.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c index 9a6376e43ced..0f0d05c47f13 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 - 2011 by Vivante Corp. +* Copyright (C) 2005 - 2012 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 @@ -279,7 +279,9 @@ _DumpDebugRegisters( for (i = 0; i < 500; i += 1) { gcmkONERROR(gckOS_WriteRegister(Os, Descriptor->index, select)); +#if !gcdENABLE_RECOVERY gcmkONERROR(gckOS_Delay(Os, 1000)); +#endif gcmkONERROR(gckOS_ReadRegister(Os, Descriptor->data, &data)); if (data == Descriptor->signature) @@ -302,7 +304,9 @@ _DumpDebugRegisters( select = i << Descriptor->shift; gcmkONERROR(gckOS_WriteRegister(Os, Descriptor->index, select)); +#if !gcdENABLE_RECOVERY gcmkONERROR(gckOS_Delay(Os, 1000)); +#endif gcmkONERROR(gckOS_ReadRegister(Os, Descriptor->data, &data)); gcmkPRINT_N(12, " [0x%02X] 0x%08X\n", i, data); @@ -356,16 +360,22 @@ _DumpGPUState( static gcsiDEBUG_REGISTERS _dbgRegs[] = { - { "RA", 0x474, 16, 0x448, 4, 0x12344321 }, - { "TX", 0x474, 24, 0x44C, 4, 0x12211221 }, - { "FE", 0x470, 0, 0x450, 4, 0xBABEF00D }, - { "PE", 0x470, 16, 0x454, 4, 0xBABEF00D }, - { "DE", 0x470, 8, 0x458, 4, 0xBABEF00D }, - { "SH", 0x470, 24, 0x45C, 15, 0xDEADBEEF }, - { "PA", 0x474, 0, 0x460, 4, 0x0000AAAA }, - { "SE", 0x474, 8, 0x464, 4, 0x5E5E5E5E }, - { "MC", 0x478, 0, 0x468, 4, 0x12345678 }, - { "HI", 0x478, 8, 0x46C, 4, 0xAAAAAAAA } + { "RA", 0x474, 16, 0x448, 16, 0x12344321 }, + { "TX", 0x474, 24, 0x44C, 16, 0x12211221 }, + { "FE", 0x470, 0, 0x450, 16, 0xBABEF00D }, + { "PE", 0x470, 16, 0x454, 16, 0xBABEF00D }, + { "DE", 0x470, 8, 0x458, 16, 0xBABEF00D }, + { "SH", 0x470, 24, 0x45C, 16, 0xDEADBEEF }, + { "PA", 0x474, 0, 0x460, 16, 0x0000AAAA }, + { "SE", 0x474, 8, 0x464, 16, 0x5E5E5E5E }, + { "MC", 0x478, 0, 0x468, 16, 0x12345678 }, + { "HI", 0x478, 8, 0x46C, 16, 0xAAAAAAAA } + }; + + static gctUINT32 _otherRegs[] = + { + 0x040, 0x044, 0x04C, 0x050, 0x054, 0x058, 0x05C, 0x060, + 0x43c, 0x440, 0x444, 0x414, }; gceSTATUS status; @@ -494,6 +504,14 @@ _DumpGPUState( gcmkPRINT_N(4, " write = 0x%08X\n", write); } + gcmkPRINT_N(0, " Other Registers:\n"); + for (i = 0; i < gcmCOUNTOF(_otherRegs); i += 1) + { + gctUINT32 read; + gcmkONERROR(gckOS_ReadRegisterEx(Os, kernel->core, _otherRegs[i], &read)); + gcmkPRINT_N(12, " [0x%04X] 0x%08X\n", _otherRegs[i], read); + } + OnError: if (acquired) { @@ -1075,8 +1093,6 @@ gckOS_Construct( /* Create debug lock mutex. */ gcmkONERROR(gckOS_CreateMutex(os, &os->debugLock)); - /* Create the gckHEAP object. */ - gcmkONERROR(gckHEAP_Construct(os, gcdHEAP_SIZE, &os->heap)); os->mdlHead = os->mdlTail = gcvNULL; @@ -1444,7 +1460,7 @@ gckOS_AllocateMemory( } else { - memory = (gctPOINTER) kmalloc(Bytes, GFP_KERNEL); + memory = (gctPOINTER) kmalloc(Bytes, GFP_KERNEL | __GFP_NOWARN); } if (memory == gcvNULL) @@ -4022,7 +4038,6 @@ gckOS_FreePagedMemory( ) { PLINUX_MDL mdl = (PLINUX_MDL) Physical; - gctSTRING addr; gctINT i; gcmkHEADER_ARG("Os=0x%X Physical=0x%X Bytes=%lu", Os, Physical, Bytes); @@ -4032,7 +4047,7 @@ gckOS_FreePagedMemory( gcmkVERIFY_ARGUMENT(Physical != gcvNULL); gcmkVERIFY_ARGUMENT(Bytes > 0); - addr = mdl->addr; + /*addr = mdl->addr;*/ MEMORY_LOCK(Os); @@ -4373,11 +4388,13 @@ gckOS_MapPagesEx( gceSTATUS status = gcvSTATUS_OK; PLINUX_MDL mdl; gctUINT32* table; - gctUINT32 bytes; gctUINT32 offset; +#if gcdNONPAGED_MEMORY_CACHEABLE gckMMU mmu; PLINUX_MDL mmuMdl; + gctUINT32 bytes; gctPHYS_ADDR pageTablePhysical; +#endif gcmkHEADER_ARG("Os=0x%X Core=%d Physical=0x%X PageCount=%u PageTable=0x%X", Os, Core, Physical, PageCount, PageTable); @@ -4403,9 +4420,11 @@ gckOS_MapPagesEx( MEMORY_LOCK(Os); table = (gctUINT32 *)PageTable; - bytes = PageCount * sizeof(*table); +#if gcdNONPAGED_MEMORY_CACHEABLE mmu = Os->device->kernels[Core]->mmu; + bytes = PageCount * sizeof(*table); mmuMdl = (PLINUX_MDL)mmu->pageTablePhysical; +#endif /* Get all the physical addresses and store them in the page table. */ @@ -4488,11 +4507,11 @@ gckOS_MapPagesEx( } } +#if gcdNONPAGED_MEMORY_CACHEABLE /* Get physical address of pageTable */ pageTablePhysical = (gctPHYS_ADDR)(mmuMdl->dmaHandle + ((gctUINT32 *)PageTable - mmu->pageTableLogical)); -#if gcdNONPAGED_MEMORY_CACHEABLE /* Flush the mmu page table cache. */ gcmkONERROR(gckOS_CacheClean( Os, @@ -5175,17 +5194,36 @@ gckOS_WriteMemory( IN gctUINT32 Data ) { + gceSTATUS status; gcmkHEADER_ARG("Os=0x%X Address=0x%X Data=%u", Os, Address, Data); /* Verify the arguments. */ gcmkVERIFY_ARGUMENT(Address != gcvNULL); /* Write memory. */ - writel(Data, (gctUINT8 *)Address); +#if NO_USER_DIRECT_ACCESS_FROM_KERNEL + if (access_ok(VERIFY_WRITE, Address, 4)) + { + /* User address. */ + if(put_user(Data, (gctUINT32*)Address)) + { + gcmkONERROR(gcvSTATUS_INVALID_ADDRESS); + } + } + else +#endif + { + /* Kernel address. */ + *(gctUINT32 *)Address = Data; + } /* Success. */ gcmkFOOTER_NO(); return gcvSTATUS_OK; + +OnError: + gcmkFOOTER(); + return status; } /******************************************************************************* @@ -5252,7 +5290,7 @@ OnError: { gctSIZE_T pageCount, i, j; gctUINT32_PTR pageTable; - gctUINT32 address; + gctUINT32 address = 0, physical = ~0U; gctUINT32 start, end, memory; gctINT result = 0; @@ -5333,39 +5371,60 @@ OnError: { struct vm_area_struct *vma; - vma = find_vma(current->mm, memory); - - if (vma && (vma->vm_flags & VM_PFNMAP) ) + /* Free the page table. */ + if (pages != gcvNULL) { - do + /* Release the pages if any. */ + if (result > 0) { - pte_t * pte; - spinlock_t * ptl; - unsigned long pfn; - - pgd_t * pgd = pgd_offset(current->mm, memory); - pud_t * pud = pud_offset(pgd, memory); - if (pud) + for (i = 0; i < result; i++) { - pmd_t * pmd = pmd_offset(pud, memory); - pte = pte_offset_map_lock(current->mm, pmd, memory, &ptl); - if (!pte) + if (pages[i] == gcvNULL) { break; } + + page_cache_release(pages[i]); } - else + } + + kfree(pages); + pages = gcvNULL; + } + + vma = find_vma(current->mm, memory); + + if (vma && (vma->vm_flags & VM_PFNMAP) ) + { + pte_t * pte; + spinlock_t * ptl; + unsigned long pfn; + + pgd_t * pgd = pgd_offset(current->mm, memory); + pud_t * pud = pud_offset(pgd, memory); + if (pud) + { + pmd_t * pmd = pmd_offset(pud, memory); + pte = pte_offset_map_lock(current->mm, pmd, memory, &ptl); + if (!pte) { - break; + gcmkONERROR(gcvSTATUS_OUT_OF_RESOURCES); } + } + else + { + gcmkONERROR(gcvSTATUS_OUT_OF_RESOURCES); + } - pfn = pte_pfn(*pte); - *Address = ((pfn << PAGE_SHIFT) | (((unsigned long)Memory) & ~PAGE_MASK)) - - Os->device->baseAddress; - *Info = gcvNULL; + pfn = pte_pfn(*pte); - pte_unmap_unlock(pte, ptl); + physical = (pfn << PAGE_SHIFT) | (memory & ~PAGE_MASK); + pte_unmap_unlock(pte, ptl); + + if ((Os->device->kernels[Core]->hardware->mmuVersion == 0) + && !((physical - Os->device->baseAddress) & 0x80000000)) + { /* Release page info struct. */ if (info != gcvNULL) { @@ -5373,54 +5432,42 @@ OnError: kfree(info); } - /* Free the page table. */ - if (pages != gcvNULL) - { - /* Release the pages if any. */ - if (result > 0) - { - for (i = 0; i < result; i++) - { - if (pages[i] == gcvNULL) - { - break; - } - - page_cache_release(pages[i]); - } - } - - kfree(pages); - } - MEMORY_MAP_UNLOCK(Os); + *Address = physical - Os->device->baseAddress; + *Info = gcvNULL; + gcmkFOOTER_ARG("*Info=0x%X *Address=0x%08x", *Info, *Address); + return gcvSTATUS_OK; } - while (gcvFALSE); - - *Address = ~0; - *Info = gcvNULL; - - status = gcvSTATUS_OUT_OF_RESOURCES; - break; } else { - status = gcvSTATUS_OUT_OF_RESOURCES; - break; + gcmkONERROR(gcvSTATUS_OUT_OF_RESOURCES); } } - for (i = 0; i < pageCount; i++) + if (pages) + { + for (i = 0; i < pageCount; i++) + { + /* Flush(clean) the data cache. */ + gcmkONERROR(gckOS_CacheFlush(Os, _GetProcessID(), gcvNULL, + (gctPOINTER)page_to_phys(pages[i]), + (gctPOINTER)(memory & PAGE_MASK) + i*PAGE_SIZE, + PAGE_SIZE)); + } + } + else { /* Flush(clean) the data cache. */ gcmkONERROR(gckOS_CacheFlush(Os, _GetProcessID(), gcvNULL, - (gctPOINTER)page_to_phys(pages[i]), - (gctPOINTER)(memory & PAGE_MASK) + i*PAGE_SIZE, - PAGE_SIZE)); + (gctPOINTER)(physical & PAGE_MASK), + (gctPOINTER)(memory & PAGE_MASK), + PAGE_SIZE * pageCount)); + } #if gcdENABLE_VG @@ -5444,14 +5491,26 @@ OnError: /* Fill the page table. */ for (i = 0; i < pageCount; i++) { + gctUINT32 phys; + gctUINT32_PTR tab = pageTable + i * (PAGE_SIZE/4096); + + if (pages) + { + phys = page_to_phys(pages[i]); + } + else + { + phys = (physical & PAGE_MASK) + i * PAGE_SIZE; + } + #if gcdENABLE_VG if (Core == gcvCORE_VG) { /* Get the physical address from page struct. */ gcmkONERROR( gckVGMMU_SetPage(Os->device->kernels[Core]->vg->mmu, - page_to_phys(pages[i]), - pageTable + i * (PAGE_SIZE/4096))); + phys, + tab)); } else #endif @@ -5459,8 +5518,8 @@ OnError: /* Get the physical address from page struct. */ gcmkONERROR( gckMMU_SetPage(Os->device->kernels[Core]->mmu, - page_to_phys(pages[i]), - pageTable + i * (PAGE_SIZE/4096))); + phys, + tab)); } for (j = 1; j < (PAGE_SIZE/4096); j++) @@ -5468,12 +5527,15 @@ OnError: pageTable[i * (PAGE_SIZE/4096) + j] = pageTable[i * (PAGE_SIZE/4096)] + 4096 * j; } +#if gcdSHARED_PAGETABLE + gcmkONERROR(gckMMU_FlushAllMmuCache()); +#endif + gcmkTRACE_ZONE( gcvLEVEL_INFO, gcvZONE_OS, - "%s(%d): pages[%d]: 0x%X, pageTable[%d]: 0x%X.", + "%s(%d): pageTable[%d]: 0x%X 0x%X.", __FUNCTION__, __LINE__, - i, pages[i], - i, pageTable[i]); + i, phys, pageTable[i]); } /* Save pointer to page table. */ @@ -5575,6 +5637,7 @@ OnError: { gcmkFOOTER(); } + return status; } #endif @@ -5656,6 +5719,8 @@ OnError: do { + /*gctUINT32 physical = ~0U;*/ + info = (gcsPageInfo_PTR) Info; pages = info->pages; @@ -5670,7 +5735,17 @@ OnError: /* Invalid page array. */ if (pages == gcvNULL) { - return gcvSTATUS_INVALID_ARGUMENT; + if (info->pageTable == gcvNULL) + { + kfree(info); + + gcmkFOOTER_ARG("status=%d", gcvSTATUS_INVALID_ARGUMENT); + return gcvSTATUS_INVALID_ARGUMENT; + } + else + { + /*physical = (*info->pageTable) & PAGE_MASK;*/ + } } memory = (gctUINT32) Memory; @@ -5681,12 +5756,14 @@ OnError: /* Overflow. */ if ((memory + Size) < memory) { + gcmkFOOTER_ARG("status=%d", gcvSTATUS_INVALID_ARGUMENT); return gcvSTATUS_INVALID_ARGUMENT; } /* Invalid argument. */ if (pageCount == 0) { + gcmkFOOTER_ARG("status=%d", gcvSTATUS_INVALID_ARGUMENT); return gcvSTATUS_INVALID_ARGUMENT; } @@ -5719,21 +5796,24 @@ OnError: } /* Release the page cache. */ - for (i = 0; i < pageCount; i++) + if (pages) { - gcmkTRACE_ZONE( - gcvLEVEL_INFO, gcvZONE_OS, - "%s(%d): pages[%d]: 0x%X.", - __FUNCTION__, __LINE__, - i, pages[i] - ); - - if (!PageReserved(pages[i])) + for (i = 0; i < pageCount; i++) { - SetPageDirty(pages[i]); - } + gcmkTRACE_ZONE( + gcvLEVEL_INFO, gcvZONE_OS, + "%s(%d): pages[%d]: 0x%X.", + __FUNCTION__, __LINE__, + i, pages[i] + ); - page_cache_release(pages[i]); + if (!PageReserved(pages[i])) + { + SetPageDirty(pages[i]); + } + + page_cache_release(pages[i]); + } } /* Success. */ @@ -6900,75 +6980,6 @@ gckOS_ProfileToMS( #endif } -#if gcdENABLE_BANK_ALIGNMENT -/******************************************************************************* -** gckOS_GetSurfaceBankAlignment -** -** Return the required offset alignment required to the make BaseAddress -** aligned properly. -** -** INPUT: -** -** gckOS Os -** Pointer to gcoOS object. -** -** gceSURF_TYPE Type -** Type of allocation. -** -** gctUINT32 BaseAddress -** Base address of current video memory node. -** -** OUTPUT: -** -** gctUINT32_PTR Alignment -** Pointer to a variable thah twil hold the number of bytes to skip in -** the current video memory node in order to make the alignment bank -** aligned. -*/ -gceSTATUS -gckOS_GetSurfaceBankAlignment( - IN gckOS Os, - IN gceSURF_TYPE Type, - IN gctUINT32 BaseAddress, - OUT gctUINT32_PTR Alignment - ) -{ - gctUINT32 alignedBaseAddress; - - gcmkHEADER_ARG("Os=0x%x Type=%d BaseAddress=0x%x ", Os, Type, BaseAddress); - - /* Verify the arguments. */ - gcmkVERIFY_ARGUMENT(Alignment != gcvNULL); - - switch (Type) - { - case gcvSURF_RENDER_TARGET: - /* Align to first 4kB bank. */ - alignedBaseAddress = (((BaseAddress >> 15) << 3) + (0x8 + 0x0)) << 12; - break; - - case gcvSURF_DEPTH: - /* Align to third 4kB bank. */ - alignedBaseAddress = (((BaseAddress >> 15) << 3) + (0x8 + 0x2)) << 12; - - /* Add 64-byte offset to change channel bit 6. */ - alignedBaseAddress += 64; - break; - - default: - /* no alignment needed. */ - alignedBaseAddress = BaseAddress; - } - - /* Return alignment. */ - *Alignment = alignedBaseAddress - BaseAddress; - - /* Return the status. */ - gcmkFOOTER_ARG("*Alignment=%u", *Alignment); - return gcvSTATUS_OK; -} -#endif - /******************************************************************************\ ******************************* Signal Management ****************************** \******************************************************************************/ 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 ae94fcf4cef2..021e77f6d75b 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 - 2011 by Vivante Corp. +* Copyright (C) 2005 - 2012 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 |