freeipmi-devel
[Top][All Lists]
Advanced

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

Re: [Freeipmi-devel] Issue with, UEFI support in ipmi-locate


From: Albert Chu
Subject: Re: [Freeipmi-devel] Issue with, UEFI support in ipmi-locate
Date: Tue, 19 Aug 2014 13:51:33 -0700

Hi Mark,

Looks good to me.  I possess no systems with EFI so I can only assume
the patch works :P  It'll be released with the next release.

I assumed you also opened bug #43026 and this patch fixes it.  So I
closed both it and #43027.

Al

On Tue, 2014-08-19 at 19:38 +0000, Rusk, Mark wrote:
> I just submitted a bug report (along with a patch) for ipmi-locate (#43027).
>   
> The first issue is that UEFI support is conditionally compiled.  Support for 
> UEFI should be standard in ipmi-locate, as it is easy to determine if a 
> system supports UEFI from the presence of /sys/firmware/efi/systab (or 
> /proc/firmware/efi/systab prior to 2.6.6-rc3). A single ipmi-locate in a RPM 
> or DEB needs to support both UEFI and legacy BIOS platforms.
> 
> Further the UEFI code is conditionally compile based on  USE_EFI which is 
> only defined if __ia64__ is defined.
> 
> The patch removes the #ifdef/#ifndef USE_UEFI  and further fixes a case where 
> the end of the SMBIOS= line in /sys/firmware/efi/systab is terminated with a 
> LF and not a NULL.
> 
> 
> Mark Rusk
> --------------------------------------------------------------------------------
> --- freeipmi-1.4.5/libfreeipmi/locate/ipmi-locate-dmidecode.c   2014-01-03 
> 18:45:22.000000000 -0500
> +++ freeipmi-1.4.5.fixed/libfreeipmi/locate/ipmi-locate-dmidecode.c     
> 2014-08-19 14:14:08.845109706 -0400
> @@ -47,10 +47,6 @@
> 
>  #include "freeipmi-portability.h"
> 
> -#ifdef __ia64__
> -#define USE_EFI
> -#endif /* __ia64__ */
> -
>  #define DEFAULT_MEM_DEV "/dev/mem"
> 
>  typedef uint8_t fipmiu8;
> @@ -422,7 +418,6 @@
>    return (-1);
>  }
> 
> -#ifndef USE_EFI
>  static int
>  _legacy_decode (ipmi_locate_ctx_t ctx,
>                  fipmiu8 *buf,
> @@ -448,7 +443,6 @@
> 
>    return (-1);
>  }
> -#endif /* USE_EFI */
> 
>  int
>  ipmi_locate_dmidecode_get_device_info (ipmi_locate_ctx_t ctx,
> @@ -458,11 +452,9 @@
>    struct ipmi_locate_info locate_info;
>    int found = 0;
>    size_t fp;
> -#ifdef USE_EFI
>    FILE *efi_systab;
>    const char *filename;
>    char linebuf[64];
> -#endif /* USE_EFI */
>    fipmiu8 *buf = NULL;
>    int rv = -1;
> 
> @@ -479,19 +471,13 @@
>      }
> 
>    memset (&locate_info, '\0', sizeof (struct ipmi_locate_info));
> -#ifdef USE_EFI
>    /*
>     * Linux up to 2.6.6-rc2: /proc/efi/systab
>     * Linux 2.6.6-rc3 and up: /sys/firmware/efi/systab
>     */
> -  if ((!(efi_systab = fopen (filename = "/proc/efi/systab", "r")))
> -      && (!(efi_systab = fopen (filename = "/sys/firmware/efi/systab", 
> "r"))))
> +  if (((efi_systab = fopen (filename = "/proc/efi/systab", "r")))
> +      || ((efi_systab = fopen (filename = "/sys/firmware/efi/systab", "r"))))
>      {
> -      ERRNO_TRACE (errno);
> -      LOCATE_SET_ERRNUM (ctx, IPMI_LOCATE_ERR_SYSTEM_ERROR);
> -      return (-1);
> -    }
> -
>    fp = 0;
>    while ((fgets (linebuf, sizeof (linebuf) - 1, efi_systab)))
>      {
> @@ -504,7 +490,7 @@
>           errno = 0;
>           fp = strtoul (addr, &endptr, 0);
>           if (errno
> -             || endptr[0] != '\0')
> +               || ((endptr[0] != '\0') && (endptr[0] != 0x0a)))
>             {
>               LOCATE_SET_ERRNUM (ctx, IPMI_LOCATE_ERR_SYSTEM_ERROR);
>               return (-1);
> @@ -526,7 +512,7 @@
>      found++;
> 
>    free (buf);
> -#else /* USE_EFI */
> +    } else {
>    if (!(buf = _mem_chunk (ctx, 0xF0000, 0x10000, DEFAULT_MEM_DEV)))
>      return (-1);
> 
> @@ -560,7 +546,7 @@
>      }
> 
>    free (buf);
> -#endif /* USE_EFI */
> +  }
> 
>    if (found)
>      {
> 
> _______________________________________________
> Freeipmi-devel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/freeipmi-devel
-- 
Albert Chu
address@hidden
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory





reply via email to

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