]> git.openpandora.org Git - sgx.git/commitdiff
gpu: pvr: remove CommonBridgeInit()
authorLuc Verhaegen <libv@codethink.co.uk>
Tue, 5 Apr 2011 12:41:22 +0000 (14:41 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:43:05 +0000 (21:43 +0300)
By dynamically assigning the function names in the BridgeDispatchTable, an
extra layer of potential errors (when CommonBridgeInit or
SetSGXDispatchTableEntry is not in full sync with the switch statement in
bridged_ioctl()) is removed.

/proc/pvr/bridge_stats now no longer shows IOCTL names and the function
they are supposed to be mapped to. It now shows actual IOCTL numbers, and
the functions called for them (when called at all). It can debated which is
more useful, but the removal of the extra layer of potential errors wins.

Crucially though, we stop caring about "holes" in IOCTL assignment, which
makes it much easier for me to move pdump ioctls to their own range.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
pvr/bridged_pvr_bridge.c
pvr/bridged_pvr_bridge.h
pvr/bridged_sgx_bridge.c
pvr/bridged_sgx_bridge.h
pvr/pvr_bridge_k.c

index ac976ca6b3f75aab070cf9fb40bb5e4bbcd04c0c..4621710e8da4669ebe8ea768b60202f92bded1de 100644 (file)
 #include <linux/mm.h>
 #include <linux/sched.h>
 
+#if defined(DEBUG_BRIDGE_KM)
 struct PVRSRV_BRIDGE_DISPATCH_TABLE_ENTRY
     g_BridgeDispatchTable[BRIDGE_DISPATCH_TABLE_ENTRY_COUNT];
-
-#if defined(DEBUG_BRIDGE_KM)
 struct PVRSRV_BRIDGE_GLOBAL_STATS g_BridgeGlobalStats;
 #endif
 
@@ -82,7 +81,25 @@ enum PVRSRV_ERROR CopyToUserWrapper(struct PVRSRV_PER_PROCESS_DATA *pProcData,
        g_BridgeGlobalStats.ui32TotalCopyToUserBytes += ui32Size;
        return OSCopyToUser(pProcData, pvDest, pvSrc, ui32Size);
 }
-#endif
+
+/*
+ * This is not a real sanity check. Entries cannot overlap as the compiler
+ * catches this in the switch statement. It does however  construct a list
+ * of which calls are mapped to which id, as needed by /proc/pvr/bridge_stats.
+ */
+void
+PVRSRVBridgeIDCheck(u32 id, const char *function)
+{
+       if (id != PVRSRV_GET_BRIDGE_ID(id))
+               pr_err("PVR: IOCTL %d out of range! (%s)\n", id, function);
+       else if (!g_BridgeDispatchTable[id].pszFunctionName)
+               g_BridgeDispatchTable[id].pszFunctionName = function;
+       else if (g_BridgeDispatchTable[id].pszFunctionName != function)
+               pr_err("PVR: IOCTL %d mismatch: %s != %s\n", id,
+                      g_BridgeDispatchTable[id].pszFunctionName, function);
+}
+
+#endif /* DEBUG_BRIDGE_KM */
 
 static int PVRSRVEnumerateDevicesBW(u32 ui32BridgeID, void *psBridgeIn,
                         struct PVRSRV_BRIDGE_OUT_ENUMDEVICE *psEnumDeviceOUT,
@@ -2397,93 +2414,18 @@ static int MMU_GetPDDevPAddrBW(u32 ui32BridgeID,
 int DummyBW(u32 ui32BridgeID, void *psBridgeIn, void *psBridgeOut,
            struct PVRSRV_PER_PROCESS_DATA *psPerProc)
 {
-#if !defined(CONFIG_PVR_DEBUG_EXTRA)
-       PVR_UNREFERENCED_PARAMETER(ui32BridgeID);
+#if defined(DEBUG_BRIDGE_KM)
+       PVRSRVBridgeIDCheck(ui32BridgeID, __func__);
 #endif
        PVR_UNREFERENCED_PARAMETER(psBridgeIn);
        PVR_UNREFERENCED_PARAMETER(psBridgeOut);
        PVR_UNREFERENCED_PARAMETER(psPerProc);
 
-#if defined(DEBUG_BRIDGE_KM)
-       PVR_DPF(PVR_DBG_ERROR, "%s: BRIDGE ERROR: BridgeID %lu (%s) mapped to "
-                "Dummy Wrapper (probably not what you want!)",
-                __func__, ui32BridgeID,
-                g_BridgeDispatchTable[ui32BridgeID].pszIOCName);
-#else
        PVR_DPF(PVR_DBG_ERROR, "%s: BRIDGE ERROR: BridgeID %lu mapped to "
-                "Dummy Wrapper (probably not what you want!)",
-                __func__, ui32BridgeID);
-#endif
-       return -ENOTTY;
-}
-
-void _SetDispatchTableEntry(u32 ui32Index, const char *pszIOCName,
-                           int (*pfFunction)(u32 ui32BridgeID,
-                                             void *psBridgeIn,
-                                             void *psBridgeOut,
-                                             struct PVRSRV_PER_PROCESS_DATA
-                                                                  *psPerProc),
-                           const char *pszFunctionName)
-{
-       static u32 ui32PrevIndex = ~0UL;
-#if !defined(CONFIG_PVR_DEBUG_EXTRA)
-       PVR_UNREFERENCED_PARAMETER(pszIOCName);
-#endif
-#if !defined(DEBUG_BRIDGE_KM_DISPATCH_TABLE) && !defined(DEBUG_BRIDGE_KM)
-       PVR_UNREFERENCED_PARAMETER(pszFunctionName);
-#endif
-
-
-       if (g_BridgeDispatchTable[ui32Index].pfFunction) {
-#if defined(DEBUG_BRIDGE_KM)
-               PVR_DPF(PVR_DBG_ERROR, "%s: BUG!: "
-                       "Adding dispatch table entry for %s "
-                       "clobbers an existing entry for %s",
-                        __func__, pszIOCName,
-                        g_BridgeDispatchTable[ui32Index].pszIOCName);
-#else
-               PVR_DPF(PVR_DBG_ERROR, "%s: BUG!: "
-                       "Adding dispatch table entry for %s "
-                       "clobbers an existing entry (index=%lu)",
-                        __func__, pszIOCName, ui32Index);
-#endif
-               PVR_DPF(PVR_DBG_ERROR,
-"NOTE: Enabling DEBUG_BRIDGE_KM_DISPATCH_TABLE may help debug this issue.",
-                        __func__);
-       }
+               "Dummy Wrapper (probably not what you want!)",
+               __func__, ui32BridgeID);
 
-       if ((ui32PrevIndex != ~0UL) &&
-           ((ui32Index >= ui32PrevIndex + DISPATCH_TABLE_GAP_THRESHOLD) ||
-            (ui32Index <= ui32PrevIndex))) {
-#if defined(DEBUG_BRIDGE_KM)
-               PVR_DPF(PVR_DBG_WARNING,
-                        "%s: There is a gap in the dispatch table "
-                        "between indices %lu (%s) and %lu (%s)",
-                        __func__, ui32PrevIndex,
-                        g_BridgeDispatchTable[ui32PrevIndex].pszIOCName,
-                        ui32Index, pszIOCName);
-#else
-               PVR_DPF(PVR_DBG_WARNING,
-                        "%s: There is a gap in the dispatch table "
-                       "between indices %u and %u (%s)",
-                        __func__, (unsigned)ui32PrevIndex, (unsigned)ui32Index,
-                        pszIOCName);
-#endif
-               PVR_DPF(PVR_DBG_ERROR,
-                       "NOTE: Enabling DEBUG_BRIDGE_KM_DISPATCH_TABLE "
-                       "may help debug this issue.",
-                        __func__);
-       }
-
-       g_BridgeDispatchTable[ui32Index].pfFunction = pfFunction;
-#if defined(DEBUG_BRIDGE_KM)
-       g_BridgeDispatchTable[ui32Index].pszIOCName = pszIOCName;
-       g_BridgeDispatchTable[ui32Index].pszFunctionName = pszFunctionName;
-       g_BridgeDispatchTable[ui32Index].ui32CallCount = 0;
-       g_BridgeDispatchTable[ui32Index].ui32CopyFromUserTotalBytes = 0;
-#endif
-
-       ui32PrevIndex = ui32Index;
+       return -ENOTTY;
 }
 
 static int PVRSRVInitSrvConnectBW(u32 ui32BridgeID, void *psBridgeIn,
@@ -2630,187 +2572,6 @@ static int PVRSRVEventObjectCloseBW(u32 ui32BridgeID,
        return 0;
 }
 
-enum PVRSRV_ERROR CommonBridgeInit(void)
-{
-       u32 i;
-
-       SetDispatchTableEntry(PVRSRV_BRIDGE_ENUM_DEVICES,
-                             PVRSRVEnumerateDevicesBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_ACQUIRE_DEVICEINFO,
-                             PVRSRVAcquireDeviceDataBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_RELEASE_DEVICEINFO, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_CREATE_DEVMEMCONTEXT,
-                             PVRSRVCreateDeviceMemContextBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_DESTROY_DEVMEMCONTEXT,
-                             PVRSRVDestroyDeviceMemContextBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_GET_DEVMEM_HEAPINFO,
-                             PVRSRVGetDeviceMemHeapInfoBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_ALLOC_DEVICEMEM,
-                             PVRSRVAllocDeviceMemBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_FREE_DEVICEMEM,
-                             PVRSRVFreeDeviceMemBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_GETFREE_DEVICEMEM,
-                             PVRSRVGetFreeDeviceMemBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_CREATE_COMMANDQUEUE, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_DESTROY_COMMANDQUEUE, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_MHANDLE_TO_MMAP_DATA,
-                             PVRMMapOSMemHandleToMMapDataBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_CONNECT_SERVICES, PVRSRVConnectBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_DISCONNECT_SERVICES,
-                             PVRSRVDisconnectBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_WRAP_DEVICE_MEM, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_GET_DEVICEMEMINFO, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_RESERVE_DEV_VIRTMEM, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_FREE_DEV_VIRTMEM, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_EXT_MEMORY, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_EXT_MEMORY, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_DEV_MEMORY,
-                             PVRSRVMapDeviceMemoryBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_DEV_MEMORY,
-                             PVRSRVUnmapDeviceMemoryBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_DEVICECLASS_MEMORY,
-                             PVRSRVMapDeviceClassMemoryBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_DEVICECLASS_MEMORY,
-                             PVRSRVUnmapDeviceClassMemoryBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_MEM_INFO_TO_USER, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_MEM_INFO_FROM_USER, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_EXPORT_DEVICEMEM,
-                             PVRSRVExportDeviceMemBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_RELEASE_MMAP_DATA,
-                             PVRMMapReleaseMMapDataBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_CACHE_FLUSH_DRM,
-                             PVRSRVCacheFlushDRIBW);
-
-       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(PDUMP)
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_INIT, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_MEMPOL, PDumpMemPolBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_DUMPMEM, PDumpMemBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_REG, PDumpRegWithFlagsBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_REGPOL, PDumpRegPolBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_COMMENT, PDumpCommentBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_SETFRAME, PDumpSetFrameBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_ISCAPTURING,
-                             PDumpIsCaptureFrameBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_DUMPBITMAP, PDumpBitmapBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_DUMPREADREG, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_SYNCPOL, PDumpSyncPolBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_DUMPSYNC, PDumpSyncDumpBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_DRIVERINFO, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_PDREG, PDumpPDRegBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_DUMPPDDEVPADDR,
-                             PDumpPDDevPAddrBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_CYCLE_COUNT_REG_READ,
-                             PDumpCycleCountRegReadBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_STARTINITPHASE, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_STOPINITPHASE, DummyBW);
-#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);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_ENUM_DISPCLASS_DIMS,
-                             PVRSRVEnumDCDimsBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_GET_DISPCLASS_SYSBUFFER,
-                             PVRSRVGetDCSystemBufferBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_GET_DISPCLASS_INFO,
-                             PVRSRVGetDCInfoBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_CREATE_DISPCLASS_SWAPCHAIN,
-                             PVRSRVCreateDCSwapChainBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_DESTROY_DISPCLASS_SWAPCHAIN,
-                             PVRSRVDestroyDCSwapChainBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SET_DISPCLASS_DSTRECT,
-                             PVRSRVSetDCDstRectBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SET_DISPCLASS_SRCRECT,
-                             PVRSRVSetDCSrcRectBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SET_DISPCLASS_DSTCOLOURKEY,
-                             PVRSRVSetDCDstColourKeyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SET_DISPCLASS_SRCCOLOURKEY,
-                             PVRSRVSetDCSrcColourKeyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_GET_DISPCLASS_BUFFERS,
-                             PVRSRVGetDCBuffersBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_BUFFER,
-                             PVRSRVSwapToDCBufferBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_SYSTEM,
-                             PVRSRVSwapToDCSystemBW);
-
-       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_GETMMU_PD_DEVPADDR,
-                             MMU_GetPDDevPAddrBW);
-
-       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);
-
-       SetDispatchTableEntry(PVRSRV_BRIDGE_MODIFY_SYNC_OPS,
-                             PVRSRVModifySyncOpsBW);
-
-       SetSGXDispatchTableEntry();
-
-       for (i = 0; i < BRIDGE_DISPATCH_TABLE_ENTRY_COUNT; i++)
-               if (!g_BridgeDispatchTable[i].pfFunction) {
-                       g_BridgeDispatchTable[i].pfFunction = DummyBW;
-#if defined(DEBUG_BRIDGE_KM)
-                       g_BridgeDispatchTable[i].pszIOCName =
-                                                   "_PVRSRV_BRIDGE_DUMMY";
-                       g_BridgeDispatchTable[i].pszFunctionName = "DummyBW";
-                       g_BridgeDispatchTable[i].ui32CallCount = 0;
-                       g_BridgeDispatchTable[i].ui32CopyFromUserTotalBytes = 0;
-                       g_BridgeDispatchTable[i].ui32CopyToUserTotalBytes = 0;
-#endif
-               }
-
-       return PVRSRV_OK;
-}
-
 static int bridged_check_cmd(u32 cmd_id)
 {
        if (PVRSRVGetInitServerState(PVRSRV_INIT_SERVER_RAN)) {
@@ -3284,7 +3045,7 @@ int BridgedDispatchKM(struct file *filp, struct PVRSRV_PER_PROCESS_DATA *pd,
                                pkg->ui32InBufferSize) != PVRSRV_OK)
                goto return_fault;
 
-       if (bid >= (BRIDGE_DISPATCH_TABLE_ENTRY_COUNT)) {
+       if (bid >= (PVRSRV_BRIDGE_LAST_SGX_CMD)) {
                PVR_DPF(PVR_DBG_ERROR,
                         "%s: ui32BridgeID = %d is out if range!", __func__,
                         bid);
index 188fdedf092d3109ba455560a25c220af79ac888..9371df01d59da7c52e4b486e6ec32a675133c789 100644 (file)
@@ -99,57 +99,38 @@ static inline void ReleaseHandleBatch(struct PVRSRV_PER_PROCESS_DATA *psPerProc)
 int DummyBW(u32 ui32BridgeID, void *psBridgeIn, void *psBridgeOut,
            struct PVRSRV_PER_PROCESS_DATA *psPerProc);
 
-struct PVRSRV_BRIDGE_DISPATCH_TABLE_ENTRY {
-       int (*pfFunction)(u32 ui32BridgeID, void *psBridgeIn, void *psBridgeOut,
-                         struct PVRSRV_PER_PROCESS_DATA *psPerProc);
 #if defined(DEBUG_BRIDGE_KM)
-       const char *pszIOCName;
+#define BRIDGE_DISPATCH_TABLE_ENTRY_COUNT (1 << _IOC_NRBITS)
+
+struct PVRSRV_BRIDGE_DISPATCH_TABLE_ENTRY {
        const char *pszFunctionName;
        u32 ui32CallCount;
        u32 ui32CopyFromUserTotalBytes;
        u32 ui32CopyToUserTotalBytes;
-#endif
 };
 
-#define BRIDGE_DISPATCH_TABLE_ENTRY_COUNT (PVRSRV_BRIDGE_LAST_SGX_CMD+1)
-#define PVRSRV_BRIDGE_LAST_DEVICE_CMD     PVRSRV_BRIDGE_LAST_SGX_CMD
-
 extern struct PVRSRV_BRIDGE_DISPATCH_TABLE_ENTRY
            g_BridgeDispatchTable[BRIDGE_DISPATCH_TABLE_ENTRY_COUNT];
 
-void _SetDispatchTableEntry(u32 ui32Index,
-                           const char *pszIOCName,
-                           int (*pfFunction) (u32 ui32BridgeID,
-                                              void *psBridgeIn,
-                                              void *psBridgeOut,
-                                              struct PVRSRV_PER_PROCESS_DATA *
-                                              psPerProc),
-                           const char *pszFunctionName);
+void PVRSRVBridgeIDCheck(u32 id, const char *function);
 
-#define SetDispatchTableEntry(ui32Index, pfFunction) \
-       _SetDispatchTableEntry(PVRSRV_GET_BRIDGE_ID(ui32Index), #ui32Index, \
-          (int (*)(u32 ui32BridgeID, void *psBridgeIn, void *psBridgeOut,  \
-          struct PVRSRV_PER_PROCESS_DATA *psPerProc))pfFunction, #pfFunction)
+#define PVRSRV_BRIDGE_ASSERT_CMD(X, Y) do { \
+       PVR_ASSERT(X == PVRSRV_GET_BRIDGE_ID(Y)); \
+       PVRSRVBridgeIDCheck((X), __func__);       \
+       } while (0)
 
-#define DISPATCH_TABLE_GAP_THRESHOLD 5
-
-#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)
-#endif
-
-#if defined(DEBUG_BRIDGE_KM)
 struct PVRSRV_BRIDGE_GLOBAL_STATS {
        u32 ui32IOCTLCount;
        u32 ui32TotalCopyFromUserBytes;
        u32 ui32TotalCopyToUserBytes;
 };
-
 extern struct PVRSRV_BRIDGE_GLOBAL_STATS g_BridgeGlobalStats;
-#endif
 
-enum PVRSRV_ERROR CommonBridgeInit(void);
+#else
+
+#define PVRSRV_BRIDGE_ASSERT_CMD(X, Y) PVR_UNREFERENCED_PARAMETER(X)
+
+#endif /* DEBUG_BRIDGE_KM */
 
 int BridgedDispatchKM(struct file *filp,
                        struct PVRSRV_PER_PROCESS_DATA *psPerProc,
index adb8af533ed6d71cdcc144494bd847e3aa1ac9ef..14f0aade6d4d2466e8ea71237aa9e2029379b517 100644 (file)
@@ -1791,69 +1791,3 @@ int SGXPDumpHWPerfCBBW(u32 ui32BridgeID,
 }
 
 #endif
-
-void SetSGXDispatchTableEntry(void)
-{
-
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_GETCLIENTINFO,
-                             SGXGetClientInfoBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_RELEASECLIENTINFO,
-                             SGXReleaseClientInfoBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_GETINTERNALDEVINFO,
-                             SGXGetInternalDevInfoBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_DOKICK, SGXDoKickBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_GETPHYSPAGEADDR, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_READREGISTRYDWORD, DummyBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_SCHEDULECOMMAND, DummyBW);
-
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_2DQUERYBLTSCOMPLETE,
-                             SGX2DQueryBlitsCompleteBW);
-
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_GETMMUPDADDR, DummyBW);
-
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_SUBMITTRANSFER,
-                             SGXSubmitTransferBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_GETMISCINFO, SGXGetMiscInfoBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGXINFO_FOR_SRVINIT,
-                             SGXGetInfoForSrvinitBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_DEVINITPART2,
-                             SGXDevInitPart2BW);
-
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_FINDSHAREDPBDESC,
-                             SGXFindSharedPBDescBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_UNREFSHAREDPBDESC,
-                             SGXUnrefSharedPBDescBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_ADDSHAREDPBDESC,
-                             SGXAddSharedPBDescBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_REGISTER_HW_RENDER_CONTEXT,
-                             SGXRegisterHWRenderContextBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_FLUSH_HW_RENDER_TARGET,
-                             SGXFlushHWRenderTargetBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_UNREGISTER_HW_RENDER_CONTEXT,
-                             SGXUnregisterHWRenderContextBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_REGISTER_HW_TRANSFER_CONTEXT,
-                             SGXRegisterHWTransferContextBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_UNREGISTER_HW_TRANSFER_CONTEXT,
-                             SGXUnregisterHWTransferContextBW);
-
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_READ_DIFF_COUNTERS,
-                             SGXReadDiffCountersBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_READ_HWPERF_CB,
-                             SGXReadHWPerfCBBW);
-
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_SCHEDULE_PROCESS_QUEUES,
-                             SGXScheduleProcessQueuesBW);
-
-#if defined(PDUMP)
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_PDUMP_BUFFER_ARRAY,
-                             SGXPDumpBufferArrayBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_PDUMP_3D_SIGNATURE_REGISTERS,
-                             SGXPDump3DSignatureRegistersBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_PDUMP_COUNTER_REGISTERS,
-                             SGXPDumpCounterRegistersBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_PDUMP_TA_SIGNATURE_REGISTERS,
-                             SGXPDumpTASignatureRegistersBW);
-       SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_PDUMP_HWPERFCB,
-                             SGXPDumpHWPerfCBBW);
-#endif
-}
index 91e5b6733934c373d0e38d16c3c1ca29a746e174..6c1e711c1241064675dd6169160e4e23d13c0946 100644 (file)
@@ -27,8 +27,6 @@
 #ifndef __BRIDGED_SGX_BRIDGE_H__
 #define __BRIDGED_SGX_BRIDGE_H__
 
