[edk2] [PATCH 1/3] IntelFrameworkModulePkg/GenericBdsLib: Check for invalid device handle

2016-04-29 Thread Daniil Egranov
Added error control for invalid device handle when LocateDevicePath() 
fails. 

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daniil Egranov 
---
 IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c 
b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
index 68b32f3..90a33fe 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
@@ -3626,7 +3626,11 @@ BdsLibGetBootableHandle (
   //
   UpdatedDevicePath = DevicePath;
   Status= gBS->LocateDevicePath (, 
, );
-  gBS->ConnectController (Handle, NULL, NULL, TRUE);
+  if (!EFI_ERROR (Status)) {
+gBS->ConnectController (Handle, NULL, NULL, TRUE);
+  } else {
+return (EFI_HANDLE) NULL;
+  }
 }
   } else {
 //
-- 
2.7.4

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


[edk2] [PATCH 3/3] IntelFrameworkModulePkg/BdsDxe: Show boot timeout message

2016-04-29 Thread Daniil Egranov
The PlatformBdsShowProgress() supports graphics mode only, which is not
applicable for RS-232 serial console. Show the progress message as a console
text message in case PlatformBdsShowProgress() fails.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daniil Egranov 
---
 IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c 
b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
index 6958979..7d21cc3 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
@@ -925,7 +925,7 @@ ShowProgress (
 // Show progress
 //
 if (TmpStr != NULL) {
-  PlatformBdsShowProgress (
+  Status = PlatformBdsShowProgress (
 Foreground,
 Background,
 TmpStr,
@@ -933,12 +933,19 @@ ShowProgress (
 ((TimeoutDefault - TimeoutRemain) * 100 / TimeoutDefault),
 0
 );
+  if (EFI_ERROR(Status)) {
+//if graphics mode is not supported (serial console) show text 
progress message
+AsciiPrint ("\rPress any key to enter Boot Menu in %d seconds 
", TimeoutRemain);
+  }
 }
   }
 }
 
 if (TmpStr != NULL) {
   gBS->FreePool (TmpStr);
+if (EFI_ERROR(Status)) {
+  AsciiPrint ("\n");
+}
 }
 
 //
-- 
2.7.4

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


[edk2] [PATCH 0/3] IntelFrameworkModulePkg: Fixes for Intel BDS

2016-04-29 Thread Daniil Egranov
This set of patches fixes the following:
Crash when BDS loads a device handle based onthe device path but 
the device driver has not been loaded. 
BDS boot timeout.
Timeout progress message for RS-232 serial console. 

Thanks,
Daniil

Daniil Egranov (3):
  IntelFrameworkModulePkg/GenericBdsLib: Check for invalid device handle
  IntelFrameworkModulePkg/BdsDxe: Fix for the BDS boot timeout
  IntelFrameworkModulePkg/BdsDxe: Show boot timeout message

 IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c |  6 +-
 IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c | 17 ++---
 .../Universal/BdsDxe/BootMaint/BootMaint.c  | 17 -
 .../Universal/BdsDxe/BootMaint/UpdatePage.c | 13 +++--
 IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c|  9 -
 5 files changed, 50 insertions(+), 12 deletions(-)

-- 
2.7.4

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


[edk2] [PATCH 2/3] IntelFrameworkModulePkg/BdsDxe: Fix for the BDS boot timeout

2016-04-29 Thread Daniil Egranov
The patch loads timeout value from the "Timeout" global variable and passes
it to PlatformBdsEnterFrontPage(), which handles delay and key input.
The PcdPlatformBootTimeOut is only used at the BDS entry point and updates
the "Timeout" value. This will allow the modification of the timeout value 
through the BDS menu and overwrite it if PcdPlatformBootTimeOut has been set.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daniil Egranov 
---
 IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c | 17 ++---
 .../Universal/BdsDxe/BootMaint/BootMaint.c  | 17 -
 .../Universal/BdsDxe/BootMaint/UpdatePage.c | 13 +++--
 3 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c 
b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
index ae7ad21..6078dc7 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
@@ -214,6 +214,18 @@ BdsBootDeviceSelect (
   if (Link == NULL) {
 return ;
   }
+
+  //Read boot timeout variable
+  Status = gRT->GetVariable (L"Timeout",
+ ,
+ NULL,
+ ,
+ (VOID *) );
+
+  if (EFI_ERROR (Status)) {
+Timeout = 0x;
+  }
+
   //
   // Here we make the boot in a loop, every boot success will
   // return to the front page
@@ -222,7 +234,7 @@ BdsBootDeviceSelect (
 //
 // Check the boot option list first
 //
-if (Link == ) {
+if (Link ==  || Timeout != 0x) {
   //
   // When LazyConIn enabled, signal connect ConIn event before enter UI
   //
@@ -238,12 +250,11 @@ BdsBootDeviceSelect (
   //one is success to boot, then we back here to allow user
   //add new active boot option
   //
-  Timeout = 0x;
   PlatformBdsEnterFrontPage (Timeout, FALSE);
+  Timeout = 0x;
   InitializeListHead ();
   BdsLibBuildOptionFromVar (, L"BootOrder");
   Link = BootLists.ForwardLink;
-  continue;
 }
 //
 // Get the boot option from the link list
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c 
b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
index d4b4475..fdd671d 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
@@ -111,6 +111,9 @@ InitializeBmmConfig (
   BM_MENU_ENTRY   *NewMenuEntry;
   BM_LOAD_CONTEXT *NewLoadContext;
   UINT16  Index;
+  UINT16  BootTimeOut;
+  EFI_STATUS  Status;
+  UINTN   Size;
 
   ASSERT (CallbackData != NULL);
 
@@ -128,7 +131,19 @@ InitializeBmmConfig (
 }
   }
 
-  CallbackData->BmmFakeNvData.BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut);
+  //Read boot timeout variable. If PcdPlatformBootTimeOut has been set,
+  //the Timeout variable will be initialized as part of the BDS startup 
procedure
+  Status = gRT->GetVariable ( L"Timeout",
+  ,
+  NULL,
+  ,
+  (VOID *) );
+
+  if (EFI_ERROR (Status)) {
+  BootTimeOut = 0;
+  }
+
+  CallbackData->BmmFakeNvData.BootTimeOut = BootTimeOut;
 
   //
   // Initialize data which located in Boot Options Menu
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c 
b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
index b13ed11..af14477 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
@@ -722,18 +722,21 @@ UpdateTimeOutPage (
   IN BMM_CALLBACK_DATA*CallbackData
   )
 {
-  UINT16  BootTimeOut;
   VOID*DefaultOpCodeHandle;
 
   CallbackData->BmmAskSaveOrNot = TRUE;
 
   UpdatePageStart (CallbackData);
 
-  BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut);
-
   DefaultOpCodeHandle = HiiAllocateOpCodeHandle ();
   ASSERT (DefaultOpCodeHandle != NULL);
-  HiiCreateDefaultOpCode (DefaultOpCodeHandle, EFI_HII_DEFAULT_CLASS_STANDARD, 
EFI_IFR_TYPE_NUM_SIZE_16, BootTimeOut);
+
+  HiiCreateDefaultOpCode (
+DefaultOpCodeHandle,
+EFI_HII_DEFAULT_CLASS_STANDARD,
+EFI_IFR_TYPE_NUM_SIZE_16,
+CallbackData->BmmFakeNvData.BootTimeOut
+);
 
   HiiCreateNumericOpCode (
 mStartOpCodeHandle,
@@ -752,8 +755,6 @@ UpdateTimeOutPage (
   
   HiiFreeOpCodeHandle (DefaultOpCodeHandle);
 
-  //CallbackData->BmmFakeNvData.BootTimeOut = BootTimeOut;
-
   UpdatePageEnd (CallbackData);
 }
 
-- 
2.7.4

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


Re: [edk2] [Patch v4 00/23] Use MdeModulePkg/BDS in OVMF platform

2016-04-29 Thread Ni, Ruiyu
https://github.com/niruiyu/edk2/commits/Ovmf_Bds

Regards,
Ray

From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo 
Ersek
Sent: Friday, April 29, 2016 7:21 PM
To: Ni, Ruiyu ; edk2-de...@ml01.01.org
Subject: Re: [edk2] [Patch v4 00/23] Use MdeModulePkg/BDS in OVMF platform

On 04/29/16 09:00, Ruiyu Ni wrote:
> The patch serials creates a flag USE_OLD_BDS and by default the value
> of the flag is FALSE so that the new MdeModulePkg/BDS is used.
> User can define USE_OLD_BDS as TRUE to force to use IntelFrameworkModulePkg
> /BDS.
>
> The v3 adopts comments for v1 and v2 to split the big changes to
> small changes and also expose the EfiBootManagerGetLoadOptionBuffer().
>
> The v4 adopts comments for v3.

Ray, can you please push this version to your public repo?

Thanks
Laszlo

> Ruiyu Ni (23):
>   MdeModulePkg/UefiBootManagerLib: Expose *GetLoadOptionBuffer() API
>   OvmfPkg/PlatformPei: Add memory above 4GB as tested
>   OvmfPkg: Duplicate QemuBootOrderLib to QemuNewBootOrderLib
>   OvmfPkg/QemuNewBootOrderLib: Build with UefiBootManagerLib
>   OvmfPkg: Duplicate PlatformBdsLib to PlatformBootManagerLib
>   OvmfPkg/PlatformBootManagerLib: Follow PlatformBootManagerLib
> interfaces
>   OvmfPkg/PlatformBootManagerLib: use
> EfiBootManagerUpdateConsoleVariable
>   OvmfPkg/PlatformBootManagerLib: link to UefiBootManagerLib
>   OvmfPkg/PlatformBootManagerLib: Use ConvertDevicePathToText()
>   OvmfPkg/PlatformBootManagerLib: Init console vars in *BeforeConsole()
>   OvmfPkg/PlatformBootManagerLib: Do not launch Boot Manager Menu
>   OvmfPkg/PlatformBootManagerLib: Register boot options and hot keys
>   OvmfPkg/PlatformBootManagerLib: Remove unused local functions.
>   OvmfPkg/PlatformBootManagerLib: port PlatformBdsConnectSequence to
> UefiBootManagerLib
>   OvmfPkg/PlatformBootManagerLib: Use
> EfiBootManagerRefreshAllBootOption()
>   OvmfPkg/PlatformBootManagerLib: Remove PlatformBdsGetDriverOption()
>   OvmfPkg/PlatformBootManagerLib: Use GetBootModeHob() in HobLib
>   OvmfPkg/PlatformBootManagerLib: Remove unnecessary memory test
>   OvmfPkg/PlatformBootManagerLib: Remove unused vars and func prototypes
>   OvmfPkg/PlatformBootManagerLib: Add EnableQuietBoot & DisableQuietBoot
>   OvmfPkg/PlatformBootManagerLib: Remove unused C structures definitions
>   OvmfPkg: Use MdeModulePkg/BDS
>   OvmfPkg/OvmfPkgIa32X64.dsc: Move PcdShellFile to
> [PcdsFixedAtBuild.X64]
>
>  MdeModulePkg/Include/Library/UefiBootManagerLib.h  |   23 +-
>  MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   |   11 +-
>  .../Library/UefiBootManagerLib/BmLoadOption.c  |2 +-
>  .../Library/UefiBootManagerLib/InternalBm.h|   19 -
>  .../Library/PlatformBootManagerLib/BdsPlatform.c   | 1397 
> 
>  .../Library/PlatformBootManagerLib/BdsPlatform.h   |  214 +++
>  .../PlatformBootManagerLib.inf |   83 ++
>  .../Library/PlatformBootManagerLib/PlatformData.c  |   41 +
>  .../QemuKernel.c   |0
>  OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c |  671 ++
>  .../ExtraRootBusMap.c  |0
>  .../ExtraRootBusMap.h  |0
>  .../QemuBootOrderLib.c |  139 +-
>  .../QemuBootOrderLib.inf   |   10 +-
>  OvmfPkg/OvmfPkgIa32.dsc|   41 +-
>  OvmfPkg/OvmfPkgIa32.fdf|5 +
>  OvmfPkg/OvmfPkgIa32X64.dsc |   43 +-
>  OvmfPkg/OvmfPkgIa32X64.fdf |5 +
>  OvmfPkg/OvmfPkgX64.dsc |   41 +-
>  OvmfPkg/OvmfPkgX64.fdf |5 +
>  OvmfPkg/PlatformPei/MemDetect.c|4 +-
>  OvmfPkg/PlatformPei/Platform.c |   29 -
>  OvmfPkg/PlatformPei/Platform.h |   14 +-
>  OvmfPkg/PlatformPei/Xen.c  |8 +-
>  24 files changed, 2653 insertions(+), 152 deletions(-)
>  create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
>  create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
>  create mode 100644 
> OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
>  create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
>  copy OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/QemuKernel.c 
> (100%)
>  create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c
>  copy OvmfPkg/Library/{QemuBootOrderLib => 
> QemuNewBootOrderLib}/ExtraRootBusMap.c (100%)
>  copy OvmfPkg/Library/{QemuBootOrderLib => 
> QemuNewBootOrderLib}/ExtraRootBusMap.h (100%)
>  copy OvmfPkg/Library/{QemuBootOrderLib => 
> QemuNewBootOrderLib}/QemuBootOrderLib.c (91%)
>  copy OvmfPkg/Library/{QemuBootOrderLib => 
> QemuNewBootOrderLib}/QemuBootOrderLib.inf (83%)
>

___
edk2-devel 

Re: [edk2] [RFC] MdeModulePkg, ShellPkg: increase TFTP block size

2016-04-29 Thread Carsey, Jaben
I missed that the default was from the RFC.  I agree with you.

-Jaben

> -Original Message-
> From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> Sent: Friday, April 29, 2016 11:00 AM
> To: Carsey, Jaben 
> Cc: Marcin Wojtas ; Fu, Siyuan ;
> ha...@marvell.com; edk2-devel@lists.01.org; Gao, Liming
> ; n...@marvell.com; Kinney, Michael D
> 
> Subject: Re: [edk2] [RFC] MdeModulePkg, ShellPkg: increase TFTP block size
> Importance: High
> 
> Since the default is actually defined in the RFC, I would prefer this
> to not be PCD configurable. Having it as an option to the shell command
> makes a lot of sense, though.
> 
> /
> Leif
> 
> On Fri, Apr 29, 2016 at 05:44:50PM +, Carsey, Jaben wrote:
> > Maybe we should have a PCD control the default value so that people
> > who build it can set it as per their own best value.  Adding a
> > parameter seems like a great (but separate) solution.
> >
> > -Jaben
> >
> > > -Original Message-
> > > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> > > Marcin Wojtas
> > > Sent: Friday, April 29, 2016 2:15 AM
> > > To: Fu, Siyuan 
> > > Cc: ha...@marvell.com; edk2-devel@lists.01.org; Gao, Liming
> > > ; n...@marvell.com; leif.lindh...@linaro.org;
> > > Kinney, Michael D 
> > > Subject: Re: [edk2] [RFC] MdeModulePkg, ShellPkg: increase TFTP block
> size
> > > Importance: High
> > >
> > > Hi Siyuan,
> > >
> > > Thanks a lot for thorough explanation. The default 512B won't be
> > > changed then - PCD and extending tftp command seem a good alternative.
> > > We will come back later with more proper solution.
> > >
> > > Best regards,
> > > Marcin
> > >
> > > 2016-04-29 10:40 GMT+02:00 Fu, Siyuan :
> > > > Hi, Marcin
> > > >
> > > > The RFC2348 has a detail discussion about the block size setting in tftp
> and
> > > give the answer: using value of MTU is not the best choice. You may find
> you
> > > still can gain more efficiency by increasing the block size over the path
> MTU,
> > > until the IP fragmentation gives more overhead than the tftp package
> frame
> > > and process.
> > > >
> > > > The default block size (512) of tftp is defined in the RFC1350, that's 
> > > > why
> the
> > > Mtftp driver use 512 as the default macro value. The MTFTP4 prococol
> does
> > > provide the interface to allow the caller to provide a "blksize" option in
> the
> > > MTFTP request, so I prefer to keep the default value to 512 in the Mtftp4
> > > driver, to follow RFC's definition. Another driver in edk2 stack which is
> using
> > > the mtftp protocol, like the PXE driver, provides a PCD
> > > gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize which allow the
> users
> > > to configure the default block size during PXE mtftp download.
> > > >
> > > > For the shell "tftp" command, I also suggest to add a new argument to 
> > > > let
> > > user set the block size, not simply override it with 1468.
> > > >
> > > > Best Regards
> > > > Siyuan
> > > >
> > > >> -Original Message-
> > > >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf
> Of
> > > >> Marcin Wojtas
> > > >> Sent: Friday, April 29, 2016 9:09 AM
> > > >> To: edk2-devel@lists.01.org
> > > >> Cc: ha...@marvell.com; leif.lindh...@linaro.org; n...@marvell.com;
> > > Gao,
> > > >> Liming ; Kinney, Michael D
> > > >> 
> > > >> Subject: [edk2] [RFC] MdeModulePkg, ShellPkg: increase TFTP block
> size
> > > >>
> > > >> From: Bartosz Szczepanek 
> > > >>
> > > >> Hi,
> > > >>
> > > >> When dealing with low network speed during tftp, the analysis showed
> > > >> two issues - UEFI tftp and network stack spend a lot of time (~3.5ms,
> > > >> comparing to U-Boot's ~0.6ms) on preparing ACK packet after receiving
> > > >> data block from host. The network driver itself is using SNP and its
> > > >> time spent on executing SnpTransmit routine is negligible, so it is
> > > >> definitely not a problem.
> > > >>
> > > >> This patch however is only releated to above mentioned problem. It
> > > >> occurred that despite our MTU is set to 1500, each block of data has
> > > >> to be split to 512 chunks, so the very long receive/ack sequence was
> > > >> executed three times more than needed.
> > > >>
> > > >> Below is an example of a solution of increasing TFTP block size
> > > >> to maximum allowed by 1500 MTU. The default block size is changed,
> > > >> as well as this option is negotiatied with host. For sure a situation,
> > > >> when proposed, increased block size is rejected by host (a default
> > > >> fall back to 512 should happen) should be handled properly.
> > > >>
> > > >> Also a dynamic dependency between port's MTU was considered, but
> > > there
> > > >> are two problems - how to pass it to Mtftp4 

Re: [edk2] [RFC] MdeModulePkg, ShellPkg: increase TFTP block size

2016-04-29 Thread Leif Lindholm
Since the default is actually defined in the RFC, I would prefer this
to not be PCD configurable. Having it as an option to the shell command
makes a lot of sense, though.

/
Leif

On Fri, Apr 29, 2016 at 05:44:50PM +, Carsey, Jaben wrote:
> Maybe we should have a PCD control the default value so that people
> who build it can set it as per their own best value.  Adding a
> parameter seems like a great (but separate) solution.
> 
> -Jaben
> 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> > Marcin Wojtas
> > Sent: Friday, April 29, 2016 2:15 AM
> > To: Fu, Siyuan 
> > Cc: ha...@marvell.com; edk2-devel@lists.01.org; Gao, Liming
> > ; n...@marvell.com; leif.lindh...@linaro.org;
> > Kinney, Michael D 
> > Subject: Re: [edk2] [RFC] MdeModulePkg, ShellPkg: increase TFTP block size
> > Importance: High
> > 
> > Hi Siyuan,
> > 
> > Thanks a lot for thorough explanation. The default 512B won't be
> > changed then - PCD and extending tftp command seem a good alternative.
> > We will come back later with more proper solution.
> > 
> > Best regards,
> > Marcin
> > 
> > 2016-04-29 10:40 GMT+02:00 Fu, Siyuan :
> > > Hi, Marcin
> > >
> > > The RFC2348 has a detail discussion about the block size setting in tftp 
> > > and
> > give the answer: using value of MTU is not the best choice. You may find you
> > still can gain more efficiency by increasing the block size over the path 
> > MTU,
> > until the IP fragmentation gives more overhead than the tftp package frame
> > and process.
> > >
> > > The default block size (512) of tftp is defined in the RFC1350, that's 
> > > why the
> > Mtftp driver use 512 as the default macro value. The MTFTP4 prococol does
> > provide the interface to allow the caller to provide a "blksize" option in 
> > the
> > MTFTP request, so I prefer to keep the default value to 512 in the Mtftp4
> > driver, to follow RFC's definition. Another driver in edk2 stack which is 
> > using
> > the mtftp protocol, like the PXE driver, provides a PCD
> > gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize which allow the users
> > to configure the default block size during PXE mtftp download.
> > >
> > > For the shell "tftp" command, I also suggest to add a new argument to let
> > user set the block size, not simply override it with 1468.
> > >
> > > Best Regards
> > > Siyuan
> > >
> > >> -Original Message-
> > >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> > >> Marcin Wojtas
> > >> Sent: Friday, April 29, 2016 9:09 AM
> > >> To: edk2-devel@lists.01.org
> > >> Cc: ha...@marvell.com; leif.lindh...@linaro.org; n...@marvell.com;
> > Gao,
> > >> Liming ; Kinney, Michael D
> > >> 
> > >> Subject: [edk2] [RFC] MdeModulePkg, ShellPkg: increase TFTP block size
> > >>
> > >> From: Bartosz Szczepanek 
> > >>
> > >> Hi,
> > >>
> > >> When dealing with low network speed during tftp, the analysis showed
> > >> two issues - UEFI tftp and network stack spend a lot of time (~3.5ms,
> > >> comparing to U-Boot's ~0.6ms) on preparing ACK packet after receiving
> > >> data block from host. The network driver itself is using SNP and its
> > >> time spent on executing SnpTransmit routine is negligible, so it is
> > >> definitely not a problem.
> > >>
> > >> This patch however is only releated to above mentioned problem. It
> > >> occurred that despite our MTU is set to 1500, each block of data has
> > >> to be split to 512 chunks, so the very long receive/ack sequence was
> > >> executed three times more than needed.
> > >>
> > >> Below is an example of a solution of increasing TFTP block size
> > >> to maximum allowed by 1500 MTU. The default block size is changed,
> > >> as well as this option is negotiatied with host. For sure a situation,
> > >> when proposed, increased block size is rejected by host (a default
> > >> fall back to 512 should happen) should be handled properly.
> > >>
> > >> Also a dynamic dependency between port's MTU was considered, but
> > there
> > >> are two problems - how to pass it to Mtftp4 module and way of negotiating
> > >> size with host - option requires string format. Hence IMO it's better
> > >> to stick to arbitrary size.
> > >>
> > >> I would be very grateful for any comments and ideas, how to handle
> > >> this issue properly.
> > >>
> > >> Best reards,
> > >> Marcin
> > >>
> > >> ---
> > >>  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h | 2 +-
> > >>  ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c   | 5 +
> > >>  2 files changed, 6 insertions(+), 1 deletion(-)
> > >>
> > >> diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
> > >> b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
> > >> index 527fd1d..9a2d409 100644
> > >> --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
> > >> +++ 

Re: [edk2] [review]Please review changes to UNI file format document

2016-04-29 Thread Bjorge, Erik C
Reviewed-by: Erik Bjorge 

From: Carsey, Jaben
Sent: Friday, April 29, 2016 10:53 AM
To: edk2-devel@lists.01.org; Bjorge, Erik C ; Qiu, 
Shumin 
Cc: Carsey, Jaben 
Subject: [review]Please review changes to UNI file format document

Updated UNI spec to remove info specific to some consumers, not format.
Updated UNI spec to allow non-ascii characters in strings.


Cc: Qiu Shumin >

Cc: Erik Bjorge >

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Jaben Carsey 
>



There are 3 sections here.  The table of changes, the beginning of chapter 2, 
and chapter 4.





1.3


Added:

*  Syntax for non-ascii characters inside quoted strings

Removed:

*  Info on specific consumers (.INF & .DEC) removed.


April 2016




2
Unicode Strings File Format
EDK II Unicode files are used for mapping token names to localized strings that 
are identified by an RFC4646 language code. The format for storing EDK II 
Unicode files is UTF-16LE. The character content must be UCS-2.
The UNI files contain UCS-2 characters stored in either UTF-8 or UTF-16LE 
format on disk.
Strings ends are determined by the first of the following items found:

*  a control character

*  a comment

*  the end of the file

*  a blank line
Comments may appear anywhere within the string file.
All the files must begin with a Unicode BOM character.

Note:  Please make sure you select an editor that supports UCS-2 characters 
that can be stored in a UTF-8 or UTF-16LE file.

2.1Common EBNF
The following EBNF uses quoted (double quotes) encapsulated characters to 
represent UCS-2 string literals. In the following definitions, the semi-colon 
is used to denote a comment.


::=  " "

::=  {(\u0041-\u005A)} ; Characters A - Z
 {(\u0061-\u007A)} ; Characters a - z

 ::=  (\u0030-\u0039)   ; Characters 0 - 9

::=  +

::=  {} {}

   ::=  "//" *  

 ::=  

 ::=  (\u0001-\uF6FF)



::=  (\u0021-\uF6FF){(\u0020-\uF6FF)} {}



   ::=  "\x" [{}]{4} "\"



::=  (\u0021-\uF6FF)








4  Redacted

Formerly "Meta-Data UNI Files". This chapter intentionally removed.

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


[edk2] [review]Please review changes to UNI file format document

2016-04-29 Thread Carsey, Jaben
Updated UNI spec to remove info specific to some consumers, not format.
Updated UNI spec to allow non-ascii characters in strings.


Cc: Qiu Shumin >

Cc: Erik Bjorge 

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Jaben Carsey 
>



There are 3 sections here.  The table of changes, the beginning of chapter 2, 
and chapter 4.





1.3


Added:

*  Syntax for non-ascii characters inside quoted strings

Removed:

*  Info on specific consumers (.INF & .DEC) removed.


April 2016




2
Unicode Strings File Format
EDK II Unicode files are used for mapping token names to localized strings that 
are identified by an RFC4646 language code. The format for storing EDK II 
Unicode files is UTF-16LE. The character content must be UCS-2.
The UNI files contain UCS-2 characters stored in either UTF-8 or UTF-16LE 
format on disk.
Strings ends are determined by the first of the following items found:

*a control character

*a comment

*the end of the file

*a blank line
Comments may appear anywhere within the string file.
All the files must begin with a Unicode BOM character.

Note:Please make sure you select an editor that supports UCS-2 characters 
that can be stored in a UTF-8 or UTF-16LE file.

2.1  Common EBNF
The following EBNF uses quoted (double quotes) encapsulated characters to 
represent UCS-2 string literals. In the following definitions, the semi-colon 
is used to denote a comment.


::=  " "

::=  {(\u0041-\u005A)} ; Characters A - Z
 {(\u0061-\u007A)} ; Characters a - z

 ::=  (\u0030-\u0039)   ; Characters 0 - 9

::=  +

::=  {} {}

   ::=  "//" *  

 ::=  

 ::=  (\u0001-\uF6FF)



::=  (\u0021-\uF6FF){(\u0020-\uF6FF)} {}



   ::=  "\x" [{}]{4} "\"



::=  (\u0021-\uF6FF)








4  Redacted

Formerly "Meta-Data UNI Files". This chapter intentionally removed.

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


Re: [edk2] [PATCH 1/2] ShellPkg/UefiDpLib: Fix the error message "Timer library instance error!"

2016-04-29 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Cinnamon Shia
> Sent: Thursday, April 28, 2016 7:42 PM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben ; Qiu, Shumin
> ; Zeng, Star 
> Subject: [edk2] [PATCH 1/2] ShellPkg/UefiDpLib: Fix the error message "Timer
> library instance error!"
> Importance: High
> 
> When executing shell dp command, there is an error message "Timer library
> instance error!"
> 
> The error message "Timer library instance error!" should be for the case
> about
> duration > EndTimeStamp if CountUp or duration < StartTimeStamp if
> CountDown.
> 
> But if the EndTimeStamp of an entry is not added, it should not the case to
> catch.
> 
> This change fixes the error message "Timer library instance error!" from the
> "BdsAttempt" entry which is logged when trying to boot a boot option.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Cinnamon Shia 
> ---
>  ShellPkg/Library/UefiDpLib/DpUtilities.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/ShellPkg/Library/UefiDpLib/DpUtilities.c
> b/ShellPkg/Library/UefiDpLib/DpUtilities.c
> index 032e7b4..fbdd938 100644
> --- a/ShellPkg/Library/UefiDpLib/DpUtilities.c
> +++ b/ShellPkg/Library/UefiDpLib/DpUtilities.c
> @@ -2,7 +2,7 @@
>Utility functions used by the Dp application.
> 
>Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
> -  (C) Copyright 2015 Hewlett Packard Enterprise Development LP
> +  (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of the BSD
> License
>which accompanies this distribution.  The full text of the license may be
> found at
> @@ -68,6 +68,10 @@ GetDuration (
>UINT64Duration;
>BOOLEAN   Error;
> 
> +  if (Measurement->EndTimeStamp == 0) {
> +return 0;
> +  }
> +
>// PERF_START macros are called with a value of 1 to indicate
>// the beginning of time.  So, adjust the start ticker value
>// to the real beginning of time.
> --
> 2.8.1.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 2/2] PerformancePkg/Dp_App: Fix the error message "Timer library instance error!"

2016-04-29 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Cinnamon Shia
> Sent: Thursday, April 28, 2016 7:42 PM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben ; Qiu, Shumin
> ; Zeng, Star 
> Subject: [edk2] [PATCH 2/2] PerformancePkg/Dp_App: Fix the error message
> "Timer library instance error!"
> Importance: High
> 
> When executing shell dp command, there is an error message "Timer library
> instance error!"
> 
> The error message "Timer library instance error!" should be for the case
> about
> duration > EndTimeStamp if CountUp or duration < StartTimeStamp if
> CountDown.
> 
> But if the EndTimeStamp of an entry is not added, it should not the case to
> catch.
> 
> This change fixes the error message "Timer library instance error!" from the
> "BdsAttempt" entry which is logged when trying to boot a boot option.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Cinnamon Shia 
> ---
>  PerformancePkg/Dp_App/DpUtilities.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/PerformancePkg/Dp_App/DpUtilities.c
> b/PerformancePkg/Dp_App/DpUtilities.c
> index b49844a..f5ef9cf 100644
> --- a/PerformancePkg/Dp_App/DpUtilities.c
> +++ b/PerformancePkg/Dp_App/DpUtilities.c
> @@ -2,6 +2,7 @@
>Utility functions used by the Dp application.
> 
>Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
> +  (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of the BSD
> License
>which accompanies this distribution.  The full text of the license may be
> found at
> @@ -82,6 +83,10 @@ GetDuration (
>UINT64Duration;
>BOOLEAN   Error;
> 
> +  if (Measurement->EndTimeStamp == 0) {
> +return 0;
> +  }
> +
>// PERF_START macros are called with a value of 1 to indicate
>// the beginning of time.  So, adjust the start ticker value
>// to the real beginning of time.
> --
> 2.8.1.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [RFC] MdeModulePkg, ShellPkg: increase TFTP block size

2016-04-29 Thread Carsey, Jaben
Maybe we should have a PCD control the default value so that people who build 
it can set it as per their own best value.  Adding a parameter seems like a 
great (but separate) solution.

-Jaben

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Marcin Wojtas
> Sent: Friday, April 29, 2016 2:15 AM
> To: Fu, Siyuan 
> Cc: ha...@marvell.com; edk2-devel@lists.01.org; Gao, Liming
> ; n...@marvell.com; leif.lindh...@linaro.org;
> Kinney, Michael D 
> Subject: Re: [edk2] [RFC] MdeModulePkg, ShellPkg: increase TFTP block size
> Importance: High
> 
> Hi Siyuan,
> 
> Thanks a lot for thorough explanation. The default 512B won't be
> changed then - PCD and extending tftp command seem a good alternative.
> We will come back later with more proper solution.
> 
> Best regards,
> Marcin
> 
> 2016-04-29 10:40 GMT+02:00 Fu, Siyuan :
> > Hi, Marcin
> >
> > The RFC2348 has a detail discussion about the block size setting in tftp and
> give the answer: using value of MTU is not the best choice. You may find you
> still can gain more efficiency by increasing the block size over the path MTU,
> until the IP fragmentation gives more overhead than the tftp package frame
> and process.
> >
> > The default block size (512) of tftp is defined in the RFC1350, that's why 
> > the
> Mtftp driver use 512 as the default macro value. The MTFTP4 prococol does
> provide the interface to allow the caller to provide a "blksize" option in the
> MTFTP request, so I prefer to keep the default value to 512 in the Mtftp4
> driver, to follow RFC's definition. Another driver in edk2 stack which is 
> using
> the mtftp protocol, like the PXE driver, provides a PCD
> gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize which allow the users
> to configure the default block size during PXE mtftp download.
> >
> > For the shell "tftp" command, I also suggest to add a new argument to let
> user set the block size, not simply override it with 1468.
> >
> > Best Regards
> > Siyuan
> >
> >> -Original Message-
> >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> >> Marcin Wojtas
> >> Sent: Friday, April 29, 2016 9:09 AM
> >> To: edk2-devel@lists.01.org
> >> Cc: ha...@marvell.com; leif.lindh...@linaro.org; n...@marvell.com;
> Gao,
> >> Liming ; Kinney, Michael D
> >> 
> >> Subject: [edk2] [RFC] MdeModulePkg, ShellPkg: increase TFTP block size
> >>
> >> From: Bartosz Szczepanek 
> >>
> >> Hi,
> >>
> >> When dealing with low network speed during tftp, the analysis showed
> >> two issues - UEFI tftp and network stack spend a lot of time (~3.5ms,
> >> comparing to U-Boot's ~0.6ms) on preparing ACK packet after receiving
> >> data block from host. The network driver itself is using SNP and its
> >> time spent on executing SnpTransmit routine is negligible, so it is
> >> definitely not a problem.
> >>
> >> This patch however is only releated to above mentioned problem. It
> >> occurred that despite our MTU is set to 1500, each block of data has
> >> to be split to 512 chunks, so the very long receive/ack sequence was
> >> executed three times more than needed.
> >>
> >> Below is an example of a solution of increasing TFTP block size
> >> to maximum allowed by 1500 MTU. The default block size is changed,
> >> as well as this option is negotiatied with host. For sure a situation,
> >> when proposed, increased block size is rejected by host (a default
> >> fall back to 512 should happen) should be handled properly.
> >>
> >> Also a dynamic dependency between port's MTU was considered, but
> there
> >> are two problems - how to pass it to Mtftp4 module and way of negotiating
> >> size with host - option requires string format. Hence IMO it's better
> >> to stick to arbitrary size.
> >>
> >> I would be very grateful for any comments and ideas, how to handle
> >> this issue properly.
> >>
> >> Best reards,
> >> Marcin
> >>
> >> ---
> >>  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h | 2 +-
> >>  ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c   | 5 +
> >>  2 files changed, 6 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
> >> b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
> >> index 527fd1d..9a2d409 100644
> >> --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
> >> +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
> >> @@ -55,7 +55,7 @@ typedef struct _MTFTP4_PROTOCOL
> >> MTFTP4_PROTOCOL;
> >>  #define MTFTP4_DEFAULT_SERVER_PORT  69
> >>  #define MTFTP4_DEFAULT_TIMEOUT  3
> >>  #define MTFTP4_DEFAULT_RETRY5
> >> -#define MTFTP4_DEFAULT_BLKSIZE  512
> >> +#define MTFTP4_DEFAULT_BLKSIZE  1468
> >>  #define MTFTP4_TIME_TO_GETMAP   5
> >>
> >>  #define MTFTP4_STATE_UNCONFIGED 0
> >> diff --git 

Re: [edk2] [PATCH] ArmPlatformPkg/PrePi: allow unicore version to be used on MP hardware

2016-04-29 Thread Ard Biesheuvel
On 28 April 2016 at 17:29, Leif Lindholm  wrote:
> On Thu, Apr 28, 2016 at 05:02:19PM +0200, Ard Biesheuvel wrote:
>> On 19 April 2016 at 09:26, Ard Biesheuvel  wrote:
>> > When combining UEFI firmware built from Tianocore with ARM Trusted
>> > Firmware running in EL3, it is the responsibility of ATF that only
>> > a single core enters the UEFI firmware in EL2, and the remaining cores
>> > are released directly to the OS via PSCI SMC calls.
>> >
>> > In this case, we don't need the MpCore flavor of PrePi or PrePeiCore,
>> > but the UniCore flavor currently checks the CPU identification registers
>> > directly, and refuses to proceed if the boot CPU is part of a MpCore
>> > system.
>> >
>> > So drop the ASSERT()'s that implement this check.
>> >
>>
>> We will need something like this for PrePeiCore so that we can move Husky to 
>> it
>
> Yeah, sorry - was getting stuck considering what to do at the MP side,
> but that really is a completely separate thing.
>
> Apart from the name no longer making sense:
> Reviewed-by: Leif Lindholm 
>

Pushed as well

>> > Contributed-under: TianoCore Contribution Agreement 1.0
>> > Signed-off-by: Ard Biesheuvel 
>> > ---
>> >  ArmPlatformPkg/PrePi/MainUniCore.c | 5 -
>> >  ArmPlatformPkg/PrePi/PrePi.c   | 2 --
>> >  2 files changed, 7 deletions(-)
>> >
>> > diff --git a/ArmPlatformPkg/PrePi/MainUniCore.c 
>> > b/ArmPlatformPkg/PrePi/MainUniCore.c
>> > index 49b02338ebc2..11b9f462bb48 100644
>> > --- a/ArmPlatformPkg/PrePi/MainUniCore.c
>> > +++ b/ArmPlatformPkg/PrePi/MainUniCore.c
>> > @@ -21,11 +21,6 @@ PrimaryMain (
>> >IN  UINT64StartTimeStamp
>> >)
>> >  {
>> > -  DEBUG_CODE_BEGIN();
>> > -// On MPCore system, PeiMpCore.inf should be used instead of 
>> > PeiUniCore.inf
>> > -ASSERT(ArmIsMpCore() == 0);
>> > -  DEBUG_CODE_END();
>> > -
>> >PrePiMain (UefiMemoryBase, StacksBase, StartTimeStamp);
>> >
>> >// We must never return
>> > diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c
>> > index 8740b2a9e84d..36928c65a73b 100644
>> > --- a/ArmPlatformPkg/PrePi/PrePi.c
>> > +++ b/ArmPlatformPkg/PrePi/PrePi.c
>> > @@ -183,8 +183,6 @@ CEntryPoint (
>> >  {
>> >UINT64   StartTimeStamp;
>> >
>> > -  ASSERT(!ArmIsMpCore() || (PcdGet32 (PcdCoreCount) > 1));
>> > -
>> >// Initialize the platform specific controllers
>> >ArmPlatformInitialize (MpId);
>> >
>> > --
>> > 2.5.0
>> >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 2/2] ArmPkg: implement CpuIo2 protocol driver specific for PCI

2016-04-29 Thread Leif Lindholm
On Fri, Apr 29, 2016 at 05:41:20PM +0200, Ard Biesheuvel wrote:
> The CpuIo2 protocol is required by the generic PciHostBridgeDxe driver,
> which relies on it to back its own I/O and MMIO operations.
> 
> Since ARM has no native I/O port equivalent, such accesses can only
> originate from PCI drivers, and the PCI I/O space is translated to MMIO
> in this case.
> 
> So we can implement this protocol using MMIO operations only, and take
> the PCI I/O translation offset into account when performing I/O port
> accesses.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel 

Reviewed-by: Leif Lindholm 

Thanks!

> ---
>  ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.c   | 559 
>  ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf |  53 ++
>  2 files changed, 612 insertions(+)
> 
> diff --git a/ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.c 
> b/ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.c
> new file mode 100644
> index ..fecf6a87adce
> --- /dev/null
> +++ b/ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.c
> @@ -0,0 +1,559 @@
> +/** @file
> +  Produces the CPU I/O 2 Protocol.
> +
> +Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
> +Copyright (c) 2016, Linaro Ltd. All rights reserved.
> +
> +This program and the accompanying materials
> +are licensed and made available under the terms and conditions of the BSD 
> License
> +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 
> +
> +#define MAX_IO_PORT_ADDRESS   0x
> +
> +//
> +// Handle for the CPU I/O 2 Protocol
> +//
> +STATIC EFI_HANDLE  mHandle = NULL;
> +
> +//
> +// Lookup table for increment values based on transfer widths
> +//
> +STATIC CONST UINT8 mInStride[] = {
> +  1, // EfiCpuIoWidthUint8
> +  2, // EfiCpuIoWidthUint16
> +  4, // EfiCpuIoWidthUint32
> +  8, // EfiCpuIoWidthUint64
> +  0, // EfiCpuIoWidthFifoUint8
> +  0, // EfiCpuIoWidthFifoUint16
> +  0, // EfiCpuIoWidthFifoUint32
> +  0, // EfiCpuIoWidthFifoUint64
> +  1, // EfiCpuIoWidthFillUint8
> +  2, // EfiCpuIoWidthFillUint16
> +  4, // EfiCpuIoWidthFillUint32
> +  8  // EfiCpuIoWidthFillUint64
> +};
> +
> +//
> +// Lookup table for increment values based on transfer widths
> +//
> +STATIC CONST UINT8 mOutStride[] = {
> +  1, // EfiCpuIoWidthUint8
> +  2, // EfiCpuIoWidthUint16
> +  4, // EfiCpuIoWidthUint32
> +  8, // EfiCpuIoWidthUint64
> +  1, // EfiCpuIoWidthFifoUint8
> +  2, // EfiCpuIoWidthFifoUint16
> +  4, // EfiCpuIoWidthFifoUint32
> +  8, // EfiCpuIoWidthFifoUint64
> +  0, // EfiCpuIoWidthFillUint8
> +  0, // EfiCpuIoWidthFillUint16
> +  0, // EfiCpuIoWidthFillUint32
> +  0  // EfiCpuIoWidthFillUint64
> +};
> +
> +/**
> +  Check parameters to a CPU I/O 2 Protocol service request.
> +
> +  The I/O operations are carried out exactly as requested. The caller is 
> responsible
> +  for satisfying any alignment and I/O width restrictions that a PI System 
> on a
> +  platform might require. For example on some platforms, width requests of
> +  EfiCpuIoWidthUint64 do not work. Misaligned buffers, on the other hand, 
> will
> +  be handled by the driver.
> +
> +  @param[in] MmioOperation  TRUE for an MMIO operation, FALSE for I/O Port 
> operation.
> +  @param[in] Width  Signifies the width of the I/O or Memory 
> operation.
> +  @param[in] AddressThe base address of the I/O operation.
> +  @param[in] Count  The number of I/O operations to perform. The 
> number of
> +bytes moved is Width size * Count, starting at 
> Address.
> +  @param[in] Buffer For read operations, the destination buffer to 
> store the results.
> +For write operations, the source buffer from 
> which to write data.
> +
> +  @retval EFI_SUCCESSThe parameters for this request pass the 
> checks.
> +  @retval EFI_INVALID_PARAMETER  Width is invalid for this PI system.
> +  @retval EFI_INVALID_PARAMETER  Buffer is NULL.
> +  @retval EFI_UNSUPPORTEDThe Buffer is not aligned for the given 
> Width.
> +  @retval EFI_UNSUPPORTEDThe address range specified by Address, 
> Width,
> + and Count is not valid for this PI system.
> +
> +**/
> +STATIC
> +EFI_STATUS
> +CpuIoCheckParameter (
> +  IN BOOLEANMmioOperation,
> +  IN EFI_CPU_IO_PROTOCOL_WIDTH  Width,
> +  IN UINT64 Address,
> +  IN UINTN  Count,
> +  IN VOID   *Buffer
> +  )
> +{
> +  UINT64  MaxCount;
> +  UINT64  Limit;
> +
> +  //
> +  // 

Re: [edk2] [PATCH 1/2] ArmPlatformPkg: move PCI related PCD definitions to ArmPkg

2016-04-29 Thread Leif Lindholm
On Fri, Apr 29, 2016 at 05:41:19PM +0200, Ard Biesheuvel wrote:
> The PCI related PCDs are not platform specific, and architectural
> protocols such as CpuIo2 are based on PCI provided MMIO to IO
> translation, so these PCDs belong in ArmPkg not ArmPlatformPkg.

Very happy with this - but, could you before pushing add a notice to
message saying something like:

"This *WILL* break some out-of-tree platforms, the fix is changing all
consumers of gArmPlatformTokenSpaceGuid.PcdPci* to
gArmTokenSpaceGuid.PcdPci."?

> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel 

Reviewed-by: Leif Lindholm 

> ---
>  ArmPkg/ArmPkg.dec   | 62 
> 
>  ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf |  4 
> +-
>  ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeDxe.inf | 16 
> ++---
>  ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJunoLib.inf |  8 
> +--
>  ArmPlatformPkg/ArmPlatformPkg.dec   | 62 
> 
>  5 files changed, 76 insertions(+), 76 deletions(-)
> 
> diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec
> index e90306653864..75c238aa1e3d 100644
> --- a/ArmPkg/ArmPkg.dec
> +++ b/ArmPkg/ArmPkg.dec
> @@ -255,3 +255,65 @@ [PcdsFixedAtBuild.common, PcdsDynamic.common]
>gArmTokenSpaceGuid.PcdGicRedistributorsBase|0|UINT32|0x000E
>gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0|UINT32|0x000D
>gArmTokenSpaceGuid.PcdGicSgiIntId|0|UINT32|0x0025
> +
> +  #
> +  # Bases, sizes and translation offsets of IO and MMIO spaces, respectively.
> +  # Note that "IO" is just another MMIO range that simulates IO space; there
> +  # are no special instructions to access it.
> +  #
> +  # The base addresses PcdPciIoBase, PcdPciMmio32Base and PcdPciMmio64Base 
> are
> +  # specific to their containing address spaces. In order to get the physical
> +  # address for the CPU, for a given access, the respective translation value
> +  # has to be added.
> +  #
> +  # The translations always have to be initialized like this, using UINT64:
> +  #
> +  #   UINT64 IoCpuBase; // mapping target in 64-bit cpu-physical space
> +  #   UINT64 Mmio32CpuBase; // mapping target in 64-bit cpu-physical space
> +  #   UINT64 Mmio64CpuBase; // mapping target in 64-bit cpu-physical space
> +  #
> +  #   PcdPciIoTranslation = IoCpuBase - PcdPciIoBase;
> +  #   PcdPciMmio32Translation = Mmio32CpuBase - (UINT64)PcdPciMmio32Base;
> +  #   PcdPciMmio64Translation = Mmio64CpuBase - PcdPciMmio64Base;
> +  #
> +  # because (a) the target address space (ie. the cpu-physical space) is
> +  # 64-bit, and (b) the translation values are meant as offsets for *modular*
> +  # arithmetic.
> +  #
> +  # Accordingly, the translation itself needs to be implemented as:
> +  #
> +  #   UINT64 UntranslatedIoAddress; // input parameter
> +  #   UINT32 UntranslatedMmio32Address; // input parameter
> +  #   UINT64 UntranslatedMmio64Address; // input parameter
> +  #
> +  #   UINT64 TranslatedIoAddress;   // output parameter
> +  #   UINT64 TranslatedMmio32Address;   // output parameter
> +  #   UINT64 TranslatedMmio64Address;   // output parameter
> +  #
> +  #   TranslatedIoAddress = UntranslatedIoAddress +
> +  # PcdPciIoTranslation;
> +  #   TranslatedMmio32Address = (UINT64)UntranslatedMmio32Address +
> +  # PcdPciMmio32Translation;
> +  #   TranslatedMmio64Address = UntranslatedMmio64Address +
> +  # PcdPciMmio64Translation;
> +  #
> +  #  The modular arithmetic performed in UINT64 ensures that the translation
> +  #  works correctly regardless of the relation between IoCpuBase and
> +  #  PcdPciIoBase, Mmio32CpuBase and PcdPciMmio32Base, and Mmio64CpuBase and
> +  #  PcdPciMmio64Base.
> +  #
> +  gArmTokenSpaceGuid.PcdPciIoBase|0x0|UINT64|0x0050
> +  gArmTokenSpaceGuid.PcdPciIoSize|0x0|UINT64|0x0051
> +  gArmTokenSpaceGuid.PcdPciIoTranslation|0x0|UINT64|0x0052
> +  gArmTokenSpaceGuid.PcdPciMmio32Base|0x0|UINT32|0x0053
> +  gArmTokenSpaceGuid.PcdPciMmio32Size|0x0|UINT32|0x0054
> +  gArmTokenSpaceGuid.PcdPciMmio32Translation|0x0|UINT64|0x0055
> +  gArmTokenSpaceGuid.PcdPciMmio64Base|0x0|UINT64|0x0056
> +  gArmTokenSpaceGuid.PcdPciMmio64Size|0x0|UINT64|0x0057
> +  gArmTokenSpaceGuid.PcdPciMmio64Translation|0x0|UINT64|0x0058
> +
> +  #
> +  # Inclusive range of allowed PCI buses.
> +  #
> +  gArmTokenSpaceGuid.PcdPciBusMin|0x0|UINT32|0x0059
> +  gArmTokenSpaceGuid.PcdPciBusMax|0x0|UINT32|0x005A
> diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf 
> b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
> index 6ab81e8dd60a..a2617982b259 100644
> --- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
> +++ 

[edk2] [PATCH 1/2] ArmPlatformPkg: move PCI related PCD definitions to ArmPkg

2016-04-29 Thread Ard Biesheuvel
The PCI related PCDs are not platform specific, and architectural
protocols such as CpuIo2 are based on PCI provided MMIO to IO
translation, so these PCDs belong in ArmPkg not ArmPlatformPkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmPkg/ArmPkg.dec   | 62 

 ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf |  4 +-
 ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeDxe.inf | 16 
++---
 ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJunoLib.inf |  8 
+--
 ArmPlatformPkg/ArmPlatformPkg.dec   | 62 

 5 files changed, 76 insertions(+), 76 deletions(-)

diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec
index e90306653864..75c238aa1e3d 100644
--- a/ArmPkg/ArmPkg.dec
+++ b/ArmPkg/ArmPkg.dec
@@ -255,3 +255,65 @@ [PcdsFixedAtBuild.common, PcdsDynamic.common]
   gArmTokenSpaceGuid.PcdGicRedistributorsBase|0|UINT32|0x000E
   gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0|UINT32|0x000D
   gArmTokenSpaceGuid.PcdGicSgiIntId|0|UINT32|0x0025
+
+  #
+  # Bases, sizes and translation offsets of IO and MMIO spaces, respectively.
+  # Note that "IO" is just another MMIO range that simulates IO space; there
+  # are no special instructions to access it.
+  #
+  # The base addresses PcdPciIoBase, PcdPciMmio32Base and PcdPciMmio64Base are
+  # specific to their containing address spaces. In order to get the physical
+  # address for the CPU, for a given access, the respective translation value
+  # has to be added.
+  #
+  # The translations always have to be initialized like this, using UINT64:
+  #
+  #   UINT64 IoCpuBase; // mapping target in 64-bit cpu-physical space
+  #   UINT64 Mmio32CpuBase; // mapping target in 64-bit cpu-physical space
+  #   UINT64 Mmio64CpuBase; // mapping target in 64-bit cpu-physical space
+  #
+  #   PcdPciIoTranslation = IoCpuBase - PcdPciIoBase;
+  #   PcdPciMmio32Translation = Mmio32CpuBase - (UINT64)PcdPciMmio32Base;
+  #   PcdPciMmio64Translation = Mmio64CpuBase - PcdPciMmio64Base;
+  #
+  # because (a) the target address space (ie. the cpu-physical space) is
+  # 64-bit, and (b) the translation values are meant as offsets for *modular*
+  # arithmetic.
+  #
+  # Accordingly, the translation itself needs to be implemented as:
+  #
+  #   UINT64 UntranslatedIoAddress; // input parameter
+  #   UINT32 UntranslatedMmio32Address; // input parameter
+  #   UINT64 UntranslatedMmio64Address; // input parameter
+  #
+  #   UINT64 TranslatedIoAddress;   // output parameter
+  #   UINT64 TranslatedMmio32Address;   // output parameter
+  #   UINT64 TranslatedMmio64Address;   // output parameter
+  #
+  #   TranslatedIoAddress = UntranslatedIoAddress +
+  # PcdPciIoTranslation;
+  #   TranslatedMmio32Address = (UINT64)UntranslatedMmio32Address +
+  # PcdPciMmio32Translation;
+  #   TranslatedMmio64Address = UntranslatedMmio64Address +
+  # PcdPciMmio64Translation;
+  #
+  #  The modular arithmetic performed in UINT64 ensures that the translation
+  #  works correctly regardless of the relation between IoCpuBase and
+  #  PcdPciIoBase, Mmio32CpuBase and PcdPciMmio32Base, and Mmio64CpuBase and
+  #  PcdPciMmio64Base.
+  #
+  gArmTokenSpaceGuid.PcdPciIoBase|0x0|UINT64|0x0050
+  gArmTokenSpaceGuid.PcdPciIoSize|0x0|UINT64|0x0051
+  gArmTokenSpaceGuid.PcdPciIoTranslation|0x0|UINT64|0x0052
+  gArmTokenSpaceGuid.PcdPciMmio32Base|0x0|UINT32|0x0053
+  gArmTokenSpaceGuid.PcdPciMmio32Size|0x0|UINT32|0x0054
+  gArmTokenSpaceGuid.PcdPciMmio32Translation|0x0|UINT64|0x0055
+  gArmTokenSpaceGuid.PcdPciMmio64Base|0x0|UINT64|0x0056
+  gArmTokenSpaceGuid.PcdPciMmio64Size|0x0|UINT64|0x0057
+  gArmTokenSpaceGuid.PcdPciMmio64Translation|0x0|UINT64|0x0058
+
+  #
+  # Inclusive range of allowed PCI buses.
+  #
+  gArmTokenSpaceGuid.PcdPciBusMin|0x0|UINT32|0x0059
+  gArmTokenSpaceGuid.PcdPciBusMax|0x0|UINT32|0x005A
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf 
b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
index 6ab81e8dd60a..a2617982b259 100644
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
+++ b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
@@ -80,8 +80,8 @@ [FixedPcd]
 
   # PCI Root complex specific PCDs
   gArmJunoTokenSpaceGuid.PcdPciConfigurationSpaceBaseAddress
-  gArmPlatformTokenSpaceGuid.PcdPciBusMin
-  gArmPlatformTokenSpaceGuid.PcdPciBusMax
+  gArmTokenSpaceGuid.PcdPciBusMin
+  gArmTokenSpaceGuid.PcdPciBusMax
 
 [Pcd]
   gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths
diff --git 
a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeDxe.inf 
b/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeDxe.inf

[edk2] [PATCH 2/2] ArmPkg: implement CpuIo2 protocol driver specific for PCI

2016-04-29 Thread Ard Biesheuvel
The CpuIo2 protocol is required by the generic PciHostBridgeDxe driver,
which relies on it to back its own I/O and MMIO operations.

Since ARM has no native I/O port equivalent, such accesses can only
originate from PCI drivers, and the PCI I/O space is translated to MMIO
in this case.

So we can implement this protocol using MMIO operations only, and take
the PCI I/O translation offset into account when performing I/O port
accesses.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.c   | 559 
 ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf |  53 ++
 2 files changed, 612 insertions(+)

diff --git a/ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.c 
b/ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.c
new file mode 100644
index ..fecf6a87adce
--- /dev/null
+++ b/ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.c
@@ -0,0 +1,559 @@
+/** @file
+  Produces the CPU I/O 2 Protocol.
+
+Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2016, Linaro Ltd. All rights reserved.
+
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD 
License
+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 
+
+#define MAX_IO_PORT_ADDRESS   0x
+
+//
+// Handle for the CPU I/O 2 Protocol
+//
+STATIC EFI_HANDLE  mHandle = NULL;
+
+//
+// Lookup table for increment values based on transfer widths
+//
+STATIC CONST UINT8 mInStride[] = {
+  1, // EfiCpuIoWidthUint8
+  2, // EfiCpuIoWidthUint16
+  4, // EfiCpuIoWidthUint32
+  8, // EfiCpuIoWidthUint64
+  0, // EfiCpuIoWidthFifoUint8
+  0, // EfiCpuIoWidthFifoUint16
+  0, // EfiCpuIoWidthFifoUint32
+  0, // EfiCpuIoWidthFifoUint64
+  1, // EfiCpuIoWidthFillUint8
+  2, // EfiCpuIoWidthFillUint16
+  4, // EfiCpuIoWidthFillUint32
+  8  // EfiCpuIoWidthFillUint64
+};
+
+//
+// Lookup table for increment values based on transfer widths
+//
+STATIC CONST UINT8 mOutStride[] = {
+  1, // EfiCpuIoWidthUint8
+  2, // EfiCpuIoWidthUint16
+  4, // EfiCpuIoWidthUint32
+  8, // EfiCpuIoWidthUint64
+  1, // EfiCpuIoWidthFifoUint8
+  2, // EfiCpuIoWidthFifoUint16
+  4, // EfiCpuIoWidthFifoUint32
+  8, // EfiCpuIoWidthFifoUint64
+  0, // EfiCpuIoWidthFillUint8
+  0, // EfiCpuIoWidthFillUint16
+  0, // EfiCpuIoWidthFillUint32
+  0  // EfiCpuIoWidthFillUint64
+};
+
+/**
+  Check parameters to a CPU I/O 2 Protocol service request.
+
+  The I/O operations are carried out exactly as requested. The caller is 
responsible
+  for satisfying any alignment and I/O width restrictions that a PI System on a
+  platform might require. For example on some platforms, width requests of
+  EfiCpuIoWidthUint64 do not work. Misaligned buffers, on the other hand, will
+  be handled by the driver.
+
+  @param[in] MmioOperation  TRUE for an MMIO operation, FALSE for I/O Port 
operation.
+  @param[in] Width  Signifies the width of the I/O or Memory operation.
+  @param[in] AddressThe base address of the I/O operation.
+  @param[in] Count  The number of I/O operations to perform. The 
number of
+bytes moved is Width size * Count, starting at 
Address.
+  @param[in] Buffer For read operations, the destination buffer to 
store the results.
+For write operations, the source buffer from which 
to write data.
+
+  @retval EFI_SUCCESSThe parameters for this request pass the 
checks.
+  @retval EFI_INVALID_PARAMETER  Width is invalid for this PI system.
+  @retval EFI_INVALID_PARAMETER  Buffer is NULL.
+  @retval EFI_UNSUPPORTEDThe Buffer is not aligned for the given Width.
+  @retval EFI_UNSUPPORTEDThe address range specified by Address, Width,
+ and Count is not valid for this PI system.
+
+**/
+STATIC
+EFI_STATUS
+CpuIoCheckParameter (
+  IN BOOLEANMmioOperation,
+  IN EFI_CPU_IO_PROTOCOL_WIDTH  Width,
+  IN UINT64 Address,
+  IN UINTN  Count,
+  IN VOID   *Buffer
+  )
+{
+  UINT64  MaxCount;
+  UINT64  Limit;
+
+  //
+  // Check to see if Buffer is NULL
+  //
+  if (Buffer == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  //
+  // Check to see if Width is in the valid range
+  //
+  if ((UINT32)Width >= EfiCpuIoWidthMaximum) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  //
+  // For FIFO type, the target address won't increase during the access,
+  // so treat Count as 1
+  //
+  if (Width >= EfiCpuIoWidthFifoUint8 && Width <= 

Re: [edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe

2016-04-29 Thread Yao, Jiewen
Reviewed-by: jiewen@intel.com

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Derek Lin
> Sent: Friday, April 29, 2016 7:09 PM
> To: edk2-devel@lists.01.org
> Cc: Derek Lin ; Yao, Jiewen ;
> Zhang, Chao B 
> Subject: [edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe
> 
> Reduce several DEBUG messages verbosity from INFO to VERBOSE, so that
> will not see debug message around each driver loading when TPM 2.0 part
> present.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Derek Lin 
> ---
>  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> index 07f76af..bdff5bd 100644
> --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> @@ -2,6 +2,7 @@
>This module implements Tcg2 Protocol.
> 
>  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD
> License
>  which accompanies this distribution.  The full text of the license may be
> found at
> @@ -332,14 +333,14 @@ Tcg2GetCapability (
>IN OUT EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability
>)
>  {
> -  DEBUG ((EFI_D_INFO, "Tcg2GetCapability ...\n"));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2GetCapability ...\n"));
> 
>if ((This == NULL) || (ProtocolCapability == NULL)) {
>  return EFI_INVALID_PARAMETER;
>}
> 
> -  DEBUG ((EFI_D_INFO, "Size - 0x%x\n", ProtocolCapability->Size));
> -  DEBUG ((EFI_D_INFO, " 1.1 - 0x%x, 1.0 - 0x%x\n",
> sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY),
> sizeof(TREE_BOOT_SERVICE_CAPABILITY_1_0)));
> +  DEBUG ((DEBUG_VERBOSE, "Size - 0x%x\n", ProtocolCapability->Size));
> +  DEBUG ((DEBUG_VERBOSE, " 1.1 - 0x%x, 1.0 - 0x%x\n",
> sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY),
> sizeof(TREE_BOOT_SERVICE_CAPABILITY_1_0)));
> 
>if (ProtocolCapability->Size < mTcgDxeData.BsCap.Size) {
>  //
> @@ -363,7 +364,7 @@ Tcg2GetCapability (
>}
> 
>CopyMem (ProtocolCapability, ,
> mTcgDxeData.BsCap.Size);
> -  DEBUG ((EFI_D_INFO, "Tcg2GetCapability - %r\n", EFI_SUCCESS));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2GetCapability - %r\n", EFI_SUCCESS));
>return EFI_SUCCESS;
>  }
> 
> @@ -1237,7 +1238,7 @@ Tcg2HashLogExtendEvent (
>TCG_PCR_EVENT_HDR  NewEventHdr;
>TPML_DIGEST_VALUES DigestList;
> 
> -  DEBUG ((EFI_D_INFO, "Tcg2HashLogExtendEvent ...\n"));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2HashLogExtendEvent ...\n"));
> 
>if ((This == NULL) || (DataToHash == 0) || (Event == NULL)) {
>  return EFI_INVALID_PARAMETER;
> @@ -1287,7 +1288,7 @@ Tcg2HashLogExtendEvent (
> Event->Event
> );
>}
> -  DEBUG ((EFI_D_INFO, "Tcg2HashLogExtendEvent - %r\n", Status));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2HashLogExtendEvent - %r\n", Status));
>return Status;
>  }
> 
> --
> 2.7.4.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch v4 00/23] Use MdeModulePkg/BDS in OVMF platform

2016-04-29 Thread Laszlo Ersek
On 04/29/16 09:00, Ruiyu Ni wrote:
> The patch serials creates a flag USE_OLD_BDS and by default the value
> of the flag is FALSE so that the new MdeModulePkg/BDS is used.
> User can define USE_OLD_BDS as TRUE to force to use IntelFrameworkModulePkg
> /BDS.
> 
> The v3 adopts comments for v1 and v2 to split the big changes to
> small changes and also expose the EfiBootManagerGetLoadOptionBuffer().
> 
> The v4 adopts comments for v3.

Ray, can you please push this version to your public repo?

Thanks
Laszlo

> Ruiyu Ni (23):
>   MdeModulePkg/UefiBootManagerLib: Expose *GetLoadOptionBuffer() API
>   OvmfPkg/PlatformPei: Add memory above 4GB as tested
>   OvmfPkg: Duplicate QemuBootOrderLib to QemuNewBootOrderLib
>   OvmfPkg/QemuNewBootOrderLib: Build with UefiBootManagerLib
>   OvmfPkg: Duplicate PlatformBdsLib to PlatformBootManagerLib
>   OvmfPkg/PlatformBootManagerLib: Follow PlatformBootManagerLib
> interfaces
>   OvmfPkg/PlatformBootManagerLib: use
> EfiBootManagerUpdateConsoleVariable
>   OvmfPkg/PlatformBootManagerLib: link to UefiBootManagerLib
>   OvmfPkg/PlatformBootManagerLib: Use ConvertDevicePathToText()
>   OvmfPkg/PlatformBootManagerLib: Init console vars in *BeforeConsole()
>   OvmfPkg/PlatformBootManagerLib: Do not launch Boot Manager Menu
>   OvmfPkg/PlatformBootManagerLib: Register boot options and hot keys
>   OvmfPkg/PlatformBootManagerLib: Remove unused local functions.
>   OvmfPkg/PlatformBootManagerLib: port PlatformBdsConnectSequence to
> UefiBootManagerLib
>   OvmfPkg/PlatformBootManagerLib: Use
> EfiBootManagerRefreshAllBootOption()
>   OvmfPkg/PlatformBootManagerLib: Remove PlatformBdsGetDriverOption()
>   OvmfPkg/PlatformBootManagerLib: Use GetBootModeHob() in HobLib
>   OvmfPkg/PlatformBootManagerLib: Remove unnecessary memory test
>   OvmfPkg/PlatformBootManagerLib: Remove unused vars and func prototypes
>   OvmfPkg/PlatformBootManagerLib: Add EnableQuietBoot & DisableQuietBoot
>   OvmfPkg/PlatformBootManagerLib: Remove unused C structures definitions
>   OvmfPkg: Use MdeModulePkg/BDS
>   OvmfPkg/OvmfPkgIa32X64.dsc: Move PcdShellFile to
> [PcdsFixedAtBuild.X64]
> 
>  MdeModulePkg/Include/Library/UefiBootManagerLib.h  |   23 +-
>  MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   |   11 +-
>  .../Library/UefiBootManagerLib/BmLoadOption.c  |2 +-
>  .../Library/UefiBootManagerLib/InternalBm.h|   19 -
>  .../Library/PlatformBootManagerLib/BdsPlatform.c   | 1397 
> 
>  .../Library/PlatformBootManagerLib/BdsPlatform.h   |  214 +++
>  .../PlatformBootManagerLib.inf |   83 ++
>  .../Library/PlatformBootManagerLib/PlatformData.c  |   41 +
>  .../QemuKernel.c   |0
>  OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c |  671 ++
>  .../ExtraRootBusMap.c  |0
>  .../ExtraRootBusMap.h  |0
>  .../QemuBootOrderLib.c |  139 +-
>  .../QemuBootOrderLib.inf   |   10 +-
>  OvmfPkg/OvmfPkgIa32.dsc|   41 +-
>  OvmfPkg/OvmfPkgIa32.fdf|5 +
>  OvmfPkg/OvmfPkgIa32X64.dsc |   43 +-
>  OvmfPkg/OvmfPkgIa32X64.fdf |5 +
>  OvmfPkg/OvmfPkgX64.dsc |   41 +-
>  OvmfPkg/OvmfPkgX64.fdf |5 +
>  OvmfPkg/PlatformPei/MemDetect.c|4 +-
>  OvmfPkg/PlatformPei/Platform.c |   29 -
>  OvmfPkg/PlatformPei/Platform.h |   14 +-
>  OvmfPkg/PlatformPei/Xen.c  |8 +-
>  24 files changed, 2653 insertions(+), 152 deletions(-)
>  create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
>  create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
>  create mode 100644 
> OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
>  create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
>  copy OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/QemuKernel.c 
> (100%)
>  create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c
>  copy OvmfPkg/Library/{QemuBootOrderLib => 
> QemuNewBootOrderLib}/ExtraRootBusMap.c (100%)
>  copy OvmfPkg/Library/{QemuBootOrderLib => 
> QemuNewBootOrderLib}/ExtraRootBusMap.h (100%)
>  copy OvmfPkg/Library/{QemuBootOrderLib => 
> QemuNewBootOrderLib}/QemuBootOrderLib.c (91%)
>  copy OvmfPkg/Library/{QemuBootOrderLib => 
> QemuNewBootOrderLib}/QemuBootOrderLib.inf (83%)
> 

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


Re: [edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe

2016-04-29 Thread Laszlo Ersek
On 04/29/16 13:09, Derek Lin wrote:
> Reduce several DEBUG messages verbosity from INFO to VERBOSE, so that will 
> not see debug message around each driver loading when TPM 2.0 part present.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Derek Lin 
> ---
>  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)

Just a superficial comment: it should be EFI_D_VERBOSE, not DEBUG_VERBOSE.

Thanks
Laszlo

> diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c 
> b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> index 07f76af..bdff5bd 100644
> --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> @@ -2,6 +2,7 @@
>This module implements Tcg2 Protocol.
>
>  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  This program and the accompanying materials 
>  are licensed and made available under the terms and conditions of the BSD 
> License 
>  which accompanies this distribution.  The full text of the license may be 
> found at 
> @@ -332,14 +333,14 @@ Tcg2GetCapability (
>IN OUT EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability
>)
>  {
> -  DEBUG ((EFI_D_INFO, "Tcg2GetCapability ...\n"));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2GetCapability ...\n"));
>  
>if ((This == NULL) || (ProtocolCapability == NULL)) {
>  return EFI_INVALID_PARAMETER;
>}
>
> -  DEBUG ((EFI_D_INFO, "Size - 0x%x\n", ProtocolCapability->Size));
> -  DEBUG ((EFI_D_INFO, " 1.1 - 0x%x, 1.0 - 0x%x\n", 
> sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY), 
> sizeof(TREE_BOOT_SERVICE_CAPABILITY_1_0)));
> +  DEBUG ((DEBUG_VERBOSE, "Size - 0x%x\n", ProtocolCapability->Size));
> +  DEBUG ((DEBUG_VERBOSE, " 1.1 - 0x%x, 1.0 - 0x%x\n", 
> sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY), 
> sizeof(TREE_BOOT_SERVICE_CAPABILITY_1_0)));
>  
>if (ProtocolCapability->Size < mTcgDxeData.BsCap.Size) {
>  //
> @@ -363,7 +364,7 @@ Tcg2GetCapability (
>}
>  
>CopyMem (ProtocolCapability, , mTcgDxeData.BsCap.Size);
> -  DEBUG ((EFI_D_INFO, "Tcg2GetCapability - %r\n", EFI_SUCCESS));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2GetCapability - %r\n", EFI_SUCCESS));
>return EFI_SUCCESS;
>  }
>  
> @@ -1237,7 +1238,7 @@ Tcg2HashLogExtendEvent (
>TCG_PCR_EVENT_HDR  NewEventHdr;
>TPML_DIGEST_VALUES DigestList;
>  
> -  DEBUG ((EFI_D_INFO, "Tcg2HashLogExtendEvent ...\n"));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2HashLogExtendEvent ...\n"));
>  
>if ((This == NULL) || (DataToHash == 0) || (Event == NULL)) {
>  return EFI_INVALID_PARAMETER;
> @@ -1287,7 +1288,7 @@ Tcg2HashLogExtendEvent (
> Event->Event
> );
>}
> -  DEBUG ((EFI_D_INFO, "Tcg2HashLogExtendEvent - %r\n", Status));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2HashLogExtendEvent - %r\n", Status));
>return Status;
>  }
>  
> 

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


[edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe

2016-04-29 Thread Derek Lin
Reduce several DEBUG messages verbosity from INFO to VERBOSE, so that will not 
see debug message around each driver loading when TPM 2.0 part present.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Derek Lin 
---
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c 
b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
index 07f76af..bdff5bd 100644
--- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
+++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
@@ -2,6 +2,7 @@
   This module implements Tcg2 Protocol.
   
 Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials 
 are licensed and made available under the terms and conditions of the BSD 
License 
 which accompanies this distribution.  The full text of the license may be 
found at 
@@ -332,14 +333,14 @@ Tcg2GetCapability (
   IN OUT EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability
   )
 {
-  DEBUG ((EFI_D_INFO, "Tcg2GetCapability ...\n"));
+  DEBUG ((DEBUG_VERBOSE, "Tcg2GetCapability ...\n"));
 
   if ((This == NULL) || (ProtocolCapability == NULL)) {
 return EFI_INVALID_PARAMETER;
   }
   
-  DEBUG ((EFI_D_INFO, "Size - 0x%x\n", ProtocolCapability->Size));
-  DEBUG ((EFI_D_INFO, " 1.1 - 0x%x, 1.0 - 0x%x\n", 
sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY), 
sizeof(TREE_BOOT_SERVICE_CAPABILITY_1_0)));
+  DEBUG ((DEBUG_VERBOSE, "Size - 0x%x\n", ProtocolCapability->Size));
+  DEBUG ((DEBUG_VERBOSE, " 1.1 - 0x%x, 1.0 - 0x%x\n", 
sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY), 
sizeof(TREE_BOOT_SERVICE_CAPABILITY_1_0)));
 
   if (ProtocolCapability->Size < mTcgDxeData.BsCap.Size) {
 //
@@ -363,7 +364,7 @@ Tcg2GetCapability (
   }
 
   CopyMem (ProtocolCapability, , mTcgDxeData.BsCap.Size);
-  DEBUG ((EFI_D_INFO, "Tcg2GetCapability - %r\n", EFI_SUCCESS));
+  DEBUG ((DEBUG_VERBOSE, "Tcg2GetCapability - %r\n", EFI_SUCCESS));
   return EFI_SUCCESS;
 }
 
@@ -1237,7 +1238,7 @@ Tcg2HashLogExtendEvent (
   TCG_PCR_EVENT_HDR  NewEventHdr;
   TPML_DIGEST_VALUES DigestList;
 
-  DEBUG ((EFI_D_INFO, "Tcg2HashLogExtendEvent ...\n"));
+  DEBUG ((DEBUG_VERBOSE, "Tcg2HashLogExtendEvent ...\n"));
 
   if ((This == NULL) || (DataToHash == 0) || (Event == NULL)) {
 return EFI_INVALID_PARAMETER;
@@ -1287,7 +1288,7 @@ Tcg2HashLogExtendEvent (
Event->Event
);
   }
-  DEBUG ((EFI_D_INFO, "Tcg2HashLogExtendEvent - %r\n", Status));
+  DEBUG ((DEBUG_VERBOSE, "Tcg2HashLogExtendEvent - %r\n", Status));
   return Status;
 }
 
-- 
2.7.4.windows.1

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


Re: [edk2] [PATCH v4 2/2] OvmfPkg: Modify FDF/DSC files for RamDiskDxe's adding NFIT report feature

2016-04-29 Thread Laszlo Ersek
On 04/29/16 04:23, Hao Wu wrote:
> The RamDiskDxe driver in MdeModulePkg now will use EFI_ACPI_TABLE_PROTOCOL
> and EFI_ACPI_SDT_PROTOCOL during reporting RAM disks to NVDIMM Firmware
> Interface Table (NFIT).
> 
> A Pcd 'PcdInstallAcpiSdtProtocol' controls whether the
> EFI_ACPI_SDT_PROTOCOL will be produced. Its default value is set to FALSE
> in MdeModulePkg. To make the NFIT reporting feature working properly under
> OVMF, the patch will set the Pcd to TRUE in OVMF DSC files.
> 
> Also, the RamDiskDxe driver will sometimes report a NVDIMM Root Device
> using ASL code which is put in a Secondary System Description Table (SSDT)
> according to the ACPI 6.1 spec.
> 
> Locating the SSDT requires modifying the [Rule.Common.DXE_DRIVER] field in
> OVMF FDF files.
> 
> Cc: Laszlo Ersek 
> Cc: Jordan Justen 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Hao Wu 
> ---
>  OvmfPkg/OvmfPkgIa32.dsc| 1 +
>  OvmfPkg/OvmfPkgIa32.fdf| 2 ++
>  OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
>  OvmfPkg/OvmfPkgIa32X64.fdf | 2 ++
>  OvmfPkg/OvmfPkgX64.dsc | 1 +
>  OvmfPkg/OvmfPkgX64.fdf | 2 ++
>  6 files changed, 9 insertions(+)
> 
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index 0206dda..5dbfe57 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -350,6 +350,7 @@
>gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
>gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
>gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
>  !if $(SECURE_BOOT_ENABLE) == TRUE
>gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootEnable|TRUE
>  !endif
> diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
> index 93a51a5..287737c 100644
> --- a/OvmfPkg/OvmfPkgIa32.fdf
> +++ b/OvmfPkg/OvmfPkgIa32.fdf
> @@ -444,6 +444,8 @@ FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
>  PE32 PE32$(INF_OUTPUT)/$(MODULE_NAME).efi
>  UI   STRING="$(MODULE_NAME)" Optional
>  VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
> +RAW ACPI  Optional   |.acpi
> +RAW ASL   Optional   |.aml
>}
>  
>  [Rule.Common.DXE_RUNTIME_DRIVER]
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 06fe141..896f9c6 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -355,6 +355,7 @@
>gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|TRUE
>gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
>gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
>  !if $(SECURE_BOOT_ENABLE) == TRUE
>gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootEnable|TRUE
>  !endif
> diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
> index aad16a6..cc1587a 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.fdf
> +++ b/OvmfPkg/OvmfPkgIa32X64.fdf
> @@ -444,6 +444,8 @@ FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
>  PE32 PE32$(INF_OUTPUT)/$(MODULE_NAME).efi
>  UI   STRING="$(MODULE_NAME)" Optional
>  VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
> +RAW ACPI  Optional   |.acpi
> +RAW ASL   Optional   |.aml
>}
>  
>  [Rule.Common.DXE_RUNTIME_DRIVER]
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index e88e70d..cdac4ef 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -355,6 +355,7 @@
>gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
>gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
>gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
>  !if $(SECURE_BOOT_ENABLE) == TRUE
>gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootEnable|TRUE
>  !endif
> diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
> index 387b808..1b52381 100644
> --- a/OvmfPkg/OvmfPkgX64.fdf
> +++ b/OvmfPkg/OvmfPkgX64.fdf
> @@ -444,6 +444,8 @@ FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
>  PE32 PE32$(INF_OUTPUT)/$(MODULE_NAME).efi
>  UI   STRING="$(MODULE_NAME)" Optional
>  VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
> +RAW ACPI  Optional   |.acpi
> +RAW ASL   Optional   |.aml
>}
>  
>  [Rule.Common.DXE_RUNTIME_DRIVER]
> 

Okay, I reviewed the [Rule] docs in the FDF spec, and the FileType
definitions in the INF spec. Patch looks good.

Reviewed-by: Laszlo Ersek 

Jordan, do you have any comments?

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


Re: [edk2] [PATCH 2/2] PerformancePkg/Dp_App: Fix the error message "Timer library instance error!"

2016-04-29 Thread Shia, Cinnamon
Hi Star,

Thanks for your review.

"duration < StartTimeStamp" is for the case of the timer counting down.

Below is the source code for your reference:

if (TimerInfo.CountUp) {
  Duration = Measurement->EndTimeStamp - Measurement->StartTimeStamp;
  Error = (BOOLEAN)(Duration > Measurement->EndTimeStamp);
 } else {
  Duration = Measurement->StartTimeStamp - Measurement->EndTimeStamp;
  Error = (BOOLEAN)(Duration > Measurement->StartTimeStamp);
 }

Thanks,
Cinnamon Shia

On 2016?4?29?, at 13:30, Zeng, Star 
> wrote:

Cinnamon,

On 2016/4/29 10:42, Cinnamon Shia wrote:
When executing shell dp command, there is an error message "Timer library
instance error!"

The error message "Timer library instance error!" should be for the case about
duration > EndTimeStamp if CountUp or duration < StartTimeStamp if CountDown.

The information "duration < StartTimeStamp" should be "duration > 
StartTimeStamp", right?

With this updated, you can have my Reviewed-by: Star Zeng 
>.
Same comments to another patch in ShellPkg.

If you agree, you do not need resend the patch, I can help push the patches.

I have other comments are not related to these patches.
Could you help send patch to remove "HP_ISS_EDK2_CONTRIUTION" in 
ShellPkg\Library\UefiDpLib\DpTrace.c comments?
And could you send patch to remove InitCumulativeData() in 
PerformancePkg\Dp_App\Dp.c as the function is not used by Dp in PerformancePkg?


Thanks,
Star


But if the EndTimeStamp of an entry is not added, it should not the case to 
catch.

This change fixes the error message "Timer library instance error!" from the
"BdsAttempt" entry which is logged when trying to boot a boot option.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia 
>
---
 PerformancePkg/Dp_App/DpUtilities.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/PerformancePkg/Dp_App/DpUtilities.c 
b/PerformancePkg/Dp_App/DpUtilities.c
index b49844a..f5ef9cf 100644
--- a/PerformancePkg/Dp_App/DpUtilities.c
+++ b/PerformancePkg/Dp_App/DpUtilities.c
@@ -2,6 +2,7 @@
   Utility functions used by the Dp application.

   Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+  (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -82,6 +83,10 @@ GetDuration (
   UINT64Duration;
   BOOLEAN   Error;

+  if (Measurement->EndTimeStamp == 0) {
+return 0;
+  }
+
   // PERF_START macros are called with a value of 1 to indicate
   // the beginning of time.  So, adjust the start ticker value
   // to the real beginning of time.


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


Re: [edk2] [PATCH] MdeModulePkg/DxeCore: set ImageContext Handle and ImageRead() fields

2016-04-29 Thread Zeng, Star
Reviewed-by: Star Zeng 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ard 
Biesheuvel
Sent: Friday, April 29, 2016 3:44 PM
To: edk2-devel@lists.01.org; Tian, Feng ; Zeng, Star 

Cc: Ard Biesheuvel 
Subject: [edk2] [PATCH] MdeModulePkg/DxeCore: set ImageContext Handle and 
ImageRead() fields

Set the ImageContext.Handle and ImageContext.ImageRead() fields so that
PeCoffLoaderRelocateImageExtraAction() can invoke PeCoffLoaderGetImageInfo or 
PeCoffLoaderGetPeHeader if desired to obtain additional metadata.

We will use this to create a PeCoffLoaderRelocateImageExtraAction()
implementation that applies boot time strict mapping permissions to PE/COFF 
modules.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c 
b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
index 70a283bc2ba2..c34067e11845 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
+++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
@@ -315,6 +315,8 @@ DxeMain (
   if (Status == EFI_SUCCESS) {
 ImageContext.EntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)EntryPoint;
   }
+  ImageContext.Handle = (VOID *)(UINTN)gDxeCoreLoadedImage->ImageBase;
+  ImageContext.ImageRead  = PeCoffLoaderImageReadFromMemory;
   PeCoffLoaderRelocateImageExtraAction ();
 
   //
--
2.7.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] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe

2016-04-29 Thread Lin, Derek (HPS UEFI Dev)
Thanks.
I agree, will send a patch soon.

Derek

-Original Message-
From: Yao, Jiewen [mailto:jiewen@intel.com] 
Sent: Friday, April 29, 2016 6:29 PM
To: Lin, Derek (HPS UEFI Dev) ; Zhang, Chao B 
; El-Haj-Mahmoud, Samer ; 
edk2-devel@lists.01.org
Subject: RE: [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe

Thanks. That makes sense now. Would you please update commit message?

I agree to reduce debug message. I think below message is of much importance to 
show TPM capability and narrow BitLock failure, per my experience.

I suggest we keep those as INFO. For others, I am OK to change to VERBOSE.

 DEBUG ((EFI_D_INFO, "Tcg2.SupportedEventLogs - 0x%08x\n", 
mTcgDxeData.BsCap.SupportedEventLogs));
 DEBUG ((EFI_D_INFO, "Tcg2.HashAlgorithmBitmap - 0x%08x\n", 
mTcgDxeData.BsCap.HashAlgorithmBitmap));
 DEBUG ((EFI_D_INFO, "Tcg2.NumberOfPCRBanks  - 0x%08x\n", 
mTcgDxeData.BsCap.NumberOfPCRBanks));
 DEBUG ((EFI_D_INFO, "Tcg2.ActivePcrBanks- 0x%08x\n", 
mTcgDxeData.BsCap.ActivePcrBanks));



> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Lin, Derek (HPS UEFI Dev)
> Sent: Friday, April 29, 2016 5:59 PM
> To: Yao, Jiewen ; Zhang, Chao B 
> ; El-Haj-Mahmoud, Samer 
> ; edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in 
> Tcg2Dxe
> 
> Hi Jiewen,
> 
> It is test with TPM 2.0 part present. There is debug message around 
> each driver loading, which we think should be verbose.
> The commit description is wrong.
> 
> Thanks,
> Derek
> 
> -Original Message-
> From: Yao, Jiewen [mailto:jiewen@intel.com]
> Sent: Friday, April 29, 2016 10:38 AM
> To: Zhang, Chao B ; El-Haj-Mahmoud, Samer 
> ; edk2-devel@lists.01.org
> Cc: El-Haj-Mahmoud, Samer ; Lin, Derek 
> (HPS UEFI Dev) ; Yao, Jiewen 
> 
> Subject: RE: [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe
> 
> Chao
> I have question on this patch. I asked in another mail.
> 
> If there is no TPM 2.0 part present, this code should not run, by design.
> 
> Would you please clarify how you trigger this situation?
> 
> Thank you
> Yao Jiewen
> 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf 
> > Of Zhang, Chao B
> > Sent: Friday, April 29, 2016 10:31 AM
> > To: Samer El-Haj-Mahmoud ; 
> > edk2-devel@lists.01.org
> > Cc: Samer El-Haj-Mahmoud ; Derek Lin 
> > 
> > Subject: Re: [edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in 
> > Tcg2Dxe
> >
> > Reviewed-by: Chao Zhang 
> >
> >
> >
> >
> >
> >
> > Thanks & Best regards
> > Chao Zhang
> >
> >
> > -Original Message-
> > From: Samer El-Haj-Mahmoud [mailto:samer.el-haj-mahm...@hpe.com]
> > Sent: Friday, April 29, 2016 4:47 AM
> > To: edk2-devel@lists.01.org
> > Cc: Zhang, Chao B; Samer El-Haj-Mahmoud; Samer El-Haj-Mahmoud;
> Derek
> > Lin
> > Subject: [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe
> >
> > Reduce several DEBUG messages verbosity from INFO to VERBOSE to
> reduce
> > debug spam when there is no TPM 2.0 part present
> >
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Samer El-Haj-Mahmoud 
> > Signed-off-by: Derek Lin 
> > ---
> >  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 21 +++--
> >  1 file changed, 11 insertions(+), 10 deletions(-)
> >
> > diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> > b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> > index 07f76af..6555df5 100644
> > --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> > +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> > @@ -2,6 +2,7 @@
> >This module implements Tcg2 Protocol.
> >
> >  Copyright (c) 2015 - 2016, Intel Corporation. All rights 
> > reserved.
> > +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
> >  This program and the accompanying materials  are licensed and made 
> > available under the terms and conditions of the BSD License  which 
> > accompanies this distribution.  The full text of the license may be 
> > found at @@ -332,14 +333,14 @@ Tcg2GetCapability (
> >IN OUT EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability
> >)
> >  {
> > -  DEBUG ((EFI_D_INFO, "Tcg2GetCapability ...\n"));
> > +  DEBUG ((DEBUG_VERBOSE, "Tcg2GetCapability ...\n"));
> >
> >if ((This == NULL) || (ProtocolCapability == NULL)) {
> >  return EFI_INVALID_PARAMETER;
> >}
> >
> > -  DEBUG ((EFI_D_INFO, "Size - 0x%x\n", ProtocolCapability->Size));
> > -  DEBUG ((EFI_D_INFO, " 1.1 - 0x%x, 1.0 - 0x%x\n", 
> > sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY),
> > sizeof(TREE_BOOT_SERVICE_CAPABILITY_1_0)));
> > +  DEBUG 

Re: [edk2] [PATCH] SecurityPkg: Reduce TPM debug verbosity

2016-04-29 Thread Yao, Jiewen
Reviewed by: jiewen@intel.com

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Samer El-Haj-Mahmoud
> Sent: Friday, April 29, 2016 5:08 AM
> To: edk2-devel@lists.01.org
> Cc: Samer El-Haj-Mahmoud ; Zhang, Chao B
> 
> Subject: [edk2] [PATCH] SecurityPkg: Reduce TPM debug verbosity
> 
> Reduce several DEBUG messages verbosity in TPM, especially when no TPM
> HW is present
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Samer El-Haj-Mahmoud 
> ---
>  SecurityPkg/Tcg/TcgPei/TcgPei.c   |  3 ++-
>  SecurityPkg/Tcg/TcgSmm/TcgSmm.c   |  3 ++-
>  SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c | 43
> ---
>  SecurityPkg/Tcg/TrEEPei/TrEEPei.c |  5 +++--
>  4 files changed, 29 insertions(+), 25 deletions(-)
> 
> diff --git a/SecurityPkg/Tcg/TcgPei/TcgPei.c
> b/SecurityPkg/Tcg/TcgPei/TcgPei.c
> index 25724a6..69eb728 100644
> --- a/SecurityPkg/Tcg/TcgPei/TcgPei.c
> +++ b/SecurityPkg/Tcg/TcgPei/TcgPei.c
> @@ -2,6 +2,7 @@
>Initialize TPM device and measure FVs before handing off control to DXE.
> 
>  Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.
> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD
> License
>  which accompanies this distribution.  The full text of the license may be
> found at
> @@ -753,7 +754,7 @@ PeimEntryMA (
>EFI_BOOT_MODE BootMode;
> 
>if (!CompareGuid (PcdGetPtr(PcdTpmInstanceGuid),
> )){
> -DEBUG ((EFI_D_ERROR, "No TPM12 instance required!\n"));
> +DEBUG ((EFI_D_INFO, "No TPM12 instance required!\n"));
>  return EFI_UNSUPPORTED;
>}
> 
> diff --git a/SecurityPkg/Tcg/TcgSmm/TcgSmm.c
> b/SecurityPkg/Tcg/TcgSmm/TcgSmm.c
> index 96fb456..981db1c 100644
> --- a/SecurityPkg/Tcg/TcgSmm/TcgSmm.c
> +++ b/SecurityPkg/Tcg/TcgSmm/TcgSmm.c
> @@ -9,6 +9,7 @@
>PhysicalPresenceCallback() and MemoryClearCallback() will receive
> untrusted input and do some check.
> 
>  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD
> License
>  which accompanies this distribution.  The full text of the license may be
> found at
> @@ -426,7 +427,7 @@ InitializeTcgSmm (
>EFI_HANDLE SwHandle;
> 
>if (!CompareGuid (PcdGetPtr(PcdTpmInstanceGuid),
> )){
> -DEBUG ((EFI_D_ERROR, "No TPM12 instance required!\n"));
> +DEBUG ((EFI_D_INFO, "No TPM12 instance required!\n"));
>  return EFI_UNSUPPORTED;
>}
> 
> diff --git a/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c
> b/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c
> index dfdee04..f93c6d2 100644
> --- a/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c
> +++ b/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c
> @@ -2,6 +2,7 @@
>This module implements TrEE Protocol.
> 
>  Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.
> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD
> License
>  which accompanies this distribution.  The full text of the license may be
> found at
> @@ -212,7 +213,7 @@ InternalDumpData (
>  {
>UINTN  Index;
>for (Index = 0; Index < Size; Index++) {
> -DEBUG ((EFI_D_INFO, "%02x", (UINTN)Data[Index]));
> +DEBUG ((DEBUG_VERBOSE, "%02x", (UINTN)Data[Index]));
>}
>  }
> 
> @@ -239,15 +240,15 @@ InternalDumpHex (
>Count = Size / COLUME_SIZE;
>Left  = Size % COLUME_SIZE;
>for (Index = 0; Index < Count; Index++) {
> -DEBUG ((EFI_D_INFO, "%04x: ", Index * COLUME_SIZE));
> +DEBUG ((DEBUG_VERBOSE, "%04x: ", Index * COLUME_SIZE));
>  InternalDumpData (Data + Index * COLUME_SIZE, COLUME_SIZE);
> -DEBUG ((EFI_D_INFO, "\n"));
> +DEBUG ((DEBUG_VERBOSE, "\n"));
>}
> 
>if (Left != 0) {
> -DEBUG ((EFI_D_INFO, "%04x: ", Index * COLUME_SIZE));
> +DEBUG ((DEBUG_VERBOSE, "%04x: ", Index * COLUME_SIZE));
>  InternalDumpData (Data + Index * COLUME_SIZE, Left);
> -DEBUG ((EFI_D_INFO, "\n"));
> +DEBUG ((DEBUG_VERBOSE, "\n"));
>}
>  }
> 
> @@ -392,21 +393,21 @@ DumpEventLog (
>TCG_PCR_EVENT_HDR *EventHdr;
>UINTN Index;
> 
> -  DEBUG ((EFI_D_INFO, "EventLogFormat: (0x%x)\n", EventLogFormat));
> +  DEBUG ((DEBUG_VERBOSE, "EventLogFormat: (0x%x)\n",
> EventLogFormat));
> 
>switch (EventLogFormat) {
>case TREE_EVENT_LOG_FORMAT_TCG_1_2:
>  EventHdr = (TCG_PCR_EVENT_HDR *)(UINTN)EventLogLocation;
>  while ((UINTN)EventHdr <= EventLogLastEntry) {
> -  DEBUG ((EFI_D_INFO, "  Event:\n"));
> -  DEBUG ((EFI_D_INFO, "PCRIndex  - %d\n",
> 

Re: [edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe

2016-04-29 Thread Yao, Jiewen
Thanks. That makes sense now. Would you please update commit message?

I agree to reduce debug message. I think below message is of much importance to 
show TPM capability and narrow BitLock failure, per my experience.

I suggest we keep those as INFO. For others, I am OK to change to VERBOSE.

 DEBUG ((EFI_D_INFO, "Tcg2.SupportedEventLogs - 0x%08x\n", 
mTcgDxeData.BsCap.SupportedEventLogs));
 DEBUG ((EFI_D_INFO, "Tcg2.HashAlgorithmBitmap - 0x%08x\n", 
mTcgDxeData.BsCap.HashAlgorithmBitmap));
 DEBUG ((EFI_D_INFO, "Tcg2.NumberOfPCRBanks  - 0x%08x\n", 
mTcgDxeData.BsCap.NumberOfPCRBanks));
 DEBUG ((EFI_D_INFO, "Tcg2.ActivePcrBanks- 0x%08x\n", 
mTcgDxeData.BsCap.ActivePcrBanks));



> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Lin, Derek (HPS UEFI Dev)
> Sent: Friday, April 29, 2016 5:59 PM
> To: Yao, Jiewen ; Zhang, Chao B
> ; El-Haj-Mahmoud, Samer
> ; edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe
> 
> Hi Jiewen,
> 
> It is test with TPM 2.0 part present. There is debug message around each
> driver loading, which we think should be verbose.
> The commit description is wrong.
> 
> Thanks,
> Derek
> 
> -Original Message-
> From: Yao, Jiewen [mailto:jiewen@intel.com]
> Sent: Friday, April 29, 2016 10:38 AM
> To: Zhang, Chao B ; El-Haj-Mahmoud, Samer
> ; edk2-devel@lists.01.org
> Cc: El-Haj-Mahmoud, Samer ; Lin, Derek
> (HPS UEFI Dev) ; Yao, Jiewen
> 
> Subject: RE: [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe
> 
> Chao
> I have question on this patch. I asked in another mail.
> 
> If there is no TPM 2.0 part present, this code should not run, by design.
> 
> Would you please clarify how you trigger this situation?
> 
> Thank you
> Yao Jiewen
> 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> > Zhang, Chao B
> > Sent: Friday, April 29, 2016 10:31 AM
> > To: Samer El-Haj-Mahmoud ;
> > edk2-devel@lists.01.org
> > Cc: Samer El-Haj-Mahmoud ; Derek Lin
> > 
> > Subject: Re: [edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in
> > Tcg2Dxe
> >
> > Reviewed-by: Chao Zhang 
> >
> >
> >
> >
> >
> >
> > Thanks & Best regards
> > Chao Zhang
> >
> >
> > -Original Message-
> > From: Samer El-Haj-Mahmoud [mailto:samer.el-haj-mahm...@hpe.com]
> > Sent: Friday, April 29, 2016 4:47 AM
> > To: edk2-devel@lists.01.org
> > Cc: Zhang, Chao B; Samer El-Haj-Mahmoud; Samer El-Haj-Mahmoud;
> Derek
> > Lin
> > Subject: [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe
> >
> > Reduce several DEBUG messages verbosity from INFO to VERBOSE to
> reduce
> > debug spam when there is no TPM 2.0 part present
> >
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Samer El-Haj-Mahmoud 
> > Signed-off-by: Derek Lin 
> > ---
> >  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 21 +++--
> >  1 file changed, 11 insertions(+), 10 deletions(-)
> >
> > diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> > b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> > index 07f76af..6555df5 100644
> > --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> > +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> > @@ -2,6 +2,7 @@
> >This module implements Tcg2 Protocol.
> >
> >  Copyright (c) 2015 - 2016, Intel Corporation. All rights
> > reserved.
> > +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
> >  This program and the accompanying materials  are licensed and made
> > available under the terms and conditions of the BSD License  which
> > accompanies this distribution.  The full text of the license may be
> > found at @@ -332,14 +333,14 @@ Tcg2GetCapability (
> >IN OUT EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability
> >)
> >  {
> > -  DEBUG ((EFI_D_INFO, "Tcg2GetCapability ...\n"));
> > +  DEBUG ((DEBUG_VERBOSE, "Tcg2GetCapability ...\n"));
> >
> >if ((This == NULL) || (ProtocolCapability == NULL)) {
> >  return EFI_INVALID_PARAMETER;
> >}
> >
> > -  DEBUG ((EFI_D_INFO, "Size - 0x%x\n", ProtocolCapability->Size));
> > -  DEBUG ((EFI_D_INFO, " 1.1 - 0x%x, 1.0 - 0x%x\n",
> > sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY),
> > sizeof(TREE_BOOT_SERVICE_CAPABILITY_1_0)));
> > +  DEBUG ((DEBUG_VERBOSE, "Size - 0x%x\n", ProtocolCapability->Size));
> > + DEBUG ((DEBUG_VERBOSE, " 1.1 - 0x%x, 1.0 - 0x%x\n",
> > + sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY),
> > + sizeof(TREE_BOOT_SERVICE_CAPABILITY_1_0)));
> >
> >if (ProtocolCapability->Size < mTcgDxeData.BsCap.Size) {
> >  //
> > @@ -363,7 +364,7 @@ Tcg2GetCapability (
> >}
> >
> >CopyMem (ProtocolCapability, ,
> > mTcgDxeData.BsCap.Size);
> > 

Re: [edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe

2016-04-29 Thread Lin, Derek (HPS UEFI Dev)
Hi Jiewen,

It is test with TPM 2.0 part present. There is debug message around each driver 
loading, which we think should be verbose.
The commit description is wrong.

Thanks,
Derek

-Original Message-
From: Yao, Jiewen [mailto:jiewen@intel.com] 
Sent: Friday, April 29, 2016 10:38 AM
To: Zhang, Chao B ; El-Haj-Mahmoud, Samer 
; edk2-devel@lists.01.org
Cc: El-Haj-Mahmoud, Samer ; Lin, Derek (HPS UEFI 
Dev) ; Yao, Jiewen 
Subject: RE: [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe

Chao
I have question on this patch. I asked in another mail.

If there is no TPM 2.0 part present, this code should not run, by design.

Would you please clarify how you trigger this situation?

Thank you
Yao Jiewen

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Zhang, Chao B
> Sent: Friday, April 29, 2016 10:31 AM
> To: Samer El-Haj-Mahmoud ; 
> edk2-devel@lists.01.org
> Cc: Samer El-Haj-Mahmoud ; Derek Lin 
> 
> Subject: Re: [edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in 
> Tcg2Dxe
> 
> Reviewed-by: Chao Zhang 
> 
> 
> 
> 
> 
> 
> Thanks & Best regards
> Chao Zhang
> 
> 
> -Original Message-
> From: Samer El-Haj-Mahmoud [mailto:samer.el-haj-mahm...@hpe.com]
> Sent: Friday, April 29, 2016 4:47 AM
> To: edk2-devel@lists.01.org
> Cc: Zhang, Chao B; Samer El-Haj-Mahmoud; Samer El-Haj-Mahmoud; Derek 
> Lin
> Subject: [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe
> 
> Reduce several DEBUG messages verbosity from INFO to VERBOSE to reduce 
> debug spam when there is no TPM 2.0 part present
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Samer El-Haj-Mahmoud 
> Signed-off-by: Derek Lin 
> ---
>  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 21 +++--
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> index 07f76af..6555df5 100644
> --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> @@ -2,6 +2,7 @@
>This module implements Tcg2 Protocol.
> 
>  Copyright (c) 2015 - 2016, Intel Corporation. All rights 
> reserved.
> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  This program and the accompanying materials  are licensed and made 
> available under the terms and conditions of the BSD License  which 
> accompanies this distribution.  The full text of the license may be 
> found at @@ -332,14 +333,14 @@ Tcg2GetCapability (
>IN OUT EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability
>)
>  {
> -  DEBUG ((EFI_D_INFO, "Tcg2GetCapability ...\n"));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2GetCapability ...\n"));
> 
>if ((This == NULL) || (ProtocolCapability == NULL)) {
>  return EFI_INVALID_PARAMETER;
>}
> 
> -  DEBUG ((EFI_D_INFO, "Size - 0x%x\n", ProtocolCapability->Size));
> -  DEBUG ((EFI_D_INFO, " 1.1 - 0x%x, 1.0 - 0x%x\n", 
> sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY),
> sizeof(TREE_BOOT_SERVICE_CAPABILITY_1_0)));
> +  DEBUG ((DEBUG_VERBOSE, "Size - 0x%x\n", ProtocolCapability->Size)); 
> + DEBUG ((DEBUG_VERBOSE, " 1.1 - 0x%x, 1.0 - 0x%x\n", 
> + sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY),
> + sizeof(TREE_BOOT_SERVICE_CAPABILITY_1_0)));
> 
>if (ProtocolCapability->Size < mTcgDxeData.BsCap.Size) {
>  //
> @@ -363,7 +364,7 @@ Tcg2GetCapability (
>}
> 
>CopyMem (ProtocolCapability, , 
> mTcgDxeData.BsCap.Size);
> -  DEBUG ((EFI_D_INFO, "Tcg2GetCapability - %r\n", EFI_SUCCESS));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2GetCapability - %r\n", EFI_SUCCESS));
>return EFI_SUCCESS;
>  }
> 
> @@ -1237,7 +1238,7 @@ Tcg2HashLogExtendEvent (
>TCG_PCR_EVENT_HDR  NewEventHdr;
>TPML_DIGEST_VALUES DigestList;
> 
> -  DEBUG ((EFI_D_INFO, "Tcg2HashLogExtendEvent ...\n"));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2HashLogExtendEvent ...\n"));
> 
>if ((This == NULL) || (DataToHash == 0) || (Event == NULL)) {
>  return EFI_INVALID_PARAMETER;
> @@ -1287,7 +1288,7 @@ Tcg2HashLogExtendEvent (
> Event->Event
> );
>}
> -  DEBUG ((EFI_D_INFO, "Tcg2HashLogExtendEvent - %r\n", Status));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2HashLogExtendEvent - %r\n", Status));
>return Status;
>  }
> 
> @@ -2530,10 +2531,10 @@ DriverEntry (
>  mTcgDxeData.BsCap.SupportedEventLogs &= 
> ~EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2;
>}
> 
> -  DEBUG ((EFI_D_INFO, "Tcg2.SupportedEventLogs - 0x%08x\n", 
> mTcgDxeData.BsCap.SupportedEventLogs));
> -  DEBUG ((EFI_D_INFO, "Tcg2.HashAlgorithmBitmap - 0x%08x\n", 
> mTcgDxeData.BsCap.HashAlgorithmBitmap));
> -  DEBUG ((EFI_D_INFO, "Tcg2.NumberOfPCRBanks  - 0x%08x\n",
> mTcgDxeData.BsCap.NumberOfPCRBanks));
> -  DEBUG ((EFI_D_INFO, "Tcg2.ActivePcrBanks   

Re: [edk2] [RFC] MdeModulePkg, ShellPkg: increase TFTP block size

2016-04-29 Thread Marcin Wojtas
Hi Siyuan,

Thanks a lot for thorough explanation. The default 512B won't be
changed then - PCD and extending tftp command seem a good alternative.
We will come back later with more proper solution.

Best regards,
Marcin

2016-04-29 10:40 GMT+02:00 Fu, Siyuan :
> Hi, Marcin
>
> The RFC2348 has a detail discussion about the block size setting in tftp and 
> give the answer: using value of MTU is not the best choice. You may find you 
> still can gain more efficiency by increasing the block size over the path 
> MTU, until the IP fragmentation gives more overhead than the tftp package 
> frame and process.
>
> The default block size (512) of tftp is defined in the RFC1350, that's why 
> the Mtftp driver use 512 as the default macro value. The MTFTP4 prococol does 
> provide the interface to allow the caller to provide a "blksize" option in 
> the MTFTP request, so I prefer to keep the default value to 512 in the Mtftp4 
> driver, to follow RFC's definition. Another driver in edk2 stack which is 
> using the mtftp protocol, like the PXE driver, provides a PCD 
> gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize which allow the users to 
> configure the default block size during PXE mtftp download.
>
> For the shell "tftp" command, I also suggest to add a new argument to let 
> user set the block size, not simply override it with 1468.
>
> Best Regards
> Siyuan
>
>> -Original Message-
>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>> Marcin Wojtas
>> Sent: Friday, April 29, 2016 9:09 AM
>> To: edk2-devel@lists.01.org
>> Cc: ha...@marvell.com; leif.lindh...@linaro.org; n...@marvell.com; Gao,
>> Liming ; Kinney, Michael D
>> 
>> Subject: [edk2] [RFC] MdeModulePkg, ShellPkg: increase TFTP block size
>>
>> From: Bartosz Szczepanek 
>>
>> Hi,
>>
>> When dealing with low network speed during tftp, the analysis showed
>> two issues - UEFI tftp and network stack spend a lot of time (~3.5ms,
>> comparing to U-Boot's ~0.6ms) on preparing ACK packet after receiving
>> data block from host. The network driver itself is using SNP and its
>> time spent on executing SnpTransmit routine is negligible, so it is
>> definitely not a problem.
>>
>> This patch however is only releated to above mentioned problem. It
>> occurred that despite our MTU is set to 1500, each block of data has
>> to be split to 512 chunks, so the very long receive/ack sequence was
>> executed three times more than needed.
>>
>> Below is an example of a solution of increasing TFTP block size
>> to maximum allowed by 1500 MTU. The default block size is changed,
>> as well as this option is negotiatied with host. For sure a situation,
>> when proposed, increased block size is rejected by host (a default
>> fall back to 512 should happen) should be handled properly.
>>
>> Also a dynamic dependency between port's MTU was considered, but there
>> are two problems - how to pass it to Mtftp4 module and way of negotiating
>> size with host - option requires string format. Hence IMO it's better
>> to stick to arbitrary size.
>>
>> I would be very grateful for any comments and ideas, how to handle
>> this issue properly.
>>
>> Best reards,
>> Marcin
>>
>> ---
>>  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h | 2 +-
>>  ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c   | 5 +
>>  2 files changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
>> b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
>> index 527fd1d..9a2d409 100644
>> --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
>> +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
>> @@ -55,7 +55,7 @@ typedef struct _MTFTP4_PROTOCOL
>> MTFTP4_PROTOCOL;
>>  #define MTFTP4_DEFAULT_SERVER_PORT  69
>>  #define MTFTP4_DEFAULT_TIMEOUT  3
>>  #define MTFTP4_DEFAULT_RETRY5
>> -#define MTFTP4_DEFAULT_BLKSIZE  512
>> +#define MTFTP4_DEFAULT_BLKSIZE  1468
>>  #define MTFTP4_TIME_TO_GETMAP   5
>>
>>  #define MTFTP4_STATE_UNCONFIGED 0
>> diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
>> b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
>> index 831b9c3..3e06b67 100644
>> --- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
>> +++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
>> @@ -894,12 +894,17 @@ DownloadFile (
>>TftpContext->DownloadedNbOfBytes   = 0;
>>TftpContext->LastReportedNbOfBytes = 0;
>>
>> +  UINT8 name[] = "blksize";
>> +  UINT8 val[] = "1468";
>> +  EFI_MTFTP4_OPTION Blksize = { name, val };
>>ZeroMem (, sizeof (EFI_MTFTP4_TOKEN));
>>Mtftp4Token.Filename= (UINT8*)AsciiFilePath;
>>Mtftp4Token.BufferSize  = FileSize;
>>Mtftp4Token.Buffer  = Buffer;
>>Mtftp4Token.CheckPacket = CheckPacket;
>>Mtftp4Token.Context = (VOID*)TftpContext;
>> +  Mtftp4Token.OptionCount = 1;
>> +  Mtftp4Token.OptionList = 
>>
>>

Re: [edk2] [RFC] MdeModulePkg, ShellPkg: increase TFTP block size

2016-04-29 Thread Fu, Siyuan
Hi, Marcin

The RFC2348 has a detail discussion about the block size setting in tftp and 
give the answer: using value of MTU is not the best choice. You may find you 
still can gain more efficiency by increasing the block size over the path MTU, 
until the IP fragmentation gives more overhead than the tftp package frame and 
process.

The default block size (512) of tftp is defined in the RFC1350, that's why the 
Mtftp driver use 512 as the default macro value. The MTFTP4 prococol does 
provide the interface to allow the caller to provide a "blksize" option in the 
MTFTP request, so I prefer to keep the default value to 512 in the Mtftp4 
driver, to follow RFC's definition. Another driver in edk2 stack which is using 
the mtftp protocol, like the PXE driver, provides a PCD 
gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize which allow the users to 
configure the default block size during PXE mtftp download.

For the shell "tftp" command, I also suggest to add a new argument to let user 
set the block size, not simply override it with 1468. 

Best Regards
Siyuan

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Marcin Wojtas
> Sent: Friday, April 29, 2016 9:09 AM
> To: edk2-devel@lists.01.org
> Cc: ha...@marvell.com; leif.lindh...@linaro.org; n...@marvell.com; Gao,
> Liming ; Kinney, Michael D
> 
> Subject: [edk2] [RFC] MdeModulePkg, ShellPkg: increase TFTP block size
> 
> From: Bartosz Szczepanek 
> 
> Hi,
> 
> When dealing with low network speed during tftp, the analysis showed
> two issues - UEFI tftp and network stack spend a lot of time (~3.5ms,
> comparing to U-Boot's ~0.6ms) on preparing ACK packet after receiving
> data block from host. The network driver itself is using SNP and its
> time spent on executing SnpTransmit routine is negligible, so it is
> definitely not a problem.
> 
> This patch however is only releated to above mentioned problem. It
> occurred that despite our MTU is set to 1500, each block of data has
> to be split to 512 chunks, so the very long receive/ack sequence was
> executed three times more than needed.
> 
> Below is an example of a solution of increasing TFTP block size
> to maximum allowed by 1500 MTU. The default block size is changed,
> as well as this option is negotiatied with host. For sure a situation,
> when proposed, increased block size is rejected by host (a default
> fall back to 512 should happen) should be handled properly.
> 
> Also a dynamic dependency between port's MTU was considered, but there
> are two problems - how to pass it to Mtftp4 module and way of negotiating
> size with host - option requires string format. Hence IMO it's better
> to stick to arbitrary size.
> 
> I would be very grateful for any comments and ideas, how to handle
> this issue properly.
> 
> Best reards,
> Marcin
> 
> ---
>  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h | 2 +-
>  ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c   | 5 +
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
> b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
> index 527fd1d..9a2d409 100644
> --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
> +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
> @@ -55,7 +55,7 @@ typedef struct _MTFTP4_PROTOCOL
> MTFTP4_PROTOCOL;
>  #define MTFTP4_DEFAULT_SERVER_PORT  69
>  #define MTFTP4_DEFAULT_TIMEOUT  3
>  #define MTFTP4_DEFAULT_RETRY5
> -#define MTFTP4_DEFAULT_BLKSIZE  512
> +#define MTFTP4_DEFAULT_BLKSIZE  1468
>  #define MTFTP4_TIME_TO_GETMAP   5
> 
>  #define MTFTP4_STATE_UNCONFIGED 0
> diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> index 831b9c3..3e06b67 100644
> --- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> +++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> @@ -894,12 +894,17 @@ DownloadFile (
>TftpContext->DownloadedNbOfBytes   = 0;
>TftpContext->LastReportedNbOfBytes = 0;
> 
> +  UINT8 name[] = "blksize";
> +  UINT8 val[] = "1468";
> +  EFI_MTFTP4_OPTION Blksize = { name, val };
>ZeroMem (, sizeof (EFI_MTFTP4_TOKEN));
>Mtftp4Token.Filename= (UINT8*)AsciiFilePath;
>Mtftp4Token.BufferSize  = FileSize;
>Mtftp4Token.Buffer  = Buffer;
>Mtftp4Token.CheckPacket = CheckPacket;
>Mtftp4Token.Context = (VOID*)TftpContext;
> +  Mtftp4Token.OptionCount = 1;
> +  Mtftp4Token.OptionList = 
> 
>ShellPrintHiiEx (
>  -1, -1, NULL, STRING_TOKEN (STR_TFTP_DOWNLOADING),
> --
> 1.8.3.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] MdeModulePkg/DxeCore: set ImageContext Handle and ImageRead() fields

2016-04-29 Thread Ard Biesheuvel
Set the ImageContext.Handle and ImageContext.ImageRead() fields so that
PeCoffLoaderRelocateImageExtraAction() can invoke PeCoffLoaderGetImageInfo
or PeCoffLoaderGetPeHeader if desired to obtain additional metadata.

We will use this to create a PeCoffLoaderRelocateImageExtraAction()
implementation that applies boot time strict mapping permissions to
PE/COFF modules.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c 
b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
index 70a283bc2ba2..c34067e11845 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
+++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
@@ -315,6 +315,8 @@ DxeMain (
   if (Status == EFI_SUCCESS) {
 ImageContext.EntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)EntryPoint;
   }
+  ImageContext.Handle = (VOID *)(UINTN)gDxeCoreLoadedImage->ImageBase;
+  ImageContext.ImageRead  = PeCoffLoaderImageReadFromMemory;
   PeCoffLoaderRelocateImageExtraAction ();
 
   //
-- 
2.7.4

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


Re: [edk2] [PATCH] MdeModulePkg/PciBusDxe: don't create bogus descriptor if no resources needed

2016-04-29 Thread Ard Biesheuvel
On 29 April 2016 at 09:19, Ni, Ruiyu  wrote:
> Ard,
> At first glance of this patch, I immediately checked the PI spec 
> SubResources() description,
> it says when a root bridge doesn't require any resource, "a zero-length 
> resource request
> must explicitly be submitted."
> "zero-length resource" can be interpreted in two ways:
> 1. only END descriptor
> 2. MEM resource with 0-length, plus IO resource with 0-length, plus END 
> descriptor
>
> I believe that both ways should be accepted by PciHostBridge driver.
> But without your patch, the zero descriptor cannot be accepted by 
> PciHostBridge driver.
> I think it fails in the check:
>
> case ACPI_ADDRESS_SPACE_TYPE_MEM /* 0 */:
>   if (Descriptor->AddrSpaceGranularity != 32 && 
> Descriptor->AddrSpaceGranularity != 64) {
> return EFI_INVALID_PARAMETER;
>   }
>

I agree with your analysis. The NULL entry is misidentified as a
ACPI_ADDRESS_SPACE_TYPE_MEM resource descriptor because the constant
is defined as 0

> I agree with your patch.
>
> Reviewed-by: Ruiyu Ni 
>

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


Re: [edk2] [PATCH] MdeModulePkg/PciBusDxe: don't create bogus descriptor if no resources needed

2016-04-29 Thread Ni, Ruiyu
Ard,
At first glance of this patch, I immediately checked the PI spec SubResources() 
description,
it says when a root bridge doesn't require any resource, "a zero-length 
resource request
must explicitly be submitted."
"zero-length resource" can be interpreted in two ways:
1. only END descriptor
2. MEM resource with 0-length, plus IO resource with 0-length, plus END 
descriptor

I believe that both ways should be accepted by PciHostBridge driver.
But without your patch, the zero descriptor cannot be accepted by PciHostBridge 
driver.
I think it fails in the check:

case ACPI_ADDRESS_SPACE_TYPE_MEM /* 0 */:
  if (Descriptor->AddrSpaceGranularity != 32 && 
Descriptor->AddrSpaceGranularity != 64) {
return EFI_INVALID_PARAMETER;
  }

I agree with your patch.

Reviewed-by: Ruiyu Ni 



Regards,
Ray

>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ard 
>Biesheuvel
>Sent: Thursday, April 28, 2016 11:51 PM
>To: edk2-devel@lists.01.org; Tian, Feng ; Zeng, Star 
>
>Cc: leif.lindh...@linaro.org; Ard Biesheuvel 
>Subject: [edk2] [PATCH] MdeModulePkg/PciBusDxe: don't create bogus descriptor 
>if no resources needed
>
>If the current PCI configuration requires no resources to be allocated at
>all (i.e., unpopulated bus), the PCI enumeration code creates a single
>ACPI_ADDRESS_SPACE_DESCRIPTOR memory descriptor with all fields cleared.
>This is rejected by the SubmitResources() implementation of the generic
>PciHostBridgeDxe in the following way:
>
>  PciHostBridge: SubmitResources for PcieRoot(0x0)
>   Mem: Granularity/SpecificFlag = 0 / 00
>Length/Alignment = 0x0 / 0x0
>  PciBus: HostBridge->SubmitResources() - Invalid Parameter
>
>  ASSERT_EFI_ERROR (Status = Invalid Parameter)
>  ASSERT [PciBusDxe] .../PciBusDxe/PciLib.c(561): !EFI_ERROR (Status)
>
>So instead, create the empty configuration as a single entry of type
>EFI_ACPI_END_TAG_DESCRIPTOR.
>
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Ard Biesheuvel 
>---
> MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 7 ++-
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
>diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c 
>b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
>index 597c0834e0f5..469a2ddb8ac0 100644
>--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
>+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
>@@ -1307,15 +1307,12 @@ ConstructAcpiResourceRequestor (
> //
> // If there is no resource request
> //
>-Configuration = AllocateZeroPool (sizeof 
>(EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof
>(EFI_ACPI_END_TAG_DESCRIPTOR));
>+Configuration = AllocateZeroPool (sizeof (EFI_ACPI_END_TAG_DESCRIPTOR));
> if (Configuration == NULL) {
>   return EFI_OUT_OF_RESOURCES;
> }
>
>-Ptr   = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) (Configuration);
>-Ptr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
>-
>-PtrEnd= (EFI_ACPI_END_TAG_DESCRIPTOR *) (Ptr + 1);
>+PtrEnd= (EFI_ACPI_END_TAG_DESCRIPTOR *) (Configuration);
> PtrEnd->Desc  = ACPI_END_TAG_DESCRIPTOR;
> PtrEnd->Checksum  = 0;
>   }
>--
>2.7.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


[edk2] [Patch v4 23/23] OvmfPkg/OvmfPkgIa32X64.dsc: Move PcdShellFile to [PcdsFixedAtBuild.X64]

2016-04-29 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Laszlo Ersek 
---
 OvmfPkg/OvmfPkgIa32X64.dsc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index e5a5e8a..6e04dd6 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -429,11 +429,11 @@ [PcdsFixedAtBuild]
   gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2
 !endif
 
+[PcdsFixedAtBuild.X64]
 !ifndef $(USE_OLD_SHELL)
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 
0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
 !endif
 
-[PcdsFixedAtBuild.X64]
 !if $(SMM_REQUIRE) == TRUE
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout|10
-- 
2.7.0.windows.1

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


[edk2] [Patch v4 21/23] OvmfPkg/PlatformBootManagerLib: Remove unused C structures definitions

2016-04-29 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Reviewed-by: Laszlo Ersek 
---
 .../Library/PlatformBootManagerLib/BdsPlatform.h   | 47 --
 1 file changed, 47 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index 46d14b4..4c379b6 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
@@ -152,56 +152,9 @@ extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode;
 #define PCI_SUBCLASS_SERIAL0x00
 #define PCI_IF_16550   0x02
 #define IS_PCI_16550SERIAL(_p)   IS_CLASS3 (_p, PCI_CLASS_SCC, 
PCI_SUBCLASS_SERIAL, PCI_IF_16550)
-
-#define EFI_SYSTEM_TABLE_MAX_ADDRESS 0x
-#define SYS_TABLE_PAD(ptr) (((~ptr) +1) & 0x07 )
-
 #define IS_PCI_ISA_PDECODE(_p)IS_CLASS3 (_p, PCI_CLASS_BRIDGE, 
PCI_CLASS_BRIDGE_ISA_PDECODE, 0)
 
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   IsaBridge;
-  ACPI_HID_DEVICE_PATH  Keyboard;
-  EFI_DEVICE_PATH_PROTOCOL  End;
-} PLATFORM_DUMMY_ISA_KEYBOARD_DEVICE_PATH;
-
-typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   IsaBridge;
-  ACPI_HID_DEVICE_PATH  IsaSerial;
-  UART_DEVICE_PATH  Uart;
-  VENDOR_DEVICE_PATHTerminalType;
-  EFI_DEVICE_PATH_PROTOCOL  End;
-} PLATFORM_DUMMY_ISA_SERIAL_DEVICE_PATH;
-
-typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   VgaDevice;
-  EFI_DEVICE_PATH_PROTOCOL  End;
-} PLATFORM_DUMMY_PCI_VGA_DEVICE_PATH;
-
-typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   PciBridge;
-  PCI_DEVICE_PATH   SerialDevice;
-  UART_DEVICE_PATH  Uart;
-  VENDOR_DEVICE_PATHTerminalType;
-  EFI_DEVICE_PATH_PROTOCOL  End;
-} PLATFORM_DUMMY_PCI_SERIAL_DEVICE_PATH;
-
-//
-// the short form device path for Usb keyboard
-//
-#define CLASS_HID   3
-#define SUBCLASS_BOOT   1
-#define PROTOCOL_KEYBOARD   1
-
-typedef struct {
-  USB_CLASS_DEVICE_PATH   UsbClass;
-  EFI_DEVICE_PATH_PROTOCOLEnd;
-} USB_CLASS_FORMAT_DEVICE_PATH;
-
-typedef struct {
   EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
   UINTN ConnectType;
 } PLATFORM_CONSOLE_CONNECT_ENTRY;
-- 
2.7.0.windows.1

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


[edk2] [Patch v4 15/23] OvmfPkg/PlatformBootManagerLib: Use EfiBootManagerRefreshAllBootOption()

2016-04-29 Thread Ruiyu Ni
The patch uses EfiBootManagerRefreshAllBootOption() to collect
all boot options and uses SetBootOrderFromQemu exposed by
QemuNewBootOrderLib to adjust the boot option order.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Reviewed-by: Laszlo Ersek 
---
 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 11 +++
 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h |  1 +
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index c49e5a5..1bdf18e 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -14,7 +14,6 @@
 
 #include "BdsPlatform.h"
 #include 
-#include 
 
 
 //
@@ -1364,14 +1363,10 @@ Routine Description:
   // Process QEMU's -kernel command line option
   //
   TryRunningQemuKernel ();
-  BdsLibEnumerateAllBootOption (BootOptionList);
 
-  SetBootOrderFromQemu (BootOptionList);
-  //
-  // The BootOrder variable may have changed, reload the in-memory list with
-  // it.
-  //
-  BdsLibBuildOptionFromVar (BootOptionList, L"BootOrder");
+  EfiBootManagerRefreshAllBootOption ();
+
+  SetBootOrderFromQemu (NULL);
 }
 
 /**
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index b14410c..4950d3a 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
@@ -47,6 +47,7 @@ Abstract:
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
-- 
2.7.0.windows.1

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


[edk2] [Patch v4 22/23] OvmfPkg: Use MdeModulePkg/BDS

2016-04-29 Thread Ruiyu Ni
By default the new MdeModulePkg/BDS is used.
If USE_OLD_BDS is defined to TRUE, IntelFrameworkModulePkg/BDS
is used.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
---
 OvmfPkg/OvmfPkgIa32.dsc| 41 +
 OvmfPkg/OvmfPkgIa32.fdf|  5 +
 OvmfPkg/OvmfPkgIa32X64.dsc | 41 +
 OvmfPkg/OvmfPkgIa32X64.fdf |  5 +
 OvmfPkg/OvmfPkgX64.dsc | 41 +
 OvmfPkg/OvmfPkgX64.fdf |  5 +
 6 files changed, 126 insertions(+), 12 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 0206dda..a945c0a 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -37,6 +37,7 @@ [Defines]
   DEFINE NETWORK_IP6_ENABLE  = FALSE
   DEFINE HTTP_BOOT_ENABLE= FALSE
   DEFINE SMM_REQUIRE = FALSE
+  DEFINE USE_OLD_BDS = FALSE
 
 [BuildOptions]
   GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
@@ -75,7 +76,13 @@ [LibraryClasses]
   
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
   
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+  SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+!if $(USE_OLD_BDS) == TRUE
   GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
+!else
+  
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+!endif
+  FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
   
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
@@ -275,7 +282,13 @@ [LibraryClasses.common.DXE_DRIVER]
   IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
   UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
+!if $(USE_OLD_BDS) == TRUE
   PlatformBdsLib|OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf
+  QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
+!else
+  
PlatformBootManagerLib|OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+  QemuBootOrderLib|OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.inf
+!endif
   
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
 !if $(SMM_REQUIRE) == TRUE
   LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf
@@ -285,8 +298,6 @@ [LibraryClasses.common.DXE_DRIVER]
 !ifdef $(SOURCE_DEBUG_ENABLE)
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
 !endif
-  QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
-  FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
   PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
 
 [LibraryClasses.common.UEFI_APPLICATION]
@@ -294,6 +305,7 @@ [LibraryClasses.common.UEFI_APPLICATION]
   TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
   
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
 !ifdef $(DEBUG_ON_SERIAL_PORT)
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
 !else
@@ -428,6 +440,9 @@ [PcdsFixedAtBuild]
   # IRQs 5, 9, 10, 11 are level-triggered
   gPcAtChipsetPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20
 
+  # Point to the MdeModulePkg/Application/UiApp/UiApp.inf
+  gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 
0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
+
 

 #
 # Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform
@@ -551,13 +566,32 @@ [Components]
   PcAtChipsetPkg/KbcResetDxe/Reset.inf
   MdeModulePkg/Universal/Metronome/Metronome.inf
   PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
+!if $(USE_OLD_BDS) == TRUE
   IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf {
 
+  !ifdef $(CSM_ENABLE)
+  NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
+  !endif
+  }
+!else
+  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
+
 !ifdef $(CSM_ENABLE)
   NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
+  
NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf
 !endif
   }
-
+  MdeModulePkg/Application/UiApp/UiApp.inf {
+
+  NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
+  

[edk2] [Patch v4 16/23] OvmfPkg/PlatformBootManagerLib: Remove PlatformBdsGetDriverOption()

2016-04-29 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Reviewed-by: Laszlo Ersek 
---
 .../Library/PlatformBootManagerLib/BdsPlatform.c   | 30 --
 .../Library/PlatformBootManagerLib/BdsPlatform.h   |  6 -
 2 files changed, 36 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 1bdf18e..804c18d 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1189,31 +1189,6 @@ Returns:
 }
 
 VOID
-PlatformBdsGetDriverOption (
-  IN OUT LIST_ENTRY  *BdsDriverLists
-  )
-/*++
-
-Routine Description:
-
-  Load the predefined driver option, OEM/IBV can customize this
-  to load their own drivers
-
-Arguments:
-
-  BdsDriverLists  - The header of the driver option link list.
-
-Returns:
-
-  None.
-
---*/
-{
-  DEBUG ((EFI_D_INFO, "PlatformBdsGetDriverOption\n"));
-  return;
-}
-
-VOID
 PlatformBdsDiagnostics (
   IN EXTENDMEM_COVERAGE_LEVELMemoryTestLevel,
   IN BOOLEAN QuietBoot,
@@ -1333,11 +1308,6 @@ Routine Description:
   }
 
   //
-  // Load the driver option as the driver option list
-  //
-  PlatformBdsGetDriverOption (DriverOptionList);
-
-  //
   // Get current Boot Mode
   //
   Status = BdsLibGetBootMode ();
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index 4950d3a..5e46300 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
@@ -210,12 +210,6 @@ extern PLATFORM_CONSOLE_CONNECT_ENTRY  gPlatformConsole[];
 //
 // Platform BDS Functions
 //
-
-VOID
-PlatformBdsGetDriverOption (
-  IN LIST_ENTRY   *BdsDriverLists
-  );
-
 EFI_STATUS
 BdsMemoryTest (
   EXTENDMEM_COVERAGE_LEVEL Level
-- 
2.7.0.windows.1

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


[edk2] [Patch v4 20/23] OvmfPkg/PlatformBootManagerLib: Add EnableQuietBoot & DisableQuietBoot

2016-04-29 Thread Ruiyu Ni
EnableQuietBoot and DisableQuietBoot are copied from
IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c.
Because these two functions are not in UefiBootManagerLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
---
 .../Library/PlatformBootManagerLib/BdsPlatform.h   |  32 +
 .../PlatformBootManagerLib.inf |   6 +
 OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c | 671 +
 3 files changed, 709 insertions(+)
 create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index c507bad..46d14b4 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
@@ -26,6 +26,7 @@ Abstract:
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -48,7 +49,11 @@ Abstract:
 #include 
 #include 
 #include 
+#include 
 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -226,4 +231,31 @@ TryRunningQemuKernel (
   VOID
   );
 
+/**
+  Use SystemTable Conout to stop video based Simple Text Out consoles from 
going
+  to the video device. Put up LogoFile on every video device that is a console.
+
+  @param[in]  LogoFile   File name of logo to display on the center of the 
screen.
+
+  @retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo 
displayed.
+  @retval EFI_UNSUPPORTED Logo not found
+
+**/
+EFI_STATUS
+EnableQuietBoot (
+  IN  EFI_GUID  *LogoFile
+  );
+
+/**
+  Use SystemTable Conout to turn on video based Simple Text Out consoles. The
+  Simple Text Out screens will now be synced up with all non video output 
devices
+
+  @retval EFI_SUCCESS UGA devices are back in text mode and synced up.
+
+**/
+EFI_STATUS
+DisableQuietBoot (
+  VOID
+  );
+
 #endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 5f6421d..34c43e2 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -30,6 +30,7 @@ [Sources]
   BdsPlatform.c
   PlatformData.c
   QemuKernel.c
+  QuietBoot.c
   BdsPlatform.h
 
 [Packages]
@@ -62,6 +63,10 @@ [Pcd]
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile
 
+[FeaturePcd]
+  gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport   ## CONSUMES
+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBootlogoOnlyEnable ## CONSUMES
+
 [Pcd.IA32, Pcd.X64]
   gEfiMdePkgTokenSpaceGuid.PcdFSBClock
 
@@ -70,6 +75,7 @@ [Protocols]
   gEfiPciRootBridgeIoProtocolGuid
   gEfiS3SaveStateProtocolGuid   # PROTOCOL SOMETIMES_CONSUMED
   gEfiDxeSmmReadyToLockProtocolGuid # PROTOCOL SOMETIMES_PRODUCED
+  gEfiOEMBadgingProtocolGuid# PROTOCOL SOMETIMES_PRODUCED
   gEfiLoadedImageProtocolGuid   # PROTOCOL SOMETIMES_PRODUCED
 
 [Guids]
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c 
b/OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c
new file mode 100644
index 000..dd475ad
--- /dev/null
+++ b/OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c
@@ -0,0 +1,671 @@
+/** @file
+  Platform BDS function for quiet boot support.
+
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD 
License
+which accompanies this distribution.  The full text of the license may be 
found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "BdsPlatform.h"
+
+/**
+  Convert a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
+  is passed in a GopBlt buffer will be allocated by this routine. If a GopBlt
+  buffer is passed in it will be used if it is big enough.
+
+  @param  BmpImage  Pointer to BMP file
+  @param  BmpImageSize  Number of bytes in BmpImage
+  @param  GopBltBuffer containing GOP version of BmpImage.
+  @param  GopBltSizeSize of GopBlt in bytes.
+  @param  PixelHeight   Height of GopBlt/BmpImage in pixels
+  @param  PixelWidthWidth of GopBlt/BmpImage in pixels
+
+  @retval EFI_SUCCESS   GopBlt and GopBltSize are returned.
+  @retval EFI_UNSUPPORTED   BmpImage is not a valid *.BMP image
+  @retval EFI_BUFFER_TOO_SMALL  The passed in GopBlt buffer is not big enough.
+GopBltSize will contain the required size.
+  @retval EFI_OUT_OF_RESOURCES  No enough buffer to 

[edk2] [Patch v4 18/23] OvmfPkg/PlatformBootManagerLib: Remove unnecessary memory test

2016-04-29 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Reviewed-by: Laszlo Ersek 
---
 .../Library/PlatformBootManagerLib/BdsPlatform.c   | 60 +-
 .../Library/PlatformBootManagerLib/BdsPlatform.h   |  5 --
 2 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index ec749aa..b9ddfde 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1188,62 +1188,6 @@ Returns:
   gST->ConOut->ClearScreen (gST->ConOut);
 }
 
-VOID
-PlatformBdsDiagnostics (
-  IN EXTENDMEM_COVERAGE_LEVELMemoryTestLevel,
-  IN BOOLEAN QuietBoot,
-  IN BASEM_MEMORY_TEST   BaseMemoryTest
-  )
-/*++
-
-Routine Description:
-
-  Perform the platform diagnostic, such like test memory. OEM/IBV also
-  can customize this fuction to support specific platform diagnostic.
-
-Arguments:
-
-  MemoryTestLevel  - The memory test intensive level
-
-  QuietBoot- Indicate if need to enable the quiet boot
-
-  BaseMemoryTest   - A pointer to BaseMemoryTest()
-
-Returns:
-
-  None.
-
---*/
-{
-  EFI_STATUS  Status;
-
-  DEBUG ((EFI_D_INFO, "PlatformBdsDiagnostics\n"));
-
-  //
-  // Here we can decide if we need to show
-  // the diagnostics screen
-  // Notes: this quiet boot code should be remove
-  // from the graphic lib
-  //
-  if (QuietBoot) {
-EnableQuietBoot (PcdGetPtr(PcdLogoFile));
-//
-// Perform system diagnostic
-//
-Status = BaseMemoryTest (MemoryTestLevel);
-if (EFI_ERROR (Status)) {
-  DisableQuietBoot ();
-}
-
-return ;
-  }
-  //
-  // Perform system diagnostic
-  //
-  Status = BaseMemoryTest (MemoryTestLevel);
-}
-
-
 /**
   Save the S3 boot script.
 
@@ -1319,9 +1263,9 @@ Routine Description:
   ASSERT (BootMode == BOOT_WITH_FULL_CONFIGURATION);
 
   //
-  // Memory test and Logo show
+  // Logo show
   //
-  PlatformBdsDiagnostics (IGNORE, TRUE, BaseMemoryTest);
+  EnableQuietBoot (PcdGetPtr (PcdLogoFile));
 
   //
   // Perform some platform specific connect sequence
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index 5e46300..44b7c0d 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
@@ -211,11 +211,6 @@ extern PLATFORM_CONSOLE_CONNECT_ENTRY  gPlatformConsole[];
 // Platform BDS Functions
 //
 EFI_STATUS
-BdsMemoryTest (
-  EXTENDMEM_COVERAGE_LEVEL Level
-  );
-
-EFI_STATUS
 PlatformBdsShowProgress (
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
-- 
2.7.0.windows.1

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


[edk2] [Patch v4 19/23] OvmfPkg/PlatformBootManagerLib: Remove unused vars and func prototypes

2016-04-29 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
---
 .../Library/PlatformBootManagerLib/BdsPlatform.h   | 42 --
 .../Library/PlatformBootManagerLib/PlatformData.c  | 12 +--
 2 files changed, 1 insertion(+), 53 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index 44b7c0d..c507bad 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
@@ -68,7 +68,6 @@ Abstract:
 #include 
 
 extern EFI_DEVICE_PATH_PROTOCOL   *gPlatformConnectSequence[];
-extern EFI_DEVICE_PATH_PROTOCOL   *gPlatformDriverOption[];
 extern ACPI_HID_DEVICE_PATH   gPnpPs2KeyboardDeviceNode;
 extern ACPI_HID_DEVICE_PATH   gPnp16550ComPortDeviceNode;
 extern UART_DEVICE_PATH   gUartDeviceNode;
@@ -210,53 +209,12 @@ extern PLATFORM_CONSOLE_CONNECT_ENTRY  gPlatformConsole[];
 //
 // Platform BDS Functions
 //
-EFI_STATUS
-PlatformBdsShowProgress (
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
-  CHAR16*Title,
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
-  UINTN Progress,
-  UINTN PreviousValue
-  );
-
-VOID
-PlatformBdsConnectSequence (
-  VOID
-  );
-
-EFI_STATUS
-ProcessCapsules (
-  EFI_BOOT_MODE BootMode
-  );
 
 VOID
 PlatformInitializeConsole (
   IN PLATFORM_CONSOLE_CONNECT_ENTRY   *PlatformConsole
   );
 
-EFI_STATUS
-ConvertMpsTable (
-  IN OUT  VOID **Table
-  );
-
-EFI_STATUS
-ConvertSmbiosTable (
-  IN OUT VOID   **Table
-  );
-
-EFI_STATUS
-ConvertAcpiTable (
- IN  UINTN  TableLen,
- IN OUT  VOID   **Table
-  );
-
-EFI_STATUS
-ConvertSystemTable (
- IN EFI_GUID   *TableGuid,
- IN OUT VOID   **Table
-  );
-
 /**
   Loads and boots UEFI Linux via the FwCfg interface.
 
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c 
b/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
index 4f8cdf7..e9737a7 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
@@ -2,7 +2,7 @@
   Defined the platform specific device path which will be used by
   platform Bbd to perform the platform policy connect.
 
-  Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.
+  Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -15,11 +15,6 @@
 
 #include "BdsPlatform.h"
 
-//
-// Predefined platform default time out value
-//
-UINT16  gPlatformBootTimeOutDefault = 5;
-
 ACPI_HID_DEVICE_PATH   gPnpPs2KeyboardDeviceNode  = gPnpPs2Keyboard;
 ACPI_HID_DEVICE_PATH   gPnp16550ComPortDeviceNode = gPnp16550ComPort;
 UART_DEVICE_PATH   gUartDeviceNode= gUart;
@@ -40,11 +35,6 @@ PLATFORM_CONSOLE_CONNECT_ENTRY   gPlatformConsole[] = {
 };
 
 //
-// Predefined platform specific driver option
-//
-EFI_DEVICE_PATH_PROTOCOL*gPlatformDriverOption[] = { NULL };
-
-//
 // Predefined platform connect sequence
 //
 EFI_DEVICE_PATH_PROTOCOL*gPlatformConnectSequence[] = { 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 v4 17/23] OvmfPkg/PlatformBootManagerLib: Use GetBootModeHob() in HobLib

2016-04-29 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Reviewed-by: Laszlo Ersek 
---
 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 804c18d..ec749aa 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1291,7 +1291,6 @@ Routine Description:
 
 --*/
 {
-  EFI_STATUS Status;
   EFI_BOOT_MODE  BootMode;
 
   DEBUG ((EFI_D_INFO, "PlatformBootManagerAfterConsole\n"));
@@ -1310,7 +1309,7 @@ Routine Description:
   //
   // Get current Boot Mode
   //
-  Status = BdsLibGetBootMode ();
+  BootMode = GetBootModeHob ();
   DEBUG ((EFI_D_ERROR, "Boot Mode:%x\n", BootMode));
 
   //
-- 
2.7.0.windows.1

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


[edk2] [Patch v4 10/23] OvmfPkg/PlatformBootManagerLib: Init console vars in *BeforeConsole()

2016-04-29 Thread Ruiyu Ni
The major difference between IntelFrameworkModulePkg/BDS and
MdeModulePkg/BDS is the latter connects the consoles in core
code while the former connects in platform code.
The change initializes the console variables in
PlatformBootManagerBeforeConsole() and removes the console
connection code.
It also removes unused functions: PlatformBdsNoConsoleAction()
and LockKeyboards().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
---
 .../Library/PlatformBootManagerLib/BdsPlatform.c   | 97 ++
 .../Library/PlatformBootManagerLib/BdsPlatform.h   | 31 +++
 .../Library/PlatformBootManagerLib/PlatformData.c  |  2 +-
 3 files changed, 21 insertions(+), 109 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 5c053ce..cae2192 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -164,6 +164,8 @@ Returns:
   , EFI_NATIVE_INTERFACE,
   NULL);
   ASSERT_EFI_ERROR (Status);
+
+  PlatformInitializeConsole (gPlatformConsole);
 }
 
 
@@ -669,9 +671,9 @@ DetectAndPreparePlatformPciDevicePaths (
 }
 
 
-EFI_STATUS
-PlatformBdsConnectConsole (
-  IN BDS_CONSOLE_CONNECT_ENTRY   *PlatformConsole
+VOID
+PlatformInitializeConsole (
+  IN PLATFORM_CONSOLE_CONNECT_ENTRY   *PlatformConsole
   )
 /*++
 
@@ -683,37 +685,17 @@ Routine Description:
 Arguments:
 
   PlatformConsole - Predfined platform default console device array.
-
-Returns:
-
-  EFI_SUCCESS - Success connect at least one ConIn and ConOut
-device, there must have one ConOut device is
-active vga device.
-
-  EFI_STATUS  - Return the status of
-BdsLibConnectAllDefaultConsoles ()
-
 --*/
 {
-  EFI_STATUS Status;
   UINTN  Index;
   EFI_DEVICE_PATH_PROTOCOL   *VarConout;
   EFI_DEVICE_PATH_PROTOCOL   *VarConin;
-  UINTN  DevicePathSize;
 
   //
   // Connect RootBridge
   //
-  VarConout = BdsLibGetVariableAndSize (
-VarConsoleOut,
-,
-
-);
-  VarConin = BdsLibGetVariableAndSize (
-   VarConsoleInp,
-   ,
-   
-   );
+  GetEfiGlobalVariable2 (EFI_CON_OUT_VARIABLE_NAME, (VOID **) , 
NULL);
+  GetEfiGlobalVariable2 (EFI_CON_IN_VARIABLE_NAME, (VOID **) , NULL);
 
   if (VarConout == NULL || VarConin == NULL) {
 //
@@ -746,16 +728,6 @@ Returns:
 //
 DetectAndPreparePlatformPciDevicePaths (TRUE);
   }
-
-  //
-  // Connect the all the default console with current cosole variable
-  //
-  Status = BdsLibConnectAllDefaultConsoles ();
-  if (EFI_ERROR (Status)) {
-return Status;
-  }
-
-  return EFI_SUCCESS;
 }
 
 
@@ -1294,16 +1266,6 @@ Routine Description:
   // Notes: this part code can be change with the table policy
   //
   ASSERT (BootMode == BOOT_WITH_FULL_CONFIGURATION);
-  //
-  // Connect platform console
-  //
-  Status = PlatformBdsConnectConsole (gPlatformConsole);
-  if (EFI_ERROR (Status)) {
-//
-// Here OEM/IBV can customize with defined action
-//
-PlatformBdsNoConsoleAction ();
-  }
 
   //
   // Memory test and Logo show
@@ -1417,31 +1379,6 @@ Returns:
   }
 }
 
-EFI_STATUS
-PlatformBdsNoConsoleAction (
-  VOID
-  )
-/*++
-
-Routine Description:
-
-  This function is remained for IBV/OEM to do some platform action,
-  if there no console device can be connected.
-
-Arguments:
-
-  None.
-
-Returns:
-
-  EFI_SUCCESS  - Direct return success now.
-
---*/
-{
-  DEBUG ((EFI_D_INFO, "PlatformBdsNoConsoleAction\n"));
-  return EFI_SUCCESS;
-}
-
 VOID
 EFIAPI
 PlatformBdsLockNonUpdatableFlash (
@@ -1566,23 +1503,3 @@ PlatformBootManagerWaitCallback (
 {
 }
 
-/**
-  Lock the ConsoleIn device in system table. All key
-  presses will be ignored until the Password is typed in. The only way to
-  disable the password is to type it in to a ConIn device.
-
-  @param  PasswordPassword used to lock ConIn device.
-
-  @retval EFI_SUCCESS lock the Console In Spliter virtual handle 
successfully.
-  @retval EFI_UNSUPPORTED Password not found
-
-**/
-EFI_STATUS
-EFIAPI
-LockKeyboards (
-  IN  CHAR16*Password
-  )
-{
-return EFI_UNSUPPORTED;
-}
-
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index 922744f..6ea61ee 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
@@ -65,22 +65,12 @@ Abstract:
 
 #include 
 
-extern BDS_CONSOLE_CONNECT_ENTRY  gPlatformConsole[];
 extern EFI_DEVICE_PATH_PROTOCOL   

[edk2] [Patch v4 05/23] OvmfPkg: Duplicate PlatformBdsLib to PlatformBootManagerLib

2016-04-29 Thread Ruiyu Ni
It will be changed to build with MdeModulePkg/BDS.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
---
 .../{PlatformBdsLib => PlatformBootManagerLib}/BdsPlatform.c| 0
 .../{PlatformBdsLib => PlatformBootManagerLib}/BdsPlatform.h| 6 +++---
 .../{PlatformBdsLib => PlatformBootManagerLib}/PlatformBdsLib.inf   | 6 +++---
 .../{PlatformBdsLib => PlatformBootManagerLib}/PlatformData.c   | 0
 .../Library/{PlatformBdsLib => PlatformBootManagerLib}/QemuKernel.c | 0
 5 files changed, 6 insertions(+), 6 deletions(-)
 copy OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/BdsPlatform.c 
(100%)
 copy OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/BdsPlatform.h 
(95%)
 copy OvmfPkg/Library/{PlatformBdsLib => 
PlatformBootManagerLib}/PlatformBdsLib.inf (89%)
 copy OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/PlatformData.c 
(100%)
 copy OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/QemuKernel.c 
(100%)

diff --git a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
similarity index 100%
copy from OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
copy to OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
diff --git a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
similarity index 95%
copy from OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h
copy to OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index 6ba0d48..d6ff316 100644
--- a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
@@ -204,7 +204,7 @@ typedef struct {
 typedef struct {
   USB_CLASS_DEVICE_PATH   UsbClass;
   EFI_DEVICE_PATH_PROTOCOLEnd;
-} USB_CLASS_FORMAT_DEVICE_PATH;  
+} USB_CLASS_FORMAT_DEVICE_PATH;
 
 //
 // Platform BDS Functions
@@ -254,12 +254,12 @@ EFI_STATUS
 ConvertMpsTable (
   IN OUT  VOID **Table
   );
-  
+
 EFI_STATUS
 ConvertSmbiosTable (
   IN OUT VOID   **Table
   );
-  
+
 EFI_STATUS
 ConvertAcpiTable (
  IN  UINTN  TableLen,
diff --git a/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf 
b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBdsLib.inf
similarity index 89%
copy from OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf
copy to OvmfPkg/Library/PlatformBootManagerLib/PlatformBdsLib.inf
index 6a04b45..239d50f 100644
--- a/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBdsLib.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Platform BDS customizations library.
 #
-#  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
+#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
 #  which accompanies this distribution.  The full text of the license may be 
found at
@@ -9,13 +9,13 @@
 #
 #  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
-#  
+#
 ##
 
 [Defines]
   INF_VERSION= 0x00010005
   BASE_NAME  = PlatformBdsLib
-  FILE_GUID  = F844172E-9985-44f2-BADE-0DD783462E95
+  FILE_GUID  = FB65006C-AC9F-4992-AD80-184B2BDBBD83
   MODULE_TYPE= DXE_DRIVER
   VERSION_STRING = 1.0
   LIBRARY_CLASS  = PlatformBdsLib|DXE_DRIVER
diff --git a/OvmfPkg/Library/PlatformBdsLib/PlatformData.c 
b/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
similarity index 100%
copy from OvmfPkg/Library/PlatformBdsLib/PlatformData.c
copy to OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
diff --git a/OvmfPkg/Library/PlatformBdsLib/QemuKernel.c 
b/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c
similarity index 100%
copy from OvmfPkg/Library/PlatformBdsLib/QemuKernel.c
copy to OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c
-- 
2.7.0.windows.1

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


[edk2] [Patch v4 12/23] OvmfPkg/PlatformBootManagerLib: Register boot options and hot keys

2016-04-29 Thread Ruiyu Ni
The patch registers "Enter" key as the continue key (hot key to skip
the boot timeout wait), maps "F2" key to UI, and registers Shell
boot option.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
---
 .../Library/PlatformBootManagerLib/BdsPlatform.c   | 86 +-
 .../Library/PlatformBootManagerLib/BdsPlatform.h   |  1 +
 .../PlatformBootManagerLib.inf |  2 +
 3 files changed, 87 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 3432e02..d9e5d94 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -88,6 +88,63 @@ InstallDevicePathCallback (
   VOID
   );
 
+VOID
+PlatformRegisterFvBootOption (
+  EFI_GUID *FileGuid,
+  CHAR16   *Description,
+  UINT32   Attributes
+  )
+{
+  EFI_STATUSStatus;
+  UINTN OptionIndex;
+  EFI_BOOT_MANAGER_LOAD_OPTION  NewOption;
+  EFI_BOOT_MANAGER_LOAD_OPTION  *BootOptions;
+  UINTN BootOptionCount;
+  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;
+  EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
+
+  Status = gBS->HandleProtocol (
+  gImageHandle,
+  ,
+  (VOID **) 
+  );
+  ASSERT_EFI_ERROR (Status);
+
+  EfiInitializeFwVolDevicepathNode (, FileGuid);
+  DevicePath = AppendDevicePathNode (
+ DevicePathFromHandle (LoadedImage->DeviceHandle),
+ (EFI_DEVICE_PATH_PROTOCOL *) 
+ );
+
+  Status = EfiBootManagerInitializeLoadOption (
+ ,
+ LoadOptionNumberUnassigned,
+ LoadOptionTypeBoot,
+ Attributes,
+ Description,
+ DevicePath,
+ NULL,
+ 0
+ );
+  if (!EFI_ERROR (Status)) {
+BootOptions = EfiBootManagerGetLoadOptions (
+, LoadOptionTypeBoot
+);
+
+OptionIndex = EfiBootManagerFindLoadOption (
+, BootOptions, BootOptionCount
+);
+
+if (OptionIndex == -1) {
+  Status = EfiBootManagerAddLoadOptionVariable (, (UINTN) -1);
+  ASSERT_EFI_ERROR (Status);
+}
+EfiBootManagerFreeLoadOption ();
+EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
+  }
+}
+
 EFI_STATUS
 EFIAPI
 ConnectRootBridge (
@@ -125,8 +182,11 @@ Returns:
 
 --*/
 {
-  EFI_HANDLE Handle;
-  EFI_STATUS Status;
+  EFI_HANDLE   Handle;
+  EFI_STATUS   Status;
+  EFI_INPUT_KEYEnter;
+  EFI_INPUT_KEYF2;
+  EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
 
   DEBUG ((EFI_D_INFO, "PlatformBootManagerBeforeConsole\n"));
   InstallDevicePathCallback ();
@@ -167,6 +227,28 @@ Returns:
 
   PlatformInitializeConsole (gPlatformConsole);
   PcdSet16 (PcdPlatformBootTimeOut, GetFrontPageTimeoutFromQemu ());
+
+  //
+  // Register ENTER as CONTINUE key
+  //
+  Enter.ScanCode= SCAN_NULL;
+  Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;
+  EfiBootManagerRegisterContinueKeyOption (0, , NULL);
+  //
+  // Map F2 to Boot Manager Menu
+  //
+  F2.ScanCode= SCAN_F2;
+  F2.UnicodeChar = CHAR_NULL;
+  EfiBootManagerGetBootManagerMenu ();
+  EfiBootManagerAddKeyOptionVariable (
+NULL, (UINT16) BootOption.OptionNumber, 0, , NULL
+);
+  //
+  // Register UEFI Shell
+  //
+  PlatformRegisterFvBootOption (
+PcdGetPtr (PcdShellFile), L"UEFI Shell", LOAD_OPTION_ACTIVE
+);
 }
 
 
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index 8e11d44..b14410c 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
@@ -55,6 +55,7 @@ Abstract:
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 76ebba2..5f6421d 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -60,6 +60,7 @@ [Pcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile
 
 [Pcd.IA32, Pcd.X64]
   gEfiMdePkgTokenSpaceGuid.PcdFSBClock
@@ -69,6 +70,7 @@ [Protocols]
   gEfiPciRootBridgeIoProtocolGuid
   gEfiS3SaveStateProtocolGuid   # PROTOCOL 

[edk2] [Patch v4 11/23] OvmfPkg/PlatformBootManagerLib: Do not launch Boot Manager Menu

2016-04-29 Thread Ruiyu Ni
MdeModulePkg/BDS doesn't launch UI (Boot Manager Menu) from platform
side.
The change removes the code which launches the UI but still set the
boot timeout.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Reviewed-by: Laszlo Ersek 
---
 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c  | 3 +--
 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h  | 6 --
 OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 +
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index cae2192..3432e02 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -166,6 +166,7 @@ Returns:
   ASSERT_EFI_ERROR (Status);
 
   PlatformInitializeConsole (gPlatformConsole);
+  PcdSet16 (PcdPlatformBootTimeOut, GetFrontPageTimeoutFromQemu ());
 }
 
 
@@ -1292,8 +1293,6 @@ Routine Description:
   // it.
   //
   BdsLibBuildOptionFromVar (BootOptionList, L"BootOrder");
-
-  PlatformBdsEnterFrontPage (GetFrontPageTimeoutFromQemu(), TRUE);
 }
 
 VOID
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index 6ea61ee..8e11d44 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
@@ -266,12 +266,6 @@ ConvertSystemTable (
  IN OUT VOID   **Table
   );
 
-VOID
-PlatformBdsEnterFrontPage (
-  IN UINT16 TimeoutDefault,
-  IN BOOLEANConnectAllHappened
-  );
-
 /**
   Loads and boots UEFI Linux via the FwCfg interface.
 
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 15f9c73..76ebba2 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -59,6 +59,7 @@ [Pcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
+  gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
 
 [Pcd.IA32, Pcd.X64]
   gEfiMdePkgTokenSpaceGuid.PcdFSBClock
-- 
2.7.0.windows.1

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


[edk2] [Patch v4 04/23] OvmfPkg/QemuNewBootOrderLib: Build with UefiBootManagerLib

2016-04-29 Thread Ruiyu Ni
NOTE: SetBootOrderFromQemu() interface is not changed.
But when the old IntelFrameworkModulePkg/BDS is no longer used in
OVMF and ArmVirtPkg, additional patch will be submitted to change
this interface to remove parameter BootOptionList.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
---
 .../Library/QemuNewBootOrderLib/QemuBootOrderLib.c | 139 -
 .../QemuNewBootOrderLib/QemuBootOrderLib.inf   |   4 +-
 2 files changed, 83 insertions(+), 60 deletions(-)

diff --git a/OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.c 
b/OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.c
index 15065b7..45123e9 100644
--- a/OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.c
+++ b/OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.c
@@ -2,7 +2,7 @@
   Rewrite the BootOrder NvVar based on QEMU's "bootorder" fw_cfg file.
 
   Copyright (C) 2012 - 2014, Red Hat, Inc.
-  Copyright (c) 2013, Intel Corporation. All rights reserved.
+  Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.
 
   This program and the accompanying materials are licensed and made available
   under the terms and conditions of the BSD License which accompanies this
@@ -16,7 +16,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -253,8 +253,10 @@ typedef struct {
   LOAD_OPTION_ACTIVE attribute.
 **/
 typedef struct {
-  CONST BDS_COMMON_OPTION *BootOption; // reference only, no ownership
-  BOOLEAN Appended;// has been added to a BOOT_ORDER?
+  CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOption; // reference only, no
+  //   ownership
+  BOOLEANAppended;// has been added to a
+  //   BOOT_ORDER?
 } ACTIVE_OPTION;
 
 
@@ -300,7 +302,7 @@ BootOrderAppend (
   }
 
   BootOrder->Data[BootOrder->Produced++] =
- ActiveOption->BootOption->BootCurrent;
+   (UINT16) ActiveOption->BootOption->OptionNumber;
   ActiveOption->Appended = TRUE;
   return RETURN_SUCCESS;
 }
@@ -308,22 +310,25 @@ BootOrderAppend (
 
 /**
 
-  Create an array of ACTIVE_OPTION elements for a boot option list.
+  Create an array of ACTIVE_OPTION elements for a boot option array.
 
-  @param[in]  BootOptionList  A boot option list, created with
-  BdsLibEnumerateAllBootOption().
+  @param[in]  BootOptions  A boot option array, created with
+   EfiBootManagerRefreshAllBootOptions () and
+   EfiBootManagerGetLoadOptions ().
 
-  @param[out] ActiveOptionPointer to the first element in the new array.
-  The caller is responsible for freeing the array
-  with FreePool() after use.
+  @param[in]  BootOptionCount  The number of elements in BootOptions.
 
-  @param[out] Count   Number of elements in the new array.
+  @param[out] ActiveOption Pointer to the first element in the new array.
+   The caller is responsible for freeing the array
+   with FreePool() after use.
+
+  @param[out] CountNumber of elements in the new array.
 
 
   @retval RETURN_SUCCESS   The ActiveOption array has been created.
 
   @retval RETURN_NOT_FOUND No active entry has been found in
-   BootOptionList.
+   BootOptions.
 
   @retval RETURN_OUT_OF_RESOURCES  Memory allocation failed.
 
@@ -331,11 +336,13 @@ BootOrderAppend (
 STATIC
 RETURN_STATUS
 CollectActiveOptions (
-  IN   CONST LIST_ENTRY *BootOptionList,
-  OUT  ACTIVE_OPTION**ActiveOption,
-  OUT  UINTN*Count
+  IN   CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions,
+  IN   UINTN  BootOptionCount,
+  OUT  ACTIVE_OPTION  **ActiveOption,
+  OUT  UINTN  *Count
   )
 {
+  UINTN Index;
   UINTN ScanMode;
 
   *ActiveOption = NULL;
@@ -346,22 +353,15 @@ CollectActiveOptions (
   // - store links to active entries.
   //
   for (ScanMode = 0; ScanMode < 2; ++ScanMode) {
-CONST LIST_ENTRY *Link;
-
-Link = BootOptionList->ForwardLink;
 *Count = 0;
-while (Link != BootOptionList) {
-  CONST BDS_COMMON_OPTION *Current;
-
-  Current = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
-  if (IS_LOAD_OPTION_TYPE (Current->Attribute, LOAD_OPTION_ACTIVE)) {
+for (Index = 0; Index < BootOptionCount; Index++) {
+  if ((BootOptions[Index].Attributes & LOAD_OPTION_ACTIVE) != 0) {
 if (ScanMode == 1) {
-  (*ActiveOption)[*Count].BootOption = Current;
+  

[edk2] [Patch v4 03/23] OvmfPkg: Duplicate QemuBootOrderLib to QemuNewBootOrderLib

2016-04-29 Thread Ruiyu Ni
QemuNewBootOrderLib will be changed to work with MdeModulePkg/BDS.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
---
 .../{QemuBootOrderLib => QemuNewBootOrderLib}/ExtraRootBusMap.c | 0
 .../{QemuBootOrderLib => QemuNewBootOrderLib}/ExtraRootBusMap.h | 0
 .../{QemuBootOrderLib => QemuNewBootOrderLib}/QemuBootOrderLib.c| 0
 .../{QemuBootOrderLib => QemuNewBootOrderLib}/QemuBootOrderLib.inf  | 6 +++---
 4 files changed, 3 insertions(+), 3 deletions(-)
 copy OvmfPkg/Library/{QemuBootOrderLib => 
QemuNewBootOrderLib}/ExtraRootBusMap.c (100%)
 copy OvmfPkg/Library/{QemuBootOrderLib => 
QemuNewBootOrderLib}/ExtraRootBusMap.h (100%)
 copy OvmfPkg/Library/{QemuBootOrderLib => 
QemuNewBootOrderLib}/QemuBootOrderLib.c (100%)
 copy OvmfPkg/Library/{QemuBootOrderLib => 
QemuNewBootOrderLib}/QemuBootOrderLib.inf (86%)

diff --git a/OvmfPkg/Library/QemuBootOrderLib/ExtraRootBusMap.c 
b/OvmfPkg/Library/QemuNewBootOrderLib/ExtraRootBusMap.c
similarity index 100%
copy from OvmfPkg/Library/QemuBootOrderLib/ExtraRootBusMap.c
copy to OvmfPkg/Library/QemuNewBootOrderLib/ExtraRootBusMap.c
diff --git a/OvmfPkg/Library/QemuBootOrderLib/ExtraRootBusMap.h 
b/OvmfPkg/Library/QemuNewBootOrderLib/ExtraRootBusMap.h
similarity index 100%
copy from OvmfPkg/Library/QemuBootOrderLib/ExtraRootBusMap.h
copy to OvmfPkg/Library/QemuNewBootOrderLib/ExtraRootBusMap.h
diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c 
b/OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.c
similarity index 100%
copy from OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
copy to OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.c
diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf 
b/OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.inf
similarity index 86%
copy from OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
copy to OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.inf
index 1024328..9374a61 100644
--- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
+++ b/OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.inf
@@ -2,7 +2,7 @@
 #  Rewrite the BootOrder NvVar based on QEMU's "bootorder" fw_cfg file.
 #
 #  Copyright (C) 2012 - 2014, Red Hat, Inc.
-#  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
+#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
 #
 #  This program and the accompanying materials are licensed and made available
 #  under the terms and conditions of the BSD License which accompanies this
@@ -17,8 +17,8 @@
 
 [Defines]
   INF_VERSION= 0x00010005
-  BASE_NAME  = QemuBootOrderLib
-  FILE_GUID  = 4FFFA9E1-103D-4CF2-9C06-563BDD03050E
+  BASE_NAME  = QemuNewBootOrderLib
+  FILE_GUID  = 1D677A58-C753-4AF1-B552-EFE142DF8F57
   MODULE_TYPE= DXE_DRIVER
   VERSION_STRING = 1.0
   LIBRARY_CLASS  = QemuBootOrderLib|DXE_DRIVER
-- 
2.7.0.windows.1

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


[edk2] [Patch v4 14/23] OvmfPkg/PlatformBootManagerLib: port PlatformBdsConnectSequence to UefiBootManagerLib

2016-04-29 Thread Ruiyu Ni
The patch changes PlatformBdsConnectSequence() to use library API
exposed from UefiBootManagerLib and removes the additional
connect ALL action.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Reviewed-by: Laszlo Ersek 
---
 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 6221402..c49e5a5 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1135,7 +1135,6 @@ PlatformBdsRestoreNvVarsFromHardDisk (
 
 }
 
-
 VOID
 PlatformBdsConnectSequence (
   VOID
@@ -1172,14 +1171,15 @@ Returns:
 //
 // Build the platform boot option
 //
-BdsLibConnectDevicePath (gPlatformConnectSequence[Index]);
+EfiBootManagerConnectDevicePath (gPlatformConnectSequence[Index], NULL);
 Index++;
   }
 
   //
   // Just use the simple policy to connect all devices
   //
-  BdsLibConnectAll ();
+  DEBUG ((EFI_D_INFO, "EfiBootManagerConnectAll\n"));
+  EfiBootManagerConnectAll ();
 
   PciAcpiInitialization ();
 
@@ -1364,9 +1364,6 @@ Routine Description:
   // Process QEMU's -kernel command line option
   //
   TryRunningQemuKernel ();
-
-  DEBUG ((EFI_D_INFO, "BdsLibConnectAll\n"));
-  BdsLibConnectAll ();
   BdsLibEnumerateAllBootOption (BootOptionList);
 
   SetBootOrderFromQemu (BootOptionList);
-- 
2.7.0.windows.1

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


[edk2] [Patch v4 09/23] OvmfPkg/PlatformBootManagerLib: Use ConvertDevicePathToText()

2016-04-29 Thread Ruiyu Ni
The DevicePathToStr() function (in
"IntelFrameworkModulePkg/Library/GenericBdsLib/DevicePath.c") is a
simple wrapper around ConvertDevicePathToText().

DevicePathToStr() passes DisplayOnly=TRUE and AllowShortcuts=TRUE to
ConvertDevicePathToText(), whereas in this patch, both parameters are
flipped to FALSE.

The formatted devpaths are used only for debugging purposes, so this
change is safe.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
---
 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c  | 6 +++---
 OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index ea0ae1e..5c053ce 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -251,7 +251,7 @@ Returns:
   //
   // Print Device Path
   //
-  DevPathStr = DevicePathToStr(DevicePath);
+  DevPathStr = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
   if (DevPathStr != NULL) {
 DEBUG((
   EFI_D_INFO,
@@ -280,7 +280,7 @@ Returns:
   //
   // Print Device Path
   //
-  DevPathStr = DevicePathToStr(DevicePath);
+  DevPathStr = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
   if (DevPathStr != NULL) {
 DEBUG((
   EFI_D_INFO,
@@ -991,7 +991,7 @@ ConnectRecursivelyIfPciMassStorage (
 //
 // Print Device Path
 //
-DevPathStr = DevicePathToStr (DevicePath);
+DevPathStr = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
 if (DevPathStr != NULL) {
   DEBUG((
 EFI_D_INFO,
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 2bb43d0..15f9c73 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -46,6 +46,7 @@ [LibraryClasses]
   DebugLib
   PcdLib
   UefiBootManagerLib
+  DevicePathLib
   PciLib
   NvVarsFileLib
   QemuFwCfgLib
-- 
2.7.0.windows.1

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


[edk2] [Patch v4 06/23] OvmfPkg/PlatformBootManagerLib: Follow PlatformBootManagerLib interfaces

2016-04-29 Thread Ruiyu Ni
Change the function name to follow new library class
PlatformBootManagerLib interfaces.

NOTE: There is no progress bar during BDS timeout waiting.
In order to show the progress bar, PlatformBootManagerWaitCallback ()
needs to change to draw it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
---
 .../Library/PlatformBootManagerLib/BdsPlatform.c   | 42 ++
 .../Library/PlatformBootManagerLib/BdsPlatform.h   |  3 +-
 ...atformBdsLib.inf => PlatformBootManagerLib.inf} |  4 +--
 3 files changed, 22 insertions(+), 27 deletions(-)
 rename OvmfPkg/Library/PlatformBootManagerLib/{PlatformBdsLib.inf => 
PlatformBootManagerLib.inf} (90%)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 8354f31..1988b3e 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1,7 +1,7 @@
 /** @file
   Platform BDS customizations.
 
-  Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+  Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -107,7 +107,7 @@ SaveS3BootScript (
 //
 VOID
 EFIAPI
-PlatformBdsInit (
+PlatformBootManagerBeforeConsole (
   VOID
   )
 /*++
@@ -128,7 +128,7 @@ Returns:
   EFI_HANDLE Handle;
   EFI_STATUS Status;
 
-  DEBUG ((EFI_D_INFO, "PlatformBdsInit\n"));
+  DEBUG ((EFI_D_INFO, "PlatformBootManagerBeforeConsole\n"));
   InstallDevicePathCallback ();
 
   VisitAllInstancesOfProtocol (,
@@ -1249,11 +1249,8 @@ SaveS3BootScript (
 
 VOID
 EFIAPI
-PlatformBdsPolicyBehavior (
-  IN OUT LIST_ENTRY  *DriverOptionList,
-  IN OUT LIST_ENTRY  *BootOptionList,
-  IN PROCESS_CAPSULESProcessCapsules,
-  IN BASEM_MEMORY_TEST   BaseMemoryTest
+PlatformBootManagerAfterConsole (
+  VOID
   )
 /*++
 
@@ -1263,26 +1260,12 @@ Routine Description:
   is driven by boot mode. IBV/OEM can customize this code for their specific
   policy action.
 
-Arguments:
-
-  DriverOptionList - The header of the driver option link list
-
-  BootOptionList   - The header of the boot option link list
-
-  ProcessCapsules  - A pointer to ProcessCapsules()
-
-  BaseMemoryTest   - A pointer to BaseMemoryTest()
-
-Returns:
-
-  None.
-
 --*/
 {
   EFI_STATUS Status;
   EFI_BOOT_MODE  BootMode;
 
-  DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior\n"));
+  DEBUG ((EFI_D_INFO, "PlatformBootManagerAfterConsole\n"));
 
   if (PcdGetBool (PcdOvmfFlashVariablesEnable)) {
 DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior: not restoring NvVars "
@@ -1571,6 +1554,19 @@ InstallDevicePathCallback (
 }
 
 /**
+  This function is called each second during the boot manager waits the 
timeout.
+
+  @param TimeoutRemain  The remaining timeout.
+**/
+VOID
+EFIAPI
+PlatformBootManagerWaitCallback (
+  UINT16  TimeoutRemain
+  )
+{
+}
+
+/**
   Lock the ConsoleIn device in system table. All key
   presses will be ignored until the Password is typed in. The only way to
   disable the password is to type it in to a ConIn device.
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index d6ff316..84f5b6f 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
@@ -1,7 +1,7 @@
 /** @file
   Platform BDS customizations include file.
 
-  Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -40,7 +40,6 @@ Abstract:
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBdsLib.inf 
b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
similarity index 90%
rename from OvmfPkg/Library/PlatformBootManagerLib/PlatformBdsLib.inf
rename to OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 239d50f..abac516 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBdsLib.inf
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -14,11 +14,11 @@
 
 [Defines]
   INF_VERSION= 0x00010005
-  BASE_NAME  = PlatformBdsLib
+  BASE_NAME  = PlatformBootManagerLib
   FILE_GUID  = 

[edk2] [Patch v4 13/23] OvmfPkg/PlatformBootManagerLib: Remove unused local functions.

2016-04-29 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Reviewed-by: Laszlo Ersek 
---
 .../Library/PlatformBootManagerLib/BdsPlatform.c   | 94 --
 1 file changed, 94 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index d9e5d94..6221402 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1377,100 +1377,6 @@ Routine Description:
   BdsLibBuildOptionFromVar (BootOptionList, L"BootOrder");
 }
 
-VOID
-EFIAPI
-PlatformBdsBootSuccess (
-  IN  BDS_COMMON_OPTION   *Option
-  )
-/*++
-
-Routine Description:
-
-  Hook point after a boot attempt succeeds. We don't expect a boot option to
-  return, so the EFI 1.0 specification defines that you will default to an
-  interactive mode and stop processing the BootOrder list in this case. This
-  is alos a platform implementation and can be customized by IBV/OEM.
-
-Arguments:
-
-  Option - Pointer to Boot Option that succeeded to boot.
-
-Returns:
-
-  None.
-
---*/
-{
-  CHAR16  *TmpStr;
-
-  DEBUG ((EFI_D_INFO, "PlatformBdsBootSuccess\n"));
-  //
-  // If Boot returned with EFI_SUCCESS and there is not in the boot device
-  // select loop then we need to pop up a UI and wait for user input.
-  //
-  TmpStr = Option->StatusString;
-  if (TmpStr != NULL) {
-BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", 
NULL);
-FreePool (TmpStr);
-  }
-}
-
-VOID
-EFIAPI
-PlatformBdsBootFail (
-  IN  BDS_COMMON_OPTION  *Option,
-  IN  EFI_STATUS Status,
-  IN  CHAR16 *ExitData,
-  IN  UINTN  ExitDataSize
-  )
-/*++
-
-Routine Description:
-
-  Hook point after a boot attempt fails.
-
-Arguments:
-
-  Option - Pointer to Boot Option that failed to boot.
-
-  Status - Status returned from failed boot.
-
-  ExitData - Exit data returned from failed boot.
-
-  ExitDataSize - Exit data size returned from failed boot.
-
-Returns:
-
-  None.
-
---*/
-{
-  CHAR16  *TmpStr;
-
-  DEBUG ((EFI_D_INFO, "PlatformBdsBootFail\n"));
-
-  //
-  // If Boot returned with failed status then we need to pop up a UI and wait
-  // for user input.
-  //
-  TmpStr = Option->StatusString;
-  if (TmpStr != NULL) {
-BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", 
NULL);
-FreePool (TmpStr);
-  }
-}
-
-VOID
-EFIAPI
-PlatformBdsLockNonUpdatableFlash (
-  VOID
-  )
-{
-  DEBUG ((EFI_D_INFO, "PlatformBdsLockNonUpdatableFlash\n"));
-  return;
-}
-
-
 /**
   This notification function is invoked when an instance of the
   EFI_DEVICE_PATH_PROTOCOL is produced.
-- 
2.7.0.windows.1

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


[edk2] [Patch v4 07/23] OvmfPkg/PlatformBootManagerLib: use EfiBootManagerUpdateConsoleVariable

2016-04-29 Thread Ruiyu Ni
Call EfiBootManagerUpdateConsoleVariable in UefiBootManagerLib
instead of BdsLibUpdateConsoleVariable in GenericBdsLib.

Still cannot pass build.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Reviewed-by: Laszlo Ersek 
---
 .../Library/PlatformBootManagerLib/BdsPlatform.c   | 32 +++---
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 1988b3e..ea0ae1e 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -236,7 +236,7 @@ Returns:
   //
   DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL 
*));
 
-  BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);
 
   //
   // Register COM1
@@ -263,9 +263,9 @@ Returns:
 FreePool(DevPathStr);
   }
 
-  BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);
-  BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);
-  BdsLibUpdateConsoleVariable (VarErrorOut, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ErrOut, DevicePath, NULL);
 
   //
   // Register COM2
@@ -292,9 +292,9 @@ Returns:
 FreePool(DevPathStr);
   }
 
-  BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);
-  BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);
-  BdsLibUpdateConsoleVariable (VarErrorOut, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ErrOut, DevicePath, NULL);
 
   return EFI_SUCCESS;
 }
@@ -374,8 +374,8 @@ GetGopDevicePath (
 // Delete the PCI device's path that added by 
GetPlugInPciVgaDevicePath()
 // Add the integrity GOP device path.
 //
-BdsLibUpdateConsoleVariable (VarConsoleOutDev, NULL, PciDevicePath);
-BdsLibUpdateConsoleVariable (VarConsoleOutDev, TempDevicePath, NULL);
+EfiBootManagerUpdateConsoleVariable (ConOutDev, NULL, PciDevicePath);
+EfiBootManagerUpdateConsoleVariable (ConOutDev, TempDevicePath, NULL);
   }
 }
 gBS->FreePool (GopHandleBuffer);
@@ -424,7 +424,7 @@ Returns:
   GetGopDevicePath (DevicePath, );
   DevicePath = GopDevicePath;
 
-  BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);
 
   return EFI_SUCCESS;
 }
@@ -467,9 +467,9 @@ Returns:
   DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL 
*));
   DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL 
*));
 
-  BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);
-  BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);
-  BdsLibUpdateConsoleVariable (VarErrorOut, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ErrOut, DevicePath, NULL);
 
   return EFI_SUCCESS;
 }
@@ -731,13 +731,13 @@ Returns:
   // Update the console variable with the connect type
   //
   if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {
-BdsLibUpdateConsoleVariable (VarConsoleInp, 
PlatformConsole[Index].DevicePath, NULL);
+EfiBootManagerUpdateConsoleVariable (ConIn, 
PlatformConsole[Index].DevicePath, NULL);
   }
   if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {
-BdsLibUpdateConsoleVariable (VarConsoleOut, 
PlatformConsole[Index].DevicePath, NULL);
+EfiBootManagerUpdateConsoleVariable (ConOut, 
PlatformConsole[Index].DevicePath, NULL);
   }
   if ((PlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {
-BdsLibUpdateConsoleVariable (VarErrorOut, 
PlatformConsole[Index].DevicePath, NULL);
+EfiBootManagerUpdateConsoleVariable (ErrOut, 
PlatformConsole[Index].DevicePath, NULL);
   }
 }
   } else {
-- 
2.7.0.windows.1

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


[edk2] [Patch v4 01/23] MdeModulePkg/UefiBootManagerLib: Expose *GetLoadOptionBuffer() API

2016-04-29 Thread Ruiyu Ni
Expose EfiBootManagerGetLoadOptionBuffer() API.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Reviewed-by: Laszlo Ersek 
---
 MdeModulePkg/Include/Library/UefiBootManagerLib.h  | 23 +-
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   | 11 ++-
 .../Library/UefiBootManagerLib/BmLoadOption.c  |  2 +-
 .../Library/UefiBootManagerLib/InternalBm.h| 19 --
 4 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/MdeModulePkg/Include/Library/UefiBootManagerLib.h 
b/MdeModulePkg/Include/Library/UefiBootManagerLib.h
index 91926fc..0fdb23d 100644
--- a/MdeModulePkg/Include/Library/UefiBootManagerLib.h
+++ b/MdeModulePkg/Include/Library/UefiBootManagerLib.h
@@ -1,7 +1,7 @@
 /** @file
   Provide Boot Manager related library APIs.
 
-Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
 (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
@@ -431,6 +431,27 @@ EfiBootManagerGetBootManagerMenu (
   EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
   );
 
+
+/**
+  Get the load option by its device path.
+
+  @param FilePath  The device path pointing to a load option.
+   It could be a short-form device path.
+  @param FullPath  Return the full device path of the load option after
+   short-form device path expanding.
+   Caller is responsible to free it.
+  @param FileSize  Return the load option size.
+
+  @return The load option buffer. Caller is responsible to free the memory.
+**/
+VOID *
+EFIAPI
+EfiBootManagerGetLoadOptionBuffer (
+  IN  EFI_DEVICE_PATH_PROTOCOL  *FilePath,
+  OUT EFI_DEVICE_PATH_PROTOCOL  **FullPath,
+  OUT UINTN *FileSize
+  );
+
 /**
   The function enumerates all the legacy boot options, creates them and 
   registers them in the BootOrder variable.
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index beb2eaf..d016517 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -586,7 +586,7 @@ BmExpandUsbDevicePath (
 
   for (Index = 0; (Index < HandleCount) && (FileBuffer == NULL); Index++) {
 FullDevicePath = AppendDevicePath (DevicePathFromHandle (Handles[Index]), 
RemainingDevicePath);
-FileBuffer = BmGetLoadOptionBuffer (FullDevicePath, FullPath, FileSize);
+FileBuffer = EfiBootManagerGetLoadOptionBuffer (FullDevicePath, FullPath, 
FileSize);
 FreePool (FullDevicePath);
   }
 
@@ -851,7 +851,7 @@ BmExpandPartitionDevicePath (
 Status = EfiBootManagerConnectDevicePath (Instance, NULL);
 if (!EFI_ERROR (Status)) {
   TempDevicePath = AppendDevicePath (Instance, NextDevicePathNode 
(FilePath));
-  FileBuffer = BmGetLoadOptionBuffer (TempDevicePath, FullPath, 
FileSize);
+  FileBuffer = EfiBootManagerGetLoadOptionBuffer (TempDevicePath, 
FullPath, FileSize);
   FreePool (TempDevicePath);
 
   if (FileBuffer != NULL) {
@@ -911,7 +911,7 @@ BmExpandPartitionDevicePath (
   // Find the matched partition device path
   //
   TempDevicePath = AppendDevicePath (BlockIoDevicePath, NextDevicePathNode 
(FilePath));
-  FileBuffer = BmGetLoadOptionBuffer (TempDevicePath, FullPath, FileSize);
+  FileBuffer = EfiBootManagerGetLoadOptionBuffer (TempDevicePath, 
FullPath, FileSize);
   FreePool (TempDevicePath);
 
   if (FileBuffer != NULL) {
@@ -1425,7 +1425,8 @@ BmGetFileBufferFromLoadFiles (
   @return The load option buffer. Caller is responsible to free the memory.
 **/
 VOID *
-BmGetLoadOptionBuffer (
+EFIAPI
+EfiBootManagerGetLoadOptionBuffer (
   IN  EFI_DEVICE_PATH_PROTOCOL  *FilePath,
   OUT EFI_DEVICE_PATH_PROTOCOL  **FullPath,
   OUT UINTN *FileSize
@@ -1648,7 +1649,7 @@ EfiBootManagerBoot (
   RamDiskDevicePath = NULL;
   if (DevicePathType (BootOption->FilePath) != BBS_DEVICE_PATH) {
 Status = EFI_NOT_FOUND;
-FileBuffer = BmGetLoadOptionBuffer (BootOption->FilePath, , 
);
+FileBuffer = EfiBootManagerGetLoadOptionBuffer (BootOption->FilePath, 
, );
 if (FileBuffer != NULL) {
   RamDiskDevicePath = BmGetRamDiskDevicePath (FilePath);
 }
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
index 8201255..9af98de 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
@@ -1281,7 +1281,7 @@ EfiBootManagerProcessLoadOption (
 mBmLoadOptionName[LoadOption->OptionType], LoadOption->OptionNumber
 ));
   ImageHandle = 

[edk2] [Patch v4 02/23] OvmfPkg/PlatformPei: Add memory above 4GB as tested

2016-04-29 Thread Ruiyu Ni
Since PlatformBootManagerLib do not run memory test
to convert untested memory to tested.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Tested-by: Laszlo Ersek 
Reviewed-by: Laszlo Ersek 
---
 OvmfPkg/PlatformPei/MemDetect.c |  4 ++--
 OvmfPkg/PlatformPei/Platform.c  | 29 -
 OvmfPkg/PlatformPei/Platform.h  | 14 +-
 OvmfPkg/PlatformPei/Xen.c   |  8 ++--
 4 files changed, 5 insertions(+), 50 deletions(-)

diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
index ed13c57..7991ba2 100644
--- a/OvmfPkg/PlatformPei/MemDetect.c
+++ b/OvmfPkg/PlatformPei/MemDetect.c
@@ -1,7 +1,7 @@
 /**@file
   Memory Detection for Virtual Machines.
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -422,7 +422,7 @@ QemuInitializeRam (
 }
 
 if (UpperMemorySize != 0) {
-  AddUntestedMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);
+  AddMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);
 }
   }
 
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index ef654c4..4be9922 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -152,35 +152,6 @@ AddMemoryRangeHob (
 
 
 VOID
-AddUntestedMemoryBaseSizeHob (
-  EFI_PHYSICAL_ADDRESSMemoryBase,
-  UINT64  MemorySize
-  )
-{
-  BuildResourceDescriptorHob (
-EFI_RESOURCE_SYSTEM_MEMORY,
-  EFI_RESOURCE_ATTRIBUTE_PRESENT |
-  EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
-  EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
-  EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
-  EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
-  EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE,
-MemoryBase,
-MemorySize
-);
-}
-
-
-VOID
-AddUntestedMemoryRangeHob (
-  EFI_PHYSICAL_ADDRESSMemoryBase,
-  EFI_PHYSICAL_ADDRESSMemoryLimit
-  )
-{
-  AddUntestedMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - 
MemoryBase));
-}
-
-VOID
 MemMapInitialization (
   VOID
   )
diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
index dad3c61..bb988ea 100644
--- a/OvmfPkg/PlatformPei/Platform.h
+++ b/OvmfPkg/PlatformPei/Platform.h
@@ -1,7 +1,7 @@
 /** @file
   Platform PEI module include file.
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -42,12 +42,6 @@ AddMemoryRangeHob (
   );
 
 VOID
-AddUntestedMemoryBaseSizeHob (
-  EFI_PHYSICAL_ADDRESSMemoryBase,
-  UINT64  MemorySize
-  );
-
-VOID
 AddReservedMemoryBaseSizeHob (
   EFI_PHYSICAL_ADDRESSMemoryBase,
   UINT64  MemorySize,
@@ -55,12 +49,6 @@ AddReservedMemoryBaseSizeHob (
   );
 
 VOID
-AddUntestedMemoryRangeHob (
-  EFI_PHYSICAL_ADDRESSMemoryBase,
-  EFI_PHYSICAL_ADDRESSMemoryLimit
-  );
-
-VOID
 AddressWidthInitialization (
   VOID
   );
diff --git a/OvmfPkg/PlatformPei/Xen.c b/OvmfPkg/PlatformPei/Xen.c
index 7fa9019..3a43582 100644
--- a/OvmfPkg/PlatformPei/Xen.c
+++ b/OvmfPkg/PlatformPei/Xen.c
@@ -1,7 +1,7 @@
 /**@file
   Xen Platform PEI support
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
   Copyright (c) 2011, Andrei Warkentin 
 
   This program and the accompanying materials
@@ -189,11 +189,7 @@ XenPublishRamRegions (
 continue;
   }
 
-  if (Entry->BaseAddr >= BASE_4GB) {
-AddUntestedMemoryBaseSizeHob (Entry->BaseAddr, Entry->Length);
-  } else {
-AddMemoryBaseSizeHob (Entry->BaseAddr, Entry->Length);
-  }
+  AddMemoryBaseSizeHob (Entry->BaseAddr, Entry->Length);
 
   MtrrSetMemoryAttribute (Entry->BaseAddr, Entry->Length, CacheWriteBack);
 }
-- 
2.7.0.windows.1

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


[edk2] [Patch v4 00/23] Use MdeModulePkg/BDS in OVMF platform

2016-04-29 Thread Ruiyu Ni
The patch serials creates a flag USE_OLD_BDS and by default the value
of the flag is FALSE so that the new MdeModulePkg/BDS is used.
User can define USE_OLD_BDS as TRUE to force to use IntelFrameworkModulePkg
/BDS.

The v3 adopts comments for v1 and v2 to split the big changes to
small changes and also expose the EfiBootManagerGetLoadOptionBuffer().

The v4 adopts comments for v3.

Ruiyu Ni (23):
  MdeModulePkg/UefiBootManagerLib: Expose *GetLoadOptionBuffer() API
  OvmfPkg/PlatformPei: Add memory above 4GB as tested
  OvmfPkg: Duplicate QemuBootOrderLib to QemuNewBootOrderLib
  OvmfPkg/QemuNewBootOrderLib: Build with UefiBootManagerLib
  OvmfPkg: Duplicate PlatformBdsLib to PlatformBootManagerLib
  OvmfPkg/PlatformBootManagerLib: Follow PlatformBootManagerLib
interfaces
  OvmfPkg/PlatformBootManagerLib: use
EfiBootManagerUpdateConsoleVariable
  OvmfPkg/PlatformBootManagerLib: link to UefiBootManagerLib
  OvmfPkg/PlatformBootManagerLib: Use ConvertDevicePathToText()
  OvmfPkg/PlatformBootManagerLib: Init console vars in *BeforeConsole()
  OvmfPkg/PlatformBootManagerLib: Do not launch Boot Manager Menu
  OvmfPkg/PlatformBootManagerLib: Register boot options and hot keys
  OvmfPkg/PlatformBootManagerLib: Remove unused local functions.
  OvmfPkg/PlatformBootManagerLib: port PlatformBdsConnectSequence to
UefiBootManagerLib
  OvmfPkg/PlatformBootManagerLib: Use
EfiBootManagerRefreshAllBootOption()
  OvmfPkg/PlatformBootManagerLib: Remove PlatformBdsGetDriverOption()
  OvmfPkg/PlatformBootManagerLib: Use GetBootModeHob() in HobLib
  OvmfPkg/PlatformBootManagerLib: Remove unnecessary memory test
  OvmfPkg/PlatformBootManagerLib: Remove unused vars and func prototypes
  OvmfPkg/PlatformBootManagerLib: Add EnableQuietBoot & DisableQuietBoot
  OvmfPkg/PlatformBootManagerLib: Remove unused C structures definitions
  OvmfPkg: Use MdeModulePkg/BDS
  OvmfPkg/OvmfPkgIa32X64.dsc: Move PcdShellFile to
[PcdsFixedAtBuild.X64]

 MdeModulePkg/Include/Library/UefiBootManagerLib.h  |   23 +-
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   |   11 +-
 .../Library/UefiBootManagerLib/BmLoadOption.c  |2 +-
 .../Library/UefiBootManagerLib/InternalBm.h|   19 -
 .../Library/PlatformBootManagerLib/BdsPlatform.c   | 1397 
 .../Library/PlatformBootManagerLib/BdsPlatform.h   |  214 +++
 .../PlatformBootManagerLib.inf |   83 ++
 .../Library/PlatformBootManagerLib/PlatformData.c  |   41 +
 .../QemuKernel.c   |0
 OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c |  671 ++
 .../ExtraRootBusMap.c  |0
 .../ExtraRootBusMap.h  |0
 .../QemuBootOrderLib.c |  139 +-
 .../QemuBootOrderLib.inf   |   10 +-
 OvmfPkg/OvmfPkgIa32.dsc|   41 +-
 OvmfPkg/OvmfPkgIa32.fdf|5 +
 OvmfPkg/OvmfPkgIa32X64.dsc |   43 +-
 OvmfPkg/OvmfPkgIa32X64.fdf |5 +
 OvmfPkg/OvmfPkgX64.dsc |   41 +-
 OvmfPkg/OvmfPkgX64.fdf |5 +
 OvmfPkg/PlatformPei/MemDetect.c|4 +-
 OvmfPkg/PlatformPei/Platform.c |   29 -
 OvmfPkg/PlatformPei/Platform.h |   14 +-
 OvmfPkg/PlatformPei/Xen.c  |8 +-
 24 files changed, 2653 insertions(+), 152 deletions(-)
 create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
 create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
 create mode 100644 
OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
 create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
 copy OvmfPkg/Library/{PlatformBdsLib => PlatformBootManagerLib}/QemuKernel.c 
(100%)
 create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c
 copy OvmfPkg/Library/{QemuBootOrderLib => 
QemuNewBootOrderLib}/ExtraRootBusMap.c (100%)
 copy OvmfPkg/Library/{QemuBootOrderLib => 
QemuNewBootOrderLib}/ExtraRootBusMap.h (100%)
 copy OvmfPkg/Library/{QemuBootOrderLib => 
QemuNewBootOrderLib}/QemuBootOrderLib.c (91%)
 copy OvmfPkg/Library/{QemuBootOrderLib => 
QemuNewBootOrderLib}/QemuBootOrderLib.inf (83%)

-- 
2.7.0.windows.1

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


Re: [edk2] [PATCH] [BaseTools]/Build: Better DSC arch filtering

2016-04-29 Thread Palmer, Thomas
Xie xie,
Thomas

-Original Message-
From: Zhu, Yonghong [mailto:yonghong@intel.com] 
Sent: Friday, April 29, 2016 1:30 AM
To: Palmer, Thomas ; edk2-devel@lists.01.org
Cc: Gao, Liming ; El-Haj-Mahmoud, Samer 
; Zhu, Yonghong 
Subject: RE: [PATCH] [BaseTools]/Build: Better DSC arch filtering

Reviewed-by: Yonghong Zhu  

I will push this patch to Git Repository.

Best Regards,
Zhu Yonghong


-Original Message-
From: Thomas Palmer [mailto:thomas.pal...@hpe.com]
Sent: Thursday, April 28, 2016 6:32 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming ; 
samer.el-haj-mahm...@hpe.com; Thomas Palmer 
Subject: [PATCH] [BaseTools]/Build: Better DSC arch filtering

Description:
When building for any specific architecture, the build script today is loading 
DSC sections for other architectures not in the build. The build process should 
disregard DSC sections that are not relevant to the build.

My previous patch only fixed issue for one section type (Components). This 
patch will handle all section types by updating the MetaFileParser class, which 
now takes a Arch argument and will filter the DSC table results as they are 
returned from the database.  The database still contains all information from 
DSCs for when builds support multiple arch's

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Thomas Palmer 
---
 .../Source/Python/Workspace/MetaFileParser.py  | 40 ++
 .../Source/Python/Workspace/WorkspaceDatabase.py   |  7 +---
 2 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py 
b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 2811fd1..209f47c 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -2,7 +2,7 @@
 # This file is used to parse meta files  #  # Copyright (c) 2008 - 2016, Intel 
Corporation. All rights reserved. -# Copyright (c) 2015, Hewlett Packard 
Enterprise Development, L.P.
+# (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 # This program and the accompanying materials  # are licensed and made 
available under the terms and conditions of the BSD License  # which 
accompanies this distribution.  The full text of the license may be found at @@ 
-144,14 +144,15 @@ class MetaFileParser(object):
 #
 #   @param  FilePathThe path of platform description file
 #   @param  FileTypeThe raw data of DSC file
+#   @param  ArchDefault Arch value for filtering sections
 #   @param  Table   Database used to retrieve module/package 
information
-#   @param  Macros  Macros used for replacement in file
 #   @param  Owner   Owner ID (for sub-section parsing)
 #   @param  FromID from which the data comes (for !INCLUDE 
directive)
 #
-def __init__(self, FilePath, FileType, Table, Owner= -1, From= -1):
+def __init__(self, FilePath, FileType, Arch, Table, Owner= -1, From= -1):
 self._Table = Table
 self._RawTable = Table
+self._Arch = Arch
 self._FileType = FileType
 self.MetaFile = FilePath
 self._FileDir = self.MetaFile.Dir @@ -211,6 +212,15 @@ class 
MetaFileParser(object):
 def _SetFinished(self, Value):
 self._Finished = Value
 
+## Remove records that do not match given Filter Arch
+def _FilterRecordList(self, RecordList, FilterArch):
+NewRecordList = []
+for Record in RecordList:
+Arch = Record[3]
+if Arch == 'COMMON' or Arch == FilterArch:
+NewRecordList.append(Record)
+return NewRecordList
+
 ## Use [] style to query data in table, just for readability
 #
 #   DataInfo = [data_type, scope1(arch), scope2(platform/moduletype)]
@@ -230,13 +240,13 @@ class MetaFileParser(object):
 
 # No specific ARCH or Platform given, use raw data
 if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] == None):
-return self._RawTable.Query(*DataInfo)
+return
+ self._FilterRecordList(self._RawTable.Query(*DataInfo), self._Arch)
 
 # Do post-process if necessary
 if not self._PostProcessed:
 self._PostProcess()
 
-return self._Table.Query(*DataInfo)
+return self._FilterRecordList(self._Table.Query(*DataInfo),
+ DataInfo[1])
 
 ## Data parser for the common format in different type of file
 #
@@ -490,14 +500,14 @@ class InfParser(MetaFileParser):
 #
 #   @param  FilePathThe path of module description file
 #   @param  FileTypeThe raw data of DSC file
+#   @param  Arch   

Re: [edk2] [PATCH] [BaseTools]/Build: Better DSC arch filtering

2016-04-29 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

I will push this patch to Git Repository.

Best Regards,
Zhu Yonghong


-Original Message-
From: Thomas Palmer [mailto:thomas.pal...@hpe.com] 
Sent: Thursday, April 28, 2016 6:32 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming ; 
samer.el-haj-mahm...@hpe.com; Thomas Palmer 
Subject: [PATCH] [BaseTools]/Build: Better DSC arch filtering

Description:
When building for any specific architecture, the build script today is loading 
DSC sections for other architectures not in the build. The build process should 
disregard DSC sections that are not relevant to the build.

My previous patch only fixed issue for one section type (Components). This 
patch will handle all section types by updating the MetaFileParser class, which 
now takes a Arch argument and will filter the DSC table results as they are 
returned from the database.  The database still contains all information from 
DSCs for when builds support multiple arch's

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Thomas Palmer 
---
 .../Source/Python/Workspace/MetaFileParser.py  | 40 ++
 .../Source/Python/Workspace/WorkspaceDatabase.py   |  7 +---
 2 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py 
b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 2811fd1..209f47c 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -2,7 +2,7 @@
 # This file is used to parse meta files  #  # Copyright (c) 2008 - 2016, Intel 
Corporation. All rights reserved. -# Copyright (c) 2015, Hewlett Packard 
Enterprise Development, L.P.
+# (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 # This program and the accompanying materials  # are licensed and made 
available under the terms and conditions of the BSD License  # which 
accompanies this distribution.  The full text of the license may be found at @@ 
-144,14 +144,15 @@ class MetaFileParser(object):
 #
 #   @param  FilePathThe path of platform description file
 #   @param  FileTypeThe raw data of DSC file
+#   @param  ArchDefault Arch value for filtering sections
 #   @param  Table   Database used to retrieve module/package 
information
-#   @param  Macros  Macros used for replacement in file
 #   @param  Owner   Owner ID (for sub-section parsing)
 #   @param  FromID from which the data comes (for !INCLUDE 
directive)
 #
-def __init__(self, FilePath, FileType, Table, Owner= -1, From= -1):
+def __init__(self, FilePath, FileType, Arch, Table, Owner= -1, From= -1):
 self._Table = Table
 self._RawTable = Table
+self._Arch = Arch
 self._FileType = FileType
 self.MetaFile = FilePath
 self._FileDir = self.MetaFile.Dir @@ -211,6 +212,15 @@ class 
MetaFileParser(object):
 def _SetFinished(self, Value):
 self._Finished = Value
 
+## Remove records that do not match given Filter Arch
+def _FilterRecordList(self, RecordList, FilterArch):
+NewRecordList = []
+for Record in RecordList:
+Arch = Record[3]
+if Arch == 'COMMON' or Arch == FilterArch:
+NewRecordList.append(Record)
+return NewRecordList
+
 ## Use [] style to query data in table, just for readability
 #
 #   DataInfo = [data_type, scope1(arch), scope2(platform/moduletype)]
@@ -230,13 +240,13 @@ class MetaFileParser(object):
 
 # No specific ARCH or Platform given, use raw data
 if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] == None):
-return self._RawTable.Query(*DataInfo)
+return 
+ self._FilterRecordList(self._RawTable.Query(*DataInfo), self._Arch)
 
 # Do post-process if necessary
 if not self._PostProcessed:
 self._PostProcess()
 
-return self._Table.Query(*DataInfo)
+return self._FilterRecordList(self._Table.Query(*DataInfo), 
+ DataInfo[1])
 
 ## Data parser for the common format in different type of file
 #
@@ -490,14 +500,14 @@ class InfParser(MetaFileParser):
 #
 #   @param  FilePathThe path of module description file
 #   @param  FileTypeThe raw data of DSC file
+#   @param  ArchDefault Arch value for filtering sections
 #   @param  Table   Database used to retrieve module/package 
information
-#   @param  Macros  Macros used for replacement in file
 #
-def __init__(self, FilePath, FileType, Table):
+def __init__(self, FilePath, FileType, Arch, Table):
 # prevent re-initialization
 if hasattr(self, 

Re: [edk2] [Patch] BaseTools: fix the bug for FMP to support use Macro as path description

2016-04-29 Thread Gao, Liming
Reviewed-by: Liming Gao 

> -Original Message-
> From: Zhu, Yonghong
> Sent: Thursday, April 28, 2016 3:07 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming 
> Subject: [Patch] BaseTools: fix the bug for FMP to support use Macro as path
> description
> 
> Fix the bug for FMP image to support to use Macro as path description,
> eg: FILE DATA =
> $(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/test.efi
> 
> Cc: Liming Gao 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu 
> ---
>  BaseTools/Source/Python/GenFds/FdfParser.py | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
> b/BaseTools/Source/Python/GenFds/FdfParser.py
> index 72fb3dc..39f951a 100644
> --- a/BaseTools/Source/Python/GenFds/FdfParser.py
> +++ b/BaseTools/Source/Python/GenFds/FdfParser.py
> @@ -3433,13 +3433,12 @@ class FdfParser:
> 
>  if not self.__GetNextToken():
>  raise Warning("expected File name", self.FileName,
> self.CurrentLineNumber)
> 
>  AnyFileName = self.__Token
> -AnyFileName =
> GenFdsGlobalVariable.ReplaceWorkspaceMacro(AnyFileName)
> -if not os.path.exists(AnyFileName):
> -raise Warning("File %s not exists"%AnyFileName, self.FileName,
> self.CurrentLineNumber)
> +self.__VerifyFile(AnyFileName)
> +
>  return AnyFileName
> 
>  ## __GetAnyFileStatement() method
>  #
>  #   Get AnyFile for capsule
> --
> 2.6.1.windows.1

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


[edk2] [Patch] SecurityPkg OpalPasswordDxe: Install menu without device dependency.

2016-04-29 Thread Eric Dong
Change design to always install opal menu.
Current implementation only install menu when device connect.

Cc: Feng Tian 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong 
---
 SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c  | 13 +++---
 SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c | 46 --
 .../Tcg/Opal/OpalPasswordDxe/OpalPasswordDxe.inf   |  2 +-
 3 files changed, 6 insertions(+), 55 deletions(-)

diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c 
b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c
index e06ce4a..1f70331 100644
--- a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c
+++ b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c
@@ -732,6 +732,11 @@ EfiDriverEntryPoint(
   
   );
 
+  //
+  // Install Hii packages.
+  //
+  HiiInstall();
+
   return Status;
 }
 
@@ -966,14 +971,6 @@ OpalEfiDriverBindingStart(
   AddDeviceToTail(Dev);
 
   //
-  // Install Hii if it hasn't already been installed
-  //
-  if (!gHiiInstalled) {
-HiiInstall();
-gHiiInstalled = TRUE;
-  }
-
-  //
   // check if device is locked and prompt for password
   //
   OpalDriverRequestPassword (Dev);
diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c 
b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
index 75ff9fc..0a4453a 100644
--- a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
+++ b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
@@ -108,43 +108,6 @@ HiiSetCurrentConfiguration(
 }
 
 /**
-  Check that all required protocols for HII are available.
-
-  @retval  EFI_SUCCESSAll required protocols are installed.
-  @retval  EFI_NOT_FOUND  One or more protocol are not installed.
-**/
-EFI_STATUS
-HiiCheckForRequiredProtocols (
-  VOID
-  )
-{
-  VOID*   TempProtocol;
-  EFI_STATUS  Status;
-
-  Status = gBS->LocateProtocol(, NULL, 
(VOID**) );
-  if (EFI_ERROR (Status)) {
-return EFI_NOT_FOUND;
-  }
-
-  Status = gBS->LocateProtocol(, NULL, 
(VOID**) );
-  if (EFI_ERROR (Status)) {
-return EFI_NOT_FOUND;
-  }
-
-  Status = gBS->LocateProtocol(, NULL, 
(VOID**) );
-  if (EFI_ERROR (Status)) {
-return EFI_NOT_FOUND;
-  }
-
-  Status = gBS->LocateProtocol(, NULL, 
(VOID**) );
-  if (EFI_ERROR (Status)) {
-return EFI_NOT_FOUND;
-  }
-
-  return EFI_SUCCESS;
-}
-
-/**
   Install the HII related resources.
 
   @retval  EFI_SUCCESSInstall all the resources success.
@@ -159,15 +122,6 @@ HiiInstall(
   EFI_HANDLE   DriverHandle;
 
   //
-  // Check that all required protocols are available for HII.
-  // If not, fail the install
-  //
-  Status = HiiCheckForRequiredProtocols();
-  if (EFI_ERROR(Status)) {
-return Status;
-  }
-
-  //
   // Clear the global configuration.
   //
   ZeroMem(, sizeof(gHiiConfiguration));
diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalPasswordDxe.inf 
b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalPasswordDxe.inf
index bae8885..703c1b6 100644
--- a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalPasswordDxe.inf
+++ b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalPasswordDxe.inf
@@ -78,4 +78,4 @@
   gOpalExtraInfoVariableGuid## PRODUCES ## GUID
 
 [Depex]
-  gEfiSmmCommunicationProtocolGuid
+  gEfiSmmCommunicationProtocolGuid AND gEfiHiiStringProtocolGuid AND 
gEfiHiiDatabaseProtocolGuid
-- 
2.6.4.windows.1

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