[edk2] [Patch] QuarkSocPkg: Remove intrinsic memset function usages in MemoryInit

2016-04-10 Thread Liming Gao
Use BaseMemoryLib ZeroMem replace memset function.

Cc: Michael Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
---
 QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit.c 
b/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit.c
index 50692fe..321163a 100644
--- a/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit.c
+++ b/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit.c
@@ -1,6 +1,6 @@
 /
  *
- * Copyright (c) 2013-2015 Intel Corporation.
+ * Copyright (c) 2013-2016 Intel Corporation.
  *
 * This program and the accompanying materials
 * are licensed and made available under the terms and conditions of the BSD 
License
@@ -40,6 +40,7 @@
 #include "meminit_utils.h"
 #include "hte.h"
 #include "io.h"
+#include "MemoryInit.h"
 
 // Override ODT to off state if requested
 #define DRMC_DEFAULT(mrc_params->rd_odt_value==0?BIT12:0)
@@ -1108,7 +1109,7 @@ static void rcvn_cal(
 
 #ifdef R2R_SHARING
   // need to set "final_delay[][]" elements to "0"
-  memset((void *) (final_delay), 0x00, (size_t) sizeof(final_delay));
+  ZeroMem((void *) (final_delay), (size_t) sizeof(final_delay));
 #endif // R2R_SHARING
 
   // loop through each enabled channel
@@ -1393,7 +1394,7 @@ static void wr_level(
 
 #ifdef R2R_SHARING
   // need to set "final_delay[][]" elements to "0"
-  memset((void *) (final_delay), 0x00, (size_t) sizeof(final_delay));
+  ZeroMem((void *) (final_delay), (size_t) sizeof(final_delay));
 #endif // R2R_SHARING
   // loop through each enabled channel
   for (channel_i = 0; channel_i < NUM_CHANNELS; channel_i++)
@@ -1647,7 +1648,7 @@ static void rd_train(
 
 #ifdef R2R_SHARING
   // need to set "final_delay[][]" elements to "0"
-  memset((void *) (final_delay), 0x00, (size_t) sizeof(final_delay));
+  ZeroMem((void *) (final_delay), (size_t) sizeof(final_delay));
 #endif // R2R_SHARING
 
   // look for passing coordinates
@@ -1969,7 +1970,7 @@ static void wr_train(
 
 #ifdef R2R_SHARING
   // need to set "final_delay[][]" elements to "0"
-  memset((void *) (final_delay), 0x00, (size_t) sizeof(final_delay));
+  ZeroMem((void *) (final_delay), (size_t) sizeof(final_delay));
 #endif // R2R_SHARING
 
   // start algorithm on the LEFT side and train each channel/bl until no 
failures are observed, then repeat for the RIGHT side.
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch v2] MdeModulePkg/Ps2Keyboard: Add missing PCD and protocol to DEC file

2016-04-10 Thread Tian, Feng
Reviewed-by: Feng Tian 

Thanks
Feng


-Original Message-
From: Ni, Ruiyu 
Sent: Monday, April 11, 2016 11:02 AM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu ; Tian, Feng 
Subject: [Patch v2] MdeModulePkg/Ps2Keyboard: Add missing PCD and protocol to 
DEC file

gEfiPs2PolicyProtocolGuid and PcdFastPS2Detection was missed when resolving the 
conflict.
Check in the two definition to MdeModulePkg.dec to fix build failure.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Feng Tian 
---
 MdeModulePkg/MdeModulePkg.dec | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec 
index 49bd105..935554c 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -493,6 +493,10 @@
   gIpmiProtocolGuid= { 0xdbc6381f, 0x5554, 0x4d14, { 0x8f, 0xfd, 0x76, 
0xd7, 0x87, 0xb8, 0xac, 0xbf } }
   gSmmIpmiProtocolGuid = { 0x5169af60, 0x8c5a, 0x4243, { 0xb3, 0xe9, 0x56, 
0xc5, 0x6d, 0x18, 0xee, 0x26 } }
 
+  ## PS/2 policy protocol abstracts the specific platform initialization and 
setting.
+  #  Include/Protocol/Ps2Policy.h
+  gEfiPs2PolicyProtocolGuid = { 0x4DF19259, 0xDC71, 0x4D46, { 0xBE, 
+ 0xF1, 0x35, 0x7B, 0xB5, 0x78, 0xC4, 0x18 } }
+
 #
 # [Error.gEfiMdeModulePkgTokenSpaceGuid]
 #   0x8001 | Invalid value provided.
@@ -1531,6 +1535,13 @@
   # @Prompt Reserved S3 Boot Script Stack ACPI Memory Size
   
gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptStackSize|0x8000|UINT32|0x0200
 
+  ## Indicates if to use the optimized timing for best PS2 detection 
performance.
+  #  Note this PCD could be set to TRUE for best boot performance and set to 
FALSE for best device compatibility.
+  #   TRUE  - Use the optimized timing for best PS2 detection performance.
+  #   FALSE - Use the normal timing to detect PS2.
+  # @Prompt Enable fast PS2 detection
+  
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFastPS2Detection|FALSE|BOOLEAN|0x300
+ 01044
+
 [PcdsPatchableInModule]
   ## Specify memory size with page number for PEI code when
   #  Loading Module at Fixed Address feature is enabled.
--
2.7.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch v2] MdeModulePkg/Ps2Keyboard: Add missing PCD and protocol to DEC file

2016-04-10 Thread Ruiyu Ni
gEfiPs2PolicyProtocolGuid and PcdFastPS2Detection was missed when
resolving the conflict.
Check in the two definition to MdeModulePkg.dec to fix build failure.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Feng Tian 
---
 MdeModulePkg/MdeModulePkg.dec | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 49bd105..935554c 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -493,6 +493,10 @@
   gIpmiProtocolGuid= { 0xdbc6381f, 0x5554, 0x4d14, { 0x8f, 0xfd, 0x76, 
0xd7, 0x87, 0xb8, 0xac, 0xbf } }
   gSmmIpmiProtocolGuid = { 0x5169af60, 0x8c5a, 0x4243, { 0xb3, 0xe9, 0x56, 
0xc5, 0x6d, 0x18, 0xee, 0x26 } }
 
+  ## PS/2 policy protocol abstracts the specific platform initialization and 
setting.
+  #  Include/Protocol/Ps2Policy.h
+  gEfiPs2PolicyProtocolGuid = { 0x4DF19259, 0xDC71, 0x4D46, { 0xBE, 0xF1, 
0x35, 0x7B, 0xB5, 0x78, 0xC4, 0x18 } }
+
 #
 # [Error.gEfiMdeModulePkgTokenSpaceGuid]
 #   0x8001 | Invalid value provided.
@@ -1531,6 +1535,13 @@
   # @Prompt Reserved S3 Boot Script Stack ACPI Memory Size
   
gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptStackSize|0x8000|UINT32|0x0200
 
+  ## Indicates if to use the optimized timing for best PS2 detection 
performance.
+  #  Note this PCD could be set to TRUE for best boot performance and set to 
FALSE for best device compatibility.
+  #   TRUE  - Use the optimized timing for best PS2 detection performance.
+  #   FALSE - Use the normal timing to detect PS2.
+  # @Prompt Enable fast PS2 detection
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFastPS2Detection|FALSE|BOOLEAN|0x30001044
+
 [PcdsPatchableInModule]
   ## Specify memory size with page number for PEI code when
   #  Loading Module at Fixed Address feature is enabled.
-- 
2.7.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg/Ps2Keyboard: Add missing PCD and protocol to DEC file

2016-04-10 Thread Ruiyu Ni
gEfiPs2PolicyProtocolGuid and PcdFastPS2Detection was missed when
resolving the conflict.
Check in the two definition to MdeModulePkg.dec to fix build failure.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Feng Tian 
---
 MdeModulePkg/MdeModulePkg.dec | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 49bd105..cbedb51 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -493,6 +493,10 @@
   gIpmiProtocolGuid= { 0xdbc6381f, 0x5554, 0x4d14, { 0x8f, 0xfd, 0x76, 
0xd7, 0x87, 0xb8, 0xac, 0xbf } }
   gSmmIpmiProtocolGuid = { 0x5169af60, 0x8c5a, 0x4243, { 0xb3, 0xe9, 0x56, 
0xc5, 0x6d, 0x18, 0xee, 0x26 } }
 
+  ## PS/2 policy protocol abstracts the specific platform initialization and 
setting.
+  #  Include/Protocol/Ps2Policy.h
+  gEfiPs2PolicyProtocolGuid = { 0x4DF19259, 0xDC71, 0x4D46, { 0xBE, 0xF1, 
0x35, 0x7B, 0xB5, 0x78, 0xC4, 0x18 } }
+
 #
 # [Error.gEfiMdeModulePkgTokenSpaceGuid]
 #   0x8001 | Invalid value provided.
@@ -738,6 +742,13 @@
   # @Prompt Turn on PS2 Mouse Extended Verification
   
gEfiMdeModulePkgTokenSpaceGuid.PcdPs2MouseExtendedVerification|TRUE|BOOLEAN|0x00010075
 
+  ## Indicates if to use the optimized timing for best PS2 detection 
performance.
+  #  Note this PCD could be set to TRUE for best boot performance and set to 
FALSE for best device compatibility.
+  #   TRUE  - Use the optimized timing for best PS2 detection performance.
+  #   FALSE - Use the normal timing to detect PS2.
+  # @Prompt Enable fast PS2 detection
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFastPS2Detection|FALSE|BOOLEAN|0x00010076
+
 [PcdsFeatureFlag.IA32, PcdsFeatureFlag.X64]
   ## Indicates if DxeIpl should switch to long mode to enter DXE phase.
   #  It is assumed that 64-bit DxeCore is built in firmware if it is true; 
otherwise 32-bit DxeCore
-- 
2.7.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] Update edksetup.bat to check EDK_TOOLS_PATH before set it.

2016-04-10 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: Gao, Liming 
Sent: Friday, April 08, 2016 3:57 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong 
Subject: [Patch] Update edksetup.bat to check EDK_TOOLS_PATH before set it.

If EDK_TOOLS_PATH is set, then not set it again.
If EDK_TOOLS_PATH is not set, then set it.

Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
---
 edksetup.bat | 30 --
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/edksetup.bat b/edksetup.bat index b69bd26..e065b64 100755
--- a/edksetup.bat
+++ b/edksetup.bat
@@ -1,7 +1,7 @@
 @REM @file
 @REM   Windows batch file to setup a WORKSPACE environment
 @REM
-@REM Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+@REM Copyright (c) 2006 - 2016, Intel Corporation. All rights 
+reserved.
 @REM This program and the accompanying materials  @REM are licensed and made 
available under the terms and conditions of the BSD License  @REM which 
accompanies this distribution.  The full text of the license may be found at @@ 
-100,21 +100,23 @@ shift
 :no_nt32
 
 if /I "%1"=="NewBuild" shift
-if exist %WORKSPACE%\BaseTools (
-  set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
-) else (
-  if defined PACKAGES_PATH (
-for %%i IN (%PACKAGES_PATH%) DO (
-  if exist %%~fi\BaseTools (
-set EDK_TOOLS_PATH=%%~fi\BaseTools
-goto checkBaseTools
+if not defined EDK_TOOLS_PATH (
+  if exist %WORKSPACE%\BaseTools (
+set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
+  ) else (
+if defined PACKAGES_PATH (
+  for %%i IN (%PACKAGES_PATH%) DO (
+if exist %%~fi\BaseTools (
+  set EDK_TOOLS_PATH=%%~fi\BaseTools
+  goto checkBaseTools
+)
   )
+) else (
+  echo.
+  echo !!! ERROR !!! Cannot find BaseTools !!!
+  echo. 
+  goto BadBaseTools
 )
-  ) else (
-echo.
-echo !!! ERROR !!! Cannot find BaseTools !!!
-echo. 
-goto BadBaseTools
   )
 )
 if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%
--
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] ShellPkg : Cache the environment variable into memory to enhance the performance.

2016-04-10 Thread Qiu Shumin
Currently UEFI Shell reads variable storage to get the environment
variables every time running a new command. And reading(writing)
UEFI variables is a high cost operation on most platforms. In order
to enhance the performance this patch read the variable storage once
and cache the environment variables in memory. Every further 'set'
command will save the variable not only to Shell cache, but also the
flash variable storage.

Cc: Jaben Carsey 
Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin 
---
 ShellPkg/Application/Shell/Shell.c |   4 +
 ShellPkg/Application/Shell/ShellEnvVar.c   | 175 -
 ShellPkg/Application/Shell/ShellEnvVar.h   |  82 +-
 ShellPkg/Application/Shell/ShellProtocol.c | 101 ++---
 4 files changed, 317 insertions(+), 45 deletions(-)

diff --git a/ShellPkg/Application/Shell/Shell.c 
b/ShellPkg/Application/Shell/Shell.c
index bd695a4..12daff9 100644
--- a/ShellPkg/Application/Shell/Shell.c
+++ b/ShellPkg/Application/Shell/Shell.c
@@ -445,6 +445,8 @@ UefiMain (
 Status = CommandInit();
 ASSERT_EFI_ERROR(Status);
 
+Status = ShellInitEnvVarList ();
+
 //
 // Check the command line
 //
@@ -702,6 +704,8 @@ FreeResources:
 DEBUG_CODE(ShellInfoObject.ConsoleInfo = NULL;);
   }
 
+  ShellFreeEnvVarList ();
+
   if (ShellCommandGetExit()) {
 return ((EFI_STATUS)ShellCommandGetExitCode());
   }
diff --git a/ShellPkg/Application/Shell/ShellEnvVar.c 
b/ShellPkg/Application/Shell/ShellEnvVar.c
index a8f177e..d2c721d 100644
--- a/ShellPkg/Application/Shell/ShellEnvVar.c
+++ b/ShellPkg/Application/Shell/ShellEnvVar.c
@@ -1,7 +1,7 @@
 /** @file
   function declarations for shell environment functions.
 
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -17,6 +17,11 @@
 #define INIT_NAME_BUFFER_SIZE  128
 #define INIT_DATA_BUFFER_SIZE  1024
 
+//
+// The list is used to cache the environment variables.
+//
+ENV_VAR_LIST   gShellEnvVarList;
+
 /**
   Reports whether an environment variable is Volatile or Non-Volatile.
 
@@ -379,3 +384,171 @@ SetEnvironmentVariables(
   //
   return (SetEnvironmentVariableList(>Link));
 }
+
+/**
+  Find an environment variable in the gShellEnvVarList.
+
+  @param KeyThe name of the environment variable.
+  @param Value  The value of the environment variable, the buffer
+shoule be freed by the caller.
+  @param ValueSize  The size in bytes of the environment variable
+including the tailing CHAR_NELL.
+  @param Atts   The attributes of the variable.
+
+  @retval EFI_SUCCESS   The command executed successfully.
+  @retval EFI_NOT_FOUND The environment variable is not found in
+gShellEnvVarList.
+
+**/
+EFI_STATUS
+ShellFindEnvVarInList (
+  IN  CONST CHAR16*Key,
+  OUT CHAR16  **Value,
+  OUT UINTN   *ValueSize,
+  OUT UINT32  *Atts OPTIONAL
+  )
+{
+  ENV_VAR_LIST  *Node;
+  
+  if (Key == NULL || Value == NULL || ValueSize == NULL) {
+return SHELL_INVALID_PARAMETER;
+  }
+
+  for ( Node = (ENV_VAR_LIST*)GetFirstNode()
+  ; !IsNull(, >Link)
+  ; Node = (ENV_VAR_LIST*)GetNextNode(, >Link)
+ ){
+if (Node->Key != NULL && StrCmp(Key, Node->Key) == 0) {
+  *Value  = AllocateCopyPool(StrSize(Node->Val), Node->Val);
+  *ValueSize  = StrSize(Node->Val);
+  if (Atts != NULL) {
+*Atts = Node->Atts;
+  }
+  return EFI_SUCCESS;
+}
+  }
+
+  return EFI_NOT_FOUND;
+}
+
+/**
+  Add an environment variable into gShellEnvVarList.
+
+  @param KeyThe name of the environment variable.
+  @param Value  The value of environment variable.
+  @param ValueSize  The size in bytes of the environment variable
+including the tailing CHAR_NULL
+  @param Atts   The attributes of the variable.
+
+**/
+VOID
+ShellAddEnvVarToList (
+  IN CONST CHAR16 *Key,
+  IN CONST CHAR16 *Value,
+  IN UINTNValueSize,
+  IN UINT32   Atts
+  )
+{
+  ENV_VAR_LIST  *Node;
+  
+  if (Key == NULL || Value == NULL || ValueSize == 0) {
+return;
+  }
+
+  for ( Node = (ENV_VAR_LIST*)GetFirstNode()
+  ; !IsNull(, >Link)
+  ; Node = (ENV_VAR_LIST*)GetNextNode(, >Link)
+ ){
+if (Node->Key != NULL && StrCmp(Key, Node->Key) == 0) {
+  Node->Atts = Atts;
+  SHELL_FREE_NON_NULL(Node->Val);
+  Node->Val  = AllocateZeroPool (ValueSize);
+  ASSERT (Node->Val != NULL);
+  CopyMem(Node->Val, Value, ValueSize);
+  return;
+}
+  }

[edk2] about C++ support

2016-04-10 Thread Michael Zimmermann
Hi

I'm not really a fan of using c++ in bootloaders but since I had to add C++
support to edk2 some time ago to port a c++ library which I need I thought
it might be a good idea to discuss this topic.

Is there any need for this by others?
Could the patches be merged or do you prefer keeping the code clean?

Michael
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] StdLib: add __noreturn attribute to __assert

2016-04-10 Thread Michael Zimmermann
I guess it's time to send a reminder for this patch :)

MIchael

On Tue, Feb 9, 2016 at 3:27 AM, Daryl McDaniel 
wrote:

> Michael,
>
> Thanks for the report and clear references.
> I'll add this to the list of StdLib work.
>
> Also, thanks for the reminder about '__declspec(noreturn)'.
>
> Daryl McDaniel
>
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Michael
> > Zimmermann
> > Sent: Monday, February 08, 2016 8:42 AM
> > To: Andrew Fish 
> > Cc: edk2-devel@lists.01.org 
> > Subject: Re: [edk2] [PATCH] StdLib: add __noreturn attribute to __assert
> >
> > it is StdLib specific and other functions like abort are using it
> already.
> > from StdLib/Include/sys/EfiCdefs.h:
> > #if __GNUC_PREREQ__(2, 7)
> > #define __unused  __attribute__((__unused__))
> > #define __noreturn  __attribute__((__noreturn__))
> > #else
> > #define __unused  /* delete */
> > #define __noreturn  /* delete */
> > #endif
> >
> > do other compilers(VC?) really don't need this or should we treat it as
> not
> > being implemented?
> > This page shows that there's sth. called '__declspec(noreturn)':
> > https://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx
> > but obviously there are even more compilers than just gcc and vc.
> >
> > On Mon, Feb 8, 2016 at 5:32 PM, Andrew Fish  wrote:
> >
> > >
> > > > On Feb 8, 2016, at 4:15 AM, Michael Zimmermann <
> sigmaepsilo...@gmail.com>
> > > wrote:
> > > >
> > > > this prevents warnings like 'control reaches end of non-void
> function'.
> > > >
> > > > Contributed-under: TianoCore Contribution Agreement 1.0
> > > > Signed-off-by: M1cha 
> > > > ---
> > > > StdLib/Include/assert.h | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/StdLib/Include/assert.h b/StdLib/Include/assert.h
> > > > index ece4f27..8369f25 100644
> > > > --- a/StdLib/Include/assert.h
> > > > +++ b/StdLib/Include/assert.h
> > > > @@ -52,7 +52,7 @@ __BEGIN_DECLS
> > > >   the application was launched from.
> > > > **/
> > > > extern void
> > > > -__assert(const char *file, const char *func, int line, const char
> > > > *failedexpr);
> > > > +__assert(const char *file, const char *func, int line, const char
> > > > *failedexpr) __noreturn;
> > > >
> > >
> > > Is __noreturn in the C standard or is it compiler specific?
> > >
> > > Thanks,
> > >
> > > Andrew Fish
> > >
> > > > __END_DECLS
> > > >
> > > > --
> > > > 2.7.0
> > > > ___
> > > > edk2-devel mailing list
> > > > edk2-devel@lists.01.org
> > > > https://lists.01.org/mailman/listinfo/edk2-devel
> > >
> > >
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
>
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] StdLib/LibC: Add floorf

2016-04-10 Thread Michael Zimmermann
I forgot to CC the  maintainers, so I'm pinging with them CC'ed now.

Michael

On Wed, Dec 30, 2015 at 2:55 PM, Michael Zimmermann <
sigmaepsilo...@gmail.com> wrote:

> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Michael Zimmermann 
> ---
>  StdLib/Include/math.h   |  8 ++
>  StdLib/LibC/Math/Math.inf   |  1 +
>  StdLib/LibC/Math/s_floorf.c | 64
> +
>  3 files changed, 73 insertions(+)
>  create mode 100644 StdLib/LibC/Math/s_floorf.c
>
> diff --git a/StdLib/Include/math.h b/StdLib/Include/math.h
> index 3041120..2b5746b 100644
> --- a/StdLib/Include/math.h
> +++ b/StdLib/Include/math.h
> @@ -304,6 +304,14 @@ double  fabs(double Arg);
>  **/
>  double  floor(double);
>
> +/** Compute the largest integer value not greater than Arg.
> +
> +@param[in]Arg   The value to compute the floor of.
> +
> +@return   The largest integer value not greater than Arg, expressed
> as a floating-point number.
> +**/
> +float  floorf(float);
> +
>  /** Compute the floating-point remainder of A1 / A2.
>
>  @param[in]A1The dividend.
> diff --git a/StdLib/LibC/Math/Math.inf b/StdLib/LibC/Math/Math.inf
> index ec5c71a..9d6c66d 100644
> --- a/StdLib/LibC/Math/Math.inf
> +++ b/StdLib/LibC/Math/Math.inf
> @@ -64,6 +64,7 @@
>s_fabs.c
>s_ceil.c
>s_floor.c
> +  s_floorf.c
>s_trunc.c
>
># wrapper functions
> diff --git a/StdLib/LibC/Math/s_floorf.c b/StdLib/LibC/Math/s_floorf.c
> new file mode 100644
> index 000..d6e201f
> --- /dev/null
> +++ b/StdLib/LibC/Math/s_floorf.c
> @@ -0,0 +1,64 @@
> +/* s_floorf.c -- float version of s_floor.c.
> + * Conversion to float by Ian Lance Taylor, Cygnus Support,
> i...@cygnus.com.
> + */
> +
> +/*
> + * 
> + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
> + *
> + * Developed at SunPro, a Sun Microsystems, Inc. business.
> + * Permission to use, copy, modify, and distribute this
> + * software is freely granted, provided that this notice
> + * is preserved.
> + * 
> + */
> +
> +#include  
> +#include  
> +#if defined(LIBM_SCCS) && !defined(lint)
> +__RCSID("$NetBSD: s_floor.c,v 1.11 2002/05/26 22:01:56 wiz Exp $");
> +#endif
> +
> +/*
> + * floorf(x)
> + * Return x rounded toward -inf to integral value
> + * Method:
> + *  Bit twiddling.
> + * Exception:
> + *  Inexact flag raised if x not equal to floorf(x).
> + */
> +
> +#include "math.h"
> +#include "math_private.h"
> +
> +static const float huge = 1.0e30;
> +
> +float
> +floorf(float x)
> +{
> +  int32_t i0,j0;
> +  u_int32_t i;
> +  GET_FLOAT_WORD(i0,x);
> +  j0 = ((i0>>23)&0xff)-0x7f;
> +  if(j0<23) {
> +  if(j0<0) {   /* raise inexact if x != 0 */
> +if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */
> +if(i0>=0) {i0=0;}
> +else if((i0&0x7fff)!=0)
> +  { i0=0xbf80;}
> +}
> +  } else {
> +i = (0x007f)>>j0;
> +if((i0)==0) return x; /* x is integral */
> +if(huge+x>(float)0.0) {  /* raise inexact flag */
> +if(i0<0) i0 += (0x0080)>>j0;
> +i0 &= (~i);
> +}
> +  }
> +  } else {
> +  if(j0==0x80) return x+x;  /* inf or NaN */
> +  else return x;/* x is integral */
> +  }
> +  SET_FLOAT_WORD(x,i0);
> +  return x;
> +}
> --
> 2.6.4
>
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] StdLib/LibC: Add trunc

2016-04-10 Thread Michael Zimmermann
I forgot to CC the  maintainers, so I'm pinging with them CC'ed now.

Michael

On Wed, Dec 30, 2015 at 2:41 PM, Michael Zimmermann <
sigmaepsilo...@gmail.com> wrote:

> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Michael Zimmermann 
> ---
>  StdLib/LibC/Math/Math.inf  |  1 +
>  StdLib/LibC/Math/s_trunc.c | 65
> ++
>  2 files changed, 66 insertions(+)
>  create mode 100644 StdLib/LibC/Math/s_trunc.c
>
> diff --git a/StdLib/LibC/Math/Math.inf b/StdLib/LibC/Math/Math.inf
> index 6a48d97..ec5c71a 100644
> --- a/StdLib/LibC/Math/Math.inf
> +++ b/StdLib/LibC/Math/Math.inf
> @@ -64,6 +64,7 @@
>s_fabs.c
>s_ceil.c
>s_floor.c
> +  s_trunc.c
>
># wrapper functions
>w_acos.c
> diff --git a/StdLib/LibC/Math/s_trunc.c b/StdLib/LibC/Math/s_trunc.c
> new file mode 100644
> index 000..a976c5f
> --- /dev/null
> +++ b/StdLib/LibC/Math/s_trunc.c
> @@ -0,0 +1,65 @@
> +/* @(#)s_floor.c 5.1 93/09/24 */
> +/*
> + * 
> + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
> + *
> + * Developed at SunPro, a Sun Microsystems, Inc. business.
> + * Permission to use, copy, modify, and distribute this
> + * software is freely granted, provided that this notice
> + * is preserved.
> + * 
> + */
> +
> +#include  
> +#include  
> +#if defined(LIBM_SCCS) && !defined(lint)
> +__RCSID("$NetBSD: s_floor.c,v 1.11 2002/05/26 22:01:56 wiz Exp $");
> +#endif
> +
> +/*
> + * trunc(x)
> + * Return x rounded toward 0 to integral value
> + * Method:
> + *  Bit twiddling.
> + * Exception:
> + *  Inexact flag raised if x not equal to trunc(x).
> + */
> +
> +
> +#include "math.h"
> +#include "math_private.h"
> +
> +static const double huge = 1.0e300;
> +
> +double
> +trunc(double x)
> +{
> +  int32_t i0,i1,j0;
> +  u_int32_t i;
> +  EXTRACT_WORDS(i0,i1,x);
> +  j0 = ((i0>>20)&0x7ff)-0x3ff;
> +  if(j0<20) {
> +  if(j0<0) {   /* raise inexact if x != 0 */
> +if(huge+x>0.0) {/* |x|<1, so return 0*sign(x) */
> +i0 &= 0x8000U;
> +i1 = 0;
> +}
> +  } else {
> +i = (0x000f)>>j0;
> +if(((i0)|i1)==0) return x; /* x is integral */
> +if(huge+x>0.0) {  /* raise inexact flag */
> +i0 &= (~i); i1=0;
> +}
> +  }
> +  } else if (j0>51) {
> +  if(j0==0x400) return x+x;  /* inf or NaN */
> +  else return x;/* x is integral */
> +  } else {
> +  i = ((u_int32_t)(0x))>>(j0-20);
> +  if((i1)==0) return x;  /* x is integral */
> +  if(huge+x>0.0)/* raise inexact flag */
> +i1 &= (~i);
> +  }
> +  INSERT_WORDS(x,i0,i1);
> +  return x;
> +}
> --
> 2.6.4
>
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] StdLib/LibC: Add __aeabi_ui2f and __aeabi_f2uiz

