[edk2] [PATCH] BaseTools: Remove EdkIIWorkspaceBuild.py from source code

2018-04-03 Thread Feng, YunhuaX
Remove EdkIIWorkspaceBuild.py from source code

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 .../Source/Python/Common/EdkIIWorkspaceBuild.py| 1670 
 BaseTools/Source/Python/Makefile   |1 -
 2 files changed, 1671 deletions(-)
 delete mode 100644 BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py

diff --git a/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py 
b/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py
deleted file mode 100644
index c0966d5265..00
--- a/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py
+++ /dev/null
@@ -1,1670 +0,0 @@
-## @file
-# This file is used to define each component of the build database
-#
-# Copyright (c) 2007 - 2014, 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
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-##
-# Import Modules
-#
-import Common.LongFilePathOs as os, string, copy, pdb, copy
-import EdkLogger
-import DataType
-from InfClassObject import *
-from DecClassObject import *
-from DscClassObject import *
-from String import *
-from BuildToolError import *
-from Misc import sdict
-import Database as Database
-import time as time
-
-## PcdClassObject
-#
-# This Class is used for PcdObject
-# 
-# @param object: Inherited from object class
-# @param Name:   Input value for Name of Pcd, default is None
-# @param Guid:   Input value for Guid of Pcd, default is None
-# @param Type:   Input value for Type of Pcd, default is None
-# @param DatumType:  Input value for DatumType of Pcd, default is None
-# @param Value:  Input value for Value of Pcd, default is None
-# @param Token:  Input value for Token of Pcd, default is None
-# @param MaxDatumSize:   Input value for MaxDatumSize of Pcd, default is 
None
-# @param SkuInfoList:Input value for SkuInfoList of Pcd, default is {}
-# @param IsOverrided:Input value for IsOverrided of Pcd, default is 
False
-#
-# @var TokenCName:   To store value for TokenCName
-# @var TokenSpaceGuidCName:  To store value for TokenSpaceGuidCName
-# @var Type: To store value for Type
-# @var DatumType:To store value for DatumType
-# @var TokenValue:   To store value for TokenValue
-# @var MaxDatumSize: To store value for MaxDatumSize
-# @var SkuInfoList:  To store value for SkuInfoList
-# @var IsOverrided:  To store value for IsOverrided
-# @var Phase:To store value for Phase, default is "DXE"
-#
-class PcdClassObject(object):
-def __init__(self, Name = None, Guid = None, Type = None, DatumType = 
None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = {}, 
IsOverrided = False):
-self.TokenCName = Name
-self.TokenSpaceGuidCName = Guid
-self.Type = Type
-self.DatumType = DatumType
-self.DefaultValue = Value
-self.TokenValue = Token
-self.MaxDatumSize = MaxDatumSize
-self.SkuInfoList = SkuInfoList
-self.IsOverrided = IsOverrided
-self.Phase = "DXE"
-
-## Convert the class to a string
-#
-#  Convert each member of the class to string
-#  Organize to a signle line format string
-#
-#  @retval Rtn Formatted String
-#
-def __str__(self):
-Rtn = '\tTokenCName=' + str(self.TokenCName) + ', ' + \
-  'TokenSpaceGuidCName=' + str(self.TokenSpaceGuidCName) + ', ' + \
-  'Type=' + str(self.Type) + ', ' + \
-  'DatumType=' + str(self.DatumType) + ', ' + \
-  'DefaultValue=' + str(self.DefaultValue) + ', ' + \
-  'TokenValue=' + str(self.TokenValue) + ', ' + \
-  'MaxDatumSize=' + str(self.MaxDatumSize) + ', '
-for Item in self.SkuInfoList.values():
-Rtn = Rtn + 'SkuId=' + Item.SkuId + ', ' + 'SkuIdName=' + 
Item.SkuIdName
-Rtn = Rtn + str(self.IsOverrided)
-
-return Rtn
-
-## Override __eq__ function
-#
-# Check whether pcds are the same
-#
-# @retval False The two pcds are different
-# @retval True  The two pcds are the same
-#
-def __eq__(self, Other):
-return Other is not None and self.TokenCName == Other.TokenCName and 
self.TokenSpaceGuidCName == Other.TokenSpaceGuidCName
-
-## Override __hash__ function
-#
-# Use (TokenCName, TokenSpaceGuidCName) as key in hash table
-#
-# @retval truple() 

[edk2] [PATCH V2] MdeModulePkg/Gcd: Filter gCpu->SetMemoryAttributes() calls

2018-04-03 Thread Star Zeng
From: "Kinney, Michael D" 

This patch fixes an issue with VlvTbltDevicePkg introduced
by commit 5b91bf82c67b586b9588cbe4bbffa1588f6b5926.

The history is as below.
To support heap guard feature, 14dde9e903bb9a719ebb8f3381da72b19509bc36
added support for SetMemorySpaceAttributes() to handle page attributes,
but after that, a combination of CPU arch attributes and other attributes
was not allowed anymore, for example, UC + RUNTIME. It is a regression.
Then 5b91bf82c67b586b9588cbe4bbffa1588f6b5926 was to fix the regression,
and we thought 0 CPU arch attributes may be used to clear CPU arch
attributes, so 0 CPU arch attributes was allowed to be sent to
gCpu->SetMemoryAttributes().

But some implementation of CPU driver may return error for 0 CPU arch
attributes. That fails the case that caller just calls
SetMemorySpaceAttributes() with none CPU arch attributes (for example,
RUNTIME), and the purpose of the case is not to clear CPU arch attributes.

This patch filters the call to gCpu->SetMemoryAttributes()
if the requested attributes is 0.  It also removes the #define
INVALID_CPU_ARCH_ATTRIBUTES that is no longer used.

Cc: Heyi Guo 
Cc: Yi Li 
Cc: Renhao Liang 
Cc: Star Zeng 
Cc: Eric Dong 
Cc: Liming Gao 
Cc: Jian J Wang 
Cc: Ruiyu Ni 
Signed-off-by: Michael D Kinney 
Signed-off-by: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index 907245a3f512..31ddf9c3bb51 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -48,8 +48,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #define NONEXCLUSIVE_MEMORY_ATTRIBUTES (EFI_MEMORY_XP | EFI_MEMORY_RP | \
 EFI_MEMORY_RO)
 
-#define INVALID_CPU_ARCH_ATTRIBUTES   0x
-
 //
 // Module Variables
 //
@@ -873,7 +871,21 @@ CoreConvertSpace (
 // Call CPU Arch Protocol to attempt to set attributes on the range
 //
 CpuArchAttributes = ConverToCpuArchAttributes (Attributes);
-if (CpuArchAttributes != INVALID_CPU_ARCH_ATTRIBUTES) {
+//
+// CPU arch attributes include page attributes and cache attributes. 
+// Only page attributes supports to be cleared, but not cache attributes.
+// Caller is expected to use GetMemorySpaceDescriptor() to get the current
+// attributes, AND/OR attributes, and then calls SetMemorySpaceAttributes()
+// to set the new attributes.
+// So 0 CPU arch attributes should not happen as memory should always have
+// a cache attribute (no matter UC or WB, etc). 
+//
+// Here, 0 CPU arch attributes will be filtered to be compatible with the
+// case that caller just calls SetMemorySpaceAttributes() with none CPU
+// arch attributes (for example, RUNTIME) as the purpose of the case is not
+// to clear CPU arch attributes.
+//
+if (CpuArchAttributes != 0) {
   if (gCpu == NULL) {
 Status = EFI_NOT_AVAILABLE_YET;
   } else {
@@ -936,6 +948,13 @@ CoreConvertSpace (
 // Set attributes operation
 //
 case GCD_SET_ATTRIBUTES_MEMORY_OPERATION:
+  if (CpuArchAttributes == 0) {
+//
+// Keep original CPU arch attributes when caller just calls
+// SetMemorySpaceAttributes() with none CPU arch attributes (for 
example, RUNTIME).
+//
+Attributes |= (Entry->Attributes & (EXCLUSIVE_MEMORY_ATTRIBUTES | 
NONEXCLUSIVE_MEMORY_ATTRIBUTES));
+  }
   Entry->Attributes = Attributes;
   break;
 //
-- 
2.7.0.windows.1

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


Re: [edk2] HSTI sample code?

2018-04-03 Thread Yao, Jiewen
You can find the UEFI SHELL tool to dump HSTI information.
@ 
https://github.com/jyao1/EdkiiShellTool/tree/master/EdkiiShellToolPkg/HstiWsmtDump

Thank you
Yao Jiewen

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Blibbet
> Sent: Wednesday, April 4, 2018 4:49 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] HSTI sample code?
> 
> Hi,
> 
> I'm trying a tool to write a UEFI app that accesses the HSTI image, via
> it's Boot Service Protocol.
> 
> Before I start, does anyone know of any:
> 
> 1) existing open source tool that does this?
> 
> 2) existing Tianocore source that uses the HSTI boot services protocol?
> 
> 3) OS-present API/ioctl/interface, for Mac or Win or Linux, that
> provides OS-present app access with this HSTI image?
> 
> For 1-2, I don't want to re-invent the wheel. For 3, I'd like to have an
> OS-present tool instead of -- or in addition to -- a UEFI Shell tool.
> 
> Thanks in advance for any help!
> 
> Lee Fisher
> 
> 
> ___
> 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/1] MdeModulePkg/Gcd: Fix bug of attribute conversion

2018-04-03 Thread Guo Heyi
On Tue, Apr 03, 2018 at 02:25:30AM +, Yao, Jiewen wrote:
> I have a discussion with Star/Jian.
> 
> The expectation for the CPU driver is to handle PageAttribute.
> The expectation for the platform driver is to use GetAttribute(), AND/OR 
> attribute, then call SetAttribute().

Agree, "Get and then Set" seems to be the clearest definition for
gDS->SetMemoryAttributes().

Thanks,

Heyi

> Because the DRAM always has a cache attribute (no matter UC or WB), 0 should 
> not happen. (0 might happen for a GCD reserved memory, but there is no need 
> to set page attribute)
> 
> If all drivers use above way, there won't be any issue. There is no need to 
> introduce a new protocol so far.
> 
> We did encounter some error, because the platform/silicon/CPU code is not 
> updated yet. (For example, the MinnowMax which is using binary)
> The fix to filter 0 seems a workable way to resolve the compatibility issue.
> 
> Later, I suggest we update MinnowMax binary - Add paging handling for CPU 
> driver, and use GetAttribute()/SetAttribute() for platform/silicon code.
> 
> 
> Thank you
> Yao Jiewen
> 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Wang,
> > Jian J
> > Sent: Tuesday, April 3, 2018 9:24 AM
> > To: Zeng, Star ; Kinney, Michael D
> > ; Heyi Guo ;
> > edk2-devel@lists.01.org
> > Cc: Ni, Ruiyu ; Yi Li ; Gao,
> > Liming ; Dong, Eric ; Renhao
> > Liang 
> > Subject: Re: [edk2] [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of attribute
> > conversion
> > 
> > The NX Memory Protection and Heap Guard features need to clear paging
> > attributes.
> > Allowing 0 attribute is the current only choice without changing arch 
> > protocol.
> > Maybe
> > It's time to introduce a new protocol.
> > 
> > Regards,
> > Jian
> > 
> > 
> > > -Original Message-
> > > From: Zeng, Star
> > > Sent: Tuesday, April 03, 2018 9:16 AM
> > > To: Kinney, Michael D ; Heyi Guo
> > > ; edk2-devel@lists.01.org
> > > Cc: Yi Li ; Renhao Liang
> > > ; Dong, Eric ; Gao, Liming
> > > ; Wang, Jian J ; Ni, Ruiyu
> > > ; Zeng, Star 
> > > Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion
> > >
> > > Current gCpu->SetMemoryAttributes does not support getting memory
> > > attributes, and has no clear description about clearing memory attributes.
> > >
> > > I noticed we introduced
> > >
> > SmmMemoryAttribute(MdeModulePkg\Include\Protocol\SmmMemoryAttribut
> > e.
> > > h) protocol for heap guard feature in SMM environment.
> > > Seemingly, we also need introduce MemoryAttribute protocol for DXE?
> > >
> > >
> > > Thanks,
> > > Star
> > > -Original Message-
> > > From: Zeng, Star
> > > Sent: Tuesday, April 3, 2018 8:59 AM
> > > To: Kinney, Michael D ; Heyi Guo
> > > ; edk2-devel@lists.01.org
> > > Cc: Yi Li ; Renhao Liang
> > > ; Dong, Eric ; Gao, Liming
> > > ; Wang, Jian J ; Ni, Ruiyu
> > > ; Zeng, Star 
> > > Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion
> > >
> > > Mike,
> > >
> > > Agree the problem.
> > > We need support only RUNTIME attribute.
> > > We need support only cache attributes.
> > > We need support only page attributes.
> > > We need support RUNTIME + cache + page attributes.
> > > Do we need support the 0 Attributes case to clear page attributes?
> > > There was discussion about the 0 Attributes case at
> > > https://lists.01.org/pipermail/edk2-devel/2018-March/023315.html.
> > > It came to the question that should the 0 Attributes case be handled by
> > > SetMemoryAttributes() to clear the page attributes?
> > >
> > >
> > > Thanks,
> > > Star
> > > -Original Message-
> > > From: Kinney, Michael D
> > > Sent: Tuesday, April 3, 2018 5:43 AM
> > > To: Zeng, Star ; Heyi Guo ; 
> > > edk2-
> > > de...@lists.01.org; Kinney, Michael D 
> > > Cc: Yi Li ; Renhao Liang
> > > ; Dong, Eric ; Gao, Liming
> > > ; Wang, Jian J ; Ni, Ruiyu
> > > 
> > > Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion
> > >
> > > Star,
> > >
> > > This commit breaks Vlv2TbltDevicePkg.
> > >
> > > On this platform, there are 2 calls to
> > > gDS->SetMemorySpaceAttributes() for an MMIO
> > > range to set only the EFI_MEMORY_RUNTIME 

Re: [edk2] [PATCH 1/2] MdeModulePkg SmmMemoryAttribute.h: Refine some comments

2018-04-03 Thread Zeng, Star
Agree (also for patch 2/2).
Thanks for the feedback.
I will update them before pushing


Star
-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Tuesday, April 3, 2018 7:37 PM
To: Zeng, Star ; edk2-devel@lists.01.org
Cc: Yao, Jiewen 
Subject: Re: [edk2] [PATCH 1/2] MdeModulePkg SmmMemoryAttribute.h: Refine some 
comments

Hi Star,

On 04/03/18 03:52, Star Zeng wrote:
> 1. Fix some "support" to "supported".
> 2. Fix some "set" to "clear" in ClearMemoryAttributes interface.
> 3. Remove redundant comments for GetMemoryAttributes interface.
> 
> Cc: Jian J Wang 
> Cc: Jiewen Yao 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> ---
>  MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h | 15 
> ++-
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h 
> b/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h
> index 0700eb51d6e1..012fa2aaec6e 100644
> --- a/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h
> +++ b/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h
> @@ -2,7 +2,7 @@
>SMM Memory Attribute Protocol provides retrieval and update service
>for memory attributes in EFI SMM environment.
>  
> -  Copyright (c) 2017, Intel Corporation. All rights reserved.
> +  Copyright (c) 2017 - 2018, 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 @@ -42,7 +42,7 @@ typedef struct 
> _EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL EDKII_SMM_MEMORY_ATTRIBUTE_P
>@retval EFI_UNSUPPORTED   The processor does not support one or more
>  bytes of the memory resource range specified
>  by BaseAddress and Length.
> -The bit mask of attributes is not support for
> +The bit mask of attributes is not 
> + supported for
>  the memory resource range specified by
>  BaseAddress and Length.
>  
> @@ -64,17 +64,17 @@ EFI_STATUS
>@param  BaseAddress   The physical address that is the start address of
>  a memory region.
>@param  LengthThe size in bytes of the memory region.
> -  @param  AttributesThe bit mask of attributes to set for the memory
> +  @param  AttributesThe bit mask of attributes to clear for the 
> memory
>  region.
>  
> -  @retval EFI_SUCCESS   The attributes were set for the memory 
> region.
> +  @retval EFI_SUCCESS   The attributes were clear for the memory 
> region.

(This is for EDKII_SMM_CLEAR_MEMORY_ATTRIBUTES.)

Please write "were cleared" here, not just "were clear".

With that change:

Reviewed-by: Laszlo Ersek 

Thanks!
Laszlo


>@retval EFI_INVALID_PARAMETER Length is zero.
>  Attributes specified an illegal combination 
> of
>  attributes that cannot be set together.
>@retval EFI_UNSUPPORTED   The processor does not support one or more
>  bytes of the memory resource range specified
>  by BaseAddress and Length.
> -The bit mask of attributes is not support for
> +The bit mask of attributes is not 
> + supported for
>  the memory resource range specified by
>  BaseAddress and Length.
>  
> @@ -89,7 +89,7 @@ EFI_STATUS
>);
>  
>  /**
> -  This function retrieve the attributes of the memory region 
> specified by
> +  This function retrieves the attributes of the memory region 
> + specified by
>BaseAddress and Length. If different attributes are got from different part
>of the memory region, EFI_NO_MAPPING will be returned.
>  
> @@ -107,9 +107,6 @@ EFI_STATUS
>@retval EFI_UNSUPPORTED   The processor does not support one or more
>  bytes of the memory resource range specified
>  by BaseAddress and Length.
> -The bit mask of attributes is not support for
> -the memory resource range specified by
> -BaseAddress and Length.
>  
>  **/
>  typedef
> 

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


Re: [edk2] OVMF package : Question about Qemu/Xen support

2018-04-03 Thread Tiger Liu(BJ-RD)
Hi, Laszlo:
Got it!

Thank you very much!

Best wishes,

-邮件原件-
发件人: Laszlo Ersek [mailto:ler...@redhat.com]
发送时间: 2018年4月3日 18:36
收件人: Tiger Liu(BJ-RD) 
抄送: 'edk2-devel@lists.01.org' ; Anthony Perard 
; Julien Grall ; Marcel 
Apfelbaum 
主题: Re: [edk2] OVMF package : Question about Qemu/Xen support

Hi,

(CC Marcel)

On 04/02/18 08:55, Tiger Liu(BJ-RD) wrote:
> Hi, Laszlo:
> I have a question you would like to ask you.
> Could I study pcie native hot plug feature with ovmf?
>
> It seems qemu emulates Q35 chipset.
> And ovmf provides PciHotPlugInitDxe driver.

Sure. Here's some tips I can give you:

* The first PCI Express -- not traditional PCI -- hotplug feature request for 
OVMF arrived in . That link is 
dead now, because we abandoned the GitHub issue tracker. Instead, the report 
was migrated to .

This issue got solved by adding MMCONFIG (ECAM) config space access to OVMF. 
Without MMCONFIG, PCIe hotplug in the guest OS would not work.
Please see Marcel's analysis in the TianoCore BZ linked above. The edk2 commit 
range is noted in comment 32.

* Once config space access works like that, you need the PCIe enumeration / 
resource assignment (which occurs in the firmware) to account for PCI resources 
*in advance* that hotplugged endpoints *might* require. This means reserving 
various kinds of apertures. On the QEMU side, this is documented in the 
following two text files (in the QEMU tree):

- docs/pcie.txt
- docs/pcie_pci_bridge.txt

In particular there is a "resource reservation hint" PCIe capability (for PCIe 
root ports) that QEMU can populate and OVMF can parse. Then OVMF informs 
PciBusDxe to reserve the appropriate resources.

* PCI_HOT_PLUG_INIT_PROTOCOL (implemented in OVMF by
OvmfPkg/PciHotPlugInitDxe) is defined by the PI spec. Roughly, it has two 
purposes: it can (a) report+initialize non-enumerable [*] hotplug controllers 
(of which QEMU has none) to PciBusDxe, (b) it can convey reservation hints 
("resource paddings") to PciBusDxe. OVMF stubs out the two interfaces related 
to purpose (a), and implements the
GetResourcePadding() member function (purpose (b)) by translating QEMU's PCIe 
capability to the format expected by the PI spec and PciBusDxe.

[*] The PI spec calls this kind of hotplug controller "root" HPC, but that has 
nothing to do with "root" in the PCIe sense. In this terminology, "root HPC" 
simply means "non-enumerable", and "non-root HPC" means "enumerable" through 
the normal PCI(e) traversal.


Hope this helps,
Laszlo


保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for 
the sole use of its intended recipient. Any unauthorized review, use, copying 
or forwarding of this email or the content of this email is strictly prohibited.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion

2018-04-03 Thread Zeng, Star
Sure, I can do that.

Thanks,
Star
-Original Message-
From: Kinney, Michael D 
Sent: Wednesday, April 4, 2018 5:45 AM
To: Yao, Jiewen ; Zeng, Star ; Wang, 
Jian J ; Heyi Guo ; 
edk2-devel@lists.01.org; Kinney, Michael D 
Cc: Ni, Ruiyu ; Yi Li ; Gao, 
Liming ; Dong, Eric ; Renhao Liang 

Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion

Star,

Can you update my patch with the additional comments and commit log message 
that clarifies the behavior of gDS->SetMemorySpaceAttributes() for different 
bit settings?

Thanks,

Mike

> -Original Message-
> From: Yao, Jiewen
> Sent: Monday, April 2, 2018 7:34 PM
> To: Zeng, Star ; Wang, Jian J 
> ; Kinney, Michael D 
> ; Heyi Guo ; 
> edk2-devel@lists.01.org
> Cc: Ni, Ruiyu ; Yi Li ; 
> Gao, Liming ; Dong, Eric ; 
> Renhao Liang 
> Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of attribute 
> conversion
> 
> That is good idea.
> 
> Just add more description as the code comment, please.
> 
> It is easy for code review later.
> 
> Thank you
> Yao Jiewen
> 
> 
> > -Original Message-
> > From: Zeng, Star
> > Sent: Tuesday, April 3, 2018 10:33 AM
> > To: Yao, Jiewen ; Wang, Jian J
> ;
> > Kinney, Michael D ; Heyi
> Guo
> > ; edk2-devel@lists.01.org
> > Cc: Ni, Ruiyu ; Yi Li
> ; Gao,
> > Liming ; Dong, Eric
> ; Renhao
> > Liang ; Zeng, Star
> 
> > Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of
> attribute conversion
> >
> > Agree.
> >
> > And I agree we need the fix at
> > https://lists.01.org/pipermail/edk2-devel/2018-
> April/023364.html from Mike
> > for compatibility.
> > And I think more precious and precise information need
> to be added into the
> > commit log or code comments since we have been crazy
> about handling
> > attributes in the GCD service. :)
> >
> >
> > Thanks,
> > Star
> > -Original Message-
> > From: Yao, Jiewen
> > Sent: Tuesday, April 3, 2018 10:26 AM
> > To: Wang, Jian J ; Zeng, Star
> ;
> > Kinney, Michael D ; Heyi
> Guo
> > ; edk2-devel@lists.01.org
> > Cc: Ni, Ruiyu ; Yi Li
> ; Gao,
> > Liming ; Dong, Eric
> ; Renhao
> > Liang 
> > Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of
> attribute conversion
> >
> > I have a discussion with Star/Jian.
> >
> > The expectation for the CPU driver is to handle
> PageAttribute.
> > The expectation for the platform driver is to use
> GetAttribute(), AND/OR
> > attribute, then call SetAttribute().
> > Because the DRAM always has a cache attribute (no
> matter UC or WB), 0 should
> > not happen. (0 might happen for a GCD reserved memory,
> but there is no need
> > to set page attribute)
> >
> > If all drivers use above way, there won't be any
> issue. There is no need to
> > introduce a new protocol so far.
> >
> > We did encounter some error, because the
> platform/silicon/CPU code is not
> > updated yet. (For example, the MinnowMax which is
> using binary) The fix to
> > filter 0 seems a workable way to resolve the
> compatibility issue.
> >
> > Later, I suggest we update MinnowMax binary - Add
> paging handling for CPU
> > driver, and use GetAttribute()/SetAttribute() for
> platform/silicon code.
> >
> >
> > Thank you
> > Yao Jiewen
> >
> > > -Original Message-
> > > From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of
> > > Wang, Jian J
> > > Sent: Tuesday, April 3, 2018 9:24 AM
> > > To: Zeng, Star ; Kinney,
> Michael D
> > > ; Heyi Guo
> ;
> > > edk2-devel@lists.01.org
> > > Cc: Ni, Ruiyu ; Yi Li
> ;
> > > Gao, Liming ; Dong, Eric
> ;
> > > Renhao Liang 
> > > Subject: Re: [edk2] [PATCH 1/1] MdeModulePkg/Gcd:
> Fix bug of attribute
> > > conversion
> > >
> > > The NX Memory Protection and Heap Guard features
> need to clear paging
> > > attributes.
> > > Allowing 0 attribute is the current only choice
> without changing arch protocol.
> > > Maybe
> > > It's time to introduce a new protocol.
> > >
> > > Regards,
> > > Jian
> > >
> > >
> > > > -Original Message-
> > > 

