dmidecode-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [dmidecode] Adding -s bios-revision & -s firmware-revision support


From: Erwan Velu
Subject: Re: [dmidecode] Adding -s bios-revision & -s firmware-revision support
Date: Sat, 21 Sep 2019 12:44:15 +0200

Oh yes. I'll update the man page as well. Thanks for the review.

Le ven. 20 sept. 2019 à 23:04, Jerry Hoemann <address@hidden> a
écrit :

> On Tue, Sep 17, 2019 at 05:50:00PM +0200, Erwan Velu wrote:
> > Hey,
> > I faced a situation where some vendors like HPe encodes the release
> > version of the bios into the bios_revision field.
> >
> > Dmidecode only exports the bios-version which is not relevant here. So
> > I simply added a new entry of the -s option to expose this.
> >
> > I performed the same operation for the firmware_revision which helps
> > extraction the BMC version of the server.
> >
> > Both are useful when tracking firmware versions across an infrastructure.
>
> I tested the changes on a few proliants and they seem to work ad
> advertized.
>
> Shouldn't man/dmidecode.8 be updated to reflect changes in the command?
>
> thanks
>
> Jerry
>
> >
> > Please find the two patches attached,
> > Cheers,
> > Erwan
>
> > From 62e22ea8dec527f381c8bf3d8257b09d70743493 Mon Sep 17 00:00:00 2001
> > From: Erwan Velu <address@hidden>
> > Date: Tue, 17 Sep 2019 17:44:22 +0200
> > Subject: [PATCH 2/2] dmidecode: Adding firmware-revision support to -s
> option
> >
> > Most of servers like HPe, QCT, report the BMC version via the Firmware
> Revision field.
> >
> > This patch add an option to the -s to export this information directly.
> >
> > Signed-off-by: Erwan Velu <address@hidden>
> > ---
> >  dmidecode.c | 16 +++++++++++++---
> >  dmiopt.c    |  1 +
> >  2 files changed, 14 insertions(+), 3 deletions(-)
> >
> > diff --git a/dmidecode.c b/dmidecode.c
> > index 7cdcce93df4e..712127efb9af 100644
> > --- a/dmidecode.c
> > +++ b/dmidecode.c
> > @@ -320,6 +320,15 @@ static void dmi_bios_revision(u8 major, u8 minor)
> >       }
> >  }
> >
> > +static void dmi_firmware_revision(u8 major, u8 minor)
> > +{
> > +     if (major != 0xFF && minor != 0xFF) {
> > +             if (!(opt.flags & FLAG_QUIET))
> > +                     printf("\tFirmware Revision: ");
> > +             printf("%u.%u\n", major, minor);
> > +     }
> > +}
> > +
> >  static void dmi_bios_rom_size(u8 code1, u16 code2)
> >  {
> >       static const char *unit[4] = {
> > @@ -3888,9 +3897,7 @@ static void dmi_decode(const struct dmi_header *h,
> u16 ver)
> >                       dmi_bios_characteristics_x2(data[0x13], "\t\t");
> >                       if (h->length < 0x18) break;
> >                       dmi_bios_revision(data[0x14], data[0x15]);
> > -                     if (data[0x16] != 0xFF && data[0x17] != 0xFF)
> > -                             printf("\tFirmware Revision: %u.%u\n",
> > -                                     data[0x16], data[0x17]);
> > +                     dmi_firmware_revision(data[0x16], data[0x17]);
> >                       break;
> >
> >               case 1: /* 7.2 System Information */
> > @@ -5092,6 +5099,9 @@ static void dmi_table_string(const struct
> dmi_header *h, const u8 *data, u16 ver
> >               case 0x14:
> >                       dmi_bios_revision(data[offset], data[offset+1]);
> >                       break;
> > +             case 0x16:
> > +                     dmi_firmware_revision(data[offset],
> data[offset+1]);
> > +                     break;
> >               case 0x108:
> >                       dmi_system_uuid(data + offset, ver);
> >                       printf("\n");
> > diff --git a/dmiopt.c b/dmiopt.c
> > index cefe27d4554a..a67171f5a017 100644
> > --- a/dmiopt.c
> > +++ b/dmiopt.c
> > @@ -152,6 +152,7 @@ static const struct string_keyword
> opt_string_keyword[] = {
> >       { "bios-version", 0, 0x05 },
> >       { "bios-release-date", 0, 0x08 },
> >       { "bios-revision", 0, 0x14 },
> > +     { "firmware-revision", 0, 0x16 },
> >       { "system-manufacturer", 1, 0x04 },
> >       { "system-product-name", 1, 0x05 },
> >       { "system-version", 1, 0x06 },
> > --
> > 2.21.0
> >
>
> > From 76dcb63c956fead50bd26dcba46746d91a96f684 Mon Sep 17 00:00:00 2001
> > From: Erwan Velu <address@hidden>
> > Date: Tue, 17 Sep 2019 17:35:46 +0200
> > Subject: [PATCH 1/2] dmidecode: Adding bios-revision in -s mode
> >
> > Some hardware vendors like HPe use the Version field to store the bios
> generation like (U30, U32, A40, ...).
> > If you want to get the "release" version of this bios generation, the
> bios revision field must be considered.
> >
> > A typical output of this kind of server looks like :
> >
> >       BIOS Information
> >               Vendor: HPE
> >               Version: A40
> >               Release Date: 07/20/2019
> >               [...]
> >               BIOS Revision: 2.0
> >               Firmware Revision: 1.45
> >
> > This patch add a "bios-revision" option and rework the way this field is
> reported.
> >
> > Signed-off-by: Erwan Velu <address@hidden>
> > ---
> >  dmidecode.c | 16 +++++++++++++---
> >  dmiopt.c    |  1 +
> >  2 files changed, 14 insertions(+), 3 deletions(-)
> >
> > diff --git a/dmidecode.c b/dmidecode.c
> > index cff7d3f1941d..7cdcce93df4e 100644
> > --- a/dmidecode.c
> > +++ b/dmidecode.c
> > @@ -311,6 +311,15 @@ static void dmi_bios_runtime_size(u32 code)
> >               printf(" %u kB", code >> 10);
> >  }
> >
> > +static void dmi_bios_revision(u8 major, u8 minor)
> > +{
> > +     if (major != 0xFF && minor != 0xFF) {
> > +             if (!(opt.flags & FLAG_QUIET))
> > +                     printf("\tBIOS Revision: ");
> > +             printf("%u.%u\n", major, minor);
> > +     }
> > +}
> > +
> >  static void dmi_bios_rom_size(u8 code1, u16 code2)
> >  {
> >       static const char *unit[4] = {
> > @@ -3878,9 +3887,7 @@ static void dmi_decode(const struct dmi_header *h,
> u16 ver)
> >                       if (h->length < 0x14) break;
> >                       dmi_bios_characteristics_x2(data[0x13], "\t\t");
> >                       if (h->length < 0x18) break;
> > -                     if (data[0x14] != 0xFF && data[0x15] != 0xFF)
> > -                             printf("\tBIOS Revision: %u.%u\n",
> > -                                     data[0x14], data[0x15]);
> > +                     dmi_bios_revision(data[0x14], data[0x15]);
> >                       if (data[0x16] != 0xFF && data[0x17] != 0xFF)
> >                               printf("\tFirmware Revision: %u.%u\n",
> >                                       data[0x16], data[0x17]);
> > @@ -5082,6 +5089,9 @@ static void dmi_table_string(const struct
> dmi_header *h, const u8 *data, u16 ver
> >       key = (opt.string->type << 8) | offset;
> >       switch (key)
> >       {
> > +             case 0x14:
> > +                     dmi_bios_revision(data[offset], data[offset+1]);
> > +                     break;
> >               case 0x108:
> >                       dmi_system_uuid(data + offset, ver);
> >                       printf("\n");
> > diff --git a/dmiopt.c b/dmiopt.c
> > index 2f285f34a96b..cefe27d4554a 100644
> > --- a/dmiopt.c
> > +++ b/dmiopt.c
> > @@ -151,6 +151,7 @@ static const struct string_keyword
> opt_string_keyword[] = {
> >       { "bios-vendor", 0, 0x04 },
> >       { "bios-version", 0, 0x05 },
> >       { "bios-release-date", 0, 0x08 },
> > +     { "bios-revision", 0, 0x14 },
> >       { "system-manufacturer", 1, 0x04 },
> >       { "system-product-name", 1, 0x05 },
> >       { "system-version", 1, 0x06 },
> > --
> > 2.21.0
> >
>
> > _______________________________________________
> > https://lists.nongnu.org/mailman/listinfo/dmidecode-devel
>
>
> --
>
>
> -----------------------------------------------------------------------------
> Jerry Hoemann                  Software Engineer   Hewlett Packard
> Enterprise
>
> -----------------------------------------------------------------------------
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]