Blame SOURCES/0003-Fixed-typeo-lib-error.c-EFI_WARN_UNKNOWN_GLYPH-defin.patch

4c0d37
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
4c0d37
From: Nigel Croxon <ncroxon@redhat.com>
4c0d37
Date: Wed, 9 Jan 2019 07:03:46 -0500
4c0d37
Subject: [PATCH] * Fixed typeo lib/error.c EFI_WARN_UNKNOWN_GLYPH definition.
4c0d37
 On couple of locations in runtime string library (rtstr.c) there are calls to
4c0d37
 non-runtime variant of StrLen function. * Another issue is with formatting
4c0d37
 1394 paths. The F1394_DEVICE_PATH::Guid is formatted as %g, but 1394 GUID is
4c0d37
 8 byte integer, not EFI_GUID and therefore should be formatted as e.g. %016lx
4c0d37
 (as edk2 does). * Beyond what's mentioned above, changed the format of the
4c0d37
 harddrive path, so it's in line with edk2 format and spec (2.7 errata A,
4c0d37
 chapter 10.6.1.6, table 102).
4c0d37
4c0d37
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
4c0d37
Signed-off-by: manison <manison@users.sf.net>
4c0d37
---
4c0d37
 inc/efidevp.h       | 10 +++++-----
4c0d37
 lib/dpath.c         | 26 ++++++++++++++------------
4c0d37
 lib/error.c         |  2 +-
4c0d37
 lib/runtime/rtstr.c | 12 ++++++------
4c0d37
 4 files changed, 26 insertions(+), 24 deletions(-)
