Eliciting In-context Retrieval and Reasoning for Long-context Large Language Models