_mali_osk_errcode_t mali_gp_stop_bus_wait(struct mali_gp_core *core) { int i; const int request_loop_count = 20; MALI_DEBUG_ASSERT_POINTER(core); mali_gp_stop_bus(core); for (i = 0; i < request_loop_count; i++) { if (mali_hw_core_register_read(&core->hw_core, MALIGP2_REG_ADDR_MGMT_STATUS) & MALIGP2_REG_VAL_STATUS_BUS_STOPPED) { break; } _mali_osk_time_ubusydelay(10); } if (request_loop_count == i) { MALI_PRINT_ERROR(("Mali GP: Failed to stop bus on %s\n", core->hw_core.description)); return _MALI_OSK_ERR_FAULT; } return _MALI_OSK_ERR_OK; }
_mali_osk_errcode_t mali_gp_stop_bus_wait(struct mali_gp_core *core) { int i; MALI_DEBUG_ASSERT_POINTER(core); /* Send the stop bus command. */ mali_gp_stop_bus(core); /* Wait for bus to be stopped */ for (i = 0; i < MALI_REG_POLL_COUNT_FAST; i++) { if (mali_hw_core_register_read(&core->hw_core, MALIGP2_REG_ADDR_MGMT_STATUS) & MALIGP2_REG_VAL_STATUS_BUS_STOPPED) { break; } } if (MALI_REG_POLL_COUNT_FAST == i) { MALI_PRINT_ERROR(("Mali GP: Failed to stop bus on %s\n", core->hw_core.description)); return _MALI_OSK_ERR_FAULT; } return _MALI_OSK_ERR_OK; }
static void mali_group_recovery_reset(struct mali_group *group) { MALI_ASSERT_GROUP_LOCKED(group); /* Stop cores, bus stop */ if (NULL != group->pp_core) { mali_pp_stop_bus(group->pp_core); } if (NULL != group->gp_core) { mali_gp_stop_bus(group->gp_core); } /* Flush MMU */ mali_mmu_activate_fault_flush_page_directory(group->mmu); mali_mmu_page_fault_done(group->mmu); /* Wait for cores to stop bus */ if (NULL != group->pp_core) { mali_pp_stop_bus_wait(group->pp_core); } if (NULL != group->gp_core) { mali_gp_stop_bus_wait(group->gp_core); } /* Reset cores */ if (NULL != group->pp_core) { mali_pp_hard_reset(group->pp_core); } if (NULL != group->gp_core) { mali_gp_hard_reset(group->gp_core); } /* Reset MMU */ mali_mmu_reset(group->mmu); group->session = NULL; }