[edk2] [PATCH] OvmfPkg: Increase default RELEASE build image size to 2MB

2016-01-27 Thread Jordan Justen
Fixes: https://github.com/tianocore/edk2/issues/47
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Bruce Cran 
Cc: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.fdf.inc|  6 ++
 OvmfPkg/OvmfPkgIa32.fdf| 12 
 OvmfPkg/OvmfPkgIa32X64.fdf | 12 
 OvmfPkg/OvmfPkgX64.fdf | 12 
 4 files changed, 6 insertions(+), 36 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.fdf.inc b/OvmfPkg/OvmfPkg.fdf.inc
index 441c35a..fd57904 100644
--- a/OvmfPkg/OvmfPkg.fdf.inc
+++ b/OvmfPkg/OvmfPkg.fdf.inc
@@ -15,6 +15,12 @@
 #
 ##
 
+#
+# Default flash size for is 2MB.
+#
+# Defining FD_SIZE_1MB on the build command line can override this.
+#
+
 DEFINE BLOCK_SIZE= 0x1000
 DEFINE VARS_SIZE = 0x2
 DEFINE VARS_BLOCKS   = 0x20
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 1c1936c..e3cbf74 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -15,19 +15,7 @@
 
 

 
-#
-# Default flash size for DEBUG build is 2MB. For RELEASE it is 1MB.
-#
-# Defining FD_SIZE_1MB or FD_SIZE_2MB on the build command line can
-# override this.
-#
 [Defines]
-!if $(TARGET) == RELEASE
-!ifndef $(FD_SIZE_2MB)
-DEFINE FD_SIZE_1MB=
-!endif
-!endif
-
 !include OvmfPkg.fdf.inc
 
 #
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index ffed58a..b60d93b 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -15,19 +15,7 @@
 
 

 
-#
-# Default flash size for DEBUG build is 2MB. For RELEASE it is 1MB.
-#
-# Defining FD_SIZE_1MB or FD_SIZE_2MB on the build command line can
-# override this.
-#
 [Defines]
-!if $(TARGET) == RELEASE
-!ifndef $(FD_SIZE_2MB)
-DEFINE FD_SIZE_1MB=
-!endif
-!endif
-
 !include OvmfPkg.fdf.inc
 
 #
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index ae9f348..d8b119a 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -15,19 +15,7 @@
 
 

 
-#
-# Default flash size for DEBUG build is 2MB. For RELEASE it is 1MB.
-#
-# Defining FD_SIZE_1MB or FD_SIZE_2MB on the build command line can
-# override this.
-#
 [Defines]
-!if $(TARGET) == RELEASE
-!ifndef $(FD_SIZE_2MB)
-DEFINE FD_SIZE_1MB=
-!endif
-!endif
-
 !include OvmfPkg.fdf.inc
 
 #
-- 
2.6.2

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


Re: [edk2] [PATCH v2] NetworkPkg: change HTTP API typos.

2016-01-27 Thread Zhang, Lubo
Thanks,  I will modify it when I check in.

-Original Message-
From: Fu, Siyuan 
Sent: Thursday, January 28, 2016 9:03 AM
To: Zhang, Lubo; edk2-devel@lists.01.org
Cc: Ye, Ting; Wu, Jiaxin
Subject: RE: [PATCH v2] NetworkPkg: change HTTP API typos.

Hi, Lubo

The function description of EfiHttpGetModeData() is different in header file 
and HttpImpl.c. And the HttpConfigData != NULL is redundant in below code. 
Other part are good with me. Please remember to also update the copyright year 
when you create patch next time.

Reviewed-by: Siyuan Fu 

+  HttpConfigData == NULL ||
  (HttpConfigData != NULL && ((HttpConfigData->LocalAddressIsIPv6 && 
HttpConfigData->AccessPoint.IPv6Node == NULL) ||
  (!HttpConfigData->LocalAddressIsIPv6 && 
HttpConfigData->AccessPoint.IPv4Node == NULL {
 return EFI_INVALID_PARAMETER;
   }

-Original Message-
From: Zhang, Lubo
Sent: Wednesday, January 27, 2016 5:20 PM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan ; Ye, Ting ; Wu, Jiaxin 

Subject: [PATCH v2] NetworkPkg: change HTTP API typos.

v2:
* Correct errors in HttpGetModeData()

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/HttpDxe/HttpImpl.c | 49 +--
 NetworkPkg/HttpDxe/HttpImpl.h | 18 +---
 2 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c 
index aee3de5..4cd6336 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -37,63 +37,61 @@ EFI_HTTP_PROTOCOL  mEfiHttpTemplate = {
 
   @retval EFI_SUCCESS Operation succeeded.
   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is 
TRUE:
   This is NULL.
   HttpConfigData is NULL.
-  HttpConfigData->AccessPoint is NULL.
-  @retval EFI_OUT_OF_RESOURCESCould not allocate enough system resources.
-  @retval EFI_NOT_STARTED The HTTP instance is not configured.
+  HttpInstance->LocalAddressIsIPv6 is FALSE and
+  HttpConfigData->IPv4Node is NULL.
+  HttpInstance->LocalAddressIsIPv6 is TRUE and
+  HttpConfigData->IPv6Node is NULL.
+  @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been 
started.
 
 **/
 EFI_STATUS
 EFIAPI
 EfiHttpGetModeData (
   IN  EFI_HTTP_PROTOCOL *This,
   OUT EFI_HTTP_CONFIG_DATA  *HttpConfigData
   )
 {
   HTTP_PROTOCOL *HttpInstance;
-  EFI_HTTPv4_ACCESS_POINT   *Http4AccessPoint;
-  EFI_HTTPv6_ACCESS_POINT   *Http6AccessPoint;
-
-  if ((This == NULL) || (HttpConfigData == NULL)) {
+  
+  //
+  // Check input parameters.
+  //
+  if (This == NULL || HttpConfigData == NULL) {
 return EFI_INVALID_PARAMETER;
   }
   
   HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
   ASSERT (HttpInstance != NULL);
   
+  if ((HttpInstance->LocalAddressIsIPv6 && 
HttpConfigData->AccessPoint.IPv6Node == NULL) ||
+  (!HttpInstance->LocalAddressIsIPv6 && 
HttpConfigData->AccessPoint.IPv4Node == NULL)) {
+return EFI_INVALID_PARAMETER;
+  }
+  
   if (HttpInstance->State < HTTP_STATE_HTTP_CONFIGED) {
 return EFI_NOT_STARTED;
   }
 
   HttpConfigData->HttpVersion= HttpInstance->HttpVersion;
   HttpConfigData->TimeOutMillisec= HttpInstance->TimeOutMillisec;
   HttpConfigData->LocalAddressIsIPv6 = HttpInstance->LocalAddressIsIPv6;
 
   if (HttpInstance->LocalAddressIsIPv6) {
-Http6AccessPoint = AllocateZeroPool (sizeof (EFI_HTTPv6_ACCESS_POINT));
-if (Http6AccessPoint == NULL) {
-  return EFI_OUT_OF_RESOURCES;
-}
 CopyMem (
-  Http6AccessPoint,
+  HttpConfigData->AccessPoint.IPv6Node,
   >Ipv6Node,
   sizeof (HttpInstance->Ipv6Node)
 );
-HttpConfigData->AccessPoint.IPv6Node = Http6AccessPoint;
   } else {
-Http4AccessPoint = AllocateZeroPool (sizeof (EFI_HTTPv4_ACCESS_POINT));
-if (Http4AccessPoint == NULL) {
-  return EFI_OUT_OF_RESOURCES;
-}
 CopyMem (
-  Http4AccessPoint,
+  HttpConfigData->AccessPoint.IPv4Node,
   >IPv4Node,
   sizeof (HttpInstance->IPv4Node)
   );
-HttpConfigData->AccessPoint.IPv4Node = Http4AccessPoint;
   }
 
   return EFI_SUCCESS;
 }
 
@@ -105,19 +103,20 @@ EfiHttpGetModeData (
   timeout, local address, port, etc.
   When HttpConfigData is NULL, reset this EFI HTTP instance by closing all 
active
   connections with remote hosts, canceling all asynchronous tokens, and flush 
request
   and response buffers without informing the appropriate hosts.
 
-  

Re: [edk2] [Patch] BaseTools: Fix the bug for VOID* Patchable PCD declaration in Library

2016-01-27 Thread Laszlo Ersek
On 01/28/16 00:10, Andrew Fish wrote:
> 
>> On Jan 27, 2016, at 9:33 AM, Laszlo Ersek  wrote:
>>
>> On 01/27/16 10:18, Yonghong Zhu wrote:
>>> VOID* Patchable PCD in Library has the different declaration from the
>>> one in Driver, this issue that will cause GCC LTO build failure.
>>
>> Wow, you managed to build edk2 modules with -flto? How? Is that going to
>> be added to BaseTools?
>>
> 
> Laszlo,
> 
> I can tell you what you need to do for Xcode.
> DLINK flag you add: -object_path_lto $(DEST_DIR_DEBUG)/$(BASE_NAME).lto
> This is only needed for source level debug. 
> 
> Adding -flto to the CC_FLAGS makes the compiler emit LLVM, and if you do this 
> the linker knows what to do. And you can do the reverse and set -fno-lto to 
> turn it off, as last flag wins. So for example you can turn it by adding to 
> the CC_FLAG in your platform DSC if you want to test. 
> 
> Note sure how it works with GCC. 

Thank you for these hints, although I've never tried clang.

I vaguely recall someone had looked into this for gcc (maybe Scott?
that's why I CC'd him), but I don't remember why it didn't work out
ultimately.

Ah, right, here it is:

http://thread.gmane.org/gmane.comp.bios.tianocore.devel/17382

... It looks complicated. I fail to distill a clear idea of why that
patch wasn't merged.

Thanks
Laszlo

> 
> Thanks,
> 
> Andrew Fish
> 
>> Thanks!
>> Laszlo
>>
>>>
>>> Contributed-under: TianoCore Contribution Agreement 1.0
>>> Signed-off-by: Yonghong Zhu 
>>> ---
>>> BaseTools/Source/Python/AutoGen/GenC.py | 15 ---
>>> 1 file changed, 12 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/BaseTools/Source/Python/AutoGen/GenC.py 
>>> b/BaseTools/Source/Python/AutoGen/GenC.py
>>> index 93be718..3f0dfd9 100644
>>> --- a/BaseTools/Source/Python/AutoGen/GenC.py
>>> +++ b/BaseTools/Source/Python/AutoGen/GenC.py
>>> @@ -1,9 +1,9 @@
>>> ## @file
>>> # Routines for generating AutoGen.h and AutoGen.c
>>> #
>>> -# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
>>> +# Copyright (c) 2007 - 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
>>> # http://opensource.org/licenses/bsd-license.php
>>> #
>>> @@ -1097,11 +1097,12 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, 
>>> Pcd):
>>> GetModeSizeName = '_PCD_GET_MODE_SIZE' + '_' + Pcd.TokenCName
>>>
>>> Type = ''
>>> Array = ''
>>> if Pcd.DatumType == 'VOID*':
>>> -Type = '(VOID *)'
>>> +if Pcd.DefaultValue[0]== '{':
>>> +Type = '(VOID *)'
>>> Array = '[]'
>>> PcdItemType = Pcd.Type
>>> PcdExCNameList  = []
>>> if PcdItemType in gDynamicExPcd:
>>> PcdExTokenName = '_PCD_TOKEN_' + TokenSpaceGuidCName + '_' + 
>>> Pcd.TokenCName
>>> @@ -1159,11 +1160,19 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, 
>>> Pcd):
>>> else:
>>> AutoGenH.Append('#define %s(Value)  LibPcdSet%s(%s, 
>>> (Value))\n' % (SetModeName, DatumSizeLib, PcdTokenName))
>>> AutoGenH.Append('#define %s(Value)  LibPcdSet%sS(%s, 
>>> (Value))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName))
>>> if PcdItemType == TAB_PCDS_PATCHABLE_IN_MODULE:
>>> PcdVariableName = '_gPcd_' + 
>>> gItemTypeStringDatabase[TAB_PCDS_PATCHABLE_IN_MODULE] + '_' + TokenCName
>>> -AutoGenH.Append('extern volatile %s _gPcd_BinaryPatch_%s%s;\n' 
>>> %(DatumType, TokenCName, Array) )
>>> +if DatumType == 'VOID*':
>>> +ArraySize = int(Pcd.MaxDatumSize, 0)
>>> +if Pcd.DefaultValue[0] == 'L':
>>> +ArraySize = ArraySize / 2
>>> +Array = '[%d]' % ArraySize
>>> +DatumType = ['UINT8', 'UINT16'][Pcd.DefaultValue[0] == 'L']
>>> +AutoGenH.Append('extern %s _gPcd_BinaryPatch_%s%s;\n' 
>>> %(DatumType, TokenCName, Array))
>>> +else:
>>> +AutoGenH.Append('extern volatile  %s  %s%s;\n' % (DatumType, 
>>> PcdVariableName, Array))
>>> AutoGenH.Append('#define %s  %s_gPcd_BinaryPatch_%s\n' 
>>> %(GetModeName, Type, TokenCName))
>>> if Pcd.DatumType == 'VOID*':
>>> AutoGenH.Append('#define %s(SizeOfBuffer, Buffer)  
>>> LibPatchPcdSetPtrAndSize((VOID *)_gPcd_BinaryPatch_%s, 
>>> &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), 
>>> (Buffer))\n' % (SetModeName, Pcd.TokenCName, Pcd.TokenCName, 
>>> Pcd.TokenCName))
>>> AutoGenH.Append('#define %s(SizeOfBuffer, Buffer)  
>>> LibPatchPcdSetPtrAndSizeS((VOID *)_gPcd_BinaryPatch_%s, 
>>> &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), 
>>> (Buffer))\n' % (SetModeStatusName, Pcd.TokenCName, Pcd.TokenCName, 
>>> Pcd.TokenCName))
>>> else:
>>>
>>
>> 

Re: [edk2] Cannot Use Arrow Key in Boot Menu in IntelBDS

2016-01-27 Thread Narinder Dhillon
Hi,

I am using two platforms for running UEFI on ARMv8, ARM fast model and
a Cadence Palladium platform. In both cases I have same problem.

Thanx,

