Re: [edk2] [PATCH v3 4/6] BeagleBoardPkg: Fix build failure due to Tftp library removal

2017-11-28 Thread Ard Biesheuvel
On 29 November 2017 at 00:59, Ruiyu Ni  wrote:
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> ---
>  BeagleBoardPkg/BeagleBoardPkg.dsc | 16 +---
>  BeagleBoardPkg/BeagleBoardPkg.fdf |  3 ++-
>  2 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc 
> b/BeagleBoardPkg/BeagleBoardPkg.dsc
> index 4f7c0bd645..d67ccf377e 100644
> --- a/BeagleBoardPkg/BeagleBoardPkg.dsc
> +++ b/BeagleBoardPkg/BeagleBoardPkg.dsc
> @@ -2,7 +2,7 @@
>  # Beagle board package.
>  #
>  # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
> -# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
>  # Copyright (c) 2016, Linaro Ltd. All rights reserved.
>  #
>  #This program and the accompanying materials
> @@ -355,11 +355,6 @@ [PcdsFixedAtBuild.common]
># OMAP Interrupt Controller
>gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress|0x4820
>
> -  # We want to use the Shell Libraries but don't want it to initialise
> -  # automatically. We initialise the libraries when the command is called by 
> the
> -  # Shell.
> -  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
> -

Why are you moving this? The TFTP shell library is not the only user
of this PCD.

>gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|10
>
># GUID of the UEFI Shell
> @@ -487,6 +482,14 @@ [Components.common]
>NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
>
> NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
>}
> +
> +  #
> +  # Shell
> +  #
> +  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
> +
> +  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
> +  }
>ShellPkg/Application/Shell/Shell.inf {
>  
>
> ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
> @@ -497,7 +500,6 @@ [Components.common]
>
> NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
>
> NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
>
> NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
> -  
> NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
>
> HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
>PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>
> BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
> diff --git a/BeagleBoardPkg/BeagleBoardPkg.fdf 
> b/BeagleBoardPkg/BeagleBoardPkg.fdf
> index c9c6afd714..71249c7eb3 100644
> --- a/BeagleBoardPkg/BeagleBoardPkg.fdf
> +++ b/BeagleBoardPkg/BeagleBoardPkg.fdf
> @@ -1,7 +1,7 @@
>  # FLASH layout file for Beagle board.
>  #
>  # Copyright (c) 2009, Apple Inc. All rights reserved.
> -# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
>  # Copyright (c) 2016, Linaro, Ltd. All rights reserved.
>  #
>  #This program and the accompanying materials
> @@ -178,6 +178,7 @@ [FV.FvMain]
># UEFI application (Shell Embedded Boot Loader)
>#
>INF ShellPkg/Application/Shell/Shell.inf
> +  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
>
>#
># Bds
> --
> 2.15.0.gvfs.1.preview.4
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] Anyone interested in core dumps for EFI?

2017-11-28 Thread Andrew Fish
I was mucking around making a mach-O core dump file and it turned out to be a 
little easier than I thought once I figured out the magic. The reality is it is 
constructed a lot like an executable. I'm assuming on the gcc and ELF side it 
would be similar. I've got no clue how it works on Windows.

I basically wrote an lldb Python debugger function that takes a register dump 
and a list of memory ranges and it makes a core dump that you can read into 
lldb. The tricky bit is figuring out what to dump. I figured out how to find 
the stack that was in use (hint: top of stack is derived from rounding backward 
from the oldest frames frame pointer). If you have the stack frame you can find 
the load address and size of all the PE/COFF images referenced in the frame. 
Thus the stack + PE/COFF images in the frame becomes the simple core dump, and 
you get locals, globals, code. So far so good, but the problem comes in when 
you try and figure out the malloc'ed memory.

I'm guessing in PEI getting access to the PHIT HOB (EFI_HOB_HANDOFF_INFO_TABLE) 
and knowing the range of the XIP code in FVs would be the really useful info 
you need. In DXE you kind of need the memory map. The interesting thing about 
DXE is you don't really really care about the memory types as it is really just 
a do you need it kind of decision. I also guess if your memory reads are fast 
enough you can trade off dumping unused memory to remove fragmentation from the 
list. 

It kind of feels like we would need to update the DebugAgentLib so there is a 
path to communicate the memory regions that need to be dumped. I guess it might 
be possible to have the CpuExceptionHandlerLib do a core dump, but it is going 
to run into the same issue that you really need to know the memory ranges to 
dump. 

Seemed like an interesting topic to think about

Thanks,

Andrew Fish


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


Re: [edk2] [PATCH 0/2] Move MicrocodeUpdate from UefiCpuPkg to IntelSiliconPkg

2017-11-28 Thread Yao, Jiewen
Reviewed-by: jiewen@intel.com