[edk2] UDK2018 Release Available

2018-04-03 Thread Richardson, Brian
UDK2018 is available for download. This is the latest UEFI Development Kit 
release, based on a validated snapshot of EDK II. Release notes & documentation 
available on the TianoCore wiki.

https://github.com/tianocore/tianocore.github.io/wiki/UDK2018
https://github.com/tianocore/edk2/releases/tag/vUDK2018

Thanks ... br
---
Brian Richardson, Senior Technical Marketing Engineer, Intel Software
brian.richard...@intel.com -- @intel_brian 
(Twitter & WeChat)
https://software.intel.com/en-us/meet-the-developers/evangelists/team/brian-richardson

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


[edk2] [PATCH v1 4/5] BaseTools: AutoGen - use the new shared RegEx

2018-04-03 Thread Jaben Carsey
Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/IdfClassObject.py | 3 ++-
 BaseTools/Source/Python/AutoGen/UniClassObject.py | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/IdfClassObject.py 
b/BaseTools/Source/Python/AutoGen/IdfClassObject.py
index cb72219b40d5..a028aceee927 100644
--- a/BaseTools/Source/Python/AutoGen/IdfClassObject.py
+++ b/BaseTools/Source/Python/AutoGen/IdfClassObject.py
@@ -21,6 +21,7 @@ from Common.Misc import PathClass
 from Common.LongFilePathSupport import LongFilePath
 import re
 import os
+from Common.GlobalData import gIdentifierPattern
 
 IMAGE_TOKEN = re.compile('IMAGE_TOKEN *\(([A-Z0-9_]+) *\)', re.MULTILINE | 
re.UNICODE)
 
@@ -105,7 +106,7 @@ class IdfFileClassObject(object):
 EdkLogger.error("Image Definition File Parser", 
PARSER_ERROR, 'The format is not match #image IMAGE_ID [TRANSPARENT] 
ImageFileName in Line %s of File %s.' % (LineNo, File.Path))
 if Len == 4 and LineDetails[2] != 'TRANSPARENT':
 EdkLogger.error("Image Definition File Parser", 
PARSER_ERROR, 'Please use the keyword "TRANSPARENT" to describe the 
transparency setting in Line %s of File %s.' % (LineNo, File.Path))
-MatchString = re.match('^[a-zA-Z][a-zA-Z0-9_]*$', 
LineDetails[1], re.UNICODE)
+MatchString = gIdentifierPattern.match(LineDetails[1])
 if MatchString is None or MatchString.end(0) != 
len(LineDetails[1]):
 EdkLogger.error('Image Definition  File Parser', 
FORMAT_INVALID, 'The Image token name %s defined in Idf file %s contains the 
invalid character.' % (LineDetails[1], File.Path))
 if LineDetails[1] not in self.ImageIDList:
diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py 
b/BaseTools/Source/Python/AutoGen/UniClassObject.py
index 242402dfaeeb..8b0c563a8c88 100644
--- a/BaseTools/Source/Python/AutoGen/UniClassObject.py
+++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py
@@ -351,7 +351,7 @@ class UniFileClassObject(object):
 Name = Item.split()[1]
 # Check the string name
 if Name != '':
-MatchString = re.match('^[a-zA-Z][a-zA-Z0-9_]*$', Name, re.UNICODE)
+MatchString = gIdentifierPattern.match(Name)
 if MatchString is None or MatchString.end(0) != len(Name):
 EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The 
string token name %s defined in UNI file %s contains the invalid character.' % 
(Name, self.File))
 LanguageList = Item.split(u'#language ')
@@ -521,7 +521,7 @@ class UniFileClassObject(object):
 Language = GetLanguageCode(Language, self.IsCompatibleMode, 
self.File)
 # Check the string name
 if not self.IsCompatibleMode and Name != '':
-MatchString = re.match('^[a-zA-Z][a-zA-Z0-9_]*$', Name, 
re.UNICODE)
+MatchString = gIdentifierPattern.match(Name)
 if MatchString is None or MatchString.end(0) != len(Name):
 EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 
'The string token name %s defined in UNI file %s contains the invalid 
character.' % (Name, self.File))
 self.AddStringToList(Name, Language, Value)
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 2/5] BaseTools: GenFds - move RegEx compile

2018-04-03 Thread Jaben Carsey
compile each RegEx once not in loops/functions

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/GenFds/FdfParser.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py 
b/BaseTools/Source/Python/GenFds/FdfParser.py
index 9b7e898570a3..00e03446421d 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -85,6 +85,7 @@ RegionSizePattern = 
re.compile("\s*(?P(?:0x|0X)?[a-fA-F0-9]+)\s*\|\s*(?P\w+\.\w+)\s*\|\s*(?P\w+\.\w+)\s*")
 RegionOffsetPcdPattern = re.compile("\s*(?P\w+\.\w+)\s*$")
 ShortcutPcdPattern = 
re.compile("\s*\w+\s*=\s*(?P(?:0x|0X)?[a-fA-F0-9]+)\s*\|\s*(?P\w+\.\w+)\s*")
+BaseAddrValuePattern = re.compile('^0[xX][0-9a-fA-F]+')
 
 AllIncludeFileList = []
 
@@ -2211,9 +2212,7 @@ class FdfParser:
 if not self.__GetNextToken():
 raise Warning("expected FV base address value", self.FileName, 
self.CurrentLineNumber)
 
-IsValidBaseAddrValue = re.compile('^0[x|X][0-9a-fA-F]+')
-
-if not IsValidBaseAddrValue.match(self.__Token.upper()):
+if not BaseAddrValuePattern.match(self.__Token.upper()):
 raise Warning("Unknown FV base address value '%s'" % self.__Token, 
self.FileName, self.CurrentLineNumber)
 Obj.FvBaseAddress = self.__Token
 return True  
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 3/5] BaseTools: Add new RegEx pattern to GlobalData

2018-04-03 Thread Jaben Carsey
Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/GlobalData.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/BaseTools/Source/Python/Common/GlobalData.py 
b/BaseTools/Source/Python/Common/GlobalData.py
index fab67601a9e5..f58dc5a8dda2 100644
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -63,6 +63,9 @@ gGuidPatternEnd = re.compile(r'{}$'.format(_GuidPattern))
 g4HexChar = re.compile(r'{}{{4}}'.format(_HexChar))
 gHexPattern = re.compile(r'0[xX]{}+'.format(_HexChar))
 
+## Regular expressions for string identifier checking
+gIdentifierPattern = re.compile('^[a-zA-Z][a-zA-Z0-9_]*$', re.UNICODE)
+
 #
 # A global variable for whether current build in AutoGen phase or not.
 #
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 5/5] BaseTools: remove redundant check

2018-04-03 Thread Jaben Carsey
The RegEx matches begining and end of the string, dont then check length.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/IdfClassObject.py | 2 +-
 BaseTools/Source/Python/AutoGen/UniClassObject.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/IdfClassObject.py 
b/BaseTools/Source/Python/AutoGen/IdfClassObject.py
index a028aceee927..6953854a5247 100644
--- a/BaseTools/Source/Python/AutoGen/IdfClassObject.py
+++ b/BaseTools/Source/Python/AutoGen/IdfClassObject.py
@@ -107,7 +107,7 @@ class IdfFileClassObject(object):
 if Len == 4 and LineDetails[2] != 'TRANSPARENT':
 EdkLogger.error("Image Definition File Parser", 
PARSER_ERROR, 'Please use the keyword "TRANSPARENT" to describe the 
transparency setting in Line %s of File %s.' % (LineNo, File.Path))
 MatchString = gIdentifierPattern.match(LineDetails[1])
-if MatchString is None or MatchString.end(0) != 
len(LineDetails[1]):
+if MatchString is None:
 EdkLogger.error('Image Definition  File Parser', 
FORMAT_INVALID, 'The Image token name %s defined in Idf file %s contains the 
invalid character.' % (LineDetails[1], File.Path))
 if LineDetails[1] not in self.ImageIDList:
 self.ImageIDList.append(LineDetails[1])
diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py 
b/BaseTools/Source/Python/AutoGen/UniClassObject.py
index 8b0c563a8c88..5b879d784d9c 100644
--- a/BaseTools/Source/Python/AutoGen/UniClassObject.py
+++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py
@@ -352,7 +352,7 @@ class UniFileClassObject(object):
 # Check the string name
 if Name != '':
 MatchString = gIdentifierPattern.match(Name)
-if MatchString is None or MatchString.end(0) != len(Name):
+if MatchString is None:
 EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The 
string token name %s defined in UNI file %s contains the invalid character.' % 
(Name, self.File))
 LanguageList = Item.split(u'#language ')
 for IndexI in range(len(LanguageList)):
@@ -522,7 +522,7 @@ class UniFileClassObject(object):
 # Check the string name
 if not self.IsCompatibleMode and Name != '':
 MatchString = gIdentifierPattern.match(Name)
-if MatchString is None or MatchString.end(0) != len(Name):
+if MatchString is None:
 EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 
'The string token name %s defined in UNI file %s contains the invalid 
character.' % (Name, self.File))
 self.AddStringToList(Name, Language, Value)
 continue
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 1/5] BaseTools: Autogen - move RegEx compile

2018-04-03 Thread Jaben Carsey
compile each RegEx once not in loops/functions

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 22 +---
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 3384fdb70b7e..7dd7c35e6685 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -49,6 +49,16 @@ from GenVar import VariableMgr,var_info
 ## Regular expression for splitting Dependency Expression string into tokens
 gDepexTokenPattern = re.compile("(\(|\)|\w+| \S+\.inf)")
 
+## Regular expression for match: PCD(.yyy)
+gPCDAsGuidPattern = re.compile(r"^PCD\(.+\..+\)$")
+
+#
+# Regular expression for finding Include Directories, the difference between 
MSFT and INTEL/GCC/RVCT
+# is the former use /I , the Latter used -I to specify include directories
+#
+gBuildOptIncludePatternMsft = re.compile(r"(?:.*?)/I[ \t]*([^ ]*)", 
re.MULTILINE | re.DOTALL)
+gBuildOptIncludePatternOther = re.compile(r"(?:.*?)-I[ \t]*([^ ]*)", 
re.MULTILINE | re.DOTALL)
+
 #
 # Match name = variable
 #
@@ -818,13 +828,11 @@ class WorkspaceAutoGen(AutoGen):
 InfFoundFlag = False
 
 if FfsFile.NameGuid is not None:
-_CheckPCDAsGuidPattern = re.compile("^PCD\(.+\..+\)$")
-
 #
 # If the NameGuid reference a PCD name. 
 # The style must match: PCD(.yyy)
 #
-if _CheckPCDAsGuidPattern.match(FfsFile.NameGuid):
+if gPCDAsGuidPattern.match(FfsFile.NameGuid):
 #
 # Replace the PCD value.
 #
@@ -3315,9 +3323,9 @@ class ModuleAutoGen(AutoGen):
 # is the former use /I , the Latter used -I to specify include 
directories
 #
 if self.PlatformInfo.ToolChainFamily in ('MSFT'):
-gBuildOptIncludePattern = re.compile(r"(?:.*?)/I[ \t]*([^ 
]*)", re.MULTILINE | re.DOTALL)
+BuildOptIncludeRegEx = gBuildOptIncludePatternMsft
 elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC', 'RVCT'):
-gBuildOptIncludePattern = re.compile(r"(?:.*?)-I[ \t]*([^ 
]*)", re.MULTILINE | re.DOTALL)
+BuildOptIncludeRegEx = gBuildOptIncludePatternOther
 else:
 #
 # New ToolChainFamily, don't known whether there is option to 
specify include directories
@@ -3334,13 +3342,13 @@ class ModuleAutoGen(AutoGen):
 FlagOption = ''
 
 if self.PlatformInfo.ToolChainFamily != 'RVCT':
-IncPathList = [NormPath(Path, self.Macros) for Path in 
gBuildOptIncludePattern.findall(FlagOption)]
+IncPathList = [NormPath(Path, self.Macros) for Path in 
BuildOptIncludeRegEx.findall(FlagOption)]
 else:
 #
 # RVCT may specify a list of directory seperated by commas
 #
 IncPathList = []
-for Path in gBuildOptIncludePattern.findall(FlagOption):
+for Path in BuildOptIncludeRegEx.findall(FlagOption):
 PathList = GetSplitList(Path, TAB_COMMA_SPLIT)
 IncPathList += [NormPath(PathEntry, self.Macros) for 
PathEntry in PathList]
 
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 0/5] BaseTools: RegEx refactoring

2018-04-03 Thread Jaben Carsey
move RegEx compile out of functions/loops
share RegEx when have identical data

Jaben Carsey (5):
  BaseTools: Autogen - move RegEx compile
  BaseTools: GenFds - move RegEx compile
  BaseTools: Add new RegEx pattern to GlobalData
  BaseTools: AutoGen - use the new shared RegEx
  BaseTools: remove redundant check

 BaseTools/Source/Python/AutoGen/AutoGen.py| 22 +---
 BaseTools/Source/Python/AutoGen/IdfClassObject.py |  5 +++--
 BaseTools/Source/Python/AutoGen/UniClassObject.py |  8 +++
 BaseTools/Source/Python/Common/GlobalData.py  |  3 +++
 BaseTools/Source/Python/GenFds/FdfParser.py   |  5 ++---
 5 files changed, 27 insertions(+), 16 deletions(-)

-- 
2.16.2.windows.1

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


Re: [edk2] [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion

2018-04-03 Thread Kinney, Michael D
Star,

Can you update my patch with the additional comments
and commit log message that clarifies the behavior
of gDS->SetMemorySpaceAttributes() for different bit 
settings?

Thanks,

Mike

> -Original Message-
> From: Yao, Jiewen
> Sent: Monday, April 2, 2018 7:34 PM
> To: Zeng, Star ; Wang, Jian J
> ; Kinney, Michael D
> ; Heyi Guo
> ; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu ; Yi Li
> ; Gao, Liming
> ; Dong, Eric
> ; Renhao Liang
> 
> Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of
> attribute conversion
> 
> That is good idea.
> 
> Just add more description as the code comment, please.
> 
> It is easy for code review later.
> 
> Thank you
> Yao Jiewen
> 
> 
> > -Original Message-
> > From: Zeng, Star
> > Sent: Tuesday, April 3, 2018 10:33 AM
> > To: Yao, Jiewen ; Wang, Jian J
> ;
> > Kinney, Michael D ; Heyi
> Guo
> > ; edk2-devel@lists.01.org
> > Cc: Ni, Ruiyu ; Yi Li
> ; Gao,
> > Liming ; Dong, Eric
> ; Renhao
> > Liang ; Zeng, Star
> 
> > Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of
> attribute conversion
> >
> > Agree.
> >
> > And I agree we need the fix at
> > https://lists.01.org/pipermail/edk2-devel/2018-
> April/023364.html from Mike
> > for compatibility.
> > And I think more precious and precise information need
> to be added into the
> > commit log or code comments since we have been crazy
> about handling
> > attributes in the GCD service. :)
> >
> >
> > Thanks,
> > Star
> > -Original Message-
> > From: Yao, Jiewen
> > Sent: Tuesday, April 3, 2018 10:26 AM
> > To: Wang, Jian J ; Zeng, Star
> ;
> > Kinney, Michael D ; Heyi
> Guo
> > ; edk2-devel@lists.01.org
> > Cc: Ni, Ruiyu ; Yi Li
> ; Gao,
> > Liming ; Dong, Eric
> ; Renhao
> > Liang 
> > Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of
> attribute conversion
> >
> > I have a discussion with Star/Jian.
> >
> > The expectation for the CPU driver is to handle
> PageAttribute.
> > The expectation for the platform driver is to use
> GetAttribute(), AND/OR
> > attribute, then call SetAttribute().
> > Because the DRAM always has a cache attribute (no
> matter UC or WB), 0 should
> > not happen. (0 might happen for a GCD reserved memory,
> but there is no need
> > to set page attribute)
> >
> > If all drivers use above way, there won't be any
> issue. There is no need to
> > introduce a new protocol so far.
> >
> > We did encounter some error, because the
> platform/silicon/CPU code is not
> > updated yet. (For example, the MinnowMax which is
> using binary) The fix to
> > filter 0 seems a workable way to resolve the
> compatibility issue.
> >
> > Later, I suggest we update MinnowMax binary - Add
> paging handling for CPU
> > driver, and use GetAttribute()/SetAttribute() for
> platform/silicon code.
> >
> >
> > Thank you
> > Yao Jiewen
> >
> > > -Original Message-
> > > From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of
> > > Wang, Jian J
> > > Sent: Tuesday, April 3, 2018 9:24 AM
> > > To: Zeng, Star ; Kinney,
> Michael D
> > > ; Heyi Guo
> ;
> > > edk2-devel@lists.01.org
> > > Cc: Ni, Ruiyu ; Yi Li
> ;
> > > Gao, Liming ; Dong, Eric
> ;
> > > Renhao Liang 
> > > Subject: Re: [edk2] [PATCH 1/1] MdeModulePkg/Gcd:
> Fix bug of attribute
> > > conversion
> > >
> > > The NX Memory Protection and Heap Guard features
> need to clear paging
> > > attributes.
> > > Allowing 0 attribute is the current only choice
> without changing arch protocol.
> > > Maybe
> > > It's time to introduce a new protocol.
> > >
> > > Regards,
> > > Jian
> > >
> > >
> > > > -Original Message-
> > > > From: Zeng, Star
> > > > Sent: Tuesday, April 03, 2018 9:16 AM
> > > > To: Kinney, Michael D
> ; Heyi Guo
> > > > ; edk2-devel@lists.01.org
> > > > Cc: Yi Li ; Renhao Liang
> > > > ; Dong, Eric
> ; Gao,
> > > > Liming ; Wang, Jian J
> ;
> > > > Ni, Ruiyu ; Zeng, Star
> 
> > > > Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug
> of attribute
> > > > conversion
> > > >
> > > > Current 

[edk2] [PATCH v1 01/10] BaseTools: Use local variable for list of constants.

2018-04-03 Thread Jaben Carsey
instead of listing in multiple places, use a single list.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/GenC.py | 30 +++-
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenC.py 
b/BaseTools/Source/Python/AutoGen/GenC.py
index 4d9ea1b2a8b1..8d76aabd5367 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -41,6 +41,8 @@ gItemTypeStringDatabase  = {
 TAB_PCDS_DYNAMIC_EX_HII :   '',
 }
 
+_NumericDataTypesList = ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN']
+
 ## Dynamic PCD types
 gDynamicPcd = [TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, 
TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_HII]
 
@@ -869,7 +871,7 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH):
 TokenCNameList.append(TokenCName)
 
 def GetPcdSize(Pcd):
-if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN']:
+if Pcd.DatumType not in _NumericDataTypesList:
 Value = Pcd.DefaultValue
 if Value in [None, '']:
 return 1
@@ -975,7 +977,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
 AutoGenH.Append('// #define %s  %s\n' % (PcdTokenName, 
PcdExTokenName))
 AutoGenH.Append('// #define %s  LibPcdGetEx%s(&%s, %s)\n' % 
(GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
 AutoGenH.Append('// #define %s  LibPcdGetExSize(&%s, %s)\n' % 
(GetModeSizeName,Pcd.TokenSpaceGuidCName, PcdTokenName))
-if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 
'BOOLEAN']:
+if Pcd.DatumType not in _NumericDataTypesList:
 AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer)  
LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, 
DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
 AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer)  
LibPcdSetEx%sS(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, 
DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
 else:
@@ -985,7 +987,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
 AutoGenH.Append('#define %s  %s\n' % (PcdTokenName, 
PcdExTokenName))
 AutoGenH.Append('#define %s  LibPcdGetEx%s(&%s, %s)\n' % 
(GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
 AutoGenH.Append('#define %s LibPcdGetExSize(&%s, %s)\n' % 
(GetModeSizeName,Pcd.TokenSpaceGuidCName, PcdTokenName))
-if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 
'BOOLEAN']:
+if Pcd.DatumType not in _NumericDataTypesList:
 AutoGenH.Append('#define %s(SizeOfBuffer, Buffer)  
LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, 
DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
 AutoGenH.Append('#define %s(SizeOfBuffer, Buffer)  
LibPcdSetEx%sS(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, 
DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
 else:
@@ -1004,7 +1006,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
 else:
 AutoGenH.Append('#define %s  LibPcdGet%s(%s)\n' % (GetModeName, 
DatumSizeLib, PcdTokenName))
 AutoGenH.Append('#define %s  LibPcdGetSize(%s)\n' % 
(GetModeSizeName, PcdTokenName))
-if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 
'BOOLEAN']:
+if Pcd.DatumType not in _NumericDataTypesList:
 AutoGenH.Append('#define %s(SizeOfBuffer, Buffer)  
LibPcdSet%s(%s, (SizeOfBuffer), (Buffer))\n' %(SetModeName, DatumSizeLib, 
PcdTokenName))
 AutoGenH.Append('#define %s(SizeOfBuffer, Buffer)  
LibPcdSet%sS(%s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, 
DatumSizeLib, PcdTokenName))
 else:
@@ -1081,7 +1083,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
 ExtraData="[%s]" % str(Info))
 if not Value.endswith('U'):
 Value += 'U'
-if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 
'BOOLEAN']:
+if Pcd.DatumType not in _NumericDataTypesList:
 if Pcd.MaxDatumSize is None or Pcd.MaxDatumSize == '':
 EdkLogger.error("build", AUTOGEN_ERROR,
 "Unknown [MaxDatumSize] of PCD [%s.%s]" % 
(Pcd.TokenSpaceGuidCName, TokenCName),
@@ -1132,7 +1134,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
 else:
 PcdValueName = '_PCD_VALUE_' + TokenCName
 
-if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 
'BOOLEAN']:
+if Pcd.DatumType not in _NumericDataTypesList:
 #
 # For 

[edk2] [PATCH v1 05/10] BaseTools - AutoGen - replace custom dictionary class with python standard one

2018-04-03 Thread Jaben Carsey
We have a custom ordered dictionary class.  works fine with python OrderedDict 
version.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 31 ++--
 BaseTools/Source/Python/AutoGen/GenMake.py |  3 +-
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 3384fdb70b7e..3865827f26df 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -45,6 +45,7 @@ import InfSectionParser
 import datetime
 import hashlib
 from GenVar import VariableMgr,var_info
+from collections import OrderedDict
 
 ## Regular expression for splitting Dependency Expression string into tokens
 gDepexTokenPattern = re.compile("(\(|\)|\w+| \S+\.inf)")
@@ -892,7 +893,7 @@ class WorkspaceAutoGen(AutoGen):
 ]
 
 # This dict store PCDs which are not used by any modules with 
