dmidecode-devel
[Top][All Lists]
Advanced

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

Re: [dmidecode] [PATCH] Prefer SMBIOS3 when read entry point from efi sy


From: Jean Delvare
Subject: Re: [dmidecode] [PATCH] Prefer SMBIOS3 when read entry point from efi systab
Date: Fri, 7 Oct 2016 10:00:13 +0200

Hi Petr,

Please Cc dmidecode patches to the dmidecode-devel list.

On Thu, 06 Oct 2016 11:15:44 +0200, Petr Oros wrote:
> From 61c2e2b0c3b3c1e103b6648c9450f4c2e8efec52 Mon Sep 17 00:00:00 2001
> From: Petr Oros <address@hidden>
> Date: Thu, 6 Oct 2016 10:48:07 +0200
> Subject: [PATCH] Prefer SMBIOS3 when read entry point from efi systab
> 
>   According to the DMTF SMBIOS reference spec v3.0.0, it is
>   allowed to define both the 64-bit entry point (smbios3) and
>   the 32-bit entry point (smbios), in which case they should
>   either both point to the same SMBIOS structure table, or the
>   table pointed to by the 64-bit entry point should contain a
>   superset of the table contents pointed to by the 32-bit entry
>   point (section 5.2)
> 
>   In this case /sys/firmware/efi/systab can contain:
> 
>     ACPI20=0x7cefe014
>     ACPI=0x7cefe000
>     SMBIOS=0x00dead00
>     SMBIOS3=0xffdeadff

This is a very interesting address :-D

>   But for this case, processing end when found
>   first record and dmidecode fall back to older
>   table and ignore newer version. With this patch,
>   processing continue and SMBIOS accept only
>   if have not SMBIOS3 version.

This was fixed over a year ago in the kernel:

Author: Jean Delvare <address@hidden>
Date:   Thu Apr 30 15:23:05 2015 +0200

    efi: dmi: List SMBIOS3 table before SMBIOS table

I suggest you simply backport this fix to your kernel.

> 
>   Testing: tested on fake /sys/firmware/efi/systab
>   ./dmidecode
>   # dmidecode 3.0
>   # SMBIOS entry point at 0x00dead00
>   # SMBIOS3 entry point at 0xffdeadff
>   Found SMBIOS entry point in EFI, reading table from /dev/mem at 0xffdeadff.
> 
> Signed-off-by: Petr Oros <address@hidden>
> ---
>  dmidecode.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/dmidecode.c b/dmidecode.c
> index 3993592..44f1195 100644
> --- a/dmidecode.c
> +++ b/dmidecode.c
> @@ -4755,14 +4755,13 @@ static int address_from_efi(off_t *address)
>               char *addrp = strchr(linebuf, '=');
>               *(addrp++) = '\0';
>               if (strcmp(linebuf, "SMBIOS3") == 0
> -              || strcmp(linebuf, "SMBIOS") == 0)
> +              || (strcmp(linebuf, "SMBIOS") == 0 && *address == 0))
>               {
>                       *address = strtoull(addrp, NULL, 0);
>                       if (!(opt.flags & FLAG_QUIET))
>                               printf("# %s entry point at 0x%08llx\n",
>                                      linebuf, (unsigned long long)*address);
>                       ret = 0;
> -                     break;
>               }
>       }
>       if (fclose(efi_systab) != 0)
> @@ -4895,8 +4894,8 @@ int main(int argc, char * const argv[])
>       }
>  
>       if (!(opt.flags & FLAG_QUIET))
> -             printf("Found SMBIOS entry point in EFI, reading table from 
> %s.\n",
> -                    opt.devmem);
> +             printf("Found SMBIOS entry point in EFI, reading table from %s 
> at 0x%08lx.\n",
> +                    opt.devmem, fp);
>       if ((buf = mem_chunk(fp, 0x20, opt.devmem)) == NULL)
>       {
>               ret = 1;


-- 
Jean Delvare
SUSE L3 Support



reply via email to

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