On Tue, Jan 26, 2016 at 5:30 PM, Laszlo Ersek  wrote:
> On 01/27/16 01:51, Narinder Dhillon wrote:
>> Hi All,
>>
>> I just switched from ArmBDS to IntelBDS and I get the boot menu on
>> terminal but I cannot use the 'arrow' key to choose different options.
>> Any hint on how to get around ?
>
> Interesting, we've been discussing just this.
>
> Please refer to these "short" threads:
>
> http://thread.gmane.org/gmane.comp.bios.edk2.devel/4779/focus=6553
> http://thread.gmane.org/gmane.comp.bios.edk2.devel/6704
>
> (If you stated your specific platform, it might help too.)
>
> Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Update BaseTools to pass VS2015 compiler

2016-01-27 Thread Ni, Ruiyu
Why keep the code as below:
-  UInt32 curAndLenPrice;
-  COptimal *opt;
+  // UInt32 curAndLenPrice;
+  // COptimal *opt;

I think we should completely remove them instead of just commenting them.
Several similar cases in your patch are found.

Regards,
Ray

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Wednesday, January 27, 2016 3:36 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch] BaseTools: Update BaseTools to pass VS2015 compiler

Fix some errors to pass VS2015 compiler.
1. warning C4456: declaration of xxx hides previous local declaration
2. warning C4005: 'UINT8_MAX': macro redefinition

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu 
---
 BaseTools/Source/C/GenFw/Elf32Convert.c |  4 +--
 BaseTools/Source/C/GenVtf/GenVtf.c  | 16 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c |  2 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c | 39 +
 BaseTools/Source/C/VfrCompile/VfrSyntax.g   |  5 +++-
 5 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c 
