This is basically a sed -i 's/\<DEBUG\>/CONFIG_PVR_DEBUG_EXTRA' *.[ch] .
Currently a driver built in debug mode will only work together with the
relevant PVR/OGLES user space libraries being built in debug mode too.
This is becuase the ABI is different in debug and release build.
This is not very flexible when one wants to only debug the kernel driver
and not care about the user space part, let alone figuring out where to
get the sources for that and rebuild it in debug mode too.
Mark the current user space dependent debug code parts with a new
CONFIG_PVR_DEBUG_EXTRA option instead of DEBUG, so that later we can
selectively add back basic debugging facilities like debug traces and
mark them with CONFIG_PVR_DEBUG.
Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
bool "Timing"
endchoice
+config PVR_DEBUG_EXTRA
+ bool "Extra debugging info"
+ depends on PVR_DEBUG
+ help
+ This enables extra debugging facilities on top of what you
+ get with setting debug build type above. This effectively
+ changes the driver's ABI, so the user space clients using
+ the driver need to be built in debug mode as well.
+
config PVR_DEBUG_PDUMP
tristate "PDUMP debug support"
depends on PVR
int DummyBW(u32 ui32BridgeID, void *psBridgeIn, void *psBridgeOut,
struct PVRSRV_PER_PROCESS_DATA *psPerProc)
{
-#if !defined(DEBUG)
+#if !defined(CONFIG_PVR_DEBUG_EXTRA)
PVR_UNREFERENCED_PARAMETER(ui32BridgeID);
#endif
PVR_UNREFERENCED_PARAMETER(psBridgeIn);
const char *pszFunctionName)
{
static u32 ui32PrevIndex = ~0UL;
-#if !defined(DEBUG)
+#if !defined(CONFIG_PVR_DEBUG_EXTRA)
PVR_UNREFERENCED_PARAMETER(pszIOCName);
#endif
#if !defined(DEBUG_BRIDGE_KM_DISPATCH_TABLE) && !defined(DEBUG_BRIDGE_KM)
#define DISPATCH_TABLE_GAP_THRESHOLD 5
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
#define PVRSRV_BRIDGE_ASSERT_CMD(X, Y) PVR_ASSERT(X == PVRSRV_GET_BRIDGE_ID(Y))
#else
#define PVRSRV_BRIDGE_ASSERT_CMD(X, Y) PVR_UNREFERENCED_PARAMETER(X)
goto ExitDisable;
}
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
printk(KERN_ERR DRVNAME ": BC_Example_ModInit: major device %d\n",
AssignedMajorNumber);
#endif
struct PVRSRV_LINUX_EVENT_OBJECT {
atomic_t sTimeStamp;
u32 ui32TimeStampPrevious;
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
unsigned ui32Stats;
#endif
wait_queue_head_t sWait;
if (hOSEventObject) {
struct PVRSRV_LINUX_EVENT_OBJECT *psLinuxEventObject =
(struct PVRSRV_LINUX_EVENT_OBJECT *)hOSEventObject;
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
PVR_DPF(PVR_DBG_MESSAGE,
"LinuxEventObjectListDelete: Event object waits: %lu",
psLinuxEventObject->ui32Stats);
list_del(&psLinuxEventObject->sList);
write_unlock_bh(&psLinuxEventObjectList->sLock);
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
PVR_DPF(PVR_DBG_MESSAGE,
"LinuxEventObjectDeleteCallback: Event object waits: %lu",
psLinuxEventObject->ui32Stats);
atomic_set(&psLinuxEventObject->sTimeStamp, 0);
psLinuxEventObject->ui32TimeStampPrevious = 0;
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
psLinuxEventObject->ui32Stats = 0;
#endif
init_waitqueue_head(&psLinuxEventObject->sWait);
(u32) schedule_timeout((s32) ui32TimeOutJiffies);
pvr_lock();
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
psLinuxEventObject->ui32Stats++;
#endif
#include "services_headers.h"
#include "handle.h"
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
#define HANDLE_BLOCK_SIZE 1
#else
#define HANDLE_BLOCK_SIZE 256
bIsEmpty = (IMG_BOOL) (psList->ui32Next == ui32Index);
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
{
IMG_BOOL bIsEmpty2;
return bIsEmpty;
}
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
static inline IMG_BOOL NoChildren(struct PVRSRV_HANDLE_BASE *psBase,
struct sHandle *psHandle)
{
ui32IndexPlusOne = ui32NextIndexPlusOne;
}
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
if (psBase->ui32TotalHandCountPreBatch != psBase->ui32TotalHandCount) {
u32 ui32Delta =
psBase->ui32TotalHandCount -
const char *LinuxMemAreaTypeToString(enum LINUX_MEM_AREA_TYPE eMemAreaType);
-#if defined(DEBUG) || defined(DEBUG_LINUX_MEM_AREAS)
+#if defined(CONFIG_PVR_DEBUG_EXTRA) || defined(DEBUG_LINUX_MEM_AREAS)
const char *HAPFlagsToString(u32 ui32Flags);
#endif
u32 ui32RealByteSize)
{
struct KV_OFFSET_STRUCT *psOffsetStruct;
-#if defined(DEBUG) || defined(DEBUG_LINUX_MMAP_AREAS)
+#if defined(CONFIG_PVR_DEBUG_EXTRA) || defined(DEBUG_LINUX_MMAP_AREAS)
const char *pszName =
LinuxMemAreaTypeToString(LinuxMemAreaRootType(psLinuxMemArea));
#endif
enum PVRSRV_ERROR PVRMMapRegisterArea(struct LinuxMemArea *psLinuxMemArea)
{
enum PVRSRV_ERROR eError = PVRSRV_ERROR_GENERIC;
-#if defined(DEBUG) || defined(DEBUG_LINUX_MMAP_AREAS)
+#if defined(CONFIG_PVR_DEBUG_EXTRA) || defined(DEBUG_LINUX_MMAP_AREAS)
const char *pszName =
LinuxMemAreaTypeToString(LinuxMemAreaRootType(psLinuxMemArea));
#endif
#define DRVNAME "pvrsrvkm"
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
static int debug = DBGPRIV_WARNING;
#include <linux/moduleparam.h>
module_param(debug, int, 0);
pvr_init_lock();
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
PVRDebugSetLevel(debug);
#endif
#define OMAPLFB_PAGE_ROUNDUP(x) (((x) + OMAPLFB_PAGE_MASK) & OMAPLFB_PAGE_TRUNC)
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
#define DEBUG_PRINTK(x) printk x
#else
#define DEBUG_PRINTK(x)
struct IMG_SYS_PHYADDR *psPhysAddr;
int iPageOffset;
int iContiguous;
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
u32 ulStartAddr;
u32 ulBeyondEndAddr;
struct vm_area_struct *psVMArea;
}
memset(psInfo, 0, sizeof(*psInfo));
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
psInfo->ulStartAddr = ulStartAddrOrig;
psInfo->ulBeyondEndAddr = ulBeyondEndAddrOrig;
#endif
goto error_release_mmap_sem;
}
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
psInfo->psVMArea = psVMArea;
#endif
static enum PVRSRV_ERROR SGXCleanupSharedPBDescCreateLockCallback(void *pvParam,
u32 ui32Param)
{
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
struct PVRSRV_PER_PROCESS_DATA *psPerProc =
(struct PVRSRV_PER_PROCESS_DATA *)pvParam;
PVR_ASSERT(psPerProc == psPerProcCreateSharedPB);
return -ENOMEM;
}
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
if (CreateProcEntry
("debug_level", PVRDebugProcGetLevel, PVRDebugProcSetLevel, NULL)) {
PVR_DPF(PVR_DBG_ERROR,
void RemoveProcEntries(void)
{
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
RemoveProcEntry("debug_level");
#endif
RemoveProcEntry("queue");
#define PVR_DBG_CALLTRACE DBGPRIV_CALLTRACE
#define PVR_DBG_ALLOC DBGPRIV_ALLOC
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
#define PVR_ASSERT(EXPR) \
do { \
# define NO_HARDWARE 1
#endif
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
# define DEBUG_LINUX_MEMORY_ALLOCATIONS 1
# define DEBUG_LINUX_MEM_AREAS 1
# define DEBUG_LINUX_MMAP_AREAS 1
#ifdef RA_STATS
struct RA_STATISTICS sStatistics;
#endif
-#if defined(CONFIG_PROC_FS) && defined(DEBUG)
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_PVR_DEBUG_EXTRA)
#define PROC_NAME_SIZE 32
char szProcInfoName[PROC_NAME_SIZE];
char szProcSegsName[PROC_NAME_SIZE];
#endif
};
-#if defined(CONFIG_PROC_FS) && defined(DEBUG)
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_PVR_DEBUG_EXTRA)
static int RA_DumpSegs(char *page, char **start, off_t off, int count, int *eof,
void *data);
static int RA_DumpInfo(char *page, char **start, off_t off, int count, int *eof,
void *data);
#endif
-#if defined(CONFIG_PROC_FS) && defined(DEBUG)
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_PVR_DEBUG_EXTRA)
static char *ReplaceSpaces(char *const pS)
{
char *pT;
pArena->sStatistics.uExportCount = 0;
#endif
-#if defined(CONFIG_PROC_FS) && defined(DEBUG)
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_PVR_DEBUG_EXTRA)
if (strcmp(pArena->name, "") != 0) {
int ret;
int (*pfnCreateProcEntry) (const char *, read_proc_t,
pArena->sStatistics.uSpanCount--;
#endif
}
-#if defined(CONFIG_PROC_FS) && defined(DEBUG)
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_PVR_DEBUG_EXTRA)
{
void (*pfnRemoveProcEntry) (const char *);
return IMG_FALSE;
}
-#if (defined(CONFIG_PROC_FS) && defined(DEBUG)) || defined(RA_STATS)
+#if (defined(CONFIG_PROC_FS) && defined(CONFIG_PVR_DEBUG_EXTRA)) || \
+ defined(RA_STATS)
static char *_BTType(int eType)
{
switch (eType) {
}
#endif
-#if defined(CONFIG_PROC_FS) && defined(DEBUG)
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_PVR_DEBUG_EXTRA)
static int RA_DumpSegs(char *page, char **start, off_t off, int count, int *eof,
void *data)
{
#define RESMAN_SIGNATURE 0x12345678
struct RESMAN_ITEM {
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
u32 ui32Signature;
#endif
struct RESMAN_ITEM **ppsThis;
};
struct RESMAN_CONTEXT {
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
u32 ui32Signature;
#endif
struct RESMAN_CONTEXT **ppsThis;
u32 ui32Param,
IMG_BOOL bExecuteCallback);
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
static void ValidateResList(struct RESMAN_LIST *psResList);
#define VALIDATERESLIST() ValidateResList(gpsResList)
#else
return eError;
}
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
psResManContext->ui32Signature = RESMAN_SIGNATURE;
#endif
psResManContext->psResItemList = NULL;
return (struct RESMAN_ITEM *)NULL;
}
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
psNewResItem->ui32Signature = RESMAN_SIGNATURE;
#endif
psNewResItem->ui32ResType = ui32ResType;
PVR_DBG_BREAK;
return PVRSRV_ERROR_INVALID_PARAMS;
}
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
PVR_ASSERT(psResItem->ui32Signature == RESMAN_SIGNATURE);
#endif
PVR_DBG_BREAK;
return PVRSRV_ERROR_INVALID_PARAMS;
}
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
PVR_ASSERT(psItem->ui32Signature == RESMAN_SIGNATURE);
#endif
return freed;
}
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
static void ValidateResList(struct RESMAN_LIST *psResList)
{
struct RESMAN_ITEM *psCurItem, **ppsThisItem;
*
******************************************************************************/
-#if defined(DEBUG) || defined(INTERNAL_TEST)
+#if defined(CONFIG_PVR_DEBUG_EXTRA) || defined(INTERNAL_TEST)
#define DEBUG_SET_OFFSET OPTIONS_BIT0
#define OPTIONS_BIT0 0x1
#else
PVR_DPF(PVR_DBG_ERROR,
"SGX2DQueryBlitsCompleteKM: Timed out. Ops pending.");
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
{
struct PVRSRV_SYNC_DATA *psSyncData = psSyncInfo->psSyncData;
struct clk *psSGX_FCK;
struct clk *psSGX_ICK;
struct clk *psMPU_CK;
-#if defined(DEBUG) || defined(TIMING)
+#if defined(CONFIG_PVR_DEBUG_EXTRA) || defined(TIMING)
struct clk *psGPT11_FCK;
struct clk *psGPT11_ICK;
void __iomem *gpt_base;
if (atomic_read(&gpsSysSpecificData->sSGXClocksEnabled) != 0 &&
gpsSysSpecificData->bSGXInitComplete) {
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
unsigned long rate;
rate = clk_get_rate(gpsSysSpecificData->psSGX_FCK);
}
}
-#if defined(DEBUG) || defined(TIMING)
+#if defined(CONFIG_PVR_DEBUG_EXTRA) || defined(TIMING)
static inline u32 gpt_read_reg(struct SYS_DATA *psSysData, u32 reg)
{
struct SYS_SPECIFIC_DATA *psSysSpecData = psSysData->pvSysSpecificData;