Phase diagram and large deviations in the free energy of mean-field spin glasses