  Let $f$ be a primitive positive definite integral binary quadratic form of
discriminant $-D$ and let $\pi_f(x)$ be the number of primes up to $x$ which
are represented by $f$. We prove several types of upper bounds for $\pi_f(x)$
within a constant factor of its asymptotic size: unconditional, conditional on
the Generalized Riemann Hypothesis (GRH), and for almost all discriminants. The
key feature of these estimates is that they hold whenever $x$ exceeds a small
power of $D$ and, in some cases, this range of $x$ is essentially best
possible. In particular, if $f$ is reduced then this optimal range of $x$ is
achieved for almost all discriminants or by assuming GRH. We also exhibit an
upper bound for the number of primes represented by $f$ in a short interval and
a lower bound for the number of small integers represented by $f$ which have
few prime factors.