specified arches
-UnusedPcd = sdict()
+UnusedPcd = OrderedDict()
 for Pa in self.AutoGenObjectList:
 # Key of DSC's Pcds dictionary is PcdCName, TokenSpaceGuid
 for Pcd in Pa.Platform.Pcds:
@@ -2084,7 +2085,7 @@ class PlatformAutoGen(AutoGen):
 ## Generate Token Number for all PCD
 def _GetPcdTokenNumbers(self):
 if self._PcdTokenNumber is None:
-self._PcdTokenNumber = sdict()
+self._PcdTokenNumber = OrderedDict()
 TokenNumber = 1
 #
 # Make the Dynamic and DynamicEx PCD use within different 
TokenNumber area. 
@@ -2207,8 +2208,8 @@ class PlatformAutoGen(AutoGen):
 # EdkII module
 LibraryConsumerList = [Module]
 Constructor = []
-ConsumedByList  = sdict()
-LibraryInstance = sdict()
+ConsumedByList  = OrderedDict()
+LibraryInstance = OrderedDict()
 
 EdkLogger.verbose("")
 EdkLogger.verbose("Library instances of module [%s] [%s]:" % 
(str(Module), self.Arch))
@@ -2880,14 +2881,14 @@ class ModuleAutoGen(AutoGen):
 self._DerivedPackageList  = None
 self._ModulePcdList   = None
 self._LibraryPcdList  = None
-self._PcdComments = sdict()
+self._PcdComments = OrderedDict()
 self._GuidList= None
 self._GuidsUsedByPcd = None
-self._GuidComments = sdict()
+self._GuidComments = OrderedDict()
 self._ProtocolList= None
-self._ProtocolComments = sdict()
+self._ProtocolComments = OrderedDict()
 self._PpiList = None
-self._PpiComments = sdict()
+self._PpiComments = OrderedDict()
 self._DepexList   = None
 self._DepexExpressionList = None
 self._BuildOption = None
@@ -2943,7 +2944,7 @@ class ModuleAutoGen(AutoGen):
 # Macros could be used in build_rule.txt (also Makefile)
 def _GetMacros(self):
 if self._Macro is None:
-self._Macro = sdict()
+self._Macro = OrderedDict()
 self._Macro["WORKSPACE" ] = self.WorkspaceDir
 self._Macro["MODULE_NAME"   ] = self.Name
 self._Macro["MODULE_NAME_GUID"  ] = self._GetUniqueBaseName()
@@ -3695,7 +3696,7 @@ class ModuleAutoGen(AutoGen):
 #
 def _GetLibraryPcdList(self):
 if self._LibraryPcdList is None:
-Pcds = sdict()
+Pcds = OrderedDict()
 if not self.IsLibrary:
 # get PCDs from dependent libraries
 for Library in self.DependentLibraryList:
@@ -3717,7 +3718,7 @@ class ModuleAutoGen(AutoGen):
 #
 def _GetGuidList(self):
 if self._GuidList is None:
-self._GuidList = sdict()
+self._GuidList = OrderedDict()
 self._GuidList.update(self.Module.Guids)
 for Library in self.DependentLibraryList:
 self._GuidList.update(Library.Guids)
@@ -3727,7 +3728,7 @@ class ModuleAutoGen(AutoGen):
 
 def GetGuidsUsedByPcd(self):
 if self._GuidsUsedByPcd is None:
-self._GuidsUsedByPcd = sdict()
+self._GuidsUsedByPcd = OrderedDict()
 self._GuidsUsedByPcd.update(self.Module.GetGuidsUsedByPcd())
 for Library in self.DependentLibraryList:
 self._GuidsUsedByPcd.update(Library.GetGuidsUsedByPcd())
@@ -3738,7 +3739,7 @@ class ModuleAutoGen(AutoGen):
 #
 def _GetProtocolList(self):
 if self._ProtocolList is None:
-self._ProtocolList = sdict()
+self._ProtocolList = OrderedDict()
 self._ProtocolList.update(self.Module.Protocols)
 for Library in self.DependentLibraryList:

[edk2] [PATCH v1 09/10] BaseTools: Workspace - use built in OrderedDict instead of custom version.

2018-04-03 Thread Jaben Carsey
We dont use any feature added by custom dictionary class.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py| 24 -
 BaseTools/Source/Python/Workspace/InfBuildData.py| 52 +---
 BaseTools/Source/Python/Workspace/WorkspaceCommon.py |  3 +-
 3 files changed, 36 insertions(+), 43 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index cf9608651269..6766f059b0f7 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -635,7 +635,7 @@ class DscBuildData(PlatformBuildClassObject):
 ## Retrieve [SkuIds] section information
 def _GetSkuIds(self):
 if self._SkuIds is None:
-self._SkuIds = sdict()
+self._SkuIds = OrderedDict()
 RecordList = self._RawData[MODEL_EFI_SKU_ID, self._Arch]
 for Record in RecordList:
 if Record[0] in [None, '']:
@@ -662,7 +662,7 @@ class DscBuildData(PlatformBuildClassObject):
 return int(intstr,16) if intstr.upper().startswith("0X") else 
int(intstr)
 def _GetDefaultStores(self):
 if self.DefaultStores is None:
-self.DefaultStores = sdict()
+self.DefaultStores = OrderedDict()
 RecordList = self._RawData[MODEL_EFI_DEFAULT_STORES, self._Arch]
 for Record in RecordList:
 if Record[0] in [None, '']:
@@ -692,7 +692,7 @@ class DscBuildData(PlatformBuildClassObject):
 if self._Modules is not None:
 return self._Modules
 
-self._Modules = sdict()
+self._Modules = OrderedDict()
 RecordList = self._RawData[MODEL_META_DATA_COMPONENT, self._Arch]
 Macros = self._Macros
 Macros["EDK_SOURCE"] = GlobalData.gEcpSource
@@ -1122,7 +1122,7 @@ class DscBuildData(PlatformBuildClassObject):
 ## Retrieve all PCD settings in platform
 def _GetPcds(self):
 if self._Pcds is None:
-self._Pcds = sdict()
+self._Pcds = OrderedDict()
 self.__ParsePcdFromCommandLine()
 self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))
 self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE))
@@ -1157,7 +1157,7 @@ class DscBuildData(PlatformBuildClassObject):
 ## Retrieve [BuildOptions]
 def _GetBuildOptions(self):
 if self._BuildOptions is None:
-self._BuildOptions = sdict()
+self._BuildOptions = OrderedDict()
 #
 # Retrieve build option for EDKII and EDK style module
 #
@@ -1179,9 +1179,9 @@ class DscBuildData(PlatformBuildClassObject):
 
 def GetBuildOptionsByModuleType(self, Edk, ModuleType):
 if self._ModuleTypeOptions is None:
-self._ModuleTypeOptions = sdict()
+self._ModuleTypeOptions = OrderedDict()
 if (Edk, ModuleType) not in self._ModuleTypeOptions:
-options = sdict()
+options = OrderedDict()
 self._ModuleTypeOptions[Edk, ModuleType] = options
 DriverType = '%s.%s' % (Edk, ModuleType)
 CommonDriverType = '%s.%s' % ('COMMON', ModuleType)
@@ -1446,7 +1446,7 @@ class DscBuildData(PlatformBuildClassObject):
 #   @retval a dict object contains settings of given PCD type
 #
 def _GetPcd(self, Type):
-Pcds = sdict()
+Pcds = OrderedDict()
 #
 # tdict is a special dict kind of type, used for selecting correct
 # PCD settings for certain ARCH
@@ -1457,7 +1457,7 @@ class DscBuildData(PlatformBuildClassObject):
 PcdSet = set()
 # Find out all possible PCD candidates for self._Arch
 RecordList = self._RawData[Type, self._Arch]
-PcdValueDict = sdict()
+PcdValueDict = OrderedDict()
 for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, 
Dummy4,Dummy5 in RecordList:
 SkuName = SkuName.upper()
 SkuName = 'DEFAULT' if SkuName == 'COMMON' else SkuName
@@ -2230,7 +2230,7 @@ class DscBuildData(PlatformBuildClassObject):
 def _GetDynamicPcd(self, Type):
 
 
-Pcds = sdict()
+Pcds = OrderedDict()
 #
 # tdict is a special dict kind of type, used for selecting correct
 # PCD settings for certain ARCH and SKU
@@ -2395,7 +2395,7 @@ class DscBuildData(PlatformBuildClassObject):
 
 VariableAttrs = {}
 
-Pcds = sdict()
+Pcds = OrderedDict()
 #
 # tdict is a special dict kind of type, used for selecting correct
 # PCD settings for certain ARCH and SKU
@@ -2557,7 +2557,7 @@ class DscBuildData(PlatformBuildClassObject):
 def _GetDynamicVpdPcd(self, Type):
 
 
-Pcds = sdict()
+ 

[edk2] [PATCH v1 04/10] BaseTools: remove unused import statement

2018-04-03 Thread Jaben Carsey
Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/GenFds/GenFds.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/GenFds.py 
b/BaseTools/Source/Python/GenFds/GenFds.py
index 49e26424bbfc..810a1f86e948 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -24,7 +24,6 @@ import Common.BuildToolError as BuildToolError
 from GenFdsGlobalVariable import GenFdsGlobalVariable
 from Workspace.WorkspaceDatabase import WorkspaceDatabase
 from Workspace.BuildClassObject import PcdClassObject
-from Workspace.BuildClassObject import ModuleBuildClassObject
 import RuleComplexFile
 from EfiSection import EfiSection
 import StringIO
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 03/10] BaseTools: Eot tool never populates this dictionary

2018-04-03 Thread Jaben Carsey
we initialize this dict and then check it's contents, but never add items.
we can remove it without any effect.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Eot/Eot.py   | 8 
 BaseTools/Source/Python/Eot/EotGlobalData.py | 4 
 2 files changed, 12 deletions(-)

diff --git a/BaseTools/Source/Python/Eot/Eot.py 
b/BaseTools/Source/Python/Eot/Eot.py
index c4164199acf3..45c97bb258f2 100644
--- a/BaseTools/Source/Python/Eot/Eot.py
+++ b/BaseTools/Source/Python/Eot/Eot.py
@@ -340,14 +340,6 @@ class Eot(object):
 GuidMacro2 = ''
 GuidValue = ''
 
-# Find value for hardcode guid macro
-if GuidName in EotGlobalData.gGuidMacroDict:
-GuidMacro = EotGlobalData.gGuidMacroDict[GuidName][0]
-GuidValue = EotGlobalData.gGuidMacroDict[GuidName][1]
-SqlCommand = """update Report set GuidMacro = '%s', GuidValue 
= '%s' where GuidName = '%s'""" %(GuidMacro, GuidValue, GuidName)
-EotGlobalData.gDb.TblReport.Exec(SqlCommand)
-continue
-
 # Find guid value defined in Dec file
 if GuidName in EotGlobalData.gGuidDict:
 GuidValue = EotGlobalData.gGuidDict[GuidName]
diff --git a/BaseTools/Source/Python/Eot/EotGlobalData.py 
b/BaseTools/Source/Python/Eot/EotGlobalData.py
index a4654853ab5e..dea4206e9d48 100644
--- a/BaseTools/Source/Python/Eot/EotGlobalData.py
+++ b/BaseTools/Source/Python/Eot/EotGlobalData.py
@@ -72,10 +72,6 @@ gOP_SOURCE_FILES = open(gSOURCE_FILES, 'w+')
 # Dict for GUID found in DEC files
 gGuidDict = dict()
 
-# Dict for hard coded GUID Macros
-# {GuidName : [GuidMacro : GuidValue]}
-gGuidMacroDict = sdict()
-
 # Dict for PPI
 gPpiList = {}
 
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 07/10] BaseTools: use built in OrderedDict instead of custom version.

2018-04-03 Thread Jaben Carsey
We dont use any feature added by custom dictionary class.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/DscClassObject.py|  4 ++--
 BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py   | 10 
 BaseTools/Source/Python/CommonDataClass/PackageClass.py |  4 ++--
 BaseTools/Source/Python/Eot/EotGlobalData.py| 10 
 BaseTools/Source/Python/Eot/Parser.py   |  3 +--
 BaseTools/Source/Python/Workspace/BuildClassObject.py   |  4 ++--
 BaseTools/Source/Python/Workspace/DecBuildData.py   | 24 
++--
 BaseTools/Source/Python/build/build.py  | 10 
 8 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/BaseTools/Source/Python/Common/DscClassObject.py 
b/BaseTools/Source/Python/Common/DscClassObject.py
index da3101ae0fe9..cff9ab0eefb2 100644
--- a/BaseTools/Source/Python/Common/DscClassObject.py
+++ b/BaseTools/Source/Python/Common/DscClassObject.py
@@ -25,7 +25,7 @@ from Dictionary import *
 from CommonDataClass.PlatformClass import *
 from CommonDataClass.CommonClass import SkuInfoClass
 from BuildToolError import *
-from Misc import sdict
+from collections import OrderedDict
 import GlobalData
 from Table.TableDsc import TableDsc
 from Common.LongFilePathSupport import OpenLongFilePath as open
@@ -732,7 +732,7 @@ class Dsc(object):
 #
 def GenComponents(self, ContainerFile):
 EdkLogger.debug(2, "Generate %s ..." % TAB_COMPONENTS)
-Components = sdict()
+Components = OrderedDict()
 #
 # Get all include files
 #
diff --git a/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py 
b/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py
index c0966d526519..c4f45b7c59c2 100644
--- a/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py
+++ b/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py
@@ -22,7 +22,7 @@ from DecClassObject import *
 from DscClassObject import *
 from String import *
 from BuildToolError import *
-from Misc import sdict
+from collections import OrderedDict
 import Database as Database
 import time as time
 
@@ -189,7 +189,7 @@ class ModuleBuildClassObject(object):
 
 self.Binaries= []
 self.Sources = []
-self.LibraryClasses  = sdict()
+self.LibraryClasses  = OrderedDict()
 self.Libraries   = []
 self.Protocols   = []
 self.Ppis= []
@@ -955,8 +955,8 @@ class WorkspaceBuild(object):
 # EdkII module
 LibraryConsumerList = [Module]
 Constructor = []
-ConsumedByList  = sdict()
-LibraryInstance = sdict()
+ConsumedByList  = OrderedDict()
+LibraryInstance = OrderedDict()
 
 EdkLogger.verbose("")
 EdkLogger.verbose("Library instances of module [%s] [%s]:" % 
(str(Module), Arch))
@@ -1097,7 +1097,7 @@ class WorkspaceBuild(object):
 # The DAG Topo sort produces the destructor order, so the list of 
constructors must generated in the reverse order
 #
 SortedLibraryList.reverse()
-Module.LibraryClasses = sdict()
+Module.LibraryClasses = OrderedDict()
 for L in SortedLibraryList:
 for Lc in L.LibraryClass:
 Module.LibraryClasses[Lc.LibraryClass, ModuleType] = str(L)
diff --git a/BaseTools/Source/Python/CommonDataClass/PackageClass.py 
b/BaseTools/Source/Python/CommonDataClass/PackageClass.py
index 89d4d0797fe1..ba7d7eb67911 100644
--- a/BaseTools/Source/Python/CommonDataClass/PackageClass.py
+++ b/BaseTools/Source/Python/CommonDataClass/PackageClass.py
@@ -14,7 +14,7 @@
 # Import Modules
 #
 from CommonClass import *
-from Common.Misc import sdict
+from collections import OrderedDict
 
 ## PackageHeaderClass
 #
@@ -107,7 +107,7 @@ class PackageClass(object):
 self.IndustryStdHeaders = []
 self.ModuleFiles = []
 # {[Guid, Value, Path(relative to WORKSPACE)]: ModuleClassObj}
-self.Modules = sdict()
+self.Modules = OrderedDict()
 self.PackageIncludePkgHeaders = []
 self.GuidDeclarations = []
 self.ProtocolDeclarations = []
diff --git a/BaseTools/Source/Python/Eot/EotGlobalData.py 
b/BaseTools/Source/Python/Eot/EotGlobalData.py
index dea4206e9d48..7689b76da9d6 100644
--- a/BaseTools/Source/Python/Eot/EotGlobalData.py
+++ b/BaseTools/Source/Python/Eot/EotGlobalData.py
@@ -11,7 +11,7 @@
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #
 
-from Common.Misc import sdict
+from collections import OrderedDict
 from Common.LongFilePathSupport import OpenLongFilePath as open
 
 gEFI_SOURCE = ''
@@ -79,12 +79,12 @@ gPpiList = {}
 gProtocolList = {}
 
 # Dict for consumed PPI 

[edk2] [PATCH v1 08/10] BaseTools: use combined version of OrderedDict

2018-04-03 Thread Jaben Carsey
since we need order and a default entry, use collections dicts to
auto generate.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Workspace/WorkspaceCommon.py | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py 
b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
index abe34cf9a071..8c27b4ad5b9b 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
@@ -12,11 +12,17 @@
 #
 
 from Common.Misc import sdict
+from collections import OrderedDict, defaultdict
 from Common.DataType import SUP_MODULE_USER_DEFINED
 from BuildClassObject import LibraryClassObject
 import Common.GlobalData as GlobalData
 from Workspace.BuildClassObject import StructurePcd
 
+class OrderedListDict(OrderedDict, defaultdict):
+def __init__(self, *args, **kwargs):
+super(OrderedListDict, self).__init__(*args, **kwargs)
+self.default_factory = list
+
 ## Get all packages from platform for specified arch, target and toolchain
 #
 #  @param Platform: DscBuildData instance
