Protective mechanism of phosphorus-containing coatings