My 2007 legacy have same problem except , only P0304 ,
trouble shooting through, and give up send Subaru Dealer ,
got report that # 4 cylinder had leak , estimate cost $10,000 for repair
They say not worth fix it.
Car is good shape, Looking for goos repair shop now.