diff mbox series

[v4,05/13] smbios: Add more properties

Message ID 20201022141949.711984-5-sjg@chromium.org
State Superseded
Delegated to: Bin Meng
Headers show
Series x86: Updates to SMBIOS | expand

Commit Message

Simon Glass Oct. 22, 2020, 2:19 p.m. UTC
The current tables only support a subset of the available fields defined
by the SMBIOS spec. Add a few more.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 lib/smbios.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Bin Meng Nov. 3, 2020, 8:39 a.m. UTC | #1
Hi Simon,

On Thu, Oct 22, 2020 at 10:20 PM Simon Glass <sjg@chromium.org> wrote:
>
> The current tables only support a subset of the available fields defined
> by the SMBIOS spec. Add a few more.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> (no changes since v1)
>
>  lib/smbios.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/lib/smbios.c b/lib/smbios.c
> index be72a98c49d..87dd4be415d 100644
> --- a/lib/smbios.c
> +++ b/lib/smbios.c
> @@ -173,12 +173,15 @@ static int smbios_write_type1(ulong *current, int handle, ofnode node)
>                                                   CONFIG_SMBIOS_MANUFACTURER);
>         t->product_name = smbios_add_prop_default(t->eos, node, "product",
>                                                   CONFIG_SMBIOS_PRODUCT_NAME);
> +       t->version = smbios_add_prop(t->eos, node, "version");

How about:

t->version = smbios_add_prop_default(t->eos, node, "version",
U_BOOT_VERSION_STRING);

>         if (serial_str) {
>                 t->serial_number = smbios_add_string(t->eos, serial_str);
>                 strncpy((char *)t->uuid, serial_str, sizeof(t->uuid));
>         } else {
>                 t->serial_number = smbios_add_prop(t->eos, node, "serial");
>         }
> +       t->sku_number = smbios_add_prop(t->eos, node, "sku");
> +       t->family = smbios_add_prop(t->eos, node, "family");

t->family = smbios_add_prop_default(t->eos, node, "family", CONFIG_SYS_CPU)?

>
>         len = t->length + smbios_string_table_len(t->eos);
>         *current += len;
> @@ -199,6 +202,7 @@ static int smbios_write_type2(ulong *current, int handle, ofnode node)
>                                                   CONFIG_SMBIOS_MANUFACTURER);
>         t->product_name = smbios_add_prop_default(t->eos, node, "product",
>                                                   CONFIG_SMBIOS_PRODUCT_NAME);
> +       t->asset_tag_number = smbios_add_prop(t->eos, node, "asset-tag");
>         t->feature_flags = SMBIOS_BOARD_FEATURE_HOSTING;
>         t->board_type = SMBIOS_BOARD_MOTHERBOARD;
>
> --

Regards,
Bin
Bin Meng Nov. 3, 2020, 9:02 a.m. UTC | #2
On Tue, Nov 3, 2020 at 4:39 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Simon,
>
> On Thu, Oct 22, 2020 at 10:20 PM Simon Glass <sjg@chromium.org> wrote:
> >
> > The current tables only support a subset of the available fields defined
> > by the SMBIOS spec. Add a few more.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> > (no changes since v1)
> >
> >  lib/smbios.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/lib/smbios.c b/lib/smbios.c
> > index be72a98c49d..87dd4be415d 100644
> > --- a/lib/smbios.c
> > +++ b/lib/smbios.c
> > @@ -173,12 +173,15 @@ static int smbios_write_type1(ulong *current, int handle, ofnode node)
> >                                                   CONFIG_SMBIOS_MANUFACTURER);
> >         t->product_name = smbios_add_prop_default(t->eos, node, "product",
> >                                                   CONFIG_SMBIOS_PRODUCT_NAME);
> > +       t->version = smbios_add_prop(t->eos, node, "version");
>
> How about:
>
> t->version = smbios_add_prop_default(t->eos, node, "version",
> U_BOOT_VERSION_STRING);

Ignore this. It is not for the bootloader version, but the product version ..

