[edk2] [Patch 2/2] NetworkPkg: Fix SPD entry edit policy issue in IPSecConfig.

2016-01-11 Thread Jiaxin Wu
The current implementation doesn't handle the relationship
between SPD and SAD well, which may introduce some security
and connection issue after SPD updated.
For SPD entry edit policy, if one SPD entry is edited/updated,
the original SAs list should be discard. Current IPSecConfig
tool does not dealt properly with those rules.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 
---
 .../Application/IpsecConfig/PolicyEntryOperation.c | 41 ++
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/NetworkPkg/Application/IpsecConfig/PolicyEntryOperation.c 
b/NetworkPkg/Application/IpsecConfig/PolicyEntryOperation.c
index 970caa1..9bbc114 100644
--- a/NetworkPkg/Application/IpsecConfig/PolicyEntryOperation.c
+++ b/NetworkPkg/Application/IpsecConfig/PolicyEntryOperation.c
@@ -1,9 +1,9 @@
 /** @file
   The implementation of policy entry operation function in IpSecConfig 
application.
 
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php.
@@ -1396,10 +1396,12 @@ CombineSpdEntry (
   break;
   }
   //
   // Process Data
   //
+  OldData->SaIdCount = 0;
+
   if ((Mask & NAME) != 0) {
 AsciiStrCpyS ((CHAR8 *) OldData->Name, MAX_PEERID_LEN, (CHAR8 *) 
NewData->Name);
   }
 
   if ((Mask & PACKET_FLAG) != 0) {
@@ -1860,41 +1862,34 @@ EditOperatePolicyEntry (
Context->Data,
Context->Mask,
&CreateNew
);
 if (!EFI_ERROR (Status)) {
+  //
+  // If the Selector already existed, this Entry will be updated by set 
data.
+  //
+  Status = mIpSecConfig->SetData (
+   mIpSecConfig,
+   Context->DataType,
+   Context->Selector, /// New created selector.
+   Data, /// Old date which has been modified, 
need to be set data.
+   Selector
+   );
+  ASSERT_EFI_ERROR (Status);
+  
   if (CreateNew) {
 //
-// Insert new entry before old entry
+// Edit the entry to a new one. So, we need delete the old entry.
 //
 Status = mIpSecConfig->SetData (
  mIpSecConfig,
  Context->DataType,
- Context->Selector,
- Data,
- Selector
- );
-ASSERT_EFI_ERROR (Status);
-//
-// Delete old entry
-//
-Status = mIpSecConfig->SetData (
- mIpSecConfig,
- Context->DataType,
- Selector,
- NULL,
+ Selector, /// Old selector.
+ NULL, /// NULL means to delete this Entry 
specified by Selector.
  NULL
  );
 ASSERT_EFI_ERROR (Status);
-  } else {
-Status = mIpSecConfig->SetData (
- mIpSecConfig,
- Context->DataType,
- Context->Selector,
- Data,
- NULL
- );
   }
 }
 
 Context->Status = Status;
 return EFI_ABORTED;
-- 
1.9.5.msysgit.1

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


[edk2] [Patch 0/2] Fix IpSec SPD and SAD mapping issue when SPD updated

2016-01-11 Thread Jiaxin Wu
The serial patches are used to fix the IpSec SPD and SAD mapping issue 
when SPD updated by IPSecConfig tool. The problem is divided into two 
parts: One is SPD SetData policy, and the other is edit policy which 
mainly triggered by IPSecConfig tool.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 

Jiaxin Wu (2):
  NetworkPkg: Fix IpSec SPD and SAD mapping issue when SPD is updated
  NetworkPkg: Fix SPD entry edit policy issue in IPSecConfig.

 .../Application/IpsecConfig/PolicyEntryOperation.c | 41 ++---
 NetworkPkg/IpSecDxe/IpSecConfigImpl.c  | 68 +++---
 2 files changed, 64 insertions(+), 45 deletions(-)

-- 
1.9.5.msysgit.1

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


[edk2] [Patch 1/2] NetworkPkg: Fix IpSec SPD and SAD mapping issue when SPD updated

2016-01-11 Thread Jiaxin Wu
The current implementation doesn't handle the relationship between
SPD and SAD well, which may introduce some security and connection
issue after SPD updated.
For SPD SetData policy:
A) When delete the existed SPD entry, its related SAs also should be
removed from its Sas list(SadEntry->BySpd). If the SA entry is
established by IKE, we can remove it from global SAD list(SadEntry->List)
and then free it directly since its SpdEntry will be freed later.
B) SPD SetData operation should do some setting date validity-check.
For example, whether the SaId specified by setting Data is valid. If
the setting date is invalid, EFI_INVALID_PARAMETER should be returned.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 
---
 NetworkPkg/IpSecDxe/IpSecConfigImpl.c | 68 +++
 1 file changed, 46 insertions(+), 22 deletions(-)

diff --git a/NetworkPkg/IpSecDxe/IpSecConfigImpl.c 
b/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
index 8c7724c..e1b24e4 100644
--- a/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
+++ b/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
@@ -1,9 +1,9 @@
 /** @file
   The implementation of IPSEC_CONFIG_PROTOCOL.
 
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php.
@@ -209,11 +209,11 @@ CompareSpdSelector (
 IsMatch = FALSE;
 return IsMatch;
   }
   
   //
-  // Compare the all LocalAddress fields in the two Spdselectors.
+  // Compare the all LocalAddress and RemoteAddress fields in the two 
Spdselectors.
   // First, SpdSel1->LocalAddress to SpdSel2->LocalAddress && Compare 
   // SpdSel1->RemoteAddress to SpdSel2->RemoteAddress. If all match, return
   // TRUE.
   //
   for (Index = 0; Index < SpdSel1->LocalAddressCount; Index++) {
@@ -370,11 +370,11 @@ IsSubSpdSelector (
   ) {
 IsMatch = FALSE;
   }
   
   //
-  // Compare the all LocalAddress fields in the two Spdselectors.
+  // Compare the all LocalAddress and RemoteAddress fields in the two 
Spdselectors.
   // First, SpdSel1->LocalAddress to SpdSel2->LocalAddress && Compare 
   // SpdSel1->RemoteAddress to SpdSel2->RemoteAddress. If all match, return
   // TRUE.
   //
   if (IsMatch) {
@@ -427,13 +427,13 @@ IsSubSpdSelector (
 IsMatch = FALSE;
 return IsMatch;
   }
   
   //
-  // Compare the all LocalAddress fields in the two Spdselectors.
-  // First, SpdSel1->LocalAddress to SpdSel2->LocalAddress && Compare 
-  // SpdSel1->RemoteAddress to SpdSel2->RemoteAddress. If all match, return
+  // Compare the all LocalAddress and RemoteAddress fields in the two 
Spdselectors.
+  // First, SpdSel1->LocalAddress to SpdSel2->RemoteAddress && Compare 
+  // SpdSel1->RemoteAddress to SpdSel2->LocalAddress. If all match, return
   // TRUE.
   //
   for (Index = 0; Index < SpdSel1->LocalAddressCount; Index++) {
 if (!IsInAddressInfoList (
   &SpdSel1->LocalAddress[Index],
@@ -1016,10 +1016,12 @@ UnfixPadEntry (
  and its policy is not NULL.
- The Action of Data is Protected, its 
policy 
  mode is Tunnel, and its tunnel option is 
NULL.
- The Action of Data is protected and its 
policy 
  mode is not Tunnel and it tunnel option 
is not NULL.
+   - SadEntry requied to be set into new 
SpdEntry's Sas has 
+ been found but it is invalid.
   @retval EFI_OUT_OF_RESOURCED  The required system resource could not be 
allocated.
   @retval EFI_SUCCESS   The specified configuration data was obtained 
successfully.
 
 **/
 EFI_STATUS
