diff mbox

hdata: Add BMC device-tree node for P9 OpenPOWER systems

Message ID 148854169808.28500.17194027943843855491.stgit@thinktux.in.ibm.com
State Accepted
Headers show

Commit Message

Ananth N Mavinakayanahalli March 3, 2017, 11:48 a.m. UTC
On P8 Hostboot creates the node. On P9, OPAL needs to create the node. BMC
information available in HDAT's SPINFO section.

Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
---
 hdata/fsp.c   |   17 ++++++++++++++++-
 hdata/spira.h |    1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

Comments

Joel Stanley March 3, 2017, 2:02 p.m. UTC | #1
On Fri, Mar 3, 2017 at 10:18 PM, Ananth N Mavinakayanahalli
<ananth@linux.vnet.ibm.com> wrote:
> On P8 Hostboot creates the node. On P9, OPAL needs to create the node. BMC
> information available in HDAT's SPINFO section.
>
> Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
> ---
>  hdata/fsp.c   |   17 ++++++++++++++++-
>  hdata/spira.h |    1 +
>  2 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/hdata/fsp.c b/hdata/fsp.c
> index f44f6a9..3896dc4 100644
> --- a/hdata/fsp.c
> +++ b/hdata/fsp.c
> @@ -279,11 +279,26 @@ static void add_uart(const struct spss_iopath *iopath, struct dt_node *lpc)
>
>  static void bmc_create_node(const struct HDIF_common_hdr *sp)

I know you didn't add this function, but bmc_create_node in fsp.c?
What happened here?

Cheers,

Joel

>  {
> +       struct dt_node *bmc_node;
>         u32 fw_bar, io_bar, mem_bar, internal_bar;
>         const struct spss_iopath *iopath;
> +       const struct spss_sp_impl *sp_impl;
>         struct dt_node *lpcm, *lpc, *n;
>         u64 lpcm_base, lpcm_end;
> -       int chip_id;
> +       int chip_id, size;
> +
> +       bmc_node = dt_new(dt_root, "bmc");
> +       assert(bmc_node);
> +
> +       dt_add_property_cells(bmc_node, "#address-cells", 1);
> +       dt_add_property_cells(bmc_node, "#size-cells", 0);
> +
> +       /* TODO: add sensor info under /bmc */
> +       sp_impl = HDIF_get_idata(sp, SPSS_IDATA_SP_IMPL, &size);
> +       if (CHECK_SPPTR(sp_impl) && (size > 8)) {
> +               dt_add_property_strings(bmc_node, "compatible", sp_impl->sp_family);
> +               prlog(PR_INFO, "SP Family is %s\n", sp_impl->sp_family);
> +       }
>
>         iopath = HDIF_get_iarray_item(sp, SPSS_IDATA_SP_IOPATH, 0, NULL);
>
> diff --git a/hdata/spira.h b/hdata/spira.h
> index 01ce4cb..a9338ee 100644
> --- a/hdata/spira.h
> +++ b/hdata/spira.h
> @@ -262,6 +262,7 @@ struct spss_sp_impl {
>  #define SPSS_SP_IMPL_FLAGS_PRIMARY     0x2000
>         u8      chip_version;
>         u8      reserved;
> +       u8      sp_family[64];
>  };
>
>  /* Idata index 3 is deprecated */
>
> _______________________________________________
> Skiboot mailing list
> Skiboot@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
Ananth N Mavinakayanahalli March 3, 2017, 2:29 p.m. UTC | #2
On Sat, Mar 04, 2017 at 12:32:04AM +1030, Joel Stanley wrote:
> On Fri, Mar 3, 2017 at 10:18 PM, Ananth N Mavinakayanahalli
> <ananth@linux.vnet.ibm.com> wrote:
> > On P8 Hostboot creates the node. On P9, OPAL needs to create the node. BMC
> > information available in HDAT's SPINFO section.
> >
> > Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
> > ---
> >  hdata/fsp.c   |   17 ++++++++++++++++-
> >  hdata/spira.h |    1 +
> >  2 files changed, 17 insertions(+), 1 deletion(-)
> >
> > diff --git a/hdata/fsp.c b/hdata/fsp.c
> > index f44f6a9..3896dc4 100644
> > --- a/hdata/fsp.c
> > +++ b/hdata/fsp.c
> > @@ -279,11 +279,26 @@ static void add_uart(const struct spss_iopath *iopath, struct dt_node *lpc)
> >
> >  static void bmc_create_node(const struct HDIF_common_hdr *sp)
> 
> I know you didn't add this function, but bmc_create_node in fsp.c?
> What happened here?

Well, I guess whoever wrote the early BMC support thought it the file
name wasn't that big a deal :-)

sp.c would've been an ideal name -- that cosmetic change for some other
day, I guess.
Oliver O'Halloran March 3, 2017, 2:36 p.m. UTC | #3
On Sat, Mar 4, 2017 at 1:02 AM, Joel Stanley <joel@jms.id.au> wrote:
> On Fri, Mar 3, 2017 at 10:18 PM, Ananth N Mavinakayanahalli
> <ananth@linux.vnet.ibm.com> wrote:
>> On P8 Hostboot creates the node. On P9, OPAL needs to create the node. BMC
>> information available in HDAT's SPINFO section.
>>
>> Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
>> ---
>>  hdata/fsp.c   |   17 ++++++++++++++++-
>>  hdata/spira.h |    1 +
>>  2 files changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/hdata/fsp.c b/hdata/fsp.c
>> index f44f6a9..3896dc4 100644
>> --- a/hdata/fsp.c
>> +++ b/hdata/fsp.c
>> @@ -279,11 +279,26 @@ static void add_uart(const struct spss_iopath *iopath, struct dt_node *lpc)
>>
>>  static void bmc_create_node(const struct HDIF_common_hdr *sp)
>
> I know you didn't add this function, but bmc_create_node in fsp.c?
> What happened here?

I thought it was funny. I regret nothing.

Oliver
Ananth N Mavinakayanahalli March 3, 2017, 2:42 p.m. UTC | #4
On Sat, Mar 04, 2017 at 01:36:11AM +1100, Oliver O'Halloran wrote:
> On Sat, Mar 4, 2017 at 1:02 AM, Joel Stanley <joel@jms.id.au> wrote:
> > On Fri, Mar 3, 2017 at 10:18 PM, Ananth N Mavinakayanahalli
> > <ananth@linux.vnet.ibm.com> wrote:
> >> On P8 Hostboot creates the node. On P9, OPAL needs to create the node. BMC
> >> information available in HDAT's SPINFO section.
> >>
> >> Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
> >> ---
> >>  hdata/fsp.c   |   17 ++++++++++++++++-
> >>  hdata/spira.h |    1 +
> >>  2 files changed, 17 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/hdata/fsp.c b/hdata/fsp.c
> >> index f44f6a9..3896dc4 100644
> >> --- a/hdata/fsp.c
> >> +++ b/hdata/fsp.c
> >> @@ -279,11 +279,26 @@ static void add_uart(const struct spss_iopath *iopath, struct dt_node *lpc)
> >>
> >>  static void bmc_create_node(const struct HDIF_common_hdr *sp)
> >
> > I know you didn't add this function, but bmc_create_node in fsp.c?
> > What happened here?
> 
> I thought it was funny. I regret nothing.

'Funny Service Processor'? :-)