>
> >         if (serial_str) {
> >                 t->serial_number = smbios_add_string(t->eos, serial_str);
> >                 strncpy((char *)t->uuid, serial_str, sizeof(t->uuid));
> >         } else {
> >                 t->serial_number = smbios_add_prop(t->eos, node, "serial");
> >         }
> > +       t->sku_number = smbios_add_prop(t->eos, node, "sku");
> > +       t->family = smbios_add_prop(t->eos, node, "family");
>
> t->family = smbios_add_prop_default(t->eos, node, "family", CONFIG_SYS_CPU)?
>
> >
> >         len = t->length + smbios_string_table_len(t->eos);
> >         *current += len;
> > @@ -199,6 +202,7 @@ static int smbios_write_type2(ulong *current, int handle, ofnode node)
> >                                                   CONFIG_SMBIOS_MANUFACTURER);
> >         t->product_name = smbios_add_prop_default(t->eos, node, "product",
> >                                                   CONFIG_SMBIOS_PRODUCT_NAME);
> > +       t->asset_tag_number = smbios_add_prop(t->eos, node, "asset-tag");
> >         t->feature_flags = SMBIOS_BOARD_FEATURE_HOSTING;
> >         t->board_type = SMBIOS_BOARD_MOTHERBOARD;
> >
> > --

Regards,
Bin
Simon Glass Nov. 4, 2020, 4:20 p.m. UTC | #3
Hi Bin,

On Tue, 3 Nov 2020 at 01:40, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Simon,
>
> On Thu, Oct 22, 2020 at 10:20 PM Simon Glass <sjg@chromium.org> wrote:
> >
> > The current tables only support a subset of the available fields defined
> > by the SMBIOS spec. Add a few more.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> > (no changes since v1)
> >
> >  lib/smbios.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/lib/smbios.c b/lib/smbios.c
> > index be72a98c49d..87dd4be415d 100644
> > --- a/lib/smbios.c
> > +++ b/lib/smbios.c
> > @@ -173,12 +173,15 @@ static int smbios_write_type1(ulong *current, int handle, ofnode node)
> >                                                   CONFIG_SMBIOS_MANUFACTURER);
> >         t->product_name = smbios_add_prop_default(t->eos, node, "product",
> >                                                   CONFIG_SMBIOS_PRODUCT_NAME);
> > +       t->version = smbios_add_prop(t->eos, node, "version");
>
> How about:
>
> t->version = smbios_add_prop_default(t->eos, node, "version",
> U_BOOT_VERSION_STRING);
>
> >         if (serial_str) {
> >                 t->serial_number = smbios_add_string(t->eos, serial_str);
> >                 strncpy((char *)t->uuid, serial_str, sizeof(t->uuid));
> >         } else {
> >                 t->serial_number = smbios_add_prop(t->eos, node, "serial");
> >         }
> > +       t->sku_number = smbios_add_prop(t->eos, node, "sku");
> > +       t->family = smbios_add_prop(t->eos, node, "family");
>
> t->family = smbios_add_prop_default(t->eos, node, "family", CONFIG_SYS_CPU)?

I did that but then realised that this table refers to the system not
just the CPU. I added a comment to the commit message.

Regards,
Simon
diff mbox series

Patch

diff --git a/lib/smbios.c b/lib/smbios.c
index be72a98c49d..87dd4be415d 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -173,12 +173,15 @@  static int smbios_write_type1(ulong *current, int handle, ofnode node)
 						  CONFIG_SMBIOS_MANUFACTURER);
 	t->product_name = smbios_add_prop_default(t->eos, node, "product",
 						  CONFIG_SMBIOS_PRODUCT_NAME);
+	t->version = smbios_add_prop(t->eos, node, "version");
 	if (serial_str) {
 		t->serial_number = smbios_add_string(t->eos, serial_str);
 		strncpy((char *)t->uuid, serial_str, sizeof(t->uuid));
 	} else {
 		t->serial_number = smbios_add_prop(t->eos, node, "serial");
 	}
+	t->sku_number = smbios_add_prop(t->eos, node, "sku");
+	t->family = smbios_add_prop(t->eos, node, "family");
 
 	len = t->length + smbios_string_table_len(t->eos);
 	*current += len;
@@ -199,6 +202,7 @@  static int smbios_write_type2(ulong *current, int handle, ofnode node)
 						  CONFIG_SMBIOS_MANUFACTURER);
 	t->product_name = smbios_add_prop_default(t->eos, node, "product",
 						  CONFIG_SMBIOS_PRODUCT_NAME);
+	t->asset_tag_number = smbios_add_prop(t->eos, node, "asset-tag");
 	t->feature_flags = SMBIOS_BOARD_FEATURE_HOSTING;
 	t->board_type = SMBIOS_BOARD_MOTHERBOARD;