diff mbox series

[v2] core/pci: Fix FSP platforms to favor slot-location-codes over labels

Message ID 20200209020130.31031-1-klaus@linux.vnet.ibm.com
State Superseded
Headers show
Series [v2] core/pci: Fix FSP platforms to favor slot-location-codes over labels | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (179d53dfcca30436777b0c748d530a979bbc8a45)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Klaus Heinrich Kiwi Feb. 9, 2020, 2:01 a.m. UTC
FSP Systems will favor fully-qualified "ibm,slot-location-codes" (e.g.
"UOPWR.001.XYZ0000-P1-C2" over "ibm,slot-label" (e.g. "C2") for it's
"ibm,loc-code" property on pci devices.

Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
---
 core/pci.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Oliver O'Halloran Feb. 13, 2020, 12:52 a.m. UTC | #1
On Sun, Feb 9, 2020 at 1:01 PM Klaus Heinrich Kiwi
<klaus@linux.vnet.ibm.com> wrote:
>
> FSP Systems will favor fully-qualified "ibm,slot-location-codes" (e.g.
> "UOPWR.001.XYZ0000-P1-C2" over "ibm,slot-label" (e.g. "C2") for it's
> "ibm,loc-code" property on pci devices.
>
> Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
> ---
>  core/pci.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/core/pci.c b/core/pci.c
> index 8b52fc10..b2703d3b 100644
> --- a/core/pci.c
> +++ b/core/pci.c
> @@ -1393,10 +1393,14 @@ static void pci_add_loc_code(struct dt_node *np, struct pci_device *pd)
>         uint8_t pos, len;
>
>         while (p) {
> -               /* if we have a slot label (i.e. openpower) use that */
> -               blcode = dt_prop_get_def(p, "ibm,slot-label", NULL);
> -               if (blcode)
> -                       break;
> +               /* BMC platforms will favor slot-label, while FSP platforms will
> +                * prefer slot-location-code
> +                */

/*
 * use the this style for multi-line comments
 */

> +               if (platform.bmc) {
> +                       blcode = dt_prop_get_def(p, "ibm,slot-label", NULL);
> +                       if (blcode)
> +                               break;
> +               }

The existing hacks that check for platform.bmc sort of made sense when
we added them since there was a very clear split between FSP and BMC.
However, with eBMC in the pipeline that's not really true any more. I
think it would make more sense to turn pci_add_loc_code into an
optional platform callback. The current slot-label behaviour can be
the default and platforms that want to use fully-qualified location
codes can override that.

It would also let us move that dumb network card location code hack
out of generic code so it'd be a nice cleanup.


>
>                 /* otherwise use the fully qualified location code */
>                 blcode = dt_prop_get_def(p, "ibm,slot-location-code", NULL);
> --
> 2.17.1
>
> --
> Skiboot-stable mailing list
> Skiboot-stable@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot-stable
diff mbox series

Patch

diff --git a/core/pci.c b/core/pci.c
index 8b52fc10..b2703d3b 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -1393,10 +1393,14 @@  static void pci_add_loc_code(struct dt_node *np, struct pci_device *pd)
 	uint8_t pos, len;
 
 	while (p) {
-		/* if we have a slot label (i.e. openpower) use that */
-		blcode = dt_prop_get_def(p, "ibm,slot-label", NULL);
-		if (blcode)
-			break;
+		/* BMC platforms will favor slot-label, while FSP platforms will
+		 * prefer slot-location-code
+		 */
+		if (platform.bmc) {
+			blcode = dt_prop_get_def(p, "ibm,slot-label", NULL);
+			if (blcode)
+				break;
+		}
 
 		/* otherwise use the fully qualified location code */
 		blcode = dt_prop_get_def(p, "ibm,slot-location-code", NULL);