Module Name:    src
Committed By:   jmcneill
Date:           Thu Aug 16 18:22:05 UTC 2018

Modified Files:
        src/sys/external/bsd/gnu-efi/dist/inc: efiapi.h efidef.h efistdarg.h
        src/sys/external/bsd/gnu-efi/dist/inc/ia32: efibind.h
        src/sys/external/bsd/gnu-efi/dist/inc/ia64: efibind.h
        src/sys/external/bsd/gnu-efi/dist/inc/x86_64: efibind.h
        src/sys/external/bsd/gnu-efi/dist/lib: dpath.c event.c hand.c hw.c

Log Message:
Merge conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/gnu-efi/dist/inc/efiapi.h \
    src/sys/external/bsd/gnu-efi/dist/inc/efidef.h \
    src/sys/external/bsd/gnu-efi/dist/inc/efistdarg.h
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/gnu-efi/dist/inc/ia32/efibind.h
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/gnu-efi/dist/inc/ia64/efibind.h
cvs rdiff -u -r1.2 -r1.3 \
    src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efibind.h
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/gnu-efi/dist/lib/dpath.c \
    src/sys/external/bsd/gnu-efi/dist/lib/event.c \
    src/sys/external/bsd/gnu-efi/dist/lib/hw.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/gnu-efi/dist/lib/hand.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/gnu-efi/dist/inc/efiapi.h
diff -u src/sys/external/bsd/gnu-efi/dist/inc/efiapi.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/efiapi.h:1.3
--- src/sys/external/bsd/gnu-efi/dist/inc/efiapi.h:1.2	Thu Aug  4 18:08:12 2016
+++ src/sys/external/bsd/gnu-efi/dist/inc/efiapi.h	Thu Aug 16 18:22:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiapi.h,v 1.2 2016/08/04 18:08:12 scole Exp $	*/
+/*	$NetBSD: efiapi.h,v 1.3 2018/08/16 18:22:05 jmcneill Exp $	*/
 
 #ifndef _EFI_API_H
 #define _EFI_API_H
@@ -109,8 +109,6 @@ EFI_STATUS
 // EFI Events
 //
 
-
-
 #define EVT_TIMER                           0x80000000
 #define EVT_RUNTIME                         0x40000000
 #define EVT_RUNTIME_CONTEXT                 0x20000000
@@ -122,7 +120,18 @@ EFI_STATUS
 #define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE   0x60000202
 
 #define EVT_EFI_SIGNAL_MASK                 0x000000FF
-#define EVT_EFI_SIGNAL_MAX                  2
+#define EVT_EFI_SIGNAL_MAX                  4
+
+#define EFI_EVENT_TIMER                         EVT_TIMER
+#define EFI_EVENT_RUNTIME                       EVT_RUNTIME
+#define EFI_EVENT_RUNTIME_CONTEXT               EVT_RUNTIME_CONTEXT
+#define EFI_EVENT_NOTIFY_WAIT                   EVT_NOTIFY_WAIT
+#define EFI_EVENT_NOTIFY_SIGNAL                 EVT_NOTIFY_SIGNAL
+#define EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES     EVT_SIGNAL_EXIT_BOOT_SERVICES
+#define EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE
+#define EFI_EVENT_EFI_SIGNAL_MASK               EVT_EFI_SIGNAL_MASK
+#define EFI_EVENT_EFI_SIGNAL_MAX                EVT_EFI_SIGNAL_MAX
+
 
 typedef
 VOID
@@ -186,11 +195,14 @@ EFI_STATUS
 // Task priority level
 //
 
-#define TPL_APPLICATION    4
-#define TPL_CALLBACK       8
-#define TPL_NOTIFY        16 
-#define TPL_HIGH_LEVEL    31 
-
+#define TPL_APPLICATION       4
+#define TPL_CALLBACK          8
+#define TPL_NOTIFY           16
+#define TPL_HIGH_LEVEL       31
+#define EFI_TPL_APPLICATION  TPL_APPLICATION
+#define EFI_TPL_CALLBACK     TPL_CALLBACK
+#define EFI_TPL_NOTIFY       TPL_NOTIFY
+#define EFI_TPL_HIGH_LEVEL   TPL_HIGH_LEVEL
 typedef
 EFI_TPL
 (EFIAPI *EFI_RAISE_TPL) (
@@ -212,9 +224,13 @@ VOID
     { 0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} }
 
 // Variable attributes
-#define EFI_VARIABLE_NON_VOLATILE           0x00000001
-#define EFI_VARIABLE_BOOTSERVICE_ACCESS     0x00000002
-#define EFI_VARIABLE_RUNTIME_ACCESS         0x00000004
+#define EFI_VARIABLE_NON_VOLATILE                          0x00000001
+#define EFI_VARIABLE_BOOTSERVICE_ACCESS                    0x00000002
+#define EFI_VARIABLE_RUNTIME_ACCESS                        0x00000004
+#define EFI_VARIABLE_HARDWARE_ERROR_RECORD                 0x00000008
+#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS            0x00000010
+#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020
+#define EFI_VARIABLE_APPEND_WRITE                          0x00000040
 
 // Variable size limitation
 #define EFI_MAXIMUM_VARIABLE_SIZE           1024
@@ -312,6 +328,22 @@ EFI_STATUS
 #define EFI_IMAGE_MACHINE_IA64      0x0200
 #endif
 
+#if !defined(EFI_IMAGE_MACHINE_EBC)
+#define EFI_IMAGE_MACHINE_EBC      0x0EBC
+#endif
+
+#if !defined(EFI_IMAGE_MACHINE_X64)
+#define EFI_IMAGE_MACHINE_X64       0x8664
+#endif
+
+#if !defined(EFI_IMAGE_MACHINE_ARMTHUMB_MIXED)
+#define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED 0x01C2
+#endif
+
+#if !defined(EFI_IMAGE_MACHINE_AARCH64)
+#define EFI_IMAGE_MACHINE_AARCH64   0xAA64
+#endif
+
 // Image Entry prototype
 
 typedef 
@@ -349,15 +381,9 @@ EFI_STATUS
     IN CHAR16                       *ExitData OPTIONAL
     );
 
-typedef 
-EFI_STATUS
-(EFIAPI *EFI_IMAGE_UNLOAD) (
-    IN EFI_HANDLE                   ImageHandle
-    );
-
 
 // Image handle
-#define LOADED_IMAGE_PROTOCOL      \
+/*#define LOADED_IMAGE_PROTOCOL      \
     { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
 
 #define EFI_IMAGE_INFORMATION_REVISION      0x1000
@@ -384,7 +410,7 @@ typedef struct {
     // If the driver image supports a dynamic unload request
     EFI_IMAGE_UNLOAD                Unload;
 
-} EFI_LOADED_IMAGE;
+} EFI_LOADED_IMAGE;*/
 
 
 typedef
@@ -583,6 +609,51 @@ EFI_STATUS
     OUT UINT32                  *HighCount
     );
 
