In a-Si:H, large concentrations of B or P (of order 1%) are required to dope the material, suggesting that doping mechanisms are very different than for the crystal for which much smaller concentrations are required. In this paper, we report simulations on B and P introduced into realistic models of a-Si:H and a-Si, with concentrations ranging from 1.6% to 12.5% of B or P in the amorphous host. The results indicate that tetrahedral B and P are effective doping configurations in a-Si, but high impurity concentrations introduce many defect states. For a-Si:H, we report that both B(3,1) and P(3,1) (B or P atom bonded with three Si atoms and one H atom) are effective doping configurations. We investigate H passivation in both cases. For both B and P, there exists a “hydrogen poison range” of order 6 Å for which H in a bond-center site can suppress doping. For B doping, nearby H prefers to stay at the bond-center of Si-Si, leaves B four-fold and neutralizes the doping configuration; for P doping, nearby H spoils the doping by inducing a reconstruction rendering initially tetrahedral P three-fold.