b/BaseTools/Source/C/GenFw/Elf32Convert.c
index eede645..9bf5855 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -1,9 +1,9 @@
 /** @file
 Elf32 Convert solution
 
-Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
 Portions copyright (c) 2013, ARM Ltd. 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
@@ -813,11 +813,11 @@ WriteRelocations32 (
   if (IsTextShdr(SecShdr) || IsDataShdr(SecShdr)) {
 UINT32 RelIdx;
 
 FoundRelocations = TRUE;
 for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += 
RelShdr->sh_entsize) {
-  Elf_Rel  *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + 
RelIdx);
+  Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);
 
   if (mEhdr->e_machine == EM_386) { 
 switch (ELF_R_TYPE(Rel->r_info)) {
 case R_386_NONE:
 case R_386_PC32:
diff --git a/BaseTools/Source/C/GenVtf/GenVtf.c 
b/BaseTools/Source/C/GenVtf/GenVtf.c
index 6f66ddc..9a3f508 100644
--- a/BaseTools/Source/C/GenVtf/GenVtf.c
+++ b/BaseTools/Source/C/GenVtf/GenVtf.c
@@ -1,10 +1,10 @@
 /** @file
 This file contains functions required to generate a boot strap file (BSF) also 
 known as the Volume Top File (VTF)
 
-Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 1999 - 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
 http://opensource.org/licenses/bsd-license.php
 
@@ -2650,24 +2650,24 @@ Returns:
   OutFileName1 = VTF_OUTPUT_FILE1;
 }
 SymFileName = VTF_SYM_FILE;
   } else {
 INTN OutFileNameLen = strlen(OutFileName1);
-INTN Index;
+INTN NewIndex;
 
-for (Index = OutFileNameLen; Index > 0; --Index) {
-  if (OutFileName1[Index] == '/' || OutFileName1[Index] == '\\') {
+for (NewIndex = OutFileNameLen; NewIndex > 0; --NewIndex) {
+  if (OutFileName1[NewIndex] == '/' || OutFileName1[NewIndex] == '\\') {
 break;
   }
 }
-if (Index == 0) {
+if (NewIndex == 0) {
   SymFileName = VTF_SYM_FILE;
 } else {
-  INTN SymFileNameLen = Index + 1 + strlen(VTF_SYM_FILE);
+  INTN SymFileNameLen = NewIndex + 1 + strlen(VTF_SYM_FILE);
   SymFileName = malloc(SymFileNameLen + 1);
-  memcpy(SymFileName, OutFileName1, Index + 1);
-  memcpy(SymFileName + Index + 1, VTF_SYM_FILE, strlen(VTF_SYM_FILE));
+  memcpy(SymFileName, OutFileName1, NewIndex + 1);
+  memcpy(SymFileName + NewIndex + 1, VTF_SYM_FILE, strlen(VTF_SYM_FILE));
   SymFileName[SymFileNameLen] = '\0';
 }
 if (DebugMode) {
   DebugMsg(UTILITY_NAME, 0, DebugLevel, SymFileName, NULL);
 }
diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c 
b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c
index eb52501..87bea86 100644
--- a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c
+++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c
@@ -264,11 +264,11 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, 
SizeT limit, const Byte
 }
 state = state < kNumLitStates ? 8 : 11;
 prob = probs + RepLenCoder;
   }
   {
-unsigned limit, offset;
+unsigned offset;
 CLzmaProb *probLen = prob + LenChoice;
 

Re: [edk2] [PATCH 0/3] Minor update to the Data parameter for GetVariable()

2016-01-27 Thread Zeng, Star
Ray,

The spec has covered it and our implementation has only copied data when Data 
is not NULL.

Status Codes Returned:
EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has been
updated with the size needed to complete the request.
EFI_INVALID_PARAMETER DataSize is NULL.
EFI_INVALID_PARAMETER The DataSize is not too small and Data is NULL.


Thanks,
Star
-Original Message-
From: Ni, Ruiyu 
Sent: Thursday, January 28, 2016 10:12 AM
To: Zeng, Star; edk2-devel@lists.01.org
Subject: RE: [edk2] [PATCH 0/3] Minor update to the Data parameter for 
GetVariable()

Star,
Should we also update the implementation to only copy the data out when Data is 
not NULL?

Regards,
Ray


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Star Zeng
Sent: Wednesday, January 27, 2016 4:52 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH 0/3] Minor update to the Data parameter for GetVariable()

UEFI 2.6 spec has minor update to the Data parameter for GetVariable(), and no 
real functional behavior change.

The modifier of Data parameter:
OUT VOID *Data
->
OUT VOID *Data OPTIONAL

The comments of Data parameter:
DataThe buffer to return the contents of the variable.
->
DataThe buffer to return the contents of the variable. May be NULL
with a zero DataSize in order to determine the size buffer needed.

The patches are to follow the spec to update the definition and implementation.

Star Zeng (3):
  MdePkg: Minor update to the Data parameter for GetVariable()
  MdeModulePkg Variable: Minor update to the Data parameter for
GetVariable()
  DuetPkg FSVariable: Minor update to the Data parameter for
GetVariable()

 DuetPkg/FSVariable/FSVariable.c  | 7 ---
 MdeModulePkg/Universal/Variable/EmuRuntimeDxe/InitVariable.c | 7 ---
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c| 5 +++--
 MdePkg/Include/Uefi/UefiSpec.h   | 7 ---
 4 files changed, 15 insertions(+), 11 deletions(-)

--
2.7.0.windows.1

___
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] [Patch] MdePkg: Add new enum EfiPlatformConfigurationActionUnsupportedGuid

2016-01-27 Thread Ruiyu Ni
Add new enum EfiPlatformConfigurationActionUnsupportedGuid to
EFI_PLATFORM_CONFIGURATION_ACTION to be used by Response() when
Query() returns a unsupported ParameterTypeGuid.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Liming Gao 
---
 .../Protocol/PlatformToDriverConfiguration.h   | 26 --
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Include/Protocol/PlatformToDriverConfiguration.h 
b/MdePkg/Include/Protocol/PlatformToDriverConfiguration.h
index ee10dc7..4756af4 100644
--- a/MdePkg/Include/Protocol/PlatformToDriverConfiguration.h
+++ b/MdePkg/Include/Protocol/PlatformToDriverConfiguration.h
@@ -5,7 +5,7 @@
   by a UEFI Driver in its Start() function. This protocol allows the driver to 
receive 
   configuration information as part of being started.
 
-  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 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
@@ -44,7 +44,15 @@ typedef struct 
_EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL EFI_PLATFORM_TO_DR
   returned by the platform, and calls Response passing in the
   arguments returned from Query. The Instance value passed into
   Response must be the same value passed into the corresponding
-  call to Query.
+  call to Query. The UEFI driver must continuously call Query and
+  Response until EFI_NOT_FOUND is returned by Query.
+  If the UEFI driver does not recognize the ParameterTypeGuid, it
+  calls Response with a ConfigurationAction of
+  EfiPlatformConfigurationActionUnsupportedGuid. The UEFI driver
+  must then continue calling Query and Response until EFI_NOT_FOUND
+  is returned by Query. This gives the platform an opportunity to
+  pass additional configuration settings using a different
+  ParameterTypeGuid that may be supported by the driver.
   An Instance value of zero means return the first ParameterBlock
   in the set of unprocessed parameter blocks. The driver should
   increment the Instance value by one for each successive call to Query.
@@ -183,6 +191,20 @@ typedef enum {
   ///  after ControllerHandle is stopped. 
   /// 
   EfiPlatformConfigurationActionNvramFailed   = 4,
+
+  ///
+  /// The controller specified by ControllerHandle is still
+  /// in a usable state; its configuration has not been updated
+  /// via parsing the ParameterBlock. The driver did not support
+  /// the ParameterBlock format identified by ParameterTypeGuid.
+  /// No actions are required before this controller can be used
+  /// again. On additional Query calls from this ControllerHandle,
+  /// the platform should stop returning a ParameterBlock
+  /// qualified by this same ParameterTypeGuid. If no other
+  /// ParameterTypeGuid is supported by the platform, Query
+  /// should return EFI_NOT_FOUND.
+  ///
+  EfiPlatformConfigurationActionUnsupportedGuid   = 5,
   EfiPlatformConfigurationActionMaximum
 } EFI_PLATFORM_CONFIGURATION_ACTION;
 
-- 
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] MdePkg:Add new traffic statistics definition for Wireless NIC.

2016-01-27 Thread Zhang, Lubo
Got it, thanks

-Original Message-
From: Gao, Liming 
Sent: Thursday, January 28, 2016 10:24 AM
To: Zhang, Lubo; edk2-devel@lists.01.org
Cc: Ye, Ting; Fu, Siyuan; Wu, Jiaxin
Subject: RE: [edk2] [patch] MdePkg:Add new traffic statistics definition for 
Wireless NIC.

Please remember to change CopyRight to2016. :)

Reviewed-by: Liming Gao 


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Zhang 
Lubo
Sent: Tuesday, January 26, 2016 3:21 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting; Fu, Siyuan; Wu, Jiaxin
Subject: [edk2] [patch] MdePkg:Add new traffic statistics definition for 
Wireless NIC.

Add New traffic statistics  which will be used by wireless NIC.

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 MdePkg/Include/Protocol/SimpleNetwork.h | 19 +++
 MdePkg/Include/Uefi/UefiPxe.h   | 20 
 2 files changed, 39 insertions(+)

diff --git a/MdePkg/Include/Protocol/SimpleNetwork.h 
b/MdePkg/Include/Protocol/SimpleNetwork.h
index 18c09f3..0d8595c 100644
--- a/MdePkg/Include/Protocol/SimpleNetwork.h
+++ b/MdePkg/Include/Protocol/SimpleNetwork.h
@@ -119,10 +119,29 @@ typedef struct {
   ///
   /// Number of frames destined for unsupported protocol.
   ///
   UINT64  UnsupportedProtocol;
 
+  ///
+  /// Number of valid frames received that were duplicated.
+  ///
+  UINT64  RxDuplicatedFrames;
+
+  ///
+  /// Number of encrypted frames received that failed to decrypt.
+  ///
+  UINT64  RxDecryptErrorFrames;
+
+  ///
+  /// Number of frames that failed to transmit after exceeding the retry limit.
+  ///
+  UINT64  TxErrorFrames;
+
+  ///
+  /// Number of frames transmitted successfully after more than one attempt.
+  ///
+  UINT64  TxRetryFrames;
 } EFI_NETWORK_STATISTICS;
 
 ///
 /// The state of the network interface.
 /// When an EFI_SIMPLE_NETWORK_PROTOCOL driver initializes a diff --git 
a/MdePkg/Include/Uefi/UefiPxe.h b/MdePkg/Include/Uefi/UefiPxe.h index 
2972ff7..7e238c9 100644
--- a/MdePkg/Include/Uefi/UefiPxe.h
+++ b/MdePkg/Include/Uefi/UefiPxe.h
@@ -1456,10 +1456,30 @@ typedef struct s_pxe_db_statistics {  ///  /// Number 
of frames destined for unsupported protocol.
 ///
 #define PXE_STATISTICS_UNSUPPORTED_PROTOCOL 0x15
 
+///
+/// Number of valid frames received that were duplicated.
+///
+#define PXE_STATISTICS_RX_DUPLICATED_FRAMES 0x16
+
+///
+/// Number of encrypted frames received that failed to decrypt.
+///
+#define PXE_STATISTICS_RX_DECRYPT_ERROR_FRAMES 0x17
+
+///
+/// Number of frames that failed to transmit after exceeding the retry limit.
+///
+#define PXE_STATISTICS_TX_ERROR_FRAMES 0x18
+
+///
+/// Number of frames transmitted successfully after more than one attempt.
+///
+#define PXE_STATISTICS_TX_RETRY_FRAMES 0x19
+
 typedef struct s_pxe_cpb_mcast_ip_to_mac {
   ///
   /// Multicast IP address to be converted to multicast MAC address.
   ///
   PXE_IP_ADDR IP;
--
1.9.5.msysgit.1

___
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 1/2] MdePkg:Add a new error status code EFI_HTTP_ERROR.

2016-01-27 Thread Gao, Liming
Reviewed-by: Liming Gao 

-Original Message-
From: Zhang, Lubo 
Sent: Wednesday, January 27, 2016 3:26 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting; Fu, Siyuan; Gao, Liming
Subject: [patch 1/2] MdePkg:Add a new error status code EFI_HTTP_ERROR.

Add a new error status code EFI_HTTP_ERROR in corresponding with the UEFI 2.6 
spec

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 MdePkg/Include/Base.h  | 5 +
 MdePkg/Include/Uefi/UefiBaseType.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index 
85ed34f..174a32e 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -939,10 +939,15 @@ typedef UINTN RETURN_STATUS;  /// security status.
 ///
 #define RETURN_COMPROMISED_DATA  ENCODE_ERROR (33)
 
 ///
+/// A HTTP error occurred during the network operation.
+///
+#define RETURN_HTTP_ERRORENCODE_ERROR (35)
+
+///
 /// The string contained one or more characters that  /// the device could not 
render and were skipped.
 ///
 #define RETURN_WARN_UNKNOWN_GLYPHENCODE_WARNING (1)
 
diff --git a/MdePkg/Include/Uefi/UefiBaseType.h 
b/MdePkg/Include/Uefi/UefiBaseType.h
index b505e7d..3c75764 100644
--- a/MdePkg/Include/Uefi/UefiBaseType.h
+++ b/MdePkg/Include/Uefi/UefiBaseType.h
@@ -149,10 +149,11 @@ typedef union {
 #define EFI_CRC_ERROR RETURN_CRC_ERROR   
 #define EFI_END_OF_MEDIA  RETURN_END_OF_MEDIA
 #define EFI_END_OF_FILE   RETURN_END_OF_FILE
 #define EFI_INVALID_LANGUAGE  RETURN_INVALID_LANGUAGE
 #define EFI_COMPROMISED_DATA  RETURN_COMPROMISED_DATA
+#define EFI_HTTP_ERRORRETURN_HTTP_ERROR
 
 #define EFI_WARN_UNKNOWN_GLYPHRETURN_WARN_UNKNOWN_GLYPH   
 #define EFI_WARN_DELETE_FAILURE   RETURN_WARN_DELETE_FAILURE  
 #define EFI_WARN_WRITE_FAILURERETURN_WARN_WRITE_FAILURE   
 #define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL
--
1.9.5.msysgit.1

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


Re: [edk2] [Patch] BaseTools: Update BaseTools to pass VS2015 compiler

2016-01-27 Thread Zhu, Yonghong
Got it, thanks. I will clean these comments.

Best Regards,

Zhu Yonghong


-Original Message-
From: Ni, Ruiyu 
Sent: Thursday, January 28, 2016 9:56 AM
To: Zhu, Yonghong; edk2-devel@lists.01.org
Subject: RE: [edk2] [Patch] BaseTools: Update BaseTools to pass VS2015 compiler

Why keep the code as below:
-  UInt32 curAndLenPrice;
-  COptimal *opt;
+  // UInt32 curAndLenPrice;
+  // COptimal *opt;

I think we should completely remove them instead of just commenting them.
Several similar cases in your patch are found.

Regards,
Ray

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Wednesday, January 27, 2016 3:36 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch] BaseTools: Update BaseTools to pass VS2015 compiler

Fix some errors to pass VS2015 compiler.
1. warning C4456: declaration of xxx hides previous local declaration 2. 
warning C4005: 'UINT8_MAX': macro redefinition

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu 
---
 BaseTools/Source/C/GenFw/Elf32Convert.c |  4 +--
 BaseTools/Source/C/GenVtf/GenVtf.c  | 16 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c |  2 +-  
BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c | 39 +
 BaseTools/Source/C/VfrCompile/VfrSyntax.g   |  5 +++-
 5 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c 
b/BaseTools/Source/C/GenFw/Elf32Convert.c
index eede645..9bf5855 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -1,9 +1,9 @@
 /** @file
 Elf32 Convert solution
 
-Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
 Portions copyright (c) 2013, ARM Ltd. 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 @@ -813,11 +813,11 
@@ WriteRelocations32 (
   if (IsTextShdr(SecShdr) || IsDataShdr(SecShdr)) {
 UINT32 RelIdx;
 
 FoundRelocations = TRUE;
 for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += 
RelShdr->sh_entsize) {
-  Elf_Rel  *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + 
RelIdx);
+  Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + 
+ RelIdx);
 
   if (mEhdr->e_machine == EM_386) { 
 switch (ELF_R_TYPE(Rel->r_info)) {
 case R_386_NONE:
 case R_386_PC32:
diff --git a/BaseTools/Source/C/GenVtf/GenVtf.c 
b/BaseTools/Source/C/GenVtf/GenVtf.c
index 6f66ddc..9a3f508 100644
--- a/BaseTools/Source/C/GenVtf/GenVtf.c
+++ b/BaseTools/Source/C/GenVtf/GenVtf.c
@@ -1,10 +1,10 @@
 /** @file
 This file contains functions required to generate a boot strap file (BSF) also 
 known as the Volume Top File (VTF)
 
-Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 1999 - 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  
http://opensource.org/licenses/bsd-license.php
 
@@ -2650,24 +2650,24 @@ Returns:
   OutFileName1 = VTF_OUTPUT_FILE1;
 }
 SymFileName = VTF_SYM_FILE;
   } else {
 INTN OutFileNameLen = strlen(OutFileName1);
-INTN Index;
+INTN NewIndex;
 
-for (Index = OutFileNameLen; Index > 0; --Index) {
-  if (OutFileName1[Index] == '/' || OutFileName1[Index] == '\\') {
+for (NewIndex = OutFileNameLen; NewIndex > 0; --NewIndex) {
+  if (OutFileName1[NewIndex] == '/' || OutFileName1[NewIndex] == 
+ '\\') {
 break;
   }
 }
-if (Index == 0) {
+if (NewIndex == 0) {
   SymFileName = VTF_SYM_FILE;
 } else {
-  INTN SymFileNameLen = Index + 1 + strlen(VTF_SYM_FILE);
+  INTN SymFileNameLen = NewIndex + 1 + strlen(VTF_SYM_FILE);
   SymFileName = malloc(SymFileNameLen + 1);
-  memcpy(SymFileName, OutFileName1, Index + 1);
-  memcpy(SymFileName + Index + 1, VTF_SYM_FILE, strlen(VTF_SYM_FILE));
+  memcpy(SymFileName, OutFileName1, NewIndex + 1);
+  memcpy(SymFileName + NewIndex + 1, VTF_SYM_FILE, 
+ strlen(VTF_SYM_FILE));
   SymFileName[SymFileNameLen] = '\0';
 }
 if (DebugMode) {
   DebugMsg(UTILITY_NAME, 0, DebugLevel, SymFileName, NULL);
 }
diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c 
b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c
index eb52501..87bea86 100644
--- a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c
+++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c
@@ -264,11 +264,11 @@ static int 

[edk2] [PATCH] MdeModulePkg: Minor comments update to GetNextHighMonotonicCount()

2016-01-27 Thread Star Zeng
Description of the GetNextHighMonotonicCount does not state that the counter
is incremented on calling this function. However, the example usage of this
API documented relies on this behavior.

UEFI 2.6 spec is to update description to match usage documented.

The high 32-bit value is nonvolatile and is increased by 1 whenever the system
resets whenever the low 32-bit count (returned by GetNextMonoticCount()) 
overflows.

->

The high 32-bit value is nonvolatile and is increased by 1 whenever the system
resets, whenever GetNextHighMonotonicCount() is called, or whenever the low
32-bit count (returned by GetNextMonoticCount()) overflows.

Cc: Liming Gao 
Cc: Feng Tian 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
 .../Universal/MonotonicCounterRuntimeDxe/MonotonicCounter.c| 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounter.c 
b/MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounter.c
index ddb0d2e..2bfede6 100644
--- a/MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounter.c
+++ b/MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounter.c
@@ -2,7 +2,7 @@
   Produce the UEFI boot service GetNextMonotonicCount() and runtime service
   GetNextHighMonotonicCount().
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 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
@@ -107,8 +107,9 @@ MonotonicCounterDriverGetNextMonotonicCount (
   comprised of two 32 bit quantities:  the high 32 bits and the low 32 bits.
   During boot service time the low 32 bit value is volatile:  it is reset to
   zero on every system reset and is increased by 1 on every call to 
GetNextMonotonicCount().
-  The high 32 bit value is non-volatile and is increased by 1 whenever the 
system resets
-  or whenever the low 32 bit count [returned by GetNextMonoticCount()] 
overflows.
+  The high 32 bit value is non-volatile and is increased by 1 whenever the 
system resets,
+  whenever GetNextHighMonotonicCount() is called, or whenever the low 32 bit 
count
+  (returned by GetNextMonoticCount()) overflows.
   The GetNextMonotonicCount() function is only available at boot services time.
   If the operating system wishes to extend the platform monotonic counter to 
runtime,
   it may do so by utilizing GetNextHighMonotonicCount().  To do this, before 
calling
-- 
2.7.0.windows.1

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


[edk2] [Patch] PcAtChipsetPkg/Rtc: Don't unnecessarily create timezone variable.

2016-01-27 Thread Ruiyu Ni
When SetTime() is called with EFI_UNSPECIFIED_TIMEZONE, the code
can optimally not create the private timezone variable because
absence of timezone variable indicates the timezone is unspecified.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Feng Tian 
---
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 81 ++
 1 file changed, 38 insertions(+), 43 deletions(-)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index bf22176..acc70a6 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -1,7 +1,7 @@
 /** @file
   RTC Architectural Protocol GUID as defined in DxeCis 0.96.
 
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 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
@@ -14,6 +14,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 
 #include "PcRtc.h"
 
+//
+// Days of month.
+//
+UINTN mDayOfMonth[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+
+//
+// The name of NV variable to store the timezone and daylight saving 
information.
+//
+CHAR16 mTimeZoneVariableName[] = L"RTC";
+
 /**
   Compare the Hour, Minute and Second of the From time and the To time.
   
@@ -182,11 +192,11 @@ PcRtcInit (
   //
   DataSize = sizeof (UINT32);
   Status = EfiGetVariable (
- L"RTC",
+ mTimeZoneVariableName,
  ,
  NULL,
  ,
- (VOID *) 
+ 
  );
   if (!EFI_ERROR (Status)) {
 Time.TimeZone = (INT16) TimerVar;
@@ -477,15 +487,29 @@ PcRtcSetTime (
   //
   // Write timezone and daylight to RTC variable
   //
-  TimerVar = Time->Daylight;
-  TimerVar = (UINT32) ((TimerVar << 16) | (UINT16)(Time->TimeZone));
-  Status =  EfiSetVariable (
-  L"RTC",
-  ,
-  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | 
EFI_VARIABLE_NON_VOLATILE,
-  sizeof (TimerVar),
-  
-  );
+  if (Time->TimeZone == EFI_UNSPECIFIED_TIMEZONE) {
+Status = EfiSetVariable (
+   mTimeZoneVariableName,
+   ,
+   0,
+   0,
+   NULL
+   );
+if (Status == EFI_NOT_FOUND) {
+  Status = EFI_SUCCESS;
+}
+  } else {
+TimerVar = Time->Daylight;
+TimerVar = (UINT32) ((TimerVar << 16) | (UINT16)(Time->TimeZone));
+Status = EfiSetVariable (
+   mTimeZoneVariableName,
+   ,
+   EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | 
EFI_VARIABLE_NON_VOLATILE,
+   sizeof (TimerVar),
+   
+   );
+  }
+
   if (EFI_ERROR (Status)) {
 if (!EfiAtRuntime ()) {
   EfiReleaseLock (>RtcLock);
@@ -987,28 +1011,13 @@ DayValid (
   IN  EFI_TIME  *Time
   )
 {
-  INTN  DayOfMonth[12];
-
-  DayOfMonth[0] = 31;
-  DayOfMonth[1] = 29;
-  DayOfMonth[2] = 31;
-  DayOfMonth[3] = 30;
-  DayOfMonth[4] = 31;
-  DayOfMonth[5] = 30;
-  DayOfMonth[6] = 31;
-  DayOfMonth[7] = 31;
-  DayOfMonth[8] = 30;
-  DayOfMonth[9] = 31;
-  DayOfMonth[10] = 30;
-  DayOfMonth[11] = 31;
-
   //
   // The validity of Time->Month field should be checked before
   //
   ASSERT (Time->Month >=1);
   ASSERT (Time->Month <=12);
   if (Time->Day < 1 ||
-  Time->Day > DayOfMonth[Time->Month - 1] ||
+  Time->Day > mDayOfMonth[Time->Month - 1] ||
   (Time->Month == 2 && (!IsLeapYear (Time) && Time->Day > 28))
   ) {
 return FALSE;
@@ -1144,22 +1153,8 @@ IsWithinOneDay (
   IN EFI_TIME  *To
   )
 {
-  UINT8   DayOfMonth[12];
   BOOLEAN Adjacent;
 
-  DayOfMonth[0] = 31;
-  DayOfMonth[1] = 29;
-  DayOfMonth[2] = 31;
-  DayOfMonth[3] = 30;
-  DayOfMonth[4] = 31;
-  DayOfMonth[5] = 30;
-  DayOfMonth[6] = 31;
-  DayOfMonth[7] = 31;
-  DayOfMonth[8] = 30;
-  DayOfMonth[9] = 31;
-  DayOfMonth[10] = 30;
-  DayOfMonth[11] = 31;
-
   Adjacent = FALSE;
 
   //
@@ -1186,7 +1181,7 @@ IsWithinOneDay (
 Adjacent = TRUE;
   }
 }
-  } else if (From->Day == DayOfMonth[From->Month - 1]) {
+  } else if (From->Day == mDayOfMonth[From->Month - 1]) {
 if ((CompareHMS(From, To) >= 0)) {
Adjacent = TRUE;
 }
-- 
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] MdePkg:Change HTTP API typos.

2016-01-27 Thread Gao, Liming
Reviewed-by: Liming Gao 

-Original Message-
From: Zhang, Lubo 
Sent: Tuesday, January 26, 2016 5:26 PM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan; Ye, Ting; Gao, Liming
Subject: [patch] MdePkg:Change HTTP API typos.

change HTTP API typos and clarify returned status code in HTTP API.

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 MdePkg/Include/Protocol/Http.h | 25 ++---
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/MdePkg/Include/Protocol/Http.h b/MdePkg/Include/Protocol/Http.h 
index 839e378..7050a04 100644
--- a/MdePkg/Include/Protocol/Http.h
+++ b/MdePkg/Include/Protocol/Http.h
@@ -111,11 +111,11 @@ typedef enum {
 ///
 typedef struct {
   ///
   /// Set to TRUE to instruct the EFI HTTP instance to use the default address
   /// information in every TCP connection made by this instance. In addition, 
when set
-  /// to TRUE, LocalAddress, LocalSubnet, and LocalPort are ignored.
+  /// to TRUE, LocalAddress and LocalSubnet are ignored.
   ///
   BOOLEAN   UseDefaultAddress;
   ///
   /// If UseDefaultAddress is set to FALSE, this defines the local IP address 
to be
   /// used in every TCP connection opened by this instance.
@@ -125,11 +125,11 @@ typedef struct {
   /// If UseDefaultAddress is set to FALSE, this defines the local subnet to 
be used
   /// in every TCP connection opened by this instance.
   ///
   EFI_IPv4_ADDRESS  LocalSubnet;
   ///
-  /// If UseDefaultAddress is set to FALSE, this defines the local port to be 
used in
+  /// This defines the local port to be used in
   /// every TCP connection opened by this instance.
   ///
   UINT16LocalPort;
 } EFI_HTTPv4_ACCESS_POINT;
 
@@ -304,10 +304,16 @@ typedef struct {
   @param[out] HttpConfigData  Point to buffer for operational parameters 
of this
   HTTP instance.
 
   @retval EFI_SUCCESS Operation succeeded.
   @retval EFI_INVALID_PARAMETER   This is NULL.
+  HttpConfigData is NULL.
+  HttpConfigData->LocalAddressIsIPv6 is FALSE 
and
+  HttpConfigData->IPv4Node is NULL.
+  HttpConfigData->LocalAddressIsIPv6 is TRUE 
and
+  HttpConfigData->IPv6Node is NULL.
+  @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been 
started.
 **/
 typedef
 EFI_STATUS
 (EFIAPI * EFI_HTTP_GET_MODE_DATA)(
   IN  EFI_HTTP_PROTOCOL *This,
@@ -322,19 +328,20 @@ EFI_STATUS
   timeout, local address, port, etc.
   When HttpConfigData is NULL, reset this EFI HTTP instance by closing all 
active
   connections with remote hosts, canceling all asynchronous tokens, and flush 
request
   and response buffers without informing the appropriate hosts.
 
-  Except for GetModeData() and Configure(), No other EFI HTTP function can be 
executed
-  by this instance until the Configure() function is executed and returns 
successfully.
+  No other EFI HTTP function can be executed by this instance until the 
+ Configure()  function is executed and returns successfully.
 
   @param[in]  ThisPointer to EFI_HTTP_PROTOCOL instance.
   @param[in]  HttpConfigData  Pointer to the configure data to configure 
the instance.
 
   @retval EFI_SUCCESS Operation succeeded.
   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is 
TRUE:
   This is NULL.
+  HttpConfigData is NULL.
   HttpConfigData->LocalAddressIsIPv6 is FALSE 
and
   HttpConfigData->IPv4Node is NULL.
   HttpConfigData->LocalAddressIsIPv6 is TRUE 
and
   HttpConfigData->IPv6Node is NULL.
   @retval EFI_ALREADY_STARTED Reinitialize this HTTP instance without 
calling
@@ -365,15 +372,18 @@ EFI_STATUS
   @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been 
started.
   @retval EFI_DEVICE_ERRORAn unexpected system or network error 
occurred.
   @retval EFI_TIMEOUT Data was dropped out of the transmit or 
receive queue.
   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is 
TRUE:
   This is NULL.
+  Token is NULL.
   Token->Message is NULL.
   Token->Message->Body is not NULL,
   Token->Message->BodyLength is non-zero, and
   Token->Message->Data is NULL, but a previous 
call to
  

Re: [edk2] [patch] MdePkg:Add new traffic statistics definition for Wireless NIC.

2016-01-27 Thread Gao, Liming
Please remember to change CopyRight to2016. :)

