From 566b4f008f51a5ea3eee9356ed80322f34c36017 Mon Sep 17 00:00:00 2001 From: Rudolf Marek Date: Sun, 12 Jan 2014 00:23:30 +0100 Subject: AGESA f15tn: Fix GPP ports resume The AGESA resumes the GPP ports in the romstage using FchInitResetGpp(), which does FchGppPortInitS3Phase() for S3 resume. The PreInitGppLink() looks into CMOS to figure out what ports to just force to Gen1 or Gen2 PCIe. Then boot continues and in the ramstage the rest of GPP init is executed. There is a problem that nobody sets properly the PortDetected flags in the S3 path. As the consequence FchGppDynamicPowerSaving() thinks the GPP port is not enabled and shut downs it. The best fix would be also to remove the CMOS dependency which might be some left over, because AGESA does not use CMOS much for anything else. There could be also some way how to pass the GPP state structure from romstage to ramstage possibly via hudson/resume.c but I don't know how to do that. Similar problem is that the "late" stage of init again "forgets" the PortDetected state. This fix fixes the resume issue on Asus F2A85-M. With this patch applied both GPP ports (used as PCIe x1 and internal ethernet) are working again after resume. Change-Id: Idaf609043abb09441c6790504d66d23e0637588f Signed-off-by: Rudolf Marek Reviewed-on: http://review.coreboot.org/4671 Tested-by: build bot (Jenkins) Reviewed-by: Idwer Vollering Reviewed-by: Ronald G. Minnich --- src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c | 16 ++++++++++++++++ src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppLate.c | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'src/vendorcode/amd') diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c index e4db032b7c..678ddaa227 100644 --- a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c +++ b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c @@ -65,10 +65,26 @@ FchInitEnvGpp ( { FCH_DATA_BLOCK *LocalCfgPtr; AMD_CONFIG_PARAMS *StdHeader; + UINT8 GppS3Data; + UINT8 PortId; LocalCfgPtr = (FCH_DATA_BLOCK *) FchDataPtr; StdHeader = LocalCfgPtr->StdHeader; + /* + * The romstage will force link, but re-read the GPP params from CMOS, + * otherwise the late init will powerdown all ports including + * those which were just taken out of S3 + */ + if (ReadFchSleepType (StdHeader) == ACPI_SLPTYP_S3) { + ReadMem ( ACPI_MMIO_BASE + CMOS_RAM_BASE + 0x0D, AccessWidth8, &GppS3Data); + for ( PortId = 0; PortId < MAX_GPP_PORTS; PortId++ ) { + if ( GppS3Data & (1 << (PortId + 4))) { + LocalCfgPtr->Gpp.PortCfg[PortId].PortDetected = TRUE; + } + } + } + if ( !LocalCfgPtr->Gpp.NewGppAlgorithm) { ProgramFchGppInitReset (&LocalCfgPtr->Gpp, StdHeader); FchStall (5000, StdHeader); diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppLate.c b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppLate.c index d4c9fe9604..4c77358716 100644 --- a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppLate.c +++ b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppLate.c @@ -281,6 +281,9 @@ FchInitLateGpp ( RwAlink (0x310 | (UINT32) (ABCFG << 29), 0xFFFFFFFF, BIT7, StdHeader); RwAlink (FCH_RCINDXC_REGC0, 0xFFFFFFFF, BIT9, StdHeader); } - RwMem (ACPI_MMIO_BASE + CMOS_RAM_BASE + 0x0D, AccessWidth8, 0, GppS3Data); + + if (ReadFchSleepType (StdHeader) != ACPI_SLPTYP_S3) { + RwMem (ACPI_MMIO_BASE + CMOS_RAM_BASE + 0x0D, AccessWidth8, 0, GppS3Data); + } } -- cgit v1.2.3