May apply equally to FSP and BMC... ergo, aptly named.
Ananth N Mavinakayanahalli March 6, 2017, 5:26 a.m. UTC | #5
On Fri, Mar 03, 2017 at 05:18:18PM +0530, Ananth N Mavinakayanahalli wrote:
> On P8 Hostboot creates the node. On P9, OPAL needs to create the node. BMC
> information available in HDAT's SPINFO section.
> 
> Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>

This has been tested on a Witherspoon and works as expected.

Ananth
Joel Stanley March 6, 2017, 6:26 a.m. UTC | #6
On Mon, Mar 6, 2017 at 3:56 PM, Ananth N Mavinakayanahalli
<ananth@linux.vnet.ibm.com> wrote:
> On Fri, Mar 03, 2017 at 05:18:18PM +0530, Ananth N Mavinakayanahalli wrote:
>> On P8 Hostboot creates the node. On P9, OPAL needs to create the node. BMC
>> information available in HDAT's SPINFO section.
>>
>> Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
>
> This has been tested on a Witherspoon and works as expected.

Thanks Ananth.

Acked-by: Joel Stanley <joel@jms.id.au>

This is required for bootargs (and any other IPMI based things) to
work from Petitboot on P9 BMC machines.

 https://github.com/open-power/skiboot/issues/57

Cheers,

Joel
Stewart Smith March 7, 2017, 4:50 a.m. UTC | #7
Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> writes:
> On P8 Hostboot creates the node. On P9, OPAL needs to create the node. BMC
> information available in HDAT's SPINFO section.
>
> Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
> ---

Merged to master as of 0f28e38bbeaa11bda20b81f2247c82682d93d787
diff mbox

Patch

diff --git a/hdata/fsp.c b/hdata/fsp.c
index f44f6a9..3896dc4 100644
--- a/hdata/fsp.c
+++ b/hdata/fsp.c
@@ -279,11 +279,26 @@  static void add_uart(const struct spss_iopath *iopath, struct dt_node *lpc)
 
 static void bmc_create_node(const struct HDIF_common_hdr *sp)
 {
+	struct dt_node *bmc_node;
 	u32 fw_bar, io_bar, mem_bar, internal_bar;
 	const struct spss_iopath *iopath;
+	const struct spss_sp_impl *sp_impl;
 	struct dt_node *lpcm, *lpc, *n;
 	u64 lpcm_base, lpcm_end;
-	int chip_id;
+	int chip_id, size;
+
+	bmc_node = dt_new(dt_root, "bmc");
+	assert(bmc_node);
+
+	dt_add_property_cells(bmc_node, "#address-cells", 1);
+	dt_add_property_cells(bmc_node, "#size-cells", 0);
+
+	/* TODO: add sensor info under /bmc */
+	sp_impl = HDIF_get_idata(sp, SPSS_IDATA_SP_IMPL, &size);
+	if (CHECK_SPPTR(sp_impl) && (size > 8)) {
+		dt_add_property_strings(bmc_node, "compatible", sp_impl->sp_family);
+		prlog(PR_INFO, "SP Family is %s\n", sp_impl->sp_family);
+	}
 
 	iopath = HDIF_get_iarray_item(sp, SPSS_IDATA_SP_IOPATH, 0, NULL);
 
diff --git a/hdata/spira.h b/hdata/spira.h
index 01ce4cb..a9338ee 100644
--- a/hdata/spira.h
+++ b/hdata/spira.h
@@ -262,6 +262,7 @@  struct spss_sp_impl {
 #define SPSS_SP_IMPL_FLAGS_PRIMARY	0x2000
 	u8	chip_version;
 	u8	reserved;
+	u8	sp_family[64];
 };
 
 /* Idata index 3 is deprecated */