Reviewed-by: Liming Gao 


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Zhang 
Lubo
Sent: Tuesday, January 26, 2016 3:21 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting; Fu, Siyuan; Wu, Jiaxin
Subject: [edk2] [patch] MdePkg:Add new traffic statistics definition for 
Wireless NIC.

Add New traffic statistics  which will be used by wireless NIC.

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 MdePkg/Include/Protocol/SimpleNetwork.h | 19 +++
 MdePkg/Include/Uefi/UefiPxe.h   | 20 
 2 files changed, 39 insertions(+)

diff --git a/MdePkg/Include/Protocol/SimpleNetwork.h 
b/MdePkg/Include/Protocol/SimpleNetwork.h
index 18c09f3..0d8595c 100644
--- a/MdePkg/Include/Protocol/SimpleNetwork.h
+++ b/MdePkg/Include/Protocol/SimpleNetwork.h
@@ -119,10 +119,29 @@ typedef struct {
   ///
   /// Number of frames destined for unsupported protocol.
   ///
   UINT64  UnsupportedProtocol;
 
+  ///
+  /// Number of valid frames received that were duplicated.
+  ///
+  UINT64  RxDuplicatedFrames;
+
+  ///
+  /// Number of encrypted frames received that failed to decrypt.
+  ///
+  UINT64  RxDecryptErrorFrames;
+
+  ///
+  /// Number of frames that failed to transmit after exceeding the retry limit.
+  ///
+  UINT64  TxErrorFrames;
+
+  ///
+  /// Number of frames transmitted successfully after more than one attempt.
+  ///
+  UINT64  TxRetryFrames;
 } EFI_NETWORK_STATISTICS;
 
 ///
 /// The state of the network interface.
 /// When an EFI_SIMPLE_NETWORK_PROTOCOL driver initializes a diff --git 
a/MdePkg/Include/Uefi/UefiPxe.h b/MdePkg/Include/Uefi/UefiPxe.h index 
2972ff7..7e238c9 100644
--- a/MdePkg/Include/Uefi/UefiPxe.h
+++ b/MdePkg/Include/Uefi/UefiPxe.h
@@ -1456,10 +1456,30 @@ typedef struct s_pxe_db_statistics {  ///  /// Number 
of frames destined for unsupported protocol.
 ///
 #define PXE_STATISTICS_UNSUPPORTED_PROTOCOL 0x15
 
+///
+/// Number of valid frames received that were duplicated.
+///
+#define PXE_STATISTICS_RX_DUPLICATED_FRAMES 0x16
+
+///
+/// Number of encrypted frames received that failed to decrypt.
+///
+#define PXE_STATISTICS_RX_DECRYPT_ERROR_FRAMES 0x17
+
+///
+/// Number of frames that failed to transmit after exceeding the retry limit.
+///
+#define PXE_STATISTICS_TX_ERROR_FRAMES 0x18
+
+///
+/// Number of frames transmitted successfully after more than one attempt.
+///
+#define PXE_STATISTICS_TX_RETRY_FRAMES 0x19
+
 typedef struct s_pxe_cpb_mcast_ip_to_mac {
   ///
   /// Multicast IP address to be converted to multicast MAC address.
   ///
   PXE_IP_ADDR IP;
--
1.9.5.msysgit.1

___
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 0/3] Minor update to the Data parameter for GetVariable()

2016-01-27 Thread Ni, Ruiyu
Star,
Should we also update the implementation to only copy the data out when Data is 
not NULL?

Regards,
Ray


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Star Zeng
Sent: Wednesday, January 27, 2016 4:52 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH 0/3] Minor update to the Data parameter for GetVariable()

UEFI 2.6 spec has minor update to the Data parameter for GetVariable(),
and no real functional behavior change.

The modifier of Data parameter:
OUT VOID *Data
->
OUT VOID *Data OPTIONAL

The comments of Data parameter:
DataThe buffer to return the contents of the variable.
->
DataThe buffer to return the contents of the variable. May be NULL
with a zero DataSize in order to determine the size buffer needed.

The patches are to follow the spec to update the definition and implementation.

Star Zeng (3):
  MdePkg: Minor update to the Data parameter for GetVariable()
  MdeModulePkg Variable: Minor update to the Data parameter for
GetVariable()
  DuetPkg FSVariable: Minor update to the Data parameter for
GetVariable()

 DuetPkg/FSVariable/FSVariable.c  | 7 ---
 MdeModulePkg/Universal/Variable/EmuRuntimeDxe/InitVariable.c | 7 ---
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c| 5 +++--
 MdePkg/Include/Uefi/UefiSpec.h   | 7 ---
 4 files changed, 15 insertions(+), 11 deletions(-)

-- 
2.7.0.windows.1

___
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] MdeModulePkg: Minor comments update to GetNextHighMonotonicCount()

2016-01-27 Thread Gao, Liming
Reviewed-by: Liming Gao 

-Original Message-
From: Zeng, Star 
Sent: Thursday, January 28, 2016 10:11 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming; Tian, Feng
Subject: [PATCH] MdeModulePkg: Minor comments update to 
GetNextHighMonotonicCount()

Description of the GetNextHighMonotonicCount does not state that the counter is 
incremented on calling this function. However, the example usage of this API 
documented relies on this behavior.

UEFI 2.6 spec is to update description to match usage documented.

The high 32-bit value is nonvolatile and is increased by 1 whenever the system 
resets whenever the low 32-bit count (returned by GetNextMonoticCount()) 
overflows.

->

The high 32-bit value is nonvolatile and is increased by 1 whenever the system 
resets, whenever GetNextHighMonotonicCount() is called, or whenever the low 
32-bit count (returned by GetNextMonoticCount()) overflows.

Cc: Liming Gao 
Cc: Feng Tian 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
 .../Universal/MonotonicCounterRuntimeDxe/MonotonicCounter.c| 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounter.c 
b/MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounter.c
index ddb0d2e..2bfede6 100644
--- a/MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounter.c
+++ b/MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounter
+++ .c
@@ -2,7 +2,7 @@
   Produce the UEFI boot service GetNextMonotonicCount() and runtime service
   GetNextHighMonotonicCount().
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 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 @@ -107,8 +107,9 @@ 
MonotonicCounterDriverGetNextMonotonicCount (
   comprised of two 32 bit quantities:  the high 32 bits and the low 32 bits.
   During boot service time the low 32 bit value is volatile:  it is reset to
   zero on every system reset and is increased by 1 on every call to 
GetNextMonotonicCount().
-  The high 32 bit value is non-volatile and is increased by 1 whenever the 
system resets
-  or whenever the low 32 bit count [returned by GetNextMonoticCount()] 
overflows.
+  The high 32 bit value is non-volatile and is increased by 1 whenever 
+ the system resets,  whenever GetNextHighMonotonicCount() is called, or 
+ whenever the low 32 bit count  (returned by GetNextMonoticCount()) overflows.
   The GetNextMonotonicCount() function is only available at boot services time.
   If the operating system wishes to extend the platform monotonic counter to 
runtime,
   it may do so by utilizing GetNextHighMonotonicCount().  To do this, before 
calling
--
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] BaseTools: Fix the bug for VOID* Patchable PCD declaration in Library

2016-01-27 Thread Gao, Liming
Laszlo:
  Someone evaluates GCC LTO feature and detects this issue. Now, we have no 
clear plan to add LTO support. 

Thanks
Liming
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo 
Ersek
Sent: Thursday, January 28, 2016 1:34 AM
To: Zhu, Yonghong
Cc: edk2-de...@ml01.01.org; Scott Duplichan
Subject: Re: [edk2] [Patch] BaseTools: Fix the bug for VOID* Patchable PCD 
declaration in Library

On 01/27/16 10:18, Yonghong Zhu wrote:
> VOID* Patchable PCD in Library has the different declaration from the 
> one in Driver, this issue that will cause GCC LTO build failure.

Wow, you managed to build edk2 modules with -flto? How? Is that going to be 
added to BaseTools?

Thanks!
Laszlo

> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu 
> ---
>  BaseTools/Source/Python/AutoGen/GenC.py | 15 ---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenC.py 
> b/BaseTools/Source/Python/AutoGen/GenC.py
> index 93be718..3f0dfd9 100644
> --- a/BaseTools/Source/Python/AutoGen/GenC.py
> +++ b/BaseTools/Source/Python/AutoGen/GenC.py
> @@ -1,9 +1,9 @@
>  ## @file
>  # Routines for generating AutoGen.h and AutoGen.c  # -# Copyright (c) 
> 2007 - 2015, Intel Corporation. All rights reserved.
> +# Copyright (c) 2007 - 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  # http://opensource.org/licenses/bsd-license.php
>  #
> @@ -1097,11 +1097,12 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, 
> Pcd):
>  GetModeSizeName = '_PCD_GET_MODE_SIZE' + '_' + Pcd.TokenCName
>  
>  Type = ''
>  Array = ''
>  if Pcd.DatumType == 'VOID*':
> -Type = '(VOID *)'
> +if Pcd.DefaultValue[0]== '{':
> +Type = '(VOID *)'
>  Array = '[]'
>  PcdItemType = Pcd.Type
>  PcdExCNameList  = []
>  if PcdItemType in gDynamicExPcd:
>  PcdExTokenName = '_PCD_TOKEN_' + TokenSpaceGuidCName + '_' + 
> Pcd.TokenCName @@ -1159,11 +1160,19 @@ def CreateLibraryPcdCode(Info, 
> AutoGenC, AutoGenH, Pcd):
>  else:
>  AutoGenH.Append('#define %s(Value)  LibPcdSet%s(%s, 
> (Value))\n' % (SetModeName, DatumSizeLib, PcdTokenName))
>  AutoGenH.Append('#define %s(Value)  LibPcdSet%sS(%s, 
> (Value))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName))
>  if PcdItemType == TAB_PCDS_PATCHABLE_IN_MODULE:
>  PcdVariableName = '_gPcd_' + 
> gItemTypeStringDatabase[TAB_PCDS_PATCHABLE_IN_MODULE] + '_' + TokenCName
> -AutoGenH.Append('extern volatile %s _gPcd_BinaryPatch_%s%s;\n' 
> %(DatumType, TokenCName, Array) )
> +if DatumType == 'VOID*':
> +ArraySize = int(Pcd.MaxDatumSize, 0)
> +if Pcd.DefaultValue[0] == 'L':
> +ArraySize = ArraySize / 2
> +Array = '[%d]' % ArraySize
> +DatumType = ['UINT8', 'UINT16'][Pcd.DefaultValue[0] == 'L']
> +AutoGenH.Append('extern %s _gPcd_BinaryPatch_%s%s;\n' 
> %(DatumType, TokenCName, Array))
> +else:
> +AutoGenH.Append('extern volatile  %s  %s%s;\n' % 
> + (DatumType, PcdVariableName, Array))
>  AutoGenH.Append('#define %s  %s_gPcd_BinaryPatch_%s\n' 
> %(GetModeName, Type, TokenCName))
>  if Pcd.DatumType == 'VOID*':
>  AutoGenH.Append('#define %s(SizeOfBuffer, Buffer)  
> LibPatchPcdSetPtrAndSize((VOID *)_gPcd_BinaryPatch_%s, 
> &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), 
> (Buffer))\n' % (SetModeName, Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName))
>  AutoGenH.Append('#define %s(SizeOfBuffer, Buffer)  
> LibPatchPcdSetPtrAndSizeS((VOID *)_gPcd_BinaryPatch_%s, 
> &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), 
> (Buffer))\n' % (SetModeStatusName, Pcd.TokenCName, Pcd.TokenCName, 
> Pcd.TokenCName))
>  else:
> 

