Re: [edk2-devel] [PATCH V2 1/1] UefiPayloadPkg: Remove PEI phase from Payload

2021-01-27 Thread Patrick Rudolph
Hi,
Modifying the bootloader and defining an interface could take a while
and requires to add code that's already present in EDK2.
Would it be possible to move the Tcg*Pei code to a Library, so that it
could be directly used by BlSupportDxe in order to set the PCDs?

Kind Regards,
Patrick Rudolph

On Wed, Jan 27, 2021 at 5:10 PM Dong, Guo  wrote:
>
>
> Hi Patrick,
> Bootloader (coreboot or Slim Bootloader) is similar with EDKII PEI, so 
> measured boot should
> work without PEI phase in UEFI payload.
> In general, bootloader need pass required information to UEFI payload.
> BlSupportDxe could get these information and set required PCDs.
>
> We need well define the interface with bootloader on how to support measured 
> boot,
> Also including measured boot enable/disable, TPM log event, etc.
>
> Thanks,
> Guo
>  > -Original Message-
>  > From: devel@edk2.groups.io  On Behalf Of Patrick
>  > Rudolph
>  > Sent: Tuesday, January 26, 2021 8:21
>  > To: Dong, Guo 
>  > Cc: You, Benjamin ; devel@edk2.groups.io; Ma,
>  > Maurice 
>  > Subject: Re: [edk2-devel] [PATCH V2 1/1] UefiPayloadPkg: Remove PEI phase
>  > from Payload
>  >
>  > Hi,
>  > I'm trying to rebase my TPM support patches for UefiPayloadPkg on top of
>  > master.
>  >
>  > The Tcg*Dxe needs the following PCDs set by their Tcg*Pei counterparts:
>  > * PcdTpm2HashMask
>  > * PcdTcg2HashAlgorithmBitmap
>  > * PcdTpmInstanceGuid
>  >
>  > As there's no PEI stage any more, how do you plan to support TPMs in
>  > UefiPayloadPkg?
>  >
>  > Kind Regards,
>  > Patrick Rudolph
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70843): https://edk2.groups.io/g/devel/message/70843
Mute This Topic: https://groups.io/mt/78282656/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 2/2] MdeModulePkg/Usb/Keyboard.c: don't request protocol before setting

2021-01-27 Thread Patrick Rudolph
Hello,
Until now no regressions have been observed.
I'll provide a full test description using a wide variety of platforms soon.

Kind Regards,
Patrick Rudolph

On Thu, Jan 28, 2021 at 3:14 AM Wu, Hao A  wrote:
>
> > -Original Message-
> > From: Patrick Rudolph 
> > Sent: Wednesday, January 20, 2021 11:59 PM
> > To: devel@edk2.groups.io
> > Cc: Wang, Jian J ; Wu, Hao A ;
> > Ni, Ray 
> > Subject: [PATCH 2/2] MdeModulePkg/Usb/Keyboard.c: don't request
> > protocol before setting
> >
> > From: Matt DeVillier 
> >
> > No need to check the interface protocol then conditionally setting, just 
> > set it
> > to BOOT_PROTOCOL and check for error.
> >
> > This is what Linux does for HID devices as some don't follow the USB spec.
> > One example is the Aspeed BMC HID keyboard device, which adds a massive
> > boot delay without this patch as it doesn't respond to 'GetProtocolRequest'.
>
>
> I am okay with the code change.
>
> But since the current logic is here for a long time, I am not sure whether
> other USB keyboard device will have functional/performance impact for this
> change.
>
> Besides the above mentioned Aspeed BMC HID keyboard device (which has a
> performance issue for the Get_Protocol request that the patch is going to
> drop), could you at least try one USB keyboard device that works fine with
> the origin code logic to see if there is any side effect for this patch?
>
> Thanks in advance.
>
> Best Regards,
> Hao Wu
>
>
> >
> > Signed-off-by: Matt DeVillier 
> > Signed-off-by: Patrick Rudolph 
> > ---
> >  MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c | 28 ---
> > -
> >  1 file changed, 17 insertions(+), 11 deletions(-)
> >
> > diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > index 77e20b203f..5914174b4d 100644
> > --- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > +++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > @@ -801,7 +801,6 @@ InitUSBKeyboard (
> >IN OUT USB_KB_DEV   *UsbKeyboardDevice   ) {-  UINT8   
> > Protocol;
> > EFI_STATUS  Status;REPORT_STATUS_CODE_WITH_DEVICE_PATH (@@
> > -814,21 +813,28 @@ InitUSBKeyboard (
> >InitQueue (&UsbKeyboardDevice->EfiKeyQueue, sizeof (EFI_KEY_DATA));
> > InitQueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, sizeof
> > (EFI_KEY_DATA)); -  UsbGetProtocolRequest (-UsbKeyboardDevice-
> > >UsbIo,-UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,-
> > &Protocol-);   //   // Set boot protocol for the USB Keyboard.   // 
> > This driver
> > only supports boot protocol.   //-  if (Protocol != BOOT_PROTOCOL) {-
> > UsbSetProtocolRequest (-  UsbKeyboardDevice->UsbIo,-
> > UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,-
> > BOOT_PROTOCOL+  Status = UsbSetProtocolRequest (+
> > UsbKeyboardDevice->UsbIo,+ UsbKeyboardDevice-
> > >InterfaceDescriptor.InterfaceNumber,+ BOOT_PROTOCOL+   
> > >  );+
> > if (EFI_ERROR (Status)) {+//+// If protocol could not be set here, 
> > it
> > means+// the keyboard interface has some errors and could+// not be
> > initialized+//+REPORT_STATUS_CODE_WITH_DEVICE_PATH (+
> > EFI_ERROR_CODE | EFI_ERROR_MINOR,+  (EFI_PERIPHERAL_KEYBOARD |
> > EFI_P_EC_INTERFACE_ERROR),+  UsbKeyboardDevice->DevicePath   );++
> > return EFI_DEVICE_ERROR;   }UsbKeyboardDevice->CtrlOn = FALSE;--
> > 2.26.2
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70842): https://edk2.groups.io/g/devel/message/70842
Mute This Topic: https://groups.io/mt/79981645/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] Maintainers.txt: Update Maintainers and reviewers for UefiPayloadPkg

2021-01-27 Thread Benjamin You
Reviewed-by: Benjamin You 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Dong, Guo
> Sent: Monday, January 25, 2021 1:59 AM
> To: devel@edk2.groups.io
> Cc: Ma, Maurice ; You, Benjamin
> ; philipp.deppenwi...@9elements.com; Kinney,
> Michael D 
> Subject: [edk2-devel] [PATCH] Maintainers.txt: Update Maintainers and
> reviewers for UefiPayloadPkg
> 
> Add Philipp Deppenwiese as Maintainer.
> Update Maurice Ma and Benjamin You as reviewers to continue support
> UefiPayloadPkg patch review.
> 
> Cc: Philipp Deppenwiese 
> Cc: Benjamin You 
> Cc: Maurice Ma 
> Cc: Michael D Kinney 
> Signed-off-by: Guo Dong 
> ---
>  Maintainers.txt | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 2cd356551e..2a49a9e6aa 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -576,11 +576,13 @@ R: Catharine West 
>  UefiPayloadPkg
>  F: UefiPayloadPkg/
>  W: https://github.com/tianocore/tianocore.github.io/wiki/UefiPayloadPkg
> -M: Maurice Ma 
>  M: Guo Dong 
> -M: Benjamin You 
> +M: Philipp Deppenwiese 
> +R: Benjamin You 
> +R: Maurice Ma 
>  S: Maintained
> 
> +
>  UnitTestFrameworkPkg
>  F: UnitTestFrameworkPkg/
>  M: Michael D Kinney 
> --
> 2.16.2.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70841): https://edk2.groups.io/g/devel/message/70841
Mute This Topic: https://groups.io/mt/80083811/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v6 14/22] ArmPkg: Add Universal/Smbios/ProcessorSubClassDxe

2021-01-27 Thread Rebecca Cran

On 1/25/21 12:04 PM, Leif Lindholm wrote:

On Thu, Jan 14, 2021 at 09:36:20 -0700, Rebecca Cran wrote:

+// Sets the HII variable `x` if `pcd` isn't empty
+#define SET_HII_STRING_IF_PCD_NOT_EMPTY(pcd, x)   \
+x##Str = (CHAR16 *)PcdGetPtr (pcd); \
+if (StrLen (x##Str) > 0) {\
+  HiiSetString (mHiiHandle, x, x##Str, NULL); \
+} \


I am not a fan of preprocessor macros that require local variables
with magic names to exist.
Can this be rewritten as a helper function?


Unfortunately PcdGetPtr uses token pasting, so a helper function won't work.

Would the following be better?

#define SetHiiStringIfPcdNotEmpty(Pcd, StringId) { \
  CHAR16 *Str = (CHAR16*)PcdGetPtr (Pcd); \
  if (StrLen (Str) > 0) { \
HiiSetString (mHiiHandle, StringId, Str, NULL); \
  } \
}

--
Rebecca Cran


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70840): https://edk2.groups.io/g/devel/message/70840
Mute This Topic: https://groups.io/mt/79679256/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] RedfishPkg/JsonLib: Fix build errors