@@ -106,7 +112,7 @@ def _GetModuleLibraryInstances(Module, Platform, 
BuildDatabase, Arch, Target, To
 # EdkII module
 LibraryConsumerList = [Module]
 Constructor = []
-ConsumedByList = sdict()
+ConsumedByList = OrderedListDict()
 LibraryInstance = sdict()
 
 while len(LibraryConsumerList) > 0:
@@ -145,8 +151,6 @@ def _GetModuleLibraryInstances(Module, Platform, 
BuildDatabase, Arch, Target, To
 if LibraryModule.ConstructorList != [] and LibraryModule not in 
Constructor:
 Constructor.append(LibraryModule)
 
-if LibraryModule not in ConsumedByList:
-ConsumedByList[LibraryModule] = []
 # don't add current module itself to consumer list
 if M != Module:
 if M in ConsumedByList[LibraryModule]:
@@ -164,7 +168,7 @@ def _GetModuleLibraryInstances(Module, Platform, 
BuildDatabase, Arch, Target, To
 for LibraryClassName in LibraryInstance:
 M = LibraryInstance[LibraryClassName]
 LibraryList.append(M)
-if ConsumedByList[M] == []:
+if len(ConsumedByList[M]) == 0:
 Q.append(M)
 
 #
@@ -185,7 +189,7 @@ def _GetModuleLibraryInstances(Module, Platform, 
BuildDatabase, Arch, Target, To
 # remove edge e from the graph if Node has no constructor
 ConsumedByList[Item].remove(Node)
 EdgeRemoved = True
-if ConsumedByList[Item] == []:
+if len(ConsumedByList[Item]) == 0:
 # insert Item into Q
 Q.insert(0, Item)
 break
@@ -207,7 +211,7 @@ def _GetModuleLibraryInstances(Module, Platform, 
BuildDatabase, Arch, Target, To
 # remove edge e from the graph
 ConsumedByList[Item].remove(Node)
 
-if ConsumedByList[Item] != []:
+if len(ConsumedByList[Item]) != 0:
 continue
 # insert Item into Q, if Item has no other incoming edges
 Q.insert(0, Item)
@@ -216,7 +220,7 @@ def _GetModuleLibraryInstances(Module, Platform, 
BuildDatabase, Arch, Target, To
 # if any remaining node Item in the graph has a constructor and an 
incoming edge, then the graph has a cycle
 #
 for Item in LibraryList:
-if ConsumedByList[Item] != [] and Item in Constructor and 
len(Constructor) > 1:
+if len(ConsumedByList[Item]) != 0 and Item in Constructor and 
len(Constructor) > 1:
 return []
 if Item not in SortedLibraryList:
 SortedLibraryList.append(Item)
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 10/10] BaseTools: Remove unused code from Misc

2018-04-03 Thread Jaben Carsey
remove the functions and classes
remove any imports of these

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/Misc.py | 280 +---
 BaseTools/Source/Python/Eot/Eot.py |   1 -
 2 files changed, 1 insertion(+), 280 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index d1752d8a624e..5e9a104305c2 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -287,32 +287,6 @@ def ClearDuplicatedInf():
 if os.path.exists(File):
 os.remove(File)
 
-## callback routine for processing variable option
-#
-# This function can be used to process variable number of option values. The
-# typical usage of it is specify architecure list on command line.
-# (e.g.  -a IA32 X64 IPF)
-#
-# @param  OptionStandard callback function parameter
-# @param  OptionString  Standard callback function parameter
-# @param  Value Standard callback function parameter
-# @param  ParserStandard callback function parameter
-#
-# @retval
-#
-def ProcessVariableArgument(Option, OptionString, Value, Parser):
-assert Value is None
-Value = []
-RawArgs = Parser.rargs
-while RawArgs:
-Arg = RawArgs[0]
-if (Arg[:2] == "--" and len(Arg) > 2) or \
-   (Arg[:1] == "-" and len(Arg) > 1 and Arg[1] != "-"):
-break
-Value.append(Arg)
-del RawArgs[0]
-setattr(Parser.values, Option.dest, Value)
-
 ## Convert GUID string in ---- style to C 
structure style
 #
 #   @param  GuidThe GUID string
@@ -450,32 +424,6 @@ def RemoveDirectory(Directory, Recursively=False):
 os.chdir(CurrentDirectory)
 os.rmdir(Directory)
 
-## Check if given file is changed or not
-#
-#  This method is used to check if a file is changed or not between two build
-#  actions. It makes use a cache to store files timestamp.
-#
-#   @param  FileThe path of file
-#
-#   @retval TrueIf the given file is changed, doesn't exist, or can't 
be
-#   found in timestamp cache
-#   @retval False   If the given file is changed
-#
-def IsChanged(File):
-if not os.path.exists(File):
-return True
-
-FileState = os.stat(File)
-TimeStamp = FileState[-2]
-
-if File in gFileTimeStampCache and TimeStamp == gFileTimeStampCache[File]:
-FileChanged = False
-else:
-FileChanged = True
-gFileTimeStampCache[File] = TimeStamp
-
-return FileChanged
-
 ## Store content in file
 #
 #  This method is used to save file only when its content is changed. This is
@@ -635,47 +583,6 @@ class DirCache:
 return os.path.join(self._Root, self._UPPER_CACHE_[UpperPath])
 return None
 
-## Get all files of a directory
-#
-# @param Root:   Root dir
-# @param SkipList :  The files need be skipped
-#
-# @retval  A list of all files
-#
-def GetFiles(Root, SkipList=None, FullPath=True):
-OriPath = Root
-FileList = []
-for Root, Dirs, Files in os.walk(Root):
-if SkipList:
-for Item in SkipList:
-if Item in Dirs:
-Dirs.remove(Item)
-
-for File in Files:
-File = os.path.normpath(os.path.join(Root, File))
-if not FullPath:
-File = File[len(OriPath) + 1:]
-FileList.append(File)
-
-return FileList
-
-## Check if gvien file exists or not
-#
-#   @param  FileFile name or path to be checked
-#   @param  Dir The directory the file is relative to
-#
-#   @retval Trueif file exists
-#   @retval False   if file doesn't exists
-#
-def ValidFile(File, Ext=None):
-if Ext is not None:
-Dummy, FileExt = os.path.splitext(File)
-if FileExt.lower() != Ext.lower():
-return False
-if not os.path.exists(File):
-return False
-return True
-
 def RealPath(File, Dir='', OverrideDir=''):
 NewFile = os.path.normpath(os.path.join(Dir, File))
 NewFile = GlobalData.gAllFiles[NewFile]
@@ -710,115 +617,6 @@ def RealPath2(File, Dir='', OverrideDir=''):
 
 return None, None
 
-## Check if gvien file exists or not
-#
-#
-def ValidFile2(AllFiles, File, Ext=None, Workspace='', EfiSource='', 
EdkSource='', Dir='.', OverrideDir=''):
-NewFile = File
-if Ext is not None:
-Dummy, FileExt = os.path.splitext(File)
-if FileExt.lower() != Ext.lower():
-return False, File
-
-# Replace the Edk macros
-if OverrideDir != '' and OverrideDir is not None:
-if OverrideDir.find('$(EFI_SOURCE)') > -1:
-OverrideDir = OverrideDir.replace('$(EFI_SOURCE)', EfiSource)
-if OverrideDir.find('$(EDK_SOURCE)') > -1:
-OverrideDir = 

[edk2] [PATCH v1 02/10] BaseTools: use built in dict instead of custom version.

2018-04-03 Thread Jaben Carsey
We dont use any feature added by custom dictionary class.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Eot/EotGlobalData.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Eot/EotGlobalData.py 
b/BaseTools/Source/Python/Eot/EotGlobalData.py
index dd4ff4cf5eb6..a4654853ab5e 100644
--- a/BaseTools/Source/Python/Eot/EotGlobalData.py
+++ b/BaseTools/Source/Python/Eot/EotGlobalData.py
@@ -70,7 +70,7 @@ gSOURCE_FILES = 'Log_SourceFiles.log'
 gOP_SOURCE_FILES = open(gSOURCE_FILES, 'w+')
 
 # Dict for GUID found in DEC files
-gGuidDict = sdict()
+gGuidDict = dict()
 
 # Dict for hard coded GUID Macros
 # {GuidName : [GuidMacro : GuidValue]}
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 06/10] BaseTools: Eot remove unused code

2018-04-03 Thread Jaben Carsey
2 functions and a dictionary that are not used.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Eot/FvImage.py | 21 
 1 file changed, 21 deletions(-)

diff --git a/BaseTools/Source/Python/Eot/FvImage.py 
b/BaseTools/Source/Python/Eot/FvImage.py
index affca4e71e8a..472ae400506d 100644
--- a/BaseTools/Source/Python/Eot/FvImage.py
+++ b/BaseTools/Source/Python/Eot/FvImage.py
@@ -138,7 +138,6 @@ class FirmwareVolume(Image):
 self.FfsDict = sdict()
 self.OrderedFfsDict = sdict()
 self.UnDispatchedFfsDict = sdict()
-self.NoDepexFfsDict = sdict()
 self.ProtocolList = sdict()
 
 def CheckArchProtocol(self):
@@ -284,26 +283,6 @@ class FirmwareVolume(Image):
 
 self.DisPatchDxe(Db)
 
-def DisPatchNoDepexFfs(self, Db):
-# Last Load Drivers without Depex
-for FfsID in self.NoDepexFfsDict:
-NewFfs = self.NoDepexFfsDict.pop(FfsID)
-self.OrderedFfsDict[FfsID] = NewFfs
-self.LoadProtocol(Db, FfsID)
-
-return True
-
-def LoadCallbackProtocol(self):
-IsLoad = True
-for Protocol in self.ProtocolList:
-for Callback in self.ProtocolList[Protocol][1]:
-if Callback[0] not in self.OrderedFfsDict.keys():
-IsLoad = False
-continue
-if IsLoad:
-EotGlobalData.gProtocolList[Protocol.lower()] = 
self.ProtocolList[Protocol][0]
-self.ProtocolList.pop(Protocol)
-
 def LoadProtocol(self, Db, ModuleGuid):
 SqlCommand = """select GuidValue from Report
 where SourceFileFullPath in
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 00/10] BaseTools: refactor code

2018-04-03 Thread Jaben Carsey
remove sdict class use and replace with built in types
remove unused code

Jaben Carsey (10):
  BaseTools: Use local variable for list of constants.
  BaseTools: use built in dict instead of custom version.
  BaseTools: Eot tool never populates this dictionary
  BaseTools: remove unused include statement
  BaseTools - AutoGen - replace custom dictionary class with python
standard one
  BaseTools: Eot remove unused code
  BaseTools: use built in dict instead of custom version.
  BaseTools: use combined version of standard dicts
  BaseTools: Workspace - use built in OrderedDict instead of custom
version.
  BaseTools: Remove unused code from Misc

 BaseTools/Source/Python/AutoGen/AutoGen.py  |  31 +--
 BaseTools/Source/Python/AutoGen/GenC.py |  30 ++-
 BaseTools/Source/Python/AutoGen/GenMake.py  |   3 +-
 BaseTools/Source/Python/Common/DscClassObject.py|   4 +-
 BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py   |  10 +-
 BaseTools/Source/Python/Common/Misc.py  | 280 
+---
 BaseTools/Source/Python/CommonDataClass/PackageClass.py |   4 +-
 BaseTools/Source/Python/Eot/Eot.py  |   9 -
 BaseTools/Source/Python/Eot/EotGlobalData.py|  16 +-
 BaseTools/Source/Python/Eot/FvImage.py  |  21 --
 BaseTools/Source/Python/Eot/Parser.py   |   3 +-
 BaseTools/Source/Python/GenFds/GenFds.py|   1 -
 BaseTools/Source/Python/Workspace/BuildClassObject.py   |   4 +-
 BaseTools/Source/Python/Workspace/DecBuildData.py   |  24 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py   |  24 +-
 BaseTools/Source/Python/Workspace/InfBuildData.py   |  52 ++--
 BaseTools/Source/Python/Workspace/WorkspaceCommon.py|  21 +-
 BaseTools/Source/Python/build/build.py  |  10 +-
 18 files changed, 118 insertions(+), 429 deletions(-)

-- 
2.16.2.windows.1

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


[edk2] HSTI sample code?

2018-04-03 Thread Blibbet
Hi,

I'm trying a tool to write a UEFI app that accesses the HSTI image, via
it's Boot Service Protocol.

Before I start, does anyone know of any:

1) existing open source tool that does this?

2) existing Tianocore source that uses the HSTI boot services protocol?

3) OS-present API/ioctl/interface, for Mac or Win or Linux, that
provides OS-present app access with this HSTI image?

For 1-2, I don't want to re-invent the wheel. For 3, I'd like to have an
OS-present tool instead of -- or in addition to -- a UEFI Shell tool.

Thanks in advance for any help!

Lee Fisher


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


[edk2] [edk2-FdfSpecification] Create release/1.28.01 branch

2018-04-03 Thread Kinney, Michael D
The release/1.28 branch already exists and contains the
1.27 version of the document.  Renaming the this release
branch  may break links to the document, so the branch
name is extended to 1.28.01.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Kinney 
---
 book.json | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/book.json b/book.json
index 8095a93..d33bf4e 100644
--- a/book.json
+++ b/book.json
@@ -1,8 +1,7 @@
 {
   "variables" : {
-"draft"   : "yes",
 "title"   : "EDK II Flash Description (FDF) File Specification",
-"version" : "Revision 1.28"
+"version" : "Revision 1.28.01"
   },
 
   "plugins": ["puml"],
-- 
2.14.2.windows.3

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


[edk2] [edk2-MetaDataExpressionSyntaxSpecification] Create release/1.30 branch

2018-04-03 Thread Kinney, Michael D
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Kinney 
---
 book.json | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/book.json b/book.json
index 0cf1c3e..e535b93 100644
--- a/book.json
+++ b/book.json
@@ -1,8 +1,7 @@
 {
   "variables" : {
-"draft"   : "yes",
 "title"   : "EDK II Meta-Data Expression Syntax Specification",
-"version" : "Revision 1.2"
+"version" : "Revision 1.3"
   },
 
   "plugins": ["puml"],
-- 
2.14.2.windows.3

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



[edk2] [edk2-InfSpecification] Create release/1.27 branch

2018-04-03 Thread Kinney, Michael D
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Kinney 
---
 book.json | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/book.json b/book.json
index 1fdd962..447dfe4 100644
--- a/book.json
+++ b/book.json
@@ -1,8 +1,7 @@
 {
   "variables" : {
-"draft"   : "yes",
 "title"   : "EDK II Module Information (INF) File Specification",
-"version" : "Revision 1.26"
+"version" : "Revision 1.27"
   },
 
   "plugins": ["puml"],
-- 
2.14.2.windows.3

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


[edk2] [edk2-DscSpecification] Create release/1.28 branch

2018-04-03 Thread Kinney, Michael D
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Kinney 
---
 book.json | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/book.json b/book.json
index 2ae4968..225e4eb 100644
--- a/book.json
+++ b/book.json
@@ -1,8 +1,7 @@
 {
   "variables" : {
-"draft"   : "yes",
 "title"   : "EDK II Platform Description (DSC) File Specification",
-"version" : "Revision 1.27"
+"version" : "Revision 1.28"
   },
 
   "plugins": ["puml"],
-- 
2.14.2.windows.3

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


Re: [edk2] OVMF UsbBulkTransfer returns EFI_OUT_OF_RESOURCES

2018-04-03 Thread Rob Taglang

Hello,

Thanks for you help, I got to the bottom of it.

I was passing a pointer to an unsigned int (note, not UINTN) as the 
length. Some garbage in the top bits was getting shifted in and causing 
the calculated number of pages to be very large in RootBridgeIoMap, 
hence the OUT_OF_RESOURCES. Copying the length to a UINTN and passing a 
pointer to that variable works correctly. I must have just been getting 
lucky with the top bits being zeroed out when running on real hardware.


Again thank you,
-Rob

On Tue, Apr 3, 2018 at 11:49 AM, Rob Taglang  wrote:
My apologies, it looks like the first link got messed up: 
https://sourceforge.net/projects/edk2/files/OVMF/OVMF-X64-r15214.zip/download


-Rob

On Tue, Apr 3, 2018 at 11:10 AM, Rob Taglang  wrote:

Hi Lazlo,

I have tried this with both the very old OVMF-X64-r15214.zip hosted 
on SourceForge: 
edk2.git-ovmf-x64-0-20180226.b3485.gb1956b5d42.noarch.rpm


And what I believe is the most recent OVMF hosted in the kraxel 
repo: edk2.git-ovmf-x64-0-20180226.b3485.gb1956b5d42.noarch.rpm


And I see the same behavior in both.

The USB device is a proprietary CDC_ACM device. I have tested on 
this motherboard: 
http://www.supermicro.com/products/motherboard/atom/x10/a1sri-2758f.cfm
whose UEFI firmware does appear to be based on EDK and everything 
works as expected.


Thanks,
Rob

On Tue, Apr 3, 2018 at 7:49 AM, Laszlo Ersek  
wrote:

Hi Rob,

On 04/03/18 00:12, Rob Taglang wrote:

 Hello,

 I can pass a host USB device to QEMU boot with OVMF, and it shows 
up as
 a EFI_USB_IO_PROTOCOL device and the interface descriptors and 
endpoints

 are detected correctly. A UsbControlTransfer operation succeeds.
 However, UsbBulkTransfer returns EFI_OUT_OF_RESOURCES regardless 
of how

 much memory I allocate for QEMU.

 This application does work correctly on real hardware. Is this 
expected

 behavior in OVMF?


I seem to recall recent patches for the core USB drivers in edk2 
that

modified various timeouts and transfer block sizes. For example:

  [edk2] [MdeModulePkg/Usb v2 0/1] Calculating the count of blocks 
to

   transfer

Committed at
.

Can you try a fresh edk2 build, and/or state git commit hashes at 
which

the tree does or does not work for you?

It would also be interesting to know the exact USB device (vendor, 
model
etc) that produces this issue for you. Chances are the edk2 USB 
drivers
would have the same issue if they encountered your device on the 
bare

metal (i.e. with edk2 running as physical platform firmware).

Thanks!
Laszlo




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




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




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


[edk2] [edk2-DecSpecification] Create release/1.27 branch

2018-04-03 Thread Kinney, Michael D
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Kinney 
---
 book.json | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/book.json b/book.json
index 46135ac..45f99c9 100644
--- a/book.json
+++ b/book.json
@@ -1,8 +1,7 @@
 {
   "variables" : {
-"draft"   : "yes",
 "title"   : "EDK II Package Declaration (DEC) File Format Specification",
-"version" : "Revision 1.26"
+"version" : "Revision 1.27"
   },
 
   "plugins": ["puml"],
-- 
2.14.2.windows.3

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


[edk2] [edk2-BuildSpecification] Create release/1.28 branch

2018-04-03 Thread Kinney, Michael D
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Kinney 
---
 book.json | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/book.json b/book.json
index 3450248..5a8fef1 100644
--- a/book.json
+++ b/book.json
@@ -1,8 +1,7 @@
 {
   "variables" : {
-"draft"   : "yes",
 "title"   : "EDK II Build Specification",
-"version" : "Revision 1.27"
+"version" : "Revision 1.28"
   },
 
   "plugins": ["puml"],
-- 
2.14.2.windows.3

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


Re: [edk2] OVMF UsbBulkTransfer returns EFI_OUT_OF_RESOURCES

2018-04-03 Thread Rob Taglang
My apologies, it looks like the first link got messed up: 
https://sourceforge.net/projects/edk2/files/OVMF/OVMF-X64-r15214.zip/download


-Rob

On Tue, Apr 3, 2018 at 11:10 AM, Rob Taglang  wrote:

Hi Lazlo,

I have tried this with both the very old OVMF-X64-r15214.zip hosted 
on SourceForge: 
edk2.git-ovmf-x64-0-20180226.b3485.gb1956b5d42.noarch.rpm


And what I believe is the most recent OVMF hosted in the kraxel repo: 
edk2.git-ovmf-x64-0-20180226.b3485.gb1956b5d42.noarch.rpm


And I see the same behavior in both.

The USB device is a proprietary CDC_ACM device. I have tested on this 
motherboard: 
http://www.supermicro.com/products/motherboard/atom/x10/a1sri-2758f.cfm
whose UEFI firmware does appear to be based on EDK and everything 
works as expected.


Thanks,
Rob

On Tue, Apr 3, 2018 at 7:49 AM, Laszlo Ersek  
wrote:

Hi Rob,

On 04/03/18 00:12, Rob Taglang wrote:

 Hello,

 I can pass a host USB device to QEMU boot with OVMF, and it shows 
up as
 a EFI_USB_IO_PROTOCOL device and the interface descriptors and 
endpoints

 are detected correctly. A UsbControlTransfer operation succeeds.
 However, UsbBulkTransfer returns EFI_OUT_OF_RESOURCES regardless 
of how

 much memory I allocate for QEMU.

 This application does work correctly on real hardware. Is this 
expected

 behavior in OVMF?


I seem to recall recent patches for the core USB drivers in edk2 that
modified various timeouts and transfer block sizes. For example:

  [edk2] [MdeModulePkg/Usb v2 0/1] Calculating the count of blocks to
   transfer

Committed at
.

Can you try a fresh edk2 build, and/or state git commit hashes at 
which

the tree does or does not work for you?

It would also be interesting to know the exact USB device (vendor, 
model
etc) that produces this issue for you. Chances are the edk2 USB 
drivers

would have the same issue if they encountered your device on the bare
metal (i.e. with edk2 running as physical platform firmware).

Thanks!
Laszlo




___
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] OVMF UsbBulkTransfer returns EFI_OUT_OF_RESOURCES

2018-04-03 Thread Rob Taglang

Hi Lazlo,

I have tried this with both the very old OVMF-X64-r15214.zip hosted on 
SourceForge: edk2.git-ovmf-x64-0-20180226.b3485.gb1956b5d42.noarch.rpm


And what I believe is the most recent OVMF hosted in the kraxel repo: 
edk2.git-ovmf-x64-0-20180226.b3485.gb1956b5d42.noarch.rpm


And I see the same behavior in both.

The USB device is a proprietary CDC_ACM device. I have tested on this 
motherboard: 
http://www.supermicro.com/products/motherboard/atom/x10/a1sri-2758f.cfm
whose UEFI firmware does appear to be based on EDK and everything works 
as expected.


Thanks,
Rob

On Tue, Apr 3, 2018 at 7:49 AM, Laszlo Ersek  wrote:

Hi Rob,

On 04/03/18 00:12, Rob Taglang wrote:

 Hello,

 I can pass a host USB device to QEMU boot with OVMF, and it shows 
up as
 a EFI_USB_IO_PROTOCOL device and the interface descriptors and 
endpoints

 are detected correctly. A UsbControlTransfer operation succeeds.
 However, UsbBulkTransfer returns EFI_OUT_OF_RESOURCES regardless of 
how

 much memory I allocate for QEMU.

 This application does work correctly on real hardware. Is this 
expected

 behavior in OVMF?


I seem to recall recent patches for the core USB drivers in edk2 that
modified various timeouts and transfer block sizes. For example:

  [edk2] [MdeModulePkg/Usb v2 0/1] Calculating the count of blocks to
   transfer

Committed at
.

Can you try a fresh edk2 build, and/or state git commit hashes at 
which

the tree does or does not work for you?

It would also be interesting to know the exact USB device (vendor, 
model
etc) that produces this issue for you. Chances are the edk2 USB 
drivers

would have the same issue if they encountered your device on the bare
metal (i.e. with edk2 running as physical platform firmware).

Thanks!
Laszlo




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


Re: [edk2] [PATCH 02/13] MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC

2018-04-03 Thread Gao, Liming
Laszlo:
  Could you use one pack to scope all structure definitions?

Thanks
Liming
> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Tuesday, April 3, 2018 10:52 PM
> To: edk2-devel-01 
> Cc: Wu, Jiaxin ; Gao, Liming ; 
> Kinney, Michael D ; Fu,
> Siyuan 
> Subject: [PATCH 02/13] MdePkg/Include/Protocol/Tls.h: pack structures from 
> the TLS RFC
> 
> The structures defined in RFC 5246 are not to have any padding between
> fields or at the end; use the "pack" pragma as necessary.
> 
> Cc: Jiaxin Wu 
> Cc: Liming Gao 
> Cc: Michael D Kinney 
> Cc: Siyuan Fu 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=915
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Laszlo Ersek 
> ---
>  MdePkg/Include/Protocol/Tls.h | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/MdePkg/Include/Protocol/Tls.h b/MdePkg/Include/Protocol/Tls.h
> index 2119f33c0f5b..dafaabcd2a8b 100644
> --- a/MdePkg/Include/Protocol/Tls.h
> +++ b/MdePkg/Include/Protocol/Tls.h
> @@ -138,33 +138,37 @@ typedef enum {
>  ///
>  /// EFI_TLS_CIPHER
>  /// Note: The definition of EFI_TLS_CIPHER definition is from "RFC 5246, 
> A.4.1.
>  ///   Hello Messages". The value of EFI_TLS_CIPHER is from TLS Cipher
>  ///   Suite Registry of IANA.
>  ///
> +#pragma pack (1)
>  typedef struct {
>UINT8 Data1;
>UINT8 Data2;
>  } EFI_TLS_CIPHER;
> +#pragma pack ()
> 
>  ///
>  /// EFI_TLS_COMPRESSION
>  /// Note: The value of EFI_TLS_COMPRESSION definition is from "RFC 3749".
>  ///
>  typedef UINT8 EFI_TLS_COMPRESSION;
> 
>  ///
>  /// EFI_TLS_EXTENSION
>  /// Note: The definition of EFI_TLS_EXTENSION if from "RFC 5246 A.4.1.
>  ///   Hello Messages".
>  ///
> +#pragma pack (1)
>  typedef struct {
>UINT16ExtensionType;
>UINT16Length;
>UINT8 Data[1];
>  } EFI_TLS_EXTENSION;
> +#pragma pack ()
> 
>  ///
>  /// EFI_TLS_VERIFY
>  /// Use either EFI_TLS_VERIFY_NONE or EFI_TLS_VERIFY_PEER, the last two 
> options
>  /// are 'ORed' with EFI_TLS_VERIFY_PEER if they are desired.
>  ///
> @@ -191,35 +195,41 @@ typedef UINT32  EFI_TLS_VERIFY;
> 
>  ///
>  /// EFI_TLS_RANDOM
>  /// Note: The definition of EFI_TLS_RANDOM is from "RFC 5246 A.4.1.
>  ///   Hello Messages".
>  ///
> +#pragma pack (1)
>  typedef struct {
>UINT32GmtUnixTime;
>UINT8 RandomBytes[28];
>  } EFI_TLS_RANDOM;
> +#pragma pack ()
> 
>  ///
>  /// EFI_TLS_MASTER_SECRET
>  /// Note: The definition of EFI_TLS_MASTER_SECRET is from "RFC 5246 8.1.
>  ///   Computing the Master Secret".
>  ///
> +#pragma pack (1)
>  typedef struct {
>UINT8 Data[48];
>  } EFI_TLS_MASTER_SECRET;
> +#pragma pack ()
> 
>  ///
>  /// EFI_TLS_SESSION_ID
>  /// Note: The definition of EFI_TLS_SESSION_ID is from "RFC 5246 A.4.1. 
> Hello Messages".
>  ///
>  #define MAX_TLS_SESSION_ID_LENGTH  32
> +#pragma pack (1)
>  typedef struct {
>UINT16Length;
>UINT8 Data[MAX_TLS_SESSION_ID_LENGTH];
>  } EFI_TLS_SESSION_ID;
> +#pragma pack ()
> 
>  ///
>  /// EFI_TLS_SESSION_STATE
>  ///
>  typedef enum {
>///
> --
> 2.14.1.3.gb7cf6e02401b
> 

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


[edk2] [PATCH 13/13] CryptoPkg/TlsLib: rewrite TlsSetCipherList()

2018-04-03 Thread Laszlo Ersek
Rewrite the TlsSetCipherList() function in order to fix the following
issues:

- Any cipher identifier in CipherId that is not recognized by
  TlsGetCipherMapping() will cause the function to return EFI_UNSUPPORTED.

  This is a problem because CipherId is an ordered preference list, and a
  caller should not get EFI_UNSUPPORTED just because it has an elaborate
  CipherId preference list. Instead, we can filter out cipher identifiers
  that we don't recognize, as long as we keep the relative order intact.

- CipherString is allocated on the stack, with 500 bytes.

  While processing a large CipherId preference list, this room may not be
  enough. Although no buffer overflow is possible, CipherString exhaustion
  can lead to a failed TLS connection, because any cipher names that don't
  fit on CipherString cannot be negotiated.

  Compute CipherStringSize first, and allocate CipherString dynamically.

- Finally, the "@STRENGTH" pseudo cipher name is appended to CipherString.
  (Assuming there is enough room left in CipherString.) This causes
  OpenSSL to sort the cipher list "in order of encryption algorithm key
  length".

  This is a bad idea. The caller specifically passes an ordered preference
  list in CipherId. Therefore TlsSetCipherList() must not ask OpenSSL to
  reorder the list, for any reason. Drop "@STRENGTH".

Cc: Jiaxin Wu 
Cc: Qin Long 
Cc: Siyuan Fu 
Cc: Ting Ye 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=915
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 CryptoPkg/Library/TlsLib/TlsLib.inf   |   3 +-
 CryptoPkg/Include/Library/TlsLib.h|   3 +-
 CryptoPkg/Library/TlsLib/InternalTlsLib.h |   3 +-
 CryptoPkg/Library/TlsLib/TlsConfig.c  | 163 +---
 4 files changed, 149 insertions(+), 23 deletions(-)

diff --git a/CryptoPkg/Library/TlsLib/TlsLib.inf 
b/CryptoPkg/Library/TlsLib/TlsLib.inf
index dbb737b2a147..9b44c9cdab3a 100644
--- a/CryptoPkg/Library/TlsLib/TlsLib.inf
+++ b/CryptoPkg/Library/TlsLib/TlsLib.inf
@@ -37,17 +37,18 @@ [Sources]
 [Packages]
   MdePkg/MdePkg.dec
   CryptoPkg/CryptoPkg.dec
 
 [LibraryClasses]
   BaseCryptLib
-  BaseLib
   BaseMemoryLib
   DebugLib
   IntrinsicLib
+  MemoryAllocationLib
   OpensslLib
+  SafeIntLib
 
 [BuildOptions]
   #
   # suppress the following warnings so we do not break the build with 
warnings-as-errors:
   # C4090: 'function' : different 'const' qualifiers
   #
diff --git a/CryptoPkg/Include/Library/TlsLib.h 
b/CryptoPkg/Include/Library/TlsLib.h
index 0ffbcb2b7c2a..e71291eaea45 100644
--- a/CryptoPkg/Include/Library/TlsLib.h
+++ b/CryptoPkg/Include/Library/TlsLib.h
@@ -353,13 +353,14 @@ TlsSetConnectionEnd (
Registry of the IANA, interpreting Byte1 and Byte2
in network (big endian) byte order.
   @param[in]  CipherNumThe number of cipher in the list.
 
   @retval  EFI_SUCCESS   The ciphers list was set successfully.
   @retval  EFI_INVALID_PARAMETER The parameter is invalid.
-  @retval  EFI_UNSUPPORTED   Unsupported TLS cipher in the list.
+  @retval  EFI_UNSUPPORTED   No supported TLS cipher was found in CipherId.
+  @retval  EFI_OUT_OF_RESOURCES  Memory allocation failed.
 
 **/
 EFI_STATUS
 EFIAPI
 TlsSetCipherList (
   IN VOID *Tls,
diff --git a/CryptoPkg/Library/TlsLib/InternalTlsLib.h 
b/CryptoPkg/Library/TlsLib/InternalTlsLib.h
index 3f18a461a8d1..b6cf9816aa38 100644
--- a/CryptoPkg/Library/TlsLib/InternalTlsLib.h
+++ b/CryptoPkg/Library/TlsLib/InternalTlsLib.h
@@ -16,15 +16,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #define __INTERNAL_TLS_LIB_H__
 
 #undef _WIN32
 #undef _WIN64
 
 #include 
-#include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 
 typedef struct {
   //
diff --git a/CryptoPkg/Library/TlsLib/TlsConfig.c 
b/CryptoPkg/Library/TlsLib/TlsConfig.c
index ab786fc23849..c7d643fd81f7 100644
--- a/CryptoPkg/Library/TlsLib/TlsConfig.c
+++ b/CryptoPkg/Library/TlsLib/TlsConfig.c
@@ -409,69 +409,192 @@ TlsSetConnectionEnd (
Registry of the IANA, interpreting Byte1 and Byte2
in network (big endian) byte order.
   @param[in]  CipherNumThe number of cipher in the list.
 
   @retval  EFI_SUCCESS   The ciphers list was set successfully.
   @retval  EFI_INVALID_PARAMETER The parameter is invalid.
-  @retval  EFI_UNSUPPORTED   Unsupported TLS cipher in the list.
+  @retval  EFI_UNSUPPORTED   No supported TLS cipher was found in CipherId.
+  @retval  EFI_OUT_OF_RESOURCES  Memory allocation failed.
 
 **/
 EFI_STATUS
 EFIAPI
 TlsSetCipherList (
   IN VOID *Tls,
   IN UINT16   *CipherId,
   IN UINTNCipherNum
   )
 {
   TLS_CONNECTION   *TlsConn;

[edk2] [PATCH 12/13] CryptoPkg/TlsLib: clean up leading comment for TlsSetCipherList()

2018-04-03 Thread Laszlo Ersek
The TlsSetCipherList() function documents its CipherId parameter
incorrectly. Document the parameter precisely and use the same
documentation in both the lib class header and the lib instance.

Cc: Jiaxin Wu 
Cc: Qin Long 
Cc: Siyuan Fu 
Cc: Ting Ye 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=915
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 CryptoPkg/Include/Library/TlsLib.h   | 6 --
 CryptoPkg/Library/TlsLib/TlsConfig.c | 5 -
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/CryptoPkg/Include/Library/TlsLib.h 
b/CryptoPkg/Include/Library/TlsLib.h
index e19a38a214ce..0ffbcb2b7c2a 100644
--- a/CryptoPkg/Include/Library/TlsLib.h
+++ b/CryptoPkg/Include/Library/TlsLib.h
@@ -345,14 +345,16 @@ TlsSetConnectionEnd (
 /**
   Set the ciphers list to be used by the TLS object.
 
   This function sets the ciphers for use by a specified TLS object.
 
   @param[in]  Tls  Pointer to a TLS object.
-  @param[in]  CipherId Pointer to a string that contains one or more
-   ciphers separated by a colon.
+  @param[in]  CipherId Array of UINT16 cipher identifiers. Each UINT16
+   cipher identifier comes from the TLS Cipher Suite
+   Registry of the IANA, interpreting Byte1 and Byte2
+   in network (big endian) byte order.
   @param[in]  CipherNumThe number of cipher in the list.
 
   @retval  EFI_SUCCESS   The ciphers list was set successfully.
   @retval  EFI_INVALID_PARAMETER The parameter is invalid.
   @retval  EFI_UNSUPPORTED   Unsupported TLS cipher in the list.
 
diff --git a/CryptoPkg/Library/TlsLib/TlsConfig.c 
b/CryptoPkg/Library/TlsLib/TlsConfig.c
index 9d21e6c1466d..ab786fc23849 100644
--- a/CryptoPkg/Library/TlsLib/TlsConfig.c
+++ b/CryptoPkg/Library/TlsLib/TlsConfig.c
@@ -401,13 +401,16 @@ TlsSetConnectionEnd (
 /**
   Set the ciphers list to be used by the TLS object.
 
   This function sets the ciphers for use by a specified TLS object.
 
   @param[in]  Tls  Pointer to a TLS object.
-  @param[in]  CipherId Pointer to a UINT16 cipher Id.
+  @param[in]  CipherId Array of UINT16 cipher identifiers. Each UINT16
+   cipher identifier comes from the TLS Cipher Suite
+   Registry of the IANA, interpreting Byte1 and Byte2
+   in network (big endian) byte order.
   @param[in]  CipherNumThe number of cipher in the list.
 
   @retval  EFI_SUCCESS   The ciphers list was set successfully.
   @retval  EFI_INVALID_PARAMETER The parameter is invalid.
   @retval  EFI_UNSUPPORTED   Unsupported TLS cipher in the list.
 
-- 
2.14.1.3.gb7cf6e02401b


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


[edk2] [PATCH 10/13] CryptoPkg/TlsLib: sort [LibraryClasses] section in the INF file

2018-04-03 Thread Laszlo Ersek
In the next patches, we'll update the library classes in
"InternalTlsLib.h" and "TlsLib.inf". It is easier to verify correctness if
those sections are sorted.

Cc: Jiaxin Wu 
Cc: Qin Long 
Cc: Siyuan Fu 
Cc: Ting Ye 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=915
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 CryptoPkg/Library/TlsLib/TlsLib.inf | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/CryptoPkg/Library/TlsLib/TlsLib.inf 
b/CryptoPkg/Library/TlsLib/TlsLib.inf
index dc7f3a5dbd23..44789ceeefa3 100644
--- a/CryptoPkg/Library/TlsLib/TlsLib.inf
+++ b/CryptoPkg/Library/TlsLib/TlsLib.inf
@@ -38,18 +38,18 @@ [Packages]
   MdePkg/MdePkg.dec
   CryptoPkg/CryptoPkg.dec
 
 [LibraryClasses]
   BaseLib
   BaseMemoryLib
-  MemoryAllocationLib
-  UefiRuntimeServicesTableLib
   DebugLib
-  OpensslLib
   IntrinsicLib
+  MemoryAllocationLib
+  OpensslLib
   PrintLib
+  UefiRuntimeServicesTableLib
 
 [BuildOptions]
   #
   # suppress the following warnings so we do not break the build with 
warnings-as-errors:
   # C4090: 'function' : different 'const' qualifiers
   #
-- 
2.14.1.3.gb7cf6e02401b


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


[edk2] [PATCH 11/13] CryptoPkg/TlsLib: sanitize lib classes in internal header and INF

2018-04-03 Thread Laszlo Ersek
"InternalTlsLib.h" includes "BaseCryptLib.h", but the lib class is not
listed in the INF file.

The INF file lists a good number of lib classes, but none of the lib class
headers are included by "InternalTlsLib.h".

Synchronize both lists, while removing those library classes that aren't
actually needed. (IntrinsicLib and OpensslLib have no edk2 class headers.)

Cc: Jiaxin Wu 
Cc: Qin Long 
Cc: Siyuan Fu 
Cc: Ting Ye 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=915
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 CryptoPkg/Library/TlsLib/TlsLib.inf   | 4 +---
 CryptoPkg/Library/TlsLib/InternalTlsLib.h | 3 +++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/CryptoPkg/Library/TlsLib/TlsLib.inf 
b/CryptoPkg/Library/TlsLib/TlsLib.inf
index 44789ceeefa3..dbb737b2a147 100644
--- a/CryptoPkg/Library/TlsLib/TlsLib.inf
+++ b/CryptoPkg/Library/TlsLib/TlsLib.inf
@@ -36,20 +36,18 @@ [Sources]
 
 [Packages]
   MdePkg/MdePkg.dec
   CryptoPkg/CryptoPkg.dec
 
 [LibraryClasses]
+  BaseCryptLib
   BaseLib
   BaseMemoryLib
   DebugLib
   IntrinsicLib
-  MemoryAllocationLib
   OpensslLib
-  PrintLib
-  UefiRuntimeServicesTableLib
 
 [BuildOptions]
   #
   # suppress the following warnings so we do not break the build with 
warnings-as-errors:
   # C4090: 'function' : different 'const' qualifiers
   #
diff --git a/CryptoPkg/Library/TlsLib/InternalTlsLib.h 
b/CryptoPkg/Library/TlsLib/InternalTlsLib.h
index 88c4e3b38e4e..3f18a461a8d1 100644
--- a/CryptoPkg/Library/TlsLib/InternalTlsLib.h
+++ b/CryptoPkg/Library/TlsLib/InternalTlsLib.h
@@ -16,12 +16,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #define __INTERNAL_TLS_LIB_H__
 
 #undef _WIN32
 #undef _WIN64
 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
 
 typedef struct {
   //
-- 
2.14.1.3.gb7cf6e02401b


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


[edk2] [PATCH 06/13] CryptoPkg/TlsLib: use binary search in the TlsGetCipherMapping() function

2018-04-03 Thread Laszlo Ersek
Improve the performance of the TlsGetCipherMapping() function by adopting
the binary search from DhcpFindOptionFormat()
[MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.c].

Cc: Jiaxin Wu 
Cc: Qin Long 
Cc: Siyuan Fu 
Cc: Ting Ye 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=915
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 CryptoPkg/Library/TlsLib/TlsConfig.c | 36 +---
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/CryptoPkg/Library/TlsLib/TlsConfig.c 
b/CryptoPkg/Library/TlsLib/TlsConfig.c
index 507489386b8e..c1d91a599482 100644
--- a/CryptoPkg/Library/TlsLib/TlsConfig.c
+++ b/CryptoPkg/Library/TlsLib/TlsConfig.c
@@ -27,12 +27,14 @@ typedef struct {
 } TLS_CIPHER_MAPPING;
 
 //
 // The mapping table between IANA/IETF Cipher Suite definitions and
 // OpenSSL-used Cipher Suite name.
 //
+// Keep the table uniquely sorted by the IanaCipher field, in increasing order.
+//
 STATIC CONST TLS_CIPHER_MAPPING TlsCipherMappingTable[] = {
   { 0x0001, "NULL-MD5" }, /// TLS_RSA_WITH_NULL_MD5
   { 0x0002, "NULL-SHA" }, /// TLS_RSA_WITH_NULL_SHA
   { 0x0004, "RC4-MD5" },  /// TLS_RSA_WITH_RC4_128_MD5
   { 0x0005, "RC4-SHA" },  /// TLS_RSA_WITH_RC4_128_SHA
   { 0x000A, "DES-CBC3-SHA" }, /// TLS_RSA_WITH_3DES_EDE_CBC_SHA, 
mandatory TLS 1.1
@@ -68,28 +70,36 @@ STATIC CONST TLS_CIPHER_MAPPING TlsCipherMappingTable[] = {
 STATIC
 CONST TLS_CIPHER_MAPPING *
 TlsGetCipherMapping (
   IN UINT16   CipherId
   )
 {
-  CONST TLS_CIPHER_MAPPING  *CipherEntry;
-  UINTN TableSize;
-  UINTN Index;
-
-  CipherEntry = TlsCipherMappingTable;
-  TableSize = sizeof (TlsCipherMappingTable) / sizeof (TLS_CIPHER_MAPPING);
+  INTN  Left;
+  INTN  Right;
+  INTN  Middle;
 
   //
-  // Search Cipher Mapping Table for IANA-OpenSSL Cipher Translation
+  // Binary Search Cipher Mapping Table for IANA-OpenSSL Cipher Translation
   //
-  for (Index = 0; Index < TableSize; Index++, CipherEntry++) {
-//
-// Translate IANA cipher suite name to OpenSSL name.
-//
-if (CipherEntry->IanaCipher == CipherId) {
-  return CipherEntry;
+  Left  = 0;
+  Right = ARRAY_SIZE (TlsCipherMappingTable) - 1;
+
+  while (Right >= Left) {
+Middle = (Left + Right) / 2;
+
+if (CipherId == TlsCipherMappingTable[Middle].IanaCipher) {
+  //
+  // Translate IANA cipher suite ID to OpenSSL name.
+  //
+  return [Middle];
+}
+
+if (CipherId < TlsCipherMappingTable[Middle].IanaCipher) {
+  Right = Middle - 1;
+} else {
+  Left  = Middle + 1;
 }
   }
 
   //
   // No Cipher Mapping found, return NULL.
   //
-- 
2.14.1.3.gb7cf6e02401b


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


[edk2] [PATCH 00/13] {Ovmf, Mde, Network, Crypto}Pkg: fixes+features for setting HTTPS cipher suites

2018-04-03 Thread Laszlo Ersek
Repo:   https://github.com/lersek/edk2.git
Branch: tls_ciphers

Earlier I posted two patch sets for better platform control of the CA
certificates used in HTTPS booting (and for putting that control to use
in OVMF):

  [edk2] [PATCH 0/5] NetworkPkg: HTTP and TLS updates

  [edk2] [PATCH 0/4] MdeModulePkg, OvmfPkg: support large CA cert list
 for HTTPS boot

These series have been committed; thank you everyone that helped with
review and testing.

My next goal is better platform control of the TLS cipher suites that
are used in HTTPS booting (and similarly, putting that control to use in
OVMF). That's what this series is about.

You'll see references to TianoCore BZ#915 in the commit messages. The BZ
is not public just yet, because I originally thought that I found
security issues. It turns out that's not the case, so the BZ should be
opened up soon. Either way, the commit messages contain enough
information about the code changes.

I'm aware some of my reviewers are currently traveling for business --
please take your time and feel free to review the patches whenever it
best suits you.

Cc: Ard Biesheuvel 
Cc: Gary Ching-Pang Lin 
Cc: Jiaxin Wu 
Cc: Jordan Justen 
Cc: Liming Gao 
Cc: Michael D Kinney 
Cc: Qin Long 
Cc: Siyuan Fu 
Cc: Ting Ye 

Thanks!
Laszlo

Laszlo Ersek (13):
  OvmfPkg/TlsAuthConfigLib: configure trusted cipher suites for HTTPS
boot
  MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC
  NetworkPkg/TlsDxe: verify DataSize for EfiTlsCipherList
  NetworkPkg/TlsDxe: clean up byte order conversion for EfiTlsCipherList
  CryptoPkg/TlsLib: replace TlsGetCipherString() with
TlsGetCipherMapping()
  CryptoPkg/TlsLib: use binary search in the TlsGetCipherMapping()
function
  CryptoPkg/TlsLib: pre-compute OpensslCipherLength in
TlsCipherMappingTable
  CryptoPkg/TlsLib: add the "TlsMappingTable.sh" POSIX shell script
  CryptoPkg/TlsLib: extend "TlsCipherMappingTable"
  CryptoPkg/TlsLib: sort [LibraryClasses] section in the INF file
  CryptoPkg/TlsLib: sanitize lib classes in internal header and INF
  CryptoPkg/TlsLib: clean up leading comment for TlsSetCipherList()
  CryptoPkg/TlsLib: rewrite TlsSetCipherList()

 CryptoPkg/Include/Library/TlsLib.h|   9 +-
 CryptoPkg/Library/TlsLib/InternalTlsLib.h |   4 +
 CryptoPkg/Library/TlsLib/TlsConfig.c  | 448 
+---
 CryptoPkg/Library/TlsLib/TlsLib.inf   |  11 +-
 CryptoPkg/Library/TlsLib/TlsMappingTable.sh   | 140 ++
 MdePkg/Include/Protocol/Tls.h |  10 +
 NetworkPkg/TlsDxe/TlsProtocol.c   |  17 +-
 OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.c   |  98 +
 OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.inf |   3 +-
 9 files changed, 664 insertions(+), 76 deletions(-)
 create mode 100644 CryptoPkg/Library/TlsLib/TlsMappingTable.sh

-- 
2.14.1.3.gb7cf6e02401b

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


[edk2] [PATCH 01/13] OvmfPkg/TlsAuthConfigLib: configure trusted cipher suites for HTTPS boot

2018-04-03 Thread Laszlo Ersek
Read the list of trusted cipher suites from fw_cfg and to store it to
EFI_TLS_CA_CERTIFICATE_VARIABLE.

The fw_cfg file is formatted by the "update-crypto-policies" utility on
the host side, so that the host settings take effect in guest HTTPS boot
as well. QEMU forwards the file intact to the firmware. The contents are
forwarded by NetworkPkg/HttpDxe (in TlsConfigCipherList()) to
NetworkPkg/TlsDxe (TlsSetSessionData()) and TlsLib (TlsSetCipherList()).

Cc: Ard Biesheuvel 
Cc: Gary Ching-Pang Lin 
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.inf |  3 +-
 OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.c   | 98 
 2 files changed, 100 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.inf 
b/OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.inf
index 5f83582a8313..40754ea5a2f3 100644
--- a/OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.inf
+++ b/OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.inf
@@ -46,10 +46,11 @@ [LibraryClasses]
   DebugLib
   MemoryAllocationLib
   QemuFwCfgLib
   UefiRuntimeServicesTableLib
 
 [Guids]
-  gEfiTlsCaCertificateGuid ## PRODUCES ## Variable:L"TlsCaCertificate"
+  gEdkiiHttpTlsCipherListGuid ## PRODUCES ## Variable:L"HttpTlsCipherList"
+  gEfiTlsCaCertificateGuid## PRODUCES ## Variable:L"TlsCaCertificate"
 
 [Depex]
   gEfiVariableWriteArchProtocolGuid
diff --git a/OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.c 
b/OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.c
index b5b33bc4fc69..74c393e5462f 100644
--- a/OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.c
+++ b/OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.c
@@ -17,12 +17,13 @@
 
 **/
 
 #include 
 #include 
 
+#include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
@@ -118,16 +119,113 @@ SetCaCerts (
 gEfiCallerBaseName, __FUNCTION__, (UINT64)HttpsCaCertsSize));
 
 FreeHttpsCaCerts:
   FreePool (HttpsCaCerts);
 }
 
+/**
+  Read the list of trusted cipher suites from the fw_cfg file
+  "etc/edk2/https/ciphers", and store it to
+  gEdkiiHttpTlsCipherListGuid:EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE.
+
+  The contents are propagated by NetworkPkg/HttpDxe to NetworkPkg/TlsDxe; the
+  list is processed by the latter.
+**/
+STATIC
+VOID
+SetCipherSuites (
+  VOID
+  )
+{
+  EFI_STATUS   Status;
+  FIRMWARE_CONFIG_ITEM HttpsCiphersItem;
+  UINTNHttpsCiphersSize;
+  VOID *HttpsCiphers;
+
+  Status = QemuFwCfgFindFile ("etc/edk2/https/ciphers", ,
+ );
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_VERBOSE, "%a:%a: not touching cipher suites\n",
+  gEfiCallerBaseName, __FUNCTION__));
+return;
+  }
+  //
+  // From this point on, any failure is fatal. An ordered cipher preference
+  // list is available from QEMU, thus we cannot let the firmware attempt HTTPS
+  // boot with either pre-existent or non-existent preferences. An empty set of
+  // cipher suites does not fail HTTPS boot automatically; the default cipher
+  // suite preferences would take effect, and we must prevent that.
+  //
+  // Delete the current EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE if it exists. If
+  // the variable exists with EFI_VARIABLE_NON_VOLATILE attribute, we cannot
+  // make it volatile without deleting it first.
+  //
+  Status = gRT->SetVariable (
+  EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE, // VariableName
+  ,// VendorGuid
+  0,   // Attributes
+  0,   // DataSize
+  NULL // Data
+  );
+  if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
+DEBUG ((DEBUG_ERROR, "%a:%a: failed to delete %g:\"%s\"\n",
+  gEfiCallerBaseName, __FUNCTION__, ,
+  EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE));
+goto Done;
+  }
+
+  if (HttpsCiphersSize == 0) {
+DEBUG ((DEBUG_ERROR, "%a:%a: list of cipher suites must not be empty\n",
+  gEfiCallerBaseName, __FUNCTION__));
+Status = EFI_INVALID_PARAMETER;
+goto Done;
+  }
+
+  HttpsCiphers = AllocatePool (HttpsCiphersSize);
+  if (HttpsCiphers == NULL) {
+DEBUG ((DEBUG_ERROR, "%a:%a: failed to allocate HttpsCiphers\n",
+  gEfiCallerBaseName, __FUNCTION__));
+Status = EFI_OUT_OF_RESOURCES;
+goto Done;
+  }
+
+  QemuFwCfgSelectItem (HttpsCiphersItem);
+  QemuFwCfgReadBytes (HttpsCiphersSize, HttpsCiphers);
+
+  Status = gRT->SetVariable (
+  EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE, // VariableName
+  ,// VendorGuid
+  EFI_VARIABLE_BOOTSERVICE_ACCESS, // Attributes
+  HttpsCiphersSize,// DataSize
+  HttpsCiphers 

[edk2] [PATCH 09/13] CryptoPkg/TlsLib: extend "TlsCipherMappingTable"

2018-04-03 Thread Laszlo Ersek
Add mapping entries printed by "TlsMappingTable.sh" to
"TlsCipherMappingTable". This allows HTTPS / TLS clients to get a good
match for their EFI_TLS_CIPHER lists.

Cc: Jiaxin Wu 
Cc: Qin Long 
Cc: Siyuan Fu 
Cc: Ting Ye 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=915
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 CryptoPkg/Library/TlsLib/TlsConfig.c | 169 
 1 file changed, 169 insertions(+)

diff --git a/CryptoPkg/Library/TlsLib/TlsConfig.c 
b/CryptoPkg/Library/TlsLib/TlsConfig.c
index e2f819b9035f..9d21e6c1466d 100644
--- a/CryptoPkg/Library/TlsLib/TlsConfig.c
+++ b/CryptoPkg/Library/TlsLib/TlsConfig.c
@@ -46,31 +46,200 @@ typedef struct {
 //
 STATIC CONST TLS_CIPHER_MAPPING TlsCipherMappingTable[] = {
   MAP ( 0x0001, "NULL-MD5" ),   /// TLS_RSA_WITH_NULL_MD5
   MAP ( 0x0002, "NULL-SHA" ),   /// TLS_RSA_WITH_NULL_SHA
   MAP ( 0x0004, "RC4-MD5" ),/// 
TLS_RSA_WITH_RC4_128_MD5
   MAP ( 0x0005, "RC4-SHA" ),/// 
TLS_RSA_WITH_RC4_128_SHA
+  MAP ( 0x0007, "IDEA-CBC-SHA" ),   /// 
TLS_RSA_WITH_IDEA_CBC_SHA
   MAP ( 0x000A, "DES-CBC3-SHA" ),   /// 
TLS_RSA_WITH_3DES_EDE_CBC_SHA, mandatory TLS 1.1
+  MAP ( 0x000D, "DH-DSS-DES-CBC3-SHA" ),/// 
TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA
+  MAP ( 0x0010, "DH-RSA-DES-CBC3-SHA" ),/// 
TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA
+  MAP ( 0x0013, "DHE-DSS-DES-CBC3-SHA" ),   /// 
TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
   MAP ( 0x0016, "DHE-RSA-DES-CBC3-SHA" ),   /// 
TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
+  MAP ( 0x0018, "ADH-RC4-MD5" ),/// 
TLS_DH_anon_WITH_RC4_128_MD5
+  MAP ( 0x001B, "ADH-DES-CBC3-SHA" ),   /// 
TLS_DH_anon_WITH_3DES_EDE_CBC_SHA
+  MAP ( 0x001F, "KRB5-DES-CBC3-SHA" ),  /// 
TLS_KRB5_WITH_3DES_EDE_CBC_SHA
+  MAP ( 0x0020, "KRB5-RC4-SHA" ),   /// 
TLS_KRB5_WITH_RC4_128_SHA
+  MAP ( 0x0021, "KRB5-IDEA-CBC-SHA" ),  /// 
TLS_KRB5_WITH_IDEA_CBC_SHA
+  MAP ( 0x0023, "KRB5-DES-CBC3-MD5" ),  /// 
TLS_KRB5_WITH_3DES_EDE_CBC_MD5
+  MAP ( 0x0024, "KRB5-RC4-MD5" ),   /// 
TLS_KRB5_WITH_RC4_128_MD5
+  MAP ( 0x0025, "KRB5-IDEA-CBC-MD5" ),  /// 
TLS_KRB5_WITH_IDEA_CBC_MD5
   MAP ( 0x002F, "AES128-SHA" ), /// 
TLS_RSA_WITH_AES_128_CBC_SHA, mandatory TLS 1.2
   MAP ( 0x0030, "DH-DSS-AES128-SHA" ),  /// 
TLS_DH_DSS_WITH_AES_128_CBC_SHA
   MAP ( 0x0031, "DH-RSA-AES128-SHA" ),  /// 
TLS_DH_RSA_WITH_AES_128_CBC_SHA
+  MAP ( 0x0032, "DHE-DSS-AES128-SHA" ), /// 
TLS_DHE_DSS_WITH_AES_128_CBC_SHA
   MAP ( 0x0033, "DHE-RSA-AES128-SHA" ), /// 
TLS_DHE_RSA_WITH_AES_128_CBC_SHA
+  MAP ( 0x0034, "ADH-AES128-SHA" ), /// 
TLS_DH_anon_WITH_AES_128_CBC_SHA
   MAP ( 0x0035, "AES256-SHA" ), /// 
TLS_RSA_WITH_AES_256_CBC_SHA
   MAP ( 0x0036, "DH-DSS-AES256-SHA" ),  /// 
TLS_DH_DSS_WITH_AES_256_CBC_SHA
   MAP ( 0x0037, "DH-RSA-AES256-SHA" ),  /// 
TLS_DH_RSA_WITH_AES_256_CBC_SHA
+  MAP ( 0x0038, "DHE-DSS-AES256-SHA" ), /// 
TLS_DHE_DSS_WITH_AES_256_CBC_SHA
   MAP ( 0x0039, "DHE-RSA-AES256-SHA" ), /// 
TLS_DHE_RSA_WITH_AES_256_CBC_SHA
+  MAP ( 0x003A, "ADH-AES256-SHA" ), /// 
TLS_DH_anon_WITH_AES_256_CBC_SHA
   MAP ( 0x003B, "NULL-SHA256" ),/// 
TLS_RSA_WITH_NULL_SHA256
   MAP ( 0x003C, "AES128-SHA256" ),  /// 
TLS_RSA_WITH_AES_128_CBC_SHA256
   MAP ( 0x003D, "AES256-SHA256" ),  /// 
TLS_RSA_WITH_AES_256_CBC_SHA256
   MAP ( 0x003E, "DH-DSS-AES128-SHA256" ),   /// 
TLS_DH_DSS_WITH_AES_128_CBC_SHA256
   MAP ( 0x003F, "DH-RSA-AES128-SHA256" ),   /// 
TLS_DH_RSA_WITH_AES_128_CBC_SHA256
+  MAP ( 0x0040, "DHE-DSS-AES128-SHA256" ),  /// 
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
+  MAP ( 0x0041, "CAMELLIA128-SHA" ),/// 
TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
+  MAP ( 0x0042, "DH-DSS-CAMELLIA128-SHA" ), /// 
TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA
+  MAP ( 0x0043, "DH-RSA-CAMELLIA128-SHA" ), /// 
TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA
+  MAP ( 0x0044, "DHE-DSS-CAMELLIA128-SHA" ),/// 
TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA
+  MAP ( 0x0045, "DHE-RSA-CAMELLIA128-SHA" ),/// 
TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
+  MAP ( 0x0046, "ADH-CAMELLIA128-SHA" ),/// 
TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA
   MAP ( 0x0067, "DHE-RSA-AES128-SHA256" ),  /// 
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
   MAP ( 0x0068, "DH-DSS-AES256-SHA256" ),   /// 
TLS_DH_DSS_WITH_AES_256_CBC_SHA256
   MAP ( 0x0069, "DH-RSA-AES256-SHA256" ),   /// 
TLS_DH_RSA_WITH_AES_256_CBC_SHA256
+  MAP ( 0x006A, "DHE-DSS-AES256-SHA256" ), 

[edk2] [PATCH 04/13] NetworkPkg/TlsDxe: clean up byte order conversion for EfiTlsCipherList

2018-04-03 Thread Laszlo Ersek
Fix the following style issues:

- "Data" is accessed through a pointer to UINT16 rather than to a pointer
  to EFI_TLS_CIPHER. While technically correct, UINT16 is harder to
  interpret against the UEFI spec.

- Array subscripting is written with weird *(Pointer + Offset)
  expressions, rather than with Pointer[Offset].

- The byte order is converted with HTONS(), while it should be NTOHS().
  Either way, use the Data1 and Data2 fields of EFI_TLS_CIPHER instead.

Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=915
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 NetworkPkg/TlsDxe/TlsProtocol.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/TlsDxe/TlsProtocol.c b/NetworkPkg/TlsDxe/TlsProtocol.c
index a5f95a098345..298ffdd659a2 100644
--- a/NetworkPkg/TlsDxe/TlsProtocol.c
+++ b/NetworkPkg/TlsDxe/TlsProtocol.c
@@ -57,12 +57,13 @@ TlsSetSessionData (
   IN UINTN DataSize
   )
 {
   EFI_STATUSStatus;
   TLS_INSTANCE  *Instance;
   UINT16*CipherId;
+  CONST EFI_TLS_CIPHER  *TlsCipherList;
   UINTN CipherCount;
   UINTN Index;
 
   EFI_TPL   OldTpl;
 
   Status = EFI_SUCCESS;
@@ -110,15 +111,17 @@ TlsSetSessionData (
 CipherId = AllocatePool (DataSize);
 if (CipherId == NULL) {
   Status = EFI_OUT_OF_RESOURCES;
   goto ON_EXIT;
 }
 
+TlsCipherList = (CONST EFI_TLS_CIPHER *) Data;
 CipherCount = DataSize / sizeof (EFI_TLS_CIPHER);
 for (Index = 0; Index < CipherCount; Index++) {
-  *(CipherId +Index) = HTONS (*(((UINT16 *) Data) + Index));
+  CipherId[Index] = ((TlsCipherList[Index].Data1 << 8) |
+ TlsCipherList[Index].Data2);
 }
 
 Status = TlsSetCipherList (Instance->TlsConn, CipherId, CipherCount);
 
 FreePool (CipherId);
 break;
-- 
2.14.1.3.gb7cf6e02401b


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


[edk2] [PATCH 05/13] CryptoPkg/TlsLib: replace TlsGetCipherString() with TlsGetCipherMapping()

2018-04-03 Thread Laszlo Ersek
In the following patches it will be useful if the IANA CipherId lookup
returns a pointer to the whole matching IANA-to-OpenSSL mapping structure,
not just the OpenSSL cipher suite name. Rename TLS_CIPHER_PAIR and
TlsGetCipherString() to TLS_CIPHER_MAPPING and TlsGetCipherMapping()
respectively, and make the function return a pointer to
TLS_CIPHER_MAPPING.

Cc: Jiaxin Wu 
Cc: Qin Long 
Cc: Siyuan Fu 
Cc: Ting Ye 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=915
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 CryptoPkg/Library/TlsLib/TlsConfig.c | 37 +++-
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/CryptoPkg/Library/TlsLib/TlsConfig.c 
b/CryptoPkg/Library/TlsLib/TlsConfig.c
index 2ffe58ad29a2..507489386b8e 100644
--- a/CryptoPkg/Library/TlsLib/TlsConfig.c
+++ b/CryptoPkg/Library/TlsLib/TlsConfig.c
@@ -21,19 +21,19 @@ typedef struct {
   //
   UINT16  IanaCipher;
   //
   // OpenSSL-used Cipher Suite String
   //
   CONST CHAR8 *OpensslCipher;
-} TLS_CIPHER_PAIR;
+} TLS_CIPHER_MAPPING;
 
 //
 // The mapping table between IANA/IETF Cipher Suite definitions and
 // OpenSSL-used Cipher Suite name.
 //
-STATIC CONST TLS_CIPHER_PAIR TlsCipherMappingTable[] = {
+STATIC CONST TLS_CIPHER_MAPPING TlsCipherMappingTable[] = {
   { 0x0001, "NULL-MD5" }, /// TLS_RSA_WITH_NULL_MD5
   { 0x0002, "NULL-SHA" }, /// TLS_RSA_WITH_NULL_SHA
   { 0x0004, "RC4-MD5" },  /// TLS_RSA_WITH_RC4_128_MD5
   { 0x0005, "RC4-SHA" },  /// TLS_RSA_WITH_RC4_128_SHA
   { 0x000A, "DES-CBC3-SHA" }, /// TLS_RSA_WITH_3DES_EDE_CBC_SHA, 
mandatory TLS 1.1
   { 0x0016, "DHE-RSA-DES-CBC3-SHA" }, /// TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
@@ -54,42 +54,42 @@ STATIC CONST TLS_CIPHER_PAIR TlsCipherMappingTable[] = {
   { 0x0068, "DH-DSS-AES256-SHA256" }, /// 
TLS_DH_DSS_WITH_AES_256_CBC_SHA256
   { 0x0069, "DH-RSA-AES256-SHA256" }, /// 
TLS_DH_RSA_WITH_AES_256_CBC_SHA256
   { 0x006B, "DHE-RSA-AES256-SHA256" } /// 
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
 };
 
 /**
-  Gets the OpenSSL cipher suite string for the supplied IANA TLS cipher suite.
+  Gets the OpenSSL cipher suite mapping for the supplied IANA TLS cipher suite.
 
   @param[in]  CipherIdThe supplied IANA TLS cipher suite ID.
 
-  @return  The corresponding OpenSSL cipher suite string if found,
+  @return  The corresponding OpenSSL cipher suite mapping if found,
NULL otherwise.
 
 **/
 STATIC
-CONST CHAR8 *
-TlsGetCipherString (
+CONST TLS_CIPHER_MAPPING *
+TlsGetCipherMapping (
   IN UINT16   CipherId
   )
 {
-  CONST TLS_CIPHER_PAIR  *CipherEntry;
-  UINTN  TableSize;
-  UINTN  Index;
+  CONST TLS_CIPHER_MAPPING  *CipherEntry;
+  UINTN TableSize;
+  UINTN Index;
 
   CipherEntry = TlsCipherMappingTable;
-  TableSize = sizeof (TlsCipherMappingTable) / sizeof (TLS_CIPHER_PAIR);
+  TableSize = sizeof (TlsCipherMappingTable) / sizeof (TLS_CIPHER_MAPPING);
 
   //
   // Search Cipher Mapping Table for IANA-OpenSSL Cipher Translation
   //
   for (Index = 0; Index < TableSize; Index++, CipherEntry++) {
 //
 // Translate IANA cipher suite name to OpenSSL name.
 //
 if (CipherEntry->IanaCipher == CipherId) {
-  return CipherEntry->OpensslCipher;
+  return CipherEntry;
 }
   }
 
   //
   // No Cipher Mapping found, return NULL.
   //
@@ -226,34 +226,37 @@ EFIAPI
 TlsSetCipherList (
   IN VOID *Tls,
   IN UINT16   *CipherId,
   IN UINTNCipherNum
   )
 {
-  TLS_CONNECTION  *TlsConn;
-  UINTN   Index;
-  CONST CHAR8 *MappingName;
-  CHAR8   CipherString[500];
+  TLS_CONNECTION   *TlsConn;
+  UINTNIndex;
+  CONST TLS_CIPHER_MAPPING *Mapping;
+  CONST CHAR8  *MappingName;
+  CHAR8CipherString[500];
 
   TlsConn = (TLS_CONNECTION *) Tls;
   if (TlsConn == NULL || TlsConn->Ssl == NULL || CipherId == NULL) {
 return EFI_INVALID_PARAMETER;
   }
 
+  Mapping = NULL;
   MappingName = NULL;
 
   memset (CipherString, 0, sizeof (CipherString));
 
   for (Index = 0; Index < CipherNum; Index++) {
 //
 // Handling OpenSSL / RFC Cipher name mapping.
 //
-MappingName = TlsGetCipherString (*(CipherId + Index));
-if (MappingName == NULL) {
+Mapping = TlsGetCipherMapping (*(CipherId + Index));
+if (Mapping == NULL) {
   return EFI_UNSUPPORTED;
 }
+MappingName = Mapping->OpensslCipher;
 
 if (Index != 0) {
   //
   // The ciphers were separated by a colon.
   //
   AsciiStrCatS (CipherString, sizeof (CipherString), ":");
-- 
2.14.1.3.gb7cf6e02401b



[edk2] [PATCH 08/13] CryptoPkg/TlsLib: add the "TlsMappingTable.sh" POSIX shell script

2018-04-03 Thread Laszlo Ersek
Add a shell script that will help us keep "TlsCipherMappingTable" in
"TlsConfig.c" up-to-date.

Cc: Jiaxin Wu 
Cc: Qin Long 
Cc: Siyuan Fu 
Cc: Ting Ye 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=915
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 CryptoPkg/Library/TlsLib/TlsLib.inf |   2 +
 CryptoPkg/Library/TlsLib/TlsMappingTable.sh | 140 
 2 files changed, 142 insertions(+)

diff --git a/CryptoPkg/Library/TlsLib/TlsLib.inf 
b/CryptoPkg/Library/TlsLib/TlsLib.inf
index a3f93e7165cb..dc7f3a5dbd23 100644
--- a/CryptoPkg/Library/TlsLib/TlsLib.inf
+++ b/CryptoPkg/Library/TlsLib/TlsLib.inf
@@ -52,6 +52,8 @@ [BuildOptions]
   #
   # suppress the following warnings so we do not break the build with 
warnings-as-errors:
   # C4090: 'function' : different 'const' qualifiers
   #
   MSFT:*_*_*_CC_FLAGS = /wd4090
 
+[UserExtensions.TianoCore."ExtraFiles"]
+  TlsMappingTable.sh
diff --git a/CryptoPkg/Library/TlsLib/TlsMappingTable.sh 
b/CryptoPkg/Library/TlsLib/TlsMappingTable.sh
new file mode 100644
index ..0cb4a4faa597
--- /dev/null
+++ b/CryptoPkg/Library/TlsLib/TlsMappingTable.sh
@@ -0,0 +1,140 @@
+## @file
+#
+# POSIX shell script to refresh "TlsCipherMappingTable" in "TlsConfig.c".
+#
+# Note: the output of this script is not meant to blindly replace the current
+# contents of "TlsCipherMappingTable". It only helps with the composition and
+# formatting of candidate lines.
+#
+# Copyright (C) 2018, Red Hat, Inc.
+#
+# 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
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+# WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+# Exit on error, treat unset variables as errors, don't overwrite existing
+# files with the ">" output redirection operator.
+set -e -u -C
+
+# This script uses a few utilities that are not defined by POSIX. Check if they
+# are available.
+if ( ! command -v mktemp  ||
+ ! command -v openssl ||
+ ! command -v curl||
+ ! command -v column ) >/dev/null
+then
+  BASENAME=$(basename -- "$0")
+  {
+printf -- '%s: please install the following utilities first:\n' "$BASENAME"
+printf -- '%s:   mktemp openssl curl column\n' "$BASENAME"
+  } >&2
+  exit 1
+fi
+
+# Create a temporary file for saving the OpenSSL output.
+OPENSSL_LIST=$(mktemp)
+trap 'rm -f -- "$OPENSSL_LIST"' EXIT
+
+# Create a temporary file for saving the IANA TLS Cipher Suite Registry.
+IANA_LIST=$(mktemp)
+trap 'rm -f -- "$OPENSSL_LIST" "$IANA_LIST"' EXIT
+
+# Sorting, and range expressions in regular expressions, depend on the locale.
+# Use a well-defined locale.
+LC_ALL=C
+export LC_ALL
+
+# Get OPENSSL_LIST.
+{
+  # List cipher suite codes and names from OpenSSL.
+  openssl ciphers -V ALL
+
+  # This produces a line format like:
+  # 0xC0,0x30 - ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=RSA 
Enc=AESGCM(256) Mac=AEAD
+  # (sequences of space characters squeezed for brevity).
+} |
+{
+  # Project the list to UINT16 hex codes (network byte order interpretation)
+  # and OpenSSL cipher suite names.
+  sed -r -n -e 's/^ *0x([0-9A-F]{2}),0x([0-9A-F]{2}) - ([^ ]+) .*$/\1\2 \3/p'
+
+  # This produces a line format like:
+  # C030 ECDHE-RSA-AES256-GCM-SHA384
+} |
+{
+  # Sort the output so we can later join it on the UINT16 hex code as key.
+  sort
+} >>"$OPENSSL_LIST"
+
+# Get IANA_LIST.
+{
+  # Download the CSV file from the IANA website.
+  curl -s https://www.iana.org/assignments/tls-parameters/tls-parameters-4.csv
+
+  # This produces a line format like:
+  # Value,Description,DTLS-OK,Reference
+  # "0x00,0x00",TLS_NULL_WITH_NULL_NULL,Y,[RFC5246]
+} |
+{
+  # Project the list to UINT16 hex codes (network byte order interpretation)
+  # and Descriptions (TLS_xxx macros).
+  sed -r -n \
+-e 's/^"0x([0-9A-F]{2}),0x([0-9A-F]{2})",([A-Za-z0-9_]+).*$/\1\2 \3/p'
+
+  # This produces a line format like:
+  #  TLS_NULL_WITH_NULL_NULL
+} |
+{
+  # Sort the output so we can later join it on the UINT16 hex code as key.
+  sort
+} >>"$IANA_LIST"
+
+# Produce the C source code on stdout.
+{
+  # Join the two lists first. Elements that are in exactly one input file are
+  # dropped.
+  join -- "$OPENSSL_LIST" "$IANA_LIST"
+
+  # This produces a line format like:
+  # 0004 RC4-MD5 TLS_RSA_WITH_RC4_128_MD5
+  # And the output remains sorted by UINT16 hex key.
+} |
+{
+  # Produce a valid C language line. Be careful that only one space character
+  # is preserved, for the next step.
+  sed -r -n -e 's!^([0-9A-F]{4}) ([^ ]+) ([^ ]+)$!{0x\1,"\2"}, ///\3!p'
+
+  # This produces a line format like:
+  # 

[edk2] [PATCH 03/13] NetworkPkg/TlsDxe: verify DataSize for EfiTlsCipherList

2018-04-03 Thread Laszlo Ersek
TlsSetSessionData() shouldn't just ignore an incomplete EFI_TLS_CIPHER
element at the end of "Data":

- Generally speaking, malformed input for a security API is best rejected
  explicitly.

- Specifically speaking, the size of EFI_TLS_CIPHER is 2 bytes. If
  DataSize is 1 on input, then the initial check for (DataSize == 0) will
  fail, but then TlsSetCipherList() will be called with CipherNum=0.

Return EFI_INVALID_PARAMETER from TlsSetSessionData() if "Data" doesn't
contain a whole number of EFI_TLS_CIPHER elements. While at it, introduce
the dedicated variable CipherCount.

Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=915
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 NetworkPkg/TlsDxe/TlsProtocol.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/TlsDxe/TlsProtocol.c b/NetworkPkg/TlsDxe/TlsProtocol.c
index ad4c922c60bd..a5f95a098345 100644
--- a/NetworkPkg/TlsDxe/TlsProtocol.c
+++ b/NetworkPkg/TlsDxe/TlsProtocol.c
@@ -35,12 +35,13 @@ EFI_TLS_PROTOCOL  mTlsProtocol = {
 
   @retval EFI_SUCCESS The TLS session data is set successfully.
   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is 
TRUE:
   This is NULL.
   Data is NULL.
   DataSize is 0.
+  DataSize is invalid for DataType.
   @retval EFI_UNSUPPORTED The DataType is unsupported.
   @retval EFI_ACCESS_DENIED   If the DataType is one of below:
   EfiTlsClientRandom
   EfiTlsServerRandom
   EfiTlsKeyMaterial
   @retval EFI_NOT_READY   Current TLS session state is NOT
@@ -56,12 +57,13 @@ TlsSetSessionData (
   IN UINTN DataSize
   )
 {
   EFI_STATUSStatus;
   TLS_INSTANCE  *Instance;
   UINT16*CipherId;
+  UINTN CipherCount;
   UINTN Index;
 
   EFI_TPL   OldTpl;
 
   Status = EFI_SUCCESS;
   CipherId = NULL;
@@ -97,23 +99,29 @@ TlsSetSessionData (
   goto ON_EXIT;
 }
 
 Status = TlsSetConnectionEnd (Instance->TlsConn, *((EFI_TLS_CONNECTION_END 
*) Data));
 break;
   case EfiTlsCipherList:
+if (DataSize % sizeof (EFI_TLS_CIPHER) != 0) {
+  Status = EFI_INVALID_PARAMETER;
+  goto ON_EXIT;
+}
+
 CipherId = AllocatePool (DataSize);
 if (CipherId == NULL) {
   Status = EFI_OUT_OF_RESOURCES;
   goto ON_EXIT;
 }
 
-for (Index = 0; Index < DataSize / sizeof (EFI_TLS_CIPHER); Index++) {
+CipherCount = DataSize / sizeof (EFI_TLS_CIPHER);
+for (Index = 0; Index < CipherCount; Index++) {
   *(CipherId +Index) = HTONS (*(((UINT16 *) Data) + Index));
 }
 
-Status = TlsSetCipherList (Instance->TlsConn, CipherId, DataSize / sizeof 
(EFI_TLS_CIPHER));
+Status = TlsSetCipherList (Instance->TlsConn, CipherId, CipherCount);
 
 FreePool (CipherId);
 break;
   case EfiTlsCompressionMethod:
 //
 // TLS seems only define one CompressionMethod.null, which specifies that 
data exchanged via the
-- 
2.14.1.3.gb7cf6e02401b


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


[edk2] [PATCH 07/13] CryptoPkg/TlsLib: pre-compute OpensslCipherLength in TlsCipherMappingTable

2018-04-03 Thread Laszlo Ersek
In the next patches, we'll need the lengths of the
TLS_CIPHER_MAPPING.OpensslCipher string fields. These lengths can be
computed at build time; add the new field "OpensslCipherLength", and
introduce the MAP() macro for populating it.

While at it, add some horizontal whitespace to "TlsCipherMappingTable",
and add a comma after the last element. This will come handy in a later
patch.

(The patch does not change the first two columns of
"TlsCipherMappingTable", which can be easily verified with "git show
--word-diff".)

Cc: Jiaxin Wu 
Cc: Qin Long 
Cc: Siyuan Fu 
Cc: Ting Ye 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=915
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 CryptoPkg/Library/TlsLib/TlsConfig.c | 58 
 1 file changed, 35 insertions(+), 23 deletions(-)

diff --git a/CryptoPkg/Library/TlsLib/TlsConfig.c 
b/CryptoPkg/Library/TlsLib/TlsConfig.c
index c1d91a599482..e2f819b9035f 100644
--- a/CryptoPkg/Library/TlsLib/TlsConfig.c
+++ b/CryptoPkg/Library/TlsLib/TlsConfig.c
@@ -21,44 +21,56 @@ typedef struct {
   //
   UINT16  IanaCipher;
   //
   // OpenSSL-used Cipher Suite String
   //
   CONST CHAR8 *OpensslCipher;
+  //
+  // Length of OpensslCipher
+  //
+  UINTN   OpensslCipherLength;
 } TLS_CIPHER_MAPPING;
 
+//
+// Create a TLS_CIPHER_MAPPING initializer from IanaCipher and OpensslCipher so
+// that OpensslCipherLength is filled in automatically. IanaCipher must be an
+// integer constant expression, and OpensslCipher must be a string literal.
+//
+#define MAP(IanaCipher, OpensslCipher) \
+  { (IanaCipher), (OpensslCipher), sizeof (OpensslCipher) - 1 }
+
 //
 // The mapping table between IANA/IETF Cipher Suite definitions and
 // OpenSSL-used Cipher Suite name.
 //
 // Keep the table uniquely sorted by the IanaCipher field, in increasing order.
 //
 STATIC CONST TLS_CIPHER_MAPPING TlsCipherMappingTable[] = {
-  { 0x0001, "NULL-MD5" }, /// TLS_RSA_WITH_NULL_MD5
-  { 0x0002, "NULL-SHA" }, /// TLS_RSA_WITH_NULL_SHA
-  { 0x0004, "RC4-MD5" },  /// TLS_RSA_WITH_RC4_128_MD5
-  { 0x0005, "RC4-SHA" },  /// TLS_RSA_WITH_RC4_128_SHA
-  { 0x000A, "DES-CBC3-SHA" }, /// TLS_RSA_WITH_3DES_EDE_CBC_SHA, 
mandatory TLS 1.1
-  { 0x0016, "DHE-RSA-DES-CBC3-SHA" }, /// TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
-  { 0x002F, "AES128-SHA" },   /// TLS_RSA_WITH_AES_128_CBC_SHA, 
mandatory TLS 1.2
-  { 0x0030, "DH-DSS-AES128-SHA" },/// TLS_DH_DSS_WITH_AES_128_CBC_SHA
-  { 0x0031, "DH-RSA-AES128-SHA" },/// TLS_DH_RSA_WITH_AES_128_CBC_SHA
-  { 0x0033, "DHE-RSA-AES128-SHA" },   /// TLS_DHE_RSA_WITH_AES_128_CBC_SHA
-  { 0x0035, "AES256-SHA" },   /// TLS_RSA_WITH_AES_256_CBC_SHA
-  { 0x0036, "DH-DSS-AES256-SHA" },/// TLS_DH_DSS_WITH_AES_256_CBC_SHA
-  { 0x0037, "DH-RSA-AES256-SHA" },/// TLS_DH_RSA_WITH_AES_256_CBC_SHA
-  { 0x0039, "DHE-RSA-AES256-SHA" },   /// TLS_DHE_RSA_WITH_AES_256_CBC_SHA
-  { 0x003B, "NULL-SHA256" },  /// TLS_RSA_WITH_NULL_SHA256
-  { 0x003C, "AES128-SHA256" },/// TLS_RSA_WITH_AES_128_CBC_SHA256
-  { 0x003D, "AES256-SHA256" },/// TLS_RSA_WITH_AES_256_CBC_SHA256
-  { 0x003E, "DH-DSS-AES128-SHA256" }, /// 
TLS_DH_DSS_WITH_AES_128_CBC_SHA256
-  { 0x003F, "DH-RSA-AES128-SHA256" }, /// 
TLS_DH_RSA_WITH_AES_128_CBC_SHA256
-  { 0x0067, "DHE-RSA-AES128-SHA256" },/// 
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
-  { 0x0068, "DH-DSS-AES256-SHA256" }, /// 
TLS_DH_DSS_WITH_AES_256_CBC_SHA256
-  { 0x0069, "DH-RSA-AES256-SHA256" }, /// 
TLS_DH_RSA_WITH_AES_256_CBC_SHA256
-  { 0x006B, "DHE-RSA-AES256-SHA256" } /// 
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
+  MAP ( 0x0001, "NULL-MD5" ),   /// TLS_RSA_WITH_NULL_MD5
+  MAP ( 0x0002, "NULL-SHA" ),   /// TLS_RSA_WITH_NULL_SHA
+  MAP ( 0x0004, "RC4-MD5" ),/// 
TLS_RSA_WITH_RC4_128_MD5
+  MAP ( 0x0005, "RC4-SHA" ),/// 
TLS_RSA_WITH_RC4_128_SHA
+  MAP ( 0x000A, "DES-CBC3-SHA" ),   /// 
TLS_RSA_WITH_3DES_EDE_CBC_SHA, mandatory TLS 1.1
+  MAP ( 0x0016, "DHE-RSA-DES-CBC3-SHA" ),   /// 
TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
+  MAP ( 0x002F, "AES128-SHA" ), /// 
TLS_RSA_WITH_AES_128_CBC_SHA, mandatory TLS 1.2
+  MAP ( 0x0030, "DH-DSS-AES128-SHA" ),  /// 
TLS_DH_DSS_WITH_AES_128_CBC_SHA
+  MAP ( 0x0031, "DH-RSA-AES128-SHA" ),  /// 
TLS_DH_RSA_WITH_AES_128_CBC_SHA
+  MAP ( 0x0033, "DHE-RSA-AES128-SHA" ), /// 
TLS_DHE_RSA_WITH_AES_128_CBC_SHA
+  MAP ( 0x0035, "AES256-SHA" ), /// 
TLS_RSA_WITH_AES_256_CBC_SHA
+  MAP ( 0x0036, "DH-DSS-AES256-SHA" ),  /// 

[edk2] [PATCH 02/13] MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC

2018-04-03 Thread Laszlo Ersek
The structures defined in RFC 5246 are not to have any padding between
fields or at the end; use the "pack" pragma as necessary.

Cc: Jiaxin Wu 
Cc: Liming Gao 
Cc: Michael D Kinney 
Cc: Siyuan Fu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=915
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 MdePkg/Include/Protocol/Tls.h | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/MdePkg/Include/Protocol/Tls.h b/MdePkg/Include/Protocol/Tls.h
index 2119f33c0f5b..dafaabcd2a8b 100644
--- a/MdePkg/Include/Protocol/Tls.h
+++ b/MdePkg/Include/Protocol/Tls.h
@@ -138,33 +138,37 @@ typedef enum {
 ///
 /// EFI_TLS_CIPHER
 /// Note: The definition of EFI_TLS_CIPHER definition is from "RFC 5246, A.4.1.
 ///   Hello Messages". The value of EFI_TLS_CIPHER is from TLS Cipher
 ///   Suite Registry of IANA.
 ///
+#pragma pack (1)
 typedef struct {
   UINT8 Data1;
   UINT8 Data2;
 } EFI_TLS_CIPHER;
+#pragma pack ()
 
 ///
 /// EFI_TLS_COMPRESSION
 /// Note: The value of EFI_TLS_COMPRESSION definition is from "RFC 3749".
 ///
 typedef UINT8 EFI_TLS_COMPRESSION;
 
 ///
 /// EFI_TLS_EXTENSION
 /// Note: The definition of EFI_TLS_EXTENSION if from "RFC 5246 A.4.1.
 ///   Hello Messages".
 ///
+#pragma pack (1)
 typedef struct {
   UINT16ExtensionType;
   UINT16Length;
   UINT8 Data[1];
 } EFI_TLS_EXTENSION;
+#pragma pack ()
 
 ///
 /// EFI_TLS_VERIFY
 /// Use either EFI_TLS_VERIFY_NONE or EFI_TLS_VERIFY_PEER, the last two options
 /// are 'ORed' with EFI_TLS_VERIFY_PEER if they are desired.
 ///
@@ -191,35 +195,41 @@ typedef UINT32  EFI_TLS_VERIFY;
 
 ///
 /// EFI_TLS_RANDOM
 /// Note: The definition of EFI_TLS_RANDOM is from "RFC 5246 A.4.1.
 ///   Hello Messages".
 ///
+#pragma pack (1)
 typedef struct {
   UINT32GmtUnixTime;
   UINT8 RandomBytes[28];
 } EFI_TLS_RANDOM;
+#pragma pack ()
 
 ///
 /// EFI_TLS_MASTER_SECRET
 /// Note: The definition of EFI_TLS_MASTER_SECRET is from "RFC 5246 8.1.
 ///   Computing the Master Secret".
 ///
+#pragma pack (1)
 typedef struct {
   UINT8 Data[48];
 } EFI_TLS_MASTER_SECRET;
+#pragma pack ()
 
 ///
 /// EFI_TLS_SESSION_ID
 /// Note: The definition of EFI_TLS_SESSION_ID is from "RFC 5246 A.4.1. Hello 
Messages".
 ///
 #define MAX_TLS_SESSION_ID_LENGTH  32
+#pragma pack (1)
 typedef struct {
   UINT16Length;
   UINT8 Data[MAX_TLS_SESSION_ID_LENGTH];
 } EFI_TLS_SESSION_ID;
+#pragma pack ()
 
 ///
 /// EFI_TLS_SESSION_STATE
 ///
 typedef enum {
   ///
-- 
2.14.1.3.gb7cf6e02401b


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


Re: [edk2] [PATCH v2 00/15] rid PiSmmCpuDxeSmm of DB-encoded instructions

2018-04-03 Thread Laszlo Ersek
Hi Mike, Liming, Eric,

On 03/23/18 22:14, Laszlo Ersek wrote:
> Repo:   https://github.com/lersek/edk2.git
> Branch: patch_insn_x86_v2
> 
> This is version 2 of the series originally posted at
> .
> The changes are documented per patch.
> 
> I retested the test cases listed in the v1 blurb.
> 
> Cc: Eric Dong 
> Cc: Liming Gao 
> Cc: Michael D Kinney 

do you have any comments?

Thank you!
Laszlo

> Laszlo Ersek (15):
>   MdePkg/BaseLib.h: state preprocessing conditions in comments after
> #endifs
>   MdePkg/BaseLib: add PatchInstructionX86()
>   UefiCpuPkg/PiSmmCpuDxeSmm: remove *.S and *.asm assembly files
>   UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmbase" with PatchInstructionX86()
>   UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmiStack" with
> PatchInstructionX86()
>   UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmiCr3" with PatchInstructionX86()
>   UefiCpuPkg/PiSmmCpuDxeSmm: patch "XdSupported" with
> PatchInstructionX86()
>   UefiCpuPkg/PiSmmCpuDxeSmm: remove unneeded DBs from X64 SmmStartup()
>   UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmmCr3" with PatchInstructionX86()
>   UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmmCr4" with PatchInstructionX86()
>   UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmmCr0" with PatchInstructionX86()
>   UefiCpuPkg/PiSmmCpuDxeSmm: eliminate "gSmmJmpAddr" and related DBs
>   UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmmInitStack" with
> PatchInstructionX86()
>   UefiCpuPkg/PiSmmCpuDxeSmm: remove DBs from
> SmmRelocationSemaphoreComplete32()
>   UefiCpuPkg/PiSmmCpuDxeSmm: use mnemonics for FXSAVE(64)/FXRSTOR(64)
> 
>  MdePkg/Include/Library/BaseLib.h |  76 ++-
>  MdePkg/Library/BaseLib/BaseLib.inf   |   2 +
>  MdePkg/Library/BaseLib/X86PatchInstruction.c |  89 +++
>  UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c|   4 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/MpFuncs.S | 165 -
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/MpFuncs.asm   | 168 -
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S| 215 --
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm  | 223 --
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm |  25 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiException.S| 696 ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiException.asm  | 713 
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiException.nasm |   8 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.S |  84 ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.asm   |  94 ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.nasm  |  30 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c   |  27 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h   |  21 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf |  20 -
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c   |   7 +
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h   |   1 +
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c   |  20 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/MpFuncs.S  | 204 --
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/MpFuncs.asm| 206 --
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c|  16 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S | 243 ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm   | 242 ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm  |  31 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiException.S | 365 --
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiException.asm   | 383 ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiException.nasm  |   4 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.S  | 141 
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.asm| 132 
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.nasm   |  76 +--
>  33 files changed, 295 insertions(+), 4436 deletions(-)
>  create mode 100644 MdePkg/Library/BaseLib/X86PatchInstruction.c
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/MpFuncs.S
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/MpFuncs.asm
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiException.S
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiException.asm
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.S
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.asm
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/X64/MpFuncs.S
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/X64/MpFuncs.asm
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiException.S
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiException.asm
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.S
>  delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.asm
> 


Re: [edk2] OVMF UsbBulkTransfer returns EFI_OUT_OF_RESOURCES

2018-04-03 Thread Laszlo Ersek
Hi Rob,

On 04/03/18 00:12, Rob Taglang wrote:
> Hello,
> 
> I can pass a host USB device to QEMU boot with OVMF, and it shows up as
> a EFI_USB_IO_PROTOCOL device and the interface descriptors and endpoints
> are detected correctly. A UsbControlTransfer operation succeeds.
> However, UsbBulkTransfer returns EFI_OUT_OF_RESOURCES regardless of how
> much memory I allocate for QEMU.
> 
> This application does work correctly on real hardware. Is this expected
> behavior in OVMF?

I seem to recall recent patches for the core USB drivers in edk2 that
modified various timeouts and transfer block sizes. For example:

  [edk2] [MdeModulePkg/Usb v2 0/1] Calculating the count of blocks to
   transfer

Committed at
.

Can you try a fresh edk2 build, and/or state git commit hashes at which
the tree does or does not work for you?

It would also be interesting to know the exact USB device (vendor, model
etc) that produces this issue for you. Chances are the edk2 USB drivers
would have the same issue if they encountered your device on the bare
metal (i.e. with edk2 running as physical platform firmware).

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


Re: [edk2] [PATCH 2/2] UefiCpuPkg PiSmmCpuDxeSmm: Refine some comments about SmmMemoryAttribute

2018-04-03 Thread Laszlo Ersek
On 04/03/18 03:52, Star Zeng wrote:
> 1. Fix some "support" to "supported".
> 2. Fix some "set" to "clear" in ClearMemoryAttributes interface.
> 3. Remove redundant comments for GetMemoryAttributes interface.
> 
> Cc: Jian J Wang 
> Cc: Jiewen Yao 
> Cc: Eric Dong 
> Cc: Laszlo Ersek 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 15 ++-
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 21 +
>  2 files changed, 15 insertions(+), 21 deletions(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> index a2babb987732..af6437ee822b 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> @@ -1079,7 +1079,7 @@ TransferApToSafeState (
>@retval EFI_UNSUPPORTED   The processor does not support one or more
>  bytes of the memory resource range specified
>  by BaseAddress and Length.
> -The bit mask of attributes is not support for
> +The bit mask of attributes is not supported 
> for
>  the memory resource range specified by
>  BaseAddress and Length.
>  
> @@ -1101,17 +1101,17 @@ EdkiiSmmSetMemoryAttributes (
>@param  BaseAddress   The physical address that is the start address of
>  a memory region.
>@param  LengthThe size in bytes of the memory region.
> -  @param  AttributesThe bit mask of attributes to set for the memory
> +  @param  AttributesThe bit mask of attributes to clear for the 
> memory
>  region.
>  
> -  @retval EFI_SUCCESS   The attributes were set for the memory 
> region.
> +  @retval EFI_SUCCESS   The attributes were clear for the memory 
> region.

Please write "were cleared" here.

>@retval EFI_INVALID_PARAMETER Length is zero.
>  Attributes specified an illegal combination 
> of
> -attributes that cannot be set together.
> +attributes that cannot be clear together.

Same here, "be cleared".

>@retval EFI_UNSUPPORTED   The processor does not support one or more
>  bytes of the memory resource range specified
>  by BaseAddress and Length.
> -The bit mask of attributes is not support for
> +The bit mask of attributes is not supported 
> for
>  the memory resource range specified by
>  BaseAddress and Length.
>  
> @@ -1126,7 +1126,7 @@ EdkiiSmmClearMemoryAttributes (
>);
>  
>  /**
> -  This function retrieve the attributes of the memory region specified by
> +  This function retrieves the attributes of the memory region specified by
>BaseAddress and Length. If different attributes are got from different part
>of the memory region, EFI_NO_MAPPING will be returned.
>  
> @@ -1144,9 +1144,6 @@ EdkiiSmmClearMemoryAttributes (
>@retval EFI_UNSUPPORTED   The processor does not support one or more
>  bytes of the memory resource range specified
>  by BaseAddress and Length.
> -The bit mask of attributes is not support for
> -the memory resource range specified by
> -BaseAddress and Length.
>  
>  **/
>  EFI_STATUS
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> index 2a4a29899862..17515fbe079c 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> @@ -604,7 +604,7 @@ SmmClearMemoryAttributesEx (
>  the memory resource range.
>@retval EFI_UNSUPPORTED   The processor does not support one or more 
> bytes of the memory
>  resource range specified by BaseAddress and 
> Length.
> -The bit mask of attributes is not support 
> for the memory resource
> +The bit mask of attributes is not supported 
> for the memory resource
>  range specified by BaseAddress and Length.
>  
>  **/
> @@ -632,12 +632,12 @@ SmmSetMemoryAttributes (
>  BaseAddress and Length cannot be modified.
>@retval EFI_INVALID_PARAMETER Length is zero.
>   

Re: [edk2] [PATCH 1/2] MdeModulePkg SmmMemoryAttribute.h: Refine some comments

2018-04-03 Thread Laszlo Ersek
Hi Star,

On 04/03/18 03:52, Star Zeng wrote:
> 1. Fix some "support" to "supported".
> 2. Fix some "set" to "clear" in ClearMemoryAttributes interface.
> 3. Remove redundant comments for GetMemoryAttributes interface.
> 
> Cc: Jian J Wang 
> Cc: Jiewen Yao 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> ---
>  MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h | 15 ++-
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h 
> b/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h
> index 0700eb51d6e1..012fa2aaec6e 100644
> --- a/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h
> +++ b/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h
> @@ -2,7 +2,7 @@
>SMM Memory Attribute Protocol provides retrieval and update service
>for memory attributes in EFI SMM environment.
>  
> -  Copyright (c) 2017, Intel Corporation. All rights reserved.
> +  Copyright (c) 2017 - 2018, 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
> @@ -42,7 +42,7 @@ typedef struct _EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL 
> EDKII_SMM_MEMORY_ATTRIBUTE_P
>@retval EFI_UNSUPPORTED   The processor does not support one or more
>  bytes of the memory resource range specified
>  by BaseAddress and Length.
> -The bit mask of attributes is not support for
> +The bit mask of attributes is not supported 
> for
>  the memory resource range specified by
>  BaseAddress and Length.
>  
> @@ -64,17 +64,17 @@ EFI_STATUS
>@param  BaseAddress   The physical address that is the start address of
>  a memory region.
>@param  LengthThe size in bytes of the memory region.
> -  @param  AttributesThe bit mask of attributes to set for the memory
> +  @param  AttributesThe bit mask of attributes to clear for the 
> memory
>  region.
>  
> -  @retval EFI_SUCCESS   The attributes were set for the memory 
> region.
> +  @retval EFI_SUCCESS   The attributes were clear for the memory 
> region.

(This is for EDKII_SMM_CLEAR_MEMORY_ATTRIBUTES.)

Please write "were cleared" here, not just "were clear".

With that change:

Reviewed-by: Laszlo Ersek 

Thanks!
Laszlo


>@retval EFI_INVALID_PARAMETER Length is zero.
>  Attributes specified an illegal combination 
> of
>  attributes that cannot be set together.
>@retval EFI_UNSUPPORTED   The processor does not support one or more
>  bytes of the memory resource range specified
>  by BaseAddress and Length.
> -The bit mask of attributes is not support for
> +The bit mask of attributes is not supported 
> for
>  the memory resource range specified by
>  BaseAddress and Length.
>  
> @@ -89,7 +89,7 @@ EFI_STATUS
>);
>  
>  /**
> -  This function retrieve the attributes of the memory region specified by
> +  This function retrieves the attributes of the memory region specified by
>BaseAddress and Length. If different attributes are got from different part
>of the memory region, EFI_NO_MAPPING will be returned.
>  
> @@ -107,9 +107,6 @@ EFI_STATUS
>@retval EFI_UNSUPPORTED   The processor does not support one or more
>  bytes of the memory resource range specified
>  by BaseAddress and Length.
> -The bit mask of attributes is not support for
> -the memory resource range specified by
> -BaseAddress and Length.
>  
>  **/
>  typedef
> 

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


Re: [edk2] OVMF package : Question about Qemu/Xen support

2018-04-03 Thread Laszlo Ersek
Hi,

(CC Marcel)

On 04/02/18 08:55, Tiger Liu(BJ-RD) wrote:
> Hi, Laszlo:
> I have a question you would like to ask you.
> Could I study pcie native hot plug feature with ovmf?
> 
> It seems qemu emulates Q35 chipset.
> And ovmf provides PciHotPlugInitDxe driver.

Sure. Here's some tips I can give you:

* The first PCI Express -- not traditional PCI -- hotplug feature
request for OVMF arrived in
. That link is dead now,
because we abandoned the GitHub issue tracker. Instead, the report was
migrated to .

This issue got solved by adding MMCONFIG (ECAM) config space access to
OVMF. Without MMCONFIG, PCIe hotplug in the guest OS would not work.
Please see Marcel's analysis in the TianoCore BZ linked above. The edk2
commit range is noted in comment 32.

* Once config space access works like that, you need the PCIe
enumeration / resource assignment (which occurs in the firmware) to
account for PCI resources *in advance* that hotplugged endpoints *might*
require. This means reserving various kinds of apertures. On the QEMU
side, this is documented in the following two text files (in the QEMU tree):

- docs/pcie.txt
- docs/pcie_pci_bridge.txt

In particular there is a "resource reservation hint" PCIe capability
(for PCIe root ports) that QEMU can populate and OVMF can parse. Then
OVMF informs PciBusDxe to reserve the appropriate resources.

* PCI_HOT_PLUG_INIT_PROTOCOL (implemented in OVMF by
OvmfPkg/PciHotPlugInitDxe) is defined by the PI spec. Roughly, it has
two purposes: it can (a) report+initialize non-enumerable [*] hotplug
controllers (of which QEMU has none) to PciBusDxe, (b) it can convey
reservation hints ("resource paddings") to PciBusDxe. OVMF stubs out the
two interfaces related to purpose (a), and implements the
GetResourcePadding() member function (purpose (b)) by translating QEMU's
PCIe capability to the format expected by the PI spec and PciBusDxe.

[*] The PI spec calls this kind of hotplug controller "root" HPC, but
that has nothing to do with "root" in the PCIe sense. In this
terminology, "root HPC" simply means "non-enumerable", and "non-root
HPC" means "enumerable" through the normal PCI(e) traversal.


Hope this helps,
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v1 0/4] BaseTools: remove un-needed code

2018-04-03 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jaben 
Carsey
Sent: Friday, March 30, 2018 8:19 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH v1 0/4] BaseTools: remove un-needed code

improve the code by removing uncalled functions and using more built in 
functionality.

Jaben Carsey (4):
  BaseTools: change hex parsing to use built in
  BaseTools: remove uncalled function
  BaseTools: make static functions when self is not needed
  BaseTools: remove uncalled functions

 BaseTools/Source/Python/Common/FdfParserLite.py  | 63 +--
 BaseTools/Source/Python/Ecc/CodeFragmentCollector.py | 36 +--  
BaseTools/Source/Python/Eot/CodeFragmentCollector.py | 36 +--
 BaseTools/Source/Python/GenFds/FdfParser.py  | 66 +---
 4 files changed, 32 insertions(+), 169 deletions(-)

--
2.16.2.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 v1 0/3] BaseTools: reduce RegExp compile times...

2018-04-03 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jaben 
Carsey
Sent: Friday, March 30, 2018 5:38 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH v1 0/3] BaseTools: reduce RegExp compile times...

make a new shareable RegEx in FdfParserLite, then use it

Jaben Carsey (3):
  BaseTools: use single RegExp for token matching
  BaseTools: use new RegEx from FdfParserLite
  BaseTools: fix comment cut/paste error

 BaseTools/Source/Python/Common/FdfParserLite.py | 20 +---
 BaseTools/Source/Python/GenFds/FdfParser.py | 12 +---
 2 files changed, 14 insertions(+), 18 deletions(-)

-- 
2.16.2.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] FDF spec: Update version to 1.28

2018-04-03 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Zhu, Yonghong
>Sent: Tuesday, April 03, 2018 3:18 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming ; Kinney, Michael D
>; Shaw, Kevin W 
>Subject: [Patch] FDF spec: Update version to 1.28
>
>Cc: Liming Gao 
>Cc: Michael Kinney 
>Cc: Kevin W Shaw 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yonghong Zhu 
>---
> 2_fdf_design_discussion/README.md|  4 ++--
> 3_edk_ii_fdf_file_format/34_[defines]_section.md | 16 
> README.md|  5 +++--
> 3 files changed, 13 insertions(+), 12 deletions(-)
>
>diff --git a/2_fdf_design_discussion/README.md
>b/2_fdf_design_discussion/README.md
>index 3202f56..7d87e43 100644
>--- a/2_fdf_design_discussion/README.md
>+++ b/2_fdf_design_discussion/README.md
>@@ -1,9 +1,9 @@
> 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] INF spec: Update version to 1.27

2018-04-03 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>Yonghong Zhu
>Sent: Tuesday, April 03, 2018 3:18 PM
>To: edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Shaw, Kevin W
>; Gao, Liming 
>Subject: [edk2] [Patch] INF spec: Update version to 1.27
>
>Cc: Liming Gao 
>Cc: Michael Kinney 
>Cc: Kevin W Shaw 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yonghong Zhu 
>---
> 2_inf_overview/24_[defines]_section.md   |  8 
> 3_edk_ii_inf_file_format/34_[defines]_section.md | 22 +++
>---
> README.md|  4 +++-
> appendix_d_sample_driver_inf_files.md|  6 +++---
> appendix_e_sample_library_inf_files.md   |  8 
> appendix_f_sample_binary_inf_files.md|  4 ++--
> 6 files changed, 27 insertions(+), 25 deletions(-)
>
>diff --git a/2_inf_overview/24_[defines]_section.md
>b/2_inf_overview/24_[defines]_section.md
>index 3aab498..37b0135 100644
>--- a/2_inf_overview/24_[defines]_section.md
>+++ b/2_inf_overview/24_[defines]_section.md
>@@ -1,9 +1,9 @@
> -- | - | 
>---
>---
>---
>---
>---
> |
>-| `INF_VERSION`| REQUIRED 
>| 1.25 or
>0x00010019| This identifies the INF spec. version. 
>Tools use this
>value to handle parsing of previous releases of the specification if there are
>incompatible changes.
>|
>+| `INF_VERSION`| REQUIRED 
>| 1.27
>or 0x0001001B| This identifies the INF spec. 
>version. It is decimal
>value with fraction or two-nibble hexadecimal representation of the same, for
>example: 1.27. Tools use this value to handle parsing of previous releases of
>the specification if there are incompatible changes.
>|
> | `BASE_NAME`  | REQUIRED 
> | A
>single word | This is a single word identifier 
>that will be used
>for the component name.
>|
> | `EDK_RELEASE_VERSION`| Not required 
> |
>Hex Double Word   | The minimum revision value 
>across the
>module and all its dependent libraries. If a revision value is not declared in 
>the
>module or any of the dependent libraries, then the tool may use the value of
>0, which disables checking.
>|
> | `PI_SPECIFICATION_VERSION`   | Not required
>| Decimal or special format of hex  | The minimum revision value 
>across
>the module and all its dependent libraries. If a revision value is not 
>declared in
>the module or any of the dependent libraries, then tools may use the value of
>0, which disables checking.
>|
> |  |  
> |
>| The `PI_SPECIFICATION_VERSION` must only be set in the INF file if the
>module depends on services or system table fields or PI core behaviors that
>are not present in the PI 1.0 version. For example, if a module depends on
>definitions in PI 1.1 that are not in PI 1.0, then `PI_SPECIFICATION_VERSION`
>must be 0x0001000A
>|
> | `UEFI_SPECIFICATION_VERSION` | Not required
>| Decimal or special format of hex  | The minimum revision value 
>across
>the module and all its dependent libraries. If a revision value is not 
>declared in
>the module or any of the dependent libraries, then tools may use the value of
>0, which disables checking.
>|
>diff --git a/3_edk_ii_inf_file_format/34_[defines]_section.md
>b/3_edk_ii_inf_file_format/34_[defines]_section.md
>index c121331..494b77d 100644
>--- a/3_edk_ii_inf_file_format/34_[defines]_section.md
>+++ b/3_edk_ii_inf_file_format/34_[defines]_section.md
>@@ -1,9 +1,9 @@
> 2.6.1.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] DSC spec: Update version to 1.28

2018-04-03 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Zhu, Yonghong
>Sent: Tuesday, April 03, 2018 3:18 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming ; Kinney, Michael D
>; Shaw, Kevin W 
>Subject: [Patch] DSC spec: Update version to 1.28
>
>Cc: Liming Gao 
>Cc: Michael Kinney 
>Cc: Kevin W Shaw 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yonghong Zhu 
>---
> 2_dsc_overview/23_[defines]_section_processing.md |  6 +++---
> 2_dsc_overview/README.md  |  4 ++--
> 3_edk_ii_dsc_file_format/35_[defines]_section.md  | 10 +-
> README.md |  8 +++-
> SUMMARY.md|  1 +
> appendix_b_sample_edk_ii_dsc_file.md  |  4 ++--
> 6 files changed, 20 insertions(+), 13 deletions(-)
>
>diff --git a/2_dsc_overview/23_[defines]_section_processing.md
>b/2_dsc_overview/23_[defines]_section_processing.md
>index a7e8680..428196b 100644
>--- a/2_dsc_overview/23_[defines]_section_processing.md
>+++ b/2_dsc_overview/23_[defines]_section_processing.md
>@@ -1,9 +1,9 @@
> ---
>---
>---
>---
>--- |
>-| `DSC_SPECIFICATION`   | Required| 0x0001001B or 1.27
>   | This
>entry is required for all EDK II DSC files. The value, 0x0001001B matches the
>1.27 version of this specification. Build tools must continue to support DSC 
>files
>that correspond to earlier versions of the document until such time as earlier
>versions are no longer in use. In order to maintain backward compatibility, 
>this
>value must only be updated in existing DSC files if other content in the file 
>is
>updated. |
>-|   | |   
>   | This value may also be specified
>as decimal value, i.e., 1.27.
>|
>+| `DSC_SPECIFICATION`   | Required| 0x0001001C or 1.28
>   | This
>entry is required for all EDK II DSC files. The value, 0x0001001C matches the
>1.28 version of this specification. Build tools must continue to support DSC 
>files
>that correspond to earlier versions of the document until such time as earlier
>versions are no longer in use. In order to maintain backward compatibility, 
>this
>value must only be updated in existing DSC files if other content in the file 
>is
>updated. |
>+|   | |   
>   | This value may also be specified
>as decimal value, i.e., 1.28.
>|
> | `PLATFORM_GUID`   | Required| Registry Format 
> GUID(8-4-4-4-12)
>| The GUID value, along the PLATFORM_VERSION, is used to uniquely identify
>a platform file. It is recommended that minor changes to the file increment
>the PLATFORM_VERSION value, and that the GUID value change for
>completely new platforms.
>|
> | `PLATFORM_VERSION`| Required| Integer or Decimal Number 
>|
>The Version value, along the PLATFORM_GUID, is used to uniquely identify a
>platform file. It is recommended that minor changes to the file increment the
>PLATFORM_VERSION value, and that the GUID value change for completely
>new platforms.
>|
> | `PLATFORM_NAME`   | Required| Single Word   
>| Only
>alphanumeric, dash and underscore character are permitted
>|
> | `SKUID_IDENTIFIER`| Required| Formatted text
>| This
>value may be passed on the command line and must match one of the
>defined names in the [SkuIds] section. If it is passed on the command line, the
>command line value takes precedence.
>|
> | `SUPPORTED_ARCHITECTURES` | Required| List  
>| Pipe
>("") separated list of architectures that the platform
>supports
>|
>diff --git a/2_dsc_overview/README.md b/2_dsc_overview/README.md
>index a8cfa48..0d1b255 100644
>--- a/2_dsc_overview/README.md
>+++ b/2_dsc_overview/README.md
>@@ -1,9 +1,9 @@
> 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] Expression spec: update version to 1.3

2018-04-03 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Zhu, Yonghong
>Sent: Tuesday, April 03, 2018 3:18 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming ; Kinney, Michael D
>; Shaw, Kevin W 
>Subject: [Patch] Expression spec: update version to 1.3
>
>Cc: Liming Gao 
>Cc: Michael Kinney 
>Cc: Kevin W Shaw 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yonghong Zhu 
>---
> README.md | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
>diff --git a/README.md b/README.md
>index 60086a9..ae725ca 100644
>--- a/README.md
>+++ b/README.md
>@@ -1,9 +1,9 @@
> 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] DEC spec: Update version to 1.27

2018-04-03 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Zhu, Yonghong
>Sent: Tuesday, April 03, 2018 3:18 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming ; Kinney, Michael D
>; Shaw, Kevin W 
>Subject: [Patch] DEC spec: Update version to 1.27
>
>Cc: Liming Gao 
>Cc: Michael Kinney 
>Cc: Kevin W Shaw 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yonghong Zhu 
>---
> 2_dec_file_overview/24_[defines]_usage.md|  4 ++--
> 3_edk_ii_dec_file_format/34_[defines]_section.md | 16 
> README.md|  5 -
> 3 files changed, 14 insertions(+), 11 deletions(-)
>
>diff --git a/2_dec_file_overview/24_[defines]_usage.md
>b/2_dec_file_overview/24_[defines]_usage.md
>index fe97c25..c2f50f1 100644
>--- a/2_dec_file_overview/24_[defines]_usage.md
>+++ b/2_dec_file_overview/24_[defines]_usage.md
>@@ -1,9 +1,9 @@
> 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] edk2-VfrSpecification: update version to 1.92

2018-04-03 Thread Gao, Liming
Got it. Reviewed-by: Liming Gao 

>-Original Message-
>From: Zhu, Yonghong
>Sent: Tuesday, April 03, 2018 4:29 PM
>To: Gao, Liming ; edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Shaw, Kevin W
>; Zhu, Yonghong 
>Subject: RE: [Patch] edk2-VfrSpecification: update version to 1.92
>
>Add the 1.92 version info in Revision History.
>
>Best Regards,
>Zhu Yonghong
>
>-Original Message-
>From: Gao, Liming
>Sent: Tuesday, April 3, 2018 4:28 PM
>To: Zhu, Yonghong ; edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Shaw, Kevin W
>
>Subject: RE: [Patch] edk2-VfrSpecification: update version to 1.92
>
>What change is here?
>
>>-Original Message-
>>From: Zhu, Yonghong
>>Sent: Tuesday, April 03, 2018 3:18 PM
>>To: edk2-devel@lists.01.org
>>Cc: Gao, Liming ; Kinney, Michael D
>>; Shaw, Kevin W 
>>Subject: [Patch] edk2-VfrSpecification: update version to 1.92
>>
>>Cc: Liming Gao 
>>Cc: Michael Kinney 
>>Cc: Kevin W Shaw 
>>Contributed-under: TianoCore Contribution Agreement 1.1
>>Signed-off-by: Yonghong Zhu 
>>---
>> README.md | 7 ---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>
>>diff --git a/README.md b/README.md
>>index 0a596eb..3c40cab 100644
>>--- a/README.md
>>+++ b/README.md
>>@@ -1,9 +1,9 @@
>> >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] Build Spec: Update Version to 1.28

2018-04-03 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Zhu, Yonghong
>Sent: Tuesday, April 03, 2018 3:18 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming ; Kinney, Michael D
>; Shaw, Kevin W 
>Subject: [Patch] Build Spec: Update Version to 1.28
>
>Cc: Liming Gao 
>Cc: Michael Kinney 
>Cc: Kevin W Shaw 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yonghong Zhu 
>---
> README.md | 8 +++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
>diff --git a/README.md b/README.md
>index d9d2146..9fb7e93 100644
>--- a/README.md
>+++ b/README.md
>@@ -1,9 +1,9 @@
> 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] edk2-VfrSpecification: update version to 1.92

2018-04-03 Thread Zhu, Yonghong
Add the 1.92 version info in Revision History.

Best Regards,
Zhu Yonghong

-Original Message-
From: Gao, Liming 
Sent: Tuesday, April 3, 2018 4:28 PM
To: Zhu, Yonghong ; edk2-devel@lists.01.org
Cc: Kinney, Michael D ; Shaw, Kevin W 

Subject: RE: [Patch] edk2-VfrSpecification: update version to 1.92

What change is here?

>-Original Message-
>From: Zhu, Yonghong
>Sent: Tuesday, April 03, 2018 3:18 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming ; Kinney, Michael D 
>; Shaw, Kevin W 
>Subject: [Patch] edk2-VfrSpecification: update version to 1.92
>
>Cc: Liming Gao 
>Cc: Michael Kinney 
>Cc: Kevin W Shaw 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yonghong Zhu 
>---
> README.md | 7 ---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
>diff --git a/README.md b/README.md
>index 0a596eb..3c40cab 100644
>--- a/README.md
>+++ b/README.md
>@@ -1,9 +1,9 @@
> 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] edk2-VfrSpecification: update version to 1.92

2018-04-03 Thread Gao, Liming
What change is here?

>-Original Message-
>From: Zhu, Yonghong
>Sent: Tuesday, April 03, 2018 3:18 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming ; Kinney, Michael D
>; Shaw, Kevin W 
>Subject: [Patch] edk2-VfrSpecification: update version to 1.92
>
>Cc: Liming Gao 
>Cc: Michael Kinney 
>Cc: Kevin W Shaw 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yonghong Zhu 
>---
> README.md | 7 ---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
>diff --git a/README.md b/README.md
>index 0a596eb..3c40cab 100644
>--- a/README.md
>+++ b/README.md
>@@ -1,9 +1,9 @@
> 2.6.1.windows.1

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


[edk2] [Patch] edk2-VfrSpecification: update version to 1.92

2018-04-03 Thread Yonghong Zhu
Cc: Liming Gao 
Cc: Michael Kinney 
Cc: Kevin W Shaw 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu 
---
 README.md | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 0a596eb..3c40cab 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
 

[edk2] [Patch] FDF spec: Update version to 1.28

2018-04-03 Thread Yonghong Zhu
Cc: Liming Gao 
Cc: Michael Kinney 
Cc: Kevin W Shaw 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu 
---
 2_fdf_design_discussion/README.md|  4 ++--
 3_edk_ii_fdf_file_format/34_[defines]_section.md | 16 
 README.md|  5 +++--
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/2_fdf_design_discussion/README.md 
b/2_fdf_design_discussion/README.md
index 3202f56..7d87e43 100644
--- a/2_fdf_design_discussion/README.md
+++ b/2_fdf_design_discussion/README.md
@@ -1,9 +1,9 @@
 

[edk2] [Patch] INF spec: Update version to 1.27

2018-04-03 Thread Yonghong Zhu
Cc: Liming Gao 
Cc: Michael Kinney 
Cc: Kevin W Shaw 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu 
---
 2_inf_overview/24_[defines]_section.md   |  8 
 3_edk_ii_inf_file_format/34_[defines]_section.md | 22 +++---
 README.md|  4 +++-
 appendix_d_sample_driver_inf_files.md|  6 +++---
 appendix_e_sample_library_inf_files.md   |  8 
 appendix_f_sample_binary_inf_files.md|  4 ++--
 6 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/2_inf_overview/24_[defines]_section.md 
b/2_inf_overview/24_[defines]_section.md
index 3aab498..37b0135 100644
--- a/2_inf_overview/24_[defines]_section.md
+++ b/2_inf_overview/24_[defines]_section.md
@@ -1,9 +1,9 @@
 

[edk2] [Patch] Expression spec: update version to 1.3

2018-04-03 Thread Yonghong Zhu
Cc: Liming Gao 
Cc: Michael Kinney 
Cc: Kevin W Shaw 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu 
---
 README.md | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 60086a9..ae725ca 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
 

[edk2] [Patch] DSC spec: Update version to 1.28

2018-04-03 Thread Yonghong Zhu
Cc: Liming Gao 
Cc: Michael Kinney 
Cc: Kevin W Shaw 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu 
---
 2_dsc_overview/23_[defines]_section_processing.md |  6 +++---
 2_dsc_overview/README.md  |  4 ++--
 3_edk_ii_dsc_file_format/35_[defines]_section.md  | 10 +-
 README.md |  8 +++-
 SUMMARY.md|  1 +
 appendix_b_sample_edk_ii_dsc_file.md  |  4 ++--
 6 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/2_dsc_overview/23_[defines]_section_processing.md 
b/2_dsc_overview/23_[defines]_section_processing.md
index a7e8680..428196b 100644
--- a/2_dsc_overview/23_[defines]_section_processing.md
+++ b/2_dsc_overview/23_[defines]_section_processing.md
@@ -1,9 +1,9 @@
 

[edk2] [Patch] DEC spec: Update version to 1.27

2018-04-03 Thread Yonghong Zhu
Cc: Liming Gao 
Cc: Michael Kinney 
Cc: Kevin W Shaw 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu 
---
 2_dec_file_overview/24_[defines]_usage.md|  4 ++--
 3_edk_ii_dec_file_format/34_[defines]_section.md | 16 
 README.md|  5 -
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/2_dec_file_overview/24_[defines]_usage.md 
b/2_dec_file_overview/24_[defines]_usage.md
index fe97c25..c2f50f1 100644
--- a/2_dec_file_overview/24_[defines]_usage.md
+++ b/2_dec_file_overview/24_[defines]_usage.md
@@ -1,9 +1,9 @@
 

[edk2] [Patch] Build Spec: Update Version to 1.28

2018-04-03 Thread Yonghong Zhu
Cc: Liming Gao 
Cc: Michael Kinney 
Cc: Kevin W Shaw 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu 
---
 README.md | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index d9d2146..9fb7e93 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
 

Re: [edk2] [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion

2018-04-03 Thread Yao, Jiewen
Right.
I think we only support clear the page attribute, and we don't support the 
cache attribute.
Using OR for RUNTIME is good.

Thank you
Yao Jiewen

> -Original Message-
> From: Zeng, Star
> Sent: Tuesday, April 3, 2018 10:41 AM
> To: Yao, Jiewen ; Wang, Jian J ;
> Kinney, Michael D ; Heyi Guo
> ; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu ; Yi Li ; Gao,
> Liming ; Dong, Eric ; Renhao
> Liang ; Zeng, Star 
> Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion
> 
> Just thought more about the case.
> 
> If a memory range has WB attribute, and code is to set RUNTIME attribute, then
> the WB attribute will be clear in GCD database, it seems wrong. :(
> For this case, need have OR operation ( | RUNTIME) to original attribute in 
> GCD
> database?
> 
> 
> Thanks,
> Star
> -Original Message-
> From: Yao, Jiewen
> Sent: Tuesday, April 3, 2018 10:34 AM
> To: Zeng, Star ; Wang, Jian J ;
> Kinney, Michael D ; Heyi Guo
> ; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu ; Yi Li ; Gao,
> Liming ; Dong, Eric ; Renhao
> Liang 
> Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion
> 
> That is good idea.
> 
> Just add more description as the code comment, please.
> 
> It is easy for code review later.
> 
> Thank you
> Yao Jiewen
> 
> 
> > -Original Message-
> > From: Zeng, Star
> > Sent: Tuesday, April 3, 2018 10:33 AM
> > To: Yao, Jiewen ; Wang, Jian J
> > ; Kinney, Michael D
> > ; Heyi Guo ;
> > edk2-devel@lists.01.org
> > Cc: Ni, Ruiyu ; Yi Li ;
> > Gao, Liming ; Dong, Eric ;
> > Renhao Liang ; Zeng, Star
> > 
> > Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of attribute
> > conversion
> >
> > Agree.
> >
> > And I agree we need the fix at
> > https://lists.01.org/pipermail/edk2-devel/2018-April/023364.html from
> > Mike for compatibility.
> > And I think more precious and precise information need to be added
> > into the commit log or code comments since we have been crazy about
> > handling attributes in the GCD service. :)
> >
> >
> > Thanks,
> > Star
> > -Original Message-
> > From: Yao, Jiewen
> > Sent: Tuesday, April 3, 2018 10:26 AM
> > To: Wang, Jian J ; Zeng, Star
> > ; Kinney, Michael D ;
> > Heyi Guo ; edk2-devel@lists.01.org
> > Cc: Ni, Ruiyu ; Yi Li ;
> > Gao, Liming ; Dong, Eric ;
> > Renhao Liang 
> > Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of attribute
> > conversion
> >
> > I have a discussion with Star/Jian.
> >
> > The expectation for the CPU driver is to handle PageAttribute.
> > The expectation for the platform driver is to use GetAttribute(),
> > AND/OR attribute, then call SetAttribute().
> > Because the DRAM always has a cache attribute (no matter UC or WB), 0
> > should not happen. (0 might happen for a GCD reserved memory, but
> > there is no need to set page attribute)
> >
> > If all drivers use above way, there won't be any issue. There is no
> > need to introduce a new protocol so far.
> >
> > We did encounter some error, because the platform/silicon/CPU code is
> > not updated yet. (For example, the MinnowMax which is using binary)
> > The fix to filter 0 seems a workable way to resolve the compatibility issue.
> >
> > Later, I suggest we update MinnowMax binary - Add paging handling for
> > CPU driver, and use GetAttribute()/SetAttribute() for platform/silicon code.
> >
> >
> > Thank you
> > Yao Jiewen
> >
> > > -Original Message-
> > > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf
> > > Of Wang, Jian J
> > > Sent: Tuesday, April 3, 2018 9:24 AM
> > > To: Zeng, Star ; Kinney, Michael D
> > > ; Heyi Guo ;
> > > edk2-devel@lists.01.org
> > > Cc: Ni, Ruiyu ; Yi Li ;
> > > Gao, Liming ; Dong, Eric
> > > ; Renhao Liang 
> > > Subject: Re: [edk2] [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of
> > > attribute conversion
> > >
> > > The NX Memory Protection and Heap Guard features need to clear
> > > paging attributes.
> > > Allowing 0 attribute is the current