  We present the rest-frame 8 micron luminosity function (LF) at redshifts z=1
and ~2, computed from Spitzer 24 micron-selected galaxies in the GOODS fields
over an area of 291 sq. arcmin. Using classification criteria based on X-ray
data and IRAC colours, we identify the AGN in our sample. The rest-frame 8
micron LF for star-forming galaxies at redshifts z=1 and ~2 have the same shape
as at z~0, but with a strong positive luminosity evolution. The number density
of star-forming galaxies with log_{10}(nu L_nu(8 micron))>11 increases by a
factor >250 from redshift z~0 to 1, and is basically the same at z=1 and ~2.
The resulting rest-frame 8 micron luminosity densities associated with star
formation at z=1 and ~2 are more than four and two times larger than at z~0,
respectively. We also compute the total rest-frame 8 micron LF for star-forming
galaxies and AGN at z~2 and show that AGN dominate its bright end, which is
well-described by a power-law. Using a new calibration based on Spitzer
star-forming galaxies at 0<z<0.6 and validated at higher redshifts through
stacking analysis, we compute the bolometric infrared (IR) LF for star-forming
galaxies at z=1 and ~2. We find that the respective bolometric IR luminosity
densities are (1.2+/-0.2) x 10^9 and (6.6^{+1.2}_{-1.0}) x 10^8 L_sun Mpc^{-3},
in agreement with previous studies within the error bars. At z~2, around 90% of
the IR luminosity density associated with star formation is produced by
luminous and ultraluminous IR galaxies (LIRG and ULIRG), with the two
populations contributing in roughly similar amounts. Finally, we discuss the
consistency of our findings with other existing observational results on galaxy
evolution.
