From fe099e45219ef6ff71bdb84cc4654f087d3fb8ff Mon Sep 17 00:00:00 2001 From: gwang23 Date: Mon, 28 May 2012 18:20:21 +0800 Subject: [PATCH] Graphics: Update graphics kernel driver to DDK 905891 BZ: 38713 Update graphics kernel driver to DDK 905891 Change-Id: Icfb4db392c2699369a32fd1446bf31135a38dba9 Signed-off-by: Tong, Bo Reviewed-on: http://android.intel.com:8080/52593 Reviewed-by: Xu, Randy Reviewed-by: buildbot Tested-by: buildbot --- drivers/staging/mrst/pvr/include4/dbgdrvif.h | 18 +- drivers/staging/mrst/pvr/include4/img_defs.h | 16 +- drivers/staging/mrst/pvr/include4/img_types.h | 34 +- drivers/staging/mrst/pvr/include4/pdumpdefs.h | 20 +- drivers/staging/mrst/pvr/include4/pvr_debug.h | 16 +- drivers/staging/mrst/pvr/include4/pvrmodule.h | 18 +- drivers/staging/mrst/pvr/include4/pvrversion.h | 22 +- drivers/staging/mrst/pvr/include4/services.h | 176 +-- drivers/staging/mrst/pvr/include4/servicesext.h | 371 ++--- drivers/staging/mrst/pvr/include4/sgx_options.h | 16 +- drivers/staging/mrst/pvr/include4/sgxapi_km.h | 32 +- drivers/staging/mrst/pvr/include4/sgxscript.h | 20 +- .../mrst/pvr/services4/include/kernelbuffer.h | 20 +- .../mrst/pvr/services4/include/kerneldisplay.h | 56 +- drivers/staging/mrst/pvr/services4/include/pdump.h | 18 +- .../mrst/pvr/services4/include/pvr_bridge.h | 326 ++-- .../mrst/pvr/services4/include/pvr_bridge_km.h | 26 +- .../staging/mrst/pvr/services4/include/pvrmmap.h | 18 +- .../mrst/pvr/services4/include/pvrsrv_errors.h | 18 +- .../mrst/pvr/services4/include/servicesint.h | 158 +- .../mrst/pvr/services4/include/sgx_bridge.h | 124 +- .../mrst/pvr/services4/include/sgx_mkif_km.h | 169 +-- .../services4/include/sgx_ukernel_status_codes.h | 940 ++++++++++++ .../staging/mrst/pvr/services4/include/sgxinfo.h | 69 +- .../services4/srvkm/bridged/bridged_pvr_bridge.c | 301 ++-- .../services4/srvkm/bridged/bridged_pvr_bridge.h | 38 +- .../pvr/services4/srvkm/bridged/bridged_support.c | 20 +- .../pvr/services4/srvkm/bridged/bridged_support.h | 18 +- .../srvkm/bridged/sgx/bridged_sgx_bridge.c | 148 +- .../srvkm/bridged/sgx/bridged_sgx_bridge.h | 18 +- .../pvr/services4/srvkm/common/buffer_manager.c | 496 +++--- .../mrst/pvr/services4/srvkm/common/deviceclass.c | 436 +++--- .../mrst/pvr/services4/srvkm/common/deviceid.h | 18 +- .../mrst/pvr/services4/srvkm/common/devicemem.c | 362 ++--- .../mrst/pvr/services4/srvkm/common/handle.c | 238 +-- .../staging/mrst/pvr/services4/srvkm/common/hash.c | 66 +- .../mrst/pvr/services4/srvkm/common/lists.c | 18 +- .../staging/mrst/pvr/services4/srvkm/common/mem.c | 22 +- .../mrst/pvr/services4/srvkm/common/mem_debug.c | 61 +- .../mrst/pvr/services4/srvkm/common/metrics.c | 42 +- .../pvr/services4/srvkm/common/osfunc_common.c | 16 +- .../mrst/pvr/services4/srvkm/common/pdump_common.c | 396 ++--- .../mrst/pvr/services4/srvkm/common/perproc.c | 58 +- .../mrst/pvr/services4/srvkm/common/power.c | 90 +- .../mrst/pvr/services4/srvkm/common/pvrsrv.c | 208 +-- .../mrst/pvr/services4/srvkm/common/queue.c | 186 ++- .../staging/mrst/pvr/services4/srvkm/common/ra.c | 152 +- .../mrst/pvr/services4/srvkm/common/refcount.c | 99 +- .../mrst/pvr/services4/srvkm/common/resman.c | 222 +-- .../mrst/pvr/services4/srvkm/common/ttrace.c | 18 +- .../mrst/pvr/services4/srvkm/devices/sgx/mmu.c | 918 ++++++------ .../mrst/pvr/services4/srvkm/devices/sgx/mmu.h | 32 +- .../mrst/pvr/services4/srvkm/devices/sgx/pb.c | 42 +- .../services4/srvkm/devices/sgx/sgx_bridge_km.h | 18 +- .../pvr/services4/srvkm/devices/sgx/sgxconfig.h | 74 +- .../pvr/services4/srvkm/devices/sgx/sgxinfokm.h | 188 ++- .../mrst/pvr/services4/srvkm/devices/sgx/sgxinit.c | 697 +++++---- .../mrst/pvr/services4/srvkm/devices/sgx/sgxkick.c | 99 +- .../pvr/services4/srvkm/devices/sgx/sgxpower.c | 84 +- .../pvr/services4/srvkm/devices/sgx/sgxreset.c | 174 +-- .../pvr/services4/srvkm/devices/sgx/sgxtransfer.c | 104 +- .../pvr/services4/srvkm/devices/sgx/sgxutils.c | 409 +++-- .../pvr/services4/srvkm/devices/sgx/sgxutils.h | 20 +- .../mrst/pvr/services4/srvkm/env/linux/Kbuild.mk | 18 +- .../mrst/pvr/services4/srvkm/env/linux/env_data.h | 18 +- .../pvr/services4/srvkm/env/linux/env_perproc.h | 20 +- .../mrst/pvr/services4/srvkm/env/linux/event.c | 96 +- .../mrst/pvr/services4/srvkm/env/linux/event.h | 16 +- .../mrst/pvr/services4/srvkm/env/linux/ion.c | 18 +- .../mrst/pvr/services4/srvkm/env/linux/ion.h | 18 +- .../mrst/pvr/services4/srvkm/env/linux/linkage.h | 22 +- .../mrst/pvr/services4/srvkm/env/linux/lock.h | 18 +- .../mrst/pvr/services4/srvkm/env/linux/mm.c | 1584 +++++++++++++------- .../mrst/pvr/services4/srvkm/env/linux/mm.h | 69 +- .../mrst/pvr/services4/srvkm/env/linux/mmap.c | 148 +- .../mrst/pvr/services4/srvkm/env/linux/mmap.h | 46 +- .../mrst/pvr/services4/srvkm/env/linux/module.c | 109 +- .../mrst/pvr/services4/srvkm/env/linux/mutex.c | 24 +- .../mrst/pvr/services4/srvkm/env/linux/mutex.h | 22 +- .../mrst/pvr/services4/srvkm/env/linux/mutils.c | 34 +- .../mrst/pvr/services4/srvkm/env/linux/mutils.h | 20 +- .../mrst/pvr/services4/srvkm/env/linux/osfunc.c | 509 ++++--- .../mrst/pvr/services4/srvkm/env/linux/osperproc.c | 26 +- .../mrst/pvr/services4/srvkm/env/linux/pdump.c | 66 +- .../pvr/services4/srvkm/env/linux/private_data.h | 32 +- .../mrst/pvr/services4/srvkm/env/linux/proc.c | 46 +- .../mrst/pvr/services4/srvkm/env/linux/proc.h | 38 +- .../pvr/services4/srvkm/env/linux/pvr_bridge_k.c | 55 +- .../mrst/pvr/services4/srvkm/env/linux/pvr_debug.c | 56 +- .../mrst/pvr/services4/srvkm/hwdefs/ocpdefs.h | 18 +- .../mrst/pvr/services4/srvkm/hwdefs/sgx530defs.h | 18 +- .../mrst/pvr/services4/srvkm/hwdefs/sgx540defs.h | 18 +- .../pvr/services4/srvkm/hwdefs/sgx543_v1.164defs.h | 18 +- .../mrst/pvr/services4/srvkm/hwdefs/sgx544defs.h | 18 +- .../mrst/pvr/services4/srvkm/hwdefs/sgx545defs.h | 18 +- .../mrst/pvr/services4/srvkm/hwdefs/sgxdefs.h | 24 +- .../mrst/pvr/services4/srvkm/hwdefs/sgxerrata.h | 296 ++-- .../pvr/services4/srvkm/hwdefs/sgxfeaturedefs.h | 33 +- .../mrst/pvr/services4/srvkm/hwdefs/sgxmmu.h | 18 +- .../mrst/pvr/services4/srvkm/hwdefs/sgxmpdefs.h | 18 +- .../pvr/services4/srvkm/include/buffer_manager.h | 79 +- .../mrst/pvr/services4/srvkm/include/device.h | 152 +- .../mrst/pvr/services4/srvkm/include/handle.h | 34 +- .../mrst/pvr/services4/srvkm/include/hash.h | 18 +- .../mrst/pvr/services4/srvkm/include/lists.h | 16 +- .../mrst/pvr/services4/srvkm/include/metrics.h | 36 +- .../mrst/pvr/services4/srvkm/include/osfunc.h | 127 +- .../mrst/pvr/services4/srvkm/include/osperproc.h | 22 +- .../mrst/pvr/services4/srvkm/include/pdump_int.h | 28 +- .../mrst/pvr/services4/srvkm/include/pdump_km.h | 30 +- .../pvr/services4/srvkm/include/pdump_osfunc.h | 24 +- .../mrst/pvr/services4/srvkm/include/perfkm.h | 18 +- .../mrst/pvr/services4/srvkm/include/perproc.h | 36 +- .../mrst/pvr/services4/srvkm/include/power.h | 30 +- .../mrst/pvr/services4/srvkm/include/queue.h | 38 +- .../staging/mrst/pvr/services4/srvkm/include/ra.h | 64 +- .../mrst/pvr/services4/srvkm/include/refcount.h | 36 +- .../mrst/pvr/services4/srvkm/include/resman.h | 114 +- .../pvr/services4/srvkm/include/services_headers.h | 18 +- .../mrst/pvr/services4/srvkm/include/srvkm.h | 24 +- .../mrst/pvr/services4/srvkm/include/ttrace.h | 22 +- .../pvr/services4/srvkm/include/ttrace_common.h | 18 +- .../pvr/services4/srvkm/include/ttrace_tokens.h | 18 +- .../mrst/pvr/services4/system/include/syscommon.h | 84 +- .../mrst/pvr/tools/intern/debug/client/linuxsrv.h | 28 +- .../tools/intern/debug/dbgdriv/common/dbgdriv.c | 464 +++--- .../tools/intern/debug/dbgdriv/common/dbgdriv.h | 18 +- .../intern/debug/dbgdriv/common/dbgdriv_ioctl.h | 16 +- .../pvr/tools/intern/debug/dbgdriv/common/handle.c | 24 +- .../tools/intern/debug/dbgdriv/common/hostfunc.h | 18 +- .../pvr/tools/intern/debug/dbgdriv/common/hotkey.c | 32 +- .../pvr/tools/intern/debug/dbgdriv/common/hotkey.h | 18 +- .../pvr/tools/intern/debug/dbgdriv/common/ioctl.c | 58 +- .../tools/intern/debug/dbgdriv/linux/hostfunc.c | 44 +- .../pvr/tools/intern/debug/dbgdriv/linux/main.c | 36 +- 135 files changed, 8366 insertions(+), 6408 deletions(-) create mode 100644 drivers/staging/mrst/pvr/services4/include/sgx_ukernel_status_codes.h diff --git a/drivers/staging/mrst/pvr/include4/dbgdrvif.h b/drivers/staging/mrst/pvr/include4/dbgdrvif.h index ab32ca8..09c1608 100644 --- a/drivers/staging/mrst/pvr/include4/dbgdrvif.h +++ b/drivers/staging/mrst/pvr/include4/dbgdrvif.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * *****************************************************************************/ @@ -34,7 +34,7 @@ #define METHOD_BUFFERED 0 #define FILE_ANY_ACCESS 0 -#define CTL_CODE( DeviceType, Function, Method, Access ) (Function) +#define CTL_CODE( DeviceType, Function, Method, Access ) (Function) #define MAKEIOCTLINDEX(i) ((i) & 0xFFF) #else diff --git a/drivers/staging/mrst/pvr/include4/img_defs.h b/drivers/staging/mrst/pvr/include4/img_defs.h index 7473abe..d5408cf 100644 --- a/drivers/staging/mrst/pvr/include4/img_defs.h +++ b/drivers/staging/mrst/pvr/include4/img_defs.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * *******************************************************************************/ #if !defined (__IMG_DEFS_H__) diff --git a/drivers/staging/mrst/pvr/include4/img_types.h b/drivers/staging/mrst/pvr/include4/img_types.h index 3b7b7db..71dcebb 100644 --- a/drivers/staging/mrst/pvr/include4/img_types.h +++ b/drivers/staging/mrst/pvr/include4/img_types.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -103,7 +103,7 @@ typedef IMG_PVOID IMG_HANDLE; typedef void** IMG_HVOID, * IMG_PHVOID; -#define IMG_NULL 0 +#define IMG_NULL 0 /* services/stream ID */ typedef IMG_UINT32 IMG_SID; @@ -128,7 +128,7 @@ typedef IMG_UINT32 IMG_EVENTSID; * and a memory block is only mapped by the MMU once. * * Different devices could have offset views of the physical address space. - * + * */ @@ -141,19 +141,19 @@ typedef IMG_UINT32 IMG_EVENTSID; * | PVOID |IMG_DEV_VIRTADDR |IMG_DEV_VIRTADDR | * | \-------------------/ | * | | | - * +------------+ +------------+ | + * +------------+ +------------+ | * | MMU | | MMU | | - * +------------+ +------------+ | - * | | | + * +------------+ +------------+ | + * | | | * | | | * | | | * +--------+ +---------+ +--------+ * | Offset | | (Offset)| | Offset | - * +--------+ +---------+ +--------+ - * | | IMG_DEV_PHYADDR | + * +--------+ +---------+ +--------+ + * | | IMG_DEV_PHYADDR | * | | | * | | IMG_DEV_PHYADDR | - * +---------------------------------------------------------------------+ + * +---------------------------------------------------------------------+ * | System Address bus | * +---------------------------------------------------------------------+ * @@ -167,7 +167,7 @@ typedef struct _IMG_DEV_VIRTADDR /* device virtual addresses are 32bit for now */ IMG_UINT32 uiAddr; #define IMG_CAST_TO_DEVVADDR_UINT(var) (IMG_UINT32)(var) - + } IMG_DEV_VIRTADDR; typedef IMG_UINT32 IMG_DEVMEM_SIZE_T; diff --git a/drivers/staging/mrst/pvr/include4/pdumpdefs.h b/drivers/staging/mrst/pvr/include4/pdumpdefs.h index e8e23d8..e43ce2f 100644 --- a/drivers/staging/mrst/pvr/include4/pdumpdefs.h +++ b/drivers/staging/mrst/pvr/include4/pdumpdefs.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * *****************************************************************************/ @@ -77,7 +77,7 @@ typedef enum _PDUMP_PIXEL_FORMAT_ PVRSRV_PDUMP_PIXEL_FORMAT_BGRA5551 = 45, PVRSRV_PDUMP_PIXEL_FORMAT_BGR565 = 46, PVRSRV_PDUMP_PIXEL_FORMAT_A8 = 47, - + PVRSRV_PDUMP_PIXEL_FORMAT_FORCE_I32 = 0x7fffffff } PDUMP_PIXEL_FORMAT; @@ -89,7 +89,7 @@ typedef enum _PDUMP_MEM_FORMAT_ PVRSRV_PDUMP_MEM_FORMAT_TILED = 8, PVRSRV_PDUMP_MEM_FORMAT_TWIDDLED = 9, PVRSRV_PDUMP_MEM_FORMAT_HYBRID = 10, - + PVRSRV_PDUMP_MEM_FORMAT_FORCE_I32 = 0x7fffffff } PDUMP_MEM_FORMAT; diff --git a/drivers/staging/mrst/pvr/include4/pvr_debug.h b/drivers/staging/mrst/pvr/include4/pvr_debug.h index 31edcc1..e66fdab 100644 --- a/drivers/staging/mrst/pvr/include4/pvr_debug.h +++ b/drivers/staging/mrst/pvr/include4/pvr_debug.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ diff --git a/drivers/staging/mrst/pvr/include4/pvrmodule.h b/drivers/staging/mrst/pvr/include4/pvrmodule.h index 8060498..3dd5845 100644 --- a/drivers/staging/mrst/pvr/include4/pvrmodule.h +++ b/drivers/staging/mrst/pvr/include4/pvrmodule.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -28,4 +28,4 @@ #define _PVRMODULE_H_ MODULE_AUTHOR("Imagination Technologies Ltd. "); MODULE_LICENSE("GPL"); -#endif +#endif diff --git a/drivers/staging/mrst/pvr/include4/pvrversion.h b/drivers/staging/mrst/pvr/include4/pvrversion.h index fa84a9b..9b928e6 100644 --- a/drivers/staging/mrst/pvr/include4/pvrversion.h +++ b/drivers/staging/mrst/pvr/include4/pvrversion.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * */ /**************************************************************************/ @@ -36,7 +36,7 @@ #define PVRVERSION_FAMILY "sgxddk" #define PVRVERSION_BRANCHNAME "1.8" -#define PVRVERSION_BUILD 840215 +#define PVRVERSION_BUILD 905891 #define PVRVERSION_BSCONTROL "intel_android_sgx_ogles1_ogles2_GPL" #define PVRVERSION_STRING "intel_android_sgx_ogles1_ogles2_GPL sgxddk 18 1.8@" PVR_STR2(PVRVERSION_BUILD) @@ -44,8 +44,8 @@ #define COPYRIGHT_TXT "Copyright (c) Imagination Technologies Ltd. All Rights Reserved." -#define PVRVERSION_BUILD_HI 84 -#define PVRVERSION_BUILD_LO 215 +#define PVRVERSION_BUILD_HI 90 +#define PVRVERSION_BUILD_LO 5891 #define PVRVERSION_STRING_NUMERIC PVR_STR2(PVRVERSION_MAJ) "." PVR_STR2(PVRVERSION_MIN) "." PVR_STR2(PVRVERSION_BUILD_HI) "." PVR_STR2(PVRVERSION_BUILD_LO) #endif /* _PVRVERSION_H_ */ diff --git a/drivers/staging/mrst/pvr/include4/services.h b/drivers/staging/mrst/pvr/include4/services.h index d7a1b37..4e6d05f 100644 --- a/drivers/staging/mrst/pvr/include4/services.h +++ b/drivers/staging/mrst/pvr/include4/services.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -40,7 +40,7 @@ extern "C" { #define PVRSRV_MAX_CMD_SIZE 1024 -#define PVRSRV_MAX_DEVICES 16 +#define PVRSRV_MAX_DEVICES 16 #define EVENTOBJNAME_MAXLENGTH (50) @@ -85,12 +85,12 @@ extern "C" { #define PVRSRV_MEM_ION (1U<<29) #define PVRSRV_MEM_ALLOCATENONCACHEDMEM (1UL<<30) -#define PVRSRV_NO_CONTEXT_LOSS 0 -#define PVRSRV_SEVERE_LOSS_OF_CONTEXT 1 -#define PVRSRV_PRE_STATE_CHANGE_MASK 0x80 +#define PVRSRV_NO_CONTEXT_LOSS 0 +#define PVRSRV_SEVERE_LOSS_OF_CONTEXT 1 +#define PVRSRV_PRE_STATE_CHANGE_MASK 0x80 -#define PVRSRV_DEFAULT_DEV_COOKIE (1) +#define PVRSRV_DEFAULT_DEV_COOKIE (1) #define PVRSRV_MISC_INFO_TIMER_PRESENT (1U<<0) @@ -138,7 +138,7 @@ typedef enum _PVRSRV_DEVICE_TYPE_ PVRSRV_DEVICE_TYPE_VGX = 8, PVRSRV_DEVICE_TYPE_TOPAZ = 9, - + PVRSRV_DEVICE_TYPE_EXT = 10, PVRSRV_DEVICE_TYPE_LAST = 10, @@ -194,64 +194,64 @@ typedef struct _PVRSRV_DEV_DATA_ *PPVRSRV_DEV_DATA; typedef struct _PVRSRV_DEVICE_IDENTIFIER_ { - PVRSRV_DEVICE_TYPE eDeviceType; - PVRSRV_DEVICE_CLASS eDeviceClass; - IMG_UINT32 ui32DeviceIndex; - IMG_CHAR *pszPDumpDevName; - IMG_CHAR *pszPDumpRegName; + PVRSRV_DEVICE_TYPE eDeviceType; + PVRSRV_DEVICE_CLASS eDeviceClass; + IMG_UINT32 ui32DeviceIndex; + IMG_CHAR *pszPDumpDevName; + IMG_CHAR *pszPDumpRegName; } PVRSRV_DEVICE_IDENTIFIER; typedef struct _PVRSRV_CLIENT_DEV_DATA_ { - IMG_UINT32 ui32NumDevices; - PVRSRV_DEVICE_IDENTIFIER asDevID[PVRSRV_MAX_DEVICES]; - PVRSRV_ERROR (*apfnDevConnect[PVRSRV_MAX_DEVICES])(PPVRSRV_DEV_DATA); - PVRSRV_ERROR (*apfnDumpTrace[PVRSRV_MAX_DEVICES])(PPVRSRV_DEV_DATA); + IMG_UINT32 ui32NumDevices; + PVRSRV_DEVICE_IDENTIFIER asDevID[PVRSRV_MAX_DEVICES]; + PVRSRV_ERROR (*apfnDevConnect[PVRSRV_MAX_DEVICES])(PPVRSRV_DEV_DATA); + PVRSRV_ERROR (*apfnDumpTrace[PVRSRV_MAX_DEVICES])(PPVRSRV_DEV_DATA); } PVRSRV_CLIENT_DEV_DATA; typedef struct _PVRSRV_CONNECTION_ { - IMG_HANDLE hServices; - IMG_UINT32 ui32ProcessID; - PVRSRV_CLIENT_DEV_DATA sClientDevData; - IMG_UINT32 ui32SrvFlags; + IMG_HANDLE hServices; + IMG_UINT32 ui32ProcessID; + PVRSRV_CLIENT_DEV_DATA sClientDevData; + IMG_UINT32 ui32SrvFlags; }PVRSRV_CONNECTION; typedef struct _PVRSRV_DEV_DATA_ { - IMG_CONST PVRSRV_CONNECTION *psConnection; + IMG_CONST PVRSRV_CONNECTION *psConnection; #if defined (SUPPORT_SID_INTERFACE) - IMG_SID hDevCookie; + IMG_SID hDevCookie; #else - IMG_HANDLE hDevCookie; + IMG_HANDLE hDevCookie; #endif } PVRSRV_DEV_DATA; typedef struct _PVRSRV_MEMUPDATE_ { - IMG_UINT32 ui32UpdateAddr; - IMG_UINT32 ui32UpdateVal; + IMG_UINT32 ui32UpdateAddr; + IMG_UINT32 ui32UpdateVal; } PVRSRV_MEMUPDATE; typedef struct _PVRSRV_HWREG_ { - IMG_UINT32 ui32RegAddr; - IMG_UINT32 ui32RegVal; + IMG_UINT32 ui32RegAddr; + IMG_UINT32 ui32RegVal; } PVRSRV_HWREG; typedef struct _PVRSRV_MEMBLK_ { - IMG_DEV_VIRTADDR sDevVirtAddr; - IMG_HANDLE hOSMemHandle; - IMG_HANDLE hOSWrapMem; - IMG_HANDLE hBuffer; - IMG_HANDLE hResItem; + IMG_DEV_VIRTADDR sDevVirtAddr; + IMG_HANDLE hOSMemHandle; + IMG_HANDLE hOSWrapMem; + IMG_HANDLE hBuffer; + IMG_HANDLE hResItem; IMG_SYS_PHYADDR *psIntSysPAddr; } PVRSRV_MEMBLK; @@ -260,68 +260,68 @@ typedef struct _PVRSRV_KERNEL_MEM_INFO_ *PPVRSRV_KERNEL_MEM_INFO; typedef struct _PVRSRV_CLIENT_MEM_INFO_ { - + IMG_PVOID pvLinAddr; - + IMG_PVOID pvLinAddrKM; - + IMG_DEV_VIRTADDR sDevVAddr; - + IMG_CPU_PHYADDR sCpuPAddr; - + IMG_UINT32 ui32Flags; - + IMG_UINT32 ui32ClientFlags; - + IMG_SIZE_T uAllocSize; - + struct _PVRSRV_CLIENT_SYNC_INFO_ *psClientSyncInfo; #if defined (SUPPORT_SID_INTERFACE) - + IMG_SID hMappingInfo; - + IMG_SID hKernelMemInfo; - + IMG_SID hResItem; #else - + IMG_HANDLE hMappingInfo; - + IMG_HANDLE hKernelMemInfo; - + IMG_HANDLE hResItem; #endif #if defined(SUPPORT_MEMINFO_IDS) #if !defined(USE_CODE) - + IMG_UINT64 ui64Stamp; - #else + #else IMG_UINT32 dummy1; IMG_UINT32 dummy2; - #endif -#endif - + #endif +#endif + struct _PVRSRV_CLIENT_MEM_INFO_ *psNext; @@ -349,9 +349,9 @@ typedef struct _PVRSRV_HEAP_INFO_ typedef struct _PVRSRV_EVENTOBJECT_ { - + IMG_CHAR szName[EVENTOBJNAME_MAXLENGTH]; - + #if defined (SUPPORT_SID_INTERFACE) IMG_SID hOSEventKM; #else @@ -369,10 +369,10 @@ typedef enum typedef struct _PVRSRV_MISC_INFO_ { - IMG_UINT32 ui32StateRequest; - IMG_UINT32 ui32StatePresent; - + IMG_UINT32 ui32StateRequest; + IMG_UINT32 ui32StatePresent; + IMG_VOID *pvSOCTimerRegisterKM; IMG_VOID *pvSOCTimerRegisterUM; #if defined (SUPPORT_SID_INTERFACE) @@ -383,15 +383,15 @@ typedef struct _PVRSRV_MISC_INFO_ IMG_HANDLE hSOCTimerRegisterMappingInfo; #endif - + IMG_VOID *pvSOCClockGateRegs; IMG_UINT32 ui32SOCClockGateRegsSize; - + IMG_CHAR *pszMemoryStr; IMG_UINT32 ui32MemoryStrLen; - + PVRSRV_EVENTOBJECT sGlobalEventObject; #if defined (SUPPORT_SID_INTERFACE) IMG_EVENTSID hOSGlobalEvent; @@ -399,60 +399,60 @@ typedef struct _PVRSRV_MISC_INFO_ IMG_HANDLE hOSGlobalEvent; #endif - + IMG_UINT32 aui32DDKVersion[4]; - + struct { - + IMG_BOOL bDeferOp; - + PVRSRV_MISC_INFO_CPUCACHEOP_TYPE eCacheOpType; - + #if !defined (SUPPORT_SID_INTERFACE) union { - + PVRSRV_CLIENT_MEM_INFO *psClientMemInfo; - + struct _PVRSRV_KERNEL_MEM_INFO_ *psKernelMemInfo; } u; #endif - + IMG_VOID *pvBaseVAddr; - + IMG_UINT32 ui32Length; } sCacheOpCtl; - + struct { - + #if !defined(SUPPORT_SID_INTERFACE) union { - + PVRSRV_CLIENT_MEM_INFO *psClientMemInfo; - + struct _PVRSRV_KERNEL_MEM_INFO_ *psKernelMemInfo; } u; #endif - + IMG_UINT32 ui32RefCount; } sGetRefCountCtl; } PVRSRV_MISC_INFO; typedef struct _PVRSRV_SYNC_TOKEN_ { - + struct { @@ -708,7 +708,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceMemory2(IMG_CONST PVRSRV_DEV_DATA *psDe IMG_HANDLE hDstDevMemHeap, #endif PVRSRV_CLIENT_MEM_INFO **ppsDstMemInfo); -#endif +#endif #if defined(SUPPORT_ION) PVRSRV_ERROR PVRSRVMapIonHandle(const PVRSRV_DEV_DATA *psDevData, @@ -724,7 +724,7 @@ PVRSRV_ERROR PVRSRVMapIonHandle(const PVRSRV_DEV_DATA *psDevData, PVRSRV_ERROR PVRSRVUnmapIonHandle(const PVRSRV_DEV_DATA *psDevData, PVRSRV_CLIENT_MEM_INFO *psMemInfo); -#endif +#endif typedef enum _PVRSRV_SYNCVAL_MODE_ { @@ -958,7 +958,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpMemPol(IMG_CONST PVRSRV_CONNECTION *psConne IMG_SID hKernelMemInfo, #else PVRSRV_CLIENT_MEM_INFO *psMemInfo, -#endif +#endif IMG_UINT32 ui32Offset, IMG_UINT32 ui32Value, IMG_UINT32 ui32Mask, @@ -1213,7 +1213,7 @@ static INLINE IMG_VOID PVRSRVPostSemaphore(PVRSRV_SEMAPHORE_HANDLE hSemaphore, I PVR_UNREFERENCED_PARAMETER(iPostCount); } -#endif +#endif #if (defined(DEBUG) && defined(__linux__)) @@ -1223,9 +1223,9 @@ IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVCallocUserModeMemTracking(IMG_SIZE_T ui3 IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVFreeUserModeMemTracking(IMG_VOID *pvMem); -IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVReallocUserModeMemTracking(IMG_VOID *pvMem, IMG_SIZE_T ui32NewSize, +IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVReallocUserModeMemTracking(IMG_VOID *pvMem, IMG_SIZE_T ui32NewSize, IMG_CHAR *pszFileName, IMG_UINT32 ui32LineNumber); -#endif +#endif IMG_IMPORT PVRSRV_ERROR PVRSRVEventObjectWait(const PVRSRV_CONNECTION *psConnection, #if defined (SUPPORT_SID_INTERFACE) @@ -1325,5 +1325,5 @@ const IMG_CHAR *PVRSRVGetErrorString(PVRSRV_ERROR eError); #if defined (__cplusplus) } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/include4/servicesext.h b/drivers/staging/mrst/pvr/include4/servicesext.h index c31138d..42558b9 100644 --- a/drivers/staging/mrst/pvr/include4/servicesext.h +++ b/drivers/staging/mrst/pvr/include4/servicesext.h @@ -1,33 +1,33 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ #if !defined (__SERVICESEXT_H__) #define __SERVICESEXT_H__ -#define PVRSRV_LOCKFLG_READONLY (1) +#define PVRSRV_LOCKFLG_READONLY (1) typedef enum _PVRSRV_ERROR_ { @@ -279,12 +279,12 @@ typedef enum _PVRSRV_DEVICE_CLASS_ typedef enum _PVRSRV_SYS_POWER_STATE_ { - PVRSRV_SYS_POWER_STATE_Unspecified = -1, - PVRSRV_SYS_POWER_STATE_D0 = 0, - PVRSRV_SYS_POWER_STATE_D1 = 1, - PVRSRV_SYS_POWER_STATE_D2 = 2, - PVRSRV_SYS_POWER_STATE_D3 = 3, - PVRSRV_SYS_POWER_STATE_D4 = 4, + PVRSRV_SYS_POWER_STATE_Unspecified = -1, + PVRSRV_SYS_POWER_STATE_D0 = 0, + PVRSRV_SYS_POWER_STATE_D1 = 1, + PVRSRV_SYS_POWER_STATE_D2 = 2, + PVRSRV_SYS_POWER_STATE_D3 = 3, + PVRSRV_SYS_POWER_STATE_D4 = 4, PVRSRV_SYS_POWER_STATE_FORCE_I32 = 0x7fffffff @@ -293,14 +293,14 @@ typedef enum _PVRSRV_SYS_POWER_STATE_ typedef enum _PVRSRV_DEV_POWER_STATE_ { - PVRSRV_DEV_POWER_STATE_DEFAULT = -1, - PVRSRV_DEV_POWER_STATE_ON = 0, - PVRSRV_DEV_POWER_STATE_IDLE = 1, - PVRSRV_DEV_POWER_STATE_OFF = 2, + PVRSRV_DEV_POWER_STATE_DEFAULT = -1, + PVRSRV_DEV_POWER_STATE_ON = 0, + PVRSRV_DEV_POWER_STATE_IDLE = 1, + PVRSRV_DEV_POWER_STATE_OFF = 2, PVRSRV_DEV_POWER_STATE_FORCE_I32 = 0x7fffffff -} PVRSRV_DEV_POWER_STATE, *PPVRSRV_DEV_POWER_STATE; +} PVRSRV_DEV_POWER_STATE, *PPVRSRV_DEV_POWER_STATE; typedef PVRSRV_ERROR (*PFN_PRE_POWER) (IMG_HANDLE hDevHandle, @@ -319,12 +319,12 @@ typedef PVRSRV_ERROR (*PFN_POST_CLOCKSPEED_CHANGE) (IMG_HANDLE hDevHandle, typedef enum _PVRSRV_PIXEL_FORMAT_ { - + PVRSRV_PIXEL_FORMAT_UNKNOWN = 0, PVRSRV_PIXEL_FORMAT_RGB565 = 1, PVRSRV_PIXEL_FORMAT_RGB555 = 2, - PVRSRV_PIXEL_FORMAT_RGB888 = 3, - PVRSRV_PIXEL_FORMAT_BGR888 = 4, + PVRSRV_PIXEL_FORMAT_RGB888 = 3, + PVRSRV_PIXEL_FORMAT_BGR888 = 4, PVRSRV_PIXEL_FORMAT_GREY_SCALE = 8, PVRSRV_PIXEL_FORMAT_PAL12 = 13, PVRSRV_PIXEL_FORMAT_PAL8 = 14, @@ -343,8 +343,8 @@ typedef enum _PVRSRV_PIXEL_FORMAT_ { PVRSRV_PIXEL_FORMAT_BGRA8888 = 28, PVRSRV_PIXEL_FORMAT_XRGB4444 = 29, PVRSRV_PIXEL_FORMAT_ARGB8332 = 30, - PVRSRV_PIXEL_FORMAT_A2RGB10 = 31, - PVRSRV_PIXEL_FORMAT_A2BGR10 = 32, + PVRSRV_PIXEL_FORMAT_A2RGB10 = 31, + PVRSRV_PIXEL_FORMAT_A2BGR10 = 32, PVRSRV_PIXEL_FORMAT_P8 = 33, PVRSRV_PIXEL_FORMAT_L8 = 34, PVRSRV_PIXEL_FORMAT_A8L8 = 35, @@ -360,7 +360,7 @@ typedef enum _PVRSRV_PIXEL_FORMAT_ { PVRSRV_PIXEL_FORMAT_D24S8 = 45, PVRSRV_PIXEL_FORMAT_D24X8 = 46, - + PVRSRV_PIXEL_FORMAT_ABGR16 = 47, PVRSRV_PIXEL_FORMAT_ABGR16F = 48, PVRSRV_PIXEL_FORMAT_ABGR32 = 49, @@ -371,22 +371,22 @@ typedef enum _PVRSRV_PIXEL_FORMAT_ { PVRSRV_PIXEL_FORMAT_GR32 = 54, PVRSRV_PIXEL_FORMAT_E5BGR9 = 55, - + PVRSRV_PIXEL_FORMAT_RESERVED1 = 56, PVRSRV_PIXEL_FORMAT_RESERVED2 = 57, PVRSRV_PIXEL_FORMAT_RESERVED3 = 58, PVRSRV_PIXEL_FORMAT_RESERVED4 = 59, PVRSRV_PIXEL_FORMAT_RESERVED5 = 60, - + PVRSRV_PIXEL_FORMAT_R8G8_B8G8 = 61, PVRSRV_PIXEL_FORMAT_G8R8_G8B8 = 62, - + PVRSRV_PIXEL_FORMAT_NV11 = 63, PVRSRV_PIXEL_FORMAT_NV12 = 64, - + PVRSRV_PIXEL_FORMAT_YUY2 = 65, PVRSRV_PIXEL_FORMAT_YUV420 = 66, PVRSRV_PIXEL_FORMAT_YUV444 = 67, @@ -396,107 +396,107 @@ typedef enum _PVRSRV_PIXEL_FORMAT_ { PVRSRV_PIXEL_FORMAT_UYVY = 71, PVRSRV_PIXEL_FORMAT_VYUY = 72, - PVRSRV_PIXEL_FORMAT_FOURCC_ORG_UYVY = 73, - PVRSRV_PIXEL_FORMAT_FOURCC_ORG_YUYV = 74, - PVRSRV_PIXEL_FORMAT_FOURCC_ORG_YVYU = 75, - PVRSRV_PIXEL_FORMAT_FOURCC_ORG_VYUY = 76, - PVRSRV_PIXEL_FORMAT_FOURCC_ORG_AYUV = 77, - - - PVRSRV_PIXEL_FORMAT_A32B32G32R32 = 78, - PVRSRV_PIXEL_FORMAT_A32B32G32R32F = 79, - PVRSRV_PIXEL_FORMAT_A32B32G32R32_UINT = 80, - PVRSRV_PIXEL_FORMAT_A32B32G32R32_SINT = 81, - - - PVRSRV_PIXEL_FORMAT_B32G32R32 = 82, - PVRSRV_PIXEL_FORMAT_B32G32R32F = 83, - PVRSRV_PIXEL_FORMAT_B32G32R32_UINT = 84, - PVRSRV_PIXEL_FORMAT_B32G32R32_SINT = 85, - - - PVRSRV_PIXEL_FORMAT_G32R32 = 86, - PVRSRV_PIXEL_FORMAT_G32R32F = 87, - PVRSRV_PIXEL_FORMAT_G32R32_UINT = 88, - PVRSRV_PIXEL_FORMAT_G32R32_SINT = 89, - - - PVRSRV_PIXEL_FORMAT_D32F = 90, - PVRSRV_PIXEL_FORMAT_R32 = 91, - PVRSRV_PIXEL_FORMAT_R32F = 92, - PVRSRV_PIXEL_FORMAT_R32_UINT = 93, - PVRSRV_PIXEL_FORMAT_R32_SINT = 94, - - - PVRSRV_PIXEL_FORMAT_A16B16G16R16 = 95, - PVRSRV_PIXEL_FORMAT_A16B16G16R16F = 96, - PVRSRV_PIXEL_FORMAT_A16B16G16R16_SINT = 97, - PVRSRV_PIXEL_FORMAT_A16B16G16R16_SNORM = 98, - PVRSRV_PIXEL_FORMAT_A16B16G16R16_UINT = 99, - PVRSRV_PIXEL_FORMAT_A16B16G16R16_UNORM = 100, - - - PVRSRV_PIXEL_FORMAT_G16R16 = 101, - PVRSRV_PIXEL_FORMAT_G16R16F = 102, - PVRSRV_PIXEL_FORMAT_G16R16_UINT = 103, - PVRSRV_PIXEL_FORMAT_G16R16_UNORM = 104, - PVRSRV_PIXEL_FORMAT_G16R16_SINT = 105, - PVRSRV_PIXEL_FORMAT_G16R16_SNORM = 106, - - - PVRSRV_PIXEL_FORMAT_R16 = 107, - PVRSRV_PIXEL_FORMAT_R16F = 108, - PVRSRV_PIXEL_FORMAT_R16_UINT = 109, - PVRSRV_PIXEL_FORMAT_R16_UNORM = 110, - PVRSRV_PIXEL_FORMAT_R16_SINT = 111, - PVRSRV_PIXEL_FORMAT_R16_SNORM = 112, - - - PVRSRV_PIXEL_FORMAT_X8R8G8B8 = 113, - PVRSRV_PIXEL_FORMAT_X8R8G8B8_UNORM = 114, - PVRSRV_PIXEL_FORMAT_X8R8G8B8_UNORM_SRGB = 115, - - PVRSRV_PIXEL_FORMAT_A8R8G8B8 = 116, - PVRSRV_PIXEL_FORMAT_A8R8G8B8_UNORM = 117, - PVRSRV_PIXEL_FORMAT_A8R8G8B8_UNORM_SRGB = 118, - - PVRSRV_PIXEL_FORMAT_A8B8G8R8 = 119, - PVRSRV_PIXEL_FORMAT_A8B8G8R8_UINT = 120, - PVRSRV_PIXEL_FORMAT_A8B8G8R8_UNORM = 121, - PVRSRV_PIXEL_FORMAT_A8B8G8R8_UNORM_SRGB = 122, - PVRSRV_PIXEL_FORMAT_A8B8G8R8_SINT = 123, - PVRSRV_PIXEL_FORMAT_A8B8G8R8_SNORM = 124, - - - PVRSRV_PIXEL_FORMAT_G8R8 = 125, - PVRSRV_PIXEL_FORMAT_G8R8_UINT = 126, - PVRSRV_PIXEL_FORMAT_G8R8_UNORM = 127, - PVRSRV_PIXEL_FORMAT_G8R8_SINT = 128, - PVRSRV_PIXEL_FORMAT_G8R8_SNORM = 129, - - - PVRSRV_PIXEL_FORMAT_A8 = 130, - PVRSRV_PIXEL_FORMAT_R8 = 131, - PVRSRV_PIXEL_FORMAT_R8_UINT = 132, - PVRSRV_PIXEL_FORMAT_R8_UNORM = 133, - PVRSRV_PIXEL_FORMAT_R8_SINT = 134, - PVRSRV_PIXEL_FORMAT_R8_SNORM = 135, - - - PVRSRV_PIXEL_FORMAT_A2B10G10R10 = 136, - PVRSRV_PIXEL_FORMAT_A2B10G10R10_UNORM = 137, - PVRSRV_PIXEL_FORMAT_A2B10G10R10_UINT = 138, - - - PVRSRV_PIXEL_FORMAT_B10G11R11 = 139, - PVRSRV_PIXEL_FORMAT_B10G11R11F = 140, - - - PVRSRV_PIXEL_FORMAT_X24G8R32 = 141, - PVRSRV_PIXEL_FORMAT_G8R24 = 142, + PVRSRV_PIXEL_FORMAT_FOURCC_ORG_UYVY = 73, + PVRSRV_PIXEL_FORMAT_FOURCC_ORG_YUYV = 74, + PVRSRV_PIXEL_FORMAT_FOURCC_ORG_YVYU = 75, + PVRSRV_PIXEL_FORMAT_FOURCC_ORG_VYUY = 76, + PVRSRV_PIXEL_FORMAT_FOURCC_ORG_AYUV = 77, + + + PVRSRV_PIXEL_FORMAT_A32B32G32R32 = 78, + PVRSRV_PIXEL_FORMAT_A32B32G32R32F = 79, + PVRSRV_PIXEL_FORMAT_A32B32G32R32_UINT = 80, + PVRSRV_PIXEL_FORMAT_A32B32G32R32_SINT = 81, + + + PVRSRV_PIXEL_FORMAT_B32G32R32 = 82, + PVRSRV_PIXEL_FORMAT_B32G32R32F = 83, + PVRSRV_PIXEL_FORMAT_B32G32R32_UINT = 84, + PVRSRV_PIXEL_FORMAT_B32G32R32_SINT = 85, + + + PVRSRV_PIXEL_FORMAT_G32R32 = 86, + PVRSRV_PIXEL_FORMAT_G32R32F = 87, + PVRSRV_PIXEL_FORMAT_G32R32_UINT = 88, + PVRSRV_PIXEL_FORMAT_G32R32_SINT = 89, + + + PVRSRV_PIXEL_FORMAT_D32F = 90, + PVRSRV_PIXEL_FORMAT_R32 = 91, + PVRSRV_PIXEL_FORMAT_R32F = 92, + PVRSRV_PIXEL_FORMAT_R32_UINT = 93, + PVRSRV_PIXEL_FORMAT_R32_SINT = 94, + + + PVRSRV_PIXEL_FORMAT_A16B16G16R16 = 95, + PVRSRV_PIXEL_FORMAT_A16B16G16R16F = 96, + PVRSRV_PIXEL_FORMAT_A16B16G16R16_SINT = 97, + PVRSRV_PIXEL_FORMAT_A16B16G16R16_SNORM = 98, + PVRSRV_PIXEL_FORMAT_A16B16G16R16_UINT = 99, + PVRSRV_PIXEL_FORMAT_A16B16G16R16_UNORM = 100, + + + PVRSRV_PIXEL_FORMAT_G16R16 = 101, + PVRSRV_PIXEL_FORMAT_G16R16F = 102, + PVRSRV_PIXEL_FORMAT_G16R16_UINT = 103, + PVRSRV_PIXEL_FORMAT_G16R16_UNORM = 104, + PVRSRV_PIXEL_FORMAT_G16R16_SINT = 105, + PVRSRV_PIXEL_FORMAT_G16R16_SNORM = 106, + + + PVRSRV_PIXEL_FORMAT_R16 = 107, + PVRSRV_PIXEL_FORMAT_R16F = 108, + PVRSRV_PIXEL_FORMAT_R16_UINT = 109, + PVRSRV_PIXEL_FORMAT_R16_UNORM = 110, + PVRSRV_PIXEL_FORMAT_R16_SINT = 111, + PVRSRV_PIXEL_FORMAT_R16_SNORM = 112, + + + PVRSRV_PIXEL_FORMAT_X8R8G8B8 = 113, + PVRSRV_PIXEL_FORMAT_X8R8G8B8_UNORM = 114, + PVRSRV_PIXEL_FORMAT_X8R8G8B8_UNORM_SRGB = 115, + + PVRSRV_PIXEL_FORMAT_A8R8G8B8 = 116, + PVRSRV_PIXEL_FORMAT_A8R8G8B8_UNORM = 117, + PVRSRV_PIXEL_FORMAT_A8R8G8B8_UNORM_SRGB = 118, + + PVRSRV_PIXEL_FORMAT_A8B8G8R8 = 119, + PVRSRV_PIXEL_FORMAT_A8B8G8R8_UINT = 120, + PVRSRV_PIXEL_FORMAT_A8B8G8R8_UNORM = 121, + PVRSRV_PIXEL_FORMAT_A8B8G8R8_UNORM_SRGB = 122, + PVRSRV_PIXEL_FORMAT_A8B8G8R8_SINT = 123, + PVRSRV_PIXEL_FORMAT_A8B8G8R8_SNORM = 124, + + + PVRSRV_PIXEL_FORMAT_G8R8 = 125, + PVRSRV_PIXEL_FORMAT_G8R8_UINT = 126, + PVRSRV_PIXEL_FORMAT_G8R8_UNORM = 127, + PVRSRV_PIXEL_FORMAT_G8R8_SINT = 128, + PVRSRV_PIXEL_FORMAT_G8R8_SNORM = 129, + + + PVRSRV_PIXEL_FORMAT_A8 = 130, + PVRSRV_PIXEL_FORMAT_R8 = 131, + PVRSRV_PIXEL_FORMAT_R8_UINT = 132, + PVRSRV_PIXEL_FORMAT_R8_UNORM = 133, + PVRSRV_PIXEL_FORMAT_R8_SINT = 134, + PVRSRV_PIXEL_FORMAT_R8_SNORM = 135, + + + PVRSRV_PIXEL_FORMAT_A2B10G10R10 = 136, + PVRSRV_PIXEL_FORMAT_A2B10G10R10_UNORM = 137, + PVRSRV_PIXEL_FORMAT_A2B10G10R10_UINT = 138, + + + PVRSRV_PIXEL_FORMAT_B10G11R11 = 139, + PVRSRV_PIXEL_FORMAT_B10G11R11F = 140, + + + PVRSRV_PIXEL_FORMAT_X24G8R32 = 141, + PVRSRV_PIXEL_FORMAT_G8R24 = 142, PVRSRV_PIXEL_FORMAT_X8R24 = 143, - PVRSRV_PIXEL_FORMAT_E5B9G9R9 = 144, - PVRSRV_PIXEL_FORMAT_R1 = 145, + PVRSRV_PIXEL_FORMAT_E5B9G9R9 = 144, + PVRSRV_PIXEL_FORMAT_R1 = 145, PVRSRV_PIXEL_FORMAT_RESERVED6 = 146, PVRSRV_PIXEL_FORMAT_RESERVED7 = 147, @@ -514,20 +514,20 @@ typedef enum _PVRSRV_PIXEL_FORMAT_ { PVRSRV_PIXEL_FORMAT_RESERVED19 = 159, PVRSRV_PIXEL_FORMAT_RESERVED20 = 160, - - PVRSRV_PIXEL_FORMAT_UBYTE4 = 161, - PVRSRV_PIXEL_FORMAT_SHORT4 = 162, - PVRSRV_PIXEL_FORMAT_SHORT4N = 163, - PVRSRV_PIXEL_FORMAT_USHORT4N = 164, - PVRSRV_PIXEL_FORMAT_SHORT2N = 165, - PVRSRV_PIXEL_FORMAT_SHORT2 = 166, - PVRSRV_PIXEL_FORMAT_USHORT2N = 167, - PVRSRV_PIXEL_FORMAT_UDEC3 = 168, - PVRSRV_PIXEL_FORMAT_DEC3N = 169, - PVRSRV_PIXEL_FORMAT_F16_2 = 170, - PVRSRV_PIXEL_FORMAT_F16_4 = 171, - - + + PVRSRV_PIXEL_FORMAT_UBYTE4 = 161, + PVRSRV_PIXEL_FORMAT_SHORT4 = 162, + PVRSRV_PIXEL_FORMAT_SHORT4N = 163, + PVRSRV_PIXEL_FORMAT_USHORT4N = 164, + PVRSRV_PIXEL_FORMAT_SHORT2N = 165, + PVRSRV_PIXEL_FORMAT_SHORT2 = 166, + PVRSRV_PIXEL_FORMAT_USHORT2N = 167, + PVRSRV_PIXEL_FORMAT_UDEC3 = 168, + PVRSRV_PIXEL_FORMAT_DEC3N = 169, + PVRSRV_PIXEL_FORMAT_F16_2 = 170, + PVRSRV_PIXEL_FORMAT_F16_4 = 171, + + PVRSRV_PIXEL_FORMAT_L_F16 = 172, PVRSRV_PIXEL_FORMAT_L_F16_REP = 173, PVRSRV_PIXEL_FORMAT_L_F16_A_F16 = 174, @@ -538,7 +538,7 @@ typedef enum _PVRSRV_PIXEL_FORMAT_ { PVRSRV_PIXEL_FORMAT_A_F32 = 178, PVRSRV_PIXEL_FORMAT_L_F32_A_F32 = 179, - + PVRSRV_PIXEL_FORMAT_PVRTC2 = 180, PVRSRV_PIXEL_FORMAT_PVRTC4 = 181, PVRSRV_PIXEL_FORMAT_PVRTCII2 = 182, @@ -555,7 +555,7 @@ typedef enum _PVRSRV_PIXEL_FORMAT_ { PVRSRV_PIXEL_FORMAT_MONO8 = 193, PVRSRV_PIXEL_FORMAT_MONO16 = 194, - + PVRSRV_PIXEL_FORMAT_C0_YUYV = 195, PVRSRV_PIXEL_FORMAT_C0_UYVY = 196, PVRSRV_PIXEL_FORMAT_C0_YVYU = 197, @@ -565,7 +565,7 @@ typedef enum _PVRSRV_PIXEL_FORMAT_ { PVRSRV_PIXEL_FORMAT_C1_YVYU = 201, PVRSRV_PIXEL_FORMAT_C1_VYUY = 202, - + PVRSRV_PIXEL_FORMAT_C0_YUV420_2P_UV = 203, PVRSRV_PIXEL_FORMAT_C0_YUV420_2P_VU = 204, PVRSRV_PIXEL_FORMAT_C0_YUV420_3P = 205, @@ -576,18 +576,18 @@ typedef enum _PVRSRV_PIXEL_FORMAT_ { PVRSRV_PIXEL_FORMAT_A2B10G10R10F = 209, PVRSRV_PIXEL_FORMAT_B8G8R8_SINT = 210, PVRSRV_PIXEL_FORMAT_PVRF32SIGNMASK = 211, - - PVRSRV_PIXEL_FORMAT_ABGR4444 = 212, + + PVRSRV_PIXEL_FORMAT_ABGR4444 = 212, PVRSRV_PIXEL_FORMAT_ABGR1555 = 213, - PVRSRV_PIXEL_FORMAT_BGR565 = 214, - + PVRSRV_PIXEL_FORMAT_BGR565 = 214, + PVRSRV_PIXEL_FORMAT_C0_4KYUV420_2P_UV = 215, PVRSRV_PIXEL_FORMAT_C0_4KYUV420_2P_VU = 216, PVRSRV_PIXEL_FORMAT_C1_4KYUV420_2P_UV = 217, PVRSRV_PIXEL_FORMAT_C1_4KYUV420_2P_VU = 218, - PVRSRV_PIXEL_FORMAT_P208 = 219, - PVRSRV_PIXEL_FORMAT_A8P8 = 220, + PVRSRV_PIXEL_FORMAT_P208 = 219, + PVRSRV_PIXEL_FORMAT_A8P8 = 220, PVRSRV_PIXEL_FORMAT_A4 = 221, PVRSRV_PIXEL_FORMAT_AYUV8888 = 222, @@ -629,51 +629,54 @@ typedef enum _PVRSRV_ROTATION_ { typedef struct _PVRSRV_SYNC_DATA_ { - + IMG_UINT32 ui32WriteOpsPending; volatile IMG_UINT32 ui32WriteOpsComplete; - + IMG_UINT32 ui32ReadOpsPending; volatile IMG_UINT32 ui32ReadOpsComplete; - + IMG_UINT32 ui32ReadOps2Pending; volatile IMG_UINT32 ui32ReadOps2Complete; - + IMG_UINT32 ui32LastOpDumpVal; IMG_UINT32 ui32LastReadOpDumpVal; + + IMG_UINT64 ui64LastWrite; + } PVRSRV_SYNC_DATA; typedef struct _PVRSRV_CLIENT_SYNC_INFO_ { - + PVRSRV_SYNC_DATA *psSyncData; + - - + IMG_DEV_VIRTADDR sWriteOpsCompleteDevVAddr; - + IMG_DEV_VIRTADDR sReadOpsCompleteDevVAddr; - + IMG_DEV_VIRTADDR sReadOps2CompleteDevVAddr; - + #if defined (SUPPORT_SID_INTERFACE) IMG_SID hMappingInfo; - + IMG_SID hKernelSyncInfo; #else IMG_HANDLE hMappingInfo; - + IMG_HANDLE hKernelSyncInfo; #endif @@ -731,52 +734,52 @@ typedef struct DISPLAY_DIMS_TAG typedef struct DISPLAY_FORMAT_TAG { - + PVRSRV_PIXEL_FORMAT pixelformat; } DISPLAY_FORMAT; typedef struct DISPLAY_SURF_ATTRIBUTES_TAG { - + PVRSRV_PIXEL_FORMAT pixelformat; - + DISPLAY_DIMS sDims; } DISPLAY_SURF_ATTRIBUTES; typedef struct DISPLAY_MODE_INFO_TAG { - + PVRSRV_PIXEL_FORMAT pixelformat; - + DISPLAY_DIMS sDims; - + IMG_UINT32 ui32RefreshHZ; - + IMG_UINT32 ui32OEMFlags; } DISPLAY_MODE_INFO; -#define MAX_DISPLAY_NAME_SIZE (50) +#define MAX_DISPLAY_NAME_SIZE (50) typedef struct DISPLAY_INFO_TAG { - + IMG_UINT32 ui32MaxSwapChains; - + IMG_UINT32 ui32MaxSwapChainBuffers; - + IMG_UINT32 ui32MinSwapInterval; - + IMG_UINT32 ui32MaxSwapInterval; - + IMG_UINT32 ui32PhysicalWidthmm; IMG_UINT32 ui32PhysicalHeightmm; - + IMG_CHAR szDisplayName[MAX_DISPLAY_NAME_SIZE]; #if defined(SUPPORT_HW_CURSOR) - + IMG_UINT16 ui32CursorWidth; IMG_UINT16 ui32CursorHeight; #endif @@ -786,7 +789,7 @@ typedef struct ACCESS_INFO_TAG { IMG_UINT32 ui32Size; IMG_UINT32 ui32FBPhysBaseAddress; - IMG_UINT32 ui32FBMemAvailable; + IMG_UINT32 ui32FBMemAvailable; IMG_UINT32 ui32SysPhysBaseAddress; IMG_UINT32 ui32SysSize; IMG_UINT32 ui32DevIRQ; @@ -803,7 +806,7 @@ typedef struct { #define PVRSRV_PDUMP_SUSPEND_Q_NAME "PVRSRVPDumpSuspendMsgQ" #define PVRSRV_PDUMP_SUSPEND_Q_LENGTH 8 -#endif +#endif typedef struct _PVRSRV_REGISTRY_INFO_ @@ -826,7 +829,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVWriteRegistryString (PPVRSRV_REGISTRY_INFO psReg #define PVRSRV_BC_FLAGS_YUVCSC_BT601 (0 << 1) #define PVRSRV_BC_FLAGS_YUVCSC_BT709 (1 << 1) -#define MAX_BUFFER_DEVICE_NAME_SIZE (50) +#define MAX_BUFFER_DEVICE_NAME_SIZE (50) typedef struct BUFFER_INFO_TAG { @@ -848,4 +851,4 @@ typedef enum _OVERLAY_DEINTERLACE_MODE_ BOB_EVEN_NONINTERLEAVED } OVERLAY_DEINTERLACE_MODE; -#endif +#endif diff --git a/drivers/staging/mrst/pvr/include4/sgx_options.h b/drivers/staging/mrst/pvr/include4/sgx_options.h index 35423db..77ff8b7 100644 --- a/drivers/staging/mrst/pvr/include4/sgx_options.h +++ b/drivers/staging/mrst/pvr/include4/sgx_options.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ diff --git a/drivers/staging/mrst/pvr/include4/sgxapi_km.h b/drivers/staging/mrst/pvr/include4/sgxapi_km.h index c51dfcc..eaf45eb 100644 --- a/drivers/staging/mrst/pvr/include4/sgxapi_km.h +++ b/drivers/staging/mrst/pvr/include4/sgxapi_km.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -80,7 +80,7 @@ extern "C" { * their ISP controll stream to. */ #if (defined(SUPPORT_PERCONTEXT_PB) || defined(SUPPORT_HYBRID_PB)) -#define SGX_3DPARAMETERS_HEAP_ID SGX_PERCONTEXT_3DPARAMETERS_HEAP_ID +#define SGX_3DPARAMETERS_HEAP_ID SGX_PERCONTEXT_3DPARAMETERS_HEAP_ID #else #define SGX_3DPARAMETERS_HEAP_ID SGX_SHARED_3DPARAMETERS_HEAP_ID #endif @@ -102,9 +102,11 @@ extern "C" { /* note: there is implicitly 1 3D Dst Sync */ #else /* sync info structure array size */ -#define SGX_MAX_SRC_SYNCS 8 -#define SGX_MAX_DST_SYNCS 1 +#define SGX_MAX_SRC_SYNCS_TA 8 +#define SGX_MAX_DST_SYNCS_TA 1 /* note: there is implicitly 1 3D Dst Sync */ +#define SGX_MAX_SRC_SYNCS_TQ 8 +#define SGX_MAX_DST_SYNCS_TQ 1 #endif @@ -186,7 +188,7 @@ extern "C" { /*! ***************************************************************************** - * One entry in the HWPerf Circular Buffer. + * One entry in the HWPerf Circular Buffer. *****************************************************************************/ typedef struct _PVRSRV_SGX_HWPERF_CB_ENTRY_ { @@ -197,7 +199,7 @@ typedef struct _PVRSRV_SGX_HWPERF_CB_ENTRY_ IMG_UINT32 ui32Ordinal; IMG_UINT32 ui32Info; IMG_UINT32 ui32Clocksx16; - /* NOTE: There should always be at least as many 3D cores as TA cores. */ + /* NOTE: There should always be at least as many 3D cores as TA cores. */ IMG_UINT32 ui32Counters[SGX_FEATURE_MP_CORE_COUNT_3D][PVRSRV_SGX_HWPERF_NUM_COUNTERS]; IMG_UINT32 ui32MiscCounters[SGX_FEATURE_MP_CORE_COUNT_3D][PVRSRV_SGX_HWPERF_NUM_MISC_COUNTERS]; } PVRSRV_SGX_HWPERF_CB_ENTRY; @@ -336,7 +338,7 @@ typedef struct _PVRSRV_SGX_MISCINFO_SET_HWPERF_STATUS { /* See PVRSRV_SGX_HWPERF_STATUS_* */ IMG_UINT32 ui32NewHWPerfStatus; - + #if defined(SGX_FEATURE_EXTENDED_PERF_COUNTERS) /* Specifies the HW's active group selectors */ IMG_UINT32 aui32PerfGroup[PVRSRV_SGX_HWPERF_NUM_COUNTERS]; @@ -445,7 +447,7 @@ typedef struct _SGX_KICKTA_DUMP_BUFFER_ #if defined(SUPPORT_SGX_NEW_STATUS_VALS) IMG_HANDLE hCtrlKernelMemInfo; /*< MemInfo handle for the control structure of the circular buffer */ - IMG_DEV_VIRTADDR sCtrlDevVAddr; /*< Device virtual address of the memory in the + IMG_DEV_VIRTADDR sCtrlDevVAddr; /*< Device virtual address of the memory in the control structure to be checked */ #endif IMG_PCHAR pszName; /*< Name of buffer */ diff --git a/drivers/staging/mrst/pvr/include4/sgxscript.h b/drivers/staging/mrst/pvr/include4/sgxscript.h index 7c4a5dc..94eb453 100644 --- a/drivers/staging/mrst/pvr/include4/sgxscript.h +++ b/drivers/staging/mrst/pvr/include4/sgxscript.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * *****************************************************************************/ #ifndef __SGXSCRIPT_H__ @@ -58,11 +58,11 @@ typedef union _SGX_INIT_COMMAND IMG_UINT32 ui32Value; } sPDumpHWReg; #endif -#if defined(FIX_HW_BRN_22997) && defined(FIX_HW_BRN_23030) && defined(SGX_FEATURE_HOST_PORT) +#if defined(FIX_HW_BRN_22997) && defined(FIX_HW_BRN_23030) && defined(SGX_FEATURE_HOST_PORT) struct { SGX_INIT_OPERATION eOp; } sWorkaroundBRN22997; -#endif +#endif } SGX_INIT_COMMAND; typedef struct _SGX_INIT_SCRIPTS_ diff --git a/drivers/staging/mrst/pvr/services4/include/kernelbuffer.h b/drivers/staging/mrst/pvr/services4/include/kernelbuffer.h index 78fb3c6..4cd36d2 100644 --- a/drivers/staging/mrst/pvr/services4/include/kernelbuffer.h +++ b/drivers/staging/mrst/pvr/services4/include/kernelbuffer.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -50,7 +50,7 @@ typedef struct PVRSRV_BC_SRV2BUFFER_KMJTABLE_TAG typedef PVRSRV_ERROR (*PFN_BC_REGISTER_BUFFER_DEV)(PVRSRV_BC_SRV2BUFFER_KMJTABLE*, IMG_UINT32*); typedef IMG_VOID (*PFN_BC_SCHEDULE_DEVICES)(IMG_VOID); -typedef PVRSRV_ERROR (*PFN_BC_REMOVE_BUFFER_DEV)(IMG_UINT32); +typedef PVRSRV_ERROR (*PFN_BC_REMOVE_BUFFER_DEV)(IMG_UINT32); typedef struct PVRSRV_BC_BUFFER2SRV_KMJTABLE_TAG { @@ -61,7 +61,7 @@ typedef struct PVRSRV_BC_BUFFER2SRV_KMJTABLE_TAG } PVRSRV_BC_BUFFER2SRV_KMJTABLE, *PPVRSRV_BC_BUFFER2SRV_KMJTABLE; -typedef IMG_BOOL (*PFN_BC_GET_PVRJTABLE) (PPVRSRV_BC_BUFFER2SRV_KMJTABLE); +typedef IMG_BOOL (*PFN_BC_GET_PVRJTABLE) (PPVRSRV_BC_BUFFER2SRV_KMJTABLE); IMG_IMPORT IMG_BOOL PVRGetBufferClassJTable(PVRSRV_BC_BUFFER2SRV_KMJTABLE *psJTable); diff --git a/drivers/staging/mrst/pvr/services4/include/kerneldisplay.h b/drivers/staging/mrst/pvr/services4/include/kerneldisplay.h index 67fad0f..d4fd59f 100644 --- a/drivers/staging/mrst/pvr/services4/include/kerneldisplay.h +++ b/drivers/staging/mrst/pvr/services4/include/kerneldisplay.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -41,15 +41,15 @@ typedef PVRSRV_ERROR (*PFN_ENUM_DC_DIMS)(IMG_HANDLE, typedef PVRSRV_ERROR (*PFN_GET_DC_SYSTEMBUFFER)(IMG_HANDLE, IMG_HANDLE*); typedef PVRSRV_ERROR (*PFN_GET_DC_INFO)(IMG_HANDLE, DISPLAY_INFO*); typedef PVRSRV_ERROR (*PFN_CREATE_DC_SWAPCHAIN)(IMG_HANDLE, - IMG_UINT32, - DISPLAY_SURF_ATTRIBUTES*, + IMG_UINT32, + DISPLAY_SURF_ATTRIBUTES*, DISPLAY_SURF_ATTRIBUTES*, - IMG_UINT32, + IMG_UINT32, PVRSRV_SYNC_DATA**, IMG_UINT32, - IMG_HANDLE*, + IMG_HANDLE*, IMG_UINT32*); -typedef PVRSRV_ERROR (*PFN_DESTROY_DC_SWAPCHAIN)(IMG_HANDLE, +typedef PVRSRV_ERROR (*PFN_DESTROY_DC_SWAPCHAIN)(IMG_HANDLE, IMG_HANDLE); typedef PVRSRV_ERROR (*PFN_SET_DC_DSTRECT)(IMG_HANDLE, IMG_HANDLE, IMG_RECT*); typedef PVRSRV_ERROR (*PFN_SET_DC_SRCRECT)(IMG_HANDLE, IMG_HANDLE, IMG_RECT*); @@ -139,25 +139,25 @@ typedef struct PVRSRV_DC_DISP2SRV_KMJTABLE_TAG typedef struct DISPLAYCLASS_FLIP_COMMAND_TAG { - + IMG_HANDLE hExtDevice; - + IMG_HANDLE hExtSwapChain; - + IMG_HANDLE hExtBuffer; - + IMG_HANDLE hPrivateTag; - + IMG_UINT32 ui32ClipRectCount; - + IMG_RECT *psClipRect; - + IMG_UINT32 ui32SwapInterval; } DISPLAYCLASS_FLIP_COMMAND; @@ -165,28 +165,28 @@ typedef struct DISPLAYCLASS_FLIP_COMMAND_TAG typedef struct DISPLAYCLASS_FLIP_COMMAND2_TAG { - + IMG_HANDLE hExtDevice; - + IMG_HANDLE hExtSwapChain; - + IMG_HANDLE hUnused; - + IMG_UINT32 ui32SwapInterval; - + IMG_PVOID pvPrivData; - + IMG_UINT32 ui32PrivDataLength; - + PDC_MEM_INFO *ppsMemInfos; - + IMG_UINT32 ui32NumMemInfos; } DISPLAYCLASS_FLIP_COMMAND2; diff --git a/drivers/staging/mrst/pvr/services4/include/pdump.h b/drivers/staging/mrst/pvr/services4/include/pdump.h index 8f7e5ea..c41a6d4 100644 --- a/drivers/staging/mrst/pvr/services4/include/pdump.h +++ b/drivers/staging/mrst/pvr/services4/include/pdump.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -33,5 +33,5 @@ #define PDUMP_FLAGS_CONTINUOUS 0x40000000U #define PDUMP_FLAGS_PERSISTENT 0x80000000U -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/include/pvr_bridge.h b/drivers/staging/mrst/pvr/services4/include/pvr_bridge.h index 461f63a..5d96068 100644 --- a/drivers/staging/mrst/pvr/services4/include/pvr_bridge.h +++ b/drivers/staging/mrst/pvr/services4/include/pvr_bridge.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -36,14 +36,14 @@ extern "C" { #ifdef __linux__ #include - + #define PVRSRV_IOC_GID 'g' #define PVRSRV_IO(INDEX) _IO(PVRSRV_IOC_GID, INDEX, PVRSRV_BRIDGE_PACKAGE) #define PVRSRV_IOW(INDEX) _IOW(PVRSRV_IOC_GID, INDEX, PVRSRV_BRIDGE_PACKAGE) #define PVRSRV_IOR(INDEX) _IOR(PVRSRV_IOC_GID, INDEX, PVRSRV_BRIDGE_PACKAGE) #define PVRSRV_IOWR(INDEX) _IOWR(PVRSRV_IOC_GID, INDEX, PVRSRV_BRIDGE_PACKAGE) -#else +#else #error Unknown platform: Cannot define ioctls @@ -53,26 +53,26 @@ extern "C" { #define PVRSRV_IOWR(INDEX) (PVRSRV_IOC_GID + (INDEX)) #define PVRSRV_BRIDGE_BASE PVRSRV_IOC_GID -#endif +#endif #define PVRSRV_BRIDGE_CORE_CMD_FIRST 0UL -#define PVRSRV_BRIDGE_ENUM_DEVICES PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+0) -#define PVRSRV_BRIDGE_ACQUIRE_DEVICEINFO PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+1) -#define PVRSRV_BRIDGE_RELEASE_DEVICEINFO PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+2) -#define PVRSRV_BRIDGE_CREATE_DEVMEMCONTEXT PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+3) -#define PVRSRV_BRIDGE_DESTROY_DEVMEMCONTEXT PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+4) -#define PVRSRV_BRIDGE_GET_DEVMEM_HEAPINFO PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+5) -#define PVRSRV_BRIDGE_ALLOC_DEVICEMEM PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+6) -#define PVRSRV_BRIDGE_FREE_DEVICEMEM PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+7) -#define PVRSRV_BRIDGE_GETFREE_DEVICEMEM PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+8) -#define PVRSRV_BRIDGE_CREATE_COMMANDQUEUE PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+9) -#define PVRSRV_BRIDGE_DESTROY_COMMANDQUEUE PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+10) -#define PVRSRV_BRIDGE_MHANDLE_TO_MMAP_DATA PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+11) -#define PVRSRV_BRIDGE_CONNECT_SERVICES PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+12) -#define PVRSRV_BRIDGE_DISCONNECT_SERVICES PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+13) -#define PVRSRV_BRIDGE_WRAP_DEVICE_MEM PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+14) -#define PVRSRV_BRIDGE_GET_DEVICEMEMINFO PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+15) +#define PVRSRV_BRIDGE_ENUM_DEVICES PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+0) +#define PVRSRV_BRIDGE_ACQUIRE_DEVICEINFO PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+1) +#define PVRSRV_BRIDGE_RELEASE_DEVICEINFO PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+2) +#define PVRSRV_BRIDGE_CREATE_DEVMEMCONTEXT PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+3) +#define PVRSRV_BRIDGE_DESTROY_DEVMEMCONTEXT PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+4) +#define PVRSRV_BRIDGE_GET_DEVMEM_HEAPINFO PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+5) +#define PVRSRV_BRIDGE_ALLOC_DEVICEMEM PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+6) +#define PVRSRV_BRIDGE_FREE_DEVICEMEM PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+7) +#define PVRSRV_BRIDGE_GETFREE_DEVICEMEM PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+8) +#define PVRSRV_BRIDGE_CREATE_COMMANDQUEUE PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+9) +#define PVRSRV_BRIDGE_DESTROY_COMMANDQUEUE PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+10) +#define PVRSRV_BRIDGE_MHANDLE_TO_MMAP_DATA PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+11) +#define PVRSRV_BRIDGE_CONNECT_SERVICES PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+12) +#define PVRSRV_BRIDGE_DISCONNECT_SERVICES PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+13) +#define PVRSRV_BRIDGE_WRAP_DEVICE_MEM PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+14) +#define PVRSRV_BRIDGE_GET_DEVICEMEMINFO PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+15) #define PVRSRV_BRIDGE_RESERVE_DEV_VIRTMEM PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+16) #define PVRSRV_BRIDGE_FREE_DEV_VIRTMEM PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+17) #define PVRSRV_BRIDGE_MAP_EXT_MEMORY PVRSRV_IOWR(PVRSRV_BRIDGE_CORE_CMD_FIRST+18) @@ -91,30 +91,30 @@ extern "C" { #define PVRSRV_BRIDGE_CORE_CMD_LAST (PVRSRV_BRIDGE_CORE_CMD_FIRST+30) #define PVRSRV_BRIDGE_SIM_CMD_FIRST (PVRSRV_BRIDGE_CORE_CMD_LAST+1) -#define PVRSRV_BRIDGE_PROCESS_SIMISR_EVENT PVRSRV_IOWR(PVRSRV_BRIDGE_SIM_CMD_FIRST+0) -#define PVRSRV_BRIDGE_REGISTER_SIM_PROCESS PVRSRV_IOWR(PVRSRV_BRIDGE_SIM_CMD_FIRST+1) -#define PVRSRV_BRIDGE_UNREGISTER_SIM_PROCESS PVRSRV_IOWR(PVRSRV_BRIDGE_SIM_CMD_FIRST+2) +#define PVRSRV_BRIDGE_PROCESS_SIMISR_EVENT PVRSRV_IOWR(PVRSRV_BRIDGE_SIM_CMD_FIRST+0) +#define PVRSRV_BRIDGE_REGISTER_SIM_PROCESS PVRSRV_IOWR(PVRSRV_BRIDGE_SIM_CMD_FIRST+1) +#define PVRSRV_BRIDGE_UNREGISTER_SIM_PROCESS PVRSRV_IOWR(PVRSRV_BRIDGE_SIM_CMD_FIRST+2) #define PVRSRV_BRIDGE_SIM_CMD_LAST (PVRSRV_BRIDGE_SIM_CMD_FIRST+2) #define PVRSRV_BRIDGE_MAPPING_CMD_FIRST (PVRSRV_BRIDGE_SIM_CMD_LAST+1) -#define PVRSRV_BRIDGE_MAPPHYSTOUSERSPACE PVRSRV_IOWR(PVRSRV_BRIDGE_MAPPING_CMD_FIRST+0) -#define PVRSRV_BRIDGE_UNMAPPHYSTOUSERSPACE PVRSRV_IOWR(PVRSRV_BRIDGE_MAPPING_CMD_FIRST+1) -#define PVRSRV_BRIDGE_GETPHYSTOUSERSPACEMAP PVRSRV_IOWR(PVRSRV_BRIDGE_MAPPING_CMD_FIRST+2) +#define PVRSRV_BRIDGE_MAPPHYSTOUSERSPACE PVRSRV_IOWR(PVRSRV_BRIDGE_MAPPING_CMD_FIRST+0) +#define PVRSRV_BRIDGE_UNMAPPHYSTOUSERSPACE PVRSRV_IOWR(PVRSRV_BRIDGE_MAPPING_CMD_FIRST+1) +#define PVRSRV_BRIDGE_GETPHYSTOUSERSPACEMAP PVRSRV_IOWR(PVRSRV_BRIDGE_MAPPING_CMD_FIRST+2) #define PVRSRV_BRIDGE_MAPPING_CMD_LAST (PVRSRV_BRIDGE_MAPPING_CMD_FIRST+2) #define PVRSRV_BRIDGE_STATS_CMD_FIRST (PVRSRV_BRIDGE_MAPPING_CMD_LAST+1) -#define PVRSRV_BRIDGE_GET_FB_STATS PVRSRV_IOWR(PVRSRV_BRIDGE_STATS_CMD_FIRST+0) +#define PVRSRV_BRIDGE_GET_FB_STATS PVRSRV_IOWR(PVRSRV_BRIDGE_STATS_CMD_FIRST+0) #define PVRSRV_BRIDGE_STATS_CMD_LAST (PVRSRV_BRIDGE_STATS_CMD_FIRST+0) #define PVRSRV_BRIDGE_MISC_CMD_FIRST (PVRSRV_BRIDGE_STATS_CMD_LAST+1) -#define PVRSRV_BRIDGE_GET_MISC_INFO PVRSRV_IOWR(PVRSRV_BRIDGE_MISC_CMD_FIRST+0) -#define PVRSRV_BRIDGE_RELEASE_MISC_INFO PVRSRV_IOWR(PVRSRV_BRIDGE_MISC_CMD_FIRST+1) +#define PVRSRV_BRIDGE_GET_MISC_INFO PVRSRV_IOWR(PVRSRV_BRIDGE_MISC_CMD_FIRST+0) +#define PVRSRV_BRIDGE_RELEASE_MISC_INFO PVRSRV_IOWR(PVRSRV_BRIDGE_MISC_CMD_FIRST+1) #define PVRSRV_BRIDGE_MISC_CMD_LAST (PVRSRV_BRIDGE_MISC_CMD_FIRST+1) #if defined (SUPPORT_OVERLAY_ROTATE_BLIT) #define PVRSRV_BRIDGE_OVERLAY_CMD_FIRST (PVRSRV_BRIDGE_MISC_CMD_LAST+1) -#define PVRSRV_BRIDGE_INIT_3D_OVL_BLT_RES PVRSRV_IOWR(PVRSRV_BRIDGE_OVERLAY_CMD_FIRST+0) -#define PVRSRV_BRIDGE_DEINIT_3D_OVL_BLT_RES PVRSRV_IOWR(PVRSRV_BRIDGE_OVERLAY_CMD_FIRST+1) +#define PVRSRV_BRIDGE_INIT_3D_OVL_BLT_RES PVRSRV_IOWR(PVRSRV_BRIDGE_OVERLAY_CMD_FIRST+0) +#define PVRSRV_BRIDGE_DEINIT_3D_OVL_BLT_RES PVRSRV_IOWR(PVRSRV_BRIDGE_OVERLAY_CMD_FIRST+1) #define PVRSRV_BRIDGE_OVERLAY_CMD_LAST (PVRSRV_BRIDGE_OVERLAY_CMD_FIRST+1) #else #define PVRSRV_BRIDGE_OVERLAY_CMD_LAST PVRSRV_BRIDGE_MISC_CMD_LAST @@ -122,21 +122,21 @@ extern "C" { #if defined(PDUMP) #define PVRSRV_BRIDGE_PDUMP_CMD_FIRST (PVRSRV_BRIDGE_OVERLAY_CMD_LAST+1) -#define PVRSRV_BRIDGE_PDUMP_INIT PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+0) -#define PVRSRV_BRIDGE_PDUMP_MEMPOL PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+1) -#define PVRSRV_BRIDGE_PDUMP_DUMPMEM PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+2) -#define PVRSRV_BRIDGE_PDUMP_REG PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+3) -#define PVRSRV_BRIDGE_PDUMP_REGPOL PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+4) -#define PVRSRV_BRIDGE_PDUMP_COMMENT PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+5) -#define PVRSRV_BRIDGE_PDUMP_SETFRAME PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+6) -#define PVRSRV_BRIDGE_PDUMP_ISCAPTURING PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+7) -#define PVRSRV_BRIDGE_PDUMP_DUMPBITMAP PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+8) -#define PVRSRV_BRIDGE_PDUMP_DUMPREADREG PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+9) -#define PVRSRV_BRIDGE_PDUMP_SYNCPOL PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+10) -#define PVRSRV_BRIDGE_PDUMP_DUMPSYNC PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+11) -#define PVRSRV_BRIDGE_PDUMP_MEMPAGES PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+12) -#define PVRSRV_BRIDGE_PDUMP_DRIVERINFO PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+13) -#define PVRSRV_BRIDGE_PDUMP_DUMPPDDEVPADDR PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+15) +#define PVRSRV_BRIDGE_PDUMP_INIT PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+0) +#define PVRSRV_BRIDGE_PDUMP_MEMPOL PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+1) +#define PVRSRV_BRIDGE_PDUMP_DUMPMEM PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+2) +#define PVRSRV_BRIDGE_PDUMP_REG PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+3) +#define PVRSRV_BRIDGE_PDUMP_REGPOL PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+4) +#define PVRSRV_BRIDGE_PDUMP_COMMENT PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+5) +#define PVRSRV_BRIDGE_PDUMP_SETFRAME PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+6) +#define PVRSRV_BRIDGE_PDUMP_ISCAPTURING PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+7) +#define PVRSRV_BRIDGE_PDUMP_DUMPBITMAP PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+8) +#define PVRSRV_BRIDGE_PDUMP_DUMPREADREG PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+9) +#define PVRSRV_BRIDGE_PDUMP_SYNCPOL PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+10) +#define PVRSRV_BRIDGE_PDUMP_DUMPSYNC PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+11) +#define PVRSRV_BRIDGE_PDUMP_MEMPAGES PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+12) +#define PVRSRV_BRIDGE_PDUMP_DRIVERINFO PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+13) +#define PVRSRV_BRIDGE_PDUMP_DUMPPDDEVPADDR PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+15) #define PVRSRV_BRIDGE_PDUMP_CYCLE_COUNT_REG_READ PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+16) #define PVRSRV_BRIDGE_PDUMP_STARTINITPHASE PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+17) #define PVRSRV_BRIDGE_PDUMP_STOPINITPHASE PVRSRV_IOWR(PVRSRV_BRIDGE_PDUMP_CMD_FIRST+18) @@ -146,7 +146,7 @@ extern "C" { #endif #define PVRSRV_BRIDGE_OEM_CMD_FIRST (PVRSRV_BRIDGE_PDUMP_CMD_LAST+1) -#define PVRSRV_BRIDGE_GET_OEMJTABLE PVRSRV_IOWR(PVRSRV_BRIDGE_OEM_CMD_FIRST+0) +#define PVRSRV_BRIDGE_GET_OEMJTABLE PVRSRV_IOWR(PVRSRV_BRIDGE_OEM_CMD_FIRST+0) #define PVRSRV_BRIDGE_OEM_CMD_LAST (PVRSRV_BRIDGE_OEM_CMD_FIRST+0) #define PVRSRV_BRIDGE_DEVCLASS_CMD_FIRST (PVRSRV_BRIDGE_OEM_CMD_LAST+1) @@ -231,30 +231,30 @@ typedef struct PVRSRV_BRIDGE_RETURN_TAG typedef struct PVRSRV_BRIDGE_PACKAGE_TAG { - IMG_UINT32 ui32BridgeID; - IMG_UINT32 ui32Size; - IMG_VOID *pvParamIn; - IMG_UINT32 ui32InBufferSize; - IMG_VOID *pvParamOut; - IMG_UINT32 ui32OutBufferSize; + IMG_UINT32 ui32BridgeID; + IMG_UINT32 ui32Size; + IMG_VOID *pvParamIn; + IMG_UINT32 ui32InBufferSize; + IMG_VOID *pvParamOut; + IMG_UINT32 ui32OutBufferSize; #if defined (SUPPORT_SID_INTERFACE) - IMG_SID hKernelServices; + IMG_SID hKernelServices; #else - IMG_HANDLE hKernelServices; + IMG_HANDLE hKernelServices; #endif }PVRSRV_BRIDGE_PACKAGE; typedef struct PVRSRV_BRIDGE_IN_CONNECT_SERVICES_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_UINT32 ui32Flags; } PVRSRV_BRIDGE_IN_CONNECT_SERVICES; typedef struct PVRSRV_BRIDGE_IN_ACQUIRE_DEVICEINFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_UINT32 uiDevIndex; PVRSRV_DEVICE_TYPE eDeviceType; @@ -263,14 +263,14 @@ typedef struct PVRSRV_BRIDGE_IN_ACQUIRE_DEVICEINFO_TAG typedef struct PVRSRV_BRIDGE_IN_ENUMCLASS_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; PVRSRV_DEVICE_CLASS sDeviceClass; } PVRSRV_BRIDGE_IN_ENUMCLASS; typedef struct PVRSRV_BRIDGE_IN_CLOSE_DISPCLASS_DEVICE_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; #else @@ -281,7 +281,7 @@ typedef struct PVRSRV_BRIDGE_IN_CLOSE_DISPCLASS_DEVICE_TAG typedef struct PVRSRV_BRIDGE_IN_ENUM_DISPCLASS_FORMATS_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; #else @@ -292,7 +292,7 @@ typedef struct PVRSRV_BRIDGE_IN_ENUM_DISPCLASS_FORMATS_TAG typedef struct PVRSRV_BRIDGE_IN_GET_DISPCLASS_SYSBUFFER_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; #else @@ -303,7 +303,7 @@ typedef struct PVRSRV_BRIDGE_IN_GET_DISPCLASS_SYSBUFFER_TAG typedef struct PVRSRV_BRIDGE_IN_GET_DISPCLASS_INFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; #else @@ -314,7 +314,7 @@ typedef struct PVRSRV_BRIDGE_IN_GET_DISPCLASS_INFO_TAG typedef struct PVRSRV_BRIDGE_IN_CLOSE_BUFFERCLASS_DEVICE_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; #else @@ -325,7 +325,7 @@ typedef struct PVRSRV_BRIDGE_IN_CLOSE_BUFFERCLASS_DEVICE_TAG typedef struct PVRSRV_BRIDGE_IN_GET_BUFFERCLASS_INFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; #else @@ -336,7 +336,7 @@ typedef struct PVRSRV_BRIDGE_IN_GET_BUFFERCLASS_INFO_TAG typedef struct PVRSRV_BRIDGE_IN_RELEASE_DEVICEINFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -348,7 +348,7 @@ typedef struct PVRSRV_BRIDGE_IN_RELEASE_DEVICEINFO_TAG typedef struct PVRSRV_BRIDGE_IN_FREE_CLASSDEVICEINFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; PVRSRV_DEVICE_CLASS DeviceClass; IMG_VOID* pvDevInfo; @@ -357,7 +357,7 @@ typedef struct PVRSRV_BRIDGE_IN_FREE_CLASSDEVICEINFO_TAG typedef struct PVRSRV_BRIDGE_IN_GET_DEVMEM_HEAPINFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; IMG_SID hDevMemContext; @@ -371,7 +371,7 @@ typedef struct PVRSRV_BRIDGE_IN_GET_DEVMEM_HEAPINFO_TAG typedef struct PVRSRV_BRIDGE_IN_CREATE_DEVMEMCONTEXT_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -383,7 +383,7 @@ typedef struct PVRSRV_BRIDGE_IN_CREATE_DEVMEMCONTEXT_TAG typedef struct PVRSRV_BRIDGE_IN_DESTROY_DEVMEMCONTEXT_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; IMG_SID hDevMemContext; @@ -397,7 +397,7 @@ typedef struct PVRSRV_BRIDGE_IN_DESTROY_DEVMEMCONTEXT_TAG typedef struct PVRSRV_BRIDGE_IN_ALLOCDEVICEMEM_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; IMG_SID hDevMemHeap; @@ -415,7 +415,7 @@ typedef struct PVRSRV_BRIDGE_IN_ALLOCDEVICEMEM_TAG typedef struct PVRSRV_BRIDGE_IN_MAPMEMINFOTOUSER_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelMemInfo; #else @@ -426,7 +426,7 @@ typedef struct PVRSRV_BRIDGE_IN_MAPMEMINFOTOUSER_TAG typedef struct PVRSRV_BRIDGE_IN_UNMAPMEMINFOFROMUSER_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelMemInfo; #else @@ -443,7 +443,7 @@ typedef struct PVRSRV_BRIDGE_IN_UNMAPMEMINFOFROMUSER_TAG typedef struct PVRSRV_BRIDGE_IN_FREEDEVICEMEM_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; IMG_SID hKernelMemInfo; @@ -457,7 +457,7 @@ typedef struct PVRSRV_BRIDGE_IN_FREEDEVICEMEM_TAG typedef struct PVRSRV_BRIDGE_IN_EXPORTDEVICEMEM_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; IMG_SID hKernelMemInfo; @@ -470,14 +470,14 @@ typedef struct PVRSRV_BRIDGE_IN_EXPORTDEVICEMEM_TAG typedef struct PVRSRV_BRIDGE_IN_GETFREEDEVICEMEM_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_UINT32 ui32Flags; } PVRSRV_BRIDGE_IN_GETFREEDEVICEMEM; typedef struct PVRSRV_BRIDGE_IN_CREATECOMMANDQUEUE_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -490,7 +490,7 @@ typedef struct PVRSRV_BRIDGE_IN_CREATECOMMANDQUEUE_TAG typedef struct PVRSRV_BRIDGE_IN_DESTROYCOMMANDQUEUE_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -503,29 +503,29 @@ typedef struct PVRSRV_BRIDGE_IN_DESTROYCOMMANDQUEUE_TAG typedef struct PVRSRV_BRIDGE_IN_MHANDLE_TO_MMAP_DATA_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) - IMG_SID hMHandle; + IMG_SID hMHandle; #else - IMG_HANDLE hMHandle; + IMG_HANDLE hMHandle; #endif } PVRSRV_BRIDGE_IN_MHANDLE_TO_MMAP_DATA; typedef struct PVRSRV_BRIDGE_IN_RELEASE_MMAP_DATA_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) - IMG_SID hMHandle; + IMG_SID hMHandle; #else - IMG_HANDLE hMHandle; + IMG_HANDLE hMHandle; #endif } PVRSRV_BRIDGE_IN_RELEASE_MMAP_DATA; typedef struct PVRSRV_BRIDGE_IN_RESERVE_DEV_VIRTMEM_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevMemHeap; #else @@ -565,7 +565,7 @@ typedef struct PVRSRV_BRIDGE_OUT_RESERVE_DEV_VIRTMEM_TAG typedef struct PVRSRV_BRIDGE_IN_FREE_DEV_VIRTMEM_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelMemInfo; #else @@ -579,7 +579,7 @@ typedef struct PVRSRV_BRIDGE_IN_FREE_DEV_VIRTMEM_TAG typedef struct PVRSRV_BRIDGE_IN_MAP_DEV_MEMORY_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelMemInfo; IMG_SID hDstDevMemHeap; @@ -607,7 +607,7 @@ typedef struct PVRSRV_BRIDGE_OUT_MAP_DEV_MEMORY_TAG typedef struct PVRSRV_BRIDGE_IN_UNMAP_DEV_MEMORY_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelMemInfo; #else @@ -621,7 +621,7 @@ typedef struct PVRSRV_BRIDGE_IN_UNMAP_DEV_MEMORY_TAG typedef struct PVRSRV_BRIDGE_IN_MAP_EXT_MEMORY_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelMemInfo; #else @@ -634,7 +634,7 @@ typedef struct PVRSRV_BRIDGE_IN_MAP_EXT_MEMORY_TAG typedef struct PVRSRV_BRIDGE_IN_UNMAP_EXT_MEMORY_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; PVRSRV_CLIENT_MEM_INFO sClientMemInfo; PVRSRV_CLIENT_SYNC_INFO sClientSyncInfo; IMG_UINT32 ui32Flags; @@ -643,7 +643,7 @@ typedef struct PVRSRV_BRIDGE_IN_UNMAP_EXT_MEMORY_TAG typedef struct PVRSRV_BRIDGE_IN_MAP_DEVICECLASS_MEMORY_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceClassBuffer; IMG_SID hDevMemContext; @@ -673,7 +673,7 @@ typedef struct PVRSRV_BRIDGE_OUT_MAP_DEVICECLASS_MEMORY_TAG typedef struct PVRSRV_BRIDGE_IN_UNMAP_DEVICECLASS_MEMORY_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelMemInfo; #else @@ -687,7 +687,7 @@ typedef struct PVRSRV_BRIDGE_IN_UNMAP_DEVICECLASS_MEMORY_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_MEMPOL_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelMemInfo; #else @@ -703,7 +703,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_MEMPOL_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_SYNCPOL_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelSyncInfo; #else @@ -719,7 +719,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_SYNCPOL_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_DUMPMEM_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_PVOID pvLinAddr; IMG_PVOID pvAltLinAddr; #if defined (SUPPORT_SID_INTERFACE) @@ -736,7 +736,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_DUMPMEM_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_DUMPSYNC_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_PVOID pvAltLinAddr; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelSyncInfo; @@ -751,7 +751,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_DUMPSYNC_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_DUMPREG_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -765,7 +765,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_DUMPREG_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_REGPOL_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -779,7 +779,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_REGPOL_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_DUMPPDREG_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; PVRSRV_HWREG sHWReg; IMG_UINT32 ui32Flags; @@ -787,7 +787,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_DUMPPDREG_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_MEMPAGES_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; IMG_SID hKernelMemInfo; @@ -806,7 +806,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_MEMPAGES_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_COMMENT_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_CHAR szComment[PVRSRV_PDUMP_MAX_COMMENT_SIZE]; IMG_UINT32 ui32Flags; @@ -815,7 +815,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_COMMENT_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_SETFRAME_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_UINT32 ui32Frame; }PVRSRV_BRIDGE_IN_PDUMP_SETFRAME; @@ -823,7 +823,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_SETFRAME_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_BITMAP_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -850,7 +850,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_BITMAP_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_READREG_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -867,7 +867,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_READREG_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_DRIVERINFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_CHAR szString[PVRSRV_PDUMP_MAX_COMMENT_SIZE]; IMG_BOOL bContinuous; @@ -875,7 +875,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_DRIVERINFO_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_DUMPPDDEVPADDR_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelMemInfo; #else @@ -887,7 +887,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_DUMPPDDEVPADDR_TAG typedef struct PVRSRV_BRIDGE_PDUM_IN_CYCLE_COUNT_REG_READ_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -930,7 +930,7 @@ typedef struct PVRSRV_BRIDGE_OUT_ENUMCLASS_TAG typedef struct PVRSRV_BRIDGE_IN_OPEN_DISPCLASS_DEVICE_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_UINT32 ui32DeviceID; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; @@ -954,7 +954,7 @@ typedef struct PVRSRV_BRIDGE_OUT_OPEN_DISPCLASS_DEVICE_TAG typedef struct PVRSRV_BRIDGE_IN_WRAP_EXT_MEMORY_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; IMG_SID hDevMemContext; @@ -982,7 +982,7 @@ typedef struct PVRSRV_BRIDGE_OUT_WRAP_EXT_MEMORY_TAG typedef struct PVRSRV_BRIDGE_IN_UNWRAP_EXT_MEMORY_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelMemInfo; #else @@ -1010,7 +1010,7 @@ typedef struct PVRSRV_BRIDGE_OUT_ENUM_DISPCLASS_FORMATS_TAG typedef struct PVRSRV_BRIDGE_IN_ENUM_DISPCLASS_DIMS_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; #else @@ -1052,7 +1052,7 @@ typedef struct PVRSRV_BRIDGE_OUT_GET_DISPCLASS_SYSBUFFER_TAG typedef struct PVRSRV_BRIDGE_IN_CREATE_DISPCLASS_SWAPCHAIN_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; #else @@ -1083,7 +1083,7 @@ typedef struct PVRSRV_BRIDGE_OUT_CREATE_DISPCLASS_SWAPCHAIN_TAG typedef struct PVRSRV_BRIDGE_IN_DESTROY_DISPCLASS_SWAPCHAIN_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; IMG_SID hSwapChain; @@ -1097,7 +1097,7 @@ typedef struct PVRSRV_BRIDGE_IN_DESTROY_DISPCLASS_SWAPCHAIN_TAG typedef struct PVRSRV_BRIDGE_IN_SET_DISPCLASS_RECT_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; IMG_SID hSwapChain; @@ -1112,7 +1112,7 @@ typedef struct PVRSRV_BRIDGE_IN_SET_DISPCLASS_RECT_TAG typedef struct PVRSRV_BRIDGE_IN_SET_DISPCLASS_COLOURKEY_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; IMG_SID hSwapChain; @@ -1127,7 +1127,7 @@ typedef struct PVRSRV_BRIDGE_IN_SET_DISPCLASS_COLOURKEY_TAG typedef struct PVRSRV_BRIDGE_IN_GET_DISPCLASS_BUFFERS_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; IMG_SID hSwapChain; @@ -1154,7 +1154,7 @@ typedef struct PVRSRV_BRIDGE_OUT_GET_DISPCLASS_BUFFERS_TAG typedef struct PVRSRV_BRIDGE_IN_SWAP_DISPCLASS_TO_BUFFER_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; IMG_SID hBuffer; @@ -1175,7 +1175,7 @@ typedef struct PVRSRV_BRIDGE_IN_SWAP_DISPCLASS_TO_BUFFER_TAG typedef struct PVRSRV_BRIDGE_IN_SWAP_DISPCLASS_TO_BUFFER2_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; IMG_SID hSwapChain; @@ -1196,7 +1196,7 @@ typedef struct PVRSRV_BRIDGE_IN_SWAP_DISPCLASS_TO_BUFFER2_TAG typedef struct PVRSRV_BRIDGE_IN_SWAP_DISPCLASS_TO_SYSTEM_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; IMG_SID hSwapChain; @@ -1230,7 +1230,7 @@ typedef struct PVRSRV_BRIDGE_OUT_GET_DISPCLASS_FRONT_BUFFER_TAG typedef struct PVRSRV_BRIDGE_IN_OPEN_BUFFERCLASS_DEVICE_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_UINT32 ui32DeviceID; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; @@ -1263,7 +1263,7 @@ typedef struct PVRSRV_BRIDGE_OUT_GET_BUFFERCLASS_INFO_TAG typedef struct PVRSRV_BRIDGE_IN_GET_BUFFERCLASS_BUFFER_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDeviceKM; #else @@ -1378,16 +1378,16 @@ typedef struct PVRSRV_BRIDGE_OUT_MHANDLE_TO_MMAP_DATA_TAG { PVRSRV_ERROR eError; - + IMG_UINT32 ui32MMapOffset; - + IMG_UINT32 ui32ByteOffset; - + IMG_UINT32 ui32RealByteSize; - + IMG_UINT32 ui32UserVAddr; } PVRSRV_BRIDGE_OUT_MHANDLE_TO_MMAP_DATA; @@ -1396,18 +1396,18 @@ typedef struct PVRSRV_BRIDGE_OUT_RELEASE_MMAP_DATA_TAG { PVRSRV_ERROR eError; - + IMG_BOOL bMUnmap; - + IMG_UINT32 ui32UserVAddr; - + IMG_UINT32 ui32RealByteSize; } PVRSRV_BRIDGE_OUT_RELEASE_MMAP_DATA; typedef struct PVRSRV_BRIDGE_IN_GET_MISC_INFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; PVRSRV_MISC_INFO sMiscInfo; }PVRSRV_BRIDGE_IN_GET_MISC_INFO; @@ -1423,7 +1423,7 @@ typedef struct PVRSRV_BRIDGE_OUT_GET_MISC_INFO_TAG typedef struct PVRSRV_BRIDGE_IN_RELEASE_MISC_INFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; PVRSRV_MISC_INFO sMiscInfo; }PVRSRV_BRIDGE_IN_RELEASE_MISC_INFO; @@ -1446,7 +1446,7 @@ typedef struct PVRSRV_BRIDGE_OUT_PDUMP_ISCAPTURING_TAG typedef struct PVRSRV_BRIDGE_IN_GET_FB_STATS_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_SIZE_T ui32Total; IMG_SIZE_T ui32Available; @@ -1455,7 +1455,7 @@ typedef struct PVRSRV_BRIDGE_IN_GET_FB_STATS_TAG typedef struct PVRSRV_BRIDGE_IN_MAPPHYSTOUSERSPACE_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -1478,7 +1478,7 @@ typedef struct PVRSRV_BRIDGE_OUT_MAPPHYSTOUSERSPACE_TAG typedef struct PVRSRV_BRIDGE_IN_UNMAPPHYSTOUSERSPACE_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -1501,7 +1501,7 @@ typedef struct PVRSRV_BRIDGE_OUT_GETPHYSTOUSERSPACEMAP_TAG #if !defined (SUPPORT_SID_INTERFACE) typedef struct PVRSRV_BRIDGE_IN_REGISTER_SIM_PROCESS_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_HANDLE hDevCookie; IMG_PVOID pvProcess; @@ -1510,8 +1510,8 @@ typedef struct PVRSRV_BRIDGE_IN_REGISTER_SIM_PROCESS_TAG typedef struct PVRSRV_BRIDGE_OUT_REGISTER_SIM_PROCESS_TAG { - IMG_SYS_PHYADDR sRegsPhysBase; - IMG_VOID *pvRegsBase; + IMG_SYS_PHYADDR sRegsPhysBase; + IMG_VOID *pvRegsBase; IMG_PVOID pvProcess; IMG_UINT32 ulNoOfEntries; IMG_PVOID pvTblLinAddr; @@ -1521,33 +1521,33 @@ typedef struct PVRSRV_BRIDGE_OUT_REGISTER_SIM_PROCESS_TAG typedef struct PVRSRV_BRIDGE_IN_UNREGISTER_SIM_PROCESS_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_HANDLE hDevCookie; IMG_PVOID pvProcess; - IMG_VOID *pvRegsBase; + IMG_VOID *pvRegsBase; } PVRSRV_BRIDGE_IN_UNREGISTER_SIM_PROCESS; typedef struct PVRSRV_BRIDGE_IN_PROCESS_SIMISR_EVENT_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_HANDLE hDevCookie; IMG_UINT32 ui32StatusAndMask; PVRSRV_ERROR eError; } PVRSRV_BRIDGE_IN_PROCESS_SIMISR_EVENT; -#endif +#endif typedef struct PVRSRV_BRIDGE_IN_INITSRV_DISCONNECT_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_BOOL bInitSuccesful; } PVRSRV_BRIDGE_IN_INITSRV_DISCONNECT; typedef struct PVRSRV_BRIDGE_IN_ALLOC_SHARED_SYS_MEM_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_UINT32 ui32Flags; IMG_SIZE_T ui32Size; }PVRSRV_BRIDGE_IN_ALLOC_SHARED_SYS_MEM; @@ -1568,7 +1568,7 @@ typedef struct PVRSRV_BRIDGE_IN_FREE_SHARED_SYS_MEM_TAG IMG_SID hKernelMemInfo; IMG_SID hMappingInfo; #else - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo; #endif PVRSRV_CLIENT_MEM_INFO sClientMemInfo; @@ -1581,7 +1581,7 @@ typedef struct PVRSRV_BRIDGE_OUT_FREE_SHARED_SYS_MEM_TAG typedef struct PVRSRV_BRIDGE_IN_MAP_MEMINFO_MEM_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelMemInfo; #else @@ -1603,7 +1603,7 @@ typedef struct PVRSRV_BRIDGE_OUT_MAP_MEMINFO_MEM_TAG typedef struct PVRSRV_BRIDGE_IN_UNMAP_MEMINFO_MEM_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; PVRSRV_CLIENT_MEM_INFO sClientMemInfo; }PVRSRV_BRIDGE_IN_UNMAP_MEMINFO_MEM; @@ -1614,7 +1614,7 @@ typedef struct PVRSRV_BRIDGE_OUT_UNMAP_MEMINFO_MEM_TAG typedef struct PVRSRV_BRIDGE_IN_EVENT_OBJECT_WAI_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hOSEventKM; #else @@ -1661,7 +1661,7 @@ typedef struct PVRSRV_BRIDGE_OUT_CREATE_SYNC_INFO_MOD_OBJ_TAG typedef struct PVRSRV_BRIDGE_IN_DESTROY_SYNC_INFO_MOD_OBJ { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelSyncInfoModObj; #else @@ -1671,7 +1671,7 @@ typedef struct PVRSRV_BRIDGE_IN_DESTROY_SYNC_INFO_MOD_OBJ typedef struct PVRSRV_BRIDGE_IN_MODIFY_PENDING_SYNC_OPS_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelSyncInfoModObj; IMG_SID hKernelSyncInfo; @@ -1685,7 +1685,7 @@ typedef struct PVRSRV_BRIDGE_IN_MODIFY_PENDING_SYNC_OPS_TAG typedef struct PVRSRV_BRIDGE_IN_MODIFY_COMPLETE_SYNC_OPS_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelSyncInfoModObj; #else @@ -1697,7 +1697,7 @@ typedef struct PVRSRV_BRIDGE_OUT_MODIFY_PENDING_SYNC_OPS_TAG { PVRSRV_ERROR eError; - + IMG_UINT32 ui32ReadOpsPending; IMG_UINT32 ui32WriteOpsPending; IMG_UINT32 ui32ReadOps2Pending; @@ -1706,7 +1706,7 @@ typedef struct PVRSRV_BRIDGE_OUT_MODIFY_PENDING_SYNC_OPS_TAG typedef struct PVRSRV_BRIDGE_IN_SYNC_OPS_TAKE_TOKEN_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelSyncInfo; #else @@ -1727,7 +1727,7 @@ typedef struct PVRSRV_BRIDGE_OUT_SYNC_OPS_TAKE_TOKEN_TAG typedef struct PVRSRV_BRIDGE_IN_SYNC_OPS_FLUSH_TO_TOKEN_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelSyncInfo; #else @@ -1740,7 +1740,7 @@ typedef struct PVRSRV_BRIDGE_IN_SYNC_OPS_FLUSH_TO_TOKEN_TAG typedef struct PVRSRV_BRIDGE_IN_SYNC_OPS_FLUSH_TO_MOD_OBJ_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelSyncInfoModObj; #else @@ -1750,7 +1750,7 @@ typedef struct PVRSRV_BRIDGE_IN_SYNC_OPS_FLUSH_TO_MOD_OBJ_TAG typedef struct PVRSRV_BRIDGE_IN_SYNC_OPS_FLUSH_TO_DELTA_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelSyncInfo; #else @@ -1761,7 +1761,7 @@ typedef struct PVRSRV_BRIDGE_IN_SYNC_OPS_FLUSH_TO_DELTA_TAG typedef struct PVRSRV_BRIDGE_IN_ALLOC_SYNC_INFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; @@ -1783,7 +1783,7 @@ typedef struct PVRSRV_BRIDGE_OUT_ALLOC_SYNC_INFO_TAG typedef struct PVRSRV_BRIDGE_IN_FREE_SYNC_INFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelSyncInfo; @@ -1803,5 +1803,5 @@ typedef struct PVRSRV_BRIDGE_IN_CHG_DEV_MEM_ATTRIBS_TAG } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/include/pvr_bridge_km.h b/drivers/staging/mrst/pvr/services4/include/pvr_bridge_km.h index 2b16ea6..70b64f4 100644 --- a/drivers/staging/mrst/pvr/services4/include/pvr_bridge_km.h +++ b/drivers/staging/mrst/pvr/services4/include/pvr_bridge_km.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -47,7 +47,7 @@ IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVAcquireDeviceDataKM(IMG_UINT32 uiDevIndex, PVRSRV_DEVICE_TYPE eDeviceType, IMG_HANDLE *phDevCookie); - + IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateCommandQueueKM(IMG_SIZE_T ui32QueueSize, PVRSRV_QUEUE_INFO **ppsQueueInfo); @@ -150,7 +150,7 @@ IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVWrapExtMemoryKM(IMG_HANDLE hDevCookie, PVRSRV_PER_PROCESS_DATA *psPerProc, IMG_HANDLE hDevMemContext, - IMG_SIZE_T ui32ByteSize, + IMG_SIZE_T ui32ByteSize, IMG_SIZE_T ui32PageOffset, IMG_BOOL bPhysContig, IMG_SYS_PHYADDR *psSysAddr, @@ -293,7 +293,9 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVAllocSyncInfoKM(IMG_HANDLE hDevCookie, IMG_HANDLE hDevMemContext, PVRSRV_KERNEL_SYNC_INFO **ppsKernelSyncInfo); IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVFreeSyncInfoKM(PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo); +IMG_VOID IMG_CALLCONV PVRSRVAcquireSyncInfoKM(PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo); +IMG_IMPORT +IMG_VOID IMG_CALLCONV PVRSRVReleaseSyncInfoKM(PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo); IMG_IMPORT #if defined (SUPPORT_SID_INTERFACE) @@ -318,5 +320,5 @@ PVRSRVDissociateMemFromResmanKM(PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo); } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/include/pvrmmap.h b/drivers/staging/mrst/pvr/services4/include/pvrmmap.h index 8024d17..242d953 100644 --- a/drivers/staging/mrst/pvr/services4/include/pvrmmap.h +++ b/drivers/staging/mrst/pvr/services4/include/pvrmmap.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -40,5 +40,5 @@ IMG_BOOL PVRUnMapKMem(IMG_HANDLE hModule, IMG_SID hMappingInfo, IMG_SID hMHandle IMG_BOOL PVRUnMapKMem(IMG_HANDLE hModule, IMG_HANDLE hMappingInfo, IMG_HANDLE hMHandle); #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/include/pvrsrv_errors.h b/drivers/staging/mrst/pvr/services4/include/pvrsrv_errors.h index addab68..5474984 100644 --- a/drivers/staging/mrst/pvr/services4/include/pvrsrv_errors.h +++ b/drivers/staging/mrst/pvr/services4/include/pvrsrv_errors.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -262,5 +262,5 @@ extern "C" { #if defined (__cplusplus) } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/include/servicesint.h b/drivers/staging/mrst/pvr/services4/include/servicesint.h index c0db526..3cd0225 100644 --- a/drivers/staging/mrst/pvr/services4/include/servicesint.h +++ b/drivers/staging/mrst/pvr/services4/include/servicesint.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -47,6 +47,10 @@ extern "C" { #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif +#define MAX_CLEANUP_TIME_US (MAX_HW_TIME_US * 4) +#define MAX_CLEANUP_TRYS 100 +#define MAX_CLEANUP_TIME_WAIT_US (MAX_CLEANUP_TIME_US/MAX_CLEANUP_TRYS) + typedef enum _PVRSRV_MEMTYPE_ { PVRSRV_MEMTYPE_UNKNOWN = 0, @@ -58,47 +62,47 @@ typedef enum _PVRSRV_MEMTYPE_ typedef struct _PVRSRV_KERNEL_MEM_INFO_ { - + IMG_PVOID pvLinAddrKM; - + IMG_DEV_VIRTADDR sDevVAddr; - + IMG_UINT32 ui32Flags; - + IMG_SIZE_T uAllocSize; - + PVRSRV_MEMBLK sMemBlk; - + IMG_PVOID pvSysBackupBuffer; - + IMG_UINT32 ui32RefCount; - + IMG_BOOL bPendingFree; #if defined(SUPPORT_MEMINFO_IDS) #if !defined(USE_CODE) - + IMG_UINT64 ui64Stamp; - #else + #else IMG_UINT32 dummy1; IMG_UINT32 dummy2; - #endif -#endif - + #endif +#endif + struct _PVRSRV_KERNEL_SYNC_INFO_ *psKernelSyncInfo; PVRSRV_MEMTYPE memType; - + @@ -106,17 +110,17 @@ typedef struct _PVRSRV_KERNEL_MEM_INFO_ struct { - + IMG_BOOL bInUse; - + IMG_HANDLE hDevCookieInt; - + IMG_UINT32 ui32ShareIndex; - + IMG_UINT32 ui32OrigReqAttribs; IMG_UINT32 ui32OrigReqSize; @@ -127,35 +131,35 @@ typedef struct _PVRSRV_KERNEL_MEM_INFO_ typedef struct _PVRSRV_KERNEL_SYNC_INFO_ { - + PVRSRV_SYNC_DATA *psSyncData; - + IMG_DEV_VIRTADDR sWriteOpsCompleteDevVAddr; - + IMG_DEV_VIRTADDR sReadOpsCompleteDevVAddr; - + IMG_DEV_VIRTADDR sReadOps2CompleteDevVAddr; - + PVRSRV_KERNEL_MEM_INFO *psSyncDataMemInfoKM; + + + IMG_PVOID pvRefCount; - - IMG_UINT32 ui32RefCount; - - + IMG_HANDLE hResItem; - + IMG_UINT32 ui32UID; } PVRSRV_KERNEL_SYNC_INFO; typedef struct _PVRSRV_DEVICE_SYNC_OBJECT_ { - + IMG_UINT32 ui32ReadOpsPendingVal; IMG_DEV_VIRTADDR sReadOpsCompleteDevVAddr; IMG_UINT32 ui32WriteOpsPendingVal; @@ -175,36 +179,36 @@ typedef struct _PVRSRV_SYNC_OBJECT typedef struct _PVRSRV_COMMAND { - IMG_SIZE_T uCmdSize; - IMG_UINT32 ui32DevIndex; - IMG_UINT32 CommandType; - IMG_UINT32 ui32DstSyncCount; - IMG_UINT32 ui32SrcSyncCount; - PVRSRV_SYNC_OBJECT *psDstSync; - PVRSRV_SYNC_OBJECT *psSrcSync; - IMG_SIZE_T uDataSize; - IMG_UINT32 ui32ProcessID; - IMG_VOID *pvData; - PFN_QUEUE_COMMAND_COMPLETE pfnCommandComplete; - IMG_HANDLE hCallbackData; + IMG_SIZE_T uCmdSize; + IMG_UINT32 ui32DevIndex; + IMG_UINT32 CommandType; + IMG_UINT32 ui32DstSyncCount; + IMG_UINT32 ui32SrcSyncCount; + PVRSRV_SYNC_OBJECT *psDstSync; + PVRSRV_SYNC_OBJECT *psSrcSync; + IMG_SIZE_T uDataSize; + IMG_UINT32 ui32ProcessID; + IMG_VOID *pvData; + PFN_QUEUE_COMMAND_COMPLETE pfnCommandComplete; + IMG_HANDLE hCallbackData; }PVRSRV_COMMAND, *PPVRSRV_COMMAND; typedef struct _PVRSRV_QUEUE_INFO_ { - IMG_VOID *pvLinQueueKM; - IMG_VOID *pvLinQueueUM; - volatile IMG_SIZE_T ui32ReadOffset; - volatile IMG_SIZE_T ui32WriteOffset; - IMG_UINT32 *pui32KickerAddrKM; - IMG_UINT32 *pui32KickerAddrUM; - IMG_SIZE_T ui32QueueSize; + IMG_VOID *pvLinQueueKM; + IMG_VOID *pvLinQueueUM; + volatile IMG_SIZE_T ui32ReadOffset; + volatile IMG_SIZE_T ui32WriteOffset; + IMG_UINT32 *pui32KickerAddrKM; + IMG_UINT32 *pui32KickerAddrUM; + IMG_SIZE_T ui32QueueSize; - IMG_UINT32 ui32ProcessID; + IMG_UINT32 ui32ProcessID; IMG_HANDLE hMemBlock[2]; - struct _PVRSRV_QUEUE_INFO_ *psNextKM; + struct _PVRSRV_QUEUE_INFO_ *psNextKM; }PVRSRV_QUEUE_INFO; @@ -222,9 +226,9 @@ typedef struct _PVRSRV_HEAP_INFO_KM_ typedef struct _PVRSRV_EVENTOBJECT_KM_ { - + IMG_CHAR szName[EVENTOBJNAME_MAXLENGTH]; - + IMG_HANDLE hOSEventKM; } PVRSRV_EVENTOBJECT_KM; @@ -232,56 +236,56 @@ typedef struct _PVRSRV_EVENTOBJECT_KM_ typedef struct _PVRSRV_MISC_INFO_KM_ { - IMG_UINT32 ui32StateRequest; - IMG_UINT32 ui32StatePresent; - + IMG_UINT32 ui32StateRequest; + IMG_UINT32 ui32StatePresent; + IMG_VOID *pvSOCTimerRegisterKM; IMG_VOID *pvSOCTimerRegisterUM; IMG_HANDLE hSOCTimerRegisterOSMemHandle; IMG_HANDLE hSOCTimerRegisterMappingInfo; - + IMG_VOID *pvSOCClockGateRegs; IMG_UINT32 ui32SOCClockGateRegsSize; - + IMG_CHAR *pszMemoryStr; IMG_UINT32 ui32MemoryStrLen; - + PVRSRV_EVENTOBJECT_KM sGlobalEventObject; IMG_HANDLE hOSGlobalEvent; - + IMG_UINT32 aui32DDKVersion[4]; - + struct { - + IMG_BOOL bDeferOp; - + PVRSRV_MISC_INFO_CPUCACHEOP_TYPE eCacheOpType; - + PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo; - + IMG_VOID *pvBaseVAddr; - + IMG_UINT32 ui32Length; } sCacheOpCtl; - + struct { - + PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo; - + IMG_UINT32 ui32RefCount; } sGetRefCountCtl; } PVRSRV_MISC_INFO_KM; @@ -368,5 +372,5 @@ PVRSRVMapMemInfoMem(const PVRSRV_CONNECTION *psConnection, #if defined (__cplusplus) } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/include/sgx_bridge.h b/drivers/staging/mrst/pvr/services4/include/sgx_bridge.h index e59da89..ec630a5 100644 --- a/drivers/staging/mrst/pvr/services4/include/sgx_bridge.h +++ b/drivers/staging/mrst/pvr/services4/include/sgx_bridge.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -90,15 +90,15 @@ extern "C" { #define PVRSRV_BRIDGE_LAST_SGX_CMD (PVRSRV_BRIDGE_SGX_CMD_BASE+37) - + typedef struct PVRSRV_BRIDGE_IN_GETPHYSPAGEADDR { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_HANDLE hDevMemHeap; IMG_DEV_VIRTADDR sDevVAddr; }PVRSRV_BRIDGE_IN_GETPHYSPAGEADDR; - + typedef struct PVRSRV_BRIDGE_OUT_GETPHYSPAGEADDR { PVRSRV_ERROR eError; @@ -106,10 +106,10 @@ typedef struct PVRSRV_BRIDGE_OUT_GETPHYSPAGEADDR IMG_CPU_PHYADDR CpuPAddr; }PVRSRV_BRIDGE_OUT_GETPHYSPAGEADDR; - + typedef struct PVRSRV_BRIDGE_IN_SGX_SET_TRANSFER_CONTEXT_PRIORITY_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; IMG_SID hHWTransferContext; @@ -121,10 +121,10 @@ typedef struct PVRSRV_BRIDGE_IN_SGX_SET_TRANSFER_CONTEXT_PRIORITY_TAG IMG_UINT32 ui32OffsetOfPriorityField; }PVRSRV_BRIDGE_IN_SGX_SET_TRANSFER_CONTEXT_PRIORITY; - + typedef struct PVRSRV_BRIDGE_IN_SGX_SET_RENDER_CONTEXT_PRIORITY_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; IMG_SID hHWRenderContext; @@ -136,10 +136,10 @@ typedef struct PVRSRV_BRIDGE_IN_SGX_SET_RENDER_CONTEXT_PRIORITY_TAG IMG_UINT32 ui32OffsetOfPriorityField; }PVRSRV_BRIDGE_IN_SGX_SET_RENDER_CONTEXT_PRIORITY; - + typedef struct PVRSRV_BRIDGE_IN_GETCLIENTINFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -147,17 +147,17 @@ typedef struct PVRSRV_BRIDGE_IN_GETCLIENTINFO_TAG #endif }PVRSRV_BRIDGE_IN_GETCLIENTINFO; - + typedef struct PVRSRV_BRIDGE_OUT_GETINTERNALDEVINFO_TAG { SGX_INTERNAL_DEVINFO sSGXInternalDevInfo; PVRSRV_ERROR eError; }PVRSRV_BRIDGE_OUT_GETINTERNALDEVINFO; - + typedef struct PVRSRV_BRIDGE_IN_GETINTERNALDEVINFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -165,17 +165,17 @@ typedef struct PVRSRV_BRIDGE_IN_GETINTERNALDEVINFO_TAG #endif }PVRSRV_BRIDGE_IN_GETINTERNALDEVINFO; - + typedef struct PVRSRV_BRIDGE_OUT_GETCLIENTINFO_TAG { SGX_CLIENT_INFO sClientInfo; PVRSRV_ERROR eError; }PVRSRV_BRIDGE_OUT_GETCLIENTINFO; - + typedef struct PVRSRV_BRIDGE_IN_RELEASECLIENTINFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -184,10 +184,10 @@ typedef struct PVRSRV_BRIDGE_IN_RELEASECLIENTINFO_TAG SGX_CLIENT_INFO sClientInfo; }PVRSRV_BRIDGE_IN_RELEASECLIENTINFO; - + typedef struct PVRSRV_BRIDGE_IN_ISPBREAKPOLL_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -195,10 +195,10 @@ typedef struct PVRSRV_BRIDGE_IN_ISPBREAKPOLL_TAG #endif }PVRSRV_BRIDGE_IN_ISPBREAKPOLL; - + typedef struct PVRSRV_BRIDGE_IN_DOKICK_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -207,10 +207,10 @@ typedef struct PVRSRV_BRIDGE_IN_DOKICK_TAG SGX_CCB_KICK sCCBKick; }PVRSRV_BRIDGE_IN_DOKICK; - + typedef struct PVRSRV_BRIDGE_IN_SGX_SCHEDULE_PROCESS_QUEUES_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -220,10 +220,10 @@ typedef struct PVRSRV_BRIDGE_IN_SGX_SCHEDULE_PROCESS_QUEUES_TAG #if defined(TRANSFER_QUEUE) - + typedef struct PVRSRV_BRIDGE_IN_SUBMITTRANSFER_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -233,10 +233,10 @@ typedef struct PVRSRV_BRIDGE_IN_SUBMITTRANSFER_TAG }PVRSRV_BRIDGE_IN_SUBMITTRANSFER; #if defined(SGX_FEATURE_2D_HARDWARE) - + typedef struct PVRSRV_BRIDGE_IN_SUBMIT2D_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -247,10 +247,10 @@ typedef struct PVRSRV_BRIDGE_IN_SUBMIT2D_TAG #endif #endif - + typedef struct PVRSRV_BRIDGE_IN_READREGDWORD_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -260,7 +260,7 @@ typedef struct PVRSRV_BRIDGE_IN_READREGDWORD_TAG IMG_PCHAR pszValue; }PVRSRV_BRIDGE_IN_READREGDWORD; - + typedef struct PVRSRV_BRIDGE_OUT_READREGDWORD_TAG { PVRSRV_ERROR eError; @@ -270,7 +270,7 @@ typedef struct PVRSRV_BRIDGE_OUT_READREGDWORD_TAG typedef struct PVRSRV_BRIDGE_IN_SGXGETMISCINFO_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -281,7 +281,7 @@ typedef struct PVRSRV_BRIDGE_IN_SGXGETMISCINFO_TAG typedef struct PVRSRV_BRIDGE_IN_SGXINFO_FOR_SRVINIT_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -297,7 +297,7 @@ typedef struct PVRSRV_BRIDGE_OUT_SGXINFO_FOR_SRVINIT_TAG typedef struct PVRSRV_BRIDGE_IN_SGXDEVINITPART2_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -313,10 +313,10 @@ typedef struct PVRSRV_BRIDGE_OUT_SGXDEVINITPART2_TAG }PVRSRV_BRIDGE_OUT_SGXDEVINITPART2; - + typedef struct PVRSRV_BRIDGE_IN_2DQUERYBLTSCOMPLETE_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; IMG_SID hKernSyncInfo; @@ -332,7 +332,7 @@ typedef struct PVRSRV_BRIDGE_IN_2DQUERYBLTSCOMPLETE_TAG typedef struct PVRSRV_BRIDGE_IN_SGXFINDSHAREDPBDESC_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -367,7 +367,7 @@ typedef struct PVRSRV_BRIDGE_OUT_SGXFINDSHAREDPBDESC_TAG typedef struct PVRSRV_BRIDGE_IN_SGXUNREFSHAREDPBDESC_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hSharedPBDesc; #else @@ -383,7 +383,7 @@ typedef struct PVRSRV_BRIDGE_OUT_SGXUNREFSHAREDPBDESC_TAG typedef struct PVRSRV_BRIDGE_IN_SGXADDSHAREDPBDESC_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_UINT32 ui32TotalPBSize; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; @@ -418,7 +418,7 @@ typedef struct PVRSRV_BRIDGE_OUT_SGXADDSHAREDPBDESC_TAG #ifdef PDUMP typedef struct PVRSRV_BRIDGE_IN_PDUMP_BUFFER_ARRAY_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; SGX_KICKTA_DUMP_BUFFER *psBufferArray; IMG_UINT32 ui32BufferArrayLength; IMG_BOOL bDumpPolls; @@ -426,7 +426,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_BUFFER_ARRAY_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_3D_SIGNATURE_REGISTERS_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; IMG_SID hDevMemContext; @@ -442,7 +442,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_3D_SIGNATURE_REGISTERS_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMPCOUNTER_REGISTERS_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -456,7 +456,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMPCOUNTER_REGISTERS_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_TA_SIGNATURE_REGISTERS_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -471,7 +471,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_TA_SIGNATURE_REGISTERS_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_HWPERFCB_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; IMG_SID hDevMemContext; @@ -487,7 +487,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_HWPERFCB_TAG typedef struct PVRSRV_BRIDGE_IN_PDUMP_SAVEMEM { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; IMG_SID hDevMemContext; @@ -509,7 +509,7 @@ typedef struct PVRSRV_BRIDGE_IN_PDUMP_SAVEMEM typedef struct PVRSRV_BRIDGE_IN_SGX_REGISTER_HW_RENDER_CONTEXT_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -534,7 +534,7 @@ typedef struct PVRSRV_BRIDGE_OUT_SGX_REGISTER_HW_RENDER_CONTEXT_TAG typedef struct PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_RENDER_CONTEXT_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_BOOL bForceCleanup; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; @@ -547,7 +547,7 @@ typedef struct PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_RENDER_CONTEXT_TAG typedef struct PVRSRV_BRIDGE_IN_SGX_REGISTER_HW_TRANSFER_CONTEXT_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -572,7 +572,7 @@ typedef struct PVRSRV_BRIDGE_OUT_SGX_REGISTER_HW_TRANSFER_CONTEXT_TAG typedef struct PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_TRANSFER_CONTEXT_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_BOOL bForceCleanup; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; @@ -585,7 +585,7 @@ typedef struct PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_TRANSFER_CONTEXT_TAG typedef struct PVRSRV_BRIDGE_IN_SGX_FLUSH_HW_RENDER_TARGET_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -594,11 +594,11 @@ typedef struct PVRSRV_BRIDGE_IN_SGX_FLUSH_HW_RENDER_TARGET_TAG IMG_DEV_VIRTADDR sHWRTDataSetDevVAddr; }PVRSRV_BRIDGE_IN_SGX_FLUSH_HW_RENDER_TARGET; - + #if defined(SGX_FEATURE_2D_HARDWARE) typedef struct PVRSRV_BRIDGE_IN_SGX_REGISTER_HW_2D_CONTEXT_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -623,7 +623,7 @@ typedef struct PVRSRV_BRIDGE_OUT_SGX_REGISTER_HW_2D_CONTEXT_TAG typedef struct PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_2D_CONTEXT_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; IMG_BOOL bForceCleanup; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; @@ -634,13 +634,13 @@ typedef struct PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_2D_CONTEXT_TAG #endif }PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_2D_CONTEXT; -#define SGX2D_MAX_BLT_CMD_SIZ 256 -#endif +#define SGX2D_MAX_BLT_CMD_SIZ 256 +#endif typedef struct PVRSRV_BRIDGE_IN_SGX_READ_HWPERF_CB_TAG { - IMG_UINT32 ui32BridgeFlags; + IMG_UINT32 ui32BridgeFlags; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hDevCookie; #else @@ -662,5 +662,5 @@ typedef struct PVRSRV_BRIDGE_OUT_SGX_READ_HWPERF_CB_TAG } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/include/sgx_mkif_km.h b/drivers/staging/mrst/pvr/services4/include/sgx_mkif_km.h index d3bf203..9f4f41f 100644 --- a/drivers/staging/mrst/pvr/services4/include/sgx_mkif_km.h +++ b/drivers/staging/mrst/pvr/services4/include/sgx_mkif_km.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -42,28 +42,28 @@ #define SGX_MP_MASTER_SELECT(x) (x + (SGX_REG_BANK_MASTER_INDEX * SGX_REG_BANK_SIZE)) #else #define SGX_MP_CORE_SELECT(x,i) (x) -#endif +#endif #endif typedef struct _SGXMKIF_COMMAND_ { - IMG_UINT32 ui32ServiceAddress; - IMG_UINT32 ui32CacheControl; - IMG_UINT32 ui32Data[6]; + IMG_UINT32 ui32ServiceAddress; + IMG_UINT32 ui32CacheControl; + IMG_UINT32 ui32Data[6]; } SGXMKIF_COMMAND; typedef struct _PVRSRV_SGX_KERNEL_CCB_ { - SGXMKIF_COMMAND asCommands[256]; + SGXMKIF_COMMAND asCommands[256]; } PVRSRV_SGX_KERNEL_CCB; typedef struct _PVRSRV_SGX_CCB_CTL_ { - IMG_UINT32 ui32WriteOffset; - IMG_UINT32 ui32ReadOffset; + IMG_UINT32 ui32WriteOffset; + IMG_UINT32 ui32ReadOffset; } PVRSRV_SGX_CCB_CTL; @@ -74,66 +74,68 @@ typedef struct _SGXMKIF_HOST_CTL_ IMG_UINT32 ui32Continue; #endif - volatile IMG_UINT32 ui32InitStatus; - volatile IMG_UINT32 ui32PowerStatus; - volatile IMG_UINT32 ui32CleanupStatus; + volatile IMG_UINT32 ui32InitStatus; + volatile IMG_UINT32 ui32PowerStatus; + volatile IMG_UINT32 ui32CleanupStatus; #if defined(FIX_HW_BRN_28889) - volatile IMG_UINT32 ui32InvalStatus; + volatile IMG_UINT32 ui32InvalStatus; #endif #if defined(SUPPORT_HW_RECOVERY) - IMG_UINT32 ui32uKernelDetectedLockups; - IMG_UINT32 ui32HostDetectedLockups; - IMG_UINT32 ui32HWRecoverySampleRate; -#endif - IMG_UINT32 ui32uKernelTimerClock; - IMG_UINT32 ui32ActivePowManSampleRate; - IMG_UINT32 ui32InterruptFlags; - IMG_UINT32 ui32InterruptClearFlags; - IMG_UINT32 ui32BPSetClearSignal; - - IMG_UINT32 ui32NumActivePowerEvents; - - IMG_UINT32 ui32TimeWraps; - IMG_UINT32 ui32HostClock; - IMG_UINT32 ui32AssertFail; + IMG_UINT32 ui32uKernelDetectedLockups; + IMG_UINT32 ui32HostDetectedLockups; + IMG_UINT32 ui32HWRecoverySampleRate; +#endif + IMG_UINT32 ui32uKernelTimerClock; + IMG_UINT32 ui32ActivePowManSampleRate; + IMG_UINT32 ui32InterruptFlags; + IMG_UINT32 ui32InterruptClearFlags; + IMG_UINT32 ui32BPSetClearSignal; + + IMG_UINT32 ui32NumActivePowerEvents; + + IMG_UINT32 ui32TimeWraps; + IMG_UINT32 ui32HostClock; + IMG_UINT32 ui32AssertFail; #if defined(SGX_FEATURE_EXTENDED_PERF_COUNTERS) - IMG_UINT32 aui32PerfGroup[PVRSRV_SGX_HWPERF_NUM_COUNTERS]; - IMG_UINT32 aui32PerfBit[PVRSRV_SGX_HWPERF_NUM_COUNTERS]; + IMG_UINT32 aui32PerfGroup[PVRSRV_SGX_HWPERF_NUM_COUNTERS]; + IMG_UINT32 aui32PerfBit[PVRSRV_SGX_HWPERF_NUM_COUNTERS]; #else - IMG_UINT32 ui32PerfGroup; -#endif + IMG_UINT32 ui32PerfGroup; +#endif #if defined(FIX_HW_BRN_31939) IMG_UINT32 ui32BRN31939Mem; #endif - IMG_UINT32 ui32OpenCLDelayCount; + IMG_UINT32 ui32OpenCLDelayCount; } SGXMKIF_HOST_CTL; #define SGXMKIF_CMDTA_CTRLFLAGS_READY 0x00000001 typedef struct _SGXMKIF_CMDTA_SHARED_ { IMG_UINT32 ui32CtrlFlags; - + IMG_UINT32 ui32NumTAStatusVals; IMG_UINT32 ui32Num3DStatusVals; - + IMG_UINT32 ui32TATQSyncWriteOpsPendingVal; IMG_DEV_VIRTADDR sTATQSyncWriteOpsCompleteDevVAddr; IMG_UINT32 ui32TATQSyncReadOpsPendingVal; IMG_DEV_VIRTADDR sTATQSyncReadOpsCompleteDevVAddr; - + IMG_UINT32 ui323DTQSyncWriteOpsPendingVal; IMG_DEV_VIRTADDR s3DTQSyncWriteOpsCompleteDevVAddr; IMG_UINT32 ui323DTQSyncReadOpsPendingVal; IMG_DEV_VIRTADDR s3DTQSyncReadOpsCompleteDevVAddr; + + PVRSRV_DEVICE_SYNC_OBJECT sTA3DDependency; #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) - + IMG_UINT32 ui32NumTASrcSyncs; PVRSRV_DEVICE_SYNC_OBJECT asTASrcSyncs[SGX_MAX_TA_SRC_SYNCS]; IMG_UINT32 ui32NumTADstSyncs; @@ -141,14 +143,11 @@ typedef struct _SGXMKIF_CMDTA_SHARED_ IMG_UINT32 ui32Num3DSrcSyncs; PVRSRV_DEVICE_SYNC_OBJECT as3DSrcSyncs[SGX_MAX_3D_SRC_SYNCS]; #else - + IMG_UINT32 ui32NumSrcSyncs; - PVRSRV_DEVICE_SYNC_OBJECT asSrcSyncs[SGX_MAX_SRC_SYNCS]; + PVRSRV_DEVICE_SYNC_OBJECT asSrcSyncs[SGX_MAX_SRC_SYNCS_TA]; #endif - - PVRSRV_DEVICE_SYNC_OBJECT sTA3DDependency; - CTL_STATUS sCtlTAStatusInfo[SGX_MAX_TA_STATUS_VALS]; CTL_STATUS sCtl3DStatusInfo[SGX_MAX_3D_STATUS_VALS]; @@ -167,21 +166,21 @@ typedef struct _SGXMKIF_CMDTA_SHARED_ typedef struct _SGXMKIF_TRANSFERCMD_SHARED_ { - + IMG_UINT32 ui32NumSrcSyncs; - PVRSRV_DEVICE_SYNC_OBJECT asSrcSyncs[SGX_MAX_SRC_SYNCS]; - + PVRSRV_DEVICE_SYNC_OBJECT asSrcSyncs[SGX_MAX_SRC_SYNCS_TQ]; + IMG_UINT32 ui32NumDstSyncs; - PVRSRV_DEVICE_SYNC_OBJECT asDstSyncs[SGX_MAX_DST_SYNCS]; - + PVRSRV_DEVICE_SYNC_OBJECT asDstSyncs[SGX_MAX_DST_SYNCS_TQ]; + IMG_UINT32 ui32TASyncWriteOpsPendingVal; IMG_DEV_VIRTADDR sTASyncWriteOpsCompleteDevVAddr; IMG_UINT32 ui32TASyncReadOpsPendingVal; IMG_DEV_VIRTADDR sTASyncReadOpsCompleteDevVAddr; - + IMG_UINT32 ui323DSyncWriteOpsPendingVal; IMG_DEV_VIRTADDR s3DSyncWriteOpsCompleteDevVAddr; IMG_UINT32 ui323DSyncReadOpsPendingVal; @@ -194,55 +193,57 @@ typedef struct _SGXMKIF_TRANSFERCMD_SHARED_ #if defined(SGX_FEATURE_2D_HARDWARE) typedef struct _SGXMKIF_2DCMD_SHARED_ { - + IMG_UINT32 ui32NumSrcSync; PVRSRV_DEVICE_SYNC_OBJECT sSrcSyncData[SGX_MAX_2D_SRC_SYNC_OPS]; - + PVRSRV_DEVICE_SYNC_OBJECT sDstSyncData; - + PVRSRV_DEVICE_SYNC_OBJECT sTASyncData; - + PVRSRV_DEVICE_SYNC_OBJECT s3DSyncData; } SGXMKIF_2DCMD_SHARED, *PSGXMKIF_2DCMD_SHARED; -#endif +#endif typedef struct _SGXMKIF_HWDEVICE_SYNC_LIST_ { IMG_DEV_VIRTADDR sAccessDevAddr; IMG_UINT32 ui32NumSyncObjects; - + PVRSRV_DEVICE_SYNC_OBJECT asSyncData[1]; } SGXMKIF_HWDEVICE_SYNC_LIST, *PSGXMKIF_HWDEVICE_SYNC_LIST; -#define PVRSRV_USSE_EDM_INIT_COMPLETE (1UL << 0) +#define PVRSRV_USSE_EDM_INIT_COMPLETE (1UL << 0) -#define PVRSRV_USSE_EDM_POWMAN_IDLE_COMPLETE (1UL << 2) -#define PVRSRV_USSE_EDM_POWMAN_POWEROFF_COMPLETE (1UL << 3) -#define PVRSRV_USSE_EDM_POWMAN_POWEROFF_RESTART_IMMEDIATE (1UL << 4) -#define PVRSRV_USSE_EDM_POWMAN_NO_WORK (1UL << 5) +#define PVRSRV_USSE_EDM_POWMAN_IDLE_COMPLETE (1UL << 2) +#define PVRSRV_USSE_EDM_POWMAN_POWEROFF_COMPLETE (1UL << 3) +#define PVRSRV_USSE_EDM_POWMAN_POWEROFF_RESTART_IMMEDIATE (1UL << 4) +#define PVRSRV_USSE_EDM_POWMAN_NO_WORK (1UL << 5) -#define PVRSRV_USSE_EDM_INTERRUPT_HWR (1UL << 0) -#define PVRSRV_USSE_EDM_INTERRUPT_ACTIVE_POWER (1UL << 1) -#define PVRSRV_USSE_EDM_INTERRUPT_IDLE (1UL << 2) +#define PVRSRV_USSE_EDM_INTERRUPT_HWR (1UL << 0) +#define PVRSRV_USSE_EDM_INTERRUPT_ACTIVE_POWER (1UL << 1) +#define PVRSRV_USSE_EDM_INTERRUPT_IDLE (1UL << 2) -#define PVRSRV_USSE_EDM_CLEANUPCMD_COMPLETE (1UL << 0) +#define PVRSRV_USSE_EDM_CLEANUPCMD_COMPLETE (1UL << 0) +#define PVRSRV_USSE_EDM_CLEANUPCMD_BUSY (1UL << 1) +#define PVRSRV_USSE_EDM_CLEANUPCMD_DONE (1UL << 2) #if defined(FIX_HW_BRN_28889) -#define PVRSRV_USSE_EDM_BIF_INVAL_COMPLETE (1UL << 0) +#define PVRSRV_USSE_EDM_BIF_INVAL_COMPLETE (1UL << 0) #endif #define PVRSRV_USSE_MISCINFO_READY 0x1UL -#define PVRSRV_USSE_MISCINFO_GET_STRUCT_SIZES 0x2UL +#define PVRSRV_USSE_MISCINFO_GET_STRUCT_SIZES 0x2UL #if defined(SUPPORT_SGX_EDM_MEMORY_DEBUG) -#define PVRSRV_USSE_MISCINFO_MEMREAD 0x4UL -#define PVRSRV_USSE_MISCINFO_MEMWRITE 0x8UL +#define PVRSRV_USSE_MISCINFO_MEMREAD 0x4UL +#define PVRSRV_USSE_MISCINFO_MEMWRITE 0x8UL #if !defined(SGX_FEATURE_MULTIPLE_MEM_CONTEXTS) -#define PVRSRV_USSE_MISCINFO_MEMREAD_FAIL 0x1UL << 31 +#define PVRSRV_USSE_MISCINFO_MEMREAD_FAIL 0x1UL << 31 #endif #endif @@ -298,27 +299,27 @@ typedef struct _SGX_MISCINFO_STRUCT_SIZES_ #if defined(SUPPORT_SGX_EDM_MEMORY_DEBUG) typedef struct _PVRSRV_SGX_MISCINFO_MEMACCESS { - IMG_DEV_VIRTADDR sDevVAddr; - IMG_DEV_PHYADDR sPDDevPAddr; + IMG_DEV_VIRTADDR sDevVAddr; + IMG_DEV_PHYADDR sPDDevPAddr; } PVRSRV_SGX_MISCINFO_MEMACCESS; #endif typedef struct _PVRSRV_SGX_MISCINFO_INFO { IMG_UINT32 ui32MiscInfoFlags; - PVRSRV_SGX_MISCINFO_FEATURES sSGXFeatures; - SGX_MISCINFO_STRUCT_SIZES sSGXStructSizes; + PVRSRV_SGX_MISCINFO_FEATURES sSGXFeatures; + SGX_MISCINFO_STRUCT_SIZES sSGXStructSizes; #if defined(SUPPORT_SGX_EDM_MEMORY_DEBUG) - PVRSRV_SGX_MISCINFO_MEMACCESS sSGXMemAccessSrc; - PVRSRV_SGX_MISCINFO_MEMACCESS sSGXMemAccessDest; + PVRSRV_SGX_MISCINFO_MEMACCESS sSGXMemAccessSrc; + PVRSRV_SGX_MISCINFO_MEMACCESS sSGXMemAccessDest; #endif } PVRSRV_SGX_MISCINFO_INFO; #ifdef PVRSRV_USSE_EDM_STATUS_DEBUG #define SGXMK_TRACE_BUFFER_SIZE 512 -#endif +#endif -#define SGXMKIF_HWPERF_CB_SIZE 0x100 +#define SGXMKIF_HWPERF_CB_SIZE 0x100 typedef struct _SGXMKIF_HWPERF_CB_ENTRY_ { @@ -330,7 +331,7 @@ typedef struct _SGXMKIF_HWPERF_CB_ENTRY_ IMG_UINT32 ui32Info; IMG_UINT32 ui32TimeWraps; IMG_UINT32 ui32Time; - + IMG_UINT32 ui32Counters[SGX_FEATURE_MP_CORE_COUNT_3D][PVRSRV_SGX_HWPERF_NUM_COUNTERS]; IMG_UINT32 ui32MiscCounters[SGX_FEATURE_MP_CORE_COUNT_3D][PVRSRV_SGX_HWPERF_NUM_MISC_COUNTERS]; } SGXMKIF_HWPERF_CB_ENTRY; @@ -344,5 +345,5 @@ typedef struct _SGXMKIF_HWPERF_CB_ } SGXMKIF_HWPERF_CB; -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/include/sgx_ukernel_status_codes.h b/drivers/staging/mrst/pvr/services4/include/sgx_ukernel_status_codes.h new file mode 100644 index 0000000..4a9eaf8 --- /dev/null +++ b/drivers/staging/mrst/pvr/services4/include/sgx_ukernel_status_codes.h @@ -0,0 +1,940 @@ +/********************************************************************** + * + * Copyright (C) Imagination Technologies Ltd. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * The full GNU General Public License is included in this distribution in + * the file called "COPYING". + * + * Contact Information: + * Imagination Technologies Ltd. + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * + +******************************************************************************/ + +#ifndef __SGX_UKERNEL_STATUS_CODES_H__ +#define __SGX_UKERNEL_STATUS_CODES_H__ + +/* + NOTE: Do not add any conditional macros to this file! There must be + no use of #if defined(). This file is included in srvkm to print + stringified ukernel status codes, it must build identically to + srvinit. +*/ + +/* + Users of this header might define this macro to do something + clever; the primary use right now is to generate a switch/case + LUT for debugging in srvkm. If you add a new code, make sure it + has a corresponding MKTC_ST. +*/ +#ifndef MKTC_ST +#define MKTC_ST(x) +#endif + +/* + It would be nice to put these definitions into an enumeration, but USEASM + only has access to the C preprocessor so macros are required. +*/ + +/* + Bits 24-31 of these codes (0xAD) are a magic number used to help + distinguish between them and other debug information which can be + optionally dumped into the status buffer, e.g. sync object values. +*/ + +/* + Microkernel trace codes +*/ +#define MKTC_EHEVENT_3DMEMFREE 0xAD000001 +MKTC_ST(MKTC_EHEVENT_3DMEMFREE) +#define MKTC_EHEVENT_PIXELENDRENDER 0xAD000002 +MKTC_ST(MKTC_EHEVENT_PIXELENDRENDER) +#define MKTC_EHEVENT_ISPBREAKPOINT 0xAD000004 +MKTC_ST(MKTC_EHEVENT_ISPBREAKPOINT) +#define MKTC_EHEVENT_TAFINISHED 0xAD000005 +MKTC_ST(MKTC_EHEVENT_TAFINISHED) +#define MKTC_EHEVENT_OUTOFMEM 0xAD000007 +MKTC_ST(MKTC_EHEVENT_OUTOFMEM) +#define MKTC_EHEVENT_TATERMINATE 0xAD000008 +MKTC_ST(MKTC_EHEVENT_TATERMINATE) +#define MKTC_EHEVENT_TIMER 0xAD000009 +MKTC_ST(MKTC_EHEVENT_TIMER) +#define MKTC_EHEVENT_SWEVENT 0xAD00000A +MKTC_ST(MKTC_EHEVENT_SWEVENT) +#define MKTC_EHEVENT_2DCOMPLETE 0xAD00000B +MKTC_ST(MKTC_EHEVENT_2DCOMPLETE) + +#define MKTC_3DEVENT_3DMEMFREE 0xAD000100 +MKTC_ST(MKTC_3DEVENT_3DMEMFREE) +#define MKTC_3DEVENT_PIXELENDRENDER 0xAD000101 +MKTC_ST(MKTC_3DEVENT_PIXELENDRENDER) +#define MKTC_3DEVENT_ISPBREAKPOINT 0xAD000102 +MKTC_ST(MKTC_3DEVENT_ISPBREAKPOINT) +#define MKTC_3DEVENT_END 0xAD000104 +MKTC_ST(MKTC_3DEVENT_END) +#define MKTC_3DLB_3DMEMFREE 0xAD000180 +MKTC_ST(MKTC_3DLB_3DMEMFREE) +#define MKTC_3DLB_PIXELENDRENDER 0xAD000181 +MKTC_ST(MKTC_3DLB_PIXELENDRENDER) +#define MKTC_3DLB_ISPBREAKPOINT 0xAD000182 +MKTC_ST(MKTC_3DLB_ISPBREAKPOINT) +#define MKTC_3DLB_FIND3D 0xAD000183 +MKTC_ST(MKTC_3DLB_FIND3D) +#define MKTC_3DLB_END 0xAD000184 +MKTC_ST(MKTC_3DLB_END) + +#define MKTC_TAEVENT_TAFINISHED 0xAD000200 +MKTC_ST(MKTC_TAEVENT_TAFINISHED) +#define MKTC_TAEVENT_END 0xAD000202 +MKTC_ST(MKTC_TAEVENT_END) +#define MKTC_TALB_TAFINISHED 0xAD000280 +MKTC_ST(MKTC_TALB_TAFINISHED) +#define MKTC_TALB_FINDTA 0xAD000281 +MKTC_ST(MKTC_TALB_FINDTA) +#define MKTC_TALB_END 0xAD000282 +MKTC_ST(MKTC_TALB_END) + +#define MKTC_CRRL_WRITEOPSBLOCKED 0xAD000300 +MKTC_ST(MKTC_CRRL_WRITEOPSBLOCKED) +#define MKTC_CRRL_READOPSBLOCKED 0xAD000301 +MKTC_ST(MKTC_CRRL_READOPSBLOCKED) +#define MKTC_CRRL_FOUNDRENDER 0xAD000302 +MKTC_ST(MKTC_CRRL_FOUNDRENDER) +#define MKTC_CRRL_NORENDER 0xAD000303 +MKTC_ST(MKTC_CRRL_NORENDER) +#define MKTC_CRRL_TARC_DIFFERENT 0xAD000304 +MKTC_ST(MKTC_CRRL_TARC_DIFFERENT) +#define MKTC_CRRL_BLOCKEDRC 0xAD000309 +MKTC_ST(MKTC_CRRL_BLOCKEDRC) +#define MKTC_CRRL_BLOCKEDRTDATA 0xAD00030A +MKTC_ST(MKTC_CRRL_BLOCKEDRTDATA) +#define MKTC_CRRL_CONTEXT_SUSPENDED 0xAD00030B +MKTC_ST(MKTC_CRRL_CONTEXT_SUSPENDED) +#define MKTC_CRRL_TAWAITINGFORMEM 0xAD00030C +MKTC_ST(MKTC_CRRL_TAWAITINGFORMEM) +#define MKTC_CRRL_TAOOMBUTPRIOINV 0xAD00030D +MKTC_ST(MKTC_CRRL_TAOOMBUTPRIOINV) +#define MKTC_CRRL_READOPS2BLOCKED 0xAD00030E +MKTC_ST(MKTC_CRRL_READOPS2BLOCKED) +#define MKTC_CRRL_SRC_WRITEOPSBLOCKED 0xAD00030F +MKTC_ST(MKTC_CRRL_SRC_WRITEOPSBLOCKED) +#define MKTC_CRRL_SRC_READOPSBLOCKED 0xAD000310 +MKTC_ST(MKTC_CRRL_SRC_READOPSBLOCKED) + +#define MKTC_KICKRENDER_START 0xAD000400 +MKTC_ST(MKTC_KICKRENDER_START) +#define MKTC_KICKRENDER_OVERLAP 0xAD000401 +MKTC_ST(MKTC_KICKRENDER_OVERLAP) +#define MKTC_KICKRENDER_ISP_START 0xAD000402 +MKTC_ST(MKTC_KICKRENDER_ISP_START) +#define MKTC_KICKRENDER_RESUME 0xAD000403 +MKTC_ST(MKTC_KICKRENDER_RESUME) +#define MKTC_KICKRENDER_CONFIG_REGION_HDRS 0xAD000404 +MKTC_ST(MKTC_KICKRENDER_CONFIG_REGION_HDRS) +#define MKTC_KICKRENDER_END 0xAD000408 +MKTC_ST(MKTC_KICKRENDER_END) +#define MKTC_KICKRENDER_RENDERCONTEXT 0xAD000409 +MKTC_ST(MKTC_KICKRENDER_RENDERCONTEXT) +#define MKTC_KICKRENDER_RTDATA 0xAD00040A +MKTC_ST(MKTC_KICKRENDER_RTDATA) +#define MKTC_KICKRENDER_PID 0xAD00040B +MKTC_ST(MKTC_KICKRENDER_PID) + +#define MKTC_RENDERFINISHED_START 0xAD000500 +MKTC_ST(MKTC_RENDERFINISHED_START) +#define MKTC_RF_START_NEXT_MT 0xAD000501 +MKTC_ST(MKTC_RF_START_NEXT_MT) +#define MKTC_RF_ALL_MTS_DONE 0xAD000502 +MKTC_ST(MKTC_RF_ALL_MTS_DONE) +#define MKTC_RENDERFINISHED_END 0xAD000503 +MKTC_ST(MKTC_RENDERFINISHED_END) +#define MKTC_VISQUERY_START 0xAD000504 +MKTC_ST(MKTC_VISQUERY_START) +#define MKTC_VISQUERY_END 0xAD000505 +MKTC_ST(MKTC_VISQUERY_END) +#define MKTC_TRANSFERRENDERFINISHED_START 0xAD000508 +MKTC_ST(MKTC_TRANSFERRENDERFINISHED_START) +#define MKTC_TRANSFERRENDERFINISHED_END 0xAD000509 +MKTC_ST(MKTC_TRANSFERRENDERFINISHED_END) +#define MKTC_TRF_UPDATESTATUSVALS 0xAD00050A +MKTC_ST(MKTC_TRF_UPDATESTATUSVALS) +#define MKTC_TRF_UPDATESTATUSVALS_DONE 0xAD00050B +MKTC_ST(MKTC_TRF_UPDATESTATUSVALS_DONE) + +#define MKTC_PIXELENDRENDER_START 0xAD000600 +MKTC_ST(MKTC_PIXELENDRENDER_START) +#define MKTC_PIXELENDRENDER_AFTERLOCK 0xAD000601 +MKTC_ST(MKTC_PIXELENDRENDER_AFTERLOCK) +#define MKTC_PIXELENDRENDER_END 0xAD000602 +MKTC_ST(MKTC_PIXELENDRENDER_END) +#define MKTC_PIXELENDRENDER_TLQEND 0xAD000603 +MKTC_ST(MKTC_PIXELENDRENDER_TLQEND) + +#define MKTC_3DMEMFREE_START 0xAD000700 +MKTC_ST(MKTC_3DMEMFREE_START) +#define MKTC_3DMEMFREE_AFTERLOCK 0xAD000701 +MKTC_ST(MKTC_3DMEMFREE_AFTERLOCK) +#define MKTC_3DMEMFREE_TESTEOR 0xAD000702 +MKTC_ST(MKTC_3DMEMFREE_TESTEOR) +#define MKTC_3DMEMFREE_END 0xAD000703 +MKTC_ST(MKTC_3DMEMFREE_END) + +#define MKTC_KICKTA_START 0xAD000800 +MKTC_ST(MKTC_KICKTA_START) +#define MKTC_KICKTA_OVERLAP 0xAD000801 +MKTC_ST(MKTC_KICKTA_OVERLAP) +#define MKTC_KICKTA_RESETCONTEXT 0xAD000802 +MKTC_ST(MKTC_KICKTA_RESETCONTEXT) +#define MKTC_KICKTA_VDM_START 0xAD000803 +MKTC_ST(MKTC_KICKTA_VDM_START) +#define MKTC_KICKTA_END 0xAD000804 +MKTC_ST(MKTC_KICKTA_END) +#define MKTC_KICKTA_RENDERCONTEXT 0xAD000805 +MKTC_ST(MKTC_KICKTA_RENDERCONTEXT) +#define MKTC_KICKTA_RTDATA 0xAD000806 +MKTC_ST(MKTC_KICKTA_RTDATA) +#define MKTC_KICKTA_RESET_VDMCSSTATUS 0xAD000807 +MKTC_ST(MKTC_KICKTA_RESET_VDMCSSTATUS) +#define MKTC_KICKTA_RESET_BUFFERS 0xAD000808 +MKTC_ST(MKTC_KICKTA_RESET_BUFFERS) +#define MKTC_KICKTA_PID 0xAD000809 +MKTC_ST(MKTC_KICKTA_PID) +#define MKTC_KICKTA_TACMD_DEBUG 0xAD00080A +MKTC_ST(MKTC_KICKTA_TACMD_DEBUG) +#define MKTC_KICKTA_FREECONTEXT 0xAD00080B +MKTC_ST(MKTC_KICKTA_FREECONTEXT) +#define MKTC_KICKTA_PIM_PATCHING 0xAD00080C +MKTC_ST(MKTC_KICKTA_PIM_PATCHING) + +#define MKTC_KICKTA_CHKPT_START_DUMMY_CS 0xAD0008A1 +MKTC_ST(MKTC_KICKTA_CHKPT_START_DUMMY_CS) +#define MKTC_KICKTA_CHKPT_START_DUMMY_TAK 0xAD0008A2 +MKTC_ST(MKTC_KICKTA_CHKPT_START_DUMMY_TAK) +#define MKTC_KICKTA_CHKPT_WAIT_FOR_DUMMY_KICK 0xAD0008A3 +MKTC_ST(MKTC_KICKTA_CHKPT_WAIT_FOR_DUMMY_KICK) +#define MKTC_KICKTA_CHKPT_WAIT_NEXT_CORE 0xAD0008A4 +MKTC_ST(MKTC_KICKTA_CHKPT_WAIT_NEXT_CORE) +#define MKTC_KICKTA_CHKPT_RESET_COMPLETE 0xAD0008A5 +MKTC_ST(MKTC_KICKTA_CHKPT_RESET_COMPLETE) +#define MKTC_KICKTA_CHKPT_CHECK_SWITCH 0xAD0008A6 +MKTC_ST(MKTC_KICKTA_CHKPT_CHECK_SWITCH) + +#define MKTC_HOSTKICK_START 0xAD000900 +MKTC_ST(MKTC_HOSTKICK_START) +#define MKTC_HOSTKICK_END 0xAD000901 +MKTC_ST(MKTC_HOSTKICK_END) +#define MKTC_HOSTKICK_PROCESS_QUEUES_END 0xAD000902 +MKTC_ST(MKTC_HOSTKICK_PROCESS_QUEUES_END) +#define MKTC_HOSTKICK_2D 0xAD000903 +MKTC_ST(MKTC_HOSTKICK_2D) +#define MKTC_HOSTKICK_TRANSFER 0xAD000904 +MKTC_ST(MKTC_HOSTKICK_TRANSFER) +#define MKTC_HOSTKICK_TA 0xAD000905 +MKTC_ST(MKTC_HOSTKICK_TA) +#define MKTC_HOSTKICK_PROCESS_QUEUES 0xAD000906 +MKTC_ST(MKTC_HOSTKICK_PROCESS_QUEUES) +#define MKTC_HOSTKICK_RESUME 0xAD000908 +MKTC_ST(MKTC_HOSTKICK_RESUME) +#define MKTC_HOSTKICK_POWEROFF 0xAD000909 +MKTC_ST(MKTC_HOSTKICK_POWEROFF) +#define MKTC_HOSTKICK_IDLE 0xAD00090A +MKTC_ST(MKTC_HOSTKICK_IDLE) +#define MKTC_HOSTKICK_CTXSUSPEND 0xAD00090B +MKTC_ST(MKTC_HOSTKICK_CTXSUSPEND) +#define MKTC_HOSTKICK_CTXRESUME 0xAD00090C +MKTC_ST(MKTC_HOSTKICK_CTXRESUME) + +#define MKTC_TIMER_POTENTIAL_TA_LOCKUP 0xAD000A00 +MKTC_ST(MKTC_TIMER_POTENTIAL_TA_LOCKUP) +#define MKTC_TIMER_POTENTIAL_3D_LOCKUP 0xAD000A01 +MKTC_ST(MKTC_TIMER_POTENTIAL_3D_LOCKUP) +#define MKTC_TIMER_CTAL_START 0xAD000A02 +MKTC_ST(MKTC_TIMER_CTAL_START) +#define MKTC_TIMER_CTAL_END 0xAD000A03 +MKTC_ST(MKTC_TIMER_CTAL_END) +#define MKTC_TIMER_C3DL_START 0xAD000A04 +MKTC_ST(MKTC_TIMER_C3DL_START) +#define MKTC_TIMER_C3DL_END 0xAD000A05 +MKTC_ST(MKTC_TIMER_C3DL_END) +#define MKTC_TIMER_LOCKUP 0xAD000A0A +MKTC_ST(MKTC_TIMER_LOCKUP) +#define MKTC_TIMER_NOT_TA_LOCKUP 0xAD000A0B +MKTC_ST(MKTC_TIMER_NOT_TA_LOCKUP) +#define MKTC_TIMER_NOT_3D_LOCKUP 0xAD000A0C +MKTC_ST(MKTC_TIMER_NOT_3D_LOCKUP) +#define MKTC_TIMER_2D_LOCKUP 0xAD000A0D +MKTC_ST(MKTC_TIMER_2D_LOCKUP) +#define MKTC_TIMER_POTENTIAL_2D_LOCKUP 0xAD000A10 +MKTC_ST(MKTC_TIMER_POTENTIAL_2D_LOCKUP) +#define MKTC_TIMER_C2DL_START 0xAD000A11 +MKTC_ST(MKTC_TIMER_C2DL_START) +#define MKTC_TIMER_C2DL_END 0xAD000A12 +MKTC_ST(MKTC_TIMER_C2DL_END) +#define MKTC_TIMER_NOT_2D_LOCKUP 0xAD000A13 +MKTC_ST(MKTC_TIMER_NOT_2D_LOCKUP) +#define MKTC_TIMER_ABORTALL 0xAD000A0E +MKTC_ST(MKTC_TIMER_ABORTALL) +#define MKTC_TIMER_END 0xAD000A0F +MKTC_ST(MKTC_TIMER_END) + +#define MKTC_HWR_START 0xAD000B00 +MKTC_ST(MKTC_HWR_START) +#define MKTC_HWR_END 0xAD000B01 +MKTC_ST(MKTC_HWR_END) +#define MKTC_HWR_HKS 0xAD000B02 +MKTC_ST(MKTC_HWR_HKS) +#define MKTC_HWR_PRL 0xAD000B03 +MKTC_ST(MKTC_HWR_PRL) +#define MKTC_HWR_PRL_DP 0xAD000B04 +MKTC_ST(MKTC_HWR_PRL_DP) +#define MKTC_HWR_CRL 0xAD000B05 +MKTC_ST(MKTC_HWR_CRL) +#define MKTC_HWR_CRL_DP 0xAD000B06 +MKTC_ST(MKTC_HWR_CRL_DP) +#define MKTC_HWR_TRL 0xAD000B07 +MKTC_ST(MKTC_HWR_TRL) +#define MKTC_HWR_TRL_DP 0xAD000B08 +MKTC_ST(MKTC_HWR_TRL_DP) +#define MKTC_HWR_ISC 0xAD000B09 +MKTC_ST(MKTC_HWR_ISC) +#define MKTC_HWR_2DL 0xAD000B0A +MKTC_ST(MKTC_HWR_2DL) + +#define MKTC_URSV_START 0xAD000C00 +MKTC_ST(MKTC_URSV_START) +#define MKTC_URSV_UPDATEWRITEOPS 0xAD000C01 +MKTC_ST(MKTC_URSV_UPDATEWRITEOPS) +#define MKTC_URSV_UPDATESTATUSVALS 0xAD000C03 +MKTC_ST(MKTC_URSV_UPDATESTATUSVALS) +#define MKTC_URSV_UPDATESTATUSVALS_DONE 0xAD000C04 +MKTC_ST(MKTC_URSV_UPDATESTATUSVALS_DONE) +#define MKTC_URSV_END 0xAD000C05 +MKTC_ST(MKTC_URSV_END) + +#define MKTC_STORETACONTEXT_START 0xAD000D00 +MKTC_ST(MKTC_STORETACONTEXT_START) +#define MKTC_STORETACONTEXT_END 0xAD000D01 +MKTC_ST(MKTC_STORETACONTEXT_END) +#define MKTC_LOADTACONTEXT_START 0xAD000D02 +MKTC_ST(MKTC_LOADTACONTEXT_START) +#define MKTC_LOADTACONTEXT_END 0xAD000D03 +MKTC_ST(MKTC_LOADTACONTEXT_END) +#define MKTC_STORE3DCONTEXT_START 0xAD000D04 +MKTC_ST(MKTC_STORE3DCONTEXT_START) +#define MKTC_STORE3DCONTEXT_END 0xAD000D05 +MKTC_ST(MKTC_STORE3DCONTEXT_END) +#define MKTC_LOAD3DCONTEXT_START 0xAD000D06 +MKTC_ST(MKTC_LOAD3DCONTEXT_START) +#define MKTC_LOAD3DCONTEXT_END 0xAD000D07 +MKTC_ST(MKTC_LOAD3DCONTEXT_END) + +#define MKTC_FINDTA_POWERREQUEST 0xAD000E00 +MKTC_ST(MKTC_FINDTA_POWERREQUEST) +#define MKTC_FINDTA_TA3D_OVERLAP_BLOCKED 0xAD000E01 +MKTC_ST(MKTC_FINDTA_TA3D_OVERLAP_BLOCKED) +#define MKTC_FINDTA_RTDATA_RENDERING 0xAD000E02 +MKTC_ST(MKTC_FINDTA_RTDATA_RENDERING) +#define MKTC_FINDTA_3DRC_DIFFERENT 0xAD000E03 +MKTC_ST(MKTC_FINDTA_3DRC_DIFFERENT) +#define MKTC_FINDTA_WRITEOPSBLOCKED 0xAD000E04 +MKTC_ST(MKTC_FINDTA_WRITEOPSBLOCKED) +#define MKTC_FINDTA_READOPSBLOCKED 0xAD000E05 +MKTC_ST(MKTC_FINDTA_READOPSBLOCKED) +#define MKTC_FINDTA_RESIZE_PB 0xAD000E06 +MKTC_ST(MKTC_FINDTA_RESIZE_PB) +#define MKTC_FINDTA_RESIZE_PB_BLOCKED 0xAD000E07 +MKTC_ST(MKTC_FINDTA_RESIZE_PB_BLOCKED) +#define MKTC_FINDTA_SHRINK_PB 0xAD000E08 +MKTC_ST(MKTC_FINDTA_SHRINK_PB) +#define MKTC_FINDTA_TAPB_DIFFERENT 0xAD000E09 +MKTC_ST(MKTC_FINDTA_TAPB_DIFFERENT) +#define MKTC_FINDTA_TACONTEXT_DIFFERENT 0xAD000E0A +MKTC_ST(MKTC_FINDTA_TACONTEXT_DIFFERENT) +#define MKTC_FINDTA_TA2D_OVERLAP_BLOCKED 0xAD000E0B +MKTC_ST(MKTC_FINDTA_TA2D_OVERLAP_BLOCKED) +#define MKTC_FINDTA_CONTEXT_SUSPENDED 0xAD000E0C +MKTC_ST(MKTC_FINDTA_CONTEXT_SUSPENDED) +#define MKTC_FINDTA_SRC_READOPSBLOCKED 0xAD000E0D +MKTC_ST(MKTC_FINDTA_SRC_READOPSBLOCKED) +#define MKTC_FINDTA_SRC_WRITEOPSBLOCKED 0xAD000E0E +MKTC_ST(MKTC_FINDTA_SRC_WRITEOPSBLOCKED) +#define MKTC_FINDTA_READOPS2BLOCKED 0xAD000E0F +MKTC_ST(MKTC_FINDTA_READOPS2BLOCKED) + +#define MKTC_CTRL_SRCREADOPSBLOCKED 0xAD000F00 +MKTC_ST(MKTC_CTRL_SRCREADOPSBLOCKED) +#define MKTC_CTRL_SRCWRITEOPSBLOCKED 0xAD000F01 +MKTC_ST(MKTC_CTRL_SRCWRITEOPSBLOCKED) +#define MKTC_CTRL_DSTREADOPSBLOCKED 0xAD000F02 +MKTC_ST(MKTC_CTRL_DSTREADOPSBLOCKED) +#define MKTC_CTRL_DSTWRITEOPSBLOCKED 0xAD000F03 +MKTC_ST(MKTC_CTRL_DSTWRITEOPSBLOCKED) +#define MKTC_CTRL_TARC_DIFFERENT 0xAD000F04 +MKTC_ST(MKTC_CTRL_TARC_DIFFERENT) +#define MKTC_CTRL_CONTEXT_SUSPENDED 0xAD000F05 +MKTC_ST(MKTC_CTRL_CONTEXT_SUSPENDED) +#define MKTC_CTRL_SRCREADOPS2BLOCKED 0xAD000F06 +MKTC_ST(MKTC_CTRL_SRCREADOPS2BLOCKED) + +#define MKTC_DPTA_START 0xAD001000 +MKTC_ST(MKTC_DPTA_START) +#define MKTC_DPTA_UPDATESTATUSVALS 0xAD001001 +MKTC_ST(MKTC_DPTA_UPDATESTATUSVALS) +#define MKTC_DPTA_UPDATESTATUSVALS_DONE 0xAD001002 +MKTC_ST(MKTC_DPTA_UPDATESTATUSVALS_DONE) +#define MKTC_DPTA_NORENDER 0xAD001003 +MKTC_ST(MKTC_DPTA_NORENDER) +#define MKTC_DPTA_MEMFREE 0xAD001004 +MKTC_ST(MKTC_DPTA_MEMFREE) +#define MKTC_DPTA_INC_COMPLETECOUNT 0xAD001005 +MKTC_ST(MKTC_DPTA_INC_COMPLETECOUNT) + +#define MKTC_INVALDC 0xAD001100 +MKTC_ST(MKTC_INVALDC) +#define MKTC_INVALPT 0xAD001101 +MKTC_ST(MKTC_INVALPT) +#define MKTC_INVALSLC 0xAD001102 +MKTC_ST(MKTC_INVALSLC) +#define MKTC_INVALDATA 0xAD001103 +MKTC_ST(MKTC_INVALDATA) + +#define MKTC_RESTARTTA 0xAD001200 +MKTC_ST(MKTC_RESTARTTA) +#define MKTC_CSABORTNONGBL 0xAD001201 +MKTC_ST(MKTC_CSABORTNONGBL) +#define MKTC_CSABORTALL 0xAD001202 +MKTC_ST(MKTC_CSABORTALL) +#define MKTC_CSRENDERINPROGRESS 0xAD001203 +MKTC_ST(MKTC_CSRENDERINPROGRESS) +#define MKTC_TATERMRENDERINPROGRESS 0xAD001204 +MKTC_ST(MKTC_TATERMRENDERINPROGRESS) +#define MKTC_RESTARTTANORENDER 0xAD001205 +MKTC_ST(MKTC_RESTARTTANORENDER) +#define MKTC_SPM_KICKRENDER 0xAD001206 +MKTC_ST(MKTC_SPM_KICKRENDER) +#define MKTC_SPM_RESUME_ABORTCOMPLETE 0xAD001208 +MKTC_ST(MKTC_SPM_RESUME_ABORTCOMPLETE) +#define MKTC_RESUMEVDM 0xAD001209 +MKTC_ST(MKTC_RESUMEVDM) +#define MKTC_REMOVE_RESERVE_MEM 0xAD00120A +MKTC_ST(MKTC_REMOVE_RESERVE_MEM) +#define MKTC_INCREASEZLSTHRESHOLD 0xAD00120B +MKTC_ST(MKTC_INCREASEZLSTHRESHOLD) +#define MKTC_CSFORCEABORTALL 0xAD00120C +MKTC_ST(MKTC_CSFORCEABORTALL) + +#define MKTC_DUMMY_DEPTH 0xAD00120D +MKTC_ST(MKTC_DUMMY_DEPTH) +#define MKTC_DUMMY_DEPTH_CS 0xAD00120E +MKTC_ST(MKTC_DUMMY_DEPTH_CS) + +#define MKTC_MTETE_OOM 0xAD00120F +MKTC_ST(MKTC_MTETE_OOM) +#define MKTC_MTETE_OOM_FIRST_STORE_REF 0xAD001210 +MKTC_ST(MKTC_MTETE_OOM_FIRST_STORE_REF) +#define MKTC_MERGE_STATE_TABLES 0xAD001211 +MKTC_ST(MKTC_MERGE_STATE_TABLES) +#define MKTC_NO_PAGES_LEFT_FOR_23055 0xAD001212 +MKTC_ST(MKTC_NO_PAGES_LEFT_FOR_23055) +#define MKTC_NO_STATE_MODS 0xAD001213 +MKTC_ST(MKTC_NO_STATE_MODS) +#define MKTC_FIND_MTE_PAGE_IN_STATE 0xAD001214 +MKTC_ST(MKTC_FIND_MTE_PAGE_IN_STATE) +#define MKTC_MTE_PAGE_FOUND 0xAD001215 +MKTC_ST(MKTC_MTE_PAGE_FOUND) +#define MKTC_MOVE_MTE_PAGE_TO_TA_STATE 0xAD001216 +MKTC_ST(MKTC_MOVE_MTE_PAGE_TO_TA_STATE) +#define MKTC_MOVE_MTE_PAGE_TO_TA_STATE_END 0xAD001217 +MKTC_ST(MKTC_MOVE_MTE_PAGE_TO_TA_STATE_END) +#define MKTC_ZERO_ZLS_THRESHOLD 0xAD001218 +MKTC_ST(MKTC_ZERO_ZLS_THRESHOLD) +#define MKTC_RESTORE_ZLS_THRESHOLD 0xAD001219 +MKTC_ST(MKTC_RESTORE_ZLS_THRESHOLD) +#define MKTC_FIND_MTE_PAGE_IN_CSM 0xAD00121A +MKTC_ST(MKTC_FIND_MTE_PAGE_IN_CSM) +#define MKTC_REISSUE_MTE_PAGE 0xAD00121B +MKTC_ST(MKTC_REISSUE_MTE_PAGE) +#define MKTC_REISSUE_MTE_PAGE_REQUIRED 0xAD00121C +MKTC_ST(MKTC_REISSUE_MTE_PAGE_REQUIRED) +#define MKTC_REISSUE_MTE_PAGE_END 0xAD00121D +MKTC_ST(MKTC_REISSUE_MTE_PAGE_END) +#define MKTC_RESET_TE_PSG 0xAD00121E +MKTC_ST(MKTC_RESET_TE_PSG) + +#define MKTC_OOM_WRITEOPSBLOCKED 0xAD00121F +MKTC_ST(MKTC_OOM_WRITEOPSBLOCKED) +#define MKTC_OOM_READOPSBLOCKED 0xAD001220 +MKTC_ST(MKTC_OOM_READOPSBLOCKED) +#define MKTC_OOM_SRC_WRITEOPSBLOCKED 0xAD001221 +MKTC_ST(MKTC_OOM_SRC_WRITEOPSBLOCKED) +#define MKTC_OOM_SRC_READOPSBLOCKED 0xAD001222 +MKTC_ST(MKTC_OOM_SRC_READOPSBLOCKED) +#define MKTC_OOM_SPM_DEADLOCK 0xAD001223 +MKTC_ST(MKTC_OOM_SPM_DEADLOCK) +#define MKTC_OOM_SPM_DEADLOCK_MEM_ADDED 0xAD001224 +MKTC_ST(MKTC_OOM_SPM_DEADLOCK_MEM_ADDED) +#define MKTC_RESET 0xAD001225 +MKTC_ST(MKTC_RESET) +#define MKTC_SPM_INVALID_ZLSCONFIG 0xAD001226 +MKTC_ST(MKTC_SPM_INVALID_ZLSCONFIG) + +#define MKTC_OOM_TYPE_MT 0xAD00122A +MKTC_ST(MKTC_OOM_TYPE_MT) +#define MKTC_OOM_TYPE_GLOBAL 0xAD001230 +MKTC_ST(MKTC_OOM_TYPE_GLOBAL) +#define MKTC_OOM_CAUSE_GBL_OOM 0xAD001231 +MKTC_ST(MKTC_OOM_CAUSE_GBL_OOM) +#define MKTC_OOM_RESTORE_LIST_SIZE 0xAD001232 +MKTC_ST(MKTC_OOM_RESTORE_LIST_SIZE) + +#define MKTC_CHECK_MTE_PAGE_REISSUE 0xAD001240 +MKTC_ST(MKTC_CHECK_MTE_PAGE_REISSUE) +#define MKTC_CPRI_VALID_ENTRIES 0xAD001241 +MKTC_ST(MKTC_CPRI_VALID_ENTRIES) +#define MKTC_CPRI_STORE_DPLIST 0xAD001242 +MKTC_ST(MKTC_CPRI_STORE_DPLIST) +#define MKTC_CPRI_STORE_OTPM_CSM 0xAD001243 +MKTC_ST(MKTC_CPRI_STORE_OTPM_CSM) +#define MKTC_CPRI_ABORT_MT_IDX 0xAD001244 +MKTC_ST(MKTC_CPRI_ABORT_MT_IDX) +#define MKTC_CPRI_ABORT_CORE_IDX 0xAD001245 +MKTC_ST(MKTC_CPRI_ABORT_CORE_IDX) +#define MKTC_CPRI_CSM_TABLE_DATA 0xAD001246 +MKTC_ST(MKTC_CPRI_CSM_TABLE_DATA) +#define MKTC_CPRI_PIM_DATA 0xAD001247 +MKTC_ST(MKTC_CPRI_PIM_DATA) +#define MKTC_CPRI_DO_CIRCULAR_TEST 0xAD001248 +MKTC_ST(MKTC_CPRI_DO_CIRCULAR_TEST) +#define MKTC_CPRI_WRITE_ENTRIES 0xAD001249 +MKTC_ST(MKTC_CPRI_WRITE_ENTRIES) + +#define MKTC_MTE_ENTRY_NOT_IN_ANY_LIST 0xAD001250 +MKTC_ST(MKTC_MTE_ENTRY_NOT_IN_ANY_LIST) + +#define MKTC_SPMAC_IGNORE_TERMINATE 0xAD001251 +MKTC_ST(MKTC_SPMAC_IGNORE_TERMINATE) + +#define MKTC_SPMAC_REQUEST_3D_TIMEOUT 0xAD001252 +MKTC_ST(MKTC_SPMAC_REQUEST_3D_TIMEOUT) +#define MKTC_SPMAC_3D_TIMEOUT_COMPLETE 0xAD001253 +MKTC_ST(MKTC_SPMAC_3D_TIMEOUT_COMPLETE) +#define MKTC_OOM_READOPS2BLOCKED 0xAD001254 +MKTC_ST(MKTC_OOM_READOPS2BLOCKED) + +/* PB Load/store status */ +#define MKTC_LOADTAPB_START 0xAD001300 +MKTC_ST(MKTC_LOADTAPB_START) +#define MKTC_LOADTAPB_END 0xAD001301 +MKTC_ST(MKTC_LOADTAPB_END) +#define MKTC_STORETAPB_START 0xAD001302 +MKTC_ST(MKTC_STORETAPB_START) +#define MKTC_STORETAPB_END 0xAD001303 +MKTC_ST(MKTC_STORETAPB_END) +#define MKTC_LOAD3DPB_START 0xAD001304 +MKTC_ST(MKTC_LOAD3DPB_START) +#define MKTC_LOAD3DPB_END 0xAD001305 +MKTC_ST(MKTC_LOAD3DPB_END) +#define MKTC_STORE3DPB_START 0xAD001306 +MKTC_ST(MKTC_STORE3DPB_START) +#define MKTC_STORE3DPB_END 0xAD001307 +MKTC_ST(MKTC_STORE3DPB_END) +#define MKTC_LOADTAPB_PAGETABLE_DONE 0xAD001308 +MKTC_ST(MKTC_LOADTAPB_PAGETABLE_DONE) +#define MKTC_LOAD3DPB_PAGETABLE_DONE 0xAD001309 +MKTC_ST(MKTC_LOAD3DPB_PAGETABLE_DONE) + +#define MKTC_TIMER_RC_CLEANUP 0xAD001400 +MKTC_ST(MKTC_TIMER_RC_CLEANUP) +#define MKTC_TIMER_RC_CLEANUP_DONE 0xAD001401 +MKTC_ST(MKTC_TIMER_RC_CLEANUP_DONE) +#define MKTC_TIMER_RC_CLEANUP_BUSY 0xAD001402 +MKTC_ST(MKTC_TIMER_RC_CLEANUP_BUSY) +#define MKTC_TIMER_RT_CLEANUP 0xAD001410 +MKTC_ST(MKTC_TIMER_RT_CLEANUP) +#define MKTC_TIMER_RT_CLEANUP_DONE 0xAD001411 +MKTC_ST(MKTC_TIMER_RT_CLEANUP_DONE) +#define MKTC_TIMER_RT_CLEANUP_PENDING 0xAD001412 +MKTC_ST(MKTC_TIMER_RT_CLEANUP_PENDING) +#define MKTC_TIMER_RT_CLEANUP_TIDYPARTIALLIST 0xAD001413 +MKTC_ST(MKTC_TIMER_RT_CLEANUP_TIDYPARTIALLIST) +#define MKTC_TIMER_RT_CLEANUP_BUSY 0xAD001414 +MKTC_ST(MKTC_TIMER_RT_CLEANUP_BUSY) +#define MKTC_TIMER_TC_CLEANUP 0xAD001420 +MKTC_ST(MKTC_TIMER_TC_CLEANUP) +#define MKTC_TIMER_TC_CLEANUP_DONE 0xAD001421 +MKTC_ST(MKTC_TIMER_TC_CLEANUP_DONE) +#define MKTC_TIMER_TC_CLEANUP_BUSY 0xAD001422 +MKTC_ST(MKTC_TIMER_TC_CLEANUP_BUSY) +#define MKTC_TIMER_2DC_CLEANUP 0xAD001430 +MKTC_ST(MKTC_TIMER_2DC_CLEANUP) +#define MKTC_TIMER_2DC_CLEANUP_DONE 0xAD001431 +MKTC_ST(MKTC_TIMER_2DC_CLEANUP_DONE) +#define MKTC_TIMER_2DC_CLEANUP_BUSY 0xAD001432 +MKTC_ST(MKTC_TIMER_2DC_CLEANUP_BUSY) +#define MKTC_TIMER_SHAREDPBDESC_CLEANUP 0xAD001440 +MKTC_ST(MKTC_TIMER_SHAREDPBDESC_CLEANUP) + + +#define MKTC_TIMER_ISP_SWITCH_POTENTIAL_LOCKUP 0xAD001450 +MKTC_ST(MKTC_TIMER_ISP_SWITCH_POTENTIAL_LOCKUP) +#define MKTC_TIMER_ISP_SWITCH_FORCE_SWITCH 0xAD001451 +MKTC_ST(MKTC_TIMER_ISP_SWITCH_FORCE_SWITCH) + +#define MKTC_UTSO_UPDATEREADOPS 0xAD001600 +MKTC_ST(MKTC_UTSO_UPDATEREADOPS) +#define MKTC_UTSO_UPDATEWRITEOPS 0xAD001601 +MKTC_ST(MKTC_UTSO_UPDATEWRITEOPS) + +#define MKTC_TAFINISHED_UPDATESTATUSVALS 0xAD001700 +MKTC_ST(MKTC_TAFINISHED_UPDATESTATUSVALS) +#define MKTC_TAFINISHED_UPDATESTATUSVALS_DONE 0xAD001701 +MKTC_ST(MKTC_TAFINISHED_UPDATESTATUSVALS_DONE) +#define MKTC_TAFINISHED_NORENDER 0xAD001702 +MKTC_ST(MKTC_TAFINISHED_NORENDER) +#define MKTC_TAFINISHED_LASTKICK 0xAD001703 +MKTC_ST(MKTC_TAFINISHED_LASTKICK) +#define MKTC_TAFINISHED_FINDRENDER 0xAD001704 +MKTC_ST(MKTC_TAFINISHED_FINDRENDER) +#define MKTC_TAFINISHED_FINDTA 0xAD001705 +MKTC_ST(MKTC_TAFINISHED_FINDTA) +#define MKTC_TAFINISHED_END 0xAD001706 +MKTC_ST(MKTC_TAFINISHED_END) +#define MKTC_TAF_SPM_DEADLOCK_MEM_REMOVED 0xAD001707 +MKTC_ST(MKTC_TAF_SPM_DEADLOCK_MEM_REMOVED) +#define MKTC_TAF_RESERVE_MEM 0xAD001708 +MKTC_ST(MKTC_TAF_RESERVE_MEM) +#define MKTC_TAF_RESERVE_MEM_REQUEST_RENDER 0xAD001709 +MKTC_ST(MKTC_TAF_RESERVE_MEM_REQUEST_RENDER) +#define MKTC_TAF_RESERVE_FREE_RENDER_FINISHED 0xAD00170A +MKTC_ST(MKTC_TAF_RESERVE_FREE_RENDER_FINISHED) +#define MKTC_TAF_RESERVE_FREE_DUMMY_RENDER 0xAD00170B +MKTC_ST(MKTC_TAF_RESERVE_FREE_DUMMY_RENDER) +#define MKTC_TAF_DEBUG_SAS 0xAD00170C +MKTC_ST(MKTC_TAF_DEBUG_SAS) +#define MKTC_TAFINISHED_NOCONTEXTSWITCH 0xAD00170D +MKTC_ST(MKTC_TAFINISHED_NOCONTEXTSWITCH) + +#define MKTC_TAFINISHED_TERM_COMPLETE_START 0xAD001710 +MKTC_ST(MKTC_TAFINISHED_TERM_COMPLETE_START) +#define MKTC_TAFINISHED_TERM_COMPLETE_END 0xAD001711 +MKTC_ST(MKTC_TAFINISHED_TERM_COMPLETE_END) + +#define MKTC_TAFINISHED_DPMPAGERECYCLING 0xAD001720 +MKTC_ST(MKTC_TAFINISHED_DPMPAGERECYCLING) + +#define MKTC_2DEVENT_2DCOMPLETE 0xAD001800 +MKTC_ST(MKTC_2DEVENT_2DCOMPLETE) +#define MKTC_2DEVENT_END 0xAD001801 +MKTC_ST(MKTC_2DEVENT_END) +#define MKTC_2DLB_2DCOMPLETE 0xAD001802 +MKTC_ST(MKTC_2DLB_2DCOMPLETE) +#define MKTC_2DLB_FIND2D 0xAD001803 +MKTC_ST(MKTC_2DLB_FIND2D) +#define MKTC_2DLB_END 0xAD001804 +MKTC_ST(MKTC_2DLB_END) +#define MKTC_2DCOMPLETE_START 0xAD001805 +MKTC_ST(MKTC_2DCOMPLETE_START) +#define MKTC_2DCOMPLETE_END 0xAD001806 +MKTC_ST(MKTC_2DCOMPLETE_END) +#define MKTC_KICK2D_START 0xAD001807 +MKTC_ST(MKTC_KICK2D_START) +#define MKTC_KICK2D_END 0xAD001808 +MKTC_ST(MKTC_KICK2D_END) +#define MKTC_DUMMYPROC2D 0xAD001809 +MKTC_ST(MKTC_DUMMYPROC2D) +#define MKTC_FTD_SRCREADOPSBLOCKED 0xAD00180A +MKTC_ST(MKTC_FTD_SRCREADOPSBLOCKED) +#define MKTC_FTD_SRCWRITEOPSBLOCKED 0xAD00180B +MKTC_ST(MKTC_FTD_SRCWRITEOPSBLOCKED) +#define MKTC_FTD_DSTREADOPSBLOCKED 0xAD00180C +MKTC_ST(MKTC_FTD_DSTREADOPSBLOCKED) +#define MKTC_FTD_DSTWRITEOPSBLOCKED 0xAD00180D +MKTC_ST(MKTC_FTD_DSTWRITEOPSBLOCKED) +#define MKTC_FTD_TA2D_OVERLAP_BLOCKED 0xAD00180E +MKTC_ST(MKTC_FTD_TA2D_OVERLAP_BLOCKED) +#define MKTC_U2DSO_UPDATEREADOPS 0xAD00180F +MKTC_ST(MKTC_U2DSO_UPDATEREADOPS) +#define MKTC_U2DSO_UPDATEWRITEOPS 0xAD001810 +MKTC_ST(MKTC_U2DSO_UPDATEWRITEOPS) +#define MKTC_FTD_TAOPSBLOCKED 0xAD001811 +MKTC_ST(MKTC_FTD_TAOPSBLOCKED) +#define MKTC_KICK2D_2DSLAVEPORT 0xAD001812 +MKTC_ST(MKTC_KICK2D_2DSLAVEPORT) +#define MKTC_KICK2D_2DSLAVEPORT_DONE 0xAD001813 +MKTC_ST(MKTC_KICK2D_2DSLAVEPORT_DONE) +#define MKTC_FTD_CONTEXT_SUSPENDED 0xAD001814 +MKTC_ST(MKTC_FTD_CONTEXT_SUSPENDED) +#define MKTC_KICK2D_PID 0xAD001815 +MKTC_ST(MKTC_KICK2D_PID) +#define MKTC_FIND2D_ADDR_SPACE_DIFFERENT 0xAD001816 +MKTC_ST(MKTC_FIND2D_ADDR_SPACE_DIFFERENT) +#define MKTC_FTD_3DOPSBLOCKED 0xAD001817 +MKTC_ST(MKTC_FTD_3DOPSBLOCKED) +#define MKTC_FTD_DSTREADOPS2BLOCKED 0xAD001818 +MKTC_ST(MKTC_FTD_DSTREADOPS2BLOCKED) + +#define MKTC_FCM_START 0xAD001900 +MKTC_ST(MKTC_FCM_START) +#define MKTC_FCM_END 0xAD001901 +MKTC_ST(MKTC_FCM_END) + +#define MKTC_TIMER_ACTIVE_POWER 0xAD001A00 +MKTC_ST(MKTC_TIMER_ACTIVE_POWER) +#define MKTC_TIMER_POWER_3D_ACTIVE 0xAD001A01 +MKTC_ST(MKTC_TIMER_POWER_3D_ACTIVE) +#define MKTC_TIMER_POWER_TA_ACTIVE 0xAD001A02 +MKTC_ST(MKTC_TIMER_POWER_TA_ACTIVE) +#define MKTC_TIMER_POWER_2D_ACTIVE 0xAD001A03 +MKTC_ST(MKTC_TIMER_POWER_2D_ACTIVE) +#define MKTC_TIMER_POWER_PENDING_EVENTS 0xAD001A04 +MKTC_ST(MKTC_TIMER_POWER_PENDING_EVENTS) +#define MKTC_TIMER_POWER_IDLE 0xAD001A05 +MKTC_ST(MKTC_TIMER_POWER_IDLE) +#define MKTC_TIMER_POWER_OFF 0xAD001A06 +MKTC_ST(MKTC_TIMER_POWER_OFF) +#define MKTC_TIMER_POWER_CCB_ERROR 0xAD001A07 +MKTC_ST(MKTC_TIMER_POWER_CCB_ERROR) +#define MKTC_TIMER_POWER_RESTART_IMMEDIATE 0xAD001A08 +MKTC_ST(MKTC_TIMER_POWER_RESTART_IMMEDIATE) + +#define MKTC_3DCONTEXT_SWITCH 0xAD001B00 +MKTC_ST(MKTC_3DCONTEXT_SWITCH) +#define MKTC_3DCONTEXT_SWITCH_END 0xAD001B01 +MKTC_ST(MKTC_3DCONTEXT_SWITCH_END) + +#define MKTC_TACONTEXT_SWITCH 0xAD001C00 +MKTC_ST(MKTC_TACONTEXT_SWITCH) +#define MKTC_TACONTEXT_SWITCH_END 0xAD001C02 +MKTC_ST(MKTC_TACONTEXT_SWITCH_END) + +#define MKTC_GETMISCINFO_MEMREAD_START 0xAD001D00 +MKTC_ST(MKTC_GETMISCINFO_MEMREAD_START) +#define MKTC_GETMISCINFO_MEMREAD_END 0xAD001D01 +MKTC_ST(MKTC_GETMISCINFO_MEMREAD_END) +#define MKTC_GETMISCINFO_MEMWRITE_START 0xAD001D02 +MKTC_ST(MKTC_GETMISCINFO_MEMWRITE_START) +#define MKTC_GETMISCINFO_MEMWRITE_END 0xAD001D03 +MKTC_ST(MKTC_GETMISCINFO_MEMWRITE_END) + +#define MKTC_HALTTA 0xAD001E00 +MKTC_ST(MKTC_HALTTA) +#define MKTC_HTA_SET_FLAG 0xAD001E01 +MKTC_ST(MKTC_HTA_SET_FLAG) +#define MKTC_HTA_SAVE_COMPLEX_PTR 0xAD001E02 +MKTC_ST(MKTC_HTA_SAVE_COMPLEX_PTR) +#define MKTC_HALTTA_END 0xAD001E03 +MKTC_ST(MKTC_HALTTA_END) + +#define MKTC_RESUMETA 0xAD001F00 +MKTC_ST(MKTC_RESUMETA) +#define MKTC_RTA_CONTEXT_LOADED 0xAD001F01 +MKTC_ST(MKTC_RTA_CONTEXT_LOADED) +#define MKTC_RTA_MTE_STATE_KICKED 0xAD001F02 +MKTC_ST(MKTC_RTA_MTE_STATE_KICKED) +#define MKTC_RTA_CMPLX_GEOM_PRESENT 0xAD001F03 +MKTC_ST(MKTC_RTA_CMPLX_GEOM_PRESENT) +#define MKTC_RTA_CMPLX_STATE_KICKED 0xAD001F04 +MKTC_ST(MKTC_RTA_CMPLX_STATE_KICKED) +#define MKTC_RTA_CHECK_NEXT_SA_PROG 0xAD001F05 +MKTC_ST(MKTC_RTA_CHECK_NEXT_SA_PROG) +#define MKTC_RTA_CORE_COMPLETED 0xAD001F06 +MKTC_ST(MKTC_RTA_CORE_COMPLETED) +#define MKTC_RTA_DEBUG_SAS 0xAD001F07 +MKTC_ST(MKTC_RTA_DEBUG_SAS) +#define MKTC_RESUMETA_END 0xAD001F0F +MKTC_ST(MKTC_RESUMETA_END) + +#define MKTC_RENDERHALT 0xAD002000 +MKTC_ST(MKTC_RENDERHALT) +#define MKTC_RH_CLEARFLAGS 0xAD002001 +MKTC_ST(MKTC_RH_CLEARFLAGS) +#define MKTC_RH_CTRL_ADDR 0xAD002002 +MKTC_ST(MKTC_RH_CTRL_ADDR) +#define MKTC_RH_RGN_ADDR 0xAD002003 +MKTC_ST(MKTC_RH_RGN_ADDR) +#define MKTC_RH_EMPTY_TILE 0xAD002004 +MKTC_ST(MKTC_RH_EMPTY_TILE) +#define MKTC_RH_EMPTY_LAST_TILE 0xAD002005 +MKTC_ST(MKTC_RH_EMPTY_LAST_TILE) +#define MKTC_RH_3D_TIMEOUT 0xAD002006 +MKTC_ST(MKTC_RH_3D_TIMEOUT) +#define MKTC_RH_NOT_EMPTY 0xAD002007 +MKTC_ST(MKTC_RH_NOT_EMPTY) +#define MKTC_RH_OBJECT_COMPLETE 0xAD002008 +MKTC_ST(MKTC_RH_OBJECT_COMPLETE) +#define MKTC_RH_STREAM_LINK 0xAD002009 +MKTC_ST(MKTC_RH_STREAM_LINK) +#define MKTC_RH_OBJECT_INCOMPLETE 0xAD00200A +MKTC_ST(MKTC_RH_OBJECT_INCOMPLETE) +#define MKTC_RH_PRIM_MASK_PRESENT 0xAD00200B +MKTC_ST(MKTC_RH_PRIM_MASK_PRESENT) +#define MKTC_RH_BYTE_MASK_PRESENT 0xAD00200C +MKTC_ST(MKTC_RH_BYTE_MASK_PRESENT) +#define MKTC_RH_BYTE_MASK_ZERO 0xAD00200D +MKTC_ST(MKTC_RH_BYTE_MASK_ZERO) +#define MKTC_RH_PRIM_MASK_ZERO 0xAD00200E +MKTC_ST(MKTC_RH_PRIM_MASK_ZERO) +#define MKTC_RH_INVALIDATE_OBJECTS 0xAD00200F +MKTC_ST(MKTC_RH_INVALIDATE_OBJECTS) +#define MKTC_RH_OBJECTS_INVALIDATED 0xAD002010 +MKTC_ST(MKTC_RH_OBJECTS_INVALIDATED) +#define MKTC_RH_DPM_RGN_PARSER_IDLE 0xAD002011 +MKTC_ST(MKTC_RH_DPM_RGN_PARSER_IDLE) +#define MKTC_RH_NEXT_RGN_BASE 0xAD002012 +MKTC_ST(MKTC_RH_NEXT_RGN_BASE) +#define MKTC_RH_OCC_EXIT 0xAD002013 +MKTC_ST(MKTC_RH_OCC_EXIT) +#define MKTC_RH_STILL_RUNNING 0xAD002020 +MKTC_ST(MKTC_RH_STILL_RUNNING) +#define MKTC_RH_CLEARMCI 0xAD002021 +MKTC_ST(MKTC_RH_CLEARMCI) +#define MKTC_RH_EOR 0xAD002022 +MKTC_ST(MKTC_RH_EOR) +#define MKTC_RENDERHALT_END 0xAD002030 +MKTC_ST(MKTC_RENDERHALT_END) + +#define MKTC_FIND3D_POWERREQUEST 0xAD002100 +MKTC_ST(MKTC_FIND3D_POWERREQUEST) + +#define MKTC_FIND2D_POWERREQUEST 0xAD002200 +MKTC_ST(MKTC_FIND2D_POWERREQUEST) + +#define MKTC_UKERNEL_INIT 0xAD002300 +MKTC_ST(MKTC_UKERNEL_INIT) +#define MKTC_UKERNEL_INIT_DCS_COMPLETE 0xAD002301 +MKTC_ST(MKTC_UKERNEL_INIT_DCS_COMPLETE) +#define MKTC_UKERNEL_INIT_VDMKICK_COMPLETE 0xAD002303 +MKTC_ST(MKTC_UKERNEL_INIT_VDMKICK_COMPLETE) + +#define MKTC_KICKTRANSFERRENDER_START 0xAD002400 +MKTC_ST(MKTC_KICKTRANSFERRENDER_START) +#define MKTC_KICKTRANSFERRENDER_ISP_START 0xAD002401 +MKTC_ST(MKTC_KICKTRANSFERRENDER_ISP_START) +#define MKTC_KICKTRANSFERRENDER_END 0xAD002402 +MKTC_ST(MKTC_KICKTRANSFERRENDER_END) +#define MKTC_DUMMYPROCTRANSFER 0xAD002403 +MKTC_ST(MKTC_DUMMYPROCTRANSFER) +#define MKTC_KTR_TQFENCE 0xAD002404 +MKTC_ST(MKTC_KTR_TQFENCE) +#define MKTC_KICKTRANSFERRENDER_PID 0xAD002405 +MKTC_ST(MKTC_KICKTRANSFERRENDER_PID) + +#define MKTC_HOSTKICK_CLEANUP_RT 0xAD002500 +MKTC_ST(MKTC_HOSTKICK_CLEANUP_RT) +#define MKTC_HOSTKICK_CLEANUP_RC 0xAD002501 +MKTC_ST(MKTC_HOSTKICK_CLEANUP_RC) +#define MKTC_HOSTKICK_CLEANUP_TC 0xAD002502 +MKTC_ST(MKTC_HOSTKICK_CLEANUP_TC) +#define MKTC_HOSTKICK_CLEANUP_2DC 0xAD002503 +MKTC_ST(MKTC_HOSTKICK_CLEANUP_2DC) +#define MKTC_HOSTKICK_CLEANUP_PB 0xAD002504 +MKTC_ST(MKTC_HOSTKICK_CLEANUP_PB) +#define MKTC_HOSTKICK_GETMISCINFO 0xAD002505 +MKTC_ST(MKTC_HOSTKICK_GETMISCINFO) +#define MKTC_HOSTKICK_DATABREAKPOINT 0xAD002506 +MKTC_ST(MKTC_HOSTKICK_DATABREAKPOINT) +#define MKTC_HOSTKICK_SETHWPERFSTATUS 0xAD002507 +MKTC_ST(MKTC_HOSTKICK_SETHWPERFSTATUS) + +#define MKTC_ZEROPC 0xAD002600 +MKTC_ST(MKTC_ZEROPC) + +#define MKTC_ASSERT_FAIL 0xAD002700 +MKTC_ST(MKTC_ASSERT_FAIL) + +#define MKTC_SDLB_ILLEGAL 0xAD002800 +MKTC_ST(MKTC_SDLB_ILLEGAL) + +#define MKTC_SPMEVENT_OUTOFMEM 0xAD002901 +MKTC_ST(MKTC_SPMEVENT_OUTOFMEM) +#define MKTC_SPMEVENT_TATERMINATE 0xAD002902 +MKTC_ST(MKTC_SPMEVENT_TATERMINATE) +#define MKTC_SPMEVENT_END 0xAD002904 +MKTC_ST(MKTC_SPMEVENT_END) + +#define MKTC_SPMLB_OUTOFMEM 0xAD002981 +MKTC_ST(MKTC_SPMLB_OUTOFMEM) +#define MKTC_SPMLB_TATERMINATE 0xAD002982 +MKTC_ST(MKTC_SPMLB_TATERMINATE) +#define MKTC_SPMLB_SPMRENDERFINSHED 0xAD002983 +MKTC_ST(MKTC_SPMLB_SPMRENDERFINSHED) +#define MKTC_SPMLB_END 0xAD002985 +MKTC_ST(MKTC_SPMLB_END) + +#define MKTC_SPM_CHECK_MT_DEADLOCK 0xAD002991 +MKTC_ST(MKTC_SPM_CHECK_MT_DEADLOCK) +#define MKTC_SPM_CHECK_GLOBAL_DEADLOCK 0xAD002992 +MKTC_ST(MKTC_SPM_CHECK_GLOBAL_DEADLOCK) +#define MKTC_SPM_RESERVE_ADDED 0xAD002993 +MKTC_ST(MKTC_SPM_RESERVE_ADDED) +#define MKTC_SPM_FORCE_GLOBAL_OOM_FAILED 0xAD00299E +MKTC_ST(MKTC_SPM_FORCE_GLOBAL_OOM_FAILED) +#define MKTC_SPM_DEADLOCK_MEM_FAILED 0xAD00299F +MKTC_ST(MKTC_SPM_DEADLOCK_MEM_FAILED) + +#define MKTC_IBC_ILLEGAL 0xAD002A00 +MKTC_ST(MKTC_IBC_ILLEGAL) + +#define MKTC_HWP_CLEARCOUNTERS 0xAD002B00 +MKTC_ST(MKTC_HWP_CLEARCOUNTERS) + +#define MKTC_TA_FRAMENUM 0xAD002C00 +MKTC_ST(MKTC_TA_FRAMENUM) +#define MKTC_3D_FRAMENUM 0xAD002C01 +MKTC_ST(MKTC_3D_FRAMENUM) +#define MKTC_SPM3D_FRAMENUM 0xAD002C02 +MKTC_ST(MKTC_SPM3D_FRAMENUM) + +#define MKTC_HKTA_RENDERCONTEXT 0xAD002D00 +MKTC_ST(MKTC_HKTA_RENDERCONTEXT) +#define MKTC_IDLECORE_REFCOUNT_FAIL 0xAD002E00 +MKTC_ST(MKTC_IDLECORE_REFCOUNT_FAIL) + +#define MKTC_MCISTATE_NOT_CLEARED 0xAD002F00 +MKTC_ST(MKTC_MCISTATE_NOT_CLEARED) + +#define MKTC_LOWERED_TO_PDS_THRESHOLD 0xAD003000 +MKTC_ST(MKTC_LOWERED_TO_PDS_THRESHOLD) +#define MKTC_REDUCE_MAX_VTX_PARTITIONS 0xAD003001 +MKTC_ST(MKTC_REDUCE_MAX_VTX_PARTITIONS) +#define MKTC_KTAOVERRIDE_MAX_VTX_PARTITIONS 0xAD003002 +MKTC_ST(MKTC_KTAOVERRIDE_MAX_VTX_PARTITIONS) +#define MKTC_KTANOOVERRIDE_MAX_VTX_PARTITIONS 0xAD003003 +MKTC_ST(MKTC_KTANOOVERRIDE_MAX_VTX_PARTITIONS) + +#define MKTC_IPRB_NORENDERDETAILS 0xAD003010 +MKTC_ST(MKTC_IPRB_NORENDERDETAILS) +#define MKTC_IPRB_HAVERENDERDETAILS 0xAD003011 +MKTC_ST(MKTC_IPRB_HAVERENDERDETAILS) + +#define MKTC_RENDER_OUT_OF_ORDER 0xAD003020 +MKTC_ST(MKTC_RENDER_OUT_OF_ORDER) +#define MKTC_RENDER_NOT_OUT_OF_ORDER 0xAD003021 +MKTC_ST(MKTC_RENDER_NOT_OUT_OF_ORDER) + +#define MKTC_ZLS_IDLE_BEGIN 0xAD003030 +MKTC_ST(MKTC_ZLS_IDLE_BEGIN) +#define MKTC_ZLS_ISP_CLK_GATING_EN 0xAD003031 +MKTC_ST(MKTC_ZLS_ISP_CLK_GATING_EN) +#define MKTC_ZLS_IDLE_END 0xAD003032 +MKTC_ST(MKTC_ZLS_IDLE_END) + +#endif /* __SGX_UKERNEL_STATUS_CODES_H__ */ + +/****************************************************************************** + End of file (sgx_ukernel_status_codes.h) +******************************************************************************/ diff --git a/drivers/staging/mrst/pvr/services4/include/sgxinfo.h b/drivers/staging/mrst/pvr/services4/include/sgxinfo.h index 32dddb0..dec8577 100644 --- a/drivers/staging/mrst/pvr/services4/include/sgxinfo.h +++ b/drivers/staging/mrst/pvr/services4/include/sgxinfo.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -135,7 +135,7 @@ typedef struct _SGX_BRIDGE_INIT_INFO_ #endif #endif -#if defined(FIX_HW_BRN_31542) +#if defined(FIX_HW_BRN_31542) || defined(FIX_HW_BRN_36513) #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelClearClipWAVDMStreamMemInfo; IMG_SID hKernelClearClipWAIndexStreamMemInfo; @@ -157,7 +157,7 @@ typedef struct _SGX_BRIDGE_INIT_INFO_ #endif #endif -#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31425) +#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31559) IMG_HANDLE hKernelVDMSnapShotBufferMemInfo; IMG_HANDLE hKernelVDMCtrlStreamBufferMemInfo; #endif @@ -172,13 +172,6 @@ typedef struct _SGX_BRIDGE_INIT_INFO_ IMG_HANDLE hKernelEDMStatusBufferMemInfo; #endif #endif -#if defined(SGX_FEATURE_OVERLAPPED_SPM) -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hKernelTmpRgnHeaderMemInfo; -#else - IMG_HANDLE hKernelTmpRgnHeaderMemInfo; -#endif -#endif IMG_UINT32 ui32EDMTaskReg0; IMG_UINT32 ui32EDMTaskReg1; @@ -192,7 +185,7 @@ typedef struct _SGX_BRIDGE_INIT_INFO_ IMG_UINT32 ui32MasterClkGateStatusMask; IMG_UINT32 ui32MasterClkGateStatus2Reg; IMG_UINT32 ui32MasterClkGateStatus2Mask; -#endif +#endif IMG_UINT32 ui32CacheControl; @@ -222,7 +215,7 @@ typedef struct _SGX_DEVICE_SYNC_LIST_ struct _SGX_DEVICE_SYNC_LIST_ *psNext; - + IMG_UINT32 ui32NumSyncObjects; #if defined (SUPPORT_SID_INTERFACE) IMG_SID ahSyncHandles[1]; @@ -259,7 +252,7 @@ typedef struct _SGX_CCB_KICK_ IMG_HANDLE hKernelHWSyncListMemInfo; #endif - + #if defined (SUPPORT_SID_INTERFACE) IMG_SID *pahDstSyncHandles; #else @@ -288,11 +281,11 @@ typedef struct _SGX_CCB_KICK_ #endif IMG_BOOL bLastInScene; - + IMG_UINT32 ui32CCBOffset; #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) - + IMG_UINT32 ui32NumTASrcSyncs; #if defined (SUPPORT_SID_INTERFACE) IMG_SID ahTASrcKernelSyncInfo[SGX_MAX_TA_SRC_SYNCS]; @@ -312,16 +305,16 @@ typedef struct _SGX_CCB_KICK_ IMG_HANDLE ah3DSrcKernelSyncInfo[SGX_MAX_3D_SRC_SYNCS]; #endif #else - + IMG_UINT32 ui32NumSrcSyncs; #if defined (SUPPORT_SID_INTERFACE) - IMG_SID ahSrcKernelSyncInfo[SGX_MAX_SRC_SYNCS]; + IMG_SID ahSrcKernelSyncInfo[SGX_MAX_SRC_SYNCS_TA]; #else - IMG_HANDLE ahSrcKernelSyncInfo[SGX_MAX_SRC_SYNCS]; + IMG_HANDLE ahSrcKernelSyncInfo[SGX_MAX_SRC_SYNCS_TA]; #endif #endif - + IMG_BOOL bTADependency; #if defined (SUPPORT_SID_INTERFACE) IMG_SID hTA3DSyncInfo; @@ -349,9 +342,9 @@ typedef struct _SGX_CCB_KICK_ typedef struct _SGX_CLIENT_INFO_ { - IMG_UINT32 ui32ProcessID; - IMG_VOID *pvProcess; - PVRSRV_MISC_INFO sMiscInfo; + IMG_UINT32 ui32ProcessID; + IMG_VOID *pvProcess; + PVRSRV_MISC_INFO sMiscInfo; IMG_UINT32 asDevData[SGX_MAX_DEV_DATA]; @@ -436,24 +429,24 @@ typedef struct _PVRSRV_2D_SGX_KICK_ #if defined (SUPPORT_SID_INTERFACE) IMG_SID ahSrcSyncInfo[SGX_MAX_2D_SRC_SYNC_OPS]; - + IMG_SID hDstSyncInfo; - + IMG_SID hTASyncInfo; - + IMG_SID h3DSyncInfo; #else IMG_HANDLE ahSrcSyncInfo[SGX_MAX_2D_SRC_SYNC_OPS]; - + IMG_HANDLE hDstSyncInfo; - + IMG_HANDLE hTASyncInfo; - + IMG_HANDLE h3DSyncInfo; #endif @@ -463,8 +456,8 @@ typedef struct _PVRSRV_2D_SGX_KICK_ #endif IMG_HANDLE hDevMemContext; } PVRSRV_2D_SGX_KICK, *PPVRSRV_2D_SGX_KICK; -#endif -#endif +#endif +#endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_pvr_bridge.c b/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_pvr_bridge.c index 7d4cb8e..c7c14b4 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_pvr_bridge.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_pvr_bridge.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -148,7 +148,7 @@ PVRSRVAcquireDeviceDataBW(IMG_UINT32 ui32BridgeID, return 0; } - + psAcquireDevInfoOUT->eError = PVRSRVAllocHandle(psPerProc->psHandleBase, &psAcquireDevInfoOUT->hDevCookie, @@ -176,7 +176,7 @@ PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_CREATE_DEVMEMCONTEXT); - + NEW_HANDLE_BATCH_OR_ERROR(psCreateDevMemContextOUT->eError, psPerProc, PVRSRV_MAX_CLIENT_HEAPS + 1) psCreateDevMemContextOUT->eError = @@ -207,7 +207,7 @@ PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID, return 0; } - + if(bCreated) { PVRSRVAllocHandleNR(psPerProc->psHandleBase, @@ -241,7 +241,7 @@ PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID, if(abSharedDeviceMemHeap[i]) #endif { - + #if defined (SUPPORT_SID_INTERFACE) PVRSRVAllocHandleNR(psPerProc->psHandleBase, &hDevMemHeapExt, @@ -258,7 +258,7 @@ PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID, #if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE) else { - + if(bCreated) { #if defined (SUPPORT_SID_INTERFACE) @@ -426,7 +426,7 @@ PVRSRVGetDeviceMemHeapInfoBW(IMG_UINT32 ui32BridgeID, if(abSharedDeviceMemHeap[i]) #endif { - + #if defined (SUPPORT_SID_INTERFACE) PVRSRVAllocHandleNR(psPerProc->psHandleBase, &hDevMemHeapExt, @@ -443,7 +443,7 @@ PVRSRVGetDeviceMemHeapInfoBW(IMG_UINT32 ui32BridgeID, #if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE) else { - + psGetDevMemHeapInfoOUT->eError = PVRSRVFindHandle(psPerProc->psHandleBase, &hDevMemHeapExt, @@ -518,15 +518,15 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID, return 0; } - + bUseShareMemWorkaround = ((psAllocDeviceMemIN->ui32Attribs & PVRSRV_MEM_XPROC) != 0) ? IMG_TRUE : IMG_FALSE; - ui32ShareIndex = 7654321; + ui32ShareIndex = 7654321; if (bUseShareMemWorkaround) { - - + + psAllocDeviceMemOUT->eError = BM_XProcWorkaroundFindNewBufferAndSetShareIndex(&ui32ShareIndex); @@ -536,7 +536,7 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID, } } - + if(psAllocDeviceMemIN->pvPrivData) { if(!OSAccessOK(PVR_VERIFY_READ, @@ -598,7 +598,7 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID, psAllocDeviceMemOUT->sClientMemInfo.ui32Flags = psMemInfo->ui32Flags; psAllocDeviceMemOUT->sClientMemInfo.uAllocSize = psMemInfo->uAllocSize; #if defined (SUPPORT_SID_INTERFACE) - + #else psAllocDeviceMemOUT->sClientMemInfo.hMappingInfo = psMemInfo->sMemBlk.hOSMemHandle; #endif @@ -629,7 +629,7 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID, if(psAllocDeviceMemIN->ui32Attribs & PVRSRV_MEM_NO_SYNCOBJ) { - + OSMemSet(&psAllocDeviceMemOUT->sClientSyncInfo, 0, sizeof (PVRSRV_CLIENT_SYNC_INFO)); @@ -637,7 +637,7 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID, } else { - + #if !defined(PVRSRV_DISABLE_UM_SYNCOBJ_MAPPINGS) psAllocDeviceMemOUT->sClientSyncInfo.psSyncData = @@ -685,7 +685,7 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID, return 0; } -#endif +#endif static IMG_INT PVRSRVFreeDeviceMemBW(IMG_UINT32 ui32BridgeID, @@ -760,7 +760,7 @@ PVRSRVExportDeviceMemBW(IMG_UINT32 ui32BridgeID, ui32BridgeID == PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_EXPORT_DEVICEMEM_2)); PVR_UNREFERENCED_PARAMETER(ui32BridgeID); - + psExportDeviceMemOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &hDevCookieInt, @@ -773,7 +773,7 @@ PVRSRVExportDeviceMemBW(IMG_UINT32 ui32BridgeID, return 0; } - + psExportDeviceMemOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase, (IMG_PVOID *)&psKernelMemInfo, @@ -790,7 +790,7 @@ PVRSRVExportDeviceMemBW(IMG_UINT32 ui32BridgeID, return 0; } - + psExportDeviceMemOUT->eError = PVRSRVFindHandle(KERNEL_HANDLE_BASE, &psExportDeviceMemOUT->hMemInfo, @@ -798,12 +798,12 @@ PVRSRVExportDeviceMemBW(IMG_UINT32 ui32BridgeID, PVRSRV_HANDLE_TYPE_MEM_INFO); if(psExportDeviceMemOUT->eError == PVRSRV_OK) { - + PVR_DPF((PVR_DBG_MESSAGE, "PVRSRVExportDeviceMemBW: allocation is already exported")); return 0; } - + psExportDeviceMemOUT->eError = PVRSRVAllocHandle(KERNEL_HANDLE_BASE, &psExportDeviceMemOUT->hMemInfo, psKernelMemInfo, @@ -815,7 +815,7 @@ PVRSRVExportDeviceMemBW(IMG_UINT32 ui32BridgeID, return 0; } - + psKernelMemInfo->ui32Flags |= PVRSRV_MEM_EXPORTED; return 0; @@ -838,7 +838,7 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID, NEW_HANDLE_BATCH_OR_ERROR(psMapDevMemOUT->eError, psPerProc, 2) - + psMapDevMemOUT->eError = PVRSRVLookupHandle(KERNEL_HANDLE_BASE, (IMG_VOID**)&psSrcKernelMemInfo, psMapDevMemIN->hKernelMemInfo, @@ -848,7 +848,7 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID, return 0; } - + psMapDevMemOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &hDstDevMemHeap, psMapDevMemIN->hDstDevMemHeap, @@ -858,7 +858,7 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID, return 0; } - + if (psSrcKernelMemInfo->sShareMemWorkaround.bInUse) { PVR_DPF((PVR_DBG_MESSAGE, "using the mem wrap workaround.")); @@ -884,7 +884,7 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID, 0, &psDstKernelMemInfo, "" ); - + BM_XProcWorkaroundUnsetShareIndex(psSrcKernelMemInfo->sShareMemWorkaround.ui32ShareIndex); if(psMapDevMemOUT->eError != PVRSRV_OK) @@ -902,7 +902,7 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID, } else { - + psMapDevMemOUT->eError = PVRSRVMapDeviceMemoryKM(psPerProc, psSrcKernelMemInfo, hDstDevMemHeap, @@ -913,7 +913,7 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID, } } - + psDstKernelMemInfo->sShareMemWorkaround = psSrcKernelMemInfo->sShareMemWorkaround; OSMemSet(&psMapDevMemOUT->sDstClientMemInfo, @@ -931,12 +931,12 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID, psMapDevMemOUT->sDstClientMemInfo.ui32Flags = psDstKernelMemInfo->ui32Flags; psMapDevMemOUT->sDstClientMemInfo.uAllocSize = psDstKernelMemInfo->uAllocSize; #if defined (SUPPORT_SID_INTERFACE) - + #else psMapDevMemOUT->sDstClientMemInfo.hMappingInfo = psDstKernelMemInfo->sMemBlk.hOSMemHandle; #endif - + PVRSRVAllocHandleNR(psPerProc->psHandleBase, &psMapDevMemOUT->sDstClientMemInfo.hKernelMemInfo, psDstKernelMemInfo, @@ -945,7 +945,7 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID, psMapDevMemOUT->sDstClientSyncInfo.hKernelSyncInfo = IMG_NULL; #if defined (SUPPORT_SID_INTERFACE) - + if (psDstKernelMemInfo->sMemBlk.hOSMemHandle != IMG_NULL) { PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, @@ -961,7 +961,7 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID, } #endif - + if(psDstKernelMemInfo->psKernelSyncInfo) { #if !defined(PVRSRV_DISABLE_UM_SYNCOBJ_MAPPINGS) @@ -975,7 +975,7 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID, psDstKernelMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr; #if defined (SUPPORT_SID_INTERFACE) - + if (psDstKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle != IMG_NULL) { PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, @@ -996,7 +996,7 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID, #endif psMapDevMemOUT->sDstClientMemInfo.psClientSyncInfo = &psMapDevMemOUT->sDstClientSyncInfo; - + PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, &psMapDevMemOUT->sDstClientSyncInfo.hKernelSyncInfo, psDstKernelMemInfo->psKernelSyncInfo, @@ -1081,7 +1081,7 @@ PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID, NEW_HANDLE_BATCH_OR_ERROR(psMapDevClassMemOUT->eError, psPerProc, 2) - + psMapDevClassMemOUT->eError = PVRSRVLookupHandleAnyType(psPerProc->psHandleBase, &hDeviceClassBufferInt, @@ -1093,7 +1093,7 @@ PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID, return 0; } - + psMapDevClassMemOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &hDevMemContextInt, @@ -1105,7 +1105,7 @@ PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID, return 0; } - + switch(eHandleType) { #if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE) @@ -1172,7 +1172,7 @@ PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID, psMapDevClassMemOUT->sClientSyncInfo.hKernelSyncInfo = IMG_NULL; - + if(psMemInfo->psKernelSyncInfo) { #if !defined(PVRSRV_DISABLE_UM_SYNCOBJ_MAPPINGS) @@ -1206,7 +1206,7 @@ PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID, #endif psMapDevClassMemOUT->sClientMemInfo.psClientSyncInfo = &psMapDevClassMemOUT->sClientSyncInfo; - + PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, &psMapDevClassMemOUT->sClientSyncInfo.hKernelSyncInfo, psMemInfo->psKernelSyncInfo, @@ -1269,7 +1269,7 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_WRAP_EXT_MEMORY *psWrapExtMemIN, PVRSRV_BRIDGE_OUT_WRAP_EXT_MEMORY *psWrapExtMemOUT, PVRSRV_PER_PROCESS_DATA *psPerProc); -#else +#else static IMG_INT PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_WRAP_EXT_MEMORY *psWrapExtMemIN, @@ -1286,7 +1286,7 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID, NEW_HANDLE_BATCH_OR_ERROR(psWrapExtMemOUT->eError, psPerProc, 2) - + psWrapExtMemOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &hDevCookieInt, psWrapExtMemIN->hDevCookie, @@ -1296,7 +1296,7 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID, return 0; } - + psWrapExtMemOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &hDevMemContextInt, psWrapExtMemIN->hDevMemContext, @@ -1325,7 +1325,7 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID, ui32PageTableSize) != PVRSRV_OK) { OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, ui32PageTableSize, (IMG_VOID *)psSysPAddr, 0); - + return -EFAULT; } } @@ -1347,7 +1347,7 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID, OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, ui32PageTableSize, (IMG_VOID *)psSysPAddr, 0); - + } if(psWrapExtMemOUT->eError != PVRSRV_OK) @@ -1358,7 +1358,7 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID, psWrapExtMemOUT->sClientMemInfo.pvLinAddrKM = psMemInfo->pvLinAddrKM; - + psWrapExtMemOUT->sClientMemInfo.pvLinAddr = 0; psWrapExtMemOUT->sClientMemInfo.sDevVAddr = psMemInfo->sDevVAddr; psWrapExtMemOUT->sClientMemInfo.ui32Flags = psMemInfo->ui32Flags; @@ -1375,7 +1375,7 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID, PVRSRV_HANDLE_ALLOC_FLAG_NONE); #if defined (SUPPORT_SID_INTERFACE) - + if (psMemInfo->sMemBlk.hOSMemHandle != IMG_NULL) { PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, @@ -1391,7 +1391,7 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID, } #endif - + #if !defined(PVRSRV_DISABLE_UM_SYNCOBJ_MAPPINGS) psWrapExtMemOUT->sClientSyncInfo.psSyncData = psMemInfo->psKernelSyncInfo->psSyncData; @@ -1403,7 +1403,7 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID, psMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr; #if defined (SUPPORT_SID_INTERFACE) - + if (psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle != IMG_NULL) { PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, @@ -1436,7 +1436,7 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID, return 0; } -#endif +#endif static IMG_INT PVRSRVUnwrapExtMemoryBW(IMG_UINT32 ui32BridgeID, @@ -1956,7 +1956,7 @@ PDumpSyncPolBW(IMG_UINT32 ui32BridgeID, ui32Offset = offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete); } - + if (psPDumpSyncPolIN->bUseLastOpDumpVal) { if(psPDumpSyncPolIN->bIsRead) @@ -2075,7 +2075,7 @@ PDumpStopInitPhaseBW(IMG_UINT32 ui32BridgeID, return 0; } -#endif +#endif static IMG_INT @@ -2113,7 +2113,7 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID, ((psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_DDKVERSION_PRESENT) != 0) && ((psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_FREEMEM_PRESENT) != 0)) { - + psGetMiscInfoOUT->eError = PVRSRV_ERROR_INVALID_PARAMS; return 0; } @@ -2122,7 +2122,7 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID, ((psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_DDKVERSION_PRESENT) != 0) || ((psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_FREEMEM_PRESENT) != 0)) { - + #if defined (SUPPORT_SID_INTERFACE) ASSIGN_AND_EXIT_ON_ERROR(psGetMiscInfoOUT->eError, OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, @@ -2131,7 +2131,7 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID, "Output string buffer")); psGetMiscInfoOUT->eError = PVRSRVGetMiscInfoKM(&sMiscInfo); - + eError = CopyToUserWrapper(psPerProc, ui32BridgeID, psGetMiscInfoIN->sMiscInfo.pszMemoryStr, sMiscInfo.pszMemoryStr, @@ -2145,14 +2145,14 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID, psGetMiscInfoOUT->eError = PVRSRVGetMiscInfoKM(&psGetMiscInfoOUT->sMiscInfo); - + eError = CopyToUserWrapper(psPerProc, ui32BridgeID, psGetMiscInfoIN->sMiscInfo.pszMemoryStr, psGetMiscInfoOUT->sMiscInfo.pszMemoryStr, psGetMiscInfoOUT->sMiscInfo.ui32MemoryStrLen); #endif - + #if defined (SUPPORT_SID_INTERFACE) OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sMiscInfo.ui32MemoryStrLen, @@ -2163,12 +2163,12 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID, (IMG_VOID *)psGetMiscInfoOUT->sMiscInfo.pszMemoryStr, 0); #endif - + psGetMiscInfoOUT->sMiscInfo.pszMemoryStr = psGetMiscInfoIN->sMiscInfo.pszMemoryStr; if(eError != PVRSRV_OK) { - + PVR_DPF((PVR_DBG_ERROR, "PVRSRVGetMiscInfoBW Error copy to user")); return -EFAULT; } @@ -2182,13 +2182,13 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID, #endif } - + if (psGetMiscInfoOUT->eError != PVRSRV_OK) { return 0; } - + #if defined (SUPPORT_SID_INTERFACE) if (sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_GLOBALEVENTOBJECT_PRESENT) #else @@ -2223,7 +2223,7 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID, if (psGetMiscInfoOUT->sMiscInfo.hSOCTimerRegisterOSMemHandle) #endif { - + psGetMiscInfoOUT->eError = PVRSRVAllocHandle(psPerProc->psHandleBase, &psGetMiscInfoOUT->sMiscInfo.hSOCTimerRegisterOSMemHandle, #if defined (SUPPORT_SID_INTERFACE) @@ -2245,7 +2245,7 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID, psGetMiscInfoOUT->sMiscInfo.hSOCTimerRegisterOSMemHandle = 0; } - + psGetMiscInfoOUT->sMiscInfo.ui32StateRequest = sMiscInfo.ui32StateRequest; psGetMiscInfoOUT->sMiscInfo.ui32StatePresent = sMiscInfo.ui32StatePresent; @@ -2278,19 +2278,19 @@ PVRSRVConnectBW(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_CONNECT_SERVICES); #if defined(PDUMP) - + if ((psConnectServicesIN->ui32Flags & SRV_FLAGS_PERSIST) != 0) { psPerProc->bPDumpPersistent = IMG_TRUE; } #if defined(SUPPORT_PDUMP_MULTI_PROCESS) - + if ((psConnectServicesIN->ui32Flags & SRV_FLAGS_PDUMP_ACTIVE) != 0) { psPerProc->bPDumpActive = IMG_TRUE; } -#endif +#endif #else PVR_UNREFERENCED_PARAMETER(psConnectServicesIN); #endif @@ -2311,7 +2311,7 @@ PVRSRVDisconnectBW(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_DISCONNECT_SERVICES); - + psRetOUT->eError = PVRSRV_OK; return 0; @@ -2474,7 +2474,7 @@ PVRSRVEnumDCDimsBW(IMG_UINT32 ui32BridgeID, #if defined(SUPPORT_PVRSRV_GET_DC_SYSTEM_BUFFER) static IMG_INT PVRSRVGetDCSystemBufferBW(IMG_UINT32 ui32BridgeID, - PVRSRV_BRIDGE_IN_GET_DISPCLASS_SYSBUFFER *psGetDispClassSysBufferIN, + PVRSRV_BRIDGE_IN_GET_DISPCLASS_SYSBUFFER *psGetDispClassSysBufferIN, PVRSRV_BRIDGE_OUT_GET_DISPCLASS_SYSBUFFER *psGetDispClassSysBufferOUT, PVRSRV_PER_PROCESS_DATA *psPerProc) { @@ -2504,7 +2504,7 @@ PVRSRVGetDCSystemBufferBW(IMG_UINT32 ui32BridgeID, return 0; } - + PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, &psGetDispClassSysBufferOUT->hBuffer, hBufferInt, @@ -2570,7 +2570,7 @@ PVRSRVCreateDCSwapChainBW(IMG_UINT32 ui32BridgeID, return 0; } - + ui32SwapChainID = psCreateDispClassSwapChainIN->ui32SwapChainID; psCreateDispClassSwapChainOUT->eError = @@ -2588,7 +2588,7 @@ PVRSRVCreateDCSwapChainBW(IMG_UINT32 ui32BridgeID, return 0; } - + psCreateDispClassSwapChainOUT->ui32SwapChainID = ui32SwapChainID; PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, @@ -2869,7 +2869,7 @@ PVRSRVGetDCBuffersBW(IMG_UINT32 ui32BridgeID, IMG_HANDLE hBufferExt; #endif - + #if defined (SUPPORT_SID_INTERFACE) PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, &hBufferExt, @@ -3305,7 +3305,7 @@ PVRSRVGetBCBufferBW(IMG_UINT32 ui32BridgeID, return 0; } - + PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, &psGetBufferClassBufferOUT->hBuffer, hBufferInt, @@ -3475,7 +3475,7 @@ PVRSRVMapMemInfoMemBW(IMG_UINT32 ui32BridgeID, return 0; } - + psMapMemInfoMemOUT->eError = PVRSRVGetParentHandle(psPerProc->psHandleBase, &hParent, @@ -3535,14 +3535,14 @@ PVRSRVMapMemInfoMemBW(IMG_UINT32 ui32BridgeID, if(psKernelMemInfo->ui32Flags & PVRSRV_MEM_NO_SYNCOBJ) { - + OSMemSet(&psMapMemInfoMemOUT->sClientSyncInfo, 0, sizeof (PVRSRV_CLIENT_SYNC_INFO)); } else { - + #if !defined(PVRSRV_DISABLE_UM_SYNCOBJ_MAPPINGS) psMapMemInfoMemOUT->sClientSyncInfo.psSyncData = psKernelMemInfo->psKernelSyncInfo->psSyncData; @@ -3624,7 +3624,7 @@ _SetDispatchTableEntry(IMG_UINT32 ui32Index, BridgeWrapperFunction pfFunction, const IMG_CHAR *pszFunctionName) { - static IMG_UINT32 ui32PrevIndex = ~0UL; + static IMG_UINT32 ui32PrevIndex = ~0UL; #if !defined(DEBUG) PVR_UNREFERENCED_PARAMETER(pszIOCName); #endif @@ -3633,11 +3633,11 @@ _SetDispatchTableEntry(IMG_UINT32 ui32Index, #endif #if defined(DEBUG_BRIDGE_KM_DISPATCH_TABLE) - + PVR_DPF((PVR_DBG_WARNING, "%s: %d %s %s", __FUNCTION__, ui32Index, pszIOCName, pszFunctionName)); #endif - + if (ui32Index >= BRIDGE_DISPATCH_TABLE_ENTRY_COUNT) { PVR_DPF((PVR_DBG_ERROR, "Invalid parameters.")); return; @@ -3656,7 +3656,7 @@ _SetDispatchTableEntry(IMG_UINT32 ui32Index, PVR_DPF((PVR_DBG_ERROR, "NOTE: Enabling DEBUG_BRIDGE_KM_DISPATCH_TABLE may help debug this issue.")); } - + if((ui32PrevIndex != ~0UL) && ((ui32Index >= ui32PrevIndex + DISPATCH_TABLE_GAP_THRESHOLD) || (ui32Index <= ui32PrevIndex))) @@ -3696,7 +3696,7 @@ PVRSRVInitSrvConnectBW(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_INITSRV_CONNECT); PVR_UNREFERENCED_PARAMETER(psBridgeIn); - + if((OSProcHasPrivSrvInit() == IMG_FALSE) || PVRSRVGetInitServerState(PVRSRV_INIT_SERVER_RUNNING) || PVRSRVGetInitServerState(PVRSRV_INIT_SERVER_RAN)) { psRetOUT->eError = PVRSRV_ERROR_SRV_CONNECT_FAILED; @@ -3879,7 +3879,7 @@ PVRSRVEventObjectCloseBW(IMG_UINT32 ui32BridgeID, &psEventObjectCloseIN->sEventObject.szName, EVENTOBJNAME_MAXLENGTH) != PVRSRV_OK) { - + return -EFAULT; } @@ -3912,13 +3912,13 @@ static PVRSRV_ERROR DoQuerySyncOpsSatisfied(PVRSRV_KERNEL_SYNC_INFO *psKernelSyn IMG_UINT32 ui32ReadOpsPending; IMG_UINT32 ui32ReadOps2Pending; - + if (!psKernelSyncInfo) { return PVRSRV_ERROR_INVALID_PARAMS; } - + @@ -3940,7 +3940,7 @@ static PVRSRV_ERROR DoQuerySyncOpsSatisfied(PVRSRV_KERNEL_SYNC_INFO *psKernelSyn ui32ReadOps2Pending - psKernelSyncInfo->psSyncData->ui32ReadOps2Complete)) { #if defined(PDUMP) && !defined(SUPPORT_VGX) - + PDumpComment("Poll for read ops complete to reach value (pdump: %u, actual snapshot: %u)", psKernelSyncInfo->psSyncData->ui32LastReadOpDumpVal, ui32ReadOpsPendingSnapShot); @@ -3948,11 +3948,11 @@ static PVRSRV_ERROR DoQuerySyncOpsSatisfied(PVRSRV_KERNEL_SYNC_INFO *psKernelSyn offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), psKernelSyncInfo->psSyncData->ui32LastReadOpDumpVal, 0xFFFFFFFF, - PDUMP_POLL_OPERATOR_EQUAL, + PDUMP_POLL_OPERATOR_EQUAL, 0, MAKEUNIQUETAG(psKernelSyncInfo->psSyncDataMemInfoKM)); - + PDumpComment("Poll for write ops complete to reach value (pdump: %u, actual snapshot: %u)", psKernelSyncInfo->psSyncData->ui32LastOpDumpVal, ui32WriteOpsPendingSnapShot); @@ -3960,10 +3960,10 @@ static PVRSRV_ERROR DoQuerySyncOpsSatisfied(PVRSRV_KERNEL_SYNC_INFO *psKernelSyn offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), psKernelSyncInfo->psSyncData->ui32LastOpDumpVal, 0xFFFFFFFF, - PDUMP_POLL_OPERATOR_EQUAL, + PDUMP_POLL_OPERATOR_EQUAL, 0, MAKEUNIQUETAG(psKernelSyncInfo->psSyncDataMemInfoKM)); - + #endif return PVRSRV_OK; @@ -3986,20 +3986,20 @@ static PVRSRV_ERROR DoModifyCompleteSyncOps(MODIFY_SYNC_OP_INFO *psModSyncOpInfo return PVRSRV_ERROR_INVALID_PARAMS; } - + if((psModSyncOpInfo->ui32WriteOpsPendingSnapShot != psKernelSyncInfo->psSyncData->ui32WriteOpsComplete) || (psModSyncOpInfo->ui32ReadOpsPendingSnapShot != psKernelSyncInfo->psSyncData->ui32ReadOpsComplete)) { return PVRSRV_ERROR_BAD_SYNC_STATE; } - + if(psModSyncOpInfo->ui32ModifyFlags & PVRSRV_MODIFYSYNCOPS_FLAGS_WO_INC) { psKernelSyncInfo->psSyncData->ui32WriteOpsComplete++; } - + if(psModSyncOpInfo->ui32ModifyFlags & PVRSRV_MODIFYSYNCOPS_FLAGS_RO_INC) { psKernelSyncInfo->psSyncData->ui32ReadOpsComplete++; @@ -4028,7 +4028,7 @@ static PVRSRV_ERROR ModifyCompleteSyncOpsCallBack(IMG_PVOID pvParam, if (psModSyncOpInfo->psKernelSyncInfo) { - + LOOP_UNTIL_TIMEOUT(MAX_HW_TIME_US) { if (DoQuerySyncOpsSatisfied(psModSyncOpInfo->psKernelSyncInfo, @@ -4056,12 +4056,13 @@ static PVRSRV_ERROR ModifyCompleteSyncOpsCallBack(IMG_PVOID pvParam, OpFlushedComplete: DoModifyCompleteSyncOps(psModSyncOpInfo); + PVRSRVKernelSyncInfoDecRef(psModSyncOpInfo->psKernelSyncInfo, IMG_NULL); } OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(MODIFY_SYNC_OP_INFO), (IMG_VOID *)psModSyncOpInfo, 0); + - - + PVRSRVScheduleDeviceCallbacks(); return PVRSRV_OK; @@ -4088,7 +4089,7 @@ PVRSRVCreateSyncInfoModObjBW(IMG_UINT32 (IMG_VOID **)&psModSyncOpInfo, 0, "ModSyncOpInfo (MODIFY_SYNC_OP_INFO)")); - psModSyncOpInfo->psKernelSyncInfo = IMG_NULL; + psModSyncOpInfo->psKernelSyncInfo = IMG_NULL; psCreateSyncInfoModObjOUT->eError = PVRSRVAllocHandle(psPerProc->psHandleBase, &psCreateSyncInfoModObjOUT->hKernelSyncInfoModObj, @@ -4135,11 +4136,13 @@ PVRSRVDestroySyncInfoModObjBW(IMG_UINT32 if(psModSyncOpInfo->psKernelSyncInfo != IMG_NULL) { - + psDestroySyncInfoModObjOUT->eError = PVRSRV_ERROR_INVALID_PARAMS; return 0; } + PVRSRVKernelSyncInfoDecRef(psModSyncOpInfo->psKernelSyncInfo, IMG_NULL); + psDestroySyncInfoModObjOUT->eError = PVRSRVReleaseHandle(psPerProc->psHandleBase, psDestroySyncInfoModObjIN->hKernelSyncInfoModObj, PVRSRV_HANDLE_TYPE_SYNC_INFO_MOD_OBJ); @@ -4194,20 +4197,29 @@ PVRSRVModifyPendingSyncOpsBW(IMG_UINT32 ui32BridgeID, if(psModSyncOpInfo->psKernelSyncInfo) { - + psModifySyncOpsOUT->eError = PVRSRV_ERROR_RETRY; PVR_DPF((PVR_DBG_VERBOSE, "PVRSRVModifyPendingSyncOpsBW: SyncInfo Modification object is not empty")); return 0; } + + if (psKernelSyncInfo == IMG_NULL) + { + psModifySyncOpsOUT->eError = PVRSRV_ERROR_INVALID_PARAMS; + PVR_DPF((PVR_DBG_VERBOSE, "PVRSRVModifyPendingSyncOpsBW: SyncInfo bad handle")); + return 0; + } + PVRSRVKernelSyncInfoIncRef(psKernelSyncInfo, IMG_NULL); + psModSyncOpInfo->psKernelSyncInfo = psKernelSyncInfo; psModSyncOpInfo->ui32ModifyFlags = psModifySyncOpsIN->ui32ModifyFlags; psModSyncOpInfo->ui32ReadOpsPendingSnapShot = psKernelSyncInfo->psSyncData->ui32ReadOpsPending; psModSyncOpInfo->ui32WriteOpsPendingSnapShot = psKernelSyncInfo->psSyncData->ui32WriteOpsPending; psModSyncOpInfo->ui32ReadOps2PendingSnapShot = psKernelSyncInfo->psSyncData->ui32ReadOps2Pending; - + psModifySyncOpsOUT->ui32ReadOpsPending = psKernelSyncInfo->psSyncData->ui32ReadOpsPending; psModifySyncOpsOUT->ui32WriteOpsPending = psKernelSyncInfo->psSyncData->ui32WriteOpsPending; @@ -4223,7 +4235,7 @@ PVRSRVModifyPendingSyncOpsBW(IMG_UINT32 ui32BridgeID, psKernelSyncInfo->psSyncData->ui32ReadOpsPending++; } - + psModifySyncOpsOUT->eError = ResManDissociateRes(psModSyncOpInfo->hResItem, psPerProc->hResManContext); @@ -4259,7 +4271,7 @@ PVRSRVModifyCompleteSyncOpsBW(IMG_UINT32 ui32BridgeID, if(psModSyncOpInfo->psKernelSyncInfo == IMG_NULL) { - + psModifySyncOpsOUT->eError = PVRSRV_ERROR_INVALID_PARAMS; return 0; } @@ -4272,9 +4284,10 @@ PVRSRVModifyCompleteSyncOpsBW(IMG_UINT32 ui32BridgeID, return 0; } + PVRSRVKernelSyncInfoDecRef(psModSyncOpInfo->psKernelSyncInfo, IMG_NULL); psModSyncOpInfo->psKernelSyncInfo = IMG_NULL; - + PVRSRVScheduleDeviceCallbacks(); return 0; @@ -4301,7 +4314,7 @@ PVRSRVSyncOpsTakeTokenBW(IMG_UINT32 ui32BridgeID, return 0; } - + psSyncOpsTakeTokenOUT->ui32ReadOpsPending = psKernelSyncInfo->psSyncData->ui32ReadOpsPending; psSyncOpsTakeTokenOUT->ui32WriteOpsPending = psKernelSyncInfo->psSyncData->ui32WriteOpsPending; @@ -4375,7 +4388,7 @@ PVRSRVSyncOpsFlushToModObjBW(IMG_UINT32 if(psModSyncOpInfo->psKernelSyncInfo == IMG_NULL) { - + psSyncOpsFlushToModObjOUT->eError = PVRSRV_ERROR_INVALID_PARAMS; return 0; } @@ -4417,14 +4430,14 @@ PVRSRVSyncOpsFlushToDeltaBW(IMG_UINT32 u return 0; } - + ui32DeltaRead = psSyncInfo->psSyncData->ui32ReadOpsPending - psSyncInfo->psSyncData->ui32ReadOpsComplete; ui32DeltaWrite = psSyncInfo->psSyncData->ui32WriteOpsPending - psSyncInfo->psSyncData->ui32WriteOpsComplete; if (ui32DeltaRead <= psSyncOpsFlushToDeltaIN->ui32Delta && ui32DeltaWrite <= psSyncOpsFlushToDeltaIN->ui32Delta) { #if defined(PDUMP) && !defined(SUPPORT_VGX) - + PDumpComment("Poll for read ops complete to delta (%u)", psSyncOpsFlushToDeltaIN->ui32Delta); psSyncOpsFlushToDeltaOUT->eError = @@ -4436,7 +4449,7 @@ PVRSRVSyncOpsFlushToDeltaBW(IMG_UINT32 u 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); - + PDumpComment("Poll for write ops complete to delta (%u)", psSyncOpsFlushToDeltaIN->ui32Delta); psSyncOpsFlushToDeltaOUT->eError = @@ -4466,18 +4479,13 @@ FreeSyncInfoCallback(IMG_PVOID pvParam, IMG_BOOL bDummy) { PVRSRV_KERNEL_SYNC_INFO *psSyncInfo; - PVRSRV_ERROR eError; PVR_UNREFERENCED_PARAMETER(ui32Param); PVR_UNREFERENCED_PARAMETER(bDummy); psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)pvParam; - eError = PVRSRVFreeSyncInfoKM(psSyncInfo); - if (eError != PVRSRV_OK) - { - return eError; - } + PVRSRVKernelSyncInfoDecRef(psSyncInfo, IMG_NULL); return PVRSRV_OK; } @@ -4535,16 +4543,16 @@ PVRSRVAllocSyncInfoBW(IMG_UINT32 ui32Bri 0, FreeSyncInfoCallback); - + goto allocsyncinfo_commit; - + allocsyncinfo_errorexit_freesyncinfo: - PVRSRVFreeSyncInfoKM(psSyncInfo); + PVRSRVKernelSyncInfoDecRef(psSyncInfo, IMG_NULL); allocsyncinfo_errorexit: - + allocsyncinfo_commit: psAllocSyncInfoOUT->eError = eError; COMMIT_HANDLE_BATCH_OR_ERROR(eError, psPerProc); @@ -4635,30 +4643,30 @@ CommonBridgeInit(IMG_VOID) SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_DEV_MEMORY_2, PVRSRVMapDeviceMemoryBW); SetDispatchTableEntry(PVRSRV_BRIDGE_EXPORT_DEVICEMEM_2, PVRSRVExportDeviceMemBW); - + SetDispatchTableEntry(PVRSRV_BRIDGE_PROCESS_SIMISR_EVENT, DummyBW); SetDispatchTableEntry(PVRSRV_BRIDGE_REGISTER_SIM_PROCESS, DummyBW); SetDispatchTableEntry(PVRSRV_BRIDGE_UNREGISTER_SIM_PROCESS, DummyBW); - + SetDispatchTableEntry(PVRSRV_BRIDGE_MAPPHYSTOUSERSPACE, DummyBW); SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAPPHYSTOUSERSPACE, DummyBW); SetDispatchTableEntry(PVRSRV_BRIDGE_GETPHYSTOUSERSPACEMAP, DummyBW); SetDispatchTableEntry(PVRSRV_BRIDGE_GET_FB_STATS, DummyBW); - + SetDispatchTableEntry(PVRSRV_BRIDGE_GET_MISC_INFO, PVRSRVGetMiscInfoBW); SetDispatchTableEntry(PVRSRV_BRIDGE_RELEASE_MISC_INFO, DummyBW); - + #if defined (SUPPORT_OVERLAY_ROTATE_BLIT) SetDispatchTableEntry(PVRSRV_BRIDGE_INIT_3D_OVL_BLT_RES, DummyBW); SetDispatchTableEntry(PVRSRV_BRIDGE_DEINIT_3D_OVL_BLT_RES, DummyBW); #endif - + #if defined(PDUMP) SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_INIT, DummyBW); SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_MEMPOL, PDumpMemPolBW); @@ -4678,15 +4686,15 @@ CommonBridgeInit(IMG_VOID) SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_CYCLE_COUNT_REG_READ, PDumpCycleCountRegReadBW); SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_STARTINITPHASE, PDumpStartInitPhaseBW); SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_STOPINITPHASE, PDumpStopInitPhaseBW); -#endif - +#endif + SetDispatchTableEntry(PVRSRV_BRIDGE_GET_OEMJTABLE, DummyBW); - + SetDispatchTableEntry(PVRSRV_BRIDGE_ENUM_CLASS, PVRSRVEnumerateDCBW); - + SetDispatchTableEntry(PVRSRV_BRIDGE_OPEN_DISPCLASS_DEVICE, PVRSRVOpenDCDeviceBW); SetDispatchTableEntry(PVRSRV_BRIDGE_CLOSE_DISPCLASS_DEVICE, PVRSRVCloseDCDeviceBW); SetDispatchTableEntry(PVRSRV_BRIDGE_ENUM_DISPCLASS_FORMATS, PVRSRVEnumDCFormatsBW); @@ -4708,26 +4716,26 @@ CommonBridgeInit(IMG_VOID) SetDispatchTableEntry(PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_BUFFER2, PVRSRVSwapToDCBuffer2BW); SetDispatchTableEntry(PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_SYSTEM, PVRSRVSwapToDCSystemBW); SetDispatchTableEntry(PVRSRV_BRIDGE_GET_DISPCLASS_FRONT_BUFFER, PVRSRVGetDCFrontBufferBW); - + SetDispatchTableEntry(PVRSRV_BRIDGE_OPEN_BUFFERCLASS_DEVICE, PVRSRVOpenBCDeviceBW); SetDispatchTableEntry(PVRSRV_BRIDGE_CLOSE_BUFFERCLASS_DEVICE, PVRSRVCloseBCDeviceBW); SetDispatchTableEntry(PVRSRV_BRIDGE_GET_BUFFERCLASS_INFO, PVRSRVGetBCInfoBW); SetDispatchTableEntry(PVRSRV_BRIDGE_GET_BUFFERCLASS_BUFFER, PVRSRVGetBCBufferBW); - + SetDispatchTableEntry(PVRSRV_BRIDGE_WRAP_EXT_MEMORY, PVRSRVWrapExtMemoryBW); SetDispatchTableEntry(PVRSRV_BRIDGE_UNWRAP_EXT_MEMORY, PVRSRVUnwrapExtMemoryBW); - + SetDispatchTableEntry(PVRSRV_BRIDGE_ALLOC_SHARED_SYS_MEM, PVRSRVAllocSharedSysMemoryBW); SetDispatchTableEntry(PVRSRV_BRIDGE_FREE_SHARED_SYS_MEM, PVRSRVFreeSharedSysMemoryBW); SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_MEMINFO_MEM, PVRSRVMapMemInfoMemBW); - + SetDispatchTableEntry(PVRSRV_BRIDGE_INITSRV_CONNECT, &PVRSRVInitSrvConnectBW); SetDispatchTableEntry(PVRSRV_BRIDGE_INITSRV_DISCONNECT, &PVRSRVInitSrvDisconnectBW); - + SetDispatchTableEntry(PVRSRV_BRIDGE_EVENT_OBJECT_WAIT, &PVRSRVEventObjectWaitBW); SetDispatchTableEntry(PVRSRV_BRIDGE_EVENT_OBJECT_OPEN, &PVRSRVEventObjectOpenBW); SetDispatchTableEntry(PVRSRV_BRIDGE_EVENT_OBJECT_CLOSE, &PVRSRVEventObjectCloseBW); @@ -4753,8 +4761,8 @@ CommonBridgeInit(IMG_VOID) SetMSVDXDispatchTableEntry(); #endif - - + + for(i=0;ipvEnvSpecificData)->pvBridgeData; psBridgeOut = (IMG_PVOID)((IMG_PBYTE)psBridgeIn + PVRSRV_MAX_BRIDGE_IN_SIZE); - - if((psBridgePackageKM->ui32InBufferSize > PVRSRV_MAX_BRIDGE_IN_SIZE) || + + if((psBridgePackageKM->ui32InBufferSize > PVRSRV_MAX_BRIDGE_IN_SIZE) || (psBridgePackageKM->ui32OutBufferSize > PVRSRV_MAX_BRIDGE_OUT_SIZE)) { goto return_fault; } + if(psBridgePackageKM->ui32InBufferSize > 0) { if(!OSAccessOK(PVR_VERIFY_READ, @@ -4892,7 +4901,7 @@ IMG_INT BridgedDispatchKM(PVRSRV_PER_PROCESS_DATA * psPerProc, } #if defined(__linux__) - + if(CopyToUserWrapper(psPerProc, ui32BridgeID, psBridgePackageKM->pvParamOut, diff --git a/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_pvr_bridge.h b/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_pvr_bridge.h index 2ac8adf..6b0dd88 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_pvr_bridge.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_pvr_bridge.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -57,7 +57,7 @@ CopyFromUserWrapper(PVRSRV_PER_PROCESS_DATA *pProcData, IMG_VOID *pvSrc, IMG_UINT32 ui32Size); PVRSRV_ERROR -CopyToUserWrapper(PVRSRV_PER_PROCESS_DATA *pProcData, +CopyToUserWrapper(PVRSRV_PER_PROCESS_DATA *pProcData, IMG_UINT32 ui32BridgeID, IMG_VOID *pvDest, IMG_VOID *pvSrc, @@ -138,11 +138,11 @@ ReleaseHandleBatch(PVRSRV_PER_PROCESS_DATA *psPerProc) PVRSRVReleaseHandleBatch(psPerProc->psHandleBase); } } -#else +#else #define NEW_HANDLE_BATCH_OR_ERROR(error, psPerProc, ui32BatchSize) #define COMMIT_HANDLE_BATCH_OR_ERROR(error, psPerProc) #define ReleaseHandleBatch(psPerProc) -#endif +#endif IMG_INT DummyBW(IMG_UINT32 ui32BridgeID, @@ -157,13 +157,13 @@ typedef IMG_INT (*BridgeWrapperFunction)(IMG_UINT32 ui32BridgeID, typedef struct _PVRSRV_BRIDGE_DISPATCH_TABLE_ENTRY { - BridgeWrapperFunction pfFunction; + BridgeWrapperFunction pfFunction; #if defined(DEBUG_BRIDGE_KM) - const IMG_CHAR *pszIOCName; - const IMG_CHAR *pszFunctionName; - IMG_UINT32 ui32CallCount; - IMG_UINT32 ui32CopyFromUserTotalBytes; - IMG_UINT32 ui32CopyToUserTotalBytes; + const IMG_CHAR *pszIOCName; + const IMG_CHAR *pszFunctionName; + IMG_UINT32 ui32CallCount; + IMG_UINT32 ui32CopyFromUserTotalBytes; + IMG_UINT32 ui32CopyToUserTotalBytes; #endif }PVRSRV_BRIDGE_DISPATCH_TABLE_ENTRY; @@ -194,7 +194,7 @@ _SetDispatchTableEntry(IMG_UINT32 ui32Index, const IMG_CHAR *pszFunctionName); - + #define SetDispatchTableEntry(ui32Index, pfFunction) \ _SetDispatchTableEntry(PVRSRV_GET_BRIDGE_ID(ui32Index), #ui32Index, (BridgeWrapperFunction)pfFunction, #pfFunction) @@ -228,5 +228,5 @@ IMG_INT BridgedDispatchKM(PVRSRV_PER_PROCESS_DATA * psPerProc, } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_support.c b/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_support.c index 2ce279e..dad0800 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_support.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_support.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -40,7 +40,7 @@ PVRSRVLookupOSMemHandle(PVRSRV_HANDLE_BASE *psHandleBase, IMG_HANDLE *phOSMemHan PVRSRV_HANDLE_TYPE eHandleType; PVRSRV_ERROR eError; - + eError = PVRSRVLookupHandleAnyType(psHandleBase, &hMHandleInt, &eHandleType, hMHandle); @@ -66,7 +66,7 @@ PVRSRVLookupOSMemHandle(PVRSRV_HANDLE_BASE *psHandleBase, IMG_HANDLE *phOSMemHan { PVRSRV_KERNEL_SYNC_INFO *psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)hMHandleInt; PVRSRV_KERNEL_MEM_INFO *psMemInfo = psSyncInfo->psSyncDataMemInfoKM; - + *phOSMemHandle = psMemInfo->sMemBlk.hOSMemHandle; break; diff --git a/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_support.h b/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_support.h index 0f21a6f..d027290 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_support.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/bridged/bridged_support.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -43,5 +43,5 @@ PVRSRV_ERROR PVRSRVLookupOSMemHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phO } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/bridged/sgx/bridged_sgx_bridge.c b/drivers/staging/mrst/pvr/services4/srvkm/bridged/sgx/bridged_sgx_bridge.c index 8638838..4e4cf24 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/bridged/sgx/bridged_sgx_bridge.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/bridged/sgx/bridged_sgx_bridge.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -103,12 +103,12 @@ SGXReleaseClientInfoBW(IMG_UINT32 ui32BridgeID, PVR_ASSERT(psDevInfo->ui32ClientRefCount > 0); - + if (psDevInfo->ui32ClientRefCount > 0) { psDevInfo->ui32ClientRefCount--; } - + psRetOUT->eError = PVRSRV_OK; return 0; @@ -146,7 +146,7 @@ SGXGetInternalDevInfoBW(IMG_UINT32 ui32BridgeID, &psSGXGetInternalDevInfoOUT->sSGXInternalDevInfo); #endif - + psSGXGetInternalDevInfoOUT->eError = PVRSRVAllocHandle(psPerProc->psHandleBase, &psSGXGetInternalDevInfoOUT->sSGXInternalDevInfo.hHostCtlKernelMemInfoHandle, @@ -212,7 +212,7 @@ SGXDoKickBW(IMG_UINT32 ui32BridgeID, { return 0; } - + if(psDoKickIN->sCCBKick.hTA3DSyncInfo != 0) #else if(psDoKickIN->sCCBKick.hTA3DSyncInfo != IMG_NULL) @@ -257,7 +257,7 @@ SGXDoKickBW(IMG_UINT32 ui32BridgeID, } #if defined(FIX_HW_BRN_31620) - + psRetOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &psDoKickIN->sCCBKick.hDevMemContext, @@ -294,7 +294,7 @@ SGXDoKickBW(IMG_UINT32 ui32BridgeID, #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) - + if (psDoKickIN->sCCBKick.ui32NumTASrcSyncs > SGX_MAX_TA_SRC_SYNCS) { psRetOUT->eError = PVRSRV_ERROR_INVALID_PARAMS; @@ -376,8 +376,8 @@ SGXDoKickBW(IMG_UINT32 ui32BridgeID, } } #else - - if (psDoKickIN->sCCBKick.ui32NumSrcSyncs > SGX_MAX_SRC_SYNCS) + + if (psDoKickIN->sCCBKick.ui32NumSrcSyncs > SGX_MAX_SRC_SYNCS_TA) { psRetOUT->eError = PVRSRV_ERROR_INVALID_PARAMS; return 0; @@ -460,7 +460,7 @@ SGXDoKickBW(IMG_UINT32 ui32BridgeID, #endif psDoKickIN->sCCBKick.as3DStatusUpdate[i].hKernelMemInfo, PVRSRV_HANDLE_TYPE_MEM_INFO); - + #if defined (SUPPORT_SID_INTERFACE) sCCBKickKM.as3DStatusUpdate[i].sCtlStatus = psDoKickIN->sCCBKick.as3DStatusUpdate[i].sCtlStatus; #endif @@ -517,7 +517,7 @@ SGXDoKickBW(IMG_UINT32 ui32BridgeID, goto PVRSRV_BRIDGE_SGX_DOKICK_RETURN_RESULT; } - + psDoKickIN->sCCBKick.pahDstSyncHandles = phKernelSyncInfoHandles; #endif @@ -576,7 +576,7 @@ SGXDoKickBW(IMG_UINT32 ui32BridgeID, #if defined(NO_HARDWARE) sCCBKickKM.ui32WriteOpsPendingVal = psDoKickIN->sCCBKick.ui32WriteOpsPendingVal; #endif -#endif +#endif psRetOUT->eError = SGXDoKickKM(hDevCookieInt, #if defined (SUPPORT_SID_INTERFACE) @@ -593,7 +593,7 @@ PVRSRV_BRIDGE_SGX_DOKICK_RETURN_RESULT: ui32NumDstSyncs * sizeof(IMG_HANDLE), (IMG_VOID *)phKernelSyncInfoHandles, 0); - + } return ret; } @@ -646,7 +646,7 @@ SGXSubmitTransferBW(IMG_UINT32 ui32BridgeID, psKick = &psSubmitTransferIN->sKick; #if defined(FIX_HW_BRN_31620) - + psRetOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &psKick->hDevMemContext, @@ -814,7 +814,7 @@ SGXSetTransferContextPriorityBW(IMG_UINT32 ui32BridgeID, } psRetOUT->eError = SGXSetTransferContextPriorityKM( - hDevCookieInt, + hDevCookieInt, hTransferContextInt, psSGXSetTransferContextPriorityIN->ui32Priority, psSGXSetTransferContextPriorityIN->ui32OffsetOfPriorityField); @@ -856,7 +856,7 @@ SGXSetRenderContextPriorityBW(IMG_UINT32 ui32BridgeID, } psRetOUT->eError = SGXSetRenderContextPriorityKM( - hDevCookieInt, + hDevCookieInt, hRenderContextInt, psSGXSetRenderContextPriorityIN->ui32Priority, psSGXSetRenderContextPriorityIN->ui32OffsetOfPriorityField); @@ -885,7 +885,7 @@ SGXSubmit2DBW(IMG_UINT32 ui32BridgeID, psKick = &psSubmit2DIN->sKick; #if defined(FIX_HW_BRN_31620) - + psRetOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &psKick->hDevMemContext, @@ -1037,7 +1037,7 @@ SGXSubmit2DBW(IMG_UINT32 ui32BridgeID, sKickKM.hDstSyncInfo = IMG_NULL; } - + sKickKM.ui32SharedCmdCCBOffset = psKick->ui32SharedCmdCCBOffset; sKickKM.ui32NumSrcSync = psKick->ui32NumSrcSync; sKickKM.ui32PDumpFlags = psKick->ui32PDumpFlags; @@ -1056,8 +1056,8 @@ SGXSubmit2DBW(IMG_UINT32 ui32BridgeID, return 0; } -#endif -#endif +#endif +#endif static IMG_INT @@ -1086,7 +1086,7 @@ SGXGetMiscInfoBW(IMG_UINT32 ui32BridgeID, } #if defined(SUPPORT_SGX_EDM_MEMORY_DEBUG) - + if (psSGXGetMiscInfoIN->psMiscInfo->eRequest == SGX_MISC_INFO_REQUEST_MEMREAD) { psRetOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase, @@ -1100,7 +1100,7 @@ SGXGetMiscInfoBW(IMG_UINT32 ui32BridgeID, } } #endif - + psDeviceNode = hDevCookieInt; PVR_ASSERT(psDeviceNode != IMG_NULL); if (psDeviceNode == IMG_NULL) @@ -1110,7 +1110,7 @@ SGXGetMiscInfoBW(IMG_UINT32 ui32BridgeID, psDevInfo = psDeviceNode->pvDevice; - + psRetOUT->eError = CopyFromUserWrapper(psPerProc, ui32BridgeID, &sMiscInfo, @@ -1130,7 +1130,7 @@ SGXGetMiscInfoBW(IMG_UINT32 ui32BridgeID, } } - + psRetOUT->eError = CopyToUserWrapper(psPerProc, ui32BridgeID, psSGXGetMiscInfoIN->psMiscInfo, @@ -1195,7 +1195,7 @@ SGXReadHWPerfCBBW(IMG_UINT32 ui32BridgeID, ui32AllocatedSize, psAllocated, hAllocatedHandle); - + return 0; } @@ -1224,7 +1224,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SGX_DEVINITPART2); - + psSGXDevInitPart2OUT->ui32KMBuildOptions = SGX_BUILD_OPTIONS; if(!psPerProc->bInitProcess) @@ -1243,7 +1243,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID, return 0; } - + eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &hDummy, psSGXDevInitPart2IN->sInitInfo.hKernelCCBMemInfo, @@ -1372,7 +1372,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID, #endif -#if defined(FIX_HW_BRN_31542) +#if defined(FIX_HW_BRN_31542) || defined(FIX_HW_BRN_36513) eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &hDummy, psSGXDevInitPart2IN->sInitInfo.hKernelClearClipWAVDMStreamMemInfo, @@ -1421,7 +1421,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID, { bLookupFailed = IMG_TRUE; } - + eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &hDummy, psSGXDevInitPart2IN->sInitInfo.hKernelClearClipWATPCMemInfo, @@ -1440,7 +1440,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID, } #endif -#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31425) +#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31559) eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &hDummy, psSGXDevInitPart2IN->sInitInfo.hKernelVDMSnapShotBufferMemInfo, @@ -1516,7 +1516,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID, return 0; } - + eError = PVRSRVLookupAndReleaseHandle(psPerProc->psHandleBase, #if defined (SUPPORT_SID_INTERFACE) &asInitInfoKM.hKernelCCBMemInfo, @@ -1699,7 +1699,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID, #endif -#if defined(FIX_HW_BRN_31542) +#if defined(FIX_HW_BRN_31542) || defined(FIX_HW_BRN_36513) eError = PVRSRVLookupAndReleaseHandle(psPerProc->psHandleBase, #if defined (SUPPORT_SID_INTERFACE) &asInitInfoKM.hKernelClearClipWAVDMStreamMemInfo, @@ -1797,7 +1797,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID, bReleaseFailed = IMG_TRUE; } #endif -#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31425) +#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31559) eError = PVRSRVLookupAndReleaseHandle(psPerProc->psHandleBase, &psSGXDevInitPart2IN->sInitInfo.hKernelVDMSnapShotBufferMemInfo, psSGXDevInitPart2IN->sInitInfo.hKernelVDMSnapShotBufferMemInfo, @@ -1876,12 +1876,12 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID, { PVR_DPF((PVR_DBG_ERROR, "DevInitSGXPart2BW: A handle release failed")); psSGXDevInitPart2OUT->eError = PVRSRV_ERROR_INIT2_PHASE_FAILED; - + PVR_DBG_BREAK; return 0; } - + #if defined (SUPPORT_SID_INTERFACE) eError = PVRSRVDissociateDeviceMemKM(hDevCookieInt, asInitInfoKM.hKernelCCBMemInfo); #else @@ -1944,7 +1944,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID, } #endif - + #if defined (SUPPORT_SID_INTERFACE) eError = PVRSRVDissociateDeviceMemKM(hDevCookieInt, asInitInfoKM.hKernelSGXMiscMemInfo); #else @@ -2027,7 +2027,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID, #endif #endif -#if defined(FIX_HW_BRN_31542) +#if defined(FIX_HW_BRN_31542) || defined(FIX_HW_BRN_36513) #if defined (SUPPORT_SID_INTERFACE) eError = PVRSRVDissociateDeviceMemKM(hDevCookieInt, asInitInfoKM.hKernelClearClipWAVDMStreamMemInfo); if (eError != PVRSRV_OK) @@ -2110,10 +2110,10 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID, #endif #endif -#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31425) +#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31559) eError = PVRSRVDissociateDeviceMemKM(hDevCookieInt, psSGXDevInitPart2IN->sInitInfo.hKernelVDMSnapShotBufferMemInfo); bDissociateFailed |= (IMG_BOOL)(eError != PVRSRV_OK); - + eError = PVRSRVDissociateDeviceMemKM(hDevCookieInt, psSGXDevInitPart2IN->sInitInfo.hKernelVDMCtrlStreamBufferMemInfo); bDissociateFailed |= (IMG_BOOL)(eError != PVRSRV_OK); #endif @@ -2154,7 +2154,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID, } } - + if(bDissociateFailed) { #if defined (SUPPORT_SID_INTERFACE) @@ -2198,7 +2198,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID, psSGXDevInitPart2OUT->eError = PVRSRV_ERROR_INIT2_PHASE_FAILED; - + PVR_DBG_BREAK; return 0; } @@ -2496,7 +2496,7 @@ SGXUnregisterHW2DContextBW(IMG_UINT32 ui32BridgeID, return 0; } -#endif +#endif static IMG_INT SGXFlushHWRenderTargetBW(IMG_UINT32 ui32BridgeID, @@ -2619,7 +2619,7 @@ SGXFindSharedPBDescBW(IMG_UINT32 ui32BridgeID, if(hSharedPBDesc == IMG_NULL) { psSGXFindSharedPBDescOUT->hSharedPBDescKernelMemInfoHandle = 0; - + goto PVRSRV_BRIDGE_SGX_FINDSHAREDPBDESC_EXIT; } @@ -2629,7 +2629,7 @@ SGXFindSharedPBDescBW(IMG_UINT32 ui32BridgeID, PVRSRV_HANDLE_TYPE_SHARED_PB_DESC, PVRSRV_HANDLE_ALLOC_FLAG_NONE); - + PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, &psSGXFindSharedPBDescOUT->hSharedPBDescKernelMemInfoHandle, psSharedPBDescKernelMemInfo, @@ -2866,26 +2866,26 @@ SGXAddSharedPBDescBW(IMG_UINT32 ui32BridgeID, } } - - + + eError = PVRSRVReleaseHandle(psPerProc->psHandleBase, psSGXAddSharedPBDescIN->hSharedPBDescKernelMemInfo, PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO); PVR_ASSERT(eError == PVRSRV_OK); - + eError = PVRSRVReleaseHandle(psPerProc->psHandleBase, psSGXAddSharedPBDescIN->hHWPBDescKernelMemInfo, PVRSRV_HANDLE_TYPE_MEM_INFO); PVR_ASSERT(eError == PVRSRV_OK); - + eError = PVRSRVReleaseHandle(psPerProc->psHandleBase, psSGXAddSharedPBDescIN->hBlockKernelMemInfo, PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO); PVR_ASSERT(eError == PVRSRV_OK); - + eError = PVRSRVReleaseHandle(psPerProc->psHandleBase, psSGXAddSharedPBDescIN->hHWBlockKernelMemInfo, PVRSRV_HANDLE_TYPE_MEM_INFO); @@ -2893,7 +2893,7 @@ SGXAddSharedPBDescBW(IMG_UINT32 ui32BridgeID, for(i=0; ipsHandleBase, phKernelMemInfoHandles[i], PVRSRV_HANDLE_TYPE_MEM_INFO); @@ -3005,7 +3005,7 @@ SGXGetInfoForSrvinitBW(IMG_UINT32 ui32BridgeID, if ((asHeapInfo[i].ui32HeapID != (IMG_UINT32)SGX_UNDEFINED_HEAP_ID) && (asHeapInfo[i].hDevMemHeap != IMG_NULL)) { - + PVRSRVAllocHandleNR(psPerProc->psHandleBase, &psHeapInfo->hDevMemHeap, asHeapInfo[i].hDevMemHeap, @@ -3029,7 +3029,7 @@ SGXGetInfoForSrvinitBW(IMG_UINT32 ui32BridgeID, if (psHeapInfo->hDevMemHeap != IMG_NULL) { - + PVRSRVAllocHandleNR(psPerProc->psHandleBase, &hDevMemHeapExt, psHeapInfo->hDevMemHeap, @@ -3114,7 +3114,7 @@ DumpBufferArray(PVRSRV_PER_PROCESS_DATA *psPerProc, } else { - + if (bDumpPolls) { @@ -3201,7 +3201,7 @@ SGXPDumpBufferArrayBW(IMG_UINT32 ui32BridgeID, ui32BufferArraySize, (IMG_PVOID *)&psKickTADumpBuffer, 0, "Array of Kick Tile Accelerator Dump Buffer") != PVRSRV_OK) -#endif +#endif { return -ENOMEM; } @@ -3214,7 +3214,7 @@ SGXPDumpBufferArrayBW(IMG_UINT32 ui32BridgeID, ui32BufferArraySize) != PVRSRV_OK) { OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, ui32BufferArraySize, psKickTADumpBuffer, 0); - + return -EFAULT; } #endif @@ -3303,7 +3303,7 @@ SGXPDumpBufferArrayBW(IMG_UINT32 ui32BridgeID, #else OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, ui32BufferArraySize, psKickTADumpBuffer, 0); #endif - + return 0; } @@ -3348,7 +3348,7 @@ SGXPDump3DSignatureRegistersBW(IMG_UINT32 ui32BridgeID, psDevInfo = (PVRSRV_SGXDEV_INFO*)psDeviceNode->pvDevice; #if defined(SGX_FEATURE_MP) && defined(FIX_HW_BRN_27270) - + ui32RegVal = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_CORE); OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_CORE, (SGX_FEATURE_MP_CORE_COUNT - 1) << EUR_CR_MASTER_CORE_ENABLE_SHIFT); #if defined(PDUMP) @@ -3392,7 +3392,7 @@ SGXPDump3DSignatureRegistersBW(IMG_UINT32 ui32BridgeID, return 0; } - + PVR_ASSERT(psDeviceNode->pfnMMUGetContextID != IMG_NULL) ui32MMUContextID = psDeviceNode->pfnMMUGetContextID((IMG_HANDLE)psDeviceNode->sDevMemoryInfo.pBMKernelContext); @@ -3537,7 +3537,7 @@ SGXPDumpTASignatureRegistersBW(IMG_UINT32 ui32BridgeID, psDevInfo = (PVRSRV_SGXDEV_INFO*)psDeviceNode->pvDevice; - + ui32RegVal = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_CORE); OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_CORE, (SGX_FEATURE_MP_CORE_COUNT - 1) << EUR_CR_MASTER_CORE_ENABLE_SHIFT); #if defined(PDUMP) @@ -3631,7 +3631,7 @@ SGXPDumpHWPerfCBBW(IMG_UINT32 ui32BridgeID, return 0; } - + PVR_ASSERT(psDeviceNode->pfnMMUGetContextID != IMG_NULL) ui32MMUContextID = psDeviceNode->pfnMMUGetContextID(hDevMemContextInt); @@ -3650,14 +3650,14 @@ SGXPDumpHWPerfCBBW(IMG_UINT32 ui32BridgeID, PVR_UNREFERENCED_PARAMETER(psRetOUT); PVR_UNREFERENCED_PARAMETER(psPerProc); return 0; -#endif +#endif #else PVR_UNREFERENCED_PARAMETER(ui32BridgeID); PVR_UNREFERENCED_PARAMETER(psPDumpHWPerfCBIN); PVR_UNREFERENCED_PARAMETER(psRetOUT); PVR_UNREFERENCED_PARAMETER(psPerProc); return -EFAULT; -#endif +#endif } @@ -3693,7 +3693,7 @@ SGXPDumpSaveMemBW(IMG_UINT32 ui32BridgeID, return 0; } - + PVR_ASSERT(psDeviceNode->pfnMMUGetContextID != IMG_NULL) ui32MMUContextID = psDeviceNode->pfnMMUGetContextID(hDevMemContextInt); @@ -3707,10 +3707,10 @@ SGXPDumpSaveMemBW(IMG_UINT32 ui32BridgeID, return 0; } -#endif - +#endif + IMG_VOID SetSGXDispatchTableEntry(IMG_VOID) { @@ -3759,6 +3759,6 @@ IMG_VOID SetSGXDispatchTableEntry(IMG_VOID) SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_PDUMP_SAVEMEM, SGXPDumpSaveMemBW); #endif } + - -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/bridged/sgx/bridged_sgx_bridge.h b/drivers/staging/mrst/pvr/services4/srvkm/bridged/sgx/bridged_sgx_bridge.h index 584ca2c..204450c 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/bridged/sgx/bridged_sgx_bridge.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/bridged/sgx/bridged_sgx_bridge.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -38,5 +38,5 @@ IMG_VOID SetSGXDispatchTableEntry(IMG_VOID); } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/buffer_manager.c b/drivers/staging/mrst/pvr/services4/srvkm/common/buffer_manager.c index 042dfbf..88ae29a 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/buffer_manager.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/buffer_manager.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -71,26 +71,26 @@ AllocMemory (BM_CONTEXT *pBMContext, "AllocMemory (uSize=0x%x, uFlags=0x%x, align=0x%x)", uSize, uFlags, uDevVAddrAlignment)); - + if(uFlags & PVRSRV_MEM_RAM_BACKED_ALLOCATION) { if(uFlags & PVRSRV_MEM_USER_SUPPLIED_DEVVADDR) { - + PVR_DPF ((PVR_DBG_ERROR, "AllocMemory: combination of DevVAddr management and RAM backing mode unsupported")); return IMG_FALSE; } + - - + if(psBMHeap->ui32Attribs & (PVRSRV_BACKINGSTORE_SYSMEM_NONCONTIG |PVRSRV_BACKINGSTORE_LOCALMEM_CONTIG)) { - + pArena = psBMHeap->pImportArena; PVR_ASSERT(psBMHeap->sDevArena.psDeviceMemoryHeapInfo->ui32Attribs & PVRSRV_MEM_RAM_BACKED_ALLOCATION); } @@ -100,7 +100,7 @@ AllocMemory (BM_CONTEXT *pBMContext, return IMG_FALSE; } - + if(uFlags & PVRSRV_MEM_NO_GPU_ADDR) { IMG_SIZE_T uImportSize = uSize; @@ -126,20 +126,20 @@ AllocMemory (BM_CONTEXT *pBMContext, } else { - if (!RA_Alloc(pArena, - uSize, - IMG_NULL, - (IMG_VOID*) &pMapping, - uFlags, - uDevVAddrAlignment, - 0, - pvPrivData, - ui32PrivDataLength, - (IMG_UINTPTR_T *)&(pBuf->DevVAddr.uiAddr))) - { - PVR_DPF((PVR_DBG_ERROR, "AllocMemory: RA_Alloc(0x%x) FAILED", uSize)); - return IMG_FALSE; - } + if (!RA_Alloc(pArena, + uSize, + IMG_NULL, + (IMG_VOID*) &pMapping, + uFlags, + uDevVAddrAlignment, + 0, + pvPrivData, + ui32PrivDataLength, + (IMG_UINTPTR_T *)&(pBuf->DevVAddr.uiAddr))) + { + PVR_DPF((PVR_DBG_ERROR, "AllocMemory: RA_Alloc(0x%x) FAILED", uSize)); + return IMG_FALSE; + } } uOffset = pBuf->DevVAddr.uiAddr - pMapping->DevVAddr.uiAddr; @@ -169,7 +169,7 @@ AllocMemory (BM_CONTEXT *pBMContext, } } - + pBuf->CpuPAddr.uiAddr = pMapping->CpuPAddr.uiAddr + uOffset; if(uFlags & PVRSRV_MEM_ZERO) @@ -184,7 +184,7 @@ AllocMemory (BM_CONTEXT *pBMContext, { if(uFlags & PVRSRV_MEM_USER_SUPPLIED_DEVVADDR) { - + PVR_ASSERT(psDevVAddr != IMG_NULL); if (psDevVAddr == IMG_NULL) @@ -193,7 +193,7 @@ AllocMemory (BM_CONTEXT *pBMContext, return IMG_FALSE; } - + pBMContext->psDeviceNode->pfnMMUAlloc (psBMHeap->pMMUHeap, uSize, IMG_NULL, @@ -201,15 +201,15 @@ AllocMemory (BM_CONTEXT *pBMContext, uDevVAddrAlignment, psDevVAddr); - + pBuf->DevVAddr = *psDevVAddr; } else { IMG_BOOL bResult; + - - + bResult = pBMContext->psDeviceNode->pfnMMUAlloc (psBMHeap->pMMUHeap, uSize, IMG_NULL, @@ -224,7 +224,7 @@ AllocMemory (BM_CONTEXT *pBMContext, } } - + if (OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof (struct _BM_MAPPING_), (IMG_PVOID *)&pMapping, IMG_NULL, @@ -234,12 +234,12 @@ AllocMemory (BM_CONTEXT *pBMContext, return IMG_FALSE; } - + pBuf->CpuVAddr = IMG_NULL; pBuf->hOSMemHandle = 0; pBuf->CpuPAddr.uiAddr = 0; - + pMapping->CpuVAddr = IMG_NULL; pMapping->CpuPAddr.uiAddr = 0; pMapping->DevVAddr = pBuf->DevVAddr; @@ -248,14 +248,14 @@ AllocMemory (BM_CONTEXT *pBMContext, pMapping->hOSMemHandle = 0; } - + pMapping->pArena = pArena; - + pMapping->pBMHeap = psBMHeap; pBuf->pMapping = pMapping; - + PVR_DPF ((PVR_DBG_MESSAGE, "AllocMemory: pMapping=%08x: DevV=%08X CpuV=%08x CpuP=%08X uSize=0x%x", (IMG_UINTPTR_T)pMapping, @@ -272,7 +272,7 @@ AllocMemory (BM_CONTEXT *pBMContext, pBuf->CpuPAddr.uiAddr, uSize)); - + PVR_ASSERT(((pBuf->DevVAddr.uiAddr) & (uDevVAddrAlignment - 1)) == 0); return IMG_TRUE; @@ -299,13 +299,13 @@ WrapMemory (BM_HEAP *psBMHeap, (IMG_UINTPTR_T)psBMHeap, uSize, ui32BaseOffset, bPhysContig, (IMG_UINTPTR_T)pvCPUVAddr, uFlags)); PVR_ASSERT((psAddr->uiAddr & (ui32PageSize - 1)) == 0); - + PVR_ASSERT(((IMG_UINTPTR_T)pvCPUVAddr & (ui32PageSize - 1)) == 0); uSize += ui32BaseOffset; uSize = HOST_PAGEALIGN (uSize); - + if (OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(*pMapping), (IMG_PVOID *)&pMapping, IMG_NULL, @@ -393,7 +393,7 @@ WrapMemory (BM_HEAP *psBMHeap, } } - + bResult = DevMemoryAlloc(psBMHeap->pBMContext, pMapping, IMG_NULL, @@ -408,7 +408,7 @@ WrapMemory (BM_HEAP *psBMHeap, goto fail_cleanup; } - + pBuf->CpuPAddr.uiAddr = pMapping->CpuPAddr.uiAddr + ui32BaseOffset; if(!ui32BaseOffset) { @@ -480,7 +480,7 @@ fail_cleanup: } OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BM_MAPPING), pMapping, IMG_NULL); - + return IMG_FALSE; } @@ -521,14 +521,14 @@ ZeroBuf(BM_BUF *pBuf, BM_MAPPING *pMapping, IMG_SIZE_T ui32Bytes, IMG_UINT32 ui3 IMG_SIZE_T ui32CurrentOffset = 0; IMG_CPU_PHYADDR CpuPAddr; - + PVR_ASSERT(pBuf->hOSMemHandle); while(ui32BytesRemaining > 0) { IMG_SIZE_T ui32BlockBytes = MIN(ui32BytesRemaining, HOST_PAGESIZE()); CpuPAddr = OSMemHandleToCpuPAddr(pBuf->hOSMemHandle, ui32CurrentOffset); - + if(CpuPAddr.uiAddr & (HOST_PAGESIZE() -1)) { ui32BlockBytes = @@ -571,7 +571,7 @@ FreeBuf (BM_BUF *pBuf, IMG_UINT32 ui32Flags, IMG_BOOL bFromAllocator) (IMG_UINTPTR_T)pBuf, pBuf->DevVAddr.uiAddr, (IMG_UINTPTR_T)pBuf->CpuVAddr, pBuf->CpuPAddr.uiAddr)); - + pMapping = pBuf->pMapping; psDeviceNode = pMapping->pBMHeap->pBMContext->psDeviceNode; @@ -582,42 +582,42 @@ FreeBuf (BM_BUF *pBuf, IMG_UINT32 ui32Flags, IMG_BOOL bFromAllocator) if(ui32Flags & PVRSRV_MEM_USER_SUPPLIED_DEVVADDR) { - + if ((pBuf->ui32ExportCount == 0) && (pBuf->ui32RefCount == 0)) { - + if(ui32Flags & PVRSRV_MEM_RAM_BACKED_ALLOCATION) { - + PVR_DPF ((PVR_DBG_ERROR, "FreeBuf: combination of DevVAddr management and RAM backing mode unsupported")); } else { - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BM_MAPPING), pMapping, IMG_NULL); - pBuf->pMapping = IMG_NULL; + pBuf->pMapping = IMG_NULL; } } } else { - + if(pBuf->hOSMemHandle != pMapping->hOSMemHandle) { - + if ((pBuf->ui32ExportCount == 0) && (pBuf->ui32RefCount == 0)) { - + OSReleaseSubMemHandle(pBuf->hOSMemHandle, ui32Flags); } } if(ui32Flags & PVRSRV_MEM_RAM_BACKED_ALLOCATION) { - - + + if ((pBuf->ui32ExportCount == 0) && (pBuf->ui32RefCount == 0)) { - + PVR_ASSERT(pBuf->ui32ExportCount == 0) @@ -629,10 +629,10 @@ FreeBuf (BM_BUF *pBuf, IMG_UINT32 ui32Flags, IMG_BOOL bFromAllocator) } else { - RA_Free (pBuf->pMapping->pArena, pBuf->DevVAddr.uiAddr, IMG_FALSE); - } + RA_Free (pBuf->pMapping->pArena, pBuf->DevVAddr.uiAddr, IMG_FALSE); } } + } else { if ((pBuf->ui32ExportCount == 0) && (pBuf->ui32RefCount == 0)) @@ -660,9 +660,9 @@ FreeBuf (BM_BUF *pBuf, IMG_UINT32 ui32Flags, IMG_BOOL bFromAllocator) if ((pBuf->ui32ExportCount == 0) && (pBuf->ui32RefCount == 0)) { - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BM_MAPPING), pMapping, IMG_NULL); - pBuf->pMapping = IMG_NULL; + pBuf->pMapping = IMG_NULL; } } } @@ -671,7 +671,7 @@ FreeBuf (BM_BUF *pBuf, IMG_UINT32 ui32Flags, IMG_BOOL bFromAllocator) if ((pBuf->ui32ExportCount == 0) && (pBuf->ui32RefCount == 0)) { OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BM_BUF), pBuf, IMG_NULL); - + } } @@ -709,7 +709,7 @@ BM_DestroyContext(IMG_HANDLE hBMContext, *pbDestroyed = IMG_FALSE; } - + if (pBMContext == IMG_NULL) { @@ -721,11 +721,11 @@ BM_DestroyContext(IMG_HANDLE hBMContext, if (pBMContext->ui32RefCount > 0) { - + return PVRSRV_OK; } - + eError = List_BM_HEAP_PVRSRV_ERROR_Any(pBMContext->psBMHeap, &BM_DestroyContext_AnyCb); @@ -733,22 +733,22 @@ BM_DestroyContext(IMG_HANDLE hBMContext, { PVR_DPF ((PVR_DBG_ERROR, "BM_DestroyContext: List_BM_HEAP_PVRSRV_ERROR_Any failed")); #if 0 - - - - + + + + PVR_DPF ((PVR_DBG_ERROR, "BM_DestroyContext: Cleaning up with ResManFreeSpecial")); if(ResManFreeSpecial() != PVRSRV_OK) { PVR_DPF ((PVR_DBG_ERROR, "BM_DestroyContext: ResManFreeSpecial failed %d",eError)); } - + #endif return eError; } else { - + eError = ResManFreeResByPtr(pBMContext->hResItem, CLEANUP_WITH_POLL); if(eError != PVRSRV_OK) { @@ -756,7 +756,7 @@ BM_DestroyContext(IMG_HANDLE hBMContext, return eError; } - + if (pbDestroyed != IMG_NULL) { *pbDestroyed = IMG_TRUE; @@ -772,7 +772,7 @@ static PVRSRV_ERROR BM_DestroyContextCallBack_AnyVaCb(BM_HEAP *psBMHeap, va_list PVRSRV_DEVICE_NODE *psDeviceNode; psDeviceNode = va_arg(va, PVRSRV_DEVICE_NODE*); - + if(psBMHeap->ui32Attribs & (PVRSRV_BACKINGSTORE_SYSMEM_NONCONTIG |PVRSRV_BACKINGSTORE_LOCALMEM_CONTIG)) @@ -788,12 +788,12 @@ static PVRSRV_ERROR BM_DestroyContextCallBack_AnyVaCb(BM_HEAP *psBMHeap, va_list return PVRSRV_ERROR_UNSUPPORTED_BACKING_STORE; } - + psDeviceNode->pfnMMUDelete(psBMHeap->pMMUHeap); - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BM_HEAP), psBMHeap, IMG_NULL); - + return PVRSRV_OK; } @@ -809,11 +809,11 @@ static PVRSRV_ERROR BM_DestroyContextCallBack(IMG_PVOID pvParam, PVR_UNREFERENCED_PARAMETER(ui32Param); PVR_UNREFERENCED_PARAMETER(bDummy); - + psDeviceNode = pBMContext->psDeviceNode; - + eError = List_BM_HEAP_PVRSRV_ERROR_Any_va(pBMContext->psBMHeap, &BM_DestroyContextCallBack_AnyVaCb, @@ -822,14 +822,14 @@ static PVRSRV_ERROR BM_DestroyContextCallBack(IMG_PVOID pvParam, { return eError; } - + if (pBMContext->psMMUContext) { psDeviceNode->pfnMMUFinalise(pBMContext->psMMUContext); } - + if (pBMContext->pBufferHash) { @@ -838,20 +838,20 @@ static PVRSRV_ERROR BM_DestroyContextCallBack(IMG_PVOID pvParam, if (pBMContext == psDeviceNode->sDevMemoryInfo.pBMKernelContext) { - + psDeviceNode->sDevMemoryInfo.pBMKernelContext = IMG_NULL; } else { if (pBMContext->ppsThis != IMG_NULL) { - + List_BM_CONTEXT_Remove(pBMContext); } } OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BM_CONTEXT), pBMContext, IMG_NULL); - + return PVRSRV_OK; } @@ -863,7 +863,7 @@ static IMG_HANDLE BM_CreateContext_IncRefCount_AnyVaCb(BM_CONTEXT *pBMContext, v hResManContext = va_arg(va, PRESMAN_CONTEXT); if(ResManFindResourceByPtr(hResManContext, pBMContext->hResItem) == PVRSRV_OK) { - + pBMContext->ui32RefCount++; return pBMContext; } @@ -881,7 +881,7 @@ static IMG_VOID BM_CreateContext_InsertHeap_ForEachVaCb(BM_HEAP *psBMHeap, va_li case DEVICE_MEMORY_HEAP_SHARED: case DEVICE_MEMORY_HEAP_SHARED_EXPORTED: { - + psDeviceNode->pfnMMUInsertHeap(pBMContext->psMMUContext, psBMHeap->pMMUHeap); break; } @@ -917,7 +917,7 @@ BM_CreateContext(PVRSRV_DEVICE_NODE *psDeviceNode, *pbCreated = IMG_FALSE; } - + psDevMemoryInfo = &psDeviceNode->sDevMemoryInfo; if (bKernelContext == IMG_FALSE) @@ -931,7 +931,7 @@ BM_CreateContext(PVRSRV_DEVICE_NODE *psDeviceNode, } } - + if (OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof (struct _BM_CONTEXT_), (IMG_PVOID *)&pBMContext, IMG_NULL, @@ -942,11 +942,11 @@ BM_CreateContext(PVRSRV_DEVICE_NODE *psDeviceNode, } OSMemSet(pBMContext, 0, sizeof (BM_CONTEXT)); - + pBMContext->psDeviceNode = psDeviceNode; - - + + pBMContext->pBufferHash = HASH_Create(32); if (pBMContext->pBufferHash==IMG_NULL) { @@ -964,13 +964,13 @@ BM_CreateContext(PVRSRV_DEVICE_NODE *psDeviceNode, if(bKernelContext) { - + PVR_ASSERT(psDevMemoryInfo->pBMKernelContext == IMG_NULL); psDevMemoryInfo->pBMKernelContext = pBMContext; } else { - + @@ -985,13 +985,13 @@ BM_CreateContext(PVRSRV_DEVICE_NODE *psDeviceNode, PVR_ASSERT(psDevMemoryInfo->pBMKernelContext->psBMHeap); - + pBMContext->psBMSharedHeap = psDevMemoryInfo->pBMKernelContext->psBMHeap; - + List_BM_HEAP_ForEach_va(pBMContext->psBMSharedHeap, @@ -999,14 +999,14 @@ BM_CreateContext(PVRSRV_DEVICE_NODE *psDeviceNode, psDeviceNode, pBMContext); - + List_BM_CONTEXT_Insert(&psDevMemoryInfo->pBMContext, pBMContext); } - + pBMContext->ui32RefCount++; - + pBMContext->hResItem = ResManRegisterRes(hResManContext, RESMAN_TYPE_DEVICEMEM_CONTEXT, pBMContext, @@ -1037,7 +1037,7 @@ static IMG_VOID *BM_CreateHeap_AnyVaCb(BM_HEAP *psBMHeap, va_list va) psDevMemHeapInfo = va_arg(va, DEVICE_MEMORY_HEAP_INFO*); if (psBMHeap->sDevArena.ui32HeapID == psDevMemHeapInfo->ui32HeapID) { - + return psBMHeap; } else @@ -1064,12 +1064,12 @@ BM_CreateHeap (IMG_HANDLE hBMContext, psDeviceNode = pBMContext->psDeviceNode; - - + + PVR_ASSERT((psDevMemHeapInfo->ui32HeapSize & (psDevMemHeapInfo->ui32DataPageSize - 1)) == 0); PVR_ASSERT(psDevMemHeapInfo->ui32HeapSize > 0); - + @@ -1110,7 +1110,7 @@ BM_CreateHeap (IMG_HANDLE hBMContext, psBMHeap->ui32XTileStride = psDevMemHeapInfo->ui32XTileStride; #endif - + psBMHeap->pBMContext = pBMContext; psBMHeap->pMMUHeap = psDeviceNode->pfnMMUCreate (pBMContext->psMMUContext, @@ -1123,7 +1123,7 @@ BM_CreateHeap (IMG_HANDLE hBMContext, goto ErrorExit; } - + psBMHeap->pImportArena = RA_Create (psDevMemHeapInfo->pszBSName, 0, 0, IMG_NULL, MAX(HOST_PAGESIZE(), psBMHeap->sDevArena.ui32DataPageSize), @@ -1139,7 +1139,7 @@ BM_CreateHeap (IMG_HANDLE hBMContext, if(psBMHeap->ui32Attribs & PVRSRV_BACKINGSTORE_LOCALMEM_CONTIG) { - + @@ -1151,24 +1151,24 @@ BM_CreateHeap (IMG_HANDLE hBMContext, } } - + List_BM_HEAP_Insert(&pBMContext->psBMHeap, psBMHeap); return (IMG_HANDLE)psBMHeap; - + ErrorExit: - + if (psBMHeap->pMMUHeap != IMG_NULL) { psDeviceNode->pfnMMUDelete (psBMHeap->pMMUHeap); - + } - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BM_HEAP), psBMHeap, IMG_NULL); - + return IMG_NULL; } @@ -1183,7 +1183,7 @@ BM_DestroyHeap (IMG_HANDLE hDevMemHeap) if(psBMHeap) { - + if(psBMHeap->ui32Attribs & (PVRSRV_BACKINGSTORE_SYSMEM_NONCONTIG |PVRSRV_BACKINGSTORE_LOCALMEM_CONTIG)) @@ -1199,14 +1199,14 @@ BM_DestroyHeap (IMG_HANDLE hDevMemHeap) return; } - + psDeviceNode->pfnMMUDelete (psBMHeap->pMMUHeap); - + List_BM_HEAP_Remove(psBMHeap); - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BM_HEAP), psBMHeap, IMG_NULL); - + } else { @@ -1265,7 +1265,7 @@ BM_Alloc ( IMG_HANDLE hDevMemHeap, uDevVAddrAlignment = 1; } - + if (OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof (BM_BUF), (IMG_PVOID *)&pBuf, IMG_NULL, @@ -1276,7 +1276,7 @@ BM_Alloc ( IMG_HANDLE hDevMemHeap, } OSMemSet(pBuf, 0, sizeof (BM_BUF)); - + if (AllocMemory(pBMContext, psBMHeap, psDevVAddr, @@ -1288,7 +1288,7 @@ BM_Alloc ( IMG_HANDLE hDevMemHeap, pBuf) != IMG_TRUE) { OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof (BM_BUF), pBuf, IMG_NULL); - + PVR_DPF((PVR_DBG_ERROR, "BM_Alloc: AllocMemory FAILED")); return IMG_FALSE; } @@ -1297,12 +1297,12 @@ BM_Alloc ( IMG_HANDLE hDevMemHeap, "BM_Alloc (uSize=0x%x, uFlags=0x%x)", uSize, uFlags)); - + pBuf->ui32RefCount = 1; *phBuf = (BM_HANDLE)pBuf; *pui32Flags = uFlags | psBMHeap->ui32Attribs; - + if(uFlags & PVRSRV_HAP_CACHETYPE_MASK) { *pui32Flags &= ~PVRSRV_HAP_CACHETYPE_MASK; @@ -1422,24 +1422,24 @@ BM_Wrap ( IMG_HANDLE hDevMemHeap, } } #endif - + if (psSysAddr == IMG_NULL) { PVR_DPF((PVR_DBG_ERROR, "Invalid parameter.")); return IMG_FALSE; } sHashAddress = psSysAddr[0]; - + sHashAddress.uiAddr += ui32Offset; - + pBuf = (BM_BUF *)HASH_Retrieve(psBMContext->pBufferHash, sHashAddress.uiAddr); if(pBuf) { IMG_SIZE_T ui32MappingSize = HOST_PAGEALIGN (ui32Size + ui32Offset); - + if(pBuf->pMapping->uSize == ui32MappingSize && (pBuf->pMapping->eCpuMemoryOrigin == hm_wrapped || pBuf->pMapping->eCpuMemoryOrigin == hm_wrapped_virtaddr)) { @@ -1456,12 +1456,12 @@ BM_Wrap ( IMG_HANDLE hDevMemHeap, } else { - + HASH_Remove(psBMContext->pBufferHash, (IMG_UINTPTR_T)sHashAddress.uiAddr); - } + } } - + if (OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof (BM_BUF), (IMG_PVOID *)&pBuf, IMG_NULL, @@ -1472,19 +1472,19 @@ BM_Wrap ( IMG_HANDLE hDevMemHeap, } OSMemSet(pBuf, 0, sizeof (BM_BUF)); - + if (WrapMemory (psBMHeap, ui32Size, ui32Offset, bPhysContig, psSysAddr, pvCPUVAddr, uFlags, pBuf) != IMG_TRUE) { PVR_DPF((PVR_DBG_ERROR, "BM_Wrap: WrapMemory FAILED")); OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof (BM_BUF), pBuf, IMG_NULL); - + return IMG_FALSE; } - + if(pBuf->pMapping->eCpuMemoryOrigin == hm_wrapped || pBuf->pMapping->eCpuMemoryOrigin == hm_wrapped_virtaddr) { - + PVR_ASSERT(SysSysPAddrToCpuPAddr(sHashAddress).uiAddr == pBuf->CpuPAddr.uiAddr); if (!HASH_Insert (psBMContext->pBufferHash, sHashAddress.uiAddr, (IMG_UINTPTR_T)pBuf)) @@ -1499,12 +1499,12 @@ BM_Wrap ( IMG_HANDLE hDevMemHeap, "BM_Wrap (uSize=0x%x, uFlags=0x%x, devVAddr=%08X)", ui32Size, uFlags, pBuf->DevVAddr.uiAddr)); - + pBuf->ui32RefCount = 1; *phBuf = (BM_HANDLE)pBuf; if(pui32Flags) { - + *pui32Flags = (uFlags & ~PVRSRV_HAP_MAPTYPE_MASK) | PVRSRV_HAP_MULTI_PROCESS; } @@ -1549,7 +1549,6 @@ BM_Free (BM_HANDLE hBuf, SysAcquireData(&psSysData); PVRSRVBMBufDecRef(pBuf); - if(pBuf->ui32RefCount == 0) { if(pBuf->pMapping->eCpuMemoryOrigin == hm_wrapped || pBuf->pMapping->eCpuMemoryOrigin == hm_wrapped_virtaddr) @@ -1654,19 +1653,19 @@ DevMemoryAlloc (BM_CONTEXT *pBMContext, if(uFlags & PVRSRV_MEM_INTERLEAVED) { - + pMapping->uSize *= 2; } #ifdef PDUMP if(uFlags & PVRSRV_MEM_DUMMY) { - + ui32PDumpSize = pMapping->pBMHeap->sDevArena.ui32DataPageSize; } #endif - + if (!psDeviceNode->pfnMMUAlloc (pMapping->pBMHeap->pMMUHeap, pMapping->uSize, pActualSize, @@ -1683,7 +1682,7 @@ DevMemoryAlloc (BM_CONTEXT *pBMContext, #endif #if defined(PDUMP) - + PDUMPMALLOCPAGES(&psDeviceNode->sDevId, pMapping->DevVAddr.uiAddr, pMapping->CpuVAddr, @@ -1693,8 +1692,8 @@ DevMemoryAlloc (BM_CONTEXT *pBMContext, #if defined(SUPPORT_PDUMP_MULTI_PROCESS) psDeviceNode->pfnMMUIsHeapShared(pMapping->pBMHeap->pMMUHeap), #else - IMG_FALSE, -#endif + IMG_FALSE, +#endif (IMG_HANDLE)pMapping); #endif @@ -1768,17 +1767,17 @@ DevMemoryFree (BM_MAPPING *pMapping) if (sDevPAddr.uiAddr != 0) { #ifdef PDUMP - + if(pMapping->ui32Flags & PVRSRV_MEM_DUMMY) { - + ui32PSize = pMapping->pBMHeap->sDevArena.ui32DataPageSize; } else { ui32PSize = (IMG_UINT32)pMapping->uSize; } - + PDUMPFREEPAGES(pMapping->pBMHeap, pMapping->DevVAddr, ui32PSize, @@ -1803,21 +1802,12 @@ DevMemoryFree (BM_MAPPING *pMapping) static IMG_UINT32 gXProcWorkaroundShareIndex = XPROC_WORKAROUND_BAD_SHAREINDEX; static IMG_UINT32 gXProcWorkaroundState = XPROC_WORKAROUND_UNKNOWN; - -static struct { - IMG_UINT32 ui32RefCount; - IMG_UINT32 ui32AllocFlags; - IMG_UINT32 ui32Size; - IMG_UINT32 ui32PageSize; - RA_ARENA *psArena; - IMG_SYS_PHYADDR sSysPAddr; - IMG_VOID *pvCpuVAddr; - IMG_HANDLE hOSMemHandle; -} gXProcWorkaroundShareData[XPROC_WORKAROUND_NUM_SHAREABLES] = {{0}}; + +XPROC_DATA gXProcWorkaroundShareData[XPROC_WORKAROUND_NUM_SHAREABLES] = {{0}}; PVRSRV_ERROR BM_XProcWorkaroundSetShareIndex(IMG_UINT32 ui32Index) { - + if (gXProcWorkaroundShareIndex != XPROC_WORKAROUND_BAD_SHAREINDEX) @@ -1834,7 +1824,7 @@ PVRSRV_ERROR BM_XProcWorkaroundSetShareIndex(IMG_UINT32 ui32Index) PVRSRV_ERROR BM_XProcWorkaroundUnsetShareIndex(IMG_UINT32 ui32Index) { - + if (gXProcWorkaroundShareIndex == XPROC_WORKAROUND_BAD_SHAREINDEX) @@ -1856,7 +1846,7 @@ PVRSRV_ERROR BM_XProcWorkaroundUnsetShareIndex(IMG_UINT32 ui32Index) PVRSRV_ERROR BM_XProcWorkaroundFindNewBufferAndSetShareIndex(IMG_UINT32 *pui32Index) { - + if (gXProcWorkaroundShareIndex != XPROC_WORKAROUND_BAD_SHAREINDEX) @@ -1928,7 +1918,7 @@ XProcWorkaroundAllocShareable(RA_ARENA *psArena, *ppvCpuVAddr = gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].pvCpuVAddr; *phOSMemHandle = gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].hOSMemHandle; - gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].ui32RefCount ++; + BM_XProcIndexAcquire(gXProcWorkaroundShareIndex); return PVRSRV_OK; } @@ -1937,8 +1927,8 @@ XProcWorkaroundAllocShareable(RA_ARENA *psArena, if (gXProcWorkaroundState != XPROC_WORKAROUND_ALLOC) { PVR_DPF((PVR_DBG_ERROR, - "XPROC workaround in bad state! About to allocate memory from non-alloc state! (%d)", - gXProcWorkaroundState)); + "XPROC workaround in bad state! About to allocate memory from non-alloc state! (%d)", + gXProcWorkaroundState)); } PVR_ASSERT(gXProcWorkaroundState == XPROC_WORKAROUND_ALLOC); @@ -1985,7 +1975,7 @@ XProcWorkaroundAllocShareable(RA_ARENA *psArena, ui32AllocFlags &= ~PVRSRV_HAP_MAPTYPE_MASK; ui32AllocFlags |= PVRSRV_HAP_SINGLE_PROCESS; - + if (OSAllocPages(ui32AllocFlags, ui32Size, ui32PageSize, @@ -2009,7 +1999,7 @@ XProcWorkaroundAllocShareable(RA_ARENA *psArena, *ppvCpuVAddr = gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].pvCpuVAddr; *phOSMemHandle = gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].hOSMemHandle; - gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].ui32RefCount ++; + BM_XProcIndexAcquire(gXProcWorkaroundShareIndex); return PVRSRV_OK; } @@ -2017,7 +2007,7 @@ XProcWorkaroundAllocShareable(RA_ARENA *psArena, static PVRSRV_ERROR XProcWorkaroundHandleToSI(IMG_HANDLE hOSMemHandle, IMG_UINT32 *pui32SI) { - + IMG_UINT32 ui32SI; IMG_BOOL bFound; IMG_BOOL bErrorDups; @@ -2049,52 +2039,78 @@ static PVRSRV_ERROR XProcWorkaroundHandleToSI(IMG_HANDLE hOSMemHandle, IMG_UINT3 return PVRSRV_OK; } -static IMG_VOID XProcWorkaroundFreeShareable(IMG_HANDLE hOSMemHandle) +#if defined(PVRSRV_REFCOUNT_DEBUG) +IMG_VOID _BM_XProcIndexAcquireDebug(const IMG_CHAR *pszFile, IMG_INT iLine, IMG_UINT32 ui32Index) +#else +IMG_VOID _BM_XProcIndexAcquire(IMG_UINT32 ui32Index) +#endif { - IMG_UINT32 ui32SI = (IMG_UINT32)((IMG_UINTPTR_T)hOSMemHandle & 0xffffU); - PVRSRV_ERROR eError; - - eError = XProcWorkaroundHandleToSI(hOSMemHandle, &ui32SI); - if (eError != PVRSRV_OK) - { - PVR_DPF((PVR_DBG_ERROR, "bad handle")); - return; - } +#if defined(PVRSRV_REFCOUNT_DEBUG) + PVRSRVBMXProcIncRef2(pszFile, iLine, ui32Index); +#else + PVRSRVBMXProcIncRef(ui32Index); +#endif +} - gXProcWorkaroundShareData[ui32SI].ui32RefCount --; +#if defined(PVRSRV_REFCOUNT_DEBUG) +IMG_VOID _BM_XProcIndexReleaseDebug(const IMG_CHAR *pszFile, IMG_INT iLine, IMG_UINT32 ui32Index) +#else +IMG_VOID _BM_XProcIndexRelease(IMG_UINT32 ui32Index) +#endif +{ +#if defined(PVRSRV_REFCOUNT_DEBUG) + PVRSRVBMXProcDecRef2(pszFile, iLine, ui32Index); +#else + PVRSRVBMXProcDecRef(ui32Index); +#endif PVR_DPF((PVR_DBG_VERBOSE, "Reduced refcount of SI[%d] from %d to %d", - ui32SI, gXProcWorkaroundShareData[ui32SI].ui32RefCount+1, gXProcWorkaroundShareData[ui32SI].ui32RefCount)); + ui32Index, gXProcWorkaroundShareData[ui32Index].ui32RefCount+1, gXProcWorkaroundShareData[ui32Index].ui32RefCount)); - if (gXProcWorkaroundShareData[ui32SI].ui32RefCount == 0) + if (gXProcWorkaroundShareData[ui32Index].ui32RefCount == 0) { - if (gXProcWorkaroundShareData[ui32SI].psArena != IMG_NULL) + if (gXProcWorkaroundShareData[ui32Index].psArena != IMG_NULL) { IMG_SYS_PHYADDR sSysPAddr; - if (gXProcWorkaroundShareData[ui32SI].pvCpuVAddr != IMG_NULL) + if (gXProcWorkaroundShareData[ui32Index].pvCpuVAddr != IMG_NULL) { - OSUnReservePhys(gXProcWorkaroundShareData[ui32SI].pvCpuVAddr, - gXProcWorkaroundShareData[ui32SI].ui32Size, - gXProcWorkaroundShareData[ui32SI].ui32AllocFlags, - gXProcWorkaroundShareData[ui32SI].hOSMemHandle); + OSUnReservePhys(gXProcWorkaroundShareData[ui32Index].pvCpuVAddr, + gXProcWorkaroundShareData[ui32Index].ui32Size, + gXProcWorkaroundShareData[ui32Index].ui32AllocFlags, + gXProcWorkaroundShareData[ui32Index].hOSMemHandle); } - sSysPAddr = gXProcWorkaroundShareData[ui32SI].sSysPAddr; - RA_Free (gXProcWorkaroundShareData[ui32SI].psArena, + sSysPAddr = gXProcWorkaroundShareData[ui32Index].sSysPAddr; + RA_Free (gXProcWorkaroundShareData[ui32Index].psArena, sSysPAddr.uiAddr, IMG_FALSE); } else { PVR_DPF((PVR_DBG_VERBOSE, "freeing OS memory")); - OSFreePages(gXProcWorkaroundShareData[ui32SI].ui32AllocFlags, - gXProcWorkaroundShareData[ui32SI].ui32PageSize, - gXProcWorkaroundShareData[ui32SI].pvCpuVAddr, - gXProcWorkaroundShareData[ui32SI].hOSMemHandle); + OSFreePages(gXProcWorkaroundShareData[ui32Index].ui32AllocFlags, + gXProcWorkaroundShareData[ui32Index].ui32PageSize, + gXProcWorkaroundShareData[ui32Index].pvCpuVAddr, + gXProcWorkaroundShareData[ui32Index].hOSMemHandle); } } } +static IMG_VOID XProcWorkaroundFreeShareable(IMG_HANDLE hOSMemHandle) +{ + IMG_UINT32 ui32SI = (IMG_UINT32)((IMG_UINTPTR_T)hOSMemHandle & 0xffffU); + PVRSRV_ERROR eError; + + eError = XProcWorkaroundHandleToSI(hOSMemHandle, &ui32SI); + if (eError != PVRSRV_OK) + { + PVR_DPF((PVR_DBG_ERROR, "bad handle")); + return; + } + + BM_XProcIndexRelease(ui32SI); +} + static IMG_BOOL BM_ImportMemory (IMG_VOID *pH, @@ -2112,7 +2128,7 @@ BM_ImportMemory (IMG_VOID *pH, IMG_BOOL bResult; IMG_SIZE_T uSize; IMG_SIZE_T uPSize; - IMG_SIZE_T uDevVAddrAlignment = 0; + IMG_SIZE_T uDevVAddrAlignment = 0; PVR_DPF ((PVR_DBG_MESSAGE, "BM_ImportMemory (pBMContext=0x%x, uRequestSize=0x%x, uFlags=0x%x, uAlign=0x%x)", @@ -2147,13 +2163,13 @@ BM_ImportMemory (IMG_VOID *pH, pMapping->pBMHeap = pBMHeap; pMapping->ui32Flags = uFlags; - + if (pActualSize) { *pActualSize = uSize; } - + if(pMapping->ui32Flags & PVRSRV_MEM_DUMMY) { uPSize = pBMHeap->sDevArena.ui32DataPageSize; @@ -2168,13 +2184,13 @@ BM_ImportMemory (IMG_VOID *pH, IMG_UINT32 ui32Attribs = pBMHeap->ui32Attribs | PVRSRV_MEM_XPROC; IMG_BOOL bBadBackingStoreType; - + if(uFlags & PVRSRV_MEM_ION) { ui32Attribs |= PVRSRV_MEM_ION; } - bBadBackingStoreType = IMG_TRUE; + bBadBackingStoreType = IMG_TRUE; if ((ui32Attribs & PVRSRV_BACKINGSTORE_SYSMEM_NONCONTIG) != 0) { @@ -2189,16 +2205,16 @@ BM_ImportMemory (IMG_VOID *pH, PVR_DPF((PVR_DBG_ERROR, "Cannot use use this memory sharing workaround with allocations that might be suballocated")); goto fail_mapping_alloc; } - uDevVAddrAlignment = 0; - + uDevVAddrAlignment = 0; + if (pMapping->ui32Flags & PVRSRV_HAP_CACHETYPE_MASK) { ui32Attribs &= ~PVRSRV_HAP_CACHETYPE_MASK; ui32Attribs |= (pMapping->ui32Flags & PVRSRV_HAP_CACHETYPE_MASK); } - + if (XProcWorkaroundAllocShareable(IMG_NULL, ui32Attribs, (IMG_UINT32)uPSize, @@ -2214,8 +2230,8 @@ BM_ImportMemory (IMG_VOID *pH, goto fail_mapping_alloc; } - - + + pMapping->eCpuMemoryOrigin = hm_env; bBadBackingStoreType = IMG_FALSE; @@ -2230,16 +2246,16 @@ BM_ImportMemory (IMG_VOID *pH, PVR_DPF((PVR_DBG_ERROR, "Cannot use use this memory sharing workaround with allocations that might be suballocated")); goto fail_mapping_alloc; } - uDevVAddrAlignment = 0; - + uDevVAddrAlignment = 0; + if (pMapping->ui32Flags & PVRSRV_HAP_CACHETYPE_MASK) { ui32Attribs &= ~PVRSRV_HAP_CACHETYPE_MASK; ui32Attribs |= (pMapping->ui32Flags & PVRSRV_HAP_CACHETYPE_MASK); } - + if (XProcWorkaroundAllocShareable(pBMHeap->pLocalDevMemArena, ui32Attribs, (IMG_UINT32)uPSize, @@ -2255,8 +2271,8 @@ BM_ImportMemory (IMG_VOID *pH, goto fail_mapping_alloc; } - - + + pMapping->eCpuMemoryOrigin = hm_env; bBadBackingStoreType = IMG_FALSE; @@ -2270,26 +2286,26 @@ BM_ImportMemory (IMG_VOID *pH, } else - + if(pBMHeap->ui32Attribs & PVRSRV_BACKINGSTORE_SYSMEM_NONCONTIG) { IMG_UINT32 ui32Attribs = pBMHeap->ui32Attribs; - + if (pMapping->ui32Flags & PVRSRV_HAP_CACHETYPE_MASK) { ui32Attribs &= ~PVRSRV_HAP_CACHETYPE_MASK; ui32Attribs |= (pMapping->ui32Flags & PVRSRV_HAP_CACHETYPE_MASK); } - + if (pMapping->ui32Flags & PVRSRV_MEM_ALLOCATENONCACHEDMEM) { ui32Attribs &= ~PVRSRV_MEM_ALLOCATENONCACHEDMEM; ui32Attribs |= (pMapping->ui32Flags & PVRSRV_MEM_ALLOCATENONCACHEDMEM); - } - - + } + + if (OSAllocPages(ui32Attribs, uPSize, pBMHeap->sDevArena.ui32DataPageSize, @@ -2304,7 +2320,7 @@ BM_ImportMemory (IMG_VOID *pH, goto fail_mapping_alloc; } - + pMapping->eCpuMemoryOrigin = hm_env; } else if(pBMHeap->ui32Attribs & PVRSRV_BACKINGSTORE_LOCALMEM_CONTIG) @@ -2312,10 +2328,10 @@ BM_ImportMemory (IMG_VOID *pH, IMG_SYS_PHYADDR sSysPAddr; IMG_UINT32 ui32Attribs = pBMHeap->ui32Attribs; - + PVR_ASSERT(pBMHeap->pLocalDevMemArena != IMG_NULL); - + if (pMapping->ui32Flags & PVRSRV_HAP_CACHETYPE_MASK) { ui32Attribs &= ~PVRSRV_HAP_CACHETYPE_MASK; @@ -2337,7 +2353,7 @@ BM_ImportMemory (IMG_VOID *pH, goto fail_mapping_alloc; } - + pMapping->CpuPAddr = SysSysPAddrToCpuPAddr(sSysPAddr); if(OSReservePhys(pMapping->CpuPAddr, uPSize, @@ -2349,7 +2365,7 @@ BM_ImportMemory (IMG_VOID *pH, goto fail_dev_mem_alloc; } - + pMapping->eCpuMemoryOrigin = hm_contiguous; } else @@ -2358,26 +2374,26 @@ BM_ImportMemory (IMG_VOID *pH, goto fail_mapping_alloc; } - + if(!(uFlags & PVRSRV_MEM_NO_GPU_ADDR)) { - bResult = DevMemoryAlloc (pBMContext, - pMapping, - IMG_NULL, - uFlags, - (IMG_UINT32)uDevVAddrAlignment, - &pMapping->DevVAddr); - if (!bResult) - { - PVR_DPF((PVR_DBG_ERROR, - "BM_ImportMemory: DevMemoryAlloc(0x%x) failed", - pMapping->uSize)); - goto fail_dev_mem_alloc; - } + bResult = DevMemoryAlloc (pBMContext, + pMapping, + IMG_NULL, + uFlags, + (IMG_UINT32)uDevVAddrAlignment, + &pMapping->DevVAddr); + if (!bResult) + { + PVR_DPF((PVR_DBG_ERROR, + "BM_ImportMemory: DevMemoryAlloc(0x%x) failed", + pMapping->uSize)); + goto fail_dev_mem_alloc; + } } - - + + PVR_ASSERT (uDevVAddrAlignment>1?(pMapping->DevVAddr.uiAddr%uDevVAddrAlignment)==0:1); *pBase = pMapping->DevVAddr.uiAddr; @@ -2389,7 +2405,7 @@ BM_ImportMemory (IMG_VOID *pH, fail_dev_mem_alloc: if (pMapping && (pMapping->CpuVAddr || pMapping->hOSMemHandle)) { - + if(pMapping->ui32Flags & PVRSRV_MEM_INTERLEAVED) { pMapping->uSize /= 2; @@ -2433,7 +2449,7 @@ fail_dev_mem_alloc: } fail_mapping_alloc: OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BM_MAPPING), pMapping, IMG_NULL); - + fail_exit: return IMG_FALSE; } @@ -2461,10 +2477,10 @@ BM_FreeMemory (IMG_VOID *h, IMG_UINTPTR_T _base, BM_MAPPING *psMapping) if(!(psMapping->ui32Flags & PVRSRV_MEM_NO_GPU_ADDR)) { - DevMemoryFree (psMapping); + DevMemoryFree (psMapping); } - + if((psMapping->ui32Flags & PVRSRV_MEM_INTERLEAVED) != 0) { psMapping->uSize /= 2; @@ -2507,7 +2523,7 @@ BM_FreeMemory (IMG_VOID *h, IMG_UINTPTR_T _base, BM_MAPPING *psMapping) } OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BM_MAPPING), psMapping, IMG_NULL); - + PVR_DPF((PVR_DBG_MESSAGE, "..BM_FreeMemory (h=0x%x, base=0x%x)", @@ -2524,10 +2540,10 @@ IMG_VOID BM_GetPhysPageAddr(PVRSRV_KERNEL_MEM_INFO *psMemInfo, PVR_ASSERT (psMemInfo && psDevPAddr) - + PVR_ASSERT((sDevVPageAddr.uiAddr & 0xFFF) == 0); - + psDeviceNode = ((BM_BUF*)psMemInfo->sMemBlk.hBuffer)->pMapping->pBMHeap->pBMContext->psDeviceNode; *psDevPAddr = psDeviceNode->pfnMMUGetPhysPageAddr(((BM_BUF*)psMemInfo->sMemBlk.hBuffer)->pMapping->pBMHeap->pMMUHeap, diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/deviceclass.c b/drivers/staging/mrst/pvr/services4/srvkm/common/deviceclass.c index 7de184e..09a1416 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/deviceclass.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/deviceclass.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -49,7 +49,7 @@ typedef struct PVRSRV_DC_SRV2DISP_KMJTABLE_TAG *PPVRSRV_DC_SRV2DISP_KMJTABLE; typedef struct PVRSRV_DC_BUFFER_TAG { - + PVRSRV_DEVICECLASS_BUFFER sDeviceClassBuffer; struct PVRSRV_DISPLAYCLASS_INFO_TAG *psDCInfo; @@ -71,7 +71,7 @@ typedef struct PVRSRV_DC_SWAPCHAIN_TAG #if !defined(SUPPORT_DC_CMDCOMPLETE_WHEN_NO_LONGER_DISPLAYED) PVRSRV_KERNEL_SYNC_INFO **ppsLastSyncInfos; IMG_UINT32 ui32LastNumSyncInfos; -#endif +#endif struct PVRSRV_DISPLAYCLASS_INFO_TAG *psDCInfo; struct PVRSRV_DC_SWAPCHAIN_TAG *psNext; } PVRSRV_DC_SWAPCHAIN; @@ -80,7 +80,7 @@ typedef struct PVRSRV_DC_SWAPCHAIN_TAG typedef struct PVRSRV_DC_SWAPCHAIN_REF_TAG { struct PVRSRV_DC_SWAPCHAIN_TAG *psSwapChain; - IMG_HANDLE hResItem; + IMG_HANDLE hResItem; } PVRSRV_DC_SWAPCHAIN_REF; @@ -108,7 +108,7 @@ typedef struct PVRSRV_BC_SRV2BUFFER_KMJTABLE_TAG *PPVRSRV_BC_SRV2BUFFER_KMJTABLE typedef struct PVRSRV_BC_BUFFER_TAG { - + PVRSRV_DEVICECLASS_BUFFER sDeviceClassBuffer; struct PVRSRV_BUFFERCLASS_INFO_TAG *psBCInfo; @@ -122,7 +122,7 @@ typedef struct PVRSRV_BUFFERCLASS_INFO_TAG IMG_HANDLE hExtDevice; PPVRSRV_BC_SRV2BUFFER_KMJTABLE psFuncTable; IMG_HANDLE hDevMemContext; - + IMG_UINT32 ui32BufferCount; PVRSRV_BC_BUFFER *psBuffer; @@ -182,13 +182,13 @@ PVRSRV_ERROR PVRSRVEnumerateDCKM (PVRSRV_DEVICE_CLASS DeviceClass, IMG_UINT32 *pui32DevCount, IMG_UINT32 *pui32DevID ) { - + IMG_UINT ui32DevCount = 0; SYS_DATA *psSysData; SysAcquireData(&psSysData); - + List_PVRSRV_DEVICE_NODE_ForEach_va(psSysData->psDeviceNodeList, &PVRSRVEnumerateDCKM_ForEachVaCb, &ui32DevCount, @@ -217,7 +217,7 @@ PVRSRV_ERROR PVRSRVRegisterDCDeviceKM (PVRSRV_DC_SRV2DISP_KMJTABLE *psFuncTable, PVRSRV_DEVICE_NODE *psDeviceNode; SYS_DATA *psSysData; - + @@ -234,10 +234,10 @@ PVRSRV_ERROR PVRSRVRegisterDCDeviceKM (PVRSRV_DC_SRV2DISP_KMJTABLE *psFuncTable, SysAcquireData(&psSysData); + - - + if(OSAllocMem( PVRSRV_OS_PAGEABLE_HEAP, sizeof(*psDCInfo), (IMG_VOID **)&psDCInfo, IMG_NULL, @@ -248,7 +248,7 @@ PVRSRV_ERROR PVRSRVRegisterDCDeviceKM (PVRSRV_DC_SRV2DISP_KMJTABLE *psFuncTable, } OSMemSet (psDCInfo, 0, sizeof(*psDCInfo)); - + if(OSAllocMem( PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_DC_SRV2DISP_KMJTABLE), (IMG_VOID **)&psDCInfo->psFuncTable, IMG_NULL, @@ -259,10 +259,10 @@ PVRSRV_ERROR PVRSRVRegisterDCDeviceKM (PVRSRV_DC_SRV2DISP_KMJTABLE *psFuncTable, } OSMemSet (psDCInfo->psFuncTable, 0, sizeof(PVRSRV_DC_SRV2DISP_KMJTABLE)); - + *psDCInfo->psFuncTable = *psFuncTable; - + if(OSAllocMem( PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_DEVICE_NODE), (IMG_VOID **)&psDeviceNode, IMG_NULL, @@ -280,7 +280,7 @@ PVRSRV_ERROR PVRSRVRegisterDCDeviceKM (PVRSRV_DC_SRV2DISP_KMJTABLE *psFuncTable, psDeviceNode->sDevId.eDeviceClass = PVRSRV_DEVICE_CLASS_DISPLAY; psDeviceNode->psSysData = psSysData; - + if (AllocateDeviceID(psSysData, &psDeviceNode->sDevId.ui32DeviceIndex) != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"PVRSRVRegisterBCDeviceKM: Failed to allocate Device ID")); @@ -292,10 +292,10 @@ PVRSRV_ERROR PVRSRVRegisterDCDeviceKM (PVRSRV_DC_SRV2DISP_KMJTABLE *psFuncTable, *pui32DeviceID = psDeviceNode->sDevId.ui32DeviceIndex; } - + SysRegisterExternalDevice(psDeviceNode); - + List_PVRSRV_DEVICE_NODE_Insert(&psSysData->psDeviceNodeList, psDeviceNode); return PVRSRV_OK; @@ -309,7 +309,7 @@ ErrorExit: } OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_DISPLAYCLASS_INFO), psDCInfo, IMG_NULL); - + return PVRSRV_ERROR_OUT_OF_MEMORY; } @@ -322,7 +322,7 @@ static PVRSRV_ERROR PVRSRVRemoveDCDeviceKM(IMG_UINT32 ui32DevIndex) SysAcquireData(&psSysData); - + psDeviceNode = (PVRSRV_DEVICE_NODE*) List_PVRSRV_DEVICE_NODE_Any_va(psSysData->psDeviceNodeList, &MatchDeviceKM_AnyVaCb, @@ -331,27 +331,27 @@ static PVRSRV_ERROR PVRSRVRemoveDCDeviceKM(IMG_UINT32 ui32DevIndex) PVRSRV_DEVICE_CLASS_DISPLAY); if (!psDeviceNode) { - + PVR_DPF((PVR_DBG_ERROR,"PVRSRVRemoveDCDeviceKM: requested device %d not present", ui32DevIndex)); return PVRSRV_ERROR_NO_DEVICENODE_FOUND; } - + psDCInfo = (PVRSRV_DISPLAYCLASS_INFO*)psDeviceNode->pvDevice; - + if(psDCInfo->ui32RefCount == 0) { - + List_PVRSRV_DEVICE_NODE_Remove(psDeviceNode); - + SysRemoveExternalDevice(psDeviceNode); - + PVR_ASSERT(psDCInfo->ui32RefCount == 0); @@ -359,9 +359,9 @@ static PVRSRV_ERROR PVRSRVRemoveDCDeviceKM(IMG_UINT32 ui32DevIndex) (IMG_VOID)OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_DC_SRV2DISP_KMJTABLE), psDCInfo->psFuncTable, IMG_NULL); psDCInfo->psFuncTable = IMG_NULL; (IMG_VOID)OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_DISPLAYCLASS_INFO), psDCInfo, IMG_NULL); - + (IMG_VOID)OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_DEVICE_NODE), psDeviceNode, IMG_NULL); - + } else { @@ -380,7 +380,7 @@ PVRSRV_ERROR PVRSRVRegisterBCDeviceKM (PVRSRV_BC_SRV2BUFFER_KMJTABLE *psFuncTabl PVRSRV_BUFFERCLASS_INFO *psBCInfo = IMG_NULL; PVRSRV_DEVICE_NODE *psDeviceNode; SYS_DATA *psSysData; - + @@ -396,10 +396,10 @@ PVRSRV_ERROR PVRSRVRegisterBCDeviceKM (PVRSRV_BC_SRV2BUFFER_KMJTABLE *psFuncTabl SysAcquireData(&psSysData); + - - + if(OSAllocMem( PVRSRV_OS_PAGEABLE_HEAP, sizeof(*psBCInfo), (IMG_VOID **)&psBCInfo, IMG_NULL, @@ -410,7 +410,7 @@ PVRSRV_ERROR PVRSRVRegisterBCDeviceKM (PVRSRV_BC_SRV2BUFFER_KMJTABLE *psFuncTabl } OSMemSet (psBCInfo, 0, sizeof(*psBCInfo)); - + if(OSAllocMem( PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_BC_SRV2BUFFER_KMJTABLE), (IMG_VOID **)&psBCInfo->psFuncTable, IMG_NULL, @@ -421,10 +421,10 @@ PVRSRV_ERROR PVRSRVRegisterBCDeviceKM (PVRSRV_BC_SRV2BUFFER_KMJTABLE *psFuncTabl } OSMemSet (psBCInfo->psFuncTable, 0, sizeof(PVRSRV_BC_SRV2BUFFER_KMJTABLE)); - + *psBCInfo->psFuncTable = *psFuncTable; - + if(OSAllocMem( PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_DEVICE_NODE), (IMG_VOID **)&psDeviceNode, IMG_NULL, @@ -442,7 +442,7 @@ PVRSRV_ERROR PVRSRVRegisterBCDeviceKM (PVRSRV_BC_SRV2BUFFER_KMJTABLE *psFuncTabl psDeviceNode->sDevId.eDeviceClass = PVRSRV_DEVICE_CLASS_BUFFER; psDeviceNode->psSysData = psSysData; - + if (AllocateDeviceID(psSysData, &psDeviceNode->sDevId.ui32DeviceIndex) != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"PVRSRVRegisterBCDeviceKM: Failed to allocate Device ID")); @@ -454,7 +454,7 @@ PVRSRV_ERROR PVRSRVRegisterBCDeviceKM (PVRSRV_BC_SRV2BUFFER_KMJTABLE *psFuncTabl *pui32DeviceID = psDeviceNode->sDevId.ui32DeviceIndex; } - + List_PVRSRV_DEVICE_NODE_Insert(&psSysData->psDeviceNodeList, psDeviceNode); return PVRSRV_OK; @@ -468,7 +468,7 @@ ErrorExit: } OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_BUFFERCLASS_INFO), psBCInfo, IMG_NULL); - + return PVRSRV_ERROR_OUT_OF_MEMORY; } @@ -482,7 +482,7 @@ static PVRSRV_ERROR PVRSRVRemoveBCDeviceKM(IMG_UINT32 ui32DevIndex) SysAcquireData(&psSysData); - + psDevNode = (PVRSRV_DEVICE_NODE*) List_PVRSRV_DEVICE_NODE_Any_va(psSysData->psDeviceNodeList, &MatchDeviceKM_AnyVaCb, @@ -496,31 +496,31 @@ static PVRSRV_ERROR PVRSRVRemoveBCDeviceKM(IMG_UINT32 ui32DevIndex) return PVRSRV_ERROR_NO_DEVICENODE_FOUND; } - - + + psBCInfo = (PVRSRV_BUFFERCLASS_INFO*)psDevNode->pvDevice; - + if(psBCInfo->ui32RefCount == 0) { - + List_PVRSRV_DEVICE_NODE_Remove(psDevNode); - + (IMG_VOID)FreeDeviceID(psSysData, ui32DevIndex); - - + + (IMG_VOID)OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_BC_SRV2BUFFER_KMJTABLE), psBCInfo->psFuncTable, IMG_NULL); psBCInfo->psFuncTable = IMG_NULL; (IMG_VOID)OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_BUFFERCLASS_INFO), psBCInfo, IMG_NULL); - + (IMG_VOID)OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_DEVICE_NODE), psDevNode, IMG_NULL); - + } else { @@ -544,7 +544,7 @@ PVRSRV_ERROR PVRSRVCloseDCDeviceKM (IMG_HANDLE hDeviceKM, psDCPerContextInfo = (PVRSRV_DISPLAYCLASS_PERCONTEXT_INFO *)hDeviceKM; - + eError = ResManFreeResByPtr(psDCPerContextInfo->hResItem, CLEANUP_WITH_POLL); return eError; @@ -570,7 +570,7 @@ static PVRSRV_ERROR CloseDCDeviceCallBack(IMG_PVOID pvParam, &psDCInfo->sSystemBuffer.sDeviceClassBuffer, psDCInfo->sSystemBuffer.sDeviceClassBuffer.ui32MemMapRefCount)); #if 0 - + return PVRSRV_ERROR_STILL_MAPPED; #endif } @@ -578,21 +578,17 @@ static PVRSRV_ERROR CloseDCDeviceCallBack(IMG_PVOID pvParam, psDCInfo->ui32RefCount--; if(psDCInfo->ui32RefCount == 0) { - + psDCInfo->psFuncTable->pfnCloseDCDevice(psDCInfo->hExtDevice); PVRSRVKernelSyncInfoDecRef(psDCInfo->sSystemBuffer.sDeviceClassBuffer.psKernelSyncInfo, IMG_NULL); - if (psDCInfo->sSystemBuffer.sDeviceClassBuffer.psKernelSyncInfo->ui32RefCount == 0) - { - PVRSRVFreeSyncInfoKM(psDCInfo->sSystemBuffer.sDeviceClassBuffer.psKernelSyncInfo); - } psDCInfo->hDevMemContext = IMG_NULL; psDCInfo->hExtDevice = IMG_NULL; } OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_DISPLAYCLASS_PERCONTEXT_INFO), psDCPerContextInfo, IMG_NULL); - + return PVRSRV_OK; } @@ -618,7 +614,7 @@ PVRSRV_ERROR PVRSRVOpenDCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, SysAcquireData(&psSysData); - + psDeviceNode = (PVRSRV_DEVICE_NODE*) List_PVRSRV_DEVICE_NODE_Any_va(psSysData->psDeviceNodeList, &MatchDeviceKM_AnyVaCb, @@ -632,7 +628,7 @@ PVRSRV_ERROR PVRSRVOpenDCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, } psDCInfo = (PVRSRV_DISPLAYCLASS_INFO*)psDeviceNode->pvDevice; - + if(OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, @@ -650,10 +646,10 @@ PVRSRV_ERROR PVRSRVOpenDCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, psDeviceNode = (PVRSRV_DEVICE_NODE *)hDevCookie; - + psDCInfo->hDevMemContext = (IMG_HANDLE)psDeviceNode->sDevMemoryInfo.pBMKernelContext; - + eError = PVRSRVAllocSyncInfoKM(IMG_NULL, (IMG_HANDLE)psDeviceNode->sDevMemoryInfo.pBMKernelContext, &psDCInfo->sSystemBuffer.sDeviceClassBuffer.psKernelSyncInfo); @@ -664,7 +660,7 @@ PVRSRV_ERROR PVRSRVOpenDCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, return eError; } - + eError = psDCInfo->psFuncTable->pfnOpenDCDevice(ui32DeviceID, &psDCInfo->hExtDevice, (PVRSRV_SYNC_DATA*)psDCInfo->sSystemBuffer.sDeviceClassBuffer.psKernelSyncInfo->psSyncDataMemInfoKM->pvLinAddrKM); @@ -672,7 +668,7 @@ PVRSRV_ERROR PVRSRVOpenDCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, { PVR_DPF((PVR_DBG_ERROR,"PVRSRVOpenDCDeviceKM: Failed to open external DC device")); psDCInfo->ui32RefCount--; - PVRSRVFreeSyncInfoKM(psDCInfo->sSystemBuffer.sDeviceClassBuffer.psKernelSyncInfo); + PVRSRVKernelSyncInfoDecRef(psDCInfo->sSystemBuffer.sDeviceClassBuffer.psKernelSyncInfo, IMG_NULL); return eError; } @@ -682,11 +678,9 @@ PVRSRV_ERROR PVRSRVOpenDCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, { PVR_DPF((PVR_DBG_ERROR,"PVRSRVOpenDCDeviceKM: Failed to get system buffer")); psDCInfo->ui32RefCount--; - PVRSRVFreeSyncInfoKM(psDCInfo->sSystemBuffer.sDeviceClassBuffer.psKernelSyncInfo); + PVRSRVKernelSyncInfoDecRef(psDCInfo->sSystemBuffer.sDeviceClassBuffer.psKernelSyncInfo, IMG_NULL); return eError; } - - PVRSRVKernelSyncInfoIncRef(psDCInfo->sSystemBuffer.sDeviceClassBuffer.psKernelSyncInfo, IMG_NULL); psDCInfo->sSystemBuffer.sDeviceClassBuffer.ui32MemMapRefCount = 0; } else @@ -700,7 +694,7 @@ PVRSRV_ERROR PVRSRVOpenDCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, 0, &CloseDCDeviceCallBack); - + *phDeviceKM = (IMG_HANDLE)psDCPerContextInfo; return PVRSRV_OK; @@ -722,7 +716,7 @@ PVRSRV_ERROR PVRSRVEnumDCFormatsKM (IMG_HANDLE hDeviceKM, psDCInfo = DCDeviceHandleToDCInfo(hDeviceKM); - + return psDCInfo->psFuncTable->pfnEnumDCFormats(psDCInfo->hExtDevice, pui32Count, psFormat); } @@ -736,7 +730,7 @@ PVRSRV_ERROR PVRSRVEnumDCDimsKM (IMG_HANDLE hDeviceKM, { PVRSRV_DISPLAYCLASS_INFO *psDCInfo; - if(!hDeviceKM || !pui32Count || !psFormat) + if(!hDeviceKM || !pui32Count || !psFormat) { PVR_DPF((PVR_DBG_ERROR,"PVRSRVEnumDCDimsKM: Invalid parameters")); return PVRSRV_ERROR_INVALID_PARAMS; @@ -744,7 +738,7 @@ PVRSRV_ERROR PVRSRVEnumDCDimsKM (IMG_HANDLE hDeviceKM, psDCInfo = DCDeviceHandleToDCInfo(hDeviceKM); - + return psDCInfo->psFuncTable->pfnEnumDCDims(psDCInfo->hExtDevice, psFormat, pui32Count, psDim); } @@ -765,7 +759,7 @@ PVRSRV_ERROR PVRSRVGetDCSystemBufferKM (IMG_HANDLE hDeviceKM, psDCInfo = DCDeviceHandleToDCInfo(hDeviceKM); - + eError = psDCInfo->psFuncTable->pfnGetDCSystemBuffer(psDCInfo->hExtDevice, &hExtBuffer); if(eError != PVRSRV_OK) { @@ -773,7 +767,7 @@ PVRSRV_ERROR PVRSRVGetDCSystemBufferKM (IMG_HANDLE hDeviceKM, return eError; } - + psDCInfo->sSystemBuffer.sDeviceClassBuffer.pfnGetBufferAddr = psDCInfo->psFuncTable->pfnGetBufferAddr; psDCInfo->sSystemBuffer.sDeviceClassBuffer.hDevMemContext = psDCInfo->hDevMemContext; psDCInfo->sSystemBuffer.sDeviceClassBuffer.hExtDevice = psDCInfo->hExtDevice; @@ -781,7 +775,7 @@ PVRSRV_ERROR PVRSRVGetDCSystemBufferKM (IMG_HANDLE hDeviceKM, psDCInfo->sSystemBuffer.psDCInfo = psDCInfo; - + if (phBuffer) { *phBuffer = (IMG_HANDLE)&(psDCInfo->sSystemBuffer); @@ -806,7 +800,7 @@ PVRSRV_ERROR PVRSRVGetDCInfoKM (IMG_HANDLE hDeviceKM, psDCInfo = DCDeviceHandleToDCInfo(hDeviceKM); - + eError = psDCInfo->psFuncTable->pfnGetDCInfo(psDCInfo->hExtDevice, psDisplayInfo); if (eError != PVRSRV_OK) { @@ -848,34 +842,34 @@ static PVRSRV_ERROR DestroyDCSwapChain(PVRSRV_DC_SWAPCHAIN *psSwapChain) PVRSRV_DISPLAYCLASS_INFO *psDCInfo = psSwapChain->psDCInfo; IMG_UINT32 i; - + if( psDCInfo->psDCSwapChainShared ) { if( psDCInfo->psDCSwapChainShared == psSwapChain ) { psDCInfo->psDCSwapChainShared = psSwapChain->psNext; } - else + else { PVRSRV_DC_SWAPCHAIN *psCurrentSwapChain; - psCurrentSwapChain = psDCInfo->psDCSwapChainShared; + psCurrentSwapChain = psDCInfo->psDCSwapChainShared; while( psCurrentSwapChain->psNext ) { - if( psCurrentSwapChain->psNext != psSwapChain ) + if( psCurrentSwapChain->psNext != psSwapChain ) { psCurrentSwapChain = psCurrentSwapChain->psNext; continue; } psCurrentSwapChain->psNext = psSwapChain->psNext; - break; + break; } } } - + PVRSRVDestroyCommandQueueKM(psSwapChain->psQueue); - + eError = psDCInfo->psFuncTable->pfnDestroyDCSwapChain(psDCInfo->hExtDevice, psSwapChain->hExtSwapChain); @@ -885,16 +879,12 @@ static PVRSRV_ERROR DestroyDCSwapChain(PVRSRV_DC_SWAPCHAIN *psSwapChain) return eError; } - + for(i=0; iui32BufferCount; i++) { if(psSwapChain->asBuffer[i].sDeviceClassBuffer.psKernelSyncInfo) { PVRSRVKernelSyncInfoDecRef(psSwapChain->asBuffer[i].sDeviceClassBuffer.psKernelSyncInfo, IMG_NULL); - if (psSwapChain->asBuffer[i].sDeviceClassBuffer.psKernelSyncInfo->ui32RefCount == 0) - { - PVRSRVFreeSyncInfoKM(psSwapChain->asBuffer[i].sDeviceClassBuffer.psKernelSyncInfo); - } } } @@ -904,10 +894,10 @@ static PVRSRV_ERROR DestroyDCSwapChain(PVRSRV_DC_SWAPCHAIN *psSwapChain) OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_KERNEL_SYNC_INFO *) * psSwapChain->ui32LastNumSyncInfos, psSwapChain->ppsLastSyncInfos, IMG_NULL); } -#endif +#endif OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_DC_SWAPCHAIN), psSwapChain, IMG_NULL); - + return eError; } @@ -932,13 +922,13 @@ static PVRSRV_ERROR DestroyDCSwapChainRefCallBack(IMG_PVOID pvParam, &psSwapChainRef->psSwapChain->asBuffer[i].sDeviceClassBuffer, psSwapChainRef->psSwapChain->asBuffer[i].sDeviceClassBuffer.ui32MemMapRefCount)); #if 0 - + return PVRSRV_ERROR_STILL_MAPPED; #endif } } - if(--psSwapChainRef->psSwapChain->ui32RefCount == 0) + if(--psSwapChainRef->psSwapChain->ui32RefCount == 0) { eError = DestroyDCSwapChain(psSwapChainRef->psSwapChain); } @@ -952,9 +942,9 @@ static PVRSRV_DC_SWAPCHAIN* PVRSRVFindSharedDCSwapChainKM(PVRSRV_DISPLAYCLASS_IN { PVRSRV_DC_SWAPCHAIN *psCurrentSwapChain; - for(psCurrentSwapChain = psDCInfo->psDCSwapChainShared; - psCurrentSwapChain; - psCurrentSwapChain = psCurrentSwapChain->psNext) + for(psCurrentSwapChain = psDCInfo->psDCSwapChainShared; + psCurrentSwapChain; + psCurrentSwapChain = psCurrentSwapChain->psNext) { if(psCurrentSwapChain->ui32SwapChainID == ui32SwapChainID) return psCurrentSwapChain; @@ -963,12 +953,12 @@ static PVRSRV_DC_SWAPCHAIN* PVRSRVFindSharedDCSwapChainKM(PVRSRV_DISPLAYCLASS_IN } static PVRSRV_ERROR PVRSRVCreateDCSwapChainRefKM(PVRSRV_PER_PROCESS_DATA *psPerProc, - PVRSRV_DC_SWAPCHAIN *psSwapChain, + PVRSRV_DC_SWAPCHAIN *psSwapChain, PVRSRV_DC_SWAPCHAIN_REF **ppsSwapChainRef) { PVRSRV_DC_SWAPCHAIN_REF *psSwapChainRef = IMG_NULL; - + if(OSAllocMem( PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_DC_SWAPCHAIN_REF), (IMG_VOID **)&psSwapChainRef, IMG_NULL, @@ -979,10 +969,10 @@ static PVRSRV_ERROR PVRSRVCreateDCSwapChainRefKM(PVRSRV_PER_PROCESS_DATA *psPerP } OSMemSet (psSwapChainRef, 0, sizeof(PVRSRV_DC_SWAPCHAIN_REF)); - + psSwapChain->ui32RefCount++; - + psSwapChainRef->psSwapChain = psSwapChain; psSwapChainRef->hResItem = ResManRegisterRes(psPerProc->hResManContext, RESMAN_TYPE_DISPLAYCLASS_SWAPCHAIN_REF, @@ -1042,15 +1032,15 @@ PVRSRV_ERROR PVRSRVCreateDCSwapChainKM (PVRSRV_PER_PROCESS_DATA *psPerProc, if( ui32Flags & PVRSRV_CREATE_SWAPCHAIN_QUERY ) { - + psSwapChain = PVRSRVFindSharedDCSwapChainKM(psDCInfo, *pui32SwapChainID ); - if( psSwapChain ) - { - - eError = PVRSRVCreateDCSwapChainRefKM(psPerProc, - psSwapChain, + if( psSwapChain ) + { + + eError = PVRSRVCreateDCSwapChainRefKM(psPerProc, + psSwapChain, &psSwapChainRef); - if( eError != PVRSRV_OK ) + if( eError != PVRSRV_OK ) { PVR_DPF((PVR_DBG_ERROR,"PVRSRVCreateDCSwapChainKM: Couldn't create swap chain reference")); return eError; @@ -1060,10 +1050,10 @@ PVRSRV_ERROR PVRSRVCreateDCSwapChainKM (PVRSRV_PER_PROCESS_DATA *psPerProc, return PVRSRV_OK; } PVR_DPF((PVR_DBG_ERROR,"PVRSRVCreateDCSwapChainKM: No shared SwapChain found for query")); - return PVRSRV_ERROR_FLIP_CHAIN_EXISTS; + return PVRSRV_ERROR_FLIP_CHAIN_EXISTS; } - + if(OSAllocMem( PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_DC_SWAPCHAIN), (IMG_VOID **)&psSwapChain, IMG_NULL, @@ -1075,7 +1065,7 @@ PVRSRV_ERROR PVRSRVCreateDCSwapChainKM (PVRSRV_PER_PROCESS_DATA *psPerProc, } OSMemSet (psSwapChain, 0, sizeof(PVRSRV_DC_SWAPCHAIN)); - + eError = PVRSRVCreateCommandQueueKM(1024, &psQueue); if(eError != PVRSRV_OK) { @@ -1083,10 +1073,10 @@ PVRSRV_ERROR PVRSRVCreateDCSwapChainKM (PVRSRV_PER_PROCESS_DATA *psPerProc, goto ErrorExit; } - + psSwapChain->psQueue = psQueue; - + for(i=0; iasBuffer[i].sDeviceClassBuffer.psKernelSyncInfo, IMG_NULL); - - + psSwapChain->asBuffer[i].sDeviceClassBuffer.pfnGetBufferAddr = psDCInfo->psFuncTable->pfnGetBufferAddr; psSwapChain->asBuffer[i].sDeviceClassBuffer.hDevMemContext = psDCInfo->hDevMemContext; psSwapChain->asBuffer[i].sDeviceClassBuffer.hExtDevice = psDCInfo->hExtDevice; - + psSwapChain->asBuffer[i].psDCInfo = psDCInfo; psSwapChain->asBuffer[i].psSwapChain = psSwapChain; - + apsSyncData[i] = (PVRSRV_SYNC_DATA*)psSwapChain->asBuffer[i].sDeviceClassBuffer.psKernelSyncInfo->psSyncDataMemInfoKM->pvLinAddrKM; } @@ -1134,11 +1122,11 @@ PVRSRV_ERROR PVRSRVCreateDCSwapChainKM (PVRSRV_PER_PROCESS_DATA *psPerProc, PVR_DPF((PVR_DBG_ERROR,"PVRSRVCreateDCSwapChainKM: Failed to get DC info")); return eError; } - + psSwapChain->ui32MinSwapInterval = sDisplayInfo.ui32MinSwapInterval; psSwapChain->ui32MaxSwapInterval = sDisplayInfo.ui32MaxSwapInterval; - + eError = psDCInfo->psFuncTable->pfnCreateDCSwapChain(psDCInfo->hExtDevice, ui32Flags, psDstSurfAttrib, @@ -1155,11 +1143,11 @@ PVRSRV_ERROR PVRSRVCreateDCSwapChainKM (PVRSRV_PER_PROCESS_DATA *psPerProc, goto ErrorExit; } - - eError = PVRSRVCreateDCSwapChainRefKM(psPerProc, - psSwapChain, + + eError = PVRSRVCreateDCSwapChainRefKM(psPerProc, + psSwapChain, &psSwapChainRef); - if( eError != PVRSRV_OK ) + if( eError != PVRSRV_OK ) { PVR_DPF((PVR_DBG_ERROR,"PVRSRVCreateDCSwapChainKM: Couldn't create swap chain reference")); PDUMPCOMMENT("Swapchain allocation failed."); @@ -1169,25 +1157,25 @@ PVRSRV_ERROR PVRSRVCreateDCSwapChainKM (PVRSRV_PER_PROCESS_DATA *psPerProc, psSwapChain->ui32RefCount = 1; psSwapChain->ui32Flags = ui32Flags; - + if( ui32Flags & PVRSRV_CREATE_SWAPCHAIN_SHARED ) { - if(! psDCInfo->psDCSwapChainShared ) + if(! psDCInfo->psDCSwapChainShared ) { psDCInfo->psDCSwapChainShared = psSwapChain; - } - else - { + } + else + { PVRSRV_DC_SWAPCHAIN *psOldHead = psDCInfo->psDCSwapChainShared; psDCInfo->psDCSwapChainShared = psSwapChain; psSwapChain->psNext = psOldHead; } } - + *pui32SwapChainID = psSwapChain->ui32SwapChainID; - + *phSwapChainRef= (IMG_HANDLE)psSwapChainRef; return eError; @@ -1199,10 +1187,6 @@ ErrorExit: if(psSwapChain->asBuffer[i].sDeviceClassBuffer.psKernelSyncInfo) { PVRSRVKernelSyncInfoDecRef(psSwapChain->asBuffer[i].sDeviceClassBuffer.psKernelSyncInfo, IMG_NULL); - if (psSwapChain->asBuffer[i].sDeviceClassBuffer.psKernelSyncInfo->ui32RefCount == 0) - { - PVRSRVFreeSyncInfoKM(psSwapChain->asBuffer[i].sDeviceClassBuffer.psKernelSyncInfo); - } } } @@ -1214,7 +1198,7 @@ ErrorExit: if(psSwapChain) { OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_DC_SWAPCHAIN), psSwapChain, IMG_NULL); - + } return eError; @@ -1337,7 +1321,7 @@ PVRSRV_ERROR PVRSRVGetDCBuffersKM(IMG_HANDLE hDeviceKM, psDCInfo = DCDeviceHandleToDCInfo(hDeviceKM); psSwapChain = ((PVRSRV_DC_SWAPCHAIN_REF*)hSwapChainRef)->psSwapChain; - + eError = psDCInfo->psFuncTable->pfnGetDCBuffers(psDCInfo->hExtDevice, psSwapChain->hExtSwapChain, pui32BufferCount, @@ -1345,7 +1329,7 @@ PVRSRV_ERROR PVRSRVGetDCBuffersKM(IMG_HANDLE hDeviceKM, PVR_ASSERT(*pui32BufferCount <= PVRSRV_MAX_DC_SWAPCHAIN_BUFFERS); - + for(i=0; i<*pui32BufferCount; i++) @@ -1378,7 +1362,7 @@ PVRSRV_ERROR PVRSRVGetDCBuffersKM(IMG_HANDLE hDeviceKM, psPhyAddr[i] = *pPhyAddr; } -#endif +#endif return eError; } @@ -1414,7 +1398,7 @@ PVRSRV_ERROR PVRSRVSwapToDCBufferKM(IMG_HANDLE hDeviceKM, psBuffer = (PVRSRV_DC_BUFFER*)hBuffer; psDCInfo = DCDeviceHandleToDCInfo(hDeviceKM); - + if(ui32SwapInterval < psBuffer->psSwapChain->ui32MinSwapInterval || ui32SwapInterval > psBuffer->psSwapChain->ui32MaxSwapInterval) { @@ -1429,34 +1413,34 @@ PVRSRV_ERROR PVRSRVSwapToDCBufferKM(IMG_HANDLE hDeviceKM, { psDCInfo->psFuncTable->pfnQuerySwapCommandID(psDCInfo->hExtDevice, psBuffer->psSwapChain->hExtSwapChain, - psBuffer->sDeviceClassBuffer.hExtBuffer, - hPrivateTag, + psBuffer->sDeviceClassBuffer.hExtBuffer, + hPrivateTag, &ui16SwapCommandID, &bAddReferenceToLast); - + } #endif - + psQueue = psBuffer->psSwapChain->psQueue; - + apsSrcSync[0] = psBuffer->sDeviceClassBuffer.psKernelSyncInfo; - + if(bAddReferenceToLast && psBuffer->psSwapChain->psLastFlipBuffer && psBuffer != psBuffer->psSwapChain->psLastFlipBuffer) { apsSrcSync[1] = psBuffer->psSwapChain->psLastFlipBuffer->sDeviceClassBuffer.psKernelSyncInfo; - + ui32NumSrcSyncs++; } - + eError = PVRSRVInsertCommandKM (psQueue, &psCommand, psDCInfo->ui32DeviceID, @@ -1474,37 +1458,37 @@ PVRSRV_ERROR PVRSRVSwapToDCBufferKM(IMG_HANDLE hDeviceKM, goto Exit; } - + psFlipCmd = (DISPLAYCLASS_FLIP_COMMAND*)psCommand->pvData; - + psFlipCmd->hExtDevice = psDCInfo->hExtDevice; - + psFlipCmd->hExtSwapChain = psBuffer->psSwapChain->hExtSwapChain; - + psFlipCmd->hExtBuffer = psBuffer->sDeviceClassBuffer.hExtBuffer; - + psFlipCmd->hPrivateTag = hPrivateTag; - + psFlipCmd->ui32ClipRectCount = ui32ClipRectCount; - - psFlipCmd->psClipRect = (IMG_RECT*)((IMG_UINT8*)psFlipCmd + sizeof(DISPLAYCLASS_FLIP_COMMAND)); - + + psFlipCmd->psClipRect = (IMG_RECT*)((IMG_UINT8*)psFlipCmd + sizeof(DISPLAYCLASS_FLIP_COMMAND)); + for(i=0; ipsClipRect[i] = psClipRect[i]; } - + psFlipCmd->ui32SwapInterval = ui32SwapInterval; SysAcquireData(&psSysData); - + { if(psSysData->ePendingCacheOpType == PVRSRV_MISC_INFO_CPUCACHEOP_FLUSH) { @@ -1518,7 +1502,7 @@ PVRSRV_ERROR PVRSRVSwapToDCBufferKM(IMG_HANDLE hDeviceKM, psSysData->ePendingCacheOpType = PVRSRV_MISC_INFO_CPUCACHEOP_NONE; } - + eError = PVRSRVSubmitCommandKM (psQueue, psCommand); if (eError != PVRSRV_OK) { @@ -1526,7 +1510,7 @@ PVRSRV_ERROR PVRSRVSwapToDCBufferKM(IMG_HANDLE hDeviceKM, goto Exit; } - + eError = OSScheduleMISR(psSysData); @@ -1536,7 +1520,7 @@ PVRSRV_ERROR PVRSRVSwapToDCBufferKM(IMG_HANDLE hDeviceKM, goto Exit; } - + psBuffer->psSwapChain->psLastFlipBuffer = psBuffer; psDCInfo->psDCSwapChainCur = psBuffer->psSwapChain; @@ -1611,7 +1595,7 @@ PVRSRV_ERROR PVRSRVSwapToDCBuffer2KM(IMG_HANDLE hDeviceKM, psSwapChain = ((PVRSRV_DC_SWAPCHAIN_REF*)hSwapChain)->psSwapChain; psDCInfo = DCDeviceHandleToDCInfo(hDeviceKM); - + if(ui32SwapInterval < psSwapChain->ui32MinSwapInterval || ui32SwapInterval > psSwapChain->ui32MaxSwapInterval) { @@ -1650,7 +1634,7 @@ PVRSRV_ERROR PVRSRVSwapToDCBuffer2KM(IMG_HANDLE hDeviceKM, psCallbackData->ppvMemInfos = ppvMemInfos; psCallbackData->ui32NumMemInfos = ui32NumMemSyncInfos; - + psQueue = psSwapChain->psQueue; #if !defined(SUPPORT_DC_CMDCOMPLETE_WHEN_NO_LONGER_DISPLAYED) @@ -1687,7 +1671,7 @@ PVRSRV_ERROR PVRSRVSwapToDCBuffer2KM(IMG_HANDLE hDeviceKM, PVR_DPF((PVR_DBG_ERROR,"PVRSRVSwapToDCBuffer2KM: Failed to allocate space for meminfo list")); goto Exit; } - + OSMemCopy(ppsCompiledSyncInfos, ppsSyncInfos, sizeof(PVRSRV_KERNEL_SYNC_INFO *) * ui32NumMemSyncInfos); for(j = 0, i = ui32NumMemSyncInfos; j < psSwapChain->ui32LastNumSyncInfos; j++) { @@ -1699,13 +1683,13 @@ PVRSRV_ERROR PVRSRVSwapToDCBuffer2KM(IMG_HANDLE hDeviceKM, } } else -#endif +#endif { ppsCompiledSyncInfos = ppsSyncInfos; ui32NumCompiledSyncInfos = ui32NumMemSyncInfos; } - + eError = PVRSRVInsertCommandKM (psQueue, &psCommand, psDCInfo->ui32DeviceID, @@ -1731,34 +1715,34 @@ PVRSRV_ERROR PVRSRVSwapToDCBuffer2KM(IMG_HANDLE hDeviceKM, goto Exit; } - + psFlipCmd = (DISPLAYCLASS_FLIP_COMMAND2*)psCommand->pvData; - + psFlipCmd->hUnused = IMG_NULL; - + psFlipCmd->hExtDevice = psDCInfo->hExtDevice; - + psFlipCmd->hExtSwapChain = psSwapChain->hExtSwapChain; - + psFlipCmd->ui32SwapInterval = ui32SwapInterval; - + psFlipCmd->pvPrivData = pvPrivData; psFlipCmd->ui32PrivDataLength = ui32PrivDataLength; psFlipCmd->ppsMemInfos = (PDC_MEM_INFO *)ppvMemInfos; psFlipCmd->ui32NumMemInfos = ui32NumMemSyncInfos; - + psFlipCmd->hUnused = IMG_NULL; SysAcquireData(&psSysData); - + { if(psSysData->ePendingCacheOpType == PVRSRV_MISC_INFO_CPUCACHEOP_FLUSH) { @@ -1772,7 +1756,7 @@ PVRSRV_ERROR PVRSRVSwapToDCBuffer2KM(IMG_HANDLE hDeviceKM, psSysData->ePendingCacheOpType = PVRSRV_MISC_INFO_CPUCACHEOP_NONE; } - + eError = PVRSRVSubmitCommandKM (psQueue, psCommand); if (eError != PVRSRV_OK) { @@ -1780,10 +1764,10 @@ PVRSRV_ERROR PVRSRVSwapToDCBuffer2KM(IMG_HANDLE hDeviceKM, goto Exit; } - + psCallbackData = IMG_NULL; - + eError = OSScheduleMISR(psSysData); @@ -1794,7 +1778,7 @@ PVRSRV_ERROR PVRSRVSwapToDCBuffer2KM(IMG_HANDLE hDeviceKM, } #if !defined(SUPPORT_DC_CMDCOMPLETE_WHEN_NO_LONGER_DISPLAYED) - + if (psSwapChain->ui32LastNumSyncInfos < ui32NumMemSyncInfos) { if (psSwapChain->ppsLastSyncInfos) @@ -1819,7 +1803,7 @@ PVRSRV_ERROR PVRSRVSwapToDCBuffer2KM(IMG_HANDLE hDeviceKM, { psSwapChain->ppsLastSyncInfos[i] = ppsSyncInfos[i]; } -#endif +#endif Exit: if (psCallbackData) @@ -1868,7 +1852,7 @@ PVRSRV_ERROR PVRSRVSwapToDCSystemKM(IMG_HANDLE hDeviceKM, psSwapChainRef = (PVRSRV_DC_SWAPCHAIN_REF*)hSwapChainRef; psSwapChain = psSwapChainRef->psSwapChain; - + psQueue = psSwapChain->psQueue; #if defined(SUPPORT_CUSTOM_SWAP_OPERATIONS) @@ -1877,34 +1861,34 @@ PVRSRV_ERROR PVRSRVSwapToDCSystemKM(IMG_HANDLE hDeviceKM, { psDCInfo->psFuncTable->pfnQuerySwapCommandID(psDCInfo->hExtDevice, psSwapChain->hExtSwapChain, - psDCInfo->sSystemBuffer.sDeviceClassBuffer.hExtBuffer, - 0, + psDCInfo->sSystemBuffer.sDeviceClassBuffer.hExtBuffer, + 0, &ui16SwapCommandID, &bAddReferenceToLast); - + } #endif - + apsSrcSync[0] = psDCInfo->sSystemBuffer.sDeviceClassBuffer.psKernelSyncInfo; - + if(bAddReferenceToLast && psSwapChain->psLastFlipBuffer) { - + if (apsSrcSync[0] != psSwapChain->psLastFlipBuffer->sDeviceClassBuffer.psKernelSyncInfo) { apsSrcSync[1] = psSwapChain->psLastFlipBuffer->sDeviceClassBuffer.psKernelSyncInfo; - + ui32NumSrcSyncs++; } } - + eError = PVRSRVInsertCommandKM (psQueue, &psCommand, psDCInfo->ui32DeviceID, @@ -1922,27 +1906,27 @@ PVRSRV_ERROR PVRSRVSwapToDCSystemKM(IMG_HANDLE hDeviceKM, goto Exit; } - + psFlipCmd = (DISPLAYCLASS_FLIP_COMMAND*)psCommand->pvData; - + psFlipCmd->hExtDevice = psDCInfo->hExtDevice; - + psFlipCmd->hExtSwapChain = psSwapChain->hExtSwapChain; - + psFlipCmd->hExtBuffer = psDCInfo->sSystemBuffer.sDeviceClassBuffer.hExtBuffer; - + psFlipCmd->hPrivateTag = IMG_NULL; - + psFlipCmd->ui32ClipRectCount = 0; psFlipCmd->ui32SwapInterval = 1; - + eError = PVRSRVSubmitCommandKM (psQueue, psCommand); if (eError != PVRSRV_OK) { @@ -1950,7 +1934,7 @@ PVRSRV_ERROR PVRSRVSwapToDCSystemKM(IMG_HANDLE hDeviceKM, goto Exit; } - + SysAcquireData(&psSysData); eError = OSScheduleMISR(psSysData); @@ -1960,7 +1944,7 @@ PVRSRV_ERROR PVRSRVSwapToDCSystemKM(IMG_HANDLE hDeviceKM, goto Exit; } - + psSwapChain->psLastFlipBuffer = &psDCInfo->sSystemBuffer; psDCInfo->psDCSwapChainCur = psSwapChain; @@ -2054,7 +2038,7 @@ PVRSRV_ERROR PVRSRVRegisterSystemISRHandler (PFN_ISR_HANDLER pfnISRHandler, SysAcquireData(&psSysData); - + psDevNode = (PVRSRV_DEVICE_NODE*) List_PVRSRV_DEVICE_NODE_Any_va(psSysData->psDeviceNodeList, &MatchDeviceKM_AnyVaCb, @@ -2068,10 +2052,10 @@ PVRSRV_ERROR PVRSRVRegisterSystemISRHandler (PFN_ISR_HANDLER pfnISRHandler, return PVRSRV_ERROR_NO_DEVICENODE_FOUND; } - + psDevNode->pvISRData = (IMG_VOID*) pvISRHandlerData; - + psDevNode->pfnDeviceISR = pfnISRHandler; return PVRSRV_OK; @@ -2175,7 +2159,7 @@ PVRSRV_ERROR PVRSRVCloseBCDeviceKM (IMG_HANDLE hDeviceKM, psBCPerContextInfo = (PVRSRV_BUFFERCLASS_PERCONTEXT_INFO *)hDeviceKM; - + eError = ResManFreeResByPtr(psBCPerContextInfo->hResItem, CLEANUP_WITH_POLL); return eError; @@ -2217,23 +2201,19 @@ static PVRSRV_ERROR CloseBCDeviceCallBack(IMG_PVOID pvParam, if(psBCInfo->ui32RefCount == 0) { - + psBCInfo->psFuncTable->pfnCloseBCDevice(psBCInfo->ui32DeviceID, psBCInfo->hExtDevice); - + for(i=0; iui32BufferCount; i++) { if(psBCInfo->psBuffer[i].sDeviceClassBuffer.psKernelSyncInfo) { PVRSRVKernelSyncInfoDecRef(psBCInfo->psBuffer[i].sDeviceClassBuffer.psKernelSyncInfo, IMG_NULL); - if (psBCInfo->psBuffer[i].sDeviceClassBuffer.psKernelSyncInfo->ui32RefCount == 0) - { - PVRSRVFreeSyncInfoKM(psBCInfo->psBuffer[i].sDeviceClassBuffer.psKernelSyncInfo); - } } } - + if(psBCInfo->psBuffer) { OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_BC_BUFFER) * psBCInfo->ui32BufferCount, psBCInfo->psBuffer, IMG_NULL); @@ -2242,7 +2222,7 @@ static PVRSRV_ERROR CloseBCDeviceCallBack(IMG_PVOID pvParam, } OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_BUFFERCLASS_PERCONTEXT_INFO), psBCPerContextInfo, IMG_NULL); - + return PVRSRV_OK; } @@ -2269,7 +2249,7 @@ PVRSRV_ERROR PVRSRVOpenBCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, SysAcquireData(&psSysData); - + psDeviceNode = (PVRSRV_DEVICE_NODE*) List_PVRSRV_DEVICE_NODE_Any_va(psSysData->psDeviceNodeList, &MatchDeviceKM_AnyVaCb, @@ -2283,7 +2263,7 @@ PVRSRV_ERROR PVRSRVOpenBCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, } psBCInfo = (PVRSRV_BUFFERCLASS_INFO*)psDeviceNode->pvDevice; - + if(OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, @@ -2302,10 +2282,10 @@ PVRSRV_ERROR PVRSRVOpenBCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, psDeviceNode = (PVRSRV_DEVICE_NODE *)hDevCookie; - + psBCInfo->hDevMemContext = (IMG_HANDLE)psDeviceNode->sDevMemoryInfo.pBMKernelContext; - + eError = psBCInfo->psFuncTable->pfnOpenBCDevice(ui32DeviceID, &psBCInfo->hExtDevice); if(eError != PVRSRV_OK) { @@ -2313,7 +2293,7 @@ PVRSRV_ERROR PVRSRVOpenBCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, return eError; } - + eError = psBCInfo->psFuncTable->pfnGetBCInfo(psBCInfo->hExtDevice, &sBufferInfo); if(eError != PVRSRV_OK) { @@ -2321,15 +2301,15 @@ PVRSRV_ERROR PVRSRVOpenBCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, return eError; } - + psBCInfo->ui32BufferCount = sBufferInfo.ui32BufferCount; - + if(sBufferInfo.ui32BufferCount == 0) { // reference count is not increased if buffer count is zero psBCInfo->ui32RefCount = 0; } - + eError = OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_BC_BUFFER) * sBufferInfo.ui32BufferCount, (IMG_VOID **)&psBCInfo->psBuffer, @@ -2346,7 +2326,7 @@ PVRSRV_ERROR PVRSRVOpenBCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, for(i=0; iui32BufferCount; i++) { - + eError = PVRSRVAllocSyncInfoKM(IMG_NULL, psBCInfo->hDevMemContext, &psBCInfo->psBuffer[i].sDeviceClassBuffer.psKernelSyncInfo); @@ -2355,10 +2335,8 @@ PVRSRV_ERROR PVRSRVOpenBCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, PVR_DPF((PVR_DBG_ERROR,"PVRSRVOpenBCDeviceKM: Failed sync info alloc")); goto ErrorExit; } - - PVRSRVKernelSyncInfoIncRef(psBCInfo->psBuffer[i].sDeviceClassBuffer.psKernelSyncInfo, IMG_NULL); - - + + eError = psBCInfo->psFuncTable->pfnGetBCBuffer(psBCInfo->hExtDevice, @@ -2371,7 +2349,7 @@ PVRSRV_ERROR PVRSRVOpenBCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, goto ErrorExit; } - + psBCInfo->psBuffer[i].sDeviceClassBuffer.pfnGetBufferAddr = psBCInfo->psFuncTable->pfnGetBufferAddr; psBCInfo->psBuffer[i].sDeviceClassBuffer.hDevMemContext = psBCInfo->hDevMemContext; psBCInfo->psBuffer[i].sDeviceClassBuffer.hExtDevice = psBCInfo->hExtDevice; @@ -2386,7 +2364,7 @@ PVRSRV_ERROR PVRSRVOpenBCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, 0, &CloseBCDeviceCallBack); - + *phDeviceKM = (IMG_HANDLE)psBCPerContextInfo; return PVRSRV_OK; @@ -2395,20 +2373,16 @@ ErrorExit: if(psBCInfo->ui32RefCount) psBCInfo->ui32RefCount--; - + for(i=0; iui32BufferCount; i++) { if(psBCInfo->psBuffer[i].sDeviceClassBuffer.psKernelSyncInfo) { PVRSRVKernelSyncInfoDecRef(psBCInfo->psBuffer[i].sDeviceClassBuffer.psKernelSyncInfo, IMG_NULL); - if (psBCInfo->psBuffer[i].sDeviceClassBuffer.psKernelSyncInfo->ui32RefCount == 0) - { - PVRSRVFreeSyncInfoKM(psBCInfo->psBuffer[i].sDeviceClassBuffer.psKernelSyncInfo); - } } } - + if(psBCInfo->psBuffer) { OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_BC_BUFFER), psBCInfo->psBuffer, IMG_NULL); diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/deviceid.h b/drivers/staging/mrst/pvr/services4/srvkm/common/deviceid.h index 2de8413..9a7bdb3 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/deviceid.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/deviceid.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -33,4 +33,4 @@ PVRSRV_ERROR AllocateDeviceID(SYS_DATA *psSysData, IMG_UINT32 *pui32DevID); PVRSRV_ERROR FreeDeviceID(SYS_DATA *psSysData, IMG_UINT32 ui32DevID); -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/devicemem.c b/drivers/staging/mrst/pvr/services4/srvkm/common/devicemem.c index 866c67a..8874d61 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/devicemem.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/devicemem.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -43,9 +43,9 @@ static PVRSRV_ERROR AllocDeviceMem(IMG_HANDLE hDevCookie, typedef struct _RESMAN_MAP_DEVICE_MEM_DATA_ { - + PVRSRV_KERNEL_MEM_INFO *psMemInfo; - + PVRSRV_KERNEL_MEM_INFO *psSrcMemInfo; } RESMAN_MAP_DEVICE_MEM_DATA; @@ -82,22 +82,23 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetDeviceMemHeapsKM(IMG_HANDLE hDevCookie, psDeviceNode = (PVRSRV_DEVICE_NODE *)hDevCookie; - + ui32HeapCount = psDeviceNode->sDevMemoryInfo.ui32HeapCount; psDeviceMemoryHeap = psDeviceNode->sDevMemoryInfo.psDeviceMemoryHeap; - + PVR_ASSERT(ui32HeapCount <= PVRSRV_MAX_CLIENT_HEAPS); - + for(i=0; isDevMemoryInfo.ui32HeapCount; psDeviceMemoryHeap = psDeviceNode->sDevMemoryInfo.psDeviceMemoryHeap; - + PVR_ASSERT(ui32HeapCount <= PVRSRV_MAX_CLIENT_HEAPS); - + hDevMemContext = BM_CreateContext(psDeviceNode, &sPDDevPAddr, @@ -165,14 +166,14 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateDeviceMemContextKM(IMG_HANDLE hDevCook return PVRSRV_ERROR_OUT_OF_MEMORY; } - + for(i=0; isDevMemoryInfo.ui32HeapCount; psDeviceMemoryHeap = psDeviceNode->sDevMemoryInfo.psDeviceMemoryHeap; - + PVR_ASSERT(ui32HeapCount <= PVRSRV_MAX_CLIENT_HEAPS); - + for(i=0; isMemBlk); - + psMemInfo->ui32Flags = ui32Flags | PVRSRV_MEM_RAM_BACKED_ALLOCATION; bBMError = BM_Alloc (hDevMemHeap, @@ -396,18 +397,18 @@ static PVRSRV_ERROR AllocDeviceMem(IMG_HANDLE hDevCookie, { PVR_DPF((PVR_DBG_ERROR,"AllocDeviceMem: BM_Alloc Failed")); OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(PVRSRV_KERNEL_MEM_INFO), psMemInfo, IMG_NULL); - + return PVRSRV_ERROR_OUT_OF_MEMORY; } - + psMemBlock->sDevVirtAddr = BM_HandleToDevVaddr(hBuffer); psMemBlock->hOSMemHandle = BM_HandleToOSMemHandle(hBuffer); - + psMemBlock->hBuffer = (IMG_HANDLE)hBuffer; - + psMemInfo->pvLinAddrKM = BM_HandleToCpuVaddr(hBuffer); @@ -415,13 +416,13 @@ static PVRSRV_ERROR AllocDeviceMem(IMG_HANDLE hDevCookie, psMemInfo->uAllocSize = ui32Size; - + psMemInfo->pvSysBackupBuffer = IMG_NULL; - + *ppsMemInfo = psMemInfo; - + return (PVRSRV_OK); } @@ -436,7 +437,7 @@ static PVRSRV_ERROR FreeDeviceMem2(PVRSRV_KERNEL_MEM_INFO *psMemInfo, PVRSRV_FRE hBuffer = psMemInfo->sMemBlk.hBuffer; - + switch(eCallbackOrigin) { case PVRSRV_FREE_CALLBACK_ORIGIN_ALLOCATOR: @@ -449,18 +450,18 @@ static PVRSRV_ERROR FreeDeviceMem2(PVRSRV_KERNEL_MEM_INFO *psMemInfo, PVRSRV_FRE break; } - + if (psMemInfo->pvSysBackupBuffer && eCallbackOrigin == PVRSRV_FREE_CALLBACK_ORIGIN_ALLOCATOR) { - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, psMemInfo->uAllocSize, psMemInfo->pvSysBackupBuffer, IMG_NULL); psMemInfo->pvSysBackupBuffer = IMG_NULL; } if (psMemInfo->ui32RefCount == 0) OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(PVRSRV_KERNEL_MEM_INFO), psMemInfo, IMG_NULL); - + return(PVRSRV_OK); } @@ -476,18 +477,18 @@ static PVRSRV_ERROR FreeDeviceMem(PVRSRV_KERNEL_MEM_INFO *psMemInfo) hBuffer = psMemInfo->sMemBlk.hBuffer; - + BM_Free(hBuffer, psMemInfo->ui32Flags); if(psMemInfo->pvSysBackupBuffer) { - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, psMemInfo->uAllocSize, psMemInfo->pvSysBackupBuffer, IMG_NULL); psMemInfo->pvSysBackupBuffer = IMG_NULL; } OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(PVRSRV_KERNEL_MEM_INFO), psMemInfo, IMG_NULL); - + return(PVRSRV_OK); } @@ -515,16 +516,23 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVAllocSyncInfoKM(IMG_HANDLE hDevCookie, return PVRSRV_ERROR_OUT_OF_MEMORY; } - psKernelSyncInfo->ui32RefCount = 0; - + eError = OSAtomicAlloc(&psKernelSyncInfo->pvRefCount); + if (eError != PVRSRV_OK) + { + PVR_DPF((PVR_DBG_ERROR,"PVRSRVAllocSyncInfoKM: Failed to allocate atomic")); + OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(PVRSRV_KERNEL_SYNC_INFO), psKernelSyncInfo, IMG_NULL); + return PVRSRV_ERROR_OUT_OF_MEMORY; + } + + pBMContext = (BM_CONTEXT*)hDevMemContext; psDevMemoryInfo = &pBMContext->psDeviceNode->sDevMemoryInfo; - + hSyncDevMemHeap = psDevMemoryInfo->psDeviceMemoryHeap[psDevMemoryInfo->ui32SyncHeapID].hDevMemHeap; - + eError = AllocDeviceMem(hDevCookie, @@ -540,12 +548,13 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVAllocSyncInfoKM(IMG_HANDLE hDevCookie, { PVR_DPF((PVR_DBG_ERROR,"PVRSRVAllocSyncInfoKM: Failed to alloc memory")); + OSAtomicFree(psKernelSyncInfo->pvRefCount); OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(PVRSRV_KERNEL_SYNC_INFO), psKernelSyncInfo, IMG_NULL); - + return PVRSRV_ERROR_OUT_OF_MEMORY; } - + psKernelSyncInfo->psSyncData = psKernelSyncInfo->psSyncDataMemInfoKM->pvLinAddrKM; psSyncData = psKernelSyncInfo->psSyncData; @@ -557,6 +566,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVAllocSyncInfoKM(IMG_HANDLE hDevCookie, psSyncData->ui32ReadOps2Complete = 0; psSyncData->ui32LastOpDumpVal = 0; psSyncData->ui32LastReadOpDumpVal = 0; + psSyncData->ui64LastWrite = 0; #if defined(PDUMP) PDUMPCOMMENT("Allocating kernel sync object"); @@ -573,43 +583,44 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVAllocSyncInfoKM(IMG_HANDLE hDevCookie, psKernelSyncInfo->sReadOps2CompleteDevVAddr.uiAddr = psKernelSyncInfo->psSyncDataMemInfoKM->sDevVAddr.uiAddr + offsetof(PVRSRV_SYNC_DATA, ui32ReadOps2Complete); psKernelSyncInfo->ui32UID = g_ui32SyncUID++; - + psKernelSyncInfo->psSyncDataMemInfoKM->psKernelSyncInfo = IMG_NULL; + OSAtomicInc(psKernelSyncInfo->pvRefCount); + *ppsKernelSyncInfo = psKernelSyncInfo; return PVRSRV_OK; } - IMG_EXPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVFreeSyncInfoKM(PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo) +IMG_VOID PVRSRVAcquireSyncInfoKM(PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo) { - PVRSRV_ERROR eError; + OSAtomicInc(psKernelSyncInfo->pvRefCount); +} - if (psKernelSyncInfo->ui32RefCount != 0) +IMG_EXPORT +IMG_VOID IMG_CALLCONV PVRSRVReleaseSyncInfoKM(PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo) +{ + if (OSAtomicDecAndTest(psKernelSyncInfo->pvRefCount)) { - PVR_DPF((PVR_DBG_ERROR, "oops: sync info ref count not zero at destruction")); - - return PVRSRV_ERROR_OUT_OF_MEMORY; + FreeDeviceMem(psKernelSyncInfo->psSyncDataMemInfoKM); + + + psKernelSyncInfo->psSyncDataMemInfoKM = IMG_NULL; + psKernelSyncInfo->psSyncData = IMG_NULL; + OSAtomicFree(psKernelSyncInfo->pvRefCount); + (IMG_VOID)OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(PVRSRV_KERNEL_SYNC_INFO), psKernelSyncInfo, IMG_NULL); + } - - eError = FreeDeviceMem(psKernelSyncInfo->psSyncDataMemInfoKM); - - psKernelSyncInfo->psSyncDataMemInfoKM = IMG_NULL; - psKernelSyncInfo->psSyncData = IMG_NULL; - (IMG_VOID)OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(PVRSRV_KERNEL_SYNC_INFO), psKernelSyncInfo, IMG_NULL); - - - return eError; } static IMG_VOID freeWrapped(PVRSRV_KERNEL_MEM_INFO *psMemInfo) { IMG_HANDLE hOSWrapMem = psMemInfo->sMemBlk.hOSWrapMem; - + if(psMemInfo->sMemBlk.psIntSysPAddr) { OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(IMG_SYS_PHYADDR), psMemInfo->sMemBlk.psIntSysPAddr, IMG_NULL); @@ -652,14 +663,14 @@ PVRSRV_ERROR _PollUntilAtLeast(volatile IMG_UINT32* pui32WatchedValue, ui32Tries--; - + if (psSysData->psGlobalEventObject) { IMG_HANDLE hOSEventKM; if(psSysData->psGlobalEventObject) { eError = OSEventObjectOpenKM(psSysData->psGlobalEventObject, &hOSEventKM); - if (eError |= PVRSRV_OK) + if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR, "_PollUntilAtLeast: OSEventObjectOpen failed")); @@ -695,7 +706,7 @@ static PVRSRV_ERROR FlushKernelOps(PVRSRV_SYNC_DATA *psSyncData) return PVRSRV_ERROR_INVALID_PARAMS; } - + @@ -711,7 +722,7 @@ static PVRSRV_ERROR FlushKernelOps(PVRSRV_SYNC_DATA *psSyncData) if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR, "FlushClientOps: Read ops pending timeout")); - PVR_DBG_BREAK; + PVR_DBG_BREAK; return eError; } @@ -722,12 +733,12 @@ static PVRSRV_ERROR FlushKernelOps(PVRSRV_SYNC_DATA *psSyncData) if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR, "FlushClientOps: Write ops pending timeout")); - PVR_DBG_BREAK; + PVR_DBG_BREAK; } return eError; } -#endif +#endif IMG_EXPORT PVRSRV_ERROR FreeMemCallBackCommon(PVRSRV_KERNEL_MEM_INFO *psMemInfo, @@ -738,10 +749,10 @@ PVRSRV_ERROR FreeMemCallBackCommon(PVRSRV_KERNEL_MEM_INFO *psMemInfo, PVR_UNREFERENCED_PARAMETER(ui32Param); - + PVRSRVKernelMemInfoDecRef(psMemInfo); - + if (psMemInfo->ui32RefCount == 0) { if((psMemInfo->ui32Flags & PVRSRV_MEM_EXPORTED) != 0) @@ -752,7 +763,7 @@ PVRSRV_ERROR FreeMemCallBackCommon(PVRSRV_KERNEL_MEM_INFO *psMemInfo, IMG_HANDLE hMemInfo = IMG_NULL; #endif - + eError = PVRSRVFindHandle(KERNEL_HANDLE_BASE, &hMemInfo, psMemInfo, @@ -763,7 +774,7 @@ PVRSRV_ERROR FreeMemCallBackCommon(PVRSRV_KERNEL_MEM_INFO *psMemInfo, return eError; } - + eError = PVRSRVReleaseHandle(KERNEL_HANDLE_BASE, hMemInfo, PVRSRV_HANDLE_TYPE_MEM_INFO); @@ -785,20 +796,15 @@ PVRSRV_ERROR FreeMemCallBackCommon(PVRSRV_KERNEL_MEM_INFO *psMemInfo, #endif switch(psMemInfo->memType) { - + case PVRSRV_MEMTYPE_WRAPPED: freeWrapped(psMemInfo); case PVRSRV_MEMTYPE_DEVICE: + case PVRSRV_MEMTYPE_DEVICECLASS: if (psMemInfo->psKernelSyncInfo) { PVRSRVKernelSyncInfoDecRef(psMemInfo->psKernelSyncInfo, psMemInfo); - - if (psMemInfo->psKernelSyncInfo->ui32RefCount == 0) - { - eError = PVRSRVFreeSyncInfoKM(psMemInfo->psKernelSyncInfo); - } } - case PVRSRV_MEMTYPE_DEVICECLASS: break; default: PVR_DPF((PVR_DBG_ERROR, "FreeMemCallBackCommon: Unknown memType")); @@ -806,7 +812,7 @@ PVRSRV_ERROR FreeMemCallBackCommon(PVRSRV_KERNEL_MEM_INFO *psMemInfo, } } - + if (eError == PVRSRV_OK) { eError = FreeDeviceMem2(psMemInfo, eCallbackOrigin); @@ -820,7 +826,7 @@ static PVRSRV_ERROR FreeDeviceMemCallBack(IMG_PVOID pvParam, IMG_BOOL bDummy) { PVRSRV_KERNEL_MEM_INFO *psMemInfo = (PVRSRV_KERNEL_MEM_INFO *)pvParam; - + PVR_UNREFERENCED_PARAMETER(bDummy); return FreeMemCallBackCommon(psMemInfo, ui32Param, @@ -847,7 +853,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVFreeDeviceMemKM(IMG_HANDLE hDevCookie, } else { - + eError = FreeDeviceMemCallBack(psMemInfo, 0, CLEANUP_WITH_POLL); } @@ -877,10 +883,10 @@ PVRSRV_ERROR IMG_CALLCONV _PVRSRVAllocDeviceMemKM(IMG_HANDLE hDevCookie, return PVRSRV_ERROR_INVALID_PARAMS; } - + if (ui32Flags & PVRSRV_HAP_CACHETYPE_MASK) { - + if (((ui32Size % HOST_PAGESIZE()) != 0) || ((ui32Alignment % HOST_PAGESIZE()) != 0)) { @@ -908,7 +914,7 @@ PVRSRV_ERROR IMG_CALLCONV _PVRSRVAllocDeviceMemKM(IMG_HANDLE hDevCookie, } else { - + psBMHeap = (BM_HEAP*)hDevMemHeap; @@ -920,11 +926,9 @@ PVRSRV_ERROR IMG_CALLCONV _PVRSRVAllocDeviceMemKM(IMG_HANDLE hDevCookie, { goto free_mainalloc; } - - PVRSRVKernelSyncInfoIncRef(psMemInfo->psKernelSyncInfo, psMemInfo); } - + *ppsMemInfo = psMemInfo; if (ui32Flags & PVRSRV_MEM_NO_RESMAN) @@ -933,7 +937,7 @@ PVRSRV_ERROR IMG_CALLCONV _PVRSRVAllocDeviceMemKM(IMG_HANDLE hDevCookie, } else { - + psMemInfo->sMemBlk.hResItem = ResManRegisterRes(psPerProc->hResManContext, RESMAN_TYPE_DEVICEMEM_ALLOCATION, psMemInfo, @@ -941,27 +945,30 @@ PVRSRV_ERROR IMG_CALLCONV _PVRSRVAllocDeviceMemKM(IMG_HANDLE hDevCookie, &FreeDeviceMemCallBack); if (psMemInfo->sMemBlk.hResItem == IMG_NULL) { - + eError = PVRSRV_ERROR_OUT_OF_MEMORY; goto free_mainalloc; } } - + PVRSRVKernelMemInfoIncRef(psMemInfo); psMemInfo->memType = PVRSRV_MEMTYPE_DEVICE; - + return (PVRSRV_OK); free_mainalloc: + if (psMemInfo->psKernelSyncInfo) + { + PVRSRVKernelSyncInfoDecRef(psMemInfo->psKernelSyncInfo, psMemInfo); + } FreeDeviceMem(psMemInfo); return eError; } - IMG_EXPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVDissociateDeviceMemKM(IMG_HANDLE hDevCookie, PVRSRV_KERNEL_MEM_INFO *psMemInfo) @@ -990,7 +997,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetFreeDeviceMemKM(IMG_UINT32 ui32Flags, IMG_SIZE_T *pui32Free, IMG_SIZE_T *pui32LargestBlock) { - + PVR_UNREFERENCED_PARAMETER(ui32Flags); PVR_UNREFERENCED_PARAMETER(pui32Total); @@ -1020,7 +1027,7 @@ static PVRSRV_ERROR UnwrapExtMemoryCallBack(IMG_PVOID pvParam, IMG_BOOL bDummy) { PVRSRV_KERNEL_MEM_INFO *psMemInfo = (PVRSRV_KERNEL_MEM_INFO *)pvParam; - + PVR_UNREFERENCED_PARAMETER(bDummy); return FreeMemCallBackCommon(psMemInfo, ui32Param, @@ -1069,14 +1076,14 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVWrapExtMemoryKM(IMG_HANDLE hDevCookie, if(pvLinAddr) { - + uPageOffset = (IMG_UINTPTR_T)pvLinAddr & (ui32HostPageSize - 1); - + uPageCount = HOST_PAGEALIGN(uByteSize + uPageOffset) / ui32HostPageSize; pvPageAlignedCPUVAddr = (IMG_VOID *)((IMG_UINTPTR_T)pvLinAddr - uPageOffset); - + if(OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, uPageCount * sizeof(IMG_SYS_PHYADDR), (IMG_VOID **)&psIntSysPAddr, IMG_NULL, @@ -1097,19 +1104,19 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVWrapExtMemoryKM(IMG_HANDLE hDevCookie, goto ErrorExitPhase1; } - + psExtSysPAddr = psIntSysPAddr; - + bPhysContig = IMG_FALSE; } else { - + } - + psDevMemoryInfo = &((BM_CONTEXT*)hDevMemContext)->psDeviceNode->sDevMemoryInfo; psDeviceMemoryHeap = psDevMemoryInfo->psDeviceMemoryHeap; for(i=0; i 0) { hDevMemHeap = BM_CreateHeap(hDevMemContext, &psDeviceMemoryHeap[i]); @@ -1173,25 +1180,25 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVWrapExtMemoryKM(IMG_HANDLE hDevCookie, goto ErrorExitPhase3; } - + psMemBlock->sDevVirtAddr = BM_HandleToDevVaddr(hBuffer); psMemBlock->hOSMemHandle = BM_HandleToOSMemHandle(hBuffer); psMemBlock->hOSWrapMem = hOSWrapMem; psMemBlock->psIntSysPAddr = psIntSysPAddr; - + psMemBlock->hBuffer = (IMG_HANDLE)hBuffer; - + psMemInfo->pvLinAddrKM = BM_HandleToCpuVaddr(hBuffer); psMemInfo->sDevVAddr = psMemBlock->sDevVirtAddr; psMemInfo->uAllocSize = uByteSize; - + psMemInfo->pvSysBackupBuffer = IMG_NULL; - + psBMHeap = (BM_HEAP*)hDevMemHeap; @@ -1204,32 +1211,30 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVWrapExtMemoryKM(IMG_HANDLE hDevCookie, goto ErrorExitPhase4; } - PVRSRVKernelSyncInfoIncRef(psMemInfo->psKernelSyncInfo, psMemInfo); - - + PVRSRVKernelMemInfoIncRef(psMemInfo); psMemInfo->memType = PVRSRV_MEMTYPE_WRAPPED; - + psMemInfo->sMemBlk.hResItem = ResManRegisterRes(psPerProc->hResManContext, RESMAN_TYPE_DEVICEMEM_WRAP, psMemInfo, 0, &UnwrapExtMemoryCallBack); - + *ppsMemInfo = psMemInfo; return PVRSRV_OK; - + ErrorExitPhase4: if(psMemInfo) { FreeDeviceMem(psMemInfo); - + psMemInfo = IMG_NULL; @@ -1239,7 +1244,7 @@ ErrorExitPhase3: if(psMemInfo) { OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_KERNEL_MEM_INFO), psMemInfo, IMG_NULL); - + } ErrorExitPhase2: @@ -1252,7 +1257,7 @@ ErrorExitPhase1: if(psIntSysPAddr) { OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, uPageCount * sizeof(IMG_SYS_PHYADDR), psIntSysPAddr, IMG_NULL); - + } return eError; @@ -1290,15 +1295,6 @@ static PVRSRV_ERROR UnmapDeviceMemoryCallBack(IMG_PVOID pvParam, if( psMapData->psMemInfo->psKernelSyncInfo ) { PVRSRVKernelSyncInfoDecRef(psMapData->psMemInfo->psKernelSyncInfo, psMapData->psMemInfo); - if (psMapData->psMemInfo->psKernelSyncInfo->ui32RefCount == 0) - { - eError = PVRSRVFreeSyncInfoKM(psMapData->psMemInfo->psKernelSyncInfo); - if(eError != PVRSRV_OK) - { - PVR_DPF((PVR_DBG_ERROR,"UnmapDeviceMemoryCallBack: Failed to free sync info")); - return eError; - } - } } eError = FreeDeviceMem(psMapData->psMemInfo); @@ -1308,12 +1304,12 @@ static PVRSRV_ERROR UnmapDeviceMemoryCallBack(IMG_PVOID pvParam, return eError; } - + eError = FreeMemCallBackCommon(psMapData->psSrcMemInfo, 0, PVRSRV_FREE_CALLBACK_ORIGIN_IMPORTER); OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(RESMAN_MAP_DEVICE_MEM_DATA), psMapData, IMG_NULL); - + return eError; } @@ -1341,21 +1337,21 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceMemoryKM(PVRSRV_PER_PROCESS_DATA *psPer IMG_VOID *pvPageAlignedCPUVAddr; RESMAN_MAP_DEVICE_MEM_DATA *psMapData = IMG_NULL; - + if(!psSrcMemInfo || !hDstDevMemHeap || !ppsDstMemInfo) { PVR_DPF((PVR_DBG_ERROR,"PVRSRVMapDeviceMemoryKM: invalid parameters")); return PVRSRV_ERROR_INVALID_PARAMS; } - + *ppsDstMemInfo = IMG_NULL; uPageOffset = psSrcMemInfo->sDevVAddr.uiAddr & (ui32HostPageSize - 1); uPageCount = HOST_PAGEALIGN(psSrcMemInfo->uAllocSize + uPageOffset) / ui32HostPageSize; pvPageAlignedCPUVAddr = (IMG_VOID *)((IMG_UINTPTR_T)psSrcMemInfo->pvLinAddrKM - uPageOffset); - + @@ -1370,23 +1366,23 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceMemoryKM(PVRSRV_PER_PROCESS_DATA *psPer psBuf = psSrcMemInfo->sMemBlk.hBuffer; - + psDeviceNode = psBuf->pMapping->pBMHeap->pBMContext->psDeviceNode; - + sDevVAddr.uiAddr = psSrcMemInfo->sDevVAddr.uiAddr - IMG_CAST_TO_DEVVADDR_UINT(uPageOffset); for(i=0; isDevId.eDeviceType, sDevPAddr); - + sDevVAddr.uiAddr += IMG_CAST_TO_DEVVADDR_UINT(ui32HostPageSize); } - + if(OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(RESMAN_MAP_DEVICE_MEM_DATA), (IMG_VOID **)&psMapData, IMG_NULL, @@ -1428,50 +1424,50 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceMemoryKM(PVRSRV_PER_PROCESS_DATA *psPer goto ErrorExit; } - + psMemBlock->sDevVirtAddr = BM_HandleToDevVaddr(hBuffer); psMemBlock->hOSMemHandle = BM_HandleToOSMemHandle(hBuffer); - + psMemBlock->hBuffer = (IMG_HANDLE)hBuffer; - + psMemBlock->psIntSysPAddr = psSysPAddr; - + psMemInfo->pvLinAddrKM = psSrcMemInfo->pvLinAddrKM; - + psMemInfo->sDevVAddr = psMemBlock->sDevVirtAddr; psMemInfo->uAllocSize = psSrcMemInfo->uAllocSize; psMemInfo->psKernelSyncInfo = psSrcMemInfo->psKernelSyncInfo; - + if(psMemInfo->psKernelSyncInfo) { PVRSRVKernelSyncInfoIncRef(psMemInfo->psKernelSyncInfo, psMemInfo); } - + psMemInfo->pvSysBackupBuffer = IMG_NULL; - + PVRSRVKernelMemInfoIncRef(psMemInfo); - + PVRSRVKernelMemInfoIncRef(psSrcMemInfo); - + BM_Export(psSrcMemInfo->sMemBlk.hBuffer); psMemInfo->memType = PVRSRV_MEMTYPE_MAPPED; - + psMapData->psMemInfo = psMemInfo; psMapData->psSrcMemInfo = psSrcMemInfo; - + psMemInfo->sMemBlk.hResItem = ResManRegisterRes(psPerProc->hResManContext, RESMAN_TYPE_DEVICEMEM_MAPPING, psMapData, @@ -1482,29 +1478,29 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceMemoryKM(PVRSRV_PER_PROCESS_DATA *psPer return PVRSRV_OK; - + ErrorExit: if(psSysPAddr) { - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(IMG_SYS_PHYADDR), psSysPAddr, IMG_NULL); - + } if(psMemInfo) { - + OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(PVRSRV_KERNEL_MEM_INFO), psMemInfo, IMG_NULL); - + } if(psMapData) { - + OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(RESMAN_MAP_DEVICE_MEM_DATA), psMapData, IMG_NULL); - + } return eError; @@ -1590,7 +1586,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceClassMemoryKM(PVRSRV_PER_PROCESS_DATA * return PVRSRV_ERROR_INVALID_PARAMS; } - + if(OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_DC_MAPINFO), (IMG_VOID **)&psDCMapInfo, IMG_NULL, @@ -1603,7 +1599,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceClassMemoryKM(PVRSRV_PER_PROCESS_DATA * psDeviceClassBuffer = (PVRSRV_DEVICECLASS_BUFFER*)hDeviceClassBuffer; - + @@ -1636,7 +1632,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceClassMemoryKM(PVRSRV_PER_PROCESS_DATA * goto ErrorExitPhase1; } - + psBMContext = (BM_CONTEXT*)psDeviceClassBuffer->hDevMemContext; psDeviceNode = psBMContext->psDeviceNode; psDevMemoryInfo = &psDeviceNode->sDevMemoryInfo; @@ -1647,7 +1643,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceClassMemoryKM(PVRSRV_PER_PROCESS_DATA * { if(psDeviceMemoryHeap[i].DevMemHeapType == DEVICE_MEMORY_HEAP_PERCONTEXT) { - + if (psDeviceMemoryHeap[i].ui32HeapSize > 0) { hDevMemHeap = BM_CreateHeap(hDevMemContext, &psDeviceMemoryHeap[i]); @@ -1672,7 +1668,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceClassMemoryKM(PVRSRV_PER_PROCESS_DATA * goto ErrorExitPhase1; } - + ui32Offset = ((IMG_UINTPTR_T)pvCPUVAddr) & (ui32PageSize - 1); pvPageAlignedCPUVAddr = (IMG_VOID *)((IMG_UINTPTR_T)pvCPUVAddr - ui32Offset); @@ -1702,32 +1698,38 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceClassMemoryKM(PVRSRV_PER_PROCESS_DATA * if (!bBMError) { PVR_DPF((PVR_DBG_ERROR,"PVRSRVMapDeviceClassMemoryKM: BM_Wrap Failed")); - + eError = PVRSRV_ERROR_BAD_MAPPING; goto ErrorExitPhase2; } - + psMemBlock->sDevVirtAddr = BM_HandleToDevVaddr(hBuffer); psMemBlock->hOSMemHandle = BM_HandleToOSMemHandle(hBuffer); - + psMemBlock->hBuffer = (IMG_HANDLE)hBuffer; - + psMemInfo->pvLinAddrKM = BM_HandleToCpuVaddr(hBuffer); - + psMemInfo->sDevVAddr = psMemBlock->sDevVirtAddr; psMemInfo->uAllocSize = uByteSize; psMemInfo->psKernelSyncInfo = psDeviceClassBuffer->psKernelSyncInfo; + PVR_ASSERT(psMemInfo->psKernelSyncInfo != IMG_NULL); + if (psMemInfo->psKernelSyncInfo) + { + PVRSRVKernelSyncInfoIncRef(psMemInfo->psKernelSyncInfo, psMemInfo); + } + psMemInfo->pvSysBackupBuffer = IMG_NULL; - + psDCMapInfo->psMemInfo = psMemInfo; psDCMapInfo->psDeviceClassBuffer = psDeviceClassBuffer; @@ -1736,7 +1738,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceClassMemoryKM(PVRSRV_PER_PROCESS_DATA * if(psDCMapInfo->ui32TilingStride > 0) { - + eError = psDeviceNode->pfnAllocMemTilingRange(psDeviceNode, psMemInfo, psDCMapInfo->ui32TilingStride, @@ -1749,7 +1751,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceClassMemoryKM(PVRSRV_PER_PROCESS_DATA * } #endif - + psMemInfo->sMemBlk.hResItem = ResManRegisterRes(psPerProc->hResManContext, RESMAN_TYPE_DEVICECLASSMEM_MAPPING, psDCMapInfo, @@ -1761,13 +1763,14 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceClassMemoryKM(PVRSRV_PER_PROCESS_DATA * psMemInfo->memType = PVRSRV_MEMTYPE_DEVICECLASS; - + *ppsMemInfo = psMemInfo; #if defined(SUPPORT_PDUMP_MULTI_PROCESS) - + if(psMemInfo->pvLinAddrKM) { + PDUMPCOMMENT("Dump display surface"); PDUMPMEM(IMG_NULL, psMemInfo, ui32Offset, psMemInfo->uAllocSize, PDUMP_FLAGS_CONTINUOUS, ((BM_BUF*)psMemInfo->sMemBlk.hBuffer)->pMapping); } @@ -1778,8 +1781,13 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceClassMemoryKM(PVRSRV_PER_PROCESS_DATA * ErrorExitPhase3: if(psMemInfo) { - FreeDeviceMem(psMemInfo); + if (psMemInfo->psKernelSyncInfo) + { + PVRSRVKernelSyncInfoDecRef(psMemInfo->psKernelSyncInfo, psMemInfo); + } + FreeDeviceMem(psMemInfo); + psMemInfo = IMG_NULL; diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/handle.c b/drivers/staging/mrst/pvr/services4/srvkm/common/handle.c index 0819d92..5201078 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/handle.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/handle.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -130,85 +130,85 @@ enum ePVRSRVInternalHandleFlag struct sHandle { - + PVRSRV_HANDLE_TYPE eType; - + IMG_VOID *pvData; - + IMG_UINT32 ui32NextIndexPlusOne; - + enum ePVRSRVInternalHandleFlag eInternalFlag; - + PVRSRV_HANDLE_ALLOC_FLAG eFlag; - + IMG_UINT32 ui32Index; - + struct sHandleList sChildren; - + struct sHandleList sSiblings; }; struct sHandleIndex { - + struct sHandle *psHandle; - + IMG_HANDLE hBlockAlloc; - + IMG_UINT32 ui32FreeHandBlockCount; }; struct _PVRSRV_HANDLE_BASE_ { - + IMG_HANDLE hBaseBlockAlloc; - + IMG_HANDLE hArrayBlockAlloc; - + struct sHandleIndex *psHandleArray; - + HASH_TABLE *psHashTab; - + IMG_UINT32 ui32FreeHandCount; - + IMG_UINT32 ui32FirstFreeIndex; - + IMG_UINT32 ui32MaxIndexPlusOne; - + IMG_UINT32 ui32TotalHandCount; - + IMG_UINT32 ui32LastFreeIndexPlusOne; - + IMG_UINT32 ui32HandBatchSize; - + IMG_UINT32 ui32TotalHandCountPreBatch; - + IMG_UINT32 ui32FirstBatchIndexPlusOne; - + IMG_UINT32 ui32BatchHandAllocFailures; - + IMG_BOOL bPurgingEnabled; }; @@ -216,7 +216,7 @@ enum eHandKey { HAND_KEY_DATA = 0, HAND_KEY_TYPE, HAND_KEY_PARENT, - HAND_KEY_LEN + HAND_KEY_LEN }; PVRSRV_HANDLE_BASE *gpsKernelHandleBase = IMG_NULL; @@ -310,7 +310,7 @@ IMG_BOOL NoParent(struct sHandle *psHandle) } return IMG_FALSE; } -#endif +#endif #ifdef INLINE_IS_PRAGMA #pragma inline(ParentHandle) #endif @@ -333,7 +333,7 @@ IMG_HANDLE ParentHandle(struct sHandle *psHandle) static INLINE IMG_VOID HandleListInsertBefore(PVRSRV_HANDLE_BASE *psBase, IMG_UINT32 ui32InsIndex, struct sHandleList *psIns, IMG_SIZE_T uiParentOffset, IMG_UINT32 ui32EntryIndex, struct sHandleList *psEntry, IMG_SIZE_T uiEntryOffset, IMG_UINT32 ui32ParentIndex) { - + struct sHandleList *psPrevIns = LIST_PTR_FROM_INDEX_AND_OFFSET(psBase, psIns->ui32Prev, ui32ParentIndex, uiParentOffset, uiEntryOffset); PVR_ASSERT(psEntry->hParent == IMG_NULL) @@ -370,11 +370,11 @@ IMG_VOID HandleListRemove(PVRSRV_HANDLE_BASE *psBase, IMG_UINT32 ui32EntryIndex, { if (!HandleListIsEmpty(ui32EntryIndex, psEntry)) { - + struct sHandleList *psPrev = LIST_PTR_FROM_INDEX_AND_OFFSET(psBase, psEntry->ui32Prev, HANDLE_TO_INDEX(psEntry->hParent), uiParentOffset, uiEntryOffset); struct sHandleList *psNext = LIST_PTR_FROM_INDEX_AND_OFFSET(psBase, psEntry->ui32Next, HANDLE_TO_INDEX(psEntry->hParent), uiParentOffset, uiEntryOffset); - + PVR_ASSERT(psEntry->hParent != IMG_NULL) psPrev->ui32Next = psEntry->ui32Next; @@ -404,16 +404,16 @@ PVRSRV_ERROR HandleListIterate(PVRSRV_HANDLE_BASE *psBase, struct sHandleList *p PVR_ASSERT(psHead->hParent != IMG_NULL) - + for(ui32Index = psHead->ui32Next; ui32Index != ui32Parent; ) { struct sHandle *psHandle = INDEX_TO_HANDLE_STRUCT_PTR(psBase, ui32Index); - + struct sHandleList *psEntry = LIST_PTR_FROM_INDEX_AND_OFFSET(psBase, ui32Index, ui32Parent, uiParentOffset, uiEntryOffset); PVRSRV_ERROR eError; PVR_ASSERT(psEntry->hParent == psHead->hParent) - + ui32Index = psEntry->ui32Next; eError = (*pfnIterFunc)(psBase, psHandle); @@ -448,7 +448,7 @@ PVRSRV_ERROR GetHandleStructure(PVRSRV_HANDLE_BASE *psBase, struct sHandle **pps IMG_UINT32 ui32Index = HANDLE_TO_INDEX(hHandle); struct sHandle *psHandle; - + if (!INDEX_IS_VALID(psBase, ui32Index)) { PVR_DPF((PVR_DBG_ERROR, "GetHandleStructure: Handle index out of range (%u >= %u)", ui32Index, psBase->ui32TotalHandCount)); @@ -468,7 +468,7 @@ PVRSRV_ERROR GetHandleStructure(PVRSRV_HANDLE_BASE *psBase, struct sHandle **pps return PVRSRV_ERROR_HANDLE_NOT_ALLOCATED; } - + if (eType != PVRSRV_HANDLE_TYPE_NONE && eType != psHandle->eType) { PVR_DPF((PVR_DBG_ERROR, "GetHandleStructure: Handle type mismatch (%d != %d)", eType, psHandle->eType)); @@ -478,7 +478,7 @@ PVRSRV_ERROR GetHandleStructure(PVRSRV_HANDLE_BASE *psBase, struct sHandle **pps return PVRSRV_ERROR_HANDLE_TYPE_MISMATCH; } - + *ppsHandle = psHandle; return PVRSRV_OK; @@ -549,7 +549,7 @@ PVRSRV_ERROR ReallocHandleArray(PVRSRV_HANDLE_BASE *psBase, IMG_UINT32 ui32NewCo if (ui32NewCount != 0) { - + eError = OSAllocMem(PVRSRV_OS_NON_PAGEABLE_HEAP, HANDLE_ARRAY_SIZE(ui32NewCount) * sizeof(struct sHandleIndex), (IMG_VOID **)&psNewArray, @@ -568,7 +568,7 @@ PVRSRV_ERROR ReallocHandleArray(PVRSRV_HANDLE_BASE *psBase, IMG_UINT32 ui32NewCo } } - + for(ui32Index = ui32NewCount; ui32Index < ui32OldCount; ui32Index += HANDLE_BLOCK_SIZE) { struct sHandleIndex *psIndex = INDEX_TO_INDEX_STRUCT_PTR(psOldArray, ui32Index); @@ -583,10 +583,10 @@ PVRSRV_ERROR ReallocHandleArray(PVRSRV_HANDLE_BASE *psBase, IMG_UINT32 ui32NewCo } } - + for(ui32Index = ui32OldCount; ui32Index < ui32NewCount; ui32Index += HANDLE_BLOCK_SIZE) { - + struct sHandleIndex *psIndex = INDEX_TO_INDEX_STRUCT_PTR(psNewArray, ui32Index); eError = OSAllocMem(PVRSRV_OS_NON_PAGEABLE_HEAP, @@ -624,7 +624,7 @@ PVRSRV_ERROR ReallocHandleArray(PVRSRV_HANDLE_BASE *psBase, IMG_UINT32 ui32NewCo } #ifdef DEBUG_MAX_HANDLE_COUNT - + if (ui32NewCount > DEBUG_MAX_HANDLE_COUNT) { PVR_DPF((PVR_DBG_ERROR, "ReallocHandleArray: Max handle count (%u) reached", DEBUG_MAX_HANDLE_COUNT)); @@ -635,7 +635,7 @@ PVRSRV_ERROR ReallocHandleArray(PVRSRV_HANDLE_BASE *psBase, IMG_UINT32 ui32NewCo if (psOldArray != IMG_NULL) { - + eError = OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, HANDLE_ARRAY_SIZE(ui32OldCount) * sizeof(struct sHandleIndex), psOldArray, @@ -652,13 +652,13 @@ PVRSRV_ERROR ReallocHandleArray(PVRSRV_HANDLE_BASE *psBase, IMG_UINT32 ui32NewCo if (ui32NewCount > ui32OldCount) { - + PVR_ASSERT(psBase->ui32FreeHandCount + (ui32NewCount - ui32OldCount) > psBase->ui32FreeHandCount) - + psBase->ui32FreeHandCount += (ui32NewCount - ui32OldCount); - + if (psBase->ui32FirstFreeIndex == 0) { PVR_ASSERT(psBase->ui32LastFreeIndexPlusOne == 0) @@ -687,7 +687,7 @@ PVRSRV_ERROR ReallocHandleArray(PVRSRV_HANDLE_BASE *psBase, IMG_UINT32 ui32NewCo PVR_ASSERT(ui32NewCount == 0 || psBase->ui32FirstFreeIndex <= ui32NewCount) PVR_ASSERT(psBase->ui32FreeHandCount - (ui32OldCount - ui32NewCount) < psBase->ui32FreeHandCount) - + psBase->ui32FreeHandCount -= (ui32OldCount - ui32NewCount); if (ui32NewCount == 0) @@ -706,7 +706,7 @@ error: if (psNewArray != IMG_NULL) { - + for(ui32Index = ui32OldCount; ui32Index < ui32NewCount; ui32Index += HANDLE_BLOCK_SIZE) { struct sHandleIndex *psIndex = INDEX_TO_INDEX_STRUCT_PTR(psNewArray, ui32Index); @@ -723,7 +723,7 @@ error: } } - + eError = OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, HANDLE_ARRAY_SIZE(ui32NewCount) * sizeof(struct sHandleIndex), psNewArray, @@ -748,7 +748,7 @@ static PVRSRV_ERROR FreeHandle(PVRSRV_HANDLE_BASE *psBase, struct sHandle *psHan IMG_UINT32 ui32Index = HANDLE_PTR_TO_INDEX(psHandle); PVRSRV_ERROR eError; - + InitKey(aKey, psBase, psHandle->pvData, psHandle->eType, ParentIfPrivate(psHandle)); if (!TEST_ALLOC_FLAG(psHandle, PVRSRV_HANDLE_ALLOC_FLAG_MULTI) && !BATCHED_HANDLE_PARTIALLY_FREE(psHandle)) @@ -767,10 +767,10 @@ static PVRSRV_ERROR FreeHandle(PVRSRV_HANDLE_BASE *psBase, struct sHandle *psHan PVR_UNREFERENCED_PARAMETER(hHandle); } - + UnlinkFromParent(psBase, psHandle); - + eError = IterateOverChildren(psBase, psHandle, FreeHandle); if (eError != PVRSRV_OK) { @@ -778,18 +778,18 @@ static PVRSRV_ERROR FreeHandle(PVRSRV_HANDLE_BASE *psBase, struct sHandle *psHan return eError; } - + psHandle->eType = PVRSRV_HANDLE_TYPE_NONE; if (BATCHED_HANDLE(psHandle) && !BATCHED_HANDLE_PARTIALLY_FREE(psHandle)) { - + SET_BATCHED_HANDLE_PARTIALLY_FREE(psHandle); - + return PVRSRV_OK; } - + if (!psBase->bPurgingEnabled) { if (psBase->ui32FreeHandCount == 0) @@ -801,7 +801,7 @@ static PVRSRV_ERROR FreeHandle(PVRSRV_HANDLE_BASE *psBase, struct sHandle *psHan } else { - + PVR_ASSERT(psBase->ui32LastFreeIndexPlusOne != 0) PVR_ASSERT(INDEX_TO_HANDLE_STRUCT_PTR(psBase, psBase->ui32LastFreeIndexPlusOne - 1)->ui32NextIndexPlusOne == 0) INDEX_TO_HANDLE_STRUCT_PTR(psBase, psBase->ui32LastFreeIndexPlusOne - 1)->ui32NextIndexPlusOne = ui32Index + 1; @@ -809,7 +809,7 @@ static PVRSRV_ERROR FreeHandle(PVRSRV_HANDLE_BASE *psBase, struct sHandle *psHan PVR_ASSERT(psHandle->ui32NextIndexPlusOne == 0) - + psBase->ui32LastFreeIndexPlusOne = ui32Index + 1; } @@ -860,7 +860,7 @@ static PVRSRV_ERROR FreeAllHandles(PVRSRV_HANDLE_BASE *psBase) break; } - + if (psBase->ui32FreeHandCount == psBase->ui32TotalHandCount) { break; @@ -881,7 +881,7 @@ static PVRSRV_ERROR FreeHandleBase(PVRSRV_HANDLE_BASE *psBase) PVRSRVReleaseHandleBatch(psBase); } - + eError = FreeAllHandles(psBase); if (eError != PVRSRV_OK) { @@ -889,7 +889,7 @@ static PVRSRV_ERROR FreeHandleBase(PVRSRV_HANDLE_BASE *psBase) return eError; } - + eError = FreeHandleArray(psBase); if (eError != PVRSRV_OK) { @@ -899,7 +899,7 @@ static PVRSRV_ERROR FreeHandleBase(PVRSRV_HANDLE_BASE *psBase) if (psBase->psHashTab != IMG_NULL) { - + HASH_Delete(psBase->psHashTab); } @@ -948,7 +948,7 @@ static PVRSRV_ERROR IncreaseHandleArraySize(PVRSRV_HANDLE_BASE *psBase, IMG_UINT PVR_ASSERT(ui32Delta != 0) - + if (ui32NewTotalHandCount > psBase->ui32MaxIndexPlusOne || ui32NewTotalHandCount <= psBase->ui32TotalHandCount) { ui32NewTotalHandCount = psBase->ui32MaxIndexPlusOne; @@ -964,7 +964,7 @@ static PVRSRV_ERROR IncreaseHandleArraySize(PVRSRV_HANDLE_BASE *psBase, IMG_UINT PVR_ASSERT(ui32DeltaAdjusted >= ui32Delta) - + eError = ReallocHandleArray(psBase, ui32NewTotalHandCount); if (eError != PVRSRV_OK) { @@ -1010,23 +1010,23 @@ static PVRSRV_ERROR AllocHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHandle HAND_KEY aKey; PVRSRV_ERROR eError; - + PVR_ASSERT(eType != PVRSRV_HANDLE_TYPE_NONE) PVR_ASSERT(psBase != IMG_NULL) PVR_ASSERT(psBase->psHashTab != IMG_NULL) if (!TEST_FLAG(eFlag, PVRSRV_HANDLE_ALLOC_FLAG_MULTI)) { - + PVR_ASSERT(FindHandle(psBase, pvData, eType, hParent) == IMG_NULL) } if (psBase->ui32FreeHandCount == 0 && HANDLES_BATCHED(psBase)) { - PVR_DPF((PVR_DBG_WARNING, "AllocHandle: Handle batch size (%u) was too small, allocating additional space", psBase->ui32HandBatchSize)); + PVR_DPF((PVR_DBG_WARNING, "AllocHandle: Handle batch size (%u) was too small, allocating additional space", psBase->ui32HandBatchSize)); } - + eError = EnsureFreeHandles(psBase, 1); if (eError != PVRSRV_OK) { @@ -1037,18 +1037,18 @@ static PVRSRV_ERROR AllocHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHandle if (!psBase->bPurgingEnabled) { - + ui32NewIndex = psBase->ui32FirstFreeIndex; - + psNewHandle = INDEX_TO_HANDLE_STRUCT_PTR(psBase, ui32NewIndex); } else { IMG_UINT32 ui32BlockedIndex; - - + + PVR_ASSERT((psBase->ui32FirstFreeIndex % HANDLE_BLOCK_SIZE) == 0) for (ui32BlockedIndex = ROUND_DOWN_TO_MULTIPLE_OF_BLOCK_SIZE(psBase->ui32FirstFreeIndex); ui32BlockedIndex < psBase->ui32TotalHandCount; ui32BlockedIndex += HANDLE_BLOCK_SIZE) @@ -1077,16 +1077,16 @@ static PVRSRV_ERROR AllocHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHandle return PVRSRV_ERROR_INVALID_PARAMS; } - + hHandle = INDEX_TO_HANDLE(ui32NewIndex); - + if (!TEST_FLAG(eFlag, PVRSRV_HANDLE_ALLOC_FLAG_MULTI)) { - + InitKey(aKey, psBase, pvData, eType, hParent); - + if (!HASH_Insert_Extended(psBase->psHashTab, aKey, (IMG_UINTPTR_T)hHandle)) { PVR_DPF((PVR_DBG_ERROR, "AllocHandle: Couldn't add handle to hash table")); @@ -1102,10 +1102,10 @@ static PVRSRV_ERROR AllocHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHandle INDEX_TO_FREE_HAND_BLOCK_COUNT(psBase, ui32NewIndex)--; - + if (!psBase->bPurgingEnabled) { - + if (psBase->ui32FreeHandCount == 0) { PVR_ASSERT(psBase->ui32FirstFreeIndex == ui32NewIndex) @@ -1116,17 +1116,17 @@ static PVRSRV_ERROR AllocHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHandle } else { - + psBase->ui32FirstFreeIndex = (psNewHandle->ui32NextIndexPlusOne == 0) ? ui32NewIndex + 1 : psNewHandle->ui32NextIndexPlusOne - 1; } } - + PVR_ASSERT(psNewHandle->ui32Index == ui32NewIndex) - + psNewHandle->eType = eType; psNewHandle->pvData = pvData; psNewHandle->eInternalFlag = INTERNAL_HANDLE_FLAG_NONE; @@ -1144,12 +1144,12 @@ static PVRSRV_ERROR AllocHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHandle if (HANDLES_BATCHED(psBase)) { - + psNewHandle->ui32NextIndexPlusOne = psBase->ui32FirstBatchIndexPlusOne; psBase->ui32FirstBatchIndexPlusOne = ui32NewIndex + 1; - + SET_BATCHED_HANDLE(psNewHandle); } else @@ -1157,7 +1157,7 @@ static PVRSRV_ERROR AllocHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHandle psNewHandle->ui32NextIndexPlusOne = 0; } - + *phHandle = hHandle; return PVRSRV_OK; @@ -1184,16 +1184,16 @@ PVRSRV_ERROR PVRSRVAllocHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHandle, if (HANDLES_BATCHED(psBase)) { - + psBase->ui32BatchHandAllocFailures++; } - + PVR_ASSERT(eType != PVRSRV_HANDLE_TYPE_NONE) if (!TEST_FLAG(eFlag, PVRSRV_HANDLE_ALLOC_FLAG_MULTI)) { - + hHandle = FindHandle(psBase, pvData, eType, IMG_NULL); #if defined (SUPPORT_SID_INTERFACE) if (hHandle != 0) @@ -1210,14 +1210,14 @@ PVRSRV_ERROR PVRSRVAllocHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHandle, return eError; } - + if (TEST_FLAG(psHandle->eFlag & eFlag, PVRSRV_HANDLE_ALLOC_FLAG_SHARED)) { *phHandle = hHandle; eError = PVRSRV_OK; goto exit_ok; } - + #if defined (SUPPORT_SID_INTERFACE) PVR_DBG_BREAK #endif @@ -1226,7 +1226,7 @@ PVRSRV_ERROR PVRSRVAllocHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHandle, } eError = AllocHandle(psBase, phHandle, pvData, eType, eFlag, IMG_NULL); - + exit_ok: if (HANDLES_BATCHED(psBase) && (eError == PVRSRV_OK)) { @@ -1259,17 +1259,17 @@ PVRSRV_ERROR PVRSRVAllocSubHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHand if (HANDLES_BATCHED(psBase)) { - + psBase->ui32BatchHandAllocFailures++; } - + PVR_ASSERT(eType != PVRSRV_HANDLE_TYPE_NONE) hParentKey = TEST_FLAG(eFlag, PVRSRV_HANDLE_ALLOC_FLAG_PRIVATE) ? hParent : IMG_NULL; - + eError = GetHandleStructure(psBase, &psPHand, hParent, PVRSRV_HANDLE_TYPE_NONE); if (eError != PVRSRV_OK) { @@ -1278,7 +1278,7 @@ PVRSRV_ERROR PVRSRVAllocSubHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHand if (!TEST_FLAG(eFlag, PVRSRV_HANDLE_ALLOC_FLAG_MULTI)) { - + hHandle = FindHandle(psBase, pvData, eType, hParentKey); #if defined (SUPPORT_SID_INTERFACE) if (hHandle != 0) @@ -1298,7 +1298,7 @@ PVRSRV_ERROR PVRSRVAllocSubHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHand PVR_ASSERT(hParentKey != IMG_NULL && ParentHandle(HANDLE_TO_HANDLE_STRUCT_PTR(psBase, hHandle)) == hParent) - + if (TEST_FLAG(psCHandle->eFlag & eFlag, PVRSRV_HANDLE_ALLOC_FLAG_SHARED) && ParentHandle(HANDLE_TO_HANDLE_STRUCT_PTR(psBase, hHandle)) == hParent) { *phHandle = hHandle; @@ -1317,7 +1317,7 @@ PVRSRV_ERROR PVRSRVAllocSubHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHand return eError; } - + psPHand = HANDLE_TO_HANDLE_STRUCT_PTR(psBase, hParent); psCHand = HANDLE_TO_HANDLE_STRUCT_PTR(psBase, hHandle); @@ -1349,7 +1349,7 @@ PVRSRV_ERROR PVRSRVFindHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phHandle, PVR_ASSERT(eType != PVRSRV_HANDLE_TYPE_NONE) - + #if defined (SUPPORT_SID_INTERFACE) hHandle = (IMG_SID) FindHandle(psBase, pvData, eType, IMG_NULL); #else @@ -1441,7 +1441,7 @@ PVRSRV_ERROR PVRSRVLookupSubHandle(PVRSRV_HANDLE_BASE *psBase, IMG_PVOID *ppvDat return eError; } - + for (psPHand = psCHand; ParentHandle(psPHand) != hAncestor; ) { eError = GetHandleStructure(psBase, &psPHand, ParentHandle(psPHand), PVRSRV_HANDLE_TYPE_NONE); @@ -1556,7 +1556,7 @@ PVRSRV_ERROR PVRSRVNewHandleBatch(PVRSRV_HANDLE_BASE *psBase, IMG_UINT32 ui32Bat psBase->ui32HandBatchSize = ui32BatchSize; - + psBase->ui32TotalHandCountPreBatch = psBase->ui32TotalHandCount; PVR_ASSERT(psBase->ui32BatchHandAllocFailures == 0) @@ -1589,7 +1589,7 @@ static PVRSRV_ERROR PVRSRVHandleBatchCommitOrRelease(PVRSRV_HANDLE_BASE *psBase, } bCommitBatch = IMG_FALSE; } - + PVR_ASSERT(psBase->ui32BatchHandAllocFailures == 0 || !bCommit) ui32IndexPlusOne = psBase->ui32FirstBatchIndexPlusOne; @@ -1605,11 +1605,11 @@ static PVRSRV_ERROR PVRSRVHandleBatchCommitOrRelease(PVRSRV_HANDLE_BASE *psBase, { PVRSRV_ERROR eError; - + if (!BATCHED_HANDLE_PARTIALLY_FREE(psHandle)) { - - SET_UNBATCHED_HANDLE(psHandle); + + SET_UNBATCHED_HANDLE(psHandle); } eError = FreeHandle(psBase, psHandle); @@ -1621,7 +1621,7 @@ static PVRSRV_ERROR PVRSRVHandleBatchCommitOrRelease(PVRSRV_HANDLE_BASE *psBase, } else { - + SET_UNBATCHED_HANDLE(psHandle); } @@ -1675,7 +1675,7 @@ PVRSRV_ERROR PVRSRVSetMaxHandle(PVRSRV_HANDLE_BASE *psBase, IMG_UINT32 ui32MaxHa return PVRSRV_ERROR_INVALID_PARAMS; } - + if (ui32MaxHandle == 0 || ui32MaxHandle > DEFAULT_MAX_HANDLE) { PVR_DPF((PVR_DBG_ERROR, "PVRSRVSetMaxHandle: Limit must be between %u and %u, inclusive", 0, DEFAULT_MAX_HANDLE)); @@ -1683,7 +1683,7 @@ PVRSRV_ERROR PVRSRVSetMaxHandle(PVRSRV_HANDLE_BASE *psBase, IMG_UINT32 ui32MaxHa return PVRSRV_ERROR_INVALID_PARAMS; } - + if (psBase->ui32TotalHandCount != 0) { PVR_DPF((PVR_DBG_ERROR, "PVRSRVSetMaxHandle: Limit cannot be set because handles have already been allocated")); @@ -1693,7 +1693,7 @@ PVRSRV_ERROR PVRSRVSetMaxHandle(PVRSRV_HANDLE_BASE *psBase, IMG_UINT32 ui32MaxHa ui32MaxHandleRounded = ROUND_DOWN_TO_MULTIPLE_OF_BLOCK_SIZE(ui32MaxHandle); - + if (ui32MaxHandleRounded != 0 && ui32MaxHandleRounded < psBase->ui32MaxIndexPlusOne) { psBase->ui32MaxIndexPlusOne = ui32MaxHandleRounded; @@ -1719,7 +1719,7 @@ PVRSRV_ERROR PVRSRVEnableHandlePurging(PVRSRV_HANDLE_BASE *psBase) return PVRSRV_OK; } - + if (psBase->ui32TotalHandCount != 0) { PVR_DPF((PVR_DBG_ERROR, "PVRSRVEnableHandlePurging: Handles have already been allocated")); @@ -1759,12 +1759,12 @@ PVRSRV_ERROR PVRSRVPurgeHandles(PVRSRV_HANDLE_BASE *psBase) } ui32NewHandCount = BLOCK_INDEX_TO_INDEX(ui32BlockIndex); - + if (ui32NewHandCount <= (psBase->ui32TotalHandCount/2)) { PVRSRV_ERROR eError; - + eError = ReallocHandleArray(psBase, ui32NewHandCount); if (eError != PVRSRV_OK) @@ -1794,7 +1794,7 @@ PVRSRV_ERROR PVRSRVAllocHandleBase(PVRSRV_HANDLE_BASE **ppsBase) } OSMemSet(psBase, 0, sizeof(*psBase)); - + psBase->psHashTab = HASH_Create_Extended(HANDLE_HASH_TAB_INIT_SIZE, sizeof(HAND_KEY), HASH_Func_Default, HASH_Key_Comp_Default); if (psBase->psHashTab == IMG_NULL) { @@ -1873,4 +1873,4 @@ PVRSRV_ERROR PVRSRVHandleDeInit(IMG_VOID) return eError; } #else -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/hash.c b/drivers/staging/mrst/pvr/services4/srvkm/common/hash.c index 4c0819f..78eab44 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/hash.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/hash.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -41,38 +41,38 @@ struct _BUCKET_ { - + struct _BUCKET_ *pNext; - + IMG_UINTPTR_T v; - - IMG_UINTPTR_T k[]; + + IMG_UINTPTR_T k[]; }; typedef struct _BUCKET_ BUCKET; struct _HASH_TABLE_ { - + BUCKET **ppBucketTable; - + IMG_UINT32 uSize; - + IMG_UINT32 uCount; - + IMG_UINT32 uMinimumSize; - + IMG_UINT32 uKeySize; - + HASH_FUNC *pfnHashFunc; - + HASH_KEY_COMP *pfnKeyComp; }; @@ -141,7 +141,7 @@ _ChainInsert (HASH_TABLE *pHash, BUCKET *pBucket, BUCKET **ppBucketTable, IMG_UI return PVRSRV_ERROR_INVALID_PARAMS; } - uIndex = KEY_TO_INDEX(pHash, pBucket->k, uSize); + uIndex = KEY_TO_INDEX(pHash, pBucket->k, uSize); pBucket->pNext = ppBucketTable[uIndex]; ppBucketTable[uIndex] = pBucket; @@ -202,7 +202,7 @@ _Resize (HASH_TABLE *pHash, IMG_UINT32 uNewSize) } OSFreeMem (PVRSRV_PAGEABLE_SELECT, sizeof(BUCKET *)*pHash->uSize, pHash->ppBucketTable, IMG_NULL); - + pHash->ppBucketTable = ppNewTable; pHash->uSize = uNewSize; } @@ -240,7 +240,7 @@ HASH_TABLE * HASH_Create_Extended (IMG_UINT32 uInitialLen, IMG_SIZE_T uKeySize, if (pHash->ppBucketTable == IMG_NULL) { OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(HASH_TABLE), pHash, IMG_NULL); - + return IMG_NULL; } @@ -271,7 +271,7 @@ HASH_Delete (HASH_TABLE *pHash) OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(BUCKET *)*pHash->uSize, pHash->ppBucketTable, IMG_NULL); pHash->ppBucketTable = IMG_NULL; OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(HASH_TABLE), pHash, IMG_NULL); - + } } @@ -301,7 +301,7 @@ HASH_Insert_Extended (HASH_TABLE *pHash, IMG_VOID *pKey, IMG_UINTPTR_T v) } pBucket->v = v; - + OSMemCopy(pBucket->k, pKey, pHash->uKeySize); if (_ChainInsert (pHash, pBucket, pHash->ppBucketTable, pHash->uSize) != PVRSRV_OK) { @@ -313,10 +313,10 @@ HASH_Insert_Extended (HASH_TABLE *pHash, IMG_VOID *pKey, IMG_UINTPTR_T v) pHash->uCount++; - + if (pHash->uCount << 1 > pHash->uSize) { - + _Resize (pHash, pHash->uSize << 1); } @@ -356,7 +356,7 @@ HASH_Remove_Extended(HASH_TABLE *pHash, IMG_VOID *pKey) for (ppBucket = &(pHash->ppBucketTable[uIndex]); *ppBucket != IMG_NULL; ppBucket = &((*ppBucket)->pNext)) { - + if (KEY_COMPARE(pHash, (*ppBucket)->k, pKey)) { BUCKET *pBucket = *ppBucket; @@ -364,15 +364,15 @@ HASH_Remove_Extended(HASH_TABLE *pHash, IMG_VOID *pKey) (*ppBucket) = pBucket->pNext; OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(BUCKET) + pHash->uKeySize, pBucket, IMG_NULL); - + pHash->uCount--; - + if (pHash->uSize > (pHash->uCount << 2) && pHash->uSize > pHash->uMinimumSize) { - + _Resize (pHash, PRIVATE_MAX (pHash->uSize >> 1, @@ -421,7 +421,7 @@ HASH_Retrieve_Extended (HASH_TABLE *pHash, IMG_VOID *pKey) for (ppBucket = &(pHash->ppBucketTable[uIndex]); *ppBucket != IMG_NULL; ppBucket = &((*ppBucket)->pNext)) { - + if (KEY_COMPARE(pHash, (*ppBucket)->k, pKey)) { BUCKET *pBucket = *ppBucket; @@ -459,10 +459,10 @@ HASH_Iterate(HASH_TABLE *pHash, HASH_pfnCallback pfnCallback) { PVRSRV_ERROR eError; BUCKET *pNextBucket = pBucket->pNext; - + eError = pfnCallback((IMG_UINTPTR_T) ((IMG_VOID *) *(pBucket->k)), (IMG_UINTPTR_T) pBucket->v); - + if (eError != PVRSRV_OK) return eError; diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/lists.c b/drivers/staging/mrst/pvr/services4/srvkm/common/lists.c index 29ac4a4..1081781 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/lists.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/lists.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -69,7 +69,7 @@ IMG_VOID* MatchDeviceKM_AnyVaCb(PVRSRV_DEVICE_NODE* psDeviceNode, va_list va) } else { - + eDevClass = PVRSRV_DEVICE_CLASS_FORCE_I32; } diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/mem.c b/drivers/staging/mrst/pvr/services4/srvkm/common/mem.c index 1be0b7d..746494a 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/mem.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/mem.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -47,7 +47,7 @@ FreeSharedSysMemCallBack(IMG_PVOID pvParam, sizeof(PVRSRV_KERNEL_MEM_INFO), psKernelMemInfo, IMG_NULL); - + return PVRSRV_OK; } @@ -94,7 +94,7 @@ PVRSRVAllocSharedSysMemoryKM(PVRSRV_PER_PROCESS_DATA *psPerProc, return PVRSRV_ERROR_OUT_OF_MEMORY; } - + psKernelMemInfo->sMemBlk.hResItem = ResManRegisterRes(psPerProc->hResManContext, RESMAN_TYPE_SHARED_MEM_INFO, @@ -104,7 +104,7 @@ PVRSRVAllocSharedSysMemoryKM(PVRSRV_PER_PROCESS_DATA *psPerProc, *ppsKernelMemInfo = psKernelMemInfo; - return PVRSRV_OK; + return PVRSRV_OK; } diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/mem_debug.c b/drivers/staging/mrst/pvr/services4/srvkm/common/mem_debug.c index c905308..b9cc780 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/mem_debug.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/mem_debug.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -39,9 +39,7 @@ extern "C" #define STOP_ON_ERROR 0 - - - + @@ -60,13 +58,13 @@ extern "C" return IMG_TRUE; } - + IMG_VOID OSCheckMemDebug(IMG_PVOID pvCpuVAddr, IMG_SIZE_T uSize, const IMG_CHAR *pszFileName, const IMG_UINT32 uLine) { OSMEM_DEBUG_INFO const *psInfo = (OSMEM_DEBUG_INFO *)((IMG_UINT32)pvCpuVAddr - TEST_BUFFER_PADDING_STATUS); - + if (pvCpuVAddr == IMG_NULL) { PVR_DPF((PVR_DBG_ERROR, "Pointer 0x%X : null pointer" @@ -77,7 +75,7 @@ extern "C" while (STOP_ON_ERROR); } - + if (((IMG_UINT32)pvCpuVAddr&3) != 0) { PVR_DPF((PVR_DBG_ERROR, "Pointer 0x%X : invalid alignment" @@ -88,7 +86,7 @@ extern "C" while (STOP_ON_ERROR); } - + if (!MemCheck((IMG_PVOID)psInfo->sGuardRegionBefore, 0xB1, sizeof(psInfo->sGuardRegionBefore))) { PVR_DPF((PVR_DBG_ERROR, "Pointer 0x%X : guard region before overwritten" @@ -99,7 +97,7 @@ extern "C" while (STOP_ON_ERROR); } - + if (uSize != psInfo->uSize) { PVR_DPF((PVR_DBG_WARNING, "Pointer 0x%X : supplied size was different to stored size (0x%X != 0x%X)" @@ -110,7 +108,7 @@ extern "C" while (STOP_ON_ERROR); } - + if ((0x01234567 ^ psInfo->uSizeParityCheck) != psInfo->uSize) { PVR_DPF((PVR_DBG_WARNING, "Pointer 0x%X : stored size parity error (0x%X != 0x%X)" @@ -122,11 +120,11 @@ extern "C" } else { - + uSize = psInfo->uSize; } - + if (uSize) { if (!MemCheck((IMG_VOID*)((IMG_UINT32)pvCpuVAddr + uSize), 0xB2, TEST_BUFFER_PADDING_AFTER)) @@ -139,7 +137,7 @@ extern "C" } } - + if (psInfo->eValid != isAllocated) { PVR_DPF((PVR_DBG_ERROR, "Pointer 0x%X : not allocated (freed? %d)" @@ -155,7 +153,7 @@ extern "C" { IMG_SIZE_T i = 0; - for (; i < 128; i++) + for (; i < 128; i++) { *pDest = *pSrc; if (*pSrc == '\0') break; @@ -187,11 +185,10 @@ extern "C" return eError; } - OSMemSet((IMG_CHAR *)(*ppvCpuVAddr) + TEST_BUFFER_PADDING_STATUS, 0xBB, ui32Size); OSMemSet((IMG_CHAR *)(*ppvCpuVAddr) + ui32Size + TEST_BUFFER_PADDING_STATUS, 0xB2, TEST_BUFFER_PADDING_AFTER); - + psInfo = (OSMEM_DEBUG_INFO *)(*ppvCpuVAddr); OSMemSet(psInfo->sGuardRegionBefore, 0xB1, sizeof(psInfo->sGuardRegionBefore)); @@ -201,11 +198,11 @@ extern "C" psInfo->uSize = ui32Size; psInfo->uSizeParityCheck = 0x01234567 ^ ui32Size; - + *ppvCpuVAddr = (IMG_PVOID) ((IMG_UINT32)*ppvCpuVAddr)+TEST_BUFFER_PADDING_STATUS; #ifdef PVRSRV_LOG_MEMORY_ALLOCS - + PVR_TRACE(("Allocated pointer (after debug info): 0x%X from %s:%d", *ppvCpuVAddr, pszFilename, ui32Line)); #endif @@ -221,16 +218,16 @@ extern "C" { OSMEM_DEBUG_INFO *psInfo; - + OSCheckMemDebug(pvCpuVAddr, ui32Size, pszFilename, ui32Line); + + OSMemSet(pvCpuVAddr, 0xBF, ui32Size + TEST_BUFFER_PADDING_AFTER); - OSMemSet(pvCpuVAddr, 0xBF, ui32Size + TEST_BUFFER_PADDING_AFTER); - - + psInfo = (OSMEM_DEBUG_INFO *)((IMG_UINT32) pvCpuVAddr - TEST_BUFFER_PADDING_STATUS); - + psInfo->uSize = 0; psInfo->uSizeParityCheck = 0; psInfo->eValid = isFree; @@ -245,6 +242,6 @@ extern "C" } #endif -#endif +#endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/metrics.c b/drivers/staging/mrst/pvr/services4/srvkm/common/metrics.c index 26fe0e6..640eb04 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/metrics.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/metrics.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -44,7 +44,7 @@ static volatile IMG_UINT32 *pui32TimerRegister = 0; #define PVRSRV_TIMER_COUNT(X) asTimers[X].ui32Count -Temporal_Data asTimers[PVRSRV_NUM_TIMERS]; +Temporal_Data asTimers[PVRSRV_NUM_TIMERS]; IMG_UINT32 PVRSRVTimeNow(IMG_VOID) @@ -67,11 +67,11 @@ IMG_UINT32 PVRSRVTimeNow(IMG_VOID) return (0xffffffff-*pui32TimerRegister); -#else +#else return 0; -#endif +#endif } @@ -106,25 +106,25 @@ IMG_VOID PVRSRVSetupMetricTimers(IMG_VOID *pvDevInfo) #if defined(__sh__) - - - - + + + + *TCR_2 = TIMER_DIVISOR; - + *TCOR_2 = *TCNT_2 = (IMG_UINT)0xffffffff; - + *TST_REG |= (IMG_UINT8)0x04; pui32TimerRegister = (IMG_UINT32 *)TCNT_2; - #else + #else pui32TimerRegister = 0; - #endif + #endif } @@ -149,12 +149,12 @@ IMG_VOID PVRSRVOutputMetricTotals(IMG_VOID) } } #if 0 - + PVR_DPF((PVR_DBG_ERROR," Timer(%u): Total = %u",PVRSRV_TIMER_EXAMPLE_1, PVRSRV_TIMER_TOTAL_IN_TICKS(PVRSRV_TIMER_EXAMPLE_1))); PVR_DPF((PVR_DBG_ERROR," Timer(%u): Time = %ums",PVRSRV_TIMER_EXAMPLE_1, PVRSRV_TIMER_TOTAL_IN_MS(PVRSRV_TIMER_EXAMPLE_1))); PVR_DPF((PVR_DBG_ERROR," Timer(%u): Count = %u",PVRSRV_TIMER_EXAMPLE_1, PVRSRV_TIMER_COUNT(PVRSRV_TIMER_EXAMPLE_1))); #endif } -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/osfunc_common.c b/drivers/staging/mrst/pvr/services4/srvkm/common/osfunc_common.c index 6a944bd..e0a46da 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/osfunc_common.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/osfunc_common.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/pdump_common.c b/drivers/staging/mrst/pvr/services4/srvkm/common/pdump_common.c index c4eefbe..45845b6cc 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/pdump_common.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/pdump_common.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -66,7 +66,7 @@ IMG_BOOL _PDumpIsPersistent(IMG_VOID) if(psPerProc == IMG_NULL) { - + return IMG_FALSE; } return psPerProc->bPDumpPersistent; @@ -81,13 +81,13 @@ IMG_BOOL _PDumpIsProcessActive(IMG_VOID) PVRSRV_PER_PROCESS_DATA* psPerProc = PVRSRVFindPerProcessData(); if(psPerProc == IMG_NULL) { - + return IMG_TRUE; } return psPerProc->bPDumpActive; } -#endif +#endif #if defined(PDUMP_DEBUG_OUTFILES) static INLINE @@ -96,16 +96,16 @@ IMG_UINT32 _PDumpGetPID(IMG_VOID) PVRSRV_PER_PROCESS_DATA* psPerProc = PVRSRVFindPerProcessData(); if(psPerProc == IMG_NULL) { - + return 0; } return psPerProc->ui32PID; } -#endif +#endif static IMG_VOID *GetTempBuffer(IMG_VOID) { - + if (gpvTempBuffer == IMG_NULL) { PVRSRV_ERROR eError = OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, @@ -144,19 +144,19 @@ static IMG_VOID FreeTempBuffer(IMG_VOID) IMG_VOID PDumpInitCommon(IMG_VOID) { - + (IMG_VOID) GetTempBuffer(); - + PDumpInit(); } IMG_VOID PDumpDeInitCommon(IMG_VOID) { - + FreeTempBuffer(); - + PDumpDeInit(); } @@ -219,13 +219,13 @@ PVRSRV_ERROR PDumpRegKM(IMG_CHAR *pszPDumpRegName, } PVRSRV_ERROR PDumpRegPolWithFlagsKM(IMG_CHAR *pszPDumpRegName, - IMG_UINT32 ui32RegAddr, - IMG_UINT32 ui32RegValue, + IMG_UINT32 ui32RegAddr, + IMG_UINT32 ui32RegValue, IMG_UINT32 ui32Mask, IMG_UINT32 ui32Flags, PDUMP_POLL_OPERATOR eOperator) { - + #define POLL_DELAY 1000U #define POLL_COUNT_LONG (2000000000U / POLL_DELAY) #define POLL_COUNT_SHORT (1000000U / POLL_DELAY) @@ -237,7 +237,7 @@ PVRSRV_ERROR PDumpRegPolWithFlagsKM(IMG_CHAR *pszPDumpRegName, PDUMP_DBG(("PDumpRegPolWithFlagsKM")); if ( _PDumpIsPersistent() ) { - + return PVRSRV_OK; } @@ -294,14 +294,14 @@ PVRSRV_ERROR PDumpMallocPages (PVRSRV_DEVICE_IDENTIFIER *psDevID, PDUMP_GET_SCRIPT_STRING(); #if defined(SUPPORT_PDUMP_MULTI_PROCESS) - + ui32Flags |= ( _PDumpIsPersistent() || bShared ) ? PDUMP_FLAGS_PERSISTENT : 0; #else PVR_UNREFERENCED_PARAMETER(bShared); ui32Flags |= ( _PDumpIsPersistent() ) ? PDUMP_FLAGS_PERSISTENT : 0; #endif - + #if !defined(LINUX) PVR_ASSERT(((IMG_UINTPTR_T)pvLinAddr & HOST_PAGEMASK) == 0); #endif @@ -309,7 +309,7 @@ PVRSRV_ERROR PDumpMallocPages (PVRSRV_DEVICE_IDENTIFIER *psDevID, PVR_ASSERT(((IMG_UINT32) ui32DevVAddr & HOST_PAGEMASK) == 0); PVR_ASSERT(((IMG_UINT32) ui32NumBytes & HOST_PAGEMASK) == 0); - + eErr = PDumpOSBufprintf(hScript, ui32MaxLen, "-- MALLOC :%s:VA_%08X 0x%08X %u\r\n", psDevID->pszPDumpDevName, ui32DevVAddr, ui32NumBytes, ui32PageSize); @@ -319,25 +319,25 @@ PVRSRV_ERROR PDumpMallocPages (PVRSRV_DEVICE_IDENTIFIER *psDevID, } PDumpOSWriteString2(hScript, ui32Flags); - + pui8LinAddr = (IMG_PUINT8) pvLinAddr; ui32Offset = 0; ui32NumPages = ui32NumBytes / ui32PageSize; while (ui32NumPages) - { + { ui32NumPages--; + - - - - + + + PDumpOSCPUVAddrToDevPAddr(psDevID->eDeviceType, hOSMemHandle, ui32Offset, @@ -345,7 +345,7 @@ PVRSRV_ERROR PDumpMallocPages (PVRSRV_DEVICE_IDENTIFIER *psDevID, ui32PageSize, &sDevPAddr); ui32Page = (IMG_UINT32)(sDevPAddr.uiAddr / ui32PageSize); - + pui8LinAddr += ui32PageSize; ui32Offset += ui32PageSize; @@ -382,8 +382,8 @@ PVRSRV_ERROR PDumpMallocPageTable (PVRSRV_DEVICE_IDENTIFIER *psDevId, PVR_ASSERT(((IMG_UINTPTR_T)pvLinAddr & (ui32PTSize - 1)) == 0); ui32Flags |= PDUMP_FLAGS_CONTINUOUS; ui32Flags |= ( _PDumpIsPersistent() ) ? PDUMP_FLAGS_PERSISTENT : 0; - - + + eErr = PDumpOSBufprintf(hScript, ui32MaxLen, @@ -397,15 +397,15 @@ PVRSRV_ERROR PDumpMallocPageTable (PVRSRV_DEVICE_IDENTIFIER *psDevId, } PDumpOSWriteString2(hScript, ui32Flags); + - - - - - + + + + PDumpOSCPUVAddrToDevPAddr(psDevId->eDeviceType, - hOSMemHandle, + hOSMemHandle, ui32Offset, (IMG_PUINT8) pvLinAddr, ui32PTSize, @@ -448,9 +448,9 @@ PVRSRV_ERROR PDumpFreePages (BM_HEAP *psBMHeap, psDeviceNode = psBMHeap->pBMContext->psDeviceNode; ui32Flags |= ( _PDumpIsPersistent() ) ? PDUMP_FLAGS_PERSISTENT : 0; + - - eErr = PDumpOSBufprintf(hScript, ui32MaxLen, "-- FREE :%s:VA_%08X\r\n", + eErr = PDumpOSBufprintf(hScript, ui32MaxLen, "-- FREE :%s:VA_%08X\r\n", psDeviceNode->sDevId.pszPDumpDevName, sDevVAddr.uiAddr); if(eErr != PVRSRV_OK) { @@ -458,10 +458,10 @@ PVRSRV_ERROR PDumpFreePages (BM_HEAP *psBMHeap, } #if defined(SUPPORT_PDUMP_MULTI_PROCESS) - + { PVRSRV_DEVICE_NODE *psDeviceNode = psBMHeap->pBMContext->psDeviceNode; - + if( psDeviceNode->pfnMMUIsHeapShared(psBMHeap->pMMUHeap) ) { ui32Flags |= PDUMP_FLAGS_PERSISTENT; @@ -470,7 +470,7 @@ PVRSRV_ERROR PDumpFreePages (BM_HEAP *psBMHeap, #endif PDumpOSWriteString2(hScript, ui32Flags); - + ui32NumPages = ui32NumBytes / ui32PageSize; for (ui32PageCounter = 0; ui32PageCounter < ui32NumPages; ui32PageCounter++) @@ -491,7 +491,7 @@ PVRSRV_ERROR PDumpFreePages (BM_HEAP *psBMHeap, } else { - + } sDevVAddr.uiAddr += ui32PageSize; @@ -515,10 +515,10 @@ PVRSRV_ERROR PDumpFreePageTable (PVRSRV_DEVICE_IDENTIFIER *psDevID, ui32Flags |= PDUMP_FLAGS_CONTINUOUS; ui32Flags |= ( _PDumpIsPersistent() ) ? PDUMP_FLAGS_PERSISTENT : 0; + + PVR_ASSERT(((IMG_UINTPTR_T)pvLinAddr & (ui32PTSize-1UL)) == 0); - PVR_ASSERT(((IMG_UINTPTR_T)pvLinAddr & (ui32PTSize-1UL)) == 0); - - + eErr = PDumpOSBufprintf(hScript, ui32MaxLen, "-- FREE :%s:PAGE_TABLE\r\n", psDevID->pszPDumpDevName); if(eErr != PVRSRV_OK) @@ -527,15 +527,15 @@ PVRSRV_ERROR PDumpFreePageTable (PVRSRV_DEVICE_IDENTIFIER *psDevID, } PDumpOSWriteString2(hScript, ui32Flags); + - - - - - + + + + PDumpOSCPUVAddrToDevPAddr(psDevID->eDeviceType, - hOSMemHandle, + hOSMemHandle, 0, (IMG_PUINT8) pvLinAddr, ui32PTSize, @@ -565,9 +565,9 @@ PVRSRV_ERROR PDumpPDRegWithFlags(PDUMP_MMU_ATTRIB *psMMUAttrib, PVRSRV_ERROR eErr; IMG_CHAR *pszRegString; PDUMP_GET_SCRIPT_STRING() - + if(psMMUAttrib->pszPDRegRegion != IMG_NULL) - { + { pszRegString = psMMUAttrib->pszPDRegRegion; } else @@ -575,7 +575,7 @@ PVRSRV_ERROR PDumpPDRegWithFlags(PDUMP_MMU_ATTRIB *psMMUAttrib, pszRegString = psMMUAttrib->sDevId.pszPDumpRegName; } - + #if defined(SGX_FEATURE_36BIT_MMU) eErr = PDumpOSBufprintf(hScript, ui32MaxLen, @@ -589,7 +589,7 @@ PVRSRV_ERROR PDumpPDRegWithFlags(PDUMP_MMU_ATTRIB *psMMUAttrib, return eErr; } PDumpOSWriteString2(hScript, ui32Flags); - eErr = PDumpOSBufprintf(hScript, ui32MaxLen, "SHR :%s:$1 :%s:$1 0x4\r\n", + eErr = PDumpOSBufprintf(hScript, ui32MaxLen, "SHR :%s:$1 :%s:$1 0x4\r\n", psMMUAttrib->sDevId.pszPDumpDevName, psMMUAttrib->sDevId.pszPDumpDevName); if(eErr != PVRSRV_OK) @@ -626,7 +626,7 @@ PVRSRV_ERROR PDumpPDRegWithFlags(PDUMP_MMU_ATTRIB *psMMUAttrib, return PVRSRV_OK; } -PVRSRV_ERROR PDumpPDReg (PDUMP_MMU_ATTRIB *psMMUAttrib, +PVRSRV_ERROR PDumpPDReg (PDUMP_MMU_ATTRIB *psMMUAttrib, IMG_UINT32 ui32Reg, IMG_UINT32 ui32Data, IMG_HANDLE hUniqueTag) @@ -661,16 +661,16 @@ PVRSRV_ERROR PDumpMemPolKM(PVRSRV_KERNEL_MEM_INFO *psMemInfo, if ( _PDumpIsPersistent() ) { - + return PVRSRV_OK; } - + PVR_ASSERT((ui32Offset + sizeof(IMG_UINT32)) <= psMemInfo->uAllocSize); psMMUAttrib = ((BM_BUF*)psMemInfo->sMemBlk.hBuffer)->pMapping->pBMHeap->psMMUAttrib; - + eErr = PDumpOSBufprintf(hScript, ui32MaxLen, @@ -691,10 +691,10 @@ PVRSRV_ERROR PDumpMemPolKM(PVRSRV_KERNEL_MEM_INFO *psMemInfo, pui8LinAddr = psMemInfo->pvLinAddrKM; - + pui8LinAddr += ui32Offset; - + PDumpOSCPUVAddrToPhysPages(psMemInfo->sMemBlk.hOSMemHandle, @@ -703,15 +703,15 @@ PVRSRV_ERROR PDumpMemPolKM(PVRSRV_KERNEL_MEM_INFO *psMemInfo, psMMUAttrib->ui32DataPageMask, &ui32PageOffset); - + sDevVPageAddr.uiAddr = psMemInfo->sDevVAddr.uiAddr + ui32Offset - ui32PageOffset; PVR_ASSERT((sDevVPageAddr.uiAddr & psMMUAttrib->ui32DataPageMask) == 0); - + BM_GetPhysPageAddr(psMemInfo, sDevVPageAddr, &sDevPAddr); - + sDevPAddr.uiAddr += ui32PageOffset; eErr = PDumpOSBufprintf(hScript, @@ -756,16 +756,16 @@ PVRSRV_ERROR PDumpMemKM(IMG_PVOID pvAltLinAddr, IMG_UINT32 ui32DataPageSize; PDUMP_GET_SCRIPT_AND_FILE_STRING(); - - + + if (ui32Bytes == 0 || PDumpOSIsSuspended()) { return PVRSRV_OK; } psMMUAttrib = ((BM_BUF*)psMemInfo->sMemBlk.hBuffer)->pMapping->pBMHeap->psMMUAttrib; - - + + PVR_ASSERT((ui32Offset + ui32Bytes) <= psMemInfo->uAllocSize); @@ -775,11 +775,11 @@ PVRSRV_ERROR PDumpMemKM(IMG_PVOID pvAltLinAddr, } #if defined(SUPPORT_PDUMP_MULTI_PROCESS) - + { BM_HEAP *pHeap = ((BM_BUF*)psMemInfo->sMemBlk.hBuffer)->pMapping->pBMHeap; PVRSRV_DEVICE_NODE *psDeviceNode = pHeap->pBMContext->psDeviceNode; - + if( psDeviceNode->pfnMMUIsHeapShared(pHeap->pMMUHeap) ) { ui32Flags |= PDUMP_FLAGS_PERSISTENT; @@ -787,7 +787,7 @@ PVRSRV_ERROR PDumpMemKM(IMG_PVOID pvAltLinAddr, } #endif - + if(pvAltLinAddr) { pui8DataLinAddr = pvAltLinAddr; @@ -799,7 +799,7 @@ PVRSRV_ERROR PDumpMemKM(IMG_PVOID pvAltLinAddr, pui8LinAddr = (IMG_UINT8 *)psMemInfo->pvLinAddrKM; sDevVAddr = psMemInfo->sDevVAddr; - + sDevVAddr.uiAddr += ui32Offset; pui8LinAddr += ui32Offset; @@ -809,7 +809,7 @@ PVRSRV_ERROR PDumpMemKM(IMG_PVOID pvAltLinAddr, ui32ParamOutPos = PDumpOSGetStreamOffset(PDUMP_STREAM_PARAM2); - + if(!PDumpOSWriteString(PDumpOSGetStream(PDUMP_STREAM_PARAM2), pui8DataLinAddr, @@ -832,7 +832,7 @@ PVRSRV_ERROR PDumpMemKM(IMG_PVOID pvAltLinAddr, return eErr; } - + eErr = PDumpOSBufprintf(hScript, ui32MaxLenScript, @@ -850,7 +850,7 @@ PVRSRV_ERROR PDumpMemKM(IMG_PVOID pvAltLinAddr, } PDumpOSWriteString2(hScript, ui32Flags); - + PDumpOSCPUVAddrToPhysPages(psMemInfo->sMemBlk.hOSMemHandle, @@ -864,31 +864,31 @@ PVRSRV_ERROR PDumpMemKM(IMG_PVOID pvAltLinAddr, while(ui32NumPages) { ui32NumPages--; - - + + sDevVPageAddr.uiAddr = sDevVAddr.uiAddr - ui32PageByteOffset; if (ui32DataPageSize <= PDUMP_TEMP_BUFFER_SIZE) { - + PVR_ASSERT((sDevVPageAddr.uiAddr & psMMUAttrib->ui32DataPageMask) == 0); } - + BM_GetPhysPageAddr(psMemInfo, sDevVPageAddr, &sDevPAddr); - + sDevPAddr.uiAddr += ui32PageByteOffset; - + if (ui32PageByteOffset + ui32Bytes > ui32DataPageSize) { - + ui32BlockBytes = ui32DataPageSize - ui32PageByteOffset; } else { - + ui32BlockBytes = ui32Bytes; } @@ -908,22 +908,22 @@ PVRSRV_ERROR PDumpMemKM(IMG_PVOID pvAltLinAddr, } PDumpOSWriteString2(hScript, ui32Flags); - + #if defined(SGX_FEATURE_VARIABLE_MMU_PAGE_SIZE) - + ui32PageByteOffset = (ui32PageByteOffset + ui32BlockBytes) % ui32DataPageSize; #else - + ui32PageByteOffset = 0; #endif - - ui32Bytes -= ui32BlockBytes; - + + ui32Bytes -= ui32BlockBytes; + sDevVAddr.uiAddr += ui32BlockBytes; - + pui8LinAddr += ui32BlockBytes; - + ui32ParamOutPos += ui32BlockBytes; } @@ -940,8 +940,8 @@ PVRSRV_ERROR PDumpMemPDEntriesKM(PDUMP_MMU_ATTRIB *psMMUAttrib, IMG_HANDLE hUniqueTag2) { PDUMP_MMU_ATTRIB sMMUAttrib; - - + + sMMUAttrib = *psMMUAttrib; sMMUAttrib.ui32PTSize = (IMG_UINT32)HOST_PAGESIZE(); return PDumpMemPTEntriesKM( &sMMUAttrib, @@ -972,7 +972,7 @@ PVRSRV_ERROR PDumpMemPTEntriesKM(PDUMP_MMU_ATTRIB *psMMUAttrib, IMG_CPU_PHYADDR sCpuPAddr; IMG_UINT32 ui32Offset; IMG_UINT32 ui32ParamOutPos; - IMG_UINT32 ui32PageMask; + IMG_UINT32 ui32PageMask; PDUMP_GET_SCRIPT_AND_FILE_STRING(); ui32Flags |= ( _PDumpIsPersistent() ) ? PDUMP_FLAGS_PERSISTENT : 0; @@ -998,7 +998,7 @@ PVRSRV_ERROR PDumpMemPTEntriesKM(PDUMP_MMU_ATTRIB *psMMUAttrib, if (bInitialisePages) { - + if (!PDumpOSWriteString(PDumpOSGetStream(PDUMP_STREAM_PARAM2), @@ -1023,16 +1023,16 @@ PVRSRV_ERROR PDumpMemPTEntriesKM(PDUMP_MMU_ATTRIB *psMMUAttrib, } } - + ui32PageMask = psMMUAttrib->ui32PTSize - 1; + - - + ui32PageOffset = (IMG_UINT32)((IMG_UINTPTR_T)pvLinAddr & (psMMUAttrib->ui32PTSize - 1)); ui32NumPages = (ui32PageOffset + ui32Bytes + psMMUAttrib->ui32PTSize - 1) / psMMUAttrib->ui32PTSize; pui8LinAddr = (IMG_UINT8*) pvLinAddr; @@ -1040,7 +1040,7 @@ PVRSRV_ERROR PDumpMemPTEntriesKM(PDUMP_MMU_ATTRIB *psMMUAttrib, while (ui32NumPages) { ui32NumPages--; - + @@ -1049,21 +1049,21 @@ PVRSRV_ERROR PDumpMemPTEntriesKM(PDUMP_MMU_ATTRIB *psMMUAttrib, sCpuPAddr = OSMapLinToCPUPhys(hOSMemHandle, pui8LinAddr); sDevPAddr = SysCpuPAddrToDevPAddr(psMMUAttrib->sDevId.eDeviceType, sCpuPAddr); - + if (ui32PageOffset + ui32Bytes > psMMUAttrib->ui32PTSize) { - + ui32BlockBytes = psMMUAttrib->ui32PTSize - ui32PageOffset; } else { - + ui32BlockBytes = ui32Bytes; } + - - + if (bInitialisePages) { eErr = PDumpOSBufprintf(hScript, @@ -1086,11 +1086,11 @@ PVRSRV_ERROR PDumpMemPTEntriesKM(PDUMP_MMU_ATTRIB *psMMUAttrib, { for (ui32Offset = 0; ui32Offset < ui32BlockBytes; ui32Offset += sizeof(IMG_UINT32)) { - IMG_UINT32 ui32PTE = *((IMG_UINT32 *)(IMG_UINTPTR_T)(pui8LinAddr + ui32Offset)); + IMG_UINT32 ui32PTE = *((IMG_UINT32 *)(IMG_UINTPTR_T)(pui8LinAddr + ui32Offset)); if ((ui32PTE & psMMUAttrib->ui32PDEMask) != 0) { - + #if defined(SGX_FEATURE_36BIT_MMU) eErr = PDumpOSBufprintf(hScript, ui32MaxLenScript, @@ -1176,15 +1176,15 @@ PVRSRV_ERROR PDumpMemPTEntriesKM(PDUMP_MMU_ATTRIB *psMMUAttrib, } } + - - + ui32PageOffset = 0; - + ui32Bytes -= ui32BlockBytes; - + pui8LinAddr += ui32BlockBytes; - + ui32ParamOutPos += ui32BlockBytes; } @@ -1205,7 +1205,7 @@ PVRSRV_ERROR PDumpPDDevPAddrKM(PVRSRV_KERNEL_MEM_INFO *psMemInfo, IMG_UINT32 ui32Flags = PDUMP_FLAGS_CONTINUOUS; IMG_UINT32 ui32ParamOutPos; PDUMP_MMU_ATTRIB *psMMUAttrib; - IMG_UINT32 ui32PageMask; + IMG_UINT32 ui32PageMask; PDUMP_GET_SCRIPT_AND_FILE_STRING(); @@ -1219,7 +1219,7 @@ PVRSRV_ERROR PDumpPDDevPAddrKM(PVRSRV_KERNEL_MEM_INFO *psMemInfo, ui32ParamOutPos = PDumpOSGetStreamOffset(PDUMP_STREAM_PARAM2); - + if(!PDumpOSWriteString(PDumpOSGetStream(PDUMP_STREAM_PARAM2), (IMG_UINT8 *)&sPDDevPAddr, sizeof(IMG_DEV_PHYADDR), @@ -1241,7 +1241,7 @@ PVRSRV_ERROR PDumpPDDevPAddrKM(PVRSRV_KERNEL_MEM_INFO *psMemInfo, return eErr; } - + eErr = PDumpOSBufprintf(hScript, ui32MaxLenScript, "-- LDB :%s:PA_0x%08X%08X:0x%08X 0x%08X 0x%08X %s\r\n", @@ -1258,7 +1258,7 @@ PVRSRV_ERROR PDumpPDDevPAddrKM(PVRSRV_KERNEL_MEM_INFO *psMemInfo, } PDumpOSWriteString2(hScript, ui32Flags); - + sDevVAddr = psMemInfo->sDevVAddr; ui32PageByteOffset = sDevVAddr.uiAddr & ui32PageMask; @@ -1371,7 +1371,7 @@ PVRSRV_ERROR PDumpPDDevPAddrKM(PVRSRV_KERNEL_MEM_INFO *psMemInfo, PVRSRV_ERROR PDumpCommentKM(IMG_CHAR *pszComment, IMG_UINT32 ui32Flags) { PVRSRV_ERROR eErr; - IMG_CHAR pszCommentPrefix[] = "-- "; + IMG_CHAR pszCommentPrefix[] = "-- "; #if defined(PDUMP_DEBUG_OUTFILES) IMG_CHAR pszTemp[256]; #endif @@ -1379,17 +1379,17 @@ PVRSRV_ERROR PDumpCommentKM(IMG_CHAR *pszComment, IMG_UINT32 ui32Flags) PDUMP_GET_SCRIPT_STRING(); PDUMP_DBG(("PDumpCommentKM")); #if defined(PDUMP_DEBUG_OUTFILES) - + ui32Flags |= ( _PDumpIsPersistent() ) ? PDUMP_FLAGS_PERSISTENT : 0; #endif - + PDumpOSVerifyLineEnding(pszComment, ui32MaxLen); - + ui32LenCommentPrefix = PDumpOSBuflen(pszCommentPrefix, sizeof(pszCommentPrefix)); - - + + if (!PDumpOSWriteString(PDumpOSGetStream(PDUMP_STREAM_SCRIPT2), (IMG_UINT8*)pszCommentPrefix, ui32LenCommentPrefix, @@ -1422,13 +1422,13 @@ PVRSRV_ERROR PDumpCommentKM(IMG_CHAR *pszComment, IMG_UINT32 ui32Flags) } #if defined(PDUMP_DEBUG_OUTFILES) - + eErr = PDumpOSSprintf(pszTemp, 256, "%d-%d %s", _PDumpGetPID(), g_ui32EveryLineCounter, pszComment); - + eErr = PDumpOSBufprintf(hScript, ui32MaxLen, "%s", pszTemp); #else @@ -1450,7 +1450,7 @@ PVRSRV_ERROR PDumpCommentWithFlags(IMG_UINT32 ui32Flags, IMG_CHAR * pszFormat, . PDUMP_va_list ap; PDUMP_GET_MSG_STRING(); - + PDUMP_va_start(ap, pszFormat); eErr = PDumpOSVSprintf(pszMsg, ui32MaxLen, pszFormat, ap); PDUMP_va_end(ap); @@ -1468,7 +1468,7 @@ PVRSRV_ERROR PDumpComment(IMG_CHAR *pszFormat, ...) PDUMP_va_list ap; PDUMP_GET_MSG_STRING(); - + PDUMP_va_start(ap, pszFormat); eErr = PDumpOSVSprintf(pszMsg, ui32MaxLen, pszFormat, ap); PDUMP_va_end(ap); @@ -1486,14 +1486,14 @@ PVRSRV_ERROR PDumpDriverInfoKM(IMG_CHAR *pszString, IMG_UINT32 ui32Flags) IMG_UINT32 ui32MsgLen; PDUMP_GET_MSG_STRING(); - + eErr = PDumpOSSprintf(pszMsg, ui32MaxLen, "%s", pszString); if(eErr != PVRSRV_OK) { return eErr; } - + PDumpOSVerifyLineEnding(pszMsg, ui32MaxLen); ui32MsgLen = PDumpOSBuflen(pszMsg, ui32MaxLen); @@ -1539,7 +1539,7 @@ PVRSRV_ERROR PDumpBitmapKM( PVRSRV_DEVICE_NODE *psDeviceNode, PDumpCommentWithFlags(ui32PDumpFlags, "\r\n-- Dump bitmap of render\r\n"); - + ui32MMUContextID = psDeviceNode->pfnMMUGetContextID( hDevMemContext ); eErr = PDumpOSBufprintf(hScript, @@ -1599,7 +1599,7 @@ IMG_BOOL PDumpTestNextFrame(IMG_UINT32 ui32CurrentFrame) { IMG_BOOL bFrameDumped; - + (IMG_VOID) PDumpSetFrameKM(ui32CurrentFrame + 1); bFrameDumped = PDumpIsCaptureFrameKM(); @@ -1705,11 +1705,11 @@ PVRSRV_ERROR PDumpTASignatureRegisters (PVRSRV_DEVICE_IDENTIFIER *psDevId, } PDumpRegisterRange(psDevId, - pszFileName, - pui32Registers, - ui32NumRegisters, - &ui32FileOffset, - sizeof(IMG_UINT32), + pszFileName, + pui32Registers, + ui32NumRegisters, + &ui32FileOffset, + sizeof(IMG_UINT32), ui32Flags); return PVRSRV_OK; } @@ -1754,7 +1754,7 @@ PVRSRV_ERROR PDumpRegRead(IMG_CHAR *pszPDumpRegName, PDUMP_GET_SCRIPT_STRING(); eErr = PDumpOSBufprintf(hScript, ui32MaxLen, "RDW :%s:0x%X\r\n", - pszPDumpRegName, + pszPDumpRegName, ui32RegOffset); if(eErr != PVRSRV_OK) { @@ -1774,7 +1774,7 @@ PVRSRV_ERROR PDumpSaveMemKM (PVRSRV_DEVICE_IDENTIFIER *psDevId, { PVRSRV_ERROR eErr; PDUMP_GET_SCRIPT_STRING(); - + eErr = PDumpOSBufprintf(hScript, ui32MaxLen, "SAB :%s:v%x:0x%08X 0x%08X 0x%08X %s.bin\r\n", @@ -1800,7 +1800,7 @@ PVRSRV_ERROR PDumpCycleCountRegRead(PVRSRV_DEVICE_IDENTIFIER *psDevId, PVRSRV_ERROR eErr; PDUMP_GET_SCRIPT_STRING(); - eErr = PDumpOSBufprintf(hScript, ui32MaxLen, "RDW :%s:0x%X\r\n", + eErr = PDumpOSBufprintf(hScript, ui32MaxLen, "RDW :%s:0x%X\r\n", psDevId->pszPDumpRegName, ui32RegOffset); if(eErr != PVRSRV_OK) @@ -1862,24 +1862,24 @@ PVRSRV_ERROR PDumpCBP(PPVRSRV_KERNEL_MEM_INFO psROffMemInfo, IMG_DEV_VIRTADDR sDevVAddr; IMG_DEV_PHYADDR sDevPAddr; IMG_DEV_VIRTADDR sDevVPageAddr; - + PDUMP_MMU_ATTRIB *psMMUAttrib; PDUMP_GET_SCRIPT_STRING(); psMMUAttrib = ((BM_BUF*)psROffMemInfo->sMemBlk.hBuffer)->pMapping->pBMHeap->psMMUAttrib; - + PVR_ASSERT((ui32ROffOffset + sizeof(IMG_UINT32)) <= psROffMemInfo->uAllocSize); pui8LinAddr = psROffMemInfo->pvLinAddrKM; sDevVAddr = psROffMemInfo->sDevVAddr; - + pui8LinAddr += ui32ROffOffset; sDevVAddr.uiAddr += ui32ROffOffset; - + PDumpOSCPUVAddrToPhysPages(psROffMemInfo->sMemBlk.hOSMemHandle, @@ -1888,15 +1888,15 @@ PVRSRV_ERROR PDumpCBP(PPVRSRV_KERNEL_MEM_INFO psROffMemInfo, psMMUAttrib->ui32DataPageMask, &ui32PageOffset); - + sDevVPageAddr.uiAddr = sDevVAddr.uiAddr - ui32PageOffset; PVR_ASSERT((sDevVPageAddr.uiAddr & 0xFFF) == 0); - + BM_GetPhysPageAddr(psROffMemInfo, sDevVPageAddr, &sDevPAddr); - + sDevPAddr.uiAddr += ui32PageOffset; eErr = PDumpOSBufprintf(hScript, @@ -1955,7 +1955,7 @@ PVRSRV_ERROR PDumpMemUM(PVRSRV_PER_PROCESS_DATA *psPerProc, if (psMemInfo->pvLinAddrKM != IMG_NULL && pvAltLinAddrUM == IMG_NULL) { - + return PDumpMemKM(IMG_NULL, psMemInfo, ui32Offset, @@ -1968,7 +1968,7 @@ PVRSRV_ERROR PDumpMemUM(PVRSRV_PER_PROCESS_DATA *psPerProc, pvAddrKM = GetTempBuffer(); - + PVR_ASSERT(pvAddrUM != IMG_NULL && pvAddrKM != IMG_NULL); if (pvAddrUM == IMG_NULL || pvAddrKM == IMG_NULL) { @@ -2006,7 +2006,7 @@ PVRSRV_ERROR PDumpMemUM(PVRSRV_PER_PROCESS_DATA *psPerProc, if (eError != PVRSRV_OK) { - + if (ui32BytesDumped != 0) { PVR_DPF((PVR_DBG_ERROR, "PDumpMemUM: PDumpMemKM failed (%d)", eError)); @@ -2028,12 +2028,12 @@ static PVRSRV_ERROR _PdumpAllocMMUContext(IMG_UINT32 *pui32MMUContextID) { IMG_UINT32 i; - + for(i=0; ipvLinAddrKM & psMMUAttrib->ui32DataPageMask); - - + + sDevVPageAddr.uiAddr = uiAddr - ui32PageOffset; - - + + BM_GetPhysPageAddr(psMemInfo, sDevVPageAddr, &sDevPAddr); - - + + sDevPAddr.uiAddr += ui32PageOffset; PDumpOSBufprintf(hScript, @@ -2186,8 +2186,8 @@ PVRSRV_ERROR PDumpStoreMemToFile(PDUMP_MMU_ATTRIB *psMMUAttrib, pszFileName); PDumpOSWriteString2(hScript, ui32PDumpFlags); - - return PVRSRV_OK; + + return PVRSRV_OK; } PVRSRV_ERROR PDumpRegBasedCBP(IMG_CHAR *pszPDumpRegName, @@ -2208,12 +2208,12 @@ PVRSRV_ERROR PDumpRegBasedCBP(IMG_CHAR *pszPDumpRegName, ui32PacketSize, ui32BufferSize); PDumpOSWriteString2(hScript, ui32Flags); - - return PVRSRV_OK; + + return PVRSRV_OK; } - + #include "syscommon.h" IMG_EXPORT IMG_VOID PDumpConnectionNotify(IMG_VOID) @@ -2221,16 +2221,16 @@ IMG_EXPORT IMG_VOID PDumpConnectionNotify(IMG_VOID) SYS_DATA *psSysData; PVRSRV_DEVICE_NODE *psThis; PVR_DPF((PVR_DBG_WARNING, "PDump has connected.")); - - + + SysAcquireData(&psSysData); - + psThis = psSysData->psDeviceNodeList; while (psThis) { if (psThis->pfnPDumpInitDevice) { - + psThis->pfnPDumpInitDevice(psThis); } psThis = psThis->psNext; @@ -2243,14 +2243,14 @@ IMG_UINT32 DbgWrite(PDBG_STREAM psStream, IMG_UINT8 *pui8Data, IMG_UINT32 ui32BC IMG_UINT32 ui32Off = 0; PDBG_STREAM_CONTROL psCtrl = psStream->psCtrl; - + if ((ui32Flags & PDUMP_FLAGS_NEVER) != 0) { return ui32BCount; } - + #if defined(SUPPORT_PDUMP_MULTI_PROCESS) - + if ( (_PDumpIsProcessActive() == IMG_FALSE ) && ((ui32Flags & PDUMP_FLAGS_PERSISTENT) == 0) ) { @@ -2258,12 +2258,12 @@ IMG_UINT32 DbgWrite(PDBG_STREAM psStream, IMG_UINT8 *pui8Data, IMG_UINT32 ui32BC } #endif - + if ( ((ui32Flags & PDUMP_FLAGS_PERSISTENT) != 0) && (psCtrl->bInitPhaseComplete) ) { while (ui32BCount > 0) { - + ui32BytesWritten = PDumpOSDebugDriverWrite( psStream, @@ -2285,14 +2285,14 @@ IMG_UINT32 DbgWrite(PDBG_STREAM psStream, IMG_UINT8 *pui8Data, IMG_UINT32 ui32BC PVR_DPF((PVR_DBG_ERROR, "DbgWrite: Failed to send persistent data")); if( (psCtrl->ui32Flags & DEBUG_FLAGS_READONLY) != 0) { - + PDumpSuspendKM(); } return 0xFFFFFFFFU; } } - - + + ui32BCount = ui32Off; ui32Off = 0; ui32BytesWritten = 0; } @@ -2300,7 +2300,7 @@ IMG_UINT32 DbgWrite(PDBG_STREAM psStream, IMG_UINT8 *pui8Data, IMG_UINT32 ui32BC { if ((ui32Flags & PDUMP_FLAGS_CONTINUOUS) != 0) { - + if (((psCtrl->ui32CapMode & DEBUG_CAPMODE_FRAMED) != 0) && (psCtrl->ui32Start == 0xFFFFFFFFU) && @@ -2311,7 +2311,7 @@ IMG_UINT32 DbgWrite(PDBG_STREAM psStream, IMG_UINT8 *pui8Data, IMG_UINT32 ui32BC } else { - ui32BytesWritten = PDumpOSDebugDriverWrite( psStream, + ui32BytesWritten = PDumpOSDebugDriverWrite( psStream, PDUMP_WRITE_MODE_CONTINUOUS, &pui8Data[ui32Off], ui32BCount, 1, 0); } @@ -2321,26 +2321,26 @@ IMG_UINT32 DbgWrite(PDBG_STREAM psStream, IMG_UINT8 *pui8Data, IMG_UINT32 ui32BC if (ui32Flags & PDUMP_FLAGS_LASTFRAME) { IMG_UINT32 ui32DbgFlags; - + ui32DbgFlags = 0; if (ui32Flags & PDUMP_FLAGS_RESETLFBUFFER) { ui32DbgFlags |= WRITELF_FLAGS_RESETBUF; } - + ui32BytesWritten = PDumpOSDebugDriverWrite( psStream, PDUMP_WRITE_MODE_LASTFRAME, &pui8Data[ui32Off], ui32BCount, 1, ui32DbgFlags); } else { - ui32BytesWritten = PDumpOSDebugDriverWrite( psStream, + ui32BytesWritten = PDumpOSDebugDriverWrite( psStream, PDUMP_WRITE_MODE_BINCM, &pui8Data[ui32Off], ui32BCount, 1, 0); } } - + if (ui32BytesWritten == 0) @@ -2354,15 +2354,15 @@ IMG_UINT32 DbgWrite(PDBG_STREAM psStream, IMG_UINT8 *pui8Data, IMG_UINT32 ui32BC ui32BCount -= ui32BytesWritten; } - + } - + return ui32BytesWritten; } -#else -#endif +#else +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/perproc.c b/drivers/staging/mrst/pvr/services4/srvkm/common/perproc.c index 90cb2e1..eb73166 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/perproc.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/perproc.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -54,7 +54,7 @@ static PVRSRV_ERROR FreePerProcessData(PVRSRV_PER_PROCESS_DATA *psPerProc) if (uiPerProc == 0) { PVR_DPF((PVR_DBG_ERROR, "FreePerProcessData: Couldn't find process in per-process data hash table")); - + PVR_ASSERT(psPerProc->ui32PID == 0); } else @@ -63,7 +63,7 @@ static PVRSRV_ERROR FreePerProcessData(PVRSRV_PER_PROCESS_DATA *psPerProc) PVR_ASSERT(((PVRSRV_PER_PROCESS_DATA *)uiPerProc)->ui32PID == psPerProc->ui32PID); } - + if (psPerProc->psHandleBase != IMG_NULL) { eError = PVRSRVFreeHandleBase(psPerProc->psHandleBase); @@ -74,7 +74,7 @@ static PVRSRV_ERROR FreePerProcessData(PVRSRV_PER_PROCESS_DATA *psPerProc) } } - + if (psPerProc->hPerProcData != IMG_NULL) { eError = PVRSRVReleaseHandle(KERNEL_HANDLE_BASE, psPerProc->hPerProcData, PVRSRV_HANDLE_TYPE_PERPROC_DATA); @@ -86,7 +86,7 @@ static PVRSRV_ERROR FreePerProcessData(PVRSRV_PER_PROCESS_DATA *psPerProc) } } - + eError = OSPerProcessPrivateDataDeInit(psPerProc->hOsPrivateData); if (eError != PVRSRV_OK) { @@ -98,7 +98,7 @@ static PVRSRV_ERROR FreePerProcessData(PVRSRV_PER_PROCESS_DATA *psPerProc) sizeof(*psPerProc), psPerProc, psPerProc->hBlockAlloc); - + if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR, "FreePerProcessData: Couldn't free per-process data (%d)", eError)); @@ -115,7 +115,7 @@ PVRSRV_PER_PROCESS_DATA *PVRSRVPerProcessData(IMG_UINT32 ui32PID) PVR_ASSERT(psHashTab != IMG_NULL); - + psPerProc = (PVRSRV_PER_PROCESS_DATA *)HASH_Retrieve(psHashTab, (IMG_UINTPTR_T)ui32PID); return psPerProc; } @@ -132,12 +132,12 @@ PVRSRV_ERROR PVRSRVPerProcessDataConnect(IMG_UINT32 ui32PID, IMG_UINT32 ui32Flag return PVRSRV_ERROR_INIT_FAILURE; } - + psPerProc = (PVRSRV_PER_PROCESS_DATA *)HASH_Retrieve(psHashTab, (IMG_UINTPTR_T)ui32PID); if (psPerProc == IMG_NULL) { - + eError = OSAllocMem(PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(*psPerProc), (IMG_PVOID *)&psPerProc, @@ -170,7 +170,7 @@ PVRSRV_ERROR PVRSRVPerProcessDataConnect(IMG_UINT32 ui32PID, IMG_UINT32 ui32Flag PVR_UNREFERENCED_PARAMETER(ui32Flags); #endif - + eError = OSPerProcessPrivateDataInit(&psPerProc->hOsPrivateData); if (eError != PVRSRV_OK) { @@ -178,7 +178,7 @@ PVRSRV_ERROR PVRSRVPerProcessDataConnect(IMG_UINT32 ui32PID, IMG_UINT32 ui32Flag goto failure; } - + eError = PVRSRVAllocHandle(KERNEL_HANDLE_BASE, &psPerProc->hPerProcData, psPerProc, @@ -190,7 +190,7 @@ PVRSRV_ERROR PVRSRVPerProcessDataConnect(IMG_UINT32 ui32PID, IMG_UINT32 ui32Flag goto failure; } - + eError = PVRSRVAllocHandleBase(&psPerProc->psHandleBase); if (eError != PVRSRV_OK) { @@ -198,15 +198,15 @@ PVRSRV_ERROR PVRSRVPerProcessDataConnect(IMG_UINT32 ui32PID, IMG_UINT32 ui32Flag goto failure; } - + eError = OSPerProcessSetHandleOptions(psPerProc->psHandleBase); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR, "PVRSRVPerProcessDataConnect: Couldn't set handle options (%d)", eError)); goto failure; } - - + + eError = PVRSRVResManConnect(psPerProc, &psPerProc->hResManContext); if (eError != PVRSRV_OK) { @@ -217,7 +217,7 @@ PVRSRV_ERROR PVRSRVPerProcessDataConnect(IMG_UINT32 ui32PID, IMG_UINT32 ui32Flag PVRSRVTimeTraceBufferCreate(ui32PID); #endif } - + psPerProc->ui32RefCount++; PVR_DPF((PVR_DBG_MESSAGE, "PVRSRVPerProcessDataConnect: Process 0x%x has ref-count %d", @@ -255,10 +255,10 @@ IMG_VOID PVRSRVPerProcessDataDisconnect(IMG_UINT32 ui32PID) PVRSRVTimeTraceBufferDestroy(ui32PID); #endif - + PVRSRVResManDisconnect(psPerProc->hResManContext, IMG_FALSE); - - + + eError = FreePerProcessData(psPerProc); if (eError != PVRSRV_OK) { @@ -279,7 +279,7 @@ PVRSRV_ERROR PVRSRVPerProcessDataInit(IMG_VOID) { PVR_ASSERT(psHashTab == IMG_NULL); - + psHashTab = HASH_Create(HASH_TAB_INIT_SIZE); if (psHashTab == IMG_NULL) { @@ -292,10 +292,10 @@ PVRSRV_ERROR PVRSRVPerProcessDataInit(IMG_VOID) PVRSRV_ERROR PVRSRVPerProcessDataDeInit(IMG_VOID) { - + if (psHashTab != IMG_NULL) { - + HASH_Delete(psHashTab); psHashTab = IMG_NULL; } diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/power.c b/drivers/staging/mrst/pvr/services4/srvkm/common/power.c index fa2c990..af948bc 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/power.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/power.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -93,7 +93,7 @@ PVRSRV_ERROR PVRSRVPowerLock(IMG_UINT32 ui32CallerID, IMG_BOOL bSystemPowerEvent) { PVRSRV_ERROR eError; - SYS_DATA *psSysData; + SYS_DATA *psSysData; IMG_UINT32 ui32Timeout = 100; IMG_BOOL bTryLock = (ui32CallerID == ISR_ID); @@ -115,7 +115,7 @@ PVRSRV_ERROR PVRSRVPowerLock(IMG_UINT32 ui32CallerID, } else if (bTryLock) { - + eError = PVRSRV_ERROR_RETRY; break; @@ -130,12 +130,12 @@ PVRSRV_ERROR PVRSRVPowerLock(IMG_UINT32 ui32CallerID, OSPowerLockUnwrap(); } - + if ((eError == PVRSRV_OK) && !bSystemPowerEvent && !_IsSystemStatePowered(psSysData->eCurrentPowerState)) { - + PVRSRVPowerUnlock(ui32CallerID); eError = PVRSRV_ERROR_RETRY; } @@ -157,12 +157,12 @@ static PVRSRV_ERROR PVRSRVDevicePrePowerStateKM_AnyVaCb(PVRSRV_POWER_DEV *psPowe PVRSRV_DEV_POWER_STATE eNewDevicePowerState; PVRSRV_ERROR eError; - + IMG_BOOL bAllDevices; IMG_UINT32 ui32DeviceIndex; PVRSRV_DEV_POWER_STATE eNewPowerState; - + bAllDevices = va_arg(va, IMG_BOOL); ui32DeviceIndex = va_arg(va, IMG_UINT32); eNewPowerState = va_arg(va, PVRSRV_DEV_POWER_STATE); @@ -176,7 +176,7 @@ static PVRSRV_ERROR PVRSRVDevicePrePowerStateKM_AnyVaCb(PVRSRV_POWER_DEV *psPowe { if (psPowerDevice->pfnPrePower != IMG_NULL) { - + eError = psPowerDevice->pfnPrePower(psPowerDevice->hDevCookie, eNewDevicePowerState, psPowerDevice->eCurrentPowerState); @@ -186,7 +186,7 @@ static PVRSRV_ERROR PVRSRVDevicePrePowerStateKM_AnyVaCb(PVRSRV_POWER_DEV *psPowe } } - + eError = SysDevicePrePowerState(psPowerDevice->ui32DeviceIndex, eNewDevicePowerState, psPowerDevice->eCurrentPowerState); @@ -210,7 +210,7 @@ PVRSRV_ERROR PVRSRVDevicePrePowerStateKM(IMG_BOOL bAllDevices, SysAcquireData(&psSysData); - + eError = List_PVRSRV_POWER_DEV_PVRSRV_ERROR_Any_va(psSysData->psPowerDeviceList, &PVRSRVDevicePrePowerStateKM_AnyVaCb, bAllDevices, @@ -225,12 +225,12 @@ static PVRSRV_ERROR PVRSRVDevicePostPowerStateKM_AnyVaCb(PVRSRV_POWER_DEV *psPow PVRSRV_DEV_POWER_STATE eNewDevicePowerState; PVRSRV_ERROR eError; - + IMG_BOOL bAllDevices; IMG_UINT32 ui32DeviceIndex; PVRSRV_DEV_POWER_STATE eNewPowerState; - + bAllDevices = va_arg(va, IMG_BOOL); ui32DeviceIndex = va_arg(va, IMG_UINT32); eNewPowerState = va_arg(va, PVRSRV_DEV_POWER_STATE); @@ -242,7 +242,7 @@ static PVRSRV_ERROR PVRSRVDevicePostPowerStateKM_AnyVaCb(PVRSRV_POWER_DEV *psPow if (psPowerDevice->eCurrentPowerState != eNewDevicePowerState) { - + eError = SysDevicePostPowerState(psPowerDevice->ui32DeviceIndex, eNewDevicePowerState, psPowerDevice->eCurrentPowerState); @@ -253,7 +253,7 @@ static PVRSRV_ERROR PVRSRVDevicePostPowerStateKM_AnyVaCb(PVRSRV_POWER_DEV *psPow if (psPowerDevice->pfnPostPower != IMG_NULL) { - + eError = psPowerDevice->pfnPostPower(psPowerDevice->hDevCookie, eNewDevicePowerState, psPowerDevice->eCurrentPowerState); @@ -279,7 +279,7 @@ PVRSRV_ERROR PVRSRVDevicePostPowerStateKM(IMG_BOOL bAllDevices, SysAcquireData(&psSysData); - + eError = List_PVRSRV_POWER_DEV_PVRSRV_ERROR_Any_va(psSysData->psPowerDeviceList, &PVRSRVDevicePostPowerStateKM_AnyVaCb, bAllDevices, @@ -310,7 +310,7 @@ PVRSRV_ERROR PVRSRVSetDevicePowerStateKM(IMG_UINT32 ui32DeviceIndex, #if defined(PDUMP) if (eNewPowerState == PVRSRV_DEV_POWER_STATE_DEFAULT) { - + @@ -329,7 +329,7 @@ PVRSRV_ERROR PVRSRVSetDevicePowerStateKM(IMG_UINT32 ui32DeviceIndex, PDUMPSUSPEND(); } - #endif + #endif eError = PVRSRVDevicePrePowerStateKM(IMG_FALSE, ui32DeviceIndex, eNewPowerState); if(eError != PVRSRV_OK) @@ -374,7 +374,7 @@ PVRSRV_ERROR PVRSRVSystemPrePowerStateKM(PVRSRV_SYS_POWER_STATE eNewSysPowerStat SysAcquireData(&psSysData); - + eError = PVRSRVPowerLock(KERNEL_ID, IMG_TRUE); if(eError != PVRSRV_OK) { @@ -386,7 +386,7 @@ PVRSRV_ERROR PVRSRVSystemPrePowerStateKM(PVRSRV_SYS_POWER_STATE eNewSysPowerStat { if (_IsSystemStatePowered(eNewSysPowerState)) { - + eNewDevicePowerState = PVRSRV_DEV_POWER_STATE_DEFAULT; } else @@ -394,7 +394,7 @@ PVRSRV_ERROR PVRSRVSystemPrePowerStateKM(PVRSRV_SYS_POWER_STATE eNewSysPowerStat eNewDevicePowerState = PVRSRV_DEV_POWER_STATE_OFF; } - + eError = PVRSRVDevicePrePowerStateKM(IMG_TRUE, 0, eNewDevicePowerState); if (eError != PVRSRV_OK) { @@ -404,7 +404,7 @@ PVRSRV_ERROR PVRSRVSystemPrePowerStateKM(PVRSRV_SYS_POWER_STATE eNewSysPowerStat if (eNewSysPowerState != psSysData->eCurrentPowerState) { - + eError = SysSystemPrePowerState(eNewSysPowerState); if (eError != PVRSRV_OK) { @@ -420,7 +420,7 @@ ErrorExit: "PVRSRVSystemPrePowerStateKM: Transition from %d to %d FAILED 0x%x", psSysData->eCurrentPowerState, eNewSysPowerState, eError)); - + psSysData->eFailedPowerState = eNewSysPowerState; PVRSRVPowerUnlock(KERNEL_ID); @@ -440,7 +440,7 @@ PVRSRV_ERROR PVRSRVSystemPostPowerStateKM(PVRSRV_SYS_POWER_STATE eNewSysPowerSta if (eNewSysPowerState != psSysData->eCurrentPowerState) { - + eError = SysSystemPostPowerState(eNewSysPowerState); if (eError != PVRSRV_OK) { @@ -453,7 +453,7 @@ PVRSRV_ERROR PVRSRVSystemPostPowerStateKM(PVRSRV_SYS_POWER_STATE eNewSysPowerSta { if (_IsSystemStatePowered(eNewSysPowerState)) { - + eNewDevicePowerState = PVRSRV_DEV_POWER_STATE_DEFAULT; } else @@ -461,7 +461,7 @@ PVRSRV_ERROR PVRSRVSystemPostPowerStateKM(PVRSRV_SYS_POWER_STATE eNewSysPowerSta eNewDevicePowerState = PVRSRV_DEV_POWER_STATE_OFF; } - + eError = PVRSRVDevicePostPowerStateKM(IMG_TRUE, 0, eNewDevicePowerState); if (eError != PVRSRV_OK) { @@ -479,11 +479,11 @@ Exit: PVRSRVPowerUnlock(KERNEL_ID); - + if (_IsSystemStatePowered(eNewSysPowerState) && PVRSRVGetInitServerState(PVRSRV_INIT_SERVER_SUCCESSFUL)) { - + PVRSRVScheduleDeviceCallbacks(); @@ -513,7 +513,7 @@ PVRSRV_ERROR PVRSRVSetPowerStateKM(PVRSRV_SYS_POWER_STATE eNewSysPowerState) goto ErrorExit; } - + psSysData->eFailedPowerState = PVRSRV_SYS_POWER_STATE_Unspecified; return PVRSRV_OK; @@ -524,7 +524,7 @@ ErrorExit: "PVRSRVSetPowerStateKM: Transition from %d to %d FAILED 0x%x", psSysData->eCurrentPowerState, eNewSysPowerState, eError)); - + psSysData->eFailedPowerState = eNewSysPowerState; return eError; @@ -562,7 +562,7 @@ PVRSRV_ERROR PVRSRVRegisterPowerDevice(IMG_UINT32 ui32DeviceIndex, return eError; } - + psPowerDevice->pfnPrePower = pfnPrePower; psPowerDevice->pfnPostPower = pfnPostPower; psPowerDevice->pfnPreClockSpeedChange = pfnPreClockSpeedChange; @@ -572,7 +572,7 @@ PVRSRV_ERROR PVRSRVRegisterPowerDevice(IMG_UINT32 ui32DeviceIndex, psPowerDevice->eCurrentPowerState = eCurrentPowerState; psPowerDevice->eDefaultPowerState = eDefaultPowerState; - + List_PVRSRV_POWER_DEV_Insert(&(psSysData->psPowerDeviceList), psPowerDevice); return (PVRSRV_OK); @@ -586,7 +586,7 @@ PVRSRV_ERROR PVRSRVRemovePowerDevice (IMG_UINT32 ui32DeviceIndex) SysAcquireData(&psSysData); - + psPowerDev = (PVRSRV_POWER_DEV*) List_PVRSRV_POWER_DEV_Any_va(psSysData->psPowerDeviceList, &MatchPowerDeviceIndex_AnyVaCb, @@ -596,7 +596,7 @@ PVRSRV_ERROR PVRSRVRemovePowerDevice (IMG_UINT32 ui32DeviceIndex) { List_PVRSRV_POWER_DEV_Remove(psPowerDev); OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_POWER_DEV), psPowerDev, IMG_NULL); - + } return (PVRSRV_OK); @@ -611,7 +611,7 @@ IMG_BOOL PVRSRVIsDevicePowered(IMG_UINT32 ui32DeviceIndex) SysAcquireData(&psSysData); - + if (OSIsResourceLocked(&psSysData->sPowerStateChangeResource, KERNEL_ID) || OSIsResourceLocked(&psSysData->sPowerStateChangeResource, ISR_ID)) { @@ -641,7 +641,7 @@ PVRSRV_ERROR PVRSRVDevicePreClockSpeedChange(IMG_UINT32 ui32DeviceIndex, if (bIdleDevice) { - + eError = PVRSRVPowerLock(KERNEL_ID, IMG_FALSE); if (eError != PVRSRV_OK) { @@ -650,7 +650,7 @@ PVRSRV_ERROR PVRSRVDevicePreClockSpeedChange(IMG_UINT32 ui32DeviceIndex, } } - + psPowerDevice = (PVRSRV_POWER_DEV*) List_PVRSRV_POWER_DEV_Any_va(psSysData->psPowerDeviceList, &MatchPowerDeviceIndex_AnyVaCb, @@ -690,7 +690,7 @@ IMG_VOID PVRSRVDevicePostClockSpeedChange(IMG_UINT32 ui32DeviceIndex, SysAcquireData(&psSysData); - + psPowerDevice = (PVRSRV_POWER_DEV*) List_PVRSRV_POWER_DEV_Any_va(psSysData->psPowerDeviceList, &MatchPowerDeviceIndex_AnyVaCb, @@ -712,7 +712,7 @@ IMG_VOID PVRSRVDevicePostClockSpeedChange(IMG_UINT32 ui32DeviceIndex, if (bIdleDevice) { - + PVRSRVPowerUnlock(KERNEL_ID); } } diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/pvrsrv.c b/drivers/staging/mrst/pvr/services4/srvkm/common/pvrsrv.c index 9b8e77e..1b730f5 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/pvrsrv.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/pvrsrv.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -54,7 +54,7 @@ PVRSRV_ERROR AllocateDeviceID(SYS_DATA *psSysData, IMG_UINT32 *pui32DevID) psDeviceWalker = &psSysData->sDeviceID[0]; psDeviceEnd = psDeviceWalker + psSysData->ui32NumDevices; - + while (psDeviceWalker < psDeviceEnd) { if (!psDeviceWalker->bInUse) @@ -68,7 +68,7 @@ PVRSRV_ERROR AllocateDeviceID(SYS_DATA *psSysData, IMG_UINT32 *pui32DevID) PVR_DPF((PVR_DBG_ERROR,"AllocateDeviceID: No free and valid device IDs available!")); - + PVR_ASSERT(psDeviceWalker < psDeviceEnd); return PVRSRV_ERROR_NO_FREE_DEVICEIDS_AVALIABLE; @@ -83,10 +83,10 @@ PVRSRV_ERROR FreeDeviceID(SYS_DATA *psSysData, IMG_UINT32 ui32DevID) psDeviceWalker = &psSysData->sDeviceID[0]; psDeviceEnd = psDeviceWalker + psSysData->ui32NumDevices; - + while (psDeviceWalker < psDeviceEnd) { - + if ( (psDeviceWalker->uiID == ui32DevID) && (psDeviceWalker->bInUse) @@ -100,7 +100,7 @@ PVRSRV_ERROR FreeDeviceID(SYS_DATA *psSysData, IMG_UINT32 ui32DevID) PVR_DPF((PVR_DBG_ERROR,"FreeDeviceID: no matching dev ID that is in use!")); - + PVR_ASSERT(psDeviceWalker < psDeviceEnd); return PVRSRV_ERROR_INVALID_DEVICEID; @@ -174,17 +174,17 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVEnumerateDevicesKM(IMG_UINT32 *pui32NumDevices, SysAcquireData(&psSysData); - + for (i=0; isPowerStateChangeResource); if (eError != PVRSRV_OK) { goto Error; } - + psSysData->eCurrentPowerState = PVRSRV_SYS_POWER_STATE_D0; psSysData->eFailedPowerState = PVRSRV_SYS_POWER_STATE_Unspecified; - + if(OSAllocMem( PVRSRV_PAGEABLE_SELECT, sizeof(PVRSRV_EVENTOBJECT) , (IMG_VOID **)&psSysData->psGlobalEventObject, 0, @@ -248,7 +248,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVInit(PSYS_DATA psSysData) goto Error; } - + psSysData->pfnHighResTimerCreate = OSFuncHighResTimerCreate; psSysData->pfnHighResTimerGetus = OSFuncHighResTimerGetus; psSysData->pfnHighResTimerDestroy = OSFuncHighResTimerDestroy; @@ -260,7 +260,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVInit(PSYS_DATA psSysData) g_ui32InitFlags |= INIT_DATA_ENABLE_TTARCE; #endif - + PDUMPINIT(); g_ui32InitFlags |= INIT_DATA_ENABLE_PDUMPINIT; @@ -289,19 +289,19 @@ IMG_VOID IMG_CALLCONV PVRSRVDeInit(PSYS_DATA psSysData) PERFDEINIT(); #if defined(TTRACE) - + if ((g_ui32InitFlags & INIT_DATA_ENABLE_TTARCE) > 0) { PVRSRVTimeTraceDeinit(); } #endif - + if( (g_ui32InitFlags & INIT_DATA_ENABLE_PDUMPINIT) > 0) { PDUMPDEINIT(); } - - + + if(psSysData->psGlobalEventObject) { OSEventObjectDestroyKM(psSysData->psGlobalEventObject); @@ -336,7 +336,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVRegisterDevice(PSYS_DATA psSysData, PVRSRV_ERROR eError; PVRSRV_DEVICE_NODE *psDeviceNode; - + if(OSAllocMem( PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_DEVICE_NODE), (IMG_VOID **)&psDeviceNode, IMG_NULL, @@ -352,12 +352,12 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVRegisterDevice(PSYS_DATA psSysData, { OSFreeMem(PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_DEVICE_NODE), psDeviceNode, IMG_NULL); - + PVR_DPF((PVR_DBG_ERROR,"PVRSRVRegisterDevice : Failed to register device")); return (PVRSRV_ERROR_DEVICE_REGISTER_FAILED); } - + @@ -366,13 +366,13 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVRegisterDevice(PSYS_DATA psSysData, psDeviceNode->psSysData = psSysData; psDeviceNode->ui32SOCInterruptBit = ui32SOCInterruptBit; - + AllocateDeviceID(psSysData, &psDeviceNode->sDevId.ui32DeviceIndex); - + List_PVRSRV_DEVICE_NODE_Insert(&psSysData->psDeviceNodeList, psDeviceNode); - + *pui32DeviceIndex = psDeviceNode->sDevId.ui32DeviceIndex; return PVRSRV_OK; @@ -389,7 +389,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVInitialiseDevice (IMG_UINT32 ui32DevIndex) SysAcquireData(&psSysData); - + psDeviceNode = (PVRSRV_DEVICE_NODE*) List_PVRSRV_DEVICE_NODE_Any_va(psSysData->psDeviceNodeList, &MatchDeviceKM_AnyVaCb, @@ -397,13 +397,13 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVInitialiseDevice (IMG_UINT32 ui32DevIndex) IMG_TRUE); if(!psDeviceNode) { - + PVR_DPF((PVR_DBG_ERROR,"PVRSRVInitialiseDevice: requested device is not present")); return PVRSRV_ERROR_INIT_FAILURE; } PVR_ASSERT (psDeviceNode->ui32RefCount > 0); - + eError = PVRSRVResManConnect(IMG_NULL, &psDeviceNode->hResManContext); if (eError != PVRSRV_OK) @@ -412,7 +412,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVInitialiseDevice (IMG_UINT32 ui32DevIndex) return eError; } - + if(psDeviceNode->pfnInitDevice != IMG_NULL) { eError = psDeviceNode->pfnInitDevice(psDeviceNode); @@ -470,7 +470,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVFinaliseSystem(IMG_BOOL bInitSuccessful) return eError; } - + eError = List_PVRSRV_DEVICE_NODE_PVRSRV_ERROR_Any(psSysData->psDeviceNodeList, &PVRSRVFinaliseSystem_SetPowerState_AnyCb); if (eError != PVRSRV_OK) @@ -478,7 +478,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVFinaliseSystem(IMG_BOOL bInitSuccessful) return eError; } - + eError = List_PVRSRV_DEVICE_NODE_PVRSRV_ERROR_Any(psSysData->psDeviceNodeList, &PVRSRVFinaliseSystem_CompatCheck_AnyCb); if (eError != PVRSRV_OK) @@ -487,7 +487,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVFinaliseSystem(IMG_BOOL bInitSuccessful) } } - + @@ -499,7 +499,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVFinaliseSystem(IMG_BOOL bInitSuccessful) PVRSRV_ERROR PVRSRVDevInitCompatCheck(PVRSRV_DEVICE_NODE *psDeviceNode) { - + if (psDeviceNode->pfnInitDeviceCompatCheck) return psDeviceNode->pfnInitDeviceCompatCheck(psDeviceNode); else @@ -539,7 +539,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVAcquireDeviceDataKM (IMG_UINT32 ui32DevIndex, SysAcquireData(&psSysData); - + psDeviceNode = List_PVRSRV_DEVICE_NODE_Any_va(psSysData->psDeviceNodeList, &PVRSRVAcquireDeviceDataKM_Match_AnyVaCb, eDeviceType, @@ -548,14 +548,14 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVAcquireDeviceDataKM (IMG_UINT32 ui32DevIndex, if (!psDeviceNode) { - + PVR_DPF((PVR_DBG_ERROR,"PVRSRVAcquireDeviceDataKM: requested device is not present")); return PVRSRV_ERROR_INIT_FAILURE; } PVR_ASSERT (psDeviceNode->ui32RefCount > 0); - + if (phDevCookie) { *phDevCookie = (IMG_HANDLE)psDeviceNode; @@ -585,7 +585,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVDeinitialiseDevice(IMG_UINT32 ui32DevIndex) return PVRSRV_ERROR_DEVICEID_NOT_FOUND; } - + eError = PVRSRVSetDevicePowerStateKM(ui32DevIndex, PVRSRV_DEV_POWER_STATE_OFF, @@ -597,7 +597,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVDeinitialiseDevice(IMG_UINT32 ui32DevIndex) return eError; } - + eError = ResManFreeResByCriteria(psDeviceNode->hResManContext, RESMAN_CRITERIA_RESTYPE, @@ -609,7 +609,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVDeinitialiseDevice(IMG_UINT32 ui32DevIndex) return eError; } - + if(psDeviceNode->pfnDeInitDevice != IMG_NULL) { @@ -621,19 +621,19 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVDeinitialiseDevice(IMG_UINT32 ui32DevIndex) } } - + PVRSRVResManDisconnect(psDeviceNode->hResManContext, IMG_TRUE); psDeviceNode->hResManContext = IMG_NULL; - + List_PVRSRV_DEVICE_NODE_Remove(psDeviceNode); - + (IMG_VOID)FreeDeviceID(psSysData, ui32DevIndex); OSFreeMem(PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_DEVICE_NODE), psDeviceNode, IMG_NULL); - + return (PVRSRV_OK); } @@ -652,10 +652,10 @@ PVRSRV_ERROR IMG_CALLCONV PollForValueKM (volatile IMG_UINT32* pui32LinMemAddr, PVR_UNREFERENCED_PARAMETER(bAllowPreemption); #if !defined(__linux__) PVR_UNREFERENCED_PARAMETER(ui32PollPeriodus); - #endif - - - + #endif + + + do { if((*pui32LinMemAddr & ui32Mask) == ui32Value) @@ -667,20 +667,20 @@ PVRSRV_ERROR IMG_CALLCONV PollForValueKM (volatile IMG_UINT32* pui32LinMemAddr, OSWaitus(ui32PollPeriodus); #else OSReleaseThreadQuanta(); - #endif + #endif - } while (ui32Timeoutus); + } while (ui32Timeoutus); } #else { - IMG_UINT32 ui32ActualValue = 0xFFFFFFFFU; + IMG_UINT32 ui32ActualValue = 0xFFFFFFFFU; if (bAllowPreemption) { PVR_ASSERT(ui32PollPeriodus >= 1000); } - + LOOP_UNTIL_TIMEOUT(ui32Timeoutus) { ui32ActualValue = (*pui32LinMemAddr & ui32Mask); @@ -688,7 +688,7 @@ PVRSRV_ERROR IMG_CALLCONV PollForValueKM (volatile IMG_UINT32* pui32LinMemAddr, { return PVRSRV_OK; } - + if (bAllowPreemption) { OSSleepms(ui32PollPeriodus / 1000); @@ -698,11 +698,11 @@ PVRSRV_ERROR IMG_CALLCONV PollForValueKM (volatile IMG_UINT32* pui32LinMemAddr, OSWaitus(ui32PollPeriodus); } } END_LOOP_UNTIL_TIMEOUT(); - + PVR_DPF((PVR_DBG_ERROR,"PollForValueKM: Timeout. Expected 0x%x but found 0x%x (mask 0x%x).", ui32Value, ui32ActualValue, ui32Mask)); } -#endif +#endif return PVRSRV_ERROR_TIMEOUT; } @@ -719,7 +719,7 @@ static IMG_VOID PVRSRVGetMiscInfoKM_RA_GetStats_ForEachVaCb(BM_HEAP *psBMHeap, v pui32StrLen = va_arg(va, IMG_UINT32*); ui32Mode = va_arg(va, IMG_UINT32); - + switch(ui32Mode) { case PVRSRV_MISC_INFO_MEMSTATS_PRESENT: @@ -790,7 +790,7 @@ static PVRSRV_ERROR PVRSRVGetMiscInfoKM_Device_AnyVaCb(PVRSRV_DEVICE_NODE *psDev *pi32Count = OSSNPrintf(*ppszStr, 100, "\n\nDevice Type %d:\n", psDeviceNode->sDevId.eDeviceType); UPDATE_SPACE(*ppszStr, *pi32Count, *pui32StrLen); - + if(psDeviceNode->sDevMemoryInfo.pBMKernelContext) { CHECK_SPACE(*pui32StrLen); @@ -804,7 +804,7 @@ static PVRSRV_ERROR PVRSRVGetMiscInfoKM_Device_AnyVaCb(PVRSRV_DEVICE_NODE *psDev ui32Mode); } - + return List_BM_CONTEXT_PVRSRV_ERROR_Any_va(psDeviceNode->sDevMemoryInfo.pBMContext, &PVRSRVGetMiscInfoKM_BMContext_AnyVaCb, pui32StrLen, @@ -831,7 +831,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfoKM(PVRSRV_MISC_INFO *psMiscInfo) psMiscInfo->ui32StatePresent = 0; - + if(psMiscInfo->ui32StateRequest & ~(PVRSRV_MISC_INFO_TIMER_PRESENT |PVRSRV_MISC_INFO_CLOCKGATE_PRESENT |PVRSRV_MISC_INFO_MEMSTATS_PRESENT @@ -848,7 +848,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfoKM(PVRSRV_MISC_INFO *psMiscInfo) SysAcquireData(&psSysData); - + if(((psMiscInfo->ui32StateRequest & PVRSRV_MISC_INFO_TIMER_PRESENT) != 0UL) && (psSysData->pvSOCTimerRegisterKM != IMG_NULL)) { @@ -862,7 +862,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfoKM(PVRSRV_MISC_INFO *psMiscInfo) psMiscInfo->hSOCTimerRegisterOSMemHandle = IMG_NULL; } - + if(((psMiscInfo->ui32StateRequest & PVRSRV_MISC_INFO_CLOCKGATE_PRESENT) != 0UL) && (psSysData->pvSOCClockGateRegsBase != IMG_NULL)) { @@ -871,7 +871,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfoKM(PVRSRV_MISC_INFO *psMiscInfo) psMiscInfo->ui32SOCClockGateRegsSize = psSysData->ui32SOCClockGateRegsSize; } - + if(((psMiscInfo->ui32StateRequest & PVRSRV_MISC_INFO_MEMSTATS_PRESENT) != 0UL) && (psMiscInfo->pszMemoryStr != IMG_NULL)) { @@ -885,7 +885,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfoKM(PVRSRV_MISC_INFO *psMiscInfo) psMiscInfo->ui32StatePresent |= PVRSRV_MISC_INFO_MEMSTATS_PRESENT; - + ppArena = &psSysData->apsLocalDevMemArena[0]; while(*ppArena) { @@ -896,12 +896,12 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfoKM(PVRSRV_MISC_INFO *psMiscInfo) RA_GetStats(*ppArena, &pszStr, &ui32StrLen); - + ppArena++; } - - + + List_PVRSRV_DEVICE_NODE_PVRSRV_ERROR_Any_va(psSysData->psDeviceNodeList, &PVRSRVGetMiscInfoKM_Device_AnyVaCb, &ui32StrLen, @@ -909,32 +909,32 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfoKM(PVRSRV_MISC_INFO *psMiscInfo) &pszStr, PVRSRV_MISC_INFO_MEMSTATS_PRESENT); - + i32Count = OSSNPrintf(pszStr, 100, "\n"); UPDATE_SPACE(pszStr, i32Count, ui32StrLen); } - + if(((psMiscInfo->ui32StateRequest & PVRSRV_MISC_INFO_FREEMEM_PRESENT) != 0) && psMiscInfo->pszMemoryStr) { IMG_CHAR *pszStr; IMG_UINT32 ui32StrLen; IMG_INT32 i32Count; - + pszStr = psMiscInfo->pszMemoryStr; ui32StrLen = psMiscInfo->ui32MemoryStrLen; - + psMiscInfo->ui32StatePresent |= PVRSRV_MISC_INFO_FREEMEM_PRESENT; - + List_PVRSRV_DEVICE_NODE_PVRSRV_ERROR_Any_va(psSysData->psDeviceNodeList, &PVRSRVGetMiscInfoKM_Device_AnyVaCb, &ui32StrLen, &i32Count, &pszStr, PVRSRV_MISC_INFO_FREEMEM_PRESENT); - + i32Count = OSSNPrintf(pszStr, 100, "\n"); UPDATE_SPACE(pszStr, i32Count, ui32StrLen); } @@ -946,7 +946,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfoKM(PVRSRV_MISC_INFO *psMiscInfo) psMiscInfo->sGlobalEventObject = *psSysData->psGlobalEventObject; } - + if (((psMiscInfo->ui32StateRequest & PVRSRV_MISC_INFO_DDKVERSION_PRESENT) != 0UL) && ((psMiscInfo->ui32StateRequest & PVRSRV_MISC_INFO_MEMSTATS_PRESENT) == 0UL) @@ -954,12 +954,12 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfoKM(PVRSRV_MISC_INFO *psMiscInfo) { IMG_CHAR *pszStr; IMG_UINT32 ui32StrLen; - IMG_UINT32 ui32LenStrPerNum = 12; + IMG_UINT32 ui32LenStrPerNum = 12; IMG_INT32 i32Count; IMG_INT i; psMiscInfo->ui32StatePresent |= PVRSRV_MISC_INFO_DDKVERSION_PRESENT; - + psMiscInfo->aui32DDKVersion[0] = PVRVERSION_MAJ; psMiscInfo->aui32DDKVersion[1] = PVRVERSION_MIN; psMiscInfo->aui32DDKVersion[2] = PVRVERSION_BUILD_HI; @@ -991,7 +991,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfoKM(PVRSRV_MISC_INFO *psMiscInfo) if(psMiscInfo->sCacheOpCtl.bDeferOp) { - + psSysData->ePendingCacheOpType = psMiscInfo->sCacheOpCtl.eCacheOpType; } else @@ -1022,7 +1022,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfoKM(PVRSRV_MISC_INFO *psMiscInfo) #if defined (SUPPORT_SID_INTERFACE) PVR_DBG_BREAK #else - + psPerProc = PVRSRVFindPerProcessData(); if(PVRSRVLookupHandle(psPerProc->psHandleBase, @@ -1069,7 +1069,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfoKM(PVRSRV_MISC_INFO *psMiscInfo) #if defined (SUPPORT_SID_INTERFACE) PVR_DBG_BREAK #else - + psPerProc = PVRSRVFindPerProcessData(); if(PVRSRVLookupHandle(psPerProc->psHandleBase, @@ -1092,7 +1092,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfoKM(PVRSRV_MISC_INFO *psMiscInfo) PVR_LOG(("User requested OS reset")); OSPanic(); } -#endif +#endif return PVRSRV_OK; } @@ -1111,7 +1111,7 @@ IMG_BOOL IMG_CALLCONV PVRSRVDeviceLISR(PVRSRV_DEVICE_NODE *psDeviceNode) } psSysData = psDeviceNode->psSysData; - + ui32InterruptSource = SysGetInterruptSource(psSysData, psDeviceNode); if(ui32InterruptSource & psDeviceNode->ui32SOCInterruptBit) { @@ -1145,10 +1145,10 @@ static IMG_VOID PVRSRVSystemLISR_ForEachVaCb(PVRSRV_DEVICE_NODE *psDeviceNode, v { if((*psDeviceNode->pfnDeviceISR)(psDeviceNode->pvISRData)) { - + *pbStatus = IMG_TRUE; } - + *pui32ClearInterrupts |= psDeviceNode->ui32SOCInterruptBit; } } @@ -1166,13 +1166,13 @@ IMG_BOOL IMG_CALLCONV PVRSRVSystemLISR(IMG_VOID *pvSysData) } else { - + ui32InterruptSource = SysGetInterruptSource(psSysData, IMG_NULL); - + if(ui32InterruptSource) { - + List_PVRSRV_DEVICE_NODE_ForEach_va(psSysData->psDeviceNodeList, &PVRSRVSystemLISR_ForEachVaCb, &bStatus, @@ -1203,17 +1203,17 @@ IMG_VOID IMG_CALLCONV PVRSRVMISR(IMG_VOID *pvSysData) return; } - + List_PVRSRV_DEVICE_NODE_ForEach(psSysData->psDeviceNodeList, &PVRSRVMISR_ForEachCb); - + if (PVRSRVProcessQueues(IMG_FALSE) == PVRSRV_ERROR_PROCESSING_BLOCKED) { PVRSRVProcessQueues(IMG_FALSE); } - + if (psSysData->psGlobalEventObject) { IMG_HANDLE hOSEventKM = psSysData->psGlobalEventObject->hOSEventKM; @@ -1255,12 +1255,12 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVSaveRestoreLiveSegments(IMG_HANDLE hArena, IMG_P sSegDetails.sCpuPhyAddr.uiAddr = 0; sSegDetails.hSegment = 0; - + while (RA_GetNextLiveSegment(hArena, &sSegDetails)) { if (pbyBuffer == IMG_NULL) { - + uiBytesSaved += sizeof(sSegDetails.uiSize) + sSegDetails.uiSize; } else @@ -1272,7 +1272,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVSaveRestoreLiveSegments(IMG_HANDLE hArena, IMG_P PVR_DPF((PVR_DBG_MESSAGE, "PVRSRVSaveRestoreLiveSegments: Base %08x size %08x", sSegDetails.sCpuPhyAddr.uiAddr, sSegDetails.uiSize)); - + pvLocalMemCPUVAddr = OSMapPhysToLin(sSegDetails.sCpuPhyAddr, sSegDetails.uiSize, PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, @@ -1285,7 +1285,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVSaveRestoreLiveSegments(IMG_HANDLE hArena, IMG_P if (bSave) { - + OSMemCopy(pbyBuffer, &sSegDetails.uiSize, sizeof(sSegDetails.uiSize)); pbyBuffer += sizeof(sSegDetails.uiSize); @@ -1295,7 +1295,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVSaveRestoreLiveSegments(IMG_HANDLE hArena, IMG_P else { IMG_UINT32 uiSize; - + OSMemCopy(&uiSize, pbyBuffer, sizeof(sSegDetails.uiSize)); if (uiSize != sSegDetails.uiSize) @@ -1332,8 +1332,8 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVSaveRestoreLiveSegments(IMG_HANDLE hArena, IMG_P IMG_EXPORT const IMG_CHAR *PVRSRVGetErrorStringKM(PVRSRV_ERROR eError) -{ - +{ + #include "pvrsrv_errors.h" } @@ -1341,7 +1341,7 @@ static IMG_VOID PVRSRVCommandCompleteCallbacks_ForEachCb(PVRSRV_DEVICE_NODE *psD { if(psDeviceNode->pfnDeviceCommandComplete != IMG_NULL) { - + (*psDeviceNode->pfnDeviceCommandComplete)(psDeviceNode); } } @@ -1351,7 +1351,7 @@ IMG_VOID PVRSRVScheduleDeviceCallbacks(IMG_VOID) SYS_DATA *psSysData; SysAcquireData(&psSysData); - + List_PVRSRV_DEVICE_NODE_ForEach(psSysData->psDeviceNodeList, &PVRSRVCommandCompleteCallbacks_ForEachCb); } diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/queue.c b/drivers/staging/mrst/pvr/services4/srvkm/common/queue.c index 0af800a..6d7b036 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/queue.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/queue.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -41,8 +41,8 @@ typedef struct _DEVICE_COMMAND_DATA_ PFN_CMD_PROC pfnCmdProc; PCOMMAND_COMPLETE_DATA apsCmdCompleteData[DC_NUM_COMMANDS_PER_TYPE]; IMG_UINT32 ui32CCBOffset; - IMG_UINT32 ui32MaxDstSyncCount; - IMG_UINT32 ui32MaxSrcSyncCount; + IMG_UINT32 ui32MaxDstSyncCount; + IMG_UINT32 ui32MaxSrcSyncCount; } DEVICE_COMMAND_DATA; @@ -99,7 +99,7 @@ void ProcSeqShowQueue(struct seq_file *sfile,void* el) } } - + ui32ReadOffset += psCmd->uCmdSize; ui32ReadOffset &= psQueue->ui32QueueSize - 1; cmds++; @@ -132,7 +132,7 @@ void* ProcSeqOff2ElementQueue(struct seq_file * sfile, loff_t off) return psQueue; } -#endif +#endif #define GET_SPACE_IN_CMDQ(psQueue) \ ((((psQueue)->ui32ReadOffset - (psQueue)->ui32WriteOffset) \ @@ -159,7 +159,7 @@ IMG_UINT32 PVRSRVGetWriteOpsPending(PVRSRV_KERNEL_SYNC_INFO *psSyncInfo, IMG_BOO } else { - + ui32WriteOpsPending = psSyncInfo->psSyncData->ui32WriteOpsPending++; @@ -362,7 +362,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateCommandQueueKM(IMG_SIZE_T ui32QueueSize, SysAcquireData(&psSysData); - + eError = OSAllocMem(PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_QUEUE_INFO), (IMG_VOID **)&psQueueInfo, &hMemBlock, @@ -377,7 +377,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateCommandQueueKM(IMG_SIZE_T ui32QueueSize, psQueueInfo->hMemBlock[0] = hMemBlock; psQueueInfo->ui32ProcessID = OSGetCurrentProcessIDKM(); - + eError = OSAllocMem(PVRSRV_OS_NON_PAGEABLE_HEAP, ui32Power2QueueSize + PVRSRV_MAX_CMD_SIZE, &psQueueInfo->pvLinQueueKM, &hMemBlock, @@ -391,13 +391,13 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateCommandQueueKM(IMG_SIZE_T ui32QueueSize, psQueueInfo->hMemBlock[1] = hMemBlock; psQueueInfo->pvLinQueueUM = psQueueInfo->pvLinQueueKM; - + PVR_ASSERT(psQueueInfo->ui32ReadOffset == 0); PVR_ASSERT(psQueueInfo->ui32WriteOffset == 0); psQueueInfo->ui32QueueSize = ui32Power2QueueSize; - + if (psSysData->psQueueList == IMG_NULL) { eError = OSCreateResource(&psSysData->sQProcessResource); @@ -407,7 +407,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateCommandQueueKM(IMG_SIZE_T ui32QueueSize, } } - + eError = OSLockResource(&psSysData->sQProcessResource, KERNEL_ID); if (eError != PVRSRV_OK) @@ -445,7 +445,7 @@ ErrorExit: sizeof(PVRSRV_QUEUE_INFO), psQueueInfo, psQueueInfo->hMemBlock[0]); - + } return eError; @@ -464,7 +464,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyCommandQueueKM(PVRSRV_QUEUE_INFO *psQueue psQueue = psSysData->psQueueList; - + LOOP_UNTIL_TIMEOUT(MAX_HW_TIME_US) { if(psQueueInfo->ui32ReadOffset == psQueueInfo->ui32WriteOffset) @@ -477,13 +477,13 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyCommandQueueKM(PVRSRV_QUEUE_INFO *psQueue if (bTimeout) { - + PVR_DPF((PVR_DBG_ERROR,"PVRSRVDestroyCommandQueueKM : Failed to empty queue")); eError = PVRSRV_ERROR_CANNOT_FLUSH_QUEUE; goto ErrorExit; } - + eError = OSLockResource(&psSysData->sQProcessResource, KERNEL_ID); if (eError != PVRSRV_OK) @@ -504,8 +504,8 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyCommandQueueKM(PVRSRV_QUEUE_INFO *psQueue sizeof(PVRSRV_QUEUE_INFO), psQueueInfo, psQueueInfo->hMemBlock[0]); - - psQueueInfo = IMG_NULL; + + psQueueInfo = IMG_NULL; } else { @@ -524,8 +524,8 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyCommandQueueKM(PVRSRV_QUEUE_INFO *psQueue sizeof(PVRSRV_QUEUE_INFO), psQueueInfo, psQueueInfo->hMemBlock[0]); - - psQueueInfo = IMG_NULL; + + psQueueInfo = IMG_NULL; break; } psQueue = psQueue->psNextKM; @@ -543,14 +543,14 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyCommandQueueKM(PVRSRV_QUEUE_INFO *psQueue } } - + eError = OSUnlockResource(&psSysData->sQProcessResource, KERNEL_ID); if (eError != PVRSRV_OK) { goto ErrorExit; } - + if (psSysData->psQueueList == IMG_NULL) { eError = OSDestroyResource(&psSysData->sQProcessResource); @@ -573,7 +573,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetQueueSpaceKM(PVRSRV_QUEUE_INFO *psQueue, { IMG_BOOL bTimeout = IMG_TRUE; - + ui32ParamSize = (ui32ParamSize+3) & 0xFFFFFFFC; if (ui32ParamSize > PVRSRV_MAX_CMD_SIZE) @@ -582,7 +582,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVGetQueueSpaceKM(PVRSRV_QUEUE_INFO *psQueue, return PVRSRV_ERROR_CMD_TOO_BIG; } - + LOOP_UNTIL_TIMEOUT(MAX_HW_TIME_US) { if (GET_SPACE_IN_CMDQ(psQueue) > ui32ParamSize) @@ -628,7 +628,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVInsertCommandKM(PVRSRV_QUEUE_INFO *psQueue, SYS_DATA *psSysData; DEVICE_COMMAND_DATA *psDeviceCommandData; - + SysAcquireData(&psSysData); psDeviceCommandData = psSysData->apsDeviceCommandData[ui32DevIndex]; @@ -639,15 +639,15 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVInsertCommandKM(PVRSRV_QUEUE_INFO *psQueue, return PVRSRV_ERROR_INVALID_PARAMS; } - + ui32DataByteSize = (ui32DataByteSize + 3UL) & ~3UL; - + ui32CommandSize = sizeof(PVRSRV_COMMAND) + ((ui32DstSyncCount + ui32SrcSyncCount) * sizeof(PVRSRV_SYNC_OBJECT)) + ui32DataByteSize; - + eError = PVRSRVGetQueueSpaceKM (psQueue, ui32CommandSize, (IMG_VOID**)&psCommand); if(eError != PVRSRV_OK) { @@ -656,14 +656,14 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVInsertCommandKM(PVRSRV_QUEUE_INFO *psQueue, psCommand->ui32ProcessID = OSGetCurrentProcessIDKM(); - - psCommand->uCmdSize = ui32CommandSize; + + psCommand->uCmdSize = ui32CommandSize; psCommand->ui32DevIndex = ui32DevIndex; psCommand->CommandType = CommandType; psCommand->ui32DstSyncCount = ui32DstSyncCount; psCommand->ui32SrcSyncCount = ui32SrcSyncCount; - - + + psCommand->psDstSync = (PVRSRV_SYNC_OBJECT*)(((IMG_UINTPTR_T)psCommand) + sizeof(PVRSRV_COMMAND)); @@ -681,7 +681,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVInsertCommandKM(PVRSRV_QUEUE_INFO *psQueue, PVR_TTRACE_UI32(PVRSRV_TRACE_GROUP_QUEUE, PVRSRV_TRACE_CLASS_NONE, QUEUE_TOKEN_COMMAND_TYPE, CommandType); - + for (i=0; ipsDstSync[i].ui32WriteOpsPending)); } - + for (i=0; iui32DstSyncCount > 0) { psCommand->psDstSync = (PVRSRV_SYNC_OBJECT*)(((IMG_UINTPTR_T)psQueue->pvLinQueueKM) @@ -752,7 +752,7 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVSubmitCommandKM(PVRSRV_QUEUE_INFO *psQueue, + (psCommand->ui32DstSyncCount * sizeof(PVRSRV_SYNC_OBJECT)) + (psCommand->ui32SrcSyncCount * sizeof(PVRSRV_SYNC_OBJECT))); - + UPDATE_QUEUE_WOFF(psQueue, psCommand->uCmdSize); return PVRSRV_OK; @@ -762,7 +762,7 @@ static PVRSRV_ERROR CheckIfSyncIsQueued(PVRSRV_SYNC_OBJECT *psSync, COMMAND_COMPLETE_DATA *psCmdData) { IMG_UINT32 k; - + if (psCmdData->bInUse) { for (k=0;kui32SrcSyncCount;k++) @@ -772,7 +772,7 @@ PVRSRV_ERROR CheckIfSyncIsQueued(PVRSRV_SYNC_OBJECT *psSync, COMMAND_COMPLETE_DA PVRSRV_SYNC_DATA *psSyncData = psSync->psKernelSyncInfoKM->psSyncData; IMG_UINT32 ui32WriteOpsComplete = psSyncData->ui32WriteOpsComplete; - + if (ui32WriteOpsComplete == psSync->ui32WriteOpsPending) @@ -810,7 +810,7 @@ PVRSRV_ERROR PVRSRVProcessCommand(SYS_DATA *psSysData, DEVICE_COMMAND_DATA *psDeviceCommandData; IMG_UINT32 ui32CCBOffset; - + psWalkerObj = psCommand->psDstSync; psEndObj = psWalkerObj + psCommand->ui32DstSyncCount; while (psWalkerObj < psEndObj) @@ -819,7 +819,7 @@ PVRSRV_ERROR PVRSRVProcessCommand(SYS_DATA *psSysData, ui32WriteOpsComplete = psSyncData->ui32WriteOpsComplete; ui32ReadOpsComplete = psSyncData->ui32ReadOps2Complete; - + if ((ui32WriteOpsComplete != psWalkerObj->ui32WriteOpsPending) || (ui32ReadOpsComplete != psWalkerObj->ui32ReadOps2Pending)) { @@ -834,7 +834,7 @@ PVRSRV_ERROR PVRSRVProcessCommand(SYS_DATA *psSysData, psWalkerObj++; } - + psWalkerObj = psCommand->psSrcSync; psEndObj = psWalkerObj + psCommand->ui32SrcSyncCount; while (psWalkerObj < psEndObj) @@ -843,7 +843,7 @@ PVRSRV_ERROR PVRSRVProcessCommand(SYS_DATA *psSysData, ui32ReadOpsComplete = psSyncData->ui32ReadOps2Complete; ui32WriteOpsComplete = psSyncData->ui32WriteOpsComplete; - + if ((ui32WriteOpsComplete != psWalkerObj->ui32WriteOpsPending) || (ui32ReadOpsComplete != psWalkerObj->ui32ReadOps2Pending)) { @@ -881,7 +881,7 @@ PVRSRV_ERROR PVRSRVProcessCommand(SYS_DATA *psSysData, psWalkerObj++; } - + if (psCommand->ui32DevIndex >= SYS_DEVICE_COUNT) { PVR_DPF((PVR_DBG_ERROR, @@ -890,20 +890,20 @@ PVRSRV_ERROR PVRSRVProcessCommand(SYS_DATA *psSysData, return PVRSRV_ERROR_INVALID_PARAMS; } - + psDeviceCommandData = psSysData->apsDeviceCommandData[psCommand->ui32DevIndex]; ui32CCBOffset = psDeviceCommandData[psCommand->CommandType].ui32CCBOffset; psCmdCompleteData = psDeviceCommandData[psCommand->CommandType].apsCmdCompleteData[ui32CCBOffset]; if (psCmdCompleteData->bInUse) { - + return PVRSRV_ERROR_FAILED_DEPENDENCIES; } - + psCmdCompleteData->bInUse = IMG_TRUE; - + psCmdCompleteData->ui32DstSyncCount = psCommand->ui32DstSyncCount; for (i=0; iui32DstSyncCount; i++) { @@ -920,7 +920,7 @@ PVRSRV_ERROR PVRSRVProcessCommand(SYS_DATA *psSysData, psCmdCompleteData->pfnCommandComplete = psCommand->pfnCommandComplete; psCmdCompleteData->hCallbackData = psCommand->hCallbackData; - + psCmdCompleteData->ui32SrcSyncCount = psCommand->ui32SrcSyncCount; for (i=0; iui32SrcSyncCount; i++) { @@ -934,7 +934,7 @@ PVRSRV_ERROR PVRSRVProcessCommand(SYS_DATA *psSysData, ui32CCBOffset)); } - + @@ -948,14 +948,14 @@ PVRSRV_ERROR PVRSRVProcessCommand(SYS_DATA *psSysData, (IMG_UINT32)psCommand->uDataSize, psCommand->pvData) == IMG_FALSE) { - + psCmdCompleteData->bInUse = IMG_FALSE; eError = PVRSRV_ERROR_CMD_NOT_PROCESSED; } - - + + psDeviceCommandData[psCommand->CommandType].ui32CCBOffset = (ui32CCBOffset + 1) % DC_NUM_COMMANDS_PER_TYPE; return eError; @@ -979,13 +979,13 @@ PVRSRV_ERROR PVRSRVProcessQueues(IMG_BOOL bFlush) PVRSRV_COMMAND *psCommand; SysAcquireData(&psSysData); - + while (OSLockResource(&psSysData->sQProcessResource, ISR_ID) != PVRSRV_OK) { OSWaitus(1); }; - + psQueue = psSysData->psQueueList; if(!psQueue) @@ -1006,7 +1006,7 @@ PVRSRV_ERROR PVRSRVProcessQueues(IMG_BOOL bFlush) if (PVRSRVProcessCommand(psSysData, psCommand, bFlush) == PVRSRV_OK) { - + UPDATE_QUEUE_ROFF(psQueue, psCommand->uCmdSize) continue; } @@ -1021,7 +1021,7 @@ PVRSRV_ERROR PVRSRVProcessQueues(IMG_BOOL bFlush) PVRSRVSetDCState(DC_STATE_NO_FLUSH_COMMANDS); } - + List_PVRSRV_DEVICE_NODE_ForEach(psSysData->psDeviceNodeList, &PVRSRVProcessQueues_ForEachCb); @@ -1040,10 +1040,10 @@ IMG_VOID PVRSRVFreeCommandCompletePacketKM(IMG_HANDLE hCmdCookie, SysAcquireData(&psSysData); - + psCmdCompleteData->bInUse = IMG_FALSE; - + PVRSRVScheduleDeviceCallbacks(); if(bScheduleMISR) @@ -1052,7 +1052,7 @@ IMG_VOID PVRSRVFreeCommandCompletePacketKM(IMG_HANDLE hCmdCookie, } } -#endif +#endif IMG_EXPORT @@ -1068,16 +1068,12 @@ IMG_VOID PVRSRVCommandCompleteKM(IMG_HANDLE hCmdCookie, PVR_TTRACE(PVRSRV_TRACE_GROUP_QUEUE, PVRSRV_TRACE_CLASS_CMD_COMP_START, QUEUE_TOKEN_COMMAND_COMPLETE); - + for (i=0; iui32DstSyncCount; i++) { psCmdCompleteData->psDstSync[i].psKernelSyncInfoKM->psSyncData->ui32WriteOpsComplete++; PVRSRVKernelSyncInfoDecRef(psCmdCompleteData->psDstSync[i].psKernelSyncInfoKM, IMG_NULL); - if (psCmdCompleteData->psDstSync[i].psKernelSyncInfoKM->ui32RefCount == 0) - { - PVRSRVFreeSyncInfoKM(psCmdCompleteData->psDstSync[i].psKernelSyncInfoKM); - } PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_QUEUE, QUEUE_TOKEN_UPDATE_DST, psCmdCompleteData->psDstSync[i].psKernelSyncInfoKM, @@ -1090,16 +1086,12 @@ IMG_VOID PVRSRVCommandCompleteKM(IMG_HANDLE hCmdCookie, psCmdCompleteData->psDstSync[i].ui32WriteOpsPending)); } - + for (i=0; iui32SrcSyncCount; i++) { psCmdCompleteData->psSrcSync[i].psKernelSyncInfoKM->psSyncData->ui32ReadOps2Complete++; PVRSRVKernelSyncInfoDecRef(psCmdCompleteData->psSrcSync[i].psKernelSyncInfoKM, IMG_NULL); - if (psCmdCompleteData->psSrcSync[i].psKernelSyncInfoKM->ui32RefCount == 0) - { - PVRSRVFreeSyncInfoKM(psCmdCompleteData->psSrcSync[i].psKernelSyncInfoKM); - } PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_QUEUE, QUEUE_TOKEN_UPDATE_SRC, psCmdCompleteData->psSrcSync[i].psKernelSyncInfoKM, @@ -1120,10 +1112,10 @@ IMG_VOID PVRSRVCommandCompleteKM(IMG_HANDLE hCmdCookie, psCmdCompleteData->pfnCommandComplete(psCmdCompleteData->hCallbackData); } - + psCmdCompleteData->bInUse = IMG_FALSE; - + PVRSRVScheduleDeviceCallbacks(); if(bScheduleMISR) @@ -1148,7 +1140,7 @@ PVRSRV_ERROR PVRSRVRegisterCmdProcListKM(IMG_UINT32 ui32DevIndex, DEVICE_COMMAND_DATA *psDeviceCommandData; COMMAND_COMPLETE_DATA *psCmdCompleteData; - + if(ui32DevIndex >= SYS_DEVICE_COUNT) { PVR_DPF((PVR_DBG_ERROR, @@ -1157,10 +1149,10 @@ PVRSRV_ERROR PVRSRVRegisterCmdProcListKM(IMG_UINT32 ui32DevIndex, return PVRSRV_ERROR_INVALID_PARAMS; } - + SysAcquireData(&psSysData); - + ui32AllocSize = ui32CmdCount * sizeof(*psDeviceCommandData); eError = OSAllocMem(PVRSRV_OS_NON_PAGEABLE_HEAP, ui32AllocSize, @@ -1182,12 +1174,12 @@ PVRSRV_ERROR PVRSRVRegisterCmdProcListKM(IMG_UINT32 ui32DevIndex, psDeviceCommandData[ui32CmdTypeCounter].ui32MaxSrcSyncCount = ui32MaxSyncsPerCmd[ui32CmdTypeCounter][1]; for (ui32CmdCounter = 0; ui32CmdCounter < DC_NUM_COMMANDS_PER_TYPE; ui32CmdCounter++) { + - - ui32AllocSize = sizeof(COMMAND_COMPLETE_DATA) + ui32AllocSize = sizeof(COMMAND_COMPLETE_DATA) + ((ui32MaxSyncsPerCmd[ui32CmdTypeCounter][0] + ui32MaxSyncsPerCmd[ui32CmdTypeCounter][1]) - * sizeof(PVRSRV_SYNC_OBJECT)); + * sizeof(PVRSRV_SYNC_OBJECT)); eError = OSAllocMem(PVRSRV_OS_NON_PAGEABLE_HEAP, ui32AllocSize, @@ -1199,13 +1191,13 @@ PVRSRV_ERROR PVRSRVRegisterCmdProcListKM(IMG_UINT32 ui32DevIndex, PVR_DPF((PVR_DBG_ERROR,"PVRSRVRegisterCmdProcListKM: Failed to alloc cmd %d", ui32CmdTypeCounter)); goto ErrorExit; } - + psDeviceCommandData[ui32CmdTypeCounter].apsCmdCompleteData[ui32CmdCounter] = psCmdCompleteData; - - + + OSMemSet(psCmdCompleteData, 0x00, ui32AllocSize); - + psCmdCompleteData->psDstSync = (PVRSRV_SYNC_OBJECT*) (((IMG_UINTPTR_T)psCmdCompleteData) + sizeof(COMMAND_COMPLETE_DATA)); @@ -1221,14 +1213,14 @@ PVRSRV_ERROR PVRSRVRegisterCmdProcListKM(IMG_UINT32 ui32DevIndex, ErrorExit: - + if (PVRSRVRemoveCmdProcListKM(ui32DevIndex, ui32CmdCount) != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR, "PVRSRVRegisterCmdProcListKM: Failed to clean up after error, device 0x%x", ui32DevIndex)); } - + return eError; } @@ -1243,7 +1235,7 @@ PVRSRV_ERROR PVRSRVRemoveCmdProcListKM(IMG_UINT32 ui32DevIndex, COMMAND_COMPLETE_DATA *psCmdCompleteData; IMG_SIZE_T ui32AllocSize; - + if(ui32DevIndex >= SYS_DEVICE_COUNT) { PVR_DPF((PVR_DBG_ERROR, @@ -1252,7 +1244,7 @@ PVRSRV_ERROR PVRSRVRemoveCmdProcListKM(IMG_UINT32 ui32DevIndex, return PVRSRV_ERROR_INVALID_PARAMS; } - + SysAcquireData(&psSysData); psDeviceCommandData = psSysData->apsDeviceCommandData[ui32DevIndex]; @@ -1263,8 +1255,8 @@ PVRSRV_ERROR PVRSRVRemoveCmdProcListKM(IMG_UINT32 ui32DevIndex, for (ui32CmdCounter = 0; ui32CmdCounter < DC_NUM_COMMANDS_PER_TYPE; ui32CmdCounter++) { psCmdCompleteData = psDeviceCommandData[ui32CmdTypeCounter].apsCmdCompleteData[ui32CmdCounter]; - - + + if (psCmdCompleteData != IMG_NULL) { PVR_ASSERT(psCmdCompleteData->bInUse == IMG_FALSE); @@ -1275,7 +1267,7 @@ PVRSRV_ERROR PVRSRVRemoveCmdProcListKM(IMG_UINT32 ui32DevIndex, } } - + ui32AllocSize = ui32CmdCount * sizeof(*psDeviceCommandData); OSFreeMem(PVRSRV_OS_NON_PAGEABLE_HEAP, ui32AllocSize, psDeviceCommandData, IMG_NULL); psSysData->apsDeviceCommandData[ui32DevIndex] = IMG_NULL; diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/ra.c b/drivers/staging/mrst/pvr/services4/srvkm/common/ra.c index fe47b70..84a2162 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/ra.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/ra.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -71,29 +71,29 @@ struct _BT_ { enum bt_type { - btt_span, - btt_free, - btt_live + btt_span, + btt_free, + btt_live } type; - + IMG_UINTPTR_T base; IMG_SIZE_T uSize; - + struct _BT_ *pNextSegment; struct _BT_ *pPrevSegment; - + struct _BT_ *pNextFree; struct _BT_ *pPrevFree; - + BM_MAPPING *psMapping; #if defined(VALIDATE_ARENA_TEST) RESOURCE_DESCRIPTOR eResourceSpan; RESOURCE_TYPE eResourceType; - + IMG_UINT32 ui32BoundaryTagID; #endif @@ -103,13 +103,13 @@ typedef struct _BT_ BT; struct _RA_ARENA_ { - + IMG_CHAR *name; - + IMG_SIZE_T uQuantum; - + IMG_BOOL (*pImportAlloc)(IMG_VOID *, IMG_SIZE_T uSize, IMG_SIZE_T *pActualSize, @@ -123,20 +123,20 @@ struct _RA_ARENA_ BM_MAPPING *psMapping); IMG_VOID (*pBackingStoreFree) (IMG_VOID *, IMG_SIZE_T, IMG_SIZE_T, IMG_HANDLE); - + IMG_VOID *pImportHandle; - + #define FREE_TABLE_LIMIT 32 - + BT *aHeadFree [FREE_TABLE_LIMIT]; - + BT *pHeadSegment; BT *pTailSegment; - + HASH_TABLE *pSegmentHash; #ifdef RA_STATS @@ -164,7 +164,7 @@ static void* RA_ProcSeqOff2ElementInfo(struct seq_file * sfile, loff_t off); static void RA_ProcSeqShowRegs(struct seq_file *sfile, void* el); static void* RA_ProcSeqOff2ElementRegs(struct seq_file * sfile, loff_t off); -#endif +#endif #ifdef USE_BM_FREESPACE_CHECK IMG_VOID CheckBMFreespace(IMG_VOID); @@ -252,7 +252,7 @@ _SegmentListInsert (RA_ARENA *pArena, BT *pBT) { PVRSRV_ERROR eError = PVRSRV_OK; - + if (pArena->pHeadSegment == IMG_NULL) { pArena->pHeadSegment = pArena->pTailSegment = pBT; @@ -264,7 +264,7 @@ _SegmentListInsert (RA_ARENA *pArena, BT *pBT) if (pBT->base < pArena->pHeadSegment->base) { - + pBT->pNextSegment = pArena->pHeadSegment; pArena->pHeadSegment->pPrevSegment = pBT; pArena->pHeadSegment = pBT; @@ -273,7 +273,7 @@ _SegmentListInsert (RA_ARENA *pArena, BT *pBT) else { - + pBTScan = pArena->pHeadSegment; @@ -562,13 +562,13 @@ _InsertResourceSpan (RA_ARENA *pArena, IMG_UINTPTR_T base, IMG_SIZE_T uSize) fail_SegListInsert: OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BT), pBT, IMG_NULL); - + fail_bt: OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BT), pSpanEnd, IMG_NULL); - + fail_end: OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BT), pSpanStart, IMG_NULL); - + fail_start: return IMG_NULL; } @@ -598,7 +598,7 @@ _FreeBT (RA_ARENA *pArena, BT *pBT, IMG_BOOL bFreeBackingStore) uOrigBase = pBT->base; uOrigSize = pBT->uSize; - + pNeighbour = pBT->pPrevSegment; if (pNeighbour!=IMG_NULL && pNeighbour->type == btt_free @@ -609,13 +609,13 @@ _FreeBT (RA_ARENA *pArena, BT *pBT, IMG_BOOL bFreeBackingStore) pBT->base = pNeighbour->base; pBT->uSize += pNeighbour->uSize; OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BT), pNeighbour, IMG_NULL); - + #ifdef RA_STATS pArena->sStatistics.uFreeSegmentCount--; #endif } - + pNeighbour = pBT->pNextSegment; if (pNeighbour!=IMG_NULL && pNeighbour->type == btt_free @@ -625,28 +625,28 @@ _FreeBT (RA_ARENA *pArena, BT *pBT, IMG_BOOL bFreeBackingStore) _SegmentListRemove (pArena, pNeighbour); pBT->uSize += pNeighbour->uSize; OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BT), pNeighbour, IMG_NULL); - + #ifdef RA_STATS pArena->sStatistics.uFreeSegmentCount--; #endif } - + if (pArena->pBackingStoreFree != IMG_NULL && bFreeBackingStore) { IMG_UINTPTR_T uRoundedStart, uRoundedEnd; - + uRoundedStart = (uOrigBase / pArena->uQuantum) * pArena->uQuantum; - + if (uRoundedStart < pBT->base) { uRoundedStart += pArena->uQuantum; } - + uRoundedEnd = ((uOrigBase + uOrigSize + pArena->uQuantum - 1) / pArena->uQuantum) * pArena->uQuantum; - + if (uRoundedEnd > (pBT->base + pBT->uSize)) { uRoundedEnd -= pArena->uQuantum; @@ -675,11 +675,11 @@ _FreeBT (RA_ARENA *pArena, BT *pBT, IMG_BOOL bFreeBackingStore) pArena->sStatistics.uTotalResourceCount-=pBT->uSize; #endif OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BT), next, IMG_NULL); - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BT), prev, IMG_NULL); - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BT), pBT, IMG_NULL); - + } else _FreeListInsert (pArena, pBT); @@ -706,12 +706,12 @@ _AttemptAllocAligned (RA_ARENA *pArena, if (uAlignment>1) uAlignmentOffset %= uAlignment; - + uIndex = pvr_log2 (uSize); #if 0 - + if (1u<aHeadFree[uIndex]!=IMG_NULL) { - + BT *pBT; pBT = pArena->aHeadFree [uIndex]; @@ -754,16 +754,16 @@ _AttemptAllocAligned (RA_ARENA *pArena, pArena->sStatistics.uFreeResourceCount-=pBT->uSize; #endif - + if (aligned_base > pBT->base) { BT *pNeighbour; pNeighbour = _SegmentSplit (pArena, pBT, (IMG_SIZE_T)(aligned_base - pBT->base)); - + if (pNeighbour==IMG_NULL) { PVR_DPF ((PVR_DBG_ERROR,"_AttemptAllocAligned: Front split failed")); - + _FreeListInsert (pArena, pBT); return IMG_FALSE; } @@ -776,16 +776,16 @@ _AttemptAllocAligned (RA_ARENA *pArena, pBT = pNeighbour; } - + if (pBT->uSize > uSize) { BT *pNeighbour; pNeighbour = _SegmentSplit (pArena, pBT, uSize); - + if (pNeighbour==IMG_NULL) { PVR_DPF ((PVR_DBG_ERROR,"_AttemptAllocAligned: Back split failed")); - + _FreeListInsert (pArena, pBT); return IMG_FALSE; } @@ -916,7 +916,7 @@ RA_Create (IMG_CHAR *name, pArena->bInitProcEntry = !PVRSRVGetInitServerState(PVRSRV_INIT_SERVER_SUCCESSFUL); - + pfnCreateProcEntrySeq = pArena->bInitProcEntry ? CreateProcEntrySeq : CreatePerProcessProcEntrySeq; ret = snprintf(szProcInfoName, sizeof(szProcInfoName), "ra_info_%s", pArena->name); @@ -943,7 +943,7 @@ RA_Create (IMG_CHAR *name, PVR_DPF((PVR_DBG_ERROR, "RA_Create: couldn't create ra_segs proc entry for arena %s", pArena->name)); } } -#endif +#endif pArena->pSegmentHash = HASH_Create (MINIMUM_HASH_SIZE); if (pArena->pSegmentHash==IMG_NULL) @@ -967,7 +967,7 @@ insert_fail: HASH_Delete (pArena->pSegmentHash); hash_fail: OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(RA_ARENA), pArena, IMG_NULL); - + arena_fail: return IMG_NULL; } @@ -1004,7 +1004,7 @@ RA_Delete (RA_ARENA *pArena) _SegmentListRemove (pArena, pBT); OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BT), pBT, IMG_NULL); - + #ifdef RA_STATS pArena->sStatistics.uSpanCount--; #endif @@ -1028,7 +1028,7 @@ RA_Delete (RA_ARENA *pArena) #endif HASH_Delete (pArena->pSegmentHash); OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(RA_ARENA), pArena, IMG_NULL); - + } IMG_BOOL @@ -1111,7 +1111,7 @@ RA_Alloc (RA_ARENA *pArena, "RA_Alloc: arena='%s', size=0x%x(0x%x), alignment=0x%x, offset=0x%x", pArena->name, uSize, uRequestSize, uAlignment, uAlignmentOffset)); - + bResult = _AttemptAllocAligned (pArena, uSize, ppsMapping, uFlags, uAlignment, uAlignmentOffset, base); @@ -1121,7 +1121,7 @@ RA_Alloc (RA_ARENA *pArena, IMG_UINTPTR_T import_base; IMG_SIZE_T uImportSize = uSize; - + if (uAlignment > pArena->uQuantum) @@ -1129,7 +1129,7 @@ RA_Alloc (RA_ARENA *pArena, uImportSize += (uAlignment - 1); } - + uImportSize = ((uImportSize + pArena->uQuantum - 1)/pArena->uQuantum)*pArena->uQuantum; bResult = @@ -1140,16 +1140,16 @@ RA_Alloc (RA_ARENA *pArena, { BT *pBT; pBT = _InsertResourceSpan (pArena, import_base, uImportSize); - + if (pBT == IMG_NULL) { - + pArena->pImportFree(pArena->pImportHandle, import_base, psImportMapping); PVR_DPF ((PVR_DBG_MESSAGE, "RA_Alloc: name='%s', size=0x%x failed!", pArena->name, uSize)); - + return IMG_FALSE; } pBT->psMapping = psImportMapping; @@ -1179,7 +1179,7 @@ RA_Alloc (RA_ARENA *pArena, "RA_Alloc: name='%s', size=0x%x, *base=0x%x = %d", pArena->name, uSize, *base, bResult)); - + #if defined(VALIDATE_ARENA_TEST) ValidateArena(pArena); @@ -1219,7 +1219,7 @@ IMG_UINT32 ValidateArena(RA_ARENA *pArena) (eNextSpan == IMPORTED_RESOURCE_SPAN_FREE) || (eNextSpan == IMPORTED_RESOURCE_SPAN_END))) { - + PVR_DPF((PVR_DBG_ERROR, "ValidateArena ERROR: adjacent boundary tags %d (base=0x%x) and %d (base=0x%x) are incompatible (arena: %s)", pSegment->ui32BoundaryTagID, pSegment->base, pSegment->pNextSegment->ui32BoundaryTagID, pSegment->pNextSegment->base, pArena->name)); @@ -1232,7 +1232,7 @@ IMG_UINT32 ValidateArena(RA_ARENA *pArena) if (!((eNextSpan == IMPORTED_RESOURCE_SPAN_LIVE) || (eNextSpan == IMPORTED_RESOURCE_SPAN_END))) { - + PVR_DPF((PVR_DBG_ERROR, "ValidateArena ERROR: adjacent boundary tags %d (base=0x%x) and %d (base=0x%x) are incompatible (arena: %s)", pSegment->ui32BoundaryTagID, pSegment->base, pSegment->pNextSegment->ui32BoundaryTagID, pSegment->pNextSegment->base, pArena->name)); @@ -1246,7 +1246,7 @@ IMG_UINT32 ValidateArena(RA_ARENA *pArena) (eNextSpan == IMPORTED_RESOURCE_SPAN_FREE) || (eNextSpan == IMPORTED_RESOURCE_SPAN_END)) { - + PVR_DPF((PVR_DBG_ERROR, "ValidateArena ERROR: adjacent boundary tags %d (base=0x%x) and %d (base=0x%x) are incompatible (arena: %s)", pSegment->ui32BoundaryTagID, pSegment->base, pSegment->pNextSegment->ui32BoundaryTagID, pSegment->pNextSegment->base, pArena->name)); @@ -1260,7 +1260,7 @@ IMG_UINT32 ValidateArena(RA_ARENA *pArena) if (!((eNextSpan == IMPORTED_RESOURCE_SPAN_LIVE) || (eNextSpan == IMPORTED_RESOURCE_SPAN_FREE))) { - + PVR_DPF((PVR_DBG_ERROR, "ValidateArena ERROR: adjacent boundary tags %d (base=0x%x) and %d (base=0x%x) are incompatible (arena: %s)", pSegment->ui32BoundaryTagID, pSegment->base, pSegment->pNextSegment->ui32BoundaryTagID, pSegment->pNextSegment->base, pArena->name)); @@ -1293,7 +1293,7 @@ IMG_UINT32 ValidateArena(RA_ARENA *pArena) if (!((eNextSpan == RESOURCE_SPAN_FREE) || (eNextSpan == RESOURCE_SPAN_LIVE))) { - + PVR_DPF((PVR_DBG_ERROR, "ValidateArena ERROR: adjacent boundary tags %d (base=0x%x) and %d (base=0x%x) are incompatible (arena: %s)", pSegment->ui32BoundaryTagID, pSegment->base, pSegment->pNextSegment->ui32BoundaryTagID, pSegment->pNextSegment->base, pArena->name)); @@ -1306,7 +1306,7 @@ IMG_UINT32 ValidateArena(RA_ARENA *pArena) if (!((eNextSpan == RESOURCE_SPAN_FREE) || (eNextSpan == RESOURCE_SPAN_LIVE))) { - + PVR_DPF((PVR_DBG_ERROR, "ValidateArena ERROR: adjacent boundary tags %d (base=0x%x) and %d (base=0x%x) are incompatible (arena: %s)", pSegment->ui32BoundaryTagID, pSegment->base, pSegment->pNextSegment->ui32BoundaryTagID, pSegment->pNextSegment->base, pArena->name)); @@ -1411,7 +1411,7 @@ IMG_BOOL RA_GetNextLiveSegment(IMG_HANDLE hArena, RA_SEGMENT_DETAILS *psSegDetai pBT = pArena->pHeadSegment; } - + while (pBT != IMG_NULL) { if (pBT->type == btt_live) @@ -1490,7 +1490,7 @@ _BTType (IMG_INT eType) } return "junk"; } -#endif +#endif #if defined(ENABLE_RA_DUMP) IMG_VOID @@ -1521,7 +1521,7 @@ RA_Dump (RA_ARENA *pArena) HASH_Dump (pArena->pSegmentHash); #endif } -#endif +#endif #if defined(CONFIG_PROC_FS) && defined(DEBUG) @@ -1618,7 +1618,7 @@ static void* RA_ProcSeqOff2ElementRegs(struct seq_file * sfile, loff_t off) return (void*)pBT; } -#endif +#endif #ifdef RA_STATS @@ -1716,7 +1716,7 @@ PVRSRV_ERROR RA_GetStats(RA_ARENA *pArena, } PVRSRV_ERROR RA_GetStatsFreeMem(RA_ARENA *pArena, - IMG_CHAR **ppszStr, + IMG_CHAR **ppszStr, IMG_UINT32 *pui32StrLen) { IMG_CHAR *pszStr = *ppszStr; @@ -1729,7 +1729,7 @@ PVRSRV_ERROR RA_GetStatsFreeMem(RA_ARENA *pArena, UPDATE_SPACE(pszStr, i32Count, ui32StrLen); *ppszStr = pszStr; *pui32StrLen = ui32StrLen; - + return PVRSRV_OK; } #endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/refcount.c b/drivers/staging/mrst/pvr/services4/srvkm/common/refcount.c index 6871034..5bc9b4a 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/refcount.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/refcount.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * */ /**************************************************************************/ @@ -46,10 +46,11 @@ static DEFINE_MUTEX(gsCCBLock); #define PVRSRV_REFCOUNT_CCB_DEBUG_MEMINFO (1U << 1) #define PVRSRV_REFCOUNT_CCB_DEBUG_BM_BUF (1U << 2) #define PVRSRV_REFCOUNT_CCB_DEBUG_BM_BUF2 (1U << 3) +#define PVRSRV_REFCOUNT_CCB_DEBUG_BM_XPROC (1U << 4) #if defined(__linux__) -#define PVRSRV_REFCOUNT_CCB_DEBUG_MMAP (1U << 4) -#define PVRSRV_REFCOUNT_CCB_DEBUG_MMAP2 (1U << 5) +#define PVRSRV_REFCOUNT_CCB_DEBUG_MMAP (1U << 16) +#define PVRSRV_REFCOUNT_CCB_DEBUG_MMAP2 (1U << 17) #else #define PVRSRV_REFCOUNT_CCB_DEBUG_MMAP 0 #define PVRSRV_REFCOUNT_CCB_DEBUG_MMAP2 0 @@ -115,6 +116,8 @@ void PVRSRVKernelSyncInfoIncRef2(const IMG_CHAR *pszFile, IMG_INT iLine, PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo, PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo) { + IMG_UINT32 ui32RefValue = OSAtomicRead(psKernelSyncInfo->pvRefCount); + if(!(guiDebugMask & PVRSRV_REFCOUNT_CCB_DEBUG_SYNCINFO)) goto skip; @@ -131,8 +134,8 @@ void PVRSRVKernelSyncInfoIncRef2(const IMG_CHAR *pszFile, IMG_INT iLine, psKernelMemInfo, NULL, (psKernelMemInfo) ? psKernelMemInfo->sMemBlk.hOSMemHandle : NULL, - psKernelSyncInfo->ui32RefCount, - psKernelSyncInfo->ui32RefCount + 1, + ui32RefValue, + ui32RefValue + 1, (psKernelMemInfo) ? psKernelMemInfo->uAllocSize : 0); gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; @@ -140,7 +143,7 @@ void PVRSRVKernelSyncInfoIncRef2(const IMG_CHAR *pszFile, IMG_INT iLine, PVRSRV_UNLOCK_CCB(); skip: - psKernelSyncInfo->ui32RefCount++; + PVRSRVAcquireSyncInfoKM(psKernelSyncInfo); } IMG_INTERNAL @@ -148,6 +151,8 @@ void PVRSRVKernelSyncInfoDecRef2(const IMG_CHAR *pszFile, IMG_INT iLine, PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo, PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo) { + IMG_UINT32 ui32RefValue = OSAtomicRead(psKernelSyncInfo->pvRefCount); + if(!(guiDebugMask & PVRSRV_REFCOUNT_CCB_DEBUG_SYNCINFO)) goto skip; @@ -164,8 +169,8 @@ void PVRSRVKernelSyncInfoDecRef2(const IMG_CHAR *pszFile, IMG_INT iLine, psKernelMemInfo, (psKernelMemInfo) ? psKernelMemInfo->sMemBlk.hOSMemHandle : NULL, NULL, - psKernelSyncInfo->ui32RefCount, - psKernelSyncInfo->ui32RefCount - 1, + ui32RefValue, + ui32RefValue - 1, (psKernelMemInfo) ? psKernelMemInfo->uAllocSize : 0); gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; @@ -173,7 +178,7 @@ void PVRSRVKernelSyncInfoDecRef2(const IMG_CHAR *pszFile, IMG_INT iLine, PVRSRV_UNLOCK_CCB(); skip: - psKernelSyncInfo->ui32RefCount--; + PVRSRVReleaseSyncInfoKM(psKernelSyncInfo); } IMG_INTERNAL @@ -364,6 +369,68 @@ skip: pBuf->ui32ExportCount--; } +IMG_INTERNAL +void PVRSRVBMXProcIncRef2(const IMG_CHAR *pszFile, IMG_INT iLine, IMG_UINT32 ui32Index) +{ + if(!(guiDebugMask & PVRSRV_REFCOUNT_CCB_DEBUG_BM_XPROC)) + goto skip; + + PVRSRV_LOCK_CCB(); + + gsRefCountCCB[giOffset].pszFile = pszFile; + gsRefCountCCB[giOffset].iLine = iLine; + gsRefCountCCB[giOffset].ui32PID = OSGetCurrentProcessIDKM(); + snprintf(gsRefCountCCB[giOffset].pcMesg, + PVRSRV_REFCOUNT_CCB_MESG_MAX - 1, + PVRSRV_REFCOUNT_CCB_FMT_STRING, + "BM_XPROC", + NULL, + NULL, + gXProcWorkaroundShareData[ui32Index].hOSMemHandle, + (IMG_VOID *) ui32Index, + gXProcWorkaroundShareData[ui32Index].ui32RefCount, + gXProcWorkaroundShareData[ui32Index].ui32RefCount + 1, + gXProcWorkaroundShareData[ui32Index].ui32Size); + gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; + giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; + + PVRSRV_UNLOCK_CCB(); + +skip: + gXProcWorkaroundShareData[ui32Index].ui32RefCount++; +} + +IMG_INTERNAL +void PVRSRVBMXProcDecRef2(const IMG_CHAR *pszFile, IMG_INT iLine, IMG_UINT32 ui32Index) +{ + if(!(guiDebugMask & PVRSRV_REFCOUNT_CCB_DEBUG_BM_XPROC)) + goto skip; + + PVRSRV_LOCK_CCB(); + + gsRefCountCCB[giOffset].pszFile = pszFile; + gsRefCountCCB[giOffset].iLine = iLine; + gsRefCountCCB[giOffset].ui32PID = OSGetCurrentProcessIDKM(); + snprintf(gsRefCountCCB[giOffset].pcMesg, + PVRSRV_REFCOUNT_CCB_MESG_MAX - 1, + PVRSRV_REFCOUNT_CCB_FMT_STRING, + "BM_XPROC", + NULL, + NULL, + gXProcWorkaroundShareData[ui32Index].hOSMemHandle, + (IMG_VOID *) ui32Index, + gXProcWorkaroundShareData[ui32Index].ui32RefCount, + gXProcWorkaroundShareData[ui32Index].ui32RefCount - 1, + gXProcWorkaroundShareData[ui32Index].ui32Size); + gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; + giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; + + PVRSRV_UNLOCK_CCB(); + +skip: + gXProcWorkaroundShareData[ui32Index].ui32RefCount--; +} + #if defined(__linux__) /* mmap refcounting is Linux specific */ diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/resman.c b/drivers/staging/mrst/pvr/services4/srvkm/common/resman.c index 9620653..8eddf77 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/resman.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/resman.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -86,14 +86,14 @@ typedef struct _RESMAN_ITEM_ #ifdef DEBUG IMG_UINT32 ui32Signature; #endif - struct _RESMAN_ITEM_ **ppsThis; - struct _RESMAN_ITEM_ *psNext; + struct _RESMAN_ITEM_ **ppsThis; + struct _RESMAN_ITEM_ *psNext; - IMG_UINT32 ui32Flags; + IMG_UINT32 ui32Flags; IMG_UINT32 ui32ResType; - IMG_PVOID pvParam; - IMG_UINT32 ui32Param; + IMG_PVOID pvParam; + IMG_UINT32 ui32Param; RESMAN_FREE_FN pfnFreeResource; } RESMAN_ITEM; @@ -107,7 +107,7 @@ typedef struct _RESMAN_CONTEXT_ struct _RESMAN_CONTEXT_ **ppsThis; struct _RESMAN_CONTEXT_ *psNext; - PVRSRV_PER_PROCESS_DATA *psPerProc; + PVRSRV_PER_PROCESS_DATA *psPerProc; RESMAN_ITEM *psResItemList; @@ -116,14 +116,14 @@ typedef struct _RESMAN_CONTEXT_ typedef struct { - RESMAN_CONTEXT *psContextList; + RESMAN_CONTEXT *psContextList; -} RESMAN_LIST, *PRESMAN_LIST; +} RESMAN_LIST, *PRESMAN_LIST; PRESMAN_LIST gpsResList = IMG_NULL; -#include "lists.h" +#include "lists.h" static IMPLEMENT_LIST_ANY_VA(RESMAN_ITEM) static IMPLEMENT_LIST_ANY_VA_2(RESMAN_ITEM, IMG_BOOL, IMG_FALSE) @@ -163,7 +163,7 @@ PVRSRV_ERROR ResManInit(IMG_VOID) { if (gpsResList == IMG_NULL) { - + if (OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(*gpsResList), (IMG_VOID **)&gpsResList, IMG_NULL, @@ -172,10 +172,10 @@ PVRSRV_ERROR ResManInit(IMG_VOID) return PVRSRV_ERROR_OUT_OF_MEMORY; } - + gpsResList->psContextList = IMG_NULL; - + VALIDATERESLIST(); } @@ -187,7 +187,7 @@ IMG_VOID ResManDeInit(IMG_VOID) { if (gpsResList != IMG_NULL) { - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(*gpsResList), gpsResList, IMG_NULL); gpsResList = IMG_NULL; } @@ -200,13 +200,13 @@ PVRSRV_ERROR PVRSRVResManConnect(IMG_HANDLE hPerProc, PVRSRV_ERROR eError; PRESMAN_CONTEXT psResManContext; - + ACQUIRE_SYNC_OBJ; - + VALIDATERESLIST(); - + eError = OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(*psResManContext), (IMG_VOID **)&psResManContext, IMG_NULL, "Resource Manager Context"); @@ -214,10 +214,10 @@ PVRSRV_ERROR PVRSRVResManConnect(IMG_HANDLE hPerProc, { PVR_DPF((PVR_DBG_ERROR, "PVRSRVResManConnect: ERROR allocating new RESMAN context struct")); - + VALIDATERESLIST(); - + RELEASE_SYNC_OBJ; return eError; @@ -225,17 +225,17 @@ PVRSRV_ERROR PVRSRVResManConnect(IMG_HANDLE hPerProc, #ifdef DEBUG psResManContext->ui32Signature = RESMAN_SIGNATURE; -#endif +#endif psResManContext->psResItemList = IMG_NULL; psResManContext->psPerProc = hPerProc; - + List_RESMAN_CONTEXT_Insert(&gpsResList->psContextList, psResManContext); - + VALIDATERESLIST(); - + RELEASE_SYNC_OBJ; *phResManContext = psResManContext; @@ -247,45 +247,45 @@ PVRSRV_ERROR PVRSRVResManConnect(IMG_HANDLE hPerProc, IMG_VOID PVRSRVResManDisconnect(PRESMAN_CONTEXT psResManContext, IMG_BOOL bKernelContext) { - + ACQUIRE_SYNC_OBJ; - + VALIDATERESLIST(); - + PRINT_RESLIST(gpsResList, psResManContext, IMG_TRUE); - + if (!bKernelContext) { - + FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_OS_USERMODE_MAPPING, 0, 0, IMG_TRUE); - + FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_DMA_CLIENT_FIFO_DATA, 0, 0, IMG_TRUE); - + FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_EVENT_OBJECT, 0, 0, IMG_TRUE); - - + + List_RESMAN_ITEM_Reverse(&psResManContext->psResItemList); FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_MODIFY_SYNC_OPS, 0, 0, IMG_TRUE); - List_RESMAN_ITEM_Reverse(&psResManContext->psResItemList); - + List_RESMAN_ITEM_Reverse(&psResManContext->psResItemList); + FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_HW_RENDER_CONTEXT, 0, 0, IMG_TRUE); FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_HW_TRANSFER_CONTEXT, 0, 0, IMG_TRUE); FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_HW_2D_CONTEXT, 0, 0, IMG_TRUE); FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_TRANSFER_CONTEXT, 0, 0, IMG_TRUE); FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_SHARED_PB_DESC_CREATE_LOCK, 0, 0, IMG_TRUE); FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_SHARED_PB_DESC, 0, 0, IMG_TRUE); + + - - - + FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_SYNC_INFO, 0, 0, IMG_TRUE); FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_DEVICECLASSMEM_MAPPING, 0, 0, IMG_TRUE); FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_DEVICEMEM_WRAP, 0, 0, IMG_TRUE); @@ -295,32 +295,32 @@ IMG_VOID PVRSRVResManDisconnect(PRESMAN_CONTEXT psResManContext, FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_DEVICEMEM_CONTEXT, 0, 0, IMG_TRUE); FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_SHARED_MEM_INFO, 0, 0, IMG_TRUE); - + FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_DISPLAYCLASS_SWAPCHAIN_REF, 0, 0, IMG_TRUE); FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_DISPLAYCLASS_DEVICE, 0, 0, IMG_TRUE); - + FreeResourceByCriteria(psResManContext, RESMAN_CRITERIA_RESTYPE, RESMAN_TYPE_BUFFERCLASS_DEVICE, 0, 0, IMG_TRUE); } - + PVR_ASSERT(psResManContext->psResItemList == IMG_NULL); - + List_RESMAN_CONTEXT_Remove(psResManContext); - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(RESMAN_CONTEXT), psResManContext, IMG_NULL); + - - + VALIDATERESLIST(); - + PRINT_RESLIST(gpsResList, psResManContext, IMG_FALSE); - + RELEASE_SYNC_OBJ; } @@ -342,10 +342,10 @@ PRESMAN_ITEM ResManRegisterRes(PRESMAN_CONTEXT psResManContext, return (PRESMAN_ITEM) IMG_NULL; } - + ACQUIRE_SYNC_OBJ; - + VALIDATERESLIST(); PVR_DPF((PVR_DBG_MESSAGE, "ResManRegisterRes: register resource " @@ -357,7 +357,7 @@ PRESMAN_ITEM ResManRegisterRes(PRESMAN_CONTEXT psResManContext, ui32Param, (IMG_UINTPTR_T)pfnFreeResource)); - + if (OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(RESMAN_ITEM), (IMG_VOID **)&psNewResItem, IMG_NULL, @@ -366,29 +366,29 @@ PRESMAN_ITEM ResManRegisterRes(PRESMAN_CONTEXT psResManContext, PVR_DPF((PVR_DBG_ERROR, "ResManRegisterRes: " "ERROR allocating new resource item")); - + RELEASE_SYNC_OBJ; return((PRESMAN_ITEM)IMG_NULL); } - + #ifdef DEBUG psNewResItem->ui32Signature = RESMAN_SIGNATURE; -#endif +#endif psNewResItem->ui32ResType = ui32ResType; psNewResItem->pvParam = pvParam; psNewResItem->ui32Param = ui32Param; psNewResItem->pfnFreeResource = pfnFreeResource; psNewResItem->ui32Flags = 0; - + List_RESMAN_ITEM_Insert(&psResManContext->psResItemList, psNewResItem); - + VALIDATERESLIST(); - + RELEASE_SYNC_OBJ; return(psNewResItem); @@ -409,19 +409,19 @@ PVRSRV_ERROR ResManFreeResByPtr(RESMAN_ITEM *psResItem, IMG_BOOL bForceCleanup) PVR_DPF((PVR_DBG_MESSAGE, "ResManFreeResByPtr: freeing resource at %08X", (IMG_UINTPTR_T)psResItem)); - + ACQUIRE_SYNC_OBJ; - + VALIDATERESLIST(); - + eError = FreeResourceByPtr(psResItem, IMG_TRUE, bForceCleanup); - + VALIDATERESLIST(); - + RELEASE_SYNC_OBJ; return(eError); @@ -438,10 +438,10 @@ PVRSRV_ERROR ResManFreeResByCriteria(PRESMAN_CONTEXT psResManContext, PVR_ASSERT(psResManContext != IMG_NULL); - + ACQUIRE_SYNC_OBJ; - + VALIDATERESLIST(); PVR_DPF((PVR_DBG_MESSAGE, "ResManFreeResByCriteria: " @@ -449,15 +449,15 @@ PVRSRV_ERROR ResManFreeResByCriteria(PRESMAN_CONTEXT psResManContext, (IMG_UINTPTR_T)psResManContext, ui32SearchCriteria, ui32ResType, (IMG_UINTPTR_T)pvParam, ui32Param)); - + eError = FreeResourceByCriteria(psResManContext, ui32SearchCriteria, ui32ResType, pvParam, ui32Param, IMG_TRUE); - + VALIDATERESLIST(); - + RELEASE_SYNC_OBJ; return eError; @@ -478,16 +478,16 @@ PVRSRV_ERROR ResManDissociateRes(RESMAN_ITEM *psResItem, return PVRSRV_ERROR_INVALID_PARAMS; } -#ifdef DEBUG +#ifdef DEBUG PVR_ASSERT(psResItem->ui32Signature == RESMAN_SIGNATURE); #endif if (psNewResManContext != IMG_NULL) { - + List_RESMAN_ITEM_Remove(psResItem); - + List_RESMAN_ITEM_Insert(&psNewResManContext->psResItemList, psResItem); } @@ -529,11 +529,11 @@ IMG_INTERNAL PVRSRV_ERROR ResManFindResourceByPtr(PRESMAN_CONTEXT psResManContex return PVRSRV_ERROR_INVALID_PARAMS; } -#ifdef DEBUG +#ifdef DEBUG PVR_ASSERT(psItem->ui32Signature == RESMAN_SIGNATURE); #endif - + ACQUIRE_SYNC_OBJ; PVR_DPF((PVR_DBG_MESSAGE, @@ -550,7 +550,7 @@ IMG_INTERNAL PVRSRV_ERROR ResManFindResourceByPtr(PRESMAN_CONTEXT psResManContex (IMG_UINTPTR_T)psItem->pfnFreeResource, psItem->ui32Flags)); - + if(List_RESMAN_ITEM_IMG_BOOL_Any_va(psResManContext->psResItemList, &ResManFindResourceByPtr_AnyVaCb, psItem)) @@ -562,7 +562,7 @@ IMG_INTERNAL PVRSRV_ERROR ResManFindResourceByPtr(PRESMAN_CONTEXT psResManContex eResult = PVRSRV_ERROR_NOT_OWNER; } - + RELEASE_SYNC_OBJ; return eResult; @@ -582,7 +582,7 @@ static PVRSRV_ERROR FreeResourceByPtr(RESMAN_ITEM *psItem, return PVRSRV_ERROR_INVALID_PARAMS; } -#ifdef DEBUG +#ifdef DEBUG PVR_ASSERT(psItem->ui32Signature == RESMAN_SIGNATURE); #endif @@ -597,28 +597,30 @@ static PVRSRV_ERROR FreeResourceByPtr(RESMAN_ITEM *psItem, (IMG_UINTPTR_T)psItem->pvParam, psItem->ui32Param, (IMG_UINTPTR_T)psItem->pfnFreeResource, psItem->ui32Flags)); - - List_RESMAN_ITEM_Remove(psItem); - - - + RELEASE_SYNC_OBJ; - + if (bExecuteCallback) { eError = psItem->pfnFreeResource(psItem->pvParam, psItem->ui32Param, bForceCleanup); - if (eError != PVRSRV_OK) + if ((eError != PVRSRV_OK) && (eError != PVRSRV_ERROR_RETRY)) { PVR_DPF((PVR_DBG_ERROR, "FreeResourceByPtr: ERROR calling FreeResource function")); } } - + ACQUIRE_SYNC_OBJ; + if (eError != PVRSRV_ERROR_RETRY) + { + + List_RESMAN_ITEM_Remove(psItem); - OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(RESMAN_ITEM), psItem, IMG_NULL); + + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(RESMAN_ITEM), psItem, IMG_NULL); + } return(eError); } @@ -635,17 +637,17 @@ static IMG_VOID* FreeResourceByCriteria_AnyVaCb(RESMAN_ITEM *psCurItem, va_list pvParam = va_arg(va, IMG_PVOID); ui32Param = va_arg(va, IMG_UINT32); - + if( - + (((ui32SearchCriteria & RESMAN_CRITERIA_RESTYPE) == 0UL) || (psCurItem->ui32ResType == ui32ResType)) && - + (((ui32SearchCriteria & RESMAN_CRITERIA_PVOID_PARAM) == 0UL) || (psCurItem->pvParam == pvParam)) && - + (((ui32SearchCriteria & RESMAN_CRITERIA_UI32_PARAM) == 0UL) || (psCurItem->ui32Param == ui32Param)) ) @@ -668,8 +670,8 @@ static PVRSRV_ERROR FreeResourceByCriteria(PRESMAN_CONTEXT psResManContext, PRESMAN_ITEM psCurItem; PVRSRV_ERROR eError = PVRSRV_OK; - - + + while((psCurItem = (PRESMAN_ITEM) List_RESMAN_ITEM_Any_va(psResManContext->psResItemList, &FreeResourceByCriteria_AnyVaCb, @@ -679,7 +681,19 @@ static PVRSRV_ERROR FreeResourceByCriteria(PRESMAN_CONTEXT psResManContext, ui32Param)) != IMG_NULL && eError == PVRSRV_OK) { - eError = FreeResourceByPtr(psCurItem, bExecuteCallback, CLEANUP_WITH_POLL); + do + { + eError = FreeResourceByPtr(psCurItem, bExecuteCallback, CLEANUP_WITH_POLL); + if (eError == PVRSRV_ERROR_RETRY) + { + RELEASE_SYNC_OBJ; + OSReleaseBridgeLock(); + + OSSleepms(MAX_CLEANUP_TIME_WAIT_US/1000); + OSReacquireBridgeLock(); + ACQUIRE_SYNC_OBJ; + } + } while (eError == PVRSRV_ERROR_RETRY); } return eError; @@ -692,7 +706,7 @@ static IMG_VOID ValidateResList(PRESMAN_LIST psResList) PRESMAN_ITEM psCurItem, *ppsThisItem; PRESMAN_CONTEXT psCurContext, *ppsThisContext; - + if (psResList == IMG_NULL) { PVR_DPF((PVR_DBG_MESSAGE, "ValidateResList: resman not initialised yet")); @@ -702,10 +716,10 @@ static IMG_VOID ValidateResList(PRESMAN_LIST psResList) psCurContext = psResList->psContextList; ppsThisContext = &psResList->psContextList; - + while(psCurContext != IMG_NULL) { - + PVR_ASSERT(psCurContext->ui32Signature == RESMAN_SIGNATURE); if (psCurContext->ppsThis != ppsThisContext) { @@ -718,12 +732,12 @@ static IMG_VOID ValidateResList(PRESMAN_LIST psResList) PVR_ASSERT(psCurContext->ppsThis == ppsThisContext); } - + psCurItem = psCurContext->psResItemList; ppsThisItem = &psCurContext->psResItemList; while(psCurItem != IMG_NULL) { - + PVR_ASSERT(psCurItem->ui32Signature == RESMAN_SIGNATURE); if (psCurItem->ppsThis != ppsThisItem) { @@ -736,16 +750,16 @@ static IMG_VOID ValidateResList(PRESMAN_LIST psResList) PVR_ASSERT(psCurItem->ppsThis == ppsThisItem); } - + ppsThisItem = &psCurItem->psNext; psCurItem = psCurItem->psNext; } - + ppsThisContext = &psCurContext->psNext; psCurContext = psCurContext->psNext; } } -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/common/ttrace.c b/drivers/staging/mrst/pvr/services4/srvkm/common/ttrace.c index b2d0e74..8265127 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/common/ttrace.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/common/ttrace.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * *****************************************************************************/ #if defined (TTRACE) @@ -112,7 +112,7 @@ PVRSRVTimeTraceAllocItem(IMG_UINT32 **pui32Item, IMG_UINT32 ui32Size) PVR_DPF((PVR_DBG_ERROR, "PVRSRVTimeTraceAllocItem: Failed to create buffer")); return; } - + psBuffer = (sTimeTraceBuffer *) HASH_Retrieve(g_psBufferTable, (IMG_UINTPTR_T) ui32PID); if (psBuffer == IMG_NULL) { diff --git a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/mmu.c b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/mmu.c index 49bf6c6..c22a4b9 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/mmu.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/mmu.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -77,26 +77,26 @@ typedef struct _MMU_PT_INFO_ { - + IMG_VOID *hPTPageOSMemHandle; IMG_CPU_VIRTADDR PTPageCpuVAddr; - - + + IMG_UINT32 ui32ValidPTECount; } MMU_PT_INFO; struct _MMU_CONTEXT_ { - + PVRSRV_DEVICE_NODE *psDeviceNode; - + IMG_CPU_VIRTADDR pvPDCpuVAddr; IMG_DEV_PHYADDR sPDDevPAddr; IMG_VOID *hPDOSMemHandle; - + MMU_PT_INFO *apsPTInfoList[SGX_MAX_PD_ENTRIES]; PVRSRV_SGXDEV_INFO *psDevInfo; @@ -118,54 +118,54 @@ struct _MMU_CONTEXT_ struct _MMU_HEAP_ { - + MMU_CONTEXT *psMMUContext; + - - + IMG_UINT32 ui32PDBaseIndex; - + IMG_UINT32 ui32PageTableCount; - + IMG_UINT32 ui32PTETotalUsable; - + IMG_UINT32 ui32PDEPageSizeCtrl; + - - + IMG_UINT32 ui32DataPageSize; - + IMG_UINT32 ui32DataPageBitWidth; - + IMG_UINT32 ui32DataPageMask; + - - + IMG_UINT32 ui32PTShift; - + IMG_UINT32 ui32PTBitWidth; - + IMG_UINT32 ui32PTMask; - + IMG_UINT32 ui32PTSize; - + IMG_UINT32 ui32PTNumEntriesAllocated; - + IMG_UINT32 ui32PTNumEntriesUsable; + - - + IMG_UINT32 ui32PDShift; - + IMG_UINT32 ui32PDBitWidth; - + IMG_UINT32 ui32PDMask; - + RA_ARENA *psVMArena; DEV_ARENA_DESCRIPTOR *psDevArena; @@ -190,7 +190,7 @@ MMU_PDumpPageTables (MMU_HEAP *pMMUHeap, IMG_SIZE_T uSize, IMG_BOOL bForUnmap, IMG_HANDLE hUniqueTag); -#endif +#endif #define PAGE_TEST 0 #if PAGE_TEST @@ -206,7 +206,7 @@ static IMG_VOID DumpPT(MMU_PT_INFO *psPTInfoList) IMG_UINT32 *p = (IMG_UINT32*)psPTInfoList->PTPageCpuVAddr; IMG_UINT32 i; - + for(i = 0; i < 1024; i += 8) { PVR_DPF((PVR_DBG_ERROR, @@ -215,12 +215,12 @@ static IMG_VOID DumpPT(MMU_PT_INFO *psPTInfoList) p[i + 4], p[i + 5], p[i + 6], p[i + 7])); } } -#else +#else static INLINE IMG_VOID DumpPT(MMU_PT_INFO *psPTInfoList) { PVR_UNREFERENCED_PARAMETER(psPTInfoList); } -#endif +#endif #if PT_DEBUG static IMG_VOID CheckPT(MMU_PT_INFO *psPTInfoList) @@ -228,7 +228,7 @@ static IMG_VOID CheckPT(MMU_PT_INFO *psPTInfoList) IMG_UINT32 *p = (IMG_UINT32*) psPTInfoList->PTPageCpuVAddr; IMG_UINT32 i, ui32Count = 0; - + for(i = 0; i < 1024; i++) if(p[i] & SGX_MMU_PTE_VALID) ui32Count++; @@ -241,12 +241,12 @@ static IMG_VOID CheckPT(MMU_PT_INFO *psPTInfoList) BUG(); } } -#else +#else static INLINE IMG_VOID CheckPT(MMU_PT_INFO *psPTInfoList) { PVR_UNREFERENCED_PARAMETER(psPTInfoList); } -#endif +#endif #if defined(PVRSRV_MMU_MAKE_READWRITE_ON_DEMAND) @@ -273,12 +273,9 @@ static IMG_VOID MakeKernelPageReadWrite(IMG_PVOID ulCPUVAddr) pmd_t *psPMD; pte_t *psPTE; pte_t ptent; - spinlock_t *psPTLock; IMG_UINT32 ui32CPUVAddr = (IMG_UINT32) ulCPUVAddr; - struct mm_struct *psMM = current->active_mm; - - psPGD = pgd_offset(psMM, ui32CPUVAddr); + psPGD = pgd_offset_k(ui32CPUVAddr); if (pgd_none(*psPGD) || pgd_bad(*psPGD)) { PVR_ASSERT(0); @@ -295,13 +292,11 @@ static IMG_VOID MakeKernelPageReadWrite(IMG_PVOID ulCPUVAddr) { PVR_ASSERT(0); } + psPTE = (pte_t *)pte_offset_kernel(psPMD, ui32CPUVAddr); - psPTE = (pte_t *)pte_offset_map_lock(psMM, psPMD, ui32CPUVAddr, &psPTLock); - - ptent = ptep_modify_prot_start(psMM, ui32CPUVAddr, psPTE); + ptent = ptep_modify_prot_start(&init_mm, ui32CPUVAddr, psPTE); ptent = pte_mkwrite(ptent); - ptep_modify_prot_commit(psMM, ui32CPUVAddr, psPTE, ptent); - pte_unmap_unlock(psPTE, psPTLock); + ptep_modify_prot_commit(&init_mm, ui32CPUVAddr, psPTE, ptent); flush_tlb_all(); } @@ -313,13 +308,11 @@ static IMG_VOID MakeKernelPageReadOnly(IMG_PVOID ulCPUVAddr) pmd_t *psPMD; pte_t *psPTE; pte_t ptent; - spinlock_t *psPTLock; IMG_UINT32 ui32CPUVAddr = (IMG_UINT32) ulCPUVAddr; - struct mm_struct *psMM = current->active_mm; OSWriteMemoryBarrier(); - psPGD = pgd_offset(psMM, ui32CPUVAddr); + psPGD = pgd_offset_k(ui32CPUVAddr); if (pgd_none(*psPGD) || pgd_bad(*psPGD)) { PVR_ASSERT(0); @@ -337,19 +330,17 @@ static IMG_VOID MakeKernelPageReadOnly(IMG_PVOID ulCPUVAddr) PVR_ASSERT(0); } + psPTE = (pte_t *)pte_offset_kernel(psPMD, ui32CPUVAddr); - psPTE = (pte_t *)pte_offset_map_lock(psMM, psPMD, ui32CPUVAddr, &psPTLock); - - ptent = ptep_modify_prot_start(psMM, ui32CPUVAddr, psPTE); + ptent = ptep_modify_prot_start(&init_mm, ui32CPUVAddr, psPTE); ptent = pte_wrprotect(ptent); - ptep_modify_prot_commit(psMM, ui32CPUVAddr, psPTE, ptent); - pte_unmap_unlock(psPTE, psPTLock); + ptep_modify_prot_commit(&init_mm, ui32CPUVAddr, psPTE, ptent); flush_tlb_all(); } -#else +#else static INLINE IMG_VOID MakeKernelPageReadWrite(IMG_PVOID ulCPUVAddr) { @@ -361,7 +352,7 @@ static INLINE IMG_VOID MakeKernelPageReadOnly(IMG_PVOID ulCPUVAddr) PVR_UNREFERENCED_PARAMETER(ulCPUVAddr); } -#endif +#endif IMG_BOOL MMU_IsHeapShared(MMU_HEAP* pMMUHeap) { @@ -388,7 +379,7 @@ EnableHostAccess (MMU_CONTEXT *psMMUContext) IMG_UINT32 ui32RegVal; IMG_VOID *pvRegsBaseKM = psMMUContext->psDevInfo->pvRegsBaseKM; - + ui32RegVal = OSReadHWReg(pvRegsBaseKM, EUR_CR_BIF_CTRL); @@ -396,7 +387,7 @@ EnableHostAccess (MMU_CONTEXT *psMMUContext) OSWriteHWReg(pvRegsBaseKM, EUR_CR_BIF_CTRL, ui32RegVal | EUR_CR_BIF_CTRL_MMU_BYPASS_HOST_MASK); - + PDUMPREG(SGX_PDUMPREG_NAME, EUR_CR_BIF_CTRL, EUR_CR_BIF_CTRL_MMU_BYPASS_HOST_MASK); } @@ -406,14 +397,14 @@ DisableHostAccess (MMU_CONTEXT *psMMUContext) IMG_UINT32 ui32RegVal; IMG_VOID *pvRegsBaseKM = psMMUContext->psDevInfo->pvRegsBaseKM; - + OSWriteHWReg(pvRegsBaseKM, EUR_CR_BIF_CTRL, ui32RegVal & ~EUR_CR_BIF_CTRL_MMU_BYPASS_HOST_MASK); - + PDUMPREG(SGX_PDUMPREG_NAME, EUR_CR_BIF_CTRL, 0); } #endif @@ -425,18 +416,18 @@ static IMG_VOID MMU_InvalidateSystemLevelCache(PVRSRV_SGXDEV_INFO *psDevInfo) #if defined(SGX_FEATURE_MP) psDevInfo->ui32CacheControl |= SGXMKIF_CC_INVAL_BIF_SL; #else - + PVR_UNREFERENCED_PARAMETER(psDevInfo); - #endif + #endif } -#endif +#endif IMG_VOID MMU_InvalidateDirectoryCache(PVRSRV_SGXDEV_INFO *psDevInfo) { psDevInfo->ui32CacheControl |= SGXMKIF_CC_INVAL_BIF_PD; #if defined(SGX_FEATURE_SYSTEM_CACHE) MMU_InvalidateSystemLevelCache(psDevInfo); - #endif + #endif } @@ -445,7 +436,7 @@ static IMG_VOID MMU_InvalidatePageTableCache(PVRSRV_SGXDEV_INFO *psDevInfo) psDevInfo->ui32CacheControl |= SGXMKIF_CC_INVAL_BIF_PT; #if defined(SGX_FEATURE_SYSTEM_CACHE) MMU_InvalidateSystemLevelCache(psDevInfo); - #endif + #endif } #if defined(FIX_HW_BRN_31620) @@ -453,7 +444,7 @@ static IMG_VOID BRN31620InvalidatePageTableEntry(MMU_CONTEXT *psMMUContext, IMG_ { PVRSRV_SGXDEV_INFO *psDevInfo = psMMUContext->psDevInfo; - + if (((ui32PDIndex % (BRN31620_PDE_CACHE_FILL_SIZE/BRN31620_PT_ADDRESS_RANGE_SIZE)) == BRN31620_DUMMY_PDE_INDEX) && (ui32PTIndex == BRN31620_DUMMY_PTE_INDEX)) { @@ -478,13 +469,13 @@ static IMG_BOOL BRN31620FreePageTable(MMU_HEAP *psMMUHeap, IMG_UINT32 ui32PDInde PVR_ASSERT(psMMUHeap != IMG_NULL); - + PVR_ASSERT(psMMUContext->apsPTInfoListSave[ui32PDIndex] == IMG_NULL); psMMUContext->apsPTInfoListSave[ui32PDIndex] = psMMUContext->apsPTInfoList[ui32PDIndex]; psMMUContext->apsPTInfoList[ui32PDIndex] = IMG_NULL; - + if (--psMMUContext->ui32PDCacheRangeRefCount[ui32PDCacheLine] == 0) { IMG_UINT32 i; @@ -492,10 +483,10 @@ static IMG_BOOL BRN31620FreePageTable(MMU_HEAP *psMMUHeap, IMG_UINT32 ui32PDInde IMG_UINT32 ui32PDIndexEnd = ui32PDIndexStart + BRN31620_PDES_PER_CACHE_LINE_SIZE; IMG_UINT32 ui32PDBitMaskIndex, ui32PDBitMaskShift; - + for (i=ui32PDIndexStart;iapsPTInfoList[i] = psMMUContext->apsPTInfoListSave[i]; psMMUContext->apsPTInfoListSave[i] = IMG_NULL; _DeferredFreePageTable(psMMUHeap, i - psMMUHeap->ui32PDBaseIndex, IMG_TRUE); @@ -504,17 +495,17 @@ static IMG_BOOL BRN31620FreePageTable(MMU_HEAP *psMMUHeap, IMG_UINT32 ui32PDInde ui32PDBitMaskIndex = ui32PDCacheLine >> BRN31620_CACHE_FLUSH_BITS_SHIFT; ui32PDBitMaskShift = ui32PDCacheLine & BRN31620_CACHE_FLUSH_BITS_MASK; - + if (MMU_IsHeapShared(psMMUHeap)) { - + MMU_CONTEXT *psMMUContextWalker = (MMU_CONTEXT*) psMMUHeap->psMMUContext->psDevInfo->pvMMUContextList; while(psMMUContextWalker) { psMMUContextWalker->ui32PDChangeMask[ui32PDBitMaskIndex] |= 1 << ui32PDBitMaskShift; - + MakeKernelPageReadWrite(psMMUContextWalker->pvPDCpuVAddr); pui32Tmp = (IMG_UINT32 *) psMMUContextWalker->pvPDCpuVAddr; pui32Tmp[ui32PDIndexStart + BRN31620_DUMMY_PDE_INDEX] = (psDevInfo->sBRN31620DummyPTDevPAddr.uiAddr>>SGX_MMU_PDE_ADDR_ALIGNSHIFT) @@ -532,7 +523,7 @@ static IMG_BOOL BRN31620FreePageTable(MMU_HEAP *psMMUHeap, IMG_UINT32 ui32PDInde { psMMUContext->ui32PDChangeMask[ui32PDBitMaskIndex] |= 1 << ui32PDBitMaskShift; - + MakeKernelPageReadWrite(psMMUContext->pvPDCpuVAddr); pui32Tmp = (IMG_UINT32 *) psMMUContext->pvPDCpuVAddr; pui32Tmp[ui32PDIndexStart + BRN31620_DUMMY_PDE_INDEX] = (psDevInfo->sBRN31620DummyPTDevPAddr.uiAddr>>SGX_MMU_PDE_ADDR_ALIGNSHIFT) @@ -544,7 +535,7 @@ static IMG_BOOL BRN31620FreePageTable(MMU_HEAP *psMMUHeap, IMG_UINT32 ui32PDInde PDUMPCOMMENT("BRN31620 Re-wire dummy PT due to releasing PT allocation block"); PDUMPPDENTRIES(&psMMUHeap->sMMUAttrib, psMMUContext->hPDOSMemHandle, (IMG_VOID*)&pui32Tmp[ui32PDIndexStart + BRN31620_DUMMY_PDE_INDEX], sizeof(IMG_UINT32), 0, IMG_FALSE, PDUMP_PT_UNIQUETAG, PDUMP_PT_UNIQUETAG); } - + bFreePTs = IMG_TRUE; } @@ -560,12 +551,12 @@ _AllocPageTableMemory (MMU_HEAP *pMMUHeap, IMG_DEV_PHYADDR sDevPAddr; IMG_CPU_PHYADDR sCpuPAddr; - + if(pMMUHeap->psDevArena->psDeviceMemoryHeapInfo->psLocalDevMemArena == IMG_NULL) { - + if (OSAllocPages(PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_KERNEL_ONLY, pMMUHeap->ui32PTSize, SGX_MMU_PAGE_SIZE, @@ -578,12 +569,12 @@ _AllocPageTableMemory (MMU_HEAP *pMMUHeap, return IMG_FALSE; } - + MakeKernelPageReadOnly(psPTInfoList->PTPageCpuVAddr); - + if(psPTInfoList->PTPageCpuVAddr) { sCpuPAddr = OSMapLinToCPUPhys(psPTInfoList->hPTPageOSMemHandle, @@ -591,7 +582,7 @@ _AllocPageTableMemory (MMU_HEAP *pMMUHeap, } else { - + sCpuPAddr = OSMemHandleToCpuPAddr(psPTInfoList->hPTPageOSMemHandle, 0); } @@ -601,10 +592,10 @@ _AllocPageTableMemory (MMU_HEAP *pMMUHeap, { IMG_SYS_PHYADDR sSysPAddr; + - - + if(RA_Alloc(pMMUHeap->psDevArena->psDeviceMemoryHeapInfo->psLocalDevMemArena, SGX_MMU_PAGE_SIZE, IMG_NULL, @@ -620,9 +611,9 @@ _AllocPageTableMemory (MMU_HEAP *pMMUHeap, return IMG_FALSE; } - + sCpuPAddr = SysSysPAddrToCpuPAddr(sSysPAddr); - + psPTInfoList->PTPageCpuVAddr = OSMapPhysToLin(sCpuPAddr, SGX_MMU_PAGE_SIZE, PVRSRV_HAP_WRITECOMBINE|PVRSRV_HAP_KERNEL_ONLY, @@ -633,7 +624,7 @@ _AllocPageTableMemory (MMU_HEAP *pMMUHeap, return IMG_FALSE; } - + sDevPAddr = SysCpuPAddrToDevPAddr (PVRSRV_DEVICE_TYPE_SGX, sCpuPAddr); #if PAGE_TEST @@ -648,20 +639,20 @@ _AllocPageTableMemory (MMU_HEAP *pMMUHeap, IMG_UINT32 i; pui32Tmp = (IMG_UINT32*)psPTInfoList->PTPageCpuVAddr; - + for(i=0; iui32PTNumEntriesUsable; i++) { pui32Tmp[i] = (pMMUHeap->psMMUContext->psDevInfo->sDummyDataDevPAddr.uiAddr>>SGX_MMU_PTE_ADDR_ALIGNSHIFT) | SGX_MMU_PTE_VALID; } - + for(; iui32PTNumEntriesAllocated; i++) { pui32Tmp[i] = 0; } } #else - + OSMemSet(psPTInfoList->PTPageCpuVAddr, 0, pMMUHeap->ui32PTSize); #endif MakeKernelPageReadOnly(psPTInfoList->PTPageCpuVAddr); @@ -670,17 +661,17 @@ _AllocPageTableMemory (MMU_HEAP *pMMUHeap, { IMG_UINT32 ui32Flags = 0; #if defined(SUPPORT_PDUMP_MULTI_PROCESS) - + ui32Flags |= ( MMU_IsHeapShared(pMMUHeap) ) ? PDUMP_FLAGS_PERSISTENT : 0; #endif - + PDUMPMALLOCPAGETABLE(&pMMUHeap->psMMUContext->psDeviceNode->sDevId, psPTInfoList->hPTPageOSMemHandle, 0, psPTInfoList->PTPageCpuVAddr, pMMUHeap->ui32PTSize, ui32Flags, PDUMP_PT_UNIQUETAG); - + PDUMPMEMPTENTRIES(&pMMUHeap->sMMUAttrib, psPTInfoList->hPTPageOSMemHandle, psPTInfoList->PTPageCpuVAddr, pMMUHeap->ui32PTSize, ui32Flags, IMG_TRUE, PDUMP_PT_UNIQUETAG, PDUMP_PT_UNIQUETAG); } #endif - - + + *psDevPAddr = sDevPAddr; return IMG_TRUE; @@ -690,16 +681,16 @@ _AllocPageTableMemory (MMU_HEAP *pMMUHeap, static IMG_VOID _FreePageTableMemory (MMU_HEAP *pMMUHeap, MMU_PT_INFO *psPTInfoList) { - + if(pMMUHeap->psDevArena->psDeviceMemoryHeapInfo->psLocalDevMemArena == IMG_NULL) { - + MakeKernelPageReadWrite(psPTInfoList->PTPageCpuVAddr); - + OSFreePages(PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_KERNEL_ONLY, pMMUHeap->ui32PTSize, psPTInfoList->PTPageCpuVAddr, @@ -710,19 +701,19 @@ _FreePageTableMemory (MMU_HEAP *pMMUHeap, MMU_PT_INFO *psPTInfoList) IMG_SYS_PHYADDR sSysPAddr; IMG_CPU_PHYADDR sCpuPAddr; - - sCpuPAddr = OSMapLinToCPUPhys(psPTInfoList->hPTPageOSMemHandle, + + sCpuPAddr = OSMapLinToCPUPhys(psPTInfoList->hPTPageOSMemHandle, psPTInfoList->PTPageCpuVAddr); sSysPAddr = SysCpuPAddrToSysPAddr (sCpuPAddr); - - + + OSUnMapPhysToLin(psPTInfoList->PTPageCpuVAddr, SGX_MMU_PAGE_SIZE, PVRSRV_HAP_WRITECOMBINE|PVRSRV_HAP_KERNEL_ONLY, psPTInfoList->hPTPageOSMemHandle); - + RA_Free (pMMUHeap->psDevArena->psDeviceMemoryHeapInfo->psLocalDevMemArena, sSysPAddr.uiAddr, IMG_FALSE); @@ -742,10 +733,10 @@ _DeferredFreePageTable (MMU_HEAP *pMMUHeap, IMG_UINT32 ui32PTIndex, IMG_BOOL bOS SysAcquireData(&psSysData); - + ui32PDIndex = pMMUHeap->psDevArena->BaseDevVAddr.uiAddr >> pMMUHeap->ui32PDShift; - + ppsPTInfoList = &pMMUHeap->psMMUContext->apsPTInfoList[ui32PDIndex]; { @@ -753,11 +744,11 @@ _DeferredFreePageTable (MMU_HEAP *pMMUHeap, IMG_UINT32 ui32PTIndex, IMG_BOOL bOS if(ppsPTInfoList[ui32PTIndex] && ppsPTInfoList[ui32PTIndex]->ui32ValidPTECount > 0) { DumpPT(ppsPTInfoList[ui32PTIndex]); - + } #endif - + PVR_ASSERT(ppsPTInfoList[ui32PTIndex] == IMG_NULL || ppsPTInfoList[ui32PTIndex]->ui32ValidPTECount == 0); } @@ -767,7 +758,7 @@ _DeferredFreePageTable (MMU_HEAP *pMMUHeap, IMG_UINT32 ui32PTIndex, IMG_BOOL bOS #if defined(SUPPORT_PDUMP_MULTI_PROCESS) ui32Flags |= ( MMU_IsHeapShared(pMMUHeap) ) ? PDUMP_FLAGS_PERSISTENT : 0; #endif - + PDUMPCOMMENT("Free page table (page count == %08X)", pMMUHeap->ui32PageTableCount); if(ppsPTInfoList[ui32PTIndex] && ppsPTInfoList[ui32PTIndex]->PTPageCpuVAddr) { @@ -781,24 +772,24 @@ _DeferredFreePageTable (MMU_HEAP *pMMUHeap, IMG_UINT32 ui32PTIndex, IMG_BOOL bOS case DEVICE_MEMORY_HEAP_SHARED : case DEVICE_MEMORY_HEAP_SHARED_EXPORTED : { - + MMU_CONTEXT *psMMUContext = (MMU_CONTEXT*)pMMUHeap->psMMUContext->psDevInfo->pvMMUContextList; while(psMMUContext) { - + MakeKernelPageReadWrite(psMMUContext->pvPDCpuVAddr); pui32PDEntry = (IMG_UINT32*)psMMUContext->pvPDCpuVAddr; pui32PDEntry += ui32PDIndex; #if defined(SUPPORT_SGX_MMU_DUMMY_PAGE) - + pui32PDEntry[ui32PTIndex] = (psMMUContext->psDevInfo->sDummyPTDevPAddr.uiAddr >>SGX_MMU_PDE_ADDR_ALIGNSHIFT) | SGX_MMU_PDE_PAGE_SIZE_4K | SGX_MMU_PDE_VALID; #else - + if(bOSFreePT) { pui32PDEntry[ui32PTIndex] = 0; @@ -806,7 +797,7 @@ _DeferredFreePageTable (MMU_HEAP *pMMUHeap, IMG_UINT32 ui32PTIndex, IMG_BOOL bOS #endif MakeKernelPageReadOnly(psMMUContext->pvPDCpuVAddr); #if defined(PDUMP) - + #if defined(SUPPORT_PDUMP_MULTI_PROCESS) if(psMMUContext->bPDumpActive) #endif @@ -814,7 +805,7 @@ _DeferredFreePageTable (MMU_HEAP *pMMUHeap, IMG_UINT32 ui32PTIndex, IMG_BOOL bOS PDUMPPDENTRIES(&pMMUHeap->sMMUAttrib, psMMUContext->hPDOSMemHandle, (IMG_VOID*)&pui32PDEntry[ui32PTIndex], sizeof(IMG_UINT32), 0, IMG_FALSE, PDUMP_PT_UNIQUETAG, PDUMP_PT_UNIQUETAG); } #endif - + psMMUContext = psMMUContext->psNext; } break; @@ -823,18 +814,18 @@ _DeferredFreePageTable (MMU_HEAP *pMMUHeap, IMG_UINT32 ui32PTIndex, IMG_BOOL bOS case DEVICE_MEMORY_HEAP_KERNEL : { MakeKernelPageReadWrite(pMMUHeap->psMMUContext->pvPDCpuVAddr); - + pui32PDEntry = (IMG_UINT32*)pMMUHeap->psMMUContext->pvPDCpuVAddr; pui32PDEntry += ui32PDIndex; #if defined(SUPPORT_SGX_MMU_DUMMY_PAGE) - + pui32PDEntry[ui32PTIndex] = (pMMUHeap->psMMUContext->psDevInfo->sDummyPTDevPAddr.uiAddr >>SGX_MMU_PDE_ADDR_ALIGNSHIFT) | SGX_MMU_PDE_PAGE_SIZE_4K | SGX_MMU_PDE_VALID; #else - + if(bOSFreePT) { pui32PDEntry[ui32PTIndex] = 0; @@ -842,7 +833,7 @@ _DeferredFreePageTable (MMU_HEAP *pMMUHeap, IMG_UINT32 ui32PTIndex, IMG_BOOL bOS #endif MakeKernelPageReadOnly(pMMUHeap->psMMUContext->pvPDCpuVAddr); - + PDUMPPDENTRIES(&pMMUHeap->sMMUAttrib, pMMUHeap->psMMUContext->hPDOSMemHandle, (IMG_VOID*)&pui32PDEntry[ui32PTIndex], sizeof(IMG_UINT32), 0, IMG_FALSE, PDUMP_PD_UNIQUETAG, PDUMP_PT_UNIQUETAG); break; } @@ -853,7 +844,7 @@ _DeferredFreePageTable (MMU_HEAP *pMMUHeap, IMG_UINT32 ui32PTIndex, IMG_BOOL bOS } } - + if(ppsPTInfoList[ui32PTIndex] != IMG_NULL) { if(ppsPTInfoList[ui32PTIndex]->PTPageCpuVAddr != IMG_NULL) @@ -863,37 +854,37 @@ _DeferredFreePageTable (MMU_HEAP *pMMUHeap, IMG_UINT32 ui32PTIndex, IMG_BOOL bOS MakeKernelPageReadWrite(ppsPTInfoList[ui32PTIndex]->PTPageCpuVAddr); pui32Tmp = (IMG_UINT32*)ppsPTInfoList[ui32PTIndex]->PTPageCpuVAddr; - + for(i=0; (iui32PTETotalUsable) && (iui32PTNumEntriesUsable); i++) { - + pui32Tmp[i] = 0; } MakeKernelPageReadOnly(ppsPTInfoList[ui32PTIndex]->PTPageCpuVAddr); - + if(bOSFreePT) { _FreePageTableMemory(pMMUHeap, ppsPTInfoList[ui32PTIndex]); } - + pMMUHeap->ui32PTETotalUsable -= i; } else { - + pMMUHeap->ui32PTETotalUsable -= pMMUHeap->ui32PTNumEntriesUsable; } if(bOSFreePT) { - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(MMU_PT_INFO), ppsPTInfoList[ui32PTIndex], @@ -903,7 +894,7 @@ _DeferredFreePageTable (MMU_HEAP *pMMUHeap, IMG_UINT32 ui32PTIndex, IMG_BOOL bOS } else { - + pMMUHeap->ui32PTETotalUsable -= pMMUHeap->ui32PTNumEntriesUsable; } @@ -936,14 +927,14 @@ _DeferredFreePageTables (MMU_HEAP *pMMUHeap) { if (psMMUContext->apsPTInfoList[ui32PDIndex]->PTPageCpuVAddr) { - + for (j=0;japsPTInfoList[ui32PDIndex]->PTPageCpuVAddr; BRN31620InvalidatePageTableEntry(psMMUContext, ui32PDIndex, j, &pui32Tmp[j]); } } - + if (BRN31620FreePageTable(pMMUHeap, ui32PDIndex) == IMG_TRUE) { bInvalidateDirectoryCache = IMG_TRUE; @@ -951,7 +942,7 @@ _DeferredFreePageTables (MMU_HEAP *pMMUHeap) } } - + if (bInvalidateDirectoryCache) { MMU_InvalidateDirectoryCache(pMMUHeap->psMMUContext->psDevInfo); @@ -990,23 +981,23 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT IMG_UINT32 ui32ModifiedCachelines[BRN31620_CACHE_FLUSH_INDEX_SIZE]; #endif - + #if SGX_FEATURE_ADDRESS_SPACE_SIZE < 32 PVR_ASSERT(DevVAddr.uiAddr < (1<> pMMUHeap->ui32PDShift; - - + + if((UINT32_MAX_VALUE - DevVAddr.uiAddr) < (ui32Size + pMMUHeap->ui32DataPageMask + pMMUHeap->ui32PTMask)) { - + sHighDevVAddr.uiAddr = UINT32_MAX_VALUE; } else @@ -1019,7 +1010,7 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT ui32PageTableCount = sHighDevVAddr.uiAddr >> pMMUHeap->ui32PDShift; - + if (ui32PageTableCount == 0) ui32PageTableCount = 1024; @@ -1029,42 +1020,42 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT ui32ModifiedCachelines[i] = 0; } - - - + + + sDevVAddrRequestStart = DevVAddr; ui32PDRequestStart = ui32PDIndex; sDevVAddrRequestEnd = sHighDevVAddr; ui32PDRequestEnd = ui32PageTableCount - 1; - + DevVAddr.uiAddr = DevVAddr.uiAddr & (~BRN31620_PDE_CACHE_FILL_MASK); - + sHighDevVAddr.uiAddr = ((sHighDevVAddr.uiAddr + (BRN31620_PDE_CACHE_FILL_SIZE - 1)) & (~BRN31620_PDE_CACHE_FILL_MASK)); ui32PDIndex = DevVAddr.uiAddr >> pMMUHeap->ui32PDShift; ui32PageTableCount = sHighDevVAddr.uiAddr >> pMMUHeap->ui32PDShift; - + if (ui32PageTableCount == 0) ui32PageTableCount = 1024; #endif ui32PageTableCount -= ui32PDIndex; - + pui32PDEntry = (IMG_UINT32*)pMMUHeap->psMMUContext->pvPDCpuVAddr; pui32PDEntry += ui32PDIndex; - + ppsPTInfoList = &pMMUHeap->psMMUContext->apsPTInfoList[ui32PDIndex]; #if defined(PDUMP) { IMG_UINT32 ui32Flags = 0; - - + + if( MMU_IsHeapShared(pMMUHeap) ) { ui32Flags |= PDUMP_FLAGS_CONTINUOUS; @@ -1077,16 +1068,16 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT PDUMPCOMMENTWITHFLAGS(ui32Flags, "Page directory mods (page count == %08X)", ui32PageTableCount); } #endif - + for(i=0; ipsMMUContext->apsPTInfoListSave[ui32PDIndex + i]) { - + if (((ui32PDIndex + i) >= ui32PDRequestStart) && ((ui32PDIndex + i) <= ui32PDRequestEnd)) { IMG_UINT32 ui32PDCacheLine = (ui32PDIndex + i) >> BRN31620_PDES_PER_CACHE_LINE_SHIFT; @@ -1115,7 +1106,7 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT #endif } #if defined(FIX_HW_BRN_31620) - + if (ppsPTInfoList[i]) { #endif @@ -1128,7 +1119,7 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT IMG_UINT32 j; #else #if !defined(FIX_HW_BRN_31620) - + PVR_ASSERT(pui32PDEntry[i] == 0); #endif #endif @@ -1139,7 +1130,7 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT } #if defined(FIX_HW_BRN_31620) bFlushSystemCache = IMG_TRUE; - + { IMG_UINT32 ui32PD; IMG_UINT32 ui32PDCacheLine; @@ -1152,7 +1143,7 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT ui32PDBitMaskShift = ui32PDCacheLine & BRN31620_CACHE_FLUSH_BITS_MASK; ui32ModifiedCachelines[ui32PDBitMaskIndex] |= 1 << ui32PDBitMaskShift; - + if ((pMMUHeap->ui32PDBaseIndex + pMMUHeap->ui32PageTableCount) < (ui32PD + 1)) { pMMUHeap->ui32PageTableCount = (ui32PD + 1) - pMMUHeap->ui32PDBaseIndex; @@ -1169,32 +1160,32 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT case DEVICE_MEMORY_HEAP_SHARED : case DEVICE_MEMORY_HEAP_SHARED_EXPORTED : { - + MMU_CONTEXT *psMMUContext = (MMU_CONTEXT*)pMMUHeap->psMMUContext->psDevInfo->pvMMUContextList; while(psMMUContext) { MakeKernelPageReadWrite(psMMUContext->pvPDCpuVAddr); - + pui32PDEntry = (IMG_UINT32*)psMMUContext->pvPDCpuVAddr; pui32PDEntry += ui32PDIndex; - + pui32PDEntry[i] = (sDevPAddr.uiAddr>>SGX_MMU_PDE_ADDR_ALIGNSHIFT) | pMMUHeap->ui32PDEPageSizeCtrl | SGX_MMU_PDE_VALID; MakeKernelPageReadOnly(psMMUContext->pvPDCpuVAddr); #if defined(PDUMP) - + #if defined(SUPPORT_PDUMP_MULTI_PROCESS) if(psMMUContext->bPDumpActive) #endif { - + PDUMPPDENTRIES(&pMMUHeap->sMMUAttrib, psMMUContext->hPDOSMemHandle, (IMG_VOID*)&pui32PDEntry[i], sizeof(IMG_UINT32), 0, IMG_FALSE, PDUMP_PD_UNIQUETAG, PDUMP_PT_UNIQUETAG); } - #endif - + #endif + psMMUContext = psMMUContext->psNext; } #if defined(FIX_HW_BRN_31620) @@ -1206,13 +1197,13 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT case DEVICE_MEMORY_HEAP_KERNEL : { MakeKernelPageReadWrite(pMMUHeap->psMMUContext->pvPDCpuVAddr); - + pui32PDEntry[i] = (sDevPAddr.uiAddr>>SGX_MMU_PDE_ADDR_ALIGNSHIFT) | pMMUHeap->ui32PDEPageSizeCtrl | SGX_MMU_PDE_VALID; MakeKernelPageReadOnly(pMMUHeap->psMMUContext->pvPDCpuVAddr); - - + + PDUMPPDENTRIES(&pMMUHeap->sMMUAttrib, pMMUHeap->psMMUContext->hPDOSMemHandle, (IMG_VOID*)&pui32PDEntry[i], sizeof(IMG_UINT32), 0, IMG_FALSE, PDUMP_PD_UNIQUETAG, PDUMP_PT_UNIQUETAG); break; } @@ -1224,14 +1215,14 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT } #if !defined(SGX_FEATURE_MULTIPLE_MEM_CONTEXTS) - + MMU_InvalidateDirectoryCache(pMMUHeap->psMMUContext->psDevInfo); #endif #if defined(FIX_HW_BRN_31620) - + if (((ui32PDIndex + i) < ui32PDRequestStart) || ((ui32PDIndex + i) > ui32PDRequestEnd)) { pMMUHeap->psMMUContext->apsPTInfoListSave[ui32PDIndex + i] = ppsPTInfoList[i]; @@ -1242,7 +1233,7 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT else { #if !defined(FIX_HW_BRN_31620) - + PVR_ASSERT(pui32PDEntry[i] != 0); #endif } @@ -1253,20 +1244,20 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT #if defined(SGX_FEATURE_SYSTEM_CACHE) #if defined(FIX_HW_BRN_31620) - + if (bFlushSystemCache) { #endif MMU_InvalidateSystemLevelCache(pMMUHeap->psMMUContext->psDevInfo); - #endif + #endif #if defined(FIX_HW_BRN_31620) } - + sHighDevVAddr.uiAddr = sHighDevVAddr.uiAddr - 1; - + if (bFlushSystemCache) { MMU_CONTEXT *psMMUContext; @@ -1282,7 +1273,7 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT psMMUContext->ui32PDChangeMask[i] |= ui32ModifiedCachelines[i]; } - + psMMUContext = psMMUContext->psNext; } } @@ -1294,7 +1285,7 @@ _DeferredAllocPagetables(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT } } - + psMMUContext = pMMUHeap->psMMUContext; for (i=0;iapsPTInfoList[ui32PDIndex]) { psTempPTInfo = psMMUContext->apsPTInfoList[ui32PDIndex]; @@ -1347,7 +1338,7 @@ IMG_UINT32 MMU_GetPDumpContextID(IMG_HANDLE hDevMemContext) { BM_CONTEXT *pBMContext = hDevMemContext; PVR_ASSERT(pBMContext); - + return pBMContext->psMMUContext->ui32PDumpMMUContextID; } @@ -1356,20 +1347,20 @@ static IMG_VOID MMU_SetPDumpAttribs(PDUMP_MMU_ATTRIB *psMMUAttrib, IMG_UINT32 ui32DataPageMask, IMG_UINT32 ui32PTSize) { - + psMMUAttrib->sDevId = psDeviceNode->sDevId; - + psMMUAttrib->pszPDRegRegion = IMG_NULL; psMMUAttrib->ui32DataPageMask = ui32DataPageMask; - + psMMUAttrib->ui32PTEValid = SGX_MMU_PTE_VALID; psMMUAttrib->ui32PTSize = ui32PTSize; psMMUAttrib->ui32PTEAlignShift = SGX_MMU_PTE_ADDR_ALIGNSHIFT; - + psMMUAttrib->ui32PDEMask = SGX_MMU_PDE_ADDR_MASK; psMMUAttrib->ui32PDEAlignShift = SGX_MMU_PDE_ADDR_ALIGNSHIFT; } -#endif +#endif PVRSRV_ERROR MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, IMG_DEV_PHYADDR *psPDDevPAddr) @@ -1390,8 +1381,8 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I SysAcquireData(&psSysData); #if defined(PDUMP) - - + + MMU_SetPDumpAttribs(&sMMUAttrib, psDeviceNode, SGX_MMU_PAGE_MASK, SGX_MMU_PT_SIZE * sizeof(IMG_UINT32)); @@ -1408,14 +1399,14 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I } OSMemSet (psMMUContext, 0, sizeof(MMU_CONTEXT)); - + psDevInfo = (PVRSRV_SGXDEV_INFO*)psDeviceNode->pvDevice; psMMUContext->psDevInfo = psDevInfo; - + psMMUContext->psDeviceNode = psDeviceNode; - + if(psDeviceNode->psLocalDevMemArena == IMG_NULL) { if (OSAllocPages(PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_KERNEL_ONLY, @@ -1437,7 +1428,7 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I } else { - + sCpuPAddr = OSMemHandleToCpuPAddr(hPDOSMemHandle, 0); } sPDDevPAddr = SysCpuPAddrToDevPAddr (PVRSRV_DEVICE_TYPE_SGX, sCpuPAddr); @@ -1447,10 +1438,10 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I #endif #if defined(SUPPORT_SGX_MMU_DUMMY_PAGE) - + if(!psDevInfo->pvMMUContextList) { - + if (OSAllocPages(PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_KERNEL_ONLY, SGX_MMU_PAGE_SIZE, SGX_MMU_PAGE_SIZE, @@ -1470,12 +1461,12 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I } else { - + sCpuPAddr = OSMemHandleToCpuPAddr(psDevInfo->hDummyPTPageOSMemHandle, 0); } psDevInfo->sDummyPTDevPAddr = SysCpuPAddrToDevPAddr (PVRSRV_DEVICE_TYPE_SGX, sCpuPAddr); - + if (OSAllocPages(PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_KERNEL_ONLY, SGX_MMU_PAGE_SIZE, SGX_MMU_PAGE_SIZE, @@ -1499,13 +1490,13 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I } psDevInfo->sDummyDataDevPAddr = SysCpuPAddrToDevPAddr (PVRSRV_DEVICE_TYPE_SGX, sCpuPAddr); } -#endif +#endif #if defined(FIX_HW_BRN_31620) - + if(!psDevInfo->pvMMUContextList) { IMG_UINT32 j; - + if (OSAllocPages(PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_KERNEL_ONLY, SGX_MMU_PAGE_SIZE, SGX_MMU_PAGE_SIZE, @@ -1516,9 +1507,9 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I { PVR_DPF((PVR_DBG_ERROR, "MMU_Initialise: ERROR call to OSAllocPages failed")); return PVRSRV_ERROR_FAILED_TO_ALLOC_PAGES; - } - + } + if(psDevInfo->pvBRN31620DummyPageCpuVAddr) { sCpuPAddr = OSMapLinToCPUPhys(psDevInfo->hBRN31620DummyPageOSMemHandle, @@ -1538,7 +1529,7 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I psDevInfo->sBRN31620DummyPageDevPAddr = SysCpuPAddrToDevPAddr(PVRSRV_DEVICE_TYPE_SGX, sCpuPAddr); PDUMPMALLOCPAGETABLE(&psDeviceNode->sDevId, psDevInfo->hBRN31620DummyPageOSMemHandle, 0, psDevInfo->pvBRN31620DummyPageCpuVAddr, SGX_MMU_PAGE_SIZE, 0, PDUMP_PT_UNIQUETAG); - + if (OSAllocPages(PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_KERNEL_ONLY, SGX_MMU_PAGE_SIZE, SGX_MMU_PAGE_SIZE, @@ -1549,9 +1540,9 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I { PVR_DPF((PVR_DBG_ERROR, "MMU_Initialise: ERROR call to OSAllocPages failed")); return PVRSRV_ERROR_FAILED_TO_ALLOC_PAGES; - } - + } + if(psDevInfo->pvBRN31620DummyPTCpuVAddr) { sCpuPAddr = OSMapLinToCPUPhys(psDevInfo->hBRN31620DummyPTOSMemHandle, @@ -1572,7 +1563,7 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I { IMG_SYS_PHYADDR sSysPAddr; - + if(RA_Alloc(psDeviceNode->psLocalDevMemArena, SGX_MMU_PAGE_SIZE, IMG_NULL, @@ -1588,7 +1579,7 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I return PVRSRV_ERROR_FAILED_TO_ALLOC_VIRT_MEMORY; } - + sCpuPAddr = SysSysPAddrToCpuPAddr(sSysPAddr); sPDDevPAddr = SysSysPAddrToDevPAddr(PVRSRV_DEVICE_TYPE_SGX, sSysPAddr); pvPDCpuVAddr = OSMapPhysToLin(sCpuPAddr, @@ -1606,10 +1597,10 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I #endif #if defined(SUPPORT_SGX_MMU_DUMMY_PAGE) - + if(!psDevInfo->pvMMUContextList) { - + if(RA_Alloc(psDeviceNode->psLocalDevMemArena, SGX_MMU_PAGE_SIZE, IMG_NULL, @@ -1625,7 +1616,7 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I return PVRSRV_ERROR_FAILED_TO_ALLOC_VIRT_MEMORY; } - + sCpuPAddr = SysSysPAddrToCpuPAddr(sSysPAddr); psDevInfo->sDummyPTDevPAddr = SysSysPAddrToDevPAddr(PVRSRV_DEVICE_TYPE_SGX, sSysPAddr); psDevInfo->pvDummyPTPageCpuVAddr = OSMapPhysToLin(sCpuPAddr, @@ -1638,7 +1629,7 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I return PVRSRV_ERROR_FAILED_TO_MAP_PAGE_TABLE; } - + if(RA_Alloc(psDeviceNode->psLocalDevMemArena, SGX_MMU_PAGE_SIZE, IMG_NULL, @@ -1654,7 +1645,7 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I return PVRSRV_ERROR_FAILED_TO_ALLOC_VIRT_MEMORY; } - + sCpuPAddr = SysSysPAddrToCpuPAddr(sSysPAddr); psDevInfo->sDummyDataDevPAddr = SysSysPAddrToDevPAddr(PVRSRV_DEVICE_TYPE_SGX, sSysPAddr); psDevInfo->pvDummyDataPageCpuVAddr = OSMapPhysToLin(sCpuPAddr, @@ -1667,13 +1658,13 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I return PVRSRV_ERROR_FAILED_TO_MAP_PAGE_TABLE; } } -#endif +#endif #if defined(FIX_HW_BRN_31620) - + if(!psDevInfo->pvMMUContextList) { IMG_UINT32 j; - + if(RA_Alloc(psDeviceNode->psLocalDevMemArena, SGX_MMU_PAGE_SIZE, IMG_NULL, @@ -1689,7 +1680,7 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I return PVRSRV_ERROR_FAILED_TO_ALLOC_VIRT_MEMORY; } - + sCpuPAddr = SysSysPAddrToCpuPAddr(sSysPAddr); psDevInfo->sBRN31620DummyPageDevPAddr = SysSysPAddrToDevPAddr(PVRSRV_DEVICE_TYPE_SGX, sSysPAddr); psDevInfo->pvBRN31620DummyPageCpuVAddr = OSMapPhysToLin(sCpuPAddr, @@ -1711,7 +1702,7 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I MakeKernelPageReadOnly(psDevInfo->pvBRN31620DummyPageCpuVAddr); PDUMPMALLOCPAGETABLE(&psDeviceNode->sDevId, psDevInfo->hBRN31620DummyPageOSMemHandle, 0, psDevInfo->pvBRN31620DummyPageCpuVAddr, SGX_MMU_PAGE_SIZE, 0, PDUMP_PT_UNIQUETAG); - + if(RA_Alloc(psDeviceNode->psLocalDevMemArena, SGX_MMU_PAGE_SIZE, IMG_NULL, @@ -1727,7 +1718,7 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I return PVRSRV_ERROR_FAILED_TO_ALLOC_VIRT_MEMORY; } - + sCpuPAddr = SysSysPAddrToCpuPAddr(sSysPAddr); psDevInfo->sBRN31620DummyPTDevPAddr = SysSysPAddrToDevPAddr(PVRSRV_DEVICE_TYPE_SGX, sSysPAddr); psDevInfo->pvBRN31620DummyPTCpuVAddr = OSMapPhysToLin(sCpuPAddr, @@ -1741,16 +1732,16 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I return PVRSRV_ERROR_FAILED_TO_MAP_PAGE_TABLE; } - OSMemSet(psDevInfo->pvBRN31620DummyPTCpuVAddr,0,SGX_MMU_PAGE_SIZE); + OSMemSet(psDevInfo->pvBRN31620DummyPTCpuVAddr,0,SGX_MMU_PAGE_SIZE); PDUMPMALLOCPAGETABLE(&psDeviceNode->sDevId, psDevInfo->hBRN31620DummyPTOSMemHandle, 0, psDevInfo->pvBRN31620DummyPTCpuVAddr, SGX_MMU_PAGE_SIZE, 0, PDUMP_PT_UNIQUETAG); } -#endif +#endif } #if defined(FIX_HW_BRN_31620) if (!psDevInfo->pvMMUContextList) { - + psDevInfo->hKernelMMUContext = psMMUContext; PVR_DPF((PVR_DBG_ERROR, "MMU_Initialise: saving kernel mmu context: %p", psMMUContext)); } @@ -1758,12 +1749,12 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I #if defined(PDUMP) #if defined(SUPPORT_PDUMP_MULTI_PROCESS) - + { PVRSRV_PER_PROCESS_DATA* psPerProc = PVRSRVFindPerProcessData(); if(psPerProc == IMG_NULL) { - + psMMUContext->bPDumpActive = IMG_TRUE; } else @@ -1771,8 +1762,8 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I psMMUContext->bPDumpActive = psPerProc->bPDumpActive; } } -#endif - +#endif + #if IMG_ADDRSPACE_PHYSADDR_BITS == 32 PDUMPCOMMENT("Alloc page directory for new MMU context (PDDevPAddr == 0x%08x)", sPDDevPAddr.uiAddr); @@ -1781,7 +1772,7 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I sPDDevPAddr.uiHighAddr, sPDDevPAddr.uiAddr); #endif PDUMPMALLOCPAGETABLE(&psDeviceNode->sDevId, hPDOSMemHandle, 0, pvPDCpuVAddr, SGX_MMU_PAGE_SIZE, 0, PDUMP_PD_UNIQUETAG); -#endif +#endif #ifdef SUPPORT_SGX_MMU_BYPASS EnableHostAccess(psMMUContext); @@ -1800,7 +1791,7 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I #if defined(SUPPORT_SGX_MMU_DUMMY_PAGE) MakeKernelPageReadWrite(pvPDCpuVAddr); - + for(i=0; isDummyPTDevPAddr.uiAddr>>SGX_MMU_PDE_ADDR_ALIGNSHIFT) @@ -1811,7 +1802,7 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I if(!psDevInfo->pvMMUContextList) { - + MakeKernelPageReadWrite(psDevInfo->pvDummyPTPageCpuVAddr); @@ -1822,11 +1813,11 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I | SGX_MMU_PTE_VALID; } MakeKernelPageReadOnly(psDevInfo->pvDummyPTPageCpuVAddr); - + PDUMPCOMMENT("Dummy Page table contents"); PDUMPMEMPTENTRIES(&sMMUAttrib, psDevInfo->hDummyPTOSMemHandle, psDevInfo->pvDummyPTPageCpuVAddr, SGX_MMU_PAGE_SIZE, 0, IMG_TRUE, PDUMP_PD_UNIQUETAG, PDUMP_PT_UNIQUETAG); - + MakeKernelPageReadWrite(psDevInfo->pvDummyDataPageCpuVAddr); pui32Tmp = (IMG_UINT32 *)psDevInfo->pvDummyDataPageCpuVAddr; @@ -1835,27 +1826,27 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I pui32Tmp[i] = DUMMY_DATA_PAGE_SIGNATURE; } MakeKernelPageReadOnly(psDevInfo->pvDummyDataPageCpuVAddr); - + PDUMPCOMMENT("Dummy Data Page contents"); PDUMPMEMPTENTRIES(PVRSRV_DEVICE_TYPE_SGX, psDevInfo->hDummyDataPageOSMemHandle, psDevInfo->pvDummyDataPageCpuVAddr, SGX_MMU_PAGE_SIZE, 0, IMG_TRUE, PDUMP_PD_UNIQUETAG, PDUMP_PT_UNIQUETAG); } -#else - +#else + MakeKernelPageReadWrite(pvPDCpuVAddr); for(i=0; ibPDumpActive) -#endif +#endif { - + PDUMPCOMMENT("Page directory contents"); PDUMPPDENTRIES(&sMMUAttrib, hPDOSMemHandle, pvPDCpuVAddr, SGX_MMU_PAGE_SIZE, 0, IMG_TRUE, PDUMP_PD_UNIQUETAG, PDUMP_PT_UNIQUETAG); } @@ -1878,20 +1869,20 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I MakeKernelPageReadOnly(psDevInfo->pvBRN31620DummyPTCpuVAddr); #if defined(PDUMP) - + PDUMPCOMMENT("BRN31620 Dump dummy PT contents"); PDUMPMEMPTENTRIES(&sMMUAttrib, psDevInfo->hBRN31620DummyPTOSMemHandle, psDevInfo->pvBRN31620DummyPTCpuVAddr, SGX_MMU_PAGE_SIZE, 0, IMG_TRUE, PDUMP_PD_UNIQUETAG, PDUMP_PT_UNIQUETAG); PDUMPCOMMENT("BRN31620 Dump dummy page contents"); PDUMPMEMPTENTRIES(&sMMUAttrib, psDevInfo->hBRN31620DummyPageOSMemHandle, psDevInfo->pvBRN31620DummyPageCpuVAddr, SGX_MMU_PAGE_SIZE, 0, IMG_TRUE, PDUMP_PD_UNIQUETAG, PDUMP_PT_UNIQUETAG); - + for(i=0;ihBRN31620DummyPTOSMemHandle, &pui32PT[i], sizeof(IMG_UINT32), 0, IMG_FALSE, PDUMP_PD_UNIQUETAG, PDUMP_PT_UNIQUETAG); } #endif PDUMPCOMMENT("BRN31620 Dump PDE wire up"); - + for(i=0;ihBRN31620DummyPageOSMemHandle, psDevInfo->pvBRN31620DummyPageCpuVAddr, SGX_MMU_PAGE_SIZE, 0, IMG_TRUE, PDUMP_PD_UNIQUETAG, PDUMP_PT_UNIQUETAG); } #endif #if defined(PDUMP) - + { PVRSRV_ERROR eError; - + IMG_UINT32 ui32MMUType = 1; #if defined(SGX_FEATURE_36BIT_MMU) @@ -1949,7 +1940,7 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I } } - + PDUMPCOMMENT("Set MMU context complete (MMU Context ID == %u)", psMMUContext->ui32PDumpMMUContextID); #endif @@ -1969,18 +1960,18 @@ MMU_Initialise (PVRSRV_DEVICE_NODE *psDeviceNode, MMU_CONTEXT **ppsMMUContext, I psMMUContext->apsPTInfoListSave[i] = IMG_NULL; } #endif - + psMMUContext->pvPDCpuVAddr = pvPDCpuVAddr; psMMUContext->sPDDevPAddr = sPDDevPAddr; psMMUContext->hPDOSMemHandle = hPDOSMemHandle; - + *ppsMMUContext = psMMUContext; - + *psPDDevPAddr = sPDDevPAddr; - + psMMUContext->psNext = (MMU_CONTEXT*)psDevInfo->pvMMUContextList; psDevInfo->pvMMUContextList = (IMG_VOID*)psMMUContext; @@ -2005,11 +1996,11 @@ MMU_Finalise (MMU_CONTEXT *psMMUContext) SysAcquireData(&psSysData); #if defined(PDUMP) - + PDUMPCOMMENT("Clear MMU context (MMU Context ID == %u)", psMMUContext->ui32PDumpMMUContextID); PDUMPCLEARMMUCONTEXT(PVRSRV_DEVICE_TYPE_SGX, psMMUContext->psDeviceNode->sDevId.pszPDumpDevName, psMMUContext->ui32PDumpMMUContextID, 2); - + #if IMG_ADDRSPACE_PHYSADDR_BITS == 32 PDUMPCOMMENT("Free page directory (PDDevPAddr == 0x%08x)", psMMUContext->sPDDevPAddr.uiAddr); @@ -2017,7 +2008,7 @@ MMU_Finalise (MMU_CONTEXT *psMMUContext) PDUMPCOMMENT("Free page directory, 64-bit arch detected (PDDevPAddr == 0x%08x%08x)", psMMUContext->sPDDevPAddr.uiHighAddr, psMMUContext->sPDDevPAddr.uiAddr); #endif -#endif +#endif PDUMPFREEPAGETABLE(&psMMUContext->psDeviceNode->sDevId, psMMUContext->hPDOSMemHandle, psMMUContext->pvPDCpuVAddr, SGX_MMU_PAGE_SIZE, 0, PDUMP_PT_UNIQUETAG); #if defined(SUPPORT_SGX_MMU_DUMMY_PAGE) @@ -2028,15 +2019,15 @@ MMU_Finalise (MMU_CONTEXT *psMMUContext) pui32Tmp = (IMG_UINT32 *)psMMUContext->pvPDCpuVAddr; MakeKernelPageReadWrite(psMMUContext->pvPDCpuVAddr); - + for(i=0; ipvPDCpuVAddr); - + @@ -2045,13 +2036,14 @@ MMU_Finalise (MMU_CONTEXT *psMMUContext) #if defined(FIX_HW_BRN_31620) PVRSRV_SGXDEV_INFO *psDevInfo = (PVRSRV_SGXDEV_INFO*)psMMUContext->psDevInfo; #endif + MakeKernelPageReadWrite(psMMUContext->pvPDCpuVAddr); OSFreePages(PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_KERNEL_ONLY, SGX_MMU_PAGE_SIZE, psMMUContext->pvPDCpuVAddr, psMMUContext->hPDOSMemHandle); #if defined(FIX_HW_BRN_31620) - + if (!psMMUContextList->psNext) { PDUMPFREEPAGETABLE(&psMMUContext->psDeviceNode->sDevId, psDevInfo->hBRN31620DummyPageOSMemHandle, psDevInfo->pvBRN31620DummyPageCpuVAddr, SGX_MMU_PAGE_SIZE, 0, PDUMP_PT_UNIQUETAG); @@ -2065,11 +2057,11 @@ MMU_Finalise (MMU_CONTEXT *psMMUContext) SGX_MMU_PAGE_SIZE, psDevInfo->pvBRN31620DummyPTCpuVAddr, psDevInfo->hBRN31620DummyPTOSMemHandle); - + } #endif #if defined(SUPPORT_SGX_MMU_DUMMY_PAGE) - + if(!psMMUContextList->psNext) { OSFreePages(PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_KERNEL_ONLY, @@ -2088,82 +2080,82 @@ MMU_Finalise (MMU_CONTEXT *psMMUContext) IMG_SYS_PHYADDR sSysPAddr; IMG_CPU_PHYADDR sCpuPAddr; - + sCpuPAddr = OSMapLinToCPUPhys(psMMUContext->hPDOSMemHandle, psMMUContext->pvPDCpuVAddr); sSysPAddr = SysCpuPAddrToSysPAddr(sCpuPAddr); - + OSUnMapPhysToLin(psMMUContext->pvPDCpuVAddr, SGX_MMU_PAGE_SIZE, PVRSRV_HAP_WRITECOMBINE|PVRSRV_HAP_KERNEL_ONLY, psMMUContext->hPDOSMemHandle); - + RA_Free (psMMUContext->psDeviceNode->psLocalDevMemArena, sSysPAddr.uiAddr, IMG_FALSE); #if defined(SUPPORT_SGX_MMU_DUMMY_PAGE) - + if(!psMMUContextList->psNext) { - + sCpuPAddr = OSMapLinToCPUPhys(psDevInfo->hDummyPTPageOSMemHandle, psDevInfo->pvDummyPTPageCpuVAddr); sSysPAddr = SysCpuPAddrToSysPAddr(sCpuPAddr); - + OSUnMapPhysToLin(psDevInfo->pvDummyPTPageCpuVAddr, SGX_MMU_PAGE_SIZE, PVRSRV_HAP_WRITECOMBINE|PVRSRV_HAP_KERNEL_ONLY, psDevInfo->hDummyPTPageOSMemHandle); - + RA_Free (psMMUContext->psDeviceNode->psLocalDevMemArena, sSysPAddr.uiAddr, IMG_FALSE); - + sCpuPAddr = OSMapLinToCPUPhys(psDevInfo->hDummyDataPageOSMemHandle, psDevInfo->pvDummyDataPageCpuVAddr); sSysPAddr = SysCpuPAddrToSysPAddr(sCpuPAddr); - + OSUnMapPhysToLin(psDevInfo->pvDummyDataPageCpuVAddr, SGX_MMU_PAGE_SIZE, PVRSRV_HAP_WRITECOMBINE|PVRSRV_HAP_KERNEL_ONLY, psDevInfo->hDummyDataPageOSMemHandle); - + RA_Free (psMMUContext->psDeviceNode->psLocalDevMemArena, sSysPAddr.uiAddr, IMG_FALSE); } #endif #if defined(FIX_HW_BRN_31620) - + if(!psMMUContextList->psNext) { - + PDUMPFREEPAGETABLE(&psMMUContext->psDeviceNode->sDevId, psDevInfo->hBRN31620DummyPageOSMemHandle, psDevInfo->pvBRN31620DummyPageCpuVAddr, SGX_MMU_PAGE_SIZE, 0, PDUMP_PT_UNIQUETAG); sCpuPAddr = OSMapLinToCPUPhys(psDevInfo->hBRN31620DummyPageOSMemHandle, psDevInfo->pvBRN31620DummyPageCpuVAddr); sSysPAddr = SysCpuPAddrToSysPAddr(sCpuPAddr); - + OSUnMapPhysToLin(psDevInfo->pvBRN31620DummyPageCpuVAddr, SGX_MMU_PAGE_SIZE, PVRSRV_HAP_WRITECOMBINE|PVRSRV_HAP_KERNEL_ONLY, psDevInfo->hBRN31620DummyPageOSMemHandle); - + RA_Free (psMMUContext->psDeviceNode->psLocalDevMemArena, sSysPAddr.uiAddr, IMG_FALSE); - + PDUMPFREEPAGETABLE(&psMMUContext->psDeviceNode->sDevId, psDevInfo->hBRN31620DummyPTOSMemHandle, psDevInfo->pvBRN31620DummyPTCpuVAddr, SGX_MMU_PAGE_SIZE, 0, PDUMP_PT_UNIQUETAG); sCpuPAddr = OSMapLinToCPUPhys(psDevInfo->hBRN31620DummyPTOSMemHandle, psDevInfo->pvBRN31620DummyPTCpuVAddr); sSysPAddr = SysCpuPAddrToSysPAddr(sCpuPAddr); - + OSUnMapPhysToLin(psDevInfo->pvBRN31620DummyPTCpuVAddr, SGX_MMU_PAGE_SIZE, PVRSRV_HAP_WRITECOMBINE|PVRSRV_HAP_KERNEL_ONLY, psDevInfo->hBRN31620DummyPTOSMemHandle); - + RA_Free (psMMUContext->psDeviceNode->psLocalDevMemArena, sSysPAddr.uiAddr, IMG_FALSE); } #endif @@ -2171,24 +2163,24 @@ MMU_Finalise (MMU_CONTEXT *psMMUContext) PVR_DPF ((PVR_DBG_MESSAGE, "MMU_Finalise")); - + ppsMMUContext = (MMU_CONTEXT**)&psMMUContext->psDevInfo->pvMMUContextList; while(*ppsMMUContext) { if(*ppsMMUContext == psMMUContext) { - + *ppsMMUContext = psMMUContext->psNext; break; } - + ppsMMUContext = &((*ppsMMUContext)->psNext); } - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(MMU_CONTEXT), psMMUContext, IMG_NULL); - + } @@ -2202,11 +2194,11 @@ MMU_InsertHeap(MMU_CONTEXT *psMMUContext, MMU_HEAP *psMMUHeap) IMG_BOOL bInvalidateDirectoryCache = IMG_FALSE; #endif - + pui32PDCpuVAddr += psMMUHeap->psDevArena->BaseDevVAddr.uiAddr >> psMMUHeap->ui32PDShift; pui32KernelPDCpuVAddr += psMMUHeap->psDevArena->BaseDevVAddr.uiAddr >> psMMUHeap->ui32PDShift; - + #if defined(PDUMP) @@ -2215,7 +2207,7 @@ MMU_InsertHeap(MMU_CONTEXT *psMMUContext, MMU_HEAP *psMMUHeap) psMMUHeap->psMMUContext->ui32PDumpMMUContextID, psMMUHeap->ui32PageTableCount); PDUMPCOMMENT(" (Destination MMU Context ID == %u)", psMMUContext->ui32PDumpMMUContextID); -#endif +#endif #ifdef SUPPORT_SGX_MMU_BYPASS EnableHostAccess(psMMUContext); #endif @@ -2223,21 +2215,21 @@ MMU_InsertHeap(MMU_CONTEXT *psMMUContext, MMU_HEAP *psMMUHeap) for (ui32PDEntry = 0; ui32PDEntry < psMMUHeap->ui32PageTableCount; ui32PDEntry++) { #if (!defined(SUPPORT_SGX_MMU_DUMMY_PAGE)) && (!defined(FIX_HW_BRN_31620)) - + PVR_ASSERT(pui32PDCpuVAddr[ui32PDEntry] == 0); #endif MakeKernelPageReadWrite(psMMUContext->pvPDCpuVAddr); - + pui32PDCpuVAddr[ui32PDEntry] = pui32KernelPDCpuVAddr[ui32PDEntry]; MakeKernelPageReadOnly(psMMUContext->pvPDCpuVAddr); if (pui32PDCpuVAddr[ui32PDEntry]) { - + #if defined(PDUMP) - + #if defined(SUPPORT_PDUMP_MULTI_PROCESS) if(psMMUContext->bPDumpActive) - #endif + #endif { PDUMPPDENTRIES(&psMMUHeap->sMMUAttrib, psMMUContext->hPDOSMemHandle, (IMG_VOID *) &pui32PDCpuVAddr[ui32PDEntry], sizeof(IMG_UINT32), 0, IMG_FALSE, PDUMP_PD_UNIQUETAG, PDUMP_PT_UNIQUETAG); } @@ -2255,7 +2247,7 @@ MMU_InsertHeap(MMU_CONTEXT *psMMUContext, MMU_HEAP *psMMUHeap) #if !defined(SGX_FEATURE_MULTIPLE_MEM_CONTEXTS) if (bInvalidateDirectoryCache) { - + @@ -2281,39 +2273,39 @@ MMU_UnmapPagesAndFreePTs (MMU_HEAP *psMMUHeap, #if !defined (PDUMP) PVR_UNREFERENCED_PARAMETER(hUniqueTag); #endif - + sTmpDevVAddr = sDevVAddr; for(i=0; i> psMMUHeap->ui32PDShift; - + ppsPTInfoList = &psMMUHeap->psMMUContext->apsPTInfoList[ui32PDIndex]; { - + ui32PTIndex = (sTmpDevVAddr.uiAddr & psMMUHeap->ui32PTMask) >> psMMUHeap->ui32PTShift; - + if (!ppsPTInfoList[0]) { PVR_DPF((PVR_DBG_MESSAGE, "MMU_UnmapPagesAndFreePTs: Invalid PT for alloc at VAddr:0x%08X (VaddrIni:0x%08X AllocPage:%u) PDIdx:%u PTIdx:%u",sTmpDevVAddr.uiAddr, sDevVAddr.uiAddr,i, ui32PDIndex, ui32PTIndex )); - + sTmpDevVAddr.uiAddr += psMMUHeap->ui32DataPageSize; - + continue; } - + pui32Tmp = (IMG_UINT32*)ppsPTInfoList[0]->PTPageCpuVAddr; - + if (!pui32Tmp) { continue; @@ -2321,7 +2313,7 @@ MMU_UnmapPagesAndFreePTs (MMU_HEAP *psMMUHeap, CheckPT(ppsPTInfoList[0]); - + if (pui32Tmp[ui32PTIndex] & SGX_MMU_PTE_VALID) { ppsPTInfoList[0]->ui32ValidPTECount--; @@ -2331,15 +2323,15 @@ MMU_UnmapPagesAndFreePTs (MMU_HEAP *psMMUHeap, PVR_DPF((PVR_DBG_MESSAGE, "MMU_UnmapPagesAndFreePTs: Page is already invalid for alloc at VAddr:0x%08X (VAddrIni:0x%08X AllocPage:%u) PDIdx:%u PTIdx:%u",sTmpDevVAddr.uiAddr, sDevVAddr.uiAddr,i, ui32PDIndex, ui32PTIndex )); } - + PVR_ASSERT((IMG_INT32)ppsPTInfoList[0]->ui32ValidPTECount >= 0); MakeKernelPageReadWrite(ppsPTInfoList[0]->PTPageCpuVAddr); #if defined(SUPPORT_SGX_MMU_DUMMY_PAGE) - + pui32Tmp[ui32PTIndex] = (psMMUHeap->psMMUContext->psDevInfo->sDummyDataDevPAddr.uiAddr>>SGX_MMU_PTE_ADDR_ALIGNSHIFT) | SGX_MMU_PTE_VALID; #else - + #if defined(FIX_HW_BRN_31620) BRN31620InvalidatePageTableEntry(psMMUHeap->psMMUContext, ui32PDIndex, ui32PTIndex, &pui32Tmp[ui32PTIndex]); #else @@ -2350,7 +2342,7 @@ MMU_UnmapPagesAndFreePTs (MMU_HEAP *psMMUHeap, CheckPT(ppsPTInfoList[0]); } - + if (ppsPTInfoList[0] && (ppsPTInfoList[0]->ui32ValidPTECount == 0) ) @@ -2366,7 +2358,7 @@ MMU_UnmapPagesAndFreePTs (MMU_HEAP *psMMUHeap, #endif } - + sTmpDevVAddr.uiAddr += psMMUHeap->ui32DataPageSize; } @@ -2385,7 +2377,7 @@ MMU_UnmapPagesAndFreePTs (MMU_HEAP *psMMUHeap, psMMUHeap->ui32DataPageSize * ui32PageCount, IMG_TRUE, hUniqueTag); -#endif +#endif } @@ -2434,7 +2426,7 @@ MMU_Create (MMU_CONTEXT *psMMUContext, pMMUHeap->psMMUContext = psMMUContext; pMMUHeap->psDevArena = psDevArena; - + switch(pMMUHeap->psDevArena->ui32DataPageSize) @@ -2464,46 +2456,46 @@ MMU_Create (MMU_CONTEXT *psMMUContext, ui32ScaleSize = 10; pMMUHeap->ui32PDEPageSizeCtrl = SGX_MMU_PDE_PAGE_SIZE_4M; break; -#endif +#endif default: PVR_DPF((PVR_DBG_ERROR, "MMU_Create: invalid data page size")); goto ErrorFreeHeap; } - + pMMUHeap->ui32DataPageSize = psDevArena->ui32DataPageSize; pMMUHeap->ui32DataPageBitWidth = SGX_MMU_PAGE_SHIFT + ui32ScaleSize; pMMUHeap->ui32DataPageMask = pMMUHeap->ui32DataPageSize - 1; - + pMMUHeap->ui32PTShift = pMMUHeap->ui32DataPageBitWidth; pMMUHeap->ui32PTBitWidth = SGX_MMU_PT_SHIFT - ui32ScaleSize; pMMUHeap->ui32PTMask = SGX_MMU_PT_MASK & (SGX_MMU_PT_MASK<ui32PTSize = (IMG_UINT32)(1UL<ui32PTBitWidth) * sizeof(IMG_UINT32); - + if(pMMUHeap->ui32PTSize < 4 * sizeof(IMG_UINT32)) { pMMUHeap->ui32PTSize = 4 * sizeof(IMG_UINT32); } pMMUHeap->ui32PTNumEntriesAllocated = pMMUHeap->ui32PTSize >> 2; - + pMMUHeap->ui32PTNumEntriesUsable = (IMG_UINT32)(1UL << pMMUHeap->ui32PTBitWidth); - + pMMUHeap->ui32PDShift = pMMUHeap->ui32PTBitWidth + pMMUHeap->ui32PTShift; pMMUHeap->ui32PDBitWidth = SGX_FEATURE_ADDRESS_SPACE_SIZE - pMMUHeap->ui32PTBitWidth - pMMUHeap->ui32DataPageBitWidth; pMMUHeap->ui32PDMask = SGX_MMU_PD_MASK & (SGX_MMU_PD_MASK>>(32-SGX_FEATURE_ADDRESS_SPACE_SIZE)); - + #if !defined (SUPPORT_EXTERNAL_SYSTEM_CACHE) - + if(psDevArena->BaseDevVAddr.uiAddr > (pMMUHeap->ui32DataPageMask | pMMUHeap->ui32PTMask)) { - + PVR_ASSERT ((psDevArena->BaseDevVAddr.uiAddr @@ -2511,20 +2503,20 @@ MMU_Create (MMU_CONTEXT *psMMUContext, | pMMUHeap->ui32PTMask)) == 0); } #endif - + pMMUHeap->ui32PTETotalUsable = pMMUHeap->psDevArena->ui32Size >> pMMUHeap->ui32PTShift; - + pMMUHeap->ui32PDBaseIndex = (pMMUHeap->psDevArena->BaseDevVAddr.uiAddr & pMMUHeap->ui32PDMask) >> pMMUHeap->ui32PDShift; - + pMMUHeap->ui32PageTableCount = (pMMUHeap->ui32PTETotalUsable + pMMUHeap->ui32PTNumEntriesUsable - 1) >> pMMUHeap->ui32PTBitWidth; PVR_ASSERT(pMMUHeap->ui32PageTableCount > 0); - + pMMUHeap->psVMArena = RA_Create(psDevArena->pszName, psDevArena->BaseDevVAddr.uiAddr, psDevArena->ui32Size, @@ -2542,7 +2534,7 @@ MMU_Create (MMU_CONTEXT *psMMUContext, } #if defined(PDUMP) - + MMU_SetPDumpAttribs(&pMMUHeap->sMMUAttrib, psMMUContext->psDeviceNode, pMMUHeap->ui32DataPageMask, @@ -2554,16 +2546,16 @@ MMU_Create (MMU_CONTEXT *psMMUContext, psDevArena->ui32Size, pMMUHeap->ui32DataPageSize, psDevArena->BaseDevVAddr.uiAddr); -#endif - -#if 0 +#endif +#if 0 + if(psDevArena->ui32HeapID == SGX_TILED_HEAP_ID) { IMG_UINT32 ui32RegVal; IMG_UINT32 ui32XTileStride; - + @@ -2582,19 +2574,19 @@ MMU_Create (MMU_CONTEXT *psMMUContext, } #endif - + *ppsVMArena = pMMUHeap->psVMArena; return pMMUHeap; - + ErrorFreePagetables: _DeferredFreePageTables (pMMUHeap); ErrorFreeHeap: OSFreeMem (PVRSRV_OS_PAGEABLE_HEAP, sizeof(MMU_HEAP), pMMUHeap, IMG_NULL); - + return IMG_NULL; } @@ -2616,7 +2608,7 @@ MMU_Delete (MMU_HEAP *pMMUHeap) pMMUHeap->psDevArena->pszName, pMMUHeap->psDevArena->BaseDevVAddr.uiAddr, pMMUHeap->ui32PageTableCount); -#endif +#endif #ifdef SUPPORT_SGX_MMU_BYPASS EnableHostAccess(pMMUHeap->psMMUContext); @@ -2627,7 +2619,7 @@ MMU_Delete (MMU_HEAP *pMMUHeap) #endif OSFreeMem (PVRSRV_OS_PAGEABLE_HEAP, sizeof(MMU_HEAP), pMMUHeap, IMG_NULL); - + } } @@ -2645,7 +2637,7 @@ MMU_Alloc (MMU_HEAP *pMMUHeap, "MMU_Alloc: uSize=0x%x, flags=0x%x, align=0x%x", uSize, uFlags, uDevVAddrAlignment)); - + if((uFlags & PVRSRV_MEM_USER_SUPPLIED_DEVVADDR) == 0) { @@ -2677,7 +2669,7 @@ MMU_Alloc (MMU_HEAP *pMMUHeap, EnableHostAccess(pMMUHeap->psMMUContext); #endif - + bStatus = _DeferredAllocPagetables(pMMUHeap, *psDevVAddr, (IMG_UINT32)uSize); #ifdef SUPPORT_SGX_MMU_BYPASS @@ -2693,7 +2685,7 @@ MMU_Alloc (MMU_HEAP *pMMUHeap, pMMUHeap->psDevArena->ui32HeapID)); if((uFlags & PVRSRV_MEM_USER_SUPPLIED_DEVVADDR) == 0) { - + RA_Free (pMMUHeap->psVMArena, psDevVAddr->uiAddr, IMG_FALSE); } } @@ -2734,14 +2726,14 @@ IMG_VOID MMU_Enable (MMU_HEAP *pMMUHeap) { PVR_UNREFERENCED_PARAMETER(pMMUHeap); - + } IMG_VOID MMU_Disable (MMU_HEAP *pMMUHeap) { PVR_UNREFERENCED_PARAMETER(pMMUHeap); - + } #if defined(FIX_HW_BRN_31620) @@ -2753,7 +2745,7 @@ IMG_VOID MMU_GetCacheFlushRange(MMU_CONTEXT *pMMUContext, IMG_UINT32 *pui32Range { pui32RangeMask[i] = pMMUContext->ui32PDChangeMask[i]; - + pMMUContext->ui32PDChangeMask[i] = 0; } } @@ -2780,22 +2772,22 @@ MMU_PDumpPageTables (MMU_HEAP *pMMUHeap, IMG_UINT32 ui32PDIndex; IMG_UINT32 ui32PTDumpCount; - + ui32NumPTEntries = (IMG_UINT32)((uSize + pMMUHeap->ui32DataPageMask) >> pMMUHeap->ui32PTShift); - + ui32PDIndex = DevVAddr.uiAddr >> pMMUHeap->ui32PDShift; - + ppsPTInfoList = &pMMUHeap->psMMUContext->apsPTInfoList[ui32PDIndex]; - + ui32PTIndex = (DevVAddr.uiAddr & pMMUHeap->ui32PTMask) >> pMMUHeap->ui32PTShift; - + PDUMPCOMMENT("Page table mods (num entries == %08X) %s", ui32NumPTEntries, bForUnmap ? "(for unmap)" : ""); - + while(ui32NumPTEntries > 0) { MMU_PT_INFO* psPTInfo = *ppsPTInfoList++; @@ -2819,16 +2811,16 @@ MMU_PDumpPageTables (MMU_HEAP *pMMUHeap, PDUMPMEMPTENTRIES(&pMMUHeap->sMMUAttrib, psPTInfo->hPTPageOSMemHandle, (IMG_VOID *) &pui32PTEntry[ui32PTIndex], ui32PTDumpCount * sizeof(IMG_UINT32), ui32Flags, IMG_FALSE, PDUMP_PT_UNIQUETAG, hUniqueTag); } - + ui32NumPTEntries -= ui32PTDumpCount; - + ui32PTIndex = 0; } PDUMPCOMMENT("Finished page table mods %s", bForUnmap ? "(for unmap)" : ""); } -#endif +#endif static IMG_VOID @@ -2842,63 +2834,63 @@ MMU_MapPage (MMU_HEAP *pMMUHeap, IMG_UINT32 ui32MMUFlags = 0; MMU_PT_INFO **ppsPTInfoList; - + PVR_ASSERT((DevPAddr.uiAddr & pMMUHeap->ui32DataPageMask) == 0); - + if(((PVRSRV_MEM_READ|PVRSRV_MEM_WRITE) & ui32MemFlags) == (PVRSRV_MEM_READ|PVRSRV_MEM_WRITE)) { - + ui32MMUFlags = 0; } else if(PVRSRV_MEM_READ & ui32MemFlags) { - + ui32MMUFlags |= SGX_MMU_PTE_READONLY; } else if(PVRSRV_MEM_WRITE & ui32MemFlags) { - + ui32MMUFlags |= SGX_MMU_PTE_WRITEONLY; } - + if(PVRSRV_MEM_CACHE_CONSISTENT & ui32MemFlags) { ui32MMUFlags |= SGX_MMU_PTE_CACHECONSISTENT; } #if !defined(FIX_HW_BRN_25503) - + if(PVRSRV_MEM_EDM_PROTECT & ui32MemFlags) { ui32MMUFlags |= SGX_MMU_PTE_EDMPROTECT; } #endif + - - + ui32Index = DevVAddr.uiAddr >> pMMUHeap->ui32PDShift; - + ppsPTInfoList = &pMMUHeap->psMMUContext->apsPTInfoList[ui32Index]; CheckPT(ppsPTInfoList[0]); - + ui32Index = (DevVAddr.uiAddr & pMMUHeap->ui32PTMask) >> pMMUHeap->ui32PTShift; - + pui32Tmp = (IMG_UINT32*)ppsPTInfoList[0]->PTPageCpuVAddr; #if !defined(SUPPORT_SGX_MMU_DUMMY_PAGE) { IMG_UINT32 uTmp = pui32Tmp[ui32Index]; - - + + #if defined(FIX_HW_BRN_31620) if ((uTmp & SGX_MMU_PTE_VALID) && ((DevVAddr.uiAddr & BRN31620_PDE_CACHE_FILL_MASK) != BRN31620_DUMMY_PAGE_OFFSET)) #else @@ -2922,11 +2914,11 @@ MMU_MapPage (MMU_HEAP *pMMUHeap, } #endif - + ppsPTInfoList[0]->ui32ValidPTECount++; MakeKernelPageReadWrite(ppsPTInfoList[0]->PTPageCpuVAddr); - + pui32Tmp[ui32Index] = ((DevPAddr.uiAddr>>SGX_MMU_PTE_ADDR_ALIGNSHIFT) & ((~pMMUHeap->ui32DataPageMask)>>SGX_MMU_PTE_ADDR_ALIGNSHIFT)) | SGX_MMU_PTE_VALID @@ -2946,7 +2938,7 @@ MMU_MapScatter (MMU_HEAP *pMMUHeap, { #if defined(PDUMP) IMG_DEV_VIRTADDR MapBaseDevVAddr; -#endif +#endif IMG_UINT32 uCount, i; IMG_DEV_PHYADDR DevPAddr; @@ -2956,7 +2948,7 @@ MMU_MapScatter (MMU_HEAP *pMMUHeap, MapBaseDevVAddr = DevVAddr; #else PVR_UNREFERENCED_PARAMETER(hUniqueTag); -#endif +#endif for (i=0, uCount=0; uCountui32DataPageSize) { @@ -2965,7 +2957,7 @@ MMU_MapScatter (MMU_HEAP *pMMUHeap, sSysAddr = psSysAddr[i]; - + PVR_ASSERT((sSysAddr.uiAddr & pMMUHeap->ui32DataPageMask) == 0); DevPAddr = SysSysPAddrToDevPAddr(PVRSRV_DEVICE_TYPE_SGX, sSysAddr); @@ -2980,7 +2972,7 @@ MMU_MapScatter (MMU_HEAP *pMMUHeap, #if defined(PDUMP) MMU_PDumpPageTables (pMMUHeap, MapBaseDevVAddr, uSize, IMG_FALSE, hUniqueTag); -#endif +#endif } IMG_VOID @@ -2994,7 +2986,7 @@ MMU_MapPages (MMU_HEAP *pMMUHeap, IMG_DEV_PHYADDR DevPAddr; #if defined(PDUMP) IMG_DEV_VIRTADDR MapBaseDevVAddr; -#endif +#endif IMG_UINT32 uCount; IMG_UINT32 ui32VAdvance; IMG_UINT32 ui32PAdvance; @@ -3004,11 +2996,11 @@ MMU_MapPages (MMU_HEAP *pMMUHeap, PVR_DPF ((PVR_DBG_MESSAGE, "MMU_MapPages: heap:%s, heap_id:%d devVAddr=%08X, SysPAddr=%08X, size=0x%x", pMMUHeap->psDevArena->pszName, pMMUHeap->psDevArena->ui32HeapID, - DevVAddr.uiAddr, + DevVAddr.uiAddr, SysPAddr.uiAddr, uSize)); - + ui32VAdvance = pMMUHeap->ui32DataPageSize; ui32PAdvance = pMMUHeap->ui32DataPageSize; @@ -3016,11 +3008,11 @@ MMU_MapPages (MMU_HEAP *pMMUHeap, MapBaseDevVAddr = DevVAddr; #else PVR_UNREFERENCED_PARAMETER(hUniqueTag); -#endif +#endif DevPAddr = SysSysPAddrToDevPAddr(PVRSRV_DEVICE_TYPE_SGX, SysPAddr); - + PVR_ASSERT((DevPAddr.uiAddr & pMMUHeap->ui32DataPageMask) == 0); #if defined(FIX_HW_BRN_23281) @@ -3030,7 +3022,7 @@ MMU_MapPages (MMU_HEAP *pMMUHeap, } #endif - + if(ui32MemFlags & PVRSRV_MEM_DUMMY) @@ -3047,7 +3039,7 @@ MMU_MapPages (MMU_HEAP *pMMUHeap, #if defined(PDUMP) MMU_PDumpPageTables (pMMUHeap, MapBaseDevVAddr, uSize, IMG_FALSE, hUniqueTag); -#endif +#endif } IMG_VOID @@ -3076,11 +3068,11 @@ MMU_MapShadow (MMU_HEAP *pMMUHeap, uByteSize, (IMG_UINTPTR_T)CpuVAddr)); - + ui32VAdvance = pMMUHeap->ui32DataPageSize; ui32PAdvance = pMMUHeap->ui32DataPageSize; - + PVR_ASSERT(((IMG_UINTPTR_T)CpuVAddr & (SGX_MMU_PAGE_SIZE - 1)) == 0); PVR_ASSERT(((IMG_UINT32)uByteSize & pMMUHeap->ui32DataPageMask) == 0); pDevVAddr->uiAddr = MapBaseDevVAddr.uiAddr; @@ -3092,7 +3084,7 @@ MMU_MapShadow (MMU_HEAP *pMMUHeap, } #endif - + if(ui32MemFlags & PVRSRV_MEM_DUMMY) @@ -3100,7 +3092,7 @@ MMU_MapShadow (MMU_HEAP *pMMUHeap, ui32PAdvance = 0; } - + MapDevVAddr = MapBaseDevVAddr; for (i=0; iui32DataPageMask) == 0); PVR_DPF ((PVR_DBG_MESSAGE, @@ -3131,14 +3123,14 @@ MMU_MapShadow (MMU_HEAP *pMMUHeap, MMU_MapPage (pMMUHeap, MapDevVAddr, DevPAddr, ui32MemFlags); - + MapDevVAddr.uiAddr += ui32VAdvance; uOffset += ui32PAdvance; } #if defined(PDUMP) MMU_PDumpPageTables (pMMUHeap, MapBaseDevVAddr, uByteSize, IMG_FALSE, hUniqueTag); -#endif +#endif } @@ -3159,23 +3151,23 @@ MMU_UnmapPages (MMU_HEAP *psMMUHeap, PVR_UNREFERENCED_PARAMETER(hUniqueTag); #endif - + sTmpDevVAddr = sDevVAddr; for(i=0; i> psMMUHeap->ui32PDShift; - + ppsPTInfoList = &psMMUHeap->psMMUContext->apsPTInfoList[ui32PDIndex]; - + ui32PTIndex = (sTmpDevVAddr.uiAddr & psMMUHeap->ui32PTMask) >> psMMUHeap->ui32PTShift; - + if (!ppsPTInfoList[0]) { PVR_DPF((PVR_DBG_ERROR, "MMU_UnmapPages: ERROR Invalid PT for alloc at VAddr:0x%08X (VaddrIni:0x%08X AllocPage:%u) PDIdx:%u PTIdx:%u", @@ -3185,19 +3177,19 @@ MMU_UnmapPages (MMU_HEAP *psMMUHeap, ui32PDIndex, ui32PTIndex)); - + sTmpDevVAddr.uiAddr += uPageSize; - + continue; } CheckPT(ppsPTInfoList[0]); - + pui32Tmp = (IMG_UINT32*)ppsPTInfoList[0]->PTPageCpuVAddr; - + if (pui32Tmp[ui32PTIndex] & SGX_MMU_PTE_VALID) { ppsPTInfoList[0]->ui32ValidPTECount--; @@ -3213,16 +3205,16 @@ MMU_UnmapPages (MMU_HEAP *psMMUHeap, PVR_DPF((PVR_DBG_ERROR, "MMU_UnmapPages: Page table entry value: 0x%08X", pui32Tmp[ui32PTIndex])); } - + PVR_ASSERT((IMG_INT32)ppsPTInfoList[0]->ui32ValidPTECount >= 0); MakeKernelPageReadWrite(ppsPTInfoList[0]->PTPageCpuVAddr); #if defined(SUPPORT_SGX_MMU_DUMMY_PAGE) - + pui32Tmp[ui32PTIndex] = (psMMUHeap->psMMUContext->psDevInfo->sDummyDataDevPAddr.uiAddr>>SGX_MMU_PTE_ADDR_ALIGNSHIFT) | SGX_MMU_PTE_VALID; #else - + #if defined(FIX_HW_BRN_31620) BRN31620InvalidatePageTableEntry(psMMUHeap->psMMUContext, ui32PDIndex, ui32PTIndex, &pui32Tmp[ui32PTIndex]); #else @@ -3233,7 +3225,7 @@ MMU_UnmapPages (MMU_HEAP *psMMUHeap, CheckPT(ppsPTInfoList[0]); - + sTmpDevVAddr.uiAddr += uPageSize; } @@ -3241,7 +3233,7 @@ MMU_UnmapPages (MMU_HEAP *psMMUHeap, #if defined(PDUMP) MMU_PDumpPageTables (psMMUHeap, sDevVAddr, uPageSize*ui32PageCount, IMG_TRUE, hUniqueTag); -#endif +#endif } @@ -3253,10 +3245,10 @@ MMU_GetPhysPageAddr(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR sDevVPageAddr) IMG_DEV_PHYADDR sDevPAddr; MMU_PT_INFO **ppsPTInfoList; - + ui32Index = sDevVPageAddr.uiAddr >> pMMUHeap->ui32PDShift; - + ppsPTInfoList = &pMMUHeap->psMMUContext->apsPTInfoList[ui32Index]; if (!ppsPTInfoList[0]) { @@ -3265,19 +3257,19 @@ MMU_GetPhysPageAddr(MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR sDevVPageAddr) return sDevPAddr; } - + ui32Index = (sDevVPageAddr.uiAddr & pMMUHeap->ui32PTMask) >> pMMUHeap->ui32PTShift; - + pui32PageTable = (IMG_UINT32*)ppsPTInfoList[0]->PTPageCpuVAddr; - + sDevPAddr.uiAddr = pui32PageTable[ui32Index]; - + sDevPAddr.uiAddr &= ~(pMMUHeap->ui32DataPageMask>>SGX_MMU_PTE_ADDR_ALIGNSHIFT); - + sDevPAddr.uiAddr <<= SGX_MMU_PTE_ADDR_ALIGNSHIFT; return sDevPAddr; @@ -3299,12 +3291,12 @@ PVRSRV_ERROR SGXGetPhysPageAddrKM (IMG_HANDLE hDevMemHeap, MMU_HEAP *pMMUHeap; IMG_DEV_PHYADDR DevPAddr; - + pMMUHeap = (MMU_HEAP*)BM_GetMMUHeap(hDevMemHeap); DevPAddr = MMU_GetPhysPageAddr(pMMUHeap, sDevVAddr); - pCpuPAddr->uiAddr = DevPAddr.uiAddr; + pCpuPAddr->uiAddr = DevPAddr.uiAddr; pDevPAddr->uiAddr = DevPAddr.uiAddr; return (pDevPAddr->uiAddr != 0) ? PVRSRV_OK : PVRSRV_ERROR_INVALID_PARAMS; @@ -3320,7 +3312,7 @@ PVRSRV_ERROR SGXGetMMUPDAddrKM(IMG_HANDLE hDevCookie, return PVRSRV_ERROR_INVALID_PARAMS; } - + *psPDDevPAddr = ((BM_CONTEXT*)hDevMemContext)->psMMUContext->sPDDevPAddr; return PVRSRV_OK; @@ -3340,10 +3332,10 @@ PVRSRV_ERROR MMU_BIFResetPDAlloc(PVRSRV_SGXDEV_INFO *psDevInfo) psLocalDevMemArena = psSysData->apsLocalDevMemArena[0]; - + if(psLocalDevMemArena == IMG_NULL) { - + eError = OSAllocPages(PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_KERNEL_ONLY, 3 * SGX_MMU_PAGE_SIZE, SGX_MMU_PAGE_SIZE, @@ -3357,7 +3349,7 @@ PVRSRV_ERROR MMU_BIFResetPDAlloc(PVRSRV_SGXDEV_INFO *psDevInfo) return eError; } - + if(pui8MemBlock) { sMemBlockCpuPAddr = OSMapLinToCPUPhys(hOSMemHandle, @@ -3365,13 +3357,13 @@ PVRSRV_ERROR MMU_BIFResetPDAlloc(PVRSRV_SGXDEV_INFO *psDevInfo) } else { - + sMemBlockCpuPAddr = OSMemHandleToCpuPAddr(hOSMemHandle, 0); } } else { - + if(RA_Alloc(psLocalDevMemArena, 3 * SGX_MMU_PAGE_SIZE, @@ -3388,7 +3380,7 @@ PVRSRV_ERROR MMU_BIFResetPDAlloc(PVRSRV_SGXDEV_INFO *psDevInfo) return PVRSRV_ERROR_OUT_OF_MEMORY; } - + sMemBlockCpuPAddr = SysSysPAddrToCpuPAddr(sMemBlockSysPAddr); pui8MemBlock = OSMapPhysToLin(sMemBlockCpuPAddr, SGX_MMU_PAGE_SIZE * 3, @@ -3405,15 +3397,15 @@ PVRSRV_ERROR MMU_BIFResetPDAlloc(PVRSRV_SGXDEV_INFO *psDevInfo) psDevInfo->sBIFResetPDDevPAddr = SysCpuPAddrToDevPAddr(PVRSRV_DEVICE_TYPE_SGX, sMemBlockCpuPAddr); psDevInfo->sBIFResetPTDevPAddr.uiAddr = psDevInfo->sBIFResetPDDevPAddr.uiAddr + SGX_MMU_PAGE_SIZE; psDevInfo->sBIFResetPageDevPAddr.uiAddr = psDevInfo->sBIFResetPTDevPAddr.uiAddr + SGX_MMU_PAGE_SIZE; - - + + psDevInfo->pui32BIFResetPD = (IMG_UINT32 *)pui8MemBlock; psDevInfo->pui32BIFResetPT = (IMG_UINT32 *)(pui8MemBlock + SGX_MMU_PAGE_SIZE); - + OSMemSet(psDevInfo->pui32BIFResetPD, 0, SGX_MMU_PAGE_SIZE); OSMemSet(psDevInfo->pui32BIFResetPT, 0, SGX_MMU_PAGE_SIZE); - + OSMemSet(pui8MemBlock + (2 * SGX_MMU_PAGE_SIZE), 0xDB, SGX_MMU_PAGE_SIZE); return PVRSRV_OK; @@ -3429,7 +3421,7 @@ IMG_VOID MMU_BIFResetPDFree(PVRSRV_SGXDEV_INFO *psDevInfo) psLocalDevMemArena = psSysData->apsLocalDevMemArena[0]; - + if(psLocalDevMemArena == IMG_NULL) { OSFreePages(PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_KERNEL_ONLY, @@ -3449,6 +3441,48 @@ IMG_VOID MMU_BIFResetPDFree(PVRSRV_SGXDEV_INFO *psDevInfo) } } +IMG_VOID MMU_CheckFaultAddr(PVRSRV_SGXDEV_INFO *psDevInfo, IMG_UINT32 ui32PDDevPAddr, IMG_UINT32 ui32FaultAddr) +{ + MMU_CONTEXT *psMMUContext = psDevInfo->pvMMUContextList; + + while (psMMUContext && (psMMUContext->sPDDevPAddr.uiAddr != ui32PDDevPAddr)) + { + psMMUContext = psMMUContext->psNext; + } + + if (psMMUContext) + { + IMG_UINT32 ui32PTIndex; + IMG_UINT32 ui32PDIndex; + + PVR_LOG(("Found MMU context for page fault 0x%08x", ui32FaultAddr)); + + ui32PTIndex = (ui32FaultAddr & SGX_MMU_PT_MASK) >> SGX_MMU_PAGE_SHIFT; + ui32PDIndex = (ui32FaultAddr & SGX_MMU_PD_MASK) >> (SGX_MMU_PT_SHIFT + SGX_MMU_PAGE_SHIFT); + + if (psMMUContext->apsPTInfoList[ui32PDIndex]) + { + if (psMMUContext->apsPTInfoList[ui32PDIndex]->PTPageCpuVAddr) + { + IMG_UINT32 *pui32Ptr = psMMUContext->apsPTInfoList[ui32PDIndex]->PTPageCpuVAddr; + IMG_UINT32 ui32PTE = pui32Ptr[ui32PTIndex]; + + PVR_LOG(("PDE valid: PTE = 0x%08x (PhysAddr = 0x%08x, %s)", + ui32PTE, + ui32PTE & SGX_MMU_PTE_ADDR_MASK, + ui32PTE & SGX_MMU_PTE_VALID?"valid":"Invalid")); + } + else + { + PVR_LOG(("Found PT info but no CPU address")); + } + } + else + { + PVR_LOG(("No PDE found")); + } + } +} #if defined(FIX_HW_BRN_22997) && defined(FIX_HW_BRN_23030) && defined(SGX_FEATURE_HOST_PORT) PVRSRV_ERROR WorkaroundBRN22997Alloc(PVRSRV_DEVICE_NODE *psDeviceNode) @@ -3473,10 +3507,10 @@ PVRSRV_ERROR WorkaroundBRN22997Alloc(PVRSRV_DEVICE_NODE *psDeviceNode) psLocalDevMemArena = psSysData->apsLocalDevMemArena[0]; - + if(psLocalDevMemArena == IMG_NULL) { - + eError = OSAllocPages(PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_KERNEL_ONLY, SGX_MMU_PAGE_SIZE, SGX_MMU_PAGE_SIZE, @@ -3505,7 +3539,7 @@ PVRSRV_ERROR WorkaroundBRN22997Alloc(PVRSRV_DEVICE_NODE *psDeviceNode) } ui32PDOffset = 0; - + if(pui32PT) { sCpuPAddr = OSMapLinToCPUPhys(hPTPageOSMemHandle, @@ -3513,7 +3547,7 @@ PVRSRV_ERROR WorkaroundBRN22997Alloc(PVRSRV_DEVICE_NODE *psDeviceNode) } else { - + sCpuPAddr = OSMemHandleToCpuPAddr(hPTPageOSMemHandle, 0); } sPTDevPAddr = SysCpuPAddrToDevPAddr(PVRSRV_DEVICE_TYPE_SGX, sCpuPAddr); @@ -3525,7 +3559,7 @@ PVRSRV_ERROR WorkaroundBRN22997Alloc(PVRSRV_DEVICE_NODE *psDeviceNode) } else { - + sCpuPAddr = OSMemHandleToCpuPAddr(hPDPageOSMemHandle, 0); } sPDDevPAddr = SysCpuPAddrToDevPAddr(PVRSRV_DEVICE_TYPE_SGX, sCpuPAddr); @@ -3533,7 +3567,7 @@ PVRSRV_ERROR WorkaroundBRN22997Alloc(PVRSRV_DEVICE_NODE *psDeviceNode) } else { - + if(RA_Alloc(psLocalDevMemArena, SGX_MMU_PAGE_SIZE * 2, @@ -3550,7 +3584,7 @@ PVRSRV_ERROR WorkaroundBRN22997Alloc(PVRSRV_DEVICE_NODE *psDeviceNode) return PVRSRV_ERROR_OUT_OF_MEMORY; } - + sCpuPAddr = SysSysPAddrToCpuPAddr(psDevInfo->sBRN22997SysPAddr); pui32PT = OSMapPhysToLin(sCpuPAddr, SGX_MMU_PAGE_SIZE * 2, @@ -3563,9 +3597,9 @@ PVRSRV_ERROR WorkaroundBRN22997Alloc(PVRSRV_DEVICE_NODE *psDeviceNode) } ui32PTOffset = 0; - + sPTDevPAddr = SysCpuPAddrToDevPAddr(PVRSRV_DEVICE_TYPE_SGX, sCpuPAddr); - + pui32PD = pui32PT + SGX_MMU_PAGE_SIZE/sizeof(IMG_UINT32); ui32PDOffset = SGX_MMU_PAGE_SIZE; hPDPageOSMemHandle = hPTPageOSMemHandle; @@ -3575,7 +3609,7 @@ PVRSRV_ERROR WorkaroundBRN22997Alloc(PVRSRV_DEVICE_NODE *psDeviceNode) OSMemSet(pui32PD, 0, SGX_MMU_PAGE_SIZE); OSMemSet(pui32PT, 0, SGX_MMU_PAGE_SIZE); - + PDUMPMALLOCPAGETABLE(&psDeviceNode->sDevId, hPDPageOSMemHandle, ui32PDOffset, pui32PD, SGX_MMU_PAGE_SIZE, 0, PDUMP_PD_UNIQUETAG); PDUMPMALLOCPAGETABLE(&psDeviceNode->sDevId, hPTPageOSMemHandle, ui32PTOffset, pui32PT, SGX_MMU_PAGE_SIZE, 0, PDUMP_PT_UNIQUETAG); PDUMPMEMPTENTRIES(&psDevInfo->sMMUAttrib, hPDPageOSMemHandle, pui32PD, SGX_MMU_PAGE_SIZE, 0, IMG_TRUE, PDUMP_PD_UNIQUETAG, PDUMP_PT_UNIQUETAG); @@ -3602,43 +3636,43 @@ IMG_VOID WorkaroundBRN22997ReadHostPort(PVRSRV_SGXDEV_INFO *psDevInfo) volatile IMG_UINT32 *pui32HostPort; IMG_UINT32 ui32BIFCtrl; - - - + + + pui32HostPort = (volatile IMG_UINT32*)(((IMG_UINT8*)psDevInfo->pvHostPortBaseKM) + SYS_SGX_HOSTPORT_BRN23030_OFFSET); - + sDevVAddr.uiAddr = SYS_SGX_HOSTPORT_BASE_DEVVADDR + SYS_SGX_HOSTPORT_BRN23030_OFFSET; ui32PDIndex = (sDevVAddr.uiAddr & SGX_MMU_PD_MASK) >> (SGX_MMU_PAGE_SHIFT + SGX_MMU_PT_SHIFT); ui32PTIndex = (sDevVAddr.uiAddr & SGX_MMU_PT_MASK) >> SGX_MMU_PAGE_SHIFT; - + pui32PD[ui32PDIndex] = (psDevInfo->sBRN22997PTDevPAddr.uiAddr>>SGX_MMU_PDE_ADDR_ALIGNSHIFT) | SGX_MMU_PDE_VALID; - + pui32PT[ui32PTIndex] = (psDevInfo->sBRN22997PTDevPAddr.uiAddr>>SGX_MMU_PTE_ADDR_ALIGNSHIFT) | SGX_MMU_PTE_VALID; PDUMPMEMPTENTRIES(&psDevInfo->sMMUAttrib, psDevInfo->hBRN22997PDPageOSMemHandle, pui32PD, SGX_MMU_PAGE_SIZE, 0, IMG_TRUE, PDUMP_PD_UNIQUETAG, PDUMP_PT_UNIQUETAG); PDUMPMEMPTENTRIES(&psDevInfo->sMMUAttrib, psDevInfo->hBRN22997PTPageOSMemHandle, pui32PT, SGX_MMU_PAGE_SIZE, 0, IMG_TRUE, PDUMP_PT_UNIQUETAG, PDUMP_PD_UNIQUETAG); - + OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_DIR_LIST_BASE0, psDevInfo->sBRN22997PDDevPAddr.uiAddr); PDUMPPDREG(&psDevInfo->sMMUAttrib, EUR_CR_BIF_DIR_LIST_BASE0, psDevInfo->sBRN22997PDDevPAddr.uiAddr, PDUMP_PD_UNIQUETAG); - + ui32BIFCtrl = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_CTRL); OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_CTRL, ui32BIFCtrl | EUR_CR_BIF_CTRL_INVALDC_MASK); PDUMPREG(SGX_PDUMPREG_NAME, EUR_CR_BIF_CTRL, ui32BIFCtrl | EUR_CR_BIF_CTRL_INVALDC_MASK); OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_CTRL, ui32BIFCtrl); PDUMPREG(SGX_PDUMPREG_NAME, EUR_CR_BIF_CTRL, ui32BIFCtrl); - + if (pui32HostPort) { - + IMG_UINT32 ui32Tmp; ui32Tmp = *pui32HostPort; } @@ -3647,21 +3681,21 @@ IMG_VOID WorkaroundBRN22997ReadHostPort(PVRSRV_SGXDEV_INFO *psDevInfo) PVR_DPF((PVR_DBG_ERROR,"Host Port not present for BRN22997 workaround")); } + - - + PDUMPCOMMENT("RDW :SGXMEM:v4:%08X\r\n", sDevVAddr.uiAddr); - + PDUMPCOMMENT("SAB :SGXMEM:v4:%08X 4 0 hostport.bin", sDevVAddr.uiAddr); - + pui32PD[ui32PDIndex] = 0; pui32PT[ui32PTIndex] = 0; - + PDUMPMEMPTENTRIES(&psDevInfo->sMMUAttrib, psDevInfo->hBRN22997PDPageOSMemHandle, pui32PD, SGX_MMU_PAGE_SIZE, 0, IMG_TRUE, PDUMP_PD_UNIQUETAG, PDUMP_PT_UNIQUETAG); PDUMPMEMPTENTRIES(&psDevInfo->sMMUAttrib, psDevInfo->hBRN22997PTPageOSMemHandle, pui32PT, SGX_MMU_PAGE_SIZE, 0, IMG_TRUE, PDUMP_PT_UNIQUETAG, PDUMP_PD_UNIQUETAG); @@ -3686,7 +3720,7 @@ IMG_VOID WorkaroundBRN22997Free(PVRSRV_DEVICE_NODE *psDeviceNode) PDUMPFREEPAGETABLE(&psDeviceNode->sDevId, psDevInfo->hBRN22997PDPageOSMemHandle, psDevInfo->pui32BRN22997PD, SGX_MMU_PAGE_SIZE, 0, PDUMP_PD_UNIQUETAG); PDUMPFREEPAGETABLE(&psDeviceNode->sDevId, psDevInfo->hBRN22997PTPageOSMemHandle, psDevInfo->pui32BRN22997PT, SGX_MMU_PAGE_SIZE, 0, PDUMP_PT_UNIQUETAG); - + if(psLocalDevMemArena == IMG_NULL) { if (psDevInfo->pui32BRN22997PD != IMG_NULL) @@ -3719,7 +3753,7 @@ IMG_VOID WorkaroundBRN22997Free(PVRSRV_DEVICE_NODE *psDeviceNode) } } } -#endif +#endif #if defined(SUPPORT_EXTERNAL_SYSTEM_CACHE) @@ -3757,12 +3791,12 @@ PVRSRV_ERROR MMU_MapExtSystemCacheRegs(PVRSRV_DEVICE_NODE *psDeviceNode) pui32PT = (IMG_UINT32 *) psDeviceNode->sDevMemoryInfo.pBMKernelContext->psMMUContext->apsPTInfoList[ui32PDIndex]->PTPageCpuVAddr; MakeKernelPageReadWrite(pui32PT); - + pui32PT[ui32PTIndex] = (psDevInfo->sExtSysCacheRegsDevPBase.uiAddr>>SGX_MMU_PTE_ADDR_ALIGNSHIFT) | SGX_MMU_PTE_VALID; MakeKernelPageReadOnly(pui32PT); #if defined(PDUMP) - + { IMG_DEV_PHYADDR sDevPAddr; IMG_CPU_PHYADDR sCpuPAddr; @@ -3824,11 +3858,11 @@ PVRSRV_ERROR MMU_UnmapExtSystemCacheRegs(PVRSRV_DEVICE_NODE *psDeviceNode) psLocalDevMemArena = psSysData->apsLocalDevMemArena[0]; - + ui32PDIndex = (SGX_EXT_SYSTEM_CACHE_REGS_DEVVADDR_BASE & SGX_MMU_PD_MASK) >> (SGX_MMU_PAGE_SHIFT + SGX_MMU_PT_SHIFT); ui32PTIndex = (SGX_EXT_SYSTEM_CACHE_REGS_DEVVADDR_BASE & SGX_MMU_PT_MASK) >> SGX_MMU_PAGE_SHIFT; - + if (psDeviceNode->sDevMemoryInfo.pBMKernelContext->psMMUContext->apsPTInfoList[ui32PDIndex]) { if (psDeviceNode->sDevMemoryInfo.pBMKernelContext->psMMUContext->apsPTInfoList[ui32PDIndex]->PTPageCpuVAddr) @@ -3866,7 +3900,7 @@ static IMG_VOID PageTest(IMG_VOID* pMem, IMG_DEV_PHYADDR sDevPAddr) if (ui32WriteData != ui32ReadData) { - + PVR_DPF ((PVR_DBG_ERROR, "Error - memory page test failed at device phys address 0x%08X", sDevPAddr.uiAddr + (n<<2) )); PVR_DBG_BREAK; bOK = IMG_FALSE; @@ -3882,7 +3916,7 @@ static IMG_VOID PageTest(IMG_VOID* pMem, IMG_DEV_PHYADDR sDevPAddr) if (ui32WriteData != ui32ReadData) { - + PVR_DPF ((PVR_DBG_ERROR, "Error - memory page test failed at device phys address 0x%08X", sDevPAddr.uiAddr + (n<<2) )); PVR_DBG_BREAK; bOK = IMG_FALSE; diff --git a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/mmu.h b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/mmu.h index d78f5c5..dd92bf0 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/mmu.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/mmu.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -61,10 +61,10 @@ MMU_Free (MMU_HEAP *pMMUHeap, IMG_DEV_VIRTADDR DevVAddr, IMG_UINT32 ui32Size); -IMG_VOID +IMG_VOID MMU_Enable (MMU_HEAP *pMMUHeap); -IMG_VOID +IMG_VOID MMU_Disable (MMU_HEAP *pMMUHeap); IMG_VOID @@ -78,7 +78,7 @@ MMU_MapPages (MMU_HEAP *pMMUHeap, IMG_VOID MMU_MapShadow (MMU_HEAP * pMMUHeap, IMG_DEV_VIRTADDR MapBaseDevVAddr, - IMG_SIZE_T uByteSize, + IMG_SIZE_T uByteSize, IMG_CPU_VIRTADDR CpuVAddr, IMG_HANDLE hOSMemHandle, IMG_DEV_VIRTADDR * pDevVAddr, @@ -129,13 +129,13 @@ PVRSRV_ERROR WorkaroundBRN22997Alloc(PVRSRV_DEVICE_NODE *psDeviceNode); IMG_VOID WorkaroundBRN22997ReadHostPort(PVRSRV_SGXDEV_INFO *psDevInfo); IMG_VOID WorkaroundBRN22997Free(PVRSRV_DEVICE_NODE *psDeviceNode); -#endif +#endif #if defined(SUPPORT_EXTERNAL_SYSTEM_CACHE) PVRSRV_ERROR MMU_MapExtSystemCacheRegs(PVRSRV_DEVICE_NODE *psDeviceNode); PVRSRV_ERROR MMU_UnmapExtSystemCacheRegs(PVRSRV_DEVICE_NODE *psDeviceNode); -#endif +#endif IMG_BOOL MMU_IsHeapShared(MMU_HEAP* pMMU_Heap); @@ -147,8 +147,10 @@ IMG_VOID MMU_GetPDPhysAddr(MMU_CONTEXT *pMMUContext, IMG_DEV_PHYADDR *psDevPAddr #endif +IMG_VOID MMU_CheckFaultAddr(PVRSRV_SGXDEV_INFO *psDevInfo, IMG_UINT32 ui32PDDevPAddr, IMG_UINT32 ui32RegVal); + #if defined(PDUMP) IMG_UINT32 MMU_GetPDumpContextID(IMG_HANDLE hDevMemContext); -#endif +#endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/pb.c b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/pb.c index 2bd974a..ab6523a 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/pb.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/pb.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -108,7 +108,7 @@ SGXFindSharedPBDescKM(PVRSRV_PER_PROCESS_DATA *psPerProc, sizeof(PVRSRV_KERNEL_MEM_INFO *) * psStubPBDesc->ui32SubKernelMemInfosCount, ppsSharedPBDescSubKernelMemInfos, 0); - + PVR_DPF((PVR_DBG_ERROR, "SGXFindSharedPBDescKM: ResManRegisterRes failed")); @@ -173,15 +173,15 @@ ExitNotFound: static PVRSRV_ERROR SGXCleanupSharedPBDescKM(PVRSRV_STUB_PBDESC *psStubPBDescIn) { - + IMG_UINT32 i; PVRSRV_DEVICE_NODE *psDeviceNode; psDeviceNode = (PVRSRV_DEVICE_NODE*)psStubPBDescIn->hDevCookie; + - - + psStubPBDescIn->ui32RefCount--; if (psStubPBDescIn->ui32RefCount == 0) { @@ -189,7 +189,7 @@ SGXCleanupSharedPBDescKM(PVRSRV_STUB_PBDESC *psStubPBDescIn) List_PVRSRV_STUB_PBDESC_Remove(psStubPBDescIn); for(i=0 ; iui32SubKernelMemInfosCount; i++) { - + PVRSRVFreeDeviceMemKM(psStubPBDescIn->hDevCookie, psStubPBDescIn->ppsSubKernelMemInfos[i]); } @@ -212,16 +212,16 @@ SGXCleanupSharedPBDescKM(PVRSRV_STUB_PBDESC *psStubPBDescIn) sizeof(PVRSRV_STUB_PBDESC), psStubPBDescIn, 0); + - - + SGXCleanupRequest(psDeviceNode, &sHWPBDescDevVAddr, PVRSRV_CLEANUPCMD_PB, CLEANUP_WITH_POLL); } return PVRSRV_OK; - + } static PVRSRV_ERROR SGXCleanupSharedPBDescCallback(IMG_PVOID pvParam, IMG_UINT32 ui32Param, IMG_BOOL bDummy) @@ -281,7 +281,7 @@ SGXAddSharedPBDescKM(PVRSRV_PER_PROCESS_DATA *psPerProc, PVRSRV_SGXDEV_INFO *psSGXDevInfo; PRESMAN_ITEM psResItem; - + if (psPerProcCreateSharedPB != psPerProc) { goto NoAdd; @@ -309,7 +309,7 @@ SGXAddSharedPBDescKM(PVRSRV_PER_PROCESS_DATA *psPerProc, } - + psResItem = ResManRegisterRes(psPerProc->hResManContext, RESMAN_TYPE_SHARED_PB_DESC, psStubPBDesc, @@ -324,7 +324,7 @@ SGXAddSharedPBDescKM(PVRSRV_PER_PROCESS_DATA *psPerProc, goto NoAddKeepPB; } - + psStubPBDesc->ui32RefCount++; *phSharedPBDesc = (IMG_HANDLE)psResItem; @@ -423,7 +423,7 @@ SGXAddSharedPBDescKM(PVRSRV_PER_PROCESS_DATA *psPerProc, } psStubPBDesc->hDevCookie = hDevCookie; - + List_PVRSRV_STUB_PBDESC_Insert(&(psSGXDevInfo->psStubPBDescListKM), psStubPBDesc); @@ -446,7 +446,7 @@ NoAdd: sizeof(PVRSRV_STUB_PBDESC), psStubPBDesc, 0); - + } NoAddKeepPB: diff --git a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgx_bridge_km.h b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgx_bridge_km.h index 6db7941..8fb3002 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgx_bridge_km.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgx_bridge_km.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -156,5 +156,5 @@ SGXGetInternalDevInfoKM(IMG_HANDLE hDevCookie, } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxconfig.h b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxconfig.h index 3cddfca..90f6dd5 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxconfig.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxconfig.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -51,10 +51,10 @@ #define SGX_GENERAL_HEAP_BASE 0x08000000 #define SGX_GENERAL_HEAP_SIZE (0xB8000000-0x00001000) - + #define SGX_3DPARAMETERS_HEAP_SIZE 0x10000000 - + #if !defined(HYBRID_SHARED_PB_SIZE) #define HYBRID_SHARED_PB_SIZE (SGX_3DPARAMETERS_HEAP_SIZE >> 1) #endif @@ -76,10 +76,10 @@ #endif #define SGX_SHARED_3DPARAMETERS_HEAP_BASE 0xC0000000 - + #define SGX_PERCONTEXT_3DPARAMETERS_HEAP_BASE (SGX_SHARED_3DPARAMETERS_HEAP_BASE + SGX_SHARED_3DPARAMETERS_SIZE) - + #define SGX_TADATA_HEAP_BASE 0xD0000000 #define SGX_TADATA_HEAP_SIZE (0x0D000000-0x00001000) @@ -99,13 +99,13 @@ #define SGX_KERNEL_DATA_HEAP_BASE 0xF0000000 #define SGX_KERNEL_DATA_HEAP_SIZE (0x03000000-(0x00001000+SGX_KERNEL_DATA_HEAP_OFFSET)) - + #define SGX_PIXELSHADER_HEAP_BASE 0xF4000000 #define SGX_PIXELSHADER_HEAP_SIZE (0x05000000-0x00001000) - + #define SGX_VERTEXSHADER_HEAP_BASE 0xFC000000 #define SGX_VERTEXSHADER_HEAP_SIZE (0x02000000-0x00001000) -#else +#else #if defined(SGX_FEATURE_2D_HARDWARE) #define SGX_2D_HEAP_BASE 0x00100000 #define SGX_2D_HEAP_SIZE (0x08000000-0x00100000-0x00001000) @@ -126,8 +126,8 @@ #define SGX_GENERAL_HEAP_SIZE (0xC2000000-0x00001000) #else #include - - + + #define SGX_GENERAL_HEAP_BASE 0x10000000 #define SGX_GENERAL_HEAP_SIZE (0xB5000000-0x00001000) @@ -135,17 +135,17 @@ #define SGX_VPB_TILED_HEAP_BASE 0xC5000000 #define SGX_VPB_TILED_HEAP_SIZE (0x0D000000-0x00001000) - + #if((SGX_VPB_TILED_HEAP_BASE & SGX_BIF_TILING_ADDR_INV_MASK) != 0) #error "sgxconfig.h: SGX_VPB_TILED_HEAP has insufficient alignment" #endif - #endif - + #endif + #define SGX_3DPARAMETERS_HEAP_SIZE 0x10000000 - + #if !defined(HYBRID_SHARED_PB_SIZE) #define HYBRID_SHARED_PB_SIZE (SGX_3DPARAMETERS_HEAP_SIZE >> 1) #endif @@ -167,10 +167,10 @@ #endif #define SGX_SHARED_3DPARAMETERS_HEAP_BASE 0xD2000000 - + #define SGX_PERCONTEXT_3DPARAMETERS_HEAP_BASE (SGX_SHARED_3DPARAMETERS_HEAP_BASE + SGX_SHARED_3DPARAMETERS_SIZE) - + #define SGX_TADATA_HEAP_BASE 0xE2000000 #define SGX_TADATA_HEAP_SIZE (0x0D000000-0x00001000) @@ -190,16 +190,16 @@ #define SGX_KERNEL_DATA_HEAP_BASE 0xF4000000 #define SGX_KERNEL_DATA_HEAP_SIZE (0x05000000-(0x00001000+SGX_KERNEL_DATA_HEAP_OFFSET)) - + #define SGX_PIXELSHADER_HEAP_BASE 0xF9000000 #define SGX_PIXELSHADER_HEAP_SIZE (0x05000000-0x00001000) - + #define SGX_VERTEXSHADER_HEAP_BASE 0xFE000000 #define SGX_VERTEXSHADER_HEAP_SIZE (0x02000000-0x00001000) -#endif - +#endif + #define SGX_CORE_IDENTIFIED -#endif +#endif #if SGX_FEATURE_ADDRESS_SPACE_SIZE == 28 @@ -218,14 +218,14 @@ #define SGX_GENERAL_HEAP_SIZE (0x08800000-0x00001000-0x00001000) #endif #endif - + #if defined(SUPPORT_LARGE_GENERAL_HEAP) #define SGX_3DPARAMETERS_HEAP_SIZE 0x01000000 #else #define SGX_3DPARAMETERS_HEAP_SIZE 0x04000000 #endif - + #if !defined(HYBRID_SHARED_PB_SIZE) #define HYBRID_SHARED_PB_SIZE (SGX_3DPARAMETERS_HEAP_SIZE >> 1) #endif @@ -252,10 +252,10 @@ #define SGX_SHARED_3DPARAMETERS_HEAP_BASE 0x08800000 #endif - + #define SGX_PERCONTEXT_3DPARAMETERS_HEAP_BASE (SGX_SHARED_3DPARAMETERS_HEAP_BASE + SGX_SHARED_3DPARAMETERS_SIZE) - + #define SGX_TADATA_HEAP_BASE 0x0C800000 #define SGX_TADATA_HEAP_SIZE (0x01000000-0x00001000) @@ -281,10 +281,10 @@ #define SGX_VERTEXSHADER_HEAP_BASE 0x0FC00000 #define SGX_VERTEXSHADER_HEAP_SIZE (0x00200000-0x00001000) - + #define SGX_CORE_IDENTIFIED -#endif +#endif #if !defined(SGX_CORE_IDENTIFIED) #error "sgxconfig.h: ERROR: unspecified SGX Core version" @@ -294,11 +294,11 @@ #if ((SGX_KERNEL_CODE_HEAP_BASE + SGX_KERNEL_CODE_HEAP_SIZE - SGX_PDSPIXEL_CODEDATA_HEAP_BASE) > 0x4000000) #error "sgxconfig.h: ERROR: SGX_KERNEL_CODE_HEAP_BASE out of range of SGX_PDSPIXEL_CODEDATA_HEAP_BASE" #endif - + #if ((SGX_PDSVERTEX_CODEDATA_HEAP_BASE + SGX_PDSVERTEX_CODEDATA_HEAP_SIZE - SGX_PDSPIXEL_CODEDATA_HEAP_BASE) > 0x4000000) #error "sgxconfig.h: ERROR: SGX_PDSVERTEX_CODEDATA_HEAP_BASE out of range of SGX_PDSPIXEL_CODEDATA_HEAP_BASE" #endif -#endif +#endif #if defined(SGX_FEATURE_2D_HARDWARE) && defined(SUPPORT_SGX_GENERAL_MAPPING_HEAP) #if ((SGX_GENERAL_MAPPING_HEAP_BASE + SGX_GENERAL_MAPPING_HEAP_SIZE - SGX_2D_HEAP_BASE) >= EUR_CR_BIF_TWOD_REQ_BASE_ADDR_MASK) @@ -397,5 +397,5 @@ #error "sgxconfig.h: ERROR: SGX_VERTEXSHADER_HEAP_BASE size cause wraparound" #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxinfokm.h b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxinfokm.h index 2a5ad79..44a48be 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxinfokm.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxinfokm.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -58,40 +58,40 @@ typedef struct _PVRSRV_SGXDEV_INFO_ IMG_UINT32 ui32CoreConfig; IMG_UINT32 ui32CoreFlags; - + IMG_PVOID pvRegsBaseKM; #if defined(SGX_FEATURE_HOST_PORT) - + IMG_PVOID pvHostPortBaseKM; - + IMG_UINT32 ui32HPSize; - + IMG_SYS_PHYADDR sHPSysPAddr; #endif - + IMG_HANDLE hRegMapping; - + IMG_SYS_PHYADDR sRegsPhysBase; - + IMG_UINT32 ui32RegSize; #if defined(SUPPORT_EXTERNAL_SYSTEM_CACHE) - + IMG_UINT32 ui32ExtSysCacheRegsSize; - + IMG_DEV_PHYADDR sExtSysCacheRegsDevPBase; - + IMG_UINT32 *pui32ExtSystemCacheRegsPT; - + IMG_HANDLE hExtSystemCacheRegsPTPageOSMemHandle; - + IMG_SYS_PHYADDR sExtSystemCacheRegsPTSysPAddr; #endif - + IMG_UINT32 ui32CoreClockSpeed; IMG_UINT32 ui32uKernelTimerClock; IMG_BOOL bSGXIdle; @@ -99,67 +99,64 @@ typedef struct _PVRSRV_SGXDEV_INFO_ PVRSRV_STUB_PBDESC *psStubPBDescListKM; - + IMG_DEV_PHYADDR sKernelPDDevPAddr; - IMG_UINT32 ui32HeapCount; + IMG_UINT32 ui32HeapCount; IMG_VOID *pvDeviceMemoryHeap; - PPVRSRV_KERNEL_MEM_INFO psKernelCCBMemInfo; - PVRSRV_SGX_KERNEL_CCB *psKernelCCB; - PPVRSRV_SGX_CCB_INFO psKernelCCBInfo; - PPVRSRV_KERNEL_MEM_INFO psKernelCCBCtlMemInfo; - PVRSRV_SGX_CCB_CTL *psKernelCCBCtl; - PPVRSRV_KERNEL_MEM_INFO psKernelCCBEventKickerMemInfo; - IMG_UINT32 *pui32KernelCCBEventKicker; + PPVRSRV_KERNEL_MEM_INFO psKernelCCBMemInfo; + PVRSRV_SGX_KERNEL_CCB *psKernelCCB; + PPVRSRV_SGX_CCB_INFO psKernelCCBInfo; + PPVRSRV_KERNEL_MEM_INFO psKernelCCBCtlMemInfo; + PVRSRV_SGX_CCB_CTL *psKernelCCBCtl; + PPVRSRV_KERNEL_MEM_INFO psKernelCCBEventKickerMemInfo; + IMG_UINT32 *pui32KernelCCBEventKicker; #if defined(PDUMP) - IMG_UINT32 ui32KernelCCBEventKickerDumpVal; -#endif - PVRSRV_KERNEL_MEM_INFO *psKernelSGXMiscMemInfo; - IMG_UINT32 aui32HostKickAddr[SGXMKIF_CMD_MAX]; + IMG_UINT32 ui32KernelCCBEventKickerDumpVal; +#endif + PVRSRV_KERNEL_MEM_INFO *psKernelSGXMiscMemInfo; + IMG_UINT32 aui32HostKickAddr[SGXMKIF_CMD_MAX]; #if defined(SGX_SUPPORT_HWPROFILING) PPVRSRV_KERNEL_MEM_INFO psKernelHWProfilingMemInfo; #endif - PPVRSRV_KERNEL_MEM_INFO psKernelHWPerfCBMemInfo; - PPVRSRV_KERNEL_MEM_INFO psKernelTASigBufferMemInfo; - PPVRSRV_KERNEL_MEM_INFO psKernel3DSigBufferMemInfo; + PPVRSRV_KERNEL_MEM_INFO psKernelHWPerfCBMemInfo; + PPVRSRV_KERNEL_MEM_INFO psKernelTASigBufferMemInfo; + PPVRSRV_KERNEL_MEM_INFO psKernel3DSigBufferMemInfo; #if defined(FIX_HW_BRN_29702) - PPVRSRV_KERNEL_MEM_INFO psKernelCFIMemInfo; + PPVRSRV_KERNEL_MEM_INFO psKernelCFIMemInfo; #endif #if defined(FIX_HW_BRN_29823) - PPVRSRV_KERNEL_MEM_INFO psKernelDummyTermStreamMemInfo; + PPVRSRV_KERNEL_MEM_INFO psKernelDummyTermStreamMemInfo; #endif -#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31425) - PPVRSRV_KERNEL_MEM_INFO psKernelVDMSnapShotBufferMemInfo; - PPVRSRV_KERNEL_MEM_INFO psKernelVDMCtrlStreamBufferMemInfo; +#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31559) + PPVRSRV_KERNEL_MEM_INFO psKernelVDMSnapShotBufferMemInfo; + PPVRSRV_KERNEL_MEM_INFO psKernelVDMCtrlStreamBufferMemInfo; #endif #if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && \ defined(FIX_HW_BRN_33657) && defined(SUPPORT_SECURE_33657_FIX) - PPVRSRV_KERNEL_MEM_INFO psKernelVDMStateUpdateBufferMemInfo; + PPVRSRV_KERNEL_MEM_INFO psKernelVDMStateUpdateBufferMemInfo; #endif #if defined(PVRSRV_USSE_EDM_STATUS_DEBUG) - PPVRSRV_KERNEL_MEM_INFO psKernelEDMStatusBufferMemInfo; + PPVRSRV_KERNEL_MEM_INFO psKernelEDMStatusBufferMemInfo; #endif -#if defined(SGX_FEATURE_OVERLAPPED_SPM) - PPVRSRV_KERNEL_MEM_INFO psKernelTmpRgnHeaderMemInfo; -#endif - + IMG_UINT32 ui32ClientRefCount; - + IMG_UINT32 ui32CacheControl; - + IMG_UINT32 ui32ClientBuildOptions; - + SGX_MISCINFO_STRUCT_SIZES sSGXStructSizes; - + IMG_VOID *pvMMUContextList; - + IMG_BOOL bForcePTOff; IMG_UINT32 ui32EDMTaskReg0; @@ -174,10 +171,10 @@ typedef struct _PVRSRV_SGXDEV_INFO_ IMG_UINT32 ui32MasterClkGateStatusMask; IMG_UINT32 ui32MasterClkGateStatus2Reg; IMG_UINT32 ui32MasterClkGateStatus2Mask; -#endif +#endif SGX_INIT_SCRIPTS sScripts; - + IMG_HANDLE hBIFResetPDOSMemHandle; IMG_DEV_PHYADDR sBIFResetPDDevPAddr; IMG_DEV_PHYADDR sBIFResetPTDevPAddr; @@ -186,7 +183,7 @@ typedef struct _PVRSRV_SGXDEV_INFO_ IMG_UINT32 *pui32BIFResetPT; #if defined(FIX_HW_BRN_22997) && defined(FIX_HW_BRN_23030) && defined(SGX_FEATURE_HOST_PORT) - + IMG_HANDLE hBRN22997PTPageOSMemHandle; IMG_HANDLE hBRN22997PDPageOSMemHandle; IMG_DEV_PHYADDR sBRN22997PTDevPAddr; @@ -194,23 +191,23 @@ typedef struct _PVRSRV_SGXDEV_INFO_ IMG_UINT32 *pui32BRN22997PT; IMG_UINT32 *pui32BRN22997PD; IMG_SYS_PHYADDR sBRN22997SysPAddr; -#endif +#endif #if defined(SUPPORT_HW_RECOVERY) - + IMG_HANDLE hTimer; - + IMG_UINT32 ui32TimeStamp; #endif - + IMG_UINT32 ui32NumResets; - + PVRSRV_KERNEL_MEM_INFO *psKernelSGXHostCtlMemInfo; SGXMKIF_HOST_CTL *psSGXHostCtl; - + PVRSRV_KERNEL_MEM_INFO *psKernelSGXTA3DCtlMemInfo; #if defined(FIX_HW_BRN_31272) || defined(FIX_HW_BRN_31780) || defined(FIX_HW_BRN_33920) @@ -219,7 +216,7 @@ typedef struct _PVRSRV_SGXDEV_INFO_ IMG_UINT32 ui32Flags; - + IMG_UINT32 ui32MemTilingUsage; #if defined(PDUMP) @@ -227,7 +224,7 @@ typedef struct _PVRSRV_SGXDEV_INFO_ #endif #if defined(SUPPORT_SGX_MMU_DUMMY_PAGE) - + IMG_VOID *pvDummyPTPageCpuVAddr; IMG_DEV_PHYADDR sDummyPTDevPAddr; IMG_HANDLE hDummyPTPageOSMemHandle; @@ -241,12 +238,12 @@ typedef struct _PVRSRV_SGXDEV_INFO_ IMG_UINT32 asSGXDevData[SGX_MAX_DEV_DATA]; #if defined(FIX_HW_BRN_31620) - + IMG_VOID *pvBRN31620DummyPageCpuVAddr; IMG_HANDLE hBRN31620DummyPageOSMemHandle; IMG_DEV_PHYADDR sBRN31620DummyPageDevPAddr; - + IMG_VOID *pvBRN31620DummyPTCpuVAddr; IMG_HANDLE hBRN31620DummyPTOSMemHandle; IMG_DEV_PHYADDR sBRN31620DummyPTDevPAddr; @@ -270,7 +267,7 @@ typedef struct _SGX_DEVICE_MAP_ { IMG_UINT32 ui32Flags; - + IMG_SYS_PHYADDR sRegsSysPBase; IMG_CPU_PHYADDR sRegsCpuPBase; IMG_CPU_VIRTADDR pvRegsCpuVBase; @@ -282,7 +279,7 @@ typedef struct _SGX_DEVICE_MAP_ IMG_UINT32 ui32HPSize; #endif - + IMG_SYS_PHYADDR sLocalMemSysPBase; IMG_DEV_PHYADDR sLocalMemDevPBase; IMG_CPU_PHYADDR sLocalMemCpuPBase; @@ -293,15 +290,15 @@ typedef struct _SGX_DEVICE_MAP_ IMG_DEV_PHYADDR sExtSysCacheRegsDevPBase; #endif - + IMG_UINT32 ui32IRQ; #if !defined(SGX_DYNAMIC_TIMING_INFO) - + SGX_TIMING_INFORMATION sTimingInfo; #endif #if defined(PDUMP) - + IMG_CHAR *pszPDumpDevName; #endif } SGX_DEVICE_MAP; @@ -325,13 +322,13 @@ struct _PVRSRV_STUB_PBDESC_ typedef struct _PVRSRV_SGX_CCB_INFO_ { - PVRSRV_KERNEL_MEM_INFO *psCCBMemInfo; - PVRSRV_KERNEL_MEM_INFO *psCCBCtlMemInfo; - SGXMKIF_COMMAND *psCommands; - IMG_UINT32 *pui32WriteOffset; - volatile IMG_UINT32 *pui32ReadOffset; + PVRSRV_KERNEL_MEM_INFO *psCCBMemInfo; + PVRSRV_KERNEL_MEM_INFO *psCCBCtlMemInfo; + SGXMKIF_COMMAND *psCommands; + IMG_UINT32 *pui32WriteOffset; + volatile IMG_UINT32 *pui32ReadOffset; #if defined(PDUMP) - IMG_UINT32 ui32CCBDumpWOff; + IMG_UINT32 ui32CCBDumpWOff; #endif } PVRSRV_SGX_CCB_INFO; @@ -373,9 +370,6 @@ typedef struct _SGX_BRIDGE_INIT_INFO_KM_ #if defined(PVRSRV_USSE_EDM_STATUS_DEBUG) IMG_HANDLE hKernelEDMStatusBufferMemInfo; #endif -#if defined(SGX_FEATURE_OVERLAPPED_SPM) - IMG_HANDLE hKernelTmpRgnHeaderMemInfo; -#endif IMG_UINT32 ui32EDMTaskReg0; IMG_UINT32 ui32EDMTaskReg1; @@ -383,7 +377,7 @@ typedef struct _SGX_BRIDGE_INIT_INFO_KM_ IMG_UINT32 ui32ClkGateStatusReg; IMG_UINT32 ui32ClkGateStatusMask; #if defined(SGX_FEATURE_MP) -#endif +#endif IMG_UINT32 ui32CacheControl; @@ -408,7 +402,7 @@ typedef struct _SGX_CCB_KICK_KM_ IMG_UINT32 ui32NumDstSyncObjects; IMG_HANDLE hKernelHWSyncListMemInfo; - + IMG_HANDLE *pahDstSyncHandles; IMG_UINT32 ui32NumTAStatusVals; @@ -427,11 +421,11 @@ typedef struct _SGX_CCB_KICK_KM_ IMG_BOOL bTerminateOrAbort; #endif - + IMG_UINT32 ui32CCBOffset; #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) - + IMG_UINT32 ui32NumTASrcSyncs; IMG_HANDLE ahTASrcKernelSyncInfo[SGX_MAX_TA_SRC_SYNCS]; IMG_UINT32 ui32NumTADstSyncs; @@ -439,12 +433,12 @@ typedef struct _SGX_CCB_KICK_KM_ IMG_UINT32 ui32Num3DSrcSyncs; IMG_HANDLE ah3DSrcKernelSyncInfo[SGX_MAX_3D_SRC_SYNCS]; #else - + IMG_UINT32 ui32NumSrcSyncs; - IMG_HANDLE ahSrcKernelSyncInfo[SGX_MAX_SRC_SYNCS]; + IMG_HANDLE ahSrcKernelSyncInfo[SGX_MAX_SRC_SYNCS_TA]; #endif - + IMG_BOOL bTADependency; IMG_HANDLE hTA3DSyncInfo; @@ -495,13 +489,13 @@ typedef struct _PVRSRV_2D_SGX_KICK_KM_ IMG_UINT32 ui32NumSrcSync; IMG_HANDLE ahSrcSyncInfo[SGX_MAX_2D_SRC_SYNC_OPS]; - + IMG_HANDLE hDstSyncInfo; - + IMG_HANDLE hTASyncInfo; - + IMG_HANDLE h3DSyncInfo; IMG_UINT32 ui32PDumpFlags; @@ -509,8 +503,8 @@ typedef struct _PVRSRV_2D_SGX_KICK_KM_ IMG_UINT32 ui32CCBDumpWOff; #endif } PVRSRV_2D_SGX_KICK_KM, *PPVRSRV_2D_SGX_KICK_KM; -#endif -#endif +#endif +#endif PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode); @@ -527,12 +521,12 @@ PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo, IMG_BOOL bHardwareRecovery); PVRSRV_ERROR SGXDeinitialise(IMG_HANDLE hDevCookie); -PVRSRV_ERROR SGXPrePowerState(IMG_HANDLE hDevHandle, - PVRSRV_DEV_POWER_STATE eNewPowerState, +PVRSRV_ERROR SGXPrePowerState(IMG_HANDLE hDevHandle, + PVRSRV_DEV_POWER_STATE eNewPowerState, PVRSRV_DEV_POWER_STATE eCurrentPowerState); -PVRSRV_ERROR SGXPostPowerState(IMG_HANDLE hDevHandle, - PVRSRV_DEV_POWER_STATE eNewPowerState, +PVRSRV_ERROR SGXPostPowerState(IMG_HANDLE hDevHandle, + PVRSRV_DEV_POWER_STATE eNewPowerState, PVRSRV_DEV_POWER_STATE eCurrentPowerState); PVRSRV_ERROR SGXPreClockSpeedChange(IMG_HANDLE hDevHandle, @@ -575,5 +569,5 @@ static INLINE IMG_VOID NoHardwareGenerateEvent(PVRSRV_SGXDEV_INFO *psDevInfo, } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxinit.c b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxinit.c index 5f26b20..846035a 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxinit.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxinit.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -52,9 +52,27 @@ #include "lists.h" #include "srvkm.h" #include "ttrace.h" -#define VAR(x) #x +#if defined(PVRSRV_USSE_EDM_STATUS_DEBUG) + +static const IMG_CHAR *SGXUKernelStatusString(IMG_UINT32 code) +{ + switch(code) + { +#define MKTC_ST(x) \ + case x: \ + return #x; +#include "sgx_ukernel_status_codes.h" + default: + return "(Unknown)"; + } +} + +#endif + +#define VAR(x) #x + #define CHECK_SIZE(NAME) \ { \ if (psSGXStructSizes->ui32Sizeof_##NAME != psDevInfo->sSGXStructSizes.ui32Sizeof_##NAME) \ @@ -86,7 +104,7 @@ static IMG_VOID SGXCommandComplete(PVRSRV_DEVICE_NODE *psDeviceNode) #if defined(OS_SUPPORTS_IN_LISR) if (OSInLISR(psDeviceNode->psSysData)) { - + psDeviceNode->bReProcessDeviceCommandComplete = IMG_TRUE; } else @@ -102,7 +120,7 @@ static IMG_UINT32 DeinitDevInfo(PVRSRV_SGXDEV_INFO *psDevInfo) { if (psDevInfo->psKernelCCBInfo != IMG_NULL) { - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_SGX_CCB_INFO), psDevInfo->psKernelCCBInfo, IMG_NULL); } @@ -160,7 +178,7 @@ static PVRSRV_ERROR InitDevInfo(PVRSRV_PER_PROCESS_DATA *psPerProc, #if defined(FIX_HW_BRN_29823) psDevInfo->psKernelDummyTermStreamMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psInitInfo->hKernelDummyTermStreamMemInfo; #endif -#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31425) +#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31559) psDevInfo->psKernelVDMSnapShotBufferMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psInitInfo->hKernelVDMSnapShotBufferMemInfo; psDevInfo->psKernelVDMCtrlStreamBufferMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psInitInfo->hKernelVDMCtrlStreamBufferMemInfo; #endif @@ -171,16 +189,13 @@ static PVRSRV_ERROR InitDevInfo(PVRSRV_PER_PROCESS_DATA *psPerProc, #if defined(PVRSRV_USSE_EDM_STATUS_DEBUG) psDevInfo->psKernelEDMStatusBufferMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psInitInfo->hKernelEDMStatusBufferMemInfo; #endif -#if defined(SGX_FEATURE_OVERLAPPED_SPM) - psDevInfo->psKernelTmpRgnHeaderMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psInitInfo->hKernelTmpRgnHeaderMemInfo; -#endif - + psDevInfo->ui32ClientBuildOptions = psInitInfo->ui32ClientBuildOptions; - + psDevInfo->sSGXStructSizes = psInitInfo->sSGXStructSizes; - + eError = OSAllocMem(PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_SGX_CCB_INFO), @@ -201,7 +216,7 @@ static PVRSRV_ERROR InitDevInfo(PVRSRV_PER_PROCESS_DATA *psPerProc, psKernelCCBInfo->pui32ReadOffset = &psDevInfo->psKernelCCBCtl->ui32ReadOffset; psDevInfo->psKernelCCBInfo = psKernelCCBInfo; - + OSMemCopy(psDevInfo->aui32HostKickAddr, psInitInfo->aui32HostKickAddr, SGXMKIF_CMD_MAX * sizeof(psDevInfo->aui32HostKickAddr[0])); @@ -221,10 +236,10 @@ static PVRSRV_ERROR InitDevInfo(PVRSRV_PER_PROCESS_DATA *psPerProc, psDevInfo->ui32MasterClkGateStatusMask = psInitInfo->ui32MasterClkGateStatusMask; psDevInfo->ui32MasterClkGateStatus2Reg = psInitInfo->ui32MasterClkGateStatus2Reg; psDevInfo->ui32MasterClkGateStatus2Mask = psInitInfo->ui32MasterClkGateStatus2Mask; -#endif - +#endif + OSMemCopy(&psDevInfo->asSGXDevData, &psInitInfo->asInitDevData, sizeof(psDevInfo->asSGXDevData)); return PVRSRV_OK; @@ -269,7 +284,7 @@ static PVRSRV_ERROR SGXRunScript(PVRSRV_SGXDEV_INFO *psDevInfo, SGX_INIT_COMMAND return PVRSRV_OK; } case SGX_INIT_OP_ILLEGAL: - + default: { PVR_DPF((PVR_DBG_ERROR,"SGXRunScript: PC %d: Illegal command: %d", ui32PC, psComm->eOp)); @@ -293,14 +308,14 @@ static PVRSRV_ERROR SGX_AllocMemTilingRangeInt(PVRSRV_SGXDEV_INFO *psDevInfo, IMG_UINT32 ui32Offset; IMG_UINT32 ui32Val; - + for(i=0; i < SGX_BIF_NUM_TILING_RANGES; i++) { if((psDevInfo->ui32MemTilingUsage & (1U << i)) == 0) { - + psDevInfo->ui32MemTilingUsage |= 1U << i; - + if(pui32RangeIndex != IMG_NULL) { *pui32RangeIndex = i; @@ -314,7 +329,7 @@ static PVRSRV_ERROR SGX_AllocMemTilingRangeInt(PVRSRV_SGXDEV_INFO *psDevInfo, RangeAllocated: - + if(ui32Start & ~SGX_BIF_TILING_ADDR_MASK) { PVR_DPF((PVR_DBG_WARNING,"SGX_AllocMemTilingRangeInt: Tiling range start (0x%08X) fails" @@ -344,12 +359,12 @@ RangeAllocated: OSWriteHWReg(psDevInfo->pvRegsBaseKM, ui32Offset, ui32Val); PDUMPREG(SGX_PDUMPREG_NAME, ui32Offset, ui32Val); -#endif +#endif return PVRSRV_OK; } -#endif +#endif PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo, IMG_BOOL bHardwareRecovery) @@ -360,15 +375,15 @@ PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo, static IMG_BOOL bFirstTime = IMG_TRUE; #if defined(PDUMP) IMG_BOOL bPDumpIsSuspended = PDumpIsSuspended(); -#endif +#endif #if defined(SGX_FEATURE_MP) - + #else SGXInitClocks(psDevInfo, PDUMP_FLAGS_CONTINUOUS); -#endif - - +#endif + + PDUMPCOMMENTWITHFLAGS(PDUMP_FLAGS_CONTINUOUS, "SGX initialisation script part 1\n"); eError = SGXRunScript(psDevInfo, psDevInfo->sScripts.asInitCommandsPart1, SGX_MAX_INIT_COMMANDS); @@ -379,13 +394,13 @@ PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo, } PDUMPCOMMENTWITHFLAGS(PDUMP_FLAGS_CONTINUOUS, "End of SGX initialisation script part 1\n"); - + psDevInfo->ui32NumResets++; SGXReset(psDevInfo, bFirstTime || bHardwareRecovery, PDUMP_FLAGS_CONTINUOUS); #if defined(EUR_CR_POWER) #if defined(SGX531) - + @@ -393,13 +408,13 @@ PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo, OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_POWER, 1); PDUMPREG(SGX_PDUMPREG_NAME, EUR_CR_POWER, 1); #else - + OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_POWER, 0); PDUMPREG(SGX_PDUMPREG_NAME, EUR_CR_POWER, 0); #endif #endif - + *psDevInfo->pui32KernelCCBEventKicker = 0; #if defined(PDUMP) if (!bPDumpIsSuspended) @@ -410,11 +425,11 @@ PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo, sizeof(*psDevInfo->pui32KernelCCBEventKicker), PDUMP_FLAGS_CONTINUOUS, MAKEUNIQUETAG(psDevInfo->psKernelCCBEventKickerMemInfo)); } -#endif +#endif #if defined(SUPPORT_MEMORY_TILING) { - + DEVICE_MEMORY_HEAP_INFO *psDeviceMemoryHeap = psDevInfo->pvDeviceMemoryHeap; IMG_UINT32 i; @@ -424,7 +439,7 @@ PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo, { if(psDeviceMemoryHeap[i].ui32XTileStride > 0) { - + eError = SGX_AllocMemTilingRangeInt( psDevInfo, psDeviceMemoryHeap[i].sDevVAddrBase.uiAddr, @@ -443,7 +458,7 @@ PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo, } #endif - + PDUMPCOMMENTWITHFLAGS(PDUMP_FLAGS_CONTINUOUS, "SGX initialisation script part 2\n"); eError = SGXRunScript(psDevInfo, psDevInfo->sScripts.asInitCommandsPart2, SGX_MAX_INIT_COMMANDS); @@ -454,7 +469,7 @@ PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo, } PDUMPCOMMENTWITHFLAGS(PDUMP_FLAGS_CONTINUOUS, "End of SGX initialisation script part 2\n"); - + psSGXHostCtl->ui32HostClock = OSClockus(); psSGXHostCtl->ui32InitStatus = 0; @@ -467,7 +482,7 @@ PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo, MAKEUNIQUETAG(psSGXHostCtlMemInfo)); PDUMPCOMMENTWITHFLAGS(PDUMP_FLAGS_CONTINUOUS, "Initialise the microkernel\n"); -#endif +#endif #if defined(SGX_FEATURE_MULTI_EVENT_KICK) OSWriteMemoryBarrier(); @@ -480,12 +495,12 @@ PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo, OSWriteHWReg(psDevInfo->pvRegsBaseKM, SGX_MP_CORE_SELECT(EUR_CR_EVENT_KICK, 0), EUR_CR_EVENT_KICK_NOW_MASK); -#endif +#endif OSMemoryBarrier(); #if defined(PDUMP) - + if (!bPDumpIsSuspended) { @@ -502,12 +517,12 @@ PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo, PDUMP_FLAGS_CONTINUOUS, MAKEUNIQUETAG(psDevInfo->psKernelCCBEventKickerMemInfo)); PDUMPREG(SGX_PDUMPREG_NAME, SGX_MP_CORE_SELECT(EUR_CR_EVENT_KICK, 0), EUR_CR_EVENT_KICK_NOW_MASK); -#endif +#endif } -#endif +#endif #if !defined(NO_HARDWARE) - + if (PollForValueKM(&psSGXHostCtl->ui32InitStatus, PVRSRV_USSE_EDM_INIT_COMPLETE, @@ -520,10 +535,10 @@ PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo, #if !defined(FIX_HW_BRN_23281) SGXDumpDebugInfo(psDevInfo, IMG_FALSE); PVR_DBG_BREAK; - #endif + #endif return PVRSRV_ERROR_RETRY; } -#endif +#endif #if defined(PDUMP) PDUMPCOMMENTWITHFLAGS(PDUMP_FLAGS_CONTINUOUS, @@ -535,19 +550,19 @@ PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo, PDUMP_POLL_OPERATOR_EQUAL, PDUMP_FLAGS_CONTINUOUS, MAKEUNIQUETAG(psSGXHostCtlMemInfo)); -#endif +#endif #if defined(FIX_HW_BRN_22997) && defined(FIX_HW_BRN_23030) && defined(SGX_FEATURE_HOST_PORT) - + WorkaroundBRN22997ReadHostPort(psDevInfo); -#endif +#endif PVR_ASSERT(psDevInfo->psKernelCCBCtl->ui32ReadOffset == psDevInfo->psKernelCCBCtl->ui32WriteOffset); bFirstTime = IMG_FALSE; - + return PVRSRV_OK; } @@ -557,7 +572,7 @@ PVRSRV_ERROR SGXDeinitialise(IMG_HANDLE hDevCookie) PVRSRV_SGXDEV_INFO *psDevInfo = (PVRSRV_SGXDEV_INFO *) hDevCookie; PVRSRV_ERROR eError; - + if (psDevInfo->pvRegsBaseKM == IMG_NULL) { return PVRSRV_OK; @@ -585,16 +600,16 @@ static PVRSRV_ERROR DevInitSGXPart1 (IMG_VOID *pvDeviceNode) DEVICE_MEMORY_HEAP_INFO *psDeviceMemoryHeap = psDeviceNode->sDevMemoryInfo.psDeviceMemoryHeap; PVRSRV_ERROR eError; - + PDUMPCOMMENT("SGX Core Version Information: %s", SGX_CORE_FRIENDLY_NAME); - + #if defined(SGX_FEATURE_MP) #if !defined(SGX_FEATURE_MP_PLUS) PDUMPCOMMENT("SGX Multi-processor: %d cores", SGX_FEATURE_MP_CORE_COUNT); #else PDUMPCOMMENT("SGX Multi-processor: %d TA cores, %d 3D cores", SGX_FEATURE_MP_CORE_COUNT_TA, SGX_FEATURE_MP_CORE_COUNT_3D); #endif - #endif + #endif #if (SGX_CORE_REV == 0) PDUMPCOMMENT("SGX Core Revision Information: head RTL"); @@ -606,12 +621,12 @@ static PVRSRV_ERROR DevInitSGXPart1 (IMG_VOID *pvDeviceNode) PDUMPCOMMENT("SGX System Level Cache is present\r\n"); #if defined(SGX_BYPASS_SYSTEM_CACHE) PDUMPCOMMENT("SGX System Level Cache is bypassed\r\n"); - #endif - #endif + #endif + #endif PDUMPCOMMENT("SGX Initialisation Part 1"); - + if(OSAllocMem( PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_SGXDEV_INFO), (IMG_VOID **)&psDevInfo, IMG_NULL, @@ -622,18 +637,18 @@ static PVRSRV_ERROR DevInitSGXPart1 (IMG_VOID *pvDeviceNode) } OSMemSet (psDevInfo, 0, sizeof(PVRSRV_SGXDEV_INFO)); - + psDevInfo->eDeviceType = DEV_DEVICE_TYPE; psDevInfo->eDeviceClass = DEV_DEVICE_CLASS; - + psDeviceNode->pvDevice = (IMG_PVOID)psDevInfo; - + psDevInfo->ui32HeapCount = psDeviceNode->sDevMemoryInfo.ui32HeapCount; psDevInfo->pvDeviceMemoryHeap = (IMG_VOID*)psDeviceMemoryHeap; - + hKernelDevMemContext = BM_CreateContext(psDeviceNode, &sPDDevPAddr, IMG_NULL, @@ -646,7 +661,7 @@ static PVRSRV_ERROR DevInitSGXPart1 (IMG_VOID *pvDeviceNode) psDevInfo->sKernelPDDevPAddr = sPDDevPAddr; - + for(i=0; isDevMemoryInfo.ui32HeapCount; i++) { switch(psDeviceMemoryHeap[i].DevMemHeapType) @@ -655,12 +670,12 @@ static PVRSRV_ERROR DevInitSGXPart1 (IMG_VOID *pvDeviceNode) case DEVICE_MEMORY_HEAP_SHARED: case DEVICE_MEMORY_HEAP_SHARED_EXPORTED: { - + if (psDeviceMemoryHeap[i].ui32HeapSize > 0) { hDevMemHeap = BM_CreateHeap (hKernelDevMemContext, &psDeviceMemoryHeap[i]); - + psDeviceMemoryHeap[i].hDevMemHeap = hDevMemHeap; @@ -672,7 +687,7 @@ static PVRSRV_ERROR DevInitSGXPart1 (IMG_VOID *pvDeviceNode) #if defined(PDUMP) if(hDevMemHeap) { - + psDevInfo->sMMUAttrib = *((BM_HEAP*)hDevMemHeap)->psMMUAttrib; } #endif @@ -740,7 +755,7 @@ PVRSRV_ERROR DevInitSGXPart2KM (PVRSRV_PER_PROCESS_DATA *psPerProc, psDeviceNode = (PVRSRV_DEVICE_NODE *)hDevHandle; psDevInfo = (PVRSRV_SGXDEV_INFO *)psDeviceNode->pvDevice; - + eError = InitDevInfo(psPerProc, psDeviceNode, psInitInfo); if (eError != PVRSRV_OK) @@ -758,14 +773,14 @@ PVRSRV_ERROR DevInitSGXPart2KM (PVRSRV_PER_PROCESS_DATA *psPerProc, return PVRSRV_ERROR_INIT_FAILURE; } - + if (psSGXDeviceMap->pvRegsCpuVBase) { psDevInfo->pvRegsBaseKM = psSGXDeviceMap->pvRegsCpuVBase; } else { - + psDevInfo->pvRegsBaseKM = OSMapPhysToLin(psSGXDeviceMap->sRegsCpuPBase, psSGXDeviceMap->ui32RegsSize, PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, @@ -783,7 +798,7 @@ PVRSRV_ERROR DevInitSGXPart2KM (PVRSRV_PER_PROCESS_DATA *psPerProc, #if defined(SGX_FEATURE_HOST_PORT) if (psSGXDeviceMap->ui32Flags & SGX_HOSTPORT_PRESENT) { - + psDevInfo->pvHostPortBaseKM = OSMapPhysToLin(psSGXDeviceMap->sHPCpuPBase, psSGXDeviceMap->ui32HPSize, PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, @@ -800,17 +815,17 @@ PVRSRV_ERROR DevInitSGXPart2KM (PVRSRV_PER_PROCESS_DATA *psPerProc, #if defined (SYS_USING_INTERRUPTS) - + psDeviceNode->pvISRData = psDeviceNode; - + PVR_ASSERT(psDeviceNode->pfnDeviceISR == SGX_ISRHandler); -#endif - +#endif + psDevInfo->psSGXHostCtl->ui32PowerStatus |= PVRSRV_USSE_EDM_POWMAN_NO_WORK; eDefaultPowerState = PVRSRV_DEV_POWER_STATE_OFF; - + eError = PVRSRVRegisterPowerDevice (psDeviceNode->sDevId.ui32DeviceIndex, &SGXPrePowerState, &SGXPostPowerState, &SGXPreClockSpeedChange, &SGXPostClockSpeedChange, @@ -830,10 +845,10 @@ PVRSRV_ERROR DevInitSGXPart2KM (PVRSRV_PER_PROCESS_DATA *psPerProc, PVR_DPF((PVR_DBG_ERROR,"SGXInitialise : Failed to alloc memory for BRN22997 workaround")); return eError; } -#endif +#endif #if defined(SUPPORT_EXTERNAL_SYSTEM_CACHE) - + psDevInfo->ui32ExtSysCacheRegsSize = psSGXDeviceMap->ui32ExtSysCacheRegsSize; psDevInfo->sExtSysCacheRegsDevPBase = psSGXDeviceMap->sExtSysCacheRegsDevPBase; eError = MMU_MapExtSystemCacheRegs(psDeviceNode); @@ -842,9 +857,9 @@ PVRSRV_ERROR DevInitSGXPart2KM (PVRSRV_PER_PROCESS_DATA *psPerProc, PVR_DPF((PVR_DBG_ERROR,"SGXInitialise : Failed to map external system cache registers")); return eError; } -#endif - +#endif + OSMemSet(psDevInfo->psKernelCCB, 0, sizeof(PVRSRV_SGX_KERNEL_CCB)); OSMemSet(psDevInfo->psKernelCCBCtl, 0, sizeof(PVRSRV_SGX_CCB_CTL)); @@ -873,7 +888,7 @@ static PVRSRV_ERROR DevDeInitSGX (IMG_VOID *pvDeviceNode) if (!psDevInfo) { - + PVR_DPF((PVR_DBG_ERROR,"DevDeInitSGX: Null DevInfo")); return PVRSRV_OK; } @@ -889,29 +904,29 @@ static PVRSRV_ERROR DevDeInitSGX (IMG_VOID *pvDeviceNode) } psDevInfo->hTimer = IMG_NULL; } -#endif +#endif #if defined(SUPPORT_EXTERNAL_SYSTEM_CACHE) - + eError = MMU_UnmapExtSystemCacheRegs(psDeviceNode); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"DevDeInitSGX: Failed to unmap ext system cache registers")); return eError; } -#endif +#endif #if defined(FIX_HW_BRN_22997) && defined(FIX_HW_BRN_23030) && defined(SGX_FEATURE_HOST_PORT) WorkaroundBRN22997Free(psDeviceNode); -#endif +#endif MMU_BIFResetPDFree(psDevInfo); - + DeinitDevInfo(psDevInfo); - + psDeviceMemoryHeap = (DEVICE_MEMORY_HEAP_INFO *)psDevInfo->pvDeviceMemoryHeap; for(ui32Heap=0; ui32HeapsDevMemoryInfo.ui32HeapCount; ui32Heap++) { @@ -930,7 +945,7 @@ static PVRSRV_ERROR DevDeInitSGX (IMG_VOID *pvDeviceNode) } } - + eError = BM_DestroyContext(psDeviceNode->sDevMemoryInfo.pBMKernelContext, IMG_NULL); if (eError != PVRSRV_OK) { @@ -938,7 +953,7 @@ static PVRSRV_ERROR DevDeInitSGX (IMG_VOID *pvDeviceNode) return eError; } - + eError = PVRSRVRemovePowerDevice (((PVRSRV_DEVICE_NODE*)pvDeviceNode)->sDevId.ui32DeviceIndex); if (eError != PVRSRV_OK) { @@ -953,10 +968,10 @@ static PVRSRV_ERROR DevDeInitSGX (IMG_VOID *pvDeviceNode) return eError; } - + if (!psSGXDeviceMap->pvRegsCpuVBase) { - + if (psDevInfo->pvRegsBaseKM != IMG_NULL) { OSUnMapPhysToLin(psDevInfo->pvRegsBaseKM, @@ -969,7 +984,7 @@ static PVRSRV_ERROR DevDeInitSGX (IMG_VOID *pvDeviceNode) #if defined(SGX_FEATURE_HOST_PORT) if (psSGXDeviceMap->ui32Flags & SGX_HOSTPORT_PRESENT) { - + if (psDevInfo->pvHostPortBaseKM != IMG_NULL) { OSUnMapPhysToLin(psDevInfo->pvHostPortBaseKM, @@ -978,10 +993,10 @@ static PVRSRV_ERROR DevDeInitSGX (IMG_VOID *pvDeviceNode) IMG_NULL); } } -#endif - +#endif + OSFreeMem(PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_SGXDEV_INFO), psDevInfo, @@ -991,7 +1006,7 @@ static PVRSRV_ERROR DevDeInitSGX (IMG_VOID *pvDeviceNode) if (psDeviceMemoryHeap != IMG_NULL) { - + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(DEVICE_MEMORY_HEAP_INFO) * SGX_MAX_HEAP_ID, psDeviceMemoryHeap, @@ -1013,7 +1028,7 @@ static IMG_VOID SGXDumpMasterDebugReg (PVRSRV_SGXDEV_INFO *psDevInfo, PVR_LOG(("(HYD) %s%08X", pszName, ui32RegVal)); } -#endif +#endif static IMG_VOID SGXDumpDebugReg (PVRSRV_SGXDEV_INFO *psDevInfo, IMG_UINT32 ui32CoreNum, @@ -1062,7 +1077,7 @@ IMG_VOID SGXDumpDebugInfo (PVRSRV_SGXDEV_INFO *psDevInfo, #endif for (ui32CoreNum = 0; ui32CoreNum < SGX_FEATURE_MP_CORE_COUNT_3D; ui32CoreNum++) { - + SGXDumpDebugReg(psDevInfo, ui32CoreNum, "EUR_CR_EVENT_STATUS: ", EUR_CR_EVENT_STATUS); SGXDumpDebugReg(psDevInfo, ui32CoreNum, "EUR_CR_EVENT_STATUS2: ", EUR_CR_EVENT_STATUS2); SGXDumpDebugReg(psDevInfo, ui32CoreNum, "EUR_CR_BIF_CTRL: ", EUR_CR_BIF_CTRL); @@ -1077,14 +1092,34 @@ IMG_VOID SGXDumpDebugInfo (PVRSRV_SGXDEV_INFO *psDevInfo, SGXDumpDebugReg(psDevInfo, ui32CoreNum, "EUR_CR_PDS_PC_BASE: ", EUR_CR_PDS_PC_BASE); #endif } - } +#if !defined(SGX_FEATURE_MULTIPLE_MEM_CONTEXTS) && !defined(FIX_HW_BRN_31620) + { + IMG_UINT32 ui32RegVal; + IMG_UINT32 ui32PDDevPAddr; + + + + + ui32RegVal = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_INT_STAT); + if (ui32RegVal & EUR_CR_BIF_INT_STAT_PF_N_RW_MASK) + { + ui32RegVal = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_FAULT); + ui32RegVal &= EUR_CR_BIF_FAULT_ADDR_MASK; + ui32PDDevPAddr = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_DIR_LIST_BASE0); + ui32PDDevPAddr &= EUR_CR_BIF_DIR_LIST_BASE0_ADDR_MASK; + MMU_CheckFaultAddr(psDevInfo, ui32PDDevPAddr, ui32RegVal); + } + } +#endif + } + QueueDumpDebugInfo(); { - + SGXMKIF_HOST_CTL *psSGXHostCtl = psDevInfo->psSGXHostCtl; IMG_UINT32 *pui32HostCtlBuffer = (IMG_UINT32 *)psSGXHostCtl; @@ -1109,7 +1144,7 @@ IMG_VOID SGXDumpDebugInfo (PVRSRV_SGXDEV_INFO *psDevInfo, } { - + IMG_UINT32 *pui32TA3DCtlBuffer = psDevInfo->psKernelSGXTA3DCtlMemInfo->pvLinAddrKM; IMG_UINT32 ui32LoopCounter; @@ -1136,10 +1171,11 @@ IMG_VOID SGXDumpDebugInfo (PVRSRV_SGXDEV_INFO *psDevInfo, ui32WriteOffset = *pui32MKTraceBuffer; pui32MKTraceBuffer++; - PVR_LOG(("Last SGX microkernel status code: %08X", ui32LastStatusCode)); + PVR_LOG(("Last SGX microkernel status code: %08X %s", + ui32LastStatusCode, SGXUKernelStatusString(ui32LastStatusCode))); #if defined(PVRSRV_DUMP_MK_TRACE) - + { IMG_UINT32 ui32LoopCounter; @@ -1151,16 +1187,17 @@ IMG_VOID SGXDumpDebugInfo (PVRSRV_SGXDEV_INFO *psDevInfo, IMG_UINT32 *pui32BufPtr; pui32BufPtr = pui32MKTraceBuffer + (((ui32WriteOffset + ui32LoopCounter) % SGXMK_TRACE_BUFFER_SIZE) * 4); - PVR_LOG(("\t(MKT-%X) %08X %08X %08X %08X", ui32LoopCounter, - pui32BufPtr[2], pui32BufPtr[3], pui32BufPtr[1], pui32BufPtr[0])); + PVR_LOG(("\t(MKT-%X) %08X %08X %08X %08X %s", ui32LoopCounter, + pui32BufPtr[2], pui32BufPtr[3], pui32BufPtr[1], pui32BufPtr[0], + SGXUKernelStatusString(pui32BufPtr[0]))); } } - #endif + #endif } - #endif + #endif { - + PVR_LOG(("SGX Kernel CCB WO:0x%X RO:0x%X", psDevInfo->psKernelCCBCtl->ui32WriteOffset, @@ -1183,7 +1220,7 @@ IMG_VOID SGXDumpDebugInfo (PVRSRV_SGXDEV_INFO *psDevInfo, psCommand->ui32Data[2], psCommand->ui32Data[3])); } } - #endif + #endif } #if defined (TTRACE) PVRSRVDumpTimeTraceBuffers(); @@ -1204,12 +1241,12 @@ IMG_VOID HWRecoveryResetSGX (PVRSRV_DEVICE_NODE *psDeviceNode, PVR_UNREFERENCED_PARAMETER(ui32Component); - + eError = PVRSRVPowerLock(ui32CallerID, IMG_FALSE); if(eError != PVRSRV_OK) { - + PVR_DPF((PVR_DBG_WARNING,"HWRecoveryResetSGX: Power transition in progress")); @@ -1222,14 +1259,14 @@ IMG_VOID HWRecoveryResetSGX (PVRSRV_DEVICE_NODE *psDeviceNode, SGXDumpDebugInfo(psDeviceNode->pvDevice, IMG_TRUE); - + PDUMPSUSPEND(); - + #if defined(FIX_HW_BRN_23281) - + for (eError = PVRSRV_ERROR_RETRY; eError == PVRSRV_ERROR_RETRY;) -#endif +#endif { eError = SGXInitialise(psDevInfo, IMG_TRUE); } @@ -1238,19 +1275,19 @@ IMG_VOID HWRecoveryResetSGX (PVRSRV_DEVICE_NODE *psDeviceNode, PVR_DPF((PVR_DBG_ERROR,"HWRecoveryResetSGX: SGXInitialise failed (%d)", eError)); } - + PDUMPRESUME(); PVRSRVPowerUnlock(ui32CallerID); - + SGXScheduleProcessQueuesKM(psDeviceNode); - - + + PVRSRVProcessQueues(IMG_TRUE); } -#endif +#endif #if defined(SUPPORT_HW_RECOVERY) @@ -1259,7 +1296,7 @@ IMG_VOID SGXOSTimer(IMG_VOID *pvData) PVRSRV_DEVICE_NODE *psDeviceNode = pvData; PVRSRV_SGXDEV_INFO *psDevInfo = psDeviceNode->pvDevice; static IMG_UINT32 ui32EDMTasks = 0; - static IMG_UINT32 ui32LockupCounter = 0; + static IMG_UINT32 ui32LockupCounter = 0; static IMG_UINT32 ui32OpenCLDelayCounter = 0; static IMG_UINT32 ui32NumResets = 0; #if defined(FIX_HW_BRN_31093) @@ -1270,17 +1307,17 @@ IMG_VOID SGXOSTimer(IMG_VOID *pvData) IMG_BOOL bLockup = IMG_FALSE; IMG_BOOL bPoweredDown; - + psDevInfo->ui32TimeStamp++; #if defined(NO_HARDWARE) bPoweredDown = IMG_TRUE; #else bPoweredDown = (SGXIsDevicePowered(psDeviceNode)) ? IMG_FALSE : IMG_TRUE; -#endif - - +#endif + + if (bPoweredDown) { ui32LockupCounter = 0; @@ -1290,7 +1327,7 @@ IMG_VOID SGXOSTimer(IMG_VOID *pvData) } else { - + ui32CurrentEDMTasks = OSReadHWReg(psDevInfo->pvRegsBaseKM, psDevInfo->ui32EDMTaskReg0); if (psDevInfo->ui32EDMTaskReg1 != 0) { @@ -1319,24 +1356,24 @@ IMG_VOID SGXOSTimer(IMG_VOID *pvData) #if defined(FIX_HW_BRN_31093) if (bBRN31093Inval == IMG_FALSE) { - + #if defined(FIX_HW_BRN_29997) IMG_UINT32 ui32BIFCtrl; - + ui32BIFCtrl = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_CTRL); OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_CTRL, ui32BIFCtrl | EUR_CR_BIF_CTRL_PAUSE_MASK); - + SGXWaitClocks(psDevInfo, 200); #endif - + bBRN31093Inval = IMG_TRUE; - + OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_CTRL_INVAL, EUR_CR_BIF_CTRL_INVAL_PTE_MASK); - + SGXWaitClocks(psDevInfo, 200); - - #if defined(FIX_HW_BRN_29997) - + + #if defined(FIX_HW_BRN_29997) + OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_CTRL, ui32BIFCtrl); #endif } @@ -1366,14 +1403,14 @@ SGX_NoUKernel_LockUp: { SGXMKIF_HOST_CTL *psSGXHostCtl = (SGXMKIF_HOST_CTL *)psDevInfo->psSGXHostCtl; - + psSGXHostCtl->ui32HostDetectedLockups ++; - + HWRecoveryResetSGX(psDeviceNode, 0, ISR_ID); } } -#endif +#endif @@ -1384,18 +1421,18 @@ IMG_BOOL SGX_ISRHandler (IMG_VOID *pvData) IMG_BOOL bInterruptProcessed = IMG_FALSE; - + { IMG_UINT32 ui32EventStatus, ui32EventEnable; IMG_UINT32 ui32EventClear = 0; #if defined(SGX_FEATURE_DATA_BREAKPOINTS) IMG_UINT32 ui32EventStatus2, ui32EventEnable2; -#endif +#endif IMG_UINT32 ui32EventClear2 = 0; PVRSRV_DEVICE_NODE *psDeviceNode; PVRSRV_SGXDEV_INFO *psDevInfo; - + if(pvData == IMG_NULL) { PVR_DPF((PVR_DBG_ERROR, "SGX_ISRHandler: Invalid params\n")); @@ -1408,18 +1445,18 @@ IMG_BOOL SGX_ISRHandler (IMG_VOID *pvData) ui32EventStatus = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_STATUS); ui32EventEnable = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_HOST_ENABLE); - + ui32EventStatus &= ui32EventEnable; #if defined(SGX_FEATURE_DATA_BREAKPOINTS) ui32EventStatus2 = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_STATUS2); ui32EventEnable2 = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_HOST_ENABLE2); - + ui32EventStatus2 &= ui32EventEnable2; -#endif - +#endif + if (ui32EventStatus & EUR_CR_EVENT_STATUS_SW_EVENT_MASK) { @@ -1436,16 +1473,16 @@ IMG_BOOL SGX_ISRHandler (IMG_VOID *pvData) { ui32EventClear2 |= EUR_CR_EVENT_HOST_CLEAR2_DATA_BREAKPOINT_TRAPPED_MASK; } -#endif +#endif if (ui32EventClear || ui32EventClear2) { bInterruptProcessed = IMG_TRUE; - + ui32EventClear |= EUR_CR_EVENT_HOST_CLEAR_MASTER_INTERRUPT_MASK; - + OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_HOST_CLEAR, ui32EventClear); OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_HOST_CLEAR2, ui32EventClear2); } @@ -1476,7 +1513,7 @@ static IMG_VOID SGX_MISRHandler (IMG_VOID *pvData) SGXTestActivePowerEvent(psDeviceNode, ISR_ID); } -#endif +#endif #if defined(SUPPORT_MEMORY_TILING) @@ -1507,21 +1544,21 @@ PVRSRV_ERROR SGX_FreeMemTilingRange(PVRSRV_DEVICE_NODE *psDeviceNode, return PVRSRV_ERROR_INVALID_PARAMS; } - + psDevInfo->ui32MemTilingUsage &= ~(1<pvRegsBaseKM, ui32Offset, ui32Val); PDUMPREG(SGX_PDUMPREG_NAME, ui32Offset, ui32Val); return PVRSRV_OK; } -#endif +#endif static IMG_VOID SGXCacheInvalidate(PVRSRV_DEVICE_NODE *psDeviceNode) @@ -1532,7 +1569,7 @@ static IMG_VOID SGXCacheInvalidate(PVRSRV_DEVICE_NODE *psDeviceNode) psDevInfo->ui32CacheControl |= SGXMKIF_CC_INVAL_BIF_SL; #else PVR_UNREFERENCED_PARAMETER(psDevInfo); - #endif + #endif } PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) @@ -1540,12 +1577,12 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) DEVICE_MEMORY_INFO *psDevMemoryInfo; DEVICE_MEMORY_HEAP_INFO *psDeviceMemoryHeap; - + psDeviceNode->sDevId.eDeviceType = DEV_DEVICE_TYPE; psDeviceNode->sDevId.eDeviceClass = DEV_DEVICE_CLASS; #if defined(PDUMP) { - + SGX_DEVICE_MAP *psSGXDeviceMemMap; SysGetDeviceMemoryMap(PVRSRV_DEVICE_TYPE_SGX, (IMG_VOID**)&psSGXDeviceMemMap); @@ -1553,9 +1590,9 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceNode->sDevId.pszPDumpDevName = psSGXDeviceMemMap->pszPDumpDevName; PVR_ASSERT(psDeviceNode->sDevId.pszPDumpDevName != IMG_NULL); } - + psDeviceNode->sDevId.pszPDumpRegName = SGX_PDUMPREG_NAME; -#endif +#endif psDeviceNode->pfnInitDevice = &DevInitSGXPart1; psDeviceNode->pfnDeInitDevice = &DevDeInitSGX; @@ -1565,7 +1602,7 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceNode->pfnPDumpInitDevice = &SGXResetPDump; psDeviceNode->pfnMMUGetContextID = &MMU_GetPDumpContextID; #endif - + psDeviceNode->pfnMMUInitialise = &MMU_Initialise; psDeviceNode->pfnMMUFinalise = &MMU_Finalise; @@ -1591,7 +1628,7 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceNode->pfnMMUGetPDPhysAddr = IMG_NULL; #endif #if defined (SYS_USING_INTERRUPTS) - + psDeviceNode->pfnDeviceISR = SGX_ISRHandler; psDeviceNode->pfnDeviceMISR = SGX_MISRHandler; @@ -1602,22 +1639,22 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceNode->pfnFreeMemTilingRange = SGX_FreeMemTilingRange; #endif - + psDeviceNode->pfnDeviceCommandComplete = &SGXCommandComplete; psDeviceNode->pfnCacheInvalidate = SGXCacheInvalidate; - + psDevMemoryInfo = &psDeviceNode->sDevMemoryInfo; - + psDevMemoryInfo->ui32AddressSpaceSizeLog2 = SGX_FEATURE_ADDRESS_SPACE_SIZE; - + psDevMemoryInfo->ui32Flags = 0; - + if(OSAllocMem( PVRSRV_OS_PAGEABLE_HEAP, sizeof(DEVICE_MEMORY_HEAP_INFO) * SGX_MAX_HEAP_ID, (IMG_VOID **)&psDevMemoryInfo->psDeviceMemoryHeap, 0, @@ -1630,10 +1667,10 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceMemoryHeap = psDevMemoryInfo->psDeviceMemoryHeap; + - - + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_GENERAL_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_GENERAL_HEAP_BASE; psDeviceMemoryHeap->ui32HeapSize = SGX_GENERAL_HEAP_SIZE; @@ -1643,16 +1680,16 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceMemoryHeap->pszName = "General"; psDeviceMemoryHeap->pszBSName = "General BS"; psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_PERCONTEXT; - + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; #if !defined(SUPPORT_SGX_GENERAL_MAPPING_HEAP) - + psDevMemoryInfo->ui32MappingHeapID = (IMG_UINT32)(psDeviceMemoryHeap - psDevMemoryInfo->psDeviceMemoryHeap); #endif psDeviceMemoryHeap++; #if defined(SUPPORT_MEMORY_TILING) - + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_VPB_TILED_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_VPB_TILED_HEAP_BASE; psDeviceMemoryHeap->ui32HeapSize = SGX_VPB_TILED_HEAP_SIZE; @@ -1662,14 +1699,14 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceMemoryHeap->pszName = "VPB Tiled"; psDeviceMemoryHeap->pszBSName = "VPB Tiled BS"; psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_PERCONTEXT; - + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; psDeviceMemoryHeap->ui32XTileStride = SGX_VPB_TILED_HEAP_STRIDE; PVR_DPF((PVR_DBG_WARNING, "VPB tiling heap tiling stride = 0x%x", psDeviceMemoryHeap->ui32XTileStride)); psDeviceMemoryHeap++; #endif - + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_TADATA_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_TADATA_HEAP_BASE; psDeviceMemoryHeap->ui32HeapSize = SGX_TADATA_HEAP_SIZE; @@ -1679,12 +1716,12 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceMemoryHeap->pszName = "TA Data"; psDeviceMemoryHeap->pszBSName = "TA Data BS"; psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_PERCONTEXT; - + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; psDeviceMemoryHeap++; - + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_KERNEL_CODE_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_KERNEL_CODE_HEAP_BASE; psDeviceMemoryHeap->ui32HeapSize = SGX_KERNEL_CODE_HEAP_SIZE; @@ -1694,12 +1731,12 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceMemoryHeap->pszName = "Kernel Code"; psDeviceMemoryHeap->pszBSName = "Kernel Code BS"; psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_SHARED_EXPORTED; - + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; psDeviceMemoryHeap++; - + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_KERNEL_DATA_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_KERNEL_DATA_HEAP_BASE; psDeviceMemoryHeap->ui32HeapSize = SGX_KERNEL_DATA_HEAP_SIZE; @@ -1709,15 +1746,15 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceMemoryHeap->pszName = "KernelData"; psDeviceMemoryHeap->pszBSName = "KernelData BS"; psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_SHARED_EXPORTED; - + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; psDeviceMemoryHeap++; - + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_PIXELSHADER_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_PIXELSHADER_HEAP_BASE; - + @@ -1731,15 +1768,15 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceMemoryHeap->pszName = "PixelShaderUSSE"; psDeviceMemoryHeap->pszBSName = "PixelShaderUSSE BS"; psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_PERCONTEXT; - + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; psDeviceMemoryHeap++; - + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_VERTEXSHADER_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_VERTEXSHADER_HEAP_BASE; - + psDeviceMemoryHeap->ui32HeapSize = ((4 << SGX_USE_CODE_SEGMENT_RANGE_BITS) - 0x00001000); PVR_ASSERT(psDeviceMemoryHeap->ui32HeapSize <= SGX_VERTEXSHADER_HEAP_SIZE); psDeviceMemoryHeap->ui32Attribs = PVRSRV_HAP_WRITECOMBINE @@ -1748,12 +1785,12 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceMemoryHeap->pszName = "VertexShaderUSSE"; psDeviceMemoryHeap->pszBSName = "VertexShaderUSSE BS"; psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_PERCONTEXT; - + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; psDeviceMemoryHeap++; - + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_PDSPIXEL_CODEDATA_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_PDSPIXEL_CODEDATA_HEAP_BASE; psDeviceMemoryHeap->ui32HeapSize = SGX_PDSPIXEL_CODEDATA_HEAP_SIZE; @@ -1763,12 +1800,12 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceMemoryHeap->pszName = "PDSPixelCodeData"; psDeviceMemoryHeap->pszBSName = "PDSPixelCodeData BS"; psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_PERCONTEXT; - + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; psDeviceMemoryHeap++; - + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_PDSVERTEX_CODEDATA_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_PDSVERTEX_CODEDATA_HEAP_BASE; psDeviceMemoryHeap->ui32HeapSize = SGX_PDSVERTEX_CODEDATA_HEAP_SIZE; @@ -1778,12 +1815,12 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceMemoryHeap->pszName = "PDSVertexCodeData"; psDeviceMemoryHeap->pszBSName = "PDSVertexCodeData BS"; psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_PERCONTEXT; - + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; psDeviceMemoryHeap++; - + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_SYNCINFO_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_SYNCINFO_HEAP_BASE; psDeviceMemoryHeap->ui32HeapSize = SGX_SYNCINFO_HEAP_SIZE; @@ -1793,14 +1830,14 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceMemoryHeap->pszName = "CacheCoherent"; psDeviceMemoryHeap->pszBSName = "CacheCoherent BS"; psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_SHARED_EXPORTED; - + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; - + psDevMemoryInfo->ui32SyncHeapID = (IMG_UINT32)(psDeviceMemoryHeap - psDevMemoryInfo->psDeviceMemoryHeap); psDeviceMemoryHeap++; - + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_SHARED_3DPARAMETERS_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_SHARED_3DPARAMETERS_HEAP_BASE; psDeviceMemoryHeap->ui32HeapSize = SGX_SHARED_3DPARAMETERS_HEAP_SIZE; @@ -1811,11 +1848,11 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) | PVRSRV_HAP_MULTI_PROCESS; psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_SHARED_EXPORTED; - + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; psDeviceMemoryHeap++; - + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_PERCONTEXT_3DPARAMETERS_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_PERCONTEXT_3DPARAMETERS_HEAP_BASE; psDeviceMemoryHeap->ui32HeapSize = SGX_PERCONTEXT_3DPARAMETERS_HEAP_SIZE; @@ -1825,13 +1862,13 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) | PVRSRV_MEM_RAM_BACKED_ALLOCATION | PVRSRV_HAP_SINGLE_PROCESS; psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_PERCONTEXT; - + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; psDeviceMemoryHeap++; #if defined(SUPPORT_SGX_GENERAL_MAPPING_HEAP) - + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_GENERAL_MAPPING_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_GENERAL_MAPPING_HEAP_BASE; psDeviceMemoryHeap->ui32HeapSize = SGX_GENERAL_MAPPING_HEAP_SIZE; @@ -1841,7 +1878,7 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceMemoryHeap->pszName = "GeneralMapping"; psDeviceMemoryHeap->pszBSName = "GeneralMapping BS"; #if defined(SGX_FEATURE_MULTIPLE_MEM_CONTEXTS) && defined(FIX_HW_BRN_23410) - + @@ -1849,20 +1886,20 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_SHARED_EXPORTED; - #else + #else psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_PERCONTEXT; - #endif - + #endif + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; - + psDevMemoryInfo->ui32MappingHeapID = (IMG_UINT32)(psDeviceMemoryHeap - psDevMemoryInfo->psDeviceMemoryHeap); psDeviceMemoryHeap++; -#endif +#endif #if defined(SGX_FEATURE_2D_HARDWARE) - + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_2D_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_2D_HEAP_BASE; psDeviceMemoryHeap->ui32HeapSize = SGX_2D_HEAP_SIZE; @@ -1871,17 +1908,17 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) | PVRSRV_HAP_SINGLE_PROCESS; psDeviceMemoryHeap->pszName = "2D"; psDeviceMemoryHeap->pszBSName = "2D BS"; - + psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_SHARED_EXPORTED; - + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; psDeviceMemoryHeap++; -#endif +#endif #if defined(FIX_HW_BRN_26915) - - + + psDeviceMemoryHeap->ui32HeapID = HEAP_ID( PVRSRV_DEVICE_TYPE_SGX, SGX_CGBUFFER_HEAP_ID); psDeviceMemoryHeap->sDevVAddrBase.uiAddr = SGX_CGBUFFER_HEAP_BASE; psDeviceMemoryHeap->ui32HeapSize = SGX_CGBUFFER_HEAP_SIZE; @@ -1892,12 +1929,12 @@ PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode) psDeviceMemoryHeap->pszBSName = "CGBuffer BS"; psDeviceMemoryHeap->DevMemHeapType = DEVICE_MEMORY_HEAP_PERCONTEXT; - + psDeviceMemoryHeap->ui32DataPageSize = SGX_MMU_PAGE_SIZE; psDeviceMemoryHeap++; -#endif - +#endif + psDevMemoryInfo->ui32HeapCount = (IMG_UINT32)(psDeviceMemoryHeap - psDevMemoryInfo->psDeviceMemoryHeap); return PVRSRV_OK; @@ -1910,10 +1947,10 @@ PVRSRV_ERROR SGXResetPDump(PVRSRV_DEVICE_NODE *psDeviceNode) PVRSRV_SGXDEV_INFO *psDevInfo = (PVRSRV_SGXDEV_INFO *)(psDeviceNode->pvDevice); psDevInfo->psKernelCCBInfo->ui32CCBDumpWOff = 0; PVR_DPF((PVR_DBG_MESSAGE, "Reset pdump CCB write offset.")); - + return PVRSRV_OK; } -#endif +#endif IMG_EXPORT @@ -1922,19 +1959,19 @@ PVRSRV_ERROR SGXGetClientInfoKM(IMG_HANDLE hDevCookie, { PVRSRV_SGXDEV_INFO *psDevInfo = (PVRSRV_SGXDEV_INFO *)((PVRSRV_DEVICE_NODE *)hDevCookie)->pvDevice; - + psDevInfo->ui32ClientRefCount++; - + psClientInfo->ui32ProcessID = OSGetCurrentProcessIDKM(); - + OSMemCopy(&psClientInfo->asDevData, &psDevInfo->asSGXDevData, sizeof(psClientInfo->asDevData)); - + return PVRSRV_OK; } @@ -1954,12 +1991,12 @@ PVRSRV_ERROR SGXDevInitCompatCheck(PVRSRV_DEVICE_NODE *psDeviceNode) IMG_UINT32 ui32BuildOptions, ui32BuildOptionsMismatch; #if !defined(NO_HARDWARE) PPVRSRV_KERNEL_MEM_INFO psMemInfo; - PVRSRV_SGX_MISCINFO_INFO *psSGXMiscInfoInt; + PVRSRV_SGX_MISCINFO_INFO *psSGXMiscInfoInt; PVRSRV_SGX_MISCINFO_FEATURES *psSGXFeatures; - SGX_MISCINFO_STRUCT_SIZES *psSGXStructSizes; + SGX_MISCINFO_STRUCT_SIZES *psSGXStructSizes; IMG_BOOL bStructSizesFailed; - + IMG_BOOL bCheckCoreRev; const IMG_UINT32 aui32CoreRevExceptions[] = { @@ -1969,7 +2006,7 @@ PVRSRV_ERROR SGXDevInitCompatCheck(PVRSRV_DEVICE_NODE *psDeviceNode) IMG_UINT i; #endif - + if(psDeviceNode->sDevId.eDeviceType != PVRSRV_DEVICE_TYPE_SGX) { PVR_LOG(("(FAIL) SGXInit: Device not of type SGX")); @@ -1979,8 +2016,8 @@ PVRSRV_ERROR SGXDevInitCompatCheck(PVRSRV_DEVICE_NODE *psDeviceNode) psDevInfo = psDeviceNode->pvDevice; - - + + ui32BuildOptions = (SGX_BUILD_OPTIONS); if (ui32BuildOptions != psDevInfo->ui32ClientBuildOptions) { @@ -2009,13 +2046,13 @@ PVRSRV_ERROR SGXDevInitCompatCheck(PVRSRV_DEVICE_NODE *psDeviceNode) #if !defined (NO_HARDWARE) psMemInfo = psDevInfo->psKernelSGXMiscMemInfo; - + psSGXMiscInfoInt = psMemInfo->pvLinAddrKM; psSGXMiscInfoInt->ui32MiscInfoFlags = 0; psSGXMiscInfoInt->ui32MiscInfoFlags |= PVRSRV_USSE_MISCINFO_GET_STRUCT_SIZES; eError = SGXGetMiscInfoUkernel(psDevInfo, psDeviceNode, IMG_NULL); - + if(eError != PVRSRV_OK) { PVR_LOG(("(FAIL) SGXInit: Unable to validate device DDK version")); @@ -2039,17 +2076,17 @@ PVRSRV_ERROR SGXDevInitCompatCheck(PVRSRV_DEVICE_NODE *psDeviceNode) PVRVERSION_BUILD, psSGXFeatures->ui32DDKBuild)); } - + if (psSGXFeatures->ui32CoreRevSW == 0) { - + PVR_LOG(("SGXInit: HW core rev (%x) check skipped.", psSGXFeatures->ui32CoreRev)); } else { - + bCheckCoreRev = IMG_TRUE; for(i=0; ipvLinAddrKM))->sSGXStructSizes; bStructSizesFailed = IMG_FALSE; @@ -2115,7 +2152,7 @@ PVRSRV_ERROR SGXDevInitCompatCheck(PVRSRV_DEVICE_NODE *psDeviceNode) PVR_DPF((PVR_DBG_MESSAGE, "SGXInit: SGXMKIF structure sizes match. [ OK ]")); } - + ui32BuildOptions = psSGXFeatures->ui32BuildOptions; if (ui32BuildOptions != (SGX_BUILD_OPTIONS)) { @@ -2140,7 +2177,7 @@ PVRSRV_ERROR SGXDevInitCompatCheck(PVRSRV_DEVICE_NODE *psDeviceNode) { PVR_DPF((PVR_DBG_MESSAGE, "SGXInit: Driver and microkernel build options match. [ OK ]")); } -#endif +#endif eError = PVRSRV_OK; chk_exit: @@ -2157,10 +2194,10 @@ PVRSRV_ERROR SGXGetMiscInfoUkernel(PVRSRV_SGXDEV_INFO *psDevInfo, IMG_HANDLE hDevMemContext) { PVRSRV_ERROR eError; - SGXMKIF_COMMAND sCommandData; - PVRSRV_SGX_MISCINFO_INFO *psSGXMiscInfoInt; - PVRSRV_SGX_MISCINFO_FEATURES *psSGXFeatures; - SGX_MISCINFO_STRUCT_SIZES *psSGXStructSizes; + SGXMKIF_COMMAND sCommandData; + PVRSRV_SGX_MISCINFO_INFO *psSGXMiscInfoInt; + PVRSRV_SGX_MISCINFO_FEATURES *psSGXFeatures; + SGX_MISCINFO_STRUCT_SIZES *psSGXStructSizes; PPVRSRV_KERNEL_MEM_INFO psMemInfo = psDevInfo->psKernelSGXMiscMemInfo; @@ -2175,12 +2212,12 @@ PVRSRV_ERROR SGXGetMiscInfoUkernel(PVRSRV_SGXDEV_INFO *psDevInfo, psSGXMiscInfoInt->ui32MiscInfoFlags &= ~PVRSRV_USSE_MISCINFO_READY; - + OSMemSet(psSGXFeatures, 0, sizeof(*psSGXFeatures)); OSMemSet(psSGXStructSizes, 0, sizeof(*psSGXStructSizes)); - - sCommandData.ui32Data[1] = psMemInfo->sDevVAddr.uiAddr; + + sCommandData.ui32Data[1] = psMemInfo->sDevVAddr.uiAddr; PDUMPCOMMENT("Microkernel kick for SGXGetMiscInfo"); eError = SGXScheduleCCBCommandKM(psDeviceNode, @@ -2197,7 +2234,7 @@ PVRSRV_ERROR SGXGetMiscInfoUkernel(PVRSRV_SGXDEV_INFO *psDevInfo, return eError; } - + #if !defined(NO_HARDWARE) { IMG_BOOL bExit; @@ -2212,14 +2249,14 @@ PVRSRV_ERROR SGXGetMiscInfoUkernel(PVRSRV_SGXDEV_INFO *psDevInfo, } } END_LOOP_UNTIL_TIMEOUT(); - + if (!bExit) { PVR_DPF((PVR_DBG_ERROR, "SGXGetMiscInfoUkernel: Timeout occurred waiting for misc info.")); return PVRSRV_ERROR_TIMEOUT; } } -#endif +#endif return PVRSRV_OK; } @@ -2236,7 +2273,7 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, PPVRSRV_KERNEL_MEM_INFO psMemInfo = psDevInfo->psKernelSGXMiscMemInfo; IMG_UINT32 *pui32MiscInfoFlags = &((PVRSRV_SGX_MISCINFO_INFO*)(psMemInfo->pvLinAddrKM))->ui32MiscInfoFlags; - + *pui32MiscInfoFlags = 0; #if !defined(SUPPORT_SGX_EDM_MEMORY_DEBUG) @@ -2257,14 +2294,14 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, IMG_UINT32 ui32EndRegVal; SGXMKIF_COMMAND sCommandData; - + if(psMiscInfo->uData.sSGXBreakpointInfo.bBPEnable) { - + IMG_DEV_VIRTADDR sBPDevVAddr = psMiscInfo->uData.sSGXBreakpointInfo.sBPDevVAddr; IMG_DEV_VIRTADDR sBPDevVAddrEnd = psMiscInfo->uData.sSGXBreakpointInfo.sBPDevVAddrEnd; - + ui32StartRegVal = sBPDevVAddr.uiAddr & EUR_CR_BREAKPOINT0_START_ADDRESS_MASK; ui32EndRegVal = sBPDevVAddrEnd.uiAddr & EUR_CR_BREAKPOINT0_END_ADDRESS_MASK; @@ -2273,7 +2310,7 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, ui32CtrlREnable = psMiscInfo->uData.sSGXBreakpointInfo.bRead; ui32CtrlTrapEnable = psMiscInfo->uData.sSGXBreakpointInfo.bTrapped; - + ui32RegVal = ((ui32MaskDM<uData.sSGXBreakpointInfo.ui32BPIndex; sCommandData.ui32Data[1] = ui32StartRegVal; sCommandData.ui32Data[2] = ui32EndRegVal; sCommandData.ui32Data[3] = ui32RegVal; - + psDevInfo->psSGXHostCtl->ui32BPSetClearSignal = 0; PDUMPCOMMENT("Microkernel kick for setting a data breakpoint"); @@ -2310,7 +2347,7 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, } #if defined(NO_HARDWARE) - + psDevInfo->psSGXHostCtl->ui32BPSetClearSignal = 0; #else { @@ -2322,32 +2359,32 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, if (psDevInfo->psSGXHostCtl->ui32BPSetClearSignal != 0) { bExit = IMG_TRUE; - + psDevInfo->psSGXHostCtl->ui32BPSetClearSignal = 0; break; } } END_LOOP_UNTIL_TIMEOUT(); - + if (!bExit) { PVR_DPF((PVR_DBG_ERROR, "SGXGetMiscInfoKM: Timeout occurred waiting BP set/clear")); return PVRSRV_ERROR_TIMEOUT; } } -#endif +#endif return PVRSRV_OK; } case SGX_MISC_INFO_REQUEST_POLL_BREAKPOINT: { + - - + #if !defined(NO_HARDWARE) #if defined(SGX_FEATURE_MP) @@ -2358,7 +2395,7 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, #define NUM_PIPES_PLUS_ONE (SGX_FEATURE_PERPIPE_BKPT_REGS_NUMPIPES+1) #endif IMG_BOOL bTrappedBPAny; -#endif +#endif IMG_BOOL bFoundOne; #if defined(SGX_FEATURE_MP) @@ -2366,12 +2403,12 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, bTrappedBPMaster = !!(EUR_CR_MASTER_BREAKPOINT_TRAPPED_MASK & OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_BREAKPOINT)); bTrappedBPAny = bTrappedBPMaster; #if defined(SGX_FEATURE_PERPIPE_BKPT_REGS) - ui32TrappedBPPipeNum = 0; + ui32TrappedBPPipeNum = 0; #endif for (ui32CoreNum = 0; ui32CoreNum < SGX_FEATURE_MP_CORE_COUNT_3D; ui32CoreNum++) { #if defined(SGX_FEATURE_PERPIPE_BKPT_REGS) - + #define SGX_MP_CORE_PIPE_SELECT(r,c,p) \ @@ -2379,8 +2416,8 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, for (ui32PipeNum = 0; ui32PipeNum < NUM_PIPES_PLUS_ONE; ui32PipeNum++) { bFoundOne = - 0 != (EUR_CR_PARTITION_BREAKPOINT_TRAPPED_MASK & - OSReadHWReg(psDevInfo->pvRegsBaseKM, + 0 != (EUR_CR_PARTITION_BREAKPOINT_TRAPPED_MASK & + OSReadHWReg(psDevInfo->pvRegsBaseKM, SGX_MP_CORE_PIPE_SELECT(BREAKPOINT, ui32CoreNum, ui32PipeNum))); @@ -2391,23 +2428,23 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, ui32TrappedBPPipeNum = ui32PipeNum; } } -#else +#else bFoundOne = !!(EUR_CR_BREAKPOINT_TRAPPED_MASK & OSReadHWReg(psDevInfo->pvRegsBaseKM, SGX_MP_CORE_SELECT(EUR_CR_BREAKPOINT, ui32CoreNum))); if (bFoundOne) { bTrappedBPAny = IMG_TRUE; ui32TrappedBPCoreNum = ui32CoreNum; } -#endif +#endif } psMiscInfo->uData.sSGXBreakpointInfo.bTrappedBP = bTrappedBPAny; -#else +#else #if defined(SGX_FEATURE_PERPIPE_BKPT_REGS) #error Not yet considered the case for per-pipe regs in non-mp case #endif psMiscInfo->uData.sSGXBreakpointInfo.bTrappedBP = 0 != (EUR_CR_BREAKPOINT_TRAPPED_MASK & OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BREAKPOINT)); -#endif +#endif if (psMiscInfo->uData.sSGXBreakpointInfo.bTrappedBP) { @@ -2417,14 +2454,14 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, #if defined(SGX_FEATURE_PERPIPE_BKPT_REGS) ui32Info0 = OSReadHWReg(psDevInfo->pvRegsBaseKM, bTrappedBPMaster?EUR_CR_MASTER_BREAKPOINT_TRAP_INFO0:SGX_MP_CORE_PIPE_SELECT(BREAKPOINT_TRAP_INFO0, ui32TrappedBPCoreNum, ui32TrappedBPPipeNum)); ui32Info1 = OSReadHWReg(psDevInfo->pvRegsBaseKM, bTrappedBPMaster?EUR_CR_MASTER_BREAKPOINT_TRAP_INFO1:SGX_MP_CORE_PIPE_SELECT(BREAKPOINT_TRAP_INFO1, ui32TrappedBPCoreNum, ui32TrappedBPPipeNum)); -#else +#else ui32Info0 = OSReadHWReg(psDevInfo->pvRegsBaseKM, bTrappedBPMaster?EUR_CR_MASTER_BREAKPOINT_TRAP_INFO0:SGX_MP_CORE_SELECT(EUR_CR_BREAKPOINT_TRAP_INFO0, ui32TrappedBPCoreNum)); ui32Info1 = OSReadHWReg(psDevInfo->pvRegsBaseKM, bTrappedBPMaster?EUR_CR_MASTER_BREAKPOINT_TRAP_INFO1:SGX_MP_CORE_SELECT(EUR_CR_BREAKPOINT_TRAP_INFO1, ui32TrappedBPCoreNum)); -#endif -#else +#endif +#else ui32Info0 = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BREAKPOINT_TRAP_INFO0); ui32Info1 = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BREAKPOINT_TRAP_INFO1); -#endif +#endif #ifdef SGX_FEATURE_PERPIPE_BKPT_REGS psMiscInfo->uData.sSGXBreakpointInfo.ui32BPIndex = (ui32Info1 & EUR_CR_PARTITION_BREAKPOINT_TRAP_INFO1_NUMBER_MASK) >> EUR_CR_PARTITION_BREAKPOINT_TRAP_INFO1_NUMBER_SHIFT; @@ -2433,41 +2470,41 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, psMiscInfo->uData.sSGXBreakpointInfo.bTrappedBPRead = !!(ui32Info1 & EUR_CR_PARTITION_BREAKPOINT_TRAP_INFO1_RNW_MASK); psMiscInfo->uData.sSGXBreakpointInfo.ui32TrappedBPDataMaster = (ui32Info1 & EUR_CR_PARTITION_BREAKPOINT_TRAP_INFO1_DATA_MASTER_MASK) >> EUR_CR_PARTITION_BREAKPOINT_TRAP_INFO1_DATA_MASTER_SHIFT; psMiscInfo->uData.sSGXBreakpointInfo.ui32TrappedBPTag = (ui32Info1 & EUR_CR_PARTITION_BREAKPOINT_TRAP_INFO1_TAG_MASK) >> EUR_CR_PARTITION_BREAKPOINT_TRAP_INFO1_TAG_SHIFT; -#else +#else psMiscInfo->uData.sSGXBreakpointInfo.ui32BPIndex = (ui32Info1 & EUR_CR_BREAKPOINT_TRAP_INFO1_NUMBER_MASK) >> EUR_CR_BREAKPOINT_TRAP_INFO1_NUMBER_SHIFT; psMiscInfo->uData.sSGXBreakpointInfo.sTrappedBPDevVAddr.uiAddr = ui32Info0 & EUR_CR_BREAKPOINT_TRAP_INFO0_ADDRESS_MASK; psMiscInfo->uData.sSGXBreakpointInfo.ui32TrappedBPBurstLength = (ui32Info1 & EUR_CR_BREAKPOINT_TRAP_INFO1_SIZE_MASK) >> EUR_CR_BREAKPOINT_TRAP_INFO1_SIZE_SHIFT; psMiscInfo->uData.sSGXBreakpointInfo.bTrappedBPRead = !!(ui32Info1 & EUR_CR_BREAKPOINT_TRAP_INFO1_RNW_MASK); psMiscInfo->uData.sSGXBreakpointInfo.ui32TrappedBPDataMaster = (ui32Info1 & EUR_CR_BREAKPOINT_TRAP_INFO1_DATA_MASTER_MASK) >> EUR_CR_BREAKPOINT_TRAP_INFO1_DATA_MASTER_SHIFT; psMiscInfo->uData.sSGXBreakpointInfo.ui32TrappedBPTag = (ui32Info1 & EUR_CR_BREAKPOINT_TRAP_INFO1_TAG_MASK) >> EUR_CR_BREAKPOINT_TRAP_INFO1_TAG_SHIFT; -#endif +#endif #if defined(SGX_FEATURE_MP) #if defined(SGX_FEATURE_PERPIPE_BKPT_REGS) - + psMiscInfo->uData.sSGXBreakpointInfo.ui32CoreNum = bTrappedBPMaster?65535:(ui32TrappedBPCoreNum + (ui32TrappedBPPipeNum<<10)); -#else - +#else + psMiscInfo->uData.sSGXBreakpointInfo.ui32CoreNum = bTrappedBPMaster?65535:ui32TrappedBPCoreNum; -#endif -#else +#endif +#else #if defined(SGX_FEATURE_PERPIPE_BKPT_REGS) - + #error non-mp perpipe regs not yet supported -#else - +#else + psMiscInfo->uData.sSGXBreakpointInfo.ui32CoreNum = 65534; -#endif -#endif +#endif +#endif } -#endif +#endif return PVRSRV_OK; } case SGX_MISC_INFO_REQUEST_RESUME_BREAKPOINT: { - - - + + + #if !defined(NO_HARDWARE) #if defined(SGX_FEATURE_MP) IMG_UINT32 ui32CoreNum; @@ -2475,7 +2512,7 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, #if defined(SGX_FEATURE_PERPIPE_BKPT_REGS) IMG_UINT32 ui32PipeNum; #endif -#endif +#endif IMG_UINT32 ui32OldSeqNum, ui32NewSeqNum; #if defined(SGX_FEATURE_MP) @@ -2483,14 +2520,14 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, ui32PipeNum = psMiscInfo->uData.sSGXBreakpointInfo.ui32CoreNum >> 10; ui32CoreNum = psMiscInfo->uData.sSGXBreakpointInfo.ui32CoreNum & 1023; bMaster = psMiscInfo->uData.sSGXBreakpointInfo.ui32CoreNum > 32767; -#else +#else ui32CoreNum = psMiscInfo->uData.sSGXBreakpointInfo.ui32CoreNum; bMaster = ui32CoreNum > SGX_FEATURE_MP_CORE_COUNT_3D; -#endif +#endif if (bMaster) { - - + + ui32OldSeqNum = 0x1c & OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_BREAKPOINT); OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_BREAKPOINT_TRAP, EUR_CR_MASTER_BREAKPOINT_TRAP_WRNOTIFY_MASK | EUR_CR_MASTER_BREAKPOINT_TRAP_CONTINUE_MASK); do @@ -2500,9 +2537,9 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, while (ui32OldSeqNum == ui32NewSeqNum); } else -#endif +#endif { - + #if defined(SGX_FEATURE_PERPIPE_BKPT_REGS) ui32OldSeqNum = 0x1c & OSReadHWReg(psDevInfo->pvRegsBaseKM, SGX_MP_CORE_PIPE_SELECT(BREAKPOINT, ui32CoreNum, ui32PipeNum)); OSWriteHWReg(psDevInfo->pvRegsBaseKM, SGX_MP_CORE_PIPE_SELECT(BREAKPOINT_TRAP, ui32CoreNum, ui32PipeNum), EUR_CR_PARTITION_BREAKPOINT_TRAP_WRNOTIFY_MASK | EUR_CR_PARTITION_BREAKPOINT_TRAP_CONTINUE_MASK); @@ -2511,7 +2548,7 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, ui32NewSeqNum = 0x1c & OSReadHWReg(psDevInfo->pvRegsBaseKM, SGX_MP_CORE_PIPE_SELECT(BREAKPOINT, ui32CoreNum, ui32PipeNum)); } while (ui32OldSeqNum == ui32NewSeqNum); -#else +#else ui32OldSeqNum = 0x1c & OSReadHWReg(psDevInfo->pvRegsBaseKM, SGX_MP_CORE_SELECT(EUR_CR_BREAKPOINT, ui32CoreNum)); OSWriteHWReg(psDevInfo->pvRegsBaseKM, SGX_MP_CORE_SELECT(EUR_CR_BREAKPOINT_TRAP, ui32CoreNum), EUR_CR_BREAKPOINT_TRAP_WRNOTIFY_MASK | EUR_CR_BREAKPOINT_TRAP_CONTINUE_MASK); do @@ -2519,12 +2556,12 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, ui32NewSeqNum = 0x1c & OSReadHWReg(psDevInfo->pvRegsBaseKM, SGX_MP_CORE_SELECT(EUR_CR_BREAKPOINT, ui32CoreNum)); } while (ui32OldSeqNum == ui32NewSeqNum); -#endif +#endif } -#endif +#endif return PVRSRV_OK; } -#endif +#endif case SGX_MISC_INFO_REQUEST_CLOCKSPEED: { @@ -2552,7 +2589,7 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, case SGX_MISC_INFO_REQUEST_SPM: { - + return PVRSRV_OK; } @@ -2568,10 +2605,10 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, } psSGXFeatures = &((PVRSRV_SGX_MISCINFO_INFO*)(psMemInfo->pvLinAddrKM))->sSGXFeatures; - + psMiscInfo->uData.sSGXFeatures = *psSGXFeatures; - + PVR_DPF((PVR_DBG_MESSAGE, "SGXGetMiscInfoKM: Core 0x%x, sw ID 0x%x, sw Rev 0x%x\n", psSGXFeatures->ui32CoreRev, psSGXFeatures->ui32CoreIdSW, @@ -2580,7 +2617,7 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, psSGXFeatures->ui32DDKVersion, psSGXFeatures->ui32DDKBuild)); - + return PVRSRV_OK; } @@ -2590,7 +2627,7 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, psSGXFeatures = &((PVRSRV_SGX_MISCINFO_INFO*)(psMemInfo->pvLinAddrKM))->sSGXFeatures; - + OSMemSet(psMemInfo->pvLinAddrKM, 0, sizeof(PVRSRV_SGX_MISCINFO_INFO)); @@ -2600,16 +2637,16 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, PVRVERSION_BRANCH; psSGXFeatures->ui32DDKBuild = PVRVERSION_BUILD; - + psSGXFeatures->ui32BuildOptions = (SGX_BUILD_OPTIONS); #if defined(PVRSRV_USSE_EDM_STATUS_DEBUG) - + psSGXFeatures->sDevVAEDMStatusBuffer = psDevInfo->psKernelEDMStatusBufferMemInfo->sDevVAddr; psSGXFeatures->pvEDMStatusBuffer = psDevInfo->psKernelEDMStatusBufferMemInfo->pvLinAddrKM; #endif - + psMiscInfo->uData.sSGXFeatures = *psSGXFeatures; return PVRSRV_OK; } @@ -2620,33 +2657,33 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, { PVRSRV_ERROR eError; PVRSRV_SGX_MISCINFO_FEATURES *psSGXFeatures; - PVRSRV_SGX_MISCINFO_MEMACCESS *psSGXMemSrc; - PVRSRV_SGX_MISCINFO_MEMACCESS *psSGXMemDest; - - { + PVRSRV_SGX_MISCINFO_MEMACCESS *psSGXMemSrc; + PVRSRV_SGX_MISCINFO_MEMACCESS *psSGXMemDest; + { + *pui32MiscInfoFlags |= PVRSRV_USSE_MISCINFO_MEMREAD; psSGXMemSrc = &((PVRSRV_SGX_MISCINFO_INFO*)(psMemInfo->pvLinAddrKM))->sSGXMemAccessSrc; if(psMiscInfo->sDevVAddrSrc.uiAddr != 0) { - psSGXMemSrc->sDevVAddr = psMiscInfo->sDevVAddrSrc; + psSGXMemSrc->sDevVAddr = psMiscInfo->sDevVAddrSrc; } else { return PVRSRV_ERROR_INVALID_PARAMS; - } + } } if( psMiscInfo->eRequest == SGX_MISC_INFO_REQUEST_MEMCOPY) - { - + { + *pui32MiscInfoFlags |= PVRSRV_USSE_MISCINFO_MEMWRITE; psSGXMemDest = &((PVRSRV_SGX_MISCINFO_INFO*)(psMemInfo->pvLinAddrKM))->sSGXMemAccessDest; - + if(psMiscInfo->sDevVAddrDest.uiAddr != 0) { - psSGXMemDest->sDevVAddr = psMiscInfo->sDevVAddrDest; + psSGXMemDest->sDevVAddr = psMiscInfo->sDevVAddrDest; } else { @@ -2654,12 +2691,12 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, } } - + if(psMiscInfo->hDevMemContext != IMG_NULL) { SGXGetMMUPDAddrKM( (IMG_HANDLE)psDeviceNode, hDevMemContext, &psSGXMemSrc->sPDDevPAddr); - - + + psSGXMemDest->sPDDevPAddr = psSGXMemSrc->sPDDevPAddr; } else @@ -2667,7 +2704,7 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, return PVRSRV_ERROR_INVALID_PARAMS; } - + eError = SGXGetMiscInfoUkernel(psDevInfo, psDeviceNode); if(eError != PVRSRV_OK) { @@ -2683,11 +2720,11 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, return PVRSRV_ERROR_INVALID_MISCINFO; } #endif - + psMiscInfo->uData.sSGXFeatures = *psSGXFeatures; return PVRSRV_OK; } -#endif +#endif #if defined(SUPPORT_SGX_HWPERF) case SGX_MISC_INFO_REQUEST_SET_HWPERF_STATUS: @@ -2699,7 +2736,7 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, PVRSRV_SGX_HWPERF_STATUS_MK_EXECUTION_ON; SGXMKIF_COMMAND sCommandData = {0}; - + if ((psSetHWPerfStatus->ui32NewHWPerfStatus & ~ui32ValidFlags) != 0) { return PVRSRV_ERROR_INVALID_PARAMS; @@ -2709,9 +2746,9 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, PDUMPCOMMENTWITHFLAGS(PDUMP_FLAGS_CONTINUOUS, "SGX ukernel HWPerf status %u\n", psSetHWPerfStatus->ui32NewHWPerfStatus); - #endif - + #endif + #if defined(SGX_FEATURE_EXTENDED_PERF_COUNTERS) OSMemCopy(&psDevInfo->psSGXHostCtl->aui32PerfGroup[0], &psSetHWPerfStatus->aui32PerfGroup[0], @@ -2730,7 +2767,7 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, sizeof(psDevInfo->psSGXHostCtl->aui32PerfBit), PDUMP_FLAGS_CONTINUOUS, MAKEUNIQUETAG(psDevInfo->psKernelSGXHostCtlMemInfo)); - #endif + #endif #else psDevInfo->psSGXHostCtl->ui32PerfGroup = psSetHWPerfStatus->ui32PerfGroup; #if defined(PDUMP) @@ -2739,10 +2776,10 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, sizeof(psDevInfo->psSGXHostCtl->ui32PerfGroup), PDUMP_FLAGS_CONTINUOUS, MAKEUNIQUETAG(psDevInfo->psKernelSGXHostCtlMemInfo)); - #endif - #endif - + #endif + #endif + sCommandData.ui32Data[0] = psSetHWPerfStatus->ui32NewHWPerfStatus; eError = SGXScheduleCCBCommandKM(psDeviceNode, SGXMKIF_CMD_SETHWPERFSTATUS, @@ -2753,20 +2790,20 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, IMG_FALSE); return eError; } -#endif +#endif case SGX_MISC_INFO_DUMP_DEBUG_INFO: { PVR_LOG(("User requested SGX debug info")); - + SGXDumpDebugInfo(psDeviceNode->pvDevice, IMG_FALSE); return PVRSRV_OK; } #if defined(DEBUG) - + case SGX_MISC_INFO_PANIC: { PVR_LOG(("User requested SGX panic")); @@ -2779,7 +2816,7 @@ PVRSRV_ERROR SGXGetMiscInfoKM(PVRSRV_SGXDEV_INFO *psDevInfo, default: { - + return PVRSRV_ERROR_INVALID_PARAMS; } } diff --git a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxkick.c b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxkick.c index 10e12dc..d5441b2 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxkick.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxkick.c @@ -1,30 +1,30 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ -#include +#include #include "services_headers.h" #include "sgxinfo.h" #include "sgxinfokm.h" @@ -62,15 +62,15 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, KICK_TOKEN_DOKICK); return PVRSRV_ERROR_INVALID_PARAMS; } - - + + psTACmd = CCB_DATA_FROM_OFFSET(SGXMKIF_CMDTA_SHARED, psCCBMemInfo, psCCBKick, ui32CCBOffset); PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_CMD_START, KICK_TOKEN_DOKICK); PVR_TTRACE_UI32(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_CCB, KICK_TOKEN_CCB_OFFSET, psCCBKick->ui32CCBOffset); - + if (psCCBKick->hTA3DSyncInfo) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTA3DSyncInfo; @@ -119,7 +119,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) psTACmd->ui32NumTAStatusVals = psCCBKick->ui32NumTAStatusVals; if (psCCBKick->ui32NumTAStatusVals != 0) { - + for (i = 0; i < psCCBKick->ui32NumTAStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) @@ -135,7 +135,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) psTACmd->ui32Num3DStatusVals = psCCBKick->ui32Num3DStatusVals; if (psCCBKick->ui32Num3DStatusVals != 0) { - + for (i = 0; i < psCCBKick->ui32Num3DStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) @@ -150,7 +150,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) - + psTACmd->ui32NumTASrcSyncs = psCCBKick->ui32NumTASrcSyncs; for (i=0; iui32NumTASrcSyncs; i++) { @@ -159,9 +159,9 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) psTACmd->asTASrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->asTASrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; - + psTACmd->asTASrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; - + psTACmd->asTASrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } @@ -173,9 +173,9 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) psTACmd->asTADstSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->asTADstSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; - + psTACmd->asTADstSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; - + psTACmd->asTADstSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; } @@ -187,13 +187,13 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) psTACmd->as3DSrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->as3DSrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; - + psTACmd->as3DSrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; - + psTACmd->as3DSrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } -#else - +#else + psTACmd->ui32NumSrcSyncs = psCCBKick->ui32NumSrcSyncs; for (i=0; iui32NumSrcSyncs; i++) { @@ -205,9 +205,9 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) psTACmd->asSrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->asSrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; - + psTACmd->asSrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; - + psTACmd->asSrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } #endif @@ -242,6 +242,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) if (psSyncInfo) { + psSyncInfo->psSyncData->ui64LastWrite = ui64KickCount; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_KICK, KICK_TOKEN_DST_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); @@ -279,7 +280,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { - + PDUMPCOMMENT("Init RT ROpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, @@ -287,7 +288,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); - + PDUMPCOMMENT("Init RT WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, @@ -320,7 +321,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) 0, MAKEUNIQUETAG(psHWDstSyncListMemInfo)); - + PDUMPCOMMENT("Modify RT %d ROps2PendingVal in HWDevSyncList\r\n", i); PDUMPMEM(&ui32ModifiedValue, psHWDstSyncListMemInfo, @@ -329,7 +330,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) 0, MAKEUNIQUETAG(psHWDstSyncListMemInfo)); } - #endif + #endif } else { @@ -343,8 +344,8 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) } } } - - + + psTACmd->ui32CtrlFlags |= SGXMKIF_CMDTA_CTRLFLAGS_READY; @@ -370,7 +371,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { - + PDUMPCOMMENT("Init RT TA-SRC ROpsComplete\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, @@ -378,7 +379,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); - + PDUMPCOMMENT("Init RT TA-SRC WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, @@ -421,7 +422,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { - + PDUMPCOMMENT("Init RT TA-DST ROpsComplete\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, @@ -429,7 +430,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); - + PDUMPCOMMENT("Init RT TA-DST WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, @@ -472,7 +473,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { - + PDUMPCOMMENT("Init RT 3D-SRC ROpsComplete\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, @@ -480,7 +481,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); - + PDUMPCOMMENT("Init RT 3D-SRC WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, @@ -523,7 +524,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { - + PDUMPCOMMENT("Init RT ROpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, @@ -531,7 +532,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); - + PDUMPCOMMENT("Init RT WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, @@ -539,7 +540,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) sizeof(psSyncInfo->psSyncData->ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); - + PDUMPCOMMENT("Init RT WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, @@ -634,7 +635,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) #endif } } -#endif +#endif PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_CMD_END, KICK_TOKEN_DOKICK); @@ -646,7 +647,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) { for (i=0; i < psCCBKick->ui32NumDstSyncObjects; i++) { - + psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->pahDstSyncHandles[i]; if (psSyncInfo) @@ -702,7 +703,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) #if defined(NO_HARDWARE) - + if (psCCBKick->hTA3DSyncInfo) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTA3DSyncInfo; @@ -727,12 +728,12 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } - + for (i = 0; i < psCCBKick->ui32NumTAStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo = (PVRSRV_KERNEL_MEM_INFO*)psCCBKick->asTAStatusUpdate[i].hKernelMemInfo; - + *(IMG_UINT32*)((IMG_UINTPTR_T)psKernelMemInfo->pvLinAddrKM + (psTACmd->sCtlTAStatusInfo[i].sStatusDevAddr.uiAddr - psKernelMemInfo->sDevVAddr.uiAddr)) = psTACmd->sCtlTAStatusInfo[i].ui32StatusValue; @@ -743,7 +744,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) } #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) - + for (i=0; iui32NumTASrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTASrcKernelSyncInfo[i]; @@ -760,7 +761,7 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } #else - + for (i=0; iui32NumSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahSrcKernelSyncInfo[i]; @@ -784,12 +785,12 @@ PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) } } - + for (i = 0; i < psCCBKick->ui32Num3DStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo = (PVRSRV_KERNEL_MEM_INFO*)psCCBKick->as3DStatusUpdate[i].hKernelMemInfo; - + *(IMG_UINT32*)((IMG_UINTPTR_T)psKernelMemInfo->pvLinAddrKM + (psTACmd->sCtl3DStatusInfo[i].sStatusDevAddr.uiAddr - psKernelMemInfo->sDevVAddr.uiAddr)) = psTACmd->sCtl3DStatusInfo[i].ui32StatusValue; diff --git a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxpower.c b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxpower.c index e655873..b647b68 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxpower.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxpower.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -39,7 +39,7 @@ static PVRSRV_ERROR SGXAddTimer(PVRSRV_DEVICE_NODE *psDeviceNode, SGX_TIMING_INFORMATION *psSGXTimingInfo, IMG_HANDLE *phTimer) { - + *phTimer = OSAddTimer(SGXOSTimer, psDeviceNode, @@ -52,7 +52,7 @@ static PVRSRV_ERROR SGXAddTimer(PVRSRV_DEVICE_NODE *psDeviceNode, return PVRSRV_OK; } -#endif +#endif static PVRSRV_ERROR SGXUpdateTimingInfo(PVRSRV_DEVICE_NODE *psDeviceNode) @@ -86,10 +86,10 @@ static PVRSRV_ERROR SGXUpdateTimingInfo(PVRSRV_DEVICE_NODE *psDeviceNode) ui32OlduKernelFreq = psDevInfo->ui32CoreClockSpeed / psDevInfo->ui32uKernelTimerClock; if (ui32OlduKernelFreq != psSGXTimingInfo->ui32uKernelFreq) { - + IMG_HANDLE hNewTimer; - + eError = SGXAddTimer(psDeviceNode, psSGXTimingInfo, &hNewTimer); if (eError == PVRSRV_OK) { @@ -102,7 +102,7 @@ static PVRSRV_ERROR SGXUpdateTimingInfo(PVRSRV_DEVICE_NODE *psDeviceNode) } else { - + } } } @@ -118,13 +118,13 @@ static PVRSRV_ERROR SGXUpdateTimingInfo(PVRSRV_DEVICE_NODE *psDeviceNode) psDevInfo->psSGXHostCtl->ui32HWRecoverySampleRate = psSGXTimingInfo->ui32uKernelFreq / psSGXTimingInfo->ui32HWRecoveryFreq; } -#endif - +#endif + psDevInfo->ui32CoreClockSpeed = psSGXTimingInfo->ui32CoreClockSpeed; psDevInfo->ui32uKernelTimerClock = psSGXTimingInfo->ui32CoreClockSpeed / psSGXTimingInfo->ui32uKernelFreq; - + psDevInfo->psSGXHostCtl->ui32uKernelTimerClock = psDevInfo->ui32uKernelTimerClock; #if defined(PDUMP) PDUMPCOMMENT("Host Control - Microkernel clock"); @@ -132,13 +132,13 @@ static PVRSRV_ERROR SGXUpdateTimingInfo(PVRSRV_DEVICE_NODE *psDeviceNode) offsetof(SGXMKIF_HOST_CTL, ui32uKernelTimerClock), sizeof(IMG_UINT32), PDUMP_FLAGS_CONTINUOUS, MAKEUNIQUETAG(psDevInfo->psKernelSGXHostCtlMemInfo)); -#endif +#endif if (psSGXTimingInfo->bEnableActivePM) { ui32ActivePowManSampleRate = psSGXTimingInfo->ui32uKernelFreq * psSGXTimingInfo->ui32ActivePowManLatencyms / 1000; - + @@ -158,7 +158,7 @@ static PVRSRV_ERROR SGXUpdateTimingInfo(PVRSRV_DEVICE_NODE *psDeviceNode) offsetof(SGXMKIF_HOST_CTL, ui32ActivePowManSampleRate), sizeof(IMG_UINT32), PDUMP_FLAGS_CONTINUOUS, MAKEUNIQUETAG(psDevInfo->psKernelSGXHostCtlMemInfo)); -#endif +#endif return PVRSRV_OK; } @@ -176,7 +176,7 @@ static IMG_VOID SGXStartTimer(PVRSRV_SGXDEV_INFO *psDevInfo) } #else PVR_UNREFERENCED_PARAMETER(psDevInfo); - #endif + #endif } @@ -193,7 +193,7 @@ static IMG_VOID SGXPollForClockGating (PVRSRV_SGXDEV_INFO *psDevInfo, #if !defined(NO_HARDWARE) PVR_ASSERT(psDevInfo != IMG_NULL); - + if (PollForValueKM((IMG_UINT32 *)psDevInfo->pvRegsBaseKM + (ui32Register >> 2), 0, ui32RegisterValue, @@ -205,7 +205,7 @@ static IMG_VOID SGXPollForClockGating (PVRSRV_SGXDEV_INFO *psDevInfo, SGXDumpDebugInfo(psDevInfo, IMG_FALSE); PVR_DBG_BREAK; } - #endif + #endif PDUMPCOMMENT("%s", pszComment); PDUMPREGPOL(SGX_PDUMPREG_NAME, ui32Register, 0, ui32RegisterValue, PDUMP_POLL_OPERATOR_EQUAL); @@ -228,25 +228,25 @@ PVRSRV_ERROR SGXPrePowerState (IMG_HANDLE hDevHandle, IMG_UINT32 ui32CoresEnabled; #if defined(SUPPORT_HW_RECOVERY) - + eError = OSDisableTimer(psDevInfo->hTimer); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SGXPrePowerState: Failed to disable timer")); return eError; } - #endif + #endif if (eNewPowerState == PVRSRV_DEV_POWER_STATE_OFF) { - + ui32PowerCmd = PVRSRV_POWERCMD_POWEROFF; ui32CompleteStatus = PVRSRV_USSE_EDM_POWMAN_POWEROFF_COMPLETE; PDUMPCOMMENT("SGX power off request"); } else { - + ui32PowerCmd = PVRSRV_POWERCMD_IDLE; ui32CompleteStatus = PVRSRV_USSE_EDM_POWMAN_IDLE_COMPLETE; PDUMPCOMMENT("SGX idle request"); @@ -261,7 +261,7 @@ PVRSRV_ERROR SGXPrePowerState (IMG_HANDLE hDevHandle, return eError; } - + #if !defined(NO_HARDWARE) if (PollForValueKM(&psDevInfo->psSGXHostCtl->ui32PowerStatus, ui32CompleteStatus, @@ -274,7 +274,7 @@ PVRSRV_ERROR SGXPrePowerState (IMG_HANDLE hDevHandle, SGXDumpDebugInfo(psDevInfo, IMG_FALSE); PVR_DBG_BREAK; } - #endif + #endif #if defined(PDUMP) PDUMPCOMMENT("TA/3D CCB Control - Wait for power event on uKernel."); @@ -285,7 +285,7 @@ PVRSRV_ERROR SGXPrePowerState (IMG_HANDLE hDevHandle, PDUMP_POLL_OPERATOR_EQUAL, 0, MAKEUNIQUETAG(psDevInfo->psKernelSGXHostCtlMemInfo)); - #endif + #endif #if defined(SGX_FEATURE_MP) ui32CoresEnabled = ((OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_CORE) & EUR_CR_MASTER_CORE_ENABLE_MASK) >> EUR_CR_MASTER_CORE_ENABLE_SHIFT) + 1; @@ -295,7 +295,7 @@ PVRSRV_ERROR SGXPrePowerState (IMG_HANDLE hDevHandle, for (ui32Core = 0; ui32Core < ui32CoresEnabled; ui32Core++) { - + SGXPollForClockGating(psDevInfo, SGX_MP_CORE_SELECT(psDevInfo->ui32ClkGateStatusReg, ui32Core), psDevInfo->ui32ClkGateStatusMask, @@ -303,7 +303,7 @@ PVRSRV_ERROR SGXPrePowerState (IMG_HANDLE hDevHandle, } #if defined(SGX_FEATURE_MP) - + SGXPollForClockGating(psDevInfo, psDevInfo->ui32MasterClkGateStatusReg, psDevInfo->ui32MasterClkGateStatusMask, @@ -313,11 +313,11 @@ PVRSRV_ERROR SGXPrePowerState (IMG_HANDLE hDevHandle, psDevInfo->ui32MasterClkGateStatus2Reg, psDevInfo->ui32MasterClkGateStatus2Mask, "Wait for SGX master clock gating (2)"); - #endif + #endif if (eNewPowerState == PVRSRV_DEV_POWER_STATE_OFF) { - + eError = SGXDeinitialise(psDevInfo); if (eError != PVRSRV_OK) { @@ -343,7 +343,7 @@ PVRSRV_ERROR SGXPostPowerState (IMG_HANDLE hDevHandle, PVRSRV_SGXDEV_INFO *psDevInfo = psDeviceNode->pvDevice; SGXMKIF_HOST_CTL *psSGXHostCtl = psDevInfo->psSGXHostCtl; - + psSGXHostCtl->ui32PowerStatus = 0; #if defined(PDUMP) PDUMPCOMMENT("Host Control - Reset power status"); @@ -351,13 +351,13 @@ PVRSRV_ERROR SGXPostPowerState (IMG_HANDLE hDevHandle, offsetof(SGXMKIF_HOST_CTL, ui32PowerStatus), sizeof(IMG_UINT32), PDUMP_FLAGS_CONTINUOUS, MAKEUNIQUETAG(psDevInfo->psKernelSGXHostCtlMemInfo)); - #endif + #endif if (eCurrentPowerState == PVRSRV_DEV_POWER_STATE_OFF) { + - - + eError = SGXUpdateTimingInfo(psDeviceNode); if (eError != PVRSRV_OK) @@ -366,7 +366,7 @@ PVRSRV_ERROR SGXPostPowerState (IMG_HANDLE hDevHandle, return eError; } - + eError = SGXInitialise(psDevInfo, IMG_FALSE); if (eError != PVRSRV_OK) @@ -377,7 +377,7 @@ PVRSRV_ERROR SGXPostPowerState (IMG_HANDLE hDevHandle, } else { - + SGXMKIF_COMMAND sCommand = {0}; @@ -411,7 +411,7 @@ PVRSRV_ERROR SGXPreClockSpeedChange (IMG_HANDLE hDevHandle, { if (bIdleDevice) { - + PDUMPSUSPEND(); eError = SGXPrePowerState(hDevHandle, PVRSRV_DEV_POWER_STATE_IDLE, @@ -446,7 +446,7 @@ PVRSRV_ERROR SGXPostClockSpeedChange (IMG_HANDLE hDevHandle, { PVRSRV_ERROR eError; - + eError = SGXUpdateTimingInfo(psDeviceNode); if (eError != PVRSRV_OK) @@ -457,7 +457,7 @@ PVRSRV_ERROR SGXPostClockSpeedChange (IMG_HANDLE hDevHandle, if (bIdleDevice) { - + eError = SGXPostPowerState(hDevHandle, PVRSRV_DEV_POWER_STATE_ON, PVRSRV_DEV_POWER_STATE_IDLE); diff --git a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxreset.c b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxreset.c index 4ba86a5..45e6d79 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxreset.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxreset.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -38,11 +38,11 @@ IMG_VOID SGXInitClocks(PVRSRV_SGXDEV_INFO *psDevInfo, IMG_UINT32 ui32PDUMPFlags) { IMG_UINT32 ui32RegVal; - + #if !defined(PDUMP) PVR_UNREFERENCED_PARAMETER(ui32PDUMPFlags); -#endif - +#endif + ui32RegVal = psDevInfo->ui32ClkGateCtl; OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_CLKGATECTL, ui32RegVal); PDUMPREGWITHFLAGS(SGX_PDUMPREG_NAME, EUR_CR_CLKGATECTL, ui32RegVal, ui32PDUMPFlags); @@ -62,7 +62,7 @@ static IMG_VOID SGXResetInitBIFContexts(PVRSRV_SGXDEV_INFO *psDevInfo, #if !defined(PDUMP) PVR_UNREFERENCED_PARAMETER(ui32PDUMPFlags); -#endif +#endif ui32RegVal = 0; OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_CTRL, ui32RegVal); @@ -74,7 +74,7 @@ static IMG_VOID SGXResetInitBIFContexts(PVRSRV_SGXDEV_INFO *psDevInfo, PDUMPREGWITHFLAGS(SGX_PDUMPREG_NAME, EUR_CR_BIF_BANK_SET, ui32RegVal, ui32PDUMPFlags); OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_BANK0, ui32RegVal); PDUMPREGWITHFLAGS(SGX_PDUMPREG_NAME, EUR_CR_BIF_BANK0, ui32RegVal, ui32PDUMPFlags); -#endif +#endif PDUMPCOMMENTWITHFLAGS(ui32PDUMPFlags, "Initialise the BIF directory list\r\n"); OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_DIR_LIST_BASE0, ui32RegVal); @@ -93,7 +93,7 @@ static IMG_VOID SGXResetInitBIFContexts(PVRSRV_SGXDEV_INFO *psDevInfo, PDUMPREGWITHFLAGS(SGX_PDUMPREG_NAME, ui32DirListReg, ui32RegVal, ui32PDUMPFlags); } } -#endif +#endif } @@ -104,40 +104,40 @@ static IMG_VOID SGXResetSetupBIFContexts(PVRSRV_SGXDEV_INFO *psDevInfo, #if !defined(PDUMP) PVR_UNREFERENCED_PARAMETER(ui32PDUMPFlags); -#endif - +#endif + #if defined(SGX_FEATURE_MULTIPLE_MEM_CONTEXTS) - + ui32RegVal = (SGX_BIF_DIR_LIST_INDEX_EDM << EUR_CR_BIF_BANK0_INDEX_EDM_SHIFT); #if defined(SGX_FEATURE_2D_HARDWARE) && !defined(SGX_FEATURE_PTLA) - + ui32RegVal |= (SGX_BIF_DIR_LIST_INDEX_EDM << EUR_CR_BIF_BANK0_INDEX_2D_SHIFT); - #endif + #endif #if defined(FIX_HW_BRN_23410) - + ui32RegVal |= (SGX_BIF_DIR_LIST_INDEX_EDM << EUR_CR_BIF_BANK0_INDEX_TA_SHIFT); - #endif + #endif OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_BANK0, ui32RegVal); PDUMPCOMMENTWITHFLAGS(ui32PDUMPFlags, "Set up EDM requestor page table in BIF\r\n"); PDUMPREGWITHFLAGS(SGX_PDUMPREG_NAME, EUR_CR_BIF_BANK0, ui32RegVal, ui32PDUMPFlags); - #endif + #endif { IMG_UINT32 ui32EDMDirListReg; - + #if (SGX_BIF_DIR_LIST_INDEX_EDM == 0) ui32EDMDirListReg = EUR_CR_BIF_DIR_LIST_BASE0; #else - + ui32EDMDirListReg = EUR_CR_BIF_DIR_LIST_BASE1 + 4 * (SGX_BIF_DIR_LIST_INDEX_EDM - 1); - #endif + #endif ui32RegVal = psDevInfo->sKernelPDDevPAddr.uiAddr >> SGX_MMU_PDE_ADDR_ALIGNSHIFT; - + #if defined(FIX_HW_BRN_28011) OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_DIR_LIST_BASE0, ui32RegVal); PDUMPPDREGWITHFLAGS(&psDevInfo->sMMUAttrib, EUR_CR_BIF_DIR_LIST_BASE0, ui32RegVal, ui32PDUMPFlags, PDUMP_PD_UNIQUETAG); @@ -161,14 +161,14 @@ static IMG_VOID SGXResetSleep(PVRSRV_SGXDEV_INFO *psDevInfo, ui32ReadRegister = EUR_CR_MASTER_SOFT_RESET; #else ui32ReadRegister = EUR_CR_SOFT_RESET; - #endif + #endif #endif #if !defined(PDUMP) PVR_UNREFERENCED_PARAMETER(ui32PDUMPFlags); -#endif - +#endif + SGXWaitClocks(psDevInfo, 100); if (bPDump) { @@ -180,7 +180,7 @@ static IMG_VOID SGXResetSleep(PVRSRV_SGXDEV_INFO *psDevInfo, } #if defined(EMULATOR) - + OSReadHWReg(psDevInfo->pvRegsBaseKM, ui32ReadRegister); #endif @@ -196,7 +196,7 @@ static IMG_VOID SGXResetSoftReset(PVRSRV_SGXDEV_INFO *psDevInfo, IMG_UINT32 ui32SoftResetRegVal; ui32SoftResetRegVal = - + EUR_CR_SOFT_RESET_DPM_RESET_MASK | EUR_CR_SOFT_RESET_TA_RESET_MASK | EUR_CR_SOFT_RESET_USE_RESET_MASK | @@ -254,7 +254,7 @@ static IMG_VOID SGXResetSoftReset(PVRSRV_SGXDEV_INFO *psDevInfo, #if !defined(PDUMP) PVR_UNREFERENCED_PARAMETER(ui32PDUMPFlags); -#endif +#endif if (bResetBIF) { @@ -275,7 +275,7 @@ static IMG_VOID SGXResetInvalDC(PVRSRV_SGXDEV_INFO *psDevInfo, { IMG_UINT32 ui32RegVal; - + #if defined(EUR_CR_BIF_CTRL_INVAL) ui32RegVal = EUR_CR_BIF_CTRL_INVAL_ALL_MASK; OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_CTRL_INVAL, ui32RegVal); @@ -302,7 +302,7 @@ static IMG_VOID SGXResetInvalDC(PVRSRV_SGXDEV_INFO *psDevInfo, #if !defined(SGX_FEATURE_MULTIPLE_MEM_CONTEXTS) { - + if (PollForValueKM((IMG_UINT32 *)((IMG_UINT8*)psDevInfo->pvRegsBaseKM + EUR_CR_BIF_MEM_REQ_STAT), @@ -321,9 +321,9 @@ static IMG_VOID SGXResetInvalDC(PVRSRV_SGXDEV_INFO *psDevInfo, PDUMPREGPOLWITHFLAGS(SGX_PDUMPREG_NAME, EUR_CR_BIF_MEM_REQ_STAT, 0, EUR_CR_BIF_MEM_REQ_STAT_READS_MASK, ui32PDUMPFlags, PDUMP_POLL_OPERATOR_EQUAL); } } -#endif +#endif } -#endif +#endif IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo, @@ -340,12 +340,12 @@ IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo, #if !defined(PDUMP) PVR_UNREFERENCED_PARAMETER(ui32PDUMPFlags); -#endif +#endif PDUMPCOMMENTWITHFLAGS(ui32PDUMPFlags, "Start of SGX reset sequence\r\n"); #if defined(FIX_HW_BRN_23944) - + ui32RegVal = EUR_CR_BIF_CTRL_PAUSE_MASK; OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_CTRL, ui32RegVal); PDUMPREGWITHFLAGS(SGX_PDUMPREG_NAME, EUR_CR_BIF_CTRL, ui32RegVal, ui32PDUMPFlags); @@ -355,7 +355,7 @@ IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo, ui32RegVal = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_INT_STAT); if (ui32RegVal & ui32BifFaultMask) { - + ui32RegVal = EUR_CR_BIF_CTRL_PAUSE_MASK | EUR_CR_BIF_CTRL_CLEAR_FAULT_MASK; OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_CTRL, ui32RegVal); PDUMPREGWITHFLAGS(SGX_PDUMPREG_NAME, EUR_CR_BIF_CTRL, ui32RegVal, ui32PDUMPFlags); @@ -368,17 +368,17 @@ IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo, SGXResetSleep(psDevInfo, ui32PDUMPFlags, IMG_TRUE); } -#endif - +#endif + SGXResetSoftReset(psDevInfo, IMG_TRUE, ui32PDUMPFlags, IMG_TRUE); SGXResetSleep(psDevInfo, ui32PDUMPFlags, IMG_TRUE); - + #if defined(SGX_FEATURE_36BIT_MMU) - + OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_36BIT_ADDRESSING, EUR_CR_BIF_36BIT_ADDRESSING_ENABLE_MASK); PDUMPREGWITHFLAGS(SGX_PDUMPREG_NAME, EUR_CR_BIF_36BIT_ADDRESSING, EUR_CR_BIF_36BIT_ADDRESSING_ENABLE_MASK, ui32PDUMPFlags); #endif @@ -386,38 +386,38 @@ IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo, SGXResetInitBIFContexts(psDevInfo, ui32PDUMPFlags); #if defined(EUR_CR_BIF_MEM_ARB_CONFIG) - + ui32RegVal = (12UL << EUR_CR_BIF_MEM_ARB_CONFIG_PAGE_SIZE_SHIFT) | (7UL << EUR_CR_BIF_MEM_ARB_CONFIG_BEST_CNT_SHIFT) | (12UL << EUR_CR_BIF_MEM_ARB_CONFIG_TTE_THRESH_SHIFT); OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_MEM_ARB_CONFIG, ui32RegVal); PDUMPREGWITHFLAGS(SGX_PDUMPREG_NAME, EUR_CR_BIF_MEM_ARB_CONFIG, ui32RegVal, ui32PDUMPFlags); -#endif +#endif #if defined(SGX_FEATURE_SYSTEM_CACHE) #if defined(SGX_BYPASS_SYSTEM_CACHE) - + ui32RegVal = MNE_CR_CTRL_BYPASS_ALL_MASK; #else #if defined(FIX_HW_BRN_26620) ui32RegVal = 0; #else - + ui32RegVal = MNE_CR_CTRL_BYP_CC_MASK; #endif #if defined(FIX_HW_BRN_34028) - + ui32RegVal |= (8 << MNE_CR_CTRL_BYPASS_SHIFT); #endif - #endif + #endif OSWriteHWReg(psDevInfo->pvRegsBaseKM, MNE_CR_CTRL, ui32RegVal); PDUMPREG(SGX_PDUMPREG_NAME, MNE_CR_CTRL, ui32RegVal); -#endif +#endif if (bHardwareRecovery) { - + @@ -429,13 +429,13 @@ IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo, SGXResetSleep(psDevInfo, ui32PDUMPFlags, IMG_FALSE); - + SGXResetSoftReset(psDevInfo, IMG_FALSE, ui32PDUMPFlags, IMG_TRUE); SGXResetSleep(psDevInfo, ui32PDUMPFlags, IMG_FALSE); SGXResetInvalDC(psDevInfo, ui32PDUMPFlags, IMG_FALSE); - + for (;;) { @@ -448,7 +448,7 @@ IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo, break; } - + sBifFault.uiAddr = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_FAULT); @@ -456,10 +456,10 @@ IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo, ui32PDIndex = sBifFault.uiAddr >> (SGX_MMU_PAGE_SHIFT + SGX_MMU_PT_SHIFT); ui32PTIndex = (sBifFault.uiAddr & SGX_MMU_PT_MASK) >> SGX_MMU_PAGE_SHIFT; - + SGXResetSoftReset(psDevInfo, IMG_TRUE, ui32PDUMPFlags, IMG_FALSE); - + psDevInfo->pui32BIFResetPD[ui32PDIndex] = (psDevInfo->sBIFResetPTDevPAddr.uiAddr >>SGX_MMU_PDE_ADDR_ALIGNSHIFT) | SGX_MMU_PDE_PAGE_SIZE_4K @@ -468,7 +468,7 @@ IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo, >>SGX_MMU_PTE_ADDR_ALIGNSHIFT) | SGX_MMU_PTE_VALID; - + ui32RegVal = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_STATUS); OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_HOST_CLEAR, ui32RegVal); ui32RegVal = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_STATUS2); @@ -476,50 +476,50 @@ IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo, SGXResetSleep(psDevInfo, ui32PDUMPFlags, IMG_FALSE); - + SGXResetSoftReset(psDevInfo, IMG_FALSE, ui32PDUMPFlags, IMG_FALSE); SGXResetSleep(psDevInfo, ui32PDUMPFlags, IMG_FALSE); - + SGXResetInvalDC(psDevInfo, ui32PDUMPFlags, IMG_FALSE); - + psDevInfo->pui32BIFResetPD[ui32PDIndex] = 0; psDevInfo->pui32BIFResetPT[ui32PTIndex] = 0; } } else { - + SGXResetSoftReset(psDevInfo, IMG_FALSE, ui32PDUMPFlags, IMG_TRUE); SGXResetSleep(psDevInfo, ui32PDUMPFlags, IMG_FALSE); - } - + } + SGXResetSetupBIFContexts(psDevInfo, ui32PDUMPFlags); #if defined(SGX_FEATURE_2D_HARDWARE) && !defined(SGX_FEATURE_PTLA) - + #if ((SGX_2D_HEAP_BASE & ~EUR_CR_BIF_TWOD_REQ_BASE_ADDR_MASK) != 0) #error "SGXReset: SGX_2D_HEAP_BASE doesn't match EUR_CR_BIF_TWOD_REQ_BASE_ADDR_MASK alignment" #endif - + OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_BIF_TWOD_REQ_BASE, SGX_2D_HEAP_BASE); PDUMPREGWITHFLAGS(SGX_PDUMPREG_NAME, EUR_CR_BIF_TWOD_REQ_BASE, SGX_2D_HEAP_BASE, ui32PDUMPFlags); #endif - + SGXResetInvalDC(psDevInfo, ui32PDUMPFlags, IMG_TRUE); PVR_DPF((PVR_DBG_MESSAGE,"Soft Reset of SGX")); - + ui32RegVal = 0; OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_SOFT_RESET, ui32RegVal); PDUMPREGWITHFLAGS(SGX_PDUMPREG_NAME, EUR_CR_SOFT_RESET, ui32RegVal, ui32PDUMPFlags); - + SGXResetSleep(psDevInfo, ui32PDUMPFlags, IMG_TRUE); PDUMPCOMMENTWITHFLAGS(ui32PDUMPFlags, "End of SGX reset sequence\r\n"); @@ -529,16 +529,16 @@ IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo, { IMG_UINT32 ui32RegVal; - + PVR_UNREFERENCED_PARAMETER(bHardwareRecovery); #if !defined(PDUMP) PVR_UNREFERENCED_PARAMETER(ui32PDUMPFlags); -#endif +#endif PDUMPCOMMENTWITHFLAGS(ui32PDUMPFlags, "Start of SGX MP reset sequence\r\n"); - + ui32RegVal = EUR_CR_MASTER_SOFT_RESET_BIF_RESET_MASK | EUR_CR_MASTER_SOFT_RESET_IPF_RESET_MASK | EUR_CR_MASTER_SOFT_RESET_DPM_RESET_MASK | @@ -552,7 +552,7 @@ IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo, ui32RegVal |= EUR_CR_MASTER_SOFT_RESET_SLC_RESET_MASK; #endif - + ui32RegVal |= EUR_CR_MASTER_SOFT_RESET_CORE_RESET_MASK(0) | EUR_CR_MASTER_SOFT_RESET_CORE_RESET_MASK(1) | EUR_CR_MASTER_SOFT_RESET_CORE_RESET_MASK(2) | @@ -599,20 +599,20 @@ IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo, EUR_CR_MASTER_SLC_CTRL_BYPASS_REQ_USE3_MASK | EUR_CR_MASTER_SLC_CTRL_BYPASS_REQ_TA_MASK; #endif - #endif + #endif OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_SLC_CTRL_BYPASS, ui32RegVal); PDUMPCOMMENTWITHFLAGS(ui32PDUMPFlags, "Initialise the hydra SLC bypass control\r\n"); PDUMPREG(SGX_PDUMPREG_NAME, EUR_CR_MASTER_SLC_CTRL_BYPASS, ui32RegVal); -#endif +#endif SGXResetSleep(psDevInfo, ui32PDUMPFlags, IMG_TRUE); - + ui32RegVal = 0; OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_SOFT_RESET, ui32RegVal); PDUMPCOMMENTWITHFLAGS(ui32PDUMPFlags, "Remove the resets from all of SGX\r\n"); PDUMPREGWITHFLAGS(SGX_PDUMPREG_NAME, EUR_CR_MASTER_SOFT_RESET, ui32RegVal, ui32PDUMPFlags); - + SGXResetSleep(psDevInfo, ui32PDUMPFlags, IMG_TRUE); PDUMPCOMMENTWITHFLAGS(ui32PDUMPFlags, "Turn on the slave cores' clock gating\r\n"); @@ -624,32 +624,32 @@ IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo, #if defined(FIX_HW_BRN_31278) || defined(FIX_HW_BRN_31620) || defined(FIX_HW_BRN_31671) || defined(FIX_HW_BRN_32085) #if defined(FIX_HW_BRN_31278) || defined(FIX_HW_BRN_32085) - + ui32RegVal = (1<pvRegsBaseKM, EUR_CR_MASTER_BIF_MMU_CTRL, ui32RegVal); PDUMPREGWITHFLAGS(SGX_PDUMPREG_NAME, EUR_CR_MASTER_BIF_MMU_CTRL, ui32RegVal, ui32PDUMPFlags); #if defined(FIX_HW_BRN_31278) || defined(FIX_HW_BRN_32085) - + ui32RegVal = (1< - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -64,7 +64,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF #if defined(PDUMP) IMG_BOOL bPersistentProcess = IMG_FALSE; - + { PVRSRV_PER_PROCESS_DATA* psPerProc = PVRSRVFindPerProcessData(); if(psPerProc != IMG_NULL) @@ -72,7 +72,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF bPersistentProcess = psPerProc->bPDumpPersistent; } } -#endif +#endif #if defined(FIX_HW_BRN_31620) hDevMemContext = psKick->hDevMemContext; #endif @@ -91,8 +91,8 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF TRANSFER_TOKEN_SUBMIT); return PVRSRV_ERROR_INVALID_PARAMS; } - - + + psSharedTransferCmd = CCB_DATA_FROM_OFFSET(SGXMKIF_TRANSFERCMD_SHARED, psCCBMemInfo, psKick, ui32SharedCmdCCBOffset); PVR_TTRACE(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_CMD_START, TRANSFER_TOKEN_SUBMIT); @@ -137,14 +137,14 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF psSharedTransferCmd->s3DSyncReadOpsCompleteDevVAddr.uiAddr = 0; } - + for (loop = 0; loop < MIN(SGX_MAX_TRANSFER_SYNC_OPS, psKick->ui32NumSrcSync); loop++) { IMG_UINT32 i; PVRSRV_KERNEL_SYNC_INFO * psMySyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; - - for (i = 0; i < loop; i++) + + for (i = 0; i < loop; i++) { if (abSrcSyncEnable[i]) { @@ -168,8 +168,8 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF IMG_UINT32 i; PVRSRV_KERNEL_SYNC_INFO * psMySyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[loop]; - - for (i = 0; i < loop; i++) + + for (i = 0; i < loop; i++) { if (abDstSyncEnable[i]) { @@ -189,8 +189,8 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF } } - psSharedTransferCmd->ui32NumSrcSyncs = ui32RealSrcSyncNum; - psSharedTransferCmd->ui32NumDstSyncs = ui32RealDstSyncNum; + psSharedTransferCmd->ui32NumSrcSyncs = ui32RealSrcSyncNum; + psSharedTransferCmd->ui32NumDstSyncs = ui32RealDstSyncNum; if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_KEEPPENDING) == 0UL) { @@ -208,7 +208,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF psSharedTransferCmd->asSrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; psSharedTransferCmd->asSrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; - psSharedTransferCmd->asSrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; + psSharedTransferCmd->asSrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psSharedTransferCmd->asSrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; i++; } @@ -222,6 +222,8 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[loop]; + psSyncInfo->psSyncData->ui64LastWrite = ui64KickCount; + PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_TRANSFER, TRANSFER_TOKEN_DST_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); @@ -237,7 +239,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF } PVR_ASSERT(i == ui32RealDstSyncNum); - + for (loop = 0; loop < psKick->ui32NumSrcSync; loop++) { if (abSrcSyncEnable[loop]) @@ -258,7 +260,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF #if defined(PDUMP) if ((PDumpIsCaptureFrameKM() - || ((psKick->ui32PDumpFlags & PDUMP_FLAGS_CONTINUOUS) != 0)) + || ((psKick->ui32PDumpFlags & PDUMP_FLAGS_CONTINUOUS) != 0)) && (bPersistentProcess == IMG_FALSE) ) { PDUMPCOMMENT("Shared part of transfer command\r\n"); @@ -333,11 +335,11 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF } } - + for (loop = 0; loop < (psKick->ui32NumSrcSync); loop++) { if (abSrcSyncEnable[loop]) - { + { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; } @@ -386,7 +388,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF #endif sCommand.ui32Data[1] = psKick->sHWTransferContextDevVAddr.uiAddr; - + PVR_TTRACE(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_CMD_END, TRANSFER_TOKEN_SUBMIT); @@ -394,7 +396,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF if (eError == PVRSRV_ERROR_RETRY) { - + if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_KEEPPENDING) == 0UL) { for (loop = 0; loop < psKick->ui32NumSrcSync; loop++) @@ -429,14 +431,14 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF } } - + if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending--; } - + if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; @@ -451,12 +453,12 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSF TRANSFER_TOKEN_SUBMIT); return eError; } - + #if defined(NO_HARDWARE) if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_NOSYNCUPDATE) == 0) { - + for (loop = 0; loop < psKick->ui32NumSrcSync; loop++) { if (abSrcSyncEnable[loop]) @@ -501,7 +503,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK_ #else IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK *psKick) #endif - + { PVRSRV_KERNEL_MEM_INFO *psCCBMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psKick->hCCBMemInfo; SGXMKIF_COMMAND sCommand = {0}; @@ -512,7 +514,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK IMG_HANDLE hDevMemContext = IMG_NULL; #if defined(PDUMP) IMG_BOOL bPersistentProcess = IMG_FALSE; - + { PVRSRV_PER_PROCESS_DATA* psPerProc = PVRSRVFindPerProcessData(); if(psPerProc != IMG_NULL) @@ -520,7 +522,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK bPersistentProcess = psPerProc->bPDumpPersistent; } } -#endif +#endif #if defined(FIX_HW_BRN_31620) hDevMemContext = psKick->hDevMemContext; #endif @@ -530,13 +532,13 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK PVR_DPF((PVR_DBG_ERROR, "SGXSubmit2DKM: Invalid CCB offset")); return PVRSRV_ERROR_INVALID_PARAMS; } - - + + ps2DCmd = CCB_DATA_FROM_OFFSET(SGXMKIF_2DCMD_SHARED, psCCBMemInfo, psKick, ui32SharedCmdCCBOffset); OSMemSet(ps2DCmd, 0, sizeof(*ps2DCmd)); - + if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; @@ -548,7 +550,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK ps2DCmd->sTASyncData.sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } - + if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; @@ -560,7 +562,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK ps2DCmd->s3DSyncData.sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } - + ps2DCmd->ui32NumSrcSync = psKick->ui32NumSrcSync; for (i = 0; i < psKick->ui32NumSrcSync; i++) { @@ -586,7 +588,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK ps2DCmd->sDstSyncData.sReadOps2CompleteDevVAddr = psSyncInfo->sReadOps2CompleteDevVAddr; } - + for (i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = psKick->ahSrcSyncInfo[i]; @@ -604,7 +606,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK || ((psKick->ui32PDumpFlags & PDUMP_FLAGS_CONTINUOUS) != 0)) && (bPersistentProcess == IMG_FALSE) ) { - + PDUMPCOMMENT("Shared part of 2D command\r\n"); PDUMPMEM(ps2DCmd, psCCBMemInfo, @@ -663,7 +665,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK MAKEUNIQUETAG(psCCBMemInfo)); } - + for (i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = psKick->ahSrcSyncInfo[i]; @@ -675,16 +677,16 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK psSyncInfo = psKick->hDstSyncInfo; psSyncInfo->psSyncData->ui32LastOpDumpVal++; } - } + } #endif sCommand.ui32Data[1] = psKick->sHW2DContextDevVAddr.uiAddr; - - eError = SGXScheduleCCBCommandKM(hDevHandle, SGXMKIF_CMD_2D, &sCommand, KERNEL_ID, psKick->ui32PDumpFlags, hDevMemContext, IMG_FALSE); + + eError = SGXScheduleCCBCommandKM(hDevHandle, SGXMKIF_CMD_2D, &sCommand, KERNEL_ID, psKick->ui32PDumpFlags, hDevMemContext, IMG_FALSE); if (eError == PVRSRV_ERROR_RETRY) { - + #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) @@ -715,7 +717,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK psSyncInfo->psSyncData->ui32WriteOpsPending--; } - + if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; @@ -723,7 +725,7 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK psSyncInfo->psSyncData->ui32WriteOpsPending--; } - + if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; @@ -732,11 +734,11 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK } } - + #if defined(NO_HARDWARE) - + for(i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[i]; @@ -767,5 +769,5 @@ IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK return eError; } -#endif -#endif +#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxutils.c b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxutils.c index 10bec35..528490b 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxutils.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxutils.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -43,12 +43,14 @@ #include "ttrace.h" #ifdef __linux__ -#include -#include +#include +#include #else #include #endif +IMG_UINT64 ui64KickCount; + #if defined(SYS_CUSTOM_POWERDOWN) PVRSRV_ERROR SysPowerDownMISR(PVRSRV_DEVICE_NODE * psDeviceNode, IMG_UINT32 ui32CallerID); @@ -62,12 +64,12 @@ static IMG_VOID SGXPostActivePowerEvent(PVRSRV_DEVICE_NODE * psDeviceNode, PVRSRV_SGXDEV_INFO *psDevInfo = psDeviceNode->pvDevice; SGXMKIF_HOST_CTL *psSGXHostCtl = psDevInfo->psSGXHostCtl; - + psSGXHostCtl->ui32NumActivePowerEvents++; if ((psSGXHostCtl->ui32PowerStatus & PVRSRV_USSE_EDM_POWMAN_POWEROFF_RESTART_IMMEDIATE) != 0) { - + if (ui32CallerID == ISR_ID) @@ -102,19 +104,19 @@ IMG_VOID SGXTestActivePowerEvent (PVRSRV_DEVICE_NODE *psDeviceNode, psDevInfo->bSGXIdle = IMG_FALSE; SysSGXIdleTransition(psDevInfo->bSGXIdle); } -#endif +#endif if (((psSGXHostCtl->ui32InterruptFlags & PVRSRV_USSE_EDM_INTERRUPT_ACTIVE_POWER) != 0) && ((psSGXHostCtl->ui32InterruptClearFlags & PVRSRV_USSE_EDM_INTERRUPT_ACTIVE_POWER) == 0)) { - + psSGXHostCtl->ui32InterruptClearFlags |= PVRSRV_USSE_EDM_INTERRUPT_ACTIVE_POWER; - + PDUMPSUSPEND(); #if defined(SYS_CUSTOM_POWERDOWN) - + eError = SysPowerDownMISR(psDeviceNode, ui32CallerID); @@ -129,13 +131,13 @@ IMG_VOID SGXTestActivePowerEvent (PVRSRV_DEVICE_NODE *psDeviceNode, #endif if (eError == PVRSRV_ERROR_RETRY) { - + psSGXHostCtl->ui32InterruptClearFlags &= ~PVRSRV_USSE_EDM_INTERRUPT_ACTIVE_POWER; eError = PVRSRV_OK; } - + PDUMPRESUME(); } @@ -161,7 +163,7 @@ static INLINE SGXMKIF_COMMAND * SGXAcquireKernelCCBSlot(PVRSRV_SGX_CCB_INFO *psC OSSleepms(1); } END_LOOP_UNTIL_TIMEOUT(); - + return IMG_NULL; } @@ -200,7 +202,7 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, psMMUContext = psDevInfo->hKernelMMUContext; psDeviceNode->pfnMMUGetCacheFlushRange(psMMUContext, &ui32CacheMasks[0]); - + if (hDevMemContext) { BM_CONTEXT *psBMContext = (BM_CONTEXT *) hDevMemContext; @@ -209,7 +211,7 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, psDeviceNode->pfnMMUGetCacheFlushRange(psMMUContext, &ui32CacheMasks[2]); } - + if (ui32CacheMasks[0] || ui32CacheMasks[1] || ui32CacheMasks[2] || ui32CacheMasks[3]) { psDevInfo->ui32CacheControl |= SGXMKIF_CC_INVAL_BIF_PD; @@ -217,7 +219,7 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, #endif #if defined(FIX_HW_BRN_28889) - + @@ -243,7 +245,7 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, goto Exit; } - + #if !defined(NO_HARDWARE) if(PollForValueKM(&psSGXHostCtl->ui32InvalStatus, PVRSRV_USSE_EDM_BIF_INVAL_COMPLETE, @@ -258,7 +260,7 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, #endif #if defined(PDUMP) - + PDUMPCOMMENTWITHFLAGS(0, "Host Control - Poll for BIF cache invalidate request to complete"); PDUMPMEMPOL(psSGXHostCtlMemInfo, offsetof(SGXMKIF_HOST_CTL, ui32InvalStatus), @@ -267,7 +269,7 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, PDUMP_POLL_OPERATOR_EQUAL, 0, MAKEUNIQUETAG(psSGXHostCtlMemInfo)); - #endif + #endif psSGXHostCtl->ui32InvalStatus &= ~(PVRSRV_USSE_EDM_BIF_INVAL_COMPLETE); PDUMPMEM(IMG_NULL, psSGXHostCtlMemInfo, offsetof(SGXMKIF_HOST_CTL, ui32CleanupStatus), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psSGXHostCtlMemInfo)); @@ -282,7 +284,7 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, SGXMKIF_COMMAND sPDECacheCommand = {0}; IMG_DEV_PHYADDR sDevPAddr; - + psMMUContext = psDevInfo->hKernelMMUContext; psDeviceNode->pfnMMUGetPDPhysAddr(psMMUContext, &sDevPAddr); @@ -290,7 +292,7 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, sPDECacheCommand.ui32Data[1] = ui32CacheMasks[0]; sPDECacheCommand.ui32Data[2] = ui32CacheMasks[1]; - + if (hDevMemContext) { BM_CONTEXT *psBMContext = (BM_CONTEXT *) hDevMemContext; @@ -298,13 +300,13 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, psMMUContext = psBMContext->psMMUContext; psDeviceNode->pfnMMUGetPDPhysAddr(psMMUContext, &sDevPAddr); - + sPDECacheCommand.ui32Data[3] = sDevPAddr.uiAddr | 1; sPDECacheCommand.ui32Data[4] = ui32CacheMasks[2]; sPDECacheCommand.ui32Data[5] = ui32CacheMasks[3]; } - + if (sPDECacheCommand.ui32Data[1] | sPDECacheCommand.ui32Data[2] | sPDECacheCommand.ui32Data[4] | sPDECacheCommand.ui32Data[5]) { @@ -323,7 +325,7 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, } #endif #if defined(PDUMP) - + { PVRSRV_PER_PROCESS_DATA* psPerProc = PVRSRVFindPerProcessData(); if(psPerProc != IMG_NULL) @@ -331,12 +333,12 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, bPersistentProcess = psPerProc->bPDumpPersistent; } } -#endif +#endif psKernelCCB = psDevInfo->psKernelCCBInfo; psSGXCommand = SGXAcquireKernelCCBSlot(psKernelCCB); - + if(!psSGXCommand) { PVR_DPF((PVR_DBG_ERROR, "SGXScheduleCCBCommand: Wait for CCB space timed out")) ; @@ -344,18 +346,18 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, goto Exit; } - + psCommandData->ui32CacheControl = psDevInfo->ui32CacheControl; #if defined(PDUMP) - + psDevInfo->sPDContext.ui32CacheControl |= psDevInfo->ui32CacheControl; #endif - + psDevInfo->ui32CacheControl = 0; - + *psSGXCommand = *psCommandData; if (eCmdType >= SGXMKIF_CMD_MAX) @@ -371,7 +373,7 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, { SYS_DATA *psSysData; - + SysAcquireData(&psSysData); if(psSysData->ePendingCacheOpType == PVRSRV_MISC_INFO_CPUCACHEOP_FLUSH) @@ -383,18 +385,18 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, OSCleanCPUCacheKM(); } - + psSysData->ePendingCacheOpType = PVRSRV_MISC_INFO_CPUCACHEOP_NONE; } PVR_ASSERT(eCmdType < SGXMKIF_CMD_MAX); - psSGXCommand->ui32ServiceAddress = psDevInfo->aui32HostKickAddr[eCmdType]; + psSGXCommand->ui32ServiceAddress = psDevInfo->aui32HostKickAddr[eCmdType]; #if defined(PDUMP) if ((ui32CallerID != ISR_ID) && (bPDumpIsSuspended == IMG_FALSE) && (bPersistentProcess == IMG_FALSE) ) { - + PDUMPCOMMENTWITHFLAGS(ui32PDumpFlags, "Poll for space in the Kernel CCB\r\n"); PDUMPMEMPOL(psKernelCCB->psCCBCtlMemInfo, offsetof(PVRSRV_SGX_CCB_CTL, ui32ReadOffset), @@ -414,7 +416,7 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, ui32PDumpFlags, MAKEUNIQUETAG(psKernelCCB->psCCBMemInfo)); - + PDUMPMEM(&psDevInfo->sPDContext.ui32CacheControl, psKernelCCB->psCCBMemInfo, psKernelCCB->ui32CCBDumpWOff * sizeof(SGXMKIF_COMMAND) + @@ -426,14 +428,14 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, if (PDumpIsCaptureFrameKM() || ((ui32PDumpFlags & PDUMP_FLAGS_CONTINUOUS) != 0)) { - + psDevInfo->sPDContext.ui32CacheControl = 0; } } #endif #if defined(FIX_HW_BRN_26620) && defined(SGX_FEATURE_SYSTEM_CACHE) && !defined(SGX_BYPASS_SYSTEM_CACHE) - + eError = PollForValueKM (psKernelCCB->pui32ReadOffset, *psKernelCCB->pui32WriteOffset, 0xFF, @@ -448,7 +450,7 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, } #endif - + *psKernelCCB->pui32WriteOffset = (*psKernelCCB->pui32WriteOffset + 1) & 255; @@ -501,7 +503,7 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, OSWriteMemoryBarrier(); - + PVR_TTRACE_UI32(PVRSRV_TRACE_GROUP_MKSYNC, PVRSRV_TRACE_CLASS_NONE, MKSYNC_TOKEN_KERNEL_CCB_OFFSET, *psKernelCCB->pui32WriteOffset); PVR_TTRACE_UI32(PVRSRV_TRACE_GROUP_MKSYNC, PVRSRV_TRACE_CLASS_NONE, @@ -523,10 +525,11 @@ PVRSRV_ERROR SGXScheduleCCBCommand(PVRSRV_DEVICE_NODE *psDeviceNode, OSMemoryBarrier(); #if defined(NO_HARDWARE) - + *psKernelCCB->pui32ReadOffset = (*psKernelCCB->pui32ReadOffset + 1) & 255; #endif + ui64KickCount++; Exit: return eError; } @@ -542,10 +545,10 @@ PVRSRV_ERROR SGXScheduleCCBCommandKM(PVRSRV_DEVICE_NODE *psDeviceNode, { PVRSRV_ERROR eError; - + PDUMPSUSPEND(); - + eError = PVRSRVSetDevicePowerStateKM(psDeviceNode->sDevId.ui32DeviceIndex, PVRSRV_DEV_POWER_STATE_ON, ui32CallerID, @@ -564,7 +567,8 @@ PVRSRV_ERROR SGXScheduleCCBCommandKM(PVRSRV_DEVICE_NODE *psDeviceNode, if (ui32CallerID == ISR_ID) { SYS_DATA *psSysData; - + + psDeviceNode->bReProcessDeviceCommandComplete = IMG_TRUE; @@ -575,7 +579,7 @@ PVRSRV_ERROR SGXScheduleCCBCommandKM(PVRSRV_DEVICE_NODE *psDeviceNode, } else { - + } } @@ -606,7 +610,7 @@ PVRSRV_ERROR SGXScheduleProcessQueuesKM(PVRSRV_DEVICE_NODE *psDeviceNode) ui32PowerStatus = psHostCtl->ui32PowerStatus; if ((ui32PowerStatus & PVRSRV_USSE_EDM_POWMAN_NO_WORK) != 0) { - + return PVRSRV_OK; } @@ -639,7 +643,7 @@ PVRSRV_ERROR SGXGetInternalDevInfoKM(IMG_HANDLE hDevCookie, psSGXInternalDevInfo->ui32Flags = psDevInfo->ui32Flags; psSGXInternalDevInfo->bForcePTOff = (IMG_BOOL)psDevInfo->bForcePTOff; - + psSGXInternalDevInfo->hHostCtlKernelMemInfoHandle = (IMG_HANDLE)psDevInfo->psKernelSGXHostCtlMemInfo; @@ -665,7 +669,7 @@ PVRSRV_ERROR SGXCleanupRequest(PVRSRV_DEVICE_NODE *psDeviceNode, sCommand.ui32Data[0] = ui32CleanupType; sCommand.ui32Data[1] = (psHWDataDevVAddr == IMG_NULL) ? 0 : psHWDataDevVAddr->uiAddr; PDUMPCOMMENTWITHFLAGS(0, "Request ukernel resource clean-up, Type %u, Data 0x%X", sCommand.ui32Data[0], sCommand.ui32Data[1]); - + eError = SGXScheduleCCBCommandKM(psDeviceNode, SGXMKIF_CMD_CLEANUP, &sCommand, KERNEL_ID, 0, IMG_NULL, IMG_FALSE); if (eError != PVRSRV_OK) { @@ -674,8 +678,8 @@ PVRSRV_ERROR SGXCleanupRequest(PVRSRV_DEVICE_NODE *psDeviceNode, PVR_DBG_BREAK; return eError; } - - + + #if !defined(NO_HARDWARE) if(PollForValueKM(&psHostCtl->ui32CleanupStatus, PVRSRV_USSE_EDM_CLEANUPCMD_COMPLETE, @@ -690,35 +694,54 @@ PVRSRV_ERROR SGXCleanupRequest(PVRSRV_DEVICE_NODE *psDeviceNode, PVR_DBG_BREAK; } #endif - + #if defined(PDUMP) + + + + + + + PDUMPCOMMENTWITHFLAGS(0, "Host Control - Poll for clean-up request to complete"); PDUMPMEMPOL(psHostCtlMemInfo, offsetof(SGXMKIF_HOST_CTL, ui32CleanupStatus), - PVRSRV_USSE_EDM_CLEANUPCMD_COMPLETE, - PVRSRV_USSE_EDM_CLEANUPCMD_COMPLETE, + PVRSRV_USSE_EDM_CLEANUPCMD_COMPLETE | PVRSRV_USSE_EDM_CLEANUPCMD_DONE, + PVRSRV_USSE_EDM_CLEANUPCMD_COMPLETE | PVRSRV_USSE_EDM_CLEANUPCMD_DONE, PDUMP_POLL_OPERATOR_EQUAL, 0, MAKEUNIQUETAG(psHostCtlMemInfo)); - #endif - + #endif + if (eError != PVRSRV_OK) { return eError; } } - psHostCtl->ui32CleanupStatus &= ~(PVRSRV_USSE_EDM_CLEANUPCMD_COMPLETE); + if (psHostCtl->ui32CleanupStatus & PVRSRV_USSE_EDM_CLEANUPCMD_BUSY) + { + + PVR_ASSERT((psHostCtl->ui32CleanupStatus & PVRSRV_USSE_EDM_CLEANUPCMD_DONE) == 0); + eError = PVRSRV_ERROR_RETRY; + psHostCtl->ui32CleanupStatus &= ~(PVRSRV_USSE_EDM_CLEANUPCMD_COMPLETE | PVRSRV_USSE_EDM_CLEANUPCMD_BUSY); + } + else + { + eError = PVRSRV_OK; + psHostCtl->ui32CleanupStatus &= ~(PVRSRV_USSE_EDM_CLEANUPCMD_COMPLETE | PVRSRV_USSE_EDM_CLEANUPCMD_DONE); + } + PDUMPMEM(IMG_NULL, psHostCtlMemInfo, offsetof(SGXMKIF_HOST_CTL, ui32CleanupStatus), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psHostCtlMemInfo)); - + #if defined(SGX_FEATURE_SYSTEM_CACHE) psDevInfo->ui32CacheControl |= (SGXMKIF_CC_INVAL_BIF_SL | SGXMKIF_CC_INVAL_DATA); #else psDevInfo->ui32CacheControl |= SGXMKIF_CC_INVAL_DATA; #endif - return PVRSRV_OK; + return eError; } @@ -728,6 +751,8 @@ typedef struct _SGX_HW_RENDER_CONTEXT_CLEANUP_ PVRSRV_KERNEL_MEM_INFO *psHWRenderContextMemInfo; IMG_HANDLE hBlockAlloc; PRESMAN_ITEM psResItem; + IMG_BOOL bCleanupTimerRunning; + IMG_PVOID pvTimeData; } SGX_HW_RENDER_CONTEXT_CLEANUP; @@ -745,16 +770,44 @@ static PVRSRV_ERROR SGXCleanupHWRenderContextCallback(IMG_PVOID pvParam, PVRSRV_CLEANUPCMD_RC, bForceCleanup); + if (eError == PVRSRV_ERROR_RETRY) + { + if (!psCleanup->bCleanupTimerRunning) + { + OSTimeCreateWithUSOffset(&psCleanup->pvTimeData, MAX_CLEANUP_TIME_US); + psCleanup->bCleanupTimerRunning = IMG_TRUE; + } + else + { + if (OSTimeHasTimePassed(psCleanup->pvTimeData)) + { + eError = PVRSRV_ERROR_TIMEOUT_POLLING_FOR_VALUE; + psCleanup->bCleanupTimerRunning = IMG_FALSE; + OSTimeDestroy(psCleanup->pvTimeData); + } + } + } + else + { + if (psCleanup->bCleanupTimerRunning) + { + OSTimeDestroy(psCleanup->pvTimeData); + } + } - PVRSRVFreeDeviceMemKM(psCleanup->psDeviceNode, - psCleanup->psHWRenderContextMemInfo); - - - OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, - sizeof(SGX_HW_RENDER_CONTEXT_CLEANUP), - psCleanup, - psCleanup->hBlockAlloc); - + if (eError != PVRSRV_ERROR_RETRY) + { + + PVRSRVFreeDeviceMemKM(psCleanup->psDeviceNode, + psCleanup->psHWRenderContextMemInfo); + + + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, + sizeof(SGX_HW_RENDER_CONTEXT_CLEANUP), + psCleanup, + psCleanup->hBlockAlloc); + + } return eError; } @@ -765,6 +818,8 @@ typedef struct _SGX_HW_TRANSFER_CONTEXT_CLEANUP_ PVRSRV_KERNEL_MEM_INFO *psHWTransferContextMemInfo; IMG_HANDLE hBlockAlloc; PRESMAN_ITEM psResItem; + IMG_BOOL bCleanupTimerRunning; + IMG_PVOID pvTimeData; } SGX_HW_TRANSFER_CONTEXT_CLEANUP; @@ -782,16 +837,44 @@ static PVRSRV_ERROR SGXCleanupHWTransferContextCallback(IMG_PVOID pvParam, PVRSRV_CLEANUPCMD_TC, bForceCleanup); + if (eError == PVRSRV_ERROR_RETRY) + { + if (!psCleanup->bCleanupTimerRunning) + { + OSTimeCreateWithUSOffset(&psCleanup->pvTimeData, MAX_CLEANUP_TIME_US); + psCleanup->bCleanupTimerRunning = IMG_TRUE; + } + else + { + if (OSTimeHasTimePassed(psCleanup->pvTimeData)) + { + eError = PVRSRV_ERROR_TIMEOUT_POLLING_FOR_VALUE; + psCleanup->bCleanupTimerRunning = IMG_FALSE; + OSTimeDestroy(psCleanup->pvTimeData); + } + } + } + else + { + if (psCleanup->bCleanupTimerRunning) + { + OSTimeDestroy(psCleanup->pvTimeData); + } + } - PVRSRVFreeDeviceMemKM(psCleanup->psDeviceNode, - psCleanup->psHWTransferContextMemInfo); - - - OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, - sizeof(SGX_HW_TRANSFER_CONTEXT_CLEANUP), - psCleanup, - psCleanup->hBlockAlloc); - + if (eError != PVRSRV_ERROR_RETRY) + { + + PVRSRVFreeDeviceMemKM(psCleanup->psDeviceNode, + psCleanup->psHWTransferContextMemInfo); + + + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, + sizeof(SGX_HW_TRANSFER_CONTEXT_CLEANUP), + psCleanup, + psCleanup->hBlockAlloc); + + } return eError; } @@ -837,8 +920,8 @@ IMG_HANDLE SGXRegisterHWRenderContextKM(IMG_HANDLE hDeviceNode, eError = PVRSRVAllocDeviceMemKM(hDeviceNode, psPerProc, psHeapInfo->hDevMemHeap, - PVRSRV_MEM_READ | PVRSRV_MEM_WRITE - | PVRSRV_MEM_NO_SYNCOBJ | PVRSRV_MEM_EDM_PROTECT + PVRSRV_MEM_READ | PVRSRV_MEM_WRITE + | PVRSRV_MEM_NO_SYNCOBJ | PVRSRV_MEM_EDM_PROTECT | PVRSRV_MEM_CACHE_CONSISTENT, ui32HWRenderContextSize, 32, @@ -864,11 +947,11 @@ IMG_HANDLE SGXRegisterHWRenderContextKM(IMG_HANDLE hDeviceNode, goto exit2; } - + psHWRenderContextDevVAddr->uiAddr = psCleanup->psHWRenderContextMemInfo->sDevVAddr.uiAddr; - - eError = PVRSRVLookupHandle(psPerProc->psHandleBase, + + eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &hDevMemContextInt, hDevMemContext, PVRSRV_HANDLE_TYPE_DEV_MEM_CONTEXT); @@ -882,7 +965,7 @@ IMG_HANDLE SGXRegisterHWRenderContextKM(IMG_HANDLE hDeviceNode, psMMUContext = BM_GetMMUContextFromMemContext(hDevMemContextInt); sPDDevPAddr = psDeviceNode->pfnMMUGetPDDevPAddr(psMMUContext); - + @@ -897,18 +980,18 @@ IMG_HANDLE SGXRegisterHWRenderContextKM(IMG_HANDLE hDeviceNode, } #if defined(PDUMP) - + PDUMPCOMMENTWITHFLAGS(PDUMP_FLAGS_CONTINUOUS, "HW Render context struct"); PDUMPMEM( - IMG_NULL, + IMG_NULL, psCleanup->psHWRenderContextMemInfo, - 0, - ui32HWRenderContextSize, - PDUMP_FLAGS_CONTINUOUS, + 0, + ui32HWRenderContextSize, + PDUMP_FLAGS_CONTINUOUS, MAKEUNIQUETAG(psCleanup->psHWRenderContextMemInfo)); - + PDUMPCOMMENT("Page directory address in HW render context"); PDUMPPDDEVPADDR( psCleanup->psHWRenderContextMemInfo, @@ -920,6 +1003,7 @@ IMG_HANDLE SGXRegisterHWRenderContextKM(IMG_HANDLE hDeviceNode, psCleanup->hBlockAlloc = hBlockAlloc; psCleanup->psDeviceNode = psDeviceNode; + psCleanup->bCleanupTimerRunning = IMG_FALSE; psResItem = ResManRegisterRes(psPerProc->hResManContext, RESMAN_TYPE_HW_RENDER_CONTEXT, @@ -945,7 +1029,7 @@ exit1: sizeof(SGX_HW_RENDER_CONTEXT_CLEANUP), psCleanup, psCleanup->hBlockAlloc); - + exit0: return IMG_NULL; } @@ -1013,8 +1097,8 @@ IMG_HANDLE SGXRegisterHWTransferContextKM(IMG_HANDLE hDeviceNode, eError = PVRSRVAllocDeviceMemKM(hDeviceNode, psPerProc, psHeapInfo->hDevMemHeap, - PVRSRV_MEM_READ | PVRSRV_MEM_WRITE - | PVRSRV_MEM_NO_SYNCOBJ | PVRSRV_MEM_EDM_PROTECT + PVRSRV_MEM_READ | PVRSRV_MEM_WRITE + | PVRSRV_MEM_NO_SYNCOBJ | PVRSRV_MEM_EDM_PROTECT | PVRSRV_MEM_CACHE_CONSISTENT, ui32HWTransferContextSize, 32, @@ -1040,11 +1124,11 @@ IMG_HANDLE SGXRegisterHWTransferContextKM(IMG_HANDLE hDeviceNode, goto exit2; } - + psHWTransferContextDevVAddr->uiAddr = psCleanup->psHWTransferContextMemInfo->sDevVAddr.uiAddr; - - eError = PVRSRVLookupHandle(psPerProc->psHandleBase, + + eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &hDevMemContextInt, hDevMemContext, PVRSRV_HANDLE_TYPE_DEV_MEM_CONTEXT); @@ -1058,7 +1142,7 @@ IMG_HANDLE SGXRegisterHWTransferContextKM(IMG_HANDLE hDeviceNode, psMMUContext = BM_GetMMUContextFromMemContext(hDevMemContextInt); sPDDevPAddr = psDeviceNode->pfnMMUGetPDDevPAddr(psMMUContext); - + @@ -1073,18 +1157,18 @@ IMG_HANDLE SGXRegisterHWTransferContextKM(IMG_HANDLE hDeviceNode, } #if defined(PDUMP) - + PDUMPCOMMENTWITHFLAGS(PDUMP_FLAGS_CONTINUOUS, "HW Transfer context struct"); PDUMPMEM( - IMG_NULL, + IMG_NULL, psCleanup->psHWTransferContextMemInfo, - 0, - ui32HWTransferContextSize, - PDUMP_FLAGS_CONTINUOUS, + 0, + ui32HWTransferContextSize, + PDUMP_FLAGS_CONTINUOUS, MAKEUNIQUETAG(psCleanup->psHWTransferContextMemInfo)); - + PDUMPCOMMENT("Page directory address in HW transfer context"); PDUMPPDDEVPADDR( @@ -1097,6 +1181,7 @@ IMG_HANDLE SGXRegisterHWTransferContextKM(IMG_HANDLE hDeviceNode, psCleanup->hBlockAlloc = hBlockAlloc; psCleanup->psDeviceNode = psDeviceNode; + psCleanup->bCleanupTimerRunning = IMG_FALSE; psResItem = ResManRegisterRes(psPerProc->hResManContext, RESMAN_TYPE_HW_TRANSFER_CONTEXT, @@ -1122,7 +1207,7 @@ exit1: sizeof(SGX_HW_TRANSFER_CONTEXT_CLEANUP), psCleanup, psCleanup->hBlockAlloc); - + exit0: return IMG_NULL; @@ -1166,17 +1251,17 @@ PVRSRV_ERROR SGXSetTransferContextPriorityKM( { psCleanup = (SGX_HW_TRANSFER_CONTEXT_CLEANUP *)hHWTransferContext; - if ((ui32OffsetOfPriorityField + sizeof(ui32Priority)) + if ((ui32OffsetOfPriorityField + sizeof(ui32Priority)) >= psCleanup->psHWTransferContextMemInfo->uAllocSize) { PVR_DPF(( - PVR_DBG_ERROR, + PVR_DBG_ERROR, "SGXSetTransferContextPriorityKM: invalid context prioirty offset")); return PVRSRV_ERROR_INVALID_PARAMS; } - + pDst = (IMG_UINT8 *)psCleanup->psHWTransferContextMemInfo->pvLinAddrKM; @@ -1207,17 +1292,17 @@ PVRSRV_ERROR SGXSetRenderContextPriorityKM( if (hHWRenderContext != IMG_NULL) { psCleanup = (SGX_HW_RENDER_CONTEXT_CLEANUP *)hHWRenderContext; - if ((ui32OffsetOfPriorityField + sizeof(ui32Priority)) + if ((ui32OffsetOfPriorityField + sizeof(ui32Priority)) >= psCleanup->psHWRenderContextMemInfo->uAllocSize) { PVR_DPF(( - PVR_DBG_ERROR, + PVR_DBG_ERROR, "SGXSetContextPriorityKM: invalid HWRenderContext prioirty offset")); return PVRSRV_ERROR_INVALID_PARAMS; } - + pDst = (IMG_UINT8 *)psCleanup->psHWRenderContextMemInfo->pvLinAddrKM; @@ -1240,6 +1325,8 @@ typedef struct _SGX_HW_2D_CONTEXT_CLEANUP_ PVRSRV_KERNEL_MEM_INFO *psHW2DContextMemInfo; IMG_HANDLE hBlockAlloc; PRESMAN_ITEM psResItem; + IMG_BOOL bCleanupTimerRunning; + IMG_PVOID pvTimeData; } SGX_HW_2D_CONTEXT_CLEANUP; static PVRSRV_ERROR SGXCleanupHW2DContextCallback(IMG_PVOID pvParam, @@ -1251,23 +1338,50 @@ static PVRSRV_ERROR SGXCleanupHW2DContextCallback(IMG_PVOID pvParam, PVR_UNREFERENCED_PARAMETER(ui32Param); - + eError = SGXCleanupRequest(psCleanup->psDeviceNode, &psCleanup->psHW2DContextMemInfo->sDevVAddr, PVRSRV_CLEANUPCMD_2DC, bForceCleanup); + if (eError == PVRSRV_ERROR_RETRY) + { + if (!psCleanup->bCleanupTimerRunning) + { + OSTimeCreateWithUSOffset(&psCleanup->pvTimeData, MAX_CLEANUP_TIME_US); + psCleanup->bCleanupTimerRunning = IMG_TRUE; + } + else + { + if (OSTimeHasTimePassed(psCleanup->pvTimeData)) + { + eError = PVRSRV_ERROR_TIMEOUT_POLLING_FOR_VALUE; + psCleanup->bCleanupTimerRunning = IMG_FALSE; + OSTimeDestroy(psCleanup->pvTimeData); + } + } + } + else + { + if (psCleanup->bCleanupTimerRunning) + { + OSTimeDestroy(psCleanup->pvTimeData); + } + } - PVRSRVFreeDeviceMemKM(psCleanup->psDeviceNode, - psCleanup->psHW2DContextMemInfo); - - - OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, - sizeof(SGX_HW_2D_CONTEXT_CLEANUP), - psCleanup, - psCleanup->hBlockAlloc); - - + if (eError != PVRSRV_ERROR_RETRY) + { + + PVRSRVFreeDeviceMemKM(psCleanup->psDeviceNode, + psCleanup->psHW2DContextMemInfo); + + + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, + sizeof(SGX_HW_2D_CONTEXT_CLEANUP), + psCleanup, + psCleanup->hBlockAlloc); + + } return eError; } @@ -1311,8 +1425,8 @@ IMG_HANDLE SGXRegisterHW2DContextKM(IMG_HANDLE hDeviceNode, eError = PVRSRVAllocDeviceMemKM(hDeviceNode, psPerProc, psHeapInfo->hDevMemHeap, - PVRSRV_MEM_READ | PVRSRV_MEM_WRITE - | PVRSRV_MEM_NO_SYNCOBJ | PVRSRV_MEM_EDM_PROTECT + PVRSRV_MEM_READ | PVRSRV_MEM_WRITE + | PVRSRV_MEM_NO_SYNCOBJ | PVRSRV_MEM_EDM_PROTECT | PVRSRV_MEM_CACHE_CONSISTENT, ui32HW2DContextSize, 32, @@ -1336,12 +1450,12 @@ IMG_HANDLE SGXRegisterHW2DContextKM(IMG_HANDLE hDeviceNode, PVR_DPF((PVR_DBG_ERROR, "SGXRegisterHW2DContextKM: Couldn't copy user-mode copy of HWContext into device memory")); goto exit2; } - - + + psHW2DContextDevVAddr->uiAddr = psCleanup->psHW2DContextMemInfo->sDevVAddr.uiAddr; - - eError = PVRSRVLookupHandle(psPerProc->psHandleBase, + + eError = PVRSRVLookupHandle(psPerProc->psHandleBase, &hDevMemContextInt, hDevMemContext, PVRSRV_HANDLE_TYPE_DEV_MEM_CONTEXT); @@ -1355,7 +1469,7 @@ IMG_HANDLE SGXRegisterHW2DContextKM(IMG_HANDLE hDeviceNode, psMMUContext = BM_GetMMUContextFromMemContext(hDevMemContextInt); sPDDevPAddr = psDeviceNode->pfnMMUGetPDDevPAddr(psMMUContext); - + @@ -1370,18 +1484,18 @@ IMG_HANDLE SGXRegisterHW2DContextKM(IMG_HANDLE hDeviceNode, } #if defined(PDUMP) - + PDUMPCOMMENTWITHFLAGS(PDUMP_FLAGS_CONTINUOUS, "HW 2D context struct"); PDUMPMEM( - IMG_NULL, + IMG_NULL, psCleanup->psHW2DContextMemInfo, - 0, - ui32HW2DContextSize, - PDUMP_FLAGS_CONTINUOUS, + 0, + ui32HW2DContextSize, + PDUMP_FLAGS_CONTINUOUS, MAKEUNIQUETAG(psCleanup->psHW2DContextMemInfo)); - + PDUMPCOMMENT("Page directory address in HW 2D transfer context"); PDUMPPDDEVPADDR( psCleanup->psHW2DContextMemInfo, @@ -1393,6 +1507,7 @@ IMG_HANDLE SGXRegisterHW2DContextKM(IMG_HANDLE hDeviceNode, psCleanup->hBlockAlloc = hBlockAlloc; psCleanup->psDeviceNode = psDeviceNode; + psCleanup->bCleanupTimerRunning = IMG_FALSE; psResItem = ResManRegisterRes(psPerProc->hResManContext, RESMAN_TYPE_HW_2D_CONTEXT, @@ -1418,7 +1533,7 @@ exit1: sizeof(SGX_HW_2D_CONTEXT_CLEANUP), psCleanup, psCleanup->hBlockAlloc); - + exit0: return IMG_NULL; } @@ -1442,7 +1557,7 @@ PVRSRV_ERROR SGXUnregisterHW2DContextKM(IMG_HANDLE hHW2DContext, IMG_BOOL bForce return eError; } -#endif +#endif #ifdef INLINE_IS_PRAGMA #pragma inline(SGX2DQuerySyncOpsComplete) @@ -1476,20 +1591,20 @@ PVRSRV_ERROR SGX2DQueryBlitsCompleteKM(PVRSRV_SGXDEV_INFO *psDevInfo, if(SGX2DQuerySyncOpsComplete(psSyncInfo, ui32ReadOpsPending, ui32WriteOpsPending)) { - + PVR_DPF((PVR_DBG_CALLTRACE, "SGX2DQueryBlitsCompleteKM: No wait. Blits complete.")); return PVRSRV_OK; } - + if (!bWaitForComplete) { - + PVR_DPF((PVR_DBG_CALLTRACE, "SGX2DQueryBlitsCompleteKM: No wait. Ops pending.")); return PVRSRV_ERROR_CMD_NOT_PROCESSED; } - + PVR_DPF((PVR_DBG_MESSAGE, "SGX2DQueryBlitsCompleteKM: Ops pending. Start polling.")); LOOP_UNTIL_TIMEOUT(MAX_HW_TIME_US) @@ -1498,7 +1613,7 @@ PVRSRV_ERROR SGX2DQueryBlitsCompleteKM(PVRSRV_SGXDEV_INFO *psDevInfo, if(SGX2DQuerySyncOpsComplete(psSyncInfo, ui32ReadOpsPending, ui32WriteOpsPending)) { - + PVR_DPF((PVR_DBG_CALLTRACE, "SGX2DQueryBlitsCompleteKM: Wait over. Blits complete.")); return PVRSRV_OK; } @@ -1506,7 +1621,7 @@ PVRSRV_ERROR SGX2DQueryBlitsCompleteKM(PVRSRV_SGXDEV_INFO *psDevInfo, OSSleepms(1); } END_LOOP_UNTIL_TIMEOUT(); - + PVR_DPF((PVR_DBG_ERROR,"SGX2DQueryBlitsCompleteKM: Timed out. Ops pending.")); #if defined(DEBUG) @@ -1557,14 +1672,14 @@ IMG_UINT32 SGXConvertTimeStamp(PVRSRV_SGXDEV_INFO *psDevInfo, ui32Clocksx16 = (IMG_UINT32)(ui64Clocks / 16); return ui32Clocksx16; -#endif +#endif } IMG_VOID SGXWaitClocks(PVRSRV_SGXDEV_INFO *psDevInfo, IMG_UINT32 ui32SGXClocks) { - + OSWaitus(1 + (ui32SGXClocks * 1000000 / psDevInfo->ui32CoreClockSpeed)); } diff --git a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxutils.h b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxutils.h index fe5ca8c..9017acf 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxutils.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxutils.h @@ -1,33 +1,33 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ #include "perproc.h" #include "sgxinfokm.h" - + #define CCB_OFFSET_IS_VALID(type, psCCBMemInfo, psCCBKick, offset) \ ((sizeof(type) <= (psCCBMemInfo)->uAllocSize) && \ ((psCCBKick)->offset <= (psCCBMemInfo)->uAllocSize - sizeof(type))) @@ -36,6 +36,8 @@ ((type *)(((IMG_CHAR *)(psCCBMemInfo)->pvLinAddrKM) + \ (psCCBKick)->offset)) +extern IMG_UINT64 ui64KickCount; + IMG_IMPORT IMG_VOID SGXTestActivePowerEvent(PVRSRV_DEVICE_NODE *psDeviceNode, diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/Kbuild.mk b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/Kbuild.mk index 86b6031..f45cfbd 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/Kbuild.mk +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/Kbuild.mk @@ -1,26 +1,26 @@ # # Copyright (C) Imagination Technologies Ltd. All rights reserved. -# +# # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, # version 2, as published by the Free Software Foundation. -# -# This program is distributed in the hope it will be useful but, except -# as otherwise stated in writing, without any warranty; without even the -# implied warranty of merchantability or fitness for a particular purpose. +# +# This program is distributed in the hope it will be useful but, except +# as otherwise stated in writing, without any warranty; without even the +# implied warranty of merchantability or fitness for a particular purpose. # See the GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. -# +# # The full GNU General Public License is included in this distribution in # the file called "COPYING". # # Contact Information: # Imagination Technologies Ltd. -# Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK -# +# Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK +# pvrsrvkm-y += \ services4/srvkm/env/linux/osfunc.o \ diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/env_data.h b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/env_data.h index 91393ff..7716529 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/env_data.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/env_data.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -63,4 +63,4 @@ typedef struct _ENV_DATA_TAG #endif } ENV_DATA; -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/env_perproc.h b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/env_perproc.h index 27ffde3..dabf1e3 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/env_perproc.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/env_perproc.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -47,10 +47,10 @@ IMG_VOID RemovePerProcessProcDir(PVRSRV_ENV_PER_PROCESS_DATA *psEnvPerProc); PVRSRV_ERROR LinuxMMapPerProcessConnect(PVRSRV_ENV_PER_PROCESS_DATA *psEnvPerProc); IMG_VOID LinuxMMapPerProcessDisconnect(PVRSRV_ENV_PER_PROCESS_DATA *psEnvPerProc); - + PVRSRV_ERROR LinuxMMapPerProcessHandleOptions(PVRSRV_HANDLE_BASE *psHandleBase); IMG_HANDLE LinuxTerminatingProcessPrivateData(IMG_VOID); -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/event.c b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/event.c index 9ab80f5..7e160c3 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/event.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/event.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -68,7 +68,7 @@ typedef struct PVRSRV_LINUX_EVENT_OBJECT_LIST_TAG { rwlock_t sLock; struct list_head sList; - + } PVRSRV_LINUX_EVENT_OBJECT_LIST; @@ -79,9 +79,9 @@ typedef struct PVRSRV_LINUX_EVENT_OBJECT_TAG #if defined(DEBUG) IMG_UINT ui32Stats; #endif - wait_queue_head_t sWait; + wait_queue_head_t sWait; struct list_head sList; - IMG_HANDLE hResItem; + IMG_HANDLE hResItem; PVRSRV_LINUX_EVENT_OBJECT_LIST *psLinuxEventObjectList; } PVRSRV_LINUX_EVENT_OBJECT; @@ -89,18 +89,18 @@ PVRSRV_ERROR LinuxEventObjectListCreate(IMG_HANDLE *phEventObjectList) { PVRSRV_LINUX_EVENT_OBJECT_LIST *psEventObjectList; - if(OSAllocMem(PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_LINUX_EVENT_OBJECT_LIST), + if(OSAllocMem(PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_LINUX_EVENT_OBJECT_LIST), (IMG_VOID **)&psEventObjectList, IMG_NULL, "Linux Event Object List") != PVRSRV_OK) { - PVR_DPF((PVR_DBG_ERROR, "LinuxEventObjectCreate: failed to allocate memory for event list")); - return PVRSRV_ERROR_OUT_OF_MEMORY; + PVR_DPF((PVR_DBG_ERROR, "LinuxEventObjectCreate: failed to allocate memory for event list")); + return PVRSRV_ERROR_OUT_OF_MEMORY; } INIT_LIST_HEAD(&psEventObjectList->sList); rwlock_init(&psEventObjectList->sLock); - + *phEventObjectList = (IMG_HANDLE *) psEventObjectList; return PVRSRV_OK; @@ -111,7 +111,7 @@ PVRSRV_ERROR LinuxEventObjectListDestroy(IMG_HANDLE hEventObjectList) PVRSRV_LINUX_EVENT_OBJECT_LIST *psEventObjectList = (PVRSRV_LINUX_EVENT_OBJECT_LIST *) hEventObjectList ; - if(psEventObjectList) + if(psEventObjectList) { IMG_BOOL bListEmpty; @@ -119,14 +119,14 @@ PVRSRV_ERROR LinuxEventObjectListDestroy(IMG_HANDLE hEventObjectList) bListEmpty = list_empty(&psEventObjectList->sList); read_unlock(&psEventObjectList->sLock); - if (!bListEmpty) + if (!bListEmpty) { PVR_DPF((PVR_DBG_ERROR, "LinuxEventObjectListDestroy: Event List is not empty")); return PVRSRV_ERROR_UNABLE_TO_DESTROY_EVENT; } OSFreeMem(PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_LINUX_EVENT_OBJECT_LIST), psEventObjectList, IMG_NULL); - + } return PVRSRV_OK; @@ -139,7 +139,7 @@ PVRSRV_ERROR LinuxEventObjectDelete(IMG_HANDLE hOSEventObjectList, IMG_HANDLE hO { if(hOSEventObject) { - PVRSRV_LINUX_EVENT_OBJECT *psLinuxEventObject = (PVRSRV_LINUX_EVENT_OBJECT *)hOSEventObject; + PVRSRV_LINUX_EVENT_OBJECT *psLinuxEventObject = (PVRSRV_LINUX_EVENT_OBJECT *)hOSEventObject; #if defined(DEBUG) PVR_DPF((PVR_DBG_MESSAGE, "LinuxEventObjectListDelete: Event object waits: %u", psLinuxEventObject->ui32Stats)); #endif @@ -147,7 +147,7 @@ PVRSRV_ERROR LinuxEventObjectDelete(IMG_HANDLE hOSEventObjectList, IMG_HANDLE hO { return PVRSRV_ERROR_UNABLE_TO_DESTROY_EVENT; } - + return PVRSRV_OK; } } @@ -170,17 +170,17 @@ static PVRSRV_ERROR LinuxEventObjectDeleteCallback(IMG_PVOID pvParam, IMG_UINT32 #if defined(DEBUG) PVR_DPF((PVR_DBG_MESSAGE, "LinuxEventObjectDeleteCallback: Event object waits: %u", psLinuxEventObject->ui32Stats)); -#endif +#endif OSFreeMem(PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_LINUX_EVENT_OBJECT), psLinuxEventObject, IMG_NULL); - + return PVRSRV_OK; } PVRSRV_ERROR LinuxEventObjectAdd(IMG_HANDLE hOSEventObjectList, IMG_HANDLE *phOSEventObject) { - PVRSRV_LINUX_EVENT_OBJECT *psLinuxEventObject; - PVRSRV_LINUX_EVENT_OBJECT_LIST *psLinuxEventObjectList = (PVRSRV_LINUX_EVENT_OBJECT_LIST*)hOSEventObjectList; + PVRSRV_LINUX_EVENT_OBJECT *psLinuxEventObject; + PVRSRV_LINUX_EVENT_OBJECT_LIST *psLinuxEventObjectList = (PVRSRV_LINUX_EVENT_OBJECT_LIST*)hOSEventObjectList; IMG_UINT32 ui32PID = OSGetCurrentProcessIDKM(); PVRSRV_PER_PROCESS_DATA *psPerProc; unsigned long ulLockFlags; @@ -192,15 +192,15 @@ PVRSRV_ERROR LinuxEventObjectAdd(IMG_HANDLE hOSEventObjectList, IMG_HANDLE *phOS return PVRSRV_ERROR_OUT_OF_MEMORY; } - - if(OSAllocMem(PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_LINUX_EVENT_OBJECT), + + if(OSAllocMem(PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_LINUX_EVENT_OBJECT), (IMG_VOID **)&psLinuxEventObject, IMG_NULL, "Linux Event Object") != PVRSRV_OK) { - PVR_DPF((PVR_DBG_ERROR, "LinuxEventObjectAdd: failed to allocate memory ")); - return PVRSRV_ERROR_OUT_OF_MEMORY; + PVR_DPF((PVR_DBG_ERROR, "LinuxEventObjectAdd: failed to allocate memory ")); + return PVRSRV_ERROR_OUT_OF_MEMORY; } - + INIT_LIST_HEAD(&psLinuxEventObject->sList); atomic_set(&psLinuxEventObject->sTimeStamp, 0); @@ -217,39 +217,39 @@ PVRSRV_ERROR LinuxEventObjectAdd(IMG_HANDLE hOSEventObjectList, IMG_HANDLE *phOS RESMAN_TYPE_EVENT_OBJECT, psLinuxEventObject, 0, - &LinuxEventObjectDeleteCallback); + &LinuxEventObjectDeleteCallback); write_lock_irqsave(&psLinuxEventObjectList->sLock, ulLockFlags); list_add(&psLinuxEventObject->sList, &psLinuxEventObjectList->sList); write_unlock_irqrestore(&psLinuxEventObjectList->sLock, ulLockFlags); - + *phOSEventObject = psLinuxEventObject; - return PVRSRV_OK; + return PVRSRV_OK; } PVRSRV_ERROR LinuxEventObjectSignal(IMG_HANDLE hOSEventObjectList) { PVRSRV_LINUX_EVENT_OBJECT *psLinuxEventObject; - PVRSRV_LINUX_EVENT_OBJECT_LIST *psLinuxEventObjectList = (PVRSRV_LINUX_EVENT_OBJECT_LIST*)hOSEventObjectList; + PVRSRV_LINUX_EVENT_OBJECT_LIST *psLinuxEventObjectList = (PVRSRV_LINUX_EVENT_OBJECT_LIST*)hOSEventObjectList; struct list_head *psListEntry, *psList; psList = &psLinuxEventObjectList->sList; - + read_lock(&psLinuxEventObjectList->sLock); - list_for_each(psListEntry, psList) - { - - psLinuxEventObject = (PVRSRV_LINUX_EVENT_OBJECT *)list_entry(psListEntry, PVRSRV_LINUX_EVENT_OBJECT, sList); + list_for_each(psListEntry, psList) + { - atomic_inc(&psLinuxEventObject->sTimeStamp); + psLinuxEventObject = (PVRSRV_LINUX_EVENT_OBJECT *)list_entry(psListEntry, PVRSRV_LINUX_EVENT_OBJECT, sList); + + atomic_inc(&psLinuxEventObject->sTimeStamp); wake_up_interruptible(&psLinuxEventObject->sWait); } read_unlock(&psLinuxEventObjectList->sLock); return PVRSRV_OK; - + } PVRSRV_ERROR LinuxEventObjectWait(IMG_HANDLE hOSEventObject, IMG_UINT32 ui32MSTimeout) @@ -260,30 +260,30 @@ PVRSRV_ERROR LinuxEventObjectWait(IMG_HANDLE hOSEventObject, IMG_UINT32 ui32MSTi PVRSRV_LINUX_EVENT_OBJECT *psLinuxEventObject = (PVRSRV_LINUX_EVENT_OBJECT *) hOSEventObject; IMG_UINT32 ui32TimeOutJiffies = msecs_to_jiffies(ui32MSTimeout); - - do + + do { prepare_to_wait(&psLinuxEventObject->sWait, &sWait, TASK_INTERRUPTIBLE); ui32TimeStamp = (IMG_UINT32)atomic_read(&psLinuxEventObject->sTimeStamp); - + if(psLinuxEventObject->ui32TimeStampPrevious != ui32TimeStamp) { break; } - LinuxUnLockMutex(&gPVRSRVLock); + LinuxUnLockMutex(&gPVRSRVLock); ui32TimeOutJiffies = (IMG_UINT32)schedule_timeout((IMG_INT32)ui32TimeOutJiffies); - + LinuxLockMutex(&gPVRSRVLock); #if defined(DEBUG) psLinuxEventObject->ui32Stats++; -#endif - +#endif + } while (ui32TimeOutJiffies); - finish_wait(&psLinuxEventObject->sWait, &sWait); + finish_wait(&psLinuxEventObject->sWait, &sWait); psLinuxEventObject->ui32TimeStampPrevious = ui32TimeStamp; diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/event.h b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/event.h index af7efa5..3035283 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/event.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/event.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/ion.c b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/ion.c index 7919595..b00fdb1 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/ion.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/ion.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * *****************************************************************************/ @@ -44,7 +44,7 @@ extern struct ion_client *gpsIONClient; void PVRSRVExportFDToIONHandles(int fd, struct ion_client **client, - struct ion_handle *handles[2]) + struct ion_handle *handles[2]) { PVRSRV_FILE_PRIVATE_DATA *psPrivateData; PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo; diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/ion.h b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/ion.h index 6b00935..9b0868c 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/ion.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/ion.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * *****************************************************************************/ @@ -31,7 +31,7 @@ #include void PVRSRVExportFDToIONHandles(int fd, struct ion_client **client, - struct ion_handle *handles[2]); + struct ion_handle *handles[2]); struct ion_handle *PVRSRVExportFDToIONHandle(int fd, struct ion_client **client); diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/linkage.h b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/linkage.h index d536a41..e64012c 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/linkage.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/linkage.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -45,8 +45,8 @@ IMG_INT PVRProcSetPowerLevel(struct file *file, const IMG_CHAR *buffer, IMG_UINT void ProcSeqShowPowerLevel(struct seq_file *sfile,void* el); -#endif +#endif -#endif +#endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/lock.h b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/lock.h index f1329b5..a0854c3 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/lock.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/lock.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -29,4 +29,4 @@ extern PVRSRV_LINUX_MUTEX gPVRSRVLock; -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mm.c b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mm.c index f18df04..e8cd97e 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mm.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mm.c @@ -1,29 +1,35 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ + + + + + + #include #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)) @@ -32,6 +38,14 @@ #endif #endif +#if !defined(PVR_LINUX_MEM_AREA_POOL_MAX_PAGES) +#define PVR_LINUX_MEM_AREA_POOL_MAX_PAGES 0 +#endif + +#include +#include +#include +#include #include #include #include @@ -43,6 +57,12 @@ #include #include +#if defined(PVR_LINUX_MEM_AREA_POOL_ALLOW_SHRINK) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) +#include +#endif +#endif + #include "img_defs.h" #include "services.h" #include "servicesint.h" @@ -61,6 +81,8 @@ #include "lists.h" #endif +static atomic_t g_sPagePoolEntryCount = ATOMIC_INIT(0); + #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) typedef enum { DEBUG_MEM_ALLOC_TYPE_KMALLOC, @@ -69,14 +91,17 @@ typedef enum { DEBUG_MEM_ALLOC_TYPE_IOREMAP, DEBUG_MEM_ALLOC_TYPE_IO, DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE, - DEBUG_MEM_ALLOC_TYPE_COUNT, - DEBUG_MEM_ALLOC_TYPE_ION -}DEBUG_MEM_ALLOC_TYPE; + DEBUG_MEM_ALLOC_TYPE_ION, +#if defined(PVR_LINUX_MEM_AREA_USE_VMAP) + DEBUG_MEM_ALLOC_TYPE_VMAP, +#endif + DEBUG_MEM_ALLOC_TYPE_COUNT +} DEBUG_MEM_ALLOC_TYPE; typedef struct _DEBUG_MEM_ALLOC_REC { DEBUG_MEM_ALLOC_TYPE eAllocType; - IMG_VOID *pvKey; + IMG_VOID *pvKey; IMG_VOID *pvCpuVAddr; IMG_UINT32 ulCpuPAddr; IMG_VOID *pvPrivateData; @@ -84,10 +109,10 @@ typedef struct _DEBUG_MEM_ALLOC_REC pid_t pid; IMG_CHAR *pszFileName; IMG_UINT32 ui32Line; - + struct _DEBUG_MEM_ALLOC_REC *psNext; struct _DEBUG_MEM_ALLOC_REC **ppsThis; -}DEBUG_MEM_ALLOC_REC; +} DEBUG_MEM_ALLOC_REC; static IMPLEMENT_LIST_ANY_VA_2(DEBUG_MEM_ALLOC_REC, IMG_BOOL, IMG_FALSE) static IMPLEMENT_LIST_ANY_VA(DEBUG_MEM_ALLOC_REC) @@ -101,8 +126,14 @@ static DEBUG_MEM_ALLOC_REC *g_MemoryRecords; static IMG_UINT32 g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_COUNT]; static IMG_UINT32 g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_COUNT]; -static IMG_UINT32 g_SysRAMWaterMark; -static IMG_UINT32 g_SysRAMHighWaterMark; +static IMG_UINT32 g_SysRAMWaterMark; +static IMG_UINT32 g_SysRAMHighWaterMark; + +static inline IMG_UINT32 +SysRAMTrueWaterMark(void) +{ + return g_SysRAMWaterMark + PAGES_TO_BYTES(atomic_read(&g_sPagePoolEntryCount)); +} static IMG_UINT32 g_IOMemWaterMark; static IMG_UINT32 g_IOMemHighWaterMark; @@ -121,7 +152,7 @@ static IMG_VOID DebugMemAllocRecordRemove(DEBUG_MEM_ALLOC_TYPE eAllocType, IMG_V static IMG_CHAR *DebugMemAllocRecordTypeToString(DEBUG_MEM_ALLOC_TYPE eAllocType); -static struct proc_dir_entry *g_SeqFileMemoryRecords =0; +static struct proc_dir_entry *g_SeqFileMemoryRecords; static void* ProcSeqNextMemoryRecords(struct seq_file *sfile,void* el,loff_t off); static void ProcSeqShowMemoryRecords(struct seq_file *sfile,void* el); static void* ProcSeqOff2ElementMemoryRecords(struct seq_file * sfile, loff_t off); @@ -155,7 +186,7 @@ static IMG_UINT32 g_LinuxMemAreaWaterMark; static IMG_UINT32 g_LinuxMemAreaHighWaterMark; -static struct proc_dir_entry *g_SeqFileMemArea=0; +static struct proc_dir_entry *g_SeqFileMemArea; static void* ProcSeqNextMemArea(struct seq_file *sfile,void* el,loff_t off); static void ProcSeqShowMemArea(struct seq_file *sfile,void* el); @@ -171,8 +202,19 @@ static PVRSRV_LINUX_MUTEX g_sDebugMutex; static void ProcSeqStartstopDebugMutex(struct seq_file *sfile,IMG_BOOL start); #endif -static LinuxKMemCache *psLinuxMemAreaCache; +typedef struct +{ + + struct list_head sPagePoolItem; + + struct page *psPage; +} LinuxPagePoolEntry; + +static LinuxKMemCache *g_PsLinuxMemAreaCache; +static LinuxKMemCache *g_PsLinuxPagePoolCache; +static LIST_HEAD(g_sPagePoolList); +static int g_iPagePoolMaxEntries; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) static IMG_VOID ReservePages(IMG_VOID *pvAddress, IMG_UINT32 ui32Length); @@ -187,6 +229,7 @@ static DEBUG_LINUX_MEM_AREA_REC *DebugLinuxMemAreaRecordFind(LinuxMemArea *psLin static IMG_VOID DebugLinuxMemAreaRecordRemove(LinuxMemArea *psLinuxMemArea); #endif + /* We assume the total area space for PVRSRV_HAP_WRITECOMBINE is fewer than 4MB. If it's more than 4MB, it fails over to vmalloc automatically. @@ -232,158 +275,17 @@ static void init_pvr_pool(void) return ; } -PVRSRV_ERROR -LinuxMMInit(IMG_VOID) +static inline IMG_BOOL +AreaIsUncached(IMG_UINT32 ui32AreaFlags) { -#if defined(DEBUG_LINUX_MEM_AREAS) || defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) - LinuxInitMutex(&g_sDebugMutex); -#endif - -#if defined(DEBUG_LINUX_MEM_AREAS) - { - g_SeqFileMemArea = CreateProcReadEntrySeq( - "mem_areas", - NULL, - ProcSeqNextMemArea, - ProcSeqShowMemArea, - ProcSeqOff2ElementMemArea, - ProcSeqStartstopDebugMutex - ); - if(!g_SeqFileMemArea) - { - return PVRSRV_ERROR_OUT_OF_MEMORY; - } - } -#endif - - -#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) - { - g_SeqFileMemoryRecords =CreateProcReadEntrySeq( - "meminfo", - NULL, - ProcSeqNextMemoryRecords, - ProcSeqShowMemoryRecords, - ProcSeqOff2ElementMemoryRecords, - ProcSeqStartstopDebugMutex - ); - if(!g_SeqFileMemoryRecords) - { - return PVRSRV_ERROR_OUT_OF_MEMORY; - } - } -#endif - - psLinuxMemAreaCache = KMemCacheCreateWrapper("img-mm", sizeof(LinuxMemArea), 0, 0); - if(!psLinuxMemAreaCache) - { - PVR_DPF((PVR_DBG_ERROR,"%s: failed to allocate kmem_cache", __FUNCTION__)); - return PVRSRV_ERROR_OUT_OF_MEMORY; - } - - init_pvr_pool(); - return PVRSRV_OK; + return (ui32AreaFlags & (PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_UNCACHED)) != 0; } -#if defined(DEBUG_LINUX_MEM_AREAS) -static IMG_VOID LinuxMMCleanup_MemAreas_ForEachCb(DEBUG_LINUX_MEM_AREA_REC *psCurrentRecord) +static inline IMG_BOOL +CanFreeToPool(LinuxMemArea *psLinuxMemArea) { - LinuxMemArea *psLinuxMemArea; - - psLinuxMemArea = psCurrentRecord->psLinuxMemArea; - PVR_DPF((PVR_DBG_ERROR, "%s: BUG!: Cleaning up Linux memory area (%p), type=%s, size=%d bytes", - __FUNCTION__, - psCurrentRecord->psLinuxMemArea, - LinuxMemAreaTypeToString(psCurrentRecord->psLinuxMemArea->eAreaType), - psCurrentRecord->psLinuxMemArea->ui32ByteSize)); - - LinuxMemAreaDeepFree(psLinuxMemArea); -} -#endif - -#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) -static IMG_VOID LinuxMMCleanup_MemRecords_ForEachVa(DEBUG_MEM_ALLOC_REC *psCurrentRecord) - -{ - - PVR_DPF((PVR_DBG_ERROR, "%s: BUG!: Cleaning up memory: " - "type=%s " - "CpuVAddr=%p " - "CpuPAddr=0x%08x, " - "allocated @ file=%s,line=%d", - __FUNCTION__, - DebugMemAllocRecordTypeToString(psCurrentRecord->eAllocType), - psCurrentRecord->pvCpuVAddr, - psCurrentRecord->ulCpuPAddr, - psCurrentRecord->pszFileName, - psCurrentRecord->ui32Line)); - switch(psCurrentRecord->eAllocType) - { - case DEBUG_MEM_ALLOC_TYPE_KMALLOC: - KFreeWrapper(psCurrentRecord->pvCpuVAddr); - break; - case DEBUG_MEM_ALLOC_TYPE_IOREMAP: - IOUnmapWrapper(psCurrentRecord->pvCpuVAddr); - break; - case DEBUG_MEM_ALLOC_TYPE_IO: - - DebugMemAllocRecordRemove(DEBUG_MEM_ALLOC_TYPE_IO, psCurrentRecord->pvKey, __FILE__, __LINE__); - break; - case DEBUG_MEM_ALLOC_TYPE_VMALLOC: - VFreeWrapper(psCurrentRecord->pvCpuVAddr); - break; - case DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES: - - DebugMemAllocRecordRemove(DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES, psCurrentRecord->pvKey, __FILE__, __LINE__); - break; - case DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE: - KMemCacheFreeWrapper(psCurrentRecord->pvPrivateData, psCurrentRecord->pvCpuVAddr); - break; - default: - PVR_ASSERT(0); - } + return AreaIsUncached(psLinuxMemArea->ui32AreaFlags) && !psLinuxMemArea->bNeedsCacheInvalidate; } -#endif - - -IMG_VOID -LinuxMMCleanup(IMG_VOID) -{ - -#if defined(DEBUG_LINUX_MEM_AREAS) - { - if(g_LinuxMemAreaCount) - { - PVR_DPF((PVR_DBG_ERROR, "%s: BUG!: There are %d LinuxMemArea allocation unfreed (%d bytes)", - __FUNCTION__, g_LinuxMemAreaCount, g_LinuxMemAreaWaterMark)); - } - - List_DEBUG_LINUX_MEM_AREA_REC_ForEach(g_LinuxMemAreaRecords, - LinuxMMCleanup_MemAreas_ForEachCb); - - RemoveProcEntrySeq( g_SeqFileMemArea ); - } -#endif - - -#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) - { - - - List_DEBUG_MEM_ALLOC_REC_ForEach(g_MemoryRecords, - LinuxMMCleanup_MemRecords_ForEachVa); - - RemoveProcEntrySeq( g_SeqFileMemoryRecords ); - } -#endif - - if(psLinuxMemAreaCache) - { - KMemCacheDestroyWrapper(psLinuxMemAreaCache); - psLinuxMemAreaCache=NULL; - } -} - IMG_VOID * _KMallocWrapper(IMG_UINT32 ui32ByteSize, gfp_t uFlags, IMG_CHAR *pszFileName, IMG_UINT32 ui32Line) @@ -391,7 +293,7 @@ _KMallocWrapper(IMG_UINT32 ui32ByteSize, gfp_t uFlags, IMG_CHAR *pszFileName, IM IMG_VOID *pvRet; pvRet = kmalloc(ui32ByteSize, uFlags); #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) - if(pvRet) + if (pvRet) { DebugMemAllocRecordAdd(DEBUG_MEM_ALLOC_TYPE_KMALLOC, pvRet, @@ -401,7 +303,7 @@ _KMallocWrapper(IMG_UINT32 ui32ByteSize, gfp_t uFlags, IMG_CHAR *pszFileName, IM ui32ByteSize, pszFileName, ui32Line - ); + ); } #else PVR_UNREFERENCED_PARAMETER(pszFileName); @@ -450,31 +352,35 @@ DebugMemAllocRecordAdd(DEBUG_MEM_ALLOC_TYPE eAllocType, psRecord->ui32Bytes = ui32Bytes; psRecord->pszFileName = pszFileName; psRecord->ui32Line = ui32Line; - + List_DEBUG_MEM_ALLOC_REC_Insert(&g_MemoryRecords, psRecord); - + g_WaterMarkData[eAllocType] += ui32Bytes; - if(g_WaterMarkData[eAllocType] > g_HighWaterMarkData[eAllocType]) + if (g_WaterMarkData[eAllocType] > g_HighWaterMarkData[eAllocType]) { g_HighWaterMarkData[eAllocType] = g_WaterMarkData[eAllocType]; } - if(eAllocType == DEBUG_MEM_ALLOC_TYPE_KMALLOC + if (eAllocType == DEBUG_MEM_ALLOC_TYPE_KMALLOC || eAllocType == DEBUG_MEM_ALLOC_TYPE_VMALLOC || eAllocType == DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES || eAllocType == DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE) { + IMG_UINT32 ui32SysRAMTrueWaterMark; + g_SysRAMWaterMark += ui32Bytes; - if(g_SysRAMWaterMark > g_SysRAMHighWaterMark) + ui32SysRAMTrueWaterMark = SysRAMTrueWaterMark(); + + if (ui32SysRAMTrueWaterMark > g_SysRAMHighWaterMark) { - g_SysRAMHighWaterMark = g_SysRAMWaterMark; + g_SysRAMHighWaterMark = ui32SysRAMTrueWaterMark; } } - else if(eAllocType == DEBUG_MEM_ALLOC_TYPE_IOREMAP + else if (eAllocType == DEBUG_MEM_ALLOC_TYPE_IOREMAP || eAllocType == DEBUG_MEM_ALLOC_TYPE_IO) { g_IOMemWaterMark += ui32Bytes; - if(g_IOMemWaterMark > g_IOMemHighWaterMark) + if (g_IOMemWaterMark > g_IOMemHighWaterMark) { g_IOMemHighWaterMark = g_IOMemWaterMark; } @@ -488,29 +394,29 @@ static IMG_BOOL DebugMemAllocRecordRemove_AnyVaCb(DEBUG_MEM_ALLOC_REC *psCurrent { DEBUG_MEM_ALLOC_TYPE eAllocType; IMG_VOID *pvKey; - + eAllocType = va_arg(va, DEBUG_MEM_ALLOC_TYPE); pvKey = va_arg(va, IMG_VOID*); - if(psCurrentRecord->eAllocType == eAllocType + if (psCurrentRecord->eAllocType == eAllocType && psCurrentRecord->pvKey == pvKey) { eAllocType = psCurrentRecord->eAllocType; g_WaterMarkData[eAllocType] -= psCurrentRecord->ui32Bytes; - - if(eAllocType == DEBUG_MEM_ALLOC_TYPE_KMALLOC + + if (eAllocType == DEBUG_MEM_ALLOC_TYPE_KMALLOC || eAllocType == DEBUG_MEM_ALLOC_TYPE_VMALLOC || eAllocType == DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES || eAllocType == DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE) { g_SysRAMWaterMark -= psCurrentRecord->ui32Bytes; } - else if(eAllocType == DEBUG_MEM_ALLOC_TYPE_IOREMAP + else if (eAllocType == DEBUG_MEM_ALLOC_TYPE_IOREMAP || eAllocType == DEBUG_MEM_ALLOC_TYPE_IO) { g_IOMemWaterMark -= psCurrentRecord->ui32Bytes; } - + List_DEBUG_MEM_ALLOC_REC_Remove(psCurrentRecord); kfree(psCurrentRecord); @@ -528,8 +434,8 @@ DebugMemAllocRecordRemove(DEBUG_MEM_ALLOC_TYPE eAllocType, IMG_VOID *pvKey, IMG_ { LinuxLockMutex(&g_sDebugMutex); - - if(!List_DEBUG_MEM_ALLOC_REC_IMG_BOOL_Any_va(g_MemoryRecords, + + if (!List_DEBUG_MEM_ALLOC_REC_IMG_BOOL_Any_va(g_MemoryRecords, DebugMemAllocRecordRemove_AnyVaCb, eAllocType, pvKey)) @@ -552,24 +458,22 @@ DebugMemAllocRecordTypeToString(DEBUG_MEM_ALLOC_TYPE eAllocType) "ALLOC_PAGES", "IOREMAP", "IO", - "KMEM_CACHE_ALLOC" + "KMEM_CACHE_ALLOC", +#if defined(PVR_LINUX_MEM_AREA_USE_VMAP) + "VMAP" +#endif }; return apszDebugMemoryRecordTypes[eAllocType]; } #endif - -IMG_VOID * -_VMallocWrapper(IMG_UINT32 ui32Bytes, - IMG_UINT32 ui32AllocFlags, - IMG_CHAR *pszFileName, - IMG_UINT32 ui32Line) +static IMG_BOOL +AllocFlagsToPGProt(pgprot_t *pPGProtFlags, IMG_UINT32 ui32AllocFlags) { pgprot_t PGProtFlags; - IMG_VOID *pvRet; - switch(ui32AllocFlags & PVRSRV_HAP_CACHETYPE_MASK) + switch (ui32AllocFlags & PVRSRV_HAP_CACHETYPE_MASK) { case PVRSRV_HAP_CACHED: PGProtFlags = PAGE_KERNEL; @@ -582,17 +486,36 @@ _VMallocWrapper(IMG_UINT32 ui32Bytes, break; default: PVR_DPF((PVR_DBG_ERROR, - "VMAllocWrapper: unknown mapping flags=0x%08x", - ui32AllocFlags)); + "%s: Unknown mapping flags=0x%08x", + __FUNCTION__, ui32AllocFlags)); dump_stack(); - return NULL; + return IMG_FALSE; } + *pPGProtFlags = PGProtFlags; - pvRet = __vmalloc(ui32Bytes, GFP_KERNEL | __GFP_HIGHMEM, PGProtFlags); + return IMG_TRUE; +} +IMG_VOID * +_VMallocWrapper(IMG_UINT32 ui32Bytes, + IMG_UINT32 ui32AllocFlags, + IMG_CHAR *pszFileName, + IMG_UINT32 ui32Line) +{ + pgprot_t PGProtFlags; + IMG_VOID *pvRet; + + if (!AllocFlagsToPGProt(&PGProtFlags, ui32AllocFlags)) + { + return NULL; + } + + + pvRet = __vmalloc(ui32Bytes, GFP_KERNEL | __GFP_HIGHMEM, PGProtFlags); + #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) - if(pvRet) + if (pvRet) { DebugMemAllocRecordAdd(DEBUG_MEM_ALLOC_TYPE_VMALLOC, pvRet, @@ -602,7 +525,7 @@ _VMallocWrapper(IMG_UINT32 ui32Bytes, PAGE_ALIGN(ui32Bytes), pszFileName, ui32Line - ); + ); } #else PVR_UNREFERENCED_PARAMETER(pszFileName); @@ -626,44 +549,488 @@ _VFreeWrapper(IMG_VOID *pvCpuVAddr, IMG_CHAR *pszFileName, IMG_UINT32 ui32Line) } +#if defined(PVR_LINUX_MEM_AREA_USE_VMAP) +static IMG_VOID * +_VMapWrapper(struct page **ppsPageList, IMG_UINT32 ui32NumPages, IMG_UINT32 ui32AllocFlags, IMG_CHAR *pszFileName, IMG_UINT32 ui32Line) +{ + pgprot_t PGProtFlags; + IMG_VOID *pvRet; + + if (!AllocFlagsToPGProt(&PGProtFlags, ui32AllocFlags)) + { + return NULL; + } + + pvRet = vmap(ppsPageList, ui32NumPages, GFP_KERNEL | __GFP_HIGHMEM, PGProtFlags); + +#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) + if (pvRet) + { + DebugMemAllocRecordAdd(DEBUG_MEM_ALLOC_TYPE_VMAP, + pvRet, + pvRet, + 0, + NULL, + PAGES_TO_BYTES(ui32NumPages), + pszFileName, + ui32Line + ); + } +#else + PVR_UNREFERENCED_PARAMETER(pszFileName); + PVR_UNREFERENCED_PARAMETER(ui32Line); +#endif + + return pvRet; +} + +#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) +#define VMapWrapper(ppsPageList, ui32Bytes, ui32AllocFlags) _VMapWrapper(ppsPageList, ui32Bytes, ui32AllocFlags, __FILE__, __LINE__) +#else +#define VMapWrapper(ppsPageList, ui32Bytes, ui32AllocFlags) _VMapWrapper(ppsPageList, ui32Bytes, ui32AllocFlags, NULL, 0) +#endif + + +static IMG_VOID +_VUnmapWrapper(IMG_VOID *pvCpuVAddr, IMG_CHAR *pszFileName, IMG_UINT32 ui32Line) +{ +#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) + DebugMemAllocRecordRemove(DEBUG_MEM_ALLOC_TYPE_VMAP, pvCpuVAddr, pszFileName, ui32Line); +#else + PVR_UNREFERENCED_PARAMETER(pszFileName); + PVR_UNREFERENCED_PARAMETER(ui32Line); +#endif + vunmap(pvCpuVAddr); +} + +#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) +#define VUnmapWrapper(pvCpuVAddr) _VUnmapWrapper(pvCpuVAddr, __FILE__, __LINE__) +#else +#define VUnmapWrapper(pvCpuVAddr) _VUnmapWrapper(pvCpuVAddr, NULL, 0) +#endif + +#endif + + +IMG_VOID +_KMemCacheFreeWrapper(LinuxKMemCache *psCache, IMG_VOID *pvObject, IMG_CHAR *pszFileName, IMG_UINT32 ui32Line) +{ +#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) + DebugMemAllocRecordRemove(DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE, pvObject, pszFileName, ui32Line); +#else + PVR_UNREFERENCED_PARAMETER(pszFileName); + PVR_UNREFERENCED_PARAMETER(ui32Line); +#endif + + kmem_cache_free(psCache, pvObject); +} + + +const IMG_CHAR * +KMemCacheNameWrapper(LinuxKMemCache *psCache) +{ + PVR_UNREFERENCED_PARAMETER(psCache); + + + return ""; +} + + +static LinuxPagePoolEntry * +LinuxPagePoolEntryAlloc(IMG_VOID) +{ + return KMemCacheAllocWrapper(g_PsLinuxPagePoolCache, GFP_KERNEL); +} + +static IMG_VOID +LinuxPagePoolEntryFree(LinuxPagePoolEntry *psPagePoolEntry) +{ + KMemCacheFreeWrapper(g_PsLinuxPagePoolCache, psPagePoolEntry); +} + + +static struct page * +AllocPageFromLinux(void) +{ + struct page *psPage; + + psPage = alloc_pages(GFP_KERNEL | __GFP_HIGHMEM, 0); + if (!psPage) + { + return NULL; + + } +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)) + SetPageReserved(psPage); +#else + mem_map_reserve(psPage); +#endif +#endif + return psPage; +} + + +static IMG_VOID +FreePageToLinux(struct page *psPage) +{ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)) + ClearPageReserved(psPage); +#else + mem_map_reserve(psPage); +#endif +#endif + __free_pages(psPage, 0); +} + + +#if (PVR_LINUX_MEM_AREA_POOL_MAX_PAGES != 0) +static DEFINE_MUTEX(g_sPagePoolMutex); + +static inline void +PagePoolLock(void) +{ + mutex_lock(&g_sPagePoolMutex); +} + +static inline void +PagePoolUnlock(void) +{ + mutex_unlock(&g_sPagePoolMutex); +} + +static inline int +PagePoolTrylock(void) +{ + return mutex_trylock(&g_sPagePoolMutex); +} + +#else +static inline void +PagePoolLock(void) +{ +} + +static inline void +PagePoolUnlock(void) +{ +} + +static inline int +PagePoolTrylock(void) +{ + return 1; +} +#endif + + +static inline void +AddEntryToPool(LinuxPagePoolEntry *psPagePoolEntry) +{ + list_add_tail(&psPagePoolEntry->sPagePoolItem, &g_sPagePoolList); + atomic_inc(&g_sPagePoolEntryCount); +} + +static inline void +RemoveEntryFromPool(LinuxPagePoolEntry *psPagePoolEntry) +{ + list_del(&psPagePoolEntry->sPagePoolItem); + atomic_dec(&g_sPagePoolEntryCount); +} + +static inline LinuxPagePoolEntry * +RemoveFirstEntryFromPool(void) +{ + LinuxPagePoolEntry *psPagePoolEntry; + + if (list_empty(&g_sPagePoolList)) + { + PVR_ASSERT(atomic_read(&g_sPagePoolEntryCount) == 0); + + return NULL; + } + + PVR_ASSERT(atomic_read(&g_sPagePoolEntryCount) > 0); + + psPagePoolEntry = list_first_entry(&g_sPagePoolList, LinuxPagePoolEntry, sPagePoolItem); + + RemoveEntryFromPool(psPagePoolEntry); + + return psPagePoolEntry; +} + +static struct page * +AllocPage(IMG_UINT32 ui32AreaFlags, IMG_BOOL *pbFromPagePool) +{ + struct page *psPage = NULL; + + + if (AreaIsUncached(ui32AreaFlags) && atomic_read(&g_sPagePoolEntryCount) != 0) + { + LinuxPagePoolEntry *psPagePoolEntry; + + PagePoolLock(); + psPagePoolEntry = RemoveFirstEntryFromPool(); + PagePoolUnlock(); + + + if (psPagePoolEntry) + { + psPage = psPagePoolEntry->psPage; + LinuxPagePoolEntryFree(psPagePoolEntry); + *pbFromPagePool = IMG_TRUE; + } + } + + if (!psPage) + { + psPage = AllocPageFromLinux(); + if (psPage) + { + *pbFromPagePool = IMG_FALSE; + } + } + + return psPage; + +} + +static IMG_VOID +FreePage(IMG_BOOL bToPagePool, struct page *psPage) +{ + + if (bToPagePool && atomic_read(&g_sPagePoolEntryCount) < g_iPagePoolMaxEntries) + { + LinuxPagePoolEntry *psPagePoolEntry = LinuxPagePoolEntryAlloc(); + if (psPagePoolEntry) + { + psPagePoolEntry->psPage = psPage; + + PagePoolLock(); + AddEntryToPool(psPagePoolEntry); + PagePoolUnlock(); + + return; + } + } + + FreePageToLinux(psPage); +} + +static IMG_VOID +FreePagePool(IMG_VOID) +{ + LinuxPagePoolEntry *psPagePoolEntry, *psTempPoolEntry; + + PagePoolLock(); + +#if (PVR_LINUX_MEM_AREA_POOL_MAX_PAGES != 0) + PVR_TRACE(("%s: Freeing %d pages from pool", __FUNCTION__, atomic_read(&g_sPagePoolEntryCount))); +#else + PVR_ASSERT(atomic_read(&g_sPagePoolEntryCount) == 0); + PVR_ASSERT(list_empty(&g_sPagePoolList)); +#endif + + list_for_each_entry_safe(psPagePoolEntry, psTempPoolEntry, &g_sPagePoolList, sPagePoolItem) + { + RemoveEntryFromPool(psPagePoolEntry); + + FreePageToLinux(psPagePoolEntry->psPage); + LinuxPagePoolEntryFree(psPagePoolEntry); + } + + PVR_ASSERT(atomic_read(&g_sPagePoolEntryCount) == 0); + + PagePoolUnlock(); +} + +#if defined(PVR_LINUX_MEM_AREA_POOL_ALLOW_SHRINK) +#if defined(PVRSRV_NEED_PVR_ASSERT) +static struct shrinker g_sShrinker; +#endif + +static int +ShrinkPagePool(struct shrinker *psShrinker, struct shrink_control *psShrinkControl) +{ + unsigned long uNumToScan = psShrinkControl->nr_to_scan; + + PVR_ASSERT(psShrinker == &g_sShrinker); + (void)psShrinker; + + if (uNumToScan != 0) + { + LinuxPagePoolEntry *psPagePoolEntry, *psTempPoolEntry; + + PVR_TRACE(("%s: Number to scan: %ld", __FUNCTION__, uNumToScan)); + PVR_TRACE(("%s: Pages in pool before scan: %d", __FUNCTION__, atomic_read(&g_sPagePoolEntryCount))); + + if (!PagePoolTrylock()) + { + PVR_TRACE(("%s: Couldn't get page pool lock", __FUNCTION__)); + return -1; + } + + list_for_each_entry_safe(psPagePoolEntry, psTempPoolEntry, &g_sPagePoolList, sPagePoolItem) + { + RemoveEntryFromPool(psPagePoolEntry); + + FreePageToLinux(psPagePoolEntry->psPage); + LinuxPagePoolEntryFree(psPagePoolEntry); + + if (--uNumToScan == 0) + { + break; + } + } + + if (list_empty(&g_sPagePoolList)) + { + PVR_ASSERT(atomic_read(&g_sPagePoolEntryCount) == 0); + } + + PagePoolUnlock(); + + PVR_TRACE(("%s: Pages in pool after scan: %d", __FUNCTION__, atomic_read(&g_sPagePoolEntryCount))); + } + + return atomic_read(&g_sPagePoolEntryCount); +} +#endif + +static IMG_BOOL +AllocPages(IMG_UINT32 ui32AreaFlags, struct page ***pppsPageList, IMG_HANDLE *phBlockPageList, IMG_UINT32 ui32NumPages, IMG_BOOL *pbFromPagePool) +{ + struct page **ppsPageList; + IMG_HANDLE hBlockPageList; + IMG_INT32 i; + PVRSRV_ERROR eError; + IMG_BOOL bFromPagePool = IMG_FALSE; + + eError = OSAllocMem(0, sizeof(*ppsPageList) * ui32NumPages, (IMG_VOID **)&ppsPageList, &hBlockPageList, + "Array of pages"); + if (eError != PVRSRV_OK) + { + goto failed_page_list_alloc; + } + + *pbFromPagePool = IMG_TRUE; + for(i = 0; i < (IMG_INT32)ui32NumPages; i++) + { + ppsPageList[i] = AllocPage(ui32AreaFlags, &bFromPagePool); + if (!ppsPageList[i]) + { + goto failed_alloc_pages; + } + *pbFromPagePool &= bFromPagePool; + } + + *pppsPageList = ppsPageList; + *phBlockPageList = hBlockPageList; + +#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) + DebugMemAllocRecordAdd(DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES, + ppsPageList, + 0, + 0, + NULL, + PAGES_TO_BYTES(ui32NumPages), + "unknown", + 0 + ); +#endif + + return IMG_TRUE; + +failed_alloc_pages: + for(i--; i >= 0; i--) + { + FreePage(*pbFromPagePool, ppsPageList[i]); + } + (IMG_VOID) OSFreeMem(0, sizeof(*ppsPageList) * ui32NumPages, ppsPageList, hBlockPageList); + +failed_page_list_alloc: + return IMG_FALSE; +} + + +static IMG_VOID +FreePages(IMG_BOOL bToPagePool, struct page **ppsPageList, IMG_HANDLE hBlockPageList, IMG_UINT32 ui32NumPages) +{ + IMG_INT32 i; + + for(i = 0; i < (IMG_INT32)ui32NumPages; i++) + { + FreePage(bToPagePool, ppsPageList[i]); + } + +#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) + DebugMemAllocRecordRemove(DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES, ppsPageList, __FILE__, __LINE__); +#endif + + (IMG_VOID) OSFreeMem(0, sizeof(*ppsPageList) * ui32NumPages, ppsPageList, hBlockPageList); +} + + LinuxMemArea * NewVMallocLinuxMemArea(IMG_UINT32 ui32Bytes, IMG_UINT32 ui32AreaFlags) { - LinuxMemArea *psLinuxMemArea; - IMG_VOID *pvCpuVAddr = NULL; + LinuxMemArea *psLinuxMemArea = NULL; + IMG_VOID *pvCpuVAddr = NULL; +#if defined(PVR_LINUX_MEM_AREA_USE_VMAP) + IMG_UINT32 ui32NumPages = 0; + struct page **ppsPageList = NULL; + IMG_HANDLE hBlockPageList; +#endif + IMG_BOOL bFromPagePool = IMG_FALSE; psLinuxMemArea = LinuxMemAreaStructAlloc(); - if(!psLinuxMemArea) + if (!psLinuxMemArea) { goto failed; } - psLinuxMemArea->bfromPool = IMG_FALSE; - if (pvrsrv_pool_writecombine && ui32Bytes <= 128*1024) { - if ((ui32AreaFlags & PVRSRV_HAP_CACHETYPE_MASK) == - PVRSRV_HAP_WRITECOMBINE) { - pvCpuVAddr = gen_pool_alloc(pvrsrv_pool_writecombine, - PAGE_ALIGN(ui32Bytes)); - if (pvCpuVAddr) - psLinuxMemArea->bfromPool = IMG_TRUE; - } - } +#if defined(PVR_LINUX_MEM_AREA_USE_VMAP) + ui32NumPages = RANGE_TO_PAGES(ui32Bytes); + + if (!AllocPages(ui32AreaFlags, &ppsPageList, &hBlockPageList, ui32NumPages, &bFromPagePool)) + { + goto failed; + } + + pvCpuVAddr = VMapWrapper(ppsPageList, ui32NumPages, ui32AreaFlags); +#else + psLinuxMemArea->bfromPool = IMG_FALSE; + if (pvrsrv_pool_writecombine && ui32Bytes <= 128*1024) { + if ((ui32AreaFlags & PVRSRV_HAP_CACHETYPE_MASK) == + PVRSRV_HAP_WRITECOMBINE) { + pvCpuVAddr = gen_pool_alloc(pvrsrv_pool_writecombine, + PAGE_ALIGN(ui32Bytes)); + if (pvCpuVAddr) + psLinuxMemArea->bfromPool = IMG_TRUE; + } + } - if (!pvCpuVAddr) - pvCpuVAddr = VMallocWrapper(ui32Bytes, ui32AreaFlags); + if (!pvCpuVAddr) + pvCpuVAddr = VMallocWrapper(ui32Bytes, ui32AreaFlags); - if(!pvCpuVAddr) + if (!pvCpuVAddr) { goto failed; } - #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) - + ReservePages(pvCpuVAddr, ui32Bytes); #endif +#endif psLinuxMemArea->eAreaType = LINUX_MEM_AREA_VMALLOC; psLinuxMemArea->uData.sVmalloc.pvVmallocAddress = pvCpuVAddr; +#if defined(PVR_LINUX_MEM_AREA_USE_VMAP) + psLinuxMemArea->uData.sVmalloc.ppsPageList = ppsPageList; + psLinuxMemArea->uData.sVmalloc.hBlockPageList = hBlockPageList; +#endif psLinuxMemArea->ui32ByteSize = ui32Bytes; psLinuxMemArea->ui32AreaFlags = ui32AreaFlags; INIT_LIST_HEAD(&psLinuxMemArea->sMMapOffsetStructList); @@ -672,16 +1039,27 @@ NewVMallocLinuxMemArea(IMG_UINT32 ui32Bytes, IMG_UINT32 ui32AreaFlags) DebugLinuxMemAreaRecordAdd(psLinuxMemArea, ui32AreaFlags); #endif - - if(ui32AreaFlags & (PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_UNCACHED)) + + if (AreaIsUncached(ui32AreaFlags) && !bFromPagePool) + { OSInvalidateCPUCacheRangeKM(psLinuxMemArea, pvCpuVAddr, ui32Bytes); + } return psLinuxMemArea; failed: PVR_DPF((PVR_DBG_ERROR, "%s: failed!", __FUNCTION__)); - if(psLinuxMemArea) +#if defined(PVR_LINUX_MEM_AREA_USE_VMAP) + if (ppsPageList) + { + FreePages(bFromPagePool, ppsPageList, hBlockPageList, ui32NumPages); + } +#endif + if (psLinuxMemArea) + { LinuxMemAreaStructFree(psLinuxMemArea); + } + return NULL; } @@ -689,6 +1067,12 @@ failed: IMG_VOID FreeVMallocLinuxMemArea(LinuxMemArea *psLinuxMemArea) { +#if defined(PVR_LINUX_MEM_AREA_USE_VMAP) + IMG_UINT32 ui32NumPages; + struct page **ppsPageList; + IMG_HANDLE hBlockPageList; +#endif + PVR_ASSERT(psLinuxMemArea); PVR_ASSERT(psLinuxMemArea->eAreaType == LINUX_MEM_AREA_VMALLOC); PVR_ASSERT(psLinuxMemArea->uData.sVmalloc.pvVmallocAddress); @@ -697,19 +1081,29 @@ FreeVMallocLinuxMemArea(LinuxMemArea *psLinuxMemArea) DebugLinuxMemAreaRecordRemove(psLinuxMemArea); #endif + PVR_DPF((PVR_DBG_MESSAGE,"%s: pvCpuVAddr: %p", + __FUNCTION__, psLinuxMemArea->uData.sVmalloc.pvVmallocAddress)); + +#if defined(PVR_LINUX_MEM_AREA_USE_VMAP) + VUnmapWrapper(psLinuxMemArea->uData.sVmalloc.pvVmallocAddress); + + ui32NumPages = RANGE_TO_PAGES(psLinuxMemArea->ui32ByteSize); + ppsPageList = psLinuxMemArea->uData.sVmalloc.ppsPageList; + hBlockPageList = psLinuxMemArea->uData.sVmalloc.hBlockPageList; + + FreePages(CanFreeToPool(psLinuxMemArea), ppsPageList, hBlockPageList, ui32NumPages); +#else #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) - UnreservePages(psLinuxMemArea->uData.sVmalloc.pvVmallocAddress, + UnreservePages(psLinuxMemArea->uData.sVmalloc.pvVmallocAddress, psLinuxMemArea->ui32ByteSize); #endif - - PVR_DPF((PVR_DBG_MESSAGE,"%s: pvCpuVAddr: %p", - __FUNCTION__, psLinuxMemArea->uData.sVmalloc.pvVmallocAddress)); - if (psLinuxMemArea->bfromPool) { - gen_pool_free(pvrsrv_pool_writecombine, - psLinuxMemArea->uData.sVmalloc.pvVmallocAddress, - PAGE_ALIGN(psLinuxMemArea->ui32ByteSize)); - } else - VFreeWrapper(psLinuxMemArea->uData.sVmalloc.pvVmallocAddress); + if (psLinuxMemArea->bfromPool) { + gen_pool_free(pvrsrv_pool_writecombine, + psLinuxMemArea->uData.sVmalloc.pvVmallocAddress, + PAGE_ALIGN(psLinuxMemArea->ui32ByteSize)); + } else + VFreeWrapper(psLinuxMemArea->uData.sVmalloc.pvVmallocAddress); +#endif LinuxMemAreaStructFree(psLinuxMemArea); } @@ -748,7 +1142,7 @@ UnreservePages(IMG_VOID *pvAddress, IMG_UINT32 ui32Length) #endif } } -#endif +#endif IMG_VOID * @@ -759,8 +1153,8 @@ _IORemapWrapper(IMG_CPU_PHYADDR BasePAddr, IMG_UINT32 ui32Line) { IMG_VOID *pvIORemapCookie; - - switch(ui32MappingFlags & PVRSRV_HAP_CACHETYPE_MASK) + + switch (ui32MappingFlags & PVRSRV_HAP_CACHETYPE_MASK) { case PVRSRV_HAP_CACHED: pvIORemapCookie = (IMG_VOID *)IOREMAP(BasePAddr.uiAddr, ui32Bytes); @@ -775,9 +1169,9 @@ _IORemapWrapper(IMG_CPU_PHYADDR BasePAddr, PVR_DPF((PVR_DBG_ERROR, "IORemapWrapper: unknown mapping flags")); return NULL; } - + #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) - if(pvIORemapCookie) + if (pvIORemapCookie) { DebugMemAllocRecordAdd(DEBUG_MEM_ALLOC_TYPE_IOREMAP, pvIORemapCookie, @@ -787,7 +1181,7 @@ _IORemapWrapper(IMG_CPU_PHYADDR BasePAddr, ui32Bytes, pszFileName, ui32Line - ); + ); } #else PVR_UNREFERENCED_PARAMETER(pszFileName); @@ -820,13 +1214,13 @@ NewIORemapLinuxMemArea(IMG_CPU_PHYADDR BasePAddr, IMG_VOID *pvIORemapCookie; psLinuxMemArea = LinuxMemAreaStructAlloc(); - if(!psLinuxMemArea) + if (!psLinuxMemArea) { return NULL; } pvIORemapCookie = IORemapWrapper(BasePAddr, ui32Bytes, ui32AreaFlags); - if(!pvIORemapCookie) + if (!pvIORemapCookie) { LinuxMemAreaStructFree(psLinuxMemArea); return NULL; @@ -855,7 +1249,7 @@ FreeIORemapLinuxMemArea(LinuxMemArea *psLinuxMemArea) #if defined(DEBUG_LINUX_MEM_AREAS) DebugLinuxMemAreaRecordRemove(psLinuxMemArea); #endif - + IOUnmapWrapper(psLinuxMemArea->uData.sIORemap.pvIORemapCookie); LinuxMemAreaStructFree(psLinuxMemArea); @@ -870,7 +1264,7 @@ TreatExternalPagesAsContiguous(IMG_SYS_PHYADDR *psSysPhysAddr, IMG_UINT32 ui32By IMG_UINT32 ui32AddrChk; IMG_UINT32 ui32NumPages = RANGE_TO_PAGES(ui32Bytes); - + for (ui32 = 0, ui32AddrChk = psSysPhysAddr[0].uiAddr; ui32 < ui32NumPages; ui32++, ui32AddrChk = (bPhysContig) ? (ui32AddrChk + PAGE_SIZE) : psSysPhysAddr[ui32].uiAddr) @@ -907,7 +1301,7 @@ LinuxMemArea *NewExternalKVLinuxMemArea(IMG_SYS_PHYADDR *pBasePAddr, IMG_VOID *p LinuxMemArea *psLinuxMemArea; psLinuxMemArea = LinuxMemAreaStructAlloc(); - if(!psLinuxMemArea) + if (!psLinuxMemArea) { return NULL; } @@ -949,7 +1343,7 @@ FreeExternalKVLinuxMemArea(LinuxMemArea *psLinuxMemArea) #if defined(DEBUG_LINUX_MEM_AREAS) DebugLinuxMemAreaRecordRemove(psLinuxMemArea); #endif - + LinuxMemAreaStructFree(psLinuxMemArea); } @@ -960,12 +1354,12 @@ NewIOLinuxMemArea(IMG_CPU_PHYADDR BasePAddr, IMG_UINT32 ui32AreaFlags) { LinuxMemArea *psLinuxMemArea = LinuxMemAreaStructAlloc(); - if(!psLinuxMemArea) + if (!psLinuxMemArea) { return NULL; } - + psLinuxMemArea->eAreaType = LINUX_MEM_AREA_IO; psLinuxMemArea->uData.sIO.CPUPhysAddr.uiAddr = BasePAddr.uiAddr; psLinuxMemArea->ui32ByteSize = ui32Bytes; @@ -981,9 +1375,9 @@ NewIOLinuxMemArea(IMG_CPU_PHYADDR BasePAddr, ui32Bytes, "unknown", 0 - ); + ); #endif - + #if defined(DEBUG_LINUX_MEM_AREAS) DebugLinuxMemAreaRecordAdd(psLinuxMemArea, ui32AreaFlags); #endif @@ -996,7 +1390,7 @@ IMG_VOID FreeIOLinuxMemArea(LinuxMemArea *psLinuxMemArea) { PVR_ASSERT(psLinuxMemArea->eAreaType == LINUX_MEM_AREA_IO); - + #if defined(DEBUG_LINUX_MEM_AREAS) DebugLinuxMemAreaRecordRemove(psLinuxMemArea); #endif @@ -1006,7 +1400,7 @@ FreeIOLinuxMemArea(LinuxMemArea *psLinuxMemArea) (IMG_VOID *)psLinuxMemArea->uData.sIO.CPUPhysAddr.uiAddr, __FILE__, __LINE__); #endif - + LinuxMemAreaStructFree(psLinuxMemArea); } @@ -1016,87 +1410,45 @@ LinuxMemArea * NewAllocPagesLinuxMemArea(IMG_UINT32 ui32Bytes, IMG_UINT32 ui32AreaFlags) { LinuxMemArea *psLinuxMemArea; - IMG_UINT32 ui32PageCount; - struct page **pvPageList; + IMG_UINT32 ui32NumPages; + struct page **ppsPageList; IMG_HANDLE hBlockPageList; - IMG_INT32 i; - PVRSRV_ERROR eError; + IMG_BOOL bFromPagePool; psLinuxMemArea = LinuxMemAreaStructAlloc(); - if(!psLinuxMemArea) + if (!psLinuxMemArea) { goto failed_area_alloc; } + + ui32NumPages = RANGE_TO_PAGES(ui32Bytes); - ui32PageCount = RANGE_TO_PAGES(ui32Bytes); - eError = OSAllocMem(0, sizeof(*pvPageList) * ui32PageCount, (IMG_VOID **)&pvPageList, &hBlockPageList, - "Array of pages"); - if(eError != PVRSRV_OK) - { - goto failed_page_list_alloc; - } - - for(i=0; i<(IMG_INT32)ui32PageCount; i++) + if (!AllocPages(ui32AreaFlags, &ppsPageList, &hBlockPageList, ui32NumPages, &bFromPagePool)) { - pvPageList[i] = alloc_pages(GFP_KERNEL | __GFP_HIGHMEM, 0); - if(!pvPageList[i]) - { - goto failed_alloc_pages; - } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)) - SetPageReserved(pvPageList[i]); -#else - mem_map_reserve(pvPageList[i]); -#endif -#endif - - } - -#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) - DebugMemAllocRecordAdd(DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES, - pvPageList, - 0, - 0, - NULL, - PAGE_ALIGN(ui32Bytes), - "unknown", - 0 - ); -#endif + goto failed_alloc_pages; + } psLinuxMemArea->eAreaType = LINUX_MEM_AREA_ALLOC_PAGES; - psLinuxMemArea->uData.sPageList.pvPageList = pvPageList; + psLinuxMemArea->uData.sPageList.ppsPageList = ppsPageList; psLinuxMemArea->uData.sPageList.hBlockPageList = hBlockPageList; psLinuxMemArea->ui32ByteSize = ui32Bytes; psLinuxMemArea->ui32AreaFlags = ui32AreaFlags; INIT_LIST_HEAD(&psLinuxMemArea->sMMapOffsetStructList); - - if(ui32AreaFlags & (PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_UNCACHED)) - { - psLinuxMemArea->bNeedsCacheInvalidate = IMG_TRUE; - } + + psLinuxMemArea->bNeedsCacheInvalidate = AreaIsUncached(ui32AreaFlags) && !bFromPagePool; #if defined(DEBUG_LINUX_MEM_AREAS) DebugLinuxMemAreaRecordAdd(psLinuxMemArea, ui32AreaFlags); #endif return psLinuxMemArea; - + failed_alloc_pages: - for(i--; i >= 0; i--) - { - __free_pages(pvPageList[i], 0); - } - (IMG_VOID) OSFreeMem(0, sizeof(*pvPageList) * ui32PageCount, pvPageList, hBlockPageList); - psLinuxMemArea->uData.sPageList.pvPageList = IMG_NULL; -failed_page_list_alloc: LinuxMemAreaStructFree(psLinuxMemArea); failed_area_alloc: PVR_DPF((PVR_DBG_ERROR, "%s: failed", __FUNCTION__)); - + return NULL; } @@ -1104,10 +1456,9 @@ failed_area_alloc: IMG_VOID FreeAllocPagesLinuxMemArea(LinuxMemArea *psLinuxMemArea) { - IMG_UINT32 ui32PageCount; - struct page **pvPageList; + IMG_UINT32 ui32NumPages; + struct page **ppsPageList; IMG_HANDLE hBlockPageList; - IMG_INT32 i; PVR_ASSERT(psLinuxMemArea); PVR_ASSERT(psLinuxMemArea->eAreaType == LINUX_MEM_AREA_ALLOC_PAGES); @@ -1115,30 +1466,13 @@ FreeAllocPagesLinuxMemArea(LinuxMemArea *psLinuxMemArea) #if defined(DEBUG_LINUX_MEM_AREAS) DebugLinuxMemAreaRecordRemove(psLinuxMemArea); #endif - - ui32PageCount = RANGE_TO_PAGES(psLinuxMemArea->ui32ByteSize); - pvPageList = psLinuxMemArea->uData.sPageList.pvPageList; + + ui32NumPages = RANGE_TO_PAGES(psLinuxMemArea->ui32ByteSize); + ppsPageList = psLinuxMemArea->uData.sPageList.ppsPageList; hBlockPageList = psLinuxMemArea->uData.sPageList.hBlockPageList; - -#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) - DebugMemAllocRecordRemove(DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES, pvPageList, __FILE__, __LINE__); -#endif - - for(i=0;i<(IMG_INT32)ui32PageCount;i++) - { -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)) - ClearPageReserved(pvPageList[i]); -#else - mem_map_reserve(pvPageList[i]); -#endif -#endif - __free_pages(pvPageList[i], 0); - } - - (IMG_VOID) OSFreeMem(0, sizeof(*pvPageList) * ui32PageCount, pvPageList, hBlockPageList); - psLinuxMemArea->uData.sPageList.pvPageList = IMG_NULL; - + + FreePages(CanFreeToPool(psLinuxMemArea), ppsPageList, hBlockPageList, ui32NumPages); + LinuxMemAreaStructFree(psLinuxMemArea); } @@ -1166,29 +1500,29 @@ NewIONLinuxMemArea(IMG_UINT32 ui32Bytes, IMG_UINT32 ui32AreaFlags, LinuxMemArea *psLinuxMemArea; psLinuxMemArea = LinuxMemAreaStructAlloc(); - if(!psLinuxMemArea) + if (!psLinuxMemArea) { PVR_DPF((PVR_DBG_ERROR, "%s: Failed to allocate LinuxMemArea struct", __func__)); goto err_out; } - + BUG_ON(ui32PrivDataLength != ui32AllocDataLen && ui32PrivDataLength != ui32AllocDataLen * 2); ui32NumHandlesPerFd = ui32PrivDataLength / ui32AllocDataLen; - + for(i = 0; i < ui32NumHandlesPerFd; i++) { memcpy(&asAllocData[i], &pbPrivData[i * ui32AllocDataLen], ui32AllocDataLen); - if(omap_ion_tiler_alloc(gpsIONClient, &asAllocData[i]) < 0) + if (omap_ion_tiler_alloc(gpsIONClient, &asAllocData[i]) < 0) { PVR_DPF((PVR_DBG_ERROR, "%s: Failed to allocate via ion_tiler", __func__)); goto err_free; } - if(omap_tiler_pages(gpsIONClient, asAllocData[i].handle, &iNumPages[i], + if (omap_tiler_pages(gpsIONClient, asAllocData[i].handle, &iNumPages[i], &pu32PageAddrs[i]) < 0) { PVR_DPF((PVR_DBG_ERROR, "%s: Failed to compute tiler pages", __func__)); @@ -1196,13 +1530,13 @@ NewIONLinuxMemArea(IMG_UINT32 ui32Bytes, IMG_UINT32 ui32AreaFlags, } } - + BUG_ON(ui32Bytes != (iNumPages[0] + iNumPages[1]) * PAGE_SIZE); BUG_ON(sizeof(IMG_CPU_PHYADDR) != sizeof(int)); - + pCPUPhysAddrs = vmalloc(sizeof(IMG_CPU_PHYADDR) * (iNumPages[0] + iNumPages[1])); - if(!pCPUPhysAddrs) + if (!pCPUPhysAddrs) { PVR_DPF((PVR_DBG_ERROR, "%s: Failed to allocate page list", __func__)); goto err_free; @@ -1221,7 +1555,7 @@ NewIONLinuxMemArea(IMG_UINT32 ui32Bytes, IMG_UINT32 ui32AreaFlags, PAGE_ALIGN(ui32Bytes), "unknown", 0 - ); + ); #endif for(i = 0; i < 2; i++) @@ -1233,11 +1567,8 @@ NewIONLinuxMemArea(IMG_UINT32 ui32Bytes, IMG_UINT32 ui32AreaFlags, psLinuxMemArea->ui32AreaFlags = ui32AreaFlags; INIT_LIST_HEAD(&psLinuxMemArea->sMMapOffsetStructList); - - if(ui32AreaFlags & (PVRSRV_HAP_WRITECOMBINE | PVRSRV_HAP_UNCACHED)) - { - psLinuxMemArea->bNeedsCacheInvalidate = IMG_TRUE; - } + + psLinuxMemArea->bNeedsCacheInvalidate = AreaIsUncached(ui32AreaFlags); #if defined(DEBUG_LINUX_MEM_AREAS) DebugLinuxMemAreaRecordAdd(psLinuxMemArea, ui32AreaFlags); @@ -1270,20 +1601,20 @@ FreeIONLinuxMemArea(LinuxMemArea *psLinuxMemArea) for(i = 0; i < 2; i++) { - if(!psLinuxMemArea->uData.sIONTilerAlloc.psIONHandle[i]) + if (!psLinuxMemArea->uData.sIONTilerAlloc.psIONHandle[i]) break; ion_free(gpsIONClient, psLinuxMemArea->uData.sIONTilerAlloc.psIONHandle[i]); psLinuxMemArea->uData.sIONTilerAlloc.psIONHandle[i] = IMG_NULL; } - + vfree(psLinuxMemArea->uData.sIONTilerAlloc.pCPUPhysAddrs); psLinuxMemArea->uData.sIONTilerAlloc.pCPUPhysAddrs = IMG_NULL; LinuxMemAreaStructFree(psLinuxMemArea); } -#endif +#endif struct page* LinuxMemAreaOffsetToPage(LinuxMemArea *psLinuxMemArea, @@ -1292,19 +1623,19 @@ LinuxMemAreaOffsetToPage(LinuxMemArea *psLinuxMemArea, IMG_UINT32 ui32PageIndex; IMG_CHAR *pui8Addr; - switch(psLinuxMemArea->eAreaType) + switch (psLinuxMemArea->eAreaType) { case LINUX_MEM_AREA_ALLOC_PAGES: ui32PageIndex = PHYS_TO_PFN(ui32ByteOffset); - return psLinuxMemArea->uData.sPageList.pvPageList[ui32PageIndex]; - + return psLinuxMemArea->uData.sPageList.ppsPageList[ui32PageIndex]; + case LINUX_MEM_AREA_VMALLOC: pui8Addr = psLinuxMemArea->uData.sVmalloc.pvVmallocAddress; pui8Addr += ui32ByteOffset; return vmalloc_to_page(pui8Addr); - + case LINUX_MEM_AREA_SUB_ALLOC: - + return LinuxMemAreaOffsetToPage(psLinuxMemArea->uData.sSubAlloc.psParentLinuxMemArea, psLinuxMemArea->uData.sSubAlloc.ui32ByteOffset + ui32ByteOffset); @@ -1329,8 +1660,8 @@ KMemCacheCreateWrapper(IMG_CHAR *pszName, return kmem_cache_create(pszName, Size, Align, ui32Flags, NULL #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,22)) , NULL -#endif - ); +#endif + ); } @@ -1352,7 +1683,7 @@ _KMemCacheAllocWrapper(LinuxKMemCache *psCache, IMG_UINT32 ui32Line) { IMG_VOID *pvRet; - + pvRet = kmem_cache_zalloc(psCache, Flags); #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) @@ -1364,55 +1695,31 @@ _KMemCacheAllocWrapper(LinuxKMemCache *psCache, kmem_cache_size(psCache), pszFileName, ui32Line - ); + ); #else PVR_UNREFERENCED_PARAMETER(pszFileName); PVR_UNREFERENCED_PARAMETER(ui32Line); #endif - + return pvRet; } -IMG_VOID -_KMemCacheFreeWrapper(LinuxKMemCache *psCache, IMG_VOID *pvObject, IMG_CHAR *pszFileName, IMG_UINT32 ui32Line) -{ -#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) - DebugMemAllocRecordRemove(DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE, pvObject, pszFileName, ui32Line); -#else - PVR_UNREFERENCED_PARAMETER(pszFileName); - PVR_UNREFERENCED_PARAMETER(ui32Line); -#endif - - kmem_cache_free(psCache, pvObject); -} - - -const IMG_CHAR * -KMemCacheNameWrapper(LinuxKMemCache *psCache) -{ - PVR_UNREFERENCED_PARAMETER(psCache); - - - return ""; -} - - LinuxMemArea * NewSubLinuxMemArea(LinuxMemArea *psParentLinuxMemArea, IMG_UINT32 ui32ByteOffset, IMG_UINT32 ui32Bytes) { LinuxMemArea *psLinuxMemArea; - + PVR_ASSERT((ui32ByteOffset+ui32Bytes) <= psParentLinuxMemArea->ui32ByteSize); - + psLinuxMemArea = LinuxMemAreaStructAlloc(); - if(!psLinuxMemArea) + if (!psLinuxMemArea) { return NULL; } - + psLinuxMemArea->eAreaType = LINUX_MEM_AREA_SUB_ALLOC; psLinuxMemArea->uData.sSubAlloc.psParentLinuxMemArea = psParentLinuxMemArea; psLinuxMemArea->uData.sSubAlloc.ui32ByteOffset = ui32ByteOffset; @@ -1420,7 +1727,7 @@ NewSubLinuxMemArea(LinuxMemArea *psParentLinuxMemArea, psLinuxMemArea->ui32AreaFlags = psParentLinuxMemArea->ui32AreaFlags; psLinuxMemArea->bNeedsCacheInvalidate = psParentLinuxMemArea->bNeedsCacheInvalidate; INIT_LIST_HEAD(&psLinuxMemArea->sMMapOffsetStructList); - + #if defined(DEBUG_LINUX_MEM_AREAS) { DEBUG_LINUX_MEM_AREA_REC *psParentRecord; @@ -1428,7 +1735,7 @@ NewSubLinuxMemArea(LinuxMemArea *psParentLinuxMemArea, DebugLinuxMemAreaRecordAdd(psLinuxMemArea, psParentRecord->ui32Flags); } #endif - + return psLinuxMemArea; } @@ -1441,8 +1748,8 @@ FreeSubLinuxMemArea(LinuxMemArea *psLinuxMemArea) #if defined(DEBUG_LINUX_MEM_AREAS) DebugLinuxMemAreaRecordRemove(psLinuxMemArea); #endif - - + + LinuxMemAreaStructFree(psLinuxMemArea); } @@ -1453,12 +1760,12 @@ LinuxMemAreaStructAlloc(IMG_VOID) { #if 0 LinuxMemArea *psLinuxMemArea; - psLinuxMemArea = kmem_cache_alloc(psLinuxMemAreaCache, GFP_KERNEL); + psLinuxMemArea = kmem_cache_alloc(g_PsLinuxMemAreaCache, GFP_KERNEL); printk(KERN_ERR "%s: psLinuxMemArea=%p\n", __FUNCTION__, psLinuxMemArea); dump_stack(); return psLinuxMemArea; #else - return KMemCacheAllocWrapper(psLinuxMemAreaCache, GFP_KERNEL); + return KMemCacheAllocWrapper(g_PsLinuxMemAreaCache, GFP_KERNEL); #endif } @@ -1466,16 +1773,16 @@ LinuxMemAreaStructAlloc(IMG_VOID) static IMG_VOID LinuxMemAreaStructFree(LinuxMemArea *psLinuxMemArea) { - KMemCacheFreeWrapper(psLinuxMemAreaCache, psLinuxMemArea); - - + KMemCacheFreeWrapper(g_PsLinuxMemAreaCache, psLinuxMemArea); + + } IMG_VOID LinuxMemAreaDeepFree(LinuxMemArea *psLinuxMemArea) { - switch(psLinuxMemArea->eAreaType) + switch (psLinuxMemArea->eAreaType) { case LINUX_MEM_AREA_VMALLOC: FreeVMallocLinuxMemArea(psLinuxMemArea); @@ -1512,28 +1819,28 @@ DebugLinuxMemAreaRecordAdd(LinuxMemArea *psLinuxMemArea, IMG_UINT32 ui32Flags) { DEBUG_LINUX_MEM_AREA_REC *psNewRecord; const IMG_CHAR *pi8FlagsString; - + LinuxLockMutex(&g_sDebugMutex); - if(psLinuxMemArea->eAreaType != LINUX_MEM_AREA_SUB_ALLOC) + if (psLinuxMemArea->eAreaType != LINUX_MEM_AREA_SUB_ALLOC) { g_LinuxMemAreaWaterMark += psLinuxMemArea->ui32ByteSize; - if(g_LinuxMemAreaWaterMark > g_LinuxMemAreaHighWaterMark) + if (g_LinuxMemAreaWaterMark > g_LinuxMemAreaHighWaterMark) { g_LinuxMemAreaHighWaterMark = g_LinuxMemAreaWaterMark; } } g_LinuxMemAreaCount++; - - + + psNewRecord = kmalloc(sizeof(DEBUG_LINUX_MEM_AREA_REC), GFP_KERNEL); - if(psNewRecord) + if (psNewRecord) { - + psNewRecord->psLinuxMemArea = psLinuxMemArea; psNewRecord->ui32Flags = ui32Flags; psNewRecord->pid = OSGetCurrentProcessIDKM(); - + List_DEBUG_LINUX_MEM_AREA_REC_Insert(&g_LinuxMemAreaRecords, psNewRecord); } else @@ -1542,17 +1849,17 @@ DebugLinuxMemAreaRecordAdd(LinuxMemArea *psLinuxMemArea, IMG_UINT32 ui32Flags) "%s: failed to allocate linux memory area record.", __FUNCTION__)); } - - + + pi8FlagsString = HAPFlagsToString(ui32Flags); - if(strstr(pi8FlagsString, "UNKNOWN")) + if (strstr(pi8FlagsString, "UNKNOWN")) { PVR_DPF((PVR_DBG_ERROR, "%s: Unexpected flags (0x%08x) associated with psLinuxMemArea @ %p", __FUNCTION__, ui32Flags, psLinuxMemArea)); - + } LinuxUnLockMutex(&g_sDebugMutex); @@ -1564,9 +1871,9 @@ static IMG_VOID* MatchLinuxMemArea_AnyVaCb(DEBUG_LINUX_MEM_AREA_REC *psCurrentRe va_list va) { LinuxMemArea *psLinuxMemArea; - + psLinuxMemArea = va_arg(va, LinuxMemArea*); - if(psCurrentRecord->psLinuxMemArea == psLinuxMemArea) + if (psCurrentRecord->psLinuxMemArea == psLinuxMemArea) { return psCurrentRecord; } @@ -1586,7 +1893,7 @@ DebugLinuxMemAreaRecordFind(LinuxMemArea *psLinuxMemArea) psCurrentRecord = List_DEBUG_LINUX_MEM_AREA_REC_Any_va(g_LinuxMemAreaRecords, MatchLinuxMemArea_AnyVaCb, psLinuxMemArea); - + LinuxUnLockMutex(&g_sDebugMutex); return psCurrentRecord; @@ -1600,19 +1907,19 @@ DebugLinuxMemAreaRecordRemove(LinuxMemArea *psLinuxMemArea) LinuxLockMutex(&g_sDebugMutex); - if(psLinuxMemArea->eAreaType != LINUX_MEM_AREA_SUB_ALLOC) + if (psLinuxMemArea->eAreaType != LINUX_MEM_AREA_SUB_ALLOC) { g_LinuxMemAreaWaterMark -= psLinuxMemArea->ui32ByteSize; } g_LinuxMemAreaCount--; - + psCurrentRecord = List_DEBUG_LINUX_MEM_AREA_REC_Any_va(g_LinuxMemAreaRecords, MatchLinuxMemArea_AnyVaCb, psLinuxMemArea); - if(psCurrentRecord) + if (psCurrentRecord) { - + List_DEBUG_LINUX_MEM_AREA_REC_Remove(psCurrentRecord); kfree(psCurrentRecord); } @@ -1630,7 +1937,7 @@ DebugLinuxMemAreaRecordRemove(LinuxMemArea *psLinuxMemArea) IMG_VOID * LinuxMemAreaToCpuVAddr(LinuxMemArea *psLinuxMemArea) { - switch(psLinuxMemArea->eAreaType) + switch (psLinuxMemArea->eAreaType) { case LINUX_MEM_AREA_VMALLOC: return psLinuxMemArea->uData.sVmalloc.pvVmallocAddress; @@ -1641,8 +1948,8 @@ LinuxMemAreaToCpuVAddr(LinuxMemArea *psLinuxMemArea) case LINUX_MEM_AREA_SUB_ALLOC: { IMG_CHAR *pAddr = - LinuxMemAreaToCpuVAddr(psLinuxMemArea->uData.sSubAlloc.psParentLinuxMemArea); - if(!pAddr) + LinuxMemAreaToCpuVAddr(psLinuxMemArea->uData.sSubAlloc.psParentLinuxMemArea); + if (!pAddr) { return NULL; } @@ -1658,10 +1965,10 @@ IMG_CPU_PHYADDR LinuxMemAreaToCpuPAddr(LinuxMemArea *psLinuxMemArea, IMG_UINT32 ui32ByteOffset) { IMG_CPU_PHYADDR CpuPAddr; - + CpuPAddr.uiAddr = 0; - switch(psLinuxMemArea->eAreaType) + switch (psLinuxMemArea->eAreaType) { case LINUX_MEM_AREA_IOREMAP: { @@ -1712,7 +2019,7 @@ LinuxMemAreaToCpuPAddr(LinuxMemArea *psLinuxMemArea, IMG_UINT32 ui32ByteOffset) { struct page *page; IMG_UINT32 ui32PageIndex = PHYS_TO_PFN(ui32ByteOffset); - page = psLinuxMemArea->uData.sPageList.pvPageList[ui32PageIndex]; + page = psLinuxMemArea->uData.sPageList.ppsPageList[ui32PageIndex]; CpuPAddr.uiAddr = page_to_phys(page); CpuPAddr.uiAddr += ADDR_TO_PAGE_OFFSET(ui32ByteOffset); break; @@ -1727,14 +2034,13 @@ LinuxMemAreaToCpuPAddr(LinuxMemArea *psLinuxMemArea, IMG_UINT32 ui32ByteOffset) } default: { - PVR_DPF((PVR_DBG_ERROR, "%s: Unknown LinuxMemArea type (%d)", + PVR_DPF((PVR_DBG_ERROR, "%s: Unknown LinuxMemArea type (%d)\n", __FUNCTION__, psLinuxMemArea->eAreaType)); - dump_stack(); PVR_ASSERT(CpuPAddr.uiAddr); break; } } - + return CpuPAddr; } @@ -1742,7 +2048,7 @@ LinuxMemAreaToCpuPAddr(LinuxMemArea *psLinuxMemArea, IMG_UINT32 ui32ByteOffset) IMG_BOOL LinuxMemAreaPhysIsContig(LinuxMemArea *psLinuxMemArea) { - switch(psLinuxMemArea->eAreaType) + switch (psLinuxMemArea->eAreaType) { case LINUX_MEM_AREA_IOREMAP: case LINUX_MEM_AREA_IO: @@ -1757,11 +2063,11 @@ LinuxMemAreaPhysIsContig(LinuxMemArea *psLinuxMemArea) return IMG_FALSE; case LINUX_MEM_AREA_SUB_ALLOC: - + return LinuxMemAreaPhysIsContig(psLinuxMemArea->uData.sSubAlloc.psParentLinuxMemArea); default: - PVR_DPF((PVR_DBG_ERROR, "%s: Unknown LinuxMemArea type (%d)", + PVR_DPF((PVR_DBG_ERROR, "%s: Unknown LinuxMemArea type (%d)\n", __FUNCTION__, psLinuxMemArea->eAreaType)); break; } @@ -1772,8 +2078,8 @@ LinuxMemAreaPhysIsContig(LinuxMemArea *psLinuxMemArea) const IMG_CHAR * LinuxMemAreaTypeToString(LINUX_MEM_AREA_TYPE eMemAreaType) { - - switch(eMemAreaType) + + switch (eMemAreaType) { case LINUX_MEM_AREA_IOREMAP: return "LINUX_MEM_AREA_IOREMAP"; @@ -1798,18 +2104,18 @@ LinuxMemAreaTypeToString(LINUX_MEM_AREA_TYPE eMemAreaType) #if defined(DEBUG_LINUX_MEM_AREAS) || defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) -static void ProcSeqStartstopDebugMutex(struct seq_file *sfile, IMG_BOOL start) +static void ProcSeqStartstopDebugMutex(struct seq_file *sfile, IMG_BOOL start) { - if(start) + if (start) { - LinuxLockMutex(&g_sDebugMutex); + LinuxLockMutex(&g_sDebugMutex); } else { LinuxUnLockMutex(&g_sDebugMutex); } } -#endif +#endif #if defined(DEBUG_LINUX_MEM_AREAS) @@ -1826,8 +2132,8 @@ static IMG_VOID* DecOffMemAreaRec_AnyVaCb(DEBUG_LINUX_MEM_AREA_REC *psNode, va_l } } - -static void* ProcSeqNextMemArea(struct seq_file *sfile,void* el,loff_t off) + +static void* ProcSeqNextMemArea(struct seq_file *sfile,void* el,loff_t off) { DEBUG_LINUX_MEM_AREA_REC *psRecord; psRecord = (DEBUG_LINUX_MEM_AREA_REC*) @@ -1840,7 +2146,7 @@ static void* ProcSeqNextMemArea(struct seq_file *sfile,void* el,loff_t off) static void* ProcSeqOff2ElementMemArea(struct seq_file * sfile, loff_t off) { DEBUG_LINUX_MEM_AREA_REC *psRecord; - if(!off) + if (!off) { return PVR_PROC_SEQ_START_TOKEN; } @@ -1855,12 +2161,12 @@ static void* ProcSeqOff2ElementMemArea(struct seq_file * sfile, loff_t off) static void ProcSeqShowMemArea(struct seq_file *sfile,void* el) { - DEBUG_LINUX_MEM_AREA_REC *psRecord = (DEBUG_LINUX_MEM_AREA_REC*)el; - if(el == PVR_PROC_SEQ_START_TOKEN) + DEBUG_LINUX_MEM_AREA_REC *psRecord = (DEBUG_LINUX_MEM_AREA_REC*)el; + if (el == PVR_PROC_SEQ_START_TOKEN) { #if !defined(DEBUG_LINUX_XML_PROC_FILES) - seq_printf( sfile, + seq_printf(sfile, "Number of Linux Memory Areas: %u\n" "At the current water mark these areas correspond to %u bytes (excluding SUB areas)\n" "At the highest water mark these areas corresponded to %u bytes (excluding SUB areas)\n" @@ -1876,23 +2182,23 @@ static void ProcSeqShowMemArea(struct seq_file *sfile,void* el) "Bytes", "Pid", "Flags" - ); + ); #else - seq_printf( sfile, + seq_printf(sfile, "\n" "\t%u\n" - "\t\n" - "\t\n" + "\t\n" + "\t\n" "\n", g_LinuxMemAreaCount, g_LinuxMemAreaWaterMark, g_LinuxMemAreaHighWaterMark - ); + ); #endif return; } - seq_printf( sfile, + seq_printf(sfile, #if !defined(DEBUG_LINUX_XML_PROC_FILES) "%8p %-24s %8p %08x %-8d %-5u %08x=(%s)\n", #else @@ -1901,9 +2207,9 @@ static void ProcSeqShowMemArea(struct seq_file *sfile,void* el) "\t%s\n" "\t%8p\n" "\t%08x\n" - "\t%ld\n" + "\t%d\n" "\t%u\n" - "\t%08lx\n" + "\t%08x\n" "\t%s\n" "\n", #endif @@ -1915,11 +2221,11 @@ static void ProcSeqShowMemArea(struct seq_file *sfile,void* el) psRecord->pid, psRecord->ui32Flags, HAPFlagsToString(psRecord->ui32Flags) - ); + ); } -#endif +#endif #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) @@ -1938,8 +2244,8 @@ static IMG_VOID* DecOffMemAllocRec_AnyVaCb(DEBUG_MEM_ALLOC_REC *psNode, va_list } - -static void* ProcSeqNextMemoryRecords(struct seq_file *sfile,void* el,loff_t off) + +static void* ProcSeqNextMemoryRecords(struct seq_file *sfile,void* el,loff_t off) { DEBUG_MEM_ALLOC_REC *psRecord; psRecord = (DEBUG_MEM_ALLOC_REC*) @@ -1947,9 +2253,9 @@ static void* ProcSeqNextMemoryRecords(struct seq_file *sfile,void* el,loff_t off DecOffMemAllocRec_AnyVaCb, &off); #if defined(DEBUG_LINUX_XML_PROC_FILES) - if(!psRecord) + if (!psRecord) { - seq_printf( sfile, "\n"); + seq_printf(sfile, "\n"); } #endif @@ -1959,7 +2265,7 @@ static void* ProcSeqNextMemoryRecords(struct seq_file *sfile,void* el,loff_t off static void* ProcSeqOff2ElementMemoryRecords(struct seq_file *sfile, loff_t off) { DEBUG_MEM_ALLOC_REC *psRecord; - if(!off) + if (!off) { return PVR_PROC_SEQ_START_TOKEN; } @@ -1970,9 +2276,9 @@ static void* ProcSeqOff2ElementMemoryRecords(struct seq_file *sfile, loff_t off) &off); #if defined(DEBUG_LINUX_XML_PROC_FILES) - if(!psRecord) + if (!psRecord) { - seq_printf( sfile, "\n"); + seq_printf(sfile, "\n"); } #endif @@ -1982,64 +2288,76 @@ static void* ProcSeqOff2ElementMemoryRecords(struct seq_file *sfile, loff_t off) static void ProcSeqShowMemoryRecords(struct seq_file *sfile,void* el) { DEBUG_MEM_ALLOC_REC *psRecord = (DEBUG_MEM_ALLOC_REC*)el; - if(el == PVR_PROC_SEQ_START_TOKEN) + if (el == PVR_PROC_SEQ_START_TOKEN) { #if !defined(DEBUG_LINUX_XML_PROC_FILES) - - seq_printf( sfile, "%-60s: %d bytes\n", + + seq_printf(sfile, "%-60s: %d bytes\n", "Current Water Mark of bytes allocated via kmalloc", g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_KMALLOC]); - seq_printf( sfile, "%-60s: %d bytes\n", + seq_printf(sfile, "%-60s: %d bytes\n", "Highest Water Mark of bytes allocated via kmalloc", g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_KMALLOC]); - seq_printf( sfile, "%-60s: %d bytes\n", + seq_printf(sfile, "%-60s: %d bytes\n", "Current Water Mark of bytes allocated via vmalloc", g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_VMALLOC]); - seq_printf( sfile, "%-60s: %d bytes\n", + seq_printf(sfile, "%-60s: %d bytes\n", "Highest Water Mark of bytes allocated via vmalloc", g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_VMALLOC]); - seq_printf( sfile, "%-60s: %d bytes\n", + seq_printf(sfile, "%-60s: %d bytes\n", "Current Water Mark of bytes allocated via alloc_pages", g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES]); - seq_printf( sfile, "%-60s: %d bytes\n", + seq_printf(sfile, "%-60s: %d bytes\n", "Highest Water Mark of bytes allocated via alloc_pages", g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES]); - seq_printf( sfile, "%-60s: %d bytes\n", + seq_printf(sfile, "%-60s: %d bytes\n", "Current Water Mark of bytes allocated via ioremap", g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_IOREMAP]); - seq_printf( sfile, "%-60s: %d bytes\n", + seq_printf(sfile, "%-60s: %d bytes\n", "Highest Water Mark of bytes allocated via ioremap", g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_IOREMAP]); - seq_printf( sfile, "%-60s: %d bytes\n", + seq_printf(sfile, "%-60s: %d bytes\n", "Current Water Mark of bytes reserved for \"IO\" memory areas", g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_IO]); - seq_printf( sfile, "%-60s: %d bytes\n", + seq_printf(sfile, "%-60s: %d bytes\n", "Highest Water Mark of bytes allocated for \"IO\" memory areas", g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_IO]); - seq_printf( sfile, "%-60s: %d bytes\n", + seq_printf(sfile, "%-60s: %d bytes\n", "Current Water Mark of bytes allocated via kmem_cache_alloc", g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE]); - seq_printf( sfile, "%-60s: %d bytes\n", + seq_printf(sfile, "%-60s: %d bytes\n", "Highest Water Mark of bytes allocated via kmem_cache_alloc", g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE]); +#if defined(PVR_LINUX_MEM_AREA_USE_VMAP) + seq_printf(sfile, "%-60s: %d bytes\n", + "Current Water Mark of bytes mapped via vmap", + g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_VMAP]); + seq_printf(sfile, "%-60s: %d bytes\n", + "Highest Water Mark of bytes mapped via vmap", + g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_VMAP]); +#endif +#if (PVR_LINUX_MEM_AREA_POOL_MAX_PAGES != 0) + seq_printf(sfile, "%-60s: %d pages\n", + "Number of pages in page pool", + atomic_read(&g_sPagePoolEntryCount)); +#endif seq_printf( sfile, "\n"); - - seq_printf( sfile, "%-60s: %d bytes\n", + seq_printf(sfile, "%-60s: %d bytes\n", "The Current Water Mark for memory allocated from system RAM", - g_SysRAMWaterMark); - seq_printf( sfile, "%-60s: %d bytes\n", + SysRAMTrueWaterMark()); + seq_printf(sfile, "%-60s: %d bytes\n", "The Highest Water Mark for memory allocated from system RAM", g_SysRAMHighWaterMark); - seq_printf( sfile, "%-60s: %d bytes\n", + seq_printf(sfile, "%-60s: %d bytes\n", "The Current Water Mark for memory allocated from IO memory", g_IOMemWaterMark); - seq_printf( sfile, "%-60s: %d bytes\n", + seq_printf(sfile, "%-60s: %d bytes\n", "The Highest Water Mark for memory allocated from IO memory", g_IOMemHighWaterMark); seq_printf( sfile, "\n"); - seq_printf( sfile, "Details for all known allocations:\n" + seq_printf(sfile, "Details for all known allocations:\n" "%-16s %-8s %-8s %-10s %-5s %-10s %s\n", "Type", "CpuVAddr", @@ -2049,70 +2367,81 @@ static void ProcSeqShowMemoryRecords(struct seq_file *sfile,void* el) "PrivateData", "Filename:Line"); -#else - - - seq_printf( sfile, "\n\n"); - seq_printf( sfile, +#else + + + seq_printf(sfile, "\n\n"); + seq_printf(sfile, "\n", g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_KMALLOC]); - seq_printf( sfile, + seq_printf(sfile, "\n", g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_KMALLOC]); - seq_printf( sfile, + seq_printf(sfile, "\n", g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_VMALLOC]); - seq_printf( sfile, + seq_printf(sfile, "\n", g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_VMALLOC]); - seq_printf( sfile, + seq_printf(sfile, "\n", g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES]); - seq_printf( sfile, + seq_printf(sfile, "\n", g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES]); - seq_printf( sfile, + seq_printf(sfile, "\n", g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_IOREMAP]); - seq_printf( sfile, + seq_printf(sfile, "\n", g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_IOREMAP]); - seq_printf( sfile, + seq_printf(sfile, "\n", g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_IO]); - seq_printf( sfile, + seq_printf(sfile, "\n", g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_IO]); - seq_printf( sfile, + seq_printf(sfile, "\n", g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE]); - seq_printf( sfile, + seq_printf(sfile, "\n", g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE]); - seq_printf( sfile,"\n" ); - - seq_printf( sfile, +#if defined(PVR_LINUX_MEM_AREA_USE_VMAP) + seq_printf(sfile, + "\n", + g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_VMAP]); + seq_printf(sfile, + "\n", + g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_VMAP]); +#endif + seq_printf(sfile, "\n", - g_SysRAMWaterMark); - seq_printf( sfile, + SysRAMTrueWaterMark()); + seq_printf(sfile, "\n", g_SysRAMHighWaterMark); - seq_printf( sfile, + seq_printf(sfile, "\n", g_IOMemWaterMark); - seq_printf( sfile, + seq_printf(sfile, "\n", g_IOMemHighWaterMark); - seq_printf( sfile, "\n"); - +#if (PVR_LINUX_MEM_AREA_POOL_MAX_PAGES != 0) + seq_printf(sfile, + "\n", + PAGES_TO_BYTES(atomic_read(&g_sPagePoolEntryCount))); #endif + seq_printf(sfile, "\n"); + +#endif return; } - if(psRecord->eAllocType != DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE) + if (psRecord->eAllocType != DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE) { - seq_printf( sfile, + seq_printf(sfile, #if !defined(DEBUG_LINUX_XML_PROC_FILES) "%-16s %-8p %08x %-10d %-5d %-10s %s:%d\n", #else @@ -2138,7 +2467,7 @@ static void ProcSeqShowMemoryRecords(struct seq_file *sfile,void* el) } else { - seq_printf( sfile, + seq_printf(sfile, #if !defined(DEBUG_LINUX_XML_PROC_FILES) "%-16s %-8p %08x %-10d %-5d %-10s %s:%d\n", #else @@ -2164,7 +2493,7 @@ static void ProcSeqShowMemoryRecords(struct seq_file *sfile,void* el) } } -#endif +#endif #if defined(DEBUG_LINUX_MEM_AREAS) || defined(DEBUG_LINUX_MMAP_AREAS) @@ -2188,32 +2517,32 @@ HAPFlagsToString(IMG_UINT32 ui32Flags) "NO_CPU_VIRTUAL", "UNKNOWN" }; - - - if(ui32Flags & PVRSRV_HAP_UNCACHED){ - ui32CacheTypeIndex=0; - }else if(ui32Flags & PVRSRV_HAP_CACHED){ - ui32CacheTypeIndex=1; - }else if(ui32Flags & PVRSRV_HAP_WRITECOMBINE){ - ui32CacheTypeIndex=2; - }else{ - ui32CacheTypeIndex=3; + + + if (ui32Flags & PVRSRV_HAP_UNCACHED) { + ui32CacheTypeIndex = 0; + } else if (ui32Flags & PVRSRV_HAP_CACHED) { + ui32CacheTypeIndex = 1; + } else if (ui32Flags & PVRSRV_HAP_WRITECOMBINE) { + ui32CacheTypeIndex = 2; + } else { + ui32CacheTypeIndex = 3; PVR_DPF((PVR_DBG_ERROR, "%s: unknown cache type (%u)", __FUNCTION__, (ui32Flags & PVRSRV_HAP_CACHETYPE_MASK))); } - - if(ui32Flags & PVRSRV_HAP_KERNEL_ONLY){ + + if (ui32Flags & PVRSRV_HAP_KERNEL_ONLY) { ui32MapTypeIndex = 0; - }else if(ui32Flags & PVRSRV_HAP_SINGLE_PROCESS){ + } else if (ui32Flags & PVRSRV_HAP_SINGLE_PROCESS) { ui32MapTypeIndex = 1; - }else if(ui32Flags & PVRSRV_HAP_MULTI_PROCESS){ + } else if (ui32Flags & PVRSRV_HAP_MULTI_PROCESS) { ui32MapTypeIndex = 2; - }else if(ui32Flags & PVRSRV_HAP_FROM_EXISTING_PROCESS){ + } else if (ui32Flags & PVRSRV_HAP_FROM_EXISTING_PROCESS) { ui32MapTypeIndex = 3; - }else if(ui32Flags & PVRSRV_HAP_NO_CPU_VIRTUAL){ + } else if (ui32Flags & PVRSRV_HAP_NO_CPU_VIRTUAL) { ui32MapTypeIndex = 4; - }else{ + } else { ui32MapTypeIndex = 5; PVR_DPF((PVR_DBG_ERROR, "%s: unknown map type (%u)", __FUNCTION__, (ui32Flags & PVRSRV_HAP_MAPTYPE_MASK))); @@ -2235,3 +2564,214 @@ HAPFlagsToString(IMG_UINT32 ui32Flags) } #endif +#if defined(DEBUG_LINUX_MEM_AREAS) +static IMG_VOID LinuxMMCleanup_MemAreas_ForEachCb(DEBUG_LINUX_MEM_AREA_REC *psCurrentRecord) +{ + LinuxMemArea *psLinuxMemArea; + + psLinuxMemArea = psCurrentRecord->psLinuxMemArea; + PVR_DPF((PVR_DBG_ERROR, "%s: BUG!: Cleaning up Linux memory area (%p), type=%s, size=%d bytes", + __FUNCTION__, + psCurrentRecord->psLinuxMemArea, + LinuxMemAreaTypeToString(psCurrentRecord->psLinuxMemArea->eAreaType), + psCurrentRecord->psLinuxMemArea->ui32ByteSize)); + + LinuxMemAreaDeepFree(psLinuxMemArea); +} +#endif + +#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) +static IMG_VOID LinuxMMCleanup_MemRecords_ForEachVa(DEBUG_MEM_ALLOC_REC *psCurrentRecord) + +{ + + PVR_DPF((PVR_DBG_ERROR, "%s: BUG!: Cleaning up memory: " + "type=%s " + "CpuVAddr=%p " + "CpuPAddr=0x%08x, " + "allocated @ file=%s,line=%d", + __FUNCTION__, + DebugMemAllocRecordTypeToString(psCurrentRecord->eAllocType), + psCurrentRecord->pvCpuVAddr, + psCurrentRecord->ulCpuPAddr, + psCurrentRecord->pszFileName, + psCurrentRecord->ui32Line)); + switch (psCurrentRecord->eAllocType) + { + case DEBUG_MEM_ALLOC_TYPE_KMALLOC: + KFreeWrapper(psCurrentRecord->pvCpuVAddr); + break; + case DEBUG_MEM_ALLOC_TYPE_IOREMAP: + IOUnmapWrapper(psCurrentRecord->pvCpuVAddr); + break; + case DEBUG_MEM_ALLOC_TYPE_IO: + + DebugMemAllocRecordRemove(DEBUG_MEM_ALLOC_TYPE_IO, psCurrentRecord->pvKey, __FILE__, __LINE__); + break; + case DEBUG_MEM_ALLOC_TYPE_VMALLOC: + VFreeWrapper(psCurrentRecord->pvCpuVAddr); + break; + case DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES: + DebugMemAllocRecordRemove(DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES, psCurrentRecord->pvKey, __FILE__, __LINE__); + break; + case DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE: + KMemCacheFreeWrapper(psCurrentRecord->pvPrivateData, psCurrentRecord->pvCpuVAddr); + break; +#if defined(PVR_LINUX_MEM_AREA_USE_VMAP) + case DEBUG_MEM_ALLOC_TYPE_VMAP: + VUnmapWrapper(psCurrentRecord->pvCpuVAddr); + break; +#endif + default: + PVR_ASSERT(0); + } +} +#endif + + +#if defined(PVR_LINUX_MEM_AREA_POOL_ALLOW_SHRINK) +static struct shrinker g_sShrinker = +{ + .shrink = ShrinkPagePool, + .seeks = DEFAULT_SEEKS +}; + +static IMG_BOOL g_bShrinkerRegistered; +#endif + +IMG_VOID +LinuxMMCleanup(IMG_VOID) +{ +#if defined(DEBUG_LINUX_MEM_AREAS) + { + if (g_LinuxMemAreaCount) + { + PVR_DPF((PVR_DBG_ERROR, "%s: BUG!: There are %d LinuxMemArea allocation unfreed (%d bytes)", + __FUNCTION__, g_LinuxMemAreaCount, g_LinuxMemAreaWaterMark)); + } + + List_DEBUG_LINUX_MEM_AREA_REC_ForEach(g_LinuxMemAreaRecords, LinuxMMCleanup_MemAreas_ForEachCb); + + if (g_SeqFileMemArea) + { + RemoveProcEntrySeq(g_SeqFileMemArea); + } + } +#endif + +#if defined(PVR_LINUX_MEM_AREA_POOL_ALLOW_SHRINK) + if (g_bShrinkerRegistered) + { + unregister_shrinker(&g_sShrinker); + } +#endif + + + FreePagePool(); + +#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) + { + + + List_DEBUG_MEM_ALLOC_REC_ForEach(g_MemoryRecords, LinuxMMCleanup_MemRecords_ForEachVa); + + if (g_SeqFileMemoryRecords) + { + RemoveProcEntrySeq(g_SeqFileMemoryRecords); + } + } +#endif + + if (g_PsLinuxMemAreaCache) + { + KMemCacheDestroyWrapper(g_PsLinuxMemAreaCache); + } + + if (g_PsLinuxPagePoolCache) + { + KMemCacheDestroyWrapper(g_PsLinuxPagePoolCache); + } +} + +PVRSRV_ERROR +LinuxMMInit(IMG_VOID) +{ +#if defined(DEBUG_LINUX_MEM_AREAS) || defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) + LinuxInitMutex(&g_sDebugMutex); +#endif + +#if defined(DEBUG_LINUX_MEM_AREAS) + { + g_SeqFileMemArea = CreateProcReadEntrySeq( + "mem_areas", + NULL, + ProcSeqNextMemArea, + ProcSeqShowMemArea, + ProcSeqOff2ElementMemArea, + ProcSeqStartstopDebugMutex + ); + if (!g_SeqFileMemArea) + { + goto failed; + } + } +#endif + + +#if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) + { + g_SeqFileMemoryRecords = CreateProcReadEntrySeq( + "meminfo", + NULL, + ProcSeqNextMemoryRecords, + ProcSeqShowMemoryRecords, + ProcSeqOff2ElementMemoryRecords, + ProcSeqStartstopDebugMutex + ); + if (!g_SeqFileMemoryRecords) + { + goto failed; + } + } +#endif + + g_PsLinuxMemAreaCache = KMemCacheCreateWrapper("img-mm", sizeof(LinuxMemArea), 0, 0); + if (!g_PsLinuxMemAreaCache) + { + PVR_DPF((PVR_DBG_ERROR,"%s: failed to allocate mem area kmem_cache", __FUNCTION__)); + goto failed; + } + +#if (PVR_LINUX_MEM_AREA_POOL_MAX_PAGES != 0) + g_iPagePoolMaxEntries = PVR_LINUX_MEM_AREA_POOL_MAX_PAGES; + if (g_iPagePoolMaxEntries <= 0 || g_iPagePoolMaxEntries > INT_MAX/2) + { + g_iPagePoolMaxEntries = INT_MAX/2; + PVR_TRACE(("%s: No limit set for page pool size", __FUNCTION__)); + } + else + { + PVR_TRACE(("%s: Maximum page pool size: %d", __FUNCTION__, g_iPagePoolMaxEntries)); + } + + g_PsLinuxPagePoolCache = KMemCacheCreateWrapper("img-mm-pool", sizeof(LinuxPagePoolEntry), 0, 0); + if (!g_PsLinuxPagePoolCache) + { + PVR_DPF((PVR_DBG_ERROR,"%s: failed to allocate page pool kmem_cache", __FUNCTION__)); + goto failed; + } +#endif + +#if defined(PVR_LINUX_MEM_AREA_POOL_ALLOW_SHRINK) + register_shrinker(&g_sShrinker); + g_bShrinkerRegistered = IMG_TRUE; +#endif + + init_pvr_pool(); + return PVRSRV_OK; + +failed: + LinuxMMCleanup(); + return PVRSRV_ERROR_OUT_OF_MEMORY; +} + diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mm.h b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mm.h index 03f2827..324f4e5 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mm.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mm.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -48,6 +48,8 @@ #define ADDR_TO_PAGE_OFFSET(addr) (((unsigned long)(addr)) & (PAGE_SIZE - 1)) +#define PAGES_TO_BYTES(pages) ((pages) << PAGE_SHIFT) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)) #define REMAP_PFN_RANGE(vma, addr, pfn, size, prot) remap_pfn_range(vma, addr, pfn, size, prot) #else @@ -73,18 +75,21 @@ static inline IMG_UINT32 VMallocToPhys(IMG_VOID *pCpuVAddr) { return (page_to_phys(vmalloc_to_page(pCpuVAddr)) + ADDR_TO_PAGE_OFFSET(pCpuVAddr)); - + } typedef enum { LINUX_MEM_AREA_IOREMAP, - LINUX_MEM_AREA_EXTERNAL_KV, + LINUX_MEM_AREA_EXTERNAL_KV, LINUX_MEM_AREA_IO, LINUX_MEM_AREA_VMALLOC, LINUX_MEM_AREA_ALLOC_PAGES, LINUX_MEM_AREA_SUB_ALLOC, - LINUX_MEM_AREA_TYPE_COUNT, LINUX_MEM_AREA_ION, +#if defined(PVR_LINUX_MEM_AREA_USE_VMAP) + LINUX_MEM_AREA_VMAP, +#endif + LINUX_MEM_AREA_TYPE_COUNT }LINUX_MEM_AREA_TYPE; typedef struct _LinuxMemArea LinuxMemArea; @@ -96,16 +101,16 @@ struct _LinuxMemArea { { struct _sIORemap { - + IMG_CPU_PHYADDR CPUPhysAddr; IMG_VOID *pvIORemapCookie; }sIORemap; struct _sExternalKV { - + IMG_BOOL bPhysContig; union { - + IMG_SYS_PHYADDR SysPhysAddr; IMG_SYS_PHYADDR *pSysPhysAddr; } uPhysAddr; @@ -113,47 +118,51 @@ struct _LinuxMemArea { }sExternalKV; struct _sIO { - + IMG_CPU_PHYADDR CPUPhysAddr; }sIO; struct _sVmalloc { - + IMG_VOID *pvVmallocAddress; +#if defined(PVR_LINUX_MEM_AREA_USE_VMAP) + struct page **ppsPageList; + IMG_HANDLE hBlockPageList; +#endif }sVmalloc; struct _sPageList { - - struct page **pvPageList; + + struct page **ppsPageList; IMG_HANDLE hBlockPageList; }sPageList; struct _sIONTilerAlloc { - + IMG_CPU_PHYADDR *pCPUPhysAddrs; - struct ion_handle *psIONHandle[2]; + struct ion_handle *psIONHandle[2]; }sIONTilerAlloc; struct _sSubAlloc { - + LinuxMemArea *psParentLinuxMemArea; IMG_UINT32 ui32ByteOffset; }sSubAlloc; }uData; - IMG_UINT32 ui32ByteSize; + IMG_UINT32 ui32ByteSize; - IMG_UINT32 ui32AreaFlags; + IMG_UINT32 ui32AreaFlags; - IMG_BOOL bMMapRegistered; + IMG_BOOL bMMapRegistered; - IMG_BOOL bNeedsCacheInvalidate; + IMG_BOOL bNeedsCacheInvalidate; IMG_BOOL bfromPool; - + struct list_head sMMapItem; - + struct list_head sMMapOffsetStructList; }; @@ -296,7 +305,7 @@ NewIONLinuxMemArea(IMG_UINT32 ui32Bytes, IMG_UINT32 ui32AreaFlags, IMG_VOID FreeIONLinuxMemArea(LinuxMemArea *psLinuxMemArea); -#else +#else static inline LinuxMemArea * NewIONLinuxMemArea(IMG_UINT32 ui32Bytes, IMG_UINT32 ui32AreaFlags, @@ -316,7 +325,7 @@ static inline IMG_VOID FreeIONLinuxMemArea(LinuxMemArea *psLinuxMemArea) BUG(); } -#endif +#endif LinuxMemArea *NewSubLinuxMemArea(LinuxMemArea *psParentLinuxMemArea, @@ -372,5 +381,5 @@ const IMG_CHAR *LinuxMemAreaTypeToString(LINUX_MEM_AREA_TYPE eMemAreaType); const IMG_CHAR *HAPFlagsToString(IMG_UINT32 ui32Flags); #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mmap.c b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mmap.c index cad1476..a63223c 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mmap.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mmap.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -55,6 +55,7 @@ #endif #include "services_headers.h" + #include "pvrmmap.h" #include "mutils.h" #include "mmap.h" @@ -86,7 +87,7 @@ static IMG_UINT32 g_ui32TotalByteSize = 0; #if defined(DEBUG_LINUX_MMAP_AREAS) static struct proc_dir_entry *g_ProcMMap; -#endif +#endif #if !defined(PVR_MAKE_ALL_PFNS_SPECIAL) #define MMAP2_PGOFF_RESOLUTION (32-PAGE_SHIFT+12) @@ -98,7 +99,7 @@ static struct proc_dir_entry *g_ProcMMap; #define FIRST_SPECIAL_PFN (LAST_PHYSICAL_PFN + 1) #define LAST_SPECIAL_PFN (FIRST_SPECIAL_PFN + MAX_MMAP_HANDLE) -#else +#else #if PAGE_SHIFT != 12 #error This build variant has not yet been made non-4KB page-size aware @@ -116,20 +117,20 @@ static struct proc_dir_entry *g_ProcMMap; #define MAX_MMAP_HANDLE 0x7fffffffUL #endif -#endif +#endif #if !defined(PVR_MAKE_ALL_PFNS_SPECIAL) static inline IMG_BOOL PFNIsPhysical(IMG_UINT32 pfn) { - + return ( (pfn <= LAST_PHYSICAL_PFN)) ? IMG_TRUE : IMG_FALSE; } static inline IMG_BOOL PFNIsSpecial(IMG_UINT32 pfn) { - + return ((pfn >= FIRST_SPECIAL_PFN) ) ? IMG_TRUE : IMG_FALSE; } #endif @@ -178,7 +179,7 @@ LinuxMemAreaUsesPhysicalMap(LinuxMemArea *psLinuxMemArea) static inline IMG_UINT32 GetCurrentThreadID(IMG_VOID) { - + return (IMG_UINT32)current->pid; } #endif @@ -207,21 +208,21 @@ CreateOffsetStruct(LinuxMemArea *psLinuxMemArea, IMG_UINT32 ui32Offset, IMG_UINT PVR_DPF((PVR_DBG_ERROR,"PVRMMapRegisterArea: Couldn't alloc another mapping record from cache")); return IMG_NULL; } - + psOffsetStruct->ui32MMapOffset = ui32Offset; psOffsetStruct->psLinuxMemArea = psLinuxMemArea; psOffsetStruct->ui32RealByteSize = ui32RealByteSize; - + #if !defined(PVR_MAKE_ALL_PFNS_SPECIAL) psOffsetStruct->ui32TID = GetCurrentThreadID(); #endif psOffsetStruct->ui32PID = OSGetCurrentProcessIDKM(); #if defined(DEBUG_LINUX_MMAP_AREAS) - + psOffsetStruct->pszName = pszName; #endif @@ -252,7 +253,7 @@ DestroyOffsetStruct(PKV_OFFSET_STRUCT psOffsetStruct) psOffsetStruct->psLinuxMemArea, CpuPAddr.uiAddr)); #endif - + KMemCacheFreeWrapper(g_psMemmapCache, psOffsetStruct); } @@ -264,10 +265,10 @@ DetermineUsersSizeAndByteOffset(LinuxMemArea *psLinuxMemArea, { IMG_UINT32 ui32PageAlignmentOffset; IMG_CPU_PHYADDR CpuPAddr; - + CpuPAddr = LinuxMemAreaToCpuPAddr(psLinuxMemArea, 0); ui32PageAlignmentOffset = ADDR_TO_PAGE_OFFSET(CpuPAddr.uiAddr); - + *pui32ByteOffset = ui32PageAlignmentOffset; *pui32RealByteSize = PAGE_ALIGN(psLinuxMemArea->ui32ByteSize + ui32PageAlignmentOffset); @@ -313,14 +314,14 @@ PVRMMapOSMemHandleToMMapData(PVRSRV_PER_PROCESS_DATA *psPerProc, pui32RealByteSize, pui32ByteOffset); - + list_for_each_entry(psOffsetStruct, &psLinuxMemArea->sMMapOffsetStructList, sAreaItem) { if (psPerProc->ui32PID == psOffsetStruct->ui32PID) { PVR_ASSERT(*pui32RealByteSize == psOffsetStruct->ui32RealByteSize); - + *pui32MMapOffset = psOffsetStruct->ui32MMapOffset; *pui32UserVAddr = psOffsetStruct->ui32UserVAddr; PVRSRVOffsetStructIncRef(psOffsetStruct); @@ -330,7 +331,7 @@ PVRMMapOSMemHandleToMMapData(PVRSRV_PER_PROCESS_DATA *psPerProc, } } - + *pui32UserVAddr = 0; #if !defined(PVR_MAKE_ALL_PFNS_SPECIAL) @@ -355,7 +356,7 @@ PVRMMapOSMemHandleToMMapData(PVRSRV_PER_PROCESS_DATA *psPerProc, goto exit_unlock; } - + list_add_tail(&psOffsetStruct->sMMapItem, &g_sMMapOffsetStructList); psOffsetStruct->bOnMMapList = IMG_TRUE; @@ -364,7 +365,7 @@ PVRMMapOSMemHandleToMMapData(PVRSRV_PER_PROCESS_DATA *psPerProc, eError = PVRSRV_OK; - + *pui32MMapOffset = *pui32MMapOffset << (PAGE_SHIFT - 12); @@ -411,7 +412,7 @@ PVRMMapReleaseMMapData(PVRSRV_PER_PROCESS_DATA *psPerProc, psLinuxMemArea = (LinuxMemArea *)hOSMemHandle; - + list_for_each_entry(psOffsetStruct, &psLinuxMemArea->sMMapOffsetStructList, sAreaItem) { if (psOffsetStruct->ui32PID == ui32PID) @@ -435,7 +436,7 @@ PVRMMapReleaseMMapData(PVRSRV_PER_PROCESS_DATA *psPerProc, } } - + #if defined (SUPPORT_SID_INTERFACE) PVR_DPF((PVR_DBG_ERROR, "%s: Mapping data not found for handle %x (memory area %p)", __FUNCTION__, hMHandle, psLinuxMemArea)); #else @@ -464,7 +465,7 @@ FindOffsetStructByOffset(IMG_UINT32 ui32Offset, IMG_UINT32 ui32RealByteSize) if (ui32Offset == psOffsetStruct->ui32MMapOffset && ui32RealByteSize == psOffsetStruct->ui32RealByteSize && psOffsetStruct->ui32PID == ui32PID) { #if !defined(PVR_MAKE_ALL_PFNS_SPECIAL) - + if (!PFNIsPhysical(ui32Offset) || psOffsetStruct->ui32TID == ui32TID) #endif { @@ -486,17 +487,17 @@ DoMapToUser(LinuxMemArea *psLinuxMemArea, if (psLinuxMemArea->eAreaType == LINUX_MEM_AREA_SUB_ALLOC) { - return DoMapToUser(LinuxMemAreaRoot(psLinuxMemArea), + return DoMapToUser(LinuxMemAreaRoot(psLinuxMemArea), ps_vma, psLinuxMemArea->uData.sSubAlloc.ui32ByteOffset + ui32ByteOffset); } - + ui32ByteSize = ps_vma->vm_end - ps_vma->vm_start; PVR_ASSERT(ADDR_TO_PAGE_OFFSET(ui32ByteSize) == 0); #if defined (__sparc__) - + #error "SPARC not supported" #endif @@ -507,7 +508,7 @@ DoMapToUser(LinuxMemArea *psLinuxMemArea, PVR_ASSERT(LinuxMemAreaPhysIsContig(psLinuxMemArea)); PVR_ASSERT(LinuxMemAreaToCpuPFN(psLinuxMemArea, ui32ByteOffset) == ps_vma->vm_pgoff); - + result = IO_REMAP_PFN_RANGE(ps_vma, ps_vma->vm_start, ps_vma->vm_pgoff, ui32ByteSize, ps_vma->vm_page_prot); if(result == 0) @@ -520,14 +521,14 @@ DoMapToUser(LinuxMemArea *psLinuxMemArea, #endif { - + IMG_UINT32 ulVMAPos; IMG_UINT32 ui32ByteEnd = ui32ByteOffset + ui32ByteSize; IMG_UINT32 ui32PA; #if defined(PVR_MAKE_ALL_PFNS_SPECIAL) IMG_BOOL bMixedMap = IMG_FALSE; #endif - + for(ui32PA = ui32ByteOffset; ui32PA < ui32ByteEnd; ui32PA += PAGE_SIZE) { IMG_UINT32 pfn = LinuxMemAreaToCpuPFN(psLinuxMemArea, ui32PA); @@ -549,7 +550,7 @@ DoMapToUser(LinuxMemArea *psLinuxMemArea, ps_vma->vm_flags |= VM_MIXEDMAP; } #endif - + ulVMAPos = ps_vma->vm_start; for(ui32PA = ui32ByteOffset; ui32PA < ui32ByteEnd; ui32PA += PAGE_SIZE) { @@ -690,7 +691,7 @@ static int MMapVAccess(struct vm_area_struct *ps_vma, unsigned long addr, ulOffset = addr - ps_vma->vm_start; if (ulOffset+len > psLinuxMemArea->ui32ByteSize) - + goto exit_unlock; pvKernelAddr = LinuxMemAreaToCpuVAddr(psLinuxMemArea); @@ -714,7 +715,7 @@ static int MMapVAccess(struct vm_area_struct *ps_vma, unsigned long addr, ui32OffsetInPage = ADDR_TO_PAGE_OFFSET(ulOffset); if (ui32OffsetInPage+len > PAGE_SIZE) - + goto exit_unlock; pvKernelAddr = kmap(page); @@ -728,7 +729,7 @@ exit_unlock: LinuxUnLockMutex(&g_sMMapMutex); return iRetVal; } -#endif +#endif static struct vm_operations_struct MMapIOOps = { @@ -752,15 +753,15 @@ PVRMMap(struct file* pFile, struct vm_area_struct* ps_vma) PVR_UNREFERENCED_PARAMETER(pFile); LinuxLockMutex(&g_sMMapMutex); - + ui32ByteSize = ps_vma->vm_end - ps_vma->vm_start; - + PVR_DPF((PVR_DBG_MESSAGE, "%s: Received mmap(2) request with ui32MMapOffset 0x%08lx," " and ui32ByteSize %d(0x%08x)", __FUNCTION__, ps_vma->vm_pgoff, ui32ByteSize, ui32ByteSize)); - + psOffsetStruct = FindOffsetStructByOffset(ps_vma->vm_pgoff, ui32ByteSize); if (psOffsetStruct == IMG_NULL) { @@ -768,10 +769,10 @@ PVRMMap(struct file* pFile, struct vm_area_struct* ps_vma) LinuxUnLockMutex(&g_sMMapMutex); #if !defined(SUPPORT_DRI_DRM_EXT) - + return drm_mmap(pFile, ps_vma); #else - + return -ENOENT; #endif #else @@ -788,7 +789,7 @@ PVRMMap(struct file* pFile, struct vm_area_struct* ps_vma) list_del(&psOffsetStruct->sMMapItem); psOffsetStruct->bOnMMapList = IMG_FALSE; - + if (((ps_vma->vm_flags & VM_WRITE) != 0) && ((ps_vma->vm_flags & VM_SHARED) == 0)) { @@ -796,25 +797,25 @@ PVRMMap(struct file* pFile, struct vm_area_struct* ps_vma) iRetVal = -EINVAL; goto unlock_and_return; } - + PVR_DPF((PVR_DBG_MESSAGE, "%s: Mapped psLinuxMemArea 0x%p\n", __FUNCTION__, psOffsetStruct->psLinuxMemArea)); ps_vma->vm_flags |= VM_RESERVED; ps_vma->vm_flags |= VM_IO; - + ps_vma->vm_flags |= VM_DONTEXPAND; - - + + ps_vma->vm_flags |= VM_DONTCOPY; ps_vma->vm_private_data = (void *)psOffsetStruct; - + switch(psOffsetStruct->psLinuxMemArea->ui32AreaFlags & PVRSRV_HAP_CACHETYPE_MASK) { case PVRSRV_HAP_CACHED: - + break; case PVRSRV_HAP_WRITECOMBINE: ps_vma->vm_page_prot = PGPROT_WC(ps_vma->vm_page_prot); @@ -827,21 +828,21 @@ PVRMMap(struct file* pFile, struct vm_area_struct* ps_vma) iRetVal = -EINVAL; goto unlock_and_return; } - - + + ps_vma->vm_ops = &MMapIOOps; - + if(!DoMapToUser(psOffsetStruct->psLinuxMemArea, ps_vma, 0)) { iRetVal = -EAGAIN; goto unlock_and_return; } - + PVR_ASSERT(psOffsetStruct->ui32UserVAddr == 0) psOffsetStruct->ui32UserVAddr = ps_vma->vm_start; - + if(psOffsetStruct->psLinuxMemArea->bNeedsCacheInvalidate) { IMG_UINT32 ui32ByteOffset, ui32DummyByteSize; @@ -856,7 +857,7 @@ PVRMMap(struct file* pFile, struct vm_area_struct* ps_vma) psOffsetStruct->psLinuxMemArea->bNeedsCacheInvalidate = IMG_FALSE; } - + MMapVOpenNoLock(ps_vma); PVR_DPF((PVR_DBG_MESSAGE, "%s: Mapped area at offset 0x%08lx\n", @@ -882,11 +883,11 @@ unlock_and_return: #if defined(DEBUG_LINUX_MMAP_AREAS) -static void ProcSeqStartstopMMapRegistations(struct seq_file *sfile,IMG_BOOL start) +static void ProcSeqStartstopMMapRegistations(struct seq_file *sfile,IMG_BOOL start) { - if(start) + if(start) { - LinuxLockMutex(&g_sMMapMutex); + LinuxLockMutex(&g_sMMapMutex); } else { @@ -898,7 +899,7 @@ static void ProcSeqStartstopMMapRegistations(struct seq_file *sfile,IMG_BOOL sta static void* ProcSeqOff2ElementMMapRegistrations(struct seq_file *sfile, loff_t off) { LinuxMemArea *psLinuxMemArea; - if(!off) + if(!off) { return PVR_PROC_SEQ_START_TOKEN; } @@ -911,7 +912,7 @@ static void* ProcSeqOff2ElementMMapRegistrations(struct seq_file *sfile, loff_t { off--; if (off == 0) - { + { PVR_ASSERT(psOffsetStruct->psLinuxMemArea == psLinuxMemArea); return (void*)psOffsetStruct; } @@ -933,7 +934,7 @@ static void ProcSeqShowMMapRegistrations(struct seq_file *sfile, void *el) IMG_UINT32 ui32RealByteSize; IMG_UINT32 ui32ByteOffset; - if(el == PVR_PROC_SEQ_START_TOKEN) + if(el == PVR_PROC_SEQ_START_TOKEN) { seq_printf( sfile, #if !defined(DEBUG_LINUX_XML_PROC_FILES) @@ -1017,7 +1018,7 @@ PVRMMapRegisterArea(LinuxMemArea *psLinuxMemArea) PVR_ASSERT(psLinuxMemArea->eAreaType != LINUX_MEM_AREA_SUB_ALLOC || LinuxMemAreaRoot(psLinuxMemArea)->eAreaType != LINUX_MEM_AREA_SUB_ALLOC); - + if(psLinuxMemArea->bMMapRegistered) { PVR_DPF((PVR_DBG_ERROR, "%s: psLinuxMemArea 0x%p is already registered", @@ -1032,7 +1033,7 @@ PVRMMapRegisterArea(LinuxMemArea *psLinuxMemArea) #if defined(DEBUG_LINUX_MMAP_AREAS) g_ui32RegisteredAreas++; - + if (psLinuxMemArea->eAreaType != LINUX_MEM_AREA_SUB_ALLOC) { g_ui32TotalByteSize += psLinuxMemArea->ui32ByteSize; @@ -1063,15 +1064,14 @@ PVRMMapRemoveRegisteredArea(LinuxMemArea *psLinuxMemArea) if (psOffsetStruct->ui32Mapped != 0) { PVR_DPF((PVR_DBG_ERROR, "%s: psOffsetStruct 0x%p for memory area 0x0x%p is still mapped; psOffsetStruct->ui32Mapped %u", __FUNCTION__, psOffsetStruct, psLinuxMemArea, psOffsetStruct->ui32Mapped)); - dump_stack(); - PVRSRVDumpRefCountCCB(); - - eError = PVRSRV_ERROR_STILL_MAPPED; - goto exit_unlock; + dump_stack(); + PVRSRVDumpRefCountCCB(); + eError = PVRSRV_ERROR_STILL_MAPPED; + goto exit_unlock; } else { - + PVR_DPF((PVR_DBG_WARNING, "%s: psOffsetStruct 0x%p was never mapped", __FUNCTION__, psOffsetStruct)); } @@ -1167,13 +1167,13 @@ PVRMMapInit(IMG_VOID) } #if defined(DEBUG_LINUX_MMAP_AREAS) - g_ProcMMap = CreateProcReadEntrySeq("mmap", NULL, + g_ProcMMap = CreateProcReadEntrySeq("mmap", NULL, ProcSeqNextMMapRegistrations, ProcSeqShowMMapRegistrations, ProcSeqOff2ElementMMapRegistrations, ProcSeqStartstopMMapRegistations ); -#endif +#endif return; error: @@ -1192,7 +1192,7 @@ PVRMMapCleanup(IMG_VOID) LinuxMemArea *psLinuxMemArea, *psTmpMemArea; PVR_DPF((PVR_DBG_ERROR, "%s: Memory areas are still registered with MMap", __FUNCTION__)); - + PVR_TRACE(("%s: Unregistering memory areas", __FUNCTION__)); list_for_each_entry_safe(psLinuxMemArea, psTmpMemArea, &g_sMMapAreaList, sMMapItem) { @@ -1210,7 +1210,7 @@ PVRMMapCleanup(IMG_VOID) #if defined(DEBUG_LINUX_MMAP_AREAS) RemoveProcEntrySeq(g_ProcMMap); -#endif +#endif if(g_psMemmapCache) { diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mmap.h b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mmap.h index 8604671..224e652 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mmap.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mmap.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -39,43 +39,43 @@ typedef struct KV_OFFSET_STRUCT_TAG { - + IMG_UINT32 ui32Mapped; - + IMG_UINT32 ui32MMapOffset; - + IMG_UINT32 ui32RealByteSize; - + LinuxMemArea *psLinuxMemArea; - + #if !defined(PVR_MAKE_ALL_PFNS_SPECIAL) - + IMG_UINT32 ui32TID; #endif - + IMG_UINT32 ui32PID; - + IMG_BOOL bOnMMapList; - + IMG_UINT32 ui32RefCount; - + IMG_UINT32 ui32UserVAddr; - + #if defined(DEBUG_LINUX_MMAP_AREAS) const IMG_CHAR *pszName; #endif - - + + struct list_head sMMapItem; - + struct list_head sAreaItem; }KV_OFFSET_STRUCT, *PKV_OFFSET_STRUCT; @@ -118,5 +118,5 @@ PVRMMapReleaseMMapData(PVRSRV_PER_PROCESS_DATA *psPerProc, int PVRMMap(struct file* pFile, struct vm_area_struct* ps_vma); -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/module.c b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/module.c index 9297ae8..37eb5cc 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/module.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/module.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -35,7 +35,7 @@ #if defined(SUPPORT_DRI_DRM) && !defined(SUPPORT_DRI_DRM_PLUGIN) #define PVR_MOD_STATIC #else - + #if defined(LDM_PLATFORM) #define PVR_LDM_PLATFORM_MODULE #define PVR_LDM_MODULE @@ -69,11 +69,11 @@ #if defined(PVR_LDM_PLATFORM_MODULE) #include -#endif +#endif #if defined(PVR_LDM_PCI_MODULE) #include -#endif +#endif #if defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL) #include @@ -103,6 +103,7 @@ #include "private_data.h" #include "lock.h" #include "linkage.h" +#include "buffer_manager.h" #if defined(SUPPORT_DRI_DRM) #include "pvr_drm.h" @@ -125,7 +126,7 @@ MODULE_SUPPORTED_DEVICE(DEVNAME); extern IMG_UINT32 gPVRDebugLevel; module_param(gPVRDebugLevel, uint, 0644); MODULE_PARM_DESC(gPVRDebugLevel, "Sets the level of debug output (default 0x7)"); -#endif +#endif #if defined(CONFIG_ION_OMAP) #include @@ -133,9 +134,9 @@ MODULE_PARM_DESC(gPVRDebugLevel, "Sets the level of debug output (default 0x7)") extern struct ion_device *omap_ion_device; struct ion_client *gpsIONClient; EXPORT_SYMBOL(gpsIONClient); -#endif - +#endif + EXPORT_SYMBOL(PVRGetDisplayClassJTable); EXPORT_SYMBOL(PVRGetBufferClassJTable); @@ -172,12 +173,12 @@ static IMG_UINT32 gPVRPowerLevel; #if defined(PVR_LDM_PLATFORM_MODULE) #define LDM_DEV struct platform_device #define LDM_DRV struct platform_driver -#endif +#endif #if defined(PVR_LDM_PCI_MODULE) #define LDM_DEV struct pci_dev #define LDM_DRV struct pci_driver -#endif +#endif #if defined(PVR_LDM_PLATFORM_MODULE) static int PVRSRVDriverRemove(LDM_DEV *device); static int PVRSRVDriverProbe(LDM_DEV *device); @@ -262,13 +263,13 @@ static int __devinit PVRSRVDriverProbe(LDM_DEV *pDevice, const struct pci_device PVR_TRACE(("PVRSRVDriverProbe(pDevice=%p)", pDevice)); #if 0 - + if (PerDeviceSysInitialise((IMG_PVOID)pDevice) != PVRSRV_OK) { return -EINVAL; } -#endif - +#endif + psSysData = SysAcquireDataNoCheck(); if (psSysData == IMG_NULL) { @@ -289,7 +290,7 @@ static int __devinit PVRSRVDriverProbe(LDM_DEV *pDevice, const struct pci_device PVR_DPF((PVR_DBG_ERROR, "PVRSRVDriverProbe: Couldn't create ion client")); return PTR_ERR(gpsIONClient); } -#endif +#endif return 0; } @@ -312,7 +313,7 @@ static void __devexit PVRSRVDriverRemove(LDM_DEV *pDevice) #endif SysAcquireData(&psSysData); - + #if defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL) if (gPVRPowerLevel != 0) { @@ -340,7 +341,7 @@ static void __devexit PVRSRVDriverRemove(LDM_DEV *pDevice) return; #endif } -#endif +#endif #if defined(PVR_LDM_MODULE) || defined(PVR_DRI_DRM_PLATFORM_DEV) @@ -357,14 +358,14 @@ PVR_MOD_STATIC void PVRSRVDriverShutdown(LDM_DEV *pDevice) if (atomic_dec_and_test(&sDriverIsShutdown)) { - + LinuxLockMutex(&gPVRSRVLock); (void) PVRSRVSetPowerStateKM(PVRSRV_SYS_POWER_STATE_D3); } } -#endif +#endif #if defined(PVR_LDM_MODULE) || defined(SUPPORT_DRI_DRM) @@ -404,7 +405,7 @@ PVR_MOD_STATIC int PVRSRVDriverResume(LDM_DEV *pDevice) #endif return 0; } -#endif +#endif #if defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL) && !defined(SUPPORT_DRI_DRM) @@ -447,7 +448,7 @@ IMG_INT PVRProcSetPowerLevel(struct file *file, const IMG_CHAR *buffer, IMG_UINT return (count); } -void ProcSeqShowPowerLevel(struct seq_file *sfile,void* el) +void ProcSeqShowPowerLevel(struct seq_file *sfile,void* el) { seq_printf(sfile, "%lu\n", gPVRPowerLevel); } @@ -508,7 +509,7 @@ static int PVRSRVOpen(struct inode unref__ * pInode, struct file *pFile) psPrivateData->hBlockAlloc = hBlockAlloc; PRIVATE_DATA(pFile) = psPrivateData; iRet = 0; -err_unlock: +err_unlock: LinuxUnLockMutex(&gPVRSRVLock); return iRet; } @@ -540,7 +541,7 @@ static int PVRSRVRelease(struct inode unref__ * pInode, struct file *pFile) { PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo; - + if(PVRSRVLookupHandle(KERNEL_HANDLE_BASE, (IMG_PVOID *)&psKernelMemInfo, psPrivateData->hKernelMemInfo, @@ -551,7 +552,13 @@ static int PVRSRVRelease(struct inode unref__ * pInode, struct file *pFile) goto err_unlock; } + + if (psKernelMemInfo->sShareMemWorkaround.bInUse) + { + BM_XProcIndexRelease(psKernelMemInfo->sShareMemWorkaround.ui32ShareIndex); + } + if(FreeMemCallBackCommon(psKernelMemInfo, 0, PVRSRV_FREE_CALLBACK_ORIGIN_EXTERNAL) != PVRSRV_OK) { @@ -561,7 +568,7 @@ static int PVRSRVRelease(struct inode unref__ * pInode, struct file *pFile) } } - + gui32ReleasePID = psPrivateData->ui32OpenPID; PVRSRVProcessDisconnect(psPrivateData->ui32OpenPID); gui32ReleasePID = 0; @@ -571,7 +578,7 @@ static int PVRSRVRelease(struct inode unref__ * pInode, struct file *pFile) psPrivateData, psPrivateData->hBlockAlloc); #if !defined(SUPPORT_DRI_DRM) - PRIVATE_DATA(pFile) = IMG_NULL; + PRIVATE_DATA(pFile) = IMG_NULL; #endif } @@ -601,7 +608,7 @@ static int __init PVRCore_Init(void) #endif #if !defined(SUPPORT_DRI_DRM) - + PVRDPFInit(); #endif PVR_TRACE(("PVRCore_Init")); @@ -652,7 +659,7 @@ static int __init PVRCore_Init(void) goto init_failed; } #endif -#endif +#endif #if defined(PVR_LDM_PCI_MODULE) if ((error = pci_register_driver(&powervr_driver)) != 0) @@ -661,11 +668,11 @@ static int __init PVRCore_Init(void) goto init_failed; } -#endif -#endif +#endif +#endif #if !defined(PVR_LDM_MODULE) - + if ((eError = SysInitialise()) != PVRSRV_OK) { error = -ENODEV; @@ -678,7 +685,7 @@ static int __init PVRCore_Init(void) #endif goto init_failed; } -#endif +#endif #if !defined(SUPPORT_DRI_DRM) AssignedMajorNumber = register_chrdev(0, DEVNAME, &pvrsrv_fops); @@ -694,7 +701,7 @@ static int __init PVRCore_Init(void) PVR_TRACE(("PVRCore_Init: major device %d", AssignedMajorNumber)); #if defined(PVR_LDM_MODULE) - + psPvrClass = class_create(THIS_MODULE, "pvr"); if (IS_ERR(psPvrClass)) @@ -707,7 +714,7 @@ static int __init PVRCore_Init(void) psDev = device_create(psPvrClass, NULL, MKDEV(AssignedMajorNumber, 0), #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)) NULL, -#endif +#endif DEVNAME); if (IS_ERR(psDev)) { @@ -715,8 +722,8 @@ static int __init PVRCore_Init(void) error = -EBUSY; goto destroy_class; } -#endif -#endif +#endif +#endif return 0; @@ -741,8 +748,8 @@ sys_deinit: platform_driver_unregister(&powervr_driver); #endif -#else - +#else + { SYS_DATA *psSysData; @@ -752,7 +759,7 @@ sys_deinit: (void) SysDeinitialise(psSysData); } } -#endif +#endif init_failed: PVRMMapCleanup(); LinuxMMCleanup(); @@ -762,7 +769,7 @@ init_failed: return error; -} +} #if defined(SUPPORT_DRI_DRM) @@ -789,17 +796,17 @@ static void __exit PVRCore_Cleanup(void) #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,22)) if ( -#endif +#endif unregister_chrdev((IMG_UINT)AssignedMajorNumber, DEVNAME) #if !(LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,22)) ; -#else +#else ) { PVR_DPF((PVR_DBG_ERROR," can't unregister device major %d", AssignedMajorNumber)); } -#endif -#endif +#endif +#endif #if defined(PVR_LDM_MODULE) @@ -814,7 +821,7 @@ static void __exit PVRCore_Cleanup(void) platform_driver_unregister(&powervr_driver); #endif -#else +#else #if defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL) if (gPVRPowerLevel != 0) { @@ -824,9 +831,9 @@ static void __exit PVRCore_Cleanup(void) } } #endif - + (void) SysDeinitialise(psSysData); -#endif +#endif PVRMMapCleanup(); diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutex.c b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutex.c index 0f29e33..742fa03 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutex.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutex.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -79,7 +79,7 @@ IMG_BOOL LinuxIsLockedMutex(PVRSRV_LINUX_MUTEX *psPVRSRVMutex) } -#else +#else IMG_VOID LinuxInitMutex(PVRSRV_LINUX_MUTEX *psPVRSRVMutex) @@ -98,7 +98,7 @@ PVRSRV_ERROR LinuxLockMutexInterruptible(PVRSRV_LINUX_MUTEX *psPVRSRVMutex) { if(down_interruptible(&psPVRSRVMutex->sSemaphore) == -EINTR) { - + return PVRSRV_ERROR_MUTEX_INTERRUPTIBLE_ERROR; }else{ atomic_dec(&psPVRSRVMutex->Count); @@ -126,11 +126,11 @@ IMG_VOID LinuxUnLockMutex(PVRSRV_LINUX_MUTEX *psPVRSRVMutex) IMG_BOOL LinuxIsLockedMutex(PVRSRV_LINUX_MUTEX *psPVRSRVMutex) { IMG_INT32 iCount; - + iCount = atomic_read(&psPVRSRVMutex->Count); return (IMG_BOOL)iCount; } -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutex.h b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutex.h index ed2ec29..5e787b7 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutex.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutex.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -41,12 +41,12 @@ typedef struct mutex PVRSRV_LINUX_MUTEX; -#else +#else typedef struct { struct semaphore sSemaphore; - + atomic_t Count; }PVRSRV_LINUX_MUTEX; @@ -66,5 +66,5 @@ extern IMG_VOID LinuxUnLockMutex(PVRSRV_LINUX_MUTEX *psPVRSRVMutex); extern IMG_BOOL LinuxIsLockedMutex(PVRSRV_LINUX_MUTEX *psPVRSRVMutex); -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutils.c b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutils.c index 5701c19..a012cf5 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutils.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutils.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -77,15 +77,15 @@ pvr_pat_entry(u64 pat, IMG_UINT index) static IMG_VOID PVRLinuxX86PATProbe(IMG_VOID) { - - if (cpu_has_pat) + + if (cpu_has_pat) { u64 pat; IMG_UINT pat_index; IMG_UINT pat_entry; PVR_TRACE(("%s: PAT available", __FUNCTION__)); - + rdmsrl(MSR_IA32_CR_PAT, pat); PVR_TRACE(("%s: Top 32 bits of PAT: 0x%.8x", __FUNCTION__, (IMG_UINT)(pat >> 32))); PVR_TRACE(("%s: Bottom 32 bits of PAT: 0x%.8x", __FUNCTION__, (IMG_UINT)(pat))); @@ -110,21 +110,21 @@ PVRLinuxX86PATProbe(IMG_VOID) { PVR_TRACE(("%s: Write combining not available", __FUNCTION__)); } -#else +#else PVR_TRACE(("%s: Write combining disabled in driver build", __FUNCTION__)); -#endif -#endif +#endif +#endif } pgprot_t pvr_pgprot_writecombine(pgprot_t prot) { - - + + return (g_write_combining_available) ? __pgprot((pgprot_val(prot) & ~_PAGE_CACHE_MASK) | _PAGE_CACHE_WC) : pgprot_noncached(prot); } -#endif +#endif IMG_VOID PVRLinuxMUtilsInit(IMG_VOID) diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutils.h b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutils.h index 063e34e..b2a8ba0 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutils.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/mutils.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -61,7 +61,7 @@ #if defined(__i386__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)) #define IOREMAP(pa, bytes) ioremap_cache(pa, bytes) -#else +#else #if defined(__arm__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) #define IOREMAP(pa, bytes) ioremap_cached(pa, bytes) #else @@ -99,5 +99,5 @@ IMG_VOID PVRLinuxMUtilsInit(IMG_VOID); -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/osfunc.c b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/osfunc.c index b243de0..fdfbd6b 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/osfunc.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/osfunc.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include #include @@ -72,6 +72,7 @@ #include "mutex.h" #include "event.h" #include "linkage.h" +#include "lock.h" #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) #define ON_EACH_CPU(func, info, wait) on_each_cpu(func, info, wait) @@ -87,7 +88,7 @@ #define EVENT_OBJECT_TIMEOUT_MS (2000) #else #define EVENT_OBJECT_TIMEOUT_MS (500) -#endif +#endif #if !defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) PVRSRV_ERROR OSAllocMem_Impl(IMG_UINT32 ui32Flags, IMG_UINT32 ui32Size, IMG_PVOID *ppvCpuVAddr, IMG_HANDLE *phBlockAlloc) @@ -100,7 +101,7 @@ PVRSRV_ERROR OSAllocMem_Impl(IMG_UINT32 ui32Flags, IMG_UINT32 ui32Size, IMG_PVOI if (ui32Size > PAGE_SIZE) { - + #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) *ppvCpuVAddr = _VMallocWrapper(ui32Size, PVRSRV_HAP_CACHED, pszFilename, ui32Line); #else @@ -133,14 +134,14 @@ static inline int is_vmalloc_addr(const void *pvCpuVAddr) return lAddr >= VMALLOC_START && lAddr < VMALLOC_END; } -#endif +#endif #if !defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) PVRSRV_ERROR OSFreeMem_Impl(IMG_UINT32 ui32Flags, IMG_UINT32 ui32Size, IMG_PVOID pvCpuVAddr, IMG_HANDLE hBlockAlloc) #else PVRSRV_ERROR OSFreeMem_Impl(IMG_UINT32 ui32Flags, IMG_UINT32 ui32Size, IMG_PVOID pvCpuVAddr, IMG_HANDLE hBlockAlloc, IMG_CHAR *pszFilename, IMG_UINT32 ui32Line) #endif -{ +{ PVR_UNREFERENCED_PARAMETER(ui32Flags); PVR_UNREFERENCED_PARAMETER(ui32Size); PVR_UNREFERENCED_PARAMETER(hBlockAlloc); @@ -180,7 +181,7 @@ OSAllocPages_Impl(IMG_UINT32 ui32AllocFlags, PVR_UNREFERENCED_PARAMETER(ui32PageSize); #if 0 - + if(ui32AllocFlags & PVRSRV_HAP_SINGLE_PROCESS) { ui32AllocFlags &= ~PVRSRV_HAP_SINGLE_PROCESS; @@ -190,7 +191,7 @@ OSAllocPages_Impl(IMG_UINT32 ui32AllocFlags, if(ui32AllocFlags & PVRSRV_MEM_ION) { - + BUG_ON((ui32AllocFlags & PVRSRV_HAP_MAPTYPE_MASK) != PVRSRV_HAP_SINGLE_PROCESS); psLinuxMemArea = NewIONLinuxMemArea(ui32Size, ui32AllocFlags, @@ -217,7 +218,7 @@ OSAllocPages_Impl(IMG_UINT32 ui32AllocFlags, } case PVRSRV_HAP_SINGLE_PROCESS: { - + psLinuxMemArea = NewAllocPagesLinuxMemArea(ui32Size, ui32AllocFlags); if(!psLinuxMemArea) { @@ -229,9 +230,9 @@ OSAllocPages_Impl(IMG_UINT32 ui32AllocFlags, case PVRSRV_HAP_MULTI_PROCESS: { - + #if defined(VIVT_CACHE) || defined(__sh__) - + ui32AllocFlags &= ~PVRSRV_HAP_CACHED; #endif psLinuxMemArea = NewVMallocLinuxMemArea(ui32Size, ui32AllocFlags); @@ -252,7 +253,7 @@ OSAllocPages_Impl(IMG_UINT32 ui32AllocFlags, ExitSkipSwitch: *ppvCpuVAddr = LinuxMemAreaToCpuVAddr(psLinuxMemArea); *phOSMemHandle = psLinuxMemArea; - + LinuxMemAreaRegister(psLinuxMemArea); return PVRSRV_OK; @@ -261,13 +262,13 @@ ExitSkipSwitch: PVRSRV_ERROR OSFreePages(IMG_UINT32 ui32AllocFlags, IMG_UINT32 ui32Bytes, IMG_VOID *pvCpuVAddr, IMG_HANDLE hOSMemHandle) -{ +{ LinuxMemArea *psLinuxMemArea; PVRSRV_ERROR eError; - + PVR_UNREFERENCED_PARAMETER(ui32Bytes); PVR_UNREFERENCED_PARAMETER(pvCpuVAddr); - + psLinuxMemArea = (LinuxMemArea *)hOSMemHandle; switch(ui32AllocFlags & PVRSRV_HAP_MAPTYPE_MASK) @@ -309,7 +310,7 @@ OSGetSubMemHandle(IMG_HANDLE hOSMemHandle, PVRSRV_ERROR eError; psParentLinuxMemArea = (LinuxMemArea *)hOSMemHandle; - + psLinuxMemArea = NewSubLinuxMemArea(psParentLinuxMemArea, ui32ByteOffset, ui32Bytes); if(!psLinuxMemArea) { @@ -318,7 +319,7 @@ OSGetSubMemHandle(IMG_HANDLE hOSMemHandle, } *phOSMemHandleRet = psLinuxMemArea; - + if(ui32Flags & PVRSRV_HAP_KERNEL_ONLY) { return PVRSRV_OK; @@ -343,10 +344,10 @@ OSReleaseSubMemHandle(IMG_VOID *hOSMemHandle, IMG_UINT32 ui32Flags) { LinuxMemArea *psLinuxMemArea; PVRSRV_ERROR eError; - + psLinuxMemArea = (LinuxMemArea *)hOSMemHandle; PVR_ASSERT(psLinuxMemArea->eAreaType == LINUX_MEM_AREA_SUB_ALLOC); - + if((ui32Flags & PVRSRV_HAP_KERNEL_ONLY) == 0) { eError = PVRMMapRemoveRegisteredArea(psLinuxMemArea); @@ -448,7 +449,7 @@ IMG_VOID OSBreakResourceLock (PVRSRV_RESOURCE *psResource, IMG_UINT32 ui32ID) } else { - PVR_DPF((PVR_DBG_MESSAGE,"OSBreakResourceLock: Resource is not locked for this process.")); + PVR_DPF((PVR_DBG_MESSAGE,"OSBreakResourceLock: Resource is not locked for this process.")); } } else @@ -479,8 +480,8 @@ PVRSRV_ERROR OSInitEnvData(IMG_PVOID *ppvEnvSpecificData) { ENV_DATA *psEnvData; PVRSRV_ERROR eError; - - + + eError = OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(ENV_DATA), (IMG_VOID **)&psEnvData, IMG_NULL, "Environment Data"); if (eError != PVRSRV_OK) @@ -488,22 +489,22 @@ PVRSRV_ERROR OSInitEnvData(IMG_PVOID *ppvEnvSpecificData) return eError; } - eError = OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, PVRSRV_MAX_BRIDGE_IN_SIZE + PVRSRV_MAX_BRIDGE_OUT_SIZE, + eError = OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, PVRSRV_MAX_BRIDGE_IN_SIZE + PVRSRV_MAX_BRIDGE_OUT_SIZE, &psEnvData->pvBridgeData, IMG_NULL, "Bridge Data"); if (eError != PVRSRV_OK) { OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(ENV_DATA), psEnvData, IMG_NULL); - + return eError; } - + psEnvData->bMISRInstalled = IMG_FALSE; psEnvData->bLISRInstalled = IMG_FALSE; - + *ppvEnvSpecificData = psEnvData; return PVRSRV_OK; @@ -521,20 +522,20 @@ PVRSRV_ERROR OSDeInitEnvData(IMG_PVOID pvEnvSpecificData) psEnvData->pvBridgeData = IMG_NULL; OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(ENV_DATA), pvEnvSpecificData, IMG_NULL); - + return PVRSRV_OK; } - + IMG_VOID OSReleaseThreadQuanta(IMG_VOID) { schedule(); } - + IMG_UINT32 OSClockus(IMG_VOID) { IMG_UINT32 time, j = jiffies; @@ -557,20 +558,20 @@ IMG_VOID OSSleepms(IMG_UINT32 ui32Timems) } - + IMG_HANDLE OSFuncHighResTimerCreate(IMG_VOID) { - + return (IMG_HANDLE) 1; } - + IMG_UINT32 OSFuncHighResTimerGetus(IMG_HANDLE hTimer) { return (IMG_UINT32) jiffies_to_usecs(jiffies); } - + IMG_VOID OSFuncHighResTimerDestroy(IMG_HANDLE hTimer) { PVR_UNREFERENCED_PARAMETER(hTimer); @@ -620,7 +621,7 @@ static irqreturn_t DeviceISRWrapper(int irq, void *dev_id #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) PVR_UNREFERENCED_PARAMETER(regs); -#endif +#endif psDeviceNode = (PVRSRV_DEVICE_NODE*)dev_id; if(!psDeviceNode) { @@ -709,7 +710,7 @@ PVRSRV_ERROR OSInstallDeviceLISR(IMG_VOID *pvSysData, psEnvData->pvISRCookie = pvDeviceNode; psEnvData->bLISRInstalled = IMG_TRUE; - return PVRSRV_OK; + return PVRSRV_OK; } PVRSRV_ERROR OSUninstallDeviceLISR(IMG_VOID *pvSysData) @@ -722,7 +723,7 @@ PVRSRV_ERROR OSUninstallDeviceLISR(IMG_VOID *pvSysData) PVR_DPF((PVR_DBG_ERROR, "OSUninstallDeviceLISR: No LISR has been installed")); return PVRSRV_ERROR_ISR_NOT_INSTALLED; } - + PVR_TRACE(("Uninstalling device LISR on IRQ %d with cookie %p", psEnvData->ui32IRQ, psEnvData->pvISRCookie)); free_irq(psEnvData->ui32IRQ, psEnvData->pvISRCookie); @@ -763,7 +764,7 @@ PVRSRV_ERROR OSInstallSystemLISR(IMG_VOID *pvSysData, IMG_UINT32 ui32Irq) psEnvData->pvISRCookie = pvSysData; psEnvData->bLISRInstalled = IMG_TRUE; - return PVRSRV_OK; + return PVRSRV_OK; } @@ -868,9 +869,9 @@ PVRSRV_ERROR OSScheduleMISR(IMG_VOID *pvSysData) queue_work(psEnvData->psWorkQueue, &psEnvData->sMISRWork); } - return PVRSRV_OK; + return PVRSRV_OK; } -#else +#else #if defined(PVR_LINUX_MISR_USING_WORKQUEUE) static void MISRWrapper( #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) @@ -944,10 +945,10 @@ PVRSRV_ERROR OSScheduleMISR(IMG_VOID *pvSysData) schedule_work(&psEnvData->sMISRWork); } - return PVRSRV_OK; + return PVRSRV_OK; } -#else +#else static void MISRWrapper(unsigned long data) @@ -955,7 +956,7 @@ static void MISRWrapper(unsigned long data) SYS_DATA *psSysData; psSysData = (SYS_DATA *)data; - + PVRSRVMISR(psSysData); } @@ -1011,13 +1012,13 @@ PVRSRV_ERROR OSScheduleMISR(IMG_VOID *pvSysData) tasklet_schedule(&psEnvData->sMISRTasklet); } - return PVRSRV_OK; + return PVRSRV_OK; } -#endif -#endif +#endif +#endif -#endif +#endif IMG_VOID OSPanic(IMG_VOID) { @@ -1059,7 +1060,7 @@ PVRSRV_ERROR OSUnlockResource (PVRSRV_RESOURCE *psResource, IMG_UINT32 ui32ID) } else { - PVR_DPF((PVR_DBG_ERROR,"OSUnlockResource: Resource %p is not locked with expected value.", psResource)); + PVR_DPF((PVR_DBG_ERROR,"OSUnlockResource: Resource %p is not locked with expected value.", psResource)); PVR_DPF((PVR_DBG_MESSAGE,"Should be %x is actually %x", ui32ID, psResource->ui32ID)); eError = PVRSRV_ERROR_INVALID_LOCK_ID; } @@ -1069,7 +1070,7 @@ PVRSRV_ERROR OSUnlockResource (PVRSRV_RESOURCE *psResource, IMG_UINT32 ui32ID) PVR_DPF((PVR_DBG_ERROR,"OSUnlockResource: Resource %p is not locked", psResource)); eError = PVRSRV_ERROR_RESOURCE_NOT_LOCKED; } - + return eError; } @@ -1087,7 +1088,7 @@ IMG_BOOL OSIsResourceLocked (PVRSRV_RESOURCE *psResource, IMG_UINT32 ui32ID) #if !defined(SYS_CUSTOM_POWERLOCK_WRAP) PVRSRV_ERROR OSPowerLockWrap(IMG_BOOL bTryLock) { - PVR_UNREFERENCED_PARAMETER(bTryLock); + PVR_UNREFERENCED_PARAMETER(bTryLock); return PVRSRV_OK; } @@ -1095,7 +1096,7 @@ PVRSRV_ERROR OSPowerLockWrap(IMG_BOOL bTryLock) IMG_VOID OSPowerLockUnwrap (IMG_VOID) { } -#endif +#endif IMG_CPU_PHYADDR OSMapLinToCPUPhys(IMG_HANDLE hOSMemHandle, @@ -1108,7 +1109,7 @@ IMG_CPU_PHYADDR OSMapLinToCPUPhys(IMG_HANDLE hOSMemHandle, PVR_ASSERT(hOSMemHandle != IMG_NULL); - + psLinuxMemArea = (LinuxMemArea *)hOSMemHandle; @@ -1129,7 +1130,7 @@ OSMapPhysToLin(IMG_CPU_PHYADDR BasePAddr, { if(ui32MappingFlags & PVRSRV_HAP_KERNEL_ONLY) { - + if(phOSMemHandle == IMG_NULL) { IMG_VOID *pvIORemapCookie; @@ -1166,7 +1167,7 @@ OSUnMapPhysToLin(IMG_VOID *pvLinAddr, IMG_UINT32 ui32Bytes, IMG_UINT32 ui32Mappi { PVR_TRACE(("%s: unmapping %d bytes from %p", __FUNCTION__, ui32Bytes, pvLinAddr)); - PVR_UNREFERENCED_PARAMETER(ui32Bytes); + PVR_UNREFERENCED_PARAMETER(ui32Bytes); if(ui32MappingFlags & PVRSRV_HAP_KERNEL_ONLY) { @@ -1179,7 +1180,7 @@ OSUnMapPhysToLin(IMG_VOID *pvLinAddr, IMG_UINT32 ui32Bytes, IMG_UINT32 ui32Mappi LinuxMemArea *psLinuxMemArea = (LinuxMemArea *)hOSMemHandle; PVR_ASSERT(LinuxMemAreaToCpuVAddr(psLinuxMemArea) == pvLinAddr); - + FreeIORemapLinuxMemArea(psLinuxMemArea); } @@ -1207,7 +1208,7 @@ RegisterExternalMem(IMG_SYS_PHYADDR *pBasePAddr, case PVRSRV_HAP_KERNEL_ONLY: { psLinuxMemArea = NewExternalKVLinuxMemArea(pBasePAddr, pvCPUVAddr, ui32Bytes, bPhysContig, ui32MappingFlags); - + if(!psLinuxMemArea) { return PVRSRV_ERROR_BAD_MAPPING; @@ -1227,9 +1228,9 @@ RegisterExternalMem(IMG_SYS_PHYADDR *pBasePAddr, } case PVRSRV_HAP_MULTI_PROCESS: { - + #if defined(VIVT_CACHE) || defined(__sh__) - + ui32MappingFlags &= ~PVRSRV_HAP_CACHED; #endif psLinuxMemArea = NewExternalKVLinuxMemArea(pBasePAddr, pvCPUVAddr, ui32Bytes, bPhysContig, ui32MappingFlags); @@ -1246,7 +1247,7 @@ RegisterExternalMem(IMG_SYS_PHYADDR *pBasePAddr, *phOSMemHandle = (IMG_HANDLE)0; return PVRSRV_ERROR_INVALID_FLAGS; } - + *phOSMemHandle = (IMG_HANDLE)psLinuxMemArea; LinuxMemAreaRegister(psLinuxMemArea); @@ -1330,7 +1331,7 @@ OSReservePhys(IMG_CPU_PHYADDR BasePAddr, LinuxMemArea *psLinuxMemArea; #if 0 - + if(ui32MappingFlags & PVRSRV_HAP_SINGLE_PROCESS) { ui32MappingFlags &= ~PVRSRV_HAP_SINGLE_PROCESS; @@ -1342,7 +1343,7 @@ OSReservePhys(IMG_CPU_PHYADDR BasePAddr, { case PVRSRV_HAP_KERNEL_ONLY: { - + psLinuxMemArea = NewIORemapLinuxMemArea(BasePAddr, ui32Bytes, ui32MappingFlags); if(!psLinuxMemArea) { @@ -1352,7 +1353,7 @@ OSReservePhys(IMG_CPU_PHYADDR BasePAddr, } case PVRSRV_HAP_SINGLE_PROCESS: { - + psLinuxMemArea = NewIOLinuxMemArea(BasePAddr, ui32Bytes, ui32MappingFlags); if(!psLinuxMemArea) { @@ -1363,9 +1364,9 @@ OSReservePhys(IMG_CPU_PHYADDR BasePAddr, } case PVRSRV_HAP_MULTI_PROCESS: { - + #if defined(VIVT_CACHE) || defined(__sh__) - + ui32MappingFlags &= ~PVRSRV_HAP_CACHED; #endif psLinuxMemArea = NewIORemapLinuxMemArea(BasePAddr, ui32Bytes, ui32MappingFlags); @@ -1404,7 +1405,7 @@ OSUnReservePhys(IMG_VOID *pvCpuVAddr, PVR_UNREFERENCED_PARAMETER(ui32Bytes); psLinuxMemArea = (LinuxMemArea *)hOSMemHandle; - + switch(ui32MappingFlags & PVRSRV_HAP_MAPTYPE_MASK) { case PVRSRV_HAP_KERNEL_ONLY: @@ -1428,7 +1429,7 @@ OSUnReservePhys(IMG_VOID *pvCpuVAddr, return PVRSRV_ERROR_INVALID_PARAMS; } } - + LinuxMemAreaDeepFree(psLinuxMemArea); return PVRSRV_OK; @@ -1462,7 +1463,7 @@ PVRSRV_ERROR OSBaseAllocContigMemory(IMG_UINT32 ui32Size, IMG_CPU_VIRTADDR *pvLi psPhysAddr->uiAddr = virt_to_phys(pvKernLinAddr); return PVRSRV_OK; -#endif +#endif } @@ -1528,26 +1529,26 @@ PVRSRV_PCI_DEV_HANDLE OSPCISetDev(IMG_VOID *pvPCICookie, HOST_PCI_INIT_FLAGS eFl return IMG_NULL; } - if (psPVRPCI->ePCIFlags & HOST_PCI_INIT_FLAG_BUS_MASTER) + if (psPVRPCI->ePCIFlags & HOST_PCI_INIT_FLAG_BUS_MASTER) { pci_set_master(psPVRPCI->psPCIDev); } - if (psPVRPCI->ePCIFlags & HOST_PCI_INIT_FLAG_MSI) + if (psPVRPCI->ePCIFlags & HOST_PCI_INIT_FLAG_MSI) { #if defined(CONFIG_PCI_MSI) err = pci_enable_msi(psPVRPCI->psPCIDev); if (err != 0) { PVR_DPF((PVR_DBG_WARNING, "OSPCISetDev: Couldn't enable MSI (%d)", err)); - psPVRPCI->ePCIFlags &= ~HOST_PCI_INIT_FLAG_MSI; + psPVRPCI->ePCIFlags &= ~HOST_PCI_INIT_FLAG_MSI; } #else PVR_DPF((PVR_DBG_WARNING, "OSPCISetDev: MSI support not enabled in the kernel")); #endif } - + for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { psPVRPCI->abPCIResourceInUse[i] = IMG_FALSE; @@ -1639,17 +1640,17 @@ static IMG_UINT32 OSPCIAddrRangeFunc(enum HOST_PCI_ADDR_RANGE_FUNC eFunc, IMG_UINT32 OSPCIAddrRangeLen(PVRSRV_PCI_DEV_HANDLE hPVRPCI, IMG_UINT32 ui32Index) { - return OSPCIAddrRangeFunc(HOST_PCI_ADDR_RANGE_FUNC_LEN, hPVRPCI, ui32Index); + return OSPCIAddrRangeFunc(HOST_PCI_ADDR_RANGE_FUNC_LEN, hPVRPCI, ui32Index); } IMG_UINT32 OSPCIAddrRangeStart(PVRSRV_PCI_DEV_HANDLE hPVRPCI, IMG_UINT32 ui32Index) { - return OSPCIAddrRangeFunc(HOST_PCI_ADDR_RANGE_FUNC_START, hPVRPCI, ui32Index); + return OSPCIAddrRangeFunc(HOST_PCI_ADDR_RANGE_FUNC_START, hPVRPCI, ui32Index); } IMG_UINT32 OSPCIAddrRangeEnd(PVRSRV_PCI_DEV_HANDLE hPVRPCI, IMG_UINT32 ui32Index) { - return OSPCIAddrRangeFunc(HOST_PCI_ADDR_RANGE_FUNC_END, hPVRPCI, ui32Index); + return OSPCIAddrRangeFunc(HOST_PCI_ADDR_RANGE_FUNC_END, hPVRPCI, ui32Index); } PVRSRV_ERROR OSPCIRequestAddrRange(PVRSRV_PCI_DEV_HANDLE hPVRPCI, @@ -1670,7 +1671,7 @@ PVRSRV_ERROR OSPCIReleaseDev(PVRSRV_PCI_DEV_HANDLE hPVRPCI) PVR_TRACE(("OSPCIReleaseDev")); - + for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { if (psPVRPCI->abPCIResourceInUse[i]) @@ -1682,14 +1683,14 @@ PVRSRV_ERROR OSPCIReleaseDev(PVRSRV_PCI_DEV_HANDLE hPVRPCI) } #if defined(CONFIG_PCI_MSI) - if (psPVRPCI->ePCIFlags & HOST_PCI_INIT_FLAG_MSI) + if (psPVRPCI->ePCIFlags & HOST_PCI_INIT_FLAG_MSI) { pci_disable_msi(psPVRPCI->psPCIDev); } #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - if (psPVRPCI->ePCIFlags & HOST_PCI_INIT_FLAG_BUS_MASTER) + if (psPVRPCI->ePCIFlags & HOST_PCI_INIT_FLAG_BUS_MASTER) { pci_clear_master(psPVRPCI->psPCIDev); } @@ -1697,7 +1698,7 @@ PVRSRV_ERROR OSPCIReleaseDev(PVRSRV_PCI_DEV_HANDLE hPVRPCI) pci_disable_device(psPVRPCI->psPCIDev); OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(*psPVRPCI), (IMG_VOID *)psPVRPCI, IMG_NULL); - + return PVRSRV_OK; } @@ -1710,7 +1711,7 @@ PVRSRV_ERROR OSPCISuspendDev(PVRSRV_PCI_DEV_HANDLE hPVRPCI) PVR_TRACE(("OSPCISuspendDev")); - + for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { if (psPVRPCI->abPCIResourceInUse[i]) @@ -1789,10 +1790,10 @@ PVRSRV_ERROR OSPCIResumeDev(PVRSRV_PCI_DEV_HANDLE hPVRPCI) return PVRSRV_ERROR_PCI_CALL_FAILED; } - if (psPVRPCI->ePCIFlags & HOST_PCI_INIT_FLAG_BUS_MASTER) + if (psPVRPCI->ePCIFlags & HOST_PCI_INIT_FLAG_BUS_MASTER) pci_set_master(psPVRPCI->psPCIDev); - + for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { if (psPVRPCI->abPCIResourceInUse[i]) @@ -1809,7 +1810,7 @@ PVRSRV_ERROR OSPCIResumeDev(PVRSRV_PCI_DEV_HANDLE hPVRPCI) return PVRSRV_OK; } -#endif +#endif #define OS_MAX_TIMERS 8 @@ -1817,7 +1818,7 @@ typedef struct TIMER_CALLBACK_DATA_TAG { IMG_BOOL bInUse; PFN_TIMER_FUNC pfnTimerFunc; - IMG_VOID *pvData; + IMG_VOID *pvData; struct timer_list sTimer; IMG_UINT32 ui32Delay; IMG_BOOL bActive; @@ -1836,7 +1837,7 @@ static TIMER_CALLBACK_DATA sTimers[OS_MAX_TIMERS]; DEFINE_MUTEX(sTimerStructLock); #else #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) - + static spinlock_t sTimerStructLock = __SPIN_LOCK_UNLOCKED(); #else static DEFINE_SPINLOCK(sTimerStructLock); @@ -1848,10 +1849,10 @@ static void OSTimerCallbackBody(TIMER_CALLBACK_DATA *psTimerCBData) if (!psTimerCBData->bActive) return; - + psTimerCBData->pfnTimerFunc(psTimerCBData->pvData); - - + + mod_timer(&psTimerCBData->sTimer, psTimerCBData->ui32Delay + jiffies); } @@ -1859,7 +1860,7 @@ static void OSTimerCallbackBody(TIMER_CALLBACK_DATA *psTimerCBData) static IMG_VOID OSTimerCallbackWrapper(IMG_UINT32 ui32Data) { TIMER_CALLBACK_DATA *psTimerCBData = (TIMER_CALLBACK_DATA*)ui32Data; - + #if defined(PVR_LINUX_TIMERS_USING_WORKQUEUES) || defined(PVR_LINUX_TIMERS_USING_SHARED_WORKQUEUE) int res; @@ -1870,7 +1871,7 @@ static IMG_VOID OSTimerCallbackWrapper(IMG_UINT32 ui32Data) #endif if (res == 0) { - PVR_DPF((PVR_DBG_WARNING, "OSTimerCallbackWrapper: work already queued")); + PVR_DPF((PVR_DBG_WARNING, "OSTimerCallbackWrapper: work already queued")); } #else OSTimerCallbackBody(psTimerCBData); @@ -1895,14 +1896,14 @@ IMG_HANDLE OSAddTimer(PFN_TIMER_FUNC pfnTimerFunc, IMG_VOID *pvData, IMG_UINT32 unsigned long ulLockFlags; #endif - + if(!pfnTimerFunc) { - PVR_DPF((PVR_DBG_ERROR, "OSAddTimer: passed invalid callback")); - return IMG_NULL; + PVR_DPF((PVR_DBG_ERROR, "OSAddTimer: passed invalid callback")); + return IMG_NULL; } - - + + #if defined(PVR_LINUX_TIMERS_USING_WORKQUEUES) || defined(PVR_LINUX_TIMERS_USING_SHARED_WORKQUEUE) mutex_lock(&sTimerStructLock); #else @@ -1924,28 +1925,28 @@ IMG_HANDLE OSAddTimer(PFN_TIMER_FUNC pfnTimerFunc, IMG_VOID *pvData, IMG_UINT32 #endif if (ui32i >= OS_MAX_TIMERS) { - PVR_DPF((PVR_DBG_ERROR, "OSAddTimer: all timers are in use")); - return IMG_NULL; + PVR_DPF((PVR_DBG_ERROR, "OSAddTimer: all timers are in use")); + return IMG_NULL; } psTimerCBData->pfnTimerFunc = pfnTimerFunc; psTimerCBData->pvData = pvData; psTimerCBData->bActive = IMG_FALSE; - - + + psTimerCBData->ui32Delay = ((HZ * ui32MsTimeout) < 1000) ? 1 : ((HZ * ui32MsTimeout) / 1000); - + init_timer(&psTimerCBData->sTimer); - - - + + + psTimerCBData->sTimer.function = (IMG_VOID *)OSTimerCallbackWrapper; psTimerCBData->sTimer.data = (IMG_UINT32)psTimerCBData; - + return (IMG_HANDLE)(ui32i + 1); } @@ -1966,9 +1967,9 @@ PVRSRV_ERROR OSRemoveTimer (IMG_HANDLE hTimer) PVR_ASSERT(psTimerCBData->bInUse); PVR_ASSERT(!psTimerCBData->bActive); - + psTimerCBData->bInUse = IMG_FALSE; - + return PVRSRV_OK; } @@ -1980,15 +1981,15 @@ PVRSRV_ERROR OSEnableTimer (IMG_HANDLE hTimer) PVR_ASSERT(psTimerCBData->bInUse); PVR_ASSERT(!psTimerCBData->bActive); - + psTimerCBData->bActive = IMG_TRUE; - + psTimerCBData->sTimer.expires = psTimerCBData->ui32Delay + jiffies; - + add_timer(&psTimerCBData->sTimer); - + return PVRSRV_OK; } @@ -2000,7 +2001,7 @@ PVRSRV_ERROR OSDisableTimer (IMG_HANDLE hTimer) PVR_ASSERT(psTimerCBData->bInUse); PVR_ASSERT(psTimerCBData->bActive); - + psTimerCBData->bActive = IMG_FALSE; smp_mb(); @@ -2011,11 +2012,11 @@ PVRSRV_ERROR OSDisableTimer (IMG_HANDLE hTimer) flush_scheduled_work(); #endif - - del_timer_sync(&psTimerCBData->sTimer); - + + del_timer_sync(&psTimerCBData->sTimer); + #if defined(PVR_LINUX_TIMERS_USING_WORKQUEUES) - + flush_workqueue(psTimerWorkQueue); #endif #if defined(PVR_LINUX_TIMERS_USING_SHARED_WORKQUEUE) @@ -2034,7 +2035,7 @@ PVRSRV_ERROR OSEventObjectCreateKM(const IMG_CHAR *pszName, PVRSRV_EVENTOBJECT * { PVRSRV_ERROR eError = PVRSRV_OK; - + if(psEventObject) { if (pszName && strlen(pszName) < EVENTOBJNAME_MAXLENGTH) @@ -2043,27 +2044,27 @@ PVRSRV_ERROR OSEventObjectCreateKM(const IMG_CHAR *pszName, PVRSRV_EVENTOBJECT * } else { - - static IMG_UINT16 ui16NameIndex = 0; + + static IMG_UINT16 ui16NameIndex = 0; #if defined (SUPPORT_SID_INTERFACE) snprintf(psEventObject->szName, EVENTOBJNAME_MAXLENGTH, "PVRSRV_EVENTOBJECT_KM_%d", ui16NameIndex++); #else snprintf(psEventObject->szName, EVENTOBJNAME_MAXLENGTH, "PVRSRV_EVENTOBJECT_%d", ui16NameIndex++); #endif } - + if(LinuxEventObjectListCreate(&psEventObject->hOSEventKM) != PVRSRV_OK) { - eError = PVRSRV_ERROR_OUT_OF_MEMORY; + eError = PVRSRV_ERROR_OUT_OF_MEMORY; } } else { PVR_DPF((PVR_DBG_ERROR, "OSEventObjectCreateKM: psEventObject is not a valid pointer")); - eError = PVRSRV_ERROR_UNABLE_TO_CREATE_EVENT; + eError = PVRSRV_ERROR_UNABLE_TO_CREATE_EVENT; } - + return eError; } @@ -2094,14 +2095,14 @@ PVRSRV_ERROR OSEventObjectDestroyKM(PVRSRV_EVENTOBJECT *psEventObject) PVR_DPF((PVR_DBG_ERROR, "OSEventObjectDestroyKM: psEventObject is not a valid pointer")); eError = PVRSRV_ERROR_INVALID_PARAMS; } - + return eError; } PVRSRV_ERROR OSEventObjectWaitKM(IMG_HANDLE hOSEventKM) { PVRSRV_ERROR eError; - + if(hOSEventKM) { eError = LinuxEventObjectWait(hOSEventKM, EVENT_OBJECT_TIMEOUT_MS); @@ -2111,7 +2112,7 @@ PVRSRV_ERROR OSEventObjectWaitKM(IMG_HANDLE hOSEventKM) PVR_DPF((PVR_DBG_ERROR, "OSEventObjectWaitKM: hOSEventKM is not a valid handle")); eError = PVRSRV_ERROR_INVALID_PARAMS; } - + return eError; } @@ -2123,7 +2124,7 @@ PVRSRV_ERROR OSEventObjectOpenKM(PVRSRV_EVENTOBJECT *psEventObject, IMG_HANDLE *phOSEvent) { PVRSRV_ERROR eError = PVRSRV_OK; - + if(psEventObject) { if(LinuxEventObjectAdd(psEventObject->hOSEventKM, phOSEvent) != PVRSRV_OK) @@ -2138,7 +2139,7 @@ PVRSRV_ERROR OSEventObjectOpenKM(PVRSRV_EVENTOBJECT *psEventObject, PVR_DPF((PVR_DBG_ERROR, "OSEventObjectCreateKM: psEventObject is not a valid pointer")); eError = PVRSRV_ERROR_INVALID_PARAMS; } - + return eError; } @@ -2165,15 +2166,15 @@ PVRSRV_ERROR OSEventObjectCloseKM(PVRSRV_EVENTOBJECT *psEventObject, PVR_DPF((PVR_DBG_ERROR, "OSEventObjectDestroyKM: psEventObject is not a valid pointer")); eError = PVRSRV_ERROR_INVALID_PARAMS; } - + return eError; - + } PVRSRV_ERROR OSEventObjectSignalKM(IMG_HANDLE hOSEventKM) { PVRSRV_ERROR eError; - + if(hOSEventKM) { eError = LinuxEventObjectSignal(hOSEventKM); @@ -2183,7 +2184,7 @@ PVRSRV_ERROR OSEventObjectSignalKM(IMG_HANDLE hOSEventKM) PVR_DPF((PVR_DBG_ERROR, "OSEventObjectSignalKM: hOSEventKM is not a valid handle")); eError = PVRSRV_ERROR_INVALID_PARAMS; } - + return eError; } @@ -2192,9 +2193,9 @@ IMG_BOOL OSProcHasPrivSrvInit(IMG_VOID) return (capable(CAP_SYS_MODULE) != 0) ? IMG_TRUE : IMG_FALSE; } -PVRSRV_ERROR OSCopyToUser(IMG_PVOID pvProcess, - IMG_VOID *pvDest, - IMG_VOID *pvSrc, +PVRSRV_ERROR OSCopyToUser(IMG_PVOID pvProcess, + IMG_VOID *pvDest, + IMG_VOID *pvSrc, IMG_UINT32 ui32Bytes) { PVR_UNREFERENCED_PARAMETER(pvProcess); @@ -2205,9 +2206,9 @@ PVRSRV_ERROR OSCopyToUser(IMG_PVOID pvProcess, return PVRSRV_ERROR_FAILED_TO_COPY_VIRT_MEMORY; } -PVRSRV_ERROR OSCopyFromUser( IMG_PVOID pvProcess, - IMG_VOID *pvDest, - IMG_VOID *pvSrc, +PVRSRV_ERROR OSCopyFromUser( IMG_PVOID pvProcess, + IMG_VOID *pvDest, + IMG_VOID *pvSrc, IMG_UINT32 ui32Bytes) { PVR_UNREFERENCED_PARAMETER(pvProcess); @@ -2335,7 +2336,7 @@ PVRSRV_ERROR OSReleasePhysPageAddr(IMG_HANDLE hOSWrapMem) PVR_ASSERT(psPage != NULL); - + if (psInfo->iNumPagesMapped == psInfo->iNumPages) { if (!PageReserved(psPage)) @@ -2408,7 +2409,7 @@ static IMG_UINT32 CPUAddrToTilerPhy(IMG_UINT32 uiAddr) ui32PhysAddr = (pte & PAGE_MASK) | (~PAGE_MASK & uiAddr); - + if (ui32PhysAddr < 0x60000000 && ui32PhysAddr > 0x7fffffff) { PVR_DPF((PVR_DBG_ERROR, "CPUAddrToTilerPhy: Not in tiler range")); @@ -2420,10 +2421,10 @@ err_out: return ui32PhysAddr; } -#endif +#endif -PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr, - IMG_UINT32 ui32Bytes, +PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr, + IMG_UINT32 ui32Bytes, IMG_SYS_PHYADDR *psSysPAddr, IMG_HANDLE *phOSWrapMem) { @@ -2442,12 +2443,12 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr, IMG_BOOL bMMapSemHeld = IMG_FALSE; PVRSRV_ERROR eError = PVRSRV_ERROR_OUT_OF_MEMORY; - + ulStartAddr = ulStartAddrOrig & PAGE_MASK; ulBeyondEndAddr = PAGE_ALIGN(ulBeyondEndAddrOrig); ulAddrRange = ulBeyondEndAddr - ulStartAddr; - + if (ulBeyondEndAddr <= ulStartAddr) { PVR_DPF((PVR_DBG_ERROR, @@ -2456,7 +2457,7 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr, goto error; } - + psInfo = kmalloc(sizeof(*psInfo), GFP_KERNEL); if (psInfo == NULL) { @@ -2474,42 +2475,42 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr, psInfo->iNumPages = (IMG_INT)(ulAddrRange >> PAGE_SHIFT); psInfo->iPageOffset = (IMG_INT)(ulStartAddrOrig & ~PAGE_MASK); - + psInfo->psPhysAddr = kmalloc((size_t)psInfo->iNumPages * sizeof(*psInfo->psPhysAddr), GFP_KERNEL); if (psInfo->psPhysAddr == NULL) { PVR_DPF((PVR_DBG_ERROR, - "OSAcquirePhysPageAddr: Couldn't allocate page array")); + "OSAcquirePhysPageAddr: Couldn't allocate page array")); goto error; } memset(psInfo->psPhysAddr, 0, (size_t)psInfo->iNumPages * sizeof(*psInfo->psPhysAddr)); - + psInfo->ppsPages = kmalloc((size_t)psInfo->iNumPages * sizeof(*psInfo->ppsPages), GFP_KERNEL); if (psInfo->ppsPages == NULL) { PVR_DPF((PVR_DBG_ERROR, - "OSAcquirePhysPageAddr: Couldn't allocate page array")); + "OSAcquirePhysPageAddr: Couldn't allocate page array")); goto error; } memset(psInfo->ppsPages, 0, (size_t)psInfo->iNumPages * sizeof(*psInfo->ppsPages)); - + eError = PVRSRV_ERROR_BAD_MAPPING; - + psInfo->eType = WRAP_TYPE_GET_USER_PAGES; - + down_read(¤t->mm->mmap_sem); bMMapSemHeld = IMG_TRUE; - + psInfo->iNumPagesMapped = get_user_pages(current, current->mm, ulStartAddr, psInfo->iNumPages, 1, 0, psInfo->ppsPages, NULL); if (psInfo->iNumPagesMapped >= 0) { - + if (psInfo->iNumPagesMapped != psInfo->iNumPages) { PVR_TRACE(("OSAcquirePhysPageAddr: Couldn't map all the pages needed (wanted: %d, got %d)", psInfo->iNumPages, psInfo->iNumPagesMapped)); @@ -2517,7 +2518,7 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr, goto error; } - + for (i = 0; i < psInfo->iNumPages; i++) { IMG_CPU_PHYADDR CPUPhysAddr; @@ -2534,21 +2535,21 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr, } psInfo->psPhysAddr[i] = SysCpuPAddrToSysPAddr(CPUPhysAddr); psSysPAddr[i] = psInfo->psPhysAddr[i]; - + } goto exit; } PVR_DPF((PVR_DBG_MESSAGE, "OSAcquirePhysPageAddr: get_user_pages failed (%d), using CPU page table", psInfo->iNumPagesMapped)); - - + + psInfo->eType = WRAP_TYPE_NULL; psInfo->iNumPagesMapped = 0; memset(psInfo->ppsPages, 0, (size_t)psInfo->iNumPages * sizeof(*psInfo->ppsPages)); - - + + psInfo->eType = WRAP_TYPE_FIND_VMA; psVMArea = find_vma(current->mm, ulStartAddrOrig); @@ -2556,14 +2557,14 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr, { PVR_DPF((PVR_DBG_ERROR, "OSAcquirePhysPageAddr: Couldn't find memory region containing start address %x", ulStartAddrOrig)); - + goto error; } #if defined(DEBUG) psInfo->psVMArea = psVMArea; #endif - + if (ulStartAddrOrig < psVMArea->vm_start) { PVR_DPF((PVR_DBG_ERROR, @@ -2571,7 +2572,7 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr, goto error; } - + if (ulBeyondEndAddrOrig > psVMArea->vm_end) { PVR_DPF((PVR_DBG_ERROR, @@ -2579,7 +2580,7 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr, goto error; } - + if ((psVMArea->vm_flags & (VM_IO | VM_RESERVED)) != (VM_IO | VM_RESERVED)) { PVR_DPF((PVR_DBG_ERROR, @@ -2587,7 +2588,7 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr, goto error; } - + if ((psVMArea->vm_flags & (VM_READ | VM_WRITE)) != (VM_READ | VM_WRITE)) { PVR_DPF((PVR_DBG_ERROR, @@ -2612,7 +2613,7 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr, if (psInfo->ppsPages[i] == NULL) { #if defined(CONFIG_TI_TILER) - + IMG_UINT32 ui32TilerAddr = CPUAddrToTilerPhy(ulAddr); if (ui32TilerAddr) { @@ -2622,7 +2623,7 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr, psSysPAddr[i].uiAddr = ui32TilerAddr; continue; } -#endif +#endif bHaveNoPageStructs = IMG_TRUE; } @@ -2665,7 +2666,7 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr, if (!bHaveNoPageStructs) { - + goto exit; } @@ -2682,7 +2683,7 @@ exit: PVR_ASSERT(bMMapSemHeld); up_read(¤t->mm->mmap_sem); - + *phOSWrapMem = (IMG_HANDLE)psInfo; if (bHaveNoPageStructs) @@ -2694,8 +2695,8 @@ exit: PVR_ASSERT(psInfo->eType != 0); #if 0 - - + + OSCleanCPUCacheRangeKM(pvCPUVAddr, (IMG_VOID *)((IMG_CHAR *)pvCPUVAddr + ui32Bytes)); #endif @@ -2754,7 +2755,7 @@ static unsigned long AllocPagesAreaToPhys(LinuxMemArea *psLinuxMemArea, IMG_UINT32 ui32PageNum) { struct page *pPage; - pPage = psLinuxMemArea->uData.sPageList.pvPageList[ui32PageNumOffset + ui32PageNum]; + pPage = psLinuxMemArea->uData.sPageList.ppsPageList[ui32PageNumOffset + ui32PageNum]; return page_to_pfn(pPage) << PAGE_SHIFT; } @@ -2768,7 +2769,7 @@ static unsigned long IONAreaToPhys(LinuxMemArea *psLinuxMemArea, return CpuPAddr.uiAddr; } -#endif +#endif static IMG_VOID *FindMMapBaseVAddr(struct list_head *psMMapOffsetStructList, @@ -2777,7 +2778,7 @@ IMG_VOID *FindMMapBaseVAddr(struct list_head *psMMapOffsetStructList, PKV_OFFSET_STRUCT psOffsetStruct; IMG_VOID *pvMinVAddr; - + list_for_each_entry(psOffsetStruct, psMMapOffsetStructList, sAreaItem) { if(OSGetCurrentProcessIDKM() != psOffsetStruct->ui32PID) @@ -2785,7 +2786,7 @@ IMG_VOID *FindMMapBaseVAddr(struct list_head *psMMapOffsetStructList, pvMinVAddr = (IMG_VOID *)psOffsetStruct->ui32UserVAddr; - + if(pvRangeAddrStart >= pvMinVAddr && ui32Length <= psOffsetStruct->ui32RealByteSize) return pvMinVAddr; @@ -2828,7 +2829,7 @@ IMG_BOOL CheckExecuteCacheOp(IMG_HANDLE hOSMemHandle, psLinuxMemArea = psLinuxMemArea->uData.sSubAlloc.psParentLinuxMemArea; } - + PVR_ASSERT(psLinuxMemArea->eAreaType != LINUX_MEM_AREA_SUB_ALLOC); switch(psLinuxMemArea->eAreaType) @@ -2839,7 +2840,7 @@ IMG_BOOL CheckExecuteCacheOp(IMG_HANDLE hOSMemHandle, { pvMinVAddr = psLinuxMemArea->uData.sVmalloc.pvVmallocAddress + ui32AreaOffset; - + if(pvRangeAddrStart < pvMinVAddr) goto err_blocked; @@ -2847,7 +2848,7 @@ IMG_BOOL CheckExecuteCacheOp(IMG_HANDLE hOSMemHandle, } else { - + pvMinVAddr = FindMMapBaseVAddr(psMMapOffsetStructList, pvRangeAddrStart, ui32Length); if(!pvMinVAddr) @@ -2856,28 +2857,28 @@ IMG_BOOL CheckExecuteCacheOp(IMG_HANDLE hOSMemHandle, pfnInnerCacheOp(pvRangeAddrStart, pvRangeAddrStart + ui32Length); #if defined(CONFIG_OUTER_CACHE) - + pvRangeAddrStart = psLinuxMemArea->uData.sVmalloc.pvVmallocAddress + (ui32AreaOffset & PAGE_MASK) + (pvRangeAddrStart - pvMinVAddr); } pfnMemAreaToPhys = VMallocAreaToPhys; -#else +#else } -#endif +#endif break; } case LINUX_MEM_AREA_EXTERNAL_KV: { - + if (psLinuxMemArea->uData.sExternalKV.bPhysContig == IMG_TRUE) { PVR_DPF((PVR_DBG_WARNING, "%s: Attempt to flush contiguous external memory", __func__)); goto err_blocked; } - + if (psLinuxMemArea->uData.sExternalKV.pvExternalKV != IMG_NULL) { PVR_DPF((PVR_DBG_WARNING, "%s: Attempt to flush external memory with a kernel virtual address", __func__)); @@ -2939,17 +2940,17 @@ IMG_BOOL CheckExecuteCacheOp(IMG_HANDLE hOSMemHandle, #if defined(CONFIG_OUTER_CACHE) PVR_ASSERT(pfnMemAreaToPhys != IMG_NULL); - + { unsigned long ulStart, ulEnd, ulLength, ulStartOffset, ulEndOffset; IMG_UINT32 i, ui32NumPages; - + ulLength = (unsigned long)ui32Length; ulStartOffset = ((unsigned long)pvRangeAddrStart) & (PAGE_SIZE - 1); ulEndOffset = ((unsigned long)pvRangeAddrStart + ulLength) & (PAGE_SIZE - 1); - + ui32NumPages = (ulStartOffset + ulLength + PAGE_SIZE - 1) >> PAGE_SHIFT; for(i = 0; i < ui32NumPages; i++) @@ -3007,7 +3008,7 @@ static void x86_flush_cache_range(const void *pvStart, const void *pvEnd) IMG_VOID OSCleanCPUCacheKM(IMG_VOID) { - + ON_EACH_CPU(per_cpu_cache_flush, NULL, 1); } @@ -3020,7 +3021,7 @@ IMG_BOOL OSFlushCPUCacheRangeKM(IMG_HANDLE hOSMemHandle, IMG_VOID *pvRangeAddrStart, IMG_UINT32 ui32Length) { - + return CheckExecuteCacheOp(hOSMemHandle, pvRangeAddrStart, ui32Length, x86_flush_cache_range, IMG_NULL); } @@ -3029,7 +3030,7 @@ IMG_BOOL OSCleanCPUCacheRangeKM(IMG_HANDLE hOSMemHandle, IMG_VOID *pvRangeAddrStart, IMG_UINT32 ui32Length) { - + return CheckExecuteCacheOp(hOSMemHandle, pvRangeAddrStart, ui32Length, x86_flush_cache_range, IMG_NULL); } @@ -3038,12 +3039,12 @@ IMG_BOOL OSInvalidateCPUCacheRangeKM(IMG_HANDLE hOSMemHandle, IMG_VOID *pvRangeAddrStart, IMG_UINT32 ui32Length) { - + return CheckExecuteCacheOp(hOSMemHandle, pvRangeAddrStart, ui32Length, x86_flush_cache_range, IMG_NULL); } -#else +#else #if defined(__arm__) @@ -3055,7 +3056,7 @@ static void per_cpu_cache_flush(void *arg) IMG_VOID OSCleanCPUCacheKM(IMG_VOID) { - + ON_EACH_CPU(per_cpu_cache_flush, NULL, 1); #if defined(CONFIG_OUTER_CACHE) && !defined(PVR_NO_FULL_CACHE_OPS) outer_clean_range(0, ULONG_MAX); @@ -3119,18 +3120,18 @@ IMG_BOOL OSInvalidateCPUCacheRangeKM(IMG_HANDLE hOSMemHandle, pvr_dmac_inv_range, outer_inv_range); } -#else +#else #if defined(__mips__) IMG_VOID OSCleanCPUCacheKM(IMG_VOID) { - + dma_cache_wback(0, 0x100000); } IMG_VOID OSFlushCPUCacheKM(IMG_VOID) { - + dma_cache_wback_inv(0, 0x100000); } @@ -3139,7 +3140,7 @@ IMG_BOOL OSFlushCPUCacheRangeKM(IMG_HANDLE hOSMemHandle, IMG_UINT32 ui32Length) { if (ui32Length) - dma_cache_wback_inv((IMG_UINTPTR_T)pvRangeAddrStart, ui32Length); + dma_cache_wback_inv((IMG_UINTPTR_T)pvRangeAddrStart, ui32Length); return IMG_TRUE; } @@ -3161,15 +3162,111 @@ IMG_BOOL OSInvalidateCPUCacheRangeKM(IMG_HANDLE hOSMemHandle, return IMG_TRUE; } -#else +#else #error "Implement CPU cache flush/clean/invalidate primitives for this CPU!" -#endif +#endif -#endif +#endif -#endif +#endif + +typedef struct _AtomicStruct +{ + atomic_t RefCount; +} AtomicStruct; + +PVRSRV_ERROR OSAtomicAlloc(IMG_PVOID *ppvRefCount) +{ + AtomicStruct *psRefCount; + + psRefCount = kmalloc(sizeof(AtomicStruct), GFP_KERNEL); + if (psRefCount == NULL) + { + return PVRSRV_ERROR_OUT_OF_MEMORY; + } + atomic_set(&psRefCount->RefCount, 0); + + *ppvRefCount = psRefCount; + return PVRSRV_OK; +} + +IMG_VOID OSAtomicFree(IMG_PVOID pvRefCount) +{ + AtomicStruct *psRefCount = pvRefCount; + + PVR_ASSERT(atomic_read(&psRefCount->RefCount) == 0); + kfree(psRefCount); +} + +IMG_VOID OSAtomicInc(IMG_PVOID pvRefCount) +{ + AtomicStruct *psRefCount = pvRefCount; + + atomic_inc(&psRefCount->RefCount); +} + +IMG_BOOL OSAtomicDecAndTest(IMG_PVOID pvRefCount) +{ + AtomicStruct *psRefCount = pvRefCount; + + return atomic_dec_and_test(&psRefCount->RefCount) ? IMG_TRUE:IMG_FALSE; +} + +IMG_UINT32 OSAtomicRead(IMG_PVOID pvRefCount) +{ + AtomicStruct *psRefCount = pvRefCount; + + return (IMG_UINT32) atomic_read(&psRefCount->RefCount); +} + +IMG_VOID OSReleaseBridgeLock(IMG_VOID) +{ + LinuxUnLockMutex(&gPVRSRVLock); +} + +IMG_VOID OSReacquireBridgeLock(IMG_VOID) +{ + LinuxLockMutex(&gPVRSRVLock); +} + +typedef struct _OSTime +{ + unsigned long ulTime; +} OSTime; + +PVRSRV_ERROR OSTimeCreateWithUSOffset(IMG_PVOID *pvRet, IMG_UINT32 ui32USOffset) +{ + OSTime *psOSTime; + + psOSTime = kmalloc(sizeof(OSTime), GFP_KERNEL); + if (psOSTime == IMG_NULL) + { + return PVRSRV_ERROR_OUT_OF_MEMORY; + } + + psOSTime->ulTime = usecs_to_jiffies(jiffies_to_usecs(jiffies) + ui32USOffset); + *pvRet = psOSTime; + return PVRSRV_OK; +} + + +IMG_BOOL OSTimeHasTimePassed(IMG_PVOID pvData) +{ + OSTime *psOSTime = pvData; + + if (time_is_before_jiffies(psOSTime->ulTime)) + { + return IMG_TRUE; + } + return IMG_FALSE; +} + +IMG_VOID OSTimeDestroy(IMG_PVOID pvData) +{ + kfree(pvData); +} PVRSRV_ERROR PVROSFuncInit(IMG_VOID) { @@ -3178,7 +3275,7 @@ PVRSRV_ERROR PVROSFuncInit(IMG_VOID) psTimerWorkQueue = create_workqueue("pvr_timer"); if (psTimerWorkQueue == NULL) { - PVR_DPF((PVR_DBG_ERROR, "%s: couldn't create timer workqueue", __FUNCTION__)); + PVR_DPF((PVR_DBG_ERROR, "%s: couldn't create timer workqueue", __FUNCTION__)); return PVRSRV_ERROR_UNABLE_TO_CREATE_THREAD; } diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/osperproc.c b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/osperproc.c index 0e3cc0e..6b57dfc 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/osperproc.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/osperproc.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -57,11 +57,11 @@ PVRSRV_ERROR OSPerProcessPrivateDataInit(IMG_HANDLE *phOsPrivateData) psEnvPerProc->hBlockAlloc = hBlockAlloc; - + LinuxMMapPerProcessConnect(psEnvPerProc); #if defined(SUPPORT_DRI_DRM) && defined(PVR_SECURE_DRM_AUTH_EXPORT) - + INIT_LIST_HEAD(&psEnvPerProc->sDRMAuthListHead); #endif @@ -80,17 +80,17 @@ PVRSRV_ERROR OSPerProcessPrivateDataDeInit(IMG_HANDLE hOsPrivateData) psEnvPerProc = (PVRSRV_ENV_PER_PROCESS_DATA *)hOsPrivateData; - + LinuxMMapPerProcessDisconnect(psEnvPerProc); - + RemovePerProcessProcDir(psEnvPerProc); eError = OSFreeMem(PVRSRV_OS_NON_PAGEABLE_HEAP, sizeof(PVRSRV_ENV_PER_PROCESS_DATA), hOsPrivateData, psEnvPerProc->hBlockAlloc); - + if (eError != PVRSRV_OK) { diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/pdump.c b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/pdump.c index 66433d5..13d9b0d 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/pdump.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/pdump.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -30,7 +30,7 @@ #include #include #if defined (SUPPORT_SGX) -#include "sgxdefs.h" +#include "sgxdefs.h" #endif #include "services_headers.h" @@ -45,8 +45,8 @@ #include "pdump_km.h" #include "pdump_int.h" -#include -#include +#include +#include static IMG_BOOL PDumpWriteString2 (IMG_CHAR * pszString, IMG_UINT32 ui32Flags); static IMG_BOOL PDumpWriteILock (PDBG_STREAM psStream, IMG_UINT8 *pui8Data, IMG_UINT32 ui32Count, IMG_UINT32 ui32Flags); @@ -147,7 +147,7 @@ PVRSRV_ERROR PDumpOSBufprintf(IMG_HANDLE hBuf, IMG_UINT32 ui32ScriptSizeMax, IMG va_end(vaArgs); - if (n>=(IMG_INT32)ui32ScriptSizeMax || n==-1) + if (n>=(IMG_INT32)ui32ScriptSizeMax || n==-1) { PVR_DPF((PVR_DBG_ERROR, "Buffer overflow detected, pdump output may be incomplete.")); @@ -166,7 +166,7 @@ PVRSRV_ERROR PDumpOSVSprintf(IMG_CHAR *pszComment, IMG_UINT32 ui32ScriptSizeMax, n = vsnprintf(pszComment, ui32ScriptSizeMax, pszFormat, vaArgs); - if (n>=(IMG_INT32)ui32ScriptSizeMax || n==-1) + if (n>=(IMG_INT32)ui32ScriptSizeMax || n==-1) { PVR_DPF((PVR_DBG_ERROR, "Buffer overflow detected, pdump output may be incomplete.")); @@ -180,7 +180,7 @@ IMG_VOID PDumpOSDebugPrintf(IMG_CHAR* pszFormat, ...) { PVR_UNREFERENCED_PARAMETER(pszFormat); - + } PVRSRV_ERROR PDumpOSSprintf(IMG_CHAR *pszComment, IMG_UINT32 ui32ScriptSizeMax, IMG_CHAR *pszFormat, ...) @@ -194,7 +194,7 @@ PVRSRV_ERROR PDumpOSSprintf(IMG_CHAR *pszComment, IMG_UINT32 ui32ScriptSizeMax, va_end(vaArgs); - if (n>=(IMG_INT32)ui32ScriptSizeMax || n==-1) + if (n>=(IMG_INT32)ui32ScriptSizeMax || n==-1) { PVR_DPF((PVR_DBG_ERROR, "Buffer overflow detected, pdump output may be incomplete.")); @@ -221,10 +221,10 @@ IMG_VOID PDumpOSVerifyLineEnding(IMG_HANDLE hBuffer, IMG_UINT32 ui32BufferSizeMa IMG_UINT32 ui32Count; IMG_CHAR* pszBuf = hBuffer; - + ui32Count = PDumpOSBuflen(hBuffer, ui32BufferSizeMax); - + if ((ui32Count >= 1) && (pszBuf[ui32Count-1] != '\n') && (ui32CountpfnSetConnectNotifier(sConnectNotifier); @@ -457,7 +457,7 @@ init_failed: gsDBGPdumpState.pszMsg = IMG_NULL; } - + sConnectNotifier.pfnConnectNotifier = 0; gpfnDbgDrv->pfnSetConnectNotifier(sConnectNotifier); @@ -493,7 +493,7 @@ IMG_VOID PDumpDeInit(IMG_VOID) gsDBGPdumpState.pszMsg = IMG_NULL; } - + sConnectNotifier.pfnConnectNotifier = 0; gpfnDbgDrv->pfnSetConnectNotifier(sConnectNotifier); @@ -578,7 +578,7 @@ static IMG_BOOL PDumpWriteILock(PDBG_STREAM psStream, IMG_UINT8 *pui8Data, IMG_U } - + if (psStream == gsDBGPdumpState.psStream[PDUMP_STREAM_PARAM2]) { @@ -624,5 +624,5 @@ IMG_VOID PDumpResumeKM(IMG_VOID) atomic_dec(&gsPDumpSuspended); } -#endif -#endif +#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/private_data.h b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/private_data.h index 54a709f..b8751d3 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/private_data.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/private_data.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -34,10 +34,10 @@ typedef struct { - + IMG_UINT32 ui32OpenPID; - + #if defined (SUPPORT_SID_INTERFACE) IMG_SID hKernelMemInfo; #else @@ -45,25 +45,25 @@ typedef struct #endif #if defined(SUPPORT_DRI_DRM) && defined(PVR_SECURE_DRM_AUTH_EXPORT) - + struct list_head sDRMAuthListItem; struct drm_file *psDRMFile; #endif #if defined(SUPPORT_MEMINFO_IDS) - + IMG_UINT64 ui64Stamp; -#endif - +#endif + IMG_HANDLE hBlockAlloc; #if defined(SUPPORT_DRI_DRM_EXT) - IMG_PVOID pPriv; + IMG_PVOID pPriv; #endif } PVRSRV_FILE_PRIVATE_DATA; -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/proc.c b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/proc.c index aaad188..1df8aff 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/proc.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/proc.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -109,10 +109,10 @@ off_t printAppend(IMG_CHAR * buffer, size_t size, off_t off, const IMG_CHAR * fo n = vsnprintf (buffer+off, space, format, ap); va_end (ap); - + if (n >= (IMG_INT)space || n < 0) { - + buffer[size - 1] = 0; return (off_t)(size - 1); } @@ -126,7 +126,7 @@ off_t printAppend(IMG_CHAR * buffer, size_t size, off_t off, const IMG_CHAR * fo void* ProcSeq1ElementOff2Element(struct seq_file *sfile, loff_t off) { PVR_UNREFERENCED_PARAMETER(sfile); - + if(!off) return (void*)2; return NULL; @@ -142,7 +142,7 @@ void* ProcSeq1ElementHeaderOff2Element(struct seq_file *sfile, loff_t off) return PVR_PROC_SEQ_START_TOKEN; } - + if(off == 1) return (void*)2; @@ -157,7 +157,7 @@ static IMG_INT pvr_proc_open(struct inode *inode,struct file *file) struct seq_file *seq = (struct seq_file*)file->private_data; struct proc_dir_entry* pvr_proc_entry = PDE(inode); - + seq->private = pvr_proc_entry->data; return ret; } @@ -259,7 +259,7 @@ static struct proc_dir_entry* CreateProcEntryInDirSeq( file->proc_fops = &pvr_proc_operations; file->write_proc = whandler; - + file->data = kmalloc(sizeof(PVR_PROC_SEQ_HANDLERS), GFP_KERNEL); if(file->data) { @@ -423,7 +423,7 @@ IMG_VOID RemovePerProcessProcEntrySeq(struct proc_dir_entry* proc_entry) static IMG_INT pvr_read_proc(IMG_CHAR *page, IMG_CHAR **start, off_t off, IMG_INT count, IMG_INT *eof, IMG_VOID *data) { - + pvr_read_proc_t *pprn = (pvr_read_proc_t *)data; off_t len = pprn (page, (size_t)count, off); @@ -433,9 +433,9 @@ static IMG_INT pvr_read_proc(IMG_CHAR *page, IMG_CHAR **start, off_t off, len = 0; *eof = 1; } - else if (!len) + else if (!len) { - *start = (IMG_CHAR *) 0; + *start = (IMG_CHAR *) 0; } else { @@ -560,7 +560,7 @@ IMG_INT CreateProcReadEntry(const IMG_CHAR * name, pvr_read_proc_t handler) return -ENOMEM; } - + file = create_proc_read_entry (name, S_IFREG | S_IRUGO, dir, pvr_read_proc, (IMG_VOID *)handler); if (file) @@ -686,7 +686,7 @@ IMG_VOID RemoveProcEntries(IMG_VOID) RemoveProcEntrySeq( g_pProcDebugLevel ); #ifdef PVR_MANUAL_POWER_CONTROL RemoveProcEntrySeq( g_pProcPowerLevel ); -#endif +#endif #endif RemoveProcEntrySeq(g_pProcQueue); @@ -811,9 +811,9 @@ static void* ProcSeqOff2ElementSysNodes(struct seq_file * sfile, loff_t off) { SYS_DATA *psSysData; PVRSRV_DEVICE_NODE*psDevNode = IMG_NULL; - + PVR_UNREFERENCED_PARAMETER(sfile); - + if(!off) { return PVR_PROC_SEQ_START_TOKEN; @@ -822,14 +822,14 @@ static void* ProcSeqOff2ElementSysNodes(struct seq_file * sfile, loff_t off) psSysData = SysAcquireDataNoCheck(); if (psSysData != IMG_NULL) { - + psDevNode = (PVRSRV_DEVICE_NODE*) List_PVRSRV_DEVICE_NODE_Any_va(psSysData->psDeviceNodeList, DecOffPsDev_AnyVaCb, &off); } - + return (void*)psDevNode; } diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/proc.h b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/proc.h index fa98ec5..2066d71 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/proc.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/proc.h @@ -1,35 +1,35 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ #ifndef __SERVICES_PROC_H__ #define __SERVICES_PROC_H__ -#include -#include -#include +#include +#include +#include #define END_OF_FILE (off_t) -1 @@ -43,8 +43,8 @@ typedef void (pvr_show_proc_seq_t)(struct seq_file *,void*); typedef void (pvr_startstop_proc_seq_t)(struct seq_file *, IMG_BOOL start); typedef struct _PVR_PROC_SEQ_HANDLERS_ { - pvr_next_proc_seq_t *next; - pvr_show_proc_seq_t *show; + pvr_next_proc_seq_t *next; + pvr_show_proc_seq_t *show; pvr_off2element_proc_seq_t *off2element; pvr_startstop_proc_seq_t *startstop; IMG_VOID *data; @@ -73,18 +73,18 @@ IMG_VOID RemovePerProcessProcEntry(const IMG_CHAR * name); IMG_VOID RemoveProcEntries(IMG_VOID); struct proc_dir_entry* CreateProcReadEntrySeq ( - const IMG_CHAR* name, + const IMG_CHAR* name, IMG_VOID* data, - pvr_next_proc_seq_t next_handler, + pvr_next_proc_seq_t next_handler, pvr_show_proc_seq_t show_handler, pvr_off2element_proc_seq_t off2element_handler, pvr_startstop_proc_seq_t startstop_handler ); struct proc_dir_entry* CreateProcEntrySeq ( - const IMG_CHAR* name, + const IMG_CHAR* name, IMG_VOID* data, - pvr_next_proc_seq_t next_handler, + pvr_next_proc_seq_t next_handler, pvr_show_proc_seq_t show_handler, pvr_off2element_proc_seq_t off2element_handler, pvr_startstop_proc_seq_t startstop_handler, @@ -92,9 +92,9 @@ struct proc_dir_entry* CreateProcEntrySeq ( ); struct proc_dir_entry* CreatePerProcessProcEntrySeq ( - const IMG_CHAR* name, + const IMG_CHAR* name, IMG_VOID* data, - pvr_next_proc_seq_t next_handler, + pvr_next_proc_seq_t next_handler, pvr_show_proc_seq_t show_handler, pvr_off2element_proc_seq_t off2element_handler, pvr_startstop_proc_seq_t startstop_handler, diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/pvr_bridge_k.c b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/pvr_bridge_k.c index 4732e3b..1643118 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/pvr_bridge_k.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/pvr_bridge_k.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -36,6 +36,7 @@ #include "linkage.h" #include "pvr_bridge_km.h" #include "refcount.h" +#include "buffer_manager.h" #if defined(SUPPORT_DRI_DRM) #include @@ -75,7 +76,7 @@ extern PVRSRV_LINUX_MUTEX gPVRSRVLock; #if defined(SUPPORT_MEMINFO_IDS) static IMG_UINT64 ui64Stamp; -#endif +#endif PVRSRV_ERROR LinuxBridgeInit(IMG_VOID) @@ -83,7 +84,7 @@ LinuxBridgeInit(IMG_VOID) #if defined(DEBUG_BRIDGE_KM) { g_ProcBridgeStats = CreateProcReadEntrySeq( - "bridge_stats", + "bridge_stats", NULL, ProcSeqNextBridgeStats, ProcSeqShowBridgeStats, @@ -109,9 +110,9 @@ LinuxBridgeDeInit(IMG_VOID) #if defined(DEBUG_BRIDGE_KM) -static void ProcSeqStartstopBridgeStats(struct seq_file *sfile,IMG_BOOL start) +static void ProcSeqStartstopBridgeStats(struct seq_file *sfile,IMG_BOOL start) { - if(start) + if(start) { LinuxLockMutex(&gPVRSRVLock); } @@ -124,7 +125,7 @@ static void ProcSeqStartstopBridgeStats(struct seq_file *sfile,IMG_BOOL start) static void* ProcSeqOff2ElementBridgeStats(struct seq_file *sfile, loff_t off) { - if(!off) + if(!off) { return PVR_PROC_SEQ_START_TOKEN; } @@ -148,7 +149,7 @@ static void ProcSeqShowBridgeStats(struct seq_file *sfile,void* el) { PVRSRV_BRIDGE_DISPATCH_TABLE_ENTRY *psEntry = ( PVRSRV_BRIDGE_DISPATCH_TABLE_ENTRY*)el; - if(el == PVR_PROC_SEQ_START_TOKEN) + if(el == PVR_PROC_SEQ_START_TOKEN) { seq_printf(sfile, "Total ioctl call count = %u\n" @@ -178,7 +179,7 @@ static void ProcSeqShowBridgeStats(struct seq_file *sfile,void* el) psEntry->ui32CopyToUserTotalBytes); } -#endif +#endif #if defined(SUPPORT_DRI_DRM) @@ -216,8 +217,8 @@ PVRSRV_BridgeDispatchKM(struct file *pFile, unsigned int unref__ ioctlCmd, unsig goto unlock_and_return; } - - + + if(OSCopyFromUser(IMG_NULL, psBridgePackageKM, psBridgePackageUM, @@ -229,7 +230,7 @@ PVRSRV_BridgeDispatchKM(struct file *pFile, unsigned int unref__ ioctlCmd, unsig #endif cmd = psBridgePackageKM->ui32BridgeID; - + if(cmd != PVRSRV_BRIDGE_CONNECT_SERVICES) { PVRSRV_ERROR eError; @@ -255,7 +256,7 @@ PVRSRV_BridgeDispatchKM(struct file *pFile, unsigned int unref__ ioctlCmd, unsig } else { - + psPerProc = PVRSRVPerProcessData(ui32PID); if(psPerProc == IMG_NULL) { @@ -334,7 +335,7 @@ PVRSRV_BridgeDispatchKM(struct file *pFile, unsigned int unref__ ioctlCmd, unsig break; } - + psEnvPerProc = (PVRSRV_ENV_PER_PROCESS_DATA *)PVRSRVProcessPrivateData(psPerProc); if (psEnvPerProc == IMG_NULL) { @@ -368,7 +369,7 @@ PVRSRV_BridgeDispatchKM(struct file *pFile, unsigned int unref__ ioctlCmd, unsig default: break; } -#endif +#endif err = BridgedDispatchKM(psPerProc, psBridgePackageKM); if(err != PVRSRV_OK) @@ -390,7 +391,7 @@ PVRSRV_BridgeDispatchKM(struct file *pFile, unsigned int unref__ ioctlCmd, unsig goto unlock_and_return; } - + if(PVRSRVLookupHandle(KERNEL_HANDLE_BASE, (IMG_PVOID *)&psKernelMemInfo, hMemInfo, @@ -401,9 +402,15 @@ PVRSRV_BridgeDispatchKM(struct file *pFile, unsigned int unref__ ioctlCmd, unsig goto unlock_and_return; } - + PVRSRVKernelMemInfoIncRef(psKernelMemInfo); + + if (psKernelMemInfo->sShareMemWorkaround.bInUse) + { + BM_XProcIndexAcquire(psKernelMemInfo->sShareMemWorkaround.ui32ShareIndex); + } + psPrivateData->hKernelMemInfo = hMemInfo; #if defined(SUPPORT_MEMINFO_IDS) psPrivateData->ui64Stamp = ++ui64Stamp; @@ -444,7 +451,7 @@ PVRSRV_BridgeDispatchKM(struct file *pFile, unsigned int unref__ ioctlCmd, unsig } break; } -#endif +#endif default: break; diff --git a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/pvr_debug.c b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/pvr_debug.c index 03c3ba0..3a280fc 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/env/linux/pvr_debug.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/env/linux/pvr_debug.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include "img_types.h" #include "servicesext.h" @@ -68,7 +68,7 @@ static IMG_BOOL BAppend(IMG_CHAR *pszBuf, IMG_UINT32 ui32BufSiz, IMG_UINT32 gPVRDebugLevel = (DBGPRIV_FATAL | DBGPRIV_ERROR | DBGPRIV_WARNING); -#endif +#endif #define PVR_MAX_MSG_LEN PVR_MAX_DEBUG_MESSAGE_LEN @@ -83,14 +83,14 @@ static PVRSRV_LINUX_MUTEX gsDebugMutexNonIRQ; #endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) - + static spinlock_t gsDebugLockIRQ = __SPIN_LOCK_UNLOCKED(); #else static DEFINE_SPINLOCK(gsDebugLockIRQ); #endif #if !defined(PVR_DEBUG_ALWAYS_USE_SPINLOCK) -#if !defined (USE_SPIN_LOCK) +#if !defined (USE_SPIN_LOCK) #define USE_SPIN_LOCK (in_interrupt() || !preemptible()) #endif #endif @@ -158,7 +158,7 @@ static IMG_BOOL VBAppend(IMG_CHAR *pszBuf, IMG_UINT32 ui32BufSiz, const IMG_CHAR i32Len = vsnprintf(&pszBuf[ui32Used], ui32Space, pszFormat, VArgs); pszBuf[ui32BufSiz - 1] = 0; - + return (i32Len < 0 || i32Len >= (IMG_INT32)ui32Space) ? IMG_TRUE : IMG_FALSE; } @@ -206,7 +206,7 @@ IMG_VOID PVRSRVDebugAssertFail(const IMG_CHAR* pszFile, IMG_UINT32 uLine) BUG(); } -#endif +#endif #if defined(PVRSRV_NEED_PVR_TRACE) @@ -239,7 +239,7 @@ IMG_VOID PVRSRVTrace(const IMG_CHAR* pszFormat, ...) va_end(VArgs); } -#endif +#endif #if defined(PVRSRV_NEED_PVR_DPF) @@ -285,7 +285,7 @@ IMG_VOID PVRSRVDebugPrintf ( GetBufferLock(&ulLockFlags); - + if (bTrace == IMG_FALSE) { switch(ui32DebugLevel) @@ -333,21 +333,21 @@ IMG_VOID PVRSRVDebugPrintf ( } else { - + if (bTrace == IMG_FALSE) { #ifdef DEBUG_LOG_PATH_TRUNCATE - + static IMG_CHAR szFileNameRewrite[PVR_MAX_FILEPATH_LEN]; IMG_CHAR* pszTruncIter; IMG_CHAR* pszTruncBackInter; - + if (strlen(pszFullFileName) > strlen(DEBUG_LOG_PATH_TRUNCATE)+1) pszFileName = pszFullFileName + strlen(DEBUG_LOG_PATH_TRUNCATE)+1; - + strncpy(szFileNameRewrite, pszFileName,PVR_MAX_FILEPATH_LEN); if(strlen(szFileNameRewrite) == PVR_MAX_FILEPATH_LEN-1) { @@ -359,7 +359,7 @@ IMG_VOID PVRSRVDebugPrintf ( while(*pszTruncIter++ != 0) { IMG_CHAR* pszNextStartPoint; - + if( !( ( *pszTruncIter == '/' && (pszTruncIter-4 >= szFileNameRewrite) ) && ( *(pszTruncIter-1) == '.') && @@ -367,7 +367,7 @@ IMG_VOID PVRSRVDebugPrintf ( ( *(pszTruncIter-3) == '/') ) ) continue; - + pszTruncBackInter = pszTruncIter - 3; while(*(--pszTruncBackInter) != '/') { @@ -375,19 +375,19 @@ IMG_VOID PVRSRVDebugPrintf ( } pszNextStartPoint = pszTruncBackInter; - + while(*pszTruncIter != 0) { *pszTruncBackInter++ = *pszTruncIter++; } *pszTruncBackInter = 0; - + pszTruncIter = pszNextStartPoint; } pszFileName = szFileNameRewrite; - + if(*pszFileName == '/') pszFileName++; #endif @@ -398,7 +398,7 @@ IMG_VOID PVRSRVDebugPrintf ( { pszFileName = pszLeafName; } -#endif +#endif if (BAppend(pszBuf, ui32BufSiz, " [%u, %s]", ui32Line, pszFileName)) { @@ -421,7 +421,7 @@ IMG_VOID PVRSRVDebugPrintf ( } } -#endif +#endif #if defined(DEBUG) @@ -450,4 +450,4 @@ void ProcSeqShowDebugLevel(struct seq_file *sfile,void* el) seq_printf(sfile, "%u\n", gPVRDebugLevel); } -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/ocpdefs.h b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/ocpdefs.h index 9122bf8..3bbab7b 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/ocpdefs.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/ocpdefs.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -267,5 +267,5 @@ #define EUR_CR_OCP_DEBUG_STATUS_CMD_DEBUG_STATE_SIGNED 0 -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx530defs.h b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx530defs.h index 6becfbc..810cb81 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx530defs.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx530defs.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -484,5 +484,5 @@ #define EUR_CR_MNE_CR_EVENT_CLEAR_INVAL_SHIFT 0 #define EUR_CR_MNE_CR_CTRL_INVAL 0x0D20 -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx540defs.h b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx540defs.h index f971d30..c09aa26 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx540defs.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx540defs.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -543,5 +543,5 @@ #define EUR_CR_USE_CODE_BASE_SIZE_UINT32 16 #define EUR_CR_USE_CODE_BASE_NUM_ENTRIES 16 -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx543_v1.164defs.h b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx543_v1.164defs.h index 646e415..23bd4d4 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx543_v1.164defs.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx543_v1.164defs.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -1280,5 +1280,5 @@ #define EUR_CR_USE_CODE_BASE_SIZE_UINT32 16 #define EUR_CR_USE_CODE_BASE_NUM_ENTRIES 16 -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx544defs.h b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx544defs.h index 88dc2bd..c18b8ad 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx544defs.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx544defs.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -1363,5 +1363,5 @@ #define EUR_CR_USE_CODE_BASE_SIZE_UINT32 16 #define EUR_CR_USE_CODE_BASE_NUM_ENTRIES 16 -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx545defs.h b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx545defs.h index 17968f2..4dc7f3c 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx545defs.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgx545defs.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -1176,5 +1176,5 @@ #define EUR_CR_USE_CODE_BASE_SIZE_UINT32 16 #define EUR_CR_USE_CODE_BASE_NUM_ENTRIES 16 -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxdefs.h b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxdefs.h index 4bd2916..b3a2583 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxdefs.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxdefs.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -79,12 +79,12 @@ #include "sgxmpplusdefs.h" #else #include "sgxmpdefs.h" -#endif -#else +#endif +#else #if defined(SGX_FEATURE_SYSTEM_CACHE) #include "mnemedefs.h" #endif -#endif +#endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxerrata.h b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxerrata.h index 1e23aad..05fd45f 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxerrata.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxerrata.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -28,10 +28,10 @@ #define _SGXERRATA_KM_H_ #if defined(SGX520) && !defined(SGX_CORE_DEFINED) - + #define SGX_CORE_REV_HEAD 0 #if defined(USE_SGX_CORE_REV_HEAD) - + #define SGX_CORE_REV SGX_CORE_REV_HEAD #endif @@ -39,24 +39,23 @@ #define FIX_HW_BRN_28889 #else #if SGX_CORE_REV == 111 - #define FIX_HW_BRN_28889 #else #if SGX_CORE_REV == SGX_CORE_REV_HEAD - + #else #error "sgxerrata.h: SGX520 Core Revision unspecified" #endif #endif #endif - + #define SGX_CORE_DEFINED #endif #if defined(SGX530) && !defined(SGX_CORE_DEFINED) - + #define SGX_CORE_REV_HEAD 0 #if defined(USE_SGX_CORE_REV_HEAD) - + #define SGX_CORE_REV SGX_CORE_REV_HEAD #endif @@ -65,31 +64,31 @@ #define FIX_HW_BRN_28889 #else #if SGX_CORE_REV == 111 - #define FIX_HW_BRN_22934 + #define FIX_HW_BRN_22934 #define FIX_HW_BRN_28889 #else #if SGX_CORE_REV == 1111 - #define FIX_HW_BRN_22934 + #define FIX_HW_BRN_22934 #define FIX_HW_BRN_28889 #else #if SGX_CORE_REV == 120 - #define FIX_HW_BRN_22934 + #define FIX_HW_BRN_22934 #define FIX_HW_BRN_28889 #else #if SGX_CORE_REV == 121 - #define FIX_HW_BRN_22934 + #define FIX_HW_BRN_22934 #define FIX_HW_BRN_28889 #else #if SGX_CORE_REV == 125 - #define FIX_HW_BRN_22934 + #define FIX_HW_BRN_22934 #define FIX_HW_BRN_28889 #else #if SGX_CORE_REV == 130 - #define FIX_HW_BRN_22934 + #define FIX_HW_BRN_22934 #define FIX_HW_BRN_28889 #else #if SGX_CORE_REV == SGX_CORE_REV_HEAD - + #else #error "sgxerrata.h: SGX530 Core Revision unspecified" #endif @@ -100,15 +99,15 @@ #endif #endif #endif - + #define SGX_CORE_DEFINED #endif #if defined(SGX531) && !defined(SGX_CORE_DEFINED) - + #define SGX_CORE_REV_HEAD 0 #if defined(USE_SGX_CORE_REV_HEAD) - + #define SGX_CORE_REV SGX_CORE_REV_HEAD #endif @@ -121,48 +120,48 @@ #define FIX_HW_BRN_34028 #else #if SGX_CORE_REV == SGX_CORE_REV_HEAD - + #else #error "sgxerrata.h: SGX531 Core Revision unspecified" #endif #endif #endif - + #define SGX_CORE_DEFINED #endif #if (defined(SGX535) || defined(SGX535_V1_1)) && !defined(SGX_CORE_DEFINED) - + #define SGX_CORE_REV_HEAD 0 #if defined(USE_SGX_CORE_REV_HEAD) - + #define SGX_CORE_REV SGX_CORE_REV_HEAD #endif #if SGX_CORE_REV == 112 #define FIX_HW_BRN_23281 - #define FIX_HW_BRN_23410 + #define FIX_HW_BRN_23410 #define FIX_HW_BRN_22693 - #define FIX_HW_BRN_22934 + #define FIX_HW_BRN_22934 #define FIX_HW_BRN_22997 #define FIX_HW_BRN_23030 #else #if SGX_CORE_REV == 113 - #define FIX_HW_BRN_22934 + #define FIX_HW_BRN_22934 #define FIX_HW_BRN_23281 #define FIX_HW_BRN_23944 #define FIX_HW_BRN_23410 #else #if SGX_CORE_REV == 121 - #define FIX_HW_BRN_22934 + #define FIX_HW_BRN_22934 #define FIX_HW_BRN_23944 #define FIX_HW_BRN_23410 #else #if SGX_CORE_REV == 126 - #define FIX_HW_BRN_22934 - #else + #define FIX_HW_BRN_22934 + #else #if SGX_CORE_REV == SGX_CORE_REV_HEAD - + #else #error "sgxerrata.h: SGX535 Core Revision unspecified" @@ -171,15 +170,15 @@ #endif #endif #endif - + #define SGX_CORE_DEFINED #endif #if defined(SGX540) && !defined(SGX_CORE_DEFINED) - + #define SGX_CORE_REV_HEAD 0 #if defined(USE_SGX_CORE_REV_HEAD) - + #define SGX_CORE_REV SGX_CORE_REV_HEAD #endif @@ -209,7 +208,7 @@ #define FIX_HW_BRN_34028 #else #if SGX_CORE_REV == SGX_CORE_REV_HEAD - + #else #error "sgxerrata.h: SGX540 Core Revision unspecified" #endif @@ -218,16 +217,16 @@ #endif #endif #endif - + #define SGX_CORE_DEFINED #endif #if defined(SGX541) && !defined(SGX_CORE_DEFINED) #if defined(SGX_FEATURE_MP) - + #define SGX_CORE_REV_HEAD 0 #if defined(USE_SGX_CORE_REV_HEAD) - + #define SGX_CORE_REV SGX_CORE_REV_HEAD #endif @@ -235,26 +234,26 @@ #define FIX_HW_BRN_27270 #define FIX_HW_BRN_28011 #define FIX_HW_BRN_27510 - + #else #if SGX_CORE_REV == SGX_CORE_REV_HEAD - + #else #error "sgxerrata.h: SGX541 Core Revision unspecified" #endif #endif - + #define SGX_CORE_DEFINED - #else + #else #error "sgxerrata.h: SGX541 only supports MP configs (SGX_FEATURE_MP)" - #endif + #endif #endif #if defined(SGX543) && !defined(SGX_CORE_DEFINED) - + #define SGX_CORE_REV_HEAD 0 #if defined(USE_SGX_CORE_REV_HEAD) - + #define SGX_CORE_REV SGX_CORE_REV_HEAD #endif @@ -267,16 +266,17 @@ #define FIX_HW_BRN_31272 #define FIX_HW_BRN_31278 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #define FIX_HW_BRN_31559 #endif #define FIX_HW_BRN_31620 - #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_31780 #define FIX_HW_BRN_31542 - #define FIX_HW_BRN_32044 + #define FIX_HW_BRN_32044 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif #define FIX_HW_BRN_33920 + #define FIX_HW_BRN_36513 #else #if SGX_CORE_REV == 122 #define FIX_HW_BRN_29954 @@ -286,19 +286,20 @@ #define FIX_HW_BRN_31195 #define FIX_HW_BRN_31272 #define FIX_HW_BRN_31278 - #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #if defined(SGX_FEATURE_MP) + #define FIX_HW_BRN_31559 #endif #define FIX_HW_BRN_31620 #define FIX_HW_BRN_31780 #define FIX_HW_BRN_31542 - #define FIX_HW_BRN_32044 - #define FIX_HW_BRN_32085 + #define FIX_HW_BRN_32044 + #define FIX_HW_BRN_32085 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif #define FIX_HW_BRN_33920 - + #define FIX_HW_BRN_36513 + #else #if SGX_CORE_REV == 1221 #define FIX_HW_BRN_29954 @@ -306,18 +307,19 @@ #define FIX_HW_BRN_31272 #define FIX_HW_BRN_31278 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #define FIX_HW_BRN_31559 #endif #define FIX_HW_BRN_31542 - #define FIX_HW_BRN_31671 - #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_31671 + #define FIX_HW_BRN_31780 #define FIX_HW_BRN_32044 - #define FIX_HW_BRN_32085 + #define FIX_HW_BRN_32085 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif #define FIX_HW_BRN_33920 - + #define FIX_HW_BRN_36513 + #else #if SGX_CORE_REV == 140 #define FIX_HW_BRN_29954 @@ -327,18 +329,19 @@ #define FIX_HW_BRN_31272 #define FIX_HW_BRN_31278 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #define FIX_HW_BRN_31559 #endif #define FIX_HW_BRN_31620 - #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_31780 #define FIX_HW_BRN_31542 - #define FIX_HW_BRN_32044 - #define FIX_HW_BRN_32085 + #define FIX_HW_BRN_32044 + #define FIX_HW_BRN_32085 #define FIX_HW_BRN_33920 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif - + #define FIX_HW_BRN_36513 + #else #if SGX_CORE_REV == 1401 #define FIX_HW_BRN_29954 @@ -347,42 +350,45 @@ #define FIX_HW_BRN_31272 #define FIX_HW_BRN_31278 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #define FIX_HW_BRN_31559 #endif #define FIX_HW_BRN_31620 #define FIX_HW_BRN_31542 - #define FIX_HW_BRN_31780 - #define FIX_HW_BRN_32044 - #define FIX_HW_BRN_32085 + #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_32044 + #define FIX_HW_BRN_32085 #define FIX_HW_BRN_33920 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif - + #define FIX_HW_BRN_36513 + #else #if SGX_CORE_REV == 141 #define FIX_HW_BRN_29954 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #define FIX_HW_BRN_31559 #endif - #define FIX_HW_BRN_31671 - #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_31671 + #define FIX_HW_BRN_31780 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif - + #define FIX_HW_BRN_36513 + #else #if SGX_CORE_REV == 142 #define FIX_HW_BRN_29954 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #define FIX_HW_BRN_31559 #endif - #define FIX_HW_BRN_31671 - #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_31671 + #define FIX_HW_BRN_31780 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif - + #define FIX_HW_BRN_36513 + #else #if SGX_CORE_REV == 211 #define FIX_HW_BRN_31093 @@ -390,57 +396,61 @@ #define FIX_HW_BRN_31272 #define FIX_HW_BRN_31278 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #define FIX_HW_BRN_31559 #endif #define FIX_HW_BRN_31620 - #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_31780 #define FIX_HW_BRN_31542 - #define FIX_HW_BRN_32044 - #define FIX_HW_BRN_32085 + #define FIX_HW_BRN_32044 + #define FIX_HW_BRN_32085 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif #define FIX_HW_BRN_33920 - + #define FIX_HW_BRN_36513 + #else #if SGX_CORE_REV == 2111 - #define FIX_HW_BRN_30982 + #define FIX_HW_BRN_30982 #define FIX_HW_BRN_31093 #define FIX_HW_BRN_31195 #define FIX_HW_BRN_31272 #define FIX_HW_BRN_31278 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #define FIX_HW_BRN_31559 #endif #define FIX_HW_BRN_31620 - #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_31780 #define FIX_HW_BRN_31542 - #define FIX_HW_BRN_32044 - #define FIX_HW_BRN_32085 + #define FIX_HW_BRN_32044 + #define FIX_HW_BRN_32085 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif #define FIX_HW_BRN_33920 - + #define FIX_HW_BRN_36513 + #else #if SGX_CORE_REV == 213 #define FIX_HW_BRN_31272 - #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #if defined(SGX_FEATURE_MP) + #define FIX_HW_BRN_31559 #endif - #define FIX_HW_BRN_31671 - #define FIX_HW_BRN_31780 - #define FIX_HW_BRN_32085 + #define FIX_HW_BRN_31671 + #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_32085 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif #define FIX_HW_BRN_33920 - + #define FIX_HW_BRN_36513 + #else #if SGX_CORE_REV == 216 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif + #define FIX_HW_BRN_36513 #else #if SGX_CORE_REV == 302 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) @@ -472,48 +482,52 @@ #endif #endif #endif - + #define SGX_CORE_DEFINED #endif #if defined(SGX544) && !defined(SGX_CORE_DEFINED) - + #define SGX_CORE_REV_HEAD 0 #if defined(USE_SGX_CORE_REV_HEAD) - + #define SGX_CORE_REV SGX_CORE_REV_HEAD #endif #if SGX_CORE_REV == 100 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #define FIX_HW_BRN_31559 #endif #else #if SGX_CORE_REV == 102 #define FIX_HW_BRN_29954 #define FIX_HW_BRN_31272 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #define FIX_HW_BRN_31559 #endif - #define FIX_HW_BRN_31780 - #define FIX_HW_BRN_32085 + #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_32085 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif #define FIX_HW_BRN_33920 + #if defined(SGX_FEATURE_MP) + #define FIX_HW_BRN_36513 + #endif #else #if SGX_CORE_REV == 103 #define FIX_HW_BRN_29954 #define FIX_HW_BRN_31272 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #define FIX_HW_BRN_31559 #endif - #define FIX_HW_BRN_31780 - #define FIX_HW_BRN_32085 + #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_32085 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif #define FIX_HW_BRN_33920 + #define FIX_HW_BRN_36513 #else #if SGX_CORE_REV == 104 #define FIX_HW_BRN_29954 @@ -522,28 +536,30 @@ #define FIX_HW_BRN_31272 #define FIX_HW_BRN_31278 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #define FIX_HW_BRN_31559 #endif - #define FIX_HW_BRN_31542 + #define FIX_HW_BRN_31542 #define FIX_HW_BRN_31620 - #define FIX_HW_BRN_31671 - #define FIX_HW_BRN_31780 - #define FIX_HW_BRN_32044 - #define FIX_HW_BRN_32085 + #define FIX_HW_BRN_31671 + #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_32044 + #define FIX_HW_BRN_32085 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif #define FIX_HW_BRN_33920 - #else + #define FIX_HW_BRN_36513 + #else #if SGX_CORE_REV == 105 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #define FIX_HW_BRN_31559 #endif - #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_31780 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif #define FIX_HW_BRN_33920 + #define FIX_HW_BRN_36513 #else #if SGX_CORE_REV == 106 #define FIX_HW_BRN_31272 @@ -553,9 +569,9 @@ #if SGX_CORE_REV == 110 #define FIX_HW_BRN_31272 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #define FIX_HW_BRN_31559 #endif - #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_31780 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif @@ -566,31 +582,28 @@ #define FIX_HW_BRN_33920 #else #if SGX_CORE_REV == 114 - #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 - #endif - #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_31780 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif #else #if SGX_CORE_REV == 115 - #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 - #endif - #define FIX_HW_BRN_31780 + #define FIX_HW_BRN_31780 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif - #else - #if SGX_CORE_REV == 116 #if defined(SGX_FEATURE_MP) - #define FIX_HW_BRN_31425 + #if SGX_FEATURE_MP_CORE_COUNT > 1 + #define FIX_HW_BRN_36513 + #endif #endif + #else + #if SGX_CORE_REV == 116 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif #define FIX_HW_BRN_33809 + #define FIX_HW_BRN_36513 #else #if SGX_CORE_REV == SGX_CORE_REV_HEAD #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) @@ -610,15 +623,15 @@ #endif #endif #endif - + #define SGX_CORE_DEFINED #endif #if defined(SGX545) && !defined(SGX_CORE_DEFINED) - + #define SGX_CORE_REV_HEAD 0 #if defined(USE_SGX_CORE_REV_HEAD) - + #define SGX_CORE_REV SGX_CORE_REV_HEAD #endif @@ -647,7 +660,7 @@ #if SGX_CORE_REV == 10141 #else #if SGX_CORE_REV == SGX_CORE_REV_HEAD - + #else #error "sgxerrata.h: SGX545 Core Revision unspecified" #endif @@ -658,15 +671,15 @@ #endif #endif #endif - + #define SGX_CORE_DEFINED #endif #if defined(SGX554) && !defined(SGX_CORE_DEFINED) - + #define SGX_CORE_REV_HEAD 0 #if defined(USE_SGX_CORE_REV_HEAD) - + #define SGX_CORE_REV SGX_CORE_REV_HEAD #endif @@ -674,8 +687,9 @@ #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 #endif - - #else + #define FIX_HW_BRN_36513 + + #else #if SGX_CORE_REV == SGX_CORE_REV_HEAD #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && defined(SGX_FEATURE_MP) #define FIX_HW_BRN_33657 @@ -684,7 +698,7 @@ #error "sgxerrata.h: SGX554 Core Revision unspecified" #endif #endif - + #define SGX_CORE_DEFINED #endif @@ -696,5 +710,5 @@ #endif #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxfeaturedefs.h b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxfeaturedefs.h index de508b5..0679671 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxfeaturedefs.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxfeaturedefs.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -108,7 +108,10 @@ #define SGX_FEATURE_EXTENDED_PERF_COUNTERS #define SGX_FEATURE_EDM_VERTEX_PDSADDR_FULL_RANGE #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) - #define SGX_FEATURE_SW_VDM_CONTEXT_SWITCH + #if defined(SGX_FEATURE_MP) + #define SGX_FEATURE_MASTER_VDM_CONTEXT_SWITCH + #define SGX_FEATURE_SLAVE_VDM_CONTEXT_SWITCH + #endif #define SGX_FEATURE_SW_ISP_CONTEXT_SWITCH #endif #else @@ -133,8 +136,8 @@ #define SGX_FEATURE_MAX_TA_RENDER_TARGETS (512) #define SGX_FEATURE_SECONDARY_REQUIRES_USE_KICK #define SGX_FEATURE_WRITEBACK_DCU - - + + #define SGX_FEATURE_BIF_WIDE_TILING_AND_4K_ADDRESS #define SGX_FEATURE_MULTI_EVENT_KICK #define SGX_FEATURE_EDM_VERTEX_PDSADDR_FULL_RANGE @@ -219,7 +222,7 @@ #if defined(SGX_FEATURE_MP_CORE_COUNT_TA) && defined(SGX_FEATURE_MP_CORE_COUNT_3D) #if (SGX_FEATURE_MP_CORE_COUNT_TA > SGX_FEATURE_MP_CORE_COUNT_3D) #error Number of TA cores larger than number of 3D cores not supported in current driver -#endif +#endif #else #if defined(SGX_FEATURE_MP_CORE_COUNT) #define SGX_FEATURE_MP_CORE_COUNT_TA (SGX_FEATURE_MP_CORE_COUNT) @@ -228,13 +231,13 @@ #error Either SGX_FEATURE_MP_CORE_COUNT or \ both SGX_FEATURE_MP_CORE_COUNT_TA and SGX_FEATURE_MP_CORE_COUNT_3D \ must be defined when SGX_FEATURE_MP is defined -#endif -#endif +#endif +#endif #else #define SGX_FEATURE_MP_CORE_COUNT (1) #define SGX_FEATURE_MP_CORE_COUNT_TA (1) #define SGX_FEATURE_MP_CORE_COUNT_3D (1) -#endif +#endif #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && !defined(SUPPORT_SGX_PRIORITY_SCHEDULING) #define SUPPORT_SGX_PRIORITY_SCHEDULING diff --git a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxmmu.h b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxmmu.h index 683f485..1b265f1 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxmmu.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxmmu.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -68,5 +68,5 @@ #define SGX_MMU_PTE_CACHECONSISTENT (0x00000008U) #define SGX_MMU_PTE_EDMPROTECT (0x00000010U) -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxmpdefs.h b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxmpdefs.h index fb045ad4..e34561a 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxmpdefs.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxmpdefs.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -328,5 +328,5 @@ #define EUR_CR_MASTER_SOFT_RESET_PTLA_RESET_SHIFT 10 #define EUR_CR_MASTER_SOFT_RESET_PTLA_RESET_SIGNED 0 -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/buffer_manager.h b/drivers/staging/mrst/pvr/services4/srvkm/include/buffer_manager.h index 8b15dd2..b78b0ae 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/buffer_manager.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/buffer_manager.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -41,16 +41,16 @@ struct _BM_MAPPING_ { enum { - hm_wrapped = 1, - hm_wrapped_scatter, - hm_wrapped_virtaddr, - hm_wrapped_scatter_virtaddr, - hm_env, - hm_contiguous + hm_wrapped = 1, + hm_wrapped_scatter, + hm_wrapped_virtaddr, + hm_wrapped_scatter_virtaddr, + hm_env, + hm_contiguous } eCpuMemoryOrigin; - BM_HEAP *pBMHeap; - RA_ARENA *pArena; + BM_HEAP *pBMHeap; + RA_ARENA *pArena; IMG_CPU_VIRTADDR CpuVAddr; IMG_CPU_PHYADDR CpuPAddr; @@ -83,10 +83,10 @@ struct _BM_HEAP_ DEV_ARENA_DESCRIPTOR sDevArena; MMU_HEAP *pMMUHeap; PDUMP_MMU_ATTRIB *psMMUAttrib; - + struct _BM_HEAP_ *psNext; struct _BM_HEAP_ **ppsThis; - + IMG_UINT32 ui32XTileStride; }; @@ -94,30 +94,40 @@ struct _BM_CONTEXT_ { MMU_CONTEXT *psMMUContext; - + BM_HEAP *psBMHeap; - + BM_HEAP *psBMSharedHeap; PVRSRV_DEVICE_NODE *psDeviceNode; - + HASH_TABLE *pBufferHash; - + IMG_HANDLE hResItem; IMG_UINT32 ui32RefCount; - + struct _BM_CONTEXT_ *psNext; struct _BM_CONTEXT_ **ppsThis; }; - - +typedef struct _XPROC_DATA_{ + IMG_UINT32 ui32RefCount; + IMG_UINT32 ui32AllocFlags; + IMG_UINT32 ui32Size; + IMG_UINT32 ui32PageSize; + RA_ARENA *psArena; + IMG_SYS_PHYADDR sSysPAddr; + IMG_VOID *pvCpuVAddr; + IMG_HANDLE hOSMemHandle; +} XPROC_DATA; + +extern XPROC_DATA gXProcWorkaroundShareData[]; typedef IMG_VOID *BM_HANDLE; #define BP_POOL_MASK 0x7 @@ -210,6 +220,25 @@ PVRSRV_ERROR BM_XProcWorkaroundSetShareIndex(IMG_UINT32 ui32Index); PVRSRV_ERROR BM_XProcWorkaroundUnsetShareIndex(IMG_UINT32 ui32Index); PVRSRV_ERROR BM_XProcWorkaroundFindNewBufferAndSetShareIndex(IMG_UINT32 *pui32Index); +#if defined(PVRSRV_REFCOUNT_DEBUG) +IMG_VOID _BM_XProcIndexAcquireDebug(const IMG_CHAR *pszFile, IMG_INT iLine, IMG_UINT32 ui32Index); +IMG_VOID _BM_XProcIndexReleaseDebug(const IMG_CHAR *pszFile, IMG_INT iLine, IMG_UINT32 ui32Index); + +#define BM_XProcIndexAcquire(x...) \ + _BM_XProcIndexAcquireDebug(__FILE__, __LINE__, x) +#define BM_XProcIndexRelease(x...) \ + _BM_XProcIndexReleaseDebug(__FILE__, __LINE__, x) + +#else +IMG_VOID _BM_XProcIndexAcquire(IMG_UINT32 ui32Index); +IMG_VOID _BM_XProcIndexRelease(IMG_UINT32 ui32Index); + +#define BM_XProcIndexAcquire(x...) \ + _BM_XProcIndexAcquire( x) +#define BM_XProcIndexRelease(x...) \ + _BM_XProcIndexRelease( x) +#endif + #if defined(__cplusplus) } diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/device.h b/drivers/staging/mrst/pvr/services4/srvkm/include/device.h index 448ef58..9df2c73 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/device.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/device.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -30,9 +30,9 @@ #if defined(__cplusplus) extern "C" { #endif - -#include "ra.h" -#include "resman.h" + +#include "ra.h" +#include "resman.h" typedef struct _BM_CONTEXT_ BM_CONTEXT; @@ -51,38 +51,38 @@ typedef IMG_UINT32 DEVICE_MEMORY_HEAP_TYPE; #define DEVICE_MEMORY_HEAP_SHARED_EXPORTED 3 #define PVRSRV_DEVICE_NODE_FLAGS_PORT80DISPLAY 1 -#define PVRSRV_DEVICE_NODE_FLAGS_MMU_OPT_INV 2 +#define PVRSRV_DEVICE_NODE_FLAGS_MMU_OPT_INV 2 typedef struct _DEVICE_MEMORY_HEAP_INFO_ { - + IMG_UINT32 ui32HeapID; - + IMG_CHAR *pszName; - + IMG_CHAR *pszBSName; - - + + IMG_DEV_VIRTADDR sDevVAddrBase; - + IMG_UINT32 ui32HeapSize; - + IMG_UINT32 ui32Attribs; - + DEVICE_MEMORY_HEAP_TYPE DevMemHeapType; - - + + IMG_HANDLE hDevMemHeap; - - + + RA_ARENA *psLocalDevMemArena; - + IMG_UINT32 ui32DataPageSize; IMG_UINT32 ui32XTileStride; @@ -91,30 +91,30 @@ typedef struct _DEVICE_MEMORY_HEAP_INFO_ typedef struct _DEVICE_MEMORY_INFO_ { - + IMG_UINT32 ui32AddressSpaceSizeLog2; - + IMG_UINT32 ui32Flags; - + IMG_UINT32 ui32HeapCount; - - + + IMG_UINT32 ui32SyncHeapID; - - + + IMG_UINT32 ui32MappingHeapID; - + DEVICE_MEMORY_HEAP_INFO *psDeviceMemoryHeap; - + BM_CONTEXT *pBMKernelContext; - + BM_CONTEXT *pBMContext; } DEVICE_MEMORY_INFO; @@ -122,17 +122,17 @@ typedef struct _DEVICE_MEMORY_INFO_ typedef struct DEV_ARENA_DESCRIPTOR_TAG { - IMG_UINT32 ui32HeapID; + IMG_UINT32 ui32HeapID; - IMG_CHAR *pszName; + IMG_CHAR *pszName; - IMG_DEV_VIRTADDR BaseDevVAddr; + IMG_DEV_VIRTADDR BaseDevVAddr; - IMG_UINT32 ui32Size; + IMG_UINT32 ui32Size; DEVICE_MEMORY_HEAP_TYPE DevMemHeapType; - + IMG_UINT32 ui32DataPageSize; DEVICE_MEMORY_HEAP_INFO *psDeviceMemoryHeapInfo; @@ -143,18 +143,18 @@ typedef struct DEV_ARENA_DESCRIPTOR_TAG typedef struct _PDUMP_MMU_ATTRIB_ { PVRSRV_DEVICE_IDENTIFIER sDevId; - + IMG_CHAR *pszPDRegRegion; - - + + IMG_UINT32 ui32DataPageMask; - + IMG_UINT32 ui32PTEValid; IMG_UINT32 ui32PTSize; IMG_UINT32 ui32PTEAlignShift; - + IMG_UINT32 ui32PDEMask; IMG_UINT32 ui32PDEAlignShift; @@ -167,17 +167,17 @@ typedef struct _PVRSRV_DEVICE_NODE_ PVRSRV_DEVICE_IDENTIFIER sDevId; IMG_UINT32 ui32RefCount; + - - + PVRSRV_ERROR (*pfnInitDevice) (IMG_VOID*); - + PVRSRV_ERROR (*pfnDeInitDevice) (IMG_VOID*); - + PVRSRV_ERROR (*pfnInitDeviceCompatCheck) (struct _PVRSRV_DEVICE_NODE_*); - + PVRSRV_ERROR (*pfnMMUInitialise)(struct _PVRSRV_DEVICE_NODE_*, MMU_CONTEXT**, IMG_DEV_PHYADDR*); IMG_VOID (*pfnMMUFinalise)(MMU_CONTEXT*); IMG_VOID (*pfnMMUInsertHeap)(MMU_CONTEXT*, MMU_HEAP*); @@ -200,7 +200,7 @@ typedef struct _PVRSRV_DEVICE_NODE_ IMG_HANDLE hUniqueTag); IMG_VOID (*pfnMMUMapShadow)(MMU_HEAP *pMMU, IMG_DEV_VIRTADDR MapBaseDevVAddr, - IMG_SIZE_T uSize, + IMG_SIZE_T uSize, IMG_CPU_VIRTADDR CpuVAddr, IMG_HANDLE hOSMemHandle, IMG_DEV_VIRTADDR *pDevVAddr, @@ -225,7 +225,7 @@ typedef struct _PVRSRV_DEVICE_NODE_ IMG_VOID (*pfnMMUGetCacheFlushRange)(MMU_CONTEXT *pMMUContext, IMG_UINT32 *pui32RangeMask); IMG_VOID (*pfnMMUGetPDPhysAddr)(MMU_CONTEXT *pMMUContext, IMG_DEV_PHYADDR *psDevPAddr); - + PVRSRV_ERROR (*pfnAllocMemTilingRange)(struct _PVRSRV_DEVICE_NODE_ *psDeviceNode, PVRSRV_KERNEL_MEM_INFO *psMemInfo, IMG_UINT32 ui32TilingStride, @@ -233,47 +233,47 @@ typedef struct _PVRSRV_DEVICE_NODE_ PVRSRV_ERROR (*pfnFreeMemTilingRange)(struct _PVRSRV_DEVICE_NODE_ *psDeviceNode, IMG_UINT32 ui32RangeIndex); - + IMG_BOOL (*pfnDeviceISR)(IMG_VOID*); - + IMG_VOID *pvISRData; - + IMG_UINT32 ui32SOCInterruptBit; - + IMG_VOID (*pfnDeviceMISR)(IMG_VOID*); - + IMG_VOID (*pfnDeviceCommandComplete)(struct _PVRSRV_DEVICE_NODE_ *psDeviceNode); - + IMG_BOOL bReProcessDeviceCommandComplete; IMG_VOID (*pfnCacheInvalidate)(struct _PVRSRV_DEVICE_NODE_ *psDeviceNode); - + DEVICE_MEMORY_INFO sDevMemoryInfo; - + IMG_VOID *pvDevice; - IMG_UINT32 ui32pvDeviceSize; - - + IMG_UINT32 ui32pvDeviceSize; + + PRESMAN_CONTEXT hResManContext; - - + + PSYS_DATA psSysData; - - + + RA_ARENA *psLocalDevMemArena; - + IMG_UINT32 ui32Flags; - + struct _PVRSRV_DEVICE_NODE_ *psNext; struct _PVRSRV_DEVICE_NODE_ **ppsThis; - + #if defined(PDUMP) - + PVRSRV_ERROR (*pfnPDumpInitDevice)(struct _PVRSRV_DEVICE_NODE_ *psDeviceNode); - + IMG_UINT32 (*pfnMMUGetContextID)(IMG_HANDLE hDevMemContext); #endif } PVRSRV_DEVICE_NODE; @@ -299,7 +299,7 @@ IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PollForValueKM(volatile IMG_UINT32* pui32Li IMG_UINT32 ui32PollPeriodus, IMG_BOOL bAllowPreemption); -#endif +#endif #if defined (USING_ISR_INTERRUPTS) @@ -307,7 +307,7 @@ PVRSRV_ERROR IMG_CALLCONV PollForInterruptKM(IMG_UINT32 ui32Value, IMG_UINT32 ui32Mask, IMG_UINT32 ui32Waitus, IMG_UINT32 ui32Tries); -#endif +#endif PVRSRV_ERROR IMG_CALLCONV PVRSRVInit(PSYS_DATA psSysData); IMG_VOID IMG_CALLCONV PVRSRVDeInit(PSYS_DATA psSysData); @@ -318,6 +318,6 @@ IMG_VOID IMG_CALLCONV PVRSRVMISR(IMG_VOID *pvSysData); #if defined(__cplusplus) } #endif - -#endif + +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/handle.h b/drivers/staging/mrst/pvr/services4/srvkm/include/handle.h index 7ff9360..536fa56 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/handle.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/handle.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -65,13 +65,13 @@ typedef enum typedef enum { - + PVRSRV_HANDLE_ALLOC_FLAG_NONE = 0, - + PVRSRV_HANDLE_ALLOC_FLAG_SHARED = 0x01, - + PVRSRV_HANDLE_ALLOC_FLAG_MULTI = 0x02, - + PVRSRV_HANDLE_ALLOC_FLAG_PRIVATE = 0x04 } PVRSRV_HANDLE_ALLOC_FLAG; @@ -119,7 +119,7 @@ PVRSRV_ERROR PVRSRVGetParentHandle(PVRSRV_HANDLE_BASE *psBase, IMG_PVOID *phPare PVRSRV_ERROR PVRSRVLookupAndReleaseHandle(PVRSRV_HANDLE_BASE *psBase, IMG_PVOID *ppvData, IMG_HANDLE hHandle, PVRSRV_HANDLE_TYPE eType); PVRSRV_ERROR PVRSRVReleaseHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE hHandle, PVRSRV_HANDLE_TYPE eType); -#endif +#endif PVRSRV_ERROR PVRSRVNewHandleBatch(PVRSRV_HANDLE_BASE *psBase, IMG_UINT32 ui32BatchSize); @@ -143,7 +143,7 @@ PVRSRV_ERROR PVRSRVHandleInit(IMG_VOID); PVRSRV_ERROR PVRSRVHandleDeInit(IMG_VOID); -#else +#else #define KERNEL_HANDLE_BASE IMG_NULL @@ -196,7 +196,7 @@ static INLINE PVRSRV_ERROR PVRSRVLookupHandleAnyType(PVRSRV_HANDLE_BASE *psBase, IMG_PVOID *ppvData, PVRSRV_HANDLE_TYPE *peType, IMG_HANDLE hHandle) { PVR_UNREFERENCED_PARAMETER(psBase); - + *peType = PVRSRV_HANDLE_TYPE_NONE; *ppvData = hHandle; @@ -388,7 +388,7 @@ PVRSRV_ERROR PVRSRVHandleDeInit(IMG_VOID) return PVRSRV_OK; } -#endif +#endif #define PVRSRVAllocHandleNR(psBase, phHandle, pvData, eType, eFlag) \ (IMG_VOID)PVRSRVAllocHandle(psBase, phHandle, pvData, eType, eFlag) @@ -400,5 +400,5 @@ PVRSRV_ERROR PVRSRVHandleDeInit(IMG_VOID) } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/hash.h b/drivers/staging/mrst/pvr/services4/srvkm/include/hash.h index 47536af..3662089 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/hash.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/hash.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -76,5 +76,5 @@ IMG_VOID HASH_Dump (HASH_TABLE *pHash); } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/lists.h b/drivers/staging/mrst/pvr/services4/srvkm/include/lists.h index 5004b69..a02307a 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/lists.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/lists.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/metrics.h b/drivers/staging/mrst/pvr/services4/srvkm/include/metrics.h index b1c74bd..69e1b3d 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/metrics.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/metrics.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -36,7 +36,7 @@ extern "C" { #if defined(DEBUG) || defined(TIMING) -typedef struct +typedef struct { IMG_UINT32 ui32Start; IMG_UINT32 ui32Stop; @@ -44,7 +44,7 @@ typedef struct IMG_UINT32 ui32Count; } Temporal_Data; -extern Temporal_Data asTimers[]; +extern Temporal_Data asTimers[]; extern IMG_UINT32 PVRSRVTimeNow(IMG_VOID); extern IMG_VOID PVRSRVSetupMetricTimers(IMG_VOID *pvDevInfo); @@ -90,21 +90,21 @@ extern IMG_VOID PVRSRVOutputMetricTotals(IMG_VOID); #if defined(__sh__) -#define TST_REG ((volatile IMG_UINT8 *) (psDevInfo->pvSOCRegsBaseKM)) +#define TST_REG ((volatile IMG_UINT8 *) (psDevInfo->pvSOCRegsBaseKM)) -#define TCOR_2 ((volatile IMG_UINT *) (psDevInfo->pvSOCRegsBaseKM+28)) -#define TCNT_2 ((volatile IMG_UINT *) (psDevInfo->pvSOCRegsBaseKM+32)) -#define TCR_2 ((volatile IMG_UINT16 *)(psDevInfo->pvSOCRegsBaseKM+36)) +#define TCOR_2 ((volatile IMG_UINT *) (psDevInfo->pvSOCRegsBaseKM+28)) +#define TCNT_2 ((volatile IMG_UINT *) (psDevInfo->pvSOCRegsBaseKM+32)) +#define TCR_2 ((volatile IMG_UINT16 *)(psDevInfo->pvSOCRegsBaseKM+36)) #define TIMER_DIVISOR 4 -#endif +#endif -#else +#else @@ -119,12 +119,12 @@ extern IMG_VOID PVRSRVOutputMetricTotals(IMG_VOID); -#endif +#endif #if defined(__cplusplus) } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/osfunc.h b/drivers/staging/mrst/pvr/services4/srvkm/include/osfunc.h index 111a8c3..70caf57 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/osfunc.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/osfunc.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -46,7 +46,7 @@ extern "C" { #endif - + #define PVRSRV_PAGEABLE_SELECT PVRSRV_OS_PAGEABLE_HEAP #define KERNEL_ID 0xffffffffL @@ -59,9 +59,9 @@ extern "C" { #define HOST_PAGEMASK (HOST_PAGESIZE()-1) #define HOST_PAGEALIGN(addr) (((addr) + HOST_PAGEMASK) & ~HOST_PAGEMASK) -#define PVRSRV_OS_HEAP_MASK 0xf -#define PVRSRV_OS_PAGEABLE_HEAP 0x1 -#define PVRSRV_OS_NON_PAGEABLE_HEAP 0x2 +#define PVRSRV_OS_HEAP_MASK 0xf +#define PVRSRV_OS_PAGEABLE_HEAP 0x1 +#define PVRSRV_OS_NON_PAGEABLE_HEAP 0x2 IMG_UINT32 OSClockus(IMG_VOID); @@ -99,7 +99,7 @@ IMG_BOOL OSInvalidateCPUCacheRangeKM(IMG_HANDLE hOSMemHandle, IMG_VOID *pvRangeAddrStart, IMG_UINT32 ui32Length); -#else +#else #ifdef INLINE_IS_PRAGMA #pragma inline(OSFlushCPUCacheKM) @@ -150,19 +150,19 @@ static INLINE IMG_BOOL OSInvalidateCPUCacheRangeKM(IMG_HANDLE hOSMemHandle, return IMG_FALSE; } -#endif +#endif #if defined(__linux__) PVRSRV_ERROR OSRegisterDiscontigMem(IMG_SYS_PHYADDR *pBasePAddr, - IMG_VOID *pvCpuVAddr, + IMG_VOID *pvCpuVAddr, IMG_SIZE_T ui32Bytes, - IMG_UINT32 ui32Flags, + IMG_UINT32 ui32Flags, IMG_HANDLE *phOSMemHandle); PVRSRV_ERROR OSUnRegisterDiscontigMem(IMG_VOID *pvCpuVAddr, IMG_SIZE_T ui32Bytes, IMG_UINT32 ui32Flags, IMG_HANDLE hOSMemHandle); -#else +#else #ifdef INLINE_IS_PRAGMA #pragma inline(OSRegisterDiscontigMem) #endif @@ -196,7 +196,7 @@ static INLINE PVRSRV_ERROR OSUnRegisterDiscontigMem(IMG_VOID *pvCpuVAddr, return PVRSRV_ERROR_NOT_SUPPORTED; } -#endif +#endif #if defined(__linux__) @@ -205,15 +205,15 @@ static INLINE PVRSRV_ERROR OSUnRegisterDiscontigMem(IMG_VOID *pvCpuVAddr, #endif static INLINE PVRSRV_ERROR OSReserveDiscontigPhys(IMG_SYS_PHYADDR *pBasePAddr, IMG_SIZE_T ui32Bytes, IMG_UINT32 ui32Flags, IMG_VOID **ppvCpuVAddr, IMG_HANDLE *phOSMemHandle) { -#if defined(__linux__) +#if defined(__linux__) *ppvCpuVAddr = IMG_NULL; - return OSRegisterDiscontigMem(pBasePAddr, *ppvCpuVAddr, ui32Bytes, ui32Flags, phOSMemHandle); + return OSRegisterDiscontigMem(pBasePAddr, *ppvCpuVAddr, ui32Bytes, ui32Flags, phOSMemHandle); #else extern IMG_CPU_PHYADDR SysSysPAddrToCpuPAddr(IMG_SYS_PHYADDR SysPAddr); - + return OSReservePhys(SysSysPAddrToCpuPAddr(pBasePAddr[0]), ui32Bytes, ui32Flags, ppvCpuVAddr, phOSMemHandle); -#endif +#endif } static INLINE PVRSRV_ERROR OSUnReserveDiscontigPhys(IMG_VOID *pvCpuVAddr, IMG_SIZE_T ui32Bytes, IMG_UINT32 ui32Flags, IMG_HANDLE hOSMemHandle) @@ -221,10 +221,10 @@ static INLINE PVRSRV_ERROR OSUnReserveDiscontigPhys(IMG_VOID *pvCpuVAddr, IMG_SI #if defined(__linux__) OSUnRegisterDiscontigMem(pvCpuVAddr, ui32Bytes, ui32Flags, hOSMemHandle); #endif - + return PVRSRV_OK; } -#else +#else #ifdef INLINE_IS_PRAGMA @@ -253,7 +253,7 @@ static INLINE PVRSRV_ERROR OSUnReserveDiscontigPhys(IMG_VOID *pvCpuVAddr, IMG_SI return PVRSRV_ERROR_NOT_SUPPORTED; } -#endif +#endif PVRSRV_ERROR OSRegisterMem(IMG_CPU_PHYADDR BasePAddr, IMG_VOID *pvCpuVAddr, @@ -317,20 +317,20 @@ PVRSRV_ERROR OSFreePages(IMG_UINT32 ui32Flags, IMG_SIZE_T ui32Size, IMG_PVOID pv #define OSAllocPages(flags, size, pageSize, privdata, privdatalength, linAddr, pageAlloc) \ (PVR_TRACE(("OSAllocPages(" #flags ", " #size ", " #pageSize ", " #linAddr ", " #pageAlloc "): (size = 0x%lx)", size)), \ OSAllocPages_Impl(flags, size, pageSize, linAddr, privdata, privdatalength, pageAlloc)) - + #define OSFreeMem(flags, size, linAddr, blockAlloc) \ (PVR_TRACE(("OSFreeMem(" #flags ", " #size ", " #linAddr ", " #blockAlloc "): (pointer = 0x%X)", linAddr)), \ OSFreeMem_Debug_Wrapper(flags, size, linAddr, blockAlloc, __FILE__, __LINE__)) #else #define OSAllocMem(flags, size, linAddr, blockAlloc, logString) \ OSAllocMem_Debug_Wrapper(flags, size, linAddr, blockAlloc, __FILE__, __LINE__) - + #define OSAllocPages OSAllocPages_Impl - + #define OSFreeMem(flags, size, linAddr, blockAlloc) \ OSFreeMem_Debug_Wrapper(flags, size, linAddr, blockAlloc, __FILE__, __LINE__) #endif - + #ifdef PVRSRV_DEBUG_OS_MEMORY PVRSRV_ERROR OSAllocMem_Debug_Wrapper(IMG_UINT32 ui32Flags, @@ -339,7 +339,7 @@ PVRSRV_ERROR OSFreePages(IMG_UINT32 ui32Flags, IMG_SIZE_T ui32Size, IMG_PVOID pv IMG_HANDLE *phBlockAlloc, IMG_CHAR *pszFilename, IMG_UINT32 ui32Line); - + PVRSRV_ERROR OSFreeMem_Debug_Wrapper(IMG_UINT32 ui32Flags, IMG_UINT32 ui32Size, IMG_PVOID pvCpuVAddr, @@ -349,7 +349,7 @@ PVRSRV_ERROR OSFreePages(IMG_UINT32 ui32Flags, IMG_SIZE_T ui32Size, IMG_PVOID pv typedef struct - { + { IMG_UINT8 sGuardRegionBefore[8]; IMG_CHAR sFileName[128]; IMG_UINT32 uLineNo; @@ -360,25 +360,25 @@ PVRSRV_ERROR OSFreePages(IMG_UINT32 ui32Flags, IMG_SIZE_T ui32Size, IMG_PVOID pv isAllocated = 0x260511AA } eValid; } OSMEM_DEBUG_INFO; - - #define TEST_BUFFER_PADDING_STATUS (sizeof(OSMEM_DEBUG_INFO)) - #define TEST_BUFFER_PADDING_AFTER (8) + + #define TEST_BUFFER_PADDING_STATUS (sizeof(OSMEM_DEBUG_INFO)) + #define TEST_BUFFER_PADDING_AFTER (8) #define TEST_BUFFER_PADDING (TEST_BUFFER_PADDING_STATUS + TEST_BUFFER_PADDING_AFTER) #else #define OSAllocMem_Debug_Wrapper OSAllocMem_Debug_Linux_Memory_Allocations #define OSFreeMem_Debug_Wrapper OSFreeMem_Debug_Linux_Memory_Allocations #endif - + #if defined(__linux__) && defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) PVRSRV_ERROR OSAllocMem_Impl(IMG_UINT32 ui32Flags, IMG_SIZE_T ui32Size, IMG_PVOID *ppvLinAddr, IMG_HANDLE *phBlockAlloc, IMG_CHAR *pszFilename, IMG_UINT32 ui32Line); PVRSRV_ERROR OSFreeMem_Impl(IMG_UINT32 ui32Flags, IMG_SIZE_T ui32Size, IMG_PVOID pvLinAddr, IMG_HANDLE hBlockAlloc, IMG_CHAR *pszFilename, IMG_UINT32 ui32Line); - + #define OSAllocMem_Debug_Linux_Memory_Allocations OSAllocMem_Impl #define OSFreeMem_Debug_Linux_Memory_Allocations OSFreeMem_Impl #else PVRSRV_ERROR OSAllocMem_Impl(IMG_UINT32 ui32Flags, IMG_SIZE_T ui32Size, IMG_PVOID *ppvLinAddr, IMG_HANDLE *phBlockAlloc); PVRSRV_ERROR OSFreeMem_Impl(IMG_UINT32 ui32Flags, IMG_SIZE_T ui32Size, IMG_PVOID pvLinAddr, IMG_HANDLE hBlockAlloc); - + #define OSAllocMem_Debug_Linux_Memory_Allocations(flags, size, addr, blockAlloc, file, line) \ OSAllocMem_Impl(flags, size, addr, blockAlloc) #define OSFreeMem_Debug_Linux_Memory_Allocations(flags, size, addr, blockAlloc, file, line) \ @@ -441,7 +441,7 @@ PVRSRV_ERROR OSEventObjectOpenKM(PVRSRV_EVENTOBJECT *psEventObject, IMG_HANDLE *phOSEvent); PVRSRV_ERROR OSEventObjectCloseKM(PVRSRV_EVENTOBJECT *psEventObject, IMG_HANDLE hOSEventKM); -#endif +#endif PVRSRV_ERROR OSBaseAllocContigMemory(IMG_SIZE_T ui32Size, IMG_CPU_VIRTADDR *pLinAddr, IMG_CPU_PHYADDR *pPhysAddr); @@ -479,12 +479,12 @@ IMG_VOID OSBreakResourceLock(PVRSRV_RESOURCE *psResource, IMG_UINT32 ui32ID); PVRSRV_ERROR OSPowerLockWrap(IMG_BOOL bTryLock); IMG_VOID OSPowerLockUnwrap(IMG_VOID); -#endif - +#endif + IMG_VOID OSWaitus(IMG_UINT32 ui32Timeus); - + IMG_VOID OSSleepms(IMG_UINT32 ui32Timems); IMG_HANDLE OSFuncHighResTimerCreate(IMG_VOID); @@ -549,8 +549,8 @@ PVRSRV_ERROR OSCopyToUser(IMG_PVOID pvProcess, IMG_VOID *pvDest, IMG_VOID *pvSrc PVRSRV_ERROR OSCopyFromUser(IMG_PVOID pvProcess, IMG_VOID *pvDest, IMG_VOID *pvSrc, IMG_SIZE_T ui32Bytes); #if defined(__linux__) -PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID* pvCPUVAddr, - IMG_SIZE_T ui32Bytes, +PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID* pvCPUVAddr, + IMG_SIZE_T ui32Bytes, IMG_SYS_PHYADDR *psSysPAddr, IMG_HANDLE *phOSWrapMem); PVRSRV_ERROR OSReleasePhysPageAddr(IMG_HANDLE hOSWrapMem); @@ -558,8 +558,8 @@ PVRSRV_ERROR OSReleasePhysPageAddr(IMG_HANDLE hOSWrapMem); #ifdef INLINE_IS_PRAGMA #pragma inline(OSAcquirePhysPageAddr) #endif -static INLINE PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID* pvCPUVAddr, - IMG_SIZE_T ui32Bytes, +static INLINE PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID* pvCPUVAddr, + IMG_SIZE_T ui32Bytes, IMG_SYS_PHYADDR *psSysPAddr, IMG_HANDLE *phOSWrapMem) { @@ -567,7 +567,7 @@ static INLINE PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID* pvCPUVAddr, PVR_UNREFERENCED_PARAMETER(ui32Bytes); PVR_UNREFERENCED_PARAMETER(psSysPAddr); PVR_UNREFERENCED_PARAMETER(phOSWrapMem); - return PVRSRV_OK; + return PVRSRV_OK; } #ifdef INLINE_IS_PRAGMA #pragma inline(OSReleasePhysPageAddr) @@ -575,10 +575,10 @@ static INLINE PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID* pvCPUVAddr, static INLINE PVRSRV_ERROR OSReleasePhysPageAddr(IMG_HANDLE hOSWrapMem) { PVR_UNREFERENCED_PARAMETER(hOSWrapMem); - return PVRSRV_OK; + return PVRSRV_OK; } #endif - + #if defined(__linux__) && defined(__KERNEL__) #define OS_SUPPORTS_IN_LISR @@ -599,7 +599,7 @@ static inline IMG_VOID OSMemoryBarrier(IMG_VOID) mb(); } -#else +#else #ifdef INLINE_IS_PRAGMA #pragma inline(OSWriteMemoryBarrier) @@ -611,11 +611,38 @@ static INLINE IMG_VOID OSWriteMemoryBarrier(IMG_VOID) { } #endif static INLINE IMG_VOID OSMemoryBarrier(IMG_VOID) { } +#endif + +PVRSRV_ERROR OSAtomicAlloc(IMG_PVOID *ppvRefCount); +IMG_VOID OSAtomicFree(IMG_PVOID pvRefCount); +IMG_VOID OSAtomicInc(IMG_PVOID pvRefCount); +IMG_BOOL OSAtomicDecAndTest(IMG_PVOID pvRefCount); +IMG_UINT32 OSAtomicRead(IMG_PVOID pvRefCount); + +PVRSRV_ERROR OSTimeCreateWithUSOffset(IMG_PVOID *pvRet, IMG_UINT32 ui32MSOffset); +IMG_BOOL OSTimeHasTimePassed(IMG_PVOID pvData); +IMG_VOID OSTimeDestroy(IMG_PVOID pvData); + +#if defined(__linux__) +IMG_VOID OSReleaseBridgeLock(IMG_VOID); +IMG_VOID OSReacquireBridgeLock(IMG_VOID); +#else + +#ifdef INLINE_IS_PRAGMA +#pragma inline(OSReleaseBridgeLock) +#endif +static INLINE IMG_VOID OSReleaseBridgeLock(IMG_VOID) { } + +#ifdef INLINE_IS_PRAGMA +#pragma inline(OSReacquireBridgeLock) +#endif +static INLINE IMG_VOID OSReacquireBridgeLock(IMG_VOID) { } + #endif #if defined (__cplusplus) } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/osperproc.h b/drivers/staging/mrst/pvr/services4/srvkm/include/osperproc.h index d4851e4..02aa230 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/osperproc.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/osperproc.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -36,7 +36,7 @@ PVRSRV_ERROR OSPerProcessPrivateDataInit(IMG_HANDLE *phOsPrivateData); PVRSRV_ERROR OSPerProcessPrivateDataDeInit(IMG_HANDLE hOsPrivateData); PVRSRV_ERROR OSPerProcessSetHandleOptions(PVRSRV_HANDLE_BASE *psHandleBase); -#else +#else #ifdef INLINE_IS_PRAGMA #pragma inline(OSPerProcessPrivateDataInit) #endif @@ -66,11 +66,11 @@ static INLINE PVRSRV_ERROR OSPerProcessSetHandleOptions(PVRSRV_HANDLE_BASE *psHa return PVRSRV_OK; } -#endif +#endif #if defined (__cplusplus) } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/pdump_int.h b/drivers/staging/mrst/pvr/services4/srvkm/include/pdump_int.h index 15e27a0..9f68549 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/pdump_int.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/pdump_int.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -36,17 +36,17 @@ extern "C" { IMG_EXPORT IMG_VOID PDumpConnectionNotify(IMG_VOID); -#endif +#endif typedef enum { - + PDUMP_WRITE_MODE_CONTINUOUS = 0, - + PDUMP_WRITE_MODE_LASTFRAME, - + PDUMP_WRITE_MODE_BINCM, - + PDUMP_WRITE_MODE_PERSISTENT } PDUMP_DDWMODE; @@ -63,5 +63,5 @@ IMG_UINT32 PDumpOSDebugDriverWrite( PDBG_STREAM psStream, #if defined (__cplusplus) } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/pdump_km.h b/drivers/staging/mrst/pvr/services4/srvkm/include/pdump_km.h index f3ddf4a..6c516e0 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/pdump_km.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/pdump_km.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -96,7 +96,7 @@ extern IMG_UINT32 g_ui32EveryLineCounter; IMG_BOOL bInitialisePages, IMG_HANDLE hUniqueTag1, IMG_HANDLE hUniqueTag2); - + PVRSRV_ERROR PDumpMemPTEntriesKM(PDUMP_MMU_ATTRIB *psMMUAttrib, IMG_HANDLE hOSMemHandle, IMG_CPU_VIRTADDR pvLinAddr, @@ -297,9 +297,9 @@ extern IMG_UINT32 g_ui32EveryLineCounter; IMG_UINT32 ui32Flags); IMG_VOID PDumpVGXMemToFile(IMG_CHAR *pszFileName, - IMG_UINT32 ui32FileOffset, + IMG_UINT32 ui32FileOffset, PVRSRV_KERNEL_MEM_INFO *psMemInfo, - IMG_UINT32 uiAddr, + IMG_UINT32 uiAddr, IMG_UINT32 ui32Size, IMG_UINT32 ui32PDumpFlags, IMG_HANDLE hUniqueTag); @@ -307,12 +307,12 @@ extern IMG_UINT32 g_ui32EveryLineCounter; IMG_VOID PDumpSuspendKM(IMG_VOID); IMG_VOID PDumpResumeKM(IMG_VOID); - + PVRSRV_ERROR PDumpStoreMemToFile(PDUMP_MMU_ATTRIB *psMMUAttrib, IMG_CHAR *pszFileName, - IMG_UINT32 ui32FileOffset, + IMG_UINT32 ui32FileOffset, PVRSRV_KERNEL_MEM_INFO *psMemInfo, - IMG_UINT32 uiAddr, + IMG_UINT32 uiAddr, IMG_UINT32 ui32Size, IMG_UINT32 ui32PDumpFlags, IMG_HANDLE hUniqueTag); @@ -408,5 +408,5 @@ extern IMG_UINT32 g_ui32EveryLineCounter; } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/pdump_osfunc.h b/drivers/staging/mrst/pvr/services4/srvkm/include/pdump_osfunc.h index d1b252f..4daacf4 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/pdump_osfunc.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/pdump_osfunc.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -34,7 +34,7 @@ extern "C" { #define MAX_PDUMP_STRING_LENGTH (256) - + #define PDUMP_GET_SCRIPT_STRING() \ IMG_HANDLE hScript; \ IMG_UINT32 ui32MaxLen; \ @@ -67,13 +67,13 @@ extern "C" { eError = PDumpOSGetFilenameString(&pszFileName, &ui32MaxLenFileName);\ if(eError != PVRSRV_OK) return eError; - + PVRSRV_ERROR PDumpOSGetScriptString(IMG_HANDLE *phScript, IMG_UINT32 *pui32MaxLen); - + PVRSRV_ERROR PDumpOSGetMessageString(IMG_CHAR **ppszMsg, IMG_UINT32 *pui32MaxLen); - + PVRSRV_ERROR PDumpOSGetFilenameString(IMG_CHAR **ppszFile, IMG_UINT32 *pui32MaxLen); diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/perfkm.h b/drivers/staging/mrst/pvr/services4/srvkm/include/perfkm.h index 1fcbe47..e12bc2e 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/perfkm.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/perfkm.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -32,5 +32,5 @@ #define PERFINIT() #define PERFDEINIT() -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/perproc.h b/drivers/staging/mrst/pvr/services4/srvkm/include/perproc.h index 839e7da..842680c 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/perproc.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/perproc.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -48,27 +48,27 @@ typedef struct _PVRSRV_PER_PROCESS_DATA_ #endif PVRSRV_HANDLE_BASE *psHandleBase; #if defined (SUPPORT_SID_INTERFACE) - + IMG_BOOL bHandlesBatched; #else #if defined (PVR_SECURE_HANDLES) - + IMG_BOOL bHandlesBatched; -#endif -#endif +#endif +#endif IMG_UINT32 ui32RefCount; - + IMG_BOOL bInitProcess; #if defined(PDUMP) - + IMG_BOOL bPDumpPersistent; #if defined(SUPPORT_PDUMP_MULTI_PROCESS) - + IMG_BOOL bPDumpActive; +#endif #endif -#endif - + IMG_HANDLE hOsPrivateData; } PVRSRV_PER_PROCESS_DATA; @@ -122,5 +122,5 @@ IMG_HANDLE PVRSRVFindPerProcessPrivateData(IMG_VOID) } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/power.h b/drivers/staging/mrst/pvr/services4/srvkm/include/power.h index fcc1be0..9e3dcc40 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/power.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/power.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -32,7 +32,7 @@ extern "C" { #endif - + typedef struct _PVRSRV_POWER_DEV_TAG_ { PFN_PRE_POWER pfnPrePower; @@ -50,11 +50,11 @@ typedef struct _PVRSRV_POWER_DEV_TAG_ typedef enum _PVRSRV_INIT_SERVER_STATE_ { - PVRSRV_INIT_SERVER_Unspecified = -1, - PVRSRV_INIT_SERVER_RUNNING = 0, - PVRSRV_INIT_SERVER_RAN = 1, - PVRSRV_INIT_SERVER_SUCCESSFUL = 2, - PVRSRV_INIT_SERVER_NUM = 3, + PVRSRV_INIT_SERVER_Unspecified = -1, + PVRSRV_INIT_SERVER_RUNNING = 0, + PVRSRV_INIT_SERVER_RAN = 1, + PVRSRV_INIT_SERVER_SUCCESSFUL = 2, + PVRSRV_INIT_SERVER_NUM = 3, PVRSRV_INIT_SERVER_FORCE_I32 = 0x7fffffff } PVRSRV_INIT_SERVER_STATE, *PPVRSRV_INIT_SERVER_STATE; @@ -116,5 +116,5 @@ IMG_VOID PVRSRVDevicePostClockSpeedChange(IMG_UINT32 ui32DeviceIndex, #if defined (__cplusplus) } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/queue.h b/drivers/staging/mrst/pvr/services4/srvkm/include/queue.h index b6f2baf..d8045b1 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/queue.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/queue.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -39,14 +39,14 @@ extern "C" { typedef struct _COMMAND_COMPLETE_DATA_ { IMG_BOOL bInUse; - - IMG_UINT32 ui32DstSyncCount; - IMG_UINT32 ui32SrcSyncCount; - PVRSRV_SYNC_OBJECT *psDstSync; - PVRSRV_SYNC_OBJECT *psSrcSync; - IMG_UINT32 ui32AllocSize; - PFN_QUEUE_COMMAND_COMPLETE pfnCommandComplete; - IMG_HANDLE hCallbackData; + + IMG_UINT32 ui32DstSyncCount; + IMG_UINT32 ui32SrcSyncCount; + PVRSRV_SYNC_OBJECT *psDstSync; + PVRSRV_SYNC_OBJECT *psSrcSync; + IMG_UINT32 ui32AllocSize; + PFN_QUEUE_COMMAND_COMPLETE pfnCommandComplete; + IMG_HANDLE hCallbackData; }COMMAND_COMPLETE_DATA, *PCOMMAND_COMPLETE_DATA; #if !defined(USE_CODE) @@ -55,7 +55,7 @@ IMG_VOID QueueDumpDebugInfo(IMG_VOID); IMG_IMPORT PVRSRV_ERROR PVRSRVProcessQueues (IMG_BOOL bFlush); -#if defined(__linux__) && defined(__KERNEL__) +#if defined(__linux__) && defined(__KERNEL__) #include #include void* ProcSeqOff2ElementQueue(struct seq_file * sfile, loff_t off); @@ -103,12 +103,12 @@ IMG_IMPORT PVRSRV_ERROR PVRSRVRemoveCmdProcListKM(IMG_UINT32 ui32DevIndex, IMG_UINT32 ui32CmdCount); -#endif +#endif #if defined (__cplusplus) } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/ra.h b/drivers/staging/mrst/pvr/services4/srvkm/include/ra.h index b26323f9..d836215 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/ra.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/ra.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -31,41 +31,41 @@ #include "hash.h" #include "osfunc.h" -typedef struct _RA_ARENA_ RA_ARENA; +typedef struct _RA_ARENA_ RA_ARENA; typedef struct _BM_MAPPING_ BM_MAPPING; -#define RA_STATS +#define RA_STATS struct _RA_STATISTICS_ { - + IMG_SIZE_T uSpanCount; - + IMG_SIZE_T uLiveSegmentCount; - + IMG_SIZE_T uFreeSegmentCount; - + IMG_SIZE_T uTotalResourceCount; - - + + IMG_SIZE_T uFreeResourceCount; - + IMG_SIZE_T uCumulativeAllocs; - + IMG_SIZE_T uCumulativeFrees; - + IMG_SIZE_T uImportCount; - + IMG_SIZE_T uExportCount; }; typedef struct _RA_STATISTICS_ RA_STATISTICS; @@ -83,14 +83,14 @@ RA_Create (IMG_CHAR *name, IMG_UINTPTR_T base, IMG_SIZE_T uSize, BM_MAPPING *psMapping, - IMG_SIZE_T uQuantum, + IMG_SIZE_T uQuantum, IMG_BOOL (*imp_alloc)(IMG_VOID *_h, IMG_SIZE_T uSize, IMG_SIZE_T *pActualSize, BM_MAPPING **ppsMapping, IMG_UINT32 uFlags, - IMG_PVOID pvPrivData, - IMG_UINT32 ui32PrivDataLength, + IMG_PVOID pvPrivData, + IMG_UINT32 ui32PrivDataLength, IMG_UINTPTR_T *pBase), IMG_VOID (*imp_free) (IMG_VOID *, IMG_UINTPTR_T, @@ -111,18 +111,18 @@ IMG_BOOL RA_Add (RA_ARENA *pArena, IMG_UINTPTR_T base, IMG_SIZE_T uSize); IMG_BOOL -RA_Alloc (RA_ARENA *pArena, +RA_Alloc (RA_ARENA *pArena, IMG_SIZE_T uSize, IMG_SIZE_T *pActualSize, - BM_MAPPING **ppsMapping, + BM_MAPPING **ppsMapping, IMG_UINT32 uFlags, IMG_UINT32 uAlignment, - IMG_UINT32 uAlignmentOffset, - IMG_PVOID pvPrivData, - IMG_UINT32 ui32PrivDataLength, + IMG_UINT32 uAlignmentOffset, + IMG_PVOID pvPrivData, + IMG_UINT32 ui32PrivDataLength, IMG_UINTPTR_T *pBase); -IMG_VOID +IMG_VOID RA_Free (RA_ARENA *pArena, IMG_UINTPTR_T base, IMG_BOOL bFreeBackingStore); @@ -150,14 +150,14 @@ IMG_BOOL RA_GetNextLiveSegment(IMG_HANDLE hArena, RA_SEGMENT_DETAILS *psSegDetai PVRSRV_ERROR RA_GetStats(RA_ARENA *pArena, - IMG_CHAR **ppszStr, + IMG_CHAR **ppszStr, IMG_UINT32 *pui32StrLen); PVRSRV_ERROR RA_GetStatsFreeMem(RA_ARENA *pArena, - IMG_CHAR **ppszStr, + IMG_CHAR **ppszStr, IMG_UINT32 *pui32StrLen); -#endif +#endif #endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/refcount.h b/drivers/staging/mrst/pvr/services4/srvkm/include/refcount.h index 5def933..92de65c 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/refcount.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/refcount.h @@ -1,32 +1,34 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * */ /**************************************************************************/ #ifndef __REFCOUNT_H__ #define __REFCOUNT_H__ +#include "pvr_bridge_km.h" + #if defined(PVRSRV_REFCOUNT_DEBUG) void PVRSRVDumpRefCountCCB(void); @@ -66,6 +68,10 @@ void PVRSRVBMBufIncExport2(const IMG_CHAR *pszFile, IMG_INT iLine, BM_BUF *pBuf); void PVRSRVBMBufDecExport2(const IMG_CHAR *pszFile, IMG_INT iLine, BM_BUF *pBuf); +void PVRSRVBMXProcIncRef2(const IMG_CHAR *pszFile, IMG_INT iLine, + IMG_UINT32 ui32Index); +void PVRSRVBMXProcDecRef2(const IMG_CHAR *pszFile, IMG_INT iLine, + IMG_UINT32 ui32Index); #if defined(__linux__) @@ -100,14 +106,14 @@ static INLINE void PVRSRVKernelSyncInfoIncRef(PVRSRV_KERNEL_SYNC_INFO *psKernelS PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo) { PVR_UNREFERENCED_PARAMETER(psKernelMemInfo); - psKernelSyncInfo->ui32RefCount++; + PVRSRVAcquireSyncInfoKM(psKernelSyncInfo); } static INLINE void PVRSRVKernelSyncInfoDecRef(PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo, PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo) { PVR_UNREFERENCED_PARAMETER(psKernelMemInfo); - psKernelSyncInfo->ui32RefCount--; + PVRSRVReleaseSyncInfoKM(psKernelSyncInfo); } static INLINE void PVRSRVKernelMemInfoIncRef(PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo) @@ -140,6 +146,16 @@ static INLINE void PVRSRVBMBufDecExport(BM_BUF *pBuf) pBuf->ui32ExportCount--; } +static INLINE void PVRSRVBMXProcIncRef(IMG_UINT32 ui32Index) +{ + gXProcWorkaroundShareData[ui32Index].ui32RefCount++; +} + +static INLINE void PVRSRVBMXProcDecRef(IMG_UINT32 ui32Index) +{ + gXProcWorkaroundShareData[ui32Index].ui32RefCount--; +} + #if defined(__linux__) /* mmap refcounting is Linux specific */ diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/resman.h b/drivers/staging/mrst/pvr/services4/srvkm/include/resman.h index a2f52e6..648e490 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/resman.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/resman.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -32,51 +32,51 @@ extern "C" { #endif enum { - - RESMAN_TYPE_SHARED_PB_DESC = 1, - RESMAN_TYPE_SHARED_PB_DESC_CREATE_LOCK, - RESMAN_TYPE_HW_RENDER_CONTEXT, - RESMAN_TYPE_HW_TRANSFER_CONTEXT, - RESMAN_TYPE_HW_2D_CONTEXT, - RESMAN_TYPE_TRANSFER_CONTEXT, - - - RESMAN_TYPE_DMA_CLIENT_FIFO_DATA, - - - - - - RESMAN_TYPE_DISPLAYCLASS_SWAPCHAIN_REF, - RESMAN_TYPE_DISPLAYCLASS_DEVICE, - - - RESMAN_TYPE_BUFFERCLASS_DEVICE, - - - RESMAN_TYPE_OS_USERMODE_MAPPING, - - - RESMAN_TYPE_DEVICEMEM_CONTEXT, - RESMAN_TYPE_DEVICECLASSMEM_MAPPING, - RESMAN_TYPE_DEVICEMEM_MAPPING, - RESMAN_TYPE_DEVICEMEM_WRAP, - RESMAN_TYPE_DEVICEMEM_ALLOCATION, - RESMAN_TYPE_EVENT_OBJECT, - RESMAN_TYPE_SHARED_MEM_INFO, - RESMAN_TYPE_MODIFY_SYNC_OPS, - RESMAN_TYPE_SYNC_INFO, - - - RESMAN_TYPE_KERNEL_DEVICEMEM_ALLOCATION + + RESMAN_TYPE_SHARED_PB_DESC = 1, + RESMAN_TYPE_SHARED_PB_DESC_CREATE_LOCK, + RESMAN_TYPE_HW_RENDER_CONTEXT, + RESMAN_TYPE_HW_TRANSFER_CONTEXT, + RESMAN_TYPE_HW_2D_CONTEXT, + RESMAN_TYPE_TRANSFER_CONTEXT, + + + RESMAN_TYPE_DMA_CLIENT_FIFO_DATA, + + + + + + RESMAN_TYPE_DISPLAYCLASS_SWAPCHAIN_REF, + RESMAN_TYPE_DISPLAYCLASS_DEVICE, + + + RESMAN_TYPE_BUFFERCLASS_DEVICE, + + + RESMAN_TYPE_OS_USERMODE_MAPPING, + + + RESMAN_TYPE_DEVICEMEM_CONTEXT, + RESMAN_TYPE_DEVICECLASSMEM_MAPPING, + RESMAN_TYPE_DEVICEMEM_MAPPING, + RESMAN_TYPE_DEVICEMEM_WRAP, + RESMAN_TYPE_DEVICEMEM_ALLOCATION, + RESMAN_TYPE_EVENT_OBJECT, + RESMAN_TYPE_SHARED_MEM_INFO, + RESMAN_TYPE_MODIFY_SYNC_OPS, + RESMAN_TYPE_SYNC_INFO, + + + RESMAN_TYPE_KERNEL_DEVICEMEM_ALLOCATION }; -#define RESMAN_CRITERIA_ALL 0x00000000 -#define RESMAN_CRITERIA_RESTYPE 0x00000001 -#define RESMAN_CRITERIA_PVOID_PARAM 0x00000002 -#define RESMAN_CRITERIA_UI32_PARAM 0x00000004 +#define RESMAN_CRITERIA_ALL 0x00000000 +#define RESMAN_CRITERIA_RESTYPE 0x00000001 +#define RESMAN_CRITERIA_PVOID_PARAM 0x00000002 +#define RESMAN_CRITERIA_UI32_PARAM 0x00000004 -typedef PVRSRV_ERROR (*RESMAN_FREE_FN)(IMG_PVOID pvParam, IMG_UINT32 ui32Param, IMG_BOOL bForceCleanup); +typedef PVRSRV_ERROR (*RESMAN_FREE_FN)(IMG_PVOID pvParam, IMG_UINT32 ui32Param, IMG_BOOL bForceCleanup); typedef struct _RESMAN_ITEM_ *PRESMAN_ITEM; typedef struct _RESMAN_CONTEXT_ *PRESMAN_CONTEXT; @@ -85,18 +85,18 @@ PVRSRV_ERROR ResManInit(IMG_VOID); IMG_VOID ResManDeInit(IMG_VOID); PRESMAN_ITEM ResManRegisterRes(PRESMAN_CONTEXT hResManContext, - IMG_UINT32 ui32ResType, - IMG_PVOID pvParam, - IMG_UINT32 ui32Param, + IMG_UINT32 ui32ResType, + IMG_PVOID pvParam, + IMG_UINT32 ui32Param, RESMAN_FREE_FN pfnFreeResource); PVRSRV_ERROR ResManFreeResByPtr(PRESMAN_ITEM psResItem, IMG_BOOL bForceCleanup); PVRSRV_ERROR ResManFreeResByCriteria(PRESMAN_CONTEXT hResManContext, - IMG_UINT32 ui32SearchCriteria, - IMG_UINT32 ui32ResType, - IMG_PVOID pvParam, + IMG_UINT32 ui32SearchCriteria, + IMG_UINT32 ui32ResType, + IMG_PVOID pvParam, IMG_UINT32 ui32Param); PVRSRV_ERROR ResManDissociateRes(PRESMAN_ITEM psResItem, @@ -114,5 +114,5 @@ IMG_VOID PVRSRVResManDisconnect(PRESMAN_CONTEXT hResManContext, } #endif -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/services_headers.h b/drivers/staging/mrst/pvr/services4/srvkm/include/services_headers.h index c8130d4..09ed87e 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/services_headers.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/services_headers.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -46,5 +46,5 @@ #include "osfunc.h" #include "refcount.h" -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/srvkm.h b/drivers/staging/mrst/pvr/services4/srvkm/include/srvkm.h index f857238..474a1ee 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/srvkm.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/srvkm.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -32,11 +32,11 @@ extern "C" { #endif - + #ifdef PVR_DISABLE_LOGGING #define PVR_LOG(X) #else - + #define PVR_LOG(X) PVRSRVReleasePrintf X; #endif @@ -58,7 +58,7 @@ extern "C" { } #endif - + #define LOOP_UNTIL_TIMEOUT(TIMEOUT) \ {\ IMG_UINT32 uiOffset, uiStart, uiCurrent; \ @@ -75,4 +75,4 @@ extern "C" { IMG_IMPORT const IMG_CHAR *PVRSRVGetErrorStringKM(PVRSRV_ERROR eError); -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/ttrace.h b/drivers/staging/mrst/pvr/services4/srvkm/include/ttrace.h index 65d7bae..9e04b88 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/ttrace.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/ttrace.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -147,7 +147,7 @@ static INLINE IMG_VOID PVRSRVTimeTraceSysPhysAddr(IMG_UINT32 ui32Group, IMG_UINT 1, (IMG_UINT8 *) &psPAddr.uiAddr); } -#else +#else #define PVR_TTRACE(group, class, token) \ ((void) 0) @@ -170,7 +170,7 @@ static INLINE IMG_VOID PVRSRVTimeTraceSysPhysAddr(IMG_UINT32 ui32Group, IMG_UINT #define PVR_TTRACE_SYNC_OBJECT(group, token, syncobj, op) \ ((void) 0) -#endif +#endif IMG_IMPORT PVRSRV_ERROR PVRSRVTimeTraceInit(IMG_VOID); IMG_IMPORT IMG_VOID PVRSRVTimeTraceDeinit(IMG_VOID); @@ -181,4 +181,4 @@ IMG_IMPORT PVRSRV_ERROR PVRSRVTimeTraceBufferCreate(IMG_UINT32 ui32PID); IMG_IMPORT PVRSRV_ERROR PVRSRVTimeTraceBufferDestroy(IMG_UINT32 ui32PID); IMG_IMPORT IMG_VOID PVRSRVDumpTimeTraceBuffers(IMG_VOID); -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/ttrace_common.h b/drivers/staging/mrst/pvr/services4/srvkm/include/ttrace_common.h index dafcbee..5aa6fec 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/ttrace_common.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/ttrace_common.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -81,4 +81,4 @@ #define PVRSRV_TRACE_SYNC_RO2_DEV_VADDR 10 #define PVRSRV_TRACE_TYPE_SYNC_SIZE ((PVRSRV_TRACE_SYNC_RO2_DEV_VADDR + 1) * sizeof(IMG_UINT32)) -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/srvkm/include/ttrace_tokens.h b/drivers/staging/mrst/pvr/services4/srvkm/include/ttrace_tokens.h index 0755016..21ea5fb 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/include/ttrace_tokens.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/include/ttrace_tokens.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -81,4 +81,4 @@ #define MKSYNC_TOKEN_CORE_CLK 1 #define MKSYNC_TOKEN_UKERNEL_CLK 2 -#endif +#endif diff --git a/drivers/staging/mrst/pvr/services4/system/include/syscommon.h b/drivers/staging/mrst/pvr/services4/system/include/syscommon.h index 409b66e..d5e5eef 100644 --- a/drivers/staging/mrst/pvr/services4/system/include/syscommon.h +++ b/drivers/staging/mrst/pvr/services4/system/include/syscommon.h @@ -1,34 +1,34 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ #ifndef _SYSCOMMON_H #define _SYSCOMMON_H -#include "sysconfig.h" -#include "sysinfo.h" +#include "sysconfig.h" +#include "sysinfo.h" #include "servicesint.h" #include "queue.h" #include "power.h" @@ -62,38 +62,38 @@ typedef IMG_UINT32 (*PFN_HTIMER_GETUS) (IMG_HANDLE); typedef IMG_VOID (*PFN_HTIMER_DESTROY) (IMG_HANDLE); typedef struct _SYS_DATA_TAG_ { - IMG_UINT32 ui32NumDevices; + IMG_UINT32 ui32NumDevices; SYS_DEVICE_ID sDeviceID[SYS_DEVICE_COUNT]; - PVRSRV_DEVICE_NODE *psDeviceNodeList; - PVRSRV_POWER_DEV *psPowerDeviceList; - PVRSRV_RESOURCE sPowerStateChangeResource; - PVRSRV_SYS_POWER_STATE eCurrentPowerState; - PVRSRV_SYS_POWER_STATE eFailedPowerState; - IMG_UINT32 ui32CurrentOSPowerState; - PVRSRV_QUEUE_INFO *psQueueList; - PVRSRV_KERNEL_SYNC_INFO *psSharedSyncInfoList; - IMG_PVOID pvEnvSpecificData; - IMG_PVOID pvSysSpecificData; - PVRSRV_RESOURCE sQProcessResource; - IMG_VOID *pvSOCRegsBase; - IMG_HANDLE hSOCTimerRegisterOSMemHandle; - IMG_UINT32 *pvSOCTimerRegisterKM; - IMG_VOID *pvSOCClockGateRegsBase; + PVRSRV_DEVICE_NODE *psDeviceNodeList; + PVRSRV_POWER_DEV *psPowerDeviceList; + PVRSRV_RESOURCE sPowerStateChangeResource; + PVRSRV_SYS_POWER_STATE eCurrentPowerState; + PVRSRV_SYS_POWER_STATE eFailedPowerState; + IMG_UINT32 ui32CurrentOSPowerState; + PVRSRV_QUEUE_INFO *psQueueList; + PVRSRV_KERNEL_SYNC_INFO *psSharedSyncInfoList; + IMG_PVOID pvEnvSpecificData; + IMG_PVOID pvSysSpecificData; + PVRSRV_RESOURCE sQProcessResource; + IMG_VOID *pvSOCRegsBase; + IMG_HANDLE hSOCTimerRegisterOSMemHandle; + IMG_UINT32 *pvSOCTimerRegisterKM; + IMG_VOID *pvSOCClockGateRegsBase; IMG_UINT32 ui32SOCClockGateRegsSize; - + struct _DEVICE_COMMAND_DATA_ *apsDeviceCommandData[SYS_DEVICE_COUNT]; + + RA_ARENA *apsLocalDevMemArena[SYS_MAX_LOCAL_DEVMEM_ARENAS]; - RA_ARENA *apsLocalDevMemArena[SYS_MAX_LOCAL_DEVMEM_ARENAS]; - - IMG_CHAR *pszVersionString; + IMG_CHAR *pszVersionString; #if defined (SUPPORT_SID_INTERFACE) - PVRSRV_EVENTOBJECT_KM *psGlobalEventObject; + PVRSRV_EVENTOBJECT_KM *psGlobalEventObject; #else - PVRSRV_EVENTOBJECT *psGlobalEventObject; + PVRSRV_EVENTOBJECT *psGlobalEventObject; #endif - PVRSRV_MISC_INFO_CPUCACHEOP_TYPE ePendingCacheOpType; + PVRSRV_MISC_INFO_CPUCACHEOP_TYPE ePendingCacheOpType; PFN_HTIMER_CREATE pfnHighResTimerCreate; PFN_HTIMER_GETUS pfnHighResTimerGetus; @@ -134,7 +134,7 @@ PVRSRV_ERROR SysDevicePostPowerState(IMG_UINT32 ui32DeviceIndex, #if defined(SYS_SUPPORTS_SGX_IDLE_CALLBACK) IMG_VOID SysSGXIdleTransition(IMG_BOOL bSGXIdle); -#endif +#endif #if defined(SYS_CUSTOM_POWERLOCK_WRAP) PVRSRV_ERROR SysPowerLockWrap(IMG_BOOL bTryLock); @@ -168,10 +168,10 @@ extern SYS_DATA* gpsSysData; #endif static INLINE IMG_VOID SysAcquireData(SYS_DATA **ppsSysData) { - + *ppsSysData = gpsSysData; - + @@ -184,7 +184,7 @@ static INLINE IMG_VOID SysAcquireData(SYS_DATA **ppsSysData) #endif static INLINE SYS_DATA * SysAcquireDataNoCheck(IMG_VOID) { - + return gpsSysData; } @@ -196,7 +196,7 @@ static INLINE PVRSRV_ERROR SysInitialiseCommon(SYS_DATA *psSysData) { PVRSRV_ERROR eError; - + eError = PVRSRVInit(psSysData); return eError; @@ -207,18 +207,18 @@ static INLINE PVRSRV_ERROR SysInitialiseCommon(SYS_DATA *psSysData) #endif static INLINE IMG_VOID SysDeinitialiseCommon(SYS_DATA *psSysData) { - + PVRSRVDeInit(psSysData); OSDestroyResource(&psSysData->sPowerStateChangeResource); } -#endif +#endif #if !(defined(NO_HARDWARE) && defined(__linux__) && defined(__KERNEL__)) #define SysReadHWReg(p, o) OSReadHWReg(p, o) #define SysWriteHWReg(p, o, v) OSWriteHWReg(p, o, v) -#else +#else static inline IMG_UINT32 SysReadHWReg(IMG_PVOID pvLinRegBaseAddr, IMG_UINT32 ui32Offset) { return (IMG_UINT32) readl(pvLinRegBaseAddr + ui32Offset); @@ -228,7 +228,7 @@ static inline IMG_VOID SysWriteHWReg(IMG_PVOID pvLinRegBaseAddr, IMG_UINT32 ui32 { writel(ui32Value, pvLinRegBaseAddr + ui32Offset); } -#endif +#endif #if defined(__cplusplus) } diff --git a/drivers/staging/mrst/pvr/tools/intern/debug/client/linuxsrv.h b/drivers/staging/mrst/pvr/tools/intern/debug/client/linuxsrv.h index 5a5372e..f1cb02a 100644 --- a/drivers/staging/mrst/pvr/tools/intern/debug/client/linuxsrv.h +++ b/drivers/staging/mrst/pvr/tools/intern/debug/client/linuxsrv.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * **************************************************************************/ @@ -37,12 +37,12 @@ typedef struct tagIOCTL_PACKAGE IMG_UINT32 ui32OutBufferSize; // size of output data buffer } IOCTL_PACKAGE; -IMG_UINT32 DeviceIoControl(IMG_UINT32 hDevice, - IMG_UINT32 ui32ControlCode, - IMG_VOID *pInBuffer, +IMG_UINT32 DeviceIoControl(IMG_UINT32 hDevice, + IMG_UINT32 ui32ControlCode, + IMG_VOID *pInBuffer, IMG_UINT32 ui32InBufferSize, - IMG_VOID *pOutBuffer, - IMG_UINT32 ui32OutBufferSize, - IMG_UINT32 *pui32BytesReturned); + IMG_VOID *pOutBuffer, + IMG_UINT32 ui32OutBufferSize, + IMG_UINT32 *pui32BytesReturned); #endif /* _LINUXSRV_H__*/ diff --git a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/dbgdriv.c b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/dbgdriv.c index f8f635f..386aca4 100644 --- a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/dbgdriv.c +++ b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/dbgdriv.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -121,7 +121,7 @@ DBGKM_CONNECT_NOTIFIER g_fnDBGKMNotifier; IMG_VOID IMG_CALLCONV ExtDBGDrivSetConnectNotifier(DBGKM_CONNECT_NOTIFIER fn_notifier) { - + g_fnDBGKMNotifier = fn_notifier; } @@ -129,12 +129,12 @@ IMG_VOID * IMG_CALLCONV ExtDBGDrivCreateStream(IMG_CHAR * pszName, IMG_UINT32 ui { IMG_VOID * pvRet; - + HostAquireMutex(g_pvAPIMutex); pvRet=DBGDrivCreateStream(pszName, ui32CapMode, ui32OutMode, ui32Flags, ui32Size); - + HostReleaseMutex(g_pvAPIMutex); return pvRet; @@ -142,12 +142,12 @@ IMG_VOID * IMG_CALLCONV ExtDBGDrivCreateStream(IMG_CHAR * pszName, IMG_UINT32 ui void IMG_CALLCONV ExtDBGDrivDestroyStream(PDBG_STREAM psStream) { - + HostAquireMutex(g_pvAPIMutex); DBGDrivDestroyStream(psStream); - + HostReleaseMutex(g_pvAPIMutex); return; @@ -157,7 +157,7 @@ IMG_VOID * IMG_CALLCONV ExtDBGDrivFindStream(IMG_CHAR * pszName, IMG_BOOL bReset { IMG_VOID * pvRet; - + HostAquireMutex(g_pvAPIMutex); pvRet=DBGDrivFindStream(pszName, bResetStream); @@ -168,9 +168,9 @@ IMG_VOID * IMG_CALLCONV ExtDBGDrivFindStream(IMG_CHAR * pszName, IMG_BOOL bReset else { PVR_DPF((PVR_DBG_ERROR, "pfnConnectNotifier not initialised.\n")); - } - + } + HostReleaseMutex(g_pvAPIMutex); return pvRet; @@ -180,12 +180,12 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivWriteString(PDBG_STREAM psStream,IMG_CHAR * ps { IMG_UINT32 ui32Ret; - + HostAquireMutex(g_pvAPIMutex); ui32Ret=DBGDrivWriteString(psStream, pszString, ui32Level); - + HostReleaseMutex(g_pvAPIMutex); return ui32Ret; @@ -195,12 +195,12 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivReadString(PDBG_STREAM psStream,IMG_CHAR * psz { IMG_UINT32 ui32Ret; - + HostAquireMutex(g_pvAPIMutex); ui32Ret=DBGDrivReadString(psStream, pszString, ui32Limit); - + HostReleaseMutex(g_pvAPIMutex); return ui32Ret; @@ -210,12 +210,12 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivWrite(PDBG_STREAM psStream,IMG_UINT8 * pui8InB { IMG_UINT32 ui32Ret; - + HostAquireMutex(g_pvAPIMutex); ui32Ret=DBGDrivWrite(psStream, pui8InBuf, ui32InBuffSize, ui32Level); - + HostReleaseMutex(g_pvAPIMutex); return ui32Ret; @@ -225,12 +225,12 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivRead(PDBG_STREAM psStream, IMG_BOOL bReadInitB { IMG_UINT32 ui32Ret; - + HostAquireMutex(g_pvAPIMutex); ui32Ret=DBGDrivRead(psStream, bReadInitBuffer, ui32OutBuffSize, pui8OutBuf); - + HostReleaseMutex(g_pvAPIMutex); return ui32Ret; @@ -238,12 +238,12 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivRead(PDBG_STREAM psStream, IMG_BOOL bReadInitB void IMG_CALLCONV ExtDBGDrivSetCaptureMode(PDBG_STREAM psStream,IMG_UINT32 ui32Mode,IMG_UINT32 ui32Start,IMG_UINT32 ui32End,IMG_UINT32 ui32SampleRate) { - + HostAquireMutex(g_pvAPIMutex); DBGDrivSetCaptureMode(psStream, ui32Mode, ui32Start, ui32End, ui32SampleRate); - + HostReleaseMutex(g_pvAPIMutex); return; @@ -251,12 +251,12 @@ void IMG_CALLCONV ExtDBGDrivSetCaptureMode(PDBG_STREAM psStream,IMG_UINT32 ui32M void IMG_CALLCONV ExtDBGDrivSetOutputMode(PDBG_STREAM psStream,IMG_UINT32 ui32OutMode) { - + HostAquireMutex(g_pvAPIMutex); DBGDrivSetOutputMode(psStream, ui32OutMode); - + HostReleaseMutex(g_pvAPIMutex); return; @@ -264,12 +264,12 @@ void IMG_CALLCONV ExtDBGDrivSetOutputMode(PDBG_STREAM psStream,IMG_UINT32 ui32Ou void IMG_CALLCONV ExtDBGDrivSetDebugLevel(PDBG_STREAM psStream,IMG_UINT32 ui32DebugLevel) { - + HostAquireMutex(g_pvAPIMutex); DBGDrivSetDebugLevel(psStream, ui32DebugLevel); - + HostReleaseMutex(g_pvAPIMutex); return; @@ -277,12 +277,12 @@ void IMG_CALLCONV ExtDBGDrivSetDebugLevel(PDBG_STREAM psStream,IMG_UINT32 ui32De void IMG_CALLCONV ExtDBGDrivSetFrame(PDBG_STREAM psStream,IMG_UINT32 ui32Frame) { - + HostAquireMutex(g_pvAPIMutex); DBGDrivSetFrame(psStream, ui32Frame); - + HostReleaseMutex(g_pvAPIMutex); return; @@ -292,12 +292,12 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivGetFrame(PDBG_STREAM psStream) { IMG_UINT32 ui32Ret; - + HostAquireMutex(g_pvAPIMutex); ui32Ret=DBGDrivGetFrame(psStream); - + HostReleaseMutex(g_pvAPIMutex); return ui32Ret; @@ -307,12 +307,12 @@ IMG_BOOL IMG_CALLCONV ExtDBGDrivIsLastCaptureFrame(PDBG_STREAM psStream) { IMG_BOOL bRet; - + HostAquireMutex(g_pvAPIMutex); bRet = DBGDrivIsLastCaptureFrame(psStream); - + HostReleaseMutex(g_pvAPIMutex); return bRet; @@ -322,12 +322,12 @@ IMG_BOOL IMG_CALLCONV ExtDBGDrivIsCaptureFrame(PDBG_STREAM psStream, IMG_BOOL bC { IMG_BOOL bRet; - + HostAquireMutex(g_pvAPIMutex); bRet = DBGDrivIsCaptureFrame(psStream, bCheckPreviousFrame); - + HostReleaseMutex(g_pvAPIMutex); return bRet; @@ -335,12 +335,12 @@ IMG_BOOL IMG_CALLCONV ExtDBGDrivIsCaptureFrame(PDBG_STREAM psStream, IMG_BOOL bC void IMG_CALLCONV ExtDBGDrivOverrideMode(PDBG_STREAM psStream,IMG_UINT32 ui32Mode) { - + HostAquireMutex(g_pvAPIMutex); DBGDrivOverrideMode(psStream, ui32Mode); - + HostReleaseMutex(g_pvAPIMutex); return; @@ -348,12 +348,12 @@ void IMG_CALLCONV ExtDBGDrivOverrideMode(PDBG_STREAM psStream,IMG_UINT32 ui32Mod void IMG_CALLCONV ExtDBGDrivDefaultMode(PDBG_STREAM psStream) { - + HostAquireMutex(g_pvAPIMutex); DBGDrivDefaultMode(psStream); - + HostReleaseMutex(g_pvAPIMutex); return; @@ -363,12 +363,12 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivWrite2(PDBG_STREAM psStream,IMG_UINT8 * pui8In { IMG_UINT32 ui32Ret; - + HostAquireMutex(g_pvAPIMutex); ui32Ret=DBGDrivWrite2(psStream, pui8InBuf, ui32InBuffSize, ui32Level); - + HostReleaseMutex(g_pvAPIMutex); return ui32Ret; @@ -378,7 +378,7 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivWritePersist(PDBG_STREAM psStream,IMG_UINT8 *p { IMG_UINT32 ui32Ret; - + HostAquireMutex(g_pvAPIMutex); ui32Ret=DBGDrivWritePersist(psStream, pui8InBuf, ui32InBuffSize, ui32Level); @@ -387,7 +387,7 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivWritePersist(PDBG_STREAM psStream,IMG_UINT8 *p PVR_DPF((PVR_DBG_ERROR, "An error occurred in DBGDrivWritePersist.")); } - + HostReleaseMutex(g_pvAPIMutex); return ui32Ret; @@ -397,12 +397,12 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivWriteStringCM(PDBG_STREAM psStream,IMG_CHAR * { IMG_UINT32 ui32Ret; - + HostAquireMutex(g_pvAPIMutex); ui32Ret=DBGDrivWriteStringCM(psStream, pszString, ui32Level); - + HostReleaseMutex(g_pvAPIMutex); return ui32Ret; @@ -411,26 +411,26 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivWriteStringCM(PDBG_STREAM psStream,IMG_CHAR * IMG_UINT32 IMG_CALLCONV ExtDBGDrivWriteCM(PDBG_STREAM psStream,IMG_UINT8 * pui8InBuf,IMG_UINT32 ui32InBuffSize,IMG_UINT32 ui32Level) { IMG_UINT32 ui32Ret; - - + + HostAquireMutex(g_pvAPIMutex); - + ui32Ret=DBGDrivWriteCM(psStream, pui8InBuf, ui32InBuffSize, ui32Level); - - + + HostReleaseMutex(g_pvAPIMutex); - + return ui32Ret; } void IMG_CALLCONV ExtDBGDrivSetMarker(PDBG_STREAM psStream, IMG_UINT32 ui32Marker) { - + HostAquireMutex(g_pvAPIMutex); DBGDrivSetMarker(psStream, ui32Marker); - + HostReleaseMutex(g_pvAPIMutex); return; @@ -440,12 +440,12 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivGetMarker(PDBG_STREAM psStream) { IMG_UINT32 ui32Marker; - + HostAquireMutex(g_pvAPIMutex); ui32Marker = DBGDrivGetMarker(psStream); - + HostReleaseMutex(g_pvAPIMutex); return ui32Marker; @@ -455,12 +455,12 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivWriteLF(PDBG_STREAM psStream, IMG_UINT8 * pui8 { IMG_UINT32 ui32Ret; - + HostAquireMutex(g_pvAPIMutex); ui32Ret = DBGDrivWriteLF(psStream, pui8InBuf, ui32InBuffSize, ui32Level, ui32Flags); - + HostReleaseMutex(g_pvAPIMutex); return ui32Ret; @@ -470,12 +470,12 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivReadLF(PDBG_STREAM psStream, IMG_UINT32 ui32Ou { IMG_UINT32 ui32Ret; - + HostAquireMutex(g_pvAPIMutex); ui32Ret = DBGDrivReadLF(psStream, ui32OutBuffSize, pui8OutBuf); - + HostReleaseMutex(g_pvAPIMutex); return ui32Ret; @@ -484,12 +484,12 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivReadLF(PDBG_STREAM psStream, IMG_UINT32 ui32Ou IMG_VOID IMG_CALLCONV ExtDBGDrivStartInitPhase(PDBG_STREAM psStream) { - + HostAquireMutex(g_pvAPIMutex); DBGDrivStartInitPhase(psStream); - + HostReleaseMutex(g_pvAPIMutex); return; @@ -497,12 +497,12 @@ IMG_VOID IMG_CALLCONV ExtDBGDrivStartInitPhase(PDBG_STREAM psStream) IMG_VOID IMG_CALLCONV ExtDBGDrivStopInitPhase(PDBG_STREAM psStream) { - + HostAquireMutex(g_pvAPIMutex); DBGDrivStopInitPhase(psStream); - + HostReleaseMutex(g_pvAPIMutex); return; @@ -512,12 +512,12 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivGetStreamOffset(PDBG_STREAM psStream) { IMG_UINT32 ui32Ret; - + HostAquireMutex(g_pvAPIMutex); ui32Ret = DBGDrivGetStreamOffset(psStream); - + HostReleaseMutex(g_pvAPIMutex); return ui32Ret; @@ -525,12 +525,12 @@ IMG_UINT32 IMG_CALLCONV ExtDBGDrivGetStreamOffset(PDBG_STREAM psStream) IMG_VOID IMG_CALLCONV ExtDBGDrivSetStreamOffset(PDBG_STREAM psStream, IMG_UINT32 ui32StreamOffset) { - + HostAquireMutex(g_pvAPIMutex); DBGDrivSetStreamOffset(psStream, ui32StreamOffset); - + HostReleaseMutex(g_pvAPIMutex); } @@ -538,9 +538,9 @@ IMG_VOID IMG_CALLCONV ExtDBGDrivWaitForEvent(DBG_EVENT eEvent) { #if defined(SUPPORT_DBGDRV_EVENT_OBJECTS) DBGDrivWaitForEvent(eEvent); -#else - PVR_UNREFERENCED_PARAMETER(eEvent); -#endif +#else + PVR_UNREFERENCED_PARAMETER(eEvent); +#endif } IMG_UINT32 AtoI(IMG_CHAR *szIn) @@ -552,19 +552,19 @@ IMG_UINT32 AtoI(IMG_CHAR *szIn) IMG_INT iPos; IMG_CHAR bc; - + while (szIn[iLen] > 0) { iLen ++; } - + if (iLen == 0) { return (0); } - + iPos=0; while (szIn[iPos] == '0') { @@ -580,22 +580,22 @@ IMG_UINT32 AtoI(IMG_CHAR *szIn) szIn[iPos]='0'; } - + for (iPos = iLen - 1; iPos >= 0; iPos --) { bc = szIn[iPos]; - if ( (bc >= 'a') && (bc <= 'f') && ui32Base == 16) + if ( (bc >= 'a') && (bc <= 'f') && ui32Base == 16) { bc -= 'a' - 0xa; } else - if ( (bc >= 'A') && (bc <= 'F') && ui32Base == 16) + if ( (bc >= 'A') && (bc <= 'F') && ui32Base == 16) { bc -= 'A' - 0xa; } else - if ((bc >= '0') && (bc <= '9')) + if ((bc >= '0') && (bc <= '9')) { bc -= '0'; } @@ -657,34 +657,34 @@ static IMG_BOOL StreamValidForWrite(PDBG_STREAM psStream) static void Write(PDBG_STREAM psStream,IMG_PUINT8 pui8Data,IMG_UINT32 ui32InBuffSize) { - + if (!psStream->bCircularAllowed) { - + } if ((psStream->ui32WPtr + ui32InBuffSize) > psStream->ui32Size) { - + IMG_UINT32 ui32B1 = psStream->ui32Size - psStream->ui32WPtr; IMG_UINT32 ui32B2 = ui32InBuffSize - ui32B1; - + HostMemCopy((IMG_PVOID)((IMG_UINTPTR_T)psStream->pvBase + psStream->ui32WPtr), (IMG_PVOID) pui8Data, ui32B1); - + HostMemCopy(psStream->pvBase, (IMG_PVOID)(pui8Data + ui32B1), ui32B2); - + psStream->ui32WPtr = ui32B2; } else - { + { HostMemCopy((IMG_PVOID)((IMG_UINTPTR_T)psStream->pvBase + psStream->ui32WPtr), (IMG_PVOID) pui8Data, ui32InBuffSize); @@ -714,7 +714,7 @@ void MonoOut(IMG_CHAR * pszString,IMG_BOOL bNewLine) pScreen += g_ui32Line * 160; - + i=0; do @@ -733,7 +733,7 @@ void MonoOut(IMG_CHAR * pszString,IMG_BOOL bNewLine) g_ui32Line++; } - + if (g_ui32Line == g_ui32MonoLines) { @@ -743,18 +743,18 @@ void MonoOut(IMG_CHAR * pszString,IMG_BOOL bNewLine) HostMemSet((IMG_VOID *)(DBGDRIV_MONOBASE + (160 * (g_ui32MonoLines - 1))),0,160); } -#endif +#endif } static IMG_UINT32 WriteExpandingBuffer(PDBG_STREAM psStream,IMG_UINT8 * pui8InBuf,IMG_UINT32 ui32InBuffSize) { IMG_UINT ui32Space; - + ui32Space = SpaceInStream(psStream); - + if ((psStream->psCtrl->ui32OutMode & DEBUG_OUTMODE_STREAMENABLE) == 0) { @@ -762,11 +762,11 @@ static IMG_UINT32 WriteExpandingBuffer(PDBG_STREAM psStream,IMG_UINT8 * pui8InBu return(0); } - + if (psStream->psCtrl->ui32Flags & DEBUG_FLAGS_NO_BUF_EXPANDSION) { - + if (ui32Space < 32) @@ -781,7 +781,7 @@ static IMG_UINT32 WriteExpandingBuffer(PDBG_STREAM psStream,IMG_UINT8 * pui8InBu { IMG_UINT32 ui32NewBufSize; - + ui32NewBufSize = 2 * psStream->ui32Size; @@ -793,7 +793,7 @@ static IMG_UINT32 WriteExpandingBuffer(PDBG_STREAM psStream,IMG_UINT8 * pui8InBu ui32NewBufSize += ui32InBuffSize; } - + if (!ExpandStreamBuffer(psStream,ui32NewBufSize)) { @@ -805,7 +805,7 @@ static IMG_UINT32 WriteExpandingBuffer(PDBG_STREAM psStream,IMG_UINT8 * pui8InBu } else { - + PVR_DPF((PVR_DBG_ERROR, "WriteExpandingBuffer: Unable to expand %x. Out of memory.", (IMG_UINTPTR_T) psStream)); InvalidateAllStreams(); return (0xFFFFFFFFUL); @@ -813,7 +813,7 @@ static IMG_UINT32 WriteExpandingBuffer(PDBG_STREAM psStream,IMG_UINT8 * pui8InBu } } - + ui32Space = SpaceInStream(psStream); PVR_DPF((PVR_DBGDRIV_MESSAGE, "Expanded buffer, free space = %x", @@ -821,14 +821,14 @@ static IMG_UINT32 WriteExpandingBuffer(PDBG_STREAM psStream,IMG_UINT8 * pui8InBu } } - + if (ui32Space <= (ui32InBuffSize + 4)) { ui32InBuffSize = ui32Space - 4; } - + Write(psStream,pui8InBuf,ui32InBuffSize); @@ -852,11 +852,11 @@ IMG_VOID * IMG_CALLCONV DBGDrivCreateStream(IMG_CHAR * pszName, PDBG_LASTFRAME_BUFFER psLFBuffer; PDBG_STREAM_CONTROL psCtrl; IMG_UINT32 ui32Off; - IMG_VOID * pvBase; + IMG_VOID * pvBase; static IMG_CHAR pszNameInitSuffix[] = "_Init"; IMG_UINT32 ui32OffSuffix; - + psStream = (PDBG_STREAM) DBGDrivFindStream(pszName, IMG_FALSE); @@ -866,7 +866,7 @@ IMG_VOID * IMG_CALLCONV DBGDrivCreateStream(IMG_CHAR * pszName, return ((IMG_VOID *) psStream); } - + psStream = HostNonPageablePageAlloc(1); psInitStream = HostNonPageablePageAlloc(1); @@ -883,7 +883,7 @@ IMG_VOID * IMG_CALLCONV DBGDrivCreateStream(IMG_CHAR * pszName, return((IMG_VOID *) 0); } - + if ((ui32Flags & DEBUG_FLAGS_USE_NONPAGED_MEM) != 0) { pvBase = HostNonPageablePageAlloc(ui32Size); @@ -900,7 +900,7 @@ IMG_VOID * IMG_CALLCONV DBGDrivCreateStream(IMG_CHAR * pszName, return((IMG_VOID *) 0); } - + psCtrl->ui32Flags = ui32Flags; psCtrl->ui32CapMode = ui32CapMode; psCtrl->ui32OutMode = ui32OutMode; @@ -912,7 +912,7 @@ IMG_VOID * IMG_CALLCONV DBGDrivCreateStream(IMG_CHAR * pszName, psCtrl->ui32SampleRate = 1; psCtrl->bInitPhaseComplete = IMG_FALSE; - + psStream->psNext = 0; psStream->pvBase = pvBase; @@ -924,10 +924,10 @@ IMG_VOID * IMG_CALLCONV DBGDrivCreateStream(IMG_CHAR * pszName, psStream->ui32Marker = 0; psStream->bCircularAllowed = IMG_TRUE; psStream->ui32InitPhaseWOff = 0; + - - + if ((ui32Flags & DEBUG_FLAGS_USE_NONPAGED_MEM) != 0) { pvBase = HostNonPageablePageAlloc(ui32Size); @@ -940,7 +940,7 @@ IMG_VOID * IMG_CALLCONV DBGDrivCreateStream(IMG_CHAR * pszName, if (!pvBase) { PVR_DPF((PVR_DBG_ERROR,"DBGDriv: Couldn't alloc InitStream buffer\n\r")); - + if ((psStream->psCtrl->ui32Flags & DEBUG_FLAGS_USE_NONPAGED_MEM) != 0) { HostNonPageablePageFree(psStream->pvBase); @@ -953,7 +953,7 @@ IMG_VOID * IMG_CALLCONV DBGDrivCreateStream(IMG_CHAR * pszName, return((IMG_VOID *) 0); } - + psInitStream->psNext = 0; psInitStream->pvBase = pvBase; psInitStream->psCtrl = psCtrl; @@ -964,12 +964,12 @@ IMG_VOID * IMG_CALLCONV DBGDrivCreateStream(IMG_CHAR * pszName, psInitStream->ui32Marker = 0; psInitStream->bCircularAllowed = IMG_FALSE; psInitStream->ui32InitPhaseWOff = 0; - + psStream->psInitStream = psInitStream; - + psLFBuffer->psStream = psStream; psLFBuffer->ui32BufLen = 0UL; @@ -977,7 +977,7 @@ IMG_VOID * IMG_CALLCONV DBGDrivCreateStream(IMG_CHAR * pszName, g_ui32HotkeyMiddumpStart = 0xffffffffUL; g_ui32HotkeyMiddumpEnd = 0xffffffffUL; - + ui32Off = 0; @@ -988,9 +988,9 @@ IMG_VOID * IMG_CALLCONV DBGDrivCreateStream(IMG_CHAR * pszName, ui32Off++; } while ((pszName[ui32Off] != 0) && (ui32Off < (4096UL - sizeof(DBG_STREAM)))); - psStream->szName[ui32Off] = pszName[ui32Off]; - + psStream->szName[ui32Off] = pszName[ui32Off]; + ui32OffSuffix = 0; do @@ -1001,9 +1001,9 @@ IMG_VOID * IMG_CALLCONV DBGDrivCreateStream(IMG_CHAR * pszName, } while ( (pszNameInitSuffix[ui32OffSuffix] != 0) && (ui32Off < (4096UL - sizeof(DBG_STREAM)))); - psInitStream->szName[ui32Off] = pszNameInitSuffix[ui32OffSuffix]; - + psInitStream->szName[ui32Off] = pszNameInitSuffix[ui32OffSuffix]; + psStream->psNext = g_psStreamList; g_psStreamList = psStream; @@ -1012,7 +1012,7 @@ IMG_VOID * IMG_CALLCONV DBGDrivCreateStream(IMG_CHAR * pszName, g_psLFBufferList = psLFBuffer; AddSIDEntry(psStream); - + return((IMG_VOID *) psStream); } @@ -1026,7 +1026,7 @@ void IMG_CALLCONV DBGDrivDestroyStream(PDBG_STREAM psStream) PVR_DPF((PVR_DBG_MESSAGE, "DBGDriv: Destroying stream %s\r\n", psStream->szName )); - + if (!StreamValid(psStream)) { @@ -1034,10 +1034,10 @@ void IMG_CALLCONV DBGDrivDestroyStream(PDBG_STREAM psStream) } RemoveSIDEntry(psStream); - + psLFBuffer = FindLFBuf(psStream); - + psStreamThis = g_psStreamList; psStreamPrev = 0; @@ -1088,14 +1088,14 @@ void IMG_CALLCONV DBGDrivDestroyStream(PDBG_STREAM psStream) psLFThis = psLFThis->psNext; } } - + if (psStream->psCtrl->ui32CapMode & DEBUG_CAPMODE_HOTKEY) { DeactivateHotKeys(); } - + if ((psStream->psCtrl->ui32Flags & DEBUG_FLAGS_USE_NONPAGED_MEM) != 0) { @@ -1109,7 +1109,7 @@ void IMG_CALLCONV DBGDrivDestroyStream(PDBG_STREAM psStream) HostPageablePageFree(psStream->pvBase); HostPageablePageFree(psStream->psInitStream->pvBase); } - + HostNonPageablePageFree(psStream->psInitStream); HostNonPageablePageFree(psStream); HostNonPageablePageFree(psLFBuffer); @@ -1135,7 +1135,7 @@ IMG_VOID * IMG_CALLCONV DBGDrivFindStream(IMG_CHAR * pszName, IMG_BOOL bResetStr pszName, (bResetStream == IMG_TRUE) ? "with reset" : "no reset")); - + for (psThis = g_psStreamList; psThis != IMG_NULL; psThis = psThis->psNext) { @@ -1183,8 +1183,8 @@ IMG_VOID * IMG_CALLCONV DBGDrivFindStream(IMG_CHAR * pszName, IMG_BOOL bResetStr } { - - + + psStream->psInitStream->ui32InitPhaseWOff = psStream->psInitStream->ui32WPtr; PVR_DPF((PVR_DBGDRIV_MESSAGE, "Set %s client marker bo %x, total bw %x", psStream->szName, @@ -1203,20 +1203,20 @@ static void IMG_CALLCONV DBGDrivInvalidateStream(PDBG_STREAM psStream) IMG_UINT32 ui32Off = 0; IMG_UINT32 ui32WPtr = psStream->ui32WPtr; IMG_PUINT8 pui8Buffer = (IMG_UINT8 *) psStream->pvBase; - + PVR_DPF((PVR_DBG_ERROR, "DBGDrivInvalidateStream: An error occurred for stream %s\r\n", psStream->szName )); + + - - - + ui32Space = SpaceInStream(psStream); - + if(ui32Space > 0) { ui32Space--; @@ -1235,7 +1235,7 @@ static void IMG_CALLCONV DBGDrivInvalidateStream(PDBG_STREAM psStream) pui8Buffer[ui32WPtr++] = '\0'; psStream->ui32WPtr = ui32WPtr; - + psStream->psCtrl->ui32Flags |= DEBUG_FLAGS_READONLY; } @@ -1254,14 +1254,14 @@ static IMG_VOID InvalidateAllStreams(IMG_VOID) IMG_UINT32 IMG_CALLCONV DBGDrivWriteStringCM(PDBG_STREAM psStream,IMG_CHAR * pszString,IMG_UINT32 ui32Level) { - + if (!StreamValidForWrite(psStream)) { return(0xFFFFFFFFUL); } - + if (psStream->psCtrl->ui32CapMode & DEBUG_CAPMODE_FRAMED) { @@ -1292,21 +1292,21 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWriteString(PDBG_STREAM psStream,IMG_CHAR * pszSt IMG_UINT32 ui32WPtr; IMG_UINT8 * pui8Buffer; - + if (!StreamValidForWrite(psStream)) { return(0xFFFFFFFFUL); } - + if ((psStream->psCtrl->ui32DebugLevel & ui32Level) == 0) { return(0xFFFFFFFFUL); } - + if ((psStream->psCtrl->ui32OutMode & DEBUG_OUTMODE_ASYNC) == 0) @@ -1316,7 +1316,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWriteString(PDBG_STREAM psStream,IMG_CHAR * pszSt PVR_DPF((PVR_DBG_MESSAGE,"%s: %s\r\n",psStream->szName, pszString)); } - + if (psStream->psCtrl->ui32OutMode & DEBUG_OUTMODE_MONO) { @@ -1326,7 +1326,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWriteString(PDBG_STREAM psStream,IMG_CHAR * pszSt } } - + if ( !( @@ -1338,11 +1338,11 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWriteString(PDBG_STREAM psStream,IMG_CHAR * pszSt return(0xFFFFFFFFUL); } - + ui32Space=SpaceInStream(psStream); - + if(ui32Space > 0) { ui32Space--; @@ -1365,7 +1365,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWriteString(PDBG_STREAM psStream,IMG_CHAR * pszSt if (ui32Len < ui32Space) { - + pui8Buffer[ui32WPtr] = (IMG_UINT8)pszString[ui32Len]; ui32Len++; ui32WPtr++; @@ -1374,7 +1374,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWriteString(PDBG_STREAM psStream,IMG_CHAR * pszSt ui32WPtr = 0; } - + psStream->ui32WPtr = ui32WPtr; psStream->ui32DataWritten+= ui32Len; } else @@ -1399,14 +1399,14 @@ IMG_UINT32 IMG_CALLCONV DBGDrivReadString(PDBG_STREAM psStream,IMG_CHAR * pszStr IMG_UINT32 ui32Offset; IMG_UINT8 *pui8Buff; - + if (!StreamValidForRead(psStream)) { return(0); } - + pui8Buff = (IMG_UINT8 *)psStream->pvBase; ui32Offset = psStream->ui32RPtr; @@ -1416,7 +1416,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivReadString(PDBG_STREAM psStream,IMG_CHAR * pszStr return(0); } - + ui32Len = 0; while((pui8Buff[ui32Offset] != 0) && (ui32Offset != psStream->ui32WPtr)) @@ -1424,7 +1424,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivReadString(PDBG_STREAM psStream,IMG_CHAR * pszStr ui32Offset++; ui32Len++; - + if (ui32Offset == psStream->ui32Size) { @@ -1434,14 +1434,14 @@ IMG_UINT32 IMG_CALLCONV DBGDrivReadString(PDBG_STREAM psStream,IMG_CHAR * pszStr ui32OutLen = ui32Len + 1; - + if (ui32Len > ui32Limit) { return(0); } - + ui32Offset = psStream->ui32RPtr; ui32Len = 0; @@ -1452,7 +1452,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivReadString(PDBG_STREAM psStream,IMG_CHAR * pszStr ui32Offset++; ui32Len++; - + if (ui32Offset == psStream->ui32Size) { @@ -1477,27 +1477,27 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWrite(PDBG_STREAM psMainStream,IMG_UINT8 * pui8In IMG_UINT32 ui32Space; DBG_STREAM *psStream; - + if (!StreamValidForWrite(psMainStream)) { return(0xFFFFFFFFUL); } - + if ((psMainStream->psCtrl->ui32DebugLevel & ui32Level) == 0) { return(0xFFFFFFFFUL); } - + if (psMainStream->psCtrl->ui32CapMode & DEBUG_CAPMODE_FRAMED) { if ((psMainStream->psCtrl->ui32Flags & DEBUG_FLAGS_ENABLESAMPLE) == 0) { - + return(ui32InBuffSize); } } @@ -1505,7 +1505,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWrite(PDBG_STREAM psMainStream,IMG_UINT8 * pui8In { if ((psMainStream->psCtrl->ui32Current != g_ui32HotKeyFrame) || (g_bHotKeyPressed == IMG_FALSE)) { - + return(ui32InBuffSize); } } @@ -1519,7 +1519,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWrite(PDBG_STREAM psMainStream,IMG_UINT8 * pui8In psStream = psMainStream->psInitStream; } - + ui32Space=SpaceInStream(psStream); @@ -1529,7 +1529,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWrite(PDBG_STREAM psMainStream,IMG_UINT8 * pui8In psStream->ui32RPtr, psStream->ui32WPtr)); - + if ((psStream->psCtrl->ui32OutMode & DEBUG_OUTMODE_STREAMENABLE) == 0) { @@ -1543,14 +1543,14 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWrite(PDBG_STREAM psMainStream,IMG_UINT8 * pui8In return(0); } - + if (ui32Space <= (ui32InBuffSize + 4)) { ui32InBuffSize = ui32Space - 8; } - + Write(psStream,(IMG_UINT8 *) &ui32InBuffSize,4); Write(psStream,pui8InBuf,ui32InBuffSize); @@ -1566,20 +1566,20 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWrite(PDBG_STREAM psMainStream,IMG_UINT8 * pui8In IMG_UINT32 IMG_CALLCONV DBGDrivWriteCM(PDBG_STREAM psStream,IMG_UINT8 * pui8InBuf,IMG_UINT32 ui32InBuffSize,IMG_UINT32 ui32Level) { - + if (!StreamValidForWrite(psStream)) { return(0xFFFFFFFFUL); } - + if (psStream->psCtrl->ui32CapMode & DEBUG_CAPMODE_FRAMED) { if ((psStream->psCtrl->ui32Flags & DEBUG_FLAGS_ENABLESAMPLE) == 0) { - + return(ui32InBuffSize); } } @@ -1589,7 +1589,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWriteCM(PDBG_STREAM psStream,IMG_UINT8 * pui8InBu { if ((psStream->psCtrl->ui32Current != g_ui32HotKeyFrame) || (g_bHotKeyPressed == IMG_FALSE)) { - + return(ui32InBuffSize); } } @@ -1604,14 +1604,14 @@ static IMG_UINT32 DBGDrivWritePersist(PDBG_STREAM psMainStream,IMG_UINT8 * pui8I DBG_STREAM *psStream; PVR_UNREFERENCED_PARAMETER(ui32Level); - + if (!StreamValidForWrite(psMainStream)) { return(0xFFFFFFFFUL); } - + psStream = psMainStream->psInitStream; if(psStream->bCircularAllowed == IMG_TRUE) { @@ -1632,7 +1632,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWrite2(PDBG_STREAM psMainStream,IMG_UINT8 * pui8I { DBG_STREAM *psStream; - + if (!StreamValidForWrite(psMainStream)) { @@ -1640,7 +1640,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWrite2(PDBG_STREAM psMainStream,IMG_UINT8 * pui8I return(0xFFFFFFFFUL); } - + if ((psMainStream->psCtrl->ui32DebugLevel & ui32Level) == 0) { @@ -1670,7 +1670,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivRead(PDBG_STREAM psMainStream, IMG_BOOL bReadInit IMG_UINT32 ui32Data; DBG_STREAM *psStream; - + if (!StreamValidForRead(psMainStream)) { @@ -1687,7 +1687,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivRead(PDBG_STREAM psMainStream, IMG_BOOL bReadInit psStream = psMainStream; } - + if (psStream->ui32RPtr == psStream->ui32WPtr || ((psStream->ui32InitPhaseWOff > 0) && (psStream->ui32RPtr >= psStream->ui32InitPhaseWOff)) ) @@ -1695,7 +1695,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivRead(PDBG_STREAM psMainStream, IMG_BOOL bReadInit return(0); } - + if (psStream->ui32RPtr <= psStream->ui32WPtr) { @@ -1706,7 +1706,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivRead(PDBG_STREAM psMainStream, IMG_BOOL bReadInit ui32Data = psStream->ui32WPtr + (psStream->ui32Size - psStream->ui32RPtr); } - + if ((psStream->ui32InitPhaseWOff > 0) && (psStream->ui32InitPhaseWOff < psStream->ui32WPtr)) @@ -1714,7 +1714,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivRead(PDBG_STREAM psMainStream, IMG_BOOL bReadInit ui32Data = psStream->ui32InitPhaseWOff - psStream->ui32RPtr; } - + if (ui32Data > ui32OutBuffSize) { @@ -1727,36 +1727,36 @@ IMG_UINT32 IMG_CALLCONV DBGDrivRead(PDBG_STREAM psMainStream, IMG_BOOL bReadInit psStream->ui32RPtr, psStream->ui32WPtr)); - + if ((psStream->ui32RPtr + ui32Data) > psStream->ui32Size) - { + { IMG_UINT32 ui32B1 = psStream->ui32Size - psStream->ui32RPtr; IMG_UINT32 ui32B2 = ui32Data - ui32B1; - + HostMemCopy((IMG_VOID *) pui8OutBuf, (IMG_VOID *)((IMG_UINTPTR_T)psStream->pvBase + psStream->ui32RPtr), ui32B1); - + HostMemCopy((IMG_VOID *)(pui8OutBuf + ui32B1), psStream->pvBase, ui32B2); - + psStream->ui32RPtr = ui32B2; } else - { + { HostMemCopy((IMG_VOID *) pui8OutBuf, (IMG_VOID *)((IMG_UINTPTR_T)psStream->pvBase + psStream->ui32RPtr), ui32Data); - + psStream->ui32RPtr += ui32Data; - + if (psStream->ui32RPtr == psStream->ui32Size) { psStream->ui32RPtr = 0; @@ -1768,7 +1768,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivRead(PDBG_STREAM psMainStream, IMG_BOOL bReadInit void IMG_CALLCONV DBGDrivSetCaptureMode(PDBG_STREAM psStream,IMG_UINT32 ui32Mode,IMG_UINT32 ui32Start,IMG_UINT32 ui32End,IMG_UINT32 ui32SampleRate) { - + if (!StreamValid(psStream)) { @@ -1781,7 +1781,7 @@ void IMG_CALLCONV DBGDrivSetCaptureMode(PDBG_STREAM psStream,IMG_UINT32 ui32Mode psStream->psCtrl->ui32End = ui32End; psStream->psCtrl->ui32SampleRate = ui32SampleRate; - + if (psStream->psCtrl->ui32CapMode & DEBUG_CAPMODE_HOTKEY) { @@ -1791,7 +1791,7 @@ void IMG_CALLCONV DBGDrivSetCaptureMode(PDBG_STREAM psStream,IMG_UINT32 ui32Mode void IMG_CALLCONV DBGDrivSetOutputMode(PDBG_STREAM psStream,IMG_UINT32 ui32OutMode) { - + if (!StreamValid(psStream)) { @@ -1803,7 +1803,7 @@ void IMG_CALLCONV DBGDrivSetOutputMode(PDBG_STREAM psStream,IMG_UINT32 ui32OutMo void IMG_CALLCONV DBGDrivSetDebugLevel(PDBG_STREAM psStream,IMG_UINT32 ui32DebugLevel) { - + if (!StreamValid(psStream)) { @@ -1815,7 +1815,7 @@ void IMG_CALLCONV DBGDrivSetDebugLevel(PDBG_STREAM psStream,IMG_UINT32 ui32Debug void IMG_CALLCONV DBGDrivSetFrame(PDBG_STREAM psStream,IMG_UINT32 ui32Frame) { - + if (!StreamValid(psStream)) { @@ -1853,7 +1853,7 @@ void IMG_CALLCONV DBGDrivSetFrame(PDBG_STREAM psStream,IMG_UINT32 ui32Frame) } } - + if (g_bHotKeyRegistered) { g_bHotKeyRegistered = IMG_FALSE; @@ -1862,23 +1862,23 @@ void IMG_CALLCONV DBGDrivSetFrame(PDBG_STREAM psStream,IMG_UINT32 ui32Frame) if (!g_bHotKeyPressed) { - + g_ui32HotKeyFrame = psStream->psCtrl->ui32Current + 2; - + g_bHotKeyPressed = IMG_TRUE; } + - - if (((psStream->psCtrl->ui32CapMode & DEBUG_CAPMODE_FRAMED) != 0) && + if (((psStream->psCtrl->ui32CapMode & DEBUG_CAPMODE_FRAMED) != 0) && ((psStream->psCtrl->ui32CapMode & DEBUG_CAPMODE_HOTKEY) != 0)) { if (!g_bHotkeyMiddump) { - + g_ui32HotkeyMiddumpStart = g_ui32HotKeyFrame + 1; g_ui32HotkeyMiddumpEnd = 0xffffffff; g_bHotkeyMiddump = IMG_TRUE; @@ -1886,7 +1886,7 @@ void IMG_CALLCONV DBGDrivSetFrame(PDBG_STREAM psStream,IMG_UINT32 ui32Frame) } else { - + g_ui32HotkeyMiddumpEnd = g_ui32HotKeyFrame; PVR_DPF((PVR_DBG_MESSAGE,"Turning off sampling\n")); } @@ -1894,7 +1894,7 @@ void IMG_CALLCONV DBGDrivSetFrame(PDBG_STREAM psStream,IMG_UINT32 ui32Frame) } - + if (psStream->psCtrl->ui32Current > g_ui32HotKeyFrame) { @@ -1904,7 +1904,7 @@ void IMG_CALLCONV DBGDrivSetFrame(PDBG_STREAM psStream,IMG_UINT32 ui32Frame) IMG_UINT32 IMG_CALLCONV DBGDrivGetFrame(PDBG_STREAM psStream) { - + if (!StreamValid(psStream)) { @@ -1918,7 +1918,7 @@ IMG_BOOL IMG_CALLCONV DBGDrivIsLastCaptureFrame(PDBG_STREAM psStream) { IMG_UINT32 ui32NextFrame; - + if (!StreamValid(psStream)) { @@ -1940,7 +1940,7 @@ IMG_BOOL IMG_CALLCONV DBGDrivIsCaptureFrame(PDBG_STREAM psStream, IMG_BOOL bChec { IMG_UINT32 ui32FrameShift = bCheckPreviousFrame ? 1UL : 0UL; - + if (!StreamValid(psStream)) { @@ -1949,7 +1949,7 @@ IMG_BOOL IMG_CALLCONV DBGDrivIsCaptureFrame(PDBG_STREAM psStream, IMG_BOOL bChec if (psStream->psCtrl->ui32CapMode & DEBUG_CAPMODE_FRAMED) { - + if (g_bHotkeyMiddump) { if ((psStream->psCtrl->ui32Current >= (g_ui32HotkeyMiddumpStart - ui32FrameShift)) && @@ -1981,7 +1981,7 @@ IMG_BOOL IMG_CALLCONV DBGDrivIsCaptureFrame(PDBG_STREAM psStream, IMG_BOOL bChec void IMG_CALLCONV DBGDrivOverrideMode(PDBG_STREAM psStream,IMG_UINT32 ui32Mode) { - + if (!StreamValid(psStream)) { @@ -1993,7 +1993,7 @@ void IMG_CALLCONV DBGDrivOverrideMode(PDBG_STREAM psStream,IMG_UINT32 ui32Mode) void IMG_CALLCONV DBGDrivDefaultMode(PDBG_STREAM psStream) { - + if (!StreamValid(psStream)) { @@ -2005,7 +2005,7 @@ void IMG_CALLCONV DBGDrivDefaultMode(PDBG_STREAM psStream) IMG_VOID IMG_CALLCONV DBGDrivSetClientMarker(PDBG_STREAM psStream, IMG_UINT32 ui32Marker) { - + if (!StreamValid(psStream)) { @@ -2017,7 +2017,7 @@ IMG_VOID IMG_CALLCONV DBGDrivSetClientMarker(PDBG_STREAM psStream, IMG_UINT32 ui void IMG_CALLCONV DBGDrivSetMarker(PDBG_STREAM psStream, IMG_UINT32 ui32Marker) { - + if (!StreamValid(psStream)) { @@ -2029,7 +2029,7 @@ void IMG_CALLCONV DBGDrivSetMarker(PDBG_STREAM psStream, IMG_UINT32 ui32Marker) IMG_UINT32 IMG_CALLCONV DBGDrivGetMarker(PDBG_STREAM psStream) { - + if (!StreamValid(psStream)) { @@ -2044,7 +2044,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivGetStreamOffset(PDBG_STREAM psMainStream) { PDBG_STREAM psStream; - + if (!StreamValid(psMainStream)) { @@ -2067,7 +2067,7 @@ IMG_VOID IMG_CALLCONV DBGDrivSetStreamOffset(PDBG_STREAM psMainStream, IMG_UINT3 { PDBG_STREAM psStream; - + if (!StreamValid(psMainStream)) { @@ -2098,27 +2098,27 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWriteLF(PDBG_STREAM psStream, IMG_UINT8 * pui8InB { PDBG_LASTFRAME_BUFFER psLFBuffer; - + if (!StreamValidForWrite(psStream)) { return(0xFFFFFFFFUL); } - + if ((psStream->psCtrl->ui32DebugLevel & ui32Level) == 0) { return(0xFFFFFFFFUL); } - + if ((psStream->psCtrl->ui32CapMode & DEBUG_CAPMODE_FRAMED) != 0) { if ((psStream->psCtrl->ui32Flags & DEBUG_FLAGS_ENABLESAMPLE) == 0) { - + return(ui32InBuffSize); } } @@ -2126,7 +2126,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWriteLF(PDBG_STREAM psStream, IMG_UINT8 * pui8InB { if ((psStream->psCtrl->ui32Current != g_ui32HotKeyFrame) || (g_bHotKeyPressed == IMG_FALSE)) { - + return(ui32InBuffSize); } } @@ -2135,7 +2135,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWriteLF(PDBG_STREAM psStream, IMG_UINT8 * pui8InB if (ui32Flags & WRITELF_FLAGS_RESETBUF) { - + ui32InBuffSize = (ui32InBuffSize > LAST_FRAME_BUF_SIZE) ? LAST_FRAME_BUF_SIZE : ui32InBuffSize; HostMemCopy((IMG_VOID *)psLFBuffer->ui8Buffer, (IMG_VOID *)pui8InBuf, ui32InBuffSize); @@ -2143,7 +2143,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivWriteLF(PDBG_STREAM psStream, IMG_UINT8 * pui8InB } else { - + ui32InBuffSize = ((psLFBuffer->ui32BufLen + ui32InBuffSize) > LAST_FRAME_BUF_SIZE) ? (LAST_FRAME_BUF_SIZE - psLFBuffer->ui32BufLen) : ui32InBuffSize; HostMemCopy((IMG_VOID *)(&psLFBuffer->ui8Buffer[psLFBuffer->ui32BufLen]), (IMG_VOID *)pui8InBuf, ui32InBuffSize); @@ -2158,7 +2158,7 @@ IMG_UINT32 IMG_CALLCONV DBGDrivReadLF(PDBG_STREAM psStream, IMG_UINT32 ui32OutBu PDBG_LASTFRAME_BUFFER psLFBuffer; IMG_UINT32 ui32Data; - + if (!StreamValidForRead(psStream)) { @@ -2167,11 +2167,11 @@ IMG_UINT32 IMG_CALLCONV DBGDrivReadLF(PDBG_STREAM psStream, IMG_UINT32 ui32OutBu psLFBuffer = FindLFBuf(psStream); - + ui32Data = (ui32OutBuffSize < psLFBuffer->ui32BufLen) ? ui32OutBuffSize : psLFBuffer->ui32BufLen; - + HostMemCopy((IMG_VOID *)pui8OutBuf, (IMG_VOID *)psLFBuffer->ui8Buffer, ui32Data); @@ -2203,18 +2203,18 @@ IMG_BOOL ExpandStreamBuffer(PDBG_STREAM psStream, IMG_UINT32 ui32NewSize) IMG_UINT32 ui32NewROffset; IMG_UINT32 ui32SpaceInOldBuf; - + if (psStream->ui32Size >= ui32NewSize) { return IMG_FALSE; } - + ui32SpaceInOldBuf = SpaceInStream(psStream); - + ui32NewSizeInPages = ((ui32NewSize + 0xfffUL) & ~0xfffUL) / 4096UL; @@ -2234,12 +2234,12 @@ IMG_BOOL ExpandStreamBuffer(PDBG_STREAM psStream, IMG_UINT32 ui32NewSize) if(psStream->bCircularAllowed) { - + if (psStream->ui32RPtr <= psStream->ui32WPtr) { - + HostMemCopy(pvNewBuf, (IMG_VOID *)((IMG_UINTPTR_T)psStream->pvBase + psStream->ui32RPtr), @@ -2248,16 +2248,16 @@ IMG_BOOL ExpandStreamBuffer(PDBG_STREAM psStream, IMG_UINT32 ui32NewSize) else { IMG_UINT32 ui32FirstCopySize; - - + + ui32FirstCopySize = psStream->ui32Size - psStream->ui32RPtr; - + HostMemCopy(pvNewBuf, (IMG_VOID *)((IMG_UINTPTR_T)psStream->pvBase + psStream->ui32RPtr), ui32FirstCopySize); - - + + HostMemCopy((IMG_VOID *)((IMG_UINTPTR_T)pvNewBuf + ui32FirstCopySize), (IMG_VOID *)(IMG_PBYTE)psStream->pvBase, @@ -2267,17 +2267,17 @@ IMG_BOOL ExpandStreamBuffer(PDBG_STREAM psStream, IMG_UINT32 ui32NewSize) } else { - + HostMemCopy(pvNewBuf, psStream->pvBase, psStream->ui32WPtr); ui32NewROffset = psStream->ui32RPtr; } + - - + ui32NewWOffset = psStream->ui32Size - ui32SpaceInOldBuf; - + if ((psStream->psCtrl->ui32Flags & DEBUG_FLAGS_USE_NONPAGED_MEM) != 0) { @@ -2288,7 +2288,7 @@ IMG_BOOL ExpandStreamBuffer(PDBG_STREAM psStream, IMG_UINT32 ui32NewSize) HostPageablePageFree(psStream->pvBase); } - + psStream->pvBase = pvNewBuf; psStream->ui32RPtr = ui32NewROffset; @@ -2304,7 +2304,7 @@ IMG_UINT32 SpaceInStream(PDBG_STREAM psStream) if (psStream->bCircularAllowed) { - + if (psStream->ui32RPtr > psStream->ui32WPtr) { ui32Space = psStream->ui32RPtr - psStream->ui32WPtr; @@ -2316,7 +2316,7 @@ IMG_UINT32 SpaceInStream(PDBG_STREAM psStream) } else { - + ui32Space = psStream->ui32Size - psStream->ui32WPtr; } diff --git a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/dbgdriv.h b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/dbgdriv.h index dc75f88..2db4843 100644 --- a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/dbgdriv.h +++ b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/dbgdriv.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -82,7 +82,7 @@ IMG_VOID HostMemCopy(IMG_VOID *pvDest,IMG_VOID *pvSrc,IMG_UINT32 ui32Size); IMG_VOID MonoOut(IMG_CHAR * pszString,IMG_BOOL bNewLine); IMG_SID PStream2SID(PDBG_STREAM psStream); -PDBG_STREAM SID2PStream(IMG_SID hStream); +PDBG_STREAM SID2PStream(IMG_SID hStream); IMG_BOOL AddSIDEntry(PDBG_STREAM psStream); IMG_BOOL RemoveSIDEntry(PDBG_STREAM psStream); diff --git a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/dbgdriv_ioctl.h b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/dbgdriv_ioctl.h index 6849249..130c146 100644 --- a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/dbgdriv_ioctl.h +++ b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/dbgdriv_ioctl.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ diff --git a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/handle.c b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/handle.c index 8ba44df..ddffb3f 100644 --- a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/handle.c +++ b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/handle.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -47,7 +47,7 @@ IMG_SID PStream2SID(PDBG_STREAM psStream) { if (psStream == gaSID_Xlat_Table[iIdx].psStream) { - + return (IMG_SID)iIdx+1; } } @@ -59,7 +59,7 @@ IMG_SID PStream2SID(PDBG_STREAM psStream) PDBG_STREAM SID2PStream(IMG_SID hStream) { - + IMG_INT32 iIdx = (IMG_INT32)hStream-1; if (iIdx >= 0 && iIdx < MAX_SID_ENTRIES) @@ -83,13 +83,13 @@ IMG_BOOL AddSIDEntry(PDBG_STREAM psStream) { if (psStream == gaSID_Xlat_Table[iIdx].psStream) { - + return IMG_TRUE; } if (gaSID_Xlat_Table[iIdx].psStream == (PDBG_STREAM)IMG_NULL) { - + gaSID_Xlat_Table[iIdx].psStream = psStream; return IMG_TRUE; } diff --git a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/hostfunc.h b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/hostfunc.h index acfc439..70192fb 100644 --- a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/hostfunc.h +++ b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/hostfunc.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -52,7 +52,7 @@ IMG_INT32 HostCreateEventObjects(IMG_VOID); IMG_VOID HostWaitForEvent(DBG_EVENT eEvent); IMG_VOID HostSignalEvent(DBG_EVENT eEvent); IMG_VOID HostDestroyEventObjects(IMG_VOID); -#endif +#endif #endif diff --git a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/hotkey.c b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/hotkey.c index 2d82b6c..a456fee 100644 --- a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/hotkey.c +++ b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/hotkey.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -50,15 +50,15 @@ PRIVATEHOTKEYDATA g_PrivateHotKeyData; IMG_VOID ReadInHotKeys(IMG_VOID) { - g_PrivateHotKeyData.ui32ScanCode = 0x58; + g_PrivateHotKeyData.ui32ScanCode = 0x58; g_PrivateHotKeyData.ui32ShiftState = 0x0; - + #if 0 if (_RegOpenKey(HKEY_LOCAL_MACHINE,pszRegPath,&hKey) == ERROR_SUCCESS) { - + QueryReg(hKey,"ui32ScanCode",&g_PrivateHotKeyData.ui32ScanCode); QueryReg(hKey,"ui32ShiftState",&g_PrivateHotKeyData.ui32ShiftState); @@ -83,11 +83,11 @@ IMG_VOID RegisterKeyPressed(IMG_UINT32 dwui32ScanCode, PHOTKEYINFO pInfo) if (!g_bHotKeyPressed) { - + g_ui32HotKeyFrame = psStream->psCtrl->ui32Current + 2; - + g_bHotKeyPressed = IMG_TRUE; } @@ -96,11 +96,11 @@ IMG_VOID RegisterKeyPressed(IMG_UINT32 dwui32ScanCode, PHOTKEYINFO pInfo) IMG_VOID ActivateHotKeys(PDBG_STREAM psStream) { - + ReadInHotKeys(); - + if (!g_PrivateHotKeyData.sHotKeyInfo.hHotKey) { @@ -108,7 +108,7 @@ IMG_VOID ActivateHotKeys(PDBG_STREAM psStream) { PVR_DPF((PVR_DBG_MESSAGE,"Activate HotKey for PDUMP.\n")); - + g_PrivateHotKeyData.sHotKeyInfo.pvStream = psStream; diff --git a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/hotkey.h b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/hotkey.h index 942d2da..c5d84bb 100644 --- a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/hotkey.h +++ b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/hotkey.h @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -37,7 +37,7 @@ typedef struct _hotkeyinfo IMG_UINT32 ui32ShiftState; IMG_UINT32 ui32HotKeyProc; IMG_VOID *pvStream; - IMG_UINT32 hHotKey; + IMG_UINT32 hHotKey; } HOTKEYINFO, *PHOTKEYINFO; typedef struct _privatehotkeydata diff --git a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/ioctl.c b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/ioctl.c index a455e02..3fcded3 100644 --- a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/ioctl.c +++ b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/common/ioctl.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -28,7 +28,7 @@ #ifdef LINUX #include -#endif +#endif #include "img_types.h" #include "dbgdrvif.h" @@ -110,7 +110,7 @@ static IMG_UINT32 DBGDIOCDrivWriteString(IMG_VOID * pvInBuffer, IMG_VOID * pvOut } else { - + *pui32OutLen = 0; return(IMG_FALSE); } @@ -133,7 +133,7 @@ static IMG_UINT32 DBGDIOCDrivWriteStringCM(IMG_VOID * pvInBuffer, IMG_VOID * pvO } else { - + *pui32OutLen = 0; return(IMG_FALSE); } @@ -157,7 +157,7 @@ static IMG_UINT32 DBGDIOCDrivReadString(IMG_VOID * pvInBuffer, IMG_VOID * pvOutB } else { - + *pui32OutLen = 0; return(IMG_FALSE); } @@ -183,7 +183,7 @@ static IMG_UINT32 DBGDIOCDrivWrite(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer } else { - + *pui32BytesCopied = 0; return(IMG_FALSE); } @@ -209,7 +209,7 @@ static IMG_UINT32 DBGDIOCDrivWrite2(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffe } else { - + *pui32BytesCopied = 0; return(IMG_FALSE); } @@ -235,7 +235,7 @@ static IMG_UINT32 DBGDIOCDrivWriteCM(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuff } else { - + *pui32BytesCopied = 0; return(IMG_FALSE); } @@ -261,7 +261,7 @@ static IMG_UINT32 DBGDIOCDrivRead(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) } else { - + *pui32BytesCopied = 0; return(IMG_FALSE); } @@ -287,7 +287,7 @@ static IMG_UINT32 DBGDIOCDrivSetCaptureMode(IMG_VOID * pvInBuffer, IMG_VOID * pv } else { - + return(IMG_FALSE); } } @@ -308,7 +308,7 @@ static IMG_UINT32 DBGDIOCDrivSetOutMode(IMG_VOID * pvInBuffer, IMG_VOID * pvOutB } else { - + return(IMG_FALSE); } } @@ -329,7 +329,7 @@ static IMG_UINT32 DBGDIOCDrivSetDebugLevel(IMG_VOID * pvInBuffer, IMG_VOID * pvO } else { - + return(IMG_FALSE); } } @@ -350,7 +350,7 @@ static IMG_UINT32 DBGDIOCDrivSetFrame(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuf } else { - + return(IMG_FALSE); } } @@ -362,7 +362,7 @@ static IMG_UINT32 DBGDIOCDrivGetFrame(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuf pui32Current = (IMG_UINT32 *) pvOutBuffer; psStream = SID2PStream(*(IMG_SID *)pvInBuffer); - + if (psStream != (PDBG_STREAM)IMG_NULL) { *pui32Current = ExtDBGDrivGetFrame(psStream); @@ -370,7 +370,7 @@ static IMG_UINT32 DBGDIOCDrivGetFrame(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuf } else { - + *pui32Current = 0; return(IMG_FALSE); } @@ -394,7 +394,7 @@ static IMG_UINT32 DBGDIOCDrivIsCaptureFrame(IMG_VOID * pvInBuffer, IMG_VOID * pv } else { - + *pui32Current = 0; return(IMG_FALSE); } @@ -416,7 +416,7 @@ static IMG_UINT32 DBGDIOCDrivOverrideMode(IMG_VOID * pvInBuffer, IMG_VOID * pvOu } else { - + return(IMG_FALSE); } } @@ -435,7 +435,7 @@ static IMG_UINT32 DBGDIOCDrivDefaultMode(IMG_VOID * pvInBuffer, IMG_VOID * pvOut } else { - + return(IMG_FALSE); } } @@ -456,7 +456,7 @@ static IMG_UINT32 DBGDIOCDrivSetMarker(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBu } else { - + return(IMG_FALSE); } } @@ -476,7 +476,7 @@ static IMG_UINT32 DBGDIOCDrivGetMarker(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBu } else { - + *pui32Current = 0; return(IMG_FALSE); } @@ -515,7 +515,7 @@ static IMG_UINT32 DBGDIOCDrivWriteLF(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuff } else { - + return(IMG_FALSE); } } @@ -539,7 +539,7 @@ static IMG_UINT32 DBGDIOCDrivReadLF(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffe } else { - + *pui32BytesCopied = 0; return(IMG_FALSE); } diff --git a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/linux/hostfunc.c b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/linux/hostfunc.c index 859591c..18c8898 100644 --- a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/linux/hostfunc.c +++ b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/linux/hostfunc.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -46,7 +46,7 @@ #include #include #include -#endif +#endif #include "img_types.h" #include "pvr_debug.h" @@ -79,7 +79,7 @@ void PVRSRVDebugPrintf ( { pszFileName = pszLeafName; } -#endif +#endif bTrace = (IMG_BOOL)(ui32DebugLevel & DBGPRIV_CALLTRACE) ? IMG_TRUE : IMG_FALSE; @@ -90,13 +90,13 @@ void PVRSRVDebugPrintf ( char *szBufferEnd = szBuffer; char *szBufferLimit = szBuffer + sizeof(szBuffer) - 1; - + *szBufferLimit = '\0'; snprintf(szBufferEnd, szBufferLimit - szBufferEnd, "PVR_K:"); szBufferEnd += strlen(szBufferEnd); - + if (bTrace == IMG_FALSE) { switch(ui32DebugLevel) @@ -142,10 +142,10 @@ void PVRSRVDebugPrintf ( va_end (vaArgs); szBufferEnd += strlen(szBufferEnd); - + if (bTrace == IMG_FALSE) { - snprintf(szBufferEnd, szBufferLimit - szBufferEnd, + snprintf(szBufferEnd, szBufferLimit - szBufferEnd, " [%d, %s]", (int)ui32Line, pszFileName); szBufferEnd += strlen(szBufferEnd); } @@ -153,7 +153,7 @@ void PVRSRVDebugPrintf ( printk(KERN_INFO "%s\r\n", szBuffer); } } -#endif +#endif IMG_VOID HostMemSet(IMG_VOID *pvDest, IMG_UINT8 ui8Value, IMG_UINT32 ui32Size) { @@ -179,7 +179,7 @@ IMG_VOID HostMemCopy(IMG_VOID *pvDst, IMG_VOID *pvSrc, IMG_UINT32 ui32Size) IMG_UINT32 HostReadRegistryDWORDFromString(char *pcKey, char *pcValueName, IMG_UINT32 *pui32Data) { - + return 0; } @@ -205,18 +205,18 @@ IMG_VOID HostNonPageablePageFree(IMG_VOID * pvBase) IMG_VOID * HostMapKrnBufIntoUser(IMG_VOID * pvKrnAddr, IMG_UINT32 ui32Size, IMG_VOID **ppvMdl) { - + return IMG_NULL; } IMG_VOID HostUnMapKrnBufFromUser(IMG_VOID * pvUserAddr, IMG_VOID * pvMdl, IMG_VOID * pvProcess) { - + } IMG_VOID HostCreateRegDeclStreams(IMG_VOID) { - + } #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) @@ -294,12 +294,12 @@ IMG_VOID HostWaitForEvent(DBG_EVENT eEvent) switch(eEvent) { case DBG_EVENT_STREAM_DATA: - + wait_event_interruptible_timeout(sStreamDataEvent, iStreamData != 0, EVENT_WAIT_TIMEOUT_JIFFIES); iStreamData = 0; break; default: - + msleep_interruptible(EVENT_WAIT_TIMEOUT_MS); break; } @@ -321,4 +321,4 @@ IMG_VOID HostSignalEvent(DBG_EVENT eEvent) IMG_VOID HostDestroyEventObjects(IMG_VOID) { } -#endif +#endif diff --git a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/linux/main.c b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/linux/main.c index ca897c6..b793e85 100644 --- a/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/linux/main.c +++ b/drivers/staging/mrst/pvr/tools/intern/debug/dbgdriv/linux/main.c @@ -1,26 +1,26 @@ /********************************************************************** * * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * + * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Contact Information: * Imagination Technologies Ltd. - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK * ******************************************************************************/ @@ -65,7 +65,7 @@ #include "pvr_drm_shared.h" #include "pvr_drm.h" -#else +#else #define DRVNAME "dbgdrv" MODULE_SUPPORTED_DEVICE(DRVNAME); @@ -101,7 +101,7 @@ static struct file_operations dbgdrv_fops = { .mmap = dbgdrv_mmap, }; -#endif +#endif IMG_VOID DBGDrvGetServiceTable(IMG_VOID **fn_table); @@ -124,7 +124,7 @@ static void __exit dbgdrv_cleanup(void) class_destroy(psDbgDrvClass); #endif unregister_chrdev(AssignedMajorNumber, DRVNAME); -#endif +#endif #if defined(SUPPORT_DBGDRV_EVENT_OBJECTS) HostDestroyEventObjects(); #endif @@ -146,14 +146,14 @@ static int __init dbgdrv_init(void) int err = -EBUSY; #endif - + if ((g_pvAPIMutex=HostCreateMutex()) == IMG_NULL) { return -ENOMEM; } #if defined(SUPPORT_DBGDRV_EVENT_OBJECTS) - + (void) HostCreateEventObjects(); #endif @@ -168,7 +168,7 @@ static int __init dbgdrv_init(void) } #if defined(LDM_PLATFORM) || defined(LDM_PCI) - + psDbgDrvClass = class_create(THIS_MODULE, DRVNAME); if (IS_ERR(psDbgDrvClass)) { @@ -188,8 +188,8 @@ static int __init dbgdrv_init(void) __func__, PTR_ERR(psDev))); goto ErrDestroyClass; } -#endif -#endif +#endif +#endif return 0; @@ -205,7 +205,7 @@ ErrDestroyClass: class_destroy(psDbgDrvClass); #endif return err; -#endif +#endif } #if defined(SUPPORT_DRI_DRM) @@ -239,7 +239,7 @@ long dbgdrv_ioctl(struct file *file, unsigned int ioctlCmd, unsigned long arg) goto init_failed; } - + cmd = MAKEIOCTLINDEX(pIP->ui32Cmd) - DEBUG_SERVICE_IOCTL_BASE - 1; if(pIP->ui32Cmd == DEBUG_SERVICE_READ) -- 2.7.4