4c0d37
4c0d37
diff --git a/inc/efidevp.h b/inc/efidevp.h
4c0d37
index ffaf6e28eea..fa1a235eaba 100644
4c0d37
--- a/inc/efidevp.h
4c0d37
+++ b/inc/efidevp.h
4c0d37
@@ -325,11 +325,11 @@ typedef struct _VLAN_DEVICE_PATH {
4c0d37
 #define MSG_INFINIBAND_DP               0x09
4c0d37
 typedef struct _INFINIBAND_DEVICE_PATH {
4c0d37
         EFI_DEVICE_PATH_PROTOCOL        Header;
4c0d37
-        UINT32                          ResourceFlags ;
4c0d37
-        UINT64                          PortGid ;
4c0d37
-        UINT64                          ServiceId ;
4c0d37
-        UINT64                          TargetPortId ;
4c0d37
-        UINT64                          DeviceId ;
4c0d37
+        UINT32                          ResourceFlags;
4c0d37
+        UINT8                           PortGid[16];
4c0d37
+        UINT64                          ServiceId;
4c0d37
+        UINT64                          TargetPortId;
4c0d37
+        UINT64                          DeviceId;
4c0d37
 } INFINIBAND_DEVICE_PATH;
4c0d37
 
4c0d37
 #define MSG_UART_DP                     0x0e
4c0d37
diff --git a/lib/dpath.c b/lib/dpath.c
4c0d37
index 7486252eecf..5e079d687bd 100644
4c0d37
--- a/lib/dpath.c
4c0d37
+++ b/lib/dpath.c
4c0d37
@@ -659,7 +659,8 @@ _DevPath1394 (
4c0d37
     F1394_DEVICE_PATH       *F1394;
4c0d37
 
4c0d37
     F1394 = DevPath;
4c0d37
-    CatPrint(Str, L"1394(%g)", &F1394->Guid);
4c0d37
+    // Guid has format of IEEE-EUI64
4c0d37
+    CatPrint(Str, L"I1394(%016lx)", F1394->Guid);
4c0d37
 }
4c0d37
 
4c0d37
 
4c0d37
@@ -863,9 +864,9 @@ _DevPathInfiniBand (
4c0d37
     INFINIBAND_DEVICE_PATH  *InfiniBand;
4c0d37
 
4c0d37
     InfiniBand = DevPath;
4c0d37
-    CatPrint( Str , L"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)" ,
4c0d37
-        InfiniBand-> ResourceFlags , InfiniBand-> PortGid , InfiniBand-> ServiceId ,
4c0d37
-        InfiniBand-> TargetPortId , InfiniBand-> DeviceId ) ;
4c0d37
+    CatPrint(Str, L"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
4c0d37
+        InfiniBand->ResourceFlags, InfiniBand->PortGid, InfiniBand->ServiceId,
4c0d37
+        InfiniBand->TargetPortId, InfiniBand->DeviceId);
4c0d37
 }
4c0d37
 
4c0d37
 static VOID
4c0d37
@@ -889,17 +890,19 @@ _DevPathUart (
4c0d37
     }
4c0d37
 
4c0d37
     if (Uart->BaudRate == 0) {
4c0d37
-        CatPrint(Str, L"Uart(DEFAULT %c",Uart->BaudRate,Parity);
4c0d37
+        CatPrint(Str, L"Uart(DEFAULT,");
4c0d37
     } else {
4c0d37
-        CatPrint(Str, L"Uart(%d %c",Uart->BaudRate,Parity);
4c0d37
+        CatPrint(Str, L"Uart(%ld,", Uart->BaudRate);
4c0d37
     }
4c0d37
 
4c0d37
     if (Uart->DataBits == 0) {
4c0d37
-        CatPrint(Str, L"D");
4c0d37
+        CatPrint(Str, L"DEFAULT,");
4c0d37
     } else {
4c0d37
-        CatPrint(Str, L"%d",Uart->DataBits);
4c0d37
+        CatPrint(Str, L"%d,", Uart->DataBits);
4c0d37
     }
4c0d37
 
4c0d37
+    CatPrint(Str, L"%c,", Parity);
4c0d37
+
4c0d37
     switch (Uart->StopBits) {
4c0d37
         case 0  : CatPrint(Str, L"D)");   break;
4c0d37
         case 1  : CatPrint(Str, L"1)");   break;
4c0d37
@@ -933,21 +936,20 @@ _DevPathHardDrive (
4c0d37
     Hd = DevPath;
4c0d37
     switch (Hd->SignatureType) {
4c0d37
         case SIGNATURE_TYPE_MBR:
4c0d37
-            CatPrint(Str, L"HD(Part%d,Sig%08X)",
4c0d37
+            CatPrint(Str, L"HD(%d,MBR,0x%08x)",
4c0d37
                 Hd->PartitionNumber,
4c0d37
                 *((UINT32 *)(&(Hd->Signature[0])))
4c0d37
                 );
4c0d37
             break;
4c0d37
         case SIGNATURE_TYPE_GUID:
4c0d37
-            CatPrint(Str, L"HD(Part%d,Sig%g)",
4c0d37
+            CatPrint(Str, L"HD(%d,GPT,%g)",
4c0d37
                 Hd->PartitionNumber,
4c0d37
                 (EFI_GUID *) &(Hd->Signature[0])
4c0d37
                 );
4c0d37
             break;
4c0d37
         default:
4c0d37
-            CatPrint(Str, L"HD(Part%d,MBRType=%02x,SigType=%02x)",
4c0d37
+            CatPrint(Str, L"HD(%d,%d,0)",
4c0d37
                 Hd->PartitionNumber,
4c0d37
-                Hd->MBRType,
4c0d37
                 Hd->SignatureType
4c0d37
                 );
4c0d37
             break;
4c0d37
diff --git a/lib/error.c b/lib/error.c
4c0d37
index 3a856a6f39d..c4d053db633 100644
4c0d37
--- a/lib/error.c
4c0d37
+++ b/lib/error.c
4c0d37
@@ -56,7 +56,7 @@ struct {
4c0d37
 	{  EFI_COMPROMISED_DATA,       L"Compromised Data"},
4c0d37
 
4c0d37
 	// warnings
4c0d37
-	{  EFI_WARN_UNKOWN_GLYPH,      L"Warning Unknown Glyph"},
4c0d37
+	{  EFI_WARN_UNKNOWN_GLYPH,     L"Warning Unknown Glyph"},
4c0d37
 	{  EFI_WARN_DELETE_FAILURE,    L"Warning Delete Failure"},
4c0d37
 	{  EFI_WARN_WRITE_FAILURE,     L"Warning Write Failure"},
4c0d37
 	{  EFI_WARN_BUFFER_TOO_SMALL,  L"Warning Buffer Too Small"},
4c0d37
diff --git a/lib/runtime/rtstr.c b/lib/runtime/rtstr.c
4c0d37
index 73965cae192..802e7f43309 100644
4c0d37
--- a/lib/runtime/rtstr.c
4c0d37
+++ b/lib/runtime/rtstr.c
4c0d37
@@ -18,7 +18,7 @@ Revision History
4c0d37
 #include "lib.h"
4c0d37
 
4c0d37
 #ifndef __GNUC__
4c0d37
-#pragma RUNTIME_CODE(RtAcquireLock)
4c0d37
+#pragma RUNTIME_CODE(RtStrCmp)
4c0d37
 #endif
4c0d37
 INTN
4c0d37
 RUNTIMEFUNCTION
4c0d37
@@ -76,7 +76,7 @@ RtStrnCpy (
4c0d37
 }
4c0d37
 
4c0d37
 #ifndef __GNUC__
4c0d37
-#pragma RUNTIME_CODE(RtStrCpy)
4c0d37
+#pragma RUNTIME_CODE(RtStpCpy)
4c0d37
 #endif
4c0d37
 CHAR16 *
4c0d37
 RUNTIMEFUNCTION
4c0d37
@@ -122,7 +122,7 @@ RtStrCat (
4c0d37
     IN CONST CHAR16   *Src
4c0d37
     )
4c0d37
 {
4c0d37
-    RtStrCpy(Dest+StrLen(Dest), Src);
4c0d37
+    RtStrCpy(Dest+RtStrLen(Dest), Src);
4c0d37
 }
4c0d37
 
4c0d37
 #ifndef __GNUC__
4c0d37
@@ -138,7 +138,7 @@ RtStrnCat (
4c0d37
 {
4c0d37
     UINTN DestSize, Size;
4c0d37
 
4c0d37
-    DestSize = StrLen(Dest);
4c0d37
+    DestSize = RtStrLen(Dest);
4c0d37
     Size = RtStrnLen(Src, Len);
4c0d37
     RtCopyMem(Dest + DestSize, Src, Size * sizeof(CHAR16));
4c0d37
     Dest[DestSize + Size] = '\0';
4c0d37
@@ -169,11 +169,11 @@ RtStrnLen (
4c0d37
     IN CONST CHAR16   *s1,
4c0d37
     IN UINTN           Len
4c0d37
     )
4c0d37
-// copy strings
4c0d37
+// string length
4c0d37
 {
4c0d37
     UINTN i;
4c0d37
     for (i = 0; *s1 && i < Len; i++)
4c0d37
-	    s1++;
4c0d37
+        s1++;
4c0d37
     return i;
4c0d37
 }
4c0d37