Ionization, luminosity, and heating of the upper atmosphere of Mars