[Skiboot] [PATCH 2/6] hw/phb4: Locate AER capability position if necessary

Gavin Shan gwshan at linux.vnet.ibm.com
Thu Mar 30 10:05:27 AEDT 2017


Similar to PHB3, phb4_init_rc_cfg() can be called when the PHB is
initialized or reinitialized after complete reset. In the later case,
we needn't locate the AER capability position again and the cached
position can be used as we do for PCIe capability. So several CPU
cycles can be saved. The error message is shortened and meaningless
comment is dropped as well.

Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
---
 hw/phb4.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/hw/phb4.c b/hw/phb4.c
index 314e0f7..894b61a 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -2512,13 +2512,16 @@ static bool phb4_init_rc_cfg(struct phb4 *p)
 	 *
 	 * AER inits
 	 */
-	aercap = pci_find_ecap(&p->phb, 0, PCIECAP_ID_AER, NULL);
-	if (aercap < 0) {
-		/* Shouldn't happen */
-		PHBERR(p, "Failed to locate AER Ecapability in bridge\n");
-		return false;
+	if (p->aercap <= 0) {
+		aercap = pci_find_ecap(&p->phb, 0, PCIECAP_ID_AER, NULL);
+		if (aercap < 0) {
+			PHBERR(p, "Can't locate AER capability\n");
+			return false;
+		}
+		p->aercap = aercap;
+	} else {
+		aercap = p->aercap;
 	}
-	p->aercap = aercap;
 
 	/* Clear all UE status */
 	phb4_pcicfg_write32(&p->phb, 0, aercap + PCIECAP_AER_UE_STATUS,
-- 
2.7.4



More information about the Skiboot mailing list