Re: [edk2] [PATCH 2/2] NetworkPkg: Use the New Functions from HttpLib

2016-03-07 Thread Wu, Jiaxin
Reviewed-by: Jiaxin Wu 


> -Original Message-
> From: Ghazi Belaam [mailto:ghazi.bel...@hpe.com]
> Sent: Saturday, March 5, 2016 6:08 AM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng ; Zeng, Star ; Fu,
> Siyuan ; Wu, Jiaxin ; samer.el-
> haj-mahm...@hpe.com; Ghazi Belaam 
> Subject: [PATCH 2/2] NetworkPkg: Use the New Functions from HttpLib
> 
> After submitting changes for HttpLib, other modules should be able to use
> those functions
> 1 remove the private function and their calls
> 2 update it with the functions from httpLib
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ghazi Belaam 
> ---
>  NetworkPkg/HttpBootDxe/HttpBootSupport.c   |  43 +---
>  NetworkPkg/HttpDxe/HttpImpl.c  |   9 +-
>  NetworkPkg/HttpDxe/HttpProto.c | 112 +
>  NetworkPkg/HttpDxe/HttpProto.h |  33 +--
>  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.h |  94 +--
>  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf   |   3 +-
>  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesImpl.c| 279 
> -
>  .../HttpUtilitiesDxe/HttpUtilitiesProtocol.c   |  27 +-
>  8 files changed, 35 insertions(+), 565 deletions(-)  delete mode 100644
> NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesImpl.c
> 
> diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
> b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
> index db2af78..5a22a17 100644
> --- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
> +++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
> @@ -2,8 +2,9 @@
>Support functions implementation for UEFI HTTP boot driver.
> 
>  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved. -This
> program and the accompanying materials are licensed and made available
> under -the terms and conditions of the BSD License that accompanies this
> distribution.
> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP This
> +program and the accompanying materials are licensed and made available
> +under the terms and conditions of the BSD License that accompanies this
> distribution.
>  The full text of the license may be found at
>  http://opensource.org/licenses/bsd-license.php.
> 
> @@ -548,44 +549,10 @@ HttpBootFreeHeader (  }
> 
>  /**
> -  Find a specified header field according to the field name.
> -
> -  @param[in]   HeaderCount  Number of HTTP header structures in
> Headers list.
> -  @param[in]   Headers  Array containing list of HTTP headers.
> -  @param[in]   FieldNameNull terminated string which describes a 
> field
> name.
> -
> -  @returnPointer to the found header or NULL.
> -
> -**/
> -EFI_HTTP_HEADER *
> -HttpBootFindHeader (
> -  IN  UINTNHeaderCount,
> -  IN  EFI_HTTP_HEADER  *Headers,
> -  IN  CHAR8*FieldName
> -  )
> -{
> -  UINTN Index;
> -
> -  if (HeaderCount == 0 || Headers == NULL || FieldName == NULL) {
> -return NULL;
> -  }
> -
> -  for (Index = 0; Index < HeaderCount; Index++){
> -//
> -// Field names are case-insensitive (RFC 2616).
> -//
> -if (AsciiStriCmp (Headers[Index].FieldName, FieldName) == 0) {
> -  return &Headers[Index];
> -}
> -  }
> -  return NULL;
> -}
> -
> -/**
>Set or update a HTTP header with the field name and corresponding value.
> 
>@param[in]  HttpIoHeader   Point to the HTTP header holder.
> -  @param[in]  FieldName  Null terminated string which describes a 
> field
> name.
> +  @param[in]  FieldName  Null terminated string which describes a 
> field
> name.
>@param[in]  FieldValue Null terminated string which describes the
> corresponding field value.
> 
>@retval  EFI_SUCCESS   The HTTP header has been set or updated.
> @@ -609,7 +576,7 @@ HttpBootSetHeader (
>  return EFI_INVALID_PARAMETER;
>}
> 
> -  Header = HttpBootFindHeader (HttpIoHeader->HeaderCount,
> HttpIoHeader->Headers, FieldName);
> +  Header = HttpFindHeader (HttpIoHeader->HeaderCount,
> + HttpIoHeader->Headers, FieldName);
>if (Header == NULL) {
>  //
>  // Add a new header.
> diff --git a/NetworkPkg/HttpDxe/HttpImpl.c
> b/NetworkPkg/HttpDxe/HttpImpl.c index a068cfb..63b683e 100644
> --- a/NetworkPkg/HttpDxe/HttpImpl.c
> +++ b/NetworkPkg/HttpDxe/HttpImpl.c
> @@ -2,7 +2,7 @@
>Implementation of EFI_HTTP_PROTOCOL protocol interfaces.
> 
>Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> -  (C) Copyright 2015 Hewlett Packard Enterprise Development LP
> +  (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
> 
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of the BSD
> License @@ -497,9 +497,10 @@ EfiHttpRequest (
>goto Error3;
>  }
>}
> -  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, FileUrl);
> -  if (RequestStr == NULL) {
> -Status = EFI_OUT_OF_RESOURCES;
> +
> +  Status = HttpGenRequestString

Re: [edk2] [PATCH 1/2] ModulePkg/DxeHttpLib: Adding Functions to HttpLib

2016-03-07 Thread Wu, Jiaxin
Reviewed-by: Jiaxin Wu 


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Ghazi Belaam
> Sent: Saturday, March 5, 2016 6:08 AM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng ; Wu, Jiaxin ; Fu,
> Siyuan ; Zeng, Star 
> Subject: [edk2] [PATCH 1/2] ModulePkg/DxeHttpLib: Adding Functions to
> HttpLib
> 
> There some usefull functions in edk2 private modules that could be used, so
> we added them to the httpLib
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ghazi Belaam 
> ---
>  MdeModulePkg/Include/Library/HttpLib.h | 129 ++
>  MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c   | 595
> ++---
>  MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h   |  89 
>  MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf |   6 +
>  4 files changed, 753 insertions(+), 66 deletions(-)  create mode 100644
> MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h
> 
> diff --git a/MdeModulePkg/Include/Library/HttpLib.h
> b/MdeModulePkg/Include/Library/HttpLib.h
> index cd97b64..af9ab5f 100644
> --- a/MdeModulePkg/Include/Library/HttpLib.h
> +++ b/MdeModulePkg/Include/Library/HttpLib.h
> @@ -3,6 +3,7 @@
>It provides the helper routines to parse the HTTP message byte stream.
> 
>  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  This program and the accompanying materials  are licensed and made
> available under the terms and conditions of the BSD License  which
> accompanies this distribution.  The full text of the license may be found
> at @@ -18,6 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS
> OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> 
>  #include 
> 
> +
>  /**
>Decode a percent-encoded URI component to the ASCII character.
> 
> @@ -343,5 +345,132 @@ HttpFreeMsgParser (
>);
> 
> 
> +/**
> +  Find a specified header field according to the field name.
> +
> +  @param[in]   HeaderCount  Number of HTTP header structures in
> Headers list.
> +  @param[in]   Headers  Array containing list of HTTP headers.
> +  @param[in]   FieldNameNull terminated string which describes a 
> field
> name.
> +
> +  @returnPointer to the found header or NULL.
> +
> +**/
> +EFI_HTTP_HEADER *
> +EFIAPI
> +HttpFindHeader (
> +  IN  UINTNHeaderCount,
> +  IN  EFI_HTTP_HEADER  *Headers,
> +  IN  CHAR8*FieldName
> +  );
> +
> +/**
> +  Set FieldName and FieldValue into specified HttpHeader.
> +
> +  @param[in,out]  HttpHeader  Specified HttpHeader.
> +  @param[in]  FieldName   FieldName of this HttpHeader, a NULL
> terminated ASCII string.
> +  @param[in]  FieldValue  FieldValue of this HttpHeader, a NULL
> terminated ASCII string.
> +
> +
> +  @retval EFI_SUCCESS The FieldName and FieldValue are set into
> HttpHeader successfully.
> +  @retval EFI_OUT_OF_RESOURCESFailed to allocate resources.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +HttpSetFieldNameAndValue (
> +   IN  OUT   EFI_HTTP_HEADER   *HttpHeader,
> +   IN  CONST CHAR8 *FieldName,
> +   IN  CONST CHAR8 *FieldValue
> +  );
> +
> +/**
> +  Get one key/value header pair from the raw string.
> +
> +  @param[in]  String Pointer to the raw string.
> +  @param[out] FieldName  Points directly to field name within
> 'HttpHeader'.
> +  @param[out] FieldValue Points directly to field value within
> 'HttpHeader'.
> +
> +  @return Pointer to the next raw string.
> +  @return NULL if no key/value header pair from this raw string.
> +
> +**/
> +CHAR8 *
> +EFIAPI
> +HttpGetFieldNameAndValue (
> +  IN CHAR8   *String,
> + OUT CHAR8   **FieldName,
> + OUT CHAR8   **FieldValue
> +  );
> +
> +/**
> +  Free existing HeaderFields.
> +
> +  @param[in]  HeaderFields   Pointer to array of key/value header pairs
> waiting for free.
> +  @param[in]  FieldCount The number of header pairs in HeaderFields.
> +
> +**/
> +VOID
> +EFIAPI
> +HttpFreeHeaderFields (
> +  IN  EFI_HTTP_HEADER  *HeaderFields,
> +  IN  UINTNFieldCount
> +  );
> +
> +/**
> +  Generate HTTP request string.
> +
> +  @param[in]   MessagePointer to storage containing HTTP message
> data.
> +  @param[in]   UrlThe URL of a remote host.
> +  @param[out]  RequestString  Pointer to the created HTTP request string.
> +  NULL if any error occured.
> +
> +  @return EFI_SUCCESS If HTTP request string was created
> successfully
> +  @retval EFI_OUT_OF_RESOURCESFailed to allocate resources.
> +  @retval EFI_INVALID_PARAMETER   The input arguments are invalid
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +HttpGenRequestString (
> +  IN CONST EFI_HTTP_MESSAGE*Message,
> +  IN CONST CHAR8   *Url,
> + OUT CHAR8 **RequestString
> +  );
> +
> +

Re: [edk2] [patch] ShellPkg: Merge Ping6 and Ifconfig6 tools to Shell command.

2016-03-07 Thread Wu, Jiaxin
Looks good to me.

Reviewed-by: Jiaxin Wu 


> -Original Message-
> From: Zhang, Lubo
> Sent: Wednesday, March 2, 2016 10:14 AM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben ; Wu, Jiaxin
> ; Ye, Ting ; Fu, Siyuan
> 
> Subject: [patch] ShellPkg: Merge Ping6 and Ifconfig6 tools to Shell command.
> 
> According to the new Shell spec, we add Network2 profile and
> merge Ping6 and Ifconfig6 tools to Shell command.
> 
> Cc: Carsey Jaben 
> Cc: Wu Jiaxin 
> Cc: Ye Ting 
> Cc: Fu Siyuan 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo 
> ---
>  ShellPkg/Include/Guid/ShellLibHiiGuid.h|9 +-
>  .../UefiShellNetwork2CommandsLib/Ifconfig6.c   | 1839
> 
>  .../Library/UefiShellNetwork2CommandsLib/Ping6.c   | 1247
> +
>  .../UefiShellNetwork2CommandsLib.c |   91 +
>  .../UefiShellNetwork2CommandsLib.h |   72 +
>  .../UefiShellNetwork2CommandsLib.inf   |   63 +
>  .../UefiShellNetwork2CommandsLib.uni   |  151 ++
>  ShellPkg/ShellPkg.dec  |4 +-
>  ShellPkg/ShellPkg.dsc  |8 +-
>  9 files changed, 3479 insertions(+), 5 deletions(-)
>  create mode 100644
> ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
>  create mode 100644
> ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c
>  create mode 100644
> ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2Comm
> andsLib.c
>  create mode 100644
> ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2Comm
> andsLib.h
>  create mode 100644
> ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2Comm
> andsLib.inf
>  create mode 100644
> ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2Comm
> andsLib.uni
> 
> diff --git a/ShellPkg/Include/Guid/ShellLibHiiGuid.h
> b/ShellPkg/Include/Guid/ShellLibHiiGuid.h
> index 62c2e72..edbfd7c 100644
> --- a/ShellPkg/Include/Guid/ShellLibHiiGuid.h
> +++ b/ShellPkg/Include/Guid/ShellLibHiiGuid.h
> @@ -1,9 +1,9 @@
>  /** @file
>GUIDs for HII package list installed by Shell libraries.
> 
> -  Copyright (c) 2011, Intel Corporation. All rights reserved.
> +  Copyright (c) 2016, Intel Corporation. All rights reserved.
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of the BSD
> License
>which accompanies this distribution.  The full text of the license may be
> found at
>http://opensource.org/licenses/bsd-license.php
> 
> @@ -52,10 +52,16 @@
> 
>  #define SHELL_NETWORK1_HII_GUID \
>{ \
>  0xf3d301bb, 0xf4a5, 0x45a8, { 0xb0, 0xb7, 0xfa, 0x99, 0x9c, 0x62, 0x37,
> 0xae } \
>}
> +
> +#define SHELL_NETWORK2_HII_GUID \
> +  { \
> +0x174b2b5, 0xf505, 0x4b12, { 0xaa, 0x60, 0x59, 0xdf, 0xf8, 0xd6, 0xea,
> 0x37 } \
> +  }
> +
>  #define SHELL_TFTP_HII_GUID \
>{ \
>  0x738a9314, 0x82c1, 0x4592, { 0x8f, 0xf7, 0xc1, 0xbd, 0xf1, 0xb2, 0x0e,
> 0xd4 } \
>}
> 
> @@ -71,9 +77,10 @@ extern EFI_GUID gShellDriver1HiiGuid;
>  extern EFI_GUID gShellInstall1HiiGuid;
>  extern EFI_GUID gShellLevel1HiiGuid;
>  extern EFI_GUID gShellLevel2HiiGuid;
>  extern EFI_GUID gShellLevel3HiiGuid;
>  extern EFI_GUID gShellNetwork1HiiGuid;
> +extern EFI_GUID gShellNetwork2HiiGuid;
>  extern EFI_GUID gShellTftpHiiGuid;
>  extern EFI_GUID gShellBcfgHiiGuid;
> 
>  #endif
> diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> new file mode 100644
> index 000..b1592e6
> --- /dev/null
> +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> @@ -0,0 +1,1839 @@
> +/** @file
> +  The implementation for Shell command IfConfig6.
> +
> +  Copyright (c) 2016, Intel Corporation. All rights reserved.
> +
> +  This program and the accompanying materials
> +  are licensed and made available under the terms and conditions of the BSD
> License
> +  which accompanies this distribution.  The full text of the license may be
> found at
> +  http://opensource.org/licenses/bsd-license.php.
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +
> +**/
> +#include "UefiShellNetwork2CommandsLib.h"
> +
> +typedef enum {
> +  IfConfig6OpList = 1,
> +  IfConfig6OpSet  = 2,
> +  IfConfig6OpClear= 3
> +};
> +
> +typedef enum {
> +  VarCheckReserved  = -1,
> +  VarCheckOk= 0,
> +  VarCheckDuplicate,
> +  VarCheckConflict,
> +  VarCheckUnknown,
> +  VarCheckLackValue,
> +  VarCheckOutOfMem
> +} VAR_CHECK_CODE;
> +
> +typedef enum {
> +  FlagTypeSingle = 0,
> +  FlagTypeNeedVar,
> +  FlagTypeNeedSet,
> +  FlagTypeSkipUnknown
> +} VAR_CHECK_FLAG_TYPE;
> +
> +#define MACADDRMAXSIZE32
> +#define PREFIXMAXLEN  16
> +
> +typedef struct _IFCONFIG6_INTERFACE_CB {
> +  EFI_HANDLE  

Re: [edk2] [PATCH 3/5] OvmfPkg: add DxePciLibI440FxQ35

2016-03-07 Thread Laszlo Ersek
On 03/07/16 04:51, Jordan Justen wrote:
> On 2016-03-06 06:28:26, Laszlo Ersek wrote:

[snip]

>> So here's what I would like, in decreasing order of preference:
>>
>> * Keep the patch, as is. (Most preferred.)
>>
>> * Keep the library instance under OvmfPkg, but set MODULE_TYPE to
>>   DXE_DRIVER, and/or replace the "I440FxQ35" suffix with "PcieCf8".
>>
>> * Turn the library instance into a core module. Don't restrict it to
>>   DXE and later. Consume a new core PCD, introducing obscure ordering
>>   requirements that are not enforced at build time.
>>
>>   Set this new PCD explicitly in OVMF's PlatformPei, near the current
>>
>> PcdSet16 (PcdOvmfHostBridgePciDevId, mHostBridgeDevId)
>>
>>   call (where we capture the platform type).
>>
> 
> I don't see this as much different than depending on the
> PcdOvmfHostBridgePciDevId.
> 
> I prefer this, or the next option, but it is probably better to push
> out the SKU thing until later. So, I guess I'd prefer this option for
> now. If Mike doesn't think the library makes sense for MdePkg, then
> I'd still like to define it generically enough that it *could* live in
> MdePkg, even if it ends up in OVMF. (I seem to waste a lot of time on
> such pointless things. For example,
> OvmfPkg/Include/Library/PlatformFvbLib.h)
> 
> I guess I'm fine with the library as currently defined. So, if you
> would prefer that I make these changes, then I guess we can move
> forward with what you currently have.

I am not theoretically opposed to option #3 (I *am* opposed to option #4
below -- the SKU thing). So, if you were willing to accept this patch
as-is (option #1), and were willing to refactor it for option #3 later,
I would *greatly* appreciate it. (If the library already existed as
described in option #3, I would simply use it without a second thought.)
It's just my experience that I usually need two or three turns at this
kind of refactoring until I can satisfy your taste with it. Functionally
this library instance is trivial, so I'd prefer to move forward, and
gladly leave the "upstreaming into core" to you, if that works for you.

Thank you
Laszlo

> -Jordan
> 
>> * Turn the library instance into a core module. Don't restrict it to
>>   DXE and later. Consume a new core PCD, introducing obscure ordering
>>   requirements that are not enforced at build time.
>>
>>   Set SKU-dependent DynamicDefaults for this PCD (and maybe other OVMF
>>   PCDs as well) in OVMF's DSC files. Call LibPcdSetSku() in
>>   PlatformPei, instead of the current call to
>>
>> PcdSet16 (PcdOvmfHostBridgePciDevId, mHostBridgeDevId).
>>
>>   (Least preferred.)

[snip]

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


Re: [edk2] [PATCH 2/5] OvmfPkg: PlatformPei: enable PCIEXBAR (aka MMCONFIG / ECAM) on Q35

2016-03-07 Thread Gerd Hoffmann
  Hi,

>   PCI: MMCONFIG at [mem 0xb000-0xbfff] reserved in E820

Ok, I see you mimic seabios behavior here, resulting in a somewhat odd
memory layout (not your fault, of course).

Short history lesson:

Traditional i440fx memory layout (before we did gigabyte alignment) was
memory up to 0xe000, pci io space above that.  Which caused problems
now and then, because it isn't that much address space for pci.

So, when figuring how to do things on q35 I wanted more space.  Decided
to go down to 0xc000, giving additional 512m address space for pci.
But we also have to place the xbar somewhere.  The seabios code to do
pci bar placement is somewhat simple and can deal with a single (32bit)
I/O window only.  Decided to place the xbar @ 0xb000, so seabios has
a single region above 0xc000 for the I/O bars.

So, this is where the traditional q35 memory layout with memory up to
0xafff comes from.  These days it doesn't look that way any more
because we added gigabyte alignment meanwhile, so it's this now:

   low memory  0x -> 0x7fff.  
   free space  0x8000 -> 0xafff,
   mmcfg xbar  0xb000 -> 0xbfff,
   free space  0xc000 -> ioapic-base

i.e. the xbar splits the free space in a somewhat unclever way.

The good news is that xbar location is not fixed.  qemu is supposed to
check now the firmware programmed the q35 host bridge and fill the acpi
tables accordingly, so you should be able to move the xbar to another
location.

I think there are two reasonable choices: Either 0x8000 or
0xe000.

Using 0x8000 maintains a single I/O window. (above 0x9000).
Gives up backward compatibility to really old (pre gigabyte alignment)
q35 machines types.  But we are about to drop support for them in
upstream qemu anyway, so I'll probably switch seabios to do that.

Using 0xe000 still splits the I/O address space into two pieces, but
I don't think the edk2 resource management code has problems dealing
with that.   It places the xbar at the highest possible address, so we
get a big I/O window below the xbar (and a small one above).  The main
advantage over using 0xb000 is that you can better fit big bars
then, for example you can map even a 1G bar (at 0x800).

cheers,
  Gerd

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


Re: [edk2] [PATCH 2/5] OvmfPkg: PlatformPei: enable PCIEXBAR (aka MMCONFIG / ECAM) on Q35

2016-03-07 Thread Laszlo Ersek
Thank you for this message! Some comments below:

On 03/07/16 09:47, Gerd Hoffmann wrote:
>   Hi,
> 
>>   PCI: MMCONFIG at [mem 0xb000-0xbfff] reserved in E820
> 
> Ok, I see you mimic seabios behavior here, resulting in a somewhat odd
> memory layout (not your fault, of course).
> 
> Short history lesson:
> 
> Traditional i440fx memory layout (before we did gigabyte alignment) was
> memory up to 0xe000, pci io space above that.  Which caused problems
> now and then, because it isn't that much address space for pci.
> 
> So, when figuring how to do things on q35 I wanted more space.  Decided
> to go down to 0xc000, giving additional 512m address space for pci.
> But we also have to place the xbar somewhere.  The seabios code to do
> pci bar placement is somewhat simple and can deal with a single (32bit)
> I/O window only.  Decided to place the xbar @ 0xb000, so seabios has
> a single region above 0xc000 for the I/O bars.
> 
> So, this is where the traditional q35 memory layout with memory up to
> 0xafff comes from.  These days it doesn't look that way any more
> because we added gigabyte alignment meanwhile, so it's this now:
> 
>low memory  0x -> 0x7fff.  
>free space  0x8000 -> 0xafff,
>mmcfg xbar  0xb000 -> 0xbfff,
>free space  0xc000 -> ioapic-base
> 
> i.e. the xbar splits the free space in a somewhat unclever way.
> 
> The good news is that xbar location is not fixed.  qemu is supposed to
> check now the firmware programmed the q35 host bridge and fill the acpi
> tables accordingly, so you should be able to move the xbar to another
> location.
> 
> I think there are two reasonable choices: Either 0x8000 or
> 0xe000.
> 
> Using 0x8000 maintains a single I/O window. (above 0x9000).
> Gives up backward compatibility to really old (pre gigabyte alignment)
> q35 machines types.  But we are about to drop support for them in
> upstream qemu anyway, so I'll probably switch seabios to do that.
> 
> Using 0xe000 still splits the I/O address space into two pieces, but
> I don't think the edk2 resource management code has problems dealing
> with that.

The current abstraction we're using with the new core PCI host bridge
driver allows for a single contiguous range as MMIO32 aperture. (And, in
OVMF's case, that range is shared between the root bridges, if there are
several of them -- but I digress.) The point is, we should indeed come
up with the best split.

>   It places the xbar at the highest possible address, so we
> get a big I/O window below the xbar (and a small one above).  The main
> advantage over using 0xb000 is that you can better fit big bars
> then, for example you can map even a 1G bar (at 0x800).

Okay, my vote is 0x8000_ (2GB) then.

I will modify the patch as follows: simultaneously with programming the
exbar at 2GB, I will lower the start of the 32-bit PCI aperture from the
current 3GB (0xC000_) to (2GB+256MB == 0x9000_). Is that alright?

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


Re: [edk2] [PATCH 2/5] OvmfPkg: PlatformPei: enable PCIEXBAR (aka MMCONFIG / ECAM) on Q35

2016-03-07 Thread Gerd Hoffmann
  Hi,

> Okay, my vote is 0x8000_ (2GB) then.
> 
> I will modify the patch as follows: simultaneously with programming the
> exbar at 2GB, I will lower the start of the 32-bit PCI aperture from the
> current 3GB (0xC000_) to (2GB+256MB == 0x9000_). Is that alright?

Yes, that should work fine.

cheers,
  Gerd

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


Re: [edk2] [Patch] MdeModulePkg/Bds: Fix VS2010/VS2012 build failure.

2016-03-07 Thread Wang, Sunny (HPS SW)
Reviewed-by: Sunny Wang 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ruiyu Ni
Sent: Monday, March 07, 2016 1:30 PM
To: edk2-devel@lists.01.org
Cc: Ruiyu Ni; Shumin Qiu
Subject: [edk2] [Patch] MdeModulePkg/Bds: Fix VS2010/VS2012 build failure.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Shumin Qiu 
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 18f835a..4225e80 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1667,6 +1667,8 @@ BmGetFileBufferFromLoadFileFileSystem (
 Handles = NULL;
 HandleCount = 0;
   }
+
+  Handle = NULL;
   for (Index = 0; Index < HandleCount; Index++) {
 Node = DevicePathFromHandle (Handles[Index]);
 Status = gBS->LocateDevicePath (&gEfiLoadFileProtocolGuid, &Node, &Handle);
-- 
2.7.0.windows.1

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


Re: [edk2] [PATCH v3] NetworkPkg: Add URI configuration form to HTTP boot driver.

2016-03-07 Thread Laszlo Ersek
This patch (which is only ~1900 lines in size, including context...)

On 03/04/16 09:38, Fu Siyuan wrote:
> This patch updates the HTTP boot driver to produce a setup page for the boot
> file URI configuration. A new boot option will be created for the manual
> configured URI address. This change is made to support the HTTP boot usage
> in home environment.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Fu Siyuan 
> Cc: Wu Jiaxin 
> Cc: Ye Ting 
> ---
>  NetworkPkg/HttpBootDxe/HttpBootClient.c|  99 +--
>  NetworkPkg/HttpBootDxe/HttpBootConfig.c| 723 
> +
>  NetworkPkg/HttpBootDxe/HttpBootConfig.h|  78 +++
>  NetworkPkg/HttpBootDxe/HttpBootConfigNVDataStruc.h |  43 ++
>  NetworkPkg/HttpBootDxe/HttpBootConfigStrings.uni   | Bin 0 -> 2926 bytes
>  NetworkPkg/HttpBootDxe/HttpBootConfigVfr.vfr   |  53 ++
>  NetworkPkg/HttpBootDxe/HttpBootDhcp4.c | 111 +++-
>  NetworkPkg/HttpBootDxe/HttpBootDhcp4.h |   9 +-
>  NetworkPkg/HttpBootDxe/HttpBootDhcp6.c |   6 +-
>  NetworkPkg/HttpBootDxe/HttpBootDxe.c   |  44 +-
>  NetworkPkg/HttpBootDxe/HttpBootDxe.h   |  33 +-
>  NetworkPkg/HttpBootDxe/HttpBootDxe.inf |  17 +-
>  NetworkPkg/HttpBootDxe/HttpBootImpl.c  |  71 +-
>  NetworkPkg/HttpBootDxe/HttpBootSupport.c   |  63 ++
>  NetworkPkg/HttpBootDxe/HttpBootSupport.h   |  18 +
>  NetworkPkg/Include/Guid/HttpBootConfigHii.h|  25 +
>  NetworkPkg/NetworkPkg.dec  |   5 +-
>  17 files changed, 1288 insertions(+), 110 deletions(-)
>  create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfig.c
>  create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfig.h
>  create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfigNVDataStruc.h
>  create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfigStrings.uni
>  create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfigVfr.vfr
>  create mode 100644 NetworkPkg/Include/Guid/HttpBootConfigHii.h

breaks the gcc build here:

> +  //
> +  // Get current "BootOrder" variable and find a free target.
> +  //
> +  Length = 0;
> +  Status = GetVariable2 (
> + L"BootOrder",
> + &gEfiGlobalVariableGuid,
> + &CurrentOrder,
> + &Length 
> + );

with the following error message:


NetworkPkg/HttpBootDxe/HttpBootConfig.c: In function
'HttpBootAddBootOption':
NetworkPkg/HttpBootDxe/HttpBootConfig.c:148:14: error: passing argument
3 of 'GetVariable2' from incompatible pointer type [-Werror]
  );
  ^
In file included from NetworkPkg/HttpBootDxe/HttpBootDxe.h:31:0,
 from NetworkPkg/HttpBootDxe/HttpBootConfig.c:15:
MdePkg/Include/Library/UefiLib.h:708:1: note: expected 'void **' but
argument is of type 'CHAR16 **'
 GetVariable2 (
 ^
cc1: all warnings being treated as errors


First, the BootOrder variable is not composed of CHAR16 elements (it is
not a UCS-2 string); it is composed of UINT16 elements. From the UEFI spec:

The BootOrder variable contains an array of UINT16’s that make up
an ordered list of the Boot options.

Second, can we please figure out a way for Windows using developers to
build edk2 with at least one version of gcc? These build failures are
*incredibly* annoying. The build breaks, someone submits a patch, the
reviewer lives on the other side of the planet, a day passes, review is
in, another day passes, the submitter commits it, okay, it builds again
now. Terrible.

I would absolutely test-build my edk2 patches with a VS release if one
was available to me at no cost. I could run it in a virtual machine. I
don't do it because I can't justify the $$$ to mgmt just for this. But
gcc binaries are available to Windows people at zero cost, and gcc's use
on Windows has been repeatedly discussed on this list. I find this state
desperate.

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


[edk2] [PATCH] NetworkPkg: HttpBootDxe: fix gcc build failure

2016-03-07 Thread Laszlo Ersek
Commit fa848a404894 ("NetworkPkg: Add URI configuration form to HTTP boot
driver") causes the build to fail with gcc:

> NetworkPkg/HttpBootDxe/HttpBootConfig.c: In function
>  'HttpBootAddBootOption':
> NetworkPkg/HttpBootDxe/HttpBootConfig.c:148:14:
> error: passing argument 3 of 'GetVariable2' from incompatible pointer
>type [-Werror]
>   );
>   ^
> In file included from NetworkPkg/HttpBootDxe/HttpBootDxe.h:31:0,
>  from NetworkPkg/HttpBootDxe/HttpBootConfig.c:15:
> MdePkg/Include/Library/UefiLib.h:708:1: note: expected 'void **' but
> argument is of type 'CHAR16 **'
>  GetVariable2 (
>  ^
> cc1: all warnings being treated as errors

Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 NetworkPkg/HttpBootDxe/HttpBootConfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootConfig.c 
b/NetworkPkg/HttpBootDxe/HttpBootConfig.c
index db14da06d5cb..597192349d6b 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootConfig.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootConfig.c
@@ -143,7 +143,7 @@ HttpBootAddBootOption (
   Status = GetVariable2 (
  L"BootOrder",
  &gEfiGlobalVariableGuid,
- &CurrentOrder,
+ (VOID **)&CurrentOrder,
  &Length 
  );
   if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) {
-- 
1.8.3.1

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


Re: [edk2] [PATCH v3] NetworkPkg: Add URI configuration form to HTTP boot driver.

2016-03-07 Thread Gao, Liming
Laszlo:
  I have used GCC windows binary tools in my daily work. It is very helpful for 
the windows user. GCC Windows binary can be got from 
http://sourceforge.net/projects/edk2developertoolsforwindows/files/Tool%20Chain%20Binaries/x86.
 I would suggest we add wiki in GitHub to let user know how to set up GCC 
windows build environment.

Thanks
Liming
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo 
Ersek
Sent: Monday, March 7, 2016 6:41 PM
To: Fu, Siyuan ; edk2-de...@ml01.01.org
Cc: Ye, Ting ; Wu, Jiaxin 
Subject: Re: [edk2] [PATCH v3] NetworkPkg: Add URI configuration form to HTTP 
boot driver.

This patch (which is only ~1900 lines in size, including context...)

On 03/04/16 09:38, Fu Siyuan wrote:
> This patch updates the HTTP boot driver to produce a setup page for the boot
> file URI configuration. A new boot option will be created for the manual
> configured URI address. This change is made to support the HTTP boot usage
> in home environment.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Fu Siyuan
> Cc: Wu Jiaxin
> Cc: Ye Ting
> ---
> NetworkPkg/HttpBootDxe/HttpBootClient.c | 99 +--
> NetworkPkg/HttpBootDxe/HttpBootConfig.c | 723 +
> NetworkPkg/HttpBootDxe/HttpBootConfig.h | 78 +++
> NetworkPkg/HttpBootDxe/HttpBootConfigNVDataStruc.h | 43 ++
> NetworkPkg/HttpBootDxe/HttpBootConfigStrings.uni | Bin 0 -> 2926 bytes
> NetworkPkg/HttpBootDxe/HttpBootConfigVfr.vfr | 53 ++
> NetworkPkg/HttpBootDxe/HttpBootDhcp4.c | 111 +++-
> NetworkPkg/HttpBootDxe/HttpBootDhcp4.h | 9 +-
> NetworkPkg/HttpBootDxe/HttpBootDhcp6.c | 6 +-
> NetworkPkg/HttpBootDxe/HttpBootDxe.c | 44 +-
> NetworkPkg/HttpBootDxe/HttpBootDxe.h | 33 +-
> NetworkPkg/HttpBootDxe/HttpBootDxe.inf | 17 +-
> NetworkPkg/HttpBootDxe/HttpBootImpl.c | 71 +-
> NetworkPkg/HttpBootDxe/HttpBootSupport.c | 63 ++
> NetworkPkg/HttpBootDxe/HttpBootSupport.h | 18 +
> NetworkPkg/Include/Guid/HttpBootConfigHii.h | 25 +
> NetworkPkg/NetworkPkg.dec | 5 +-
> 17 files changed, 1288 insertions(+), 110 deletions(-)
> create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfig.c
> create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfig.h
> create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfigNVDataStruc.h
> create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfigStrings.uni
> create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfigVfr.vfr
> create mode 100644 NetworkPkg/Include/Guid/HttpBootConfigHii.h

breaks the gcc build here:

> + //
> + // Get current "BootOrder" variable and find a free target.
> + //
> + Length = 0;
> + Status = GetVariable2 (
> + L"BootOrder",
> + &gEfiGlobalVariableGuid,
> + &CurrentOrder,
> + &Length
> + );

with the following error message:


NetworkPkg/HttpBootDxe/HttpBootConfig.c: In function
'HttpBootAddBootOption':
NetworkPkg/HttpBootDxe/HttpBootConfig.c:148:14: error: passing argument
3 of 'GetVariable2' from incompatible pointer type [-Werror]
);
^
In file included from NetworkPkg/HttpBootDxe/HttpBootDxe.h:31:0,
from NetworkPkg/HttpBootDxe/HttpBootConfig.c:15:
MdePkg/Include/Library/UefiLib.h:708:1: note: expected 'void **' but
argument is of type 'CHAR16 **'
GetVariable2 (
^
cc1: all warnings being treated as errors


First, the BootOrder variable is not composed of CHAR16 elements (it is
not a UCS-2 string); it is composed of UINT16 elements. From the UEFI spec:

The BootOrder variable contains an array of UINT16's that make up
an ordered list of the Boot options.

Second, can we please figure out a way for Windows using developers to
build edk2 with at least one version of gcc? These build failures are
*incredibly* annoying. The build breaks, someone submits a patch, the
reviewer lives on the other side of the planet, a day passes, review is
in, another day passes, the submitter commits it, okay, it builds again
now. Terrible.

I would absolutely test-build my edk2 patches with a VS release if one
was available to me at no cost. I could run it in a virtual machine. I
don't do it because I can't justify the $$$ to mgmt just for this. But
gcc binaries are available to Windows people at zero cost, and gcc's use
on Windows has been repeatedly discussed on this list. I find this state
desperate.

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] [PATCH 1/2] ModulePkg/DxeHttpLib: Adding Functions to HttpLib

2016-03-07 Thread El-Haj-Mahmoud, Samer
Reviewed-by: Samer EL-Haj-Mahmoud 


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Ghazi Belaam
> Sent: Saturday, March 5, 2016 6:08 AM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng ; Wu, Jiaxin 
> ; Fu, Siyuan ; Zeng, Star 
> 
> Subject: [edk2] [PATCH 1/2] ModulePkg/DxeHttpLib: Adding Functions to 
> HttpLib
> 
> There some usefull functions in edk2 private modules that could be 
> used, so we added them to the httpLib
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ghazi Belaam 
> ---
>  MdeModulePkg/Include/Library/HttpLib.h | 129 ++
>  MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c   | 595
> ++---
>  MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h   |  89 
>  MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf |   6 +
>  4 files changed, 753 insertions(+), 66 deletions(-)  create mode 
> 100644 MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h
> 
> diff --git a/MdeModulePkg/Include/Library/HttpLib.h
> b/MdeModulePkg/Include/Library/HttpLib.h
> index cd97b64..af9ab5f 100644
> --- a/MdeModulePkg/Include/Library/HttpLib.h
> +++ b/MdeModulePkg/Include/Library/HttpLib.h
> @@ -3,6 +3,7 @@
>It provides the helper routines to parse the HTTP message byte stream.
> 
>  Copyright (c) 2015 - 2016, Intel Corporation. All rights 
> reserved.
> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  This program and the accompanying materials  are licensed and made 
> available under the terms and conditions of the BSD License  which 
> accompanies this distribution.  The full text of the license may be 
> found at @@ -18,6 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS 
> OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> 
>  #include 
> 
> +
>  /**
>Decode a percent-encoded URI component to the ASCII character.
> 
> @@ -343,5 +345,132 @@ HttpFreeMsgParser (
>);
> 
> 
> +/**
> +  Find a specified header field according to the field name.
> +
> +  @param[in]   HeaderCount  Number of HTTP header structures in
> Headers list.
> +  @param[in]   Headers  Array containing list of HTTP headers.
> +  @param[in]   FieldNameNull terminated string which describes a 
> field
> name.
> +
> +  @returnPointer to the found header or NULL.
> +
> +**/
> +EFI_HTTP_HEADER *
> +EFIAPI
> +HttpFindHeader (
> +  IN  UINTNHeaderCount,
> +  IN  EFI_HTTP_HEADER  *Headers,
> +  IN  CHAR8*FieldName
> +  );
> +
> +/**
> +  Set FieldName and FieldValue into specified HttpHeader.
> +
> +  @param[in,out]  HttpHeader  Specified HttpHeader.
> +  @param[in]  FieldName   FieldName of this HttpHeader, a NULL
> terminated ASCII string.
> +  @param[in]  FieldValue  FieldValue of this HttpHeader, a NULL
> terminated ASCII string.
> +
> +
> +  @retval EFI_SUCCESS The FieldName and FieldValue are set into
> HttpHeader successfully.
> +  @retval EFI_OUT_OF_RESOURCESFailed to allocate resources.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +HttpSetFieldNameAndValue (
> +   IN  OUT   EFI_HTTP_HEADER   *HttpHeader,
> +   IN  CONST CHAR8 *FieldName,
> +   IN  CONST CHAR8 *FieldValue
> +  );
> +
> +/**
> +  Get one key/value header pair from the raw string.
> +
> +  @param[in]  String Pointer to the raw string.
> +  @param[out] FieldName  Points directly to field name within
> 'HttpHeader'.
> +  @param[out] FieldValue Points directly to field value within
> 'HttpHeader'.
> +
> +  @return Pointer to the next raw string.
> +  @return NULL if no key/value header pair from this raw string.
> +
> +**/
> +CHAR8 *
> +EFIAPI
> +HttpGetFieldNameAndValue (
> +  IN CHAR8   *String,
> + OUT CHAR8   **FieldName,
> + OUT CHAR8   **FieldValue
> +  );
> +
> +/**
> +  Free existing HeaderFields.
> +
> +  @param[in]  HeaderFields   Pointer to array of key/value header pairs
> waiting for free.
> +  @param[in]  FieldCount The number of header pairs in HeaderFields.
> +
> +**/
> +VOID
> +EFIAPI
> +HttpFreeHeaderFields (
> +  IN  EFI_HTTP_HEADER  *HeaderFields,
> +  IN  UINTNFieldCount
> +  );
> +
> +/**
> +  Generate HTTP request string.
> +
> +  @param[in]   MessagePointer to storage containing HTTP message
> data.
> +  @param[in]   UrlThe URL of a remote host.
> +  @param[out]  RequestString  Pointer to the created HTTP request string.
> +  NULL if any error occured.
> +
> +  @return EFI_SUCCESS If HTTP request string was created 
> successfully
> +  @retval EFI_OUT_OF_RESOURCESFailed to allocate resources.
> +  @retval EFI_INVALID_PARAMETER   The input arguments are invalid
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +HttpGenRequestString (
> +  IN CONST EFI_HTTP_MESSAGE*Message,
> +  IN CONST CHAR8   *Url,
> + OUT CHAR8 **Re

Re: [edk2] [PATCH 2/2] NetworkPkg: Use the New Functions from HttpLib

2016-03-07 Thread El-Haj-Mahmoud, Samer
Reviewed-by: Samer EL-Haj-Mahmoud 

-Original Message-
From: Belaam, Ghazi 
Sent: Friday, March 4, 2016 4:08 PM
To: edk2-devel@lists.01.org
Cc: feng.t...@intel.com; star.z...@intel.com; siyuan...@intel.com; 
jiaxin...@intel.com; El-Haj-Mahmoud, Samer ; 
Belaam, Ghazi 
Subject: [PATCH 2/2] NetworkPkg: Use the New Functions from HttpLib

After submitting changes for HttpLib, other modules should be able to use those 
functions
1 remove the private function and their calls
2 update it with the functions from httpLib

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ghazi Belaam 
---
 NetworkPkg/HttpBootDxe/HttpBootSupport.c   |  43 +---
 NetworkPkg/HttpDxe/HttpImpl.c  |   9 +-
 NetworkPkg/HttpDxe/HttpProto.c | 112 +
 NetworkPkg/HttpDxe/HttpProto.h |  33 +--
 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.h |  94 +--
 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf   |   3 +-
 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesImpl.c| 279 -
 .../HttpUtilitiesDxe/HttpUtilitiesProtocol.c   |  27 +-
 8 files changed, 35 insertions(+), 565 deletions(-)  delete mode 100644 
NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesImpl.c

diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
index db2af78..5a22a17 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
@@ -2,8 +2,9 @@
   Support functions implementation for UEFI HTTP boot driver.
 
 Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved. -This 
program and the accompanying materials are licensed and made available under 
-the terms and conditions of the BSD License that accompanies this 
distribution.  
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP This 
+program and the accompanying materials are licensed and made available 
+under the terms and conditions of the BSD License that accompanies this 
distribution.
 The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php.
  
 
@@ -548,44 +549,10 @@ HttpBootFreeHeader (  }
 
 /**
-  Find a specified header field according to the field name.
-
-  @param[in]   HeaderCount  Number of HTTP header structures in Headers 
list. 
-  @param[in]   Headers  Array containing list of HTTP headers.
-  @param[in]   FieldNameNull terminated string which describes a field 
name. 
-
-  @returnPointer to the found header or NULL.
-
-**/
-EFI_HTTP_HEADER *
-HttpBootFindHeader (
-  IN  UINTNHeaderCount,
-  IN  EFI_HTTP_HEADER  *Headers,
-  IN  CHAR8*FieldName
-  )
-{
-  UINTN Index;
-
-  if (HeaderCount == 0 || Headers == NULL || FieldName == NULL) {
-return NULL;
-  }
-
-  for (Index = 0; Index < HeaderCount; Index++){
-//
-// Field names are case-insensitive (RFC 2616).
-//
-if (AsciiStriCmp (Headers[Index].FieldName, FieldName) == 0) {
-  return &Headers[Index];
-}
-  }
-  return NULL;
-}
-
-/**
   Set or update a HTTP header with the field name and corresponding value.
 
   @param[in]  HttpIoHeader   Point to the HTTP header holder.
-  @param[in]  FieldName  Null terminated string which describes a 
field name. 
+  @param[in]  FieldName  Null terminated string which describes a 
field name.
   @param[in]  FieldValue Null terminated string which describes the 
corresponding field value.
 
   @retval  EFI_SUCCESS   The HTTP header has been set or updated.
@@ -609,7 +576,7 @@ HttpBootSetHeader (
 return EFI_INVALID_PARAMETER;
   }
 
-  Header = HttpBootFindHeader (HttpIoHeader->HeaderCount, 
HttpIoHeader->Headers, FieldName);
+  Header = HttpFindHeader (HttpIoHeader->HeaderCount, 
+ HttpIoHeader->Headers, FieldName);
   if (Header == NULL) {
 //
 // Add a new header.
diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c 
index a068cfb..63b683e 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -2,7 +2,7 @@
   Implementation of EFI_HTTP_PROTOCOL protocol interfaces.
 
   Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
-  (C) Copyright 2015 Hewlett Packard Enterprise Development LP
+  (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License @@ -497,9 +497,10 @@ EfiHttpRequest (
   goto Error3;
 }
   }
-  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, FileUrl);
-  if (RequestStr == NULL) {
-Status = EFI_OUT_OF_RESOURCES;
+
+  Status = HttpGenRequestString (HttpMsg, FileUrl, &RequestStr);
+
+  if (EFI_ERROR (Status)) {
 goto Error3;
   }
 
diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c 
index 579b9e4..d78

Re: [edk2] [PATCH v2] MdeModulePkg: Change the type of PcdMaxPeiPerformanceLogEntries to UINT16

2016-03-07 Thread El-Haj-Mahmoud, Samer
Reviewed-by: Samer EL-Haj-Mahmoud 


-Original Message-
From: Shia, Cinnamon 
Sent: Monday, March 7, 2016 1:57 AM
To: edk2-devel@lists.01.org
Cc: El-Haj-Mahmoud, Samer ; Shia, Cinnamon 

Subject: [PATCH v2] MdeModulePkg: Change the type of 
PcdMaxPeiPerformanceLogEntries to UINT16

Change the type of PcdMaxPeiPerformanceLogEntries from UINT8 to UINT16 to log 
more than 255 performance entries in PEI.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia 
---
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.c|  5 -
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.inf  |  2 ++
 .../Library/PeiPerformanceLib/PeiPerformanceLib.c| 20 +++-
 .../Library/PeiPerformanceLib/PeiPerformanceLib.inf  |  2 ++
 MdeModulePkg/MdeModulePkg.dec|  9 +
 5 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 0eb8e57..bbad2e9 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -11,6 +11,7 @@
   Performance Protocol is installed at the very beginning of DXE phase.
 
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -522,7 +523,9 @@ 
DxeCorePerformanceLibConstructor (
   );
   ASSERT_EFI_ERROR (Status);
 
-  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8 
(PcdMaxPeiPerformanceLogEntries);
+  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + (UINT16) (PcdGet8 
(PcdMaxPeiPerformanceLogEntries) != 0 ?
+ PcdGet8 
(PcdMaxPeiPerformanceLogEntries) != 0 :
+ PcdGet16 
+ (PcdMaxPeiPerformanceLogEntriesMoreThan255));
 
   mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof 
(GAUGE_DATA_ENTRY_EX) * mMaxGaugeRecords));
   ASSERT (mGaugeData != NULL);
diff --git 
a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
index 5f29063..8cecdd2 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.i
+++ nf
@@ -10,6 +10,7 @@
 #  Performance and PerformanceEx Protocol are installed at the very beginning 
of DXE phase.
 #
 #  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #  This program and the accompanying materials  #  are licensed and made 
available under the terms and conditions of the BSD License  #  which 
accompanies this distribution.  The full text of the license may be found at @@ 
-67,4 +68,5 @@
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries ## CONSUMES
+  
+ gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntriesMoreThan2
+ 55 ## CONSUMES
   gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask## CONSUMES
diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c 
b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
index 9674bbc..0f90ca8 100644
--- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
+++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
@@ -4,10 +4,11 @@
   This file implements all APIs in Performance Library class in MdePkg. It 
creates
   performance logging GUIDed HOB on the first performance logging and then 
logs the
   performance data to the GUIDed HOB. Due to the limitation of temporary RAM, 
the maximum
-  number of performance logging entry is specified by 
PcdMaxPeiPerformanceLogEntries.  
+  number of performance logging entry is specified by 
+ PcdMaxPeiPerformanceLogEntries or
+  PcdMaxPeiPerformanceLogEntriesMoreThan255
 
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP
+(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -51,10 +52,14 @@ 
InternalGetPerformanceHobLog (  {
   EFI_HOB_GUID_TYPE   *GuidHob;
   UINTN   PeiPerformanceSize;
+  UINT16  PeiPerformanceLogEntries;
 
   ASSERT (PeiPerformanceLog != NULL);
   ASSERT (PeiPerformanceIdArray != NULL);
 
+  PeiPerformanceLogEntries = (UINT16) (PcdGet8 
(Pc

Re: [edk2] [PATCH v2 1/2] PerformancePkg/Dp_App: Support execution break

2016-03-07 Thread El-Haj-Mahmoud, Samer
Series Reviewed-by: Samer EL-Haj-Mahmoud 

On 2016/3/7 11:23, Cinnamon Shia wrote:
> Support UEFI shell execution break.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Cinnamon Shia 
> ---
>   PerformancePkg/Dp_App/Dp.c | 36 --
>   PerformancePkg/Dp_App/DpInternal.h | 27 -
>   PerformancePkg/Dp_App/DpTrace.c| 62 
> --
>   3 files changed, 99 insertions(+), 26 deletions(-)
>
> diff --git a/PerformancePkg/Dp_App/Dp.c b/PerformancePkg/Dp_App/Dp.c 
> index e052216..e36a032 100644
> --- a/PerformancePkg/Dp_App/Dp.c
> +++ b/PerformancePkg/Dp_App/Dp.c
> @@ -14,7 +14,7 @@
> timer information to calculate elapsed time for each measurement.
>
> Copyright (c) 2009 - 2015, Intel Corporation. All rights 
> reserved.
> -  (C) Copyright 2015 Hewlett Packard Enterprise Development LP
> +  (C) Copyright 2015-2016 Hewlett Packard Enterprise Development 
> + LP
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD 
> License
> which accompanies this distribution.  The full text of the license 
> may be found at @@ -195,11 +195,11 @@ InitCumulativeData (
>
> @param[in]  ImageHandle The image handle.
> @param[in]  SystemTable The system table.
> -
> +
> @retval EFI_SUCCESSCommand completed successfully.
> @retval EFI_INVALID_PARAMETER  Command usage error.
> +  @retval EFI_ABORTEDThe user aborts the operation.
> @retval value  Unknown error.
> -
>   **/
>   EFI_STATUS
>   EFIAPI
> @@ -443,7 +443,10 @@ InitializeDp (
>   ProcessCumulative (CustomCumulativeData);
> } else if (AllMode) {
>   if (TraceMode) {
> -  DumpAllTrace( Number2Display, ExcludeMode);
> +  Status = DumpAllTrace( Number2Display, ExcludeMode);
> +  if (Status == EFI_ABORTED) {
> +goto Done;
> +  }
>   }
>   if (ProfileMode) {
> DumpAllProfile( Number2Display, ExcludeMode); @@ -451,7 
> +454,10 @@ InitializeDp (
> }
> else if (RawMode) {
>   if (TraceMode) {
> -  DumpRawTrace( Number2Display, ExcludeMode);
> +  Status = DumpRawTrace( Number2Display, ExcludeMode);
> +  if (Status == EFI_ABORTED) {
> +goto Done;
> +  }
>   }
>   if (ProfileMode) {
> DumpRawProfile( Number2Display, ExcludeMode); @@ -463,11 
> +469,21 @@ InitializeDp (
> ProcessPhases ( Ticker );
> if ( ! SummaryMode) {
>   Status = ProcessHandles ( ExcludeMode);
> -if ( ! EFI_ERROR( Status)) {
> -  ProcessPeims ( );
> -  ProcessGlobal ();
> -  ProcessCumulative (NULL);
> +if (Status == EFI_ABORTED) {
> +  goto Done;
>   }
> +
> +Status = ProcessPeims ();
> +if (Status == EFI_ABORTED) {
> +  goto Done;
> +}
> +
> +Status = ProcessGlobal ();
> +if (Status == EFI_ABORTED) {
> +  goto Done;
> +}
> +
> +ProcessCumulative (NULL);
> }
>   }
>   if (ProfileMode) {
> @@ -480,6 +496,8 @@ InitializeDp (
>   }
> }
>
> +Done:
> +
> //
> // Free the memory allocate from HiiGetString
> //
> diff --git a/PerformancePkg/Dp_App/DpInternal.h 
> b/PerformancePkg/Dp_App/DpInternal.h
> index 0e97e1e..53c5fb2 100644
> --- a/PerformancePkg/Dp_App/DpInternal.h
> +++ b/PerformancePkg/Dp_App/DpInternal.h
> @@ -7,7 +7,7 @@
> DpUtilities.c, DpTrace.c, and DpProfile.c are included here.
>
> Copyright (c) 2009 - 2014, Intel Corporation. All rights 
> reserved.
> -  (C) Copyright 2015 Hewlett Packard Enterprise Development LP
> +  (C) Copyright 2015-2016 Hewlett Packard Enterprise Development 
> + LP
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD 
> License
> which accompanies this distribution.  The full text of the license 
> may be found at @@ -215,8 +215,11 @@ GatherStatistics(
> @param[in]Limit   The number of records to print.  Zero is ALL.
> @param[in]ExcludeFlag TRUE to exclude individual Cumulative items 
> from display.
>
> +  @retval EFI_SUCCESS   The operation was successful.
> +  @retval EFI_ABORTED   The user aborts the operation.
> +  @return Othersfrom a call to gBS->LocateHandleBuffer().
>   **/
> -VOID
> +EFI_STATUS
>   DumpAllTrace(
> IN UINTN Limit,
> IN BOOLEAN   ExcludeFlag
> @@ -238,9 +241,11 @@ DumpAllTrace(
>
> @param[in]Limit   The number of records to print.  Zero is ALL.
> @param[in]ExcludeFlag TRUE to exclude individual Cumulative items 
> from display.
> -
> +
> +  @retval EFI

Re: [edk2] [GIT PULL] CryptoPkg/OpensslLib: Fix CRLF breakage in process_files.sh

2016-03-07 Thread David Woodhouse
On Sat, 2016-03-05 at 20:05 +0100, Ard Biesheuvel wrote:
> On 5 March 2016 at 17:54, David Woodhouse  wrote:
> > Please PULL this commit from:
> >
> > git://git.infradead.org/users/dwmw2/edk2.git fix-crlf-crap
> >
> 
> Fetched and pushed, thanks!

Thanks, Ard.

-- 
dwmw2



smime.p7s
Description: S/MIME cryptographic signature
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v3] NetworkPkg: Add URI configuration form to HTTP boot driver.

2016-03-07 Thread Laszlo Ersek
On 03/07/16 13:39, Gao, Liming wrote:
> Laszlo:
> 
>   I have used GCC windows binary tools in my daily work. It is very
> helpful for the windows user. GCC Windows binary can be got from
> http://sourceforge.net/projects/edk2developertoolsforwindows/files/Tool%20Chain%20Binaries/x86.
> I would suggest we add wiki in GitHub to let user know how to set up GCC
> windows build environment.

Wow, that's great! Jordan, what do you suggest for article title /
location? Liming, do you feel like writing up the installation instructions?

Thanks!
Laszlo

> 
>  
> 
> Thanks
> 
> Liming
> 
> *From:*edk2-devel [mailto:edk2-devel-boun...@lists.01.org] *On Behalf Of
> *Laszlo Ersek
> *Sent:* Monday, March 7, 2016 6:41 PM
> *To:* Fu, Siyuan ; edk2-de...@ml01.01.org
> *Cc:* Ye, Ting ; Wu, Jiaxin 
> *Subject:* Re: [edk2] [PATCH v3] NetworkPkg: Add URI configuration form
> to HTTP boot driver.
> 
>  
> 
> This patch (which is only ~1900 lines in size, including context...)
> 
> On 03/04/16 09:38, Fu Siyuan wrote:
>> This patch updates the HTTP boot driver to produce a setup page for the boot
>> file URI configuration. A new boot option will be created for the manual
>> configured URI address. This change is made to support the HTTP boot usage
>> in home environment.
>> 
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Fu Siyuan 
>> Cc: Wu Jiaxin 
>> Cc: Ye Ting 
>> ---
>> NetworkPkg/HttpBootDxe/HttpBootClient.c | 99 +--
>> NetworkPkg/HttpBootDxe/HttpBootConfig.c | 723 +
>> NetworkPkg/HttpBootDxe/HttpBootConfig.h | 78 +++
>> NetworkPkg/HttpBootDxe/HttpBootConfigNVDataStruc.h | 43 ++
>> NetworkPkg/HttpBootDxe/HttpBootConfigStrings.uni | Bin 0 -> 2926 bytes
>> NetworkPkg/HttpBootDxe/HttpBootConfigVfr.vfr | 53 ++
>> NetworkPkg/HttpBootDxe/HttpBootDhcp4.c | 111 +++-
>> NetworkPkg/HttpBootDxe/HttpBootDhcp4.h | 9 +-
>> NetworkPkg/HttpBootDxe/HttpBootDhcp6.c | 6 +-
>> NetworkPkg/HttpBootDxe/HttpBootDxe.c | 44 +-
>> NetworkPkg/HttpBootDxe/HttpBootDxe.h | 33 +-
>> NetworkPkg/HttpBootDxe/HttpBootDxe.inf | 17 +-
>> NetworkPkg/HttpBootDxe/HttpBootImpl.c | 71 +-
>> NetworkPkg/HttpBootDxe/HttpBootSupport.c | 63 ++
>> NetworkPkg/HttpBootDxe/HttpBootSupport.h | 18 +
>> NetworkPkg/Include/Guid/HttpBootConfigHii.h | 25 +
>> NetworkPkg/NetworkPkg.dec | 5 +-
>> 17 files changed, 1288 insertions(+), 110 deletions(-)
>> create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfig.c
>> create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfig.h
>> create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfigNVDataStruc.h
>> create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfigStrings.uni
>> create mode 100644 NetworkPkg/HttpBootDxe/HttpBootConfigVfr.vfr
>> create mode 100644 NetworkPkg/Include/Guid/HttpBootConfigHii.h
> 
> breaks the gcc build here:
> 
>> + //
>> + // Get current "BootOrder" variable and find a free target.
>> + //
>> + Length = 0;
>> + Status = GetVariable2 (
>> + L"BootOrder",
>> + &gEfiGlobalVariableGuid,
>> + &CurrentOrder,
>> + &Length 
>> + );
> 
> with the following error message:
> 
> 
> NetworkPkg/HttpBootDxe/HttpBootConfig.c: In function
> 'HttpBootAddBootOption':
> NetworkPkg/HttpBootDxe/HttpBootConfig.c:148:14: error: passing argument
> 3 of 'GetVariable2' from incompatible pointer type [-Werror]
> );
> ^
> In file included from NetworkPkg/HttpBootDxe/HttpBootDxe.h:31:0,
> from NetworkPkg/HttpBootDxe/HttpBootConfig.c:15:
> MdePkg/Include/Library/UefiLib.h:708:1: note: expected 'void **' but
> argument is of type 'CHAR16 **'
> GetVariable2 (
> ^
> cc1: all warnings being treated as errors
> 
> 
> First, the BootOrder variable is not composed of CHAR16 elements (it is
> not a UCS-2 string); it is composed of UINT16 elements. From the UEFI spec:
> 
> The BootOrder variable contains an array of UINT16’s that make up
> an ordered list of the Boot options.
> 
> Second, can we please figure out a way for Windows using developers to
> build edk2 with at least one version of gcc? These build failures are
> *incredibly* annoying. The build breaks, someone submits a patch, the
> reviewer lives on the other side of the planet, a day passes, review is
> in, another day passes, the submitter commits it, okay, it builds again
> now. Terrible.
> 
> I would absolutely test-build my edk2 patches with a VS release if one
> was available to me at no cost. I could run it in a virtual machine. I
> don't do it because I can't justify the $$$ to mgmt just for this. But
> gcc binaries are available to Windows people at zero cost, and gcc's use
> on Windows has been repeatedly discussed on this list. I find this state
> desperate.
> 
> 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] [PATCH v2 1/3] ArmPkg: Add ArmReadHcr to enable read-modify-write of HCR

2016-03-07 Thread Cohen, Eugene
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen 
---
 ArmPkg/Include/Chipset/AArch64.h   | 5 +
 ArmPkg/Library/ArmLib/AArch64/AArch64Support.S | 6 ++
 2 files changed, 11 insertions(+)

diff --git a/ArmPkg/Include/Chipset/AArch64.h b/ArmPkg/Include/Chipset/AArch64.h
index e53605f..aa6a7e0 100644
--- a/ArmPkg/Include/Chipset/AArch64.h
+++ b/ArmPkg/Include/Chipset/AArch64.h
@@ -204,6 +204,11 @@ ArmWriteHcr (
   );
 
 UINTN
+ArmReadHcr (
+  VOID
+  );
+
+UINTN
 ArmReadCurrentEL (
   VOID
   );
diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S 
b/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S
index db21f73..1a3023b 100644
--- a/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S
+++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S
@@ -54,6 +54,7 @@ GCC_ASM_EXPORT (ArmIsArchTimerImplemented)
 GCC_ASM_EXPORT (ArmReadIdPfr0)
 GCC_ASM_EXPORT (ArmReadIdPfr1)
 GCC_ASM_EXPORT (ArmWriteHcr)
+GCC_ASM_EXPORT (ArmReadHcr)
 GCC_ASM_EXPORT (ArmReadCurrentEL)
 
 .set CTRL_M_BIT,  (1 << 0)
@@ -470,6 +471,11 @@ ASM_PFX(ArmWriteHcr):
   msr   hcr_el2, x0// Write the passed HCR value
   ret
 
+// UINTN ArmReadHcr(VOID)
+ASM_PFX(ArmReadHcr):
+  mrs   x0, hcr_el2
+  ret
+
 // UINTN ArmReadCurrentEL(VOID)
 ASM_PFX(ArmReadCurrentEL):
   mrs   x0, CurrentEL
-- 
1.9.5.msysgit.0

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


Re: [edk2] [PATCH 0/3] Implement ARM/AArch64 instance of CpuExceptionHandlerLib

2016-03-07 Thread Cohen, Eugene
Here's the second revision of the patch series with these changes:

1. Remove the unnecessary patching of the CommonExceptionEntry since the linker 
already does it
2. Remove a duplicate write to VBAR in the case where exception handlers are 
relocated

Both of these only affect Patch 2/3, 1 and 3 remain unchanged.

Eugene

> -Original Message-
> From: Cohen, Eugene
> Sent: Thursday, March 03, 2016 4:05 PM
> To: edk2-devel@lists.01.org; 'Ard Biesheuvel'
> ; Leif Lindholm 
> Subject: [PATCH 0/3] Implement ARM/AArch64 instance of
> CpuExceptionHandlerLib
> 
> This patch series refactors the exception handling in ArmPkg CpuDxe
> to a base library implementing the existing CpuExceptionHandlerLib
> interface.  This interface allows for exception handling in any phase of
> execution so we can get exception handlers in place early for effective
> debugging.
> 
> The issue raised earlier around EL2 taking over exception/interrupt
> handling (old subject was "ArmPkg: AArch64 exception handling init
> configures HCR in EL2") is now handled in this patchset across patches 1
> and 2.
> 
> These changes have been tested on AArch64 and ARM platforms.
> Testing consisted of inducing exceptions at SEC and DxeMain (after the
> CpuExceptionHandlerLib is initialized and before CpuDxe is loaded), as
> well as ensuring correct timer tick / IRQ interrupts delivery.
> 
> Read the patchset description of patch 2 about why there are two
> instances of the ArmExceptionLib.  The short answer is that it offers a
> choice between self-contained exception handlers (ArmExceptionLib)
> and optimizing for code size (ArmRelocateExceptionLib).
> 
> 
> NOTE:  Platforms that use the ArmPkg CpuDxe will need their DSC files
> updated to include a non-null instance of the CpuExceptionHandlerLib.
> For DXE phase components which are not as size sensitive the self-
> contained variant should suffice:
> 
> 
> CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExcep
> tionLib.inf
> 
> The following platforms will need their DSC files updated with this
> instance for the build to succeed since they use ArmPkg CpuDxe:
> 
> edk2: ArmVirtQemu, ArmVirtQemuKernel, ArmVirtXen, and
> BeagleBoardPkg
> OpenPlatformPkg: ArmJuno, ArmVExpress-CTA15-A7, ArmVExpress-
> FVP-AArch64.dsc, and BeagleBoardPkg
> 
> [please excuse me not generating patches for each of these platforms,
> I hope you understand]
> 
> 
> Thanks,
> 
> Eugene

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


[edk2] [PATCH v2 3/3] ArmPkg: Update CpuDxe to use CpuExceptionHandlerLib

2016-03-07 Thread Cohen, Eugene
Use the new ARM/AArch64 implementation of the base
CpuExceptionHandlerLib library from CpuDxe to centralize
exception handling.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen 
---
 ArmPkg/Drivers/CpuDxe/AArch64/Exception.c| 154 -
 ArmPkg/Drivers/CpuDxe/AArch64/ExceptionSupport.S | 402 ---
 ArmPkg/Drivers/CpuDxe/Arm/Exception.c| 234 -
 ArmPkg/Drivers/CpuDxe/Arm/ExceptionSupport.S | 304 -
 ArmPkg/Drivers/CpuDxe/Arm/ExceptionSupport.asm   | 301 -
 ArmPkg/Drivers/CpuDxe/CpuDxe.inf |  10 +-
 ArmPkg/Drivers/CpuDxe/Exception.c|  95 ++
 7 files changed, 98 insertions(+), 1402 deletions(-)
 delete mode 100644 ArmPkg/Drivers/CpuDxe/AArch64/Exception.c
 delete mode 100644 ArmPkg/Drivers/CpuDxe/AArch64/ExceptionSupport.S
 delete mode 100644 ArmPkg/Drivers/CpuDxe/Arm/Exception.c
 delete mode 100644 ArmPkg/Drivers/CpuDxe/Arm/ExceptionSupport.S
 delete mode 100644 ArmPkg/Drivers/CpuDxe/Arm/ExceptionSupport.asm
 create mode 100644 ArmPkg/Drivers/CpuDxe/Exception.c

diff --git a/ArmPkg/Drivers/CpuDxe/AArch64/Exception.c 
b/ArmPkg/Drivers/CpuDxe/AArch64/Exception.c
deleted file mode 100644
index ce1c6ce..000
--- a/ArmPkg/Drivers/CpuDxe/AArch64/Exception.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/** @file
-
-  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-  Portions Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
-
-  This program and the accompanying materials
-  are licensed and made available under the terms and conditions of the BSD 
License
-  which accompanies this distribution.  The full text of the license may be 
found at
-  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.
-
-**/
-
-#include "CpuDxe.h"
-
-#include 
-
-VOID
-ExceptionHandlersStart (
-  VOID
-  );
-
-VOID
-ExceptionHandlersEnd (
-  VOID
-  );
-
-VOID
-CommonExceptionEntry (
-  VOID
-  );
-
-VOID
-AsmCommonExceptionEntry (
-  VOID
-  );
-
-
-EFI_EXCEPTION_CALLBACK  gExceptionHandlers[MAX_AARCH64_EXCEPTION + 1];
-EFI_EXCEPTION_CALLBACK  gDebuggerExceptionHandlers[MAX_AARCH64_EXCEPTION + 1];
-
-
-
-/**
-  This function registers and enables the handler specified by 
InterruptHandler for a processor
-  interrupt or exception type specified by InterruptType. If InterruptHandler 
is NULL, then the
-  handler for the processor interrupt or exception type specified by 
InterruptType is uninstalled.
-  The installed handler is called once for each processor interrupt or 
exception.
-
-  @param  InterruptTypeA pointer to the processor's current interrupt 
state. Set to TRUE if interrupts
-   are enabled and FALSE if interrupts are disabled.
-  @param  InterruptHandler A pointer to a function of type 
EFI_CPU_INTERRUPT_HANDLER that is called
-   when a processor interrupt occurs. If this 
parameter is NULL, then the handler
-   will be uninstalled.
-
-  @retval EFI_SUCCESS   The handler for the processor interrupt was 
successfully installed or uninstalled.
-  @retval EFI_ALREADY_STARTED   InterruptHandler is not NULL, and a handler 
for InterruptType was
-previously installed.
-  @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for 
InterruptType was not
-previously installed.
-  @retval EFI_UNSUPPORTED   The interrupt specified by InterruptType is 
not supported.
-
-**/
-EFI_STATUS
-RegisterInterruptHandler (
-  IN EFI_EXCEPTION_TYPE InterruptType,
-  IN EFI_CPU_INTERRUPT_HANDLER  InterruptHandler
-  )
-{
-  if (InterruptType > MAX_AARCH64_EXCEPTION) {
-return EFI_UNSUPPORTED;
-  }
-
-  if ((InterruptHandler != NULL) && (gExceptionHandlers[InterruptType] != 
NULL)) {
-return EFI_ALREADY_STARTED;
-  }
-
-  gExceptionHandlers[InterruptType] = InterruptHandler;
-
-  return EFI_SUCCESS;
-}
-
-
-
-VOID
-EFIAPI
-CommonCExceptionHandler (
-  IN EFI_EXCEPTION_TYPE   ExceptionType,
-  IN OUT EFI_SYSTEM_CONTEXT   SystemContext
-  )
-{
-  if (ExceptionType <= MAX_AARCH64_EXCEPTION) {
-if (gExceptionHandlers[ExceptionType]) {
-  gExceptionHandlers[ExceptionType] (ExceptionType, SystemContext);
-  return;
-}
-  } else {
-DEBUG ((EFI_D_ERROR, "Unknown exception type %d from %016lx\n", 
ExceptionType, SystemContext.SystemContextAArch64->ELR));
-ASSERT (FALSE);
-  }
-
-  DefaultExceptionHandler (ExceptionType, SystemContext);
-}
-
-
-
-EFI_STATUS
-InitializeExceptions (
-  IN EFI_CPU_ARCH_PROTOCOL*Cpu
-  )
-{
-  EFI_STATUS   Status;
-  BOOLEAN  IrqEnabled;
-  BOOLEAN  FiqEnabled;
-
-  Status = EFI_SUCCESS;
-  ZeroMem (gExceptionHandlers,sizeof(*gExceptionHandlers));

[edk2] [PATCH v2 2/3] ArmPkg: ARM/AArch64 implementation of CpuExceptionHandlerLib

2016-03-07 Thread Cohen, Eugene
Introduce ARM and AArch64 instances of the  CpuExceptionHandlerLib
which provides exception handling and registration of handlers
regardless of execution phase.

Two variants of the ArmExceptionLib are provided: one where
exception handlers reside within the module (meeting appropriate
architectural alignment requirements for the vector table) and
another one that will relocate a copy of exception handlers to
an address specified by PcdCpuVectorBaseAddress.  The
ArmRelocateExceptionLib is intended for use in cases where
ArmExceptionLib is too large for the application (uncompressed
XIP images) as driven by the vector table alignment padding.

The AArch64 build of this library supports execution at
EL1, EL2, and EL3 exception levels.

Tested on ARM, and AArch64 with SEC, DXE Core, and CpuDxe
modules.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen 
---
 ArmPkg/ArmPkg.dsc  |   3 +
 .../ArmExceptionLib/AArch64/AArch64Exception.c |  44 +++
 .../ArmExceptionLib/AArch64/ExceptionSupport.S | 425 +
 ArmPkg/Library/ArmExceptionLib/Arm/ArmException.c  |  50 +++
 .../Library/ArmExceptionLib/Arm/ExceptionSupport.S | 305 +++
 .../ArmExceptionLib/Arm/ExceptionSupport.asm   | 302 +++
 ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c   | 320 
 ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf |  63 +++
 .../ArmExceptionLib/ArmRelocateExceptionLib.inf|  65 
 9 files changed, 1577 insertions(+)
 create mode 100644 ArmPkg/Library/ArmExceptionLib/AArch64/AArch64Exception.c
 create mode 100644 ArmPkg/Library/ArmExceptionLib/AArch64/ExceptionSupport.S
 create mode 100644 ArmPkg/Library/ArmExceptionLib/Arm/ArmException.c
 create mode 100644 ArmPkg/Library/ArmExceptionLib/Arm/ExceptionSupport.S
 create mode 100644 ArmPkg/Library/ArmExceptionLib/Arm/ExceptionSupport.asm
 create mode 100644 ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
 create mode 100644 ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf
 create mode 100644 ArmPkg/Library/ArmExceptionLib/ArmRelocateExceptionLib.inf

diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
index 688244b..df5be6e 100644
--- a/ArmPkg/ArmPkg.dsc
+++ b/ArmPkg/ArmPkg.dsc
@@ -63,6 +63,7 @@
   
UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
   
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
   
DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
+  CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf
 
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
@@ -122,6 +123,8 @@
   ArmPkg/Library/SemihostLib/SemihostLib.inf
   ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
   ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf
+  ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf
+  ArmPkg/Library/ArmExceptionLib/ArmRelocateExceptionLib.inf
 
   ArmPkg/Drivers/CpuDxe/CpuDxe.inf
   ArmPkg/Drivers/CpuPei/CpuPei.inf
diff --git a/ArmPkg/Library/ArmExceptionLib/AArch64/AArch64Exception.c 
b/ArmPkg/Library/ArmExceptionLib/AArch64/AArch64Exception.c
new file mode 100644
index 000..b005a78
--- /dev/null
+++ b/ArmPkg/Library/ArmExceptionLib/AArch64/AArch64Exception.c
@@ -0,0 +1,44 @@
+/** @file
+*  Exception Handling support specific for AArch64
+*
+*  Copyright (c) 2016 HP Development Company, L.P.
+*
+*  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.
+*
+**/
+
+#include 
+
+#include 
+
+#include  // for MAX_AARCH64_EXCEPTION
+
+UINTN   gMaxExceptionNumber = MAX_AARCH64_EXCEPTION;
+EFI_EXCEPTION_CALLBACK  gExceptionHandlers[MAX_AARCH64_EXCEPTION + 1] = { 0 };
+EFI_EXCEPTION_CALLBACK  gDebuggerExceptionHandlers[MAX_AARCH64_EXCEPTION + 1] 
= { 0 };
+PHYSICAL_ADDRESSgExceptionVectorAlignmentMask = 
ARM_VECTOR_TABLE_ALIGNMENT;
+UINTN   gDebuggerNoHandlerValue = 0; // todo: define for 
AArch64
+
+RETURN_STATUS ArchVectorConfig(
+  IN  UINTN   VectorBaseAddress
+  )
+{
+  UINTN HcrReg;
+  
+  if (ArmReadCurrentEL() == AARCH64_EL2) {
+HcrReg = ArmReadHcr();
+
+// Trap General Exceptions. All exceptions that would be routed to EL1 are 
routed to EL2
+HcrReg |= ARM_HCR_TGE;
+
+ArmWriteHcr(HcrReg);
+  }
+
+  return RETURN_SUCCESS;
+}
diff --git a/ArmPkg/Library/ArmExceptionLib/AArch64/ExceptionSupport.S 
b/ArmPkg/Library/ArmExceptionLib/AArch64/ExceptionSupport.S
new file mode 1

Re: [edk2] [PATCH v2 1/2] PerformancePkg/Dp_App: Support execution break

2016-03-07 Thread Carsey, Jaben
Also for series.

Reviewed-by: Jaben Carsey 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of El-
> Haj-Mahmoud, Samer
> Sent: Monday, March 07, 2016 4:57 AM
> To: edk2-devel@lists.01.org; Shia, Cinnamon 
> Subject: Re: [edk2] [PATCH v2 1/2] PerformancePkg/Dp_App: Support
> execution break
> Importance: High
> 
> Series Reviewed-by: Samer EL-Haj-Mahmoud 
> 
> On 2016/3/7 11:23, Cinnamon Shia wrote:
> > Support UEFI shell execution break.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Cinnamon Shia 
> > ---
> >   PerformancePkg/Dp_App/Dp.c | 36 --
> >   PerformancePkg/Dp_App/DpInternal.h | 27 -
> >   PerformancePkg/Dp_App/DpTrace.c| 62
> --
> >   3 files changed, 99 insertions(+), 26 deletions(-)
> >
> > diff --git a/PerformancePkg/Dp_App/Dp.c b/PerformancePkg/Dp_App/Dp.c
> > index e052216..e36a032 100644
> > --- a/PerformancePkg/Dp_App/Dp.c
> > +++ b/PerformancePkg/Dp_App/Dp.c
> > @@ -14,7 +14,7 @@
> > timer information to calculate elapsed time for each measurement.
> >
> > Copyright (c) 2009 - 2015, Intel Corporation. All rights
> > reserved.
> > -  (C) Copyright 2015 Hewlett Packard Enterprise Development LP
> > +  (C) Copyright 2015-2016 Hewlett Packard Enterprise Development
> > + LP
> > This program and the accompanying materials
> > are licensed and made available under the terms and conditions of the
> BSD License
> > which accompanies this distribution.  The full text of the license
> > may be found at @@ -195,11 +195,11 @@ InitCumulativeData (
> >
> > @param[in]  ImageHandle The image handle.
> > @param[in]  SystemTable The system table.
> > -
> > +
> > @retval EFI_SUCCESSCommand completed successfully.
> > @retval EFI_INVALID_PARAMETER  Command usage error.
> > +  @retval EFI_ABORTEDThe user aborts the operation.
> > @retval value  Unknown error.
> > -
> >   **/
> >   EFI_STATUS
> >   EFIAPI
> > @@ -443,7 +443,10 @@ InitializeDp (
> >   ProcessCumulative (CustomCumulativeData);
> > } else if (AllMode) {
> >   if (TraceMode) {
> > -  DumpAllTrace( Number2Display, ExcludeMode);
> > +  Status = DumpAllTrace( Number2Display, ExcludeMode);
> > +  if (Status == EFI_ABORTED) {
> > +goto Done;
> > +  }
> >   }
> >   if (ProfileMode) {
> > DumpAllProfile( Number2Display, ExcludeMode); @@ -451,7
> > +454,10 @@ InitializeDp (
> > }
> > else if (RawMode) {
> >   if (TraceMode) {
> > -  DumpRawTrace( Number2Display, ExcludeMode);
> > +  Status = DumpRawTrace( Number2Display, ExcludeMode);
> > +  if (Status == EFI_ABORTED) {
> > +goto Done;
> > +  }
> >   }
> >   if (ProfileMode) {
> > DumpRawProfile( Number2Display, ExcludeMode); @@ -463,11
> > +469,21 @@ InitializeDp (
> > ProcessPhases ( Ticker );
> > if ( ! SummaryMode) {
> >   Status = ProcessHandles ( ExcludeMode);
> > -if ( ! EFI_ERROR( Status)) {
> > -  ProcessPeims ( );
> > -  ProcessGlobal ();
> > -  ProcessCumulative (NULL);
> > +if (Status == EFI_ABORTED) {
> > +  goto Done;
> >   }
> > +
> > +Status = ProcessPeims ();
> > +if (Status == EFI_ABORTED) {
> > +  goto Done;
> > +}
> > +
> > +Status = ProcessGlobal ();
> > +if (Status == EFI_ABORTED) {
> > +  goto Done;
> > +}
> > +
> > +ProcessCumulative (NULL);
> > }
> >   }
> >   if (ProfileMode) {
> > @@ -480,6 +496,8 @@ InitializeDp (
> >   }
> > }
> >
> > +Done:
> > +
> > //
> > // Free the memory allocate from HiiGetString
> > //
> > diff --git a/PerformancePkg/Dp_App/DpInternal.h
> > b/PerformancePkg/Dp_App/DpInternal.h
> > index 0e97e1e..53c5fb2 100644
> > --- a/PerformancePkg/Dp_App/DpInternal.h
> > +++ b/PerformancePkg/Dp_App/DpInternal.h
> > @@ -7,7 +7,7 @@
> > DpUtilities.c, DpTrace.c, and DpProfile.c are included here.
> >
> > Copyright (c) 2009 - 2014, Intel Corporation. All rights
> > reserved.
> > -  (C) Copyright 2015 Hewlett Packard Enterprise Development LP
> > +  (C) Copyright 2015-2016 Hewlett Packard Enterprise Development
> > + LP
> > This program and the accompanying materials
> > are licensed and made available under the terms and conditions of the
> BSD License
> > which accompanies this distribution.  The full text of the license
> > may be found at @@ -215,8 +215,11 @@ GatherStatistics(
> > @param[in]Limit   The number of records to print.  Zero is ALL.
> > @param[in]ExcludeFlag TRUE to exclude individual Cumul

Re: [edk2] [PATCH v2] MdeModulePkg: Change the type of PcdMaxPeiPerformanceLogEntries to UINT16

2016-03-07 Thread Kinney, Michael D
Cinnamon,

How about the following changes:

1) Use a PCD name of PcdMaxPeiPerformanceLogEntries16 to show it is 16-bits.  
Also allows for more expansion if we need more than 16-bits later.
2) Make the default value of PcdMaxPeiPerformanceLogEntries16 be 0, which is 
the disabled value.
3) Use PcdMaxPeiPerformanceLogEntries16 if it is not zero.  This way, we do not 
have to set PcdMaxPeiPerformanceLogEntries
To a special value to activate the use of PcdMaxPeiPerformanceLogEntries16.  
For example:

 PeiPerformanceLogEntries = (PcdGet16 (PcdMaxPeiPerformanceLogEntries16) != 0 ?
 PcdGet16 (PcdMaxPeiPerformanceLogEntries16) :
 (UINT16)PcdGet8 (PcdMaxPeiPerformanceLogEntries));

Thanks,

Best regards,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Cinnamon Shia
> Sent: Sunday, March 6, 2016 11:57 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH v2] MdeModulePkg: Change the type of
> PcdMaxPeiPerformanceLogEntries to UINT16
> 
> Change the type of PcdMaxPeiPerformanceLogEntries from UINT8 to UINT16 to
> log more than 255 performance entries in PEI.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Cinnamon Shia 
> ---
>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c|  5 -
>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.inf  |  2 ++
>  .../Library/PeiPerformanceLib/PeiPerformanceLib.c| 20 
> +++-
>  .../Library/PeiPerformanceLib/PeiPerformanceLib.inf  |  2 ++
>  MdeModulePkg/MdeModulePkg.dec|  9 +
>  5 files changed, 32 insertions(+), 6 deletions(-)
> 
> diff --git 
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> index 0eb8e57..bbad2e9 100644
> --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> @@ -11,6 +11,7 @@
>Performance Protocol is installed at the very beginning of DXE phase.
> 
>  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD 
> License
>  which accompanies this distribution.  The full text of the license may be 
> found at
> @@ -522,7 +523,9 @@ DxeCorePerformanceLibConstructor (
>);
>ASSERT_EFI_ERROR (Status);
> 
> -  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8
> (PcdMaxPeiPerformanceLogEntries);
> +  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + (UINT16) (PcdGet8
> (PcdMaxPeiPerformanceLogEntries) != 0 ?
> + PcdGet8
> (PcdMaxPeiPerformanceLogEntries) != 0 :
> + PcdGet16
> (PcdMaxPeiPerformanceLogEntriesMoreThan255));
> 
>mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof
> (GAUGE_DATA_ENTRY_EX) * mMaxGaugeRecords));
>ASSERT (mGaugeData != NULL);
> diff --git 
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> index 5f29063..8cecdd2 100644
> --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> @@ -10,6 +10,7 @@
>  #  Performance and PerformanceEx Protocol are installed at the very 
> beginning of DXE
> phase.
>  #
>  #  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
> +# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  #  This program and the accompanying materials
>  #  are licensed and made available under the terms and conditions of the BSD 
> License
>  #  which accompanies this distribution.  The full text of the license may be 
> found at
> @@ -67,4 +68,5 @@
> 
>  [Pcd]
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries ## CONSUMES
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntriesMoreThan255 
> ## CONSUMES
>gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask## CONSUMES
> diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
> b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
> index 9674bbc..0f90ca8 100644
> --- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
> +++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
> @@ -4,10 +4,11 @@
>This file implements all APIs in Performance Library class in MdePkg. It 
> creates
>performance logging GUIDed HOB on the first performance logging and then 
> logs the
>performance data to the GUIDed HOB. Due to the limitation of temporary 
> RAM, the
> maximum
> -  number of performance logging entry is specified by 
> Pcd

Re: [edk2] [PATCH v2] MdeModulePkg: Change the type of PcdMaxPeiPerformanceLogEntries to UINT16

2016-03-07 Thread Shia, Cinnamon
Hi Mike,

Thanks for your feedbacks. It make sense to me.
Will fix it in patch v3 and update the commit message for the new changes. 

Thanks,
Cinnamon Shia


-Original Message-
From: Kinney, Michael D [mailto:michael.d.kin...@intel.com] 
Sent: Tuesday, March 8, 2016 12:13 AM
To: Shia, Cinnamon; edk2-devel@lists.01.org; Kinney, Michael D
Subject: RE: [edk2] [PATCH v2] MdeModulePkg: Change the type of 
PcdMaxPeiPerformanceLogEntries to UINT16

Cinnamon,

How about the following changes:

1) Use a PCD name of PcdMaxPeiPerformanceLogEntries16 to show it is 16-bits.  
Also allows for more expansion if we need more than 16-bits later.
2) Make the default value of PcdMaxPeiPerformanceLogEntries16 be 0, which is 
the disabled value.
3) Use PcdMaxPeiPerformanceLogEntries16 if it is not zero.  This way, we do not 
have to set PcdMaxPeiPerformanceLogEntries To a special value to activate the 
use of PcdMaxPeiPerformanceLogEntries16.  For example:

 PeiPerformanceLogEntries = (PcdGet16 (PcdMaxPeiPerformanceLogEntries16) != 0 ?
 PcdGet16 (PcdMaxPeiPerformanceLogEntries16) :
 (UINT16)PcdGet8 (PcdMaxPeiPerformanceLogEntries));

Thanks,

Best regards,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Cinnamon Shia
> Sent: Sunday, March 6, 2016 11:57 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH v2] MdeModulePkg: Change the type of 
> PcdMaxPeiPerformanceLogEntries to UINT16
> 
> Change the type of PcdMaxPeiPerformanceLogEntries from UINT8 to UINT16 
> to log more than 255 performance entries in PEI.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Cinnamon Shia 
> ---
>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c|  5 -
>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.inf  |  2 ++
>  .../Library/PeiPerformanceLib/PeiPerformanceLib.c| 20 
> +++-
>  .../Library/PeiPerformanceLib/PeiPerformanceLib.inf  |  2 ++
>  MdeModulePkg/MdeModulePkg.dec|  9 +
>  5 files changed, 32 insertions(+), 6 deletions(-)
> 
> diff --git 
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> index 0eb8e57..bbad2e9 100644
> --- 
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib
> +++ .c
> @@ -11,6 +11,7 @@
>Performance Protocol is installed at the very beginning of DXE phase.
> 
>  Copyright (c) 2006 - 2015, Intel Corporation. All rights 
> reserved.
> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  This program and the accompanying materials  are licensed and made 
> available under the terms and conditions of the BSD License  which 
> accompanies this distribution.  The full text of the license may be 
> found at @@ -522,7 +523,9 @@ DxeCorePerformanceLibConstructor (
>);
>ASSERT_EFI_ERROR (Status);
> 
> -  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8 
> (PcdMaxPeiPerformanceLogEntries);
> +  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + (UINT16) (PcdGet8
> (PcdMaxPeiPerformanceLogEntries) != 0 ?
> + PcdGet8
> (PcdMaxPeiPerformanceLogEntries) != 0 :
> + PcdGet16
> (PcdMaxPeiPerformanceLogEntriesMoreThan255));
> 
>mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof
> (GAUGE_DATA_ENTRY_EX) * mMaxGaugeRecords));
>ASSERT (mGaugeData != NULL);
> diff --git 
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> index 5f29063..8cecdd2 100644
> --- 
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib
> +++ .inf
> @@ -10,6 +10,7 @@
>  #  Performance and PerformanceEx Protocol are installed at the very 
> beginning of DXE phase.
>  #
>  #  Copyright (c) 2006 - 2014, Intel Corporation. All rights 
> reserved.
> +# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  #  This program and the accompanying materials  #  are licensed and 
> made available under the terms and conditions of the BSD License  #  
> which accompanies this distribution.  The full text of the license may 
> be found at @@ -67,4 +68,5 @@
> 
>  [Pcd]
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries ## 
> CONSUMES
> +  
> + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntriesMoreTha
> + n255 ## CONSUMES
>gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask## CONSUMES
> diff --git 
> a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
> b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
> index 9674bbc..0f90ca8 100644
> ---

[edk2] [PATCH v3] MdeModulePkg: Increase the maximum number of PEI performance log entries

2016-03-07 Thread Cinnamon Shia
The maximum number of PEI performance log entries is 255.
Add a new PCD, PcdMaxPeiPerformanceLogEntries16, to increase the maximum
number of PEI performance log entries.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia 
Reviewed-by: Samer EL-Haj-Mahmoud 
---
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.c|  5 -
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.inf  |  6 --
 .../Library/PeiPerformanceLib/PeiPerformanceLib.c| 20 +++-
 .../Library/PeiPerformanceLib/PeiPerformanceLib.inf  |  6 --
 MdeModulePkg/MdeModulePkg.dec|  9 +
 5 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 0eb8e57..7c35b8d 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -11,6 +11,7 @@
   Performance Protocol is installed at the very beginning of DXE phase.
 
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -522,7 +523,9 @@ DxeCorePerformanceLibConstructor (
   );
   ASSERT_EFI_ERROR (Status);
 
-  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8 
(PcdMaxPeiPerformanceLogEntries);
+  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + (UINT16) (PcdGet16 
(PcdMaxPeiPerformanceLogEntries) != 0 ?
+ PcdGet16 
(PcdMaxPeiPerformanceLogEntries) != 0 :
+ PcdGet8 
(PcdMaxPeiPerformanceLogEntries));
 
   mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof 
(GAUGE_DATA_ENTRY_EX) * mMaxGaugeRecords));
   ASSERT (mGaugeData != NULL);
diff --git 
a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
index 5f29063..f73d0a4 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
@@ -10,6 +10,7 @@
 #  Performance and PerformanceEx Protocol are installed at the very beginning 
of DXE phase.
 #  
 #  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
 #  which accompanies this distribution.  The full text of the license may be 
found at
@@ -66,5 +67,6 @@
   gPerformanceExProtocolGuid
 
 [Pcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries ## CONSUMES
-  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries   ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries16 ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask  ## CONSUMES
diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c 
b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
index 9674bbc..5a3c784 100644
--- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
+++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
@@ -4,10 +4,11 @@
   This file implements all APIs in Performance Library class in MdePkg. It 
creates
   performance logging GUIDed HOB on the first performance logging and then 
logs the
   performance data to the GUIDed HOB. Due to the limitation of temporary RAM, 
the maximum
-  number of performance logging entry is specified by 
PcdMaxPeiPerformanceLogEntries.  
+  number of performance logging entry is specified by 
PcdMaxPeiPerformanceLogEntries or 
+  PcdMaxPeiPerformanceLogEntries16
 
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP
+(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -51,10 +52,14 @@ InternalGetPerformanceHobLog (
 {
   EFI_HOB_GUID_TYPE   *GuidHob;
   UINTN   PeiPerformanceSize;
+  UINT16  PeiPerformanceLogEntries;
 
   ASSERT (PeiPerformanceLog != NULL);
   ASSERT (PeiPerformanceIdArray != NULL);
 
+  PeiPerformanceLogEntries = (UINT16) (PcdGet16 
(PcdMaxPeiPerformanceLogEntries16) != 0 ?
+

[edk2] [PATCH v4] MdeModulePkg: Increase the maximum number of PEI performance log entries

2016-03-07 Thread Cinnamon Shia
The maximum number of PEI performance log entries is 255.
Add a new PCD, PcdMaxPeiPerformanceLogEntries16, to increase the maximum
number of PEI performance log entries.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia 
Reviewed-by: Samer EL-Haj-Mahmoud 
Reviewed-by: Joseph Shifflett 
---
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.c|  5 -
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.inf  |  6 --
 .../Library/PeiPerformanceLib/PeiPerformanceLib.c| 20 +++-
 .../Library/PeiPerformanceLib/PeiPerformanceLib.inf  |  6 --
 MdeModulePkg/MdeModulePkg.dec|  9 +
 5 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 0eb8e57..9c729e1 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -11,6 +11,7 @@
   Performance Protocol is installed at the very beginning of DXE phase.
 
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -522,7 +523,9 @@ DxeCorePerformanceLibConstructor (
   );
   ASSERT_EFI_ERROR (Status);
 
-  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8 
(PcdMaxPeiPerformanceLogEntries);
+  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + (UINT16) (PcdGet16 
(PcdMaxPeiPerformanceLogEntries16) != 0 ?
+ PcdGet16 
(PcdMaxPeiPerformanceLogEntries16) != 0 :
+ PcdGet8 
(PcdMaxPeiPerformanceLogEntries));
 
   mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof 
(GAUGE_DATA_ENTRY_EX) * mMaxGaugeRecords));
   ASSERT (mGaugeData != NULL);
diff --git 
a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
index 5f29063..f73d0a4 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
@@ -10,6 +10,7 @@
 #  Performance and PerformanceEx Protocol are installed at the very beginning 
of DXE phase.
 #  
 #  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
 #  which accompanies this distribution.  The full text of the license may be 
found at
@@ -66,5 +67,6 @@
   gPerformanceExProtocolGuid
 
 [Pcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries ## CONSUMES
-  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries   ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries16 ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask  ## CONSUMES
diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c 
b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
index 9674bbc..5a3c784 100644
--- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
+++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
@@ -4,10 +4,11 @@
   This file implements all APIs in Performance Library class in MdePkg. It 
creates
   performance logging GUIDed HOB on the first performance logging and then 
logs the
   performance data to the GUIDed HOB. Due to the limitation of temporary RAM, 
the maximum
-  number of performance logging entry is specified by 
PcdMaxPeiPerformanceLogEntries.  
+  number of performance logging entry is specified by 
PcdMaxPeiPerformanceLogEntries or 
+  PcdMaxPeiPerformanceLogEntries16
 
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP
+(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -51,10 +52,14 @@ InternalGetPerformanceHobLog (
 {
   EFI_HOB_GUID_TYPE   *GuidHob;
   UINTN   PeiPerformanceSize;
+  UINT16  PeiPerformanceLogEntries;
 
   ASSERT (PeiPerformanceLog != NULL);
   ASSERT (PeiPerformanceIdArray != NULL);
 
+  PeiPerformanceLogEntries = (UINT16) (PcdGet16 
(PcdMaxPeiPerformanc

Re: [edk2] [PATCH v4] MdeModulePkg: Increase the maximum number of PEI performance log entries

2016-03-07 Thread El-Haj-Mahmoud, Samer
Reviewed-by: Samer El-Haj-Mahmoud 


-Original Message-
From: Shia, Cinnamon 
Sent: Monday, March 7, 2016 12:48 PM
To: edk2-devel@lists.01.org
Cc: El-Haj-Mahmoud, Samer ; Shia, Cinnamon 

Subject: [PATCH v4] MdeModulePkg: Increase the maximum number of PEI 
performance log entries

The maximum number of PEI performance log entries is 255.
Add a new PCD, PcdMaxPeiPerformanceLogEntries16, to increase the maximum number 
of PEI performance log entries.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia 
Reviewed-by: Samer EL-Haj-Mahmoud 
Reviewed-by: Joseph Shifflett 
---
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.c|  5 -
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.inf  |  6 --
 .../Library/PeiPerformanceLib/PeiPerformanceLib.c| 20 +++-
 .../Library/PeiPerformanceLib/PeiPerformanceLib.inf  |  6 --
 MdeModulePkg/MdeModulePkg.dec|  9 +
 5 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 0eb8e57..9c729e1 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -11,6 +11,7 @@
   Performance Protocol is installed at the very beginning of DXE phase.
 
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -522,7 +523,9 @@ 
DxeCorePerformanceLibConstructor (
   );
   ASSERT_EFI_ERROR (Status);
 
-  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8 
(PcdMaxPeiPerformanceLogEntries);
+  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + (UINT16) (PcdGet16 
(PcdMaxPeiPerformanceLogEntries16) != 0 ?
+ PcdGet16 
(PcdMaxPeiPerformanceLogEntries16) != 0 :
+ PcdGet8 
+ (PcdMaxPeiPerformanceLogEntries));
 
   mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof 
(GAUGE_DATA_ENTRY_EX) * mMaxGaugeRecords));
   ASSERT (mGaugeData != NULL);
diff --git 
a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
index 5f29063..f73d0a4 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.i
+++ nf
@@ -10,6 +10,7 @@
 #  Performance and PerformanceEx Protocol are installed at the very beginning 
of DXE phase.
 #
 #  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #  This program and the accompanying materials  #  are licensed and made 
available under the terms and conditions of the BSD License  #  which 
accompanies this distribution.  The full text of the license may be found at @@ 
-66,5 +67,6 @@
   gPerformanceExProtocolGuid
 
 [Pcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries ## CONSUMES
-  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries   ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries16 ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask  ## CONSUMES
diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c 
b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
index 9674bbc..5a3c784 100644
--- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
+++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
@@ -4,10 +4,11 @@
   This file implements all APIs in Performance Library class in MdePkg. It 
creates
   performance logging GUIDed HOB on the first performance logging and then 
logs the
   performance data to the GUIDed HOB. Due to the limitation of temporary RAM, 
the maximum
-  number of performance logging entry is specified by 
PcdMaxPeiPerformanceLogEntries.  
+  number of performance logging entry is specified by 
+ PcdMaxPeiPerformanceLogEntries or
+  PcdMaxPeiPerformanceLogEntries16
 
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP
+(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -51,10 +52,14 @@ 
InternalGetPerformanceHobLog (  {
   E

Re: [edk2] [PATCH v3] MdeModulePkg: Increase the maximum number of PEI performance log entries

2016-03-07 Thread Kinney, Michael D
Cinnamon,

Minor rewording of the detailed descriptions of the PCDs included below.

With those comment changes:

Reviewed-by: Michael Kinney 

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Cinnamon Shia
> Sent: Monday, March 7, 2016 10:07 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH v3] MdeModulePkg: Increase the maximum number of PEI 
> performance
> log entries
> 
> The maximum number of PEI performance log entries is 255.
> Add a new PCD, PcdMaxPeiPerformanceLogEntries16, to increase the maximum
> number of PEI performance log entries.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Cinnamon Shia 
> Reviewed-by: Samer EL-Haj-Mahmoud 
> ---
>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c|  5 -
>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.inf  |  6 --
>  .../Library/PeiPerformanceLib/PeiPerformanceLib.c| 20 
> +++-
>  .../Library/PeiPerformanceLib/PeiPerformanceLib.inf  |  6 --
>  MdeModulePkg/MdeModulePkg.dec|  9 +
>  5 files changed, 36 insertions(+), 10 deletions(-)
> 
> diff --git 
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> index 0eb8e57..7c35b8d 100644
> --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> @@ -11,6 +11,7 @@
>Performance Protocol is installed at the very beginning of DXE phase.
> 
>  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD 
> License
>  which accompanies this distribution.  The full text of the license may be 
> found at
> @@ -522,7 +523,9 @@ DxeCorePerformanceLibConstructor (
>);
>ASSERT_EFI_ERROR (Status);
> 
> -  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8
> (PcdMaxPeiPerformanceLogEntries);
> +  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + (UINT16) (PcdGet16
> (PcdMaxPeiPerformanceLogEntries) != 0 ?
> + PcdGet16
> (PcdMaxPeiPerformanceLogEntries) != 0 :
> + PcdGet8
> (PcdMaxPeiPerformanceLogEntries));
> 
>mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof
> (GAUGE_DATA_ENTRY_EX) * mMaxGaugeRecords));
>ASSERT (mGaugeData != NULL);
> diff --git 
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> index 5f29063..f73d0a4 100644
> --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> @@ -10,6 +10,7 @@
>  #  Performance and PerformanceEx Protocol are installed at the very 
> beginning of DXE
> phase.
>  #
>  #  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
> +# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  #  This program and the accompanying materials
>  #  are licensed and made available under the terms and conditions of the BSD 
> License
>  #  which accompanies this distribution.  The full text of the license may be 
> found at
> @@ -66,5 +67,6 @@
>gPerformanceExProtocolGuid
> 
>  [Pcd]
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries ## CONSUMES
> -  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask## CONSUMES
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries   ## CONSUMES
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries16 ## CONSUMES
> +  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask  ## CONSUMES
> diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
> b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
> index 9674bbc..5a3c784 100644
> --- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
> +++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
> @@ -4,10 +4,11 @@
>This file implements all APIs in Performance Library class in MdePkg. It 
> creates
>performance logging GUIDed HOB on the first performance logging and then 
> logs the
>performance data to the GUIDed HOB. Due to the limitation of temporary 
> RAM, the
> maximum
> -  number of performance logging entry is specified by 
> PcdMaxPeiPerformanceLogEntries.
> +  number of performance logging entry is specified by 
> PcdMaxPeiPerformanceLogEntries
> or
> +  PcdMaxPeiPerformanceLogEntries16
> 
>  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
> -(C) Copyright 2015 Hewlett Packard Enterprise Development LP
> +(C) Copyright 2015-2016 Hewlett Packard Enterp

Re: [edk2] [PATCH] ArmPlatformPkg: Allocate VRAM as RuntimeServicesData

2016-03-07 Thread Evan Lloyd
Hi Ard.
Some responses inline below, but the real response is "You are right, please 
don't merge this patch just yet."

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: 07 March 2016 05:23
> To: Evan Lloyd
> Cc: edk2-devel@lists.01.org; Leif Lindholm
> Subject: Re: [edk2] [PATCH] ArmPlatformPkg: Allocate VRAM as
> RuntimeServicesData
>
> On 5 March 2016 at 00:55, Ard Biesheuvel  wrote:
> > On 4 March 2016 at 18:40,   wrote:
> >> From: Sami Mujawar 
> >>
> >> The UEFI specification allows the operating system (OS) to use the
> >> Graphics Output Protocol (GOP) in the following scenarios:
> >>  a. as part of the startup process and  b. prior to loading of a high
> >> performance OS graphics driver
> >>
> >> If the VRAM is allocated as BootServicesData, then it is unmapped on
> >> exit boot services. This prevents GOP usage by the OS post exit boot
> >> services (the second scenario); as it results in a crash when the
> >> VRAM is accessed.
> >>
> >> This patch fixes the issue by allocating VRAM as RuntimeServicesData.
> >>
> >> ...
> >
> > Isn't it the job of the loader to reserve this memory if it needs to
> > hang on to it after ExitBootServices()?
> > By the same logic, configuration tables are often loaded into
> > BootServicesData memory, and it is up to the OS to reserve it if it
> > needs to use it. Otherwise, OSes that don't care about this
> > functionality are stuck with reserved regions that they cannot
> > reclaim.

Your comments caused us to re-read the specs, and we think your case is 
correct. (Thank you)

>
> After some discussion, I realize that you are probably not in a position where
> you can change the OS side to do the right thing here.

You are also right about OS changes.  :-)
However we are in a position to raise the topic for discussion, and I think all 
concerned will want it done "properly".

>
> However, RuntimeServicesData is not the correct type to use. The framebuffer
> region has special semantics throughout its lifetime, and its lifetime is
> unbounded (i.e., the OS has no way to tell at which point the framebuffer is
> released by the graphics hardware). Also, an OS may elect not to use runtime
> services at all, and free all memory related to it.

Isn't the "correct" solution for the OS GOP driver to re-do the mapping of the 
frame buffer (described by the GOP), in a manner similar to, but independent 
of, exit boot services?  This accommodates scenarios where the buffer is not 
part of normal RAM (PCI display?)

>
> So the correct type to use here is EfiReservedMemoryType. But please, also add
> a PCD to ArmPlatformPkg to make this behavior opt-in, since losing 8 MB to a
> framebuffer that the OS may never use or care about is a bit excessvie.

I wouldn't be unhappy to do this, but I think there are few scenarios where it 
would be worthwhile;
1On a headless system you would not load the GOP driver, nor reserve memory.
2On a system with a display then you can continue to use the GOP frame buffer.  
With "a high performance OS graphics driver", the firmware can (should?) 
arrange for the GOP buffer to overlay part of the buffer used by the graphics 
card.
So the only time it would matter would be on a system with a display where you 
didn't want to use it, which is a bit perverse.

>
> Thanks,
> Ard.

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v5] MdeModulePkg: Increase the maximum number of PEI performance log entries

2016-03-07 Thread Cinnamon Shia
The maximum number of PEI performance log entries is 255.
Add a new PCD, PcdMaxPeiPerformanceLogEntries16, to increase the maximum
number of PEI performance log entries.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia 
Reviewed-by: Samer EL-Haj-Mahmoud 
Reviewed-by: Joseph Shifflett 
Reviewed-by: Michael Kinney 
---
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.c|  5 -
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.inf  |  6 --
 .../Library/PeiPerformanceLib/PeiPerformanceLib.c| 20 +++-
 .../Library/PeiPerformanceLib/PeiPerformanceLib.inf  |  6 --
 MdeModulePkg/MdeModulePkg.dec| 10 ++
 5 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 0eb8e57..9c729e1 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -11,6 +11,7 @@
   Performance Protocol is installed at the very beginning of DXE phase.
 
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -522,7 +523,9 @@ DxeCorePerformanceLibConstructor (
   );
   ASSERT_EFI_ERROR (Status);
 
-  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8 
(PcdMaxPeiPerformanceLogEntries);
+  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + (UINT16) (PcdGet16 
(PcdMaxPeiPerformanceLogEntries16) != 0 ?
+ PcdGet16 
(PcdMaxPeiPerformanceLogEntries16) != 0 :
+ PcdGet8 
(PcdMaxPeiPerformanceLogEntries));
 
   mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof 
(GAUGE_DATA_ENTRY_EX) * mMaxGaugeRecords));
   ASSERT (mGaugeData != NULL);
diff --git 
a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
index 5f29063..f73d0a4 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
@@ -10,6 +10,7 @@
 #  Performance and PerformanceEx Protocol are installed at the very beginning 
of DXE phase.
 #  
 #  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
 #  which accompanies this distribution.  The full text of the license may be 
found at
@@ -66,5 +67,6 @@
   gPerformanceExProtocolGuid
 
 [Pcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries ## CONSUMES
-  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries   ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries16 ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask  ## CONSUMES
diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c 
b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
index 9674bbc..5a3c784 100644
--- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
+++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
@@ -4,10 +4,11 @@
   This file implements all APIs in Performance Library class in MdePkg. It 
creates
   performance logging GUIDed HOB on the first performance logging and then 
logs the
   performance data to the GUIDed HOB. Due to the limitation of temporary RAM, 
the maximum
-  number of performance logging entry is specified by 
PcdMaxPeiPerformanceLogEntries.  
+  number of performance logging entry is specified by 
PcdMaxPeiPerformanceLogEntries or 
+  PcdMaxPeiPerformanceLogEntries16
 
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP
+(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -51,10 +52,14 @@ InternalGetPerformanceHobLog (
 {
   EFI_HOB_GUID_TYPE   *GuidHob;
   UINTN   PeiPerformanceSize;
+  UINT16  PeiPerformanceLogEntries;
 
   ASSERT (PeiPerformanceLog != NULL);
   ASSERT (PeiPerformanceIdArray != NULL);
 
+  PeiPerformanceLogEntries = (UINT16) (

Re: [edk2] [PATCH 2/5] OvmfPkg: PlatformPei: enable PCIEXBAR (aka MMCONFIG / ECAM) on Q35

2016-03-07 Thread Brian J. Johnson

On 03/07/2016 03:38 AM, Gerd Hoffmann wrote:

   Hi,


Okay, my vote is 0x8000_ (2GB) then.

I will modify the patch as follows: simultaneously with programming the
exbar at 2GB, I will lower the start of the 32-bit PCI aperture from the
current 3GB (0xC000_) to (2GB+256MB == 0x9000_). Is that alright?


Yes, that should work fine.


FWIW that's how Intel physical servers I've dealt with are arranged: 
2GB of low RAM followed by PCIe space and MMIO.

--

Brian



  "Why do you have to dry clean a raincoat?"
   -- Don Koerkel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2] BaseTools: Update ARM/AArch64 GenFv vector processing for encapsulated FVs

2016-03-07 Thread Gao, Liming
Reviewed-by: Liming Gao 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Cohen, 
Eugene
Sent: Wednesday, March 2, 2016 7:40 AM
To: edk2-devel@lists.01.org; Ard Biesheuvel ; Gao, 
Liming ; Zhu, Yonghong 
Subject: [edk2] [PATCH v2] BaseTools: Update ARM/AArch64 GenFv vector 
processing for encapsulated FVs

(Second revision of patch which adds two missing #defines for ARM instructions)

Instead of only handling SEC Core or PEI Core instances in the outer FV,
the GenFv tool will now recurse into FV image FFS files to look for instances
in encapsulated FVs so the vector area can be updated appropriately.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen 
---
 BaseTools/Source/C/GenFv/GenFvInternalLib.c | 590 +++-
 1 file changed, 403 insertions(+), 187 deletions(-)

diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c 
b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
index 6ab8a24..9dcf9d2 100644
--- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c
+++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
@@ -3,6 +3,7 @@ This file contains the internal functions required to generate 
a Firmware Volume
 
 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
 Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
+Portions Copyright (c) 2016 HP Development Company, L.P.
 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
@@ -38,6 +39,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include "PeCoffLib.h"
 #include "WinNtInclude.h"
 
+#define ARMT_UNCONDITIONAL_JUMP_INSTRUCTION   0xEB00
+#define ARM64_UNCONDITIONAL_JUMP_INSTRUCTION  0x1400
+
 BOOLEAN mArm = FALSE;
 STATIC UINT32   MaxFfsAlignment = 0;
 
@@ -1803,6 +1807,244 @@ Returns:
   return EFI_SUCCESS;
 }
 
+EFI_STATUS
+FindCorePeSection(
+  IN VOID   *FvImageBuffer,
+  IN UINT64 FvSize,
+  IN EFI_FV_FILETYPEFileType,
+  OUT EFI_FILE_SECTION_POINTER  *Pe32Section
+  )
+/*++
+
+Routine Description:
+
+  Recursively searches the FV for the FFS file of specified type (typically
+  SEC or PEI core) and extracts the PE32 section for further processing.
+
+Arguments:
+
+  FvImageBuffer   Buffer containing FV data
+  FvSize  Size of the FV
+  FileTypeType of FFS file to search for
+  Pe32Section PE32 section pointer when FFS file is found.
+
+Returns:
+
+  EFI_SUCCESS Function Completed successfully.
+  EFI_ABORTED Error encountered.
+  EFI_INVALID_PARAMETER   A required parameter was NULL.
+  EFI_NOT_FOUND   Core file not found.
+
+--*/
+{
+  EFI_STATUS  Status;
+  EFI_FIRMWARE_VOLUME_HEADER  *OrigFvHeader;
+  UINT32  OrigFvLength;
+  EFI_FFS_FILE_HEADER *CoreFfsFile;
+  UINTN   FvImageFileCount;
+  EFI_FFS_FILE_HEADER *FvImageFile;
+  UINTN   EncapFvSectionCount;
+  EFI_FILE_SECTION_POINTEREncapFvSection;
+  EFI_FIRMWARE_VOLUME_HEADER  *EncapsulatedFvHeader;
+
+  if (Pe32Section == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  //
+  // Initialize FV library, saving previous values 
+  //
+  OrigFvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)NULL;
+  GetFvHeader (&OrigFvHeader, &OrigFvLength);
+  InitializeFvLib(FvImageBuffer, (UINT32)FvSize);
+
+  //
+  // First see if we can obtain the file directly in outer FV
+  //
+  Status = GetFileByType(FileType, 1, &CoreFfsFile);
+  if (!EFI_ERROR(Status) && (CoreFfsFile != NULL) ) {
+
+//
+// Core found, now find PE32 or TE section
+//
+Status = GetSectionByType(CoreFfsFile, EFI_SECTION_PE32, 1, Pe32Section);
+if (EFI_ERROR(Status)) {
+  Status = GetSectionByType(CoreFfsFile, EFI_SECTION_TE, 1, Pe32Section);
+}
+
+if (EFI_ERROR(Status)) {
+  Error(NULL, 0, 3000, "Invalid", "could not find a PE32 section in the 
core file.");
+  return EFI_ABORTED;
+}
+
+//
+// Core PE/TE section, found, return
+//
+Status = EFI_SUCCESS;
+goto EarlyExit;
+  }
+
+  //
+  // File was not found, look for FV Image file
+  //
+
+  // iterate through all FV image files in outer FV
+  for (FvImageFileCount = 1;; FvImageFileCount++) {
+  
+Status = GetFileByType(EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE, 
FvImageFileCount, &FvImageFile);
+
+if (EFI_ERROR(Status) || (FvImageFile == NULL) ) {
+  // exit FV image file loop, no more found
+  break;
+}
+
+// Found an fv image file, look for an FV image section.  The PI spec does 
not
+// preclude multiple FV image sections so we loop accordingly.
+for (EncapFvSectionCount = 1;; EncapFvSectionCount++) {
+  
+  // Look for the n

Re: [edk2] [PATCH v5] MdeModulePkg: Increase the maximum number of PEI performance log entries

2016-03-07 Thread Zeng, Star

Cinnamon,

Some comments below.

On 2016/3/8 3:38, Cinnamon Shia wrote:

The maximum number of PEI performance log entries is 255.
Add a new PCD, PcdMaxPeiPerformanceLogEntries16, to increase the maximum
number of PEI performance log entries.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia 
Reviewed-by: Samer EL-Haj-Mahmoud 
Reviewed-by: Joseph Shifflett 
Reviewed-by: Michael Kinney 
---
  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c|  5 -
  .../DxeCorePerformanceLib/DxeCorePerformanceLib.inf  |  6 --
  .../Library/PeiPerformanceLib/PeiPerformanceLib.c| 20 +++-
  .../Library/PeiPerformanceLib/PeiPerformanceLib.inf  |  6 --
  MdeModulePkg/MdeModulePkg.dec| 10 ++
  5 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 0eb8e57..9c729e1 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -11,6 +11,7 @@
Performance Protocol is installed at the very beginning of DXE phase.

  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
  This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD 
License
  which accompanies this distribution.  The full text of the license may be 
found at
@@ -522,7 +523,9 @@ DxeCorePerformanceLibConstructor (
);
ASSERT_EFI_ERROR (Status);

-  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8 
(PcdMaxPeiPerformanceLogEntries);
+  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + (UINT16) (PcdGet16 
(PcdMaxPeiPerformanceLogEntries16) != 0 ?
+ PcdGet16 
(PcdMaxPeiPerformanceLogEntries16) != 0 :


It should be *PcdGet16 (PcdMaxPeiPerformanceLogEntries16)*, but not 
*PcdGet16 (PcdMaxPeiPerformanceLogEntries16) != 0*, right?



+ PcdGet8 
(PcdMaxPeiPerformanceLogEntries));

mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof 
(GAUGE_DATA_ENTRY_EX) * mMaxGaugeRecords));
ASSERT (mGaugeData != NULL);
diff --git 
a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
index 5f29063..f73d0a4 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
@@ -10,6 +10,7 @@
  #  Performance and PerformanceEx Protocol are installed at the very beginning 
of DXE phase.
  #
  #  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
  #  This program and the accompanying materials
  #  are licensed and made available under the terms and conditions of the BSD 
License
  #  which accompanies this distribution.  The full text of the license may be 
found at
@@ -66,5 +67,6 @@
gPerformanceExProtocolGuid

  [Pcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries ## CONSUMES
-  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries   ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries16 ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask  ## CONSUMES
diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c 
b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
index 9674bbc..5a3c784 100644
--- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
+++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
@@ -4,10 +4,11 @@
This file implements all APIs in Performance Library class in MdePkg. It 
creates
performance logging GUIDed HOB on the first performance logging and then 
logs the
performance data to the GUIDed HOB. Due to the limitation of temporary RAM, 
the maximum
-  number of performance logging entry is specified by 
PcdMaxPeiPerformanceLogEntries.
+  number of performance logging entry is specified by 
PcdMaxPeiPerformanceLogEntries or
+  PcdMaxPeiPerformanceLogEntries16


Could you leave the "." char at the end of line?



  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP
+(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
  This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD 
License
  which accompanies this distribution.  The full text of the license may be 
found at
@@ -51,10 +52,14 @@ InternalGetPerformanceHobLog 

Re: [edk2] [PATCH] MdeModulePkg AcpiTableDxe: Use Rsdt to check against NULL

2016-03-07 Thread Qiu, Shumin
Reviewed-by: Qiu Shumin 

-Original Message-
From: Zeng, Star 
Sent: Monday, March 07, 2016 3:46 PM
To: edk2-devel@lists.01.org
Cc: Yao, Jiewen; Ard Biesheuvel; Qiu, Shumin; Tian, Feng
Subject: [PATCH] MdeModulePkg AcpiTableDxe: Use Rsdt to check against NULL

Some static scan tool may regard CurrentRsdtEntry to be potentially referenced 
to NULL pointer if CurrentRsdtEntry == NULL is used in the right above if 
condition judgment.

CopyMem (CurrentRsdtEntry, CurrentRsdtEntry + 1, (*NumberOfTableEntries 
- Index) * sizeof (UINT32));

It is introduced by commit f9bbb8d9c3f065faba9f266cf4e731fe2ca70c4d.
To avoid it and have same style with
"((Xsdt == NULL) || CurrentTablePointer64 == (UINT64) (UINTN) Table->Table)", 
use Rsdt instead of CurrentRsdtEntry to check against NULL.

Cc: Jiewen Yao 
Cc: Ard Biesheuvel 
Cc: Shumin Qiu 
Cc: Feng Tian 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c 
b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
index f6229ca..7f95b9d 100644
--- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
+++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
@@ -1,7 +1,7 @@
 /** @file
   ACPI Table Protocol Implementation
 
-  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights 
+ reserved.
   Copyright (c) 2016, Linaro Ltd. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License @@ -1132,7 +1132,7 @@ RemoveTableFromRsdt (
 //
 // Check if we have found the corresponding entry in both RSDT and XSDT
 //
-if ((CurrentRsdtEntry == NULL || *CurrentRsdtEntry == (UINT32) (UINTN) 
Table->Table) &&
+if (((Rsdt == NULL) || *CurrentRsdtEntry == (UINT32) (UINTN) 
+ Table->Table) &&
 ((Xsdt == NULL) || CurrentTablePointer64 == (UINT64) (UINTN) 
Table->Table)
 ) {
   //
--
2.7.0.windows.1

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


[edk2] [PATCH v5] MdePkg: Add UEFI2.6 HII Image Ex and Image Decoder protocol definition.

2016-03-07 Thread Cecil Sheng
Add the definition for the new UEFI 2.6 EFI_HII_IMAGE_EX_PROTOCOL and 
EFI_IMAGE_DECODER_PROTOCOL.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cecil Sheng 
Reviewed-by: Samer El-Haj-Mahmoud 
Reviewed-by: Abner Chang 
---
 MdePkg/Include/Protocol/HiiImageEx.h   | 245 +
 MdePkg/Include/Protocol/ImageDecoder.h | 192 ++
 MdePkg/MdePkg.dec  |  13 ++
 3 files changed, 450 insertions(+)
 create mode 100644 MdePkg/Include/Protocol/HiiImageEx.h
 create mode 100644 MdePkg/Include/Protocol/ImageDecoder.h

diff --git a/MdePkg/Include/Protocol/HiiImageEx.h 
b/MdePkg/Include/Protocol/HiiImageEx.h
new file mode 100644
index 000..9393a53
--- /dev/null
+++ b/MdePkg/Include/Protocol/HiiImageEx.h
@@ -0,0 +1,245 @@
+/** @file
+  Protocol which allows access to the images in the images database.
+
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
+
+This program and the accompanying materials are licensed and made available 
under
+the terms and conditions of the BSD License that 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.
+
+**/
+
+#ifndef EFI_HII_IMAGE_EX_H
+#define EFI_HII_IMAGE_EX_H
+
+#include 
+
+//
+// Global ID for the Hii Image Ex Protocol.
+//
+#define EFI_HII_IMAGE_EX_PROTOCOL_GUID \
+  {0x1a1241e6, 0x8f19, 0x41a9,  { 0xbc, 0xe, 0xe8, 0xef, 0x39, 0xe0, 0x65, 
0x46 }}
+
+typedef struct _EFI_HII_IMAGE_EX_PROTOCOL EFI_HII_IMAGE_EX_PROTOCOL;
+
+/**
+  The prototype of this extension function is the same with 
EFI_HII_IMAGE_PROTOCOL.NewImage().
+  Same with EFI_HII_IMAGE_PROTOCOL.NewImage().This protocol invokes
+EFI_HII_IMAGE_PROTOCOL.NewImage() implicitly.
+
+  @param  This   A pointer to the EFI_HII_IMAGE_EX_PROTOCOL 
instance.
+  @param  PackageListHandle of the package list where this image 
will
+ be added.
+  @param  ImageIdOn return, contains the new image id, which is
+ unique within PackageList.
+  @param  Image  Points to the image.
+
+  @retval EFI_SUCCESSThe new image was added successfully.
+  @retval EFI_NOT_FOUND  The specified PackageList could not be found 
in
+ database.
+  @retval EFI_OUT_OF_RESOURCES   Could not add the image due to lack of 
resources.
+  @retval EFI_INVALID_PARAMETER  Image is NULL or ImageId is NULL.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_NEW_IMAGE_EX)(
+  IN CONST  EFI_HII_IMAGE_EX_PROTOCOL  *This,
+  INEFI_HII_HANDLE  PackageList,
+  OUT   EFI_IMAGE_ID*ImageId,
+  IN CONST  EFI_IMAGE_INPUT *Image
+  );
+
+/**
+  Return the information about the image, associated with the package list. 
+  The prototype of this extension function is the same with 
EFI_HII_IMAGE_PROTOCOL.GetImage(). 
+  Same with EFI_HII_IMAGE_PROTOCOL.SetImage(),this protocol invokes 
EFI_HII_IMAGE_PROTOCOL.SetImage() implicitly.
+
+  @param  This   A pointer to the EFI_HII_IMAGE_EX_PROTOCOL 
instance.
+  @param  PackageListHandle of the package list where this image 
will
+ be searched.
+  @param  ImageIdThe image's id,, which is unique within
+ PackageList.
+  @param  Image  Points to the image.
+
+  @retval EFI_SUCCESSThe new image was returned successfully.
+  @retval EFI_NOT_FOUND  The image specified by ImageId is not in the
+ database. The specified PackageList is not in 
+ the database.
+  @retval EFI_BUFFER_TOO_SMALL   The buffer specified by ImageSize is too 
small to
+ hold the image.
+  @retval EFI_INVALID_PARAMETER  The Image or ImageSize was NULL.
+  @retval EFI_OUT_OF_RESOURCES   The bitmap could not be retrieved because 
there 
+ was not enough memory.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_GET_IMAGE_EX)(
+  IN CONST  EFI_HII_IMAGE_EX_PROTOCOL   *This,
+  INEFI_HII_HANDLE  PackageList,
+  INEFI_IMAGE_IDImageId,
+  OUT   EFI_IMAGE_INPUT *Image
+  );
+
+/**
+  Change the information about the image. The prototype of this extension 
+  function is the same with EFI_HII_IMAGE_PROTOCOL.SetImage().  Same with 
+  EFI_HII_IMAGE_PROTOCOL.DrawImageId(),this protocol invokes 
EFI_HII_IMAGE_PROTOCOL.DrawImageId() implicitly.
+
+  @param  This   A pointer to the EFI_HII_IMAGE_EX_PROTOCOL 
instance.
+  @param  PackageListThe package list containing the image

[edk2] [PATCH] ShellPkg: Per UEFI Shell 2.2 SPEC to make Shell supports 'NoNesting'.

2016-03-07 Thread Qiu Shumin
This patch makes Shell support -nonesting invocation option. This option
specifies that EFI_SHELL_PROTOCOL.Execute API nesting of a new Shell
instance is optional and dependent on the 'nonesting' Shell environment
variable.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey 
Reviewed-by: Qiu Shumin 
---
 ShellPkg/Application/Shell/Shell.c |  41 -
 ShellPkg/Application/Shell/Shell.h |   6 +-
 ShellPkg/Application/Shell/ShellProtocol.c | 139 -
 3 files changed, 161 insertions(+), 25 deletions(-)

diff --git a/ShellPkg/Application/Shell/Shell.c 
b/ShellPkg/Application/Shell/Shell.c
index 40ae68d..bd695a4 100644
--- a/ShellPkg/Application/Shell/Shell.c
+++ b/ShellPkg/Application/Shell/Shell.c
@@ -1,7 +1,7 @@
 /** @file
   This is THE shell (application)
 
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
   (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
@@ -33,6 +33,7 @@ SHELL_INFO ShellInfoObject = {
   0,
   0,
   0,
+  0,
   0
 }},
 0,
@@ -69,6 +70,9 @@ SHELL_INFO ShellInfoObject = {
 STATIC CONST CHAR16 mScriptExtension[]  = L".NSH";
 STATIC CONST CHAR16 mExecutableExtensions[] = L".NSH;.EFI";
 STATIC CONST CHAR16 mStartupScript[]= L"startup.nsh";
+CONST CHAR16 mNoNestingEnvVarName[] = L"nonesting";
+CONST CHAR16 mNoNestingTrue[]   = L"True";
+CONST CHAR16 mNoNestingFalse[]  = L"False";
 
 /**
   Cleans off leading and trailing spaces and tabs.
@@ -457,6 +461,29 @@ UefiMain (
 }
 
 //
+// Set the environment variable for nesting support
+//
+Size = 0;
+TempString = NULL;
+if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest) {
+  //
+  // No change.  require nesting in Shell Protocol Execute()
+  //
+  StrnCatGrow(&TempString,
+  &Size,
+  L"False",
+  0);
+} else {
+  StrnCatGrow(&TempString,
+  &Size,
+  mNoNestingTrue,
+  0);
+}
+Status = InternalEfiShellSetEnv(mNoNestingEnvVarName, TempString, TRUE);
+SHELL_FREE_NON_NULL(TempString);
+Size = 0;
+
+//
 // save the device path for the loaded image and the device path for the 
filepath (under loaded image)
 // These are where to look for the startup.nsh file
 //
@@ -891,6 +918,7 @@ ProcessCommandLine(
   ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoVersion= FALSE;
   ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay= FALSE;
   ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit = FALSE;
+  ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest   = FALSE;
   ShellInfoObject.ShellInitSettings.Delay = 5;
 
   //
@@ -952,6 +980,13 @@ ProcessCommandLine(
 }
 else if (UnicodeCollation->StriColl (
  UnicodeCollation,
+ L"-nonest",
+ CurrentArg
+ ) == 0) {
+  ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest   = TRUE;
+}
+else if (UnicodeCollation->StriColl (
+ UnicodeCollation,
  L"-delay",
  CurrentArg
  ) == 0) {
@@ -1324,7 +1359,7 @@ AddLineToCommandHistory(
   BUFFER_LIST *Walker;
   UINT16   MaxHistoryCmdCount;
   UINT16   Count;
-  
+
   Count = 0;
   MaxHistoryCmdCount = PcdGet16(PcdShellMaxHistoryCommandCount);
   
@@ -2452,7 +2487,7 @@ SetupAndRunCommandOrFile(
   IN   CHAR16 *CmdLine,
   IN   CHAR16 *FirstParameter,
   IN   EFI_SHELL_PARAMETERS_PROTOCOL  *ParamProtocol,
-  OUT EFI_STATUS*CommandStatus
+  OUT EFI_STATUS  *CommandStatus
 )
 {
   EFI_STATUSStatus;
diff --git a/ShellPkg/Application/Shell/Shell.h 
b/ShellPkg/Application/Shell/Shell.h
index a1b7276..a8c64e7 100644
--- a/ShellPkg/Application/Shell/Shell.h
+++ b/ShellPkg/Application/Shell/Shell.h
@@ -58,6 +58,9 @@
 #include "ConsoleWrappers.h"
 #include "FileHandleWrappers.h"
 
+extern CONST CHAR16 mNoNestingEnvVarName[];
+extern CONST CHAR16 mNoNestingTrue[];
+
 typedef struct {
   LIST_ENTRYLink;   ///< Standard linked list handler.
   SHELL_FILE_HANDLE *SplitStdOut;   ///< ConsoleOut for use in the split.
@@ -73,7 +76,8 @@ typedef struct {
   UINT32  NoMap:1;///< Was "-nomap" found on command line.
   UINT32  NoVersion:1;///< Was "-noversion" found on command line.
   UINT32  Delay:1;///< Was "-delay[:n]  found on command line
-  UINT32  Exi

[edk2] [PATCH 2/3] BaseTools ConvertMasmToNasm: Fix exception when no arguments are given

2016-03-07 Thread Jordan Justen
Convert to use the argparse library rather than optparse.

As part of the conversion, the script will now give an error message
if no arguments are given. Previously the script would give an
exception when no arguments were given.

Fixes: https://github.com/tianocore/edk2/issues/65
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Yonghong Zhu 
Cc: Liming Gao 
---
 BaseTools/Scripts/ConvertMasmToNasm.py | 85 +++---
 1 file changed, 37 insertions(+), 48 deletions(-)

diff --git a/BaseTools/Scripts/ConvertMasmToNasm.py 
b/BaseTools/Scripts/ConvertMasmToNasm.py
index 2f0dd4f..8288972 100755
--- a/BaseTools/Scripts/ConvertMasmToNasm.py
+++ b/BaseTools/Scripts/ConvertMasmToNasm.py
@@ -15,12 +15,12 @@
 #
 # Import Modules
 #
+import argparse
 import os.path
 import re
 import StringIO
 import subprocess
 import sys
-from optparse import OptionParser
 
 
 class UnsupportedConversion(Exception):
@@ -45,20 +45,20 @@ class CommonUtils:
 
 def __init__(self, clone=None):
 if clone is None:
-(self.Opt, self.Args) = self.ProcessCommandLine()
+self.args = self.ProcessCommandLine()
 else:
-(self.Opt, self.Args) = (clone.Opt, clone.Args)
+self.args = clone.args
 
 self.unsupportedSyntaxSeen = False
-self.src = self.Args[0]
+self.src = self.args.source
 assert(os.path.exists(self.src))
 self.dirmode = os.path.isdir(self.src)
 srcExt = os.path.splitext(self.src)[1]
 assert (self.dirmode or srcExt != '.nasm')
 self.infmode = not self.dirmode and srcExt == '.inf'
-self.diff = self.Opt.diff
-self.git = self.Opt.git
-self.force = self.Opt.force
+self.diff = self.args.diff
+self.git = self.args.git
+self.force = self.args.force
 
 if clone is None:
 self.rootdir = os.getcwd()
@@ -69,27 +69,22 @@ class CommonUtils:
 self.gitemail = clone.gitemail
 
 def ProcessCommandLine(self):
-Parser = OptionParser(description=self.__copyright__,
-  version=self.__version__,
-  prog=sys.argv[0],
-  usage=self.__usage__
-  )
-Parser.add_option("-q", "--quiet", action="store_true", type=None,
-  help="Disable all messages except FATAL ERRORS.")
-Parser.add_option("--git", action="store_true", type=None,
-  help="Use git to create commits for each file 
converted")
-Parser.add_option("--diff", action="store_true", type=None,
-  help="Show diff of conversion")
-Parser.add_option("-f", "--force", action="store_true", type=None,
-  help="Force conversion even if unsupported")
-
-(Opt, Args) = Parser.parse_args()
-
-if not Opt.quiet:
-print self.__copyright__
-Parser.print_version()
-
-return (Opt, Args)
+parser = argparse.ArgumentParser(description=self.__copyright__)
+parser.add_argument('--version', action='version',
+version='%(prog)s ' + self.VersionNumber)
+parser.add_argument("-q", "--quiet", action="store_true",
+help="Disable all messages except FATAL ERRORS.")
+parser.add_argument("--git", action="store_true",
+help="Use git to create commits for each file 
converted")
+parser.add_argument("--diff", action="store_true",
+help="Show diff of conversion")
+parser.add_argument("-f", "--force", action="store_true",
+help="Force conversion even if unsupported")
+parser.add_argument('source', help='MASM input file')
+parser.add_argument('dest', nargs='?',
+help='NASM output file (default=input.nasm; - for 
stdout)')
+
+return parser.parse_args()
 
 def RootRelative(self, path):
 result = path
@@ -185,7 +180,7 @@ class CommonUtils:
 if not self.git or not self.gitdir:
 return
 
-if not self.Opt.quiet:
+if not self.args.quiet:
 print 'Committing: Conversion of', dst
 
 prefix = ' '.join(filter(lambda a: a, [pkg, module]))
@@ -235,7 +230,7 @@ class ConvertAsmFile(CommonUtils):
 self.output = sys.stdout
 else:
 self.output = StringIO.StringIO()
-if not self.Opt.quiet:
+if not self.args.quiet:
 dirpath, src = os.path.split(self.inputFilename)
 dirpath = self.RootRelative(dirpath)
 dst = os.path.basename(self.outputFilename)
@@ -811,11 +806,11 @@ class ConvertInfFile(CommonUtils):
 self.UpdateInfAsmFile(dst)
 didSomething = True
 except UnsupportedConversio

[edk2] [PATCH 3/3] BaseTools ConvertMasmToNasm: Support Python 3

2016-03-07 Thread Jordan Justen
The script is updated to support both python 2.7 and python 3.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Yonghong Zhu 
Cc: Liming Gao 
Cc: Erik Bjorge 
---
 BaseTools/Scripts/ConvertMasmToNasm.py | 87 ++
 1 file changed, 46 insertions(+), 41 deletions(-)

diff --git a/BaseTools/Scripts/ConvertMasmToNasm.py 
b/BaseTools/Scripts/ConvertMasmToNasm.py
index 8288972..98e1fac 100755
--- a/BaseTools/Scripts/ConvertMasmToNasm.py
+++ b/BaseTools/Scripts/ConvertMasmToNasm.py
@@ -12,15 +12,18 @@
 #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
 #
 
+from __future__ import print_function
+
 #
 # Import Modules
 #
 import argparse
+import io
 import os.path
 import re
-import StringIO
 import subprocess
 import sys
+from io import open
 
 
 class UnsupportedConversion(Exception):
@@ -152,12 +155,12 @@ class CommonUtils:
 (stdout, stderr) = p.communicate(pipeIn)
 if checkExitCode:
 if p.returncode != 0:
-print 'command:', ' '.join(cmd)
-print 'stdout:', stdout
-print 'stderr:', stderr
-print 'return:', p.returncode
+print('command:', ' '.join(cmd))
+print('stdout:', stdout)
+print('stderr:', stderr)
+print('return:', p.returncode)
 assert p.returncode == 0
-return stdout
+return stdout.decode('utf-8', 'ignore')
 
 def FileUpdated(self, path):
 if not self.git or not self.gitdir:
@@ -181,7 +184,7 @@ class CommonUtils:
 return
 
 if not self.args.quiet:
-print 'Committing: Conversion of', dst
+print('Committing: Conversion of', dst)
 
 prefix = ' '.join(filter(lambda a: a, [pkg, module]))
 message = ''
@@ -195,6 +198,7 @@ class CommonUtils:
 message += 'Contributed-under: TianoCore Contribution Agreement 1.0\n'
 assert(self.gitemail is not None)
 message += 'Signed-off-by: %s\n' % self.gitemail
+message = message.encode('utf-8', 'ignore')
 
 cmd = ('git', 'commit', '-F', '-')
 self.RunAndCaptureOutput(cmd, pipeIn=message)
@@ -226,21 +230,20 @@ class ConvertAsmFile(CommonUtils):
 
 self.inputFileBase = os.path.basename(self.inputFilename)
 self.outputFileBase = os.path.basename(self.outputFilename)
-if self.outputFilename == '-' and not self.diff:
-self.output = sys.stdout
-else:
-self.output = StringIO.StringIO()
+self.output = io.BytesIO()
 if not self.args.quiet:
 dirpath, src = os.path.split(self.inputFilename)
 dirpath = self.RootRelative(dirpath)
 dst = os.path.basename(self.outputFilename)
-print 'Converting:', dirpath, src, '->', dst
+print('Converting:', dirpath, src, '->', dst)
 lines = open(self.inputFilename).readlines()
 self.Convert(lines)
-if self.outputFilename == '-':
-if self.diff:
-sys.stdout.write(self.output.getvalue())
-self.output.close()
+if self.outputFilename == '-' and not self.diff:
+output_data = self.output.getvalue()
+if sys.version_info >= (3, 0):
+output_data = output_data.decode('utf-8', 'ignore')
+sys.stdout.write(output_data)
+self.output.close()
 else:
 f = open(self.outputFilename, 'wb')
 f.write(self.output.getvalue())
@@ -521,18 +524,18 @@ class ConvertAsmFile(CommonUtils):
 return '.%d' % count
 
 def EmitString(self, string):
-self.output.write(string)
+self.output.write(string.encode('utf-8', 'ignore'))
 
 def EmitLineWithDiff(self, old, new):
 newLine = (self.indent + new).rstrip()
 if self.diff:
 if old is None:
-print '+%s' % newLine
+print('+%s' % newLine)
 elif newLine != old:
-print '-%s' % old
-print '+%s' % newLine
+print('-%s' % old)
+print('+%s' % newLine)
 else:
-print '', newLine
+print('', newLine)
 if newLine != '':
 self.newAsmEmptyLineCount = 0
 self.EmitString(newLine + '\r\n')
@@ -565,7 +568,7 @@ class ConvertAsmFile(CommonUtils):
 if emitNewLine:
 self.EmitLine(newLine.rstrip())
 elif self.diff:
-print '-%s' % self.originalLine
+print('-%s' % self.originalLine)
 
 leaRe = re.compile(r'''
(lea \s+) ([\w@][\w@0-9]*) \s* , \s* (\S (?:.*\S)?)
@@ -759,7 +762,7 @@ class ConvertInfFile(CommonUtils):
 def ScanInfAsmFiles(self):
 src = self.inf
 assert os.path.isfile(src)
-f = open(src)
+f = open(src, 'rt')
 

[edk2] [PATCH 1/3] BaseTools ConvertMasmToNasm: Set gitemail when git is not found

2016-03-07 Thread Jordan Justen
Fixes: https://github.com/tianocore/edk2/issues/63
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Yonghong Zhu 
Cc: Liming Gao 
Cc: Michael Kinney 
---
 BaseTools/Scripts/ConvertMasmToNasm.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/ConvertMasmToNasm.py 
b/BaseTools/Scripts/ConvertMasmToNasm.py
index 7ad0bd2..2f0dd4f 100755
--- a/BaseTools/Scripts/ConvertMasmToNasm.py
+++ b/BaseTools/Scripts/ConvertMasmToNasm.py
@@ -1,7 +1,7 @@
 # @file ConvertMasmToNasm.py
 # This script assists with conversion of MASM assembly syntax to NASM
 #
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -127,6 +127,7 @@ class CommonUtils:
 while True:
 path = os.path.split(lastpath)[0]
 if path == lastpath:
+self.gitemail = None
 return
 candidate = os.path.join(path, '.git')
 if os.path.isdir(candidate):
@@ -197,6 +198,7 @@ class CommonUtils:
 message += '%s to %s\n' % (src, dst)
 message += '\n'
 message += 'Contributed-under: TianoCore Contribution Agreement 1.0\n'
+assert(self.gitemail is not None)
 message += 'Signed-off-by: %s\n' % self.gitemail
 
 cmd = ('git', 'commit', '-F', '-')
-- 
2.7.0

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


[edk2] [PATCH 2/2] OvmfPkg PciHostBridgeDxe: Convert X64/IoFifo.asm to NASM

2016-03-07 Thread Jordan Justen
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/IoFifo.asm to X64/IoFifo.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Laszlo Ersek 
---
 OvmfPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf  |   3 +-
 OvmfPkg/PciHostBridgeDxe/X64/IoFifo.S  | 122 -
 .../X64/{IoFifo.asm => IoFifo.nasm}|  29 +++--
 3 files changed, 15 insertions(+), 139 deletions(-)
 delete mode 100644 OvmfPkg/PciHostBridgeDxe/X64/IoFifo.S
 rename OvmfPkg/PciHostBridgeDxe/X64/{IoFifo.asm => IoFifo.nasm} (89%)

diff --git a/OvmfPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf 
b/OvmfPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
index 5ef1ef6..edf1657 100644
--- a/OvmfPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
+++ b/OvmfPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
@@ -52,8 +52,7 @@
   Ia32/IoFifo.nasm
 
 [Sources.X64]
-  X64/IoFifo.asm
-  X64/IoFifo.S
+  X64/IoFifo.nasm
 
 [Protocols]
   gEfiPciHostBridgeResourceAllocationProtocolGuid   ## PRODUCES
diff --git a/OvmfPkg/PciHostBridgeDxe/X64/IoFifo.S 
b/OvmfPkg/PciHostBridgeDxe/X64/IoFifo.S
deleted file mode 100644
index decb382..000
--- a/OvmfPkg/PciHostBridgeDxe/X64/IoFifo.S
+++ /dev/null
@@ -1,122 +0,0 @@
-#--
-#
-# Copyright (c) 2006 - 2012, 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.
-#
-#--
-
-#--
-#  VOID
-#  EFIAPI
-#  IoReadFifo8 (
-#IN UINTN  Port,  // rcx
-#IN UINTN  Count, // rdx
-#IN VOID   *Buffer// r8
-#);
-#--
-ASM_GLOBAL ASM_PFX(IoReadFifo8)
-ASM_PFX(IoReadFifo8):
-cld
-xchg%rcx, %rdx
-xchg%r8, %rdi   # rdi: buffer address; r8: save register
-rep insb
-mov %r8, %rdi   # restore rdi
-ret
-
-#--
-#  VOID
-#  EFIAPI
-#  IoReadFifo16 (
-#IN UINTN  Port,  // rcx
-#IN UINTN  Count, // rdx
-#IN VOID   *Buffer// r8
-#);
-#--
-ASM_GLOBAL ASM_PFX(IoReadFifo16)
-ASM_PFX(IoReadFifo16):
-cld
-xchg%rcx, %rdx
-xchg%r8, %rdi   # rdi: buffer address; r8: save register
-rep insw
-mov %r8, %rdi   # restore rdi
-ret
-
-#--
-#  VOID
-#  EFIAPI
-#  IoReadFifo32 (
-#IN UINTN  Port,  // rcx
-#IN UINTN  Count, // rdx
-#IN VOID   *Buffer// r8
-#);
-#--
-ASM_GLOBAL ASM_PFX(IoReadFifo32)
-ASM_PFX(IoReadFifo32):
-cld
-xchg%rcx, %rdx
-xchg%r8, %rdi   # rdi: buffer address; r8: save register
-rep insl
-mov %r8, %rdi   # restore rdi
-ret
-
-#--
-#  VOID
-#  EFIAPI
-#  IoWriteFifo8 (
-#IN UINTN  Port,  // rcx
-#IN UINTN  Count, // rdx
-#IN VOID   *Buffer// r8
-#);
-#--
-ASM_GLOBAL ASM_PFX(IoWriteFifo8)
-ASM_PFX(IoWriteFifo8):
-cld
-xchg%rcx, %rdx
-xchg%r8, %rsi   # rsi: buffer address; r8: save register
-rep outsb
-mov %r8, %rsi   # restore rsi
-ret
-
-#--
-#  VOID
-#  EFIAPI
-#  IoWriteFifo16 (
-#IN UINTN  Port,  // rcx
-#IN UINTN  Count, // rdx
-#IN VOID   *Buffer// r8
-#);
-#--
-ASM_GLOBAL ASM_PFX(IoWriteFifo16)
-ASM_PFX(IoWriteFifo16):
-cld
-xchg%rcx, %rdx
-xchg%r8, %rsi   # rsi: buffer address; r8: save register
-rep outsw
-mov %r8, %rsi   # restore rsi
-ret

[edk2] [PATCH 1/2] OvmfPkg PciHostBridgeDxe: Convert Ia32/IoFifo.asm to NASM

2016-03-07 Thread Jordan Justen
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
Ia32/IoFifo.asm to Ia32/IoFifo.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Laszlo Ersek 
---
 OvmfPkg/PciHostBridgeDxe/Ia32/IoFifo.S | 134 -
 .../Ia32/{IoFifo.asm => IoFifo.nasm}   |  30 ++---
 OvmfPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf  |   3 +-
 3 files changed, 14 insertions(+), 153 deletions(-)
 delete mode 100644 OvmfPkg/PciHostBridgeDxe/Ia32/IoFifo.S
 rename OvmfPkg/PciHostBridgeDxe/Ia32/{IoFifo.asm => IoFifo.nasm} (87%)

diff --git a/OvmfPkg/PciHostBridgeDxe/Ia32/IoFifo.S 
b/OvmfPkg/PciHostBridgeDxe/Ia32/IoFifo.S
deleted file mode 100644
index 03a014d..000
--- a/OvmfPkg/PciHostBridgeDxe/Ia32/IoFifo.S
+++ /dev/null
@@ -1,134 +0,0 @@
-#--
-#
-# Copyright (c) 2006 - 2012, 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.
-#
-#--
-
-#--
-#  VOID
-#  EFIAPI
-#  IoReadFifo8 (
-#IN UINTN  Port,
-#IN UINTN  Count,
-#IN VOID   *Buffer
-#);
-#--
-ASM_GLOBAL ASM_PFX(IoReadFifo8)
-ASM_PFX(IoReadFifo8):
-push%edi
-cld
-movw8(%esp), %dx
-mov 12(%esp), %ecx
-mov 16(%esp), %edi
-rep insb
-pop %edi
-ret
-
-#--
-#  VOID
-#  EFIAPI
-#  IoReadFifo16 (
-#IN UINTN  Port,
-#IN UINTN  Count,
-#IN VOID   *Buffer
-#);
-#--
-ASM_GLOBAL ASM_PFX(IoReadFifo16)
-ASM_PFX(IoReadFifo16):
-push%edi
-cld
-movw8(%esp), %dx
-mov 12(%esp), %ecx
-mov 16(%esp), %edi
-rep insw
-pop %edi
-ret
-
-#--
-#  VOID
-#  EFIAPI
-#  IoReadFifo32 (
-#IN UINTN  Port,
-#IN UINTN  Count,
-#IN VOID   *Buffer
-#);
-#--
-ASM_GLOBAL ASM_PFX(IoReadFifo32)
-ASM_PFX(IoReadFifo32):
-push%edi
-cld
-movw8(%esp), %dx
-mov 12(%esp), %ecx
-mov 16(%esp), %edi
-rep insl
-pop %edi
-ret
-
-#--
-#  VOID
-#  EFIAPI
-#  IoWriteFifo8 (
-#IN UINTN  Port,
-#IN UINTN  Count,
-#IN VOID   *Buffer
-#);
-#--
-ASM_GLOBAL ASM_PFX(IoWriteFifo8)
-ASM_PFX(IoWriteFifo8):
-push%esi
-cld
-movw8(%esp), %dx
-mov 12(%esp), %ecx
-mov 16(%esp), %esi
-rep outsb
-pop %esi
-ret
-
-#--
-#  VOID
-#  EFIAPI
-#  IoWriteFifo16 (
-#IN UINTN  Port,
-#IN UINTN  Count,
-#IN VOID   *Buffer
-#);
-#--
-ASM_GLOBAL ASM_PFX(IoWriteFifo16)
-ASM_PFX(IoWriteFifo16):
-push%esi
-cld
-movw8(%esp), %dx
-mov 12(%esp), %ecx
-mov 16(%esp), %esi
-rep outsw
-pop %esi
-ret
-
-#--
-#  VOID
-#  EFIAPI
-#  IoWriteFifo32 (
-#IN UINTN  Port,
-#IN UINTN  Count,
-#IN VOID   *Buffer
-#);
-#--
-ASM_GLOBAL ASM_PFX(IoWriteFifo32)
-ASM_PFX(IoWriteFifo32):
-push%esi
-cld
-movw8(%esp), %dx
-mov 12(%esp), %ecx
-mov 16(%esp), %esi
-rep outsl
-pop %esi
-ret
-
diff --git a/OvmfPkg/PciHostBridgeDxe/Ia32/IoFifo.asm 
b/OvmfPkg/PciHostBridgeDxe/Ia32/IoFifo.nasm
similarity index 87%
rename from OvmfPkg/PciHostBridgeDxe/Ia32/IoFifo.asm
rename to OvmfPkg/PciHostBridgeDxe/Ia32/IoFifo.nasm
index b1cc25e..daa90a9 100644
--- a/OvmfPkg/PciHostBridgeDxe/Ia32/IoFifo.asm

[edk2] [PATCH v6] MdeModulePkg: Increase the maximum number of PEI performance log entries

2016-03-07 Thread Cinnamon Shia
The maximum number of PEI performance log entries is 255.
Add a new PCD, PcdMaxPeiPerformanceLogEntries16, to increase the maximum
number of PEI performance log entries.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia 
Reviewed-by: Samer EL-Haj-Mahmoud 
Reviewed-by: Joseph Shifflett 
Reviewed-by: Michael Kinney 
---
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.c|  5 -
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.inf  |  6 --
 .../Library/PeiPerformanceLib/PeiPerformanceLib.c| 20 +++-
 .../Library/PeiPerformanceLib/PeiPerformanceLib.inf  |  6 --
 MdeModulePkg/MdeModulePkg.dec| 10 ++
 5 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 0eb8e57..c3a6d70 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -11,6 +11,7 @@
   Performance Protocol is installed at the very beginning of DXE phase.
 
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -522,7 +523,9 @@ DxeCorePerformanceLibConstructor (
   );
   ASSERT_EFI_ERROR (Status);
 
-  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8 
(PcdMaxPeiPerformanceLogEntries);
+  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + (UINT16) (PcdGet16 
(PcdMaxPeiPerformanceLogEntries16) != 0 ?
+ PcdGet16 
(PcdMaxPeiPerformanceLogEntries16) :
+ PcdGet8 
(PcdMaxPeiPerformanceLogEntries));
 
   mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof 
(GAUGE_DATA_ENTRY_EX) * mMaxGaugeRecords));
   ASSERT (mGaugeData != NULL);
diff --git 
a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
index 5f29063..f73d0a4 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
@@ -10,6 +10,7 @@
 #  Performance and PerformanceEx Protocol are installed at the very beginning 
of DXE phase.
 #  
 #  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
 #  which accompanies this distribution.  The full text of the license may be 
found at
@@ -66,5 +67,6 @@
   gPerformanceExProtocolGuid
 
 [Pcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries ## CONSUMES
-  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries   ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries16 ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask  ## CONSUMES
diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c 
b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
index 9674bbc..b3b11b9 100644
--- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
+++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
@@ -4,10 +4,11 @@
   This file implements all APIs in Performance Library class in MdePkg. It 
creates
   performance logging GUIDed HOB on the first performance logging and then 
logs the
   performance data to the GUIDed HOB. Due to the limitation of temporary RAM, 
the maximum
-  number of performance logging entry is specified by 
PcdMaxPeiPerformanceLogEntries.  
+  number of performance logging entry is specified by 
PcdMaxPeiPerformanceLogEntries or 
+  PcdMaxPeiPerformanceLogEntries16.
 
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP
+(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -51,10 +52,14 @@ InternalGetPerformanceHobLog (
 {
   EFI_HOB_GUID_TYPE   *GuidHob;
   UINTN   PeiPerformanceSize;
+  UINT16  PeiPerformanceLogEntries;
 
   ASSERT (PeiPerformanceLog != NULL);
   ASSERT (PeiPerformanceIdArray != NULL);
 
+  PeiPerformanceLogEntries = (UINT16) (PcdG

Re: [edk2] [PATCH v6] MdeModulePkg: Increase the maximum number of PEI performance log entries

2016-03-07 Thread Zeng, Star

Reviewed-by: Star Zeng 

On 2016/3/8 14:00, Cinnamon Shia wrote:

The maximum number of PEI performance log entries is 255.
Add a new PCD, PcdMaxPeiPerformanceLogEntries16, to increase the maximum
number of PEI performance log entries.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia 
Reviewed-by: Samer EL-Haj-Mahmoud 
Reviewed-by: Joseph Shifflett 
Reviewed-by: Michael Kinney 
---
  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c|  5 -
  .../DxeCorePerformanceLib/DxeCorePerformanceLib.inf  |  6 --
  .../Library/PeiPerformanceLib/PeiPerformanceLib.c| 20 +++-
  .../Library/PeiPerformanceLib/PeiPerformanceLib.inf  |  6 --
  MdeModulePkg/MdeModulePkg.dec| 10 ++
  5 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 0eb8e57..c3a6d70 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -11,6 +11,7 @@
Performance Protocol is installed at the very beginning of DXE phase.

  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
  This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD 
License
  which accompanies this distribution.  The full text of the license may be 
found at
@@ -522,7 +523,9 @@ DxeCorePerformanceLibConstructor (
);
ASSERT_EFI_ERROR (Status);

-  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8 
(PcdMaxPeiPerformanceLogEntries);
+  mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + (UINT16) (PcdGet16 
(PcdMaxPeiPerformanceLogEntries16) != 0 ?
+ PcdGet16 
(PcdMaxPeiPerformanceLogEntries16) :
+ PcdGet8 
(PcdMaxPeiPerformanceLogEntries));

mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof 
(GAUGE_DATA_ENTRY_EX) * mMaxGaugeRecords));
ASSERT (mGaugeData != NULL);
diff --git 
a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
index 5f29063..f73d0a4 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
@@ -10,6 +10,7 @@
  #  Performance and PerformanceEx Protocol are installed at the very beginning 
of DXE phase.
  #
  #  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
  #  This program and the accompanying materials
  #  are licensed and made available under the terms and conditions of the BSD 
License
  #  which accompanies this distribution.  The full text of the license may be 
found at
@@ -66,5 +67,6 @@
gPerformanceExProtocolGuid

  [Pcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries ## CONSUMES
-  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries   ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries16 ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask  ## CONSUMES
diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c 
b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
index 9674bbc..b3b11b9 100644
--- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
+++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
@@ -4,10 +4,11 @@
This file implements all APIs in Performance Library class in MdePkg. It 
creates
performance logging GUIDed HOB on the first performance logging and then 
logs the
performance data to the GUIDed HOB. Due to the limitation of temporary RAM, 
the maximum
-  number of performance logging entry is specified by 
PcdMaxPeiPerformanceLogEntries.
+  number of performance logging entry is specified by 
PcdMaxPeiPerformanceLogEntries or
+  PcdMaxPeiPerformanceLogEntries16.

  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP
+(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
  This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD 
License
  which accompanies this distribution.  The full text of the license may be 
found at
@@ -51,10 +52,14 @@ InternalGetPerformanceHobLog (
  {
EFI_HOB_GUID_TYPE   *GuidHob;
UINTN   PeiPerformanceSize;
+  UINT16  PeiPerformanceLogEntries;

ASSERT (PeiPerformanceLog != NULL);

Re: [edk2] [PATCH v5] MdePkg: Add UEFI2.6 HII Image Ex and Image Decoder protocol definition.

2016-03-07 Thread Dong, Eric
Hi Cecil,

The gEfiImageDecoderProtocolGuid value in the .h file is not consistent with 
the value in the dec file. Please correct it.

Thanks,
Eric
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Cecil 
> Sheng
> Sent: Tuesday, March 08, 2016 10:33 AM
> To: edk2-devel@lists.01.org
> Cc: Cecil Sheng
> Subject: [edk2] [PATCH v5] MdePkg: Add UEFI2.6 HII Image Ex and Image Decoder 
> protocol definition.
> 
> Add the definition for the new UEFI 2.6 EFI_HII_IMAGE_EX_PROTOCOL and 
> EFI_IMAGE_DECODER_PROTOCOL.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Cecil Sheng 
> Reviewed-by: Samer El-Haj-Mahmoud 
> Reviewed-by: Abner Chang 
> ---
>  MdePkg/Include/Protocol/HiiImageEx.h   | 245 
> +
>  MdePkg/Include/Protocol/ImageDecoder.h | 192 ++
>  MdePkg/MdePkg.dec  |  13 ++
>  3 files changed, 450 insertions(+)
>  create mode 100644 MdePkg/Include/Protocol/HiiImageEx.h
>  create mode 100644 MdePkg/Include/Protocol/ImageDecoder.h
> 
> diff --git a/MdePkg/Include/Protocol/HiiImageEx.h 
> b/MdePkg/Include/Protocol/HiiImageEx.h
> new file mode 100644
> index 000..9393a53
> --- /dev/null
> +++ b/MdePkg/Include/Protocol/HiiImageEx.h
> @@ -0,0 +1,245 @@
> +/** @file
> +  Protocol which allows access to the images in the images database.
> +
> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
> +
> +This program and the accompanying materials are licensed and made available 
> under
> +the terms and conditions of the BSD License that 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.
> +
> +**/
> +
> +#ifndef EFI_HII_IMAGE_EX_H
> +#define EFI_HII_IMAGE_EX_H
> +
> +#include 
> +
> +//
> +// Global ID for the Hii Image Ex Protocol.
> +//
> +#define EFI_HII_IMAGE_EX_PROTOCOL_GUID \
> +  {0x1a1241e6, 0x8f19, 0x41a9,  { 0xbc, 0xe, 0xe8, 0xef, 0x39, 0xe0, 0x65, 
> 0x46 }}
> +
> +typedef struct _EFI_HII_IMAGE_EX_PROTOCOL EFI_HII_IMAGE_EX_PROTOCOL;
> +
> +/**
> +  The prototype of this extension function is the same with 
> EFI_HII_IMAGE_PROTOCOL.NewImage().
> +  Same with EFI_HII_IMAGE_PROTOCOL.NewImage().This protocol invokes
> +EFI_HII_IMAGE_PROTOCOL.NewImage() implicitly.
> +
> +  @param  This   A pointer to the EFI_HII_IMAGE_EX_PROTOCOL 
> instance.
> +  @param  PackageListHandle of the package list where this image 
> will
> + be added.
> +  @param  ImageIdOn return, contains the new image id, which 
> is
> + unique within PackageList.
> +  @param  Image  Points to the image.
> +
> +  @retval EFI_SUCCESSThe new image was added successfully.
> +  @retval EFI_NOT_FOUND  The specified PackageList could not be 
> found in
> + database.
> +  @retval EFI_OUT_OF_RESOURCES   Could not add the image due to lack of 
> resources.
> +  @retval EFI_INVALID_PARAMETER  Image is NULL or ImageId is NULL.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EFI_HII_NEW_IMAGE_EX)(
> +  IN CONST  EFI_HII_IMAGE_EX_PROTOCOL  *This,
> +  INEFI_HII_HANDLE  PackageList,
> +  OUT   EFI_IMAGE_ID*ImageId,
> +  IN CONST  EFI_IMAGE_INPUT *Image
> +  );
> +
> +/**
> +  Return the information about the image, associated with the package list.
> +  The prototype of this extension function is the same with 
> EFI_HII_IMAGE_PROTOCOL.GetImage().
> +  Same with EFI_HII_IMAGE_PROTOCOL.SetImage(),this protocol invokes 
> EFI_HII_IMAGE_PROTOCOL.SetImage() implicitly.
> +
> +  @param  This   A pointer to the EFI_HII_IMAGE_EX_PROTOCOL 
> instance.
> +  @param  PackageListHandle of the package list where this image 
> will
> + be searched.
> +  @param  ImageIdThe image's id,, which is unique within
> + PackageList.
> +  @param  Image  Points to the image.
> +
> +  @retval EFI_SUCCESSThe new image was returned successfully.
> +  @retval EFI_NOT_FOUND  The image specified by ImageId is not in the
> + database. The specified PackageList is not 
> in
> + the database.
> +  @retval EFI_BUFFER_TOO_SMALL   The buffer specified by ImageSize is too 
> small to
> + hold the image.
> +  @retval EFI_INVALID_PARAMETER  The Image or ImageSize was NULL.
> +  @retval EFI_OUT_OF_RESOURCES   The bitmap could not be retrieved because 
> there
> + was not enough memory.
> +
> +**/
> +typedef

[edk2] [PATCH v6] MdePkg: Add UEFI2.6 HII Image Ex and Image Decoder protocol definition.

2016-03-07 Thread Cecil Sheng
Add the definition for the new UEFI 2.6 EFI_HII_IMAGE_EX_PROTOCOL and 
EFI_IMAGE_DECODER_PROTOCOL.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cecil Sheng 
Reviewed-by: Samer El-Haj-Mahmoud 
Reviewed-by: Abner Chang 
---
 MdePkg/Include/Protocol/HiiImageEx.h   | 245 +
 MdePkg/Include/Protocol/ImageDecoder.h | 192 ++
 MdePkg/MdePkg.dec  |  14 ++
 3 files changed, 451 insertions(+)
 create mode 100644 MdePkg/Include/Protocol/HiiImageEx.h
 create mode 100644 MdePkg/Include/Protocol/ImageDecoder.h

diff --git a/MdePkg/Include/Protocol/HiiImageEx.h 
b/MdePkg/Include/Protocol/HiiImageEx.h
new file mode 100644
index 000..9393a53
--- /dev/null
+++ b/MdePkg/Include/Protocol/HiiImageEx.h
@@ -0,0 +1,245 @@
+/** @file
+  Protocol which allows access to the images in the images database.
+
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
+
+This program and the accompanying materials are licensed and made available 
under
+the terms and conditions of the BSD License that 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.
+
+**/
+
+#ifndef EFI_HII_IMAGE_EX_H
+#define EFI_HII_IMAGE_EX_H
+
+#include 
+
+//
+// Global ID for the Hii Image Ex Protocol.
+//
+#define EFI_HII_IMAGE_EX_PROTOCOL_GUID \
+  {0x1a1241e6, 0x8f19, 0x41a9,  { 0xbc, 0xe, 0xe8, 0xef, 0x39, 0xe0, 0x65, 
0x46 }}
+
+typedef struct _EFI_HII_IMAGE_EX_PROTOCOL EFI_HII_IMAGE_EX_PROTOCOL;
+
+/**
+  The prototype of this extension function is the same with 
EFI_HII_IMAGE_PROTOCOL.NewImage().
+  Same with EFI_HII_IMAGE_PROTOCOL.NewImage().This protocol invokes
+EFI_HII_IMAGE_PROTOCOL.NewImage() implicitly.
+
+  @param  This   A pointer to the EFI_HII_IMAGE_EX_PROTOCOL 
instance.
+  @param  PackageListHandle of the package list where this image 
will
+ be added.
+  @param  ImageIdOn return, contains the new image id, which is
+ unique within PackageList.
+  @param  Image  Points to the image.
+
+  @retval EFI_SUCCESSThe new image was added successfully.
+  @retval EFI_NOT_FOUND  The specified PackageList could not be found 
in
+ database.
+  @retval EFI_OUT_OF_RESOURCES   Could not add the image due to lack of 
resources.
+  @retval EFI_INVALID_PARAMETER  Image is NULL or ImageId is NULL.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_NEW_IMAGE_EX)(
+  IN CONST  EFI_HII_IMAGE_EX_PROTOCOL  *This,
+  INEFI_HII_HANDLE  PackageList,
+  OUT   EFI_IMAGE_ID*ImageId,
+  IN CONST  EFI_IMAGE_INPUT *Image
+  );
+
+/**
+  Return the information about the image, associated with the package list. 
+  The prototype of this extension function is the same with 
EFI_HII_IMAGE_PROTOCOL.GetImage(). 
+  Same with EFI_HII_IMAGE_PROTOCOL.SetImage(),this protocol invokes 
EFI_HII_IMAGE_PROTOCOL.SetImage() implicitly.
+
+  @param  This   A pointer to the EFI_HII_IMAGE_EX_PROTOCOL 
instance.
+  @param  PackageListHandle of the package list where this image 
will
+ be searched.
+  @param  ImageIdThe image's id,, which is unique within
+ PackageList.
+  @param  Image  Points to the image.
+
+  @retval EFI_SUCCESSThe new image was returned successfully.
+  @retval EFI_NOT_FOUND  The image specified by ImageId is not in the
+ database. The specified PackageList is not in 
+ the database.
+  @retval EFI_BUFFER_TOO_SMALL   The buffer specified by ImageSize is too 
small to
+ hold the image.
+  @retval EFI_INVALID_PARAMETER  The Image or ImageSize was NULL.
+  @retval EFI_OUT_OF_RESOURCES   The bitmap could not be retrieved because 
there 
+ was not enough memory.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_GET_IMAGE_EX)(
+  IN CONST  EFI_HII_IMAGE_EX_PROTOCOL   *This,
+  INEFI_HII_HANDLE  PackageList,
+  INEFI_IMAGE_IDImageId,
+  OUT   EFI_IMAGE_INPUT *Image
+  );
+
+/**
+  Change the information about the image. The prototype of this extension 
+  function is the same with EFI_HII_IMAGE_PROTOCOL.SetImage().  Same with 
+  EFI_HII_IMAGE_PROTOCOL.DrawImageId(),this protocol invokes 
EFI_HII_IMAGE_PROTOCOL.DrawImageId() implicitly.
+
+  @param  This   A pointer to the EFI_HII_IMAGE_EX_PROTOCOL 
instance.
+  @param  PackageListThe package list containing the image