-void SetSGXDispatchTableEntry(void);
-
 int SGXGetClientInfoBW(u32 ui32BridgeID,
        struct PVRSRV_BRIDGE_IN_GETCLIENTINFO *psGetClientInfoIN,
        struct PVRSRV_BRIDGE_OUT_GETCLIENTINFO *psGetClientInfoOUT,
index 7489f65e9c615088fa30b90c2465ee8a59532ecd..3bba80f738fb3fbbcf0d89cd0c0f0ee6537dda1f 100644 (file)
@@ -98,7 +98,7 @@ enum PVRSRV_ERROR LinuxBridgeInit(void)
                        return PVRSRV_ERROR_OUT_OF_MEMORY;
        }
 #endif
-       return CommonBridgeInit();
+       return PVRSRV_OK;
 }
 
 void LinuxBridgeDeInit(void)
@@ -126,13 +126,13 @@ static off_t printLinuxBridgeStats(char *buffer, size_t count, off_t off)
                        "Total number of bytes copied via copy_from_user = %u\n"
                        "Total number of bytes copied via copy_to_user = %u\n"
                        "Total number of bytes copied via copy_*_user = %u\n\n"
-                       "%-45s | %-40s | %10s | %20s | %10s\n",
+                       "%-2s | %-40s | %10s | %20s | %10s\n",
                  g_BridgeGlobalStats.ui32IOCTLCount,
                  g_BridgeGlobalStats.ui32TotalCopyFromUserBytes,
                  g_BridgeGlobalStats.ui32TotalCopyToUserBytes,
                  g_BridgeGlobalStats.ui32TotalCopyFromUserBytes +
                          g_BridgeGlobalStats.ui32TotalCopyToUserBytes,
-                 "Bridge Name", "Wrapper Function",
+                 "ID", "Wrapper Function",
                  "Call Count", "copy_from_user Bytes",
                  "copy_to_user Bytes");
 
@@ -151,9 +151,8 @@ static off_t printLinuxBridgeStats(char *buffer, size_t count, off_t off)
 
        psEntry = &g_BridgeDispatchTable[off - 1];
        Ret = printAppend(buffer, count, 0,
-                         "%-45s   %-40s   %-10u   %-20u   %-10u\n",
-                         psEntry->pszIOCName,
-                         psEntry->pszFunctionName,
+                         "%02lX   %-40s   %-10u   %-20u   %-10u\n",
+                         off - 1, psEntry->pszFunctionName,
                          psEntry->ui32CallCount,
                          psEntry->ui32CopyFromUserTotalBytes,
                          psEntry->ui32CopyToUserTotalBytes);