X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pvr%2Fpvr_debug.c;h=116c6ea257fbca68453b0b40a41a44108b2b26b0;hb=4713ddfef267393154536ce3f4edb8ae3c5d6d72;hp=b3a05a2a2a4c10901603c27609786cfbf8428395;hpb=93c5bd29c900176b8e3c38707d41fef61b5420c5;p=sgx.git diff --git a/pvr/pvr_debug.c b/pvr/pvr_debug.c index b3a05a2..116c6ea 100644 --- a/pvr/pvr_debug.c +++ b/pvr/pvr_debug.c @@ -24,23 +24,18 @@ * ******************************************************************************/ -#include #include #include #include #include #include -#include -#include -#include + #include "img_types.h" #include "servicesext.h" #include "pvr_debug.h" #include "proc.h" -#include "syscommon.h" -#include "sgxinfokm.h" -#include "sgxutils.h" -#include "pvr_bridge_km.h" + +#ifdef CONFIG_PVR_DEBUG u32 gPVRDebugLevel = DBGPRIV_WARNING; @@ -251,112 +246,17 @@ int PVRDebugProcGetLevel(char *page, char **start, off_t off, int count, return 0; } -#ifdef CONFIG_DEBUG_FS - -static struct dentry *debugfs_dentry; -static u32 pvr_reset; - -static struct PVRSRV_DEVICE_NODE *get_sgx_node(void) -{ - struct SYS_DATA *sysdata; - struct PVRSRV_DEVICE_NODE *node; - - if (SysAcquireData(&sysdata) != PVRSRV_OK) - return NULL; - - for (node = sysdata->psDeviceNodeList; node; node = node->psNext) - if (node->sDevId.eDeviceType == PVRSRV_DEVICE_TYPE_SGX) - break; - - return node; -} - -static int pvr_dbg_reset(void *data, u64 val) -{ - struct PVRSRV_DEVICE_NODE *node; - enum PVRSRV_ERROR err; - int r = 0; - - if (val != 1) - return 0; - - pvr_lock(); - - node = get_sgx_node(); - if (!node) { - r = -ENODEV; - goto exit; - } - - err = PVRSRVSetDevicePowerStateKM(node->sDevId.ui32DeviceIndex, - PVRSRV_POWER_STATE_D0, - KERNEL_ID, IMG_TRUE); - if (err != PVRSRV_OK) { - r = -EIO; - goto exit; - } - - /* - * Yes, this is kinda braindead. KERNEL_ID, IMG_TRUE above means - * take the power lock - not just try lock - and keep it. TIMER_ID - * here means that we have already the power lock, so don't take it. - * Also - regardless of the ID - the following will release the lock. - * Finally we pass KERNEL_ID again to take and release the lock. - * Yay! - */ - HWRecoveryResetSGX(node, 0, TIMER_ID); - - SGXTestActivePowerEvent(node, KERNEL_ID); -exit: - pvr_unlock(); - - return r; -} - -static int pvr_dbg_set(void *data, u64 val) -{ - u32 *var = data; - - if (var == &pvr_reset) - return pvr_dbg_reset(data, val); - - BUG(); -} - -DEFINE_SIMPLE_ATTRIBUTE(pvr_dbg_fops, NULL, pvr_dbg_set, "%llu\n"); - -static int pvr_init_debugfs(void) -{ - debugfs_dentry = debugfs_create_file("reset_sgx", S_IWUGO, NULL, - &pvr_reset, &pvr_dbg_fops); - - return debugfs_dentry ? 0 : -ENODEV; -} - -static void pvr_cleanup_debugfs(void) -{ - debugfs_remove(debugfs_dentry); -} - -#else /* !CONFIG_DEBUG_FS */ - -static int pvr_init_debugfs(void) -{ - return 0; -} - -static void pvr_cleanup_debugfs(void) { } - #endif void pvr_dbg_init(void) { +#if defined(CONFIG_PVR_DEBUG) || defined(TIMING) mutex_init(&gsDebugMutexNonIRQ); - pvr_init_debugfs(); +#endif } void pvr_dbg_cleanup(void) { - pvr_cleanup_debugfs(); + }