@@ -1037,10 +1039,11 @@ SetSpdEntry (
   LIST_ENTRY  *SpdSas;
   LIST_ENTRY  *EntryInsertBefore;
   LIST_ENTRY  *Entry;
   LIST_ENTRY  *Entry2;
   LIST_ENTRY  *NextEntry;
+  LIST_ENTRY  *NextEntry2;
   IPSEC_SPD_ENTRY *SpdEntry;
   IPSEC_SAD_ENTRY *SadEntry;
   UINTN   SpdEntrySize;
   UINTN   Index;
 
@@ -1095,15 +1098,26 @@ SetSpdEntry (
   // Update the reverse ref of SAD entry in the SPD.sas list.
   //
   SpdSas = &SpdEntry->Data->Sas;
   
   //
-  // TODO: Deleted the related SAs.
+  // Remove the related SAs from Sas(SadEntry->BySpd). If the SA entry is 
established by 
+  // IKE, remove from mConfigData list(SadEntry->List) and then free it 
directly since its 
+  // SpdEntry will be freed later.
   //
-  NET_LIST_FOR_EACH (Entry2, SpdSas) {
-SadEntry   

[edk2] [Patch 2/2] BaseTools: change $(INC) to @$(INC_LIST) in the build rule

2016-01-11 Thread Yonghong Zhu
NMAKE is limited to command-line length of 4096 characters. Due to the
large number of /I directives specified on command line (one per include
directory), the path length of WORKSPACE is multiplied by the number of
/I directives and can exceed the limit.
The patch is going to put all -I or /I options followed by include search
path into a file (inc.lst) just as object files and static library files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu 
---
 BaseTools/Conf/build_rule.template | 56 +++---
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index 3637ef4..c29f2cf 100644
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -126,18 +126,18 @@
 
 
 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
 
 
-"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
+"$(CC)" /Fo${dst} $(CC_FLAGS) @$(INC_LIST) ${src}
 
 
 # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
-"$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}
+"$(CC)" $(CC_FLAGS) -o ${dst} @$(INC_LIST) ${src}
 
 
-"$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}
+"$(CC)" $(CC_FLAGS) -o ${dst} @$(INC_LIST) ${src}
 
 [C-Code-File.COMMON.IPF]
 
 ?.c
 ?.C
@@ -152,15 +152,15 @@
 
 
 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
 
 
-"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
+"$(CC)" /Fo${dst} $(CC_FLAGS) @$(INC_LIST) ${src}
 
 
 # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
-"$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}
+"$(CC)" $(CC_FLAGS) -o ${dst} @$(INC_LIST) ${src}
 "$(SYMRENAME)" $(SYMRENAME_FLAGS) ${dst}
 
 [C-Header-File]
 
 *.h, *.H
@@ -182,19 +182,19 @@
 
 
 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
 
 
-"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
+"$(PP)" $(PP_FLAGS) @$(INC_LIST) ${src} > ${d_path}(+)${s_base}.i
 Trim --source-code --convert-hex --trim-long -o 
${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
-"$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) 
${d_path}(+)${s_base}.iii
+"$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} @$(INC_LIST) 
${d_path}(+)${s_base}.iii
 
 
-"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
+"$(PP)" $(PP_FLAGS) @$(INC_LIST) ${src} > ${d_path}(+)${s_base}.i
 Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii 
${d_path}(+)${s_base}.i
 # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
-"$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii
+"$(ASM)" $(ASM_FLAGS) -o ${dst} @$(INC_LIST) ${d_path}(+)${s_base}.iii
 
 [Nasm-Assembly-Code-File.COMMON.COMMON]
 
 ?.nasm
 
@@ -203,11 +203,11 @@
 
 
 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
 
 
-"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
+"$(PP)" $(PP_FLAGS) @$(INC_LIST) ${src} > ${d_path}(+)${s_base}.i
 Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii 
${d_path}(+)${s_base}.i
 "$(NASM)" -I${s_path}(+) $(NASM_FLAGS) -o $dst 
${d_path}(+)${s_base}.iii
 
 [Assembly-Code-File.COMMON.IPF]
 
@@ -218,11 +218,11 @@
 
 
 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
 
 
-"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
+"$(PP)" $(PP_FLAGS) @$(INC_LIST) ${src} > ${d_path}(+)${s_base}.i
 Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
 # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
 "$(ASM)" $(ASM_FLAGS) -o ${dst} ${d_path}(+)${s_base}.iii
 
 [Visual-Form-Representation-File]
@@ -236,11 +236,11 @@
 
 
 $(DEBUG_DIR)(+)${s_dir}(+)${s_base}.c
 
 
-"$(VFRPP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_base}.i
+"$(VFRPP)" $(VFRPP_FLAGS) @$(INC_LIST) ${src} > 
$(OUTPUT_DIR)(+)${s_base}.i
 "$(VFR)" $(VFR_FLAGS) --string-db 
$(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk --output-directory ${d_path} 
$(OUTPUT_DIR)(+)${s_base}.i
 
 [Object-File]
 
 *.obj
@@ -367,11 +367,11 @@
 
 
 $(MAKE_FILE)
 
 
-"$(PP)" $(APP_FLAGS) $(INC) ${src} > 
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
+"$(PP)" $(APP_FLAGS) @$(INC_LIST) ${src} > 
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
 Trim --source-code -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii 
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
 GenDepex -t $(MODULE_TYPE) -o ${dst} 
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
 
 [Acpi-Source-Language-File]
 
@@ -383,17 +383,17 @@
 
 $(MAKE_FILE)
 
 
 Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i 
$(INC_LIST) ${src}
-"$(ASLPP)" $(ASLPP_FLAGS) 

[edk2] [Patch 0/2] fix NMAKE fails due to command-line length limitation

2016-01-11 Thread Yonghong Zhu
NMAKE is limited to command-line length of 4096 characters. Due to the
large number of /I directives specified on command line (one per include
directory), the path length of WORKSPACE is multiplied by the number of
/I directives and can exceed the limit.
We generate inc.lst for every module and put all -I or /I options 
followed by include search path into a file (inc.lst) just as object 
files and static library files.

Yonghong Zhu (2):
  BaseTools: Generate inc.lst for every module
  BaseTools: change $(INC) to @$(INC_LIST) in the build rule

 BaseTools/Conf/build_rule.template | 56 +++---
 BaseTools/Source/Python/AutoGen/GenMake.py |  7 ++--
 2 files changed, 33 insertions(+), 30 deletions(-)

-- 
2.6.1.windows.1

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


[edk2] [Patch 1/2] BaseTools: Generate inc.lst for every module

2016-01-11 Thread Yonghong Zhu
NMAKE is limited to command-line length of 4096 characters. Due to the
large number of /I directives specified on command line (one per include
directory), the path length of WORKSPACE is multiplied by the number of
/I directives and can exceed the limit.
The patch is going to generate inc.lst for every module.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu 
---
 BaseTools/Source/Python/AutoGen/GenMake.py | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index 89285c1..7909789 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -516,15 +516,18 @@ cleanlib:
 )
 FileMacroList.append(FileMacro)
 
 # INC_LIST is special
 FileMacro = ""
+if FileBuildRule.INC_LIST_MACRO not in self.ListFileMacros:
+self.ListFileMacros[FileBuildRule.INC_LIST_MACRO] = []
+
 IncludePathList = []
 for P in  self._AutoGenObject.IncludePathList:
 IncludePathList.append(IncPrefix + self.PlaceMacro(P, self.Macros))
-if FileBuildRule.INC_LIST_MACRO in self.ListFileMacros:
-
self.ListFileMacros[FileBuildRule.INC_LIST_MACRO].append(IncPrefix + P)
+
self.ListFileMacros[FileBuildRule.INC_LIST_MACRO].append(IncPrefix+P)
+
 FileMacro += self._FILE_MACRO_TEMPLATE.Replace(
 {
 "macro_name"   : "INC",
 "source_file" : 
IncludePathList
 }
-- 
2.6.1.windows.1

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


[edk2] [Patch 1/2] BaseTools: VOID* PCDs in VPD region must be aligned based on value type

2016-01-11 Thread Yonghong Zhu
Base on build spec update, ASCII strings(“string”), will be byte aligned,
Unicode strings(L”string”) will be two-byte aligned, Byte arrays,
{0x00, 0x01} will be 8-byte aligned.
This patch is going to halt with an error message if a VOID* PCD has an
offset value that is not aligned based on the syntax of the PCD value.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 28 
 1 file changed, 28 insertions(+)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 4c627df..abac477 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -315,10 +315,15 @@ class WorkspaceAutoGen(AutoGen):
 Fdf = FdfParser(self.FdfFile.Path)
 Fdf.ParseFile()
 GlobalData.gFdfParser = Fdf
 GlobalData.gAutoGenPhase = False
 PcdSet = Fdf.Profile.PcdDict
+FdDict = Fdf.Profile.FdDict[Fdf.CurrentFdName]
+for FdRegion in FdDict.RegionList:
+if str(FdRegion.RegionType) is 'FILE' and 
self.Platform.VpdToolGuid in str(FdRegion.RegionDataList):
+if int(FdRegion.Offset) % 8 != 0:
+EdkLogger.error("build", FORMAT_INVALID, 'The VPD Base 
Address %s must be 8-byte aligned.' % (FdRegion.Offset))
 ModuleList = Fdf.Profile.InfList
 self.FdfProfile = Fdf.Profile
 for fvname in self.FvTargetList:
 if fvname.upper() not in self.FdfProfile.FvDict:
 EdkLogger.error("build", OPTION_VALUE_INVALID,
@@ -1136,10 +1141,22 @@ class PlatformAutoGen(AutoGen):
 if Pcd.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD] 
and \
PcdKey in VpdPcdDict:
 Pcd = VpdPcdDict[PcdKey]
 for (SkuName,Sku) in Pcd.SkuInfoList.items():
 Sku.VpdOffset = Sku.VpdOffset.strip()
+PcdValue = Sku.DefaultValue
+if PcdValue == "":
+PcdValue  = Pcd.DefaultValue
+if Sku.VpdOffset != '*':
+if PcdValue.startswith("{"):
+Alignment = 8
+elif PcdValue.startswith("L"):
+Alignment = 2
+else:
+Alignment = 1
+if int(Sku.VpdOffset) % Alignment != 0:
+EdkLogger.error("build", FORMAT_INVALID, 'The 
offset value of PCD %s.%s should be %s-byte aligned.' % 
(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Alignment))
 VpdFile.Add(Pcd, Sku.VpdOffset)
 # if the offset of a VPD is *, then it need to be 
fixed up by third party tool.
 if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
 NeedProcessVpdMapFile = True
 if self.Platform.VpdToolGuid == None or 
self.Platform.VpdToolGuid == '':
@@ -1191,10 +1208,21 @@ class PlatformAutoGen(AutoGen):
 if DscPcdEntry not in self._DynamicPcdList:
 self._DynamicPcdList.append(DscPcdEntry)
 #Sku = 
DscPcdEntry.SkuInfoList[DscPcdEntry.SkuInfoList.keys()[0]]
 Sku.VpdOffset = Sku.VpdOffset.strip()
 PcdValue = Sku.DefaultValue
+if PcdValue == "":
+PcdValue  = DscPcdEntry.DefaultValue
+if Sku.VpdOffset != '*':
+if PcdValue.startswith("{"):
+Alignment = 8
+elif PcdValue.startswith("L"):
+Alignment = 2
+else:
+Alignment = 1
+if int(Sku.VpdOffset) % Alignment != 0:
+EdkLogger.error("build", 
FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % 
(DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, Alignment))
 VpdFile.Add(DscPcdEntry, Sku.VpdOffset)
 if not NeedProcessVpdMapFile and Sku.VpdOffset 
== "*":
 NeedProcessVpdMapFile = True 
 if DscPcdEntry.DatumType == 'VOID*' and 
PcdValue.startswith("L"):
 UnicodePcdArray.append(DscPcdEntry)
-- 
2.6.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org

[edk2] [Patch 2/2] BaseTools: VPD Tool to allocate VPD region be aligned based on value type

2016-01-11 Thread Yonghong Zhu
Base on build spec update, ASCII strings(“string”), will be byte aligned,
Unicode strings(L”string”) will be two-byte aligned, Byte arrays,
{0x00, 0x01} will be 8-byte aligned.
This patch is going to update VPD Tool to allocate VOID* PCDs to an offset
value that is aligned based in syntax of the PCD value.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu 
---
 BaseTools/Source/Python/BPDG/GenVpd.py | 38 +++---
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py 
b/BaseTools/Source/Python/BPDG/GenVpd.py
index d1da99f..ee7e042 100644
--- a/BaseTools/Source/Python/BPDG/GenVpd.py
+++ b/BaseTools/Source/Python/BPDG/GenVpd.py
@@ -342,11 +342,11 @@ class GenVPD :
 # Skip the comment line
 if (not line.startswith("#")) and len(line) > 1 :
 #
 # Enhanced for support "|" character in the string.
 #
-ValueList = ['', '', '', '','']
+ValueList = ['', '', '', '','']
 
 ValueRe = re.compile(r'\s*L?\".*\|.*\"\s*$')
 PtrValue = ValueRe.findall(line)
 
 ValueUpdateFlag = False
@@ -357,11 +357,11 @@ class GenVPD :
 
 TokenList = line.split('|')
 ValueList[0:len(TokenList)] = TokenList
 
 if ValueUpdateFlag:
-ValueList[4] = PtrValue[0]  
+ValueList[4] = PtrValue[0]
 self.FileLinesList[count] = ValueList
 # Store the line number
 self.FileLinesList[count].append(str(count + 1))
 elif len(line) <= 1 :
 # Set the blank line to "None"
@@ -398,18 +398,32 @@ class GenVPD :
 # Strip the space char
 PCD.PcdCName = PCD.PcdCName.strip(' ')
 PCD.SkuId= PCD.SkuId.strip(' ')
 PCD.PcdOffset= PCD.PcdOffset.strip(' ')
 PCD.PcdSize  = PCD.PcdSize.strip(' ')
-PCD.PcdValue = PCD.PcdValue.strip(' ')   
+PCD.PcdValue = PCD.PcdValue.strip(' ')
 PCD.Lineno   = PCD.Lineno.strip(' ')
-  
+
 #
 # Store the original pcd value.
 # This information will be useful while generate the output 
map file.
 #
-PCD.PcdUnpackValue=  str(PCD.PcdValue) 
 
+PCD.PcdUnpackValue=  str(PCD.PcdValue)
+
+#
+# If value is Unicode string (e.g. L""), then use 2-byte 
alignment
+# If value is byte array (e.g. {}), then use 8-byte alignment
+#
+PCD.PcdOccupySize =  int(PCD.PcdSize)
+if PCD.PcdUnpackValue.startswith("{"):
+Alignment = 8
+elif PCD.PcdUnpackValue.startswith("L"):
+Alignment = 2
+else:
+Alignment = 1
+if PCD.PcdOccupySize % Alignment != 0:
+PCD.PcdOccupySize = (PCD.PcdOccupySize / Alignment + 1) * 
Alignment
 
 #
 # Translate PCD size string to an integer value.
 PackSize = None
 try:
@@ -488,11 +502,11 @@ class GenVPD :
 # The offset start from 0
 NowOffset = 0
 for Pcd in self.PcdUnknownOffsetList :
 Pcd.PcdBinOffset = NowOffset
 Pcd.PcdOffset= str(hex(Pcd.PcdBinOffset))
-NowOffset   += Pcd.PcdBinSize
+NowOffset   += Pcd.PcdOccupySize
 
 self.PcdFixedOffsetSizeList = self.PcdUnknownOffsetList
 return
 
 # Check the offset of VPD type pcd's offset start from 0.
@@ -512,18 +526,18 @@ class GenVPD :
 "The offset of %s at line: %s is same with %s 
at line: %s in file %s" % \
 (PcdNow.PcdCName, PcdNow.Lineno, 
PcdNext.PcdCName, PcdNext.Lineno, PcdNext.FileName),
 None)
 
 # Overlapped   
-if PcdNow.PcdBinOffset + PcdNow.PcdBinSize > PcdNext.PcdBinOffset :
+if PcdNow.PcdBinOffset + PcdNow.PcdOccupySize > 
PcdNext.PcdBinOffset :
 EdkLogger.error("BPDG", BuildToolError.ATTRIBUTE_GET_FAILURE,
 "The offset of %s at line: %s is overlapped 
with %s at line: %s in file %s" % \
 (PcdNow.PcdCName, PcdNow.Lineno, 
PcdNext.PcdCName, PcdNext.Lineno, PcdNext.FileName),
 None)
 
 # Has free space, raise a warning message   
-if PcdNow.PcdBinOffset + PcdNow.PcdBinSize < PcdNext.PcdBi

[edk2] [Patch 0/2] VOID* PCDs in VPD region must be aligned based on value type

2016-01-11 Thread Yonghong Zhu
Base on build spec update, ASCII strings(��string��), will be byte aligned,
Unicode strings(L��string��) will be two-byte aligned, Byte arrays,
{0x00, 0x01} will be 8-byte aligned.
If using automatic offset feature, VPD Tool allocate VOID* PCDs to an 
offset value that is aligned based in syntax of the PCD value,If the 
developer assigns offset values in the DSC file not follow the align 
rule, build tool break with an error.

Yonghong Zhu (2):
  BaseTools: VOID* PCDs in VPD region must be aligned based on value
type
  BaseTools: VPD Tool to allocate VPD region be aligned based on value
type

 BaseTools/Source/Python/AutoGen/AutoGen.py | 28 ++
 BaseTools/Source/Python/BPDG/GenVpd.py | 38 --
 2 files changed, 54 insertions(+), 12 deletions(-)

-- 
2.6.1.windows.1

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


Re: [edk2] [Patch 1/2] BaseTools: VOID* PCDs in VPD region must be aligned based on value type

2016-01-11 Thread Laszlo Ersek
On 01/11/16 10:17, Yonghong Zhu wrote:
> Base on build spec update, ASCII strings(“string”), will be byte aligned,

This commit message seems to contain non-ASCII unicode code points
(specifically, the quotes U+201c and U+201d).

http://unicode.org/cldr/utility/character.jsp?a=201C
http://unicode.org/cldr/utility/character.jsp?a=201D

While git can handle those all fine, is this an accepted practice for:
- SVN?
- edk2 in general?

Moreover:

> Unicode strings(L”string”) will be two-byte aligned, Byte arrays,

In this example, I think it's not right to use the above code points.
Here, L"string" is a C-language code example, and that seems to require
ASCII 0x22:

http://unicode.org/cldr/utility/character.jsp?a=0022

(Sorry, no other comments on the patch.)

Thanks
Laszlo


> {0x00, 0x01} will be 8-byte aligned.
> This patch is going to halt with an error message if a VOID* PCD has an
> offset value that is not aligned based on the syntax of the PCD value.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu 
> ---
>  BaseTools/Source/Python/AutoGen/AutoGen.py | 28 
>  1 file changed, 28 insertions(+)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
> b/BaseTools/Source/Python/AutoGen/AutoGen.py
> index 4c627df..abac477 100644
> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> @@ -315,10 +315,15 @@ class WorkspaceAutoGen(AutoGen):
>  Fdf = FdfParser(self.FdfFile.Path)
>  Fdf.ParseFile()
>  GlobalData.gFdfParser = Fdf
>  GlobalData.gAutoGenPhase = False
>  PcdSet = Fdf.Profile.PcdDict
> +FdDict = Fdf.Profile.FdDict[Fdf.CurrentFdName]
> +for FdRegion in FdDict.RegionList:
> +if str(FdRegion.RegionType) is 'FILE' and 
> self.Platform.VpdToolGuid in str(FdRegion.RegionDataList):
> +if int(FdRegion.Offset) % 8 != 0:
> +EdkLogger.error("build", FORMAT_INVALID, 'The VPD 
> Base Address %s must be 8-byte aligned.' % (FdRegion.Offset))
>  ModuleList = Fdf.Profile.InfList
>  self.FdfProfile = Fdf.Profile
>  for fvname in self.FvTargetList:
>  if fvname.upper() not in self.FdfProfile.FvDict:
>  EdkLogger.error("build", OPTION_VALUE_INVALID,
> @@ -1136,10 +1141,22 @@ class PlatformAutoGen(AutoGen):
>  if Pcd.Type in [TAB_PCDS_DYNAMIC_VPD, 
> TAB_PCDS_DYNAMIC_EX_VPD] and \
> PcdKey in VpdPcdDict:
>  Pcd = VpdPcdDict[PcdKey]
>  for (SkuName,Sku) in Pcd.SkuInfoList.items():
>  Sku.VpdOffset = Sku.VpdOffset.strip()
> +PcdValue = Sku.DefaultValue
> +if PcdValue == "":
> +PcdValue  = Pcd.DefaultValue
> +if Sku.VpdOffset != '*':
> +if PcdValue.startswith("{"):
> +Alignment = 8
> +elif PcdValue.startswith("L"):
> +Alignment = 2
> +else:
> +Alignment = 1
> +if int(Sku.VpdOffset) % Alignment != 0:
> +EdkLogger.error("build", FORMAT_INVALID, 
> 'The offset value of PCD %s.%s should be %s-byte aligned.' % 
> (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Alignment))
>  VpdFile.Add(Pcd, Sku.VpdOffset)
>  # if the offset of a VPD is *, then it need to be 
> fixed up by third party tool.
>  if not NeedProcessVpdMapFile and Sku.VpdOffset == 
> "*":
>  NeedProcessVpdMapFile = True
>  if self.Platform.VpdToolGuid == None or 
> self.Platform.VpdToolGuid == '':
> @@ -1191,10 +1208,21 @@ class PlatformAutoGen(AutoGen):
>  if DscPcdEntry not in self._DynamicPcdList:
>  self._DynamicPcdList.append(DscPcdEntry)
>  #Sku = 
> DscPcdEntry.SkuInfoList[DscPcdEntry.SkuInfoList.keys()[0]]
>  Sku.VpdOffset = Sku.VpdOffset.strip()
>  PcdValue = Sku.DefaultValue
> +if PcdValue == "":
> +PcdValue  = DscPcdEntry.DefaultValue
> +if Sku.VpdOffset != '*':
> +if PcdValue.startswith("{"):
> +Alignment = 8
> +elif PcdValue.startswith("L"):
> +Alignment = 2
> +else:
> +Alignment = 1
> + 

[edk2] [PATCH] NetworkPkg: Fix some typos

2016-01-11 Thread Alcantara, Paulo
Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Siyuan Fu 
Signed-off-by: Paulo Alcantara 
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c  | 8 
 NetworkPkg/HttpBootDxe/HttpBootClient.h  | 2 +-
 NetworkPkg/HttpBootDxe/HttpBootSupport.c | 4 ++--
 NetworkPkg/HttpBootDxe/HttpBootSupport.h | 8 
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index a2cad0a..f0817e9 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -719,8 +719,8 @@ HttpBootGetBootFile (
   EFI_STATUS Status;
   CHAR8  *HostName;
   EFI_HTTP_REQUEST_DATA  *RequestData;
-  HTTP_IO_RESOPNSE_DATA  *ResponseData;
-  HTTP_IO_RESOPNSE_DATA  ResponseBody;
+  HTTP_IO_RESPONSE_DATA  *ResponseData;
+  HTTP_IO_RESPONSE_DATA  ResponseBody;
   HTTP_IO*HttpIo;
   HTTP_IO_HEADER *HttpIoHeader;
   VOID   *Parser;
@@ -884,7 +884,7 @@ HttpBootGetBootFile (
   //
   // 3.1 First step, use zero BodyLength to only receive the response headers.
   //
-  ResponseData = AllocateZeroPool (sizeof(HTTP_IO_RESOPNSE_DATA));
+  ResponseData = AllocateZeroPool (sizeof(HTTP_IO_RESPONSE_DATA));
   if (ResponseData == NULL) {
 Status = EFI_OUT_OF_RESOURCES;
 goto ERROR_4;
@@ -948,7 +948,7 @@ HttpBootGetBootFile (
 // 3.4.2, start the message-body download, the identity and chunked 
transfer-coding
 // is handled in different path here.
 //
-ZeroMem (&ResponseBody, sizeof (HTTP_IO_RESOPNSE_DATA));
+ZeroMem (&ResponseBody, sizeof (HTTP_IO_RESPONSE_DATA));
 if (IdentityMode) {
   //
   // In identity transfer-coding there is no need to parse the message 
body,
diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.h 
b/NetworkPkg/HttpBootDxe/HttpBootClient.h
index 06b9109..e618316 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.h
@@ -41,7 +41,7 @@ typedef struct {
 typedef struct {
   LIST_ENTRY Link;// Link to the CacheList in 
driver's private data.
   EFI_HTTP_REQUEST_DATA  *RequestData;
-  HTTP_IO_RESOPNSE_DATA  *ResponseData;   // Not include any message-body 
data.
+  HTTP_IO_RESPONSE_DATA  *ResponseData;   // Not include any message-body 
data.
   UINTN  EntityLength;
   LIST_ENTRY EntityDataList;  // Entity data (message-body)
 } HTTP_BOOT_CACHE_CONTENT;
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
index 1fc4e76..f9bbe4b 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
@@ -914,7 +914,7 @@ HttpIoSendRequest (
 FALSE to continue receive the previous 
response message.
   @param[out]  ResponseData Point to a wrapper of the received response 
data.
   
-  @retval EFI_SUCCESSThe HTTP resopnse is received.
+  @retval EFI_SUCCESSThe HTTP response is received.
   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.
   @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory.
   @retval EFI_DEVICE_ERROR   An unexpected network or system error 
occurred.
@@ -925,7 +925,7 @@ EFI_STATUS
 HttpIoRecvResponse (
   IN  HTTP_IO  *HttpIo,
   IN  BOOLEAN  RecvMsgHeader,
- OUT  HTTP_IO_RESOPNSE_DATA*ResponseData
+ OUT  HTTP_IO_RESPONSE_DATA*ResponseData
   )
 {
   EFI_STATUS Status;
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.h 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.h
index d595672..2eba14e 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.h
@@ -168,7 +168,7 @@ typedef union {
 } HTTP_IO_CONFIG_DATA;
 
 //
-// HTTO_IO wrapper of the EFI HTTP service.
+// HTTP_IO wrapper of the EFI HTTP service.
 //
 typedef struct {
   UINT8 IpVersion;
@@ -196,7 +196,7 @@ typedef struct {
   EFI_HTTP_HEADER *Headers;
   UINTN   BodyLength;
   CHAR8   *Body;
-} HTTP_IO_RESOPNSE_DATA;
+} HTTP_IO_RESPONSE_DATA;
 
 /**
   Retrieve the host address using the EFI_DNS6_PROTOCOL.
@@ -303,7 +303,7 @@ HttpIoSendRequest (
 FALSE to continue receive the previous 
response message.
   @param[out]  ResponseData Point to a wrapper of the received response 
data.
   
-  @retval EFI_SUCCESSThe HTTP resopnse is received.
+  @retval EFI_SUCCESSThe HTTP response is received.
   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.
   @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory.
   @retval EFI_DEVICE_ERROR   An unexpected network or system error 
occurred.
@@ -314,7 +314,7 @@ EFI_STATUS
 HttpIoRecvResponse (
   IN  HTTP_I

Re: [edk2] [PATCH] NetworkPkg: Fix some typos

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

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Alcantara, Paulo
Sent: Tuesday, January 12, 2016 3:03 AM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan
Subject: [edk2] [PATCH] NetworkPkg: Fix some typos

Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Siyuan Fu 
Signed-off-by: Paulo Alcantara 
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c  | 8   
NetworkPkg/HttpBootDxe/HttpBootClient.h  | 2 +-  
NetworkPkg/HttpBootDxe/HttpBootSupport.c | 4 ++--  
NetworkPkg/HttpBootDxe/HttpBootSupport.h | 8 
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index a2cad0a..f0817e9 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -719,8 +719,8 @@ HttpBootGetBootFile (
   EFI_STATUS Status;
   CHAR8  *HostName;
   EFI_HTTP_REQUEST_DATA  *RequestData;
-  HTTP_IO_RESOPNSE_DATA  *ResponseData;
-  HTTP_IO_RESOPNSE_DATA  ResponseBody;
+  HTTP_IO_RESPONSE_DATA  *ResponseData;
+  HTTP_IO_RESPONSE_DATA  ResponseBody;
   HTTP_IO*HttpIo;
   HTTP_IO_HEADER *HttpIoHeader;
   VOID   *Parser;
@@ -884,7 +884,7 @@ HttpBootGetBootFile (
   //
   // 3.1 First step, use zero BodyLength to only receive the response headers.
   //
-  ResponseData = AllocateZeroPool (sizeof(HTTP_IO_RESOPNSE_DATA));
+  ResponseData = AllocateZeroPool (sizeof(HTTP_IO_RESPONSE_DATA));
   if (ResponseData == NULL) {
 Status = EFI_OUT_OF_RESOURCES;
 goto ERROR_4;
@@ -948,7 +948,7 @@ HttpBootGetBootFile (
 // 3.4.2, start the message-body download, the identity and chunked 
transfer-coding
 // is handled in different path here.
 //
-ZeroMem (&ResponseBody, sizeof (HTTP_IO_RESOPNSE_DATA));
+ZeroMem (&ResponseBody, sizeof (HTTP_IO_RESPONSE_DATA));
 if (IdentityMode) {
   //
   // In identity transfer-coding there is no need to parse the message 
body, diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.h 
b/NetworkPkg/HttpBootDxe/HttpBootClient.h
index 06b9109..e618316 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.h
@@ -41,7 +41,7 @@ typedef struct {
 typedef struct {
   LIST_ENTRY Link;// Link to the CacheList in 
driver's private data.
   EFI_HTTP_REQUEST_DATA  *RequestData;
-  HTTP_IO_RESOPNSE_DATA  *ResponseData;   // Not include any message-body 
data.
+  HTTP_IO_RESPONSE_DATA  *ResponseData;   // Not include any message-body 
data.
   UINTN  EntityLength;
   LIST_ENTRY EntityDataList;  // Entity data (message-body)
 } HTTP_BOOT_CACHE_CONTENT;
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
index 1fc4e76..f9bbe4b 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
@@ -914,7 +914,7 @@ HttpIoSendRequest (
 FALSE to continue receive the previous 
response message.
   @param[out]  ResponseData Point to a wrapper of the received response 
data.
   
-  @retval EFI_SUCCESSThe HTTP resopnse is received.
+  @retval EFI_SUCCESSThe HTTP response is received.
   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.
   @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory.
   @retval EFI_DEVICE_ERROR   An unexpected network or system error 
occurred.
@@ -925,7 +925,7 @@ EFI_STATUS
 HttpIoRecvResponse (
   IN  HTTP_IO  *HttpIo,
   IN  BOOLEAN  RecvMsgHeader,
- OUT  HTTP_IO_RESOPNSE_DATA*ResponseData
+ OUT  HTTP_IO_RESPONSE_DATA*ResponseData
   )
 {
   EFI_STATUS Status;
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.h 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.h
index d595672..2eba14e 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.h
@@ -168,7 +168,7 @@ typedef union {
 } HTTP_IO_CONFIG_DATA;
 
 //
-// HTTO_IO wrapper of the EFI HTTP service.
+// HTTP_IO wrapper of the EFI HTTP service.
 //
 typedef struct {
   UINT8 IpVersion;
@@ -196,7 +196,7 @@ typedef struct {
   EFI_HTTP_HEADER *Headers;
   UINTN   BodyLength;
   CHAR8   *Body;
-} HTTP_IO_RESOPNSE_DATA;
+} HTTP_IO_RESPONSE_DATA;
 
 /**
   Retrieve the host address using the EFI_DNS6_PROTOCOL.
@@ -303,7 +303,7 @@ HttpIoSendRequest (
 FALSE to continue receive the previous 
response message.
   @param[out]  ResponseData Point to a wrapper of the received response 
data.
   
-  @retval EFI_SUCCESSThe HTTP resopnse is received.
+  @retval EFI_SUCCESSThe HTTP response is received.
   @r

Re: [edk2] [PATCH] NetworkPkg: Fix some typos

2016-01-11 Thread Fu, Siyuan
Thanks Paulo, I will commit this patch.

Reviewed-by: Fu Siyuan 



-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Alcantara, Paulo
Sent: Tuesday, January 12, 2016 3:03 AM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan 
Subject: [edk2] [PATCH] NetworkPkg: Fix some typos

Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Siyuan Fu 
Signed-off-by: Paulo Alcantara 
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c  | 8   
NetworkPkg/HttpBootDxe/HttpBootClient.h  | 2 +-  
NetworkPkg/HttpBootDxe/HttpBootSupport.c | 4 ++--  
NetworkPkg/HttpBootDxe/HttpBootSupport.h | 8 
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index a2cad0a..f0817e9 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -719,8 +719,8 @@ HttpBootGetBootFile (
   EFI_STATUS Status;
   CHAR8  *HostName;
   EFI_HTTP_REQUEST_DATA  *RequestData;
-  HTTP_IO_RESOPNSE_DATA  *ResponseData;
-  HTTP_IO_RESOPNSE_DATA  ResponseBody;
+  HTTP_IO_RESPONSE_DATA  *ResponseData;
+  HTTP_IO_RESPONSE_DATA  ResponseBody;
   HTTP_IO*HttpIo;
   HTTP_IO_HEADER *HttpIoHeader;
   VOID   *Parser;
@@ -884,7 +884,7 @@ HttpBootGetBootFile (
   //
   // 3.1 First step, use zero BodyLength to only receive the response headers.
   //
-  ResponseData = AllocateZeroPool (sizeof(HTTP_IO_RESOPNSE_DATA));
+  ResponseData = AllocateZeroPool (sizeof(HTTP_IO_RESPONSE_DATA));
   if (ResponseData == NULL) {
 Status = EFI_OUT_OF_RESOURCES;
 goto ERROR_4;
@@ -948,7 +948,7 @@ HttpBootGetBootFile (
 // 3.4.2, start the message-body download, the identity and chunked 
transfer-coding
 // is handled in different path here.
 //
-ZeroMem (&ResponseBody, sizeof (HTTP_IO_RESOPNSE_DATA));
+ZeroMem (&ResponseBody, sizeof (HTTP_IO_RESPONSE_DATA));
 if (IdentityMode) {
   //
   // In identity transfer-coding there is no need to parse the message 
body, diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.h 
b/NetworkPkg/HttpBootDxe/HttpBootClient.h
index 06b9109..e618316 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.h
@@ -41,7 +41,7 @@ typedef struct {
 typedef struct {
   LIST_ENTRY Link;// Link to the CacheList in 
driver's private data.
   EFI_HTTP_REQUEST_DATA  *RequestData;
-  HTTP_IO_RESOPNSE_DATA  *ResponseData;   // Not include any message-body 
data.
+  HTTP_IO_RESPONSE_DATA  *ResponseData;   // Not include any message-body 
data.
   UINTN  EntityLength;
   LIST_ENTRY EntityDataList;  // Entity data (message-body)
 } HTTP_BOOT_CACHE_CONTENT;
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
index 1fc4e76..f9bbe4b 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
@@ -914,7 +914,7 @@ HttpIoSendRequest (
 FALSE to continue receive the previous 
response message.
   @param[out]  ResponseData Point to a wrapper of the received response 
data.
   
-  @retval EFI_SUCCESSThe HTTP resopnse is received.
+  @retval EFI_SUCCESSThe HTTP response is received.
   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.
   @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory.
   @retval EFI_DEVICE_ERROR   An unexpected network or system error 
occurred.
@@ -925,7 +925,7 @@ EFI_STATUS
 HttpIoRecvResponse (
   IN  HTTP_IO  *HttpIo,
   IN  BOOLEAN  RecvMsgHeader,
- OUT  HTTP_IO_RESOPNSE_DATA*ResponseData
+ OUT  HTTP_IO_RESPONSE_DATA*ResponseData
   )
 {
   EFI_STATUS Status;
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.h 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.h
index d595672..2eba14e 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.h
@@ -168,7 +168,7 @@ typedef union {
 } HTTP_IO_CONFIG_DATA;
 
 //
-// HTTO_IO wrapper of the EFI HTTP service.
+// HTTP_IO wrapper of the EFI HTTP service.
 //
 typedef struct {
   UINT8 IpVersion;
@@ -196,7 +196,7 @@ typedef struct {
   EFI_HTTP_HEADER *Headers;
   UINTN   BodyLength;
   CHAR8   *Body;
-} HTTP_IO_RESOPNSE_DATA;
+} HTTP_IO_RESPONSE_DATA;
 
 /**
   Retrieve the host address using the EFI_DNS6_PROTOCOL.
@@ -303,7 +303,7 @@ HttpIoSendRequest (
 FALSE to continue receive the previous 
response message.
   @param[out]  ResponseData Point to a wrapper of the received response 
data.
   
-  @retval EFI_SUCCESSThe HTTP resopnse is received.
+  @retval EFI_SUCCESS