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

Gavin Shan gwshan at linux.vnet.ibm.com
Wed Aug 10 09:51:19 AEST 2016


On Tue, Aug 09, 2016 at 12:39:18PM +0530, Mamatha Inamdar wrote:
>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>

Reviewed-by: Gavin Shan <gwshan at linux.vnet.ibm.com>

With below minor issues fixed:

>---
> 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);

double space before "%x" seems unnecessary. Also, the comment would
be more meaningful:

	/* Raise error message when root port or devices behind it
	 * are not found.
	 */

>+}
>+
> 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]);

The condition to call phb_final_fixup() is as below. Otherwise, it's
going to break the device node binding on NPU.

		if (phbs[i]->ops && phbs[i]->ops->phb_final_fixup) 

> 	}
> }
> 
>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 */
>

Thanks,
Gavin



More information about the Skiboot mailing list