Good night time. I only skimed though but if your PCIe cards are not working then PCIe resets are wrong. You need to find out what GPIO they are and fix mainboard.c functions.
There is AGESA callback for that so it could be read out from orig bios bootblock.
Try GPM8/9 as in mine asrock board (asrock/939....)
Thanks Rudolf