本文整理汇总了C++中PVR_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ PVR_ASSERT函数的具体用法?C++ PVR_ASSERT怎么用?C++ PVR_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PVR_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AcquireHandle
/*!
******************************************************************************
@Function AcquireHandle
@Description Acquire a new handle
@Input psBase - Pointer to handle base structure
phHandle - Points to a handle pointer
pvData - Pointer to resource to be associated with the handle
@Output phHandle - Points to a handle pointer
@Return Error code or PVRSRV_OK
******************************************************************************/
static PVRSRV_ERROR AcquireHandle(HANDLE_IMPL_BASE *psBase,
IMG_HANDLE *phHandle,
IMG_VOID *pvData)
{
IMG_UINT32 ui32NewIndex = BASE_TO_TOTAL_INDICES(psBase);
HANDLE_IMPL_DATA *psNewHandleData = IMG_NULL;
PVRSRV_ERROR eError;
PVR_ASSERT(psBase != IMG_NULL);
PVR_ASSERT(phHandle != IMG_NULL);
PVR_ASSERT(pvData != IMG_NULL);
/* Ensure there is a free handle */
eError = EnsureFreeHandles(psBase, 1);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR, "%s: EnsureFreeHandles failed (%s)",
__FUNCTION__, PVRSRVGetErrorStringKM(eError)));
return eError;
}
PVR_ASSERT(psBase->ui32TotalFreeHandCount != 0);
if (!psBase->bPurgingEnabled)
{
/* Array index of first free handle */
ui32NewIndex = psBase->ui32FirstFreeIndex;
/* Get handle array entry */
psNewHandleData = INDEX_TO_HANDLE_DATA(psBase, ui32NewIndex);
}
else
{
IMG_UINT32 ui32BlockedIndex;
/*
* If purging is enabled, we always try to allocate handles
* at the front of the array, to increase the chances that
* the size of the handle array can be reduced by a purge.
* No linked list of free handles is kept; we search for
* free handles as required.
*/
/*
* ui32FirstFreeIndex should only be set when a new batch of
* handle structures is allocated, and should always be a
* multiple of the block size.
*/
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)
{
HANDLE_BLOCK *psHandleBlock = BASE_AND_INDEX_TO_HANDLE_BLOCK(psBase, ui32BlockedIndex);
if (psHandleBlock->ui32FreeHandCount == 0)
{
continue;
}
for (ui32NewIndex = ui32BlockedIndex; ui32NewIndex < ui32BlockedIndex + HANDLE_BLOCK_SIZE; ui32NewIndex++)
{
psNewHandleData = INDEX_TO_HANDLE_DATA(psBase, ui32NewIndex);
if (psNewHandleData->pvData == IMG_NULL)
{
break;
}
}
}
psBase->ui32FirstFreeIndex = 0;
PVR_ASSERT(INDEX_IS_VALID(psBase, ui32NewIndex));
}
PVR_ASSERT(psNewHandleData != IMG_NULL);
psBase->ui32TotalFreeHandCount--;
PVR_ASSERT(INDEX_TO_BLOCK_FREE_HAND_COUNT(psBase, ui32NewIndex) <= HANDLE_BLOCK_SIZE);
PVR_ASSERT(INDEX_TO_BLOCK_FREE_HAND_COUNT(psBase, ui32NewIndex) > 0);
INDEX_TO_BLOCK_FREE_HAND_COUNT(psBase, ui32NewIndex)--;
/* No free list management if purging is enabled */
if (!psBase->bPurgingEnabled)
{
/* Check whether the last free handle has been allocated */
if (psBase->ui32TotalFreeHandCount == 0)
//.........这里部分代码省略.........
示例2: EnableSGXClocks
/*!
******************************************************************************
@Function EnableSGXClocks
@Description Enable SGX clocks
@Return PVRSRV_ERROR
******************************************************************************/
PVRSRV_ERROR EnableSGXClocks(SYS_DATA *psSysData)
{
#if !defined(NO_HARDWARE)
SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData;
#if !defined(PM_RUNTIME_SUPPORT)
IMG_INT res;
long lRate,lNewRate;
#endif
int ret;
/* SGX clocks already enabled? */
if (atomic_read(&psSysSpecData->sSGXClocksEnabled) != 0)
{
return PVRSRV_OK;
}
PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks"));
#if !defined(PM_RUNTIME_SUPPORT)
PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks"));
res=clk_enable(psSysSpecData->psSGX_FCK);
if (res < 0)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res));
return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
}
lNewRate = clk_round_rate(psSysSpecData->psSGX_FCK, SYS_SGX_CLOCK_SPEED + ONE_MHZ);
if (lNewRate <= 0)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't round SGX functional clock rate"));
return PVRSRV_ERROR_UNABLE_TO_ROUND_CLOCK_RATE;
}
lRate = clk_get_rate(psSysSpecData->psSGX_FCK);
if (lRate != lNewRate)
{
res = clk_set_rate(psSysSpecData->psSGX_FCK, lNewRate);
if (res < 0)
{
PVR_DPF((PVR_DBG_WARNING, "EnableSGXClocks: Couldn't set SGX functional clock rate (%d)", res));
return PVRSRV_ERROR_UNABLE_TO_SET_CLOCK_RATE;
}
}
#if defined(DEBUG)
{
IMG_UINT32 rate = clk_get_rate(psSysSpecData->psSGX_FCK);
PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: SGX Functional Clock is %dMhz", HZ_TO_MHZ(rate)));
}
#endif
#endif
#if defined(LDM_PLATFORM) && !defined(PVR_DRI_DRM_NOT_PCI)
#if defined(SYS_OMAP_HAS_DVFS_FRAMEWORK)
{
struct gpu_platform_data *pdata;
IMG_UINT32 max_freq_index;
int res;
pdata = (struct gpu_platform_data *)gpsPVRLDMDev->dev.platform_data;
max_freq_index = psSysSpecData->ui32SGXFreqListSize - 2;
/*
* Request maximum frequency from DVFS layer if not already set. DVFS may
* report busy if early in initialization, but all other errors are
* considered serious. Upon any error we proceed assuming our safe frequency
* value to be in use as indicated by the "unknown" index.
*/
if (psSysSpecData->ui32SGXFreqListIndex != max_freq_index)
{
PVR_ASSERT(pdata->device_scale != IMG_NULL);
res = pdata->device_scale(&gpsPVRLDMDev->dev,
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(3,4,0))
&gpsPVRLDMDev->dev,
#endif
psSysSpecData->pui32SGXFreqList[max_freq_index]);
if (res == 0)
{
psSysSpecData->ui32SGXFreqListIndex = max_freq_index;
}
else if (res == -EBUSY)
{
PVR_DPF((PVR_DBG_WARNING, "EnableSGXClocks: Unable to scale SGX frequency (EBUSY)"));
psSysSpecData->ui32SGXFreqListIndex = psSysSpecData->ui32SGXFreqListSize - 1;
}
else if (res < 0)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Unable to scale SGX frequency (%d)", res));
psSysSpecData->ui32SGXFreqListIndex = psSysSpecData->ui32SGXFreqListSize - 1;
}
}
//.........这里部分代码省略.........
示例3: AcquireGPTimer
/*!
******************************************************************************
@Function AcquireGPTimer
@Description Acquire a GP timer
@Return PVRSRV_ERROR
******************************************************************************/
static PVRSRV_ERROR AcquireGPTimer(SYS_SPECIFIC_DATA *psSysSpecData)
{
#if defined(PVR_OMAP4_TIMING_PRCM)
struct clk *psCLK;
IMG_INT res;
struct clk *sys_ck;
IMG_INT rate;
#endif
PVRSRV_ERROR eError;
IMG_CPU_PHYADDR sTimerRegPhysBase;
IMG_HANDLE hTimerEnable;
IMG_UINT32 *pui32TimerEnable;
#if defined(PVR_OMAP_TIMER_BASE_IN_SYS_SPEC_DATA)
PVR_ASSERT(psSysSpecData->sTimerRegPhysBase.uiAddr == 0);
#endif
#if defined(PVR_OMAP4_TIMING_PRCM)
/* assert our dependence on the GPTIMER11 module */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
psCLK = clk_get(NULL, "timer7_fck");
#else
psCLK = clk_get(NULL, "gpt7_fck");
#endif
if (IS_ERR(psCLK))
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get GPTIMER11 functional clock"));
goto ExitError;
}
psSysSpecData->psGPT11_FCK = psCLK;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
psCLK = clk_get(NULL, "gpt7_ick");
if (IS_ERR(psCLK))
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get GPTIMER11 interface clock"));
goto ExitError;
}
psSysSpecData->psGPT11_ICK = psCLK;
#endif
#if 0
sys_ck = clk_get(NULL, "sys_clkin_ck");
if (IS_ERR(sys_ck))
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get System clock"));
goto ExitError;
}
if(clk_get_parent(psSysSpecData->psGPT11_FCK) != sys_ck)
{
PVR_TRACE(("Setting GPTIMER11 parent to System Clock"));
res = clk_set_parent(psSysSpecData->psGPT11_FCK, sys_ck);
if (res < 0)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't set GPTIMER11 parent clock (%d)", res));
goto ExitError;
}
}
#endif
rate = clk_get_rate(psSysSpecData->psGPT11_FCK);
PVR_TRACE(("GPTIMER11 clock is %dMHz", HZ_TO_MHZ(rate)));
res = clk_enable(psSysSpecData->psGPT11_FCK);
if (res < 0)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER11 functional clock (%d)", res));
goto ExitError;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
res = clk_enable(psSysSpecData->psGPT11_ICK);
if (res < 0)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER11 interface clock (%d)", res));
goto ExitDisableGPT11FCK;
}
#endif
#endif /* defined(PVR_OMAP4_TIMING_PRCM) */
/* Set the timer to non-posted mode */
sTimerRegPhysBase.uiAddr = SYS_TI335x_GP7TIMER_TSICR_SYS_PHYS_BASE;
pui32TimerEnable = OSMapPhysToLin(sTimerRegPhysBase,
4,
PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED,
&hTimerEnable);
if (pui32TimerEnable == IMG_NULL)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: OSMapPhysToLin failed"));
goto ExitDisableGPT11ICK;
//.........这里部分代码省略.........
示例4: _DevmemImportStructAlloc
/*
Allocate and init an import structure
*/
IMG_INTERNAL
PVRSRV_ERROR _DevmemImportStructAlloc(IMG_HANDLE hBridge,
IMG_BOOL bExportable,
DEVMEM_IMPORT **ppsImport)
{
DEVMEM_IMPORT *psImport;
PVRSRV_ERROR eError;
psImport = OSAllocMem(sizeof *psImport);
if (psImport == IMG_NULL)
{
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
/* Setup some known bad values for things we don't have yet */
psImport->sDeviceImport.hReservation = LACK_OF_RESERVATION_POISON;
psImport->sDeviceImport.hMapping = LACK_OF_MAPPING_POISON;
psImport->sDeviceImport.psHeap = IMG_NULL;
psImport->sDeviceImport.bMapped = IMG_FALSE;
eError = OSLockCreate(&psImport->sDeviceImport.hLock, LOCK_TYPE_PASSIVE);
if (eError != PVRSRV_OK)
{
goto failDIOSLockCreate;
}
psImport->sCPUImport.hOSMMapData = IMG_NULL;
psImport->sCPUImport.pvCPUVAddr = IMG_NULL;
eError = OSLockCreate(&psImport->sCPUImport.hLock, LOCK_TYPE_PASSIVE);
if (eError != PVRSRV_OK)
{
goto failCIOSLockCreate;
}
/* Set up common elements */
psImport->hBridge = hBridge;
psImport->bExportable = bExportable;
/* Setup refcounts */
psImport->sDeviceImport.ui32RefCount = 0;
psImport->sCPUImport.ui32RefCount = 0;
psImport->ui32RefCount = 0;
/* Create the lock */
eError = OSLockCreate(&psImport->hLock, LOCK_TYPE_PASSIVE);
if (eError != PVRSRV_OK)
{
goto failILockAlloc;
}
#if !defined(__KERNEL__) && defined(SUPPORT_ION)
psImport->sCPUImport.iDmaBufFd = -1;
#endif
*ppsImport = psImport;
return PVRSRV_OK;
failILockAlloc:
OSLockDestroy(psImport->sCPUImport.hLock);
failCIOSLockCreate:
OSLockDestroy(psImport->sDeviceImport.hLock);
failDIOSLockCreate:
OSFreeMem(psImport);
PVR_ASSERT(eError != PVRSRV_OK);
return eError;
}
示例5: _DevmemImportStructCPUMap
/*
Map an import into the CPU
*/
IMG_INTERNAL
PVRSRV_ERROR _DevmemImportStructCPUMap(DEVMEM_IMPORT *psImport)
{
PVRSRV_ERROR eError;
DEVMEM_CPU_IMPORT *psCPUImport;
IMG_SIZE_T uiMappingLength;
psCPUImport = &psImport->sCPUImport;
OSLockAcquire(psCPUImport->hLock);
DEVMEM_REFCOUNT_PRINT("%s (%p) %d->%d",
__FUNCTION__,
psImport,
psCPUImport->ui32RefCount,
psCPUImport->ui32RefCount+1);
if (psCPUImport->ui32RefCount++ == 0)
{
_DevmemImportStructAcquire(psImport);
#if !defined(__KERNEL__) && defined(SUPPORT_ION)
if (psImport->sCPUImport.iDmaBufFd >= 0)
{
void *pvCPUVAddr;
/* For ion imports, use the ion fd and mmap facility to map the
* buffer to user space. We can bypass the services bridge in
* this case and possibly save some time.
*
*
*/
pvCPUVAddr = mmap(NULL, psImport->uiSize, PROT_READ | PROT_WRITE,
MAP_SHARED, psImport->sCPUImport.iDmaBufFd, 0);
if (pvCPUVAddr == MAP_FAILED)
{
eError = PVRSRV_ERROR_DEVICEMEM_MAP_FAILED;
goto failMap;
}
psCPUImport->hOSMMapData = pvCPUVAddr;
psCPUImport->pvCPUVAddr = pvCPUVAddr;
uiMappingLength = psImport->uiSize;
}
else
#endif
{
eError = OSMMapPMR(psImport->hBridge,
psImport->hPMR,
psImport->uiSize,
&psCPUImport->hOSMMapData,
&psCPUImport->pvCPUVAddr,
&uiMappingLength);
if (eError != PVRSRV_OK)
{
goto failMap;
}
}
/* There is no reason the mapping length is different to the size */
PVR_ASSERT(uiMappingLength == psImport->uiSize);
}
OSLockRelease(psCPUImport->hLock);
return PVRSRV_OK;
failMap:
psCPUImport->ui32RefCount--;
_DevmemImportStructRelease(psImport);
OSLockRelease(psCPUImport->hLock);
PVR_ASSERT(eError != PVRSRV_OK);
return eError;
}
示例6: EnableSGXClocks
PVRSRV_ERROR EnableSGXClocks(SYS_DATA *psSysData)
{
#if !defined(NO_HARDWARE)
SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData;
if (atomic_read(&psSysSpecData->sSGXClocksEnabled) != 0)
{
return PVRSRV_OK;
}
PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks"));
#if defined(LDM_PLATFORM) && !defined(PVR_DRI_DRM_NOT_PCI)
#if defined(SYS_OMAP4_HAS_DVFS_FRAMEWORK)
{
struct gpu_platform_data *pdata;
IMG_UINT32 max_freq_index;
int res;
pdata = (struct gpu_platform_data *)gpsPVRLDMDev->dev.platform_data;
max_freq_index = psSysSpecData->ui32SGXFreqListSize - 2;
if (psSysSpecData->ui32SGXFreqListIndex != max_freq_index)
{
PVR_ASSERT(pdata->device_scale != IMG_NULL);
res = pdata->device_scale(&gpsPVRLDMDev->dev,
&gpsPVRLDMDev->dev,
psSysSpecData->pui32SGXFreqList[max_freq_index]);
if (res == 0)
{
psSysSpecData->ui32SGXFreqListIndex = max_freq_index;
}
else if (res == -EBUSY)
{
PVR_DPF((PVR_DBG_WARNING, "EnableSGXClocks: Unable to scale SGX frequency (EBUSY)"));
psSysSpecData->ui32SGXFreqListIndex = psSysSpecData->ui32SGXFreqListSize - 1;
}
else if (res < 0)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Unable to scale SGX frequency (%d)", res));
psSysSpecData->ui32SGXFreqListIndex = psSysSpecData->ui32SGXFreqListSize - 1;
}
}
}
#endif
{
int res = pm_runtime_get_sync(&gpsPVRLDMDev->dev);
if (res < 0)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: pm_runtime_get_sync failed (%d)", -res));
return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
}
}
#endif
SysEnableSGXInterrupts(psSysData);
atomic_set(&psSysSpecData->sSGXClocksEnabled, 1);
#else
PVR_UNREFERENCED_PARAMETER(psSysData);
#endif
return PVRSRV_OK;
}
示例7: AcquireGPTimer
static PVRSRV_ERROR AcquireGPTimer(SYS_SPECIFIC_DATA *psSysSpecData)
{
#if defined(PVR_OMAP4_TIMING_PRCM)
struct clk *psCLK;
IMG_INT res;
struct clk *sys_ck;
IMG_INT rate;
#endif
PVRSRV_ERROR eError;
IMG_CPU_PHYADDR sTimerRegPhysBase;
IMG_HANDLE hTimerEnable;
IMG_UINT32 *pui32TimerEnable;
PVR_ASSERT(psSysSpecData->sTimerRegPhysBase.uiAddr == 0);
psCLK = clk_get(NULL, "sgx_fck");
if (IS_ERR(psCLK))
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get SGX Interface Clock"));
return;
}
clk_enable(psCLK);
psCLK = clk_get(NULL, "sgx_ick");
if (IS_ERR(psCLK))
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get SGX Interface Clock"));
return;
}
clk_enable(psCLK);
#if defined(PVR_OMAP4_TIMING_PRCM)
psCLK = clk_get(NULL, "gpt6_fck");
if (IS_ERR(psCLK))
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get GPTIMER functional clock"));
goto ExitError;
}
psSysSpecData->psGPT11_FCK = psCLK;
psCLK = clk_get(NULL, "gpt6_ick");
if (IS_ERR(psCLK))
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get GPTIMER interface clock"));
goto ExitError;
}
psSysSpecData->psGPT11_ICK = psCLK;
sys_ck = clk_get(NULL, "sys_ck");
if (IS_ERR(sys_ck))
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get System clock"));
goto ExitError;
}
if(clk_get_parent(psSysSpecData->psGPT11_FCK) != sys_ck)
{
PVR_TRACE(("Setting GPTIMER parent to System Clock"));
res = clk_set_parent(psSysSpecData->psGPT11_FCK, sys_ck);
if (res < 0)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't set GPTIMER parent clock (%d)", res));
goto ExitError;
}
}
rate = clk_get_rate(psSysSpecData->psGPT11_FCK);
PVR_TRACE(("GPTIMER clock is %dMHz", HZ_TO_MHZ(rate)));
res = clk_enable(psSysSpecData->psGPT11_FCK);
if (res < 0)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER functional clock (%d)", res));
goto ExitError;
}
res = clk_enable(psSysSpecData->psGPT11_ICK);
if (res < 0)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER interface clock (%d)", res));
goto ExitDisableGPT11FCK;
}
#endif
sTimerRegPhysBase.uiAddr = SYS_OMAP3_GPTIMER_TSICR_SYS_PHYS_BASE;
pui32TimerEnable = OSMapPhysToLin(sTimerRegPhysBase,
4,
PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED,
&hTimerEnable);
if (pui32TimerEnable == IMG_NULL)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: OSMapPhysToLin failed"));
//.........这里部分代码省略.........
示例8: PVRSRVBridgePMRSecureImportPMR
static IMG_INT
PVRSRVBridgePMRSecureImportPMR(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_IN_PMRSECUREIMPORTPMR *psPMRSecureImportPMRIN,
PVRSRV_BRIDGE_OUT_PMRSECUREIMPORTPMR *psPMRSecureImportPMROUT,
CONNECTION_DATA *psConnection)
{
PMR * psPMRInt = IMG_NULL;
IMG_HANDLE hPMRInt2 = IMG_NULL;
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SMM_PMRSECUREIMPORTPMR);
psPMRSecureImportPMROUT->eError =
PMRSecureImportPMR(
psPMRSecureImportPMRIN->Export,
&psPMRInt,
&psPMRSecureImportPMROUT->uiSize,
&psPMRSecureImportPMROUT->sAlign);
/* Exit early if bridged call fails */
if(psPMRSecureImportPMROUT->eError != PVRSRV_OK)
{
goto PMRSecureImportPMR_exit;
}
/* Create a resman item and overwrite the handle with it */
hPMRInt2 = ResManRegisterRes(psConnection->hResManContext,
RESMAN_TYPE_PMR,
psPMRInt,
/* FIXME: how can we avoid this cast? */
(RESMAN_FREE_FN)&PMRUnrefPMR);
if (hPMRInt2 == IMG_NULL)
{
psPMRSecureImportPMROUT->eError = PVRSRV_ERROR_UNABLE_TO_REGISTER_RESOURCE;
goto PMRSecureImportPMR_exit;
}
psPMRSecureImportPMROUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
&psPMRSecureImportPMROUT->hPMR,
(IMG_HANDLE) hPMRInt2,
PVRSRV_HANDLE_TYPE_PHYSMEM_PMR,
PVRSRV_HANDLE_ALLOC_FLAG_NONE
);
if (psPMRSecureImportPMROUT->eError != PVRSRV_OK)
{
goto PMRSecureImportPMR_exit;
}
PMRSecureImportPMR_exit:
if (psPMRSecureImportPMROUT->eError != PVRSRV_OK)
{
/* If we have a valid resman item we should undo the bridge function by freeing the resman item */
if (hPMRInt2)
{
PVRSRV_ERROR eError = ResManFreeResByPtr(hPMRInt2);
/* Freeing a resource should never fail... */
PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY));
}
else if (psPMRInt)
{
PMRUnrefPMR(psPMRInt);
}
}
return 0;
}
示例9: PVRSRVBridgePMRSecureExportPMR
static IMG_INT
PVRSRVBridgePMRSecureExportPMR(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_IN_PMRSECUREEXPORTPMR *psPMRSecureExportPMRIN,
PVRSRV_BRIDGE_OUT_PMRSECUREEXPORTPMR *psPMRSecureExportPMROUT,
CONNECTION_DATA *psConnection)
{
PMR * psPMRInt = IMG_NULL;
IMG_HANDLE hPMRInt2 = IMG_NULL;
PMR * psPMROutInt = IMG_NULL;
IMG_HANDLE hPMROutInt2 = IMG_NULL;
CONNECTION_DATA *psSecureConnection;
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SMM_PMRSECUREEXPORTPMR);
{
/* Look up the address from the handle */
psPMRSecureExportPMROUT->eError =
PVRSRVLookupHandle(psConnection->psHandleBase,
(IMG_HANDLE *) &hPMRInt2,
psPMRSecureExportPMRIN->hPMR,
PVRSRV_HANDLE_TYPE_PHYSMEM_PMR);
if(psPMRSecureExportPMROUT->eError != PVRSRV_OK)
{
goto PMRSecureExportPMR_exit;
}
/* Look up the data from the resman address */
psPMRSecureExportPMROUT->eError = ResManFindPrivateDataByPtr(hPMRInt2, (IMG_VOID **) &psPMRInt);
if(psPMRSecureExportPMROUT->eError != PVRSRV_OK)
{
goto PMRSecureExportPMR_exit;
}
}
psPMRSecureExportPMROUT->eError =
PMRSecureExportPMR(psConnection,
psPMRInt,
&psPMRSecureExportPMROUT->Export,
&psPMROutInt, &psSecureConnection);
/* Exit early if bridged call fails */
if(psPMRSecureExportPMROUT->eError != PVRSRV_OK)
{
goto PMRSecureExportPMR_exit;
}
/* Create a resman item and overwrite the handle with it */
hPMROutInt2 = ResManRegisterRes(psSecureConnection->hResManContext,
RESMAN_TYPE_PMR,
psPMROutInt,
/* FIXME: how can we avoid this cast? */
(RESMAN_FREE_FN)&PMRSecureUnexportPMR);
if (hPMROutInt2 == IMG_NULL)
{
psPMRSecureExportPMROUT->eError = PVRSRV_ERROR_UNABLE_TO_REGISTER_RESOURCE;
goto PMRSecureExportPMR_exit;
}
PMRSecureExportPMR_exit:
if (psPMRSecureExportPMROUT->eError != PVRSRV_OK)
{
/* If we have a valid resman item we should undo the bridge function by freeing the resman item */
if (hPMROutInt2)
{
PVRSRV_ERROR eError = ResManFreeResByPtr(hPMROutInt2);
/* Freeing a resource should never fail... */
PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY));
}
else if (psPMROutInt)
{
PMRSecureUnexportPMR(psPMROutInt);
}
}
return 0;
}
示例10: PVRSRVBridgeRGXCreateComputeContext
//.........这里部分代码省略.........
}
}
/* Copy the data over */
if ( !OSAccessOK(PVR_VERIFY_READ, (IMG_VOID*) psRGXCreateComputeContextIN->psFrameworkCmd, psRGXCreateComputeContextIN->ui32FrameworkCmdize * sizeof(IMG_BYTE))
|| (OSCopyFromUser(NULL, psFrameworkCmdInt, psRGXCreateComputeContextIN->psFrameworkCmd,
psRGXCreateComputeContextIN->ui32FrameworkCmdize * sizeof(IMG_BYTE)) != PVRSRV_OK) )
{
psRGXCreateComputeContextOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
goto RGXCreateComputeContext_exit;
}
{
/* Look up the address from the handle */
psRGXCreateComputeContextOUT->eError =
PVRSRVLookupHandle(psConnection->psHandleBase,
(IMG_HANDLE *) &hDevNodeInt,
psRGXCreateComputeContextIN->hDevNode,
PVRSRV_HANDLE_TYPE_DEV_NODE);
if(psRGXCreateComputeContextOUT->eError != PVRSRV_OK)
{
goto RGXCreateComputeContext_exit;
}
}
{
/* Look up the address from the handle */
psRGXCreateComputeContextOUT->eError =
PVRSRVLookupHandle(psConnection->psHandleBase,
(IMG_HANDLE *) &hPrivDataInt,
psRGXCreateComputeContextIN->hPrivData,
PVRSRV_HANDLE_TYPE_DEV_PRIV_DATA);
if(psRGXCreateComputeContextOUT->eError != PVRSRV_OK)
{
goto RGXCreateComputeContext_exit;
}
}
psRGXCreateComputeContextOUT->eError =
PVRSRVRGXCreateComputeContextKM(psConnection,
hDevNodeInt,
psRGXCreateComputeContextIN->ui32Priority,
psRGXCreateComputeContextIN->sMCUFenceAddr,
psRGXCreateComputeContextIN->ui32FrameworkCmdize,
psFrameworkCmdInt,
hPrivDataInt,
&psComputeContextInt);
/* Exit early if bridged call fails */
if(psRGXCreateComputeContextOUT->eError != PVRSRV_OK)
{
goto RGXCreateComputeContext_exit;
}
/* Create a resman item and overwrite the handle with it */
hComputeContextInt2 = ResManRegisterRes(psConnection->hResManContext,
RESMAN_TYPE_RGX_SERVER_COMPUTE_CONTEXT,
psComputeContextInt,
(RESMAN_FREE_FN)&PVRSRVRGXDestroyComputeContextKM);
if (hComputeContextInt2 == IMG_NULL)
{
psRGXCreateComputeContextOUT->eError = PVRSRV_ERROR_UNABLE_TO_REGISTER_RESOURCE;
goto RGXCreateComputeContext_exit;
}
psRGXCreateComputeContextOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
&psRGXCreateComputeContextOUT->hComputeContext,
(IMG_HANDLE) hComputeContextInt2,
PVRSRV_HANDLE_TYPE_RGX_SERVER_COMPUTE_CONTEXT,
PVRSRV_HANDLE_ALLOC_FLAG_NONE
);
if (psRGXCreateComputeContextOUT->eError != PVRSRV_OK)
{
goto RGXCreateComputeContext_exit;
}
RGXCreateComputeContext_exit:
if (psRGXCreateComputeContextOUT->eError != PVRSRV_OK)
{
/* If we have a valid resman item we should undo the bridge function by freeing the resman item */
if (hComputeContextInt2)
{
PVRSRV_ERROR eError = ResManFreeResByPtr(hComputeContextInt2);
/* Freeing a resource should never fail... */
PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY));
}
else if (psComputeContextInt)
{
PVRSRVRGXDestroyComputeContextKM(psComputeContextInt);
}
}
if (psFrameworkCmdInt)
OSFreeMem(psFrameworkCmdInt);
return 0;
}
示例11: GetMaxHandle
/*!
******************************************************************************
@Function GetMaxHandle
@Description Get maximum handle number for given handle base
@Input psBase - Pointer to handle base structure
@Return Maximum handle number or 0 if handle limits not supported.
******************************************************************************/
static IMG_UINT32 GetMaxHandle(HANDLE_IMPL_BASE *psBase)
{
PVR_ASSERT(psBase);
return psBase->ui32MaxHandleValue;
}
示例12: ReleaseHandle
/*!
******************************************************************************
@Function ReleaseHandle
@Description Release a handle that is no longer needed.
@Input psBase - Pointer to handle base structure
hHandle - Handle to release
ppvData - Points to a void data pointer
@Output ppvData - Points to a void data pointer
@Return PVRSRV_OK or PVRSRV_ERROR
******************************************************************************/
static PVRSRV_ERROR ReleaseHandle(HANDLE_IMPL_BASE *psBase,
IMG_HANDLE hHandle,
IMG_VOID **ppvData)
{
IMG_UINT32 ui32Index = HANDLE_TO_INDEX(hHandle);
HANDLE_IMPL_DATA *psHandleData;
IMG_VOID *pvData;
PVR_ASSERT(psBase);
/* Check handle index is in range */
if (!INDEX_IS_VALID(psBase, ui32Index))
{
PVR_DPF((PVR_DBG_ERROR, "%s: Handle index out of range (%u >= %u)",
__FUNCTION__, ui32Index, psBase->ui32TotalHandCount));
return PVRSRV_ERROR_HANDLE_INDEX_OUT_OF_RANGE;
}
psHandleData = INDEX_TO_HANDLE_DATA(psBase, ui32Index);
pvData = psHandleData->pvData;
psHandleData->pvData = IMG_NULL;
/* No free list management if purging is enabled */
if (!psBase->bPurgingEnabled)
{
if (psBase->ui32TotalFreeHandCount == 0)
{
PVR_ASSERT(psBase->ui32FirstFreeIndex == 0);
PVR_ASSERT(psBase->ui32LastFreeIndexPlusOne == 0);
psBase->ui32FirstFreeIndex = ui32Index;
}
else
{
/*
* Put the handle pointer on the end of the the free
* handle pointer linked list.
*/
PVR_ASSERT(psBase->ui32LastFreeIndexPlusOne != 0);
PVR_ASSERT(INDEX_TO_HANDLE_DATA(psBase, psBase->ui32LastFreeIndexPlusOne - 1)->ui32NextIndexPlusOne == 0);
INDEX_TO_HANDLE_DATA(psBase, psBase->ui32LastFreeIndexPlusOne - 1)->ui32NextIndexPlusOne = ui32Index + 1;
}
PVR_ASSERT(psHandleData->ui32NextIndexPlusOne == 0);
/* Update the end of the free handle linked list */
psBase->ui32LastFreeIndexPlusOne = ui32Index + 1;
}
psBase->ui32TotalFreeHandCount++;
INDEX_TO_BLOCK_FREE_HAND_COUNT(psBase, ui32Index)++;
PVR_ASSERT(INDEX_TO_BLOCK_FREE_HAND_COUNT(psBase, ui32Index)<= HANDLE_BLOCK_SIZE);
#if defined(DEBUG)
{
IMG_UINT32 ui32BlockedIndex;
IMG_UINT32 ui32TotalFreeHandCount = 0;
for (ui32BlockedIndex = 0; ui32BlockedIndex < psBase->ui32TotalHandCount; ui32BlockedIndex += HANDLE_BLOCK_SIZE)
{
ui32TotalFreeHandCount += INDEX_TO_BLOCK_FREE_HAND_COUNT(psBase, ui32BlockedIndex);
}
PVR_ASSERT(ui32TotalFreeHandCount == psBase->ui32TotalFreeHandCount);
}
#endif /* defined(DEBUG) */
if (ppvData)
{
*ppvData = pvData;
}
#if defined(DEBUG_HANDLEALLOC_KM)
PVR_DPF((PVR_DBG_MESSAGE, "Handle release base %p hdl %p", psBase, hHandle));
#endif
return PVRSRV_OK;
}
示例13: MMapPMROpen
static void MMapPMROpen(struct vm_area_struct* ps_vma)
{
/* Our VM flags should ensure this function never gets called */
PVR_ASSERT(0);
}
示例14: PollForValueKM
IMG_EXPORT
PVRSRV_ERROR IMG_CALLCONV PollForValueKM (volatile IMG_UINT32* pui32LinMemAddr,
IMG_UINT32 ui32Value,
IMG_UINT32 ui32Mask,
IMG_UINT32 ui32Timeoutus,
IMG_UINT32 ui32PollPeriodus,
IMG_BOOL bAllowPreemption)
{
#if defined (EMULATOR)
{
PVR_UNREFERENCED_PARAMETER(bAllowPreemption);
#if !defined(__linux__)
PVR_UNREFERENCED_PARAMETER(ui32PollPeriodus);
#endif
do
{
if((*pui32LinMemAddr & ui32Mask) == ui32Value)
{
return PVRSRV_OK;
}
#if defined(__linux__)
OSWaitus(ui32PollPeriodus);
#else
OSReleaseThreadQuanta();
#endif
} while (ui32Timeoutus);
}
#else
{
IMG_UINT32 ui32ActualValue = 0xFFFFFFFFU;
if (bAllowPreemption)
{
PVR_ASSERT(ui32PollPeriodus >= 1000);
}
LOOP_UNTIL_TIMEOUT(ui32Timeoutus)
{
ui32ActualValue = (*pui32LinMemAddr & ui32Mask);
if(ui32ActualValue == ui32Value)
{
return PVRSRV_OK;
}
if (bAllowPreemption)
{
OSSleepms(ui32PollPeriodus / 1000);
}
else
{
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
return PVRSRV_ERROR_TIMEOUT;
}
示例15: SysDeinitialise
/*!
******************************************************************************
@Function SysDeinitialise
@Description De-initialises kernel services at 'driver unload' time
@Return PVRSRV_ERROR
******************************************************************************/
PVRSRV_ERROR SysDeinitialise (SYS_DATA *psSysData)
{
PVRSRV_ERROR eError;
PVR_UNREFERENCED_PARAMETER(psSysData);
if(gpsSysData->pvSOCTimerRegisterKM)
{
OSUnReservePhys(gpsSysData->pvSOCTimerRegisterKM,
4,
PVRSRV_HAP_MULTI_PROCESS|PVRSRV_HAP_UNCACHED,
gpsSysData->hSOCTimerRegisterOSMemHandle);
}
#if defined(SYS_USING_INTERRUPTS)
if (SYS_SPECIFIC_DATA_TEST(gpsSysSpecificData, SYS_SPECIFIC_DATA_ENABLE_LISR))
{
eError = OSUninstallDeviceLISR(gpsSysData);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"SysDeinitialise: OSUninstallDeviceLISR failed"));
return eError;
}
}
#endif
if (SYS_SPECIFIC_DATA_TEST(gpsSysSpecificData, SYS_SPECIFIC_DATA_ENABLE_MISR))
{
eError = OSUninstallMISR(gpsSysData);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"SysDeinitialise: OSUninstallMISR failed"));
return eError;
}
}
if (SYS_SPECIFIC_DATA_TEST(gpsSysSpecificData, SYS_SPECIFIC_DATA_ENABLE_INITDEV))
{
#if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT)
PVR_ASSERT(SYS_SPECIFIC_DATA_TEST(gpsSysSpecificData, SYS_SPECIFIC_DATA_ENABLE_SYSCLOCKS));
/* Re-enable SGX clocks whilst SGX is being de-initialised */
eError = EnableSGXClocks(gpsSysData, IMG_TRUE);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"SysDeinitialise: EnableSGXClocks failed"));
return eError;
}
#endif /* SUPPORT_ACTIVE_POWER_MANAGEMENT */
/* De-initialise SGX */
eError = PVRSRVDeinitialiseDevice (gui32SGXDeviceID);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"SysDeinitialise: failed to de-init the device"));
return eError;
}
}
if (SYS_SPECIFIC_DATA_TEST(gpsSysSpecificData, SYS_SPECIFIC_DATA_DVFS_INIT))
{
eError = SysDvfsDeinitialize(gpsSysSpecificData);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"SysDeinitialise: Failed to de-init DVFS"));
gpsSysData = IMG_NULL;
return eError;
}
}
if (SYS_SPECIFIC_DATA_TEST(gpsSysSpecificData, SYS_SPECIFIC_DATA_ENABLE_PM_RUNTIME))
{
eError = SysPMRuntimeUnregister();
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"SysDeinitialise: Failed to unregister with OSPM!"));
gpsSysData = IMG_NULL;
return eError;
}
}
/* Disable system clocks - must happen after last access to hardware */
if (SYS_SPECIFIC_DATA_TEST(gpsSysSpecificData, SYS_SPECIFIC_DATA_ENABLE_SYSCLOCKS))
{
DisableSystemClocks(gpsSysData);
}
if (SYS_SPECIFIC_DATA_TEST(gpsSysSpecificData, SYS_SPECIFIC_DATA_ENABLE_ENVDATA))
{
eError = OSDeInitEnvData(gpsSysData->pvEnvSpecificData);
//.........这里部分代码省略.........