+typedef struct {
+    UINT64                      Length;
+    union {
+        EFI_PHYSICAL_ADDRESS    DataBlock;
+       EFI_PHYSICAL_ADDRESS    ContinuationPointer;
+    } Union;
+} EFI_CAPSULE_BLOCK_DESCRIPTOR;
+
+typedef struct {
+    EFI_GUID                    CapsuleGuid;
+    UINT32                      HeaderSize;
+    UINT32                      Flags;
+    UINT32                      CapsuleImageSize;
+} EFI_CAPSULE_HEADER;
+
+#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET    0x00010000
+#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE   0x00020000
+#define CAPSULE_FLAGS_INITIATE_RESET          0x00040000
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UPDATE_CAPSULE) (
+    IN EFI_CAPSULE_HEADER       **CapsuleHeaderArray,
+    IN UINTN                    CapsuleCount,
+    IN EFI_PHYSICAL_ADDRESS     ScatterGatherList OPTIONAL
+    );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES) (
+    IN  EFI_CAPSULE_HEADER       **CapsuleHeaderArray,
+    IN  UINTN                    CapsuleCount,
+    OUT UINT64                   *MaximumCapsuleSize,
+    OUT EFI_RESET_TYPE           *ResetType
+    );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_QUERY_VARIABLE_INFO) (
+    IN  UINT32                  Attributes,
+    OUT UINT64                  *MaximumVariableStorageSize,
+    OUT UINT64                  *RemainingVariableStorageSize,
+    OUT UINT64                  *MaximumVariableSize
+    );
+
 //
 // Protocol handler functions
 //
@@ -668,7 +739,7 @@ EFI_STATUS
 // Standard EFI table header
 //
 
