  We study the electroweak baryogenesis in a fermionic dark matter scenario
with a (pseudo)scalar being the mediator in the Higgs portal. It is discussed
that the electroweak phase transition turns to be first-order after taking into
account the role of the (pseudo)scalar in the thermal effective potential in
our extended standard model. Imposing the relic density constraint from the
WMAP/Planck and the bounds from the direct detection experiments XENON100/LUX,
we show that the dark matter scenario with a scalar mediator is hardly capable
of explaining the baryogenesis while the same model with a pseudoscalar
mediator is able to explain the baryon asymmetry. For the latter, we constrain
more the model with {\it Fermi}-LAT upper limit on dark matter annihilation
into $b\bar b$ and $\tau^+\tau^-$. The allowed dark matter mass that leads to
correct relic abundance, renders the electroweak phase transition strongly
first-order, and respects the {\it Fermi}-LAT limit, will be in the range
$110-320$ GeV. The exotic and invisible Higgs decay bounds and the mono-jet
search limit at the LHC do not affect the viable space of parameters.