2016-04-10 Thread Michael Zimmermann
I forgot to CC the  maintainers, so I'm pinging with them CC'ed now.

Michael

On Wed, Dec 30, 2015 at 2:07 PM, Michael Zimmermann <
sigmaepsilo...@gmail.com> wrote:

> these are needed for converting between unsigned int and single-precision
> float
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Michael Zimmermann 
> ---
>  StdLib/LibC/LibC.inf   |  2 +
>  StdLib/LibC/Main/Arm/fixunssfsi.c  | 75
> 
>  StdLib/LibC/Main/Arm/floatunsisf.c | 79
> ++
>  3 files changed, 156 insertions(+)
>  create mode 100644 StdLib/LibC/Main/Arm/fixunssfsi.c
>  create mode 100644 StdLib/LibC/Main/Arm/floatunsisf.c
>
> diff --git a/StdLib/LibC/LibC.inf b/StdLib/LibC/LibC.inf
> index f136306..7b53f1f 100644
> --- a/StdLib/LibC/LibC.inf
> +++ b/StdLib/LibC/LibC.inf
> @@ -86,7 +86,9 @@
>
>  [Sources.ARM]
>Main/Arm/fixunsdfsi.c
> +  Main/Arm/fixunssfsi.c
>Main/Arm/floatunsidf.c
> +  Main/Arm/floatunsisf.c
>Main/Arm/flt_rounds.c
>
>  [Sources.AARCH64]
> diff --git a/StdLib/LibC/Main/Arm/fixunssfsi.c
> b/StdLib/LibC/Main/Arm/fixunssfsi.c
> new file mode 100644
> index 000..251d720
> --- /dev/null
> +++ b/StdLib/LibC/Main/Arm/fixunssfsi.c
> @@ -0,0 +1,75 @@
> +/**
> +University of Illinois/NCSA
> +Open Source License
> +
> +Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
> +
> +All rights reserved.
> +
> +Developed by:
> +
> +LLVM Team
> +
> +University of Illinois at Urbana-Champaign
> +
> +http://llvm.org
> +
> +Permission is hereby granted, free of charge, to any person obtaining a
> copy of
> +this software and associated documentation files (the "Software"), to
> deal with
> +the Software without restriction, including without limitation the rights
> to
> +use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies
> +of the Software, and to permit persons to whom the Software is furnished
> to do
> +so, subject to the following conditions:
> +
> +* Redistributions of source code must retain the above copyright
> notice,
> +  this list of conditions and the following disclaimers.
> +
> +* Redistributions in binary form must reproduce the above copyright
> notice,
> +  this list of conditions and the following disclaimers in the
> +  documentation and/or other materials provided with the distribution.
> +
> +* Neither the names of the LLVM Team, University of Illinois at
> +  Urbana-Champaign, nor the names of its contributors may be used to
> +  endorse or promote products derived from this Software without
> specific
> +  prior written permission.
> +
> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS
> +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
> +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> OTHER
> +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> FROM,
> +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> WITH THE
> +SOFTWARE.
> +**/
> +
> +#include "int_lib.h"
> +
> +/* Returns: convert a to a unsigned int, rounding toward zero.
> + *  Negative values all become zero.
> + */
> +
> +/* Assumption: float is a IEEE 32 bit floating point type
> + * su_int is a 32 bit integral type
> + * value in float is representable in su_int or is negative
> + * (no range checking performed)
> + */
> +
> +/* seee  emmm      */
> +
> +ARM_EABI_FNALIAS(f2uiz, fixunssfsi)
> +
> +COMPILER_RT_ABI su_int
> +__fixunssfsi(float a)
> +{
> +float_bits fb;
> +fb.f = a;
> +int e = ((fb.u & 0x7F80) >> 23) - 127;
> +if (e < 0 || (fb.u & 0x8000))
> +return 0;
> +su_int r = (fb.u & 0x007F) | 0x0080;
> +if (e > 23)
> +r <<= (e - 23);
> +else
> +r >>= (23 - e);
> +return r;
> +}
> diff --git a/StdLib/LibC/Main/Arm/floatunsisf.c
> b/StdLib/LibC/Main/Arm/floatunsisf.c
> new file mode 100644
> index 000..1c9ee4e
> --- /dev/null
> +++ b/StdLib/LibC/Main/Arm/floatunsisf.c
> @@ -0,0 +1,79 @@
> +/**
> +University of Illinois/NCSA
> +Open Source License
> +
> +Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
> +
> +All rights reserved.
> +
> +Developed by:
> +
> +LLVM Team
> +
> +University of Illinois at Urbana-Champaign
> +
> +http://llvm.org
> +
> +Permission is hereby granted, free of charge, to any person obtaining a
> copy of
> +this software and associated documentation files (the "Software"), to
> deal with
> +the Software without restriction, including without limitation the rights
> to
> +use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies
> +of the Software, and to permit persons to whom the Software is 

Re: [edk2] TCPIP Client for UEFI

2016-04-10 Thread Mahan, Patrick
Jim,

Okay, that’s better.

So now I would suggest looking at the BIOS/UEFI setup screens for any hints 
about enabling the network or
enabling network booting.

For example, I have a DELL 5810 Precision Tower that I am currently using for 
UEFI testing.  To enable the
network stack and PXE booting, I have to go to the config screen that shows the 
onboard NIC config and
enable the Network stack and PXE booting.  Not sure what the Insyde screens 
show, but a quick google-foo
seems to show that PXE is enabled on the ‘Boot’ config.  I would look for any 
manual you might have for 
configuring the BIOS/UEFI.

Now here is the problem.  You can load the UNDI driver by copying it to your 
EFI directory on boot device.
For most Linux systems, this is /boot/efi/EFI/ (e.g. 
/boot/efi/EFI/ubuntu or /boot/efi/EFI/centos).

Then start the EFI shell, and in that shell use the ‘load’ command to load the 
UNDI driver, probably from
fs0:\EFI\\.efi, then exit the shell and back in the boot menu 
you should be able to add
the new NIC.  The assumption here is that when you exit the EFI shell you fall 
back into the boot menu,
which is not the case on the DELL I am using.

If this doesn’t work, then I suggest first contacting the AMD SOC support or 
the Insyde folks.

Good luck,

Patrick

> On Apr 9, 2016, at 8:00 PM, Jim Slaughter  wrote:
> 
> I downloaded there binary as they do not have the source listed,
> UEFI UNDI Driver 
> from   
> http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1=13=5=5=4=3=false
> We are using there chip on out board.
> If I do an "ifconfig" command (no arguments) I get the following:ifconfig: 
> "Locate protocol error - ip4Cofi Protocol"
> Something is missing I think? No ifconfig's work.
> Jim Slaughter
> 
> 
>On Saturday, April 9, 2016 9:29 AM, "Mahan, Patrick" 
>  wrote:
> 
> 
> Jim,
> 
> What exactly did you download?  If I google ‘realtek refi’ I get the realtek 
> refi undo driver as a UEFI binary (*.efi) but 
> no source code.
> 
> So I am not sure what you have exactly.  If it is source code then it should 
> be a UEFI package which should contain
> all the files to build the NIC.
> 
> If you haven’t already, you can take a look at how to get started developing 
> in UEFI at the following URL -
> 
> https://github.com/tianocore/tianocore.github.io/wiki/Getting%20Started%20with%20EDK%20II
> 
> (UEFI is based on EDK II)
> 
> I personally have never gotten ‘ipconfig’ to work, I instead use ‘ifconfig’.  
> Do a ‘ifconfig -?’ for help.
> 
> Patrick
> 
>> On Apr 8, 2016, at 3:57 PM, Jim Slaughter  wrote:
>> 
>> Hello,
>> The platform is an AMD based SOC. The uEFI is from Insyde. Yes I do have a 
>> uEFI shell.
>> When I downloaded the C driver there were no instructions. I have not yet 
>> configured the card. I have not seen any instructions on how to configure. 
>> ipconfig does not work.
>> Jim S.
>> 
>> 
>> On Friday, April 8, 2016 3:40 PM, "Mahan, Patrick" 
>>  wrote:
>> 
>> 
>> 
>> Jim,
>> 
>> This depends on a number of factors:
>> 
>> 1. What platform?  Who wrote the UEFI code for it?  Do you have access to a 
>> EFI or UEFI shell?
>> 
>> 2. I'm not sure about the Realtek NIC, but did they have any instructions 
>> for using the driver?  UEFI supports
>> having device specific directories that a Vendor may populate with their 
>> driver.  That might be the case for
>> Realtek.
>> 
>> 3. Go into your UEFI config (again this depends upon whose UEFI is running) 
>> and make sure you have enabled
>> the network stack.
>> 
>> Always be specific in details, it makes it easier to provide you help,
>> 
>> Thanks,
>> 
>> Patrick
>> 
>> 
>> From: edk2-devel  on behalf of Jim 
>> Slaughter 
>> Sent: Friday, April 8, 2016 3:27 PM
>> To: Edk2-devel
>> Subject: [edk2] TCPIP Client for UEFI
>> 
>> Hello,I downloaded and installed a NIC driver from Realtek for uEFI.I need a 
>> TCPIP client so I can do a dhcp.Where do I find this client?Do I need any 
>> other softwareJim Slaughter
>> 
>> ___
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
>> 
>> 
>> ___
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
> 
> 
> 
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel