[Skiboot] [PATCH V3] PCI: Commit an error log if PCI adapters are not deteced

Mamatha Inamdar mamatha4 at linux.vnet.ibm.com
Tue Aug 9 17:09:18 AEST 2016


This patch is for committing an error log when PCI adapters 
are not found in RC's children list

Signed-off-by: Mamatha Inamdar <mamatha4 at linux.vnet.ibm.com>
---
 core/pci.c         |   21 +++++++++++++++++++--
 include/errorlog.h |    3 ++-
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/core/pci.c b/core/pci.c
index cbaea35..a4ec0b0 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -21,6 +21,7 @@
 #include <pci-slot.h>
 #include <timebase.h>
 #include <device.h>
+#include <errorlog.h>
 #include <fsp.h>
 
 #define MAX_PHB_ID	256
@@ -48,6 +49,9 @@ int last_phb_id = 0;
 	      ((_bdfn) >> 8) & 0xff,			\
 	      ((_bdfn) >> 3) & 0x1f, (_bdfn) & 0x7, ## a)
 
+DEFINE_LOG_ENTRY(OPAL_RC_PCI_DETECT_DEV, OPAL_PLATFORM_ERR_EVT, OPAL_PCI,
+		OPAL_MISC_SUBSYSTEM,OPAL_PREDICTIVE_ERR_GENERAL,
+		OPAL_NA);
 /*
  * Generic PCI utilities
  */
@@ -1510,6 +1514,17 @@ static void pci_do_jobs(void (*fn)(void *))
 	free(jobs);
 }
 
+static void check_present_device(struct phb *phb)
+{
+	struct pci_device *pd;
+
+	/* check for presence of pci_device */
+	pd = list_pop(&phb->devices, struct pci_device, link);
+	if (!pd || list_empty(&pd->children))
+		log_simple_error(&e_info(OPAL_RC_PCI_DETECT_DEV),  "%x"
+			"pci device Not Found", phb->opal_id);
+}
+
 void pci_init_slots(void)
 {
 	unsigned int i;
@@ -1535,10 +1550,12 @@ void pci_init_slots(void)
 
 	/* PHB final fixup */
 	for (i = 0; i < ARRAY_SIZE(phbs); i++) {
-		if (!phbs[i] || !phbs[i]->ops || !phbs[i]->ops->phb_final_fixup)
+		if (!phbs[i])
 			continue;
 
-		phbs[i]->ops->phb_final_fixup(phbs[i]);
+		if (!phbs[i]->ops && phbs[i]->ops->phb_final_fixup)
+			phbs[i]->ops->phb_final_fixup(phbs[i]);
+		check_present_device(phbs[i]);
 	}
 }
 
diff --git a/include/errorlog.h b/include/errorlog.h
index f89eac9..0325546 100644
--- a/include/errorlog.h
+++ b/include/errorlog.h
@@ -281,7 +281,8 @@ enum opal_reasoncode {
 	OPAL_RC_PCI_INIT_SLOT	    = OPAL_SRC_COMPONENT_PCI | 0x10,
 	OPAL_RC_PCI_ADD_SLOT	    = OPAL_SRC_COMPONENT_PCI | 0x11,
 	OPAL_RC_PCI_SCAN	    = OPAL_SRC_COMPONENT_PCI | 0x12,
-	OPAL_RC_PCI_RESET_PHB	    = OPAL_SRC_COMPONENT_PCI | 0x10,
+	OPAL_RC_PCI_RESET_PHB	    = OPAL_SRC_COMPONENT_PCI | 0x13,
+	OPAL_RC_PCI_DETECT_DEV	    = OPAL_SRC_COMPONENT_PCI | 0x14,
 /* ATTN */
 	OPAL_RC_ATTN		    = OPAL_SRC_COMPONENT_ATTN | 0x10,
 /* MEM_ERR */



More information about the Skiboot mailing list