Excitation spectra and piezospectroscopic effects of neutral and singly ionized magnesium donors in silicon