___
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] MdeModulePkg/PeiCore: Fix the debug info of PEI temp heap length

2016-01-27 Thread Zeng, Star

On 2016/1/27 15:45, Cinnamon Shia wrote:

(HandoffInformationTable->EfiFreeMemoryBottom - Private->HobList.Raw)
is the PEI temp heap used instead of the length of PEI temp heap.

The length of PEI temp heap should be:
(HandoffInformationTable->EfiFreeMemoryTop - Private->HobList.Raw)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia 
---
  MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)



Reviewed-by: Star Zeng 



diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c 
b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
index 2251b9b..715e9d2 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -2,6 +2,7 @@
EFI PEI Core dispatch services

  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
  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
@@ -682,7 +683,7 @@ PeiCheckAndSwitchStack (
 StackPointer ++);

DEBUG ((EFI_D_INFO, "Temp Stack : BaseAddress=0x%p Length=0x%X\n", 
SecCoreData->StackBase, (UINT32)SecCoreData->StackSize));
-  DEBUG ((EFI_D_INFO, "Temp Heap  : BaseAddress=0x%p Length=0x%X\n", 
Private->HobList.Raw, (UINT32)((UINTN) 
Private->HobList.HandoffInformationTable->EfiFreeMemoryBottom - (UINTN) 
Private->HobList.Raw)));
+  DEBUG ((EFI_D_INFO, "Temp Heap  : BaseAddress=0x%p Length=0x%X\n", 
Private->HobList.Raw, (UINT32)((UINTN) 
Private->HobList.HandoffInformationTable->EfiFreeMemoryTop - (UINTN) Private->HobList.Raw)));
DEBUG ((EFI_D_INFO, "Total temporary memory:%d bytes.\n", 
(UINT32)SecCoreData->TemporaryRamSize));
DEBUG ((EFI_D_INFO, "  temporary memory stack ever used: %d bytes.\n",
   (UINT32)(SecCoreData->StackSize - ((UINTN) StackPointer - 
(UINTN)SecCoreData->StackBase))



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


Re: [edk2] [patch 2/2] NetworkPkg:Add a new error status code EFI_HTTP_ERROR

2016-01-27 Thread Wu, Jiaxin
Reviewed-by: Jiaxin Wu 


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Zhang 
Lubo
Sent: Wednesday, January 27, 2016 3:28 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting; Fu, Siyuan; Wu, Jiaxin
Subject: [edk2] [patch 2/2] NetworkPkg:Add a new error status code 
EFI_HTTP_ERROR

Add a new error status code EFI_HTTP_ERROR in corresponding with the UEFI 2.6 
spec, when
EFI_HTTP_PROTOCOL.Response() is called and the protocol interface encounter a 
HTTP error, it should return the new error status to the caller.

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/HttpBootDxe/HttpBootSupport.c |  4 +---
 NetworkPkg/HttpDxe/HttpImpl.c| 10 +-
 NetworkPkg/HttpDxe/HttpImpl.h|  1 +
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
index f9bbe4b..38743c6 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
@@ -974,13 +974,11 @@ HttpIoRecvResponse (
   Status = HttpIo->RspToken.Status;
   if (!EFI_ERROR (Status)) {
 ResponseData->HeaderCount = HttpIo->RspToken.Message->HeaderCount;
 ResponseData->Headers = HttpIo->RspToken.Message->Headers;
 ResponseData->BodyLength  = HttpIo->RspToken.Message->BodyLength;
-  }
-
-  if (RecvMsgHeader) {
+  } else if (Status == EFI_HTTP_ERROR) {
 StatusCode = HttpIo->RspToken.Message->Data.Response->StatusCode;
 HttpBootPrintErrorMessage (StatusCode);
   }
 
   return Status;
diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c 
index aee3de5..3ea95b6 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -814,10 +814,12 @@ HttpBodyParserCallback (
 
   @retval EFI_SUCCESS Allocation succeeded.
   @retval EFI_OUT_OF_RESOURCESFailed to complete the opration due to lack 
of resources.
   @retval EFI_NOT_READY   Can't find a corresponding Tx4Token/Tx6Token 
or 
   the EFI_HTTP_UTILITIES_PROTOCOL is not 
available.
+  @retval EFI_HTTP_ERROR  A HTTP error occurred during the network 
operation. The response 
+  status code is returned in Token->Message-> 
Response->StatusCode.
 
 **/
 EFI_STATUS
 HttpResponseWorker (
   IN  HTTP_TOKEN_WRAP   *Wrap
@@ -973,12 +975,16 @@ HttpResponseWorker (
   goto Error;
 }
 
 FreePool (HttpHeaders);
 HttpHeaders = NULL;
-
+
 HttpMsg->Data.Response->StatusCode = HttpMappingToStatusCode (StatusCode);
+if (StatusCode >= HTTP_ERROR_STATUS) {
+  Status = EFI_HTTP_ERROR;
+  goto Error;
+}
 
 //
 // Init message-body parser by header information.  
 //
 Status = EFI_NOT_READY;
@@ -1189,10 +1195,12 @@ Error:
   Token->Message->Data is NULL, but a previous 
call to
   Response() has not been completed 
successfully.
   @retval EFI_OUT_OF_RESOURCESCould not allocate enough system resources.
   @retval EFI_ACCESS_DENIED   An open TCP connection is not present with 
the host
   specified by response URL.
+  @retval EFI_HTTP_ERROR  A HTTP error occurred during the network 
operation. The response 
+  status code is returned in Token->Message-> 
Response->StatusCode.
 **/
 EFI_STATUS
 EFIAPI
 EfiHttpResponse (
   IN  EFI_HTTP_PROTOCOL *This,
diff --git a/NetworkPkg/HttpDxe/HttpImpl.h b/NetworkPkg/HttpDxe/HttpImpl.h 
index afbe982..5c159fc 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.h
+++ b/NetworkPkg/HttpDxe/HttpImpl.h
@@ -14,10 +14,11 @@
 **/
 
 #ifndef __EFI_HTTP_IMPL_H__
 #define __EFI_HTTP_IMPL_H__
 
+#define HTTP_ERROR_STATUS300
 #define HTTP_DEFAULT_PORT80
 #define HTTP_END_OF_HDR_STR  "\r\n\r\n"
 #define HTTP_CRLF_STR"\r\n"
 #define HTTP_VERSION_STR "HTTP/1.1"
 #define HTTP_VERSION_CRLF_STR" HTTP/1.1\r\n"
--
1.9.5.msysgit.1

___
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] [Patch] MdePkg: Remove magic number

2016-01-27 Thread Jiaxin Wu
This patch is used to update structure of
EFI_IP4_CONFIG2_INTERFACE_INFO to remove
magic number.

Cc: Fu Siyuan 
Cc: Ye Ting 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 
---
 MdePkg/Include/Protocol/Ip4Config2.h | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Include/Protocol/Ip4Config2.h 
b/MdePkg/Include/Protocol/Ip4Config2.h
index 383da8a..fca2bb5 100644
--- a/MdePkg/Include/Protocol/Ip4Config2.h
+++ b/MdePkg/Include/Protocol/Ip4Config2.h
@@ -1,10 +1,10 @@
 /** @file
   This file provides a definition of the EFI IPv4 Configuration II
   Protocol.
 
-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 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
 http://opensource.org/licenses/bsd-license.php
 
@@ -74,17 +74,22 @@ typedef enum {
   Ip4Config2DataTypeDnsServer,
   Ip4Config2DataTypeMaximum
 } EFI_IP4_CONFIG2_DATA_TYPE;
 
 ///
+/// EFI_IP4_CONFIG2_INTERFACE_INFO related definitions
+///
+#define EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE 32
+
+///
 /// EFI_IP4_CONFIG2_INTERFACE_INFO
 ///
 typedef struct {
   ///
   /// The name of the interface. It is a NULL-terminated Unicode string.
   ///
-  CHAR16Name[32];
+  CHAR16Name[EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE];
   ///
   /// The interface type of the network interface. See RFC 1700, 
   /// section "Number Hardware Type".
   ///
   UINT8 IfType;
-- 
1.9.5.msysgit.1

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


[edk2] [Patch] QuarkPlatformPkg: Add Readme.md for QuarkPlatformPkg

2016-01-27 Thread Michael Kinney
This patch adds a Readme.md file to the QuarkPlatformPkg.  
In order to support review, the same version of this Readme.md file can be
viewed at:

  https://github.com/mdkinney/mybooks/tree/master/Galileo


This Readme.md file contains hyperlinks to image files that are currently 
stored at following location to simulate images in a github wiki area.

  https://github.com/mdkinney/mybooks/wiki/Images

If this patch is accepted, then the image files would be added to folder of
the tianocore wiki and the links in this Readme.md file would be updated.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney 

Michael Kinney (1):
  QuarkPlatformPkg: Add Readme.md for QuarkPlatformPkg

 QuarkPlatformPkg/Readme.md | 666 +
 1 file changed, 666 insertions(+)
 create mode 100644 QuarkPlatformPkg/Readme.md

-- 
2.6.3.windows.1

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


[edk2] [Patch] QuarkPlatformPkg: Add Readme.md for QuarkPlatformPkg

2016-01-27 Thread Michael Kinney
Add a Readme.md for the QuarkPlatformPkg that describes how to
build, boot, debug, and enable/disable features for the
Intel(R) Galileo Development Board and the Intel(R) Galileo Gen 2
Development Board.

Cc: Kelly Steele 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney 
---
 QuarkPlatformPkg/Readme.md | 666 +
 1 file changed, 666 insertions(+)
 create mode 100644 QuarkPlatformPkg/Readme.md

diff --git a/QuarkPlatformPkg/Readme.md b/QuarkPlatformPkg/Readme.md
new file mode 100644
index 000..04582cd
--- /dev/null
+++ b/QuarkPlatformPkg/Readme.md
@@ -0,0 +1,666 @@
+# **EDK II firmware for Intel(R) Quark SoC X1000 based platforms**
+
+## **Features**
+* UEFI firmware image with ability to enable/disable major features such as
+- Logging
+- Source level debug using [Intel(R) UEFI Development Kit Debugger Tool](
+  
https://firmware.intel.com/develop/intel-uefi-tools-and-utilities/intel-uefi-development-kit-debugger-tool)
+- Boot Performance Measurements
+- UEFI Secure Boot with Physical Presence
+- TCG Measured Boot using TPM 1.2 hardware devices on I2C bus
+* Minimal firmware image for initial power-on and debug
+* UEFI Shell built into FLASH image
+* UEFI Linux operating system boot support from Micro SD FLASH
+* Hardware Support
+-  [Intel(R) Quark SoC X1000 CPU](
+   
http://www.intel.com/content/www/us/en/embedded/products/quark/quark-x1000-datasheet.html)
+-  [Intel(R) Galileo Development Board](
+   
http://www.intel.com/content/www/us/en/embedded/products/galileo/galileo-g1-datasheet.html)
+-  [Intel(R) Galileo Gen 2 Development Board](
+   
http://www.intel.com/content/www/us/en/embedded/products/galileo/galileo-overview.html)
+-  HPET Timer
+-  Real Time Clock
+* Major I/O Subsystems
+- PCI including support for Mini PCI Express Cards
+- USB using EHCI and OHCI host controllers
+- Micro SD FLASH with FAT file system support
+- Serial UART up to 921600 baud for console, logging, and debug
+* ACPI Tables with ACPI S3 sleep state support
+* SMBIOS Tables
+
+## **Windows Build Instructions**
+
+### Pre-requisites
+
+* GIT client: Available from https://git-scm.com/downloads
+* Microsoft Visual Studio.
+  - Visual Studio 2015 recommended and is used in the examples below.
+* Microsoft Windows Driver Development Kit 3790.1830
+  - 
http://download.microsoft.com/download/9/0/f/90f019ac-8243-48d3-91cf-81fc4093ecfd/1830_usa_ddk.iso
+  - Mount ISO image
+  - Right click on ```x86\kitsetup.exe``` & choose **Run as administrator**
+  - Install to C:\WINDDK\3790.1830
+  - Uncheck all Component Groups
+  - Expand Build Environment Component
+  - Check Windows Driver Development Kit 16-bit Additional Build Tools
+  - Install
+* ASL compiler: Available from http://www.acpica.org
+  - Install into ```C:\ASL``` to match default tools_def.txt configuration.
+
+Create a new directory for an EDK II WORKSPACE.
+
+The code block below shows the GIT clone operations required to pull the EDK II
+source tree, the FatPkg sources, the pre-built versions of BaseTools as WIN32
+binaries, and the edk2-non-osi repository that provides a binary file for the
+Quark Remote Management Unit (RMU).
+
+Next it sets environment variables that must be set before running
+```edksetup.bat```. Since content is being pulled from multiple repositories,
+the EDK II [Multiple Workspace](
+https://github.com/tianocore/tianocore.github.io/wiki/Multiple_Workspace)
+feature is used.
+
+Next, the ```edksetup.bat``` file is run to complete the initialization of an
+EDK II build environment.  Two example build commands are shown.  The first one
+in ```QuarkPlatformPlg/Quark.dsc``` builds a full UEFI firmware image that is
+able to boot the built-in UEFI Shell and Linux from a micro SD FLASH card.  The
+second one in ```QuarkPlatformPkg/QuarkMin.dsc``` builds a minimal firmware
+image that is useful for initial power-on and debug of new features.
+
+```cmd
+git clone https://github.com/tianocore/edk2.git
+git clone https://github.com/tianocore/edk2-FatPkg.git FatPkg
+git clone https://github.com/tianocore/edk2-BaseTools-win32.git
+git clone https://github.com/tianocore/edk2-non-osi.git
+
+set WORKSPACE=%CD%
+set PACKAGES_PATH=%WORKSPACE%\edk2;%WORKSPACE%\edk2-non-osi
+set EDK_TOOLS_BIN=%WORKSPACE%\edk2-BaseTools-win32
+
+cd edk2
+edksetup.bat
+
+build -a IA32 -t VS2015x86 -p QuarkPlatformPkg/Quark.dsc
+build -a IA32 -t VS2015x86 -p QuarkPlatformPkg/QuarkMin.dsc
+```
+
+## **Linux Build Instructions**
+
+### Pre-requisites
+
+* GIT client
+* GCC 4.9 compiler
+* ASL compiler: Available from http://www.acpica.org.
+
+Create a new directory for an EDK II WORKSPACE.
+
+The code block below shows the GIT clone operations required to pull the EDK II
+source tree, the FatPkg sources, and the edk2-non-osi repository 

Re: [edk2] [Patch] BaseTools: Fix the bug for VOID* Patchable PCD declaration in Library

2016-01-27 Thread Scott Duplichan
Laszlo Ersek [mailto:ler...@redhat.com] wrote:

]Sent: Wednesday, January 27, 2016 05:57 PM
]To: Andrew Fish 
]Cc: Yonghong Zhu ; edk2-de...@ml01.01.org; Scott 
Duplichan 
]Subject: Re: [edk2] [Patch] BaseTools: Fix the bug for VOID* Patchable PCD 
declaration in Library
]
]On 01/28/16 00:10, Andrew Fish wrote:
]> 
]>> On Jan 27, 2016, at 9:33 AM, Laszlo Ersek  wrote:
]>>
]>> On 01/27/16 10:18, Yonghong Zhu wrote:
]>>> VOID* Patchable PCD in Library has the different declaration from the
]>>> one in Driver, this issue that will cause GCC LTO build failure.
]>>
]>> Wow, you managed to build edk2 modules with -flto? How? Is that going to
]>> be added to BaseTools?
]>>
]> 
]> Laszlo,
]> 
]> I can tell you what you need to do for Xcode.
]> DLINK flag you add: -object_path_lto $(DEST_DIR_DEBUG)/$(BASE_NAME).lto
]> This is only needed for source level debug. 
]> 
]> Adding -flto to the CC_FLAGS makes the compiler emit LLVM, and if you do 
this the linker knows what to do. ]And you can do the reverse and set -fno-lto 
to turn it off, as last flag wins. So for example you can turn ]it by adding to 
the CC_FLAG in your platform DSC if you want to test. 
]> 
]> Note sure how it works with GCC. 
]
]Thank you for these hints, although I've never tried clang.
]
]I vaguely recall someone had looked into this for gcc (maybe Scott?
]that's why I CC'd him), but I don't remember why it didn't work out
]ultimately.
]
]Ah, right, here it is:
]
]http://thread.gmane.org/gmane.comp.bios.tianocore.devel/17382
]
]... It looks complicated. I fail to distill a clear idea of why that
]patch wasn't merged.

I think the reason the patch was never merged is that it is indeed
complicated, and without someone really pushing for it, a complicated
change doesn't get committed. Until fairly recently, the dramatic 
code size reduction brought by -flto would justify the added complexity.
I think today the decline in flash chip prices has reduced the urgency
to reduce UEFI code size. For many applications, -flto can improve
performance. But because UEFI execution time is I/O bound in so many
cases, -flto isn't going to produce faster code. The one benefit I can
think of is boot time reduction due to reading a smaller FV from the
relatively slow flash chip.

Why is using -flto with UEFI complicated? Using -flto with application
code is easy. The reason is because UEFI does some unusual things. One
unusual thing UEFI does is use its own libraries for resolving compiler
generated helper function calls. To link -flto objects with libraries, a
special prefix on the linker command line (-Wl,-plugin-opt=-pass-through=)
is needed. For an application build, gcc invokes the linker and takes care
of this requirement by passing -Wl,-plugin-opt=-pass-through= along with
its own library path. Because UEFI uses its own helper function libs, it
is up to us to us to build the corresponding path to use with the pass
through option on the linker command line. The UEFI build tools have no
mechanism for doing this. The patches I made do not solve this problem,
but rather work around it by disabling -flto for code that calls these
functions. While gcc generates few helper function calls for X64, the
same is not true for ARM.

Even trying to disable -flto for a file presents a problem. Adding
GCC:*_*_*_CC_FLAGS = -fno-lto doesn't work because GCC44 fails when
an unknown flag is encountered.

Another concern is debugging. GCC docs still say:
Link-time optimization does not work well with generation of
debugging information. Combining -flto with -g is currently
experimental and expected to produce unexpected results.
Because of this, there needs to be some ways to easily toggle the
gcc -flto feature for UEFI builds. Certainly NOOPT builds can omit
-flto. But I worry about forcing -flto for DEBUG or RELEASE builds.
I had used an environment variable to pass extra gcc flags so that
something like GCC_EXTRA_CC_FLAGS=-fno-lto could be used to
temporarily disable link time optimization. But that idea was
rejected.

Another consideration is the -flto requirement to pass compiler flags
to the link step. While this is doable without significant modification
to the UEFI build system, it does add complexity.

Use of -flto does trigger a few new warnings. Some seem to be caused
when a function from one compilation unit resolves a call from a
different compilation unit. For C code, it should be possible to link
even when the two compilation units use different function prototypes.
But use of -flto triggers a warning. While this is a useful warning
(or was it an error, I don't remember), I think it is incorrect. 

Those are the sorts of challenges I can remember. Some notes are here:
Skip over the first part about building gcc itself:
http://notabs.org/uefi/gcc-lto.htm

Thanks,
Scott





]Thanks
]Laszlo
]
]> 
]> Thanks,
]> 
]> Andrew Fish
]> 
]>> Thanks!
]>> Laszlo
]>>
]>>>
]>>> 

Re: [edk2] [Patch] BaseTools: Fix the bug for VOID* Patchable PCD declaration in Library

2016-01-27 Thread Laszlo Ersek
On 01/27/16 10:18, Yonghong Zhu wrote:
> VOID* Patchable PCD in Library has the different declaration from the
> one in Driver, this issue that will cause GCC LTO build failure.

Wow, you managed to build edk2 modules with -flto? How? Is that going to
be added to BaseTools?

Thanks!
Laszlo

> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu 
> ---
>  BaseTools/Source/Python/AutoGen/GenC.py | 15 ---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenC.py 
> b/BaseTools/Source/Python/AutoGen/GenC.py
> index 93be718..3f0dfd9 100644
> --- a/BaseTools/Source/Python/AutoGen/GenC.py
> +++ b/BaseTools/Source/Python/AutoGen/GenC.py
> @@ -1,9 +1,9 @@
>  ## @file
>  # Routines for generating AutoGen.h and AutoGen.c
>  #
> -# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
> +# Copyright (c) 2007 - 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
>  # http://opensource.org/licenses/bsd-license.php
>  #
> @@ -1097,11 +1097,12 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, 
> Pcd):
>  GetModeSizeName = '_PCD_GET_MODE_SIZE' + '_' + Pcd.TokenCName
>  
>  Type = ''
>  Array = ''
>  if Pcd.DatumType == 'VOID*':
> -Type = '(VOID *)'
> +if Pcd.DefaultValue[0]== '{':
> +Type = '(VOID *)'
>  Array = '[]'
>  PcdItemType = Pcd.Type
>  PcdExCNameList  = []
>  if PcdItemType in gDynamicExPcd:
>  PcdExTokenName = '_PCD_TOKEN_' + TokenSpaceGuidCName + '_' + 
> Pcd.TokenCName
> @@ -1159,11 +1160,19 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, 
> Pcd):
>  else:
>  AutoGenH.Append('#define %s(Value)  LibPcdSet%s(%s, 
> (Value))\n' % (SetModeName, DatumSizeLib, PcdTokenName))
>  AutoGenH.Append('#define %s(Value)  LibPcdSet%sS(%s, 
> (Value))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName))
>  if PcdItemType == TAB_PCDS_PATCHABLE_IN_MODULE:
>  PcdVariableName = '_gPcd_' + 
> gItemTypeStringDatabase[TAB_PCDS_PATCHABLE_IN_MODULE] + '_' + TokenCName
> -AutoGenH.Append('extern volatile %s _gPcd_BinaryPatch_%s%s;\n' 
> %(DatumType, TokenCName, Array) )
> +if DatumType == 'VOID*':
> +ArraySize = int(Pcd.MaxDatumSize, 0)
> +if Pcd.DefaultValue[0] == 'L':
> +ArraySize = ArraySize / 2
> +Array = '[%d]' % ArraySize
> +DatumType = ['UINT8', 'UINT16'][Pcd.DefaultValue[0] == 'L']
> +AutoGenH.Append('extern %s _gPcd_BinaryPatch_%s%s;\n' 
> %(DatumType, TokenCName, Array))
> +else:
> +AutoGenH.Append('extern volatile  %s  %s%s;\n' % (DatumType, 
> PcdVariableName, Array))
>  AutoGenH.Append('#define %s  %s_gPcd_BinaryPatch_%s\n' 
> %(GetModeName, Type, TokenCName))
>  if Pcd.DatumType == 'VOID*':
>  AutoGenH.Append('#define %s(SizeOfBuffer, Buffer)  
> LibPatchPcdSetPtrAndSize((VOID *)_gPcd_BinaryPatch_%s, 
> &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), 
> (Buffer))\n' % (SetModeName, Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName))
>  AutoGenH.Append('#define %s(SizeOfBuffer, Buffer)  
> LibPatchPcdSetPtrAndSizeS((VOID *)_gPcd_BinaryPatch_%s, 
> &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), 
> (Buffer))\n' % (SetModeStatusName, Pcd.TokenCName, Pcd.TokenCName, 
> Pcd.TokenCName))
>  else:
> 

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


Re: [edk2] [Patch] PcAtChipsetPkg/Rtc: Don't unnecessarily create timezone variable.

2016-01-27 Thread Tian, Feng
Looks good to me. Reviewed-by: Feng Tian 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ruiyu Ni
Sent: Thursday, January 28, 2016 10:22
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu; Tian, Feng
Subject: [edk2] [Patch] PcAtChipsetPkg/Rtc: Don't unnecessarily create timezone 
variable.

When SetTime() is called with EFI_UNSPECIFIED_TIMEZONE, the code can optimally 
not create the private timezone variable because absence of timezone variable 
indicates the timezone is unspecified.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Feng Tian 
---
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 81 ++
 1 file changed, 38 insertions(+), 43 deletions(-)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index bf22176..acc70a6 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -1,7 +1,7 @@
 /** @file
   RTC Architectural Protocol GUID as defined in DxeCis 0.96.
 
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 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 @@ -14,6 +14,16 @@ 
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 #include "PcRtc.h"
 
+//
+// Days of month.
+//
+UINTN mDayOfMonth[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 
+};
+
+//
+// The name of NV variable to store the timezone and daylight saving 
information.
+//
+CHAR16 mTimeZoneVariableName[] = L"RTC";
+
 /**
   Compare the Hour, Minute and Second of the From time and the To time.
   
@@ -182,11 +192,11 @@ PcRtcInit (
   //
   DataSize = sizeof (UINT32);
   Status = EfiGetVariable (
- L"RTC",
+ mTimeZoneVariableName,
  ,
  NULL,
  ,
- (VOID *) 
+ 
  );
   if (!EFI_ERROR (Status)) {
 Time.TimeZone = (INT16) TimerVar;
@@ -477,15 +487,29 @@ PcRtcSetTime (
   //
   // Write timezone and daylight to RTC variable
   //
-  TimerVar = Time->Daylight;
-  TimerVar = (UINT32) ((TimerVar << 16) | (UINT16)(Time->TimeZone));
-  Status =  EfiSetVariable (
-  L"RTC",
-  ,
-  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | 
EFI_VARIABLE_NON_VOLATILE,
-  sizeof (TimerVar),
-  
-  );
+  if (Time->TimeZone == EFI_UNSPECIFIED_TIMEZONE) {
+Status = EfiSetVariable (
+   mTimeZoneVariableName,
+   ,
+   0,
+   0,
+   NULL
+   );
+if (Status == EFI_NOT_FOUND) {
+  Status = EFI_SUCCESS;
+}
+  } else {
+TimerVar = Time->Daylight;
+TimerVar = (UINT32) ((TimerVar << 16) | (UINT16)(Time->TimeZone));
+Status = EfiSetVariable (
+   mTimeZoneVariableName,
+   ,
+   EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | 
EFI_VARIABLE_NON_VOLATILE,
+   sizeof (TimerVar),
+   
+   );
+  }
+
   if (EFI_ERROR (Status)) {
 if (!EfiAtRuntime ()) {
   EfiReleaseLock (>RtcLock); @@ -987,28 +1011,13 @@ DayValid (
   IN  EFI_TIME  *Time
   )
 {
-  INTN  DayOfMonth[12];
-
-  DayOfMonth[0] = 31;
-  DayOfMonth[1] = 29;
-  DayOfMonth[2] = 31;
-  DayOfMonth[3] = 30;
-  DayOfMonth[4] = 31;
-  DayOfMonth[5] = 30;
-  DayOfMonth[6] = 31;
-  DayOfMonth[7] = 31;
-  DayOfMonth[8] = 30;
-  DayOfMonth[9] = 31;
-  DayOfMonth[10] = 30;
-  DayOfMonth[11] = 31;
-
   //
   // The validity of Time->Month field should be checked before
   //
   ASSERT (Time->Month >=1);
   ASSERT (Time->Month <=12);
   if (Time->Day < 1 ||
-  Time->Day > DayOfMonth[Time->Month - 1] ||
+  Time->Day > mDayOfMonth[Time->Month - 1] ||
   (Time->Month == 2 && (!IsLeapYear (Time) && Time->Day > 28))
   ) {
 return FALSE;
@@ -1144,22 +1153,8 @@ IsWithinOneDay (
   IN EFI_TIME  *To
   )
 {
-  UINT8   DayOfMonth[12];
   BOOLEAN Adjacent;
 
-  DayOfMonth[0] = 31;
-  DayOfMonth[1] = 29;
-  DayOfMonth[2] = 31;
-  DayOfMonth[3] = 30;
-  DayOfMonth[4] = 31;
-  DayOfMonth[5] = 30;
-  DayOfMonth[6] = 31;
-  DayOfMonth[7] = 31;
-  DayOfMonth[8] = 30;
-  DayOfMonth[9] = 31;
-  DayOfMonth[10] = 30;
-  DayOfMonth[11] = 31;
-
   Adjacent = FALSE;
 
   //
@@ -1186,7 +1181,7 @@ IsWithinOneDay (
 Adjacent = TRUE;
   }
 }
-  } else if (From->Day == DayOfMonth[From->Month - 1]) {
+  } else if (From->Day == mDayOfMonth[From->Month - 1]) {
 if ((CompareHMS(From, To) >= 0)) {
Adjacent = TRUE;
 }
--

Re: [edk2] [patch] NetworkPkg: change HTTP API typos.

2016-01-27 Thread Fu, Siyuan
Hi, Lubo

I have 2 comments as below:
1. The " HttpConfigData != NULL " is redundant in below code.
+  // Check input parameters.
+  //
+  if (This == NULL ||
+  HttpConfigData == NULL ||
+ (HttpConfigData != NULL && ((HttpConfigData->LocalAddressIsIPv6 && 
HttpConfigData->AccessPoint.IPv6Node == NULL) ||
+ (!HttpConfigData->LocalAddressIsIPv6 
+ && HttpConfigData->AccessPoint.IPv4Node == NULL {

2. You should check the LocalAddressIsIPv6 according to the driver's current 
mode data, not from user input. The HttpConfigData is an OUT parameter, it 
doesn't contain any meaningful value.

EfiHttpGetModeData (
   IN  EFI_HTTP_PROTOCOL *This,
   OUT EFI_HTTP_CONFIG_DATA  *HttpConfigData
   ) 

Siyuan

-Original Message-
From: Zhang, Lubo 
Sent: Tuesday, January 26, 2016 5:27 PM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan ; Ye, Ting ; Wu, Jiaxin 

Subject: [patch] NetworkPkg: change HTTP API typos.

change HTTP API typos and clarify returned status code in HTTP API.

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/HttpDxe/HttpImpl.c | 47 ---
 NetworkPkg/HttpDxe/HttpImpl.h | 18 +
 2 files changed, 32 insertions(+), 33 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c 
index aee3de5..b24670e 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -37,27 +37,33 @@ EFI_HTTP_PROTOCOL  mEfiHttpTemplate = {
 
   @retval EFI_SUCCESS Operation succeeded.
   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is 
TRUE:
   This is NULL.
   HttpConfigData is NULL.
-  HttpConfigData->AccessPoint is NULL.
-  @retval EFI_OUT_OF_RESOURCESCould not allocate enough system resources.
-  @retval EFI_NOT_STARTED The HTTP instance is not configured.
+  HttpConfigData->LocalAddressIsIPv6 is FALSE 
and
+  HttpConfigData->IPv4Node is NULL.
+  HttpConfigData->LocalAddressIsIPv6 is TRUE 
and
+  HttpConfigData->IPv6Node is NULL.
+  @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been 
started.
 
 **/
 EFI_STATUS
 EFIAPI
 EfiHttpGetModeData (
   IN  EFI_HTTP_PROTOCOL *This,
   OUT EFI_HTTP_CONFIG_DATA  *HttpConfigData
   )
 {
   HTTP_PROTOCOL *HttpInstance;
-  EFI_HTTPv4_ACCESS_POINT   *Http4AccessPoint;
-  EFI_HTTPv6_ACCESS_POINT   *Http6AccessPoint;
-
-  if ((This == NULL) || (HttpConfigData == NULL)) {
+  
+  //
+  // Check input parameters.
+  //
+  if (This == NULL ||
+  HttpConfigData == NULL ||
+ (HttpConfigData != NULL && ((HttpConfigData->LocalAddressIsIPv6 && 
HttpConfigData->AccessPoint.IPv6Node == NULL) ||
+ (!HttpConfigData->LocalAddressIsIPv6 
+ && HttpConfigData->AccessPoint.IPv4Node == NULL {
 return EFI_INVALID_PARAMETER;
   }
   
   HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
   ASSERT (HttpInstance != NULL);
@@ -69,31 +75,21 @@ EfiHttpGetModeData (
   HttpConfigData->HttpVersion= HttpInstance->HttpVersion;
   HttpConfigData->TimeOutMillisec= HttpInstance->TimeOutMillisec;
   HttpConfigData->LocalAddressIsIPv6 = HttpInstance->LocalAddressIsIPv6;
 
   if (HttpInstance->LocalAddressIsIPv6) {
-Http6AccessPoint = AllocateZeroPool (sizeof (EFI_HTTPv6_ACCESS_POINT));
-if (Http6AccessPoint == NULL) {
-  return EFI_OUT_OF_RESOURCES;
-}
 CopyMem (
-  Http6AccessPoint,
+  HttpConfigData->AccessPoint.IPv6Node,
   >Ipv6Node,
   sizeof (HttpInstance->Ipv6Node)
 );
-HttpConfigData->AccessPoint.IPv6Node = Http6AccessPoint;
   } else {
-Http4AccessPoint = AllocateZeroPool (sizeof (EFI_HTTPv4_ACCESS_POINT));
-if (Http4AccessPoint == NULL) {
-  return EFI_OUT_OF_RESOURCES;
-}
 CopyMem (
-  Http4AccessPoint,
+  HttpConfigData->AccessPoint.IPv4Node,
   >IPv4Node,
   sizeof (HttpInstance->IPv4Node)
   );
-HttpConfigData->AccessPoint.IPv4Node = Http4AccessPoint;
   }
 
   return EFI_SUCCESS;
 }
 
@@ -105,19 +101,20 @@ EfiHttpGetModeData (
   timeout, local address, port, etc.
   When HttpConfigData is NULL, reset this EFI HTTP instance by closing all 
active
   connections with remote hosts, canceling all asynchronous tokens, and flush 
request
   and response buffers without informing the appropriate hosts.
 
-  Except for GetModeData() and Configure(), No other EFI HTTP function can be 
executed
-  by this instance until the Configure() function is 

[edk2] [PATCH 1/3] MdePkg: Minor update to the Data parameter for GetVariable()

2016-01-27 Thread Star Zeng
UEFI 2.6 spec has minor update to the Data parameter for GetVariable(),
and no real functional behavior change.

The modifier of Data parameter:
OUT VOID *Data
->
OUT VOID *Data OPTIONAL

The comments of Data parameter:
DataThe buffer to return the contents of the variable.
->
DataThe buffer to return the contents of the variable. May be NULL
with a zero DataSize in order to determine the size buffer needed.

The patch is to follow the spec to update the definition.

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
 MdePkg/Include/Uefi/UefiSpec.h | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h
index 909b8a1..14ffc60 100644
--- a/MdePkg/Include/Uefi/UefiSpec.h
+++ b/MdePkg/Include/Uefi/UefiSpec.h
@@ -5,7 +5,7 @@
   If a code construct is defined in the UEFI 2.5 specification it must be 
included
   by this include file.
 
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 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 that accompanies this 
distribution.  
 The full text of the license may be found at
@@ -628,7 +628,8 @@ VOID
  attributes bitmask for the variable.
   @param[in, out]  DataSize  On input, the size in bytes of the return 
Data buffer.
  On output the size of data returned in Data.
-  @param[out]  Data  The buffer to return the contents of the 
variable.
+  @param[out]  Data  The buffer to return the contents of the 
variable. May be NULL
+ with a zero DataSize in order to determine 
the size buffer needed.
 
   @retval EFI_SUCCESSThe function completed successfully.
   @retval EFI_NOT_FOUND  The variable was not found.
@@ -648,7 +649,7 @@ EFI_STATUS
   IN EFI_GUID*VendorGuid,
   OUTUINT32  *Attributes,OPTIONAL
   IN OUT UINTN   *DataSize,
-  OUTVOID*Data
+  OUTVOID*Data   OPTIONAL
   );
 
 /**
-- 
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] NetworkPkg: change HTTP API typos.

2016-01-27 Thread Zhang Lubo
v2:
* Correct errors in HttpGetModeData()

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/HttpDxe/HttpImpl.c | 49 +--
 NetworkPkg/HttpDxe/HttpImpl.h | 18 +---
 2 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index aee3de5..4cd6336 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -37,63 +37,61 @@ EFI_HTTP_PROTOCOL  mEfiHttpTemplate = {
 
   @retval EFI_SUCCESS Operation succeeded.
   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is 
TRUE:
   This is NULL.
   HttpConfigData is NULL.
-  HttpConfigData->AccessPoint is NULL.
-  @retval EFI_OUT_OF_RESOURCESCould not allocate enough system resources.
-  @retval EFI_NOT_STARTED The HTTP instance is not configured.
+  HttpInstance->LocalAddressIsIPv6 is FALSE and
+  HttpConfigData->IPv4Node is NULL.
+  HttpInstance->LocalAddressIsIPv6 is TRUE and
+  HttpConfigData->IPv6Node is NULL.
+  @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been 
started.
 
 **/
 EFI_STATUS
 EFIAPI
 EfiHttpGetModeData (
   IN  EFI_HTTP_PROTOCOL *This,
   OUT EFI_HTTP_CONFIG_DATA  *HttpConfigData
   )
 {
   HTTP_PROTOCOL *HttpInstance;
-  EFI_HTTPv4_ACCESS_POINT   *Http4AccessPoint;
-  EFI_HTTPv6_ACCESS_POINT   *Http6AccessPoint;
-
-  if ((This == NULL) || (HttpConfigData == NULL)) {
+  
+  //
+  // Check input parameters.
+  //
+  if (This == NULL || HttpConfigData == NULL) {
 return EFI_INVALID_PARAMETER;
   }
   
   HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
   ASSERT (HttpInstance != NULL);
   
+  if ((HttpInstance->LocalAddressIsIPv6 && 
HttpConfigData->AccessPoint.IPv6Node == NULL) ||
+  (!HttpInstance->LocalAddressIsIPv6 && 
HttpConfigData->AccessPoint.IPv4Node == NULL)) {
+return EFI_INVALID_PARAMETER;
+  }
+  
   if (HttpInstance->State < HTTP_STATE_HTTP_CONFIGED) {
 return EFI_NOT_STARTED;
   }
 
   HttpConfigData->HttpVersion= HttpInstance->HttpVersion;
   HttpConfigData->TimeOutMillisec= HttpInstance->TimeOutMillisec;
   HttpConfigData->LocalAddressIsIPv6 = HttpInstance->LocalAddressIsIPv6;
 
   if (HttpInstance->LocalAddressIsIPv6) {
-Http6AccessPoint = AllocateZeroPool (sizeof (EFI_HTTPv6_ACCESS_POINT));
-if (Http6AccessPoint == NULL) {
-  return EFI_OUT_OF_RESOURCES;
-}
 CopyMem (
-  Http6AccessPoint,
+  HttpConfigData->AccessPoint.IPv6Node,
   >Ipv6Node,
   sizeof (HttpInstance->Ipv6Node)
 );
-HttpConfigData->AccessPoint.IPv6Node = Http6AccessPoint;
   } else {
-Http4AccessPoint = AllocateZeroPool (sizeof (EFI_HTTPv4_ACCESS_POINT));
-if (Http4AccessPoint == NULL) {
-  return EFI_OUT_OF_RESOURCES;
-}
 CopyMem (
-  Http4AccessPoint,
+  HttpConfigData->AccessPoint.IPv4Node,
   >IPv4Node,
   sizeof (HttpInstance->IPv4Node)
   );
-HttpConfigData->AccessPoint.IPv4Node = Http4AccessPoint;
   }
 
   return EFI_SUCCESS;
 }
 
@@ -105,19 +103,20 @@ EfiHttpGetModeData (
   timeout, local address, port, etc.
   When HttpConfigData is NULL, reset this EFI HTTP instance by closing all 
active
   connections with remote hosts, canceling all asynchronous tokens, and flush 
request
   and response buffers without informing the appropriate hosts.
 
-  Except for GetModeData() and Configure(), No other EFI HTTP function can be 
executed
-  by this instance until the Configure() function is executed and returns 
successfully.
+  No other EFI HTTP function can be executed by this instance until the 
Configure()
+  function is executed and returns successfully.
 
   @param[in]  ThisPointer to EFI_HTTP_PROTOCOL instance.
   @param[in]  HttpConfigData  Pointer to the configure data to configure 
the instance.
 
   @retval EFI_SUCCESS Operation succeeded.
   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is 
TRUE:
   This is NULL.
+  HttpConfigData is NULL.
   HttpConfigData->LocalAddressIsIPv6 is FALSE 
and
   HttpConfigData->IPv4Node is NULL.
   HttpConfigData->LocalAddressIsIPv6 is TRUE 
and
   HttpConfigData->IPv6Node is NULL.
   @retval EFI_ALREADY_STARTED Reinitialize this HTTP instance without 
calling
@@ -139,11 +138,12 @@ EfiHttpConfigure (
   EFI_STATUS 

Re: [edk2] [patch 2/2] NetworkPkg:Add a new error status code EFI_HTTP_ERROR

2016-01-27 Thread Fu, Siyuan
Hi, Lubo

The "goto Error" in below code skips the body receive logic, while most of the 
error response message are allowed to have a message body according to RFC.
+if (StatusCode >= HTTP_ERROR_STATUS) {
+  Status = EFI_HTTP_ERROR;
+  goto Error;
+}

Siyuan

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Zhang 
Lubo
Sent: Wednesday, January 27, 2016 3:28 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; Fu, Siyuan ; Wu, Jiaxin 

Subject: [edk2] [patch 2/2] NetworkPkg:Add a new error status code 
EFI_HTTP_ERROR

Add a new error status code EFI_HTTP_ERROR in corresponding with the UEFI 2.6 
spec, when
EFI_HTTP_PROTOCOL.Response() is called and the protocol interface encounter a 
HTTP error, it should return the new error status to the caller.

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/HttpBootDxe/HttpBootSupport.c |  4 +---
 NetworkPkg/HttpDxe/HttpImpl.c| 10 +-
 NetworkPkg/HttpDxe/HttpImpl.h|  1 +
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
index f9bbe4b..38743c6 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
@@ -974,13 +974,11 @@ HttpIoRecvResponse (
   Status = HttpIo->RspToken.Status;
   if (!EFI_ERROR (Status)) {
 ResponseData->HeaderCount = HttpIo->RspToken.Message->HeaderCount;
 ResponseData->Headers = HttpIo->RspToken.Message->Headers;
 ResponseData->BodyLength  = HttpIo->RspToken.Message->BodyLength;
-  }
-
-  if (RecvMsgHeader) {
+  } else if (Status == EFI_HTTP_ERROR) {
 StatusCode = HttpIo->RspToken.Message->Data.Response->StatusCode;
 HttpBootPrintErrorMessage (StatusCode);
   }
 
   return Status;
diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c 
index aee3de5..3ea95b6 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -814,10 +814,12 @@ HttpBodyParserCallback (
 
   @retval EFI_SUCCESS Allocation succeeded.
   @retval EFI_OUT_OF_RESOURCESFailed to complete the opration due to lack 
of resources.
   @retval EFI_NOT_READY   Can't find a corresponding Tx4Token/Tx6Token 
or 
   the EFI_HTTP_UTILITIES_PROTOCOL is not 
available.
+  @retval EFI_HTTP_ERROR  A HTTP error occurred during the network 
operation. The response 
+  status code is returned in Token->Message-> 
Response->StatusCode.
 
 **/
 EFI_STATUS
 HttpResponseWorker (
   IN  HTTP_TOKEN_WRAP   *Wrap
@@ -973,12 +975,16 @@ HttpResponseWorker (
   goto Error;
 }
 
 FreePool (HttpHeaders);
 HttpHeaders = NULL;
-
+
 HttpMsg->Data.Response->StatusCode = HttpMappingToStatusCode (StatusCode);
+if (StatusCode >= HTTP_ERROR_STATUS) {
+  Status = EFI_HTTP_ERROR;
+  goto Error;
+}
 
 //
 // Init message-body parser by header information.  
 //
 Status = EFI_NOT_READY;
@@ -1189,10 +1195,12 @@ Error:
   Token->Message->Data is NULL, but a previous 
call to
   Response() has not been completed 
successfully.
   @retval EFI_OUT_OF_RESOURCESCould not allocate enough system resources.
   @retval EFI_ACCESS_DENIED   An open TCP connection is not present with 
the host
   specified by response URL.
+  @retval EFI_HTTP_ERROR  A HTTP error occurred during the network 
operation. The response 
+  status code is returned in Token->Message-> 
Response->StatusCode.
 **/
 EFI_STATUS
 EFIAPI
 EfiHttpResponse (
   IN  EFI_HTTP_PROTOCOL *This,
diff --git a/NetworkPkg/HttpDxe/HttpImpl.h b/NetworkPkg/HttpDxe/HttpImpl.h 
index afbe982..5c159fc 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.h
+++ b/NetworkPkg/HttpDxe/HttpImpl.h
@@ -14,10 +14,11 @@
 **/
 
 #ifndef __EFI_HTTP_IMPL_H__
 #define __EFI_HTTP_IMPL_H__
 
+#define HTTP_ERROR_STATUS300
 #define HTTP_DEFAULT_PORT80
 #define HTTP_END_OF_HDR_STR  "\r\n\r\n"
 #define HTTP_CRLF_STR"\r\n"
 #define HTTP_VERSION_STR "HTTP/1.1"
 #define HTTP_VERSION_CRLF_STR" HTTP/1.1\r\n"
--
1.9.5.msysgit.1

___
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] [PATCH 0/3] Minor update to the Data parameter for GetVariable()

2016-01-27 Thread Star Zeng
UEFI 2.6 spec has minor update to the Data parameter for GetVariable(),
and no real functional behavior change.

The modifier of Data parameter:
OUT VOID *Data
->
OUT VOID *Data OPTIONAL

The comments of Data parameter:
DataThe buffer to return the contents of the variable.
->
DataThe buffer to return the contents of the variable. May be NULL
with a zero DataSize in order to determine the size buffer needed.

The patches are to follow the spec to update the definition and implementation.

Star Zeng (3):
  MdePkg: Minor update to the Data parameter for GetVariable()
  MdeModulePkg Variable: Minor update to the Data parameter for
GetVariable()
  DuetPkg FSVariable: Minor update to the Data parameter for
GetVariable()

 DuetPkg/FSVariable/FSVariable.c  | 7 ---
 MdeModulePkg/Universal/Variable/EmuRuntimeDxe/InitVariable.c | 7 ---
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c| 5 +++--
 MdePkg/Include/Uefi/UefiSpec.h   | 7 ---
 4 files changed, 15 insertions(+), 11 deletions(-)

-- 
2.7.0.windows.1

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


[edk2] [PATCH 3/3] DuetPkg FSVariable: Minor update to the Data parameter for GetVariable()

2016-01-27 Thread Star Zeng
UEFI 2.6 spec has minor update to the Data parameter for GetVariable(),
and no real functional behavior change.

The modifier of Data parameter:
OUT VOID *Data
->
OUT VOID *Data OPTIONAL

The comments of Data parameter:
DataThe buffer to return the contents of the variable.
->
DataThe buffer to return the contents of the variable. May be NULL
with a zero DataSize in order to determine the size buffer needed.

The patch is to follow the spec to update the implementation.

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
 DuetPkg/FSVariable/FSVariable.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/DuetPkg/FSVariable/FSVariable.c b/DuetPkg/FSVariable/FSVariable.c
index 5e72f9f..06df161 100644
--- a/DuetPkg/FSVariable/FSVariable.c
+++ b/DuetPkg/FSVariable/FSVariable.c
@@ -6,7 +6,7 @@ disk. They can be changed by user. BIOS is not able to protoect 
those.
 Duet trusts all meta data from disk. If variable code, variable metadata and 
variable
 data is modified in inproper way, the behavior is undefined.
 
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 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
@@ -1305,7 +1305,7 @@ DuetGetVariable (
   IN  EFI_GUID  *VendorGuid,
   OUT UINT32*Attributes OPTIONAL,
   IN OUT  UINTN *DataSize,
-  OUT VOID  *Data
+  OUT VOID  *Data OPTIONAL
   )
 /*++
 
@@ -1320,7 +1320,8 @@ Arguments:
   Attributes OPTIONAL Attribute value of the variable found
   DataSizeSize of Data found. If size is less than the
   data, this value contains the required size.
-  DataData pointer
+  DataThe buffer to return the contents of the 
variable. May be NULL
+  with a zero DataSize in order to determine 
the size buffer needed.
 
 Returns:
 
-- 
2.7.0.windows.1

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


[edk2] [PATCH 2/3] MdeModulePkg Variable: Minor update to the Data parameter for GetVariable()

2016-01-27 Thread Star Zeng
UEFI 2.6 spec has minor update to the Data parameter for GetVariable(),
and no real functional behavior change.

The modifier of Data parameter:
OUT VOID *Data
->
OUT VOID *Data OPTIONAL

The comments of Data parameter:
DataThe buffer to return the contents of the variable.
->
DataThe buffer to return the contents of the variable. May be NULL
with a zero DataSize in order to determine the size buffer needed.

The patch is to follow the spec to update the implementation.

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Universal/Variable/EmuRuntimeDxe/InitVariable.c | 7 ---
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c| 5 +++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/InitVariable.c 
b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/InitVariable.c
index d636fcf..1feedc0 100644
--- a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/InitVariable.c
+++ b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/InitVariable.c
@@ -3,7 +3,7 @@
   Implment all four UEFI runtime variable services and 
   install variable architeture protocol.
   
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 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
@@ -27,7 +27,8 @@ EFI_EVENT   mVirtualAddressChangeEvent = NULL;
   @param Attributes Attribute value of the variable found.
   @param DataSize   Size of Data found. If size is less than 
the
 data, this value contains the required 
size.
-  @param Data   Data pointer.
+  @param Data   The buffer to return the contents of the 
variable. May be NULL
+with a zero DataSize in order to determine 
the size buffer needed.
   
   @return EFI_INVALID_PARAMETER Invalid parameter
   @return EFI_SUCCESS   Find the specified variable
@@ -42,7 +43,7 @@ RuntimeServiceGetVariable (
   IN EFI_GUID  *VendorGuid,
   OUT UINT32   *Attributes OPTIONAL,
   IN OUT UINTN *DataSize,
-  OUT VOID *Data
+  OUT VOID *Data OPTIONAL
   )
 {
   return EmuGetVariable (
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index 5e39d44..3f0240b 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -2822,7 +2822,8 @@ Done:
   @param Attributes Attribute value of the variable found.
   @param DataSize   Size of Data found. If size is less than 
the
 data, this value contains the required 
size.
-  @param Data   Data pointer.
+  @param Data   The buffer to return the contents of the 
variable. May be NULL
+with a zero DataSize in order to determine 
the size buffer needed.
 
   @return EFI_INVALID_PARAMETER Invalid parameter.
   @return EFI_SUCCESS   Find the specified variable.
@@ -2837,7 +2838,7 @@ VariableServiceGetVariable (
   IN  EFI_GUID  *VendorGuid,
   OUT UINT32*Attributes OPTIONAL,
   IN OUT  UINTN *DataSize,
-  OUT VOID  *Data
+  OUT VOID  *Data OPTIONAL
   )
 {
   EFI_STATUS  Status;
-- 
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 1/3] MdeModulePkg: NvmExpressDxe: clean up NvmeRead() / NvmeWrite() debug msgs

2016-01-27 Thread Laszlo Ersek
Hi Feng,

On 01/27/16 05:24, Tian, Feng wrote:
> Hi, Laszlo
> 
> I am ok with the format string change. 
> 
> I just have a concern about the DEBUG level change. According to
> comments, if debug msg impacts boot performance, we should use
> DEBUG_VERBOSE. Does it impact OVMF boot performance significantly? If
> yes, I agree to change it to VERBOSE. Otherwise, I would suggest to
> keep INFO level.
> 
> Others look good to me, Reviewed-by: Feng Tian  
> 
> #define DEBUG_INFO  0x0040  // Informational debug messages
> #define DEBUG_VERBOSE   0x0040  // Detailed debug messages that may 
> significantly impact boot performance

The main problem with these debug messages is that their amount scales
proportionally with the amount of data the system transfers from or to
all NVMe devices together, before ExitBootServices(). Dependent on what
the user does in the UEFI shell, or how much data a boot loader
application loads from an NVMe device (kernel, initial ram disk etc), or
how much data a SysPrep application massages, these log messages can
"squash" everything else in the full boot log.

In turn, if logging is expensive (which is platform dependent), then the
time spent on logging these messages can impact boot performance
noticeably. With OVMF (x86), logging to the QEMU debug ioport is not
extremely expensive (at least we never felt motivated to measure it :)),
but with ArmVirtPkg (logging to the emulated serial port, running on
Aarch64 KVM), we did measure high costs in general.

I've now looked up some numbers from last September. In those tests, the
ArmVirtQemu build would take about 6.1 seconds in total, from the start
of the virtual machine to reaching the guest OS kernel. This was with a
debug mask of 0x8040004F (DEBUG_ERROR | DEBUG_VERBOSE | DEBUG_INFO |
DEBUG_FS | DEBUG_LOAD | DEBUG_WARN | DEBUG_INIT). Changing the debug
mask to just DEBUG_ERROR, the time spent in ArmVirtQemu fell back to 3
seconds, eliminating about half of the previous runtime.

So, with ArmVirtPkg at least, any significant increase in the amount of
debug messages impacts boot performance quite visibly. The default debug
mask is 0x804F (== the first mask above, minus DEBUG_VERBOSE). The
time of such a boot should be somewhere between the above extremes -- it
is tolerable, while enabling the reader to have a good grasp on the boot
process. But, if such a log gets spammed with NVMe read/write messages,
that will have a high impact.

(Note, I'm not including NvmExpressDxe in ArmVirtQemu.dsc just yet, but
the aarch64 system target of QEMU, "qemu-system-aarch64 -M virt", *does*
include NVMe emulation; so this is not a purely theoretical discussion.)

In short, the log messages in question can take a significant portion of
an "INFO level" log emitted for the entire boot, and on some platforms
that will have a high impact.

Just to give you ad-hoc line counts with OVMF: using the default log
mask (0x804F), booting an installed Fedora 22 Workstation guest from
an NVMe device, the OVMF log consists of 2332 lines. Of those, 887 are
"NvmeRead()" messages. Hence the non-NvmeRead() messages take 1445 lines.

Which means, relative to the non-NvmeRead() portion of the log (which is
all you would have if you booted off another device), the NvmeRead()
messages add 887/1445 ~= 61%.

I think the other INFO messages logged by NvmExpressDxe are both helpful
and non-intrusive, but these two are intrusive.

Thanks!
Laszlo

> 
> Thanks
> Feng
> 
> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com] 
> Sent: Wednesday, January 27, 2016 10:36
> To: edk2-de...@ml01.01.org
> Cc: Tian, Feng
> Subject: [PATCH 1/3] MdeModulePkg: NvmExpressDxe: clean up NvmeRead() / 
> NvmeWrite() debug msgs
> 
> These workhorse functions are part of the BlockIo protocol that NvmExpressDxe 
> produces. For bulk data access, they are called very frequently. Their debug 
> messages should be therefore downgraded to EFI_D_VERBOSE.
> 
> In addition, the following DEBUG() warts are cleaned up:
> 
> - The function name should be printed with %a / __FUNCTION__, so that
>   renaming the function, or copying the DEBUG() elsewhere, be reflected in
>   the debug output automatically. (In fact, after this patch, the DEBUG()
>   calls become identical.)
> 
> - "Lba" is of type UINT64, therefore it should be printed with %Lx, not
>   %x.
> 
> - "OrginalBlocks" and "Blocks" are both UINTN. The only portable way to
>   print UINTN is to convert it to UINT64 manually, then format it with the
>   %Lx (or %Lu) conversion specifier.
> 
> Cc: Feng Tian 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressBlockIo.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressBlockIo.c 
>