2021-01-27 Thread Abner Chang



> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Leif Lindholm
> Sent: Tuesday, January 26, 2021 7:31 PM
> To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist)
> 
> Cc: Wang, Nickle (HPS SW) ; Michael D Kinney
> 
> Subject: Re: [edk2-devel] [PATCH] RedfishPkg/JsonLib: Fix build errors
> 
> Hi Abner,
> 
> On Mon, Jan 25, 2021 at 12:31:54 +0800, Abner Chang wrote:
> > This patch fixes the build errors when build JsonLib with EDK2 Redfish
> > feature driver.
> >
> > - Add JsonLoadString function to load a NULL terminated-string JSON
> > - json_string_value() in JsonValueGetAsciiString () is removed by
> > accident.
> >
> > Signed-off-by: Abner Chang 
> >
> > Cc: Leif Lindholm 
> > Cc: Nickle Wang 
> > Cc: Michael D Kinney 
> > ---
> >  RedfishPkg/Library/JsonLib/JsonLib.inf |  5 +++--
> >  RedfishPkg/Include/Library/JsonLib.h   | 21 ++
> >  RedfishPkg/Library/JsonLib/JsonLib.c   | 30
> --
> >  3 files changed, 52 insertions(+), 4 deletions(-)
> >
> > diff --git a/RedfishPkg/Library/JsonLib/JsonLib.inf
> > b/RedfishPkg/Library/JsonLib/JsonLib.inf
> > index 48b094a78a..9d52a622e1 100644
> > --- a/RedfishPkg/Library/JsonLib/JsonLib.inf
> > +++ b/RedfishPkg/Library/JsonLib/JsonLib.inf
> > @@ -75,12 +75,13 @@
> >#   C4244: conversion from type1 to type2, possible loss of data
> >#   C4334: 32-bit shift implicitly converted to 64-bit
> >#   C4204: nonstandard extension used: non-constant aggregate initializer
> > +  #   C4706: assignment within conditional expression
> >#
> ># Define macro HAVE_CONFIG_H to include jansson_private_config.h to
> build.
> ># Undefined _WIN32, WIN64, _MSC_VER macros
> ># On GCC, no error on the unused-function and unused-but-set-variable.
> >#
> > -  MSFT:*_*_X64_CC_FLAGS = /wd4204 /wd4244 /wd4090 /wd4334
> > /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER
> > -  MSFT:*_*_IA32_CC_FLAGS = /wd4204 /wd4244 /wd4090
> /DHAVE_CONFIG_H=1
> > /U_WIN32 /UWIN64 /U_MSC_VER
> > +  MSFT:*_*_X64_CC_FLAGS = /wd4204 /wd4244 /wd4090 /wd4334
> /wd4706
> > + /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER
> > + MSFT:*_*_IA32_CC_FLAGS = /wd4204 /wd4244 /wd4090 /wd4706
> > + /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER
> 
> Urgh, please don't do this.
> C4706 is what gives you a warning for accidentally assigning instead of
> comparing. It's our last defence against the jeopardy-comparing hordes that
> think
>   if (NULL == Ptr)
> is a sensible way of writing C.
> 
> What is the actual problem being encountered?
That is because we use the macro defined in open source header file, 
RedfishPkg/Library/JsonLib/jansson/src/jansson.h

#define json_object_foreach(object, key, value) 
 \
for (key = json_object_iter_key(json_object_iter(object));  
 \
 key && (value = json_object_iter_value(json_object_key_to_iter(key))); 
 \
 key = json_object_iter_key(
 \
 json_object_iter_next(object, json_object_key_to_iter(key

> 
> Beyond that, this will probably be an issue for all architectures, so why add
> explicit (identical) workarounds for IA32/X64?
I didn't catch this build error on GCC. You may know why?

Abner

> 
> Secondly, I understand these changes were added for a single reason "fix
> build failures" - but these are two distinct changes, so should be two 
> distinct
> patches.
> 
> /
> Leif
> 
> >GCC:*_*_*_CC_FLAGS = -Wno-unused-function
> > -Wno-unused-but-set-variable
> >
> > diff --git a/RedfishPkg/Include/Library/JsonLib.h
> > b/RedfishPkg/Include/Library/JsonLib.h
> > index 3c10f67d27..82ca4bad60 100644
> > --- a/RedfishPkg/Include/Library/JsonLib.h
> > +++ b/RedfishPkg/Include/Library/JsonLib.h
> > @@ -664,6 +664,27 @@ JsonDumpString (
> >INUINTN   Flags
> >);
> >
> > +/**
> > +  Convert a string to JSON object.
> > +  The function is used to convert a NULL terminated UTF8 encoded
> > +string to a JSON
> > +  value. Only object and array represented strings can be converted
> > +successfully,
> > +  since they are the only valid root values of a JSON text for UEFI usage.
> > +
> > +  Real number and number with exponent part are not supportted by UEFI.
> > +
> > +  Caller needs to cleanup the root value by calling JsonValueFree().
> > +
> > +  @param[in]   StringThe NULL terminated UTF8 encoded string to
> convert
> > +
> > +  @retval  Array JSON value or object JSON value, or NULL when any
> error occurs.
> > +
> > +**/
> > +EDKII_JSON_VALUE
> > +EFIAPI
> > +JsonLoadString (
> > +  IN   CONST CHAR8*String
> > +  );
> > +
> >  /**
> >Load JSON from a buffer.
> >
> > diff --git a/RedfishPkg/Library/JsonLib/JsonLib.c
> > b/RedfishPkg/Library/JsonLib/JsonLib.c
> > index 34ff381aee..1762c6f5af 100644
> > --- a/RedfishPkg/Library/JsonLib/JsonLib.c
> > +++ b/RedfishPk

Re: [edk2-devel] [PATCH] RedfishPkg/RedfishCrtLib: Add more CRT functions

2021-01-27 Thread Abner Chang
All fixed and v2 sent. Didn't pay attention on the return values. Thanks for 
catching this.

Abner

> -Original Message-
> From: Leif Lindholm [mailto:l...@nuviainc.com]
> Sent: Tuesday, January 26, 2021 7:37 PM
> To: Chang, Abner (HPS SW/FW Technologist) 
> Cc: devel@edk2.groups.io; Wang, Nickle (HPS SW) ;
> Michael D Kinney 
> Subject: Re: [PATCH] RedfishPkg/RedfishCrtLib: Add more CRT functions
> 
> On Mon, Jan 25, 2021 at 12:36:53 +0800, Abner Chang wrote:
> > Add more functions which were missed in the first time commit, that
> > causes the build error with EDK2 Redfish feature driver.
> >
> > strerror - We don't support this on edk2 environment.
> > strpbrk  - Cloned this function from edk2-LibC File operation
> > functions - Not supported on edk2 environment.
> >
> > Signed-off-by: Abner Chang 
> >
> > Cc: Nickle Wang 
> > Cc: Leif Lindholm 
> > Cc: Michael D Kinney 
> > ---
> >  .../RedfishCrtLib/RedfishCrtLib.c | 119 ++
> >  1 file changed, 119 insertions(+)
> >
> > diff --git a/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c
> > b/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c
> > index 0696341bc0..c64f14534c 100644
> > --- a/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c
> > +++ b/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c
> > @@ -15,6 +15,10 @@
> >  #include 
> >
> >  int  errno = 0;
> > +char errnum_message [] = "We don't support to map errnum to the error
> > +message on edk2 Redfish\n";
> > +
> > +// This is required to keep VC++ happy if you use floating-point int
> > +_fltused  = 1;
> >
> >  /**
> >Determine if a particular character is an alphanumeric character @@
> > -465,6 +469,76 @@ strtod (const char * __restrict nptr, char ** __restrict
> endptr) {
> >  return (double)0;
> >  }
> >
> > +static UINT8  BitMask[] = {
> > +  0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
> > +  };
> > +
> > +#define WHICH8(c) ((unsigned char)(c) >> 3)
> > +#define WHICH_BIT(c)  (BitMask[((c) & 0x7)])
> > +#define BITMAP64  ((UINT64 *)bitmap)
> > +
> > +static
> > +void
> > +BuildBitmap(unsigned char * bitmap, const char *s2, int n) {
> > +  unsigned char bit;
> > +  int   index;
> > +
> > +  // Initialize bitmap.  Bit 0 is always 1 which corresponds to '\0'
> > +  for (BITMAP64[0] = index = 1; index < n; index++)
> > +BITMAP64[index] = 0;
> 
> Please use {}.
> 
> > +
> > +  // Set bits in bitmap corresponding to the characters in s2
> > +  for (; *s2 != '\0'; s2++) {
> > +index = WHICH8(*s2);
> > +bit = WHICH_BIT(*s2);
> > +bitmap[index] = bitmap[index] | bit;
> > +  }
> > +}
> > +
> > +/** The strpbrk function locates the first occurrence in the string pointed
> to
> > +by s1 of any character from the string pointed to by s2.
> > +
> > +@return   The strpbrk function returns a pointer to the character, or a
> > +  null pointer if no character from s2 occurs in s1.
> > +**/
> > +char *
> > +strpbrk(const char *s1, const char *s2) {
> > +  UINT8 bitmap[ (((UCHAR_MAX + 1) / CHAR_BIT) + (CHAR_BIT - 1)) &
> > +~7U];
> > +  UINT8 bit;
> > +  int index;
> > +
> > +  BuildBitmap( bitmap, s2, sizeof(bitmap) / sizeof(UINT64));
> > +
> > +  for( ; *s1 != '\0'; ++s1) {
> > +index = WHICH8(*s1);
> > +bit = WHICH_BIT(*s1);
> > +if( (bitmap[index] & bit) != 0) {
> > +  return (char *)s1;
> > +}
> > +  }
> > +  return NULL;
> > +}
> > +
> > +/** The strerror function maps the number in errnum to a message string.
> > +Typically, the values for errnum come from errno, but strerror shall 
> > map
> > +any value of type int to a message.
> > +
> > +The implementation shall behave as if no library function calls the
> > +strerror function.
> > +
> > +@return   The strerror function returns a pointer to the string, the
> > +  contents of which are locale specific.  The array pointed to
> > +  shall not be modified by the program, but may be overwritten 
> > by
> > +  a subsequent call to the strerror function.
> > +**/
> > +char *
> > +strerror(int errnum)
> > +{
> > +  return errnum_message;
> > +}
> > +
> >  /**
> >Allocate and zero-initialize array.
> >  **/
> > @@ -594,6 +668,51 @@ void qsort (void *base, size_t num, size_t width,
> > int (*compare)(const void *, c  int fgetc(FILE * _File){
> > return 0;
> >  }
> > +/**
> > +  Open stream file, we don't support file operastion on edk2 JSON library.
> > +
> > +  @return 0 Unsupported
> > +
> > +**/
> > +FILE *fopen (const char *filename, const char *mode) {
> > +  return 0;
> 
> NULL.
> 
> > +}
> > +/**
> > +  Read stream from file, we don't support file operastion on edk2 JSON
> library.
> > +
> > +  @return 0 Unsupported
> > +
> > +**/
> > +size_t fread (void * ptr, size_t size, size_t count, FILE * stream) {
> > +  return 0;
> > +}
> > +/**
> > +  Write stream from file, we don't support file operastion on edk2 JSON
> library.
> > +
> > +  @return 0 Un

[edk2-devel] [PATCH v2] RedfishPkg/RedfishCrtLib: Add more CRT functions

2021-01-27 Thread Abner Chang
Add more functions which were missed in the first time commit,
that causes the build error with EDK2 Redfish feature driver.

strerror - We don't support this on edk2 environment.
strpbrk  - Cloned this function from edk2-LibC
File operation functions - Not supported on edk2 environment.

Signed-off-by: Abner Chang 

Cc: Nickle Wang 
Cc: Leif Lindholm 
Cc: Michael D Kinney 
---
 .../RedfishCrtLib/RedfishCrtLib.c | 122 +-
 1 file changed, 121 insertions(+), 1 deletion(-)

diff --git a/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c 
b/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c
index 0696341bc0..58ef4f8fdb 100644
--- a/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c
+++ b/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c
@@ -15,6 +15,10 @@
 #include 
 
 int  errno = 0;
+char errnum_message [] = "We don't support to map errnum to the error message 
on edk2 Redfish\n";
+
+// This is required to keep VC++ happy if you use floating-point
+int _fltused  = 1;
 
 /**
   Determine if a particular character is an alphanumeric character
@@ -465,6 +469,77 @@ strtod (const char * __restrict nptr, char ** __restrict 
endptr) {
 return (double)0;
 }
 
+static UINT8  BitMask[] = {
+  0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
+  };
+
+#define WHICH8(c) ((unsigned char)(c) >> 3)
+#define WHICH_BIT(c)  (BitMask[((c) & 0x7)])
+#define BITMAP64  ((UINT64 *)bitmap)
+
+static
+void
+BuildBitmap(unsigned char * bitmap, const char *s2, int n)
+{
+  unsigned char bit;
+  int   index;
+
+  // Initialize bitmap.  Bit 0 is always 1 which corresponds to '\0'
+  for (BITMAP64[0] = index = 1; index < n; index++) {
+BITMAP64[index] = 0;
+  }
+
+  // Set bits in bitmap corresponding to the characters in s2
+  for (; *s2 != '\0'; s2++) {
+index = WHICH8(*s2);
+bit = WHICH_BIT(*s2);
+bitmap[index] = bitmap[index] | bit;
+  }
+}
+
+/** The strpbrk function locates the first occurrence in the string pointed to
+by s1 of any character from the string pointed to by s2.
+
+@return   The strpbrk function returns a pointer to the character, or a
+  null pointer if no character from s2 occurs in s1.
+**/
+char *
+strpbrk(const char *s1, const char *s2)
+{
+  UINT8 bitmap[ (((UCHAR_MAX + 1) / CHAR_BIT) + (CHAR_BIT - 1)) & ~7U];
+  UINT8 bit;
+  int index;
+
+  BuildBitmap( bitmap, s2, sizeof(bitmap) / sizeof(UINT64));
+
+  for( ; *s1 != '\0'; ++s1) {
+index = WHICH8(*s1);
+bit = WHICH_BIT(*s1);
+if( (bitmap[index] & bit) != 0) {
+  return (char *)s1;
+}
+  }
+  return NULL;
+}
+
+/** The strerror function maps the number in errnum to a message string.
+Typically, the values for errnum come from errno, but strerror shall map
+any value of type int to a message.
+
+The implementation shall behave as if no library function calls the
+strerror function.
+
+@return   The strerror function returns a pointer to the string, the
+  contents of which are locale specific.  The array pointed to
+  shall not be modified by the program, but may be overwritten by
+  a subsequent call to the strerror function.
+**/
+char *
+strerror(int errnum)
+{
+  return errnum_message;
+}
+
 /**
   Allocate and zero-initialize array.
 **/
@@ -592,7 +667,52 @@ void qsort (void *base, size_t num, size_t width, int 
(*compare)(const void *, c
 
 **/
 int fgetc(FILE * _File){
-   return 0;
+   return EOF;
+}
+/**
+  Open stream file, we don't support file operastion on edk2 JSON library.
+
+  @return 0 Unsupported
+
+**/
+FILE *fopen (const char *filename, const char *mode) {
+  return NULL;
+}
+/**
+  Read stream from file, we don't support file operastion on edk2 JSON library.
+
+  @return 0 Unsupported
+
+**/
+size_t fread (void * ptr, size_t size, size_t count, FILE * stream) {
+  return 0;
+}
+/**
+  Write stream from file, we don't support file operastion on edk2 JSON 
library.
+
+  @return 0 Unsupported
+
+**/
+size_t fwrite (const void * ptr, size_t size, size_t count, FILE * stream) {
+  return 0;
+}
+/**
+  Close file, we don't support file operastion on edk2 JSON library.
+
+  @return 0 Unsupported
+
+**/
+int fclose (FILE * stream) {
+  return EOF;
+}
+/**
+  Write the formatted string to file, we don't support file operastion on edk2 
JSON library.
+
+  @return 0 Unsupported
+
+**/
+int fprintf (FILE * stream, const char * format, ...) {
+  return -1;
 }
 /**
   This function check if this is the formating string specifier.
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70837): https://edk2.groups.io/g/devel/message/70837
Mute This Topic: https://groups.io/mt/80176266/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Don't increase CpuCount in ApWakeupFunction

2021-01-27 Thread Dong, Eric
Reviewed-by: Eric Dong 

From: Ni, Ray 
Sent: Thursday, January 28, 2021 11:27 AM
To: Dong, Eric ; Laszlo Ersek ; Kumar, 
Rahul1 
Cc: devel@edk2.groups.io; Ni, Ray 
Subject: RE: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Don't increase CpuCount 
in ApWakeupFunction

Somehow I forgot to add "Cc" tag in the patch resulting the package maintainers 
are not CCed.
Add them back.

> -Original Message-
> From: devel@edk2.groups.io 
> mailto:devel@edk2.groups.io>> On Behalf Of Ni, Ray
> Sent: Tuesday, January 26, 2021 1:50 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Don't increase
> CpuCount in ApWakeupFunction
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3179
>
> When BSP first time wakes all APs, each AP atomically increases
> CpuMpData->CpuCount and CpuMpData->FinishedCount.
> Each AP atomically increases CpuMpData->NumApsExecuting
> in early assembly code and decreases it before it enters to HLT or
> MWAIT state.
>
> Putting them together, the 3 variables are changed in the following order:
> 1. NumApsExecuting++ // in assembly
> 2. CpuCpunt++
> 4. FinishedCount++
> 3. NumApsExecuting-- // in C
>
> BSP waits for a certain timeout and then polls NumApsExecuting
> until it drops to zero. It assumes all APs are waken up concurrently
> and NumApsExecuting only drops to zero when all APs have checked in.
>
> Then it additionally waits for FinishedCount == CpuCount - 1.
> (FinishedCount doesn't include BSP while CpuCount includes BSP.)
>
> There is no need to additionally wait for
> FinishedCount == CpuCount - 1 because when NumApsExecuting == 0,
> the number of increments of FinishedCount and CpuCount should equal.
>
> This patch simplifies the code to remove "CpuCount++" in
> ApWakeupFunction() and assigns FinishedCount + 1 to CpuCount after
> WakeUpAP().
>
> Signed-off-by: Ray Ni mailto:ray...@intel.com>>
> ---
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 16 +---
>  1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 8b1f7f84ba..2568986d8c 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -1,7 +1,7 @@
>  /** @file
>
>CPU MP Initialize Library common functions.
>
>
>
> -  Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.
>
> +  Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.
>
>Copyright (c) 2020, AMD Inc. All rights reserved.
>
>
>
>SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -485,14 +485,12 @@ CollectProcessorCount (
>CpuMpData->InitFlag = ApInitConfig;
>
>WakeUpAP (CpuMpData, TRUE, 0, NULL, NULL, TRUE);
>
>CpuMpData->InitFlag = ApInitDone;
>
> -  ASSERT (CpuMpData->CpuCount <= PcdGet32
> (PcdCpuMaxLogicalProcessorNumber));
>
>//
>
> -  // Wait for all APs finished the initialization
>
> +  // When InitFlag == ApInitConfig, WakeUpAP () guarantees all APs are
> checked in.
>
> +  // FinishedCount is the number of check-in APs.
>
>//
>
> -  while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {
>
> -CpuPause ();
>
> -  }
>
> -
>
> +  CpuMpData->CpuCount = CpuMpData->FinishedCount + 1;
>
> +  ASSERT (CpuMpData->CpuCount <= PcdGet32
> (PcdCpuMaxLogicalProcessorNumber));
>
>
>
>//
>
>// Enable x2APIC mode if
>
> @@ -751,10 +749,6 @@ ApWakeupFunction (
>CurrentApicMode = GetApicMode ();
>
>while (TRUE) {
>
>  if (CpuMpData->InitFlag == ApInitConfig) {
>
> -  //
>
> -  // Add CPU number
>
> -  //
>
> -  InterlockedIncrement ((UINT32 *) &CpuMpData->CpuCount);
>
>ProcessorNumber = ApIndex;
>
>//
>
>// This is first time AP wakeup, get BIST information from AP stack
>
> --
> 2.27.0.windows.1
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#70757): https://edk2.groups.io/g/devel/message/70757
> Mute This Topic: https://groups.io/mt/80124850/1712937
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray...@intel.com]
> -=-=-=-=-=-=
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70836): https://edk2.groups.io/g/devel/message/70836
Mute This Topic: https://groups.io/mt/80124850/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Don't increase CpuCount in ApWakeupFunction

2021-01-27 Thread Ni, Ray
Somehow I forgot to add "Cc" tag in the patch resulting the package maintainers 
are not CCed.
Add them back.

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Ni, Ray
> Sent: Tuesday, January 26, 2021 1:50 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Don't increase
> CpuCount in ApWakeupFunction
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3179
> 
> When BSP first time wakes all APs, each AP atomically increases
> CpuMpData->CpuCount and CpuMpData->FinishedCount.
> Each AP atomically increases CpuMpData->NumApsExecuting
> in early assembly code and decreases it before it enters to HLT or
> MWAIT state.
> 
> Putting them together, the 3 variables are changed in the following order:
> 1. NumApsExecuting++ // in assembly
> 2. CpuCpunt++
> 4. FinishedCount++
> 3. NumApsExecuting-- // in C
> 
> BSP waits for a certain timeout and then polls NumApsExecuting
> until it drops to zero. It assumes all APs are waken up concurrently
> and NumApsExecuting only drops to zero when all APs have checked in.
> 
> Then it additionally waits for FinishedCount == CpuCount - 1.
> (FinishedCount doesn't include BSP while CpuCount includes BSP.)
> 
> There is no need to additionally wait for
> FinishedCount == CpuCount - 1 because when NumApsExecuting == 0,
> the number of increments of FinishedCount and CpuCount should equal.
> 
> This patch simplifies the code to remove "CpuCount++" in
> ApWakeupFunction() and assigns FinishedCount + 1 to CpuCount after
> WakeUpAP().
> 
> Signed-off-by: Ray Ni 
> ---
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 16 +---
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 8b1f7f84ba..2568986d8c 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -1,7 +1,7 @@
>  /** @file
> 
>CPU MP Initialize Library common functions.
> 
> 
> 
> -  Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.
> 
> +  Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.
> 
>Copyright (c) 2020, AMD Inc. All rights reserved.
> 
> 
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -485,14 +485,12 @@ CollectProcessorCount (
>CpuMpData->InitFlag = ApInitConfig;
> 
>WakeUpAP (CpuMpData, TRUE, 0, NULL, NULL, TRUE);
> 
>CpuMpData->InitFlag = ApInitDone;
> 
> -  ASSERT (CpuMpData->CpuCount <= PcdGet32
> (PcdCpuMaxLogicalProcessorNumber));
> 
>//
> 
> -  // Wait for all APs finished the initialization
> 
> +  // When InitFlag == ApInitConfig, WakeUpAP () guarantees all APs are
> checked in.
> 
> +  // FinishedCount is the number of check-in APs.
> 
>//
> 
> -  while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {
> 
> -CpuPause ();
> 
> -  }
> 
> -
> 
> +  CpuMpData->CpuCount = CpuMpData->FinishedCount + 1;
> 
> +  ASSERT (CpuMpData->CpuCount <= PcdGet32
> (PcdCpuMaxLogicalProcessorNumber));
> 
> 
> 
>//
> 
>// Enable x2APIC mode if
> 
> @@ -751,10 +749,6 @@ ApWakeupFunction (
>CurrentApicMode = GetApicMode ();
> 
>while (TRUE) {
> 
>  if (CpuMpData->InitFlag == ApInitConfig) {
> 
> -  //
> 
> -  // Add CPU number
> 
> -  //
> 
> -  InterlockedIncrement ((UINT32 *) &CpuMpData->CpuCount);
> 
>ProcessorNumber = ApIndex;
> 
>//
> 
>// This is first time AP wakeup, get BIST information from AP stack
> 
> --
> 2.27.0.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#70757): https://edk2.groups.io/g/devel/message/70757
> Mute This Topic: https://groups.io/mt/80124850/1712937
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray...@intel.com]
> -=-=-=-=-=-=
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70835): https://edk2.groups.io/g/devel/message/70835
Mute This Topic: https://groups.io/mt/80124850/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 2/2] MdeModulePkg/Usb/Keyboard.c: don't request protocol before setting

2021-01-27 Thread Wu, Hao A
> -Original Message-
> From: Patrick Rudolph 
> Sent: Wednesday, January 20, 2021 11:59 PM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J ; Wu, Hao A ;
> Ni, Ray 
> Subject: [PATCH 2/2] MdeModulePkg/Usb/Keyboard.c: don't request
> protocol before setting
> 
> From: Matt DeVillier 
> 
> No need to check the interface protocol then conditionally setting, just set 
> it
> to BOOT_PROTOCOL and check for error.
> 
> This is what Linux does for HID devices as some don't follow the USB spec.
> One example is the Aspeed BMC HID keyboard device, which adds a massive
> boot delay without this patch as it doesn't respond to 'GetProtocolRequest'.


I am okay with the code change.

But since the current logic is here for a long time, I am not sure whether
other USB keyboard device will have functional/performance impact for this
change.

Besides the above mentioned Aspeed BMC HID keyboard device (which has a
performance issue for the Get_Protocol request that the patch is going to
drop), could you at least try one USB keyboard device that works fine with
the origin code logic to see if there is any side effect for this patch?

Thanks in advance.

Best Regards,
Hao Wu


> 
> Signed-off-by: Matt DeVillier 
> Signed-off-by: Patrick Rudolph 
> ---
>  MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c | 28 ---
> -
>  1 file changed, 17 insertions(+), 11 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> index 77e20b203f..5914174b4d 100644
> --- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> +++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> @@ -801,7 +801,6 @@ InitUSBKeyboard (
>IN OUT USB_KB_DEV   *UsbKeyboardDevice   ) {-  UINT8   
> Protocol;
> EFI_STATUS  Status;REPORT_STATUS_CODE_WITH_DEVICE_PATH (@@
> -814,21 +813,28 @@ InitUSBKeyboard (
>InitQueue (&UsbKeyboardDevice->EfiKeyQueue, sizeof (EFI_KEY_DATA));
> InitQueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, sizeof
> (EFI_KEY_DATA)); -  UsbGetProtocolRequest (-UsbKeyboardDevice-
> >UsbIo,-UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,-
> &Protocol-);   //   // Set boot protocol for the USB Keyboard.   // This 
> driver
> only supports boot protocol.   //-  if (Protocol != BOOT_PROTOCOL) {-
> UsbSetProtocolRequest (-  UsbKeyboardDevice->UsbIo,-
> UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,-
> BOOT_PROTOCOL+  Status = UsbSetProtocolRequest (+
> UsbKeyboardDevice->UsbIo,+ UsbKeyboardDevice-
> >InterfaceDescriptor.InterfaceNumber,+ BOOT_PROTOCOL+ 
> >);+
> if (EFI_ERROR (Status)) {+//+// If protocol could not be set here, it
> means+// the keyboard interface has some errors and could+// not be
> initialized+//+REPORT_STATUS_CODE_WITH_DEVICE_PATH (+
> EFI_ERROR_CODE | EFI_ERROR_MINOR,+  (EFI_PERIPHERAL_KEYBOARD |
> EFI_P_EC_INTERFACE_ERROR),+  UsbKeyboardDevice->DevicePath   );++
> return EFI_DEVICE_ERROR;   }UsbKeyboardDevice->CtrlOn = FALSE;--
> 2.26.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70834): https://edk2.groups.io/g/devel/message/70834
Mute This Topic: https://groups.io/mt/79981645/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/Usb/Keyboard.c: remove Get/SetConfig calls

2021-01-27 Thread Wu, Hao A
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Wu, Hao
> A
> Sent: Friday, January 22, 2021 9:17 AM
> To: devel@edk2.groups.io; patrick.rudo...@9elements.com
> Cc: Wang, Jian J ; Ni, Ray 
> Subject: Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/Usb/Keyboard.c:
> remove Get/SetConfig calls
> 
> Sorry, please grant me some time for this patch series. I will try to provide
> feedbacks before end of next week.
> Meanwhile, could you help to provide the information on what kind of tests
> have been performed for these 2 patches? Thanks in advance.
> 
> Best Regards,
> Hao Wu
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Patrick
> > Rudolph
> > Sent: Wednesday, January 20, 2021 11:59 PM
> > To: devel@edk2.groups.io
> > Cc: Wang, Jian J ; Wu, Hao A
> > ; Ni, Ray 
> > Subject: [edk2-devel] [PATCH 1/2] MdeModulePkg/Usb/Keyboard.c:
> > remove Get/SetConfig calls
> >
> > From: Matt DeVillier 
> >
> > SetConfig is already called during device enumeration, no need to do
> > it again here.


I found that the InitUSBKeyboard() function, which includes this Get/SetConfig
calls, is triggered during the keyboard reset flow. Even though the
configuration for the keyboard will be set during enumeration, I think it would
be better to keep this reconfiguration in the reset flow.

Best Regards,
Hao Wu


> >
> > Signed-off-by: Matt DeVillier 
> > ---
> >  MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c | 37 
> >  1 file changed, 37 deletions(-)
> >
> > diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > index 5faf82ea57..77e20b203f 100644
> > --- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > +++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > @@ -801,10 +801,8 @@ InitUSBKeyboard (
> >IN OUT USB_KB_DEV   *UsbKeyboardDevice
> >
> >)
> >
> >  {
> >
> > -  UINT16  ConfigValue;
> >
> >UINT8   Protocol;
> >
> >EFI_STATUS  Status;
> >
> > -  UINT32  TransferResult;
> >
> >
> >
> >REPORT_STATUS_CODE_WITH_DEVICE_PATH (
> >
> >  EFI_PROGRESS_CODE,
> >
> > @@ -816,41 +814,6 @@ InitUSBKeyboard (
> >InitQueue (&UsbKeyboardDevice->EfiKeyQueue, sizeof (EFI_KEY_DATA));
> >
> >InitQueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, sizeof
> > (EFI_KEY_DATA));
> >
> >
> >
> > -  //
> >
> > -  // Use the config out of the descriptor
> >
> > -  // Assumed the first config is the correct one and this is not
> > always the case
> >
> > -  //
> >
> > -  Status = UsbGetConfiguration (
> >
> > - UsbKeyboardDevice->UsbIo,
> >
> > - &ConfigValue,
> >
> > - &TransferResult
> >
> > - );
> >
> > -  if (EFI_ERROR (Status)) {
> >
> > -ConfigValue = 0x01;
> >
> > -//
> >
> > -// Uses default configuration to configure the USB Keyboard device.
> >
> > -//
> >
> > -Status = UsbSetConfiguration (
> >
> > -   UsbKeyboardDevice->UsbIo,
> >
> > -   ConfigValue,
> >
> > -   &TransferResult
> >
> > -   );
> >
> > -if (EFI_ERROR (Status)) {
> >
> > -  //
> >
> > -  // If configuration could not be set here, it means
> >
> > -  // the keyboard interface has some errors and could
> >
> > -  // not be initialized
> >
> > -  //
> >
> > -  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
> >
> > -EFI_ERROR_CODE | EFI_ERROR_MINOR,
> >
> > -(EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INTERFACE_ERROR),
> >
> > -UsbKeyboardDevice->DevicePath
> >
> > -);
> >
> > -
> >
> > -  return EFI_DEVICE_ERROR;
> >
> > -}
> >
> > -  }
> >
> > -
> >
> >UsbGetProtocolRequest (
> >
> >  UsbKeyboardDevice->UsbIo,
> >
> >  UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
> >
> > --
> > 2.26.2
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#70585):
> > https://edk2.groups.io/g/devel/message/70585
> > Mute This Topic: https://groups.io/mt/79981643/1768737
> > Group Owner: devel+ow...@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a...@intel.com]
> > -=-=-=-=-=-=
> >
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70833): https://edk2.groups.io/g/devel/message/70833
Mute This Topic: https://groups.io/mt/79981643/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 RESEND] MdeModulePkg/Library: Add HiiGetStringEx to UefiHiiLib for EDK2 Redfish

2021-01-27 Thread Abner Chang
Add HiiGetStringEx and leveraged by HiiGetString function to support
getting string with the best language in optionally. This avoids the
string in x-uefi language is misled to the language defined by
"PlatformLang" or the "Supported Languages". This change is introduced
to support x-uefi keyword language for configuring BIOS setting.

Signed-off-by: Jiaxin Wu 
Signed-off-by: Siyuan Fu 
Signed-off-by: Fan Wang 
Signed-off-by: Abner Chang 
Cc: Dandan Bi 
Cc: Eric Dong 
Cc: Nickle Wang 
---
 MdeModulePkg/Include/Library/HiiLib.h   | 41 ++-
 MdeModulePkg/Library/UefiHiiLib/HiiString.c | 79 -
 2 files changed, 101 insertions(+), 19 deletions(-)

diff --git a/MdeModulePkg/Include/Library/HiiLib.h 
b/MdeModulePkg/Include/Library/HiiLib.h
index c475cb74a1..14dcc3b5b6 100644
--- a/MdeModulePkg/Include/Library/HiiLib.h
+++ b/MdeModulePkg/Include/Library/HiiLib.h
@@ -1,7 +1,7 @@
 /** @file
   Public include file for the HII Library
 
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -152,8 +152,43 @@ HiiGetString (
   IN EFI_HII_HANDLE  HiiHandle,
   IN EFI_STRING_ID   StringId,
   IN CONST CHAR8 *Language  OPTIONAL
-  )
-;
+  );
+
+/**
+  Retrieves a string from a string package in a specific language.  If the 
language
+  is not specified, then a string from a string package in the current platform
+  language is retrieved.  If the string can not be retrieved using the 
specified
+  language or the current platform language, then the string is retrieved from
+  the string package in the first language the string package supports.  The
+  returned string is allocated using AllocatePool().  The caller is responsible
+  for freeing the allocated buffer using FreePool().
+
+  If HiiHandle is NULL, then ASSERT().
+  If StringId is 0, then ASSET.
+
+  @param[in]  HiiHandle A handle that was previously registered in the 
HII Database.
+  @param[in]  StringId  The identifier of the string to retrieved from 
the string
+package associated with HiiHandle.
+  @param[in]  Language  The language of the string to retrieve.  If 
this parameter
+is NULL, then the current platform language is 
used.  The
+format of Language must follow the language 
format assumed
+the HII Database.
+  @param[in]  TryBestLanguage   If TRUE, try to get the best matching language 
from all
+supported languages.If FALSE, the Language 
must be assigned
+for the StringID.
+
+  @retval NULL   The string specified by StringId is not present in the string 
package.
+  @retval Other  The string was returned.
+
+**/
+EFI_STRING
+EFIAPI
+HiiGetStringEx (
+  IN EFI_HII_HANDLE  HiiHandle,
+  IN EFI_STRING_ID   StringId,
+  IN CONST CHAR8 *Language  OPTIONAL,
+  IN BOOLEAN TryBestLanguage
+  );
 
 /**
   Retrieves a string from a string package named by GUID, in the specified 
language.
diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiString.c 
b/MdeModulePkg/Library/UefiHiiLib/HiiString.c
index 95229f8a8c..2d6c9968ba 100644
--- a/MdeModulePkg/Library/UefiHiiLib/HiiString.c
+++ b/MdeModulePkg/Library/UefiHiiLib/HiiString.c
@@ -1,7 +1,7 @@
 /** @file
   HII Library implementation that uses DXE protocols and services.
 
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -220,6 +220,45 @@ HiiGetString (
   IN EFI_STRING_ID   StringId,
   IN CONST CHAR8 *Language  OPTIONAL
   )
+{
+  return HiiGetStringEx (HiiHandle, StringId, Language, TRUE);
+}
+
+/**
+  Retrieves a string from a string package in a specific language.  If the 
language
+  is not specified, then a string from a string package in the current platform
+  language is retrieved.  If the string can not be retrieved using the 
specified
+  language or the current platform language, then the string is retrieved from
+  the string package in the first language the string package supports.  The
+  returned string is allocated using AllocatePool().  The caller is responsible
+  for freeing the allocated buffer using FreePool().
+
+  If HiiHandle is NULL, then ASSERT().
+  If StringId is 0, then ASSET.
+
+  @param[in]  HiiHandle A handle that was previously registered in the 
HII Database.
+  @param[in]  StringId  The identifier of the string to retrieved from 
the string
+package associated with HiiHandle.
+  @param[in]  Language  The language of the string to retrieve.  If 
this parameter
+is NULL, then the current platform language is 
used.  The
+  

回复: [EXTERNAL] Re: [edk2-devel] Spell check corrections, package by package

2021-01-27 Thread gaoliming
One BZ is for one package. If few change is made for single module, I would
like to create one combined patch for one package. 

 

Thanks

Liming

发件人: bounce+27952+70825+4905953+8761...@groups.io
 代表 Bret Barkelew via
groups.io
发送时间: 2021年1月27日 18:20
收件人: Laszlo Ersek ; devel@edk2.groups.io
主题: Re: [EXTERNAL] Re: [edk2-devel] Spell check corrections, package by
package

 

Noted. I’ll see what that looks like. Thanks!

 

- Bret 

 

From: Laszlo Ersek  
Sent: Wednesday, January 27, 2021 1:42 AM
To: devel@edk2.groups.io  ; Bret Barkelew
 
Subject: [EXTERNAL] Re: [edk2-devel] Spell check corrections, package by
package

 

On 01/27/21 01:24, brbarkel via groups.io wrote:
> When we added the SpellCheck to CI, we intended to move through package by
package and turn on the PR gate checks (right now they're all in "audit
only"). To do this, we must first fix all the existing spelling errors
and/or update the ignore lists and dictionaries with expected terms.
> 
> I would like to start this process so that we can get enforcement on in
the next couple of months. To pick a random package, I was going to start
with NetworkPkg. Before starting, I wanted to ask what the community would
like to see in terms of the number of patches and/or associated bugs. I'm
comfortable with whatever because I will likely automate the bug opening and
patch association (so beware if you want one bug per fix... there will be a
LOT of bugs).
> 
> Thoughts?

One BZ for OvmfPkg should work, with one associated patch series for
OvmfPkg. Each patch in the OvmfPkg series should fix typos in a given
module (library or driver or application) in OvmfPkg.

Duplicate all of the above for ArmVirtPkg (one BZ, one series, one patch
per module).

Thanks!
Laszlo

 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70831): https://edk2.groups.io/g/devel/message/70831
Mute This Topic: https://groups.io/mt/80173994/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] 回复: [Wiki] Add update notes for incomaptible patches that fix typos in SmBios.h

2021-01-27 Thread gaoliming
Zhiguang:
  Can you summary the code change in the notes? And, also include the edk2 
commits for the detail. 

Thanks
Liming
> -邮件原件-
> 发件人: Zhiguang Liu 
> 发送时间: 2021年1月27日 10:09
> 收件人: devel@edk2.groups.io
> 抄送: Liming Gao 
> 主题: [Wiki] Add update notes for incomaptible patches that fix typos in
> SmBios.h
> 
> Cc: Liming Gao 
> Signed-off-by: Zhiguang Liu 
> ---
>  EDK-II-Release-Planning.md | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/EDK-II-Release-Planning.md b/EDK-II-Release-Planning.md
> index 336d8d2..bbb5f18 100644
> --- a/EDK-II-Release-Planning.md
> +++ b/EDK-II-Release-Planning.md
> @@ -32,6 +32,7 @@
>  * If the user has the windows bat script that calls Split in it,it needs to
> change to "call Split" because Split will be a bat script but not an 
> executable
> file.
>  * Shell depends on library class OrderedCollectionLib. Platform DSC needs to
> configure it in [LibraryClasses]
> 
> OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLi
> b/BaseOrderedCollectionRedBlackTreeLib.inf
> +* Some struct fields in SmBios.h have typos and get fixed in these code
> change
> [0db8](https://github.com/tianocore/edk2/commit/0db89a661f38b10012ff4f
> 62e1853bfc48efd462),
> [bd9d](https://github.com/tianocore/edk2/commit/bd9da7b1da2639fcea8a1
> 56fa92a32bbc4209367),
> [e157](https://github.com/tianocore/edk2/commit/e157c8f9ed173a390d2c9
> d29069a46e9662e0d04). Platform code that uses those fields need
> modifications.
>  * TBD
> 
>  # edk2-stable202105 tag planning
> --
> 2.30.0.windows.2





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70830): https://edk2.groups.io/g/devel/message/70830
Mute This Topic: https://groups.io/mt/80173923/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH edk2-platforms v3 1/2] Drivers/OpTeeRpmb: Add an OP-TEE backed RPMB driver

2021-01-27 Thread Sami Mujawar
Hi Sughosh,

There are some edk2 coding standard incompatibilities (like space between 
function name and opening bracket, function parameter alignment etc.) and 
documentation for some functions is missing in the patch. Can you fix these, 
please?
Please also run the ECC tool in Drivers/OpTeeRpmb folder and fix any reported 
issues. The ECC errors 10002, 10006 and 10022 can be ignored for now.

Other than that, please find my response inline marked [SAMI].

Regards,

Sami Mujawar

-Original Message-
From: Sughosh Ganu 
Sent: 16 December 2020 11:09 AM
To: devel@edk2.groups.io
Cc: Sami Mujawar ; Ard Biesheuvel 
; Leif Lindholm ; Sahil Malhotra 
; Ilias Apalodimas 
Subject: [PATCH edk2-platforms v3 1/2] Drivers/OpTeeRpmb: Add an OP-TEE backed 
RPMB driver

From: Ilias Apalodimas 

A following patch is adding support for building StMM in order to run it
from OP-TEE.
OP-TEE in combination with a NS-world supplicant can use the RPMB
partition of an eMMC to store EFI variables. The supplicant
functionality is currently available in U-Boot only but can be ported
into EDK2. Assuming similar functionality is added in EDK2, this will
allow any hardware with an RPMB partition to store EFI variables
securely.

So let's add a driver that enables access of the RPMB partition through
OP-TEE. Since the upper layers expect a byte addressable interface,
the driver allocates memory and patches the PCDs, while syncing the
memory/hardware on read/write callbacks.

Signed-off-by: Ilias Apalodimas 
---

Changes since V2:
 - Allocate a dynamic number of pages based on the Pcd values instead
   of a static number
 - Clean up unused structs in header file
 - Added checks in OpTeeRpmbFvbGetBlockSize and handle NumLba=0

 Drivers/OpTeeRpmb/FixupPcd.inf|  44 ++
 Drivers/OpTeeRpmb/OpTeeRpmbFv.inf |  58 ++
 Drivers/OpTeeRpmb/OpTeeRpmbFvb.h  |  35 +
 Drivers/OpTeeRpmb/FixupPcd.c  |  74 ++
 Drivers/OpTeeRpmb/OpTeeRpmbFvb.c  | 803 
 5 files changed, 1014 insertions(+)

diff --git a/Drivers/OpTeeRpmb/FixupPcd.inf b/Drivers/OpTeeRpmb/FixupPcd.inf
new file mode 100644
index 00..f0cfdf7a4c
--- /dev/null
+++ b/Drivers/OpTeeRpmb/FixupPcd.inf
@@ -0,0 +1,44 @@
+## @file
+#  Instance of Base Memory Library without assembly.
+#
+#  Copyright (c) 2020, Linaro Ltd. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = FixupPcd
+  FILE_GUID  = a827c337-a9c6-301b-aeb7-acbc95d8da22
+  MODULE_TYPE= BASE
+  VERSION_STRING = 0.1
+  LIBRARY_CLASS  = RpmbPcdFixup|MM_STANDALONE
+  CONSTRUCTOR= FixPcdMemory
+
+[Sources]
+  FixupPcd.c
+  OpTeeRpmbFvb.h
+
+[Packages]
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  MmServicesTableLib
+  PcdLib
+
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
+
+
+[Protocols]
+  gEfiSmmFirmwareVolumeBlockProtocolGuid  ## CONSUMES
diff --git a/Drivers/OpTeeRpmb/OpTeeRpmbFv.inf 
b/Drivers/OpTeeRpmb/OpTeeRpmbFv.inf
new file mode 100644
index 00..b21f7397e5
--- /dev/null
+++ b/Drivers/OpTeeRpmb/OpTeeRpmbFv.inf
@@ -0,0 +1,58 @@
+## @file
+#
+#  Component description file for OpTeeRpmbFv module
+#
+#  Copyright (c) 2020, Linaro Ltd. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = OpTeeRpmbFv
+  FILE_GUID  = 4803FC20-E583-3BCD-8C60-141E85C9A2CF
+  MODULE_TYPE= MM_STANDALONE
+  VERSION_STRING = 0.1
+  PI_SPECIFICATION_VERSION   = 0x00010032
+  ENTRY_POINT= OpTeeRpmbFvbInit
+
+[Sources]
+  OpTeeRpmbFvb.c
+  OpTeeRpmbFvb.h
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  StandaloneMmPkg/StandaloneMmPkg.dec
+
+[LibraryClasses]
+  ArmSvcLib
+  BaseLib
+  BaseMemoryLib
+  DebugLib
+  MemoryAllocationLib
+  MmServicesTableLib
+  PcdLib
+  StandaloneMmDriverEntryPoint
+
+[Guids]
+  gEfiAuthenticatedVariableGuid
+  gEfiSystemNvDataFvGuid
+  gEfiVariableGuid
+
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
+  gEfiMdeModuleP

Re: [edk2-devel] [PATCH V2 1/1] UefiPayloadPkg: Remove PEI phase from Payload

2021-01-27 Thread Guo Dong

Hi Patrick,
Bootloader (coreboot or Slim Bootloader) is similar with EDKII PEI, so measured 
boot should 
work without PEI phase in UEFI payload.
In general, bootloader need pass required information to UEFI payload.
BlSupportDxe could get these information and set required PCDs.

We need well define the interface with bootloader on how to support measured 
boot, 
Also including measured boot enable/disable, TPM log event, etc. 

Thanks,
Guo
 > -Original Message-
 > From: devel@edk2.groups.io  On Behalf Of Patrick
 > Rudolph
 > Sent: Tuesday, January 26, 2021 8:21
 > To: Dong, Guo 
 > Cc: You, Benjamin ; devel@edk2.groups.io; Ma,
 > Maurice 
 > Subject: Re: [edk2-devel] [PATCH V2 1/1] UefiPayloadPkg: Remove PEI phase
 > from Payload
 >
 > Hi,
 > I'm trying to rebase my TPM support patches for UefiPayloadPkg on top of
 > master.
 >
 > The Tcg*Dxe needs the following PCDs set by their Tcg*Pei counterparts:
 > * PcdTpm2HashMask
 > * PcdTcg2HashAlgorithmBitmap
 > * PcdTpmInstanceGuid
 >
 > As there's no PEI stage any more, how do you plan to support TPMs in
 > UefiPayloadPkg?
 >
 > Kind Regards,
 > Patrick Rudolph



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70828): https://edk2.groups.io/g/devel/message/70828
Mute This Topic: https://groups.io/mt/78282656/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] MdeModulePkg/Library: Add HiiGetStringEx to UefiHiiLib for EDK2 Redfish

2021-01-27 Thread Abner Chang
Done and v2 sent.
Thanks

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> gaoliming
> Sent: Tuesday, January 26, 2021 9:51 AM
> To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist)
> 
> Cc: 'Dandan Bi' ; 'Eric Dong' ;
> Wang, Nickle (HPS SW) ; 'Michael D Kinney'
> 
> Subject: 回复: [edk2-devel] [PATCH] MdeModulePkg/Library: Add
> HiiGetStringEx to UefiHiiLib for EDK2 Redfish
> 
> Abner:
>  I agree this request is reasonable. New API name HiiGetStringEx is OK to me.
> I have some comments on the detail of this API.
> 
> 1. Please describe the behavior in function header when TryBestLanguage is
> FASLE.
> 2. When TryBestLanguage is FALSE, the input Language can't be NULL. If
> Language is NULL, the function should return the invalid parameter.
> 
> Thanks
> Liming
> > -邮件原件-
> > 发件人: bounce+27952+70661+4905953+8761...@groups.io
> >  代表 Abner Chang
> > 发送时间: 2021年1月22日 11:15
> > 收件人: devel@edk2.groups.io
> > 抄送: Dandan Bi ; Eric Dong ;
> > Nickle Wang 
> > 主题: [edk2-devel] [PATCH] MdeModulePkg/Library: Add HiiGetStringEx to
> > UefiHiiLib for EDK2 Redfish
> >
> > Add HiiGetStringEx and leveraged by HiiGetString function to support
> > getting string with the best language in optionally. This avoids the
> > string in x-uefi language is misled to the language defined by
> > "PlatformLang" or the "Supported Languages". This change is introduced
> > to support x-uefi keyword language for configuring BIOS setting.
> >
> > Signed-off-by: Jiaxin Wu 
> > Signed-off-by: Siyuan Fu 
> > Signed-off-by: Fan Wang 
> > Signed-off-by: Abner Chang 
> > Cc: Dandan Bi 
> > Cc: Eric Dong 
> > Cc: Nickle Wang 
> > ---
> >  MdeModulePkg/Include/Library/HiiLib.h   | 41 +++-
> >  MdeModulePkg/Library/UefiHiiLib/HiiString.c | 73
> > -
> >  2 files changed, 96 insertions(+), 18 deletions(-)
> >
> > diff --git a/MdeModulePkg/Include/Library/HiiLib.h
> > b/MdeModulePkg/Include/Library/HiiLib.h
> > index c475cb74a1..66c654dcd3 100644
> > --- a/MdeModulePkg/Include/Library/HiiLib.h
> > +++ b/MdeModulePkg/Include/Library/HiiLib.h
> > @@ -1,7 +1,7 @@
> >  /** @file
> >Public include file for the HII Library
> >
> > -Copyright (c) 2007 - 2018, Intel Corporation. All rights
> > reserved.
> > +Copyright (c) 2007 - 2021, Intel Corporation. All rights
> > +reserved.
> >  SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >  **/
> > @@ -152,8 +152,43 @@ HiiGetString (
> >IN EFI_HII_HANDLE  HiiHandle,
> >IN EFI_STRING_ID   StringId,
> >IN CONST CHAR8 *Language  OPTIONAL
> > -  )
> > -;
> > +  );
> > +
> > +/**
> > +  Retrieves a string from a string package in a specific language.
> > +If
> the
> > language
> > +  is not specified, then a string from a string package in the
> > + current
> platform
> > +  language is retrieved.  If the string can not be retrieved using
> > + the
> > specified
> > +  language or the current platform language, then the string is
> > + retrieved
> > from
> > +  the string package in the first language the string package supports.
> The
> > +  returned string is allocated using AllocatePool().  The caller is
> responsible
> > +  for freeing the allocated buffer using FreePool().
> > +
> > +  If HiiHandle is NULL, then ASSERT().
> > +  If StringId is 0, then ASSET.
> > +
> > +  @param[in]  HiiHandle A handle that was previously
> > registered in the HII Database.
> > +  @param[in]  StringId  The identifier of the string to retrieved
> > from the string
> > +package associated with HiiHandle.
> > +  @param[in]  Language  The language of the string to retrieve.
> > If this parameter
> > +is NULL, then the current platform
> > language is used.  The
> > +format of Language must follow the
> > language format assumed
> > +the HII Database.
> > +  @param[in]  TryBestLanguage   If TRUE, try to get the best matching
> > language from all
> > +supported languages.
> > +
> > +
> > +  @retval NULL   The string specified by StringId is not present in the
> > string package.
> > +  @retval Other  The string was returned.
> > +
> > +**/
> > +EFI_STRING
> > +EFIAPI
> > +HiiGetStringEx (
> > +  IN EFI_HII_HANDLE  HiiHandle,
> > +  IN EFI_STRING_ID   StringId,
> > +  IN CONST CHAR8 *Language  OPTIONAL,
> > +  IN BOOLEAN TryBestLanguage
> > +  );
> >
> >  /**
> >Retrieves a string from a string package named by GUID, in the
> specified
> > language.
> > diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiString.c
> > b/MdeModulePkg/Library/UefiHiiLib/HiiString.c
> > index 95229f8a8c..f3c52ace56 100644
> > --- a/MdeModulePkg/Library/UefiHiiLib/HiiString.c
> > +++ b/MdeModulePkg/Library/UefiHiiLib/HiiString.c
> > @@ -1,7 +1,7 @@
> >  /** @file
> >HII Library implementation that uses DXE protocols and services.
> >
> > -

[edk2-devel] [PATCH v2] MdeModulePkg/Library: Add HiiGetStringEx to UefiHiiLib for EDK2 Redfish

2021-01-27 Thread Abner Chang
Add HiiGetStringEx and leveraged by HiiGetString function to support
getting string with the best language in optionally. This avoids the
string in x-uefi language is misled to the language defined by
"PlatformLang" or the "Supported Languages". This change is introduced
to support x-uefi keyword language for configuring BIOS setting.

Signed-off-by: Jiaxin Wu 
Signed-off-by: Siyuan Fu 
Signed-off-by: Fan Wang 
Signed-off-by: Abner Chang 
Cc: Dandan Bi 
Cc: Eric Dong 
Cc: Nickle Wang 
---
 MdeModulePkg/Include/Library/HiiLib.h   | 41 +++-
 MdeModulePkg/Library/UefiHiiLib/HiiString.c | 73 -
 2 files changed, 96 insertions(+), 18 deletions(-)

diff --git a/MdeModulePkg/Include/Library/HiiLib.h 
b/MdeModulePkg/Include/Library/HiiLib.h
index c475cb74a1..66c654dcd3 100644
--- a/MdeModulePkg/Include/Library/HiiLib.h
+++ b/MdeModulePkg/Include/Library/HiiLib.h
@@ -1,7 +1,7 @@
 /** @file
   Public include file for the HII Library
 
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -152,8 +152,43 @@ HiiGetString (
   IN EFI_HII_HANDLE  HiiHandle,
   IN EFI_STRING_ID   StringId,
   IN CONST CHAR8 *Language  OPTIONAL
-  )
-;
+  );
+
+/**
+  Retrieves a string from a string package in a specific language.  If the 
language
+  is not specified, then a string from a string package in the current platform
+  language is retrieved.  If the string can not be retrieved using the 
specified
+  language or the current platform language, then the string is retrieved from
+  the string package in the first language the string package supports.  The
+  returned string is allocated using AllocatePool().  The caller is responsible
+  for freeing the allocated buffer using FreePool().
+
+  If HiiHandle is NULL, then ASSERT().
+  If StringId is 0, then ASSET.
+
+  @param[in]  HiiHandle A handle that was previously registered in the 
HII Database.
+  @param[in]  StringId  The identifier of the string to retrieved from 
the string
+package associated with HiiHandle.
+  @param[in]  Language  The language of the string to retrieve.  If 
this parameter
+is NULL, then the current platform language is 
used.  The
+format of Language must follow the language 
format assumed
+the HII Database.
+  @param[in]  TryBestLanguage   If TRUE, try to get the best matching language 
from all
+supported languages.
+
+
+  @retval NULL   The string specified by StringId is not present in the string 
package.
+  @retval Other  The string was returned.
+
+**/
+EFI_STRING
+EFIAPI
+HiiGetStringEx (
+  IN EFI_HII_HANDLE  HiiHandle,
+  IN EFI_STRING_ID   StringId,
+  IN CONST CHAR8 *Language  OPTIONAL,
+  IN BOOLEAN TryBestLanguage
+  );
 
 /**
   Retrieves a string from a string package named by GUID, in the specified 
language.
diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiString.c 
b/MdeModulePkg/Library/UefiHiiLib/HiiString.c
index 95229f8a8c..f3c52ace56 100644
--- a/MdeModulePkg/Library/UefiHiiLib/HiiString.c
+++ b/MdeModulePkg/Library/UefiHiiLib/HiiString.c
@@ -1,7 +1,7 @@
 /** @file
   HII Library implementation that uses DXE protocols and services.
 
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -220,6 +220,44 @@ HiiGetString (
   IN EFI_STRING_ID   StringId,
   IN CONST CHAR8 *Language  OPTIONAL
   )
+{
+  return HiiGetStringEx (HiiHandle, StringId, Language, TRUE);
+}
+
+/**
+  Retrieves a string from a string package in a specific language.  If the 
language
+  is not specified, then a string from a string package in the current platform
+  language is retrieved.  If the string can not be retrieved using the 
specified
+  language or the current platform language, then the string is retrieved from
+  the string package in the first language the string package supports.  The
+  returned string is allocated using AllocatePool().  The caller is responsible
+  for freeing the allocated buffer using FreePool().
+
+  If HiiHandle is NULL, then ASSERT().
+  If StringId is 0, then ASSET.
+
+  @param[in]  HiiHandle A handle that was previously registered in the 
HII Database.
+  @param[in]  StringId  The identifier of the string to retrieved from 
the string
+package associated with HiiHandle.
+  @param[in]  Language  The language of the string to retrieve.  If 
this parameter
+is NULL, then the current platform language is 
used.  The
+format of Language must follow the language 
format assumed
+  

Re: [EXTERNAL] Re: [edk2-devel] Spell check corrections, package by package

2021-01-27 Thread Bret Barkelew via groups.io
Noted. I’ll see what that looks like. Thanks!

- Bret

From: Laszlo Ersek
Sent: Wednesday, January 27, 2021 1:42 AM
To: devel@edk2.groups.io; Bret 
Barkelew
Subject: [EXTERNAL] Re: [edk2-devel] Spell check corrections, package by package

On 01/27/21 01:24, brbarkel via groups.io wrote:
> When we added the SpellCheck to CI, we intended to move through package by 
> package and turn on the PR gate checks (right now they're all in "audit 
> only"). To do this, we must first fix all the existing spelling errors and/or 
> update the ignore lists and dictionaries with expected terms.
>
> I would like to start this process so that we can get enforcement on in the 
> next couple of months. To pick a random package, I was going to start with 
> NetworkPkg. Before starting, I wanted to ask what the community would like to 
> see in terms of the number of patches and/or associated bugs. I'm comfortable 
> with whatever because I will likely automate the bug opening and patch 
> association (so beware if you want one bug per fix... there will be a LOT of 
> bugs).
>
> Thoughts?

One BZ for OvmfPkg should work, with one associated patch series for
OvmfPkg. Each patch in the OvmfPkg series should fix typos in a given
module (library or driver or application) in OvmfPkg.

Duplicate all of the above for ArmVirtPkg (one BZ, one series, one patch
per module).

Thanks!
Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70825): https://edk2.groups.io/g/devel/message/70825
Mute This Topic: https://groups.io/mt/80154076/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] Spell check corrections, package by package

2021-01-27 Thread Laszlo Ersek
On 01/27/21 01:24, brbarkel via groups.io wrote:
> When we added the SpellCheck to CI, we intended to move through package by 
> package and turn on the PR gate checks (right now they're all in "audit 
> only"). To do this, we must first fix all the existing spelling errors and/or 
> update the ignore lists and dictionaries with expected terms.
> 
> I would like to start this process so that we can get enforcement on in the 
> next couple of months. To pick a random package, I was going to start with 
> NetworkPkg. Before starting, I wanted to ask what the community would like to 
> see in terms of the number of patches and/or associated bugs. I'm comfortable 
> with whatever because I will likely automate the bug opening and patch 
> association (so beware if you want one bug per fix... there will be a LOT of 
> bugs).
> 
> Thoughts?

One BZ for OvmfPkg should work, with one associated patch series for
OvmfPkg. Each patch in the OvmfPkg series should fix typos in a given
module (library or driver or application) in OvmfPkg.

Duplicate all of the above for ArmVirtPkg (one BZ, one series, one patch
per module).

Thanks!
Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70824): https://edk2.groups.io/g/devel/message/70824
Mute This Topic: https://groups.io/mt/80146484/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-