  We analyze the efficiency of thermal engines (either quantum or classical)
working with a single heat reservoir like atmosphere. The engine first gets an
energy intake, which can be done in arbitrary non-equilibrium way e.g.
combustion of fuel. Then the engine performs the work and returns to the
initial state. We distinguish two general classes of engines where the working
body first equilibrates within itself and then performs the work (ergodic
engine) or when it performs the work before equilibrating (non-ergodic engine).
We show that in both cases the second law of thermodynamics limits their
efficiency. For ergodic engines we find a rigorous upper bound for the
efficiency, which is strictly smaller than the equivalent Carnot efficiency.
I.e. the Carnot efficiency can be never achieved in single reservoir heat
engines. For non-ergodic engines the efficiency can be higher and can exceed
the equilibrium Carnot bound. By extending the fundamental thermodynamic
relation to nonequilibrium processes, we find a rigorous thermodynamic bound
for the efficiency of both ergodic and non-ergodic engines and show that it is
given by the relative entropy of the non-equilibrium and initial equilibrium
distributions.These results suggest a new general strategy for designing more
efficient engines. We illustrate our ideas by using simple examples.
