PVRSRV_ERROR SysFinalise(IMG_VOID) { PVRSRV_ERROR eError = PVRSRV_OK; eError = OSInstallMISR(gpsSysData); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysFinalise: OSInstallMISR failed")); return eError; } SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_MISR_INSTALLED); #if defined(SYS_USING_INTERRUPTS) && !defined(SUPPORT_DRI_DRM_EXT) eError = OSInstallSystemLISR(gpsSysData, gsSGXDeviceMap.ui32IRQ); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysFinalise: OSInstallSystemLISR failed")); return eError; } SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_LISR_INSTALLED); #endif #if (defined(SYS_USING_INTERRUPTS) && !defined(SUPPORT_DRI_DRM_EXT)) SysEnableInterrupts(gpsSysData); SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_IRQ_ENABLED); #endif eError = SysCreateVersionString(gpsSysData); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysInitialise: Failed to create a system version string")); } return eError; }
PVRSRV_ERROR SysFinalise(IMG_VOID) { PVRSRV_ERROR eError; #if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT) eError = EnableSGXClocks(); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysInitialise: Failed to Enable SGX clocks (%d)", eError)); (IMG_VOID)SysDeinitialise(gpsSysData); gpsSysData = IMG_NULL; return eError; } #endif #if defined(SYS_USING_INTERRUPTS) eError = OSInstallMISR(gpsSysData); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"OSInstallMISR: Failed to install MISR")); SysDeinitialise(gpsSysData); gpsSysData = IMG_NULL; return eError; } gsSysSpecificData.ui32SysSpecificData |= SYS_SPECIFIC_DATA_ENABLE_MISR; eError = OSInstallSystemLISR(gpsSysData, gsSGXDeviceMap.ui32IRQ); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"OSInstallSystemLISR: Failed to install ISR")); OSUninstallMISR(gpsSysData); SysDeinitialise(gpsSysData); gpsSysData = IMG_NULL; return eError; } gsSysSpecificData.ui32SysSpecificData |= SYS_SPECIFIC_DATA_ENABLE_LISR; gsSysSpecificData.ui32SysSpecificData |= SYS_SPECIFIC_DATA_ENABLE_IRQ; #endif gpsSysData->pszVersionString=version_string; if (!gpsSysData->pszVersionString) { PVR_DPF((PVR_DBG_ERROR,"SysFinalise: Failed to create a system version string")); } else { PVR_DPF((PVR_DBG_WARNING, "SysFinalise: Version string: %s", gpsSysData->pszVersionString)); } #if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT) DisableSGXClocks(); #endif return PVRSRV_OK; }
/***********************************************************************//** * Perform system-level processing required after a system power transition * * @param eNewPowerState Power state we're switching to * * @returns PVRSRV_OK for success, or failure code **************************************************************************/ PVRSRV_ERROR SysSystemPostPowerState(PVRSRV_SYS_POWER_STATE eNewPowerState) { PVRSRV_ERROR eError = PVRSRV_OK; if (eNewPowerState != gpsSysData->eCurrentPowerState) { if ((gpsSysData->eCurrentPowerState == PVRSRV_SYS_POWER_STATE_D3) && (eNewPowerState < PVRSRV_SYS_POWER_STATE_D3)) { /* * Returning from D3 state. * Find the device again as it may have been remapped. */ eError = SysLocateDevices(gpsSysData); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysSystemPostPowerState: Failed to locate devices")); return eError; } /* * Remap the system-level registers. */ eError = SysMapInRegisters(); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysSystemPostPowerState: Failed to map in registers")); return eError; } #if defined (SYS_USING_INTERRUPTS) if (SYS_SPECIFIC_DATA_TEST(&gsSysSpecificData, SYS_SPECIFIC_DATA_PM_UNINSTALL_LISR)) { eError = OSInstallSystemLISR(gpsSysData, gsSGXDeviceMap.ui32IRQ); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysSystemPostPowerState: OSInstallSystemLISR failed to install ISR (%d)", eError)); } SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_LISR_INSTALLED); SYS_SPECIFIC_DATA_CLEAR(&gsSysSpecificData, SYS_SPECIFIC_DATA_PM_UNINSTALL_LISR); } #endif /* defined (SYS_USING_INTERRUPTS) */ if (SYS_SPECIFIC_DATA_TEST(&gsSysSpecificData, SYS_SPECIFIC_DATA_PM_IRQ_DISABLE)) { SysEnableInterrupts(gpsSysData); SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_IRQ_ENABLED); SYS_SPECIFIC_DATA_CLEAR(&gsSysSpecificData, SYS_SPECIFIC_DATA_PM_IRQ_DISABLE); } } } return eError; }
/*! ****************************************************************************** @Function SysFinalise @Description Final part of system initialisation. @Return PVRSRV_ERROR : ******************************************************************************/ PVRSRV_ERROR SysFinalise(IMG_VOID) { PVRSRV_ERROR eError; eError = OSInstallMISR(gpsSysData); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"OSInstallMISR: Failed to install MISR")); return eError; } SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_ENABLE_MISR); #if defined(SYS_USING_INTERRUPTS) /* install a system ISR */ eError = OSInstallSystemLISR(gpsSysData, gsSGXDeviceMap.ui32IRQ); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"OSInstallSystemLISR: Failed to install ISR")); return eError; } SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_ENABLE_LISR); #endif /* defined(SYS_USING_INTERRUPTS) */ #if defined(SYS_USING_INTERRUPTS) SysEnableInterrupts(gpsSysData); SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_ENABLE_IRQ); #endif #if defined(__linux__) /* Create a human readable version string for this system */ gpsSysData->pszVersionString = SysCreateVersionString(gsSGXDeviceMap.sRegsCpuPBase); if (!gpsSysData->pszVersionString) { PVR_DPF((PVR_DBG_ERROR,"SysFinalise: Failed to create a system version string")); } else { PVR_DPF((PVR_DBG_MESSAGE, "SysFinalise: Version string: %s", gpsSysData->pszVersionString)); } #endif return PVRSRV_OK; }
/***********************************************************************//** * Final part of initialisation. After this, the system is ready to * begin work * * @returns PVRSRV_OK for success, or failure code **************************************************************************/ PVRSRV_ERROR SysFinalise(IMG_VOID) { PVRSRV_ERROR eError; #if defined(SYS_USING_INTERRUPTS) eError = OSInstallMISR(gpsSysData); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"OSInstallMISR: Failed to install MISR")); return eError; } SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_MISR_INSTALLED); /* install a system ISR */ eError = OSInstallSystemLISR(gpsSysData, gsSGXDeviceMap.ui32IRQ); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"OSInstallSystemLISR: Failed to install ISR")); return eError; } SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_LISR_INSTALLED); SysEnableInterrupts(gpsSysData); SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_IRQ_ENABLED); #endif /* defined(SYS_USING_INTERRUPTS) */ #if !defined(SUPPORT_ACTIVE_POWER_MANAGEMENT) SysPowerOnSGX(); #endif eError = SysCreateVersionString(gpsSysData, &gsSGXDeviceMap); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysFinalise: Failed to create a system version string")); } else { PVR_DPF((PVR_DBG_WARNING, "SysFinalise: Version string: %s", gpsSysData->pszVersionString)); } return PVRSRV_OK; }
/*! ****************************************************************************** @Function SysSystemPostPowerState @Description Perform system-level processing required after a system power transition @Input eNewPowerState : @Return PVRSRV_ERROR : ******************************************************************************/ PVRSRV_ERROR SysSystemPostPowerState(PVRSRV_SYS_POWER_STATE eNewPowerState) { PVRSRV_ERROR eError = PVRSRV_OK; if (eNewPowerState != gpsSysData->eCurrentPowerState) { if ((gpsSysData->eCurrentPowerState == PVRSRV_SYS_POWER_STATE_D3) && (eNewPowerState < PVRSRV_SYS_POWER_STATE_D3)) { #ifdef __linux__ eError = OSPCIResumeDev(gsSysSpecificData.hSGXPCI); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysSystemPostPowerState: OSPCIResumeDev failed (%d)", eError)); } #endif /* Returning from D3 state. Find the device again as it may have been remapped. */ eError = SysLocateDevices(gpsSysData); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysSystemPostPowerState: Failed to locate devices")); return eError; } /* * Since this is a local memory architecture system, any local memory * which is currently in use must be restored before power up. */ SysSaveRestoreArenaLiveSegments(IMG_FALSE); /* * Map the system-level registers. */ eError = SysMapInRegisters(); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysSystemPostPowerState: Failed to map in registers")); return eError; } /* Reset Atlas. */ eError = SysInitRegisters(); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysSystemPostPowerState: Failed to Initialise registers")); return eError; } #if defined(SYS_USING_INTERRUPTS) if (SYS_SPECIFIC_DATA_TEST(&gsSysSpecificData, SYS_SPECIFIC_DATA_PM_UNINSTALL_LISR)) { eError = OSInstallSystemLISR(gpsSysData, gsSGXDeviceMap.ui32IRQ); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysSystemPostPowerState: OSInstallSystemLISR failed to install ISR (%d)", eError)); } SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_ENABLE_LISR); SYS_SPECIFIC_DATA_CLEAR(&gsSysSpecificData, SYS_SPECIFIC_DATA_PM_UNINSTALL_LISR); } if (SYS_SPECIFIC_DATA_TEST(&gsSysSpecificData, SYS_SPECIFIC_DATA_PM_IRQ_DISABLE)) { SysEnableInterrupts(gpsSysData); SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_ENABLE_IRQ); SYS_SPECIFIC_DATA_CLEAR(&gsSysSpecificData, SYS_SPECIFIC_DATA_PM_IRQ_DISABLE); } #endif /* defined(SYS_USING_INTERRUPTS) */ } } return eError; }
/*! ****************************************************************************** @Function SysFinalise @Description Final part of initialisation @Return PVRSRV_ERROR : ******************************************************************************/ PVRSRV_ERROR SysFinalise(IMG_VOID) { PVRSRV_ERROR eError; #if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT) eError = EnableSGXClocks(); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysInitialise: Failed to Enable SGX clocks (%d)", eError)); (IMG_VOID)SysDeinitialise(gpsSysData); gpsSysData = IMG_NULL; return eError; } #endif eError = OSInstallMISR(gpsSysData); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"OSInstallMISR: Failed to install MISR")); SysDeinitialise(gpsSysData); gpsSysData = IMG_NULL; return eError; } gsSysSpecificData.ui32SysSpecificData |= SYS_SPECIFIC_DATA_ENABLE_MISR; #if defined(SYS_USING_INTERRUPTS) /* install a system ISR */ eError = OSInstallSystemLISR(gpsSysData, gsSGXDeviceMap.ui32IRQ); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"OSInstallSystemLISR: Failed to install ISR")); OSUninstallMISR(gpsSysData); SysDeinitialise(gpsSysData); gpsSysData = IMG_NULL; return eError; } gsSysSpecificData.ui32SysSpecificData |= SYS_SPECIFIC_DATA_ENABLE_LISR; gsSysSpecificData.ui32SysSpecificData |= SYS_SPECIFIC_DATA_ENABLE_IRQ; #endif /* defined(SYS_USING_INTERRUPTS) */ /* Create a human readable version string for this system */ gpsSysData->pszVersionString = gszVersionString; if (!gpsSysData->pszVersionString) { PVR_DPF((PVR_DBG_ERROR,"SysFinalise: Failed to create a system version string")); } else { PVR_DPF((PVR_DBG_WARNING, "SysFinalise: Version string: %s", gpsSysData->pszVersionString)); } #if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT) DisableSGXClocks(); cpufreq_register_notifier(&cpufreq_limit_notifier, CPUFREQ_POLICY_NOTIFIER); #endif return PVRSRV_OK; }
PVRSRV_ERROR SysSystemPostPowerState(PVRSRV_SYS_POWER_STATE eNewPowerState) { #if !defined(SUPPORT_DRI_DRM_EXT) PVRSRV_ERROR eError = PVRSRV_OK; if (eNewPowerState != gpsSysData->eCurrentPowerState) { if ((gpsSysData->eCurrentPowerState == PVRSRV_SYS_POWER_STATE_D3) && (eNewPowerState < PVRSRV_SYS_POWER_STATE_D3)) { eError = OSPCIResumeDev(gsSysSpecificData.hSGXPCI); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysSystemPostPowerState: OSPCIResumeDev failed (%d)", eError)); return eError; } eError = SysLocateDevices(gpsSysData); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysSystemPostPowerState: Failed to locate devices")); return eError; } eError = SysMapInRegisters(); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysSystemPostPowerState: Failed to map in registers")); return eError; } #if defined(SYS_USING_INTERRUPTS) if (SYS_SPECIFIC_DATA_TEST(&gsSysSpecificData, SYS_SPECIFIC_DATA_PM_UNINSTALL_LISR)) { eError = OSInstallSystemLISR(gpsSysData, gsSGXDeviceMap.ui32IRQ); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"SysSystemPostPowerState: OSInstallSystemLISR failed to install ISR (%d)", eError)); } SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_LISR_INSTALLED); SYS_SPECIFIC_DATA_CLEAR(&gsSysSpecificData, SYS_SPECIFIC_DATA_PM_UNINSTALL_LISR); } #endif if (SYS_SPECIFIC_DATA_TEST(&gsSysSpecificData, SYS_SPECIFIC_DATA_PM_IRQ_DISABLE)) { SysEnableInterrupts(gpsSysData); SYS_SPECIFIC_DATA_SET(&gsSysSpecificData, SYS_SPECIFIC_DATA_IRQ_ENABLED); SYS_SPECIFIC_DATA_CLEAR(&gsSysSpecificData, SYS_SPECIFIC_DATA_PM_IRQ_DISABLE); } } } return eError; #else PVR_UNREFERENCED_PARAMETER(eNewPowerState); return PVRSRV_ERROR_NOT_SUPPORTED; #endif }