> -Original Message-
> From: Zeng, Star
> Sent: Wednesday, November 29, 2017 12:59 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star ; Yao, Jiewen ;
> Kinney, Michael D ; Dong, Eric
> ; Laszlo Ersek 
> Subject: [PATCH 0/2] Move MicrocodeUpdate from UefiCpuPkg to
> IntelSiliconPkg
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=540
> 
> To consume FIT table for Microcode update,
> UefiCpuPkg/Feature/Capsule/MicrocodeUpdateDxe
> needs to be updated to consume
> IntelSiliconPkg/Include/IndustryStandard/FirmwareInterfaceTable.h,
> but UefiCpuPkg could not depend on IntelSiliconPkg.
> 
> Since the Microcode update feature is specific to Intel,
> we can first move the Microcode update feature code from
> UefiCpuPkg to IntelSiliconPkg [first step], then update
> the code to consume FIT table [second step].
> 
> This patch series is for the first step.
> 
> Cc: Jiewen Yao 
> Cc: Michael D Kinney 
> Cc: Eric Dong 
> Cc: Laszlo Ersek 
> Regression-tested-by: Yonghong Zhu 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> 
> Star Zeng (2):
>   IntelSiliconPkg: Move MicrocodeUpdate from UefiCpuPkg
>   IntelSiliconPkg: Update MicrocodeUpdate to build with the package
> 
>  .../MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.c  |  0
>  .../MicrocodeFlashAccessLibNull.inf|  6
> +++---
>  .../MicrocodeFlashAccessLibNull.uni|  0
>  .../Capsule/MicrocodeCapsulePdb/MicrocodeCapsulePdb.dsc|  0
>  .../Capsule/MicrocodeCapsulePdb/MicrocodeCapsulePdb.fdf|  0
>  .../Feature/Capsule/MicrocodeCapsulePdb/Readme.md  |  0
>  .../Capsule/MicrocodeCapsuleTxt/Microcode/Microcode.inf|  0
>  .../Capsule/MicrocodeCapsuleTxt/MicrocodeCapsuleTxt.dsc|  0
>  .../Capsule/MicrocodeCapsuleTxt/MicrocodeCapsuleTxt.fdf|  0
>  .../Feature/Capsule/MicrocodeCapsuleTxt/Readme.md  |  0
>  .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeFmp.c  |  0
>  .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c   |  0
>  .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.h   |  0
>  .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf  |  3 ++-
>  .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.uni  |  0
>  .../Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxeExtra.uni |  0
>  {UefiCpuPkg => IntelSiliconPkg}/Include/Guid/MicrocodeFmp.h|  0
>  .../Include/Library/MicrocodeFlashAccessLib.h  |  0
>  IntelSiliconPkg/IntelSiliconPkg.dec| 10
> +-
>  IntelSiliconPkg/IntelSiliconPkg.dsc|  2 ++
>  UefiCpuPkg/UefiCpuPkg.dec  |  7
> ---
>  UefiCpuPkg/UefiCpuPkg.dsc  |  2
> --
>  22 files changed, 16 insertions(+), 14 deletions(-)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/Microco
> deFlashAccessLibNull.c (100%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/Microco
> deFlashAccessLibNull.inf (85%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/Microco
> deFlashAccessLibNull.uni (100%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsulePdb/MicrocodeCapsulePdb.
> dsc (100%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsulePdb/MicrocodeCapsulePdb.f
> df (100%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsulePdb/Readme.md (100%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsuleTxt/Microcode/Microcode.in
> f (100%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsuleTxt/MicrocodeCapsuleTxt.ds
> c (100%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsuleTxt/MicrocodeCapsuleTxt.fdf
> (100%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsuleTxt/Readme.md (100%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeFmp.c
> (100%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
> (100%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.h
> (100%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.in
> f (91%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.u
> ni (100%)
>  rename {UefiCpuPkg =>
> IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxeEx
> tra.uni 

Re: [edk2] [Patch v2] MdeModulePkg: Free NET_BUF data after it is sent out to avoid memory leak

2017-11-28 Thread Wu, Jiaxin
Hi Fan,

We need also remove the DhcpReleasePacket() function since no one consume it 
now.

Others looks good to me.

Thanks,
Jiaxin

> -Original Message-
> From: Wang, Fan
> Sent: Monday, November 27, 2017 2:44 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Jiaxin ; Ye, Ting ; Fu,
> Siyuan ; Wang, Fan 
> Subject: [Patch v2] MdeModulePkg: Free NET_BUF data after it is sent out to
> avoid memory leak
> 
> V2:
> * Since packet has already been referred by DhcpSb->LastPacket, and will be
> freed when sending another packet or clean up, there is no need to add an
> extra free function in NetbufFromExt.
> 
> Cc: Jiaxin Wu 
> Cc: Ye Ting 
> Cc: Fu Siyuan 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Wang Fan 
> ---
>  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h | 12
> 
>  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c   | 13 +---
> -
>  2 files changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
> b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
> index e546a08..57f6d5e 100644
> --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
> +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
> @@ -182,10 +182,22 @@ VOID
>  DhcpCleanConfigure (
>IN OUT EFI_DHCP4_CONFIG_DATA  *Config
>);
> 
>  /**
> +  Callback of Dhcp packet. Does nothing.
> +
> +  @param Arg   The context.
> +
> +**/
> +VOID
> +EFIAPI
> +DhcpDummyExtFree (
> +  IN VOID   *Arg
> +  );
> +
> +/**
>Set the elapsed time based on the given instance and the pointer to the
>elapsed time option.
> 
>@param[in]  Elapsed   The pointer to the position to append.
>@param[in]  Instance  The pointer to the Dhcp4 instance.
> diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
> b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
> index 3898223..54a610a 100644
> --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
> +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
> @@ -1357,17 +1357,16 @@ DhcpSendMessage (
>  >ClientAddressSendOut[0],
>  >Dhcp4.Header.ClientHwAddr[0],
>  Packet->Dhcp4.Header.HwAddrLen
>  );
> 
> -
>//
>// Wrap it into a netbuf then send it.
>//
>Frag.Bulk = (UINT8 *) >Dhcp4.Header;
>Frag.Len  = Packet->Length;
> -  Wrap  = NetbufFromExt (, 1, 0, 0, DhcpReleasePacket, Packet);
> +  Wrap  = NetbufFromExt (, 1, 0, 0, DhcpDummyExtFree, NULL);
> 
>if (Wrap == NULL) {
>  FreePool (Packet);
>  return EFI_OUT_OF_RESOURCES;
>}
> @@ -1397,11 +1396,10 @@ DhcpSendMessage (
>  EndPoint.LocalAddr.Addr[0]  = DhcpSb->ClientAddr;
>  UdpIo   = DhcpSb->LeaseIoPort;
>}
> 
>ASSERT (UdpIo != NULL);
> -  NET_GET_REF (Wrap);
> 
>Status = UdpIoSendDatagram (
>   UdpIo,
>   Wrap,
>   ,
> @@ -1409,11 +1407,11 @@ DhcpSendMessage (
>   DhcpOnPacketSent,
>   DhcpSb
>   );
> 
>if (EFI_ERROR (Status)) {
> -NET_PUT_REF (Wrap);
> +NetbufFree (Wrap);
>  return EFI_ACCESS_DENIED;
>}
> 
>return EFI_SUCCESS;
>  }
> @@ -1452,16 +1450,16 @@ DhcpRetransmit (
>//
>// Wrap it into a netbuf then send it.
>//
>Frag.Bulk = (UINT8 *) >LastPacket->Dhcp4.Header;
>Frag.Len  = DhcpSb->LastPacket->Length;
> -  Wrap  = NetbufFromExt (, 1, 0, 0, DhcpReleasePacket, DhcpSb-
> >LastPacket);
> +  Wrap  = NetbufFromExt (, 1, 0, 0, DhcpDummyExtFree, NULL);
> 
>if (Wrap == NULL) {
>  return EFI_OUT_OF_RESOURCES;
>}
> -
> +
>//
>// Broadcast the message, unless we know the server address.
>//
>EndPoint.RemotePort = DHCP_SERVER_PORT;
>EndPoint.LocalPort  = DHCP_CLIENT_PORT;
> @@ -1475,22 +1473,21 @@ DhcpRetransmit (
>  UdpIo   = DhcpSb->LeaseIoPort;
>}
> 
>ASSERT (UdpIo != NULL);
> 
> -  NET_GET_REF (Wrap);
>Status = UdpIoSendDatagram (
>   UdpIo,
>   Wrap,
>   ,
>   NULL,
>   DhcpOnPacketSent,
>   DhcpSb
>   );
> 
>if (EFI_ERROR (Status)) {
> -NET_PUT_REF (Wrap);
> +NetbufFree (Wrap);
>  return EFI_ACCESS_DENIED;
>}
> 
>return EFI_SUCCESS;
>  }
> --
> 1.9.5.msysgit.1

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


Re: [edk2] [PATCH] Include libraries, header files for MdeModulePkg/.../Network maintainer

2017-11-28 Thread Fu, Siyuan


Reviewed-by: Fu Siyuan 

> -Original Message-
> From: Zeng, Star
> Sent: Tuesday, November 28, 2017 6:02 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star; Fu, Siyuan; Wu, Jiaxin
> Subject: [PATCH] Include libraries, header files for
> MdeModulePkg/.../Network maintainer
> 
> Cc: Siyuan Fu 
> Cc: Jiaxin Wu 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> ---
>  Maintainers.txt | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index fbfc74e183ba..92f12d9ae793 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -167,7 +167,8 @@ MdeModulePkg
>  W: https://github.com/tianocore/tianocore.github.io/wiki/MdeModulePkg
>  M: Star Zeng 
>  M: Eric Dong 
> -M: NetworkPkg maintainers (Universal/Network)
> +M: NetworkPkg maintainers
> +  (Universal/Network and related libraries, header files)
>  R: Ruiyu Ni 
>(especially for Bus, Universal/Console, Universal/Disk,
> Universal/BdsDxe and related libraries, header files)
> --
> 2.7.0.windows.1

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


Re: [edk2] [PATCH] Include libraries, header files for MdeModulePkg/.../Network maintainer

2017-11-28 Thread Wu, Jiaxin
Reviewed-by: Jiaxin Wu 



> -Original Message-
> From: Zeng, Star
> Sent: Tuesday, November 28, 2017 6:02 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star ; Fu, Siyuan ; Wu,
> Jiaxin 
> Subject: [PATCH] Include libraries, header files for
> MdeModulePkg/.../Network maintainer
> 
> Cc: Siyuan Fu 
> Cc: Jiaxin Wu 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> ---
>  Maintainers.txt | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index fbfc74e183ba..92f12d9ae793 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -167,7 +167,8 @@ MdeModulePkg
>  W: https://github.com/tianocore/tianocore.github.io/wiki/MdeModulePkg
>  M: Star Zeng 
>  M: Eric Dong 
> -M: NetworkPkg maintainers (Universal/Network)
> +M: NetworkPkg maintainers
> +  (Universal/Network and related libraries, header files)
>  R: Ruiyu Ni 
>(especially for Bus, Universal/Console, Universal/Disk,
> Universal/BdsDxe and related libraries, header files)
> --
> 2.7.0.windows.1

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


[edk2] [PATCH 1/2] IntelSiliconPkg: Move MicrocodeUpdate from UefiCpuPkg

2017-11-28 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=540

To consume FIT table for Microcode update,
UefiCpuPkg/Feature/Capsule/MicrocodeUpdateDxe
needs to be updated to consume
IntelSiliconPkg/Include/IndustryStandard/FirmwareInterfaceTable.h,
but UefiCpuPkg could not depend on IntelSiliconPkg.

Since the Microcode update feature is specific to Intel,
we can first move the Microcode update feature code from
UefiCpuPkg to IntelSiliconPkg [first step], then update
the code to consume FIT table [second step].

This patch series is for the first step.

Note: No any code change in this patch, just move.
Next patch will update MicrocodeUpdate to build with the package.

Cc: Jiewen Yao 
Cc: Michael D Kinney 
Cc: Eric Dong 
Cc: Laszlo Ersek 
Regression-tested-by: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 .../MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.c  |  0
 .../MicrocodeFlashAccessLibNull.inf|  0
 .../MicrocodeFlashAccessLibNull.uni|  0
 .../Capsule/MicrocodeCapsulePdb/MicrocodeCapsulePdb.dsc|  0
 .../Capsule/MicrocodeCapsulePdb/MicrocodeCapsulePdb.fdf|  0
 .../Feature/Capsule/MicrocodeCapsulePdb/Readme.md  |  0
 .../Capsule/MicrocodeCapsuleTxt/Microcode/Microcode.inf|  0
 .../Capsule/MicrocodeCapsuleTxt/MicrocodeCapsuleTxt.dsc|  0
 .../Capsule/MicrocodeCapsuleTxt/MicrocodeCapsuleTxt.fdf|  0
 .../Feature/Capsule/MicrocodeCapsuleTxt/Readme.md  |  0
 .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeFmp.c  |  0
 .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c   |  0
 .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.h   |  0
 .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf  |  0
 .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.uni  |  0
 .../Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxeExtra.uni |  0
 {UefiCpuPkg => IntelSiliconPkg}/Include/Guid/MicrocodeFmp.h|  0
 .../Include/Library/MicrocodeFlashAccessLib.h  |  0
 IntelSiliconPkg/IntelSiliconPkg.dec| 10 +-
 UefiCpuPkg/UefiCpuPkg.dec  |  7 ---
 UefiCpuPkg/UefiCpuPkg.dsc  |  2 --
 21 files changed, 9 insertions(+), 10 deletions(-)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.c
 (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.inf
 (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.uni
 (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsulePdb/MicrocodeCapsulePdb.dsc 
(100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsulePdb/MicrocodeCapsulePdb.fdf 
(100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsulePdb/Readme.md (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsuleTxt/Microcode/Microcode.inf 
(100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsuleTxt/MicrocodeCapsuleTxt.dsc 
(100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsuleTxt/MicrocodeCapsuleTxt.fdf 
(100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsuleTxt/Readme.md (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeFmp.c (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.h (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf 
(100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.uni 
(100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxeExtra.uni 
(100%)
 rename {UefiCpuPkg => IntelSiliconPkg}/Include/Guid/MicrocodeFmp.h (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Include/Library/MicrocodeFlashAccessLib.h (100%)

diff --git 
a/UefiCpuPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.c
 
b/IntelSiliconPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.c
similarity index 100%
rename from 
UefiCpuPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.c
rename to 
IntelSiliconPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.c
diff --git 

[edk2] [PATCH 0/2] Move MicrocodeUpdate from UefiCpuPkg to IntelSiliconPkg

2017-11-28 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=540

To consume FIT table for Microcode update,
UefiCpuPkg/Feature/Capsule/MicrocodeUpdateDxe
needs to be updated to consume
IntelSiliconPkg/Include/IndustryStandard/FirmwareInterfaceTable.h,
but UefiCpuPkg could not depend on IntelSiliconPkg.

Since the Microcode update feature is specific to Intel,
we can first move the Microcode update feature code from
UefiCpuPkg to IntelSiliconPkg [first step], then update
the code to consume FIT table [second step].

This patch series is for the first step.

Cc: Jiewen Yao 
Cc: Michael D Kinney 
Cc: Eric Dong 
Cc: Laszlo Ersek 
Regression-tested-by: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 

Star Zeng (2):
  IntelSiliconPkg: Move MicrocodeUpdate from UefiCpuPkg
  IntelSiliconPkg: Update MicrocodeUpdate to build with the package

 .../MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.c  |  0
 .../MicrocodeFlashAccessLibNull.inf|  6 +++---
 .../MicrocodeFlashAccessLibNull.uni|  0
 .../Capsule/MicrocodeCapsulePdb/MicrocodeCapsulePdb.dsc|  0
 .../Capsule/MicrocodeCapsulePdb/MicrocodeCapsulePdb.fdf|  0
 .../Feature/Capsule/MicrocodeCapsulePdb/Readme.md  |  0
 .../Capsule/MicrocodeCapsuleTxt/Microcode/Microcode.inf|  0
 .../Capsule/MicrocodeCapsuleTxt/MicrocodeCapsuleTxt.dsc|  0
 .../Capsule/MicrocodeCapsuleTxt/MicrocodeCapsuleTxt.fdf|  0
 .../Feature/Capsule/MicrocodeCapsuleTxt/Readme.md  |  0
 .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeFmp.c  |  0
 .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c   |  0
 .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.h   |  0
 .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf  |  3 ++-
 .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.uni  |  0
 .../Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxeExtra.uni |  0
 {UefiCpuPkg => IntelSiliconPkg}/Include/Guid/MicrocodeFmp.h|  0
 .../Include/Library/MicrocodeFlashAccessLib.h  |  0
 IntelSiliconPkg/IntelSiliconPkg.dec| 10 +-
 IntelSiliconPkg/IntelSiliconPkg.dsc|  2 ++
 UefiCpuPkg/UefiCpuPkg.dec  |  7 ---
 UefiCpuPkg/UefiCpuPkg.dsc  |  2 --
 22 files changed, 16 insertions(+), 14 deletions(-)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.c
 (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.inf
 (85%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.uni
 (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsulePdb/MicrocodeCapsulePdb.dsc 
(100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsulePdb/MicrocodeCapsulePdb.fdf 
(100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsulePdb/Readme.md (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsuleTxt/Microcode/Microcode.inf 
(100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsuleTxt/MicrocodeCapsuleTxt.dsc 
(100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsuleTxt/MicrocodeCapsuleTxt.fdf 
(100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeCapsuleTxt/Readme.md (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeFmp.c (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.h (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf (91%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.uni 
(100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxeExtra.uni 
(100%)
 rename {UefiCpuPkg => IntelSiliconPkg}/Include/Guid/MicrocodeFmp.h (100%)
 rename {UefiCpuPkg => 
IntelSiliconPkg}/Include/Library/MicrocodeFlashAccessLib.h (100%)

-- 
2.7.0.windows.1

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


[edk2] [PATCH 2/2] IntelSiliconPkg: Update MicrocodeUpdate to build with the package

2017-11-28 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=540

This is after patch
"IntelSiliconPkg: Move MicrocodeUpdate from UefiCpuPkg".

Cc: Jiewen Yao 
Cc: Michael D Kinney 
Regression-tested-by: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 .../MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.inf | 6 +++---
 .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf   | 3 ++-
 IntelSiliconPkg/IntelSiliconPkg.dsc | 2 ++
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git 
a/IntelSiliconPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.inf
 
b/IntelSiliconPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.inf
index a4a47e073720..3b2532f7a09d 100644
--- 
a/IntelSiliconPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.inf
+++ 
b/IntelSiliconPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.inf
@@ -3,7 +3,7 @@
 #
 #  Microcode flash device access library NULL instance.
 #
-#  Copyright (c) 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2016 - 2017, 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
@@ -26,7 +26,7 @@ [Defines]
 #
 # The following information is for reference only and not required by the 
build tools.
 #
-#  VALID_ARCHITECTURES   = IA32 X64 IPF EBC
+#  VALID_ARCHITECTURES   = IA32 X64
 #
 
 [Sources]
@@ -34,7 +34,7 @@ [Sources]
 
 [Packages]
   MdePkg/MdePkg.dec
-  UefiCpuPkg/UefiCpuPkg.dec
+  IntelSiliconPkg/IntelSiliconPkg.dec
 
 [LibraryClasses]
   BaseMemoryLib
diff --git 
a/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf 
b/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf
index 55797cf132b1..dbc90857a0a5 100644
--- a/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf
+++ b/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf
@@ -3,7 +3,7 @@
 #
 # Produce FMP instance to update Microcode.
 #
-#  Copyright (c) 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2016 - 2017, 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
@@ -36,6 +36,7 @@ [Sources]
 
 [Packages]
   MdePkg/MdePkg.dec
+  IntelSiliconPkg/IntelSiliconPkg.dec
   UefiCpuPkg/UefiCpuPkg.dec
 
 [LibraryClasses]
diff --git a/IntelSiliconPkg/IntelSiliconPkg.dsc 
b/IntelSiliconPkg/IntelSiliconPkg.dsc
index 57173411b373..e3043f82228e 100644
--- a/IntelSiliconPkg/IntelSiliconPkg.dsc
+++ b/IntelSiliconPkg/IntelSiliconPkg.dsc
@@ -39,6 +39,7 @@ [LibraryClasses]
   
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
   SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
   
CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
+  
MicrocodeFlashAccessLib|UefiCpuPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.inf
 
 [LibraryClasses.common.PEIM]
   PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
@@ -83,6 +84,7 @@ [Components]
   IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf
   IntelSiliconPkg/Feature/VTd/PlatformVTdSampleDxe/PlatformVTdSampleDxe.inf
   
IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/PlatformVTdInfoSamplePei.inf
+  UefiCpuPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf
 
 [BuildOptions]
   *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
-- 
2.7.0.windows.1

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


Re: [edk2] [MdeModulePkg/TerminalDxe] Why do we delay 2s for ESC being pressed?

2017-11-28 Thread Andrew Fish
Big picture I think the goal is to not make the driver depend on the PCD 
protocol. A fixed at build PCD is just part of the build system, so not an 
issue.

Thanks,

Andrew Fish

> On Nov 28, 2017, at 9:55 AM, Brian J. Johnson  wrote:
> 
> On 11/24/2017 01:21 AM, Heyi Guo wrote:
>> Hi Brian,
>> 在 11/9/2017 12:00 AM, Brian J. Johnson 写道:
>>> On 11/08/2017 07:34 AM, Heyi Guo wrote:
 
 
 On 11/08/2017 05:07 PM, Gerd Hoffmann wrote:
> On Wed, Nov 08, 2017 at 04:44:37PM +0800, Heyi Guo wrote:
>> 
>> 在 11/8/2017 4:34 PM, Ni, Ruiyu 写道:
>>> No.
>>> Even a terminal tool can recognize F10, it still needs to translate it 
>>> into "ESC [ V"
>>> and send the three bytes to firmware.
>> Got it. But the 2 seconds timeout is not for this situation, right? If
>> terminal tool could translate and send the key sequence, I think it can
>> complete 3 bytes transfer in a very short time, isn't it? E.g. 9600 baud 
>> / 8
>> = 1200 Bytes/s (ignore control bits).
>> 
>> So 2 seconds timeout is still for user to enter the sequence "ESC [ V"
>> manually?
> No.  Alot of software has this kind of delay because it is recommended
> in some classic unix documentation to avoid mis-interpreting incomplete
> terminal control sequences coming from slow terminals.
> 
> Where a "slow terminal" which actually would need such a long delay is a
> physical terminal from the 70ies of the last century, or a virtual
> terminal hooked up over a *really* slow network connection.
> 
> Reducing the delay from 2 seconds to roughly 0.2 seconds should be
> pretty safe, things are not that slow any more these days :)
 That will be great if we can make such change :)
 
>>> 
>>> You'd be surprised how much delay you can get with a few layers of 
>>> firewalls, VPNs, and cross-country (or intercontinental) WAN links. That's 
>>> the advantage of serial:  you can tunnel it anywhere.
>>> 
>>> Here's a quick workaround:  if you start typing other text after the ESC, 
>>> the terminal driver will see the new keystrokes and resolve the ESC 
>>> immediately, without the delay.  For instance, at the shell prompt, type 
>>> something, press ESC to clear the line, then just start typing new text 
>>> without waiting for the timeout. The line will be cleared and the new text 
>>> will appear correctly, without delay.
>>> 
>>> On setup screens, I usually hit escape to return to the previous screen, 
>>> then hit one of the arrow keys to cause the ESC to be processed without the 
>>> timeout.  That works pretty well in practice.
>>> 
>>> I'd think a PCD to control this delay would be appropriate, though.
>> Can we really use a PCD in TerminalDxe? I remember some experts in the 
>> community said that TerminalDxe is a pure UEFI driver; it can't use PCD 
>> since PCD is not defined in UEFI spec.
>> Thanks,
>> Gary (Heyi Guo)
> 
> Gary,
> 
> I'm not sure what the rules are for PCDs.  I'm just saying that if there's a 
> good way to make the delay configurable for each platform, I wouldn't be 
> against it.  2 seconds is a long time in some contexts.
> 
> -- 
> Brian J. Johnson
> Enterprise X86 Lab
> Hewlett Packard Enterprise
> brian.john...@hpe.com 
> 
> ___
> 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][edk2-platforms/devel-MinnowBoard3-UDK2017] Spi driver change

2017-11-28 Thread Guo, Mang
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Guo Mang 
---
 .../BroxtonSiPkg/SouthCluster/Include/ScRegs/RegsSpi.h   |  3 ++-
 .../SouthCluster/Library/BaseScSpiCommonLib/SpiCommon.c  | 10 ++
 .../BroxtonSiPkg/SouthCluster/ScInit/Dxe/ScInit.c| 16 
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git 
a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Include/ScRegs/RegsSpi.h 
b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Include/ScRegs/RegsSpi.h
index 27cc50b..5c961e6 100644
--- a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Include/ScRegs/RegsSpi.h
+++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Include/ScRegs/RegsSpi.h
@@ -17,7 +17,7 @@
   - Registers / bits of new devices introduced in a SC generation will be just 
named
 as "_SC_" without  inserted.
 
-  Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2011 - 2017, 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
@@ -92,6 +92,7 @@
 #define B_SPI_HSFS_FLOCKDN   BIT15 ///< Flash 
Configuration Lock-Down
 #define B_SPI_HSFS_FDV   BIT14 ///< Flash Descriptor 
Valid
 #define B_SPI_HSFS_FDOPSSBIT13 ///< Flash Descriptor 
Override Pin-Strap Status
+#define B_SPI_HSFS_WRSDISBIT11 ///< Write Status 
Disable
 #define B_SPI_HSFS_SCIP  BIT5  ///< SPI Cycle in 
Progress
 #define B_SPI_HSFS_BERASE_MASK   (BIT4 | BIT3) ///< Block/Sector Erase 
Size
 #define V_SPI_HSFS_BERASE_256B   0//0x00   ///< Block/Sector = 256 
Bytes
diff --git 
a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/BaseScSpiCommonLib/SpiCommon.c
 
b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/BaseScSpiCommonLib/SpiCommon.c
index 97a13fa..722f297 100644
--- 
a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/BaseScSpiCommonLib/SpiCommon.c
+++ 
b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/BaseScSpiCommonLib/SpiCommon.c
@@ -601,6 +601,7 @@ SendSpiCmd (
   UINT8   BiosCtlSave;
   UINT32  SmiEnSave;
   UINT16  ABase;
+  UINT32  HsfstsCtl;
 
   Status= EFI_SUCCESS;
   SpiInstance   = SPI_INSTANCE_FROM_SPIPROTOCOL (This);
@@ -653,6 +654,15 @@ SendSpiCmd (
 goto SendSpiCmdEnd;
   }
 
+
+  if (FlashCycleType == FlashCycleWriteStatus) {
+HsfstsCtl = MmioRead32 (ScSpiBar0 + R_SPI_HSFS);
+if ((HsfstsCtl & B_SPI_HSFS_WRSDIS) != 0) {
+  Status = EFI_ACCESS_DENIED;
+  goto SendSpiCmdEnd;
+}
+  }
+
   HardwareSpiAddr = Address;
   if ((FlashCycleType == FlashCycleRead) ||
   (FlashCycleType == FlashCycleWrite) ||
diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Dxe/ScInit.c 
b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Dxe/ScInit.c
index 3fb37ea..ebb424b 100644
--- a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Dxe/ScInit.c
+++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Dxe/ScInit.c
@@ -639,6 +639,8 @@ ScOnEndOfDxe (
   UINT16 Data16Or;
   SI_POLICY_HOB  *SiPolicyHob;
   EFI_PEI_HOB_POINTERS   HobPtr;
+  UINT16 Data16;
+  UINTN  SpiBar0;
 
   NumOfDevltrOverride = 0;
   PciLpcRegBase = MmPciBase (
@@ -678,6 +680,20 @@ ScOnEndOfDxe (
 (VOID *) (UINTN) (PmcBase + R_PMC_PMIR)
 );
 
+  if (BxtSeries == BxtP){
+SpiBar0 = MmioRead32 (PciSpiRegBase + R_SPI_BASE) &~(B_SPI_BAR0_MASK);
+
+Data16 = (UINT16) (B_SPI_HSFS_FLOCKDN | B_SPI_HSFS_WRSDIS);
+MmioWrite16 ((UINTN) (SpiBar0 + R_SPI_HSFS), Data16);
+S3BootScriptSaveMemWrite (
+  EfiBootScriptWidthUint16,
+  (UINTN) (SpiBar0 + R_SPI_HSFS),
+  1,
+  
+  );
+
+  }
+  
   Status = GetConfigBlock ((VOID *) mScPolicy, , (VOID *) 
);
   ASSERT_EFI_ERROR (Status);
   if (LockDownConfig->GlobalSmi == TRUE) {
-- 
2.10.1.windows.1

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


Re: [edk2] [PATCH v3 5/6] CorebootPayloadPkg: Fix build failure due to Tftp/Dp library removal

2017-11-28 Thread You, Benjamin
Reviewed-by: Benjamin You 

> -Original Message-
> From: Ni, Ruiyu
> Sent: Wednesday, November 29, 2017 9:00 AM
> To: edk2-devel@lists.01.org
> Cc: Ma, Maurice ; Agyeman, Prince
> ; You, Benjamin 
> Subject: [PATCH v3 5/6] CorebootPayloadPkg: Fix build failure due to Tftp/Dp
> library removal
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Maurice Ma 
> Cc: Prince Agyeman 
> Cc: Benjamin You 
> ---
>  CorebootPayloadPkg/CorebootPayloadPkg.fdf|  4 ++-
>  CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc| 36 +--
> -
>  CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc | 36 +
> ---
>  3 files changed, 41 insertions(+), 35 deletions(-)
> 
> diff --git a/CorebootPayloadPkg/CorebootPayloadPkg.fdf
> b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
> index 303e626842..7994f0c949 100644
> --- a/CorebootPayloadPkg/CorebootPayloadPkg.fdf
> +++ b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
> @@ -3,7 +3,7 @@
>  #
>  # Provides drivers and definitions to create uefi payload for coreboot.
>  #
> -# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
> +# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.
>  # This program and the accompanying materials are licensed and made
> available under
>  # the terms and conditions of the BSD License that accompanies this 
> distribution.
>  # The full text of the license may be found at
> @@ -180,6 +180,8 @@ [FV.DXEFV]
>  # Shell
>  #
>  !if $(SHELL_TYPE) == BUILD_SHELL
> +INF
> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
> +INF
> ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
>  INF ShellPkg/Application/Shell/Shell.inf
>  !endif
> 
> diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
> b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
> index cdfcb75b59..ace1bc0a37 100644
> --- a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
> +++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
> @@ -3,7 +3,7 @@
>  #
>  # Provides drivers and definitions to create uefi payload for coreboot.
>  #
> -# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
> +# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.
>  # This program and the accompanying materials are licensed and made
> available under
>  # the terms and conditions of the BSD License that accompanies this 
> distribution.
>  # The full text of the license may be found at
> @@ -515,11 +515,6 @@ [Components.IA32]
> 
>  !if $(SHELL_TYPE) == BUILD_SHELL
> 
> -[PcdsFixedAtBuild]
> -  ## This flag is used to control initialization of the shell library
> -  #  This should be FALSE for compiling the shell application itself only.
> -  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
> -
>#
># Shell Lib
>#
> @@ -527,9 +522,27 @@ [LibraryClasses]
> 
> BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCo
> mmandLib.inf
>DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
>FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
> +  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
> +  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
> 
>  [Components.IA32]
> +
> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
> {
> +
> +  ## This flag is used to control initialization of the shell library
> +  #  This should be FALSE for compiling the dynamic command.
> +  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
> +  }
> +  ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf {
> +
> +  ## This flag is used to control initialization of the shell library
> +  #  This should be FALSE for compiling the dynamic command.
> +  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
> +  }
>ShellPkg/Application/Shell/Shell.inf {
> +
> +  ## This flag is used to control initialization of the shell library
> +  #  This should be FALSE for compiling the shell application itself 
> only.
> +  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
> 
>  #--
>  #  Basic commands
> @@ -549,14 +562,6 @@ [Components.IA32]
> 
>  
> 
> NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1Co
> mmandsLib.inf
> -
> NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
> -
> -#--
> -#  Performance command
> -#--
> -
> -
> -  NULL|ShellPkg/Library/UefiDpLib/UefiDpLib.inf
> 
>  #--
>  #  Support libraries
> @@ -565,13 +570,10 @@ [Components.IA32]
>  
>DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
>   

[edk2] [PATCH v3 4/6] BeagleBoardPkg: Fix build failure due to Tftp library removal

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
---
 BeagleBoardPkg/BeagleBoardPkg.dsc | 16 +---
 BeagleBoardPkg/BeagleBoardPkg.fdf |  3 ++-
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc 
b/BeagleBoardPkg/BeagleBoardPkg.dsc
index 4f7c0bd645..d67ccf377e 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.dsc
+++ b/BeagleBoardPkg/BeagleBoardPkg.dsc
@@ -2,7 +2,7 @@
 # Beagle board package.
 #
 # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
-# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
 # Copyright (c) 2016, Linaro Ltd. All rights reserved.
 #
 #This program and the accompanying materials
@@ -355,11 +355,6 @@ [PcdsFixedAtBuild.common]
   # OMAP Interrupt Controller
   gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress|0x4820
 
-  # We want to use the Shell Libraries but don't want it to initialise
-  # automatically. We initialise the libraries when the command is called by 
the
-  # Shell.
-  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
-
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|10
 
   # GUID of the UEFI Shell
@@ -487,6 +482,14 @@ [Components.common]
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
   }
+
+  #
+  # Shell
+  #
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
+
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
@@ -497,7 +500,6 @@ [Components.common]
   
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
-  NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
diff --git a/BeagleBoardPkg/BeagleBoardPkg.fdf 
b/BeagleBoardPkg/BeagleBoardPkg.fdf
index c9c6afd714..71249c7eb3 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.fdf
+++ b/BeagleBoardPkg/BeagleBoardPkg.fdf
@@ -1,7 +1,7 @@
 # FLASH layout file for Beagle board.
 #
 # Copyright (c) 2009, Apple Inc. All rights reserved.
-# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
 # Copyright (c) 2016, Linaro, Ltd. All rights reserved.
 #
 #This program and the accompanying materials
@@ -178,6 +178,7 @@ [FV.FvMain]
   # UEFI application (Shell Embedded Boot Loader)
   #
   INF ShellPkg/Application/Shell/Shell.inf
+  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 
   #
   # Bds
-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [PATCH v3 2/6] EmulatorPkg: Fix build failure due to Tftp library removal

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Andrew Fish 
---
 EmulatorPkg/EmulatorPkg.dsc | 10 ++
 EmulatorPkg/EmulatorPkg.fdf |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index ce0ae64dba..818691ce3a 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -109,6 +109,8 @@ [LibraryClasses]
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
   
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
 
 [LibraryClasses.common.SEC]
   PeiServicesLib|EmulatorPkg/Library/SecPeiServicesLib/SecPeiServicesLib.inf
@@ -378,6 +380,10 @@ [Components]
   FatPkg/EnhancedFatDxe/Fat.inf
 
 !ifndef $(USE_OLD_SHELL)
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
+
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
@@ -388,12 +394,8 @@ [Components]
   
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
-  NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
-  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
-  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
-  
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
 #  SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
 #  
SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf
diff --git a/EmulatorPkg/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf
index 377de59b5a..314eb7b895 100644
--- a/EmulatorPkg/EmulatorPkg.fdf
+++ b/EmulatorPkg/EmulatorPkg.fdf
@@ -1,7 +1,7 @@
 ## @file
 # This is Emulator FDF file with UEFI HII features enabled
 #
-# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.
 # Portions copyright (c) 2009 - 2011, Apple Inc. All rights reserved.
 #
 # This program and the accompanying materials
@@ -206,6 +206,7 @@ [FV.FvRecovery]
 INF FatPkg/EnhancedFatDxe/Fat.inf
 
 !ifndef $(USE_OLD_SHELL)
+INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 INF  ShellPkg/Application/Shell/Shell.inf
 !else
 INF  RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [PATCH v3 1/6] ShellPkg/tftp: Correct file comments header of Tftp.uni

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Reviewed-by: Jaben Carsey 
---
 ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni 
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
index 4f4447d67a..1393ba5679 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
@@ -1,7 +1,7 @@
 // /**
 //
 // (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
-// Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved. 
+// Copyright (c) 2010 - 2017, 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
@@ -12,7 +12,7 @@
 //
 // Module Name:
 //
-// UefiShellTftpCommandLib.uni
+// Tftp.uni
 //
 // Abstract:
 //
-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [PATCH v3 5/6] CorebootPayloadPkg: Fix build failure due to Tftp/Dp library removal

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Maurice Ma 
Cc: Prince Agyeman 
Cc: Benjamin You 
---
 CorebootPayloadPkg/CorebootPayloadPkg.fdf|  4 ++-
 CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc| 36 +---
 CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc | 36 +---
 3 files changed, 41 insertions(+), 35 deletions(-)

diff --git a/CorebootPayloadPkg/CorebootPayloadPkg.fdf 
b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
index 303e626842..7994f0c949 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkg.fdf
+++ b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
@@ -3,7 +3,7 @@
 #
 # Provides drivers and definitions to create uefi payload for coreboot.
 #
-# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.
 # This program and the accompanying materials are licensed and made available 
under
 # the terms and conditions of the BSD License that accompanies this 
distribution.
 # The full text of the license may be found at
@@ -180,6 +180,8 @@ [FV.DXEFV]
 # Shell
 #
 !if $(SHELL_TYPE) == BUILD_SHELL
+INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+INF ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
 INF ShellPkg/Application/Shell/Shell.inf
 !endif
 
diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc 
b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
index cdfcb75b59..ace1bc0a37 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
+++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
@@ -3,7 +3,7 @@
 #
 # Provides drivers and definitions to create uefi payload for coreboot.
 #
-# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.
 # This program and the accompanying materials are licensed and made available 
under
 # the terms and conditions of the BSD License that accompanies this 
distribution.
 # The full text of the license may be found at
@@ -515,11 +515,6 @@ [Components.IA32]
 
 !if $(SHELL_TYPE) == BUILD_SHELL
 
-[PcdsFixedAtBuild]
-  ## This flag is used to control initialization of the shell library
-  #  This should be FALSE for compiling the shell application itself only.
-  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
-
   #
   # Shell Lib
   #
@@ -527,9 +522,27 @@ [LibraryClasses]
   
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
 
 [Components.IA32]
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
+
+  ## This flag is used to control initialization of the shell library
+  #  This should be FALSE for compiling the dynamic command.
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
+  ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf {
+
+  ## This flag is used to control initialization of the shell library
+  #  This should be FALSE for compiling the dynamic command.
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
   ShellPkg/Application/Shell/Shell.inf {
+
+  ## This flag is used to control initialization of the shell library
+  #  This should be FALSE for compiling the shell application itself only.
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
 
 #--
 #  Basic commands
@@ -549,14 +562,6 @@ [Components.IA32]
 
 
   
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
-  NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
-
-#--
-#  Performance command
-#--
-
-
-  NULL|ShellPkg/Library/UefiDpLib/UefiDpLib.inf
 
 #--
 #  Support libraries
@@ -565,13 +570,10 @@ [Components.IA32]
 
   DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
-  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
-  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
-  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   

[edk2] [PATCH v3 3/6] ArmVirtPkg: Fix build failure due to Tftp library removal

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Julien Grall 
---
 ArmVirtPkg/ArmVirt.dsc.inc   | 11 +++
 ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc |  3 ++-
 ArmVirtPkg/ArmVirtXen.fdf|  3 ++-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 5d7edff104..9874637a3d 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -1,7 +1,7 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2017, 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
@@ -55,6 +55,8 @@ [LibraryClasses.common]
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
   
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
 
   UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
@@ -217,8 +219,6 @@ [LibraryClasses.common.UEFI_APPLICATION]
   PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
   
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
-  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
-  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
 
 [LibraryClasses.common.UEFI_DRIVER]
   
UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
@@ -383,6 +383,10 @@ [Components.common]
   #
   # UEFI application (Shell Embedded Boot Loader)
   #
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
+
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
@@ -393,7 +397,6 @@ [Components.common]
   
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
-  NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc 
b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
index 744006d13c..89f95b2d99 100644
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
@@ -1,7 +1,7 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2017, 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
@@ -103,6 +103,7 @@ [FV.FvMain]
   # UEFI application (Shell Embedded Boot Loader)
   #
   INF ShellPkg/Application/Shell/Shell.inf
+  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 
   #
   # Bds
diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
index 70e76df228..6586ce6be5 100644
--- a/ArmVirtPkg/ArmVirtXen.fdf
+++ b/ArmVirtPkg/ArmVirtXen.fdf
@@ -1,7 +1,7 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2017, 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
@@ -169,6 +169,7 @@ [FV.FvMain]
   # UEFI application (Shell Embedded Boot Loader)
   #
   INF ShellPkg/Application/Shell/Shell.inf
+  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 
   #
   # Bds
-- 
2.15.0.gvfs.1.preview.4

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

[edk2] [PATCH v3 6/6] OvmfPkg: Add tftp dynamic command

2017-11-28 Thread Ruiyu Ni
The TFTP command was converted from a NULL class library instance
to a dynamic shell command in commit 0961002352e9.
This patch complements commit f9bc2f876326, which only removed the
old library, but didn't add the new dynamic command。

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Reviewed-by: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Anthony Perard 
Cc: Julien Grall 
---
 OvmfPkg/OvmfPkgIa32.dsc| 7 +--
 OvmfPkg/OvmfPkgIa32.fdf| 3 ++-
 OvmfPkg/OvmfPkgIa32X64.dsc | 7 +--
 OvmfPkg/OvmfPkgIa32X64.fdf | 3 ++-
 OvmfPkg/OvmfPkgX64.dsc | 7 +--
 OvmfPkg/OvmfPkgX64.fdf | 3 ++-
 6 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 19fa0b4c8d..9d23f8c162 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -193,6 +193,7 @@ [LibraryClasses]
   TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
 !endif
 
+  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
@@ -783,6 +784,10 @@ [Components]
 !endif
 
 !ifndef $(USE_OLD_SHELL)
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
+
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
@@ -797,8 +802,6 @@ [Components]
   
NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf
 !endif
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
-  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
-  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
 #  SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
 #  
SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 06a439f8cb..ba980834d7 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -1,7 +1,7 @@
 ## @file
 #  Open Virtual Machine Firmware: FDF
 #
-#  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #
 #  This program and the accompanying materials
@@ -285,6 +285,7 @@ [FV.DXEFV]
 INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
 
 !ifndef $(USE_OLD_SHELL)
+INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 INF  ShellPkg/Application/Shell/Shell.inf
 !else
 INF  RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index e1555dbfa8..a9c667fed8 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -198,6 +198,7 @@ [LibraryClasses]
   TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
 !endif
 
+  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
@@ -792,6 +793,10 @@ [Components.X64]
 !endif
 
 !ifndef $(USE_OLD_SHELL)
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
+
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
@@ -806,8 +811,6 @@ [Components.X64]
   
NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf
 !endif
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
-  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
-  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
 #  SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
 #  
SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index ced4c5639f..72ac82e76b 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -1,7 +1,7 @@
 ## @file
 #  Open Virtual Machine Firmware: FDF
 #
-#  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.

[edk2] [PATCH v3 0/6] Fix build failure due to tftp/dp library removal

2017-11-28 Thread Ruiyu Ni
commit 0961002 and 92034c4 converted the tftp and dp from NULL class
library to dynamic command drivers.
Some platforms referencing the original tftp/dp NULL class libraries
need the platform DSC/FDF change to reference to the new dynamic
command drivers.

v3: Fix the patch issue in BeagleBordPkg change, which wrongly removed
UefiShellNetwork1CommandsLib.
Update OvmfPkg change to correct the copyright year and add more
commit message.

v2: v1 still causes build failures. I tried best to verify the build.
OVMF boot is also tried.

Ruiyu Ni (6):
  ShellPkg/tftp: Correct file comments header of Tftp.uni
  EmulatorPkg: Fix build failure due to Tftp library removal
  ArmVirtPkg: Fix build failure due to Tftp library removal
  BeagleBoardPkg: Fix build failure due to Tftp library removal
  CorebootPayloadPkg: Fix build failure due to Tftp/Dp library removal
  OvmfPkg: Add tftp dynamic command

 ArmVirtPkg/ArmVirt.dsc.inc | 11 ---
 ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc   |  3 +-
 ArmVirtPkg/ArmVirtXen.fdf  |  3 +-
 BeagleBoardPkg/BeagleBoardPkg.dsc  | 16 +-
 BeagleBoardPkg/BeagleBoardPkg.fdf  |  3 +-
 CorebootPayloadPkg/CorebootPayloadPkg.fdf  |  4 ++-
 CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc  | 36 --
 CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc   | 36 --
 EmulatorPkg/EmulatorPkg.dsc| 10 +++---
 EmulatorPkg/EmulatorPkg.fdf|  3 +-
 OvmfPkg/OvmfPkgIa32.dsc|  7 +++--
 OvmfPkg/OvmfPkgIa32.fdf|  3 +-
 OvmfPkg/OvmfPkgIa32X64.dsc |  7 +++--
 OvmfPkg/OvmfPkgIa32X64.fdf |  3 +-
 OvmfPkg/OvmfPkgX64.dsc |  7 +++--
 OvmfPkg/OvmfPkgX64.fdf |  3 +-
 .../DynamicCommand/TftpDynamicCommand/Tftp.uni |  4 +--
 17 files changed, 94 insertions(+), 65 deletions(-)

-- 
2.15.0.gvfs.1.preview.4

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


Re: [edk2] [PATCH 2/2] OvmfPkg/QemuBootOrderLib: let an OFW devpath match multiple UEFI boot opts

2017-11-28 Thread Laszlo Ersek
On 11/28/17 08:56, Ard Biesheuvel wrote:
> On 27 November 2017 at 19:03, Laszlo Ersek  wrote:
>> This means that SetBootOrderFromQemu() will preserve all UEFI boot options
>> matched by any given OFW devpath, such as PXEv4, HTTPv4, PXEv6 and HTTPv6
>> boot options for the same NIC. Currently we stop the matching / appending
>> for the OFW devpath coming from the outer loop whenever we find the first
>> UEFI boot option match in the inner loop.
>>
>> (The previous patch was about multiple OFW devpaths matching a single UEFI
>> boot option (which should never happen). This patch is about a single OFW
>> devpath matching multiple UEFI boot options. With the "break" statement
>> removed here, the small optimization from the last patch becomes a bit
>> more relevant, because now the inner loop always counts up to
>> ActiveCount.)
>>
>> Cc: Ard Biesheuvel 
>> Cc: Jordan Justen 
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Laszlo Ersek 
> 
> Acked-by: Ard Biesheuvel 

Series pushed as commit range f9bc2f876326..dc32e820f028.

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


Re: [edk2] [PATCH] Silicon/AMD Silicon/Hisilicon: remove -ArmGetCpuCountPerCluster()

2017-11-28 Thread Leif Lindholm
On Tue, Nov 28, 2017 at 05:35:26PM +, Ard Biesheuvel wrote:
> The function ArmGetCpuCountPerCluster () was moved out of ArmPlatformLib
> because it was unused (except internally by one of the implementations)
> So remove the remaining implementations from edk2-platforms.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 

Reviewed-by: Leif Lindholm 

> ---
>  Silicon/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S   | 6 --
>  Silicon/AMD/Styx/Library/AmdStyxLib/Styx.c | 6 --
>  Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/AArch64/Helper.S | 6 --
>  Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLib.c | 5 -
>  4 files changed, 23 deletions(-)
> 
> diff --git a/Silicon/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S 
> b/Silicon/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S
> index b7ec02f0e69f..19a2fc07f3d7 100644
> --- a/Silicon/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S
> +++ b/Silicon/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S
> @@ -47,12 +47,6 @@ ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)
>ldr   w0, PrimaryCoreMpid
>ret
>  
> -# IN None
> -# OUT x0 = number of cores present in the system
> -ASM_FUNC(ArmGetCpuCountPerCluster)
> -  MOV32 (w0, FixedPcdGet32 (PcdCoreCount))
> -  ret
> -
>  //UINTN
>  //ArmPlatformIsPrimaryCore (
>  //  IN UINTN MpId
> diff --git a/Silicon/AMD/Styx/Library/AmdStyxLib/Styx.c 
> b/Silicon/AMD/Styx/Library/AmdStyxLib/Styx.c
> index f17a960d60ad..facfd61ca230 100644
> --- a/Silicon/AMD/Styx/Library/AmdStyxLib/Styx.c
> +++ b/Silicon/AMD/Styx/Library/AmdStyxLib/Styx.c
> @@ -45,12 +45,6 @@
>  extern EFI_GUID gAmdStyxMpCoreInfoGuid;
>  
>  
> -UINTN
> -ArmGetCpuCountPerCluster (
> -  VOID
> -  );
> -
> -
>  /**
>Return the current Boot Mode
>  
> diff --git 
> a/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/AArch64/Helper.S 
> b/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/AArch64/Helper.S
> index 3422df279c73..74e4aeeffc31 100644
> --- a/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/AArch64/Helper.S
> +++ b/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/AArch64/Helper.S
> @@ -29,12 +29,6 @@ ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)
>MOV32 (w0, FixedPcdGet32(PcdArmPrimaryCore))
>ret
>  
> -# IN None
> -# OUT x0 = number of cores present in the system
> -ASM_FUNC(ArmGetCpuCountPerCluster)
> -  MOV32 (w0, FixedPcdGet32(PcdCoreCount))
> -  ret
> -
>  //UINTN
>  //ArmPlatformIsPrimaryCore (
>  //  IN UINTN MpId
> diff --git 
> a/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLib.c 
> b/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLib.c
> index 07ab0d1dc271..b59b9f027573 100644
> --- a/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLib.c
> +++ b/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLib.c
> @@ -23,11 +23,6 @@
>  
>  #include 
>  
> -UINTN
> -ArmGetCpuCountPerCluster (
> -  VOID
> -  );
> -
>  extern  EFI_STATUS MemInitEntry (VOID);
>  
>  /**
> -- 
> 2.11.0
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 19/19] ArmPlatformPkg: New DP500/DP550/DP650 GOP driver.

2017-11-28 Thread Ard Biesheuvel
On 26 September 2017 at 21:15,   wrote:
> From: Girish Pathak 
>
> This change adds support for the ARM Mali DP500/DP500/DP650 display
> processors using the GOP protocol. It has been tested on FVP base
> models + DP550 support.
>
> This change does not modify functionality provided by PL111 or
> HDLCD. The driver should be suitable for those platforms
> that implement ARM Mali DP500/DP550/DP650 replacing PL111/HDLCD.
>
> Only "Layer Graphics" of the ARM Mali DP is configured for rendering
> the RGB/BGR format frame buffer to satisfy the UEFI GOP requirements
> Other layers e.g. video layers are not configured.
>
> NOTE: This change implements the Mali DP on models. Versions for actual
> hardware are liable to require extra handling for clock input changes,
> etc.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Girish Pathak 
> Signed-off-by: Evan Lloyd 

Hello Girish, Evan,

(replying to 19/19 because I cannot find the cover letter in my
edk2-devel archive but this really applies to the whole series)

I have been looking at these patches again now that I am trying to
clean up ArmPlatformPkg, which is currently a dumping ground for all
things vaguely ARM related, and is also structured quite differently
from other packages.

Ideally, ArmPlatformPkg should only contain the following:
- library class interfaces under Include/Library; header files kept
here should only contain elements that define API
- driver specific include files Include/IndustryStandard but *only* if
they cannot be kept locally with the driver in question
- libraries under Library/
- drivers under Drivers/

This aligns with the common arrangement adopted by most EDK2 packages.

This series does many different things, and does not distinguish at
all between common code and code living under ArmVExpressPkg. Given
that I am trying to move ArmVExpressPkg out of EDK2 into
edk2-platforms (where it arguably belongs) having this series in limbo
for two months is basically blocking my work, and so I would like to
explore ways to proceed with this without interfering with each
other's work too much. At the same time, the way the code is
structured is a continuation of the pattern I am trying to get rid of,
so they will need some rework anyway in order to be upstreamable IMHO.

So could we split it up please? Assuming the intention is the ability
to reuse the Mali code on non-VExpress platforms, I would like to see
that code proposed separately, without any mention of VExpressPkg.dec
whatsoever. If you introduce any library classes that abstract away
the differences between platforms, you can include a Null version of
such a library that simply does ASSERT (FALSE) in every function: this
allows the driver to be built standalone, and at the same time, forces
you to keep the abstractions pure. I intend to create a separate
ArmPlatformPkg.dsc platform description for CI purposes that covers
all drivers and libraries that remain after the refactor, and that
requires Null implementations of libraries that have no implementation
upstream.

Beyond that, it would be a matter of separating the cleanup patches
from the Mali platform support being added to VExpressPkg. The latter
could wait until the moment where the support is actually made live
and wired into an actual (physical or virtual) platform.

Please let me know what you think,

Regards,
Ard.


> ---
>  ArmPlatformPkg/ArmPlatformPkg.dec   
> |   4 +
>  ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
> |   4 +-
>  ArmPlatformPkg/ArmVExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.inf 
> |  45 +++
>  ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf 
> |   3 +
>  ArmPlatformPkg/Drivers/ArmMaliDp/ArmMaliDp.inf  
> |  44 +++
>  ArmPlatformPkg/Include/Drivers/ArmMaliDp.h  
> | 249 
>  ArmPlatformPkg/ArmVExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.c   
> | 377 ++
>  ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c  
> |  10 +-
>  ArmPlatformPkg/Drivers/ArmMaliDp/ArmMaliDp.c
> | 412 
>  9 files changed, 1146 insertions(+), 2 deletions(-)
>
> diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec 
> b/ArmPlatformPkg/ArmPlatformPkg.dec
> index 
> 0174f63e77f5b8430e106289366feb9a6577fb99..3be236413cb8e12ce32e6349732d2767fe0f3024
>  100644
> --- a/ArmPlatformPkg/ArmPlatformPkg.dec
> +++ b/ArmPlatformPkg/ArmPlatformPkg.dec
> @@ -111,6 +111,10 @@ [PcdsFixedAtBuild.common]
>gArmPlatformTokenSpaceGuid.PcdPL111LcdBase|0x0|UINT32|0x0026
>gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase|0x0|UINT32|0x0027
>
> +  ## ARM Mali Display Processor DP500/DP550/DP650
> +  gArmPlatformTokenSpaceGuid.PcdArmMaliDpBase|0x0|UINT64|0x0050
> +  

Re: [edk2] [MdeModulePkg/TerminalDxe] Why do we delay 2s for ESC being pressed?

2017-11-28 Thread Brian J. Johnson

On 11/24/2017 01:21 AM, Heyi Guo wrote:

Hi Brian,


在 11/9/2017 12:00 AM, Brian J. Johnson 写道:

On 11/08/2017 07:34 AM, Heyi Guo wrote:



On 11/08/2017 05:07 PM, Gerd Hoffmann wrote:

On Wed, Nov 08, 2017 at 04:44:37PM +0800, Heyi Guo wrote:


在 11/8/2017 4:34 PM, Ni, Ruiyu 写道:

No.
Even a terminal tool can recognize F10, it still needs to 
translate it into "ESC [ V"

and send the three bytes to firmware.

Got it. But the 2 seconds timeout is not for this situation, right? If
terminal tool could translate and send the key sequence, I think it 
can
complete 3 bytes transfer in a very short time, isn't it? E.g. 9600 
baud / 8

= 1200 Bytes/s (ignore control bits).

So 2 seconds timeout is still for user to enter the sequence "ESC [ V"
manually?

No.  Alot of software has this kind of delay because it is recommended
in some classic unix documentation to avoid mis-interpreting incomplete
terminal control sequences coming from slow terminals.

Where a "slow terminal" which actually would need such a long delay 
is a

physical terminal from the 70ies of the last century, or a virtual
terminal hooked up over a *really* slow network connection.

Reducing the delay from 2 seconds to roughly 0.2 seconds should be
pretty safe, things are not that slow any more these days :)

That will be great if we can make such change :)



You'd be surprised how much delay you can get with a few layers of 
firewalls, VPNs, and cross-country (or intercontinental) WAN links. 
That's the advantage of serial:  you can tunnel it anywhere.


Here's a quick workaround:  if you start typing other text after the 
ESC, the terminal driver will see the new keystrokes and resolve the 
ESC immediately, without the delay.  For instance, at the shell 
prompt, type something, press ESC to clear the line, then just start 
typing new text without waiting for the timeout. The line will be 
cleared and the new text will appear correctly, without delay.


On setup screens, I usually hit escape to return to the previous 
screen, then hit one of the arrow keys to cause the ESC to be 
processed without the timeout.  That works pretty well in practice.


I'd think a PCD to control this delay would be appropriate, though.


Can we really use a PCD in TerminalDxe? I remember some experts in the 
community said that TerminalDxe is a pure UEFI driver; it can't use PCD 
since PCD is not defined in UEFI spec.


Thanks,

Gary (Heyi Guo)



Gary,

I'm not sure what the rules are for PCDs.  I'm just saying that if 
there's a good way to make the delay configurable for each platform, I 
wouldn't be against it.  2 seconds is a long time in some contexts.


--
Brian J. Johnson
Enterprise X86 Lab
Hewlett Packard Enterprise
brian.john...@hpe.com

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


[edk2] [PATCH] Silicon/AMD Silicon/Hisilicon: remove -ArmGetCpuCountPerCluster()

2017-11-28 Thread Ard Biesheuvel
The function ArmGetCpuCountPerCluster () was moved out of ArmPlatformLib
because it was unused (except internally by one of the implementations)
So remove the remaining implementations from edk2-platforms.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 Silicon/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S   | 6 --
 Silicon/AMD/Styx/Library/AmdStyxLib/Styx.c | 6 --
 Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/AArch64/Helper.S | 6 --
 Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLib.c | 5 -
 4 files changed, 23 deletions(-)

diff --git a/Silicon/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S 
b/Silicon/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S
index b7ec02f0e69f..19a2fc07f3d7 100644
--- a/Silicon/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S
+++ b/Silicon/AMD/Styx/Library/AmdStyxLib/AArch64/Helper.S
@@ -47,12 +47,6 @@ ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)
   ldr   w0, PrimaryCoreMpid
   ret
 
-# IN None
-# OUT x0 = number of cores present in the system
-ASM_FUNC(ArmGetCpuCountPerCluster)
-  MOV32 (w0, FixedPcdGet32 (PcdCoreCount))
-  ret
-
 //UINTN
 //ArmPlatformIsPrimaryCore (
 //  IN UINTN MpId
diff --git a/Silicon/AMD/Styx/Library/AmdStyxLib/Styx.c 
b/Silicon/AMD/Styx/Library/AmdStyxLib/Styx.c
index f17a960d60ad..facfd61ca230 100644
--- a/Silicon/AMD/Styx/Library/AmdStyxLib/Styx.c
+++ b/Silicon/AMD/Styx/Library/AmdStyxLib/Styx.c
@@ -45,12 +45,6 @@
 extern EFI_GUID gAmdStyxMpCoreInfoGuid;
 
 
-UINTN
-ArmGetCpuCountPerCluster (
-  VOID
-  );
-
-
 /**
   Return the current Boot Mode
 
diff --git a/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/AArch64/Helper.S 
b/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/AArch64/Helper.S
index 3422df279c73..74e4aeeffc31 100644
--- a/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/AArch64/Helper.S
+++ b/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/AArch64/Helper.S
@@ -29,12 +29,6 @@ ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)
   MOV32 (w0, FixedPcdGet32(PcdArmPrimaryCore))
   ret
 
-# IN None
-# OUT x0 = number of cores present in the system
-ASM_FUNC(ArmGetCpuCountPerCluster)
-  MOV32 (w0, FixedPcdGet32(PcdCoreCount))
-  ret
-
 //UINTN
 //ArmPlatformIsPrimaryCore (
 //  IN UINTN MpId
diff --git a/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLib.c 
b/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLib.c
index 07ab0d1dc271..b59b9f027573 100644
--- a/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLib.c
+++ b/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLib.c
@@ -23,11 +23,6 @@
 
 #include 
 
-UINTN
-ArmGetCpuCountPerCluster (
-  VOID
-  );
-
 extern  EFI_STATUS MemInitEntry (VOID);
 
 /**
-- 
2.11.0

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


Re: [edk2] [PATCH v2 4/6] BeagleBoardPkg: Fix build failure due to Tftp library removal

2017-11-28 Thread Ard Biesheuvel
On 28 November 2017 at 12:00, Ruiyu Ni  wrote:
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> ---
>  BeagleBoardPkg/BeagleBoardPkg.dsc | 17 +
>  BeagleBoardPkg/BeagleBoardPkg.fdf |  3 ++-
>  2 files changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc 
> b/BeagleBoardPkg/BeagleBoardPkg.dsc
> index 4f7c0bd645..b6fdb90035 100644
> --- a/BeagleBoardPkg/BeagleBoardPkg.dsc
> +++ b/BeagleBoardPkg/BeagleBoardPkg.dsc
> @@ -2,7 +2,7 @@
>  # Beagle board package.
>  #
>  # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
> -# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
>  # Copyright (c) 2016, Linaro Ltd. All rights reserved.
>  #
>  #This program and the accompanying materials
> @@ -355,11 +355,6 @@ [PcdsFixedAtBuild.common]
># OMAP Interrupt Controller
>gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress|0x4820
>
> -  # We want to use the Shell Libraries but don't want it to initialise
> -  # automatically. We initialise the libraries when the command is called by 
> the
> -  # Shell.
> -  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
> -
>gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|10
>
># GUID of the UEFI Shell
> @@ -487,6 +482,14 @@ [Components.common]
>NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
>
> NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
>}
> +
> +  #
> +  # Shell
> +  #
> +  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
> +
> +  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
> +  }
>ShellPkg/Application/Shell/Shell.inf {
>  
>
> ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
> @@ -496,8 +499,6 @@ [Components.common]
>
> NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf
>
> NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
>
> NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
> -  
> NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf

Why is this line ^^^ being removed as well?

> -  
> NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
>
> HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
>PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>
> BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
> diff --git a/BeagleBoardPkg/BeagleBoardPkg.fdf 
> b/BeagleBoardPkg/BeagleBoardPkg.fdf
> index c9c6afd714..71249c7eb3 100644
> --- a/BeagleBoardPkg/BeagleBoardPkg.fdf
> +++ b/BeagleBoardPkg/BeagleBoardPkg.fdf
> @@ -1,7 +1,7 @@
>  # FLASH layout file for Beagle board.
>  #
>  # Copyright (c) 2009, Apple Inc. All rights reserved.
> -# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
>  # Copyright (c) 2016, Linaro, Ltd. All rights reserved.
>  #
>  #This program and the accompanying materials
> @@ -178,6 +178,7 @@ [FV.FvMain]
># UEFI application (Shell Embedded Boot Loader)
>#
>INF ShellPkg/Application/Shell/Shell.inf
> +  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
>
>#
># Bds
> --
> 2.15.0.gvfs.1.preview.4
>
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 0/2] Fix dynamic command cannot start in boot

2017-11-28 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Ruiyu Ni
> Sent: Tuesday, November 28, 2017 4:02 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH 0/2] Fix dynamic command cannot start in boot
> Importance: High
> 
> When dynamic command drivers are built into FV and start during
> boot, they fails. Because Shell protocol doesn't exist during boot.
> The patch changes both ShellLib and dynamic command drivers to fix
> the bug.
> 
> Ruiyu Ni (2):
>   ShellPkg/ShellLib: Fix dynamic command fails to start during boot
>   ShellPkg/DynamicCommand: Fix bug that cannot start in boot
> 
>  .../DpDynamicCommand/DpDynamicCommand.c|  1 +
>  .../TftpDynamicCommand/TftpDynamicCommand.c|  1 +
>  ShellPkg/Library/UefiShellLib/UefiShellLib.c   | 89 
> +-
>  ShellPkg/ShellPkg.dsc  |  7 +-
>  4 files changed, 60 insertions(+), 38 deletions(-)
> 
> --
> 2.15.0.gvfs.1.preview.4
> 
> ___
> 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] ShellPkg: Fix the bug that handling Ctrl-C improperly

2017-11-28 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

> -Original Message-
> From: Ni, Ruiyu
> Sent: Tuesday, November 28, 2017 1:07 AM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben 
> Subject: [PATCH] ShellPkg: Fix the bug that handling Ctrl-C improperly
> Importance: High
> 
> Current implementation resets the CTRL-C event early when printing
> the shell prompt, when user types "ls", "ls" command
> is terminated immediately when starts.
> It's not an expected behavior from users' perspective.
> Correct way is to reset the CTRL-C event just before running the
> command, which is a bit later than current point.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Jaben Carsey 
> ---
>  ShellPkg/Application/Shell/Shell.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/ShellPkg/Application/Shell/Shell.c
> b/ShellPkg/Application/Shell/Shell.c
> index 2adc99240c..577e17311b 100644
> --- a/ShellPkg/Application/Shell/Shell.c
> +++ b/ShellPkg/Application/Shell/Shell.c
> @@ -620,11 +620,6 @@ UefiMain (
>ShellInfoObject.ConsoleInfo->Enabled= TRUE;
>ShellInfoObject.ConsoleInfo->RowCounter = 0;
> 
> -  //
> -  // Reset the CTRL-C event (yes we ignore the return values)
> -  //
> -  Status = gBS->CheckEvent (ShellInfoObject.NewEfiShellProtocol-
> >ExecutionBreak);
> -
>//
>// Display Prompt
>//
> @@ -1346,9 +1341,14 @@ DoShellPrompt (
>// Null terminate the string and parse it
>//
>if (!EFI_ERROR (Status)) {
> +//
> +// Reset the CTRL-C event just before running the command (yes we
> ignore the return values)
> +//
> +Status = gBS->CheckEvent (ShellInfoObject.NewEfiShellProtocol-
> >ExecutionBreak);
> +
>  CmdLine[BufferSize / sizeof (CHAR16)] = CHAR_NULL;
>  Status = RunCommand(CmdLine);
> -}
> +  }
> 
>//
>// Done with this command
> --
> 2.15.0.gvfs.1.preview.4

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


Re: [edk2] [PATCH 1/6] ShellPkg/tftp: Correct file comments header of Tftp.uni

2017-11-28 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

> -Original Message-
> From: Ni, Ruiyu
> Sent: Tuesday, November 28, 2017 12:38 AM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben 
> Subject: [PATCH 1/6] ShellPkg/tftp: Correct file comments header of Tftp.uni
> Importance: High
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Jaben Carsey 
> ---
>  ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
> b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
> index 4f4447d67a..1393ba5679 100644
> --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
> +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
> @@ -1,7 +1,7 @@
>  // /**
>  //
>  // (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
> -// Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved. 
> +// Copyright (c) 2010 - 2017, 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
> @@ -12,7 +12,7 @@
>  //
>  // Module Name:
>  //
> -// UefiShellTftpCommandLib.uni
> +// Tftp.uni
>  //
>  // Abstract:
>  //
> --
> 2.15.0.gvfs.1.preview.4

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


Re: [edk2] [PATCH edk2-platforms] Silicon/SynQuacer: enable coherent DMA for NETSEC and eMMC

2017-11-28 Thread Ard Biesheuvel
On 28 November 2017 at 14:19, Leif Lindholm  wrote:
> On Tue, Nov 28, 2017 at 01:53:49PM +, Ard Biesheuvel wrote:
>> On 28 November 2017 at 13:49, Leif Lindholm  wrote:
>> > On Tue, Nov 28, 2017 at 01:37:20PM +, Ard Biesheuvel wrote:
>> >> On 28 November 2017 at 13:28, Ard Biesheuvel  
>> >> wrote:
>> >> > As it turns out, it is surprisingly easy to configure both the NETSEC
>> >> > and eMMC devices as cache coherent for DMA, given that they are both
>> >> > behind the same SMMU which is already configured in passthrough mode.
>> >
>> > Configures in passthrough mode by edk2 or earlier firmware?
>>
>> No, it is the CM3 firmware that configures the various SMMUs on this 
>> platform.
>
> Right, could you add that to the above statement please?
> "... already configured in passthrough mode by the CM3 firmware."?
>

OK

>> >> > So update the static SMMU configuration to make memory accesses 
>> >> > performed
>> >> > by these devices inner shareable, inner/outer writeback cacheable, which
>> >> > makes them cache coherent with the CPUs.
>> >> >
>> >> > Contributed-under: TianoCore Contribution Agreement 1.1
>> >> > Signed-off-by: Ard Biesheuvel 
>> >> > ---
>> >> >  Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc   
>> >> >|  2 +-
>> >> >  Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi  
>> >> >|  2 ++
>> >> >  Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c 
>> >> >|  2 +-
>> >> >  Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c  
>> >> >| 23 
>> >> >  Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h   
>> >> >|  4 
>> >> >  
>> >> > Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c
>> >> >  |  3 +++
>> >> >  6 files changed, 34 insertions(+), 2 deletions(-)
>> >> >
>> >> > diff --git 
>> >> > a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc 
>> >> > b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
>> >> > index 7245240012bc..dd4a7f9baf69 100644
>> >> > --- a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
>> >> > +++ b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
>> >> > @@ -597,7 +597,7 @@ [Components.common]
>> >> >NetworkPkg/HttpBootDxe/HttpBootDxe.inf
>> >> >Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/NetsecDxe.inf {
>> >> >  
>> >> > -  
>> >> > DmaLib|EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf
>> >> > +  DmaLib|EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.inf
>> >> >}
>> >> >
>> >> >#
>> >>
>> >> Note: this hunk ^^^ needs to be applied to DeveloperBox.dsc as well.
>> >
>> > Do I wait for a v2 including that?
>> >
>>
>> Would you like me to?
>
> No, I was just wondering.
> Does the .dtsi change not cause issues for DeveloperBox without it?
>

Yes, it does, hence the need to apply this hunk to DeveloperBox.dsc as well.

>> I added this for Daniel and/or Masami, in case they were intending to
>> test this patch. I'd like to get confirmation from them or others that
>> this works as expected before merging this, so there is no rush.
>
> Right, thanks.
>
> /
> Leif
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms] Silicon/SynQuacer: enable coherent DMA for NETSEC and eMMC

2017-11-28 Thread Leif Lindholm
On Tue, Nov 28, 2017 at 01:53:49PM +, Ard Biesheuvel wrote:
> On 28 November 2017 at 13:49, Leif Lindholm  wrote:
> > On Tue, Nov 28, 2017 at 01:37:20PM +, Ard Biesheuvel wrote:
> >> On 28 November 2017 at 13:28, Ard Biesheuvel  
> >> wrote:
> >> > As it turns out, it is surprisingly easy to configure both the NETSEC
> >> > and eMMC devices as cache coherent for DMA, given that they are both
> >> > behind the same SMMU which is already configured in passthrough mode.
> >
> > Configures in passthrough mode by edk2 or earlier firmware?
> 
> No, it is the CM3 firmware that configures the various SMMUs on this platform.

Right, could you add that to the above statement please?
"... already configured in passthrough mode by the CM3 firmware."?

> >> > So update the static SMMU configuration to make memory accesses performed
> >> > by these devices inner shareable, inner/outer writeback cacheable, which
> >> > makes them cache coherent with the CPUs.
> >> >
> >> > Contributed-under: TianoCore Contribution Agreement 1.1
> >> > Signed-off-by: Ard Biesheuvel 
> >> > ---
> >> >  Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
> >> >   |  2 +-
> >> >  Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi   
> >> >   |  2 ++
> >> >  Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c  
> >> >   |  2 +-
> >> >  Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c   
> >> >   | 23 
> >> >  Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h
> >> >   |  4 
> >> >  
> >> > Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c
> >> >  |  3 +++
> >> >  6 files changed, 34 insertions(+), 2 deletions(-)
> >> >
> >> > diff --git 
> >> > a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc 
> >> > b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
> >> > index 7245240012bc..dd4a7f9baf69 100644
> >> > --- a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
> >> > +++ b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
> >> > @@ -597,7 +597,7 @@ [Components.common]
> >> >NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> >> >Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/NetsecDxe.inf {
> >> >  
> >> > -  DmaLib|EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf
> >> > +  DmaLib|EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.inf
> >> >}
> >> >
> >> >#
> >>
> >> Note: this hunk ^^^ needs to be applied to DeveloperBox.dsc as well.
> >
> > Do I wait for a v2 including that?
> >
> 
> Would you like me to?

No, I was just wondering.
Does the .dtsi change not cause issues for DeveloperBox without it?

> I added this for Daniel and/or Masami, in case they were intending to
> test this patch. I'd like to get confirmation from them or others that
> this works as expected before merging this, so there is no rush.

Right, thanks.

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


Re: [edk2] [PATCH] OvmfPkg/Sec: Fix 64bit SEC build failure

2017-11-28 Thread Laszlo Ersek
On 11/28/17 11:14, Gao, Liming wrote:
> This is VS CL issue.  It preprocesses below FixedPcdGet32() to the fixed 
> value, but lost '\'. So, it will cause nasm compiler failure. To avoid it, we 
> need to make sure FixedPcdGet32 (PcdInitValueInTempStack) at one line.
> 
>   FixedPcdGet32 (\
> PcdInitValueInTempStack  \
> )
> ==> 
> 
> 
> 0x5AA55AA5U

Thank you.

Ray, please add the above information from Liming to the commit message:

- remove "But build tool doesn't support such usage in Windows OS
environment"

- add "But, when VS CL.exe preprocesses the FixedPcdGet32() macro
invocation to the replacement text, it loses '\', and causes NASM to fail."

With that,

Reviewed-by: Laszlo Ersek 

Thanks!
Laszlo

> 
> Thanks
> Liming
>> -Original Message-
>> From: Laszlo Ersek [mailto:ler...@redhat.com]
>> Sent: Monday, November 27, 2017 11:03 PM
>> To: Ni, Ruiyu 
>> Cc: edk2-devel@lists.01.org; Zhu, Yonghong ; Gao,
>> Liming ; Ard Biesheuvel ;
>> Justen, Jordan L 
>> Subject: Re: [PATCH] OvmfPkg/Sec: Fix 64bit SEC build failure
>>
>> Hi Ray,
>>
>> adding Ard, Jordan, Liming and Yonghong:
>>
>> On 11/27/17 02:38, Ruiyu Ni wrote:
>>> Original code breaks a single assembly code to multiple lines.
>>> But build tool doesn't support such usage in Windows OS environment.
>>>
>>> Changing the multiple lines to one line to resolve the build failure.
>>>
>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>> Signed-off-by: Ruiyu Ni 
>>> Cc: Laszlo Ersek 
>>> ---
>>>  OvmfPkg/Sec/X64/SecEntry.nasm | 6 ++
>>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/OvmfPkg/Sec/X64/SecEntry.nasm
>> b/OvmfPkg/Sec/X64/SecEntry.nasm
>>> index 7c55032ac9..d76adcffd8 100644
>>> --- a/OvmfPkg/Sec/X64/SecEntry.nasm
>>> +++ b/OvmfPkg/Sec/X64/SecEntry.nasm
>>> @@ -45,10 +45,8 @@ ASM_PFX(_ModuleEntryPoint):
>>>  ; Fill the temporary RAM with the initial stack value.
>>>  ; The loop below will seed the heap as well, but that's harmless.
>>>  ;
>>> -mov rax, (FixedPcdGet32 (\
>>> -PcdInitValueInTempStack  \
>>> -) << 32) |   \
>>> - FixedPcdGet32 (PcdInitValueInTempStack)  ; qword to 
>>> store
>>> +mov rax, (FixedPcdGet32 (PcdInitValueInTempStack) << 32) |
>> FixedPcdGet32 (PcdInitValueInTempStack)
>>> +  ; qword to 
>>> store
>>>  mov rdi, FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) ; base
>> address,
>>>;   relative 
>>> to
>>>;   ES
>>>
>>
>> I'd like to understand more about the build failure. As far as I understand, 
>> the
>> NASM tool itself has no problem with the backslash line continuation; before 
>> I
>> posted the patch, I checked the NASM manual for this feature.
>>
>> http://www.nasm.us/doc/nasmdoc3.html#section-3.1
>>
>>NASM uses backslash (\) as the line continuation character; if a
>>line ends with backslash, the next line is considered to be a part
>>of the backslash-ended line.
>>
>> Now, in "BaseTools/Conf/build_rule.template", I see that we have the
>> following rule for NASM source files:
>>
>> [Nasm-Assembly-Code-File.COMMON.COMMON]
>>
>>?.nasm
>>
>>
>>$(MAKE_FILE)
>>
>>
>>$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
>>
>>
>>"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
>>Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii
>> ${d_path}(+)${s_base}.i
>>"$(NASM)" -I${s_path}(+) $(NASM_FLAGS) -o $dst
>> ${d_path}(+)${s_base}.iii
>>
>> I guess it's actually the pre-processor (PP) that splices the broken-up lines
>> together, as any C language pre-processor is supposed to do.
>>
>> Why does that not work with the VS toolchains ("cl.exe")?
>>
>> Is it perhaps a problem with the _PP_FLAGS?
>>
>> https://msdn.microsoft.com/en-us/library/3xkfswhy.aspx
>> https://msdn.microsoft.com/en-us/library/032xwy55.aspx
>>
>> "/E" seems right (pre-process). Is /TC the problem? ("C language source
>> code").
>>
>> If the problem is impossible to fix in BaseTools, I don't mind the patch, 
>> but I'd
>> like to see more explanation in the commit message.
>>
>> (Other assembly files use backslash line continuations too, they just haven't
>> been exposed to VS toolchains yet, apparently.)
>>
>> Thanks
>> Laszlo

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


Re: [edk2] [PATCH edk2-platforms] Silicon/SynQuacer: enable coherent DMA for NETSEC and eMMC

2017-11-28 Thread Ard Biesheuvel
On 28 November 2017 at 13:49, Leif Lindholm  wrote:
> On Tue, Nov 28, 2017 at 01:37:20PM +, Ard Biesheuvel wrote:
>> On 28 November 2017 at 13:28, Ard Biesheuvel  
>> wrote:
>> > As it turns out, it is surprisingly easy to configure both the NETSEC
>> > and eMMC devices as cache coherent for DMA, given that they are both
>> > behind the same SMMU which is already configured in passthrough mode.
>
> Configures in passthrough mode by edk2 or earlier firmware?
>

No, it is the CM3 firmware that configures the various SMMUs on this platform.

>> > So update the static SMMU configuration to make memory accesses performed
>> > by these devices inner shareable, inner/outer writeback cacheable, which
>> > makes them cache coherent with the CPUs.
>> >
>> > Contributed-under: TianoCore Contribution Agreement 1.1
>> > Signed-off-by: Ard Biesheuvel 
>> > ---
>> >  Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc  
>> > |  2 +-
>> >  Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi 
>> > |  2 ++
>> >  Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
>> > |  2 +-
>> >  Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c 
>> > | 23 
>> >  Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h  
>> > |  4 
>> >  
>> > Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c
>> >  |  3 +++
>> >  6 files changed, 34 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc 
>> > b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
>> > index 7245240012bc..dd4a7f9baf69 100644
>> > --- a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
>> > +++ b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
>> > @@ -597,7 +597,7 @@ [Components.common]
>> >NetworkPkg/HttpBootDxe/HttpBootDxe.inf
>> >Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/NetsecDxe.inf {
>> >  
>> > -  DmaLib|EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf
>> > +  DmaLib|EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.inf
>> >}
>> >
>> >#
>>
>> Note: this hunk ^^^ needs to be applied to DeveloperBox.dsc as well.
>
> Do I wait for a v2 including that?
>

Would you like me to?

I added this for Daniel and/or Masami, in case they were intending to
test this patch. I'd like to get confirmation from them or others that
this works as expected before merging this, so there is no rush.

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


Re: [edk2] [PATCH edk2-platforms] Silicon/SynQuacer: enable coherent DMA for NETSEC and eMMC

2017-11-28 Thread Leif Lindholm
On Tue, Nov 28, 2017 at 01:37:20PM +, Ard Biesheuvel wrote:
> On 28 November 2017 at 13:28, Ard Biesheuvel  
> wrote:
> > As it turns out, it is surprisingly easy to configure both the NETSEC
> > and eMMC devices as cache coherent for DMA, given that they are both
> > behind the same SMMU which is already configured in passthrough mode.

Configures in passthrough mode by edk2 or earlier firmware?

> > So update the static SMMU configuration to make memory accesses performed
> > by these devices inner shareable, inner/outer writeback cacheable, which
> > makes them cache coherent with the CPUs.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel 
> > ---
> >  Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc   
> >|  2 +-
> >  Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi  
> >|  2 ++
> >  Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c 
> >|  2 +-
> >  Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c  
> >| 23 
> >  Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h   
> >|  4 
> >  
> > Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c
> >  |  3 +++
> >  6 files changed, 34 insertions(+), 2 deletions(-)
> >
> > diff --git a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc 
> > b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
> > index 7245240012bc..dd4a7f9baf69 100644
> > --- a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
> > +++ b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
> > @@ -597,7 +597,7 @@ [Components.common]
> >NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> >Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/NetsecDxe.inf {
> >  
> > -  DmaLib|EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf
> > +  DmaLib|EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.inf
> >}
> >
> >#
> 
> Note: this hunk ^^^ needs to be applied to DeveloperBox.dsc as well.

Do I wait for a v2 including that?

/
Leif

> > diff --git a/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi 
> > b/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
> > index 7c791de213c7..c9fee5d1f350 100644
> > --- a/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
> > +++ b/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
> > @@ -456,6 +456,7 @@
> >  max-speed = <1000>;
> >  max-frame-size = <9000>;
> >  phy-handle = <>;
> > +dma-coherent;
> >
> >  #address-cells = <1>;
> >  #size-cells = <0>;
> > @@ -557,6 +558,7 @@
> >  fujitsu,cmd-dat-delay-select;
> >  clocks = <_alw_c_0 _alw_b_0>;
> >  clock-names = "core", "iface";
> > +dma-coherent;
> >  status = "disabled";
> >  };
> >  };
> > diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c 
> > b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
> > index 9b1957e99907..1c38b3706f9d 100644
> > --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
> > +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
> > @@ -185,7 +185,7 @@ RegisterEmmc (
> >
> >Status = RegisterNonDiscoverableMmioDevice (
> >   NonDiscoverableDeviceTypeSdhci,
> > - NonDiscoverableDeviceDmaTypeNonCoherent,
> > + NonDiscoverableDeviceDmaTypeCoherent,
> >   NULL,
> >   ,
> >   1,
> > diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c 
> > b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
> > index b28d05650bb5..acb3e0272d3f 100644
> > --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
> > +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
> > @@ -181,6 +181,27 @@ I2cEnumerate (
> >return EFI_SUCCESS;
> >  }
> >
> > +#define SMMU_SCR0 0x0
> > +#define SMMU_SCR0_SHCFG_INNER (0x2 << 22)
> > +#define SMMU_SCR0_MTCFG   (0x1 << 20)
> > +#define SMMU_SCR0_MEMATTR_INNER_OUTER_WB  (0xf << 16)
> > +
> > +STATIC
> > +VOID
> > +SmmuEnableCoherentDma (
> > +  VOID
> > +  )
> > +{
> > +  //
> > +  // The SCB SMMU (MMU-500) is shared between the NETSEC and eMMC devices, 
> > and
> > +  // is configured in passthrough mode by default. Let's set the global 
> > memory
> > +  // type override as well, so that all memory accesses by these devices 
> > are
> > +  // inner shareable inner/outer writeback cacheable.
> > +  //
> > +  MmioOr32 (SYNQUACER_SCB_SMMU_BASE + SMMU_SCR0,
> > +SMMU_SCR0_SHCFG_INNER | SMMU_SCR0_MTCFG | 
> > SMMU_SCR0_MEMATTR_INNER_OUTER_WB);
> > +}
> > +
> >  STATIC
> >  EFI_STATUS
> >  EFIAPI
> > @@ 

Re: [edk2] [PATCH edk2-platforms] Silicon/SynQuacer: enable coherent DMA for NETSEC and eMMC

2017-11-28 Thread Ard Biesheuvel
On 28 November 2017 at 13:28, Ard Biesheuvel  wrote:
> As it turns out, it is surprisingly easy to configure both the NETSEC
> and eMMC devices as cache coherent for DMA, given that they are both
> behind the same SMMU which is already configured in passthrough mode.
>
> So update the static SMMU configuration to make memory accesses performed
> by these devices inner shareable, inner/outer writeback cacheable, which
> makes them cache coherent with the CPUs.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
>  Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc 
>  |  2 +-
>  Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
>  |  2 ++
>  Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c   
>  |  2 +-
>  Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
>  | 23 
>  Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h 
>  |  4 
>  
> Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c
>  |  3 +++
>  6 files changed, 34 insertions(+), 2 deletions(-)
>
> diff --git a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc 
> b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
> index 7245240012bc..dd4a7f9baf69 100644
> --- a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
> +++ b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
> @@ -597,7 +597,7 @@ [Components.common]
>NetworkPkg/HttpBootDxe/HttpBootDxe.inf
>Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/NetsecDxe.inf {
>  
> -  DmaLib|EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf
> +  DmaLib|EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.inf
>}
>
>#

Note: this hunk ^^^ needs to be applied to DeveloperBox.dsc as well.


> diff --git a/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi 
> b/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
> index 7c791de213c7..c9fee5d1f350 100644
> --- a/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
> +++ b/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
> @@ -456,6 +456,7 @@
>  max-speed = <1000>;
>  max-frame-size = <9000>;
>  phy-handle = <>;
> +dma-coherent;
>
>  #address-cells = <1>;
>  #size-cells = <0>;
> @@ -557,6 +558,7 @@
>  fujitsu,cmd-dat-delay-select;
>  clocks = <_alw_c_0 _alw_b_0>;
>  clock-names = "core", "iface";
> +dma-coherent;
>  status = "disabled";
>  };
>  };
> diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c 
> b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
> index 9b1957e99907..1c38b3706f9d 100644
> --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
> +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
> @@ -185,7 +185,7 @@ RegisterEmmc (
>
>Status = RegisterNonDiscoverableMmioDevice (
>   NonDiscoverableDeviceTypeSdhci,
> - NonDiscoverableDeviceDmaTypeNonCoherent,
> + NonDiscoverableDeviceDmaTypeCoherent,
>   NULL,
>   ,
>   1,
> diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c 
> b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
> index b28d05650bb5..acb3e0272d3f 100644
> --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
> +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
> @@ -181,6 +181,27 @@ I2cEnumerate (
>return EFI_SUCCESS;
>  }
>
> +#define SMMU_SCR0 0x0
> +#define SMMU_SCR0_SHCFG_INNER (0x2 << 22)
> +#define SMMU_SCR0_MTCFG   (0x1 << 20)
> +#define SMMU_SCR0_MEMATTR_INNER_OUTER_WB  (0xf << 16)
> +
> +STATIC
> +VOID
> +SmmuEnableCoherentDma (
> +  VOID
> +  )
> +{
> +  //
> +  // The SCB SMMU (MMU-500) is shared between the NETSEC and eMMC devices, 
> and
> +  // is configured in passthrough mode by default. Let's set the global 
> memory
> +  // type override as well, so that all memory accesses by these devices are
> +  // inner shareable inner/outer writeback cacheable.
> +  //
> +  MmioOr32 (SYNQUACER_SCB_SMMU_BASE + SMMU_SCR0,
> +SMMU_SCR0_SHCFG_INNER | SMMU_SCR0_MTCFG | 
> SMMU_SCR0_MEMATTR_INNER_OUTER_WB);
> +}
> +
>  STATIC
>  EFI_STATUS
>  EFIAPI
> @@ -272,5 +293,7 @@ PlatformDxeEntryPoint (
>NULL);
>ASSERT_EFI_ERROR (Status);
>
> +  SmmuEnableCoherentDma ();
> +
>return EFI_SUCCESS;
>  }
> diff --git a/Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h 
> b/Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h
> index 3c7bd58866cc..f43adcc8607f 100644
> --- a/Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h
> 

[edk2] [PATCH edk2-platforms] Silicon/SynQuacer: enable coherent DMA for NETSEC and eMMC

2017-11-28 Thread Ard Biesheuvel
As it turns out, it is surprisingly easy to configure both the NETSEC
and eMMC devices as cache coherent for DMA, given that they are both
behind the same SMMU which is already configured in passthrough mode.

So update the static SMMU configuration to make memory accesses performed
by these devices inner shareable, inner/outer writeback cacheable, which
makes them cache coherent with the CPUs.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc   
   |  2 +-
 Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi  
   |  2 ++
 Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c 
   |  2 +-
 Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c  
   | 23 
 Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h   
   |  4 
 
Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c
 |  3 +++
 6 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc 
b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
index 7245240012bc..dd4a7f9baf69 100644
--- a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
+++ b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
@@ -597,7 +597,7 @@ [Components.common]
   NetworkPkg/HttpBootDxe/HttpBootDxe.inf
   Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/NetsecDxe.inf {
 
-  DmaLib|EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf
+  DmaLib|EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.inf
   }
 
   #
diff --git a/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi 
b/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
index 7c791de213c7..c9fee5d1f350 100644
--- a/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
+++ b/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
@@ -456,6 +456,7 @@
 max-speed = <1000>;
 max-frame-size = <9000>;
 phy-handle = <>;
+dma-coherent;
 
 #address-cells = <1>;
 #size-cells = <0>;
@@ -557,6 +558,7 @@
 fujitsu,cmd-dat-delay-select;
 clocks = <_alw_c_0 _alw_b_0>;
 clock-names = "core", "iface";
+dma-coherent;
 status = "disabled";
 };
 };
diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c 
b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
index 9b1957e99907..1c38b3706f9d 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
@@ -185,7 +185,7 @@ RegisterEmmc (
 
   Status = RegisterNonDiscoverableMmioDevice (
  NonDiscoverableDeviceTypeSdhci,
- NonDiscoverableDeviceDmaTypeNonCoherent,
+ NonDiscoverableDeviceDmaTypeCoherent,
  NULL,
  ,
  1,
diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c 
b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
index b28d05650bb5..acb3e0272d3f 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
@@ -181,6 +181,27 @@ I2cEnumerate (
   return EFI_SUCCESS;
 }
 
+#define SMMU_SCR0 0x0
+#define SMMU_SCR0_SHCFG_INNER (0x2 << 22)
+#define SMMU_SCR0_MTCFG   (0x1 << 20)
+#define SMMU_SCR0_MEMATTR_INNER_OUTER_WB  (0xf << 16)
+
+STATIC
+VOID
+SmmuEnableCoherentDma (
+  VOID
+  )
+{
+  //
+  // The SCB SMMU (MMU-500) is shared between the NETSEC and eMMC devices, and
+  // is configured in passthrough mode by default. Let's set the global memory
+  // type override as well, so that all memory accesses by these devices are
+  // inner shareable inner/outer writeback cacheable.
+  //
+  MmioOr32 (SYNQUACER_SCB_SMMU_BASE + SMMU_SCR0,
+SMMU_SCR0_SHCFG_INNER | SMMU_SCR0_MTCFG | 
SMMU_SCR0_MEMATTR_INNER_OUTER_WB);
+}
+
 STATIC
 EFI_STATUS
 EFIAPI
@@ -272,5 +293,7 @@ PlatformDxeEntryPoint (
   NULL);
   ASSERT_EFI_ERROR (Status);
 
+  SmmuEnableCoherentDma ();
+
   return EFI_SUCCESS;
 }
diff --git a/Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h 
b/Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h
index 3c7bd58866cc..f43adcc8607f 100644
--- a/Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h
+++ b/Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h
@@ -65,4 +65,8 @@
 #define SYNQUACER_PCIE_BASE 0x5820
 #define SYNQUACER_PCIE_SIZE 0x0020
 
+// SCB SMMU
+#define SYNQUACER_SCB_SMMU_BASE 0x52E0
+#define SYNQUACER_SCB_SMMU_SIZE SIZE_64KB
+
 #endif
diff --git 

Re: [edk2] [PATCH 6/6] OvmfPkg: Add tftp dynamic command

2017-11-28 Thread Laszlo Ersek
Hello Ray,

I have two comments:

On 11/28/17 09:38, Ruiyu Ni wrote:
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Cc: Anthony Perard 
> Cc: Julien Grall 
> ---
>  OvmfPkg/OvmfPkgIa32.dsc| 1 +
>  OvmfPkg/OvmfPkgIa32.fdf| 3 ++-
>  OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
>  OvmfPkg/OvmfPkgIa32X64.fdf | 3 ++-
>  OvmfPkg/OvmfPkgX64.dsc | 1 +
>  OvmfPkg/OvmfPkgX64.fdf | 1 +
>  6 files changed, 8 insertions(+), 2 deletions(-)

(1) Please add the following to the commit message:

"The TFTP command was converted from a NULL class library instance to a
dynamic shell command in commit 0961002352e9. This patch complements
commit f9bc2f876326, which only removed the old library, but didn't add
the new dynamic command."


(2) You forgot to update the Intel (C) notice in "OvmfPkg/OvmfPkgX64.fdf".

(The DSC files already have "2017" as the last year, and the
OvmfPkgIa32.fdf and OvmfPkgIa32X64.fdf files are updated in this patch,
but the "OvmfPkgX64.fdf" file was missed.)


With those changes:

Reviewed-by: Laszlo Ersek 

Thanks!
Laszlo

> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index 19fa0b4c8d..1acaa279c7 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -783,6 +783,7 @@ [Components]
>  !endif
>  
>  !ifndef $(USE_OLD_SHELL)
> +  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
>ShellPkg/Application/Shell/Shell.inf {
>  
>
> ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
> diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
> index 06a439f8cb..ba980834d7 100644
> --- a/OvmfPkg/OvmfPkgIa32.fdf
> +++ b/OvmfPkg/OvmfPkgIa32.fdf
> @@ -1,7 +1,7 @@
>  ## @file
>  #  Open Virtual Machine Firmware: FDF
>  #
> -#  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
>  #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  #
>  #  This program and the accompanying materials
> @@ -285,6 +285,7 @@ [FV.DXEFV]
>  INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
>  
>  !ifndef $(USE_OLD_SHELL)
> +INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
>  INF  ShellPkg/Application/Shell/Shell.inf
>  !else
>  INF  RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index e1555dbfa8..eac53947c1 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -792,6 +792,7 @@ [Components.X64]
>  !endif
>  
>  !ifndef $(USE_OLD_SHELL)
> +  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
>ShellPkg/Application/Shell/Shell.inf {
>  
>
> ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
> diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
> index ced4c5639f..72ac82e76b 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.fdf
> +++ b/OvmfPkg/OvmfPkgIa32X64.fdf
> @@ -1,7 +1,7 @@
>  ## @file
>  #  Open Virtual Machine Firmware: FDF
>  #
> -#  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
>  #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  #
>  #  This program and the accompanying materials
> @@ -286,6 +286,7 @@ [FV.DXEFV]
>  INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
>  
>  !ifndef $(USE_OLD_SHELL)
> +INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
>  INF  ShellPkg/Application/Shell/Shell.inf
>  !else
>  INF  RuleOverride = BINARY USE = X64 EdkShellBinPkg/FullShell/FullShell.inf
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index 83d63e55d7..f4a34e7f14 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -790,6 +790,7 @@ [Components]
>  !endif
>  
>  !ifndef $(USE_OLD_SHELL)
> +  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
>ShellPkg/Application/Shell/Shell.inf {
>  
>
> ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
> diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
> index 62dd58f6e4..b9887e4386 100644
> --- a/OvmfPkg/OvmfPkgX64.fdf
> +++ b/OvmfPkg/OvmfPkgX64.fdf
> @@ -286,6 +286,7 @@ [FV.DXEFV]
>  INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
>  
>  !ifndef $(USE_OLD_SHELL)
> +INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
>  INF  ShellPkg/Application/Shell/Shell.inf
>  !else
>  INF  RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
> 

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

Re: [edk2] [PATCH 3/6] ArmVirtPkg: Fix build failure due to Tftp library removal

2017-11-28 Thread Laszlo Ersek
Hi Ray,

On 11/28/17 09:38, Ruiyu Ni wrote:
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Cc: Julien Grall 
> ---
>  ArmVirtPkg/ArmVirt.dsc.inc   | 3 +--
>  ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 3 ++-
>  ArmVirtPkg/ArmVirtXen.fdf| 3 ++-
>  3 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> index 5d7edff104..4d077c8ff9 100644
> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> @@ -1,7 +1,7 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2015, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2015 - 2017, 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
> @@ -393,7 +393,6 @@ [Components.common]
>
> NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
>
> NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
>
> NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
> -  
> NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
>
> HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
>PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>
> BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
> diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc 
> b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
> index 744006d13c..89f95b2d99 100644
> --- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
> +++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
> @@ -1,7 +1,7 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2015 - 2017, 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
> @@ -103,6 +103,7 @@ [FV.FvMain]
># UEFI application (Shell Embedded Boot Loader)
>#
>INF ShellPkg/Application/Shell/Shell.inf
> +  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
>  
>#
># Bds
> diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
> index 70e76df228..6586ce6be5 100644
> --- a/ArmVirtPkg/ArmVirtXen.fdf
> +++ b/ArmVirtPkg/ArmVirtXen.fdf
> @@ -1,7 +1,7 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2015 - 2017, 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
> @@ -169,6 +169,7 @@ [FV.FvMain]
># UEFI application (Shell Embedded Boot Loader)
>#
>INF ShellPkg/Application/Shell/Shell.inf
> +  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
>  
>#
># Bds
> 

before pushing this patch, please add the following to the commit message:

"The TFTP command was converted from a NULL class library instance to a
dynamic shell command in commit 0961002352e9".

Reviewed-by: Laszlo Ersek 

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


Re: [edk2] [PATCH] [edk2-platforms]:Enabling Secure boot feature support on hikey platfrom

2017-11-28 Thread Kalyan Nagabhirava
Hi Leif,

haojian zhuang from linaro  has shared below openplatformPkg repo  (branch
is hikey-wip) for Hikey platform to support USB host :

https://github.com/jlinton/OpenPlatformPkg

Regards,
kalyan.

On 28 November 2017 at 18:07, Leif Lindholm 
wrote:

> On Tue, Nov 28, 2017 at 01:05:35PM +0530, Kalyan Nagabhirava wrote:
> > HI Leif,
> > we didn't implemented enabling USB host and  Secure boot support  on
> Hikey
> > , we just took the code from openplatfrompkg (hikey branch)
>
> There is no hikey branch in OpenPlatformPkg.
> If you are referring to some sort of fork somewhere, then please point
> it out explicitly.
>
> >  , we have implemented secureboot and DRI -disaster recovery image (HTTP
> > image download) application
> > and tested on HIkey platform , so for that purpose we are trying to
> > upstream the hikey code.
> >
> > but hikey platform code  looks in bad shape (as per ard and your
> comments)
> > ,so  we are planning to upstream
> > only our application code which is independent of platform.
>
> I understand, but I cannot merge new code which is not used by any
> upstream platform. If you do not have the time and bandwidth to clean
> up these drivers, can you ask whoever looks after that fork to
> upstream their platform support?
>
> Best Regards,
>
> Leif
>



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


Re: [edk2] [PATCH 0/2] MdeModulePkg/AtaAtapiPassThru: Revert patch to disable PCI attributes

2017-11-28 Thread Laszlo Ersek
On 11/28/17 08:39, Ni, Ruiyu wrote:
> Laszlo,
> The Windows resume issue is urgent to fix.
> I'd like to check-in the patches first.
> If I didn't know the change may cause combability issue, I'd be very fine
> to change it to AhciReset() then submit the patch, then after got a R-b,
> I'd be very happy to check in that patch.
> But since now I know there might be some combability issue, I don't
> want to switch to AhciReset() solution without thoroughly testing.
> And frankly I don't know what a thoroughly testing would be like.
> There are many OSes and many PCI storage cards! ☹

Fair enough; thank you for the explanation.

Reviewed-by: Laszlo Ersek 

Laszlo

>> -Original Message-
>> From: Laszlo Ersek [mailto:ler...@redhat.com]
>> Sent: Monday, November 27, 2017 10:10 PM
>> To: Ni, Ruiyu 
>> Cc: edk2-devel@lists.01.org; Paolo Bonzini ; Yao,
>> Jiewen ; Zeng, Star 
>> Subject: Re: [edk2] [PATCH 0/2] MdeModulePkg/AtaAtapiPassThru: Revert
>> patch to disable PCI attributes
>>
>> Hello Ray,
>>
>> On 11/27/17 02:19, Ruiyu Ni wrote:
>>> The patches caused Windows 10 S4 resume failure.
>>> Considering the similar changes are reverted from PciBus driver,
>>> revert the patches from AtaAtapiPassThru as well.
>>>
>>> Ruiyu Ni (2):
>>>   MdeModulePkg/AtaAtapiPassThru: Revert patch to disable Bus Master
>>>   MdeModulePkg/AtaAtapiPassThru: Revert patch to disable PCI
>>> attributes
>>>
>>>  .../Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c| 58 
>>> +
>> -
>>>  .../Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h|  5 --
>>>  2 files changed, 1 insertion(+), 62 deletions(-)
>>>
>>
>> it looks like these patches have not been committed yet, which is a good
>> thing, because apparently there's a better solution than a full revert.
>> Namely, in the other sub-thread at
>> > 7fd1ad742...@redhat.com>
>> (alternative link:
>> ),
>> Jiewen and Star seem to accept AhciReset() as a better way to abort pending
>> DMA.
>>
>> This means that we need not revert the EBS-handler altogether, only change
>> what it does. Could you give that a try please?
>>
>> (If the Windows regression is very urgent to fix, then I don't mind if the 
>> Bus
>> Master disabling is removed separately, before AhciReset() is added; but in
>> that case, a full revert looks unjustified, since the EBS handler will have 
>> to be
>> re-added for AhciReset() anyway.)
>>
>> Thanks,
>> Laszlo

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


Re: [edk2] [PATCH] [edk2-platforms]:Enabling Secure boot feature support on hikey platfrom

2017-11-28 Thread Leif Lindholm
On Tue, Nov 28, 2017 at 01:05:35PM +0530, Kalyan Nagabhirava wrote:
> HI Leif,
> we didn't implemented enabling USB host and  Secure boot support  on Hikey
> , we just took the code from openplatfrompkg (hikey branch)

There is no hikey branch in OpenPlatformPkg.
If you are referring to some sort of fork somewhere, then please point
it out explicitly.

>  , we have implemented secureboot and DRI -disaster recovery image (HTTP
> image download) application
> and tested on HIkey platform , so for that purpose we are trying to
> upstream the hikey code.
> 
> but hikey platform code  looks in bad shape (as per ard and your comments)
> ,so  we are planning to upstream
> only our application code which is independent of platform.

I understand, but I cannot merge new code which is not used by any
upstream platform. If you do not have the time and bandwidth to clean
up these drivers, can you ask whoever looks after that fork to
upstream their platform support?

Best Regards,

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


Re: [edk2] [PATCH v2 0/6] Fix build failure due to tftp/dp library removal

2017-11-28 Thread Leif Lindholm
It would be helpful if the cover letter included a reference to the
commit that caused the breakage.

/
Leif

On Tue, Nov 28, 2017 at 08:00:03PM +0800, Ruiyu Ni wrote:
> v2: v1 still causes build failures. I tried best to verify the build.
> OVMF boot is also tried.
> 
> Ruiyu Ni (6):
>   ShellPkg/tftp: Correct file comments header of Tftp.uni
>   EmulatorPkg: Fix build failure due to Tftp library removal
>   ArmVirtPkg: Fix build failure due to Tftp library removal
>   BeagleBoardPkg: Fix build failure due to Tftp library removal
>   CorebootPayloadPkg: Fix build failure due to Tftp/Dp library removal
>   OvmfPkg: Add tftp dynamic command
> 
>  ArmVirtPkg/ArmVirt.dsc.inc | 11 ---
>  ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc   |  3 +-
>  ArmVirtPkg/ArmVirtXen.fdf  |  3 +-
>  BeagleBoardPkg/BeagleBoardPkg.dsc  | 17 +-
>  BeagleBoardPkg/BeagleBoardPkg.fdf  |  3 +-
>  CorebootPayloadPkg/CorebootPayloadPkg.fdf  |  4 ++-
>  CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc  | 36 
> --
>  CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc   | 36 
> --
>  EmulatorPkg/EmulatorPkg.dsc| 10 +++---
>  EmulatorPkg/EmulatorPkg.fdf|  3 +-
>  OvmfPkg/OvmfPkgIa32.dsc|  7 +++--
>  OvmfPkg/OvmfPkgIa32.fdf|  3 +-
>  OvmfPkg/OvmfPkgIa32X64.dsc |  7 +++--
>  OvmfPkg/OvmfPkgIa32X64.fdf |  3 +-
>  OvmfPkg/OvmfPkgX64.dsc |  7 +++--
>  OvmfPkg/OvmfPkgX64.fdf |  1 +
>  .../DynamicCommand/TftpDynamicCommand/Tftp.uni |  4 +--
>  17 files changed, 93 insertions(+), 65 deletions(-)
> 
> -- 
> 2.15.0.gvfs.1.preview.4
> 
> ___
> 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] Add Ruiyu as MdeModulePkg reviewer

2017-11-28 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Thanks/Ray

> -Original Message-
> From: Zeng, Star
> Sent: Tuesday, November 28, 2017 6:02 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star ; Ni, Ruiyu 
> Subject: [PATCH] Add Ruiyu as MdeModulePkg reviewer
> 
> Add Ruiyu as MdeModulePkg reviewer,
> especially for some Domains.
> 
> Cc: Ruiyu Ni 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> ---
>  Maintainers.txt | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt index
> ffb69c17fe2e..fbfc74e183ba 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -168,6 +168,9 @@ W:
> https://github.com/tianocore/tianocore.github.io/wiki/MdeModulePkg
>  M: Star Zeng 
>  M: Eric Dong 
>  M: NetworkPkg maintainers (Universal/Network)
> +R: Ruiyu Ni 
> +  (especially for Bus, Universal/Console, Universal/Disk,
> +   Universal/BdsDxe and related libraries, header files)
> 
>  MdePkg
>  W: https://github.com/tianocore/tianocore.github.io/wiki/MdePkg
> --
> 2.7.0.windows.1

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


[edk2] [PATCH 1/2] ShellPkg/ShellLib: Fix dynamic command fails to start during boot

2017-11-28 Thread Ruiyu Ni
The previous change in ShellLib: "commit
3d29f8c5e361525a0d2accfa7f5bb0a7210b8927
* ShellPkg/ShellLib: Constructor doesn't depend on ShellParameters"
resolved the issue when loading dynamic command driver from Shell
environment.
But when dynamic command driver is built into FV and started during
boot, the driver still fails to start because Shell protocol doesn't
exist at that time.

The patch changes ShellLib to:
1. Do not look for Shell and ShellParameters protocol when they are
   non-NULL in ShellLibConstructorWorker();
   The two protocols are assumed to be set by DynamicCommand.Handler.
   When ShellInitialize() is called in DynamicCommand.Handler, this
   change can prevent the two protocols to be changed to NULL by
   the locating logic.
2. Do not reset the Shell and ShellParameters protocol to NULL in
   ShellLibDestructor() when CloseProtocol() fails;
   Dynamic command driver needs to set the PcdShellLibAutoInitialize
   to FALSE in order to skip the constructor.
   Current logic calls ShellLibDestructor() when the PCD is FALSE when
   ShellInitialize() is called. The change prevent the two protocols
   to be changed to NULL.

The two changes don't impact existing usage case so they are backward
compatible.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Jaben Carsey 
---
 ShellPkg/Library/UefiShellLib/UefiShellLib.c | 89 
 1 file changed, 52 insertions(+), 37 deletions(-)

diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c 
b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index 00f58ca0c1..7f6389f655 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -179,40 +179,45 @@ ShellLibConstructorWorker (
 {
   EFI_STATUS  Status;
 
-  //
-  // UEFI 2.0 shell interfaces (used preferentially)
-  //
-  Status = gBS->OpenProtocol(
-ImageHandle,
-,
-(VOID **),
-ImageHandle,
-NULL,
-EFI_OPEN_PROTOCOL_GET_PROTOCOL
-   );
-  if (EFI_ERROR(Status)) {
+  if (gEfiShellProtocol == NULL) {
 //
-// Search for the shell protocol
+// UEFI 2.0 shell interfaces (used preferentially)
 //
-Status = gBS->LocateProtocol(
+Status = gBS->OpenProtocol (
+  ImageHandle,
   ,
+  (VOID **),
+  ImageHandle,
   NULL,
-  (VOID **)
- );
-if (EFI_ERROR(Status)) {
-  gEfiShellProtocol = NULL;
+  EFI_OPEN_PROTOCOL_GET_PROTOCOL
+);
+if (EFI_ERROR (Status)) {
+  //
+  // Search for the shell protocol
+  //
+  Status = gBS->LocateProtocol (
+,
+NULL,
+(VOID **)
+  );
+  if (EFI_ERROR (Status)) {
+gEfiShellProtocol = NULL;
+  }
 }
   }
-  Status = gBS->OpenProtocol(
-ImageHandle,
-,
-(VOID **),
-ImageHandle,
-NULL,
-EFI_OPEN_PROTOCOL_GET_PROTOCOL
-   );
-  if (EFI_ERROR(Status)) {
-gEfiShellParametersProtocol = NULL;
+
+  if (gEfiShellParametersProtocol == NULL) {
+Status = gBS->OpenProtocol (
+  ImageHandle,
+  ,
+  (VOID **),
+  ImageHandle,
+  NULL,
+  EFI_OPEN_PROTOCOL_GET_PROTOCOL
+);
+if (EFI_ERROR (Status)) {
+  gEfiShellParametersProtocol = NULL;
+}
   }
 
   if (gEfiShellProtocol == NULL) {
@@ -324,35 +329,45 @@ ShellLibDestructor (
   IN EFI_SYSTEM_TABLE  *SystemTable
   )
 {
+  EFI_STATUS   Status;
+
   if (mEfiShellEnvironment2 != NULL) {
-
gBS->CloseProtocol(mEfiShellEnvironment2Handle==NULL?ImageHandle:mEfiShellEnvironment2Handle,
+Status = 
gBS->CloseProtocol(mEfiShellEnvironment2Handle==NULL?ImageHandle:mEfiShellEnvironment2Handle,
,
ImageHandle,
NULL);
-mEfiShellEnvironment2 = NULL;
+if (!EFI_ERROR (Status)) {
+  mEfiShellEnvironment2   = NULL;
+  mEfiShellEnvironment2Handle = NULL;
+}
   }
   if (mEfiShellInterface != NULL) {
-gBS->CloseProtocol(ImageHandle,
+Status = gBS->CloseProtocol(ImageHandle,
,
ImageHandle,
NULL);
-mEfiShellInterface = NULL;
+if (!EFI_ERROR (Status)) {
+  mEfiShellInterface = NULL;
+}
   }
   if (gEfiShellProtocol != NULL) {
-gBS->CloseProtocol(ImageHandle,
+Status = gBS->CloseProtocol(ImageHandle,
,
ImageHandle,
NULL);
-gEfiShellProtocol = NULL;
+if (!EFI_ERROR (Status)) {
+  gEfiShellProtocol = NULL;
+}
   }
   if (gEfiShellParametersProtocol != NULL) {
-gBS->CloseProtocol(ImageHandle,
+Status = gBS->CloseProtocol(ImageHandle,
,
ImageHandle,
NULL);
-gEfiShellParametersProtocol = NULL;
+if (!EFI_ERROR (Status)) {
+  gEfiShellParametersProtocol = NULL;
+}
   }
-  mEfiShellEnvironment2Handle = NULL;
 
   

[edk2] [PATCH 2/2] ShellPkg/DynamicCommand: Fix bug that cannot start in boot

2017-11-28 Thread Ruiyu Ni
When dynamic command drivers are built into FV and start during
boot, they fails. Because Shell protocol doesn't exist during boot.
The patch sets Shell protocol and also set PcdShellLibAutoInitialize
to FALSE to ensure that
1. Shell protocol check doesn't happen in driver's entry point.
2. Driver can get the Shell protocol in DynamicCommand.Handler().

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Jaben Carsey 
---
 ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c | 1 +
 ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c | 1 +
 ShellPkg/ShellPkg.dsc   | 7 ++-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c 
b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c
index 6f3997fff4..b10c59f49c 100644
--- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c
+++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c
@@ -38,6 +38,7 @@ DpCommandHandler (
   )
 {
   gEfiShellParametersProtocol = ShellParameters;
+  gEfiShellProtocol   = Shell;
   return RunDp (gImageHandle, SystemTable);
 }
 
diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c 
b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c
index 928ef08468..9e6489dd6f 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c
@@ -39,6 +39,7 @@ TftpCommandHandler (
   )
 {
   gEfiShellParametersProtocol = ShellParameters;
+  gEfiShellProtocol   = Shell;
   return RunTftp (gImageHandle, SystemTable);
 }
 
diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc
index 65e8959455..86382139a5 100644
--- a/ShellPkg/ShellPkg.dsc
+++ b/ShellPkg/ShellPkg.dsc
@@ -120,9 +120,14 @@ [Components]
 !endif #$(NO_SHELL_PROFILES)
   }
 
-  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
+
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
   ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf
   ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf {
+
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
 
   
PerformanceLib|MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf
   }
-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [PATCH 0/2] Fix dynamic command cannot start in boot

2017-11-28 Thread Ruiyu Ni
When dynamic command drivers are built into FV and start during
boot, they fails. Because Shell protocol doesn't exist during boot.
The patch changes both ShellLib and dynamic command drivers to fix
the bug.

Ruiyu Ni (2):
  ShellPkg/ShellLib: Fix dynamic command fails to start during boot
  ShellPkg/DynamicCommand: Fix bug that cannot start in boot

 .../DpDynamicCommand/DpDynamicCommand.c|  1 +
 .../TftpDynamicCommand/TftpDynamicCommand.c|  1 +
 ShellPkg/Library/UefiShellLib/UefiShellLib.c   | 89 +-
 ShellPkg/ShellPkg.dsc  |  7 +-
 4 files changed, 60 insertions(+), 38 deletions(-)

-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [PATCH v2 5/6] CorebootPayloadPkg: Fix build failure due to Tftp/Dp library removal

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Maurice Ma 
Cc: Prince Agyeman 
Cc: Benjamin You 
---
 CorebootPayloadPkg/CorebootPayloadPkg.fdf|  4 ++-
 CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc| 36 +---
 CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc | 36 +---
 3 files changed, 41 insertions(+), 35 deletions(-)

diff --git a/CorebootPayloadPkg/CorebootPayloadPkg.fdf 
b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
index 303e626842..7994f0c949 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkg.fdf
+++ b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
@@ -3,7 +3,7 @@
 #
 # Provides drivers and definitions to create uefi payload for coreboot.
 #
-# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.
 # This program and the accompanying materials are licensed and made available 
under
 # the terms and conditions of the BSD License that accompanies this 
distribution.
 # The full text of the license may be found at
@@ -180,6 +180,8 @@ [FV.DXEFV]
 # Shell
 #
 !if $(SHELL_TYPE) == BUILD_SHELL
+INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+INF ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
 INF ShellPkg/Application/Shell/Shell.inf
 !endif
 
diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc 
b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
index cdfcb75b59..ace1bc0a37 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
+++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
@@ -3,7 +3,7 @@
 #
 # Provides drivers and definitions to create uefi payload for coreboot.
 #
-# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.
 # This program and the accompanying materials are licensed and made available 
under
 # the terms and conditions of the BSD License that accompanies this 
distribution.
 # The full text of the license may be found at
@@ -515,11 +515,6 @@ [Components.IA32]
 
 !if $(SHELL_TYPE) == BUILD_SHELL
 
-[PcdsFixedAtBuild]
-  ## This flag is used to control initialization of the shell library
-  #  This should be FALSE for compiling the shell application itself only.
-  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
-
   #
   # Shell Lib
   #
@@ -527,9 +522,27 @@ [LibraryClasses]
   
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
 
 [Components.IA32]
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
+
+  ## This flag is used to control initialization of the shell library
+  #  This should be FALSE for compiling the dynamic command.
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
+  ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf {
+
+  ## This flag is used to control initialization of the shell library
+  #  This should be FALSE for compiling the dynamic command.
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
   ShellPkg/Application/Shell/Shell.inf {
+
+  ## This flag is used to control initialization of the shell library
+  #  This should be FALSE for compiling the shell application itself only.
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
 
 #--
 #  Basic commands
@@ -549,14 +562,6 @@ [Components.IA32]
 
 
   
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
-  NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
-
-#--
-#  Performance command
-#--
-
-
-  NULL|ShellPkg/Library/UefiDpLib/UefiDpLib.inf
 
 #--
 #  Support libraries
@@ -565,13 +570,10 @@ [Components.IA32]
 
   DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
-  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
-  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
-  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   

[edk2] [PATCH v2 6/6] OvmfPkg: Add tftp dynamic command

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Anthony Perard 
Cc: Julien Grall 
---
 OvmfPkg/OvmfPkgIa32.dsc| 7 +--
 OvmfPkg/OvmfPkgIa32.fdf| 3 ++-
 OvmfPkg/OvmfPkgIa32X64.dsc | 7 +--
 OvmfPkg/OvmfPkgIa32X64.fdf | 3 ++-
 OvmfPkg/OvmfPkgX64.dsc | 7 +--
 OvmfPkg/OvmfPkgX64.fdf | 1 +
 6 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 19fa0b4c8d..9d23f8c162 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -193,6 +193,7 @@ [LibraryClasses]
   TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
 !endif
 
+  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
@@ -783,6 +784,10 @@ [Components]
 !endif
 
 !ifndef $(USE_OLD_SHELL)
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
+
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
@@ -797,8 +802,6 @@ [Components]
   
NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf
 !endif
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
-  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
-  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
 #  SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
 #  
SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 06a439f8cb..ba980834d7 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -1,7 +1,7 @@
 ## @file
 #  Open Virtual Machine Firmware: FDF
 #
-#  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #
 #  This program and the accompanying materials
@@ -285,6 +285,7 @@ [FV.DXEFV]
 INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
 
 !ifndef $(USE_OLD_SHELL)
+INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 INF  ShellPkg/Application/Shell/Shell.inf
 !else
 INF  RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index e1555dbfa8..a9c667fed8 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -198,6 +198,7 @@ [LibraryClasses]
   TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
 !endif
 
+  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
@@ -792,6 +793,10 @@ [Components.X64]
 !endif
 
 !ifndef $(USE_OLD_SHELL)
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
+
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
@@ -806,8 +811,6 @@ [Components.X64]
   
NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf
 !endif
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
-  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
-  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
 #  SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
 #  
SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index ced4c5639f..72ac82e76b 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -1,7 +1,7 @@
 ## @file
 #  Open Virtual Machine Firmware: FDF
 #
-#  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #
 #  This program and the accompanying materials
@@ -286,6 +286,7 @@ [FV.DXEFV]
 INF  

[edk2] [PATCH v2 0/6] Fix build failure due to tftp/dp library removal

2017-11-28 Thread Ruiyu Ni
v2: v1 still causes build failures. I tried best to verify the build.
OVMF boot is also tried.

Ruiyu Ni (6):
  ShellPkg/tftp: Correct file comments header of Tftp.uni
  EmulatorPkg: Fix build failure due to Tftp library removal
  ArmVirtPkg: Fix build failure due to Tftp library removal
  BeagleBoardPkg: Fix build failure due to Tftp library removal
  CorebootPayloadPkg: Fix build failure due to Tftp/Dp library removal
  OvmfPkg: Add tftp dynamic command

 ArmVirtPkg/ArmVirt.dsc.inc | 11 ---
 ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc   |  3 +-
 ArmVirtPkg/ArmVirtXen.fdf  |  3 +-
 BeagleBoardPkg/BeagleBoardPkg.dsc  | 17 +-
 BeagleBoardPkg/BeagleBoardPkg.fdf  |  3 +-
 CorebootPayloadPkg/CorebootPayloadPkg.fdf  |  4 ++-
 CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc  | 36 --
 CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc   | 36 --
 EmulatorPkg/EmulatorPkg.dsc| 10 +++---
 EmulatorPkg/EmulatorPkg.fdf|  3 +-
 OvmfPkg/OvmfPkgIa32.dsc|  7 +++--
 OvmfPkg/OvmfPkgIa32.fdf|  3 +-
 OvmfPkg/OvmfPkgIa32X64.dsc |  7 +++--
 OvmfPkg/OvmfPkgIa32X64.fdf |  3 +-
 OvmfPkg/OvmfPkgX64.dsc |  7 +++--
 OvmfPkg/OvmfPkgX64.fdf |  1 +
 .../DynamicCommand/TftpDynamicCommand/Tftp.uni |  4 +--
 17 files changed, 93 insertions(+), 65 deletions(-)

-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [PATCH v2 1/6] ShellPkg/tftp: Correct file comments header of Tftp.uni

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Jaben Carsey 
---
 ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni 
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
index 4f4447d67a..1393ba5679 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
@@ -1,7 +1,7 @@
 // /**
 //
 // (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
-// Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved. 
+// Copyright (c) 2010 - 2017, 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
@@ -12,7 +12,7 @@
 //
 // Module Name:
 //
-// UefiShellTftpCommandLib.uni
+// Tftp.uni
 //
 // Abstract:
 //
-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [PATCH v2 4/6] BeagleBoardPkg: Fix build failure due to Tftp library removal

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
---
 BeagleBoardPkg/BeagleBoardPkg.dsc | 17 +
 BeagleBoardPkg/BeagleBoardPkg.fdf |  3 ++-
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc 
b/BeagleBoardPkg/BeagleBoardPkg.dsc
index 4f7c0bd645..b6fdb90035 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.dsc
+++ b/BeagleBoardPkg/BeagleBoardPkg.dsc
@@ -2,7 +2,7 @@
 # Beagle board package.
 #
 # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
-# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
 # Copyright (c) 2016, Linaro Ltd. All rights reserved.
 #
 #This program and the accompanying materials
@@ -355,11 +355,6 @@ [PcdsFixedAtBuild.common]
   # OMAP Interrupt Controller
   gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress|0x4820
 
-  # We want to use the Shell Libraries but don't want it to initialise
-  # automatically. We initialise the libraries when the command is called by 
the
-  # Shell.
-  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
-
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|10
 
   # GUID of the UEFI Shell
@@ -487,6 +482,14 @@ [Components.common]
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
   }
+
+  #
+  # Shell
+  #
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
+
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
@@ -496,8 +499,6 @@ [Components.common]
   
NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
-  
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
-  NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
diff --git a/BeagleBoardPkg/BeagleBoardPkg.fdf 
b/BeagleBoardPkg/BeagleBoardPkg.fdf
index c9c6afd714..71249c7eb3 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.fdf
+++ b/BeagleBoardPkg/BeagleBoardPkg.fdf
@@ -1,7 +1,7 @@
 # FLASH layout file for Beagle board.
 #
 # Copyright (c) 2009, Apple Inc. All rights reserved.
-# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
 # Copyright (c) 2016, Linaro, Ltd. All rights reserved.
 #
 #This program and the accompanying materials
@@ -178,6 +178,7 @@ [FV.FvMain]
   # UEFI application (Shell Embedded Boot Loader)
   #
   INF ShellPkg/Application/Shell/Shell.inf
+  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 
   #
   # Bds
-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [PATCH v2 3/6] ArmVirtPkg: Fix build failure due to Tftp library removal

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Julien Grall 
---
 ArmVirtPkg/ArmVirt.dsc.inc   | 11 +++
 ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc |  3 ++-
 ArmVirtPkg/ArmVirtXen.fdf|  3 ++-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 5d7edff104..9874637a3d 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -1,7 +1,7 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2017, 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
@@ -55,6 +55,8 @@ [LibraryClasses.common]
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
   
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
 
   UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
@@ -217,8 +219,6 @@ [LibraryClasses.common.UEFI_APPLICATION]
   PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
   
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
-  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
-  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
 
 [LibraryClasses.common.UEFI_DRIVER]
   
UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
@@ -383,6 +383,10 @@ [Components.common]
   #
   # UEFI application (Shell Embedded Boot Loader)
   #
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
+
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
@@ -393,7 +397,6 @@ [Components.common]
   
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
-  NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc 
b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
index 744006d13c..89f95b2d99 100644
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
@@ -1,7 +1,7 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2017, 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
@@ -103,6 +103,7 @@ [FV.FvMain]
   # UEFI application (Shell Embedded Boot Loader)
   #
   INF ShellPkg/Application/Shell/Shell.inf
+  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 
   #
   # Bds
diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
index 70e76df228..6586ce6be5 100644
--- a/ArmVirtPkg/ArmVirtXen.fdf
+++ b/ArmVirtPkg/ArmVirtXen.fdf
@@ -1,7 +1,7 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2017, 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
@@ -169,6 +169,7 @@ [FV.FvMain]
   # UEFI application (Shell Embedded Boot Loader)
   #
   INF ShellPkg/Application/Shell/Shell.inf
+  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 
   #
   # Bds
-- 
2.15.0.gvfs.1.preview.4

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

[edk2] [PATCH v2 2/6] EmulatorPkg: Fix build failure due to Tftp library removal

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Andrew Fish 
---
 EmulatorPkg/EmulatorPkg.dsc | 10 ++
 EmulatorPkg/EmulatorPkg.fdf |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index ce0ae64dba..818691ce3a 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -109,6 +109,8 @@ [LibraryClasses]
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
   
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
 
 [LibraryClasses.common.SEC]
   PeiServicesLib|EmulatorPkg/Library/SecPeiServicesLib/SecPeiServicesLib.inf
@@ -378,6 +380,10 @@ [Components]
   FatPkg/EnhancedFatDxe/Fat.inf
 
 !ifndef $(USE_OLD_SHELL)
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
+
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
@@ -388,12 +394,8 @@ [Components]
   
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
-  NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
-  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
-  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
-  
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
 #  SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
 #  
SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf
diff --git a/EmulatorPkg/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf
index 377de59b5a..314eb7b895 100644
--- a/EmulatorPkg/EmulatorPkg.fdf
+++ b/EmulatorPkg/EmulatorPkg.fdf
@@ -1,7 +1,7 @@
 ## @file
 # This is Emulator FDF file with UEFI HII features enabled
 #
-# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.
 # Portions copyright (c) 2009 - 2011, Apple Inc. All rights reserved.
 #
 # This program and the accompanying materials
@@ -206,6 +206,7 @@ [FV.FvRecovery]
 INF FatPkg/EnhancedFatDxe/Fat.inf
 
 !ifndef $(USE_OLD_SHELL)
+INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 INF  ShellPkg/Application/Shell/Shell.inf
 !else
 INF  RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
-- 
2.15.0.gvfs.1.preview.4

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


Re: [edk2] [PATCH] OvmfPkg/Sec: Fix 64bit SEC build failure

2017-11-28 Thread Gao, Liming
This is VS CL issue.  It preprocesses below FixedPcdGet32() to the fixed value, 
but lost '\'. So, it will cause nasm compiler failure. To avoid it, we need to 
make sure FixedPcdGet32 (PcdInitValueInTempStack) at one line.

  FixedPcdGet32 (\
PcdInitValueInTempStack  \
)
==> 


0x5AA55AA5U

Thanks
Liming
>-Original Message-
>From: Laszlo Ersek [mailto:ler...@redhat.com]
>Sent: Monday, November 27, 2017 11:03 PM
>To: Ni, Ruiyu 
>Cc: edk2-devel@lists.01.org; Zhu, Yonghong ; Gao,
>Liming ; Ard Biesheuvel ;
>Justen, Jordan L 
>Subject: Re: [PATCH] OvmfPkg/Sec: Fix 64bit SEC build failure
>
>Hi Ray,
>
>adding Ard, Jordan, Liming and Yonghong:
>
>On 11/27/17 02:38, Ruiyu Ni wrote:
>> Original code breaks a single assembly code to multiple lines.
>> But build tool doesn't support such usage in Windows OS environment.
>>
>> Changing the multiple lines to one line to resolve the build failure.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Ruiyu Ni 
>> Cc: Laszlo Ersek 
>> ---
>>  OvmfPkg/Sec/X64/SecEntry.nasm | 6 ++
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/OvmfPkg/Sec/X64/SecEntry.nasm
>b/OvmfPkg/Sec/X64/SecEntry.nasm
>> index 7c55032ac9..d76adcffd8 100644
>> --- a/OvmfPkg/Sec/X64/SecEntry.nasm
>> +++ b/OvmfPkg/Sec/X64/SecEntry.nasm
>> @@ -45,10 +45,8 @@ ASM_PFX(_ModuleEntryPoint):
>>  ; Fill the temporary RAM with the initial stack value.
>>  ; The loop below will seed the heap as well, but that's harmless.
>>  ;
>> -mov rax, (FixedPcdGet32 (\
>> -PcdInitValueInTempStack  \
>> -) << 32) |   \
>> - FixedPcdGet32 (PcdInitValueInTempStack)  ; qword to 
>> store
>> +mov rax, (FixedPcdGet32 (PcdInitValueInTempStack) << 32) |
>FixedPcdGet32 (PcdInitValueInTempStack)
>> +  ; qword to 
>> store
>>  mov rdi, FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) ; base
>address,
>>;   relative 
>> to
>>;   ES
>>
>
>I'd like to understand more about the build failure. As far as I understand, 
>the
>NASM tool itself has no problem with the backslash line continuation; before I
>posted the patch, I checked the NASM manual for this feature.
>
>http://www.nasm.us/doc/nasmdoc3.html#section-3.1
>
>NASM uses backslash (\) as the line continuation character; if a
>line ends with backslash, the next line is considered to be a part
>of the backslash-ended line.
>
>Now, in "BaseTools/Conf/build_rule.template", I see that we have the
>following rule for NASM source files:
>
>[Nasm-Assembly-Code-File.COMMON.COMMON]
>
>?.nasm
>
>
>$(MAKE_FILE)
>
>
>$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
>
>
>"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
>Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii
>${d_path}(+)${s_base}.i
>"$(NASM)" -I${s_path}(+) $(NASM_FLAGS) -o $dst
>${d_path}(+)${s_base}.iii
>
>I guess it's actually the pre-processor (PP) that splices the broken-up lines
>together, as any C language pre-processor is supposed to do.
>
>Why does that not work with the VS toolchains ("cl.exe")?
>
>Is it perhaps a problem with the _PP_FLAGS?
>
>https://msdn.microsoft.com/en-us/library/3xkfswhy.aspx
>https://msdn.microsoft.com/en-us/library/032xwy55.aspx
>
>"/E" seems right (pre-process). Is /TC the problem? ("C language source
>code").
>
>If the problem is impossible to fix in BaseTools, I don't mind the patch, but 
>I'd
>like to see more explanation in the commit message.
>
>(Other assembly files use backslash line continuations too, they just haven't
>been exposed to VS toolchains yet, apparently.)
>
>Thanks
>Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] Include libraries, header files for MdeModulePkg/.../Network maintainer

2017-11-28 Thread Star Zeng
Cc: Siyuan Fu 
Cc: Jiaxin Wu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 Maintainers.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Maintainers.txt b/Maintainers.txt
index fbfc74e183ba..92f12d9ae793 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -167,7 +167,8 @@ MdeModulePkg
 W: https://github.com/tianocore/tianocore.github.io/wiki/MdeModulePkg
 M: Star Zeng 
 M: Eric Dong 
-M: NetworkPkg maintainers (Universal/Network)
+M: NetworkPkg maintainers
+  (Universal/Network and related libraries, header files)
 R: Ruiyu Ni 
   (especially for Bus, Universal/Console, Universal/Disk,
Universal/BdsDxe and related libraries, header files)
-- 
2.7.0.windows.1

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


[edk2] [PATCH] Add Ruiyu as MdeModulePkg reviewer

2017-11-28 Thread Star Zeng
Add Ruiyu as MdeModulePkg reviewer,
especially for some Domains.

Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 Maintainers.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index ffb69c17fe2e..fbfc74e183ba 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -168,6 +168,9 @@ W: 
https://github.com/tianocore/tianocore.github.io/wiki/MdeModulePkg
 M: Star Zeng 
 M: Eric Dong 
 M: NetworkPkg maintainers (Universal/Network)
+R: Ruiyu Ni 
+  (especially for Bus, Universal/Console, Universal/Disk,
+   Universal/BdsDxe and related libraries, header files)
 
 MdePkg
 W: https://github.com/tianocore/tianocore.github.io/wiki/MdePkg
-- 
2.7.0.windows.1

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


[edk2] [PATCH 2/4] MdeModulePkg PeiCore: Support USED_SIZE FV_EXT_TYPE

2017-11-28 Thread Star Zeng
The USED_SIZE FV_EXT_TYPE is introduced by PI 1.6 spec.

The EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE can be used to find
out how many EFI_FVB2_ERASE_POLARITY bytes are at the end of the FV.

When the FV gets shadowed into memory you only need to copy the used
bytes into memory and fill the rest of the memory buffer with the
erase value.

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Core/Pei/FwVol/FwVol.c | 91 +++--
 1 file changed, 88 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c 
b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
index 3da90f95312d..d96d591a47dc 100644
--- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c
+++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
@@ -1295,6 +1295,69 @@ PeiFfsGetVolumeInfo (
 }
 
 /**
+  Find USED_SIZE FV_EXT_TYPE entry in FV extension header and get the FV used 
size.
+
+  @param[in]  FvHeader  Pointer to FV header.
+  @param[out] FvUsedSizePointer to FV used size returned,
+only valid if USED_SIZE FV_EXT_TYPE entry is found.
+  @param[out] EraseByte Pointer to erase byte returned,
+only valid if USED_SIZE FV_EXT_TYPE entry is found.
+
+  @retval TRUE  USED_SIZE FV_EXT_TYPE entry is found,
+FV used size and erase byte are returned.
+  @retval FALSE No USED_SIZE FV_EXT_TYPE entry found.
+
+**/
+BOOLEAN
+GetFvUsedSize (
+  IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader,
+  OUT UINT32*FvUsedSize,
+  OUT UINT8 *EraseByte
+  )
+{
+  UINT16ExtHeaderOffset;
+  EFI_FIRMWARE_VOLUME_EXT_HEADER*ExtHeader;
+  EFI_FIRMWARE_VOLUME_EXT_ENTRY *ExtEntryList;
+  UINTN ExtEntryListSize;
+  EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE  *ExtEntryUsedSize;
+
+  ExtHeaderOffset = ReadUnaligned16 (>ExtHeaderOffset);
+  if (ExtHeaderOffset != 0) {
+ExtHeader = (EFI_FIRMWARE_VOLUME_EXT_HEADER *) ((UINT8 *) FvHeader + 
ExtHeaderOffset);
+ExtEntryList = (EFI_FIRMWARE_VOLUME_EXT_ENTRY *) (ExtHeader + 1);
+ExtEntryListSize = ReadUnaligned32 (>ExtHeaderSize) - sizeof 
(EFI_FIRMWARE_VOLUME_EXT_HEADER);
+while (ExtEntryListSize >= sizeof (EFI_FIRMWARE_VOLUME_EXT_ENTRY)) {
+  if (ReadUnaligned16 (>ExtEntryType) == 
EFI_FV_EXT_TYPE_USED_SIZE_TYPE) {
+//
+// USED_SIZE FV_EXT_TYPE entry is found.
+//
+ExtEntryUsedSize = (EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE *) 
ExtEntryList;
+*FvUsedSize = ReadUnaligned32 (>UsedSize);
+if ((ReadUnaligned32 (>Attributes) & 
EFI_FVB2_ERASE_POLARITY) != 0) {
+  *EraseByte = 0xFF;
+} else {
+  *EraseByte = 0;
+}
+DEBUG ((
+  DEBUG_INFO,
+  "FV at 0x%x has 0x%x used size, and erase byte is 0x%02x\n",
+  FvHeader,
+  *FvUsedSize,
+  *EraseByte
+  ));
+return TRUE;
+  }
+  ExtEntryListSize -= ReadUnaligned16 (>ExtEntrySize);
+}
+  }
+
+  //
+  // No USED_SIZE FV_EXT_TYPE entry found.
+  //
+  return FALSE;
+}
+
+/**
   Get Fv image from the FV type file, then install FV INFO(2) ppi, Build FV 
hob.
 
   @param PrivateData  PeiCore's private data structure
@@ -1326,7 +1389,9 @@ ProcessFvFile (
   EFI_FV_FILE_INFO  FileInfo;
   UINT64FvLength;
   UINT32AuthenticationStatus;
-  
+  UINT32FvUsedSize;
+  UINT8 EraseByte;
+
   //
   // Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has already
   // been extracted.
@@ -1391,8 +1456,16 @@ ProcessFvFile (
   FvAlignment = 8;
 }
 
+DEBUG ((
+  DEBUG_INFO,
+  "%a() FV at 0x%x, FvAlignment required is 0x%x\n",
+  __FUNCTION__,
+  FvHeader,
+  FvAlignment
+  ));
+
 //
-// Check FvImage
+// Check FvImage alignment.
 //
 if ((UINTN) FvHeader % FvAlignment != 0) {
   FvLength= ReadUnaligned64 (>FvLength);
@@ -1400,7 +1473,19 @@ ProcessFvFile (
   if (NewFvBuffer == NULL) {
 return EFI_OUT_OF_RESOURCES;
   }
-  CopyMem (NewFvBuffer, FvHeader, (UINTN) FvLength);
+  if (GetFvUsedSize (FvHeader, , )) {
+//
+// Copy the used bytes and fill the rest with the erase value.
+//
+CopyMem (NewFvBuffer, FvHeader, (UINTN) FvUsedSize);
+SetMem (
+  (UINT8 *) NewFvBuffer + FvUsedSize,
+  (UINTN) (FvLength - FvUsedSize),
+  EraseByte
+  );
+  } else {
+CopyMem (NewFvBuffer, FvHeader, (UINTN) FvLength);
+  }
   FvHeader = (EFI_FIRMWARE_VOLUME_HEADER*) NewFvBuffer;
 }
   }
-- 
2.7.0.windows.1

___
edk2-devel 

[edk2] [PATCH 1/4] MdePkg PiFirmwareVolume.h: Add USED_SIZE FV_EXT_TYPE definitions

2017-11-28 Thread Star Zeng
The definitions are introduced by PI 1.6 spec.

The EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE can be used to find
out how many EFI_FVB2_ERASE_POLARITY bytes are at the end of the FV.

When the FV gets shadowed into memory you only need to copy the used
bytes into memory and fill the rest of the memory buffer with the
erase value.

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 MdePkg/Include/Pi/PiFirmwareVolume.h | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Include/Pi/PiFirmwareVolume.h 
b/MdePkg/Include/Pi/PiFirmwareVolume.h
index 79fde131902e..2482a7f96add 100644
--- a/MdePkg/Include/Pi/PiFirmwareVolume.h
+++ b/MdePkg/Include/Pi/PiFirmwareVolume.h
@@ -1,7 +1,7 @@
 /** @file
   The firmware volume related definitions in PI.
 
-  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2017, 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
@@ -11,7 +11,7 @@
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
   @par Revision Reference:
-  PI Version 1.3
+  PI Version 1.6
 
 **/
 
@@ -231,4 +231,23 @@ typedef struct {
   ///
 } EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE;
 
+#define EFI_FV_EXT_TYPE_USED_SIZE_TYPE 0x03
+
+///
+/// The EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE can be used to find
+/// out how many EFI_FVB2_ERASE_POLARITY bytes are at the end of the FV.
+///
+typedef struct {
+  ///
+  /// Standard extension entry, with the type EFI_FV_EXT_TYPE_USED_SIZE_TYPE.
+  ///
+  EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;
+  ///
+  /// The number of bytes of the FV that are in uses. The remaining
+  /// EFI_FIRMWARE_VOLUME_HEADER FvLength minus UsedSize bytes in
+  /// the FV must contain the value implied by EFI_FVB2_ERASE_POLARITY.
+  ///
+  UINT32UsedSize;
+} EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE;
+
 #endif
-- 
2.7.0.windows.1

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


[edk2] [PATCH 3/4] MdeModulePkg DxeCore: Check FvImage alignment

2017-11-28 Thread Star Zeng
No need to allocate aligned buffer if FvImage has been
at required alignment.

Then the code logic will be aligned with ProcessFvFile() in
MdeModulePkg/Core/Pei/FwVol/FwVol.c.

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 32 ---
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c 
b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
index 5eee71bb2cd3..c7b9224c0e33 100644
--- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
@@ -1023,32 +1023,38 @@ CoreProcessFvImageFile (
 // can be aligned on any power-of-two boundary. A weakly aligned volume 
can not be moved from
 // its initial linked location and maintain its alignment.
 //
-if ((FvHeader->Attributes & EFI_FVB2_WEAK_ALIGNMENT) != 
EFI_FVB2_WEAK_ALIGNMENT) {
+if ((ReadUnaligned32 (>Attributes) & EFI_FVB2_WEAK_ALIGNMENT) != 
EFI_FVB2_WEAK_ALIGNMENT) {
   //
   // Get FvHeader alignment
   //
-  FvAlignment = 1 << ((FvHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);
+  FvAlignment = 1 << ((ReadUnaligned32 (>Attributes) & 
EFI_FVB2_ALIGNMENT) >> 16);
   //
   // FvAlignment must be greater than or equal to 8 bytes of the minimum 
FFS alignment value.
   //
   if (FvAlignment < 8) {
 FvAlignment = 8;
   }
+
   //
-  // Allocate the aligned buffer for the FvImage.
+  // Check FvImage alignment.
   //
-  AlignedBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES (BufferSize), 
(UINTN) FvAlignment);
-  if (AlignedBuffer == NULL) {
-FreePool (Buffer);
-return EFI_OUT_OF_RESOURCES;
-  } else {
+  if ((UINTN) FvHeader % FvAlignment != 0) {
 //
-// Move FvImage into the aligned buffer and release the original 
buffer.
+// Allocate the aligned buffer for the FvImage.
 //
-CopyMem (AlignedBuffer, Buffer, BufferSize);
-FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) AlignedBuffer;
-CoreFreePool (Buffer);
-Buffer = NULL;
+AlignedBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES (BufferSize), 
(UINTN) FvAlignment);
+if (AlignedBuffer == NULL) {
+  FreePool (Buffer);
+  return EFI_OUT_OF_RESOURCES;
+} else {
+  //
+  // Move FvImage into the aligned buffer and release the original 
buffer.
+  //
+  CopyMem (AlignedBuffer, Buffer, BufferSize);
+  FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) AlignedBuffer;
+  CoreFreePool (Buffer);
+  Buffer = NULL;
+}
   }
 }
 //
-- 
2.7.0.windows.1

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


[edk2] [PATCH 4/4] MdeModulePkg DxeCore: Support USED_SIZE FV_EXT_TYPE

2017-11-28 Thread Star Zeng
The USED_SIZE FV_EXT_TYPE is introduced by PI 1.6 spec.

The EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE can be used to find
out how many EFI_FVB2_ERASE_POLARITY bytes are at the end of the FV.

When the FV gets shadowed into memory you only need to copy the used
bytes into memory and fill the rest of the memory buffer with the
erase value.

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 85 ++-
 1 file changed, 84 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c 
b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
index c7b9224c0e33..1a013ba6ffed 100644
--- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
@@ -938,7 +938,68 @@ FvFoundInHobFv2 (
   return FALSE;
 }
 
+/**
+  Find USED_SIZE FV_EXT_TYPE entry in FV extension header and get the FV used 
size.
+
+  @param[in]  FvHeader  Pointer to FV header.
+  @param[out] FvUsedSizePointer to FV used size returned,
+only valid if USED_SIZE FV_EXT_TYPE entry is found.
+  @param[out] EraseByte Pointer to erase byte returned,
+only valid if USED_SIZE FV_EXT_TYPE entry is found.
 
+  @retval TRUE  USED_SIZE FV_EXT_TYPE entry is found,
+FV used size and erase byte are returned.
+  @retval FALSE No USED_SIZE FV_EXT_TYPE entry found.
+
+**/
+BOOLEAN
+GetFvUsedSize (
+  IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader,
+  OUT UINT32*FvUsedSize,
+  OUT UINT8 *EraseByte
+  )
+{
+  UINT16ExtHeaderOffset;
+  EFI_FIRMWARE_VOLUME_EXT_HEADER*ExtHeader;
+  EFI_FIRMWARE_VOLUME_EXT_ENTRY *ExtEntryList;
+  UINTN ExtEntryListSize;
+  EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE  *ExtEntryUsedSize;
+
+  ExtHeaderOffset = ReadUnaligned16 (>ExtHeaderOffset);
+  if (ExtHeaderOffset != 0) {
+ExtHeader = (EFI_FIRMWARE_VOLUME_EXT_HEADER *) ((UINT8 *) FvHeader + 
ExtHeaderOffset);
+ExtEntryList = (EFI_FIRMWARE_VOLUME_EXT_ENTRY *) (ExtHeader + 1);
+ExtEntryListSize = ReadUnaligned32 (>ExtHeaderSize) - sizeof 
(EFI_FIRMWARE_VOLUME_EXT_HEADER);
+while (ExtEntryListSize >= sizeof (EFI_FIRMWARE_VOLUME_EXT_ENTRY)) {
+  if (ReadUnaligned16 (>ExtEntryType) == 
EFI_FV_EXT_TYPE_USED_SIZE_TYPE) {
+//
+// USED_SIZE FV_EXT_TYPE entry is found.
+//
+ExtEntryUsedSize = (EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE *) 
ExtEntryList;
+*FvUsedSize = ReadUnaligned32 (>UsedSize);
+if ((ReadUnaligned32 (>Attributes) & 
EFI_FVB2_ERASE_POLARITY) != 0) {
+  *EraseByte = 0xFF;
+} else {
+  *EraseByte = 0;
+}
+DEBUG ((
+  DEBUG_INFO,
+  "FV at 0x%x has 0x%x used size, and erase byte is 0x%02x\n",
+  FvHeader,
+  *FvUsedSize,
+  *EraseByte
+  ));
+return TRUE;
+  }
+  ExtEntryListSize -= ReadUnaligned16 (>ExtEntrySize);
+}
+  }
+
+  //
+  // No USED_SIZE FV_EXT_TYPE entry found.
+  //
+  return FALSE;
+}
 
 /**
   Get the driver from the FV through driver name, and produce a FVB protocol 
on FvHandle.
@@ -968,6 +1029,8 @@ CoreProcessFvImageFile (
   EFI_FIRMWARE_VOLUME_HEADER  *FvHeader;
   UINT32  FvAlignment;
   EFI_DEVICE_PATH_PROTOCOL*FvFileDevicePath;
+  UINT32  FvUsedSize;
+  UINT8   EraseByte;
 
   //
   // Read the first (and only the first) firmware volume section
@@ -1035,6 +1098,14 @@ CoreProcessFvImageFile (
 FvAlignment = 8;
   }
 
+  DEBUG ((
+DEBUG_INFO,
+"%a() FV at 0x%x, FvAlignment required is 0x%x\n",
+__FUNCTION__,
+FvHeader,
+FvAlignment
+));
+
   //
   // Check FvImage alignment.
   //
@@ -1050,7 +1121,19 @@ CoreProcessFvImageFile (
   //
   // Move FvImage into the aligned buffer and release the original 
buffer.
   //
-  CopyMem (AlignedBuffer, Buffer, BufferSize);
+  if (GetFvUsedSize (FvHeader, , )) {
+//
+// Copy the used bytes and fill the rest with the erase value.
+//
+CopyMem (AlignedBuffer, FvHeader, (UINTN) FvUsedSize);
+SetMem (
+  (UINT8 *) AlignedBuffer + FvUsedSize,
+  (UINTN) (BufferSize - FvUsedSize),
+  EraseByte
+  );
+  } else {
+CopyMem (AlignedBuffer, Buffer, BufferSize);
+  }
   FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) AlignedBuffer;
   CoreFreePool (Buffer);
   Buffer = NULL;
-- 
2.7.0.windows.1


[edk2] [PATCH 0/4] Add USED_SIZE FV_EXT_TYPE support

2017-11-28 Thread Star Zeng
The USED_SIZE FV_EXT_TYPE is introduced by PI 1.6 spec.

The EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE can be used to find
out how many EFI_FVB2_ERASE_POLARITY bytes are at the end of the FV.

When the FV gets shadowed into memory you only need to copy the used
bytes into memory and fill the rest of the memory buffer with the
erase value.

Cc: Liming Gao 

Star Zeng (4):
  MdePkg PiFirmwareVolume.h: Add USED_SIZE FV_EXT_TYPE definitions
  MdeModulePkg PeiCore: Support USED_SIZE FV_EXT_TYPE
  MdeModulePkg DxeCore: Check FvImage alignment
  MdeModulePkg DxeCore: Support USED_SIZE FV_EXT_TYPE

 MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 115 +++---
 MdeModulePkg/Core/Pei/FwVol/FwVol.c   |  91 +++-
 MdePkg/Include/Pi/PiFirmwareVolume.h  |  23 +-
 3 files changed, 211 insertions(+), 18 deletions(-)

-- 
2.7.0.windows.1

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


[edk2] [PATCH] ShellPkg: Fix the bug that handling Ctrl-C improperly

2017-11-28 Thread Ruiyu Ni
Current implementation resets the CTRL-C event early when printing
the shell prompt, when user types "ls", "ls" command
is terminated immediately when starts.
It's not an expected behavior from users' perspective.
Correct way is to reset the CTRL-C event just before running the
command, which is a bit later than current point.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Jaben Carsey 
---
 ShellPkg/Application/Shell/Shell.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/ShellPkg/Application/Shell/Shell.c 
b/ShellPkg/Application/Shell/Shell.c
index 2adc99240c..577e17311b 100644
--- a/ShellPkg/Application/Shell/Shell.c
+++ b/ShellPkg/Application/Shell/Shell.c
@@ -620,11 +620,6 @@ UefiMain (
   ShellInfoObject.ConsoleInfo->Enabled= TRUE;
   ShellInfoObject.ConsoleInfo->RowCounter = 0;
 
-  //
-  // Reset the CTRL-C event (yes we ignore the return values)
-  //
-  Status = gBS->CheckEvent 
(ShellInfoObject.NewEfiShellProtocol->ExecutionBreak);
-
   //
   // Display Prompt
   //
@@ -1346,9 +1341,14 @@ DoShellPrompt (
   // Null terminate the string and parse it
   //
   if (!EFI_ERROR (Status)) {
+//
+// Reset the CTRL-C event just before running the command (yes we ignore 
the return values)
+//
+Status = gBS->CheckEvent 
(ShellInfoObject.NewEfiShellProtocol->ExecutionBreak);
+
 CmdLine[BufferSize / sizeof (CHAR16)] = CHAR_NULL;
 Status = RunCommand(CmdLine);
-}
+  }
 
   //
   // Done with this command
-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [PATCH 5/6] CorebootPayloadPkg: Fix build failure due to Tftp/Dp library removal

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Maurice Ma 
Cc: Prince Agyeman 
Cc: Benjamin You 
---
 CorebootPayloadPkg/CorebootPayloadPkg.fdf|  4 +++-
 CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc| 21 +++--
 CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc | 21 +++--
 3 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/CorebootPayloadPkg/CorebootPayloadPkg.fdf 
b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
index 303e626842..7994f0c949 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkg.fdf
+++ b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
@@ -3,7 +3,7 @@
 #
 # Provides drivers and definitions to create uefi payload for coreboot.
 #
-# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.
 # This program and the accompanying materials are licensed and made available 
under
 # the terms and conditions of the BSD License that accompanies this 
distribution.
 # The full text of the license may be found at
@@ -180,6 +180,8 @@ [FV.DXEFV]
 # Shell
 #
 !if $(SHELL_TYPE) == BUILD_SHELL
+INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+INF ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
 INF ShellPkg/Application/Shell/Shell.inf
 !endif
 
diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc 
b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
index cdfcb75b59..d2283bcba4 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
+++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
@@ -3,7 +3,7 @@
 #
 # Provides drivers and definitions to create uefi payload for coreboot.
 #
-# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.
 # This program and the accompanying materials are licensed and made available 
under
 # the terms and conditions of the BSD License that accompanies this 
distribution.
 # The full text of the license may be found at
@@ -515,11 +515,6 @@ [Components.IA32]
 
 !if $(SHELL_TYPE) == BUILD_SHELL
 
-[PcdsFixedAtBuild]
-  ## This flag is used to control initialization of the shell library
-  #  This should be FALSE for compiling the shell application itself only.
-  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
-
   #
   # Shell Lib
   #
@@ -529,7 +524,13 @@ [LibraryClasses]
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
 
 [Components.IA32]
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+  ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
   ShellPkg/Application/Shell/Shell.inf {
+
+  ## This flag is used to control initialization of the shell library
+  #  This should be FALSE for compiling the shell application itself only.
+  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
 
 #--
 #  Basic commands
@@ -549,14 +550,6 @@ [Components.IA32]
 
 
   
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
-  NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
-
-#--
-#  Performance command
-#--
-
-
-  NULL|ShellPkg/Library/UefiDpLib/UefiDpLib.inf
 
 #--
 #  Support libraries
diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc 
b/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
index 6b16af63ba..d214da24d6 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
+++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
@@ -3,7 +3,7 @@
 #
 # Provides drivers and definitions to create uefi payload for coreboot.
 #
-# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.
 # This program and the accompanying materials are licensed and made available 
under
 # the terms and conditions of the BSD License that accompanies this 
distribution.
 # The full text of the license may be found at
@@ -516,11 +516,6 @@ [Components.X64]
 
 !if $(SHELL_TYPE) == BUILD_SHELL
 
-[PcdsFixedAtBuild]
-  ## This flag is used to control initialization of the shell library
-  #  This should be FALSE for compiling the shell application itself only.
-  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
-
   #
   # Shell Lib
   #
@@ -530,7 +525,13 @@ [LibraryClasses]
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
 
 [Components.X64]
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+  ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
   ShellPkg/Application/Shell/Shell.inf {
+
+  ## This flag is used to control initialization of the shell library
+  #  This should be FALSE for 

[edk2] [PATCH 3/6] ArmVirtPkg: Fix build failure due to Tftp library removal

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Julien Grall 
---
 ArmVirtPkg/ArmVirt.dsc.inc   | 3 +--
 ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 3 ++-
 ArmVirtPkg/ArmVirtXen.fdf| 3 ++-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 5d7edff104..4d077c8ff9 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -1,7 +1,7 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2017, 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
@@ -393,7 +393,6 @@ [Components.common]
   
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
-  NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc 
b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
index 744006d13c..89f95b2d99 100644
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
@@ -1,7 +1,7 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2017, 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
@@ -103,6 +103,7 @@ [FV.FvMain]
   # UEFI application (Shell Embedded Boot Loader)
   #
   INF ShellPkg/Application/Shell/Shell.inf
+  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 
   #
   # Bds
diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
index 70e76df228..6586ce6be5 100644
--- a/ArmVirtPkg/ArmVirtXen.fdf
+++ b/ArmVirtPkg/ArmVirtXen.fdf
@@ -1,7 +1,7 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2017, 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
@@ -169,6 +169,7 @@ [FV.FvMain]
   # UEFI application (Shell Embedded Boot Loader)
   #
   INF ShellPkg/Application/Shell/Shell.inf
+  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 
   #
   # Bds
-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [PATCH 4/6] BeagleBoardPkg: Fix build failure due to Tftp library removal

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
---
 BeagleBoardPkg/BeagleBoardPkg.dsc | 14 ++
 BeagleBoardPkg/BeagleBoardPkg.fdf |  3 ++-
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc 
b/BeagleBoardPkg/BeagleBoardPkg.dsc
index 4f7c0bd645..c64449510e 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.dsc
+++ b/BeagleBoardPkg/BeagleBoardPkg.dsc
@@ -2,7 +2,7 @@
 # Beagle board package.
 #
 # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
-# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
 # Copyright (c) 2016, Linaro Ltd. All rights reserved.
 #
 #This program and the accompanying materials
@@ -355,11 +355,6 @@ [PcdsFixedAtBuild.common]
   # OMAP Interrupt Controller
   gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress|0x4820
 
-  # We want to use the Shell Libraries but don't want it to initialise
-  # automatically. We initialise the libraries when the command is called by 
the
-  # Shell.
-  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
-
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|10
 
   # GUID of the UEFI Shell
@@ -487,6 +482,11 @@ [Components.common]
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
   }
+
+  #
+  # Shell
+  #
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
@@ -496,8 +496,6 @@ [Components.common]
   
NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
-  
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
-  NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
diff --git a/BeagleBoardPkg/BeagleBoardPkg.fdf 
b/BeagleBoardPkg/BeagleBoardPkg.fdf
index c9c6afd714..71249c7eb3 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.fdf
+++ b/BeagleBoardPkg/BeagleBoardPkg.fdf
@@ -1,7 +1,7 @@
 # FLASH layout file for Beagle board.
 #
 # Copyright (c) 2009, Apple Inc. All rights reserved.
-# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
 # Copyright (c) 2016, Linaro, Ltd. All rights reserved.
 #
 #This program and the accompanying materials
@@ -178,6 +178,7 @@ [FV.FvMain]
   # UEFI application (Shell Embedded Boot Loader)
   #
   INF ShellPkg/Application/Shell/Shell.inf
+  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 
   #
   # Bds
-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [PATCH 0/6] Fix build failure due to Tftp/Dp library removal

2017-11-28 Thread Ruiyu Ni
Ruiyu Ni (6):
  ShellPkg/tftp: Correct file comments header of Tftp.uni
  EmulatorPkg: Fix build failure due to Tftp library removal
  ArmVirtPkg: Fix build failure due to Tftp library removal
  BeagleBoardPkg: Fix build failure due to Tftp library removal
  CorebootPayloadPkg: Fix build failure due to Tftp/Dp library removal
  OvmfPkg: Add tftp dynamic command

 ArmVirtPkg/ArmVirt.dsc.inc  |  3 +--
 ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc|  3 ++-
 ArmVirtPkg/ArmVirtXen.fdf   |  3 ++-
 BeagleBoardPkg/BeagleBoardPkg.dsc   | 14 ++
 BeagleBoardPkg/BeagleBoardPkg.fdf   |  3 ++-
 CorebootPayloadPkg/CorebootPayloadPkg.fdf   |  4 +++-
 CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc   | 21 +++--
 CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc| 21 +++--
 EmulatorPkg/EmulatorPkg.dsc |  2 +-
 EmulatorPkg/EmulatorPkg.fdf |  3 ++-
 OvmfPkg/OvmfPkgIa32.dsc |  1 +
 OvmfPkg/OvmfPkgIa32.fdf |  3 ++-
 OvmfPkg/OvmfPkgIa32X64.dsc  |  1 +
 OvmfPkg/OvmfPkgIa32X64.fdf  |  3 ++-
 OvmfPkg/OvmfPkgX64.dsc  |  1 +
 OvmfPkg/OvmfPkgX64.fdf  |  1 +
 ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni |  4 ++--
 17 files changed, 43 insertions(+), 48 deletions(-)

-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [PATCH 2/6] EmulatorPkg: Fix build failure due to Tftp library removal

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Andrew Fish 
---
 EmulatorPkg/EmulatorPkg.dsc | 2 +-
 EmulatorPkg/EmulatorPkg.fdf | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index ce0ae64dba..6f52d7ac82 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -378,6 +378,7 @@ [Components]
   FatPkg/EnhancedFatDxe/Fat.inf
 
 !ifndef $(USE_OLD_SHELL)
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
@@ -388,7 +389,6 @@ [Components]
   
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
-  NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
   
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
diff --git a/EmulatorPkg/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf
index 377de59b5a..314eb7b895 100644
--- a/EmulatorPkg/EmulatorPkg.fdf
+++ b/EmulatorPkg/EmulatorPkg.fdf
@@ -1,7 +1,7 @@
 ## @file
 # This is Emulator FDF file with UEFI HII features enabled
 #
-# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.
 # Portions copyright (c) 2009 - 2011, Apple Inc. All rights reserved.
 #
 # This program and the accompanying materials
@@ -206,6 +206,7 @@ [FV.FvRecovery]
 INF FatPkg/EnhancedFatDxe/Fat.inf
 
 !ifndef $(USE_OLD_SHELL)
+INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 INF  ShellPkg/Application/Shell/Shell.inf
 !else
 INF  RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [PATCH 6/6] OvmfPkg: Add tftp dynamic command

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Anthony Perard 
Cc: Julien Grall 
---
 OvmfPkg/OvmfPkgIa32.dsc| 1 +
 OvmfPkg/OvmfPkgIa32.fdf| 3 ++-
 OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
 OvmfPkg/OvmfPkgIa32X64.fdf | 3 ++-
 OvmfPkg/OvmfPkgX64.dsc | 1 +
 OvmfPkg/OvmfPkgX64.fdf | 1 +
 6 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 19fa0b4c8d..1acaa279c7 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -783,6 +783,7 @@ [Components]
 !endif
 
 !ifndef $(USE_OLD_SHELL)
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 06a439f8cb..ba980834d7 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -1,7 +1,7 @@
 ## @file
 #  Open Virtual Machine Firmware: FDF
 #
-#  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #
 #  This program and the accompanying materials
@@ -285,6 +285,7 @@ [FV.DXEFV]
 INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
 
 !ifndef $(USE_OLD_SHELL)
+INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 INF  ShellPkg/Application/Shell/Shell.inf
 !else
 INF  RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index e1555dbfa8..eac53947c1 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -792,6 +792,7 @@ [Components.X64]
 !endif
 
 !ifndef $(USE_OLD_SHELL)
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index ced4c5639f..72ac82e76b 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -1,7 +1,7 @@
 ## @file
 #  Open Virtual Machine Firmware: FDF
 #
-#  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #
 #  This program and the accompanying materials
@@ -286,6 +286,7 @@ [FV.DXEFV]
 INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
 
 !ifndef $(USE_OLD_SHELL)
+INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 INF  ShellPkg/Application/Shell/Shell.inf
 !else
 INF  RuleOverride = BINARY USE = X64 EdkShellBinPkg/FullShell/FullShell.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 83d63e55d7..f4a34e7f14 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -790,6 +790,7 @@ [Components]
 !endif
 
 !ifndef $(USE_OLD_SHELL)
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
   ShellPkg/Application/Shell/Shell.inf {
 
   
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 62dd58f6e4..b9887e4386 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -286,6 +286,7 @@ [FV.DXEFV]
 INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
 
 !ifndef $(USE_OLD_SHELL)
+INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 INF  ShellPkg/Application/Shell/Shell.inf
 !else
 INF  RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [PATCH 1/6] ShellPkg/tftp: Correct file comments header of Tftp.uni

2017-11-28 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Jaben Carsey 
---
 ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni 
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
index 4f4447d67a..1393ba5679 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
@@ -1,7 +1,7 @@
 // /**
 //
 // (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
-// Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved. 
+// Copyright (c) 2010 - 2017, 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
@@ -12,7 +12,7 @@
 //
 // Module Name:
 //
-// UefiShellTftpCommandLib.uni
+// Tftp.uni
 //
 // Abstract:
 //
-- 
2.15.0.gvfs.1.preview.4

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


[edk2] [platforms: PATCH v3 4/4] Marvell/Armada: Enable variables support

2017-11-28 Thread Marcin Wojtas
Wire up the non-volatile EFI variable store support, by switching from
the emulation driver to the real one. Define default values for
memory mapped SPI access, which must be configured by the early
firmware. In order to ensure proper execution, configure initialization
order with Depex entries.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
Reviewed-by: Leif Lindholm 
---
 Platform/Marvell/Armada/Armada.dsc.inc | 25 +++-
 Platform/Marvell/Armada/Armada70x0.fdf |  6 -
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/Platform/Marvell/Armada/Armada.dsc.inc 
b/Platform/Marvell/Armada/Armada.dsc.inc
index 0c873fb..0da271e 100644
--- a/Platform/Marvell/Armada/Armada.dsc.inc
+++ b/Platform/Marvell/Armada/Armada.dsc.inc
@@ -364,6 +364,17 @@
   # TRNG
   gMarvellTokenSpaceGuid.PcdEip76TrngBaseAddress|0xF276
 
+  #
+  # Variable store - default values
+  #
+  gMarvellTokenSpaceGuid.PcdSpiMemoryBase|0xF900
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0xF93C
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x0001
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0xF93D
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x0001
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0xF93E
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x0001
+
 

 #
 # Components Section - list of all EDK II Modules needed by this Platform
@@ -421,7 +432,6 @@
   MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
   MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
   MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
-  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
 
   EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf
   MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
@@ -478,6 +488,19 @@
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
   }
 
+  #
+  # Variable services
+  #
+  Platform/Marvell/Drivers/Spi/Variables/MvFvbDxe.inf
+  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
+
+  
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
+  NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
+  
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
+  VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+  }
+
   # UEFI application (Shell Embedded Boot Loader)
   ShellPkg/Application/Shell/Shell.inf {
 
diff --git a/Platform/Marvell/Armada/Armada70x0.fdf 
b/Platform/Marvell/Armada/Armada70x0.fdf
index ec2c368..ca92c60 100644
--- a/Platform/Marvell/Armada/Armada70x0.fdf
+++ b/Platform/Marvell/Armada/Armada70x0.fdf
@@ -103,7 +103,6 @@ FvNameGuid = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c
   INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
   INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
   INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
-  INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
   INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf
   INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
   INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
@@ -115,6 +114,11 @@ FvNameGuid = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c
   INF Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.inf
   INF Platform/Marvell/Armada/Drivers/Armada70x0RngDxe/Armada70x0RngDxe.inf
 
+  # Variable services
+  INF Platform/Marvell/Drivers/Spi/Variables/MvFvbDxe.inf
+  INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+  INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
+
   # Network support
   INF MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
   INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-- 
2.7.4

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


[edk2] [platforms: PATCH v3 3/4] Marvell/Drivers: MvSpiDxe: Enable using driver in RT

2017-11-28 Thread Marcin Wojtas
This patch applies necessary modifications, which allow to use
MvSpiDxe driver in variable support as a runtime service.

The driver's type is modified to DXE_RUNTIME_DRIVER, as well as
a new callback is introduced as a part of the SpiMasterProtocol.
It configures the memory space for mmio access to the host
controller registers.

Apply locking in the driver only during boot services. Once at
runtime, resource protection is handled by the operating system.

Moreover ensure proper execution order before MvSpiFlashDxe
(and hence MvFvbDxe) by setting according Depex dependency.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
Reviewed-by: Leif Lindholm 
---
 Platform/Marvell/Drivers/Spi/MvSpiDxe.c   | 50 ++--
 Platform/Marvell/Drivers/Spi/MvSpiDxe.h   |  2 +
 Platform/Marvell/Drivers/Spi/MvSpiDxe.inf |  9 +++-
 Platform/Marvell/Include/Protocol/Spi.h   |  7 +++
 Platform/Marvell/Marvell.dec  |  1 +
 5 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/Platform/Marvell/Drivers/Spi/MvSpiDxe.c 
b/Platform/Marvell/Drivers/Spi/MvSpiDxe.c
index c60a520..bab6cf4 100755
--- a/Platform/Marvell/Drivers/Spi/MvSpiDxe.c
+++ b/Platform/Marvell/Drivers/Spi/MvSpiDxe.c
@@ -211,7 +211,9 @@ MvSpiTransfer (
 
   Length = 8 * DataByteCount;
 
-  EfiAcquireLock (>Lock);
+  if (!EfiAtRuntime ()) {
+EfiAcquireLock (>Lock);
+  }
 
   if (Flag & SPI_TRANSFER_BEGIN) {
 SpiActivateCs (Slave);
@@ -254,7 +256,9 @@ MvSpiTransfer (
 SpiDeactivateCs (Slave);
   }
 
-  EfiReleaseLock (>Lock);
+  if (!EfiAtRuntime ()) {
+EfiReleaseLock (>Lock);
+  }
 
   return EFI_SUCCESS;
 }
@@ -338,6 +342,44 @@ MvSpiFreeSlave (
   return EFI_SUCCESS;
 }
 
+EFI_STATUS
+EFIAPI
+MvSpiConfigRuntime (
+  IN SPI_DEVICE *Slave
+  )
+{
+  EFI_STATUS Status;
+  UINTN AlignedAddress;
+
+  //
+  // Host register base may be not aligned to the page size,
+  // which is not accepted when setting memory space attributes.
+  // Add one aligned page of memory space which covers the host
+  // controller registers.
+  //
+  AlignedAddress = Slave->HostRegisterBaseAddress & ~(SIZE_4KB - 1);
+
+  Status = gDS->AddMemorySpace (EfiGcdMemoryTypeMemoryMappedIo,
+  AlignedAddress,
+  SIZE_4KB,
+  EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "%a: Failed to add memory space\n", __FUNCTION__));
+return Status;
+  }
+
+  Status = gDS->SetMemorySpaceAttributes (AlignedAddress,
+  SIZE_4KB,
+  EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "%a: Failed to set memory attributes\n", 
__FUNCTION__));
+gDS->RemoveMemorySpace (AlignedAddress, SIZE_4KB);
+return Status;
+  }
+
+  return EFI_SUCCESS;
+}
+
 STATIC
 EFI_STATUS
 SpiMasterInitProtocol (
@@ -350,6 +392,7 @@ SpiMasterInitProtocol (
   SpiMasterProtocol->FreeDevice  = MvSpiFreeSlave;
   SpiMasterProtocol->Transfer= MvSpiTransfer;
   SpiMasterProtocol->ReadWrite   = MvSpiReadWrite;
+  SpiMasterProtocol->ConfigRuntime = MvSpiConfigRuntime;
 
   return EFI_SUCCESS;
 }
@@ -363,8 +406,7 @@ SpiMasterEntryPoint (
 {
   EFI_STATUS  Status;
 
-  mSpiMasterInstance = AllocateZeroPool (sizeof (SPI_MASTER));
-
+  mSpiMasterInstance = AllocateRuntimeZeroPool (sizeof (SPI_MASTER));
   if (mSpiMasterInstance == NULL) {
 return EFI_OUT_OF_RESOURCES;
   }
diff --git a/Platform/Marvell/Drivers/Spi/MvSpiDxe.h 
b/Platform/Marvell/Drivers/Spi/MvSpiDxe.h
index e7e280a..50cdc02 100644
--- a/Platform/Marvell/Drivers/Spi/MvSpiDxe.h
+++ b/Platform/Marvell/Drivers/Spi/MvSpiDxe.h
@@ -38,10 +38,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
diff --git a/Platform/Marvell/Drivers/Spi/MvSpiDxe.inf 
b/Platform/Marvell/Drivers/Spi/MvSpiDxe.inf
index 08c6c04..ac0e407 100644
--- a/Platform/Marvell/Drivers/Spi/MvSpiDxe.inf
+++ b/Platform/Marvell/Drivers/Spi/MvSpiDxe.inf
@@ -33,7 +33,7 @@
   INF_VERSION= 0x00010005
   BASE_NAME  = SpiMasterDxe
   FILE_GUID  = c19dbc8a-f4f9-43b0-aee5-802e3ed03d15
-  MODULE_TYPE= DXE_DRIVER
+  MODULE_TYPE= DXE_RUNTIME_DRIVER
   VERSION_STRING = 1.0
   ENTRY_POINT= SpiMasterEntryPoint
 
@@ -53,8 +53,10 @@
   TimerLib
   UefiLib
   DebugLib
+  DxeServicesTableLib
   MemoryAllocationLib
   IoLib
+  UefiRuntimeLib
 
 [FixedPcd]
   gMarvellTokenSpaceGuid.PcdSpiRegBase
@@ -65,4 +67,7 @@
   gMarvellSpiMasterProtocolGuid
 
 [Depex]
-  TRUE
+  #
+  # MvSpiDxe must be loaded prior to MvSpiFlash driver
+  #
+  BEFORE gMarvellSpiFlashDxeGuid
diff --git a/Platform/Marvell/Include/Protocol/Spi.h 
b/Platform/Marvell/Include/Protocol/Spi.h
index d993021..abbad19 

[edk2] [platforms: PATCH v3 1/4] Platform/Marvell: Introduce MvFvbDxe variable support driver

2017-11-28 Thread Marcin Wojtas
MvFvbDxe driver introduces non-volatile EFI variable support
for Armada platforms. It relies on memory-mapped SPI read access.
Implementation of EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL
is done with using existing Marvell SPI infrastructure
(SpiMasterProtocol and SpiFlashProtocol), thanks to which
this driver will be able to support various combinations of
flash devices and host controllers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
---
 Platform/Marvell/Drivers/Spi/Variables/MvFvbDxe.c   | 1138 
 Platform/Marvell/Drivers/Spi/Variables/MvFvbDxe.h   |  128 +++
 Platform/Marvell/Drivers/Spi/Variables/MvFvbDxe.inf |   91 ++
 Platform/Marvell/Marvell.dec|1 +
 4 files changed, 1358 insertions(+)

diff --git a/Platform/Marvell/Drivers/Spi/Variables/MvFvbDxe.c 
b/Platform/Marvell/Drivers/Spi/Variables/MvFvbDxe.c
new file mode 100644
index 000..252ef67
--- /dev/null
+++ b/Platform/Marvell/Drivers/Spi/Variables/MvFvbDxe.c
@@ -0,0 +1,1138 @@
+/*++ @file  MvFvbDxe.c
+
+ Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
+ Copyright (c) 2017 Marvell International Ltd.
+
+ 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "MvFvbDxe.h"
+
+STATIC EFI_EVENT mFvbVirtualAddrChangeEvent;
+STATIC FVB_DEVICE*mFvbDevice;
+
+STATIC CONST FVB_DEVICE mMvFvbFlashInstanceTemplate = {
+  {
+0,// SpiFlash Chip Select ... NEED TO BE FILLED
+0,// SpiFlash Maximum Frequency ... NEED TO BE FILLED
+0,// SpiFlash Transfer Mode ... NEED TO BE FILLED
+0,// SpiFlash Address Size ... NEED TO BE FILLED
+NULL, // SpiFlash detailed information ... NEED TO BE FILLED
+0,// HostRegisterBaseAddress ... NEED TO BE FILLED
+0,// CoreClock ... NEED TO BE FILLED
+  }, // SpiDevice
+
+  NULL, // SpiFlashProtocol ... NEED TO BE FILLED
+  NULL, // SpiMasterProtocol ... NEED TO BE FILLED
+  NULL, // Handle ... NEED TO BE FILLED
+
+  FVB_FLASH_SIGNATURE, // Signature
+
+  0, // DeviceBaseAddress ... NEED TO BE FILLED
+  0, // RegionBaseAddress ... NEED TO BE FILLED
+  SIZE_256KB, // Size
+  0, // FvbOffset ... NEED TO BE FILLED
+  0, // FvbSize ... NEED TO BE FILLED
+  0, // StartLba
+
+  {
+0, // MediaId ... NEED TO BE FILLED
+FALSE, // RemovableMedia
+TRUE,  // MediaPresent
+FALSE, // LogicalPartition
+FALSE, // ReadOnly
+FALSE, // WriteCaching;
+0, // BlockSize ... NEED TO BE FILLED
+4, // IoAlign
+0, // LastBlock ... NEED TO BE FILLED
+0, // LowestAlignedLba
+1, // LogicalBlocksPerPhysicalBlock
+  }, //Media;
+
+  {
+MvFvbGetAttributes,   // GetAttributes
+MvFvbSetAttributes,   // SetAttributes
+MvFvbGetPhysicalAddress,  // GetPhysicalAddress
+MvFvbGetBlockSize,// GetBlockSize
+MvFvbRead,// Read
+MvFvbWrite,   // Write
+MvFvbEraseBlocks, // EraseBlocks
+NULL, // ParentHandle
+  }, //  FvbProtocol;
+
+  {
+{
+  {
+HARDWARE_DEVICE_PATH,
+HW_VENDOR_DP,
+{
+  (UINT8)sizeof (VENDOR_DEVICE_PATH),
+  (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+}
+  },
+  { 0xfc0cb972, 0x21df, 0x44d2, { 0x92, 0xa5, 0x78, 0x98, 0x99, 0xcb, 
0xf6, 0x61 } }
+},
+{
+  END_DEVICE_PATH_TYPE,
+  END_ENTIRE_DEVICE_PATH_SUBTYPE,
+  { sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 }
+}
+  } // DevicePath
+};
+
+//
+// The Firmware Volume Block Protocol is the low-level interface
+// to a firmware volume. File-level access to a firmware volume
+// should not be done using the Firmware Volume Block Protocol.
+// Normal access to a firmware volume must use the Firmware
+// Volume Protocol. Typically, only the file system driver that
+// produces the Firmware Volume Protocol will bind to the
+// Firmware Volume Block Protocol.
+//
+
+/**
+  Initialises the FV Header and Variable Store Header
+  to support variable operations.
+
+  @param[in]  Ptr - Location to initialise the headers
+
+**/
+STATIC
+EFI_STATUS
+MvFvbInitFvAndVariableStoreHeaders (
+  IN FVB_DEVICE *FlashInstance
+  )
+{
+  EFI_FIRMWARE_VOLUME_HEADER  *FirmwareVolumeHeader;
+  VARIABLE_STORE_HEADER   *VariableStoreHeader;
+  EFI_STATUS  Status;
+  VOID*   Headers;
+  UINTN   HeadersLength;
+  UINTN   

[edk2] [platforms: PATCH v3 2/4] Marvell/Drivers: MvSpiFlash: Enable using driver in RT

2017-11-28 Thread Marcin Wojtas
This patch applies necessary modifications, which allow to use
MvSpiFlash driver in variable support as a runtime service.
Its type is modified to DXE_RUNTIME_DRIVER, as well as
an event is created, which converts the pointers to the
SpiMasterProtocol and its routines. In order to ensure proper
execution of the MvFvbDxe driver, configure initialization
order with Depex entry.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
Reviewed-by: Leif Lindholm 
---
 Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c   | 58 ++--
 Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.h   |  1 +
 Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.inf | 11 +++-
 Platform/Marvell/Marvell.dec|  2 +
 4 files changed, 66 insertions(+), 6 deletions(-)

diff --git a/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c 
b/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c
index 456d9f9..6886d01 100755
--- a/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c
+++ b/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c
@@ -33,6 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
***/
 #include "MvSpiFlash.h"
 
+STATIC EFI_EVENTmMvSpiFlashVirtualAddrChangeEvent;
 MARVELL_SPI_MASTER_PROTOCOL *SpiMasterProtocol;
 SPI_FLASH_INSTANCE  *mSpiFlashInstance;
 
@@ -503,6 +504,33 @@ MvSpiFlashInitProtocol (
   return EFI_SUCCESS;
 }
 
+/**
+  Fixup internal data so that EFI can be call in virtual mode.
+  Call the passed in Child Notify event and convert any pointers in
+  lib to virtual mode.
+
+  @param[in]Event   The Event that is being processed
+  @param[in]Context Event Context
+**/
+STATIC
+VOID
+EFIAPI
+MvSpiFlashVirtualNotifyEvent (
+  IN EFI_EVENTEvent,
+  IN VOID *Context
+  )
+{
+  //
+  // Convert SpiMasterProtocol callbacks in MvSpiFlashErase and
+  // MvSpiFlashWrite required by runtime variable support.
+  //
+  EfiConvertPointer (0x0, (VOID**)>ReadWrite);
+  EfiConvertPointer (0x0, (VOID**)>Transfer);
+  EfiConvertPointer (0x0, (VOID**));
+
+  return;
+}
+
 EFI_STATUS
 EFIAPI
 MvSpiFlashEntryPoint (
@@ -522,8 +550,7 @@ MvSpiFlashEntryPoint (
 return EFI_DEVICE_ERROR;
   }
 
-  mSpiFlashInstance = AllocateZeroPool (sizeof (SPI_FLASH_INSTANCE));
-
+  mSpiFlashInstance = AllocateRuntimeZeroPool (sizeof (SPI_FLASH_INSTANCE));
   if (mSpiFlashInstance == NULL) {
 DEBUG((DEBUG_ERROR, "SpiFlash: Cannot allocate memory\n"));
 return EFI_OUT_OF_RESOURCES;
@@ -540,10 +567,33 @@ MvSpiFlashEntryPoint (
   NULL
   );
   if (EFI_ERROR (Status)) {
-FreePool (mSpiFlashInstance);
 DEBUG((DEBUG_ERROR, "SpiFlash: Cannot install SPI flash protocol\n"));
-return EFI_DEVICE_ERROR;
+goto ErrorInstallProto;
+  }
+
+  //
+  // Register for the virtual address change event
+  //
+  Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL,
+  TPL_NOTIFY,
+  MvSpiFlashVirtualNotifyEvent,
+  NULL,
+  ,
+  );
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "%a: Failed to register VA change event\n", 
__FUNCTION__));
+goto ErrorCreateEvent;
   }
 
   return EFI_SUCCESS;
+
+ErrorCreateEvent:
+  gBS->UninstallMultipleProtocolInterfaces (>Handle,
+,
+NULL);
+
+ErrorInstallProto:
+  FreePool (mSpiFlashInstance);
+
+  return EFI_SUCCESS;
 }
diff --git a/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.h 
b/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.h
index f09ff50..f69c562 100755
--- a/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.h
+++ b/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.h
@@ -42,6 +42,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.inf 
b/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.inf
index 6587f69..c6bbe5e 100644
--- a/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.inf
+++ b/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.inf
@@ -33,7 +33,7 @@
   INF_VERSION= 0x00010005
   BASE_NAME  = SpiFlashDxe
   FILE_GUID  = 49d7fb74-306d-42bd-94c8-c0c54b181dd7
-  MODULE_TYPE= DXE_DRIVER
+  MODULE_TYPE= DXE_RUNTIME_DRIVER
   VERSION_STRING = 1.0
   ENTRY_POINT= MvSpiFlashEntryPoint
 
@@ -54,10 +54,17 @@
   UefiLib
   DebugLib
   MemoryAllocationLib
+  UefiRuntimeLib
+
+[Guids]
+  gEfiEventVirtualAddressChangeGuid
 
 [Protocols]
   gMarvellSpiMasterProtocolGuid
   gMarvellSpiFlashProtocolGuid
 
 [Depex]
-  TRUE
+  #
+  # MvSpiFlashDxe must be loaded prior to variables driver MvFvbDxe
+  #
+  BEFORE gMarvellFvbDxeGuid
diff --git a/Platform/Marvell/Marvell.dec 

[edk2] [platforms: PATCH v3 0/4] Armada 7k/8k variable support

2017-11-28 Thread Marcin Wojtas
Hi,

I submit v3 of the Armada variable support with the MvFvbDxe
driver improved according to the recent review. The biggest
changes are a proper implementation of Set/GetAttributes
protocol callbacks. Details can be found in the changelog below.

Patches are available in the github:
https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/var-upstream-r20171128

I'm looking forward to the comments or remarks.

Best regards,
Marcin

Changelog:
v2 -> v3
* 2/4 - 4/4
- Add RBs

* 1/4
- Fix line-breaking in MvFvbValidateFvHeader
- Check actual WriteDisabled attributes MvFvbEraseBlocks
- Rework MvFvbGetAttributes/MvFvbSetAttributes to properly
  support those features

v1 -> v2:
* Change patches order in order to safely apply related Depex modifications

* 1/4:
  - Fix style (line breaking, openining brackets, alignment, typos)
  - Rework MvFvbSetAttributes - because it can return only EFI_SUCCESS /
EFI_INVALID_PARAMETER and should return FVB attributes,
add debug information, that operation is not supported and return
default values via MvFvbGetAttributes.
  - Return EFI_SUCCESS, in case NumBytes == 0 in MvFvbRead.

* 2/4:
  - Move Depex configuration from 4/4

* 3/4:
  - Move Depex configuration from 4/4
  - Reword and break commit message.

* 4/4:
  - Remove Depex configuration


Marcin Wojtas (4):
  Platform/Marvell: Introduce MvFvbDxe variable support driver
  Marvell/Drivers: MvSpiFlash: Enable using driver in RT
  Marvell/Drivers: MvSpiDxe: Enable using driver in RT
  Marvell/Armada: Enable variables support

 Platform/Marvell/Armada/Armada.dsc.inc  |   25 +-
 Platform/Marvell/Armada/Armada70x0.fdf  |6 +-
 Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c   |   58 +-
 Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.h   |1 +
 Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.inf |   11 +-
 Platform/Marvell/Drivers/Spi/MvSpiDxe.c |   50 +-
 Platform/Marvell/Drivers/Spi/MvSpiDxe.h |2 +
 Platform/Marvell/Drivers/Spi/MvSpiDxe.inf   |9 +-
 Platform/Marvell/Drivers/Spi/Variables/MvFvbDxe.c   | 1138 
 Platform/Marvell/Drivers/Spi/Variables/MvFvbDxe.h   |  128 +++
 Platform/Marvell/Drivers/Spi/Variables/MvFvbDxe.inf |   91 ++
 Platform/Marvell/Include/Protocol/Spi.h |7 +
 Platform/Marvell/Marvell.dec|4 +
 13 files changed, 1516 insertions(+), 14 deletions(-)
 create mode 100644 Platform/Marvell/Drivers/Spi/Variables/MvFvbDxe.c
 create mode 100644 Platform/Marvell/Drivers/Spi/Variables/MvFvbDxe.h
 create mode 100644 Platform/Marvell/Drivers/Spi/Variables/MvFvbDxe.inf

-- 
2.7.4

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