summaryrefslogtreecommitdiffstats
path: root/pvr-source/services4/srvkm/devices/sgx/sgxpower.c
diff options
context:
space:
mode:
Diffstat (limited to 'pvr-source/services4/srvkm/devices/sgx/sgxpower.c')
-rw-r--r--pvr-source/services4/srvkm/devices/sgx/sgxpower.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/pvr-source/services4/srvkm/devices/sgx/sgxpower.c b/pvr-source/services4/srvkm/devices/sgx/sgxpower.c
index 2acd28d..034deab 100644
--- a/pvr-source/services4/srvkm/devices/sgx/sgxpower.c
+++ b/pvr-source/services4/srvkm/devices/sgx/sgxpower.c
@@ -48,9 +48,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "sgxutils.h"
#include "pdump_km.h"
+extern IMG_UINT32 g_ui32HostIRQCountSample;
int powering_down = 0;
-
#if defined(SUPPORT_HW_RECOVERY)
static PVRSRV_ERROR SGXAddTimer(PVRSRV_DEVICE_NODE *psDeviceNode,
SGX_TIMING_INFORMATION *psSGXTimingInfo,
@@ -359,7 +359,11 @@ PVRSRV_ERROR SGXPrePowerState (IMG_HANDLE hDevHandle,
}
#endif /* NO_HARDWARE */
- psDevInfo->bSGXIdle = IMG_TRUE;
+ if (psDevInfo->bSGXIdle == IMG_FALSE)
+ {
+ psDevInfo->bSGXIdle = IMG_TRUE;
+ SysSGXIdleEntered();
+ }
#if defined(PDUMP)
PDUMPCOMMENT("TA/3D CCB Control - Wait for power event on uKernel.");
@@ -372,6 +376,20 @@ PVRSRV_ERROR SGXPrePowerState (IMG_HANDLE hDevHandle,
MAKEUNIQUETAG(psDevInfo->psKernelSGXHostCtlMemInfo));
#endif /* PDUMP */
+ /* Wait for the pending ukernel to host interrupts to come back. */
+ #if !defined(NO_HARDWARE)
+ if (PollForValueKM(&g_ui32HostIRQCountSample,
+ psDevInfo->psSGXHostCtl->ui32InterruptCount,
+ 0xffffffff,
+ MAX_HW_TIME_US,
+ MAX_HW_TIME_US/WAIT_TRY_COUNT,
+ IMG_FALSE) != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR,"SGXPrePowerState: Wait for pending interrupts failed."));
+ SGXDumpDebugInfo(psDevInfo, IMG_FALSE);
+ PVR_DBG_BREAK;
+ }
+ #endif /* NO_HARDWARE */
#if defined(SGX_FEATURE_MP)
ui32CoresEnabled = ((OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_CORE) & EUR_CR_MASTER_CORE_ENABLE_MASK) >> EUR_CR_MASTER_CORE_ENABLE_SHIFT) + 1;
#else
@@ -548,6 +566,18 @@ PVRSRV_ERROR SGXPreClockSpeedChange (IMG_HANDLE hDevHandle,
return eError;
}
}
+ else
+ {
+ #if defined(SUPPORT_HW_RECOVERY)
+ PVRSRV_ERROR eError;
+
+ eError = OSDisableTimer(psDevInfo->hTimer);
+ if (eError != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR,"SGXStartTimer : Failed to enable host timer"));
+ }
+ #endif /* SUPPORT_HW_RECOVERY */
+ }
}
PVR_DPF((PVR_DBG_MESSAGE,"SGXPreClockSpeedChange: SGX clock speed was %uHz",