-typedef struct _EFI_TABLE_HEARDER {
+typedef struct _EFI_TABLE_HEADER {
     UINT64                      Signature;
     UINT32                      Revision;
     UINT32                      HeaderSize;
@@ -718,6 +789,9 @@ typedef struct  {
     EFI_GET_NEXT_HIGH_MONO_COUNT    GetNextHighMonotonicCount;
     EFI_RESET_SYSTEM                ResetSystem;
 
+    EFI_UPDATE_CAPSULE              UpdateCapsule;
+    EFI_QUERY_CAPSULE_CAPABILITIES  QueryCapsuleCapabilities;
+    EFI_QUERY_VARIABLE_INFO         QueryVariableInfo;
 } EFI_RUNTIME_SERVICES;
 
 
@@ -845,6 +919,9 @@ typedef struct _EFI_BOOT_SERVICES {
 #define SMBIOS_TABLE_GUID    \
     { 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
 
+#define SMBIOS3_TABLE_GUID    \
+    { 0xf2fd1544, 0x9794, 0x4a2c, {0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94} }
+
 #define SAL_SYSTEM_TABLE_GUID    \
     { 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
 
Index: src/sys/external/bsd/gnu-efi/dist/inc/efidef.h
diff -u src/sys/external/bsd/gnu-efi/dist/inc/efidef.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/efidef.h:1.3
--- src/sys/external/bsd/gnu-efi/dist/inc/efidef.h:1.2	Tue Feb 14 13:29:09 2017
+++ src/sys/external/bsd/gnu-efi/dist/inc/efidef.h	Thu Aug 16 18:22:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: efidef.h,v 1.2 2017/02/14 13:29:09 nonaka Exp $	*/
+/*	$NetBSD: efidef.h,v 1.3 2018/08/16 18:22:05 jmcneill Exp $	*/
 
 #ifndef _EFI_DEF_H
 #define _EFI_DEF_H
@@ -25,7 +25,9 @@ Revision History
 typedef UINT16          CHAR16;
 typedef UINT8           CHAR8;
 typedef UINT8           BOOLEAN;
-
+#ifndef CONST
+   #define CONST const
+#endif
 #ifndef TRUE
     #define TRUE    ((BOOLEAN) 1)
     #define FALSE   ((BOOLEAN) 0)
@@ -209,4 +211,13 @@ typedef UINT8   ISO_639_2;
 #define EFI_SIZE_TO_PAGES(a)  \
     ( ((a) >> EFI_PAGE_SHIFT) + ((a) & EFI_PAGE_MASK ? 1 : 0) )
 
+#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI        0x0000000000000001
+#define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002
+#define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED \
+                                                0x0000000000000004
+#define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED \
+                                                0x0000000000000008
+#define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED \
+                                                0x0000000000000010
+
 #endif
Index: src/sys/external/bsd/gnu-efi/dist/inc/efistdarg.h
diff -u src/sys/external/bsd/gnu-efi/dist/inc/efistdarg.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/efistdarg.h:1.3
--- src/sys/external/bsd/gnu-efi/dist/inc/efistdarg.h:1.2	Tue Apr  8 17:55:18 2014
+++ src/sys/external/bsd/gnu-efi/dist/inc/efistdarg.h	Thu Aug 16 18:22:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: efistdarg.h,v 1.2 2014/04/08 17:55:18 jakllsch Exp $	*/
+/*	$NetBSD: efistdarg.h,v 1.3 2018/08/16 18:22:05 jmcneill Exp $	*/
 
 #ifndef _EFISTDARG_H_
 #define _EFISTDARG_H_
@@ -20,20 +20,20 @@ Abstract:
 Revision History
 
 --*/
-#ifdef __GNUC__
+
+#ifndef GNU_EFI_USE_EXTERNAL_STDARG
 #ifdef __NetBSD__
 #include <sys/stdarg.h>
 #else
-#include "stdarg.h"
+typedef __builtin_va_list va_list;
+
+# define va_start(v,l)	__builtin_va_start(v,l)
+# define va_end(v)	__builtin_va_end(v)
+# define va_arg(v,l)	__builtin_va_arg(v,l)
+# define va_copy(d,s)	__builtin_va_copy(d,s)
 #endif
 #else
-#define _INTSIZEOF(n)   ( (sizeof(n) + sizeof(UINTN) - 1) & ~(sizeof(UINTN) - 1) )
-
-typedef CHAR8 * va_list;
-
-#define va_start(ap,v)  ( ap = (va_list)&v + _INTSIZEOF(v) )
-#define va_arg(ap,t)    ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
-#define va_end(ap)  ( ap = (va_list)0 )
+# include <stdarg.h>
 #endif
 
-#endif  /* _INC_STDARG */
+#endif

Index: src/sys/external/bsd/gnu-efi/dist/inc/ia32/efibind.h
diff -u src/sys/external/bsd/gnu-efi/dist/inc/ia32/efibind.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/ia32/efibind.h:1.3
--- src/sys/external/bsd/gnu-efi/dist/inc/ia32/efibind.h:1.2	Tue Apr  1 16:22:45 2014
+++ src/sys/external/bsd/gnu-efi/dist/inc/ia32/efibind.h	Thu Aug 16 18:22:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: efibind.h,v 1.2 2014/04/01 16:22:45 jakllsch Exp $	*/
+/*	$NetBSD: efibind.h,v 1.3 2018/08/16 18:22:05 jmcneill Exp $	*/
 
 /*++
 
@@ -237,9 +237,13 @@ typedef uint32_t   UINTN;
 
 //
 // When build similiar to FW, then link everything together as
-// one big module.
+// one big module. For the MSVC toolchain, we simply tell the
+// linker what our driver init function is using /ENTRY.
 //
-
+#if defined(_MSC_EXTENSIONS)
+    #define EFI_DRIVER_ENTRY_POINT(InitFunction) \
+        __pragma(comment(linker, "/ENTRY:" # InitFunction))
+#else
     #define EFI_DRIVER_ENTRY_POINT(InitFunction)    \
         UINTN                                       \
         InitializeDriver (                          \
@@ -256,6 +260,7 @@ typedef uint32_t   UINTN;
             EFI_SYSTEM_TABLE *systab                \
             ) __attribute__((weak,                  \
                     alias ("InitializeDriver")));
+#endif
 
     #define LOAD_INTERNAL_DRIVER(_if, type, name, entry)    \
             (_if)->LoadInternal(type, name, entry)
@@ -271,7 +276,7 @@ typedef uint32_t   UINTN;
 #ifdef NO_INTERFACE_DECL
 #define INTERFACE_DECL(x)
 #else
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(_MSC_EXTENSIONS)
 #define INTERFACE_DECL(x) struct x
 #else
 #define INTERFACE_DECL(x) typedef struct x

Index: src/sys/external/bsd/gnu-efi/dist/inc/ia64/efibind.h
diff -u src/sys/external/bsd/gnu-efi/dist/inc/ia64/efibind.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/ia64/efibind.h:1.3
--- src/sys/external/bsd/gnu-efi/dist/inc/ia64/efibind.h:1.2	Tue Apr  1 16:22:45 2014
+++ src/sys/external/bsd/gnu-efi/dist/inc/ia64/efibind.h	Thu Aug 16 18:22:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: efibind.h,v 1.2 2014/04/01 16:22:45 jakllsch Exp $	*/
+/*	$NetBSD: efibind.h,v 1.3 2018/08/16 18:22:05 jmcneill Exp $	*/
 
 /*++
 
@@ -183,27 +183,33 @@ void __mf (void);                       
 #pragma intrinsic (__mf)  
 #define MEMORY_FENCE()    __mf()
 #endif
+
 //
 // When build similiar to FW, then link everything together as
-// one big module.
+// one big module. For the MSVC toolchain, we simply tell the
+// linker what our driver init function is using /ENTRY.
 //
-
-#define EFI_DRIVER_ENTRY_POINT(InitFunction)    \
-    UINTN                                       \
-    InitializeDriver (                          \
-        VOID    *ImageHandle,                   \
-        VOID    *SystemTable                    \
-        )                                       \
-    {                                           \
-        return InitFunction(ImageHandle,        \
-                SystemTable);                   \
-    }                                           \
-                                                \
-    EFI_STATUS efi_main(                        \
-        EFI_HANDLE image,                       \
-        EFI_SYSTEM_TABLE *systab                \
-        ) __attribute__((weak,                  \
-                alias ("InitializeDriver")));
+#if defined(_MSC_EXTENSIONS)
+    #define EFI_DRIVER_ENTRY_POINT(InitFunction) \
+        __pragma(comment(linker, "/ENTRY:" # InitFunction))
+#else
+    #define EFI_DRIVER_ENTRY_POINT(InitFunction)    \
+        UINTN                                       \
+        InitializeDriver (                          \
+            VOID    *ImageHandle,                   \
+            VOID    *SystemTable                    \
+            )                                       \
+        {                                           \
+            return InitFunction(ImageHandle,        \
+                    SystemTable);                   \
+        }                                           \
+                                                    \
+        EFI_STATUS efi_main(                        \
+            EFI_HANDLE image,                       \
+            EFI_SYSTEM_TABLE *systab                \
+            ) __attribute__((weak,                  \
+                    alias ("InitializeDriver")));
+#endif
 
 #define LOAD_INTERNAL_DRIVER(_if, type, name, entry)    \
         (_if)->LoadInternal(type, name, entry)
@@ -217,7 +223,7 @@ void __mf (void);                       
 #ifdef NO_INTERFACE_DECL
 #define INTERFACE_DECL(x)
 #else
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(_MSC_EXTENSIONS)
 #define INTERFACE_DECL(x) struct x
 #else
 #define INTERFACE_DECL(x) typedef struct x

Index: src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efibind.h
diff -u src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efibind.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efibind.h:1.3
--- src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efibind.h:1.2	Tue Apr  1 16:22:45 2014
+++ src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efibind.h	Thu Aug 16 18:22:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: efibind.h,v 1.2 2014/04/01 16:22:45 jakllsch Exp $	*/
+/*	$NetBSD: efibind.h,v 1.3 2018/08/16 18:22:05 jmcneill Exp $	*/
 
 /*++
 
@@ -25,7 +25,7 @@ Revision History
 #endif
 
 #if defined(GNU_EFI_USE_MS_ABI)
-    #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
+    #if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)))||(defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 2)))
         #define HAVE_USE_MS_ABI 1
     #else
         #error Compiler is too old for GNU_EFI_USE_MS_ABI
@@ -249,9 +249,13 @@ typedef uint64_t   UINTN;
 
 //
 // When build similiar to FW, then link everything together as
-// one big module.
+// one big module. For the MSVC toolchain, we simply tell the
+// linker what our driver init function is using /ENTRY.
 //
-
+#if defined(_MSC_EXTENSIONS)
+    #define EFI_DRIVER_ENTRY_POINT(InitFunction) \
+        __pragma(comment(linker, "/ENTRY:" # InitFunction))
+#else
     #define EFI_DRIVER_ENTRY_POINT(InitFunction)    \
         UINTN                                       \
         InitializeDriver (                          \
@@ -268,11 +272,12 @@ typedef uint64_t   UINTN;
             EFI_SYSTEM_TABLE *systab                \
             ) __attribute__((weak,                  \
                     alias ("InitializeDriver")));
+#endif
 
     #define LOAD_INTERNAL_DRIVER(_if, type, name, entry)    \
             (_if)->LoadInternal(type, name, entry)
 
-#endif // EFI_FW_NT 
+#endif // EFI_NT_EMULATOR
 
 //
 // Some compilers don't support the forward reference construct:
@@ -283,7 +288,7 @@ typedef uint64_t   UINTN;
 #ifdef NO_INTERFACE_DECL
 #define INTERFACE_DECL(x)
 #else
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(_MSC_EXTENSIONS)
 #define INTERFACE_DECL(x) struct x
 #else
 #define INTERFACE_DECL(x) typedef struct x
@@ -372,10 +377,15 @@ UINT64 efi_call10(void *func, UINT64 arg
 
 /* main wrapper (va_num ignored) */
 #define uefi_call_wrapper(func,va_num,...)                        \
-  __VA_ARG_NSUFFIX__(_cast64_efi_call, __VA_ARGS__) (func, __VA_ARGS__)
+  __VA_ARG_NSUFFIX__(_cast64_efi_call, __VA_ARGS__) (func , ##__VA_ARGS__)
 
 #endif
-#define EFI_FUNCTION __attribute__((ms_abi))
+
+#if defined(HAVE_USE_MS_ABI) && !defined(_MSC_EXTENSIONS)
+    #define EFI_FUNCTION __attribute__((ms_abi))
+#else
+    #define EFI_FUNCTION
+#endif
 
 #ifdef _MSC_EXTENSIONS
 #pragma warning ( disable : 4731 )  // Suppress warnings about modification of EBP

Index: src/sys/external/bsd/gnu-efi/dist/lib/dpath.c
diff -u src/sys/external/bsd/gnu-efi/dist/lib/dpath.c:1.2 src/sys/external/bsd/gnu-efi/dist/lib/dpath.c:1.3
--- src/sys/external/bsd/gnu-efi/dist/lib/dpath.c:1.2	Sat Feb  4 18:08:29 2017
+++ src/sys/external/bsd/gnu-efi/dist/lib/dpath.c	Thu Aug 16 18:22:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: dpath.c,v 1.2 2017/02/04 18:08:29 mlelstv Exp $	*/
+/*	$NetBSD: dpath.c,v 1.3 2018/08/16 18:22:05 jmcneill Exp $	*/
 
 /*++
 
@@ -15,6 +15,13 @@ Abstract:
 
 Revision History
 
+2014/04 B.Burette - updated device path text representation, conforming to
+	UEFI specification 2.4 (dec. 2013). More specifically:
+	- § 9.3.5: added some media types ie. Sata()
+	- § 9.6.1.2: Acpi(PNP0A03,0) makes more sense when displayed as PciRoot(0)
+	- § 9.6.1.5: use commas (instead of '|') between option specific parameters
+	- § 9.6.1.6: hex values in device paths must be preceded by "0x" or "0X"
+
 --*/
 
 #include "lib.h"
@@ -58,7 +65,7 @@ DevicePathInstance (
 
     //
     // Check for end of device path type
-    //    
+    //
 
     for (Count = 0; ; Count++) {
         Next = NextDevicePathNode(DevPath);
@@ -123,7 +130,7 @@ AppendDevicePath (
     )
 // Src1 may have multiple "instances" and each instance is appended
 // Src2 is appended to each instance is Src1.  (E.g., it's possible
-// to append a new instance to the complete device path by passing 
+// to append a new instance to the complete device path by passing
 // it in Src2)
 {
     UINTN               Src1Size, Src1Inst, Src2Size, Size;
@@ -159,7 +166,7 @@ AppendDevicePath (
     Src1Inst = DevicePathInstanceCount(Src1);
     Src2Size = DevicePathSize(Src2);
     Size = Src1Size * Src1Inst + Src2Size;
-    
+
     Dst = AllocatePool (Size);
     if (Dst) {
         DstPos = (UINT8 *) Dst;
@@ -212,7 +219,7 @@ AppendDevicePathNode (
     }
 
     CopyMem (Temp, Src2, Length);
-    Eop = NextDevicePathNode(Temp); 
+    Eop = NextDevicePathNode(Temp);
     SetDevicePathEndNode(Eop);
 
     //
@@ -239,7 +246,7 @@ FileDevicePath (
 {
     UINTN                   Size;
     FILEPATH_DEVICE_PATH    *FilePath;
-    EFI_DEVICE_PATH         *Eop, *DevicePath;    
+    EFI_DEVICE_PATH         *Eop, *DevicePath;
 
     Size = StrSize(FileName);
     FilePath = AllocateZeroPool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + sizeof(EFI_DEVICE_PATH));
@@ -287,7 +294,7 @@ DevicePathSize (
 
     //
     // Search for the end of the device path structure
-    //    
+    //
 
     Start = DevPath;
     while (!IsDevicePathEnd(DevPath)) {
@@ -307,7 +314,7 @@ DuplicateDevicePath (
     )
 {
     EFI_DEVICE_PATH     *NewDevPath;
-    UINTN               Size;    
+    UINTN               Size;
 
 
     //
@@ -335,10 +342,10 @@ UnpackDevicePath (
 {
     EFI_DEVICE_PATH     *Src, *Dest, *NewPath;
     UINTN               Size;
-    
+
     //
     // Walk device path and round sizes to valid boundries
-    //    
+    //
 
     Src = DevPath;
     Size = 0;
@@ -411,7 +418,7 @@ AppendDevicePathInstance (
 
     CopyMem (Ptr, Src, SrcSize);
 //    FreePool (Src);
-    
+
     while (!IsDevicePathEnd(DevPath)) {
         DevPath = NextDevicePathNode(DevPath);
     }
@@ -421,7 +428,7 @@ AppendDevicePathInstance (
     //  idea.
     //
     DevPath->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
-    
+
     DevPath = NextDevicePathNode(DevPath);
     CopyMem (DevPath, Instance, InstanceSize);
     return (EFI_DEVICE_PATH *)Ptr;
@@ -465,7 +472,7 @@ LibDevicePathToInterface (
     return Status;
 }
 
-VOID
+static VOID
 _DevPathPci (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -474,10 +481,10 @@ _DevPathPci (
     PCI_DEVICE_PATH         *Pci;
 
     Pci = DevPath;
-    CatPrint(Str, L"Pci(%x|%x)", Pci->Device, Pci->Function);
+    CatPrint(Str, L"Pci(0x%x,0x%x)", Pci->Device, Pci->Function);
 }
 
-VOID
+static VOID
 _DevPathPccard (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -485,11 +492,11 @@ _DevPathPccard (
 {
     PCCARD_DEVICE_PATH      *Pccard;
 
-    Pccard = DevPath;   
-    CatPrint(Str, L"Pccard(Socket%x)", Pccard->SocketNumber);
+    Pccard = DevPath;
+    CatPrint(Str, L"Pccard(0x%x)", Pccard-> FunctionNumber );
 }
 
-VOID
+static VOID
 _DevPathMemMap (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -497,15 +504,15 @@ _DevPathMemMap (
 {
     MEMMAP_DEVICE_PATH      *MemMap;
 
-    MemMap = DevPath;   
-    CatPrint(Str, L"MemMap(%d:%x-%x)",
+    MemMap = DevPath;
+    CatPrint(Str, L"MemMap(%d,0x%x,0x%x)",
         MemMap->MemoryType,
         MemMap->StartingAddress,
         MemMap->EndingAddress
         );
 }
 
-VOID
+static VOID
 _DevPathController (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -519,7 +526,7 @@ _DevPathController (
         );
 }
 
-VOID
+static VOID
 _DevPathVendor (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -535,7 +542,7 @@ _DevPathVendor (
     case MESSAGING_DEVICE_PATH: Type = L"Msg";       break;
     case MEDIA_DEVICE_PATH:     Type = L"Media";     break;
     default:                    Type = L"?";         break;
-    }                            
+    }
 
     CatPrint(Str, L"Ven%s(%g", Type, &Vendor->Guid);
     if (CompareGuid (&Vendor->Guid, &UnknownDevice) == 0) {
@@ -550,7 +557,10 @@ _DevPathVendor (
 }
 
 
-VOID
+/*
+  Type: 2 (ACPI Device Path) SubType: 1 (ACPI Device Path)
+ */
+static VOID
 _DevPathAcpi (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -560,14 +570,47 @@ _DevPathAcpi (
 
     Acpi = DevPath;
     if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
-        CatPrint(Str, L"Acpi(PNP%04x,%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);
+        switch ( EISA_ID_TO_NUM( Acpi-> HID ) ) {
+            case 0x301 : {
+                CatPrint( Str , L"Keyboard(%d)" , Acpi-> UID ) ;
+                break ;
+            }
+            case 0x401 : {
+                CatPrint( Str , L"ParallelPort(%d)" , Acpi-> UID ) ;
+                break ;
+            }
+            case 0x501 : {
+                CatPrint( Str , L"Serial(%d)" , Acpi-> UID ) ;
+                break ;
+            }
+            case 0x604 : {
+                CatPrint( Str , L"Floppy(%d)" , Acpi-> UID ) ;
+                break ;
+            }
+            case 0xa03 : {
+                CatPrint( Str , L"PciRoot(%d)" , Acpi-> UID ) ;
+                break ;
+            }
+            case 0xa08 : {
+                CatPrint( Str , L"PcieRoot(%d)" , Acpi-> UID ) ;
+                break ;
+            }
+            default : {
+                CatPrint( Str , L"Acpi(PNP%04x" , EISA_ID_TO_NUM( Acpi-> HID ) ) ;
+                if ( Acpi-> UID ) CatPrint( Str , L",%d" , Acpi-> UID ) ;
+                CatPrint( Str , L")" ) ;
+                break ;
+            }
+	}
     } else {
-        CatPrint(Str, L"Acpi(%08x,%x)", Acpi->HID, Acpi->UID);
+        CatPrint( Str , L"Acpi(0x%X" , Acpi-> HID ) ;
+        if ( Acpi-> UID ) CatPrint( Str , L",%d" , Acpi-> UID ) ;
+        CatPrint( Str , L")" , Acpi-> HID , Acpi-> UID ) ;
     }
 }
 
 
-VOID
+static VOID
 _DevPathAtapi (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -576,13 +619,13 @@ _DevPathAtapi (
     ATAPI_DEVICE_PATH       *Atapi;
 
     Atapi = DevPath;
-    CatPrint(Str, L"Ata(%s,%s)", 
+    CatPrint(Str, L"Ata(%s,%s)",
         Atapi->PrimarySecondary ? L"Secondary" : L"Primary",
         Atapi->SlaveMaster ? L"Slave" : L"Master"
         );
 }
 
-VOID
+static VOID
 _DevPathScsi (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -591,11 +634,11 @@ _DevPathScsi (
     SCSI_DEVICE_PATH        *Scsi;
 
     Scsi = DevPath;
-    CatPrint(Str, L"Scsi(Pun%x,Lun%x)", Scsi->Pun, Scsi->Lun);
+    CatPrint(Str, L"Scsi(%d,%d)", Scsi->Pun, Scsi->Lun);
 }
 
 
-VOID
+static VOID
 _DevPathFibre (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -604,10 +647,12 @@ _DevPathFibre (
     FIBRECHANNEL_DEVICE_PATH    *Fibre;
 
     Fibre = DevPath;
-    CatPrint(Str, L"Fibre(%lx)", Fibre->WWN);
+    CatPrint( Str , L"Fibre%s(0x%016lx,0x%016lx)" ,
+        DevicePathType( & Fibre-> Header ) == MSG_FIBRECHANNEL_DP ? L"" : L"Ex" ,
+        Fibre-> WWN , Fibre-> Lun ) ;
 }
 
-VOID
+static VOID
 _DevPath1394 (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -621,7 +666,7 @@ _DevPath1394 (
 
 
 
-VOID
+static VOID
 _DevPathUsb (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -630,11 +675,11 @@ _DevPathUsb (
     USB_DEVICE_PATH         *Usb;
 
     Usb = DevPath;
-    CatPrint(Str, L"Usb(%x)", Usb->Port);
+    CatPrint( Str , L"Usb(0x%x,0x%x)" , Usb-> Port , Usb-> Endpoint ) ;
 }
 
 
-VOID
+static VOID
 _DevPathI2O (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -643,10 +688,10 @@ _DevPathI2O (
     I2O_DEVICE_PATH         *I2O;
 
     I2O = DevPath;
-    CatPrint(Str, L"I2O(%x)", I2O->Tid);
+    CatPrint(Str, L"I2O(0x%X)", I2O->Tid);
 }
 
-VOID
+static VOID
 _DevPathMacAddr (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -658,32 +703,121 @@ _DevPathMacAddr (
 
     MAC = DevPath;
 
-    HwAddressSize = sizeof(EFI_MAC_ADDRESS);
+    /* HwAddressSize = sizeof(EFI_MAC_ADDRESS); */
+    HwAddressSize = DevicePathNodeLength( & MAC-> Header ) ;
+    HwAddressSize -= sizeof( MAC-> Header ) ;
+    HwAddressSize -= sizeof( MAC-> IfType ) ;
     if (MAC->IfType == 0x01 || MAC->IfType == 0x00) {
         HwAddressSize = 6;
     }
-    
+
     CatPrint(Str, L"Mac(");
 
     for(Index = 0; Index < HwAddressSize; Index++) {
         CatPrint(Str, L"%02x",MAC->MacAddress.Addr[Index]);
     }
+    if ( MAC-> IfType != 0 ) {
+        CatPrint(Str, L",%d" , MAC-> IfType ) ;
+    }
     CatPrint(Str, L")");
 }
 
-VOID
+static VOID
+CatPrintIPv4(
+    IN OUT POOL_PRINT * Str ,
+    IN EFI_IPv4_ADDRESS * Address
+    )
+{
+    CatPrint( Str , L"%d.%d.%d.%d" , Address-> Addr[ 0 ] , Address-> Addr[ 1 ] ,
+        Address-> Addr[ 2 ] , Address-> Addr[ 3 ] ) ;
+}
+
+static BOOLEAN
+IsNotNullIPv4(
+    IN EFI_IPv4_ADDRESS * Address
+    )
+{
+    UINT8 val ;
+    val = Address-> Addr[ 0 ] | Address-> Addr[ 1 ] ;
+    val |= Address-> Addr[ 2 ] | Address-> Addr[ 3 ] ;
+    return val != 0 ;
+}
+
+static VOID
+CatPrintNetworkProtocol(
+    IN OUT POOL_PRINT * Str ,
+    IN UINT16 Proto
+    )
+{
+    if ( Proto == 6 ) {
+        CatPrint( Str , L"TCP" ) ;
+    } else if ( Proto == 17 ) {
+        CatPrint( Str , L"UDP" ) ;
+    } else {
+        CatPrint( Str , L"%d" , Proto ) ;
+    }
+}
+
+static VOID
 _DevPathIPv4 (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
     )
 {
     IPv4_DEVICE_PATH     *IP __unused;
+    BOOLEAN show ;
 
     IP = DevPath;
-    CatPrint(Str, L"IPv4(not-done)");
+    CatPrint( Str , L"IPv4(") ;
+    CatPrintIPv4( Str , & IP-> RemoteIpAddress ) ;
+    CatPrint( Str , L",") ;
+    CatPrintNetworkProtocol( Str , IP-> Protocol ) ;
+    CatPrint( Str , L",%s" , IP-> StaticIpAddress ? L"Static" : L"DHCP" ) ;
+    show = IsNotNullIPv4( & IP-> LocalIpAddress ) ;
+    if ( ! show && DevicePathNodeLength( & IP-> Header ) == sizeof( IPv4_DEVICE_PATH ) ) {
+        /* only version 2 includes gateway and netmask */
+        show |= IsNotNullIPv4( & IP-> GatewayIpAddress ) ;
+        show |= IsNotNullIPv4( & IP-> SubnetMask  ) ;
+    }
+    if ( show ) {
+        CatPrint( Str , L"," ) ;
+        CatPrintIPv4( Str , & IP-> LocalIpAddress ) ;
+        if ( DevicePathNodeLength( & IP-> Header ) == sizeof( IPv4_DEVICE_PATH ) ) {
+            /* only version 2 includes gateway and netmask */
+            show = IsNotNullIPv4( & IP-> GatewayIpAddress ) ;
+            show |= IsNotNullIPv4( & IP-> SubnetMask ) ;
+            if ( show ) {
+                CatPrint( Str , L",") ;
+                CatPrintIPv4( Str , & IP-> GatewayIpAddress ) ;
+                if ( IsNotNullIPv4( & IP-> SubnetMask ) ) {
+                    CatPrint( Str , L",") ;
+                    CatPrintIPv4( Str , & IP-> SubnetMask ) ;
+                }
+            }
+        }
+    }
+    CatPrint( Str , L")") ;
 }
 
-VOID
+#define CatPrintIPv6_ADD( x , y ) ( ( (UINT16) ( x ) ) << 8 | ( y ) )
+static VOID
+CatPrintIPv6(
+    IN OUT POOL_PRINT * Str ,
+    IN EFI_IPv6_ADDRESS * Address
+    )
+{
+    CatPrint( Str , L"%x:%x:%x:%x:%x:%x:%x:%x" ,
+        CatPrintIPv6_ADD( Address-> Addr[ 0 ] , Address-> Addr[ 1 ] ) ,
+        CatPrintIPv6_ADD( Address-> Addr[ 2 ] , Address-> Addr[ 3 ] ) ,
+        CatPrintIPv6_ADD( Address-> Addr[ 4 ] , Address-> Addr[ 5 ] ) ,
+        CatPrintIPv6_ADD( Address-> Addr[ 6 ] , Address-> Addr[ 7 ] ) ,
+        CatPrintIPv6_ADD( Address-> Addr[ 8 ] , Address-> Addr[ 9 ] ) ,
+        CatPrintIPv6_ADD( Address-> Addr[ 10 ] , Address-> Addr[ 11 ] ) ,
+        CatPrintIPv6_ADD( Address-> Addr[ 12 ] , Address-> Addr[ 13 ] ) ,
+        CatPrintIPv6_ADD( Address-> Addr[ 14 ] , Address-> Addr[ 15 ] ) ) ;
+}
+
+static VOID
 _DevPathIPv6 (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -692,10 +826,37 @@ _DevPathIPv6 (
     IPv6_DEVICE_PATH     *IP __unused;
 
     IP = DevPath;
-    CatPrint(Str, L"IP-v6(not-done)");
+    CatPrint( Str , L"IPv6(") ;
+    CatPrintIPv6( Str , & IP-> RemoteIpAddress ) ;
+    CatPrint( Str , L",") ;
+    CatPrintNetworkProtocol( Str, IP-> Protocol ) ;
+    CatPrint( Str , L",%s," , IP-> IPAddressOrigin ?
+        ( IP-> IPAddressOrigin == 1 ? L"StatelessAutoConfigure" :
+        L"StatefulAutoConfigure" ) : L"Static" ) ;
+    CatPrintIPv6( Str , & IP-> LocalIpAddress ) ;
+    if ( DevicePathNodeLength( & IP-> Header ) == sizeof( IPv6_DEVICE_PATH ) ) {
+        CatPrint( Str , L",") ;
+        CatPrintIPv6( Str , & IP-> GatewayIpAddress ) ;
+        CatPrint( Str , L",") ;
+        CatPrint( Str , L"%d" , & IP-> PrefixLength ) ;
+    }
+    CatPrint( Str , L")") ;
 }
 
-VOID
+static VOID
+_DevPathUri (
+    IN OUT POOL_PRINT       *Str,
+    IN VOID                 *DevPath
+    )
+{
+    URI_DEVICE_PATH  *Uri;
+
+    Uri = DevPath;
+
+    CatPrint( Str, L"Uri(%a)", Uri->Uri );
+}
+
+static VOID
 _DevPathInfiniBand (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -704,10 +865,12 @@ _DevPathInfiniBand (
     INFINIBAND_DEVICE_PATH  *InfiniBand __unused;
 
     InfiniBand = DevPath;
-    CatPrint(Str, L"InfiniBand(not-done)");
+    CatPrint( Str , L"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)" ,
+        InfiniBand-> ResourceFlags , InfiniBand-> PortGid , InfiniBand-> ServiceId ,
+        InfiniBand-> TargetPortId , InfiniBand-> DeviceId ) ;
 }
 
-VOID
+static VOID
 _DevPathUart (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -748,8 +911,20 @@ _DevPathUart (
     }
 }
 
+static VOID
+_DevPathSata (
+    IN OUT POOL_PRINT       *Str,
+    IN VOID                 *DevPath
+    )
+{
+    SATA_DEVICE_PATH * Sata ;
+
+    Sata = DevPath;
+    CatPrint( Str , L"Sata(0x%x,0x%x,0x%x)" , Sata-> HBAPortNumber ,
+        Sata-> PortMultiplierPortNumber , Sata-> Lun ) ;
+}
 
-VOID
+static VOID
 _DevPathHardDrive (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -760,19 +935,19 @@ _DevPathHardDrive (
     Hd = DevPath;
     switch (Hd->SignatureType) {
         case SIGNATURE_TYPE_MBR:
-            CatPrint(Str, L"HD(Part%d,Sig%08X)", 
+            CatPrint(Str, L"HD(Part%d,Sig%08X)",
                 Hd->PartitionNumber,
                 *((UINT32 *)(&(Hd->Signature[0])))
                 );
             break;
         case SIGNATURE_TYPE_GUID:
-            CatPrint(Str, L"HD(Part%d,Sig%g)", 
+            CatPrint(Str, L"HD(Part%d,Sig%g)",
                 Hd->PartitionNumber,
-                (EFI_GUID *) &(Hd->Signature[0])     
+                (EFI_GUID *) &(Hd->Signature[0])
                 );
             break;
         default:
-            CatPrint(Str, L"HD(Part%d,MBRType=%02x,SigType=%02x)", 
+            CatPrint(Str, L"HD(Part%d,MBRType=%02x,SigType=%02x)",
                 Hd->PartitionNumber,
                 Hd->MBRType,
                 Hd->SignatureType
@@ -781,7 +956,7 @@ _DevPathHardDrive (
     }
 }
 
-VOID
+static VOID
 _DevPathCDROM (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -790,22 +965,22 @@ _DevPathCDROM (
     CDROM_DEVICE_PATH       *Cd;
 
     Cd = DevPath;
-    CatPrint(Str, L"CDROM(Entry%x)", Cd->BootEntry);
+    CatPrint( Str , L"CDROM(0x%x)" , Cd-> BootEntry ) ;
 }
 
-VOID
+static VOID
 _DevPathFilePath (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
     )
 {
-    FILEPATH_DEVICE_PATH    *Fp;   
+    FILEPATH_DEVICE_PATH    *Fp;
 
     Fp = DevPath;
     CatPrint(Str, L"%s", Fp->PathName);
 }
 
-VOID
+static VOID
 _DevPathMediaProtocol (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -817,7 +992,7 @@ _DevPathMediaProtocol (
     CatPrint(Str, L"%g", &MediaProt->Protocol);
 }
 
-VOID
+static VOID
 _DevPathBssBss (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
@@ -841,29 +1016,77 @@ _DevPathBssBss (
 }
 
 
-VOID
+static VOID
 _DevPathEndInstance (
     IN OUT POOL_PRINT       *Str,
-    IN VOID                 *DevPath
+    IN VOID                 *DevPath EFI_UNUSED
     )
 {
     CatPrint(Str, L",");
 }
 
-VOID
+/**
+ * Print unknown device node.
+ * UEFI 2.4 § 9.6.1.6 table 89.
+ */
+
+static VOID
 _DevPathNodeUnknown (
     IN OUT POOL_PRINT       *Str,
     IN VOID                 *DevPath
     )
 {
-    CatPrint(Str, L"?");
+    EFI_DEVICE_PATH * Path ;
+    UINT8 * value ;
+    int length , index ;
+    Path = DevPath ;
+    value = DevPath ;
+    value += 4 ;
+    switch ( Path-> Type ) {
+        case HARDWARE_DEVICE_PATH : { /* Unknown Hardware Device Path */
+            CatPrint( Str , L"HardwarePath(%d" , Path-> SubType ) ;
+            break ;
+        }
+        case ACPI_DEVICE_PATH : { /* Unknown ACPI Device Path */
+            CatPrint( Str , L"AcpiPath(%d" , Path-> SubType ) ;
+            break ;
+        }
+        case MESSAGING_DEVICE_PATH : { /* Unknown Messaging Device Path */
+            CatPrint( Str , L"Msg(%d" , Path-> SubType ) ;
+            break ;
+        }
+        case MEDIA_DEVICE_PATH : { /* Unknown Media Device Path */
+            CatPrint( Str , L"MediaPath(%d" , Path-> SubType ) ;
+            break ;
+        }
+        case BBS_DEVICE_PATH : { /* Unknown BIOS Boot Specification Device Path */
+            CatPrint( Str , L"BbsPath(%d" , Path-> SubType ) ;
+            break ;
+        }
+        default : { /* Unknown Device Path */
+            CatPrint( Str , L"Path(%d,%d" , Path-> Type , Path-> SubType ) ;
+            break ;
+        }
+    }
+    length = DevicePathNodeLength( Path ) ;
+    for ( index = 0 ; index < length ; index ++ ) {
+        if ( index == 0 ) CatPrint( Str , L",0x" ) ;
+        CatPrint( Str , L"%02x" , * value ) ;
+	value ++ ;
+    }
+    CatPrint( Str , L")" ) ;
 }
 
 
+/*
+ * Table to convert "Type" and "SubType" to a "convert to text" function/
+ * Entries hold "Type" and "SubType" for know values.
+ * Special "SubType" 0 is used as default for known type with unknown subtype.
+ */
 struct {
     UINT8   Type;
     UINT8   SubType;
-    VOID    (*Function)(POOL_PRINT *, VOID *);    
+    VOID    (*Function)(POOL_PRINT *, VOID *);
 } DevPathTable[] = {
 	{ HARDWARE_DEVICE_PATH,   HW_PCI_DP,                        _DevPathPci},
 	{ HARDWARE_DEVICE_PATH,   HW_PCCARD_DP,                     _DevPathPccard},
@@ -880,8 +1103,10 @@ struct {
 	{ MESSAGING_DEVICE_PATH,  MSG_MAC_ADDR_DP,                  _DevPathMacAddr},
 	{ MESSAGING_DEVICE_PATH,  MSG_IPv4_DP,                      _DevPathIPv4},
 	{ MESSAGING_DEVICE_PATH,  MSG_IPv6_DP,                      _DevPathIPv6},
+	{ MESSAGING_DEVICE_PATH,  MSG_URI_DP,                       _DevPathUri},
 	{ MESSAGING_DEVICE_PATH,  MSG_INFINIBAND_DP,                _DevPathInfiniBand},
 	{ MESSAGING_DEVICE_PATH,  MSG_UART_DP,                      _DevPathUart},
+	{ MESSAGING_DEVICE_PATH , MSG_SATA_DP ,                     _DevPathSata } ,
 	{ MESSAGING_DEVICE_PATH,  MSG_VENDOR_DP,                    _DevPathVendor},
 	{ MEDIA_DEVICE_PATH,      MEDIA_HARDDRIVE_DP,               _DevPathHardDrive},
 	{ MEDIA_DEVICE_PATH,      MEDIA_CDROM_DP,                   _DevPathCDROM},
@@ -908,7 +1133,7 @@ DevicePathToStr (
 {
     POOL_PRINT          Str;
     EFI_DEVICE_PATH     *DevPathNode;
-    VOID                (*DumpNode)(POOL_PRINT *, VOID *);    
+    VOID                (*DumpNode)(POOL_PRINT *, VOID *);
     UINTN               Index, NewSize;
 
     ZeroMem(&Str, sizeof(Str));
@@ -923,7 +1148,7 @@ DevicePathToStr (
 
     //
     // Process each device path node
-    //    
+    //
 
     DevPathNode = DevPath;
     while (!IsDevicePathEnd(DevPathNode)) {
@@ -1009,7 +1234,7 @@ LibDuplicateDevicePathInstance (
     )
 {
     EFI_DEVICE_PATH     *NewDevPath,*DevicePathInst,*Temp;
-    UINTN               Size;    
+    UINTN               Size = 0;
 
     //
     // get the size of an instance from the input
@@ -1017,18 +1242,18 @@ LibDuplicateDevicePathInstance (
 
     Temp = DevPath;
     DevicePathInst = DevicePathInstance (&Temp, &Size);
-    
+
     //
     // Make a copy and set proper end type
     //
     NewDevPath = NULL;
-    if (Size) { 
+    if (Size) {
         NewDevPath = AllocatePool (Size + sizeof(EFI_DEVICE_PATH));
     }
 
     if (NewDevPath) {
         CopyMem (NewDevPath, DevicePathInst, Size);
-        Temp = NextDevicePathNode(NewDevPath); 
+        Temp = NextDevicePathNode(NewDevPath);
         SetDevicePathEndNode(Temp);
     }
 
Index: src/sys/external/bsd/gnu-efi/dist/lib/event.c
diff -u src/sys/external/bsd/gnu-efi/dist/lib/event.c:1.2 src/sys/external/bsd/gnu-efi/dist/lib/event.c:1.3
--- src/sys/external/bsd/gnu-efi/dist/lib/event.c:1.2	Sat Feb  4 18:08:29 2017
+++ src/sys/external/bsd/gnu-efi/dist/lib/event.c	Thu Aug 16 18:22:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: event.c,v 1.2 2017/02/04 18:08:29 mlelstv Exp $	*/
+/*	$NetBSD: event.c,v 1.3 2018/08/16 18:22:05 jmcneill Exp $	*/
 
 /*++
 
@@ -49,6 +49,7 @@ LibCreateProtocolNotifyEvent (
 		    NotifyContext,
 		    &Event
 		    );
+    if ( EFI_ERROR( Status ) ) return NULL ;
     ASSERT (!EFI_ERROR(Status));
 
     //
@@ -58,11 +59,11 @@ LibCreateProtocolNotifyEvent (
     Status = uefi_call_wrapper(
 		    BS->RegisterProtocolNotify,
 			3,
-                    ProtocolGuid, 
-                    Event, 
+                    ProtocolGuid,
+                    Event,
                     Registration
                     );
-
+    if ( EFI_ERROR( Status ) ) return NULL ;
     ASSERT (!EFI_ERROR(Status));
 
     //
@@ -99,7 +100,7 @@ WaitForSingleEvent (
             //
 
             uefi_call_wrapper(BS->SetTimer, 3, TimerEvent, TimerRelative, Timeout);
-            
+
             //
             // Wait for the original event or the timer
             //
@@ -154,6 +155,6 @@ WaitForEventWithTimeout (
             }
         }
     } while (Timeout > 0);
-    *Key = TimeoutKey;
+    CopyMem(Key, &TimeoutKey, sizeof(EFI_INPUT_KEY));
 }
 
Index: src/sys/external/bsd/gnu-efi/dist/lib/hw.c
diff -u src/sys/external/bsd/gnu-efi/dist/lib/hw.c:1.2 src/sys/external/bsd/gnu-efi/dist/lib/hw.c:1.3
--- src/sys/external/bsd/gnu-efi/dist/lib/hw.c:1.2	Sat Feb  4 18:08:29 2017
+++ src/sys/external/bsd/gnu-efi/dist/lib/hw.c	Thu Aug 16 18:22:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hw.c,v 1.2 2017/02/04 18:08:29 mlelstv Exp $	*/
+/*	$NetBSD: hw.c,v 1.3 2018/08/16 18:22:05 jmcneill Exp $	*/
 
 /*++
 
@@ -25,14 +25,14 @@ EFI_STATUS
 InitializeGlobalIoDevice (
         IN  EFI_DEVICE_PATH             *DevicePath,
         IN  EFI_GUID                    *Protocol,
-        IN  CHAR8                       *ErrorStr,
-        OUT EFI_DEVICE_IO_INTERFACE     **GlobalIoFncs 
+        IN  CHAR8                       *ErrorStr EFI_UNUSED,
+        OUT EFI_DEVICE_IO_INTERFACE     **GlobalIoFncs
         )
 /*++
 
 Routine Description:
 
-    Check to see if DevicePath exists for a given Protocol. Return Error if it 
+    Check to see if DevicePath exists for a given Protocol. Return Error if it
     exists. Return GlobalIoFuncs set match the DevicePath
 
   Arguments:
@@ -70,60 +70,60 @@ Returns:
     return Status;
 }
 
-UINT32 
+UINT32
 ReadPort (
-        IN  EFI_DEVICE_IO_INTERFACE     *GlobalIoFncs, 
+        IN  EFI_DEVICE_IO_INTERFACE     *GlobalIoFncs,
         IN  EFI_IO_WIDTH                Width,
         IN  UINTN                       Port
         )
 {
     UINT32       Data;
-    EFI_STATUS  Status __unused;
+    EFI_STATUS  Status EFI_UNUSED;
 
     Status = uefi_call_wrapper(GlobalIoFncs->Io.Read, 5, GlobalIoFncs, Width, (UINT64)Port, 1, &Data);
     ASSERT(!EFI_ERROR(Status));
     return Data;
 }
 
-UINT32 
+UINT32
 WritePort (
-        IN  EFI_DEVICE_IO_INTERFACE     *GlobalIoFncs, 
+        IN  EFI_DEVICE_IO_INTERFACE     *GlobalIoFncs,
         IN  EFI_IO_WIDTH                Width,
         IN  UINTN                       Port,
         IN  UINTN                       Data
         )
 {
-    EFI_STATUS  Status __unused;
+    EFI_STATUS  Status EFI_UNUSED;
 
     Status = uefi_call_wrapper(GlobalIoFncs->Io.Write, 5, GlobalIoFncs, Width, (UINT64)Port, 1, &Data);
     ASSERT(!EFI_ERROR(Status));
     return (UINT32)Data;
 }
 
-UINT32 
+UINT32
 ReadPciConfig (
-        IN  EFI_DEVICE_IO_INTERFACE     *GlobalIoFncs, 
+        IN  EFI_DEVICE_IO_INTERFACE     *GlobalIoFncs,
         IN  EFI_IO_WIDTH                Width,
         IN  UINTN                       Address
         )
 {
     UINT32       Data;
-    EFI_STATUS  Status __unused;
+    EFI_STATUS  Status EFI_UNUSED;
 
     Status = uefi_call_wrapper(GlobalIoFncs->Pci.Read, 5, GlobalIoFncs, Width, (UINT64)Address, 1, &Data);
     ASSERT(!EFI_ERROR(Status));
     return Data;
 }
 
-UINT32 
+UINT32
 WritePciConfig (
-        IN  EFI_DEVICE_IO_INTERFACE     *GlobalIoFncs, 
+        IN  EFI_DEVICE_IO_INTERFACE     *GlobalIoFncs,
         IN  EFI_IO_WIDTH                Width,
         IN  UINTN                       Address,
         IN  UINTN                       Data
         )
 {
-    EFI_STATUS  Status __unused;
+    EFI_STATUS  Status EFI_UNUSED;
 
     Status = uefi_call_wrapper(GlobalIoFncs->Pci.Write, 5, GlobalIoFncs, Width, (UINT64)Address, 1, &Data);
     ASSERT(!EFI_ERROR(Status));

Index: src/sys/external/bsd/gnu-efi/dist/lib/hand.c
diff -u src/sys/external/bsd/gnu-efi/dist/lib/hand.c:1.3 src/sys/external/bsd/gnu-efi/dist/lib/hand.c:1.4
--- src/sys/external/bsd/gnu-efi/dist/lib/hand.c:1.3	Sat Feb  4 18:08:29 2017
+++ src/sys/external/bsd/gnu-efi/dist/lib/hand.c	Thu Aug 16 18:22:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hand.c,v 1.3 2017/02/04 18:08:29 mlelstv Exp $	*/
+/*	$NetBSD: hand.c,v 1.4 2018/08/16 18:22:05 jmcneill Exp $	*/
 
 /*++
 
@@ -119,7 +119,7 @@ LibLocateHandleByDiskSignature (
     EFI_HANDLE            *BlockIoBuffer;
     EFI_DEVICE_PATH       *DevicePath;
     UINTN                 Index;
-    EFI_DEVICE_PATH       *Start __unused, *Next, *DevPath;
+    EFI_DEVICE_PATH       *Next, *DevPath;
     HARDDRIVE_DEVICE_PATH *HardDriveDevicePath;
     BOOLEAN               Match;
     BOOLEAN               PreviousNodeIsHardDriveDevicePath;
@@ -128,6 +128,7 @@ LibLocateHandleByDiskSignature (
     // Initialize for GrowBuffer loop
     //
 
+    Status = EFI_SUCCESS;
     BlockIoBuffer = NULL;
     BufferSize = 50 * sizeof(EFI_HANDLE);
 
@@ -201,7 +202,6 @@ LibLocateHandleByDiskSignature (
             PreviousNodeIsHardDriveDevicePath = FALSE;
 
             DevPath = DevicePath;
-            Start = DevPath;
 
             //
             // Check for end of device path type
@@ -341,6 +341,7 @@ LibFileInfo (
     // Initialize for GrowBuffer loop
     //
 
+    Status = EFI_SUCCESS;
     Buffer = NULL;
     BufferSize = SIZE_OF_EFI_FILE_INFO + 200;
 
@@ -376,6 +377,7 @@ LibFileSystemInfo (
     // Initialize for GrowBuffer loop
     //
 
+    Status = EFI_SUCCESS;
     Buffer = NULL;
     BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + 200;
 
@@ -410,6 +412,7 @@ LibFileSystemVolumeLabelInfo (
     // Initialize for GrowBuffer loop
     //
 
+    Status = EFI_SUCCESS;
     Buffer = NULL;
     BufferSize = SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO + 200;
 

Reply via email to