Silly question, did you reciently change out yoru airfilter ?
Those codes can mean a multitude of things, but starting out with un-mettered air getting into the system would be the #1 place to look ( as 864Lightning noted ). PCV rubber boot on the back of the intake, vac lines rotting, etc. There are a few places that un-mettered air can get into the system, but would be something large such as the rubber boot, to set the CEL.
Did it just start running rough, or did it slowly get worse ?
The reason I aks is if the Intake elbow was on part way, and finally worked its way to a larger gap, the engine would have been kind of running rough, then slowly got worse.
Cleaning the MAFS is a good thing. Carefully clean the wire in the pillar. I use Windex and a Q-tip, JMC gave me that idea, and it works well for me. Some prefer to use T/B safe T/B cleaner ( which brand that is I don't recall, look for a note on safe to use, usage directions ).
The next list of items would be the DPFE ( did I weite that correctly ? ), which has to do with the EGR and EVR.
If you try a search on P017*, you will find a few posts on the topic, and the steps that memebers took in problem determination, as I can recall 3 soultions to similar problems ( code the same area P017* ).
Good luck, let us know if you have any other questions or get stuck on the topic again.