Re: [edk2] [patch] MdeModulePkg/SetupBrowserDxe: Remove the useless check

2016-04-21 Thread Qiu, Shumin
Reviewed-by: Qiu Shumin 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dandan Bi
Sent: Friday, April 22, 2016 1:15 PM
To: edk2-devel@lists.01.org
Cc: Qiu, Shumin; Dong, Eric
Subject: [edk2] [patch] MdeModulePkg/SetupBrowserDxe: Remove the useless check

When the type of HiiValue is BUFFER Type, the BufferValue of the related 
question can not be NULL, so can remove the check.

Cc: Qiu Shumin 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi 
---
 MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c 
b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index c36588e..5887e0f 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -3917,11 +3917,11 @@ GetQuestionDefault (
   //  4, set flags of EFI_ONE_OF_OPTION (provide Standard and Manufacturing 
default)
   //  5, set flags of EFI_IFR_CHECKBOX (provide Standard and Manufacturing 
default) (lowest priority)
   //
   HiiValue = >HiiValue;
   TypeValue = >Value;
-  if (HiiValue->Type == EFI_IFR_TYPE_BUFFER && Question->BufferValue != NULL) {
+  if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {
 //
 // For orderedlist, need to pass the BufferValue to Callback function.
 //
 TypeValue = (EFI_IFR_TYPE_VALUE *) Question->BufferValue;
   }
--
1.9.5.msysgit.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] [Staging/Customized-Secure-Boot]: Create branch for Customized Secure Boot

2016-04-21 Thread Zhang, Chao B
Yes. I will provide patch to remove this feature later.





Thanks & Best regards
Chao Zhang

-Original Message-
From: El-Haj-Mahmoud, Samer [mailto:samer.el-haj-mahm...@hpe.com] 
Sent: Friday, April 22, 2016 12:56 PM
To: Zhang, Chao B; edk2-devel@lists.01.org
Cc: jere...@microsoft.com; El-Haj-Mahmoud, Samer
Subject: RE: [edk2] [PATCH] [Staging/Customized-Secure-Boot]: Create branch for 
Customized Secure Boot

Will the existing customized secureboot code in EDK2 Master be reverted until 
this branch is ready to be merged back into Master (With ECR1263 changes?)



-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Zhang, 
Chao B
Sent: Thursday, April 21, 2016 11:50 PM
To: edk2-devel@lists.01.org
Cc: jere...@microsoft.com; Chao Zhang 
Subject: [edk2] [PATCH] [Staging/Customized-Secure-Boot]: Create branch for 
Customized Secure Boot

Create a remote branch Staging/Customized-Secure-Boot for EC1263 feature. Add 
ReadMe.MD file.
https://github.com/tianocore/edk2-staging/tree/Customized-Secure-Boot

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang 
---
 Readme.MD | 45 +
 1 file changed, 45 insertions(+)
 create mode 100644 Readme.MD

diff --git a/Readme.MD b/Readme.MD
new file mode 100644
index 000..eaf95cf
--- /dev/null
+++ b/Readme.MD
@@ -0,0 +1,45 @@
+###
+# # ReadMe.MD for EDKII new feature staging branch..
+#  It contains several parts to describe the staging branch.
+#1. Introduction 
+#2. Branch Owner
+#3. Feature Summary
+#4. Timeline
+#5. Related Modules
+#6. Related Links
+#7. Misc
+#
+###
+
+   
+1. Introduction
+   This staging branch is requested by Jeremiah Cox for 
ECR 1263 Customized Secure Boot feature. 
+ This ECR has some conflicting language/figures that may result in in 
+consistent implementations
+
+2. Branch Owner
+  Chao Zhang 
+
+3. Feature Summary
+  Customized Secure Boto feature provides capabilities for automated 
+platform deployment by enterprises, OEMs, system integrators, and
+  enthusiasts into custom, higher security Secure Boot configurations.  
+This can mitigate chain of custody concerns in the supply chain
+  of a given hardware platform. It further provides the ability to 
+manage multiple UEFI certificate signers and image revocations from
+  multiple signers.  It also provides a viable solution to enterprise, 
+enthusiast, and OS vendor signing of images while maintaining overall
+  security of the pre-boot environment.  Finally, it provides for a consistent 
programmatic and secure re-deployment of already-deployed systems.
+
+4. Timeline
+  N/A
+
+5. Related Modules
+  MdePkg
+Include/Guid/GlobalVariable.h
+Include/Guid/ImageAuthentication.h
+  MdeModulePkg
+VarCheckUefiLib
+  SecuritPkg
+AuthVariableLib
+SecureBootConfigDxe
+
+6. Related Links
+  https://mantis.uefi.org/mantis/view.php?id=1263
+
+7. Misc
+  N/A
\ No newline at end of file
--
1.9.5.msysgit.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/SetupBrowserDxe: Remove the useless check

2016-04-21 Thread Dandan Bi
When the type of HiiValue is BUFFER Type, the BufferValue
of the related question can not be NULL, so can remove the
check.

Cc: Qiu Shumin 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi 
---
 MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c 
b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index c36588e..5887e0f 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -3917,11 +3917,11 @@ GetQuestionDefault (
   //  4, set flags of EFI_ONE_OF_OPTION (provide Standard and Manufacturing 
default)
   //  5, set flags of EFI_IFR_CHECKBOX (provide Standard and Manufacturing 
default) (lowest priority)
   //
   HiiValue = >HiiValue;
   TypeValue = >Value;
-  if (HiiValue->Type == EFI_IFR_TYPE_BUFFER && Question->BufferValue != NULL) {
+  if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {
 //
 // For orderedlist, need to pass the BufferValue to Callback function.
 //
 TypeValue = (EFI_IFR_TYPE_VALUE *) Question->BufferValue;
   }
-- 
1.9.5.msysgit.1

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


Re: [edk2] [PATCH 1/3] MdeModulePkg DxeCore: Fix a memory leak in InstallMemoryAttributesTable()

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

> -Original Message-
> From: Zeng, Star
> Sent: Thursday, April 21, 2016 3:20 PM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Gao, Liming
> ; Tian, Feng 
> Subject: [PATCH 1/3] MdeModulePkg DxeCore: Fix a memory leak in
> InstallMemoryAttributesTable()
> 
> Cc: Jiewen Yao 
> Cc: Liming Gao 
> Cc: Feng Tian 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng 
> ---
>  MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
> b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
> index 416ed3dca846..0362212c8b0b 100644
> --- a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
> +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
> @@ -174,6 +174,8 @@ InstallMemoryAttributesTable (
>  }
>  MemoryMap = NEXT_MEMORY_DESCRIPTOR(MemoryMap,
> DescriptorSize);
>}
> +  MemoryMap = MemoryMapStart;
> +  FreePool (MemoryMap);
> 
>Status = gBS->InstallConfigurationTable
> (, MemoryAttributesTable);
>ASSERT_EFI_ERROR (Status);
> --
> 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] [Staging/Customized-Secure-Boot]: Create branch for Customized Secure Boot

2016-04-21 Thread El-Haj-Mahmoud, Samer
Will the existing customized secureboot code in EDK2 Master be reverted until 
this branch is ready to be merged back into Master (With ECR1263 changes?)



-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Zhang, 
Chao B
Sent: Thursday, April 21, 2016 11:50 PM
To: edk2-devel@lists.01.org
Cc: jere...@microsoft.com; Chao Zhang 
Subject: [edk2] [PATCH] [Staging/Customized-Secure-Boot]: Create branch for 
Customized Secure Boot

Create a remote branch Staging/Customized-Secure-Boot for EC1263 feature. Add 
ReadMe.MD file.
https://github.com/tianocore/edk2-staging/tree/Customized-Secure-Boot

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang 
---
 Readme.MD | 45 +
 1 file changed, 45 insertions(+)
 create mode 100644 Readme.MD

diff --git a/Readme.MD b/Readme.MD
new file mode 100644
index 000..eaf95cf
--- /dev/null
+++ b/Readme.MD
@@ -0,0 +1,45 @@
+###
+# # ReadMe.MD for EDKII new feature staging branch..
+#  It contains several parts to describe the staging branch.
+#1. Introduction 
+#2. Branch Owner
+#3. Feature Summary
+#4. Timeline
+#5. Related Modules
+#6. Related Links
+#7. Misc
+#
+###
+
+   
+1. Introduction
+   This staging branch is requested by Jeremiah Cox for 
ECR 1263 Customized Secure Boot feature. 
+ This ECR has some conflicting language/figures that may result in in 
+consistent implementations
+
+2. Branch Owner
+  Chao Zhang 
+
+3. Feature Summary
+  Customized Secure Boto feature provides capabilities for automated 
+platform deployment by enterprises, OEMs, system integrators, and
+  enthusiasts into custom, higher security Secure Boot configurations.  
+This can mitigate chain of custody concerns in the supply chain
+  of a given hardware platform. It further provides the ability to 
+manage multiple UEFI certificate signers and image revocations from
+  multiple signers.  It also provides a viable solution to enterprise, 
+enthusiast, and OS vendor signing of images while maintaining overall
+  security of the pre-boot environment.  Finally, it provides for a consistent 
programmatic and secure re-deployment of already-deployed systems.
+
+4. Timeline
+  N/A
+
+5. Related Modules
+  MdePkg
+Include/Guid/GlobalVariable.h
+Include/Guid/ImageAuthentication.h
+  MdeModulePkg
+VarCheckUefiLib
+  SecuritPkg
+AuthVariableLib
+SecureBootConfigDxe
+
+6. Related Links
+  https://mantis.uefi.org/mantis/view.php?id=1263
+
+7. Misc
+  N/A
\ No newline at end of file
--
1.9.5.msysgit.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] [Staging/Customized-Secure-Boot]: Create branch for Customized Secure Boot

2016-04-21 Thread Zhang, Chao B
Create a remote branch Staging/Customized-Secure-Boot for EC1263 feature. Add 
ReadMe.MD file.
https://github.com/tianocore/edk2-staging/tree/Customized-Secure-Boot

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang 
---
 Readme.MD | 45 +
 1 file changed, 45 insertions(+)
 create mode 100644 Readme.MD

diff --git a/Readme.MD b/Readme.MD
new file mode 100644
index 000..eaf95cf
--- /dev/null
+++ b/Readme.MD
@@ -0,0 +1,45 @@
+
+# ReadMe.MD for EDKII new feature staging branch.. 
+#  It contains several parts to describe the staging branch.
+#1. Introduction 
+#2. Branch Owner
+#3. Feature Summary
+#4. Timeline
+#5. Related Modules
+#6. Related Links
+#7. Misc
+#
+###
+   
+1. Introduction
+   This staging branch is requested by Jeremiah Cox for 
ECR 1263 Customized Secure Boot feature. 
+ This ECR has some conflicting language/figures that may result in in 
consistent implementations 
+
+2. Branch Owner
+  Chao Zhang 
+
+3. Feature Summary
+  Customized Secure Boto feature provides capabilities for automated platform 
deployment by enterprises, OEMs, system integrators, and
+  enthusiasts into custom, higher security Secure Boot configurations.  This 
can mitigate chain of custody concerns in the supply chain
+  of a given hardware platform. It further provides the ability to manage 
multiple UEFI certificate signers and image revocations from 
+  multiple signers.  It also provides a viable solution to enterprise, 
enthusiast, and OS vendor signing of images while maintaining overall
+  security of the pre-boot environment.  Finally, it provides for a consistent 
programmatic and secure re-deployment of already-deployed systems.
+
+4. Timeline
+  N/A
+
+5. Related Modules
+  MdePkg
+Include/Guid/GlobalVariable.h
+Include/Guid/ImageAuthentication.h
+  MdeModulePkg
+VarCheckUefiLib
+  SecuritPkg
+AuthVariableLib
+SecureBootConfigDxe
+
+6. Related Links
+  https://mantis.uefi.org/mantis/view.php?id=1263
+
+7. Misc
+  N/A
\ No newline at end of file
-- 
1.9.5.msysgit.1

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


Re: [edk2] [PATCH] MdePkg: Add WSMT definition.

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

> -Original Message-
> From: Yao, Jiewen
> Sent: Friday, April 22, 2016 10:32 AM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen; Gao, Liming; Kinney, Michael D
> Subject: [PATCH] MdePkg: Add WSMT definition.
> 
> This patch adds Windows SMM Security Mitigation
> Table @ http://download.microsoft.com/download/1/8/A/18A21244-EB67-
> 4538-BAA2-1A54E0E490B6/WSMT.docx
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: "Yao, Jiewen" 
> Cc: "Gao, Liming" 
> Cc: "Kinney, Michael D" 
> ---
>  .../WindowsSmmSecurityMitigationTable.h| 39
> ++
>  1 file changed, 39 insertions(+)
>  create mode 100644
> MdePkg/Include/IndustryStandard/WindowsSmmSecurityMitigationTable.h
> 
> diff --git
> a/MdePkg/Include/IndustryStandard/WindowsSmmSecurityMitigationTable.
> h
> b/MdePkg/Include/IndustryStandard/WindowsSmmSecurityMitigationTable.
> h
> new file mode 100644
> index 000..bfbcf81
> --- /dev/null
> +++
> b/MdePkg/Include/IndustryStandard/WindowsSmmSecurityMitigationTable.
> h
> @@ -0,0 +1,39 @@
> +/** @file
> +  Defines Windows SMM Security Mitigation Table
> +  @ http://download.microsoft.com/download/1/8/A/18A21244-EB67-4538-
> BAA2-1A54E0E490B6/WSMT.docx
> +
> +  Copyright (c) 2016, Intel Corporation. All rights reserved.
> +  This program and the accompanying materials
> +  are licensed and made available under the terms and conditions of the BSD
> License
> +  which accompanies this distribution.  The full text of the license may be
> found at
> +  http://opensource.org/licenses/bsd-license.php
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +
> +**/
> +
> +
> +#ifndef _WINDOWS_SMM_SECURITY_MITIGATION_TABLE_H_
> +#define _WINDOWS_SMM_SECURITY_MITIGATION_TABLE_H_
> +
> +#include 
> +
> +#define
> EFI_ACPI_WINDOWS_SMM_SECURITY_MITIGATION_TABLE_SIGNATURE
> SIGNATURE_32('W', 'S', 'M', 'T')
> +
> +#pragma pack(1)
> +
> +#define EFI_WSMT_TABLE_REVISION  1
> +
> +typedef struct {
> +  EFI_ACPI_DESCRIPTION_HEADER Header;
> +  UINT32  ProtectionFlags;
> +} EFI_ACPI_WSMT_TABLE;
> +
> +#define EFI_WSMT_PROTECTION_FLAGS_FIXED_COMM_BUFFERS
> 0x1
> +#define
> EFI_WSMT_PROTECTION_FLAGS_COMM_BUFFER_NESTED_PTR_PROTECTIO
> N0x2
> +#define
> EFI_WSMT_PROTECTION_FLAGS_SYSTEM_RESOURCE_PROTECTION   0x4
> +
> +#pragma pack()
> +
> +#endif
> --
> 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 v2 0/2] Report ACPI NFIT for reserved memory RAM disks

2016-04-21 Thread Wu, Hao A
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo
> Ersek
> Sent: Thursday, April 21, 2016 7:10 PM
> To: Wu, Hao A
> Cc: Justen, Jordan L; Tian, Feng; Xiao Guangrong; edk2-de...@ml01.01.org; Yao,
> Jiewen
> Subject: Re: [edk2] [PATCH v2 0/2] Report ACPI NFIT for reserved memory RAM
> disks
> 
> On 04/21/16 07:59, Wu, Hao A wrote:
> > Hi Laszlo,
> >
> > Thanks for the feedbacks, comments are made below.
> >
> >> -Original Message-
> >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> >> Laszlo Ersek
> >> Sent: Wednesday, April 20, 2016 7:08 PM
> >> To: Wu, Hao A
> >> Cc: Tian, Feng; Xiao Guangrong; Justen, Jordan L; edk2-de...@ml01.01.org;
> >> Yao, Jiewen
> >> Subject: Re: [edk2] [PATCH v2 0/2] Report ACPI NFIT for reserved memory
> >> RAM disks
> >>
> >> Hi,
> >>
> >> On 04/20/16 03:58, Hao Wu wrote:
> >>> Changes compared with V1:
> >>> 1. Instead of creating a new NFIT for each registered reserved memory
> >>>RAM disk, new cotent of the NFIT is appended to the existing one.
> >>>
> >>> 2. Report an NVDIMM root device in the \SB scope if there is no NFIT
> >>>in the ACPI table.
> >>>
> >>> 3. Modify FDF files in OvmfPkg to make sure the report of the NVDIMM
> >>>root device will be done correctly.
> >>>
> >>> Hao Wu (2):
> >>>   MdeModulePkg RamDiskDxe: Report ACPI NFIT for reserved memory
> >> RAM
> >>> disks
> >>>   OvmfPkg: Modify fdf files due to RamDiskDxe driver's adding ASL code
> >>>
> >>>  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl |  44 ++
> >>>  .../Universal/Disk/RamDiskDxe/RamDiskDxe.inf   |  12 +
> >>>  .../Universal/Disk/RamDiskDxe/RamDiskImpl.h|   6 +
> >>>  .../Universal/Disk/RamDiskDxe/RamDiskProtocol.c| 520
> >> +
> >>>  OvmfPkg/OvmfPkgIa32.fdf|  12 +-
> >>>  OvmfPkg/OvmfPkgIa32X64.fdf |  12 +-
> >>>  OvmfPkg/OvmfPkgX64.fdf |  12 +-
> >>>  7 files changed, 615 insertions(+), 3 deletions(-)
> >>>  create mode 100644
> >> MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl
> >>>
> >>
> >> I see that Jordan already commented on patch #2, so I'll leave that to
> >> him :) My questions / remarks are general.
> >>
> >> (1) About sharing NFIT between different clients:
> >>
> >> QEMU can emulate an NVDIMM device (see "hw/acpi/nvdimm.c"). (I'm
> >> CC'ing Xiao Guangrong who authored it.) When QEMU is instructed to
> >> create an NVDIMM device, it will also generate an SSDT table with an
> >> NVDR object in it, and it will generate an NFIT table too.
> >>
> >> OVMF's ACPI platform driver downloads the generated ACPI payload
> >> from QEMU near the beginning of BDS, and installs the tables. The
> >> question is how those actions are ordered against the NFIT
> >> installation / manipulation in RamDiskDxe.
> >>
> >> * If the RAM disks are created from HII, then the question is not
> >>   relevant, because the HII RamDisk creation does not support the
> >>   allocation of RAM disks from Reserved type memory (only from
> >>   BootServicesData), so this code shouldn't apply to begin with.
> >>
> >> * Assuming some other parts of BDS register RAM disks allocated from
> >>   reserved memory, then this code becomes relevant. I *think* that
> >>   in this case, we'll be safe. Namely:
> >>
> >>   - if QEMU does not emulate an NVDIMM device, then both said SSDT
> >> (with the NVDR) will be missing, and the NFIT table will be
> >> missing too. This series recognizes this situation, and will
> >> install both itself. Fine.
> >>
> >>   - If QEMU does emulate an NVDIMM device, then NFIT and NVDR (in
> >> SSDT) will be present *before* this code should be called from
> >> BDS. (Simply because OVMF's ACPI platform driver installs QEMU's
> >> NFIT and SSDTs before the "rest of BDS" could register the RAM
> >> disk.) This should again be fine, because this code will then
> >> uninstall QEMU's NFIT, and reinstall a modified NFIT (appending
> >> further NFIT Structures to the end of QEMU's original NFIT
> >> table).
> >>
> >> * The question is what happens when a plain DXE_DRIVER module (with
> >>   a depex on the RAM disk protocol, and nothing more) registers a
> >>   RAM disk, allocated from reserved memory. Such a RAM disk
> >>   registration could occur way before OVMF's ACPI platform driver
> >>   gets a chance to download QEMU's NVDIMM-related tables (NFIT and
> >>   SSDT). At the moment this is a theoretical question only (OVMF
> >>   doesn't include such a DXE_DRIVER), but I think we should
> >>   investigate it a little.
> >>
> >
> > This issue was also raised during our internal discussions.
> >
> > Some OS will require the NVDIMM root device to be present to map the RAM
> > disk memory to a block 

Re: [edk2] [Patch] ShellPkg: Enhance ping6 to select the interface automatically

2016-04-21 Thread Wu, Jiaxin
Hello Bhupesh,

Can you also help to verify the ping6 command for the same case as ping?

Thanks and Best Regards!
Jiaxin

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Jiaxin Wu
> Sent: Friday, April 22, 2016 10:57 AM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben ; Ye, Ting ;
> Fu, Siyuan 
> Subject: [edk2] [Patch] ShellPkg: Enhance ping6 to select the interface
> automatically
> 
> This patch is used to support no source IP specified case while multiple NICs
> existed in the platform. The command will select the first both connected
> and configured interface automatically.
> 
> Cc: Bhupesh Sharma 
> Cc: Jaben Carsey 
> Cc: Ye Ting 
> Cc: Fu Siyuan 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiaxin Wu 
> ---
>  .../Library/UefiShellNetwork2CommandsLib/Ping6.c   | 166 --
> ---
>  1 file changed, 95 insertions(+), 71 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c
> b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c
> index af7d08f..f129612 100644
> --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c
> +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c
> @@ -661,22 +661,26 @@ Ping6CreateIpInstance (  {
>EFI_STATUS   Status;
>UINTNHandleIndex;
>UINTNHandleNum;
>EFI_HANDLE   *HandleBuffer;
> +  BOOLEAN  UnspecifiedSrc;
> +  BOOLEAN  MediaPresent;
>EFI_SERVICE_BINDING_PROTOCOL *Ip6Sb;
>EFI_IP6_CONFIG_PROTOCOL  *Ip6Cfg;
>EFI_IP6_CONFIG_DATA  Ip6Config;
>EFI_IP6_CONFIG_INTERFACE_INFO*IfInfo;
>UINTNIfInfoSize;
>EFI_IPv6_ADDRESS *Addr;
>UINTNAddrIndex;
> 
> -  HandleBuffer = NULL;
> -  Ip6Sb= NULL;
> -  IfInfo   = NULL;
> -  IfInfoSize   = 0;
> +  HandleBuffer  = NULL;
> +  UnspecifiedSrc= FALSE;
> +  MediaPresent  = TRUE;
> +  Ip6Sb = NULL;
> +  IfInfo= NULL;
> +  IfInfoSize= 0;
> 
>//
>// Locate all the handles with ip6 service binding protocol.
>//
>Status = gBS->LocateHandleBuffer (
> @@ -687,115 +691,135 @@ Ping6CreateIpInstance (
>
>);
>if (EFI_ERROR (Status) || (HandleNum == 0)) {
>  return EFI_ABORTED;
>}
> +
> +  if (NetIp6IsUnspecifiedAddr (>SrcAddress)) {
> +//
> +// SrcAddress is unspecified. So, both connected and configured interface
> will be automatic selected.
> +//
> +UnspecifiedSrc = TRUE;
> +  }
> +
>//
>// Source address is required when pinging a link-local address on multi-
>// interfaces host.
>//
>if (NetIp6IsLinkLocalAddr (>DstAddress) &&
> -  NetIp6IsUnspecifiedAddr (>SrcAddress) &&
> -  (HandleNum > 1)) {
> +  UnspecifiedSrc && (HandleNum > 1)) {
>  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_PING6_INVALID_SOURCE), gShellNetwork2HiiHandle);
>  Status = EFI_INVALID_PARAMETER;
>  goto ON_ERROR;
>}
> +
>//
>// For each ip6 protocol, check interface addresses list.
>//
>for (HandleIndex = 0; HandleIndex < HandleNum; HandleIndex++) {
> 
>  Ip6Sb  = NULL;
>  IfInfo = NULL;
>  IfInfoSize = 0;
> 
> +if (UnspecifiedSrc) {
> +  //
> +  // Check media.
> +  //
> +  NetLibDetectMedia (HandleBuffer[HandleIndex], );
> +  if (!MediaPresent) {
> +//
> +// Skip this one.
> +//
> +continue;
> +  }
> +}
> +
>  Status = gBS->HandleProtocol (
>  HandleBuffer[HandleIndex],
>  ,
>  (VOID **) 
>  );
>  if (EFI_ERROR (Status)) {
>goto ON_ERROR;
>  }
> 
> -if (NetIp6IsUnspecifiedAddr (>SrcAddress)) {
> -  //
> -  // No need to match interface address.
> -  //
> -  break;
> -} else {
> -  //
> -  // Ip6config protocol and ip6 service binding protocol are installed
> -  // on the same handle.
> -  //
> -  Status = gBS->HandleProtocol (
> -  HandleBuffer[HandleIndex],
> -  ,
> -  (VOID **) 
> -  );
> +//
> +// Ip6config protocol and ip6 service binding protocol are installed
> +// on the same handle.
> +//
> +Status = gBS->HandleProtocol (
> +HandleBuffer[HandleIndex],
> +,
> +(VOID **) 
> +);
> 
> -  if (EFI_ERROR (Status)) {
> -goto ON_ERROR;
> -  }
> -  //
> -  

[edk2] [Patch] ShellPkg: Enhance ping6 to select the interface automatically

2016-04-21 Thread Jiaxin Wu
This patch is used to support no source IP specified case while
multiple NICs existed in the platform. The command will select the
first both connected and configured interface automatically.

Cc: Bhupesh Sharma 
Cc: Jaben Carsey 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 
---
 .../Library/UefiShellNetwork2CommandsLib/Ping6.c   | 166 -
 1 file changed, 95 insertions(+), 71 deletions(-)

diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c 
b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c
index af7d08f..f129612 100644
--- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c
+++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c
@@ -661,22 +661,26 @@ Ping6CreateIpInstance (
 {
   EFI_STATUS   Status;
   UINTNHandleIndex;
   UINTNHandleNum;
   EFI_HANDLE   *HandleBuffer;
+  BOOLEAN  UnspecifiedSrc;
+  BOOLEAN  MediaPresent;
   EFI_SERVICE_BINDING_PROTOCOL *Ip6Sb;
   EFI_IP6_CONFIG_PROTOCOL  *Ip6Cfg;
   EFI_IP6_CONFIG_DATA  Ip6Config;
   EFI_IP6_CONFIG_INTERFACE_INFO*IfInfo;
   UINTNIfInfoSize;
   EFI_IPv6_ADDRESS *Addr;
   UINTNAddrIndex;
 
-  HandleBuffer = NULL;
-  Ip6Sb= NULL;
-  IfInfo   = NULL;
-  IfInfoSize   = 0;
+  HandleBuffer  = NULL;
+  UnspecifiedSrc= FALSE;
+  MediaPresent  = TRUE;
+  Ip6Sb = NULL;
+  IfInfo= NULL;
+  IfInfoSize= 0;
 
   //
   // Locate all the handles with ip6 service binding protocol.
   //
   Status = gBS->LocateHandleBuffer (
@@ -687,115 +691,135 @@ Ping6CreateIpInstance (
   
   );
   if (EFI_ERROR (Status) || (HandleNum == 0)) {
 return EFI_ABORTED;
   }
+
+  if (NetIp6IsUnspecifiedAddr (>SrcAddress)) {
+//
+// SrcAddress is unspecified. So, both connected and configured interface 
will be automatic selected. 
+//
+UnspecifiedSrc = TRUE;
+  }
+  
   //
   // Source address is required when pinging a link-local address on multi-
   // interfaces host.
   //
   if (NetIp6IsLinkLocalAddr (>DstAddress) &&
-  NetIp6IsUnspecifiedAddr (>SrcAddress) &&
-  (HandleNum > 1)) {
+  UnspecifiedSrc && (HandleNum > 1)) {
 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_INVALID_SOURCE), 
gShellNetwork2HiiHandle);
 Status = EFI_INVALID_PARAMETER;
 goto ON_ERROR;
   }
+  
   //
   // For each ip6 protocol, check interface addresses list.
   //
   for (HandleIndex = 0; HandleIndex < HandleNum; HandleIndex++) {
 
 Ip6Sb  = NULL;
 IfInfo = NULL;
 IfInfoSize = 0;
 
+if (UnspecifiedSrc) {
+  //
+  // Check media.
+  //
+  NetLibDetectMedia (HandleBuffer[HandleIndex], );
+  if (!MediaPresent) {
+//
+// Skip this one.
+//
+continue;
+  }
+}
+
 Status = gBS->HandleProtocol (
 HandleBuffer[HandleIndex],
 ,
 (VOID **) 
 );
 if (EFI_ERROR (Status)) {
   goto ON_ERROR;
 }
 
-if (NetIp6IsUnspecifiedAddr (>SrcAddress)) {
-  //
-  // No need to match interface address.
-  //
-  break;
-} else {
-  //
-  // Ip6config protocol and ip6 service binding protocol are installed
-  // on the same handle.
-  //
-  Status = gBS->HandleProtocol (
-  HandleBuffer[HandleIndex],
-  ,
-  (VOID **) 
-  );
+//
+// Ip6config protocol and ip6 service binding protocol are installed
+// on the same handle.
+//
+Status = gBS->HandleProtocol (
+HandleBuffer[HandleIndex],
+,
+(VOID **) 
+);
 
-  if (EFI_ERROR (Status)) {
-goto ON_ERROR;
-  }
-  //
-  // Get the interface information size.
-  //
-  Status = Ip6Cfg->GetData (
- Ip6Cfg,
- Ip6ConfigDataTypeInterfaceInfo,
- ,
- NULL
- );
-
-  if (Status != EFI_BUFFER_TOO_SMALL) {
-ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_PING6_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status);
-goto ON_ERROR;
-  }
+if (EFI_ERROR (Status)) {
+  goto ON_ERROR;
+}
+//
+// Get the interface information size.
+//
+Status = Ip6Cfg->GetData (
+   Ip6Cfg,
+   Ip6ConfigDataTypeInterfaceInfo,
+   ,
+   NULL
+   

[edk2] [PATCH] MdePkg: Add WSMT definition.

2016-04-21 Thread Jiewen Yao
This patch adds Windows SMM Security Mitigation
Table @ 
http://download.microsoft.com/download/1/8/A/18A21244-EB67-4538-BAA2-1A54E0E490B6/WSMT.docx

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" 
Cc: "Gao, Liming" 
Cc: "Kinney, Michael D" 
---
 .../WindowsSmmSecurityMitigationTable.h| 39 ++
 1 file changed, 39 insertions(+)
 create mode 100644 
MdePkg/Include/IndustryStandard/WindowsSmmSecurityMitigationTable.h

diff --git 
a/MdePkg/Include/IndustryStandard/WindowsSmmSecurityMitigationTable.h 
b/MdePkg/Include/IndustryStandard/WindowsSmmSecurityMitigationTable.h
new file mode 100644
index 000..bfbcf81
--- /dev/null
+++ b/MdePkg/Include/IndustryStandard/WindowsSmmSecurityMitigationTable.h
@@ -0,0 +1,39 @@
+/** @file
+  Defines Windows SMM Security Mitigation Table
+  @ 
http://download.microsoft.com/download/1/8/A/18A21244-EB67-4538-BAA2-1A54E0E490B6/WSMT.docx
+
+  Copyright (c) 2016, Intel Corporation. All rights reserved.
+  This program and the accompanying materials 
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+
+#ifndef _WINDOWS_SMM_SECURITY_MITIGATION_TABLE_H_
+#define _WINDOWS_SMM_SECURITY_MITIGATION_TABLE_H_
+
+#include 
+
+#define EFI_ACPI_WINDOWS_SMM_SECURITY_MITIGATION_TABLE_SIGNATURE  
SIGNATURE_32('W', 'S', 'M', 'T')
+
+#pragma pack(1)
+
+#define EFI_WSMT_TABLE_REVISION  1
+
+typedef struct {
+  EFI_ACPI_DESCRIPTION_HEADER Header;
+  UINT32  ProtectionFlags;
+} EFI_ACPI_WSMT_TABLE;
+
+#define EFI_WSMT_PROTECTION_FLAGS_FIXED_COMM_BUFFERS   0x1
+#define EFI_WSMT_PROTECTION_FLAGS_COMM_BUFFER_NESTED_PTR_PROTECTION0x2
+#define EFI_WSMT_PROTECTION_FLAGS_SYSTEM_RESOURCE_PROTECTION   0x4
+
+#pragma pack()
+
+#endif
-- 
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] ShellPkg: Fix pci command for '_e' option

2016-04-21 Thread Qiu, Shumin
Reviewed-by: Qiu Shumin 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Abdul 
Lateef Attar
Sent: Thursday, April 21, 2016 7:24 PM
To: Carsey, Jaben; Ni, Ruiyu; Qiu, Shumin; edk2-devel@lists.01.org
Cc: mohan_parthasara...@hpe.com; sunil...@hpe.com
Subject: [edk2] [PATCH] ShellPkg: Fix pci command for '_e' option

ShellPkg: Fix pci command for '_e' option

Processing of '_e' argument was missing.
Added fix, to process the '_e' option
for printing additional AER information.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Abdul Lateef Attar 
---
 ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
index 4a8a97b..337495e 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
@@ -2370,6 +2370,7 @@ PCI_CONFIG_SPACE  *mConfigSpace = NULL;  STATIC CONST 
SHELL_PARAM_ITEM ParamList[] = {
   {L"-s", TypeValue},
   {L"-i", TypeFlag},
+  {L"-_e", TypeFlag},
   {NULL, TypeMax}
   };
 
--
1.9.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] ShellPkg: Enhance ping to select the interface automatically

2016-04-21 Thread Bhupesh Sharma
Hello Jiaxin,

Sorry for the delay in reply - I was on holidays.

I will check this patch at my end and will soon get back with the results.

Regards,
Bhupesh

> -Original Message-
> From: Wu, Jiaxin [mailto:jiaxin...@intel.com]
> Sent: Thursday, April 21, 2016 7:35 AM
> To: Bhupesh Sharma ; Carsey, Jaben
> ; edk2-devel@lists.01.org
> Cc: David Van Arnem ; Ye, Ting
> ; Fu, Siyuan 
> Subject: RE: [Patch] ShellPkg: Enhance ping to select the interface
> automatically
> 
> Hello Bhupesh,
> 
> Any test result or feedback for this patch?
> 
> Thanks.
> Jiaxin
> 
> > -Original Message-
> > From: Carsey, Jaben
> > Sent: Wednesday, April 20, 2016 1:10 AM
> > To: Wu, Jiaxin ; edk2-devel@lists.01.org
> > Cc: David Van Arnem ; Bhupesh Sharma
> > ; Ye, Ting ; Fu, Siyuan
> > ; Carsey, Jaben 
> > Subject: RE: [Patch] ShellPkg: Enhance ping to select the interface
> > automatically
> >
> > Reviewed-by: Jaben Carsey 
> >
> >
> >
> > > -Original Message-
> > > From: Wu, Jiaxin
> > > Sent: Monday, April 18, 2016 6:52 PM
> > > To: edk2-devel@lists.01.org
> > > Cc: David Van Arnem ; Bhupesh Sharma
> > > ; Carsey, Jaben ;
> > Ye,
> > > Ting ; Fu, Siyuan 
> > > Subject: [Patch] ShellPkg: Enhance ping to select the interface
> > > automatically
> > > Importance: High
> > >
> > > This patch is used to support no source IP specified case while
> > > multiple NICs existed in the platform. The command will select the
> > > first both connected and configured interface automatically.
> > >
> > > Cc: David Van Arnem 
> > > Cc: Bhupesh Sharma 
> > > Cc: Jaben Carsey 
> > > Cc: Ye Ting 
> > > Cc: Fu Siyuan 
> > > Contributed-under: TianoCore Contribution Agreement 1.0
> > > Signed-off-by: Jiaxin Wu 
> > > ---
> > >  .../Library/UefiShellNetwork1CommandsLib/Ping.c| 224
> -
> > ---
> > > -
> > >  1 file changed, 127 insertions(+), 97 deletions(-)
> > >
> > > diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c
> > > b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c
> > > index 13bcdde..6b05884 100644
> > > --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c
> > > +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c
> > > @@ -874,20 +874,24 @@ PingCreateIpInstance (  {
> > >EFI_STATUS   Status;
> > >UINTNHandleIndex;
> > >UINTNHandleNum;
> > >EFI_HANDLE   *HandleBuffer;
> > > +  BOOLEAN  UnspecifiedSrc;
> > > +  BOOLEAN  MediaPresent;
> > >EFI_SERVICE_BINDING_PROTOCOL *EfiSb;
> > >VOID *IpXCfg;
> > >EFI_IP6_CONFIG_DATA  Ip6Config;
> > >EFI_IP4_CONFIG_DATA  Ip4Config;
> > >VOID *IpXInterfaceInfo;
> > >UINTNIfInfoSize;
> > >EFI_IPv6_ADDRESS *Addr;
> > >UINTNAddrIndex;
> > >
> > >HandleBuffer  = NULL;
> > > +  UnspecifiedSrc= FALSE;
> > > +  MediaPresent  = TRUE;
> > >EfiSb = NULL;
> > >IpXInterfaceInfo  = NULL;
> > >IfInfoSize= 0;
> > >
> > >//
> > > @@ -923,139 +927,165 @@ PingCreateIpInstance (
> > >ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> > > (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", mSrcString);
> > >Status = EFI_INVALID_PARAMETER;
> > >goto ON_ERROR;
> > >  }
> > >}
> > > +
> > > +  if (Private->IpChoice == PING_IP_CHOICE_IP6 ?
> > > + NetIp6IsUnspecifiedAddr
> > > ((EFI_IPv6_ADDRESS*)>SrcAddress) : \
> > > +  PingNetIp4IsUnspecifiedAddr ((EFI_IPv4_ADDRESS*)
> > > >SrcAddress)) {
> > > +//
> > > +// SrcAddress is unspecified. So, both connected and
> configured
> > > + interface
> > > will be automatic selected.
> > > +//
> > > +UnspecifiedSrc = TRUE;
> > > +  }
> > > +
> > >//
> > >// For each ip6 protocol, check interface addresses list.
> > >//
> > >for (HandleIndex = 0; HandleIndex < HandleNum; HandleIndex++) {
> > > -
> > >  EfiSb = NULL;
> > >  IpXInterfaceInfo  = NULL;
> > >  IfInfoSize= 0;
> > >
> > > +if (UnspecifiedSrc) {
> > > +  //
> > > +  // Check media.
> > > +  //
> > > +  NetLibDetectMedia (HandleBuffer[HandleIndex],
> );
> > > +  if (!MediaPresent) {
> > > +//
> > > +// Skip this one.
> > > +//
> 

Re: [edk2] [PATCH] ShellPkg: Fix pci command for '_e' option

2016-04-21 Thread Carsey, Jaben
Looks good to me.
I will let Shumin or Ray review also.
Reviewed-by: Jaben Carsey 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Abdul Lateef Attar
> Sent: Thursday, April 21, 2016 4:24 AM
> To: Carsey, Jaben ; Ni, Ruiyu ;
> Qiu, Shumin ; edk2-devel@lists.01.org
> Cc: mohan_parthasara...@hpe.com; sunil...@hpe.com
> Subject: [edk2] [PATCH] ShellPkg: Fix pci command for '_e' option
> Importance: High
> 
> ShellPkg: Fix pci command for '_e' option
> 
> Processing of '_e' argument was missing.
> Added fix, to process the '_e' option
> for printing additional AER information.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Abdul Lateef Attar 
> ---
>  ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> index 4a8a97b..337495e 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> @@ -2370,6 +2370,7 @@ PCI_CONFIG_SPACE  *mConfigSpace = NULL;
>  STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
>{L"-s", TypeValue},
>{L"-i", TypeFlag},
> +  {L"-_e", TypeFlag},
>{NULL, TypeMax}
>};
> 
> --
> 1.9.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] ShellPkg: Fix pci command for '_e' option

2016-04-21 Thread Abdul Lateef Attar
ShellPkg: Fix pci command for '_e' option

Processing of '_e' argument was missing.
Added fix, to process the '_e' option
for printing additional AER information.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Abdul Lateef Attar 
---
 ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
index 4a8a97b..337495e 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
@@ -2370,6 +2370,7 @@ PCI_CONFIG_SPACE  *mConfigSpace = NULL;
 STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
   {L"-s", TypeValue},
   {L"-i", TypeFlag},
+  {L"-_e", TypeFlag},
   {NULL, TypeMax}
   };
 
-- 
1.9.1

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


Re: [edk2] facing memory allocation failure on QEMU

2016-04-21 Thread Ard Biesheuvel

> On 21 apr. 2016, at 13:11, Meenakshi Aggarwal  
> wrote:
> 
> Hi Ard,
> 
> Thanks for your quick reply.
> 
> 
> I took the latest image from linaro site
> 
> http://releases.linaro.org/14.08/openembedded/aarch64/vexpress64-openembedded_minimal-armv8-gcc-4.9_20140823-686.img.gz
> 
> 
> run following commands on image:
> 
> zcat vexpress64-openembedded_minimal-armv8-gcc-4.9_20140823-686.img.gz > 
> vexpress64-oe.img
> sudo mount -o loop,offset=32256 vexpress64-oe.img /mnt
> cd /mnt
> sync
> sudo umount /mnt
> 
> 
> Signed this image and try to load Image.signed, but I face similar error on 
> loading signed kernel image.
> 
> 
> Please point me to the correct kernel image if mentioned image is not a valid 
> one.
> 

As I said, you need to build a kernel from more recent sources. Surely, you 
should be able to find some instructions online if you don't know how to do 
that.

> Also, I am following the below mentioned wiki page:
> https://wiki.linaro.org/LEG/UEFIforQEMU
> 
> 
> Here, flow of shim->grub->kernel is not mentioned, so I am trying to load 
> kernel directly from shell using below command:
> 
> Image.signed root=/dev/vda2 console=ttyAMA0,38400n8 earlycon=pl011,0x900
> 
> 
> Will this work in case of SECURE_BOOT?
> 
> 
> Thanks,
> Meenakshi
> 
> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
> Sent: Thursday, April 21, 2016 3:56 PM
> To: Meenakshi Aggarwal 
> Cc: Laszlo Ersek ; edk2-devel@lists.01.org 
> 
> Subject: Re: [edk2] facing memory allocation failure on QEMU
> 
> 
>> On 21 apr. 2016, at 12:14, Meenakshi Aggarwal  
>> wrote:
>> 
>> Hi,
>> 
>> 
>> The issue seems more like of sbsigntool.
>> 
>> I used vexpress64-oe.img image from below link:
>> http://releases.linaro.org/14.08/openembedded/aarch64/vexpress64-opene
>> mbedded_minimal-armv8-gcc-4.9_20140823-686.img.gz
>> 
>> 
>> I signed it using sbsigntool :
>> sbsign --key DB.key --cert DB.crt --output Image.signed Image
> 
> Do you mean you are signing the kernel image you took from that filesystem 
> image? In that case, this is a known issue that was solved a long time ago. 
> Please try signing a more recent kernel image.
> 
>> 
>> 
>> After that I launch QEMU and try to execute Image.signed, but its 
>> verification got failed:
>> 
>> FSOpen: Open '\Image.signed' Success
>> FSOpen: Open '\Image.signed' Success
>> FatDiskIo: Cache Page OutBound occurred! 
>> FatDiskIo: Cache Page OutBound occurred! 
>> The image doesn't pass verification: 
>> VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003E000A)/HD(1,MBR,
>> 0x,0x3F,0x21FC0)/\Image.signed
>> InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 
>> 795EC8C0 Unloading driver at 0x000 Command Error Status: 
>> Unsupported
>> 
>> 
>> 
>> So I verify its signature using sbverify, then its verification failed with 
>> following output:
>> 
>> sbverify --cert DB.crt Image.signed
>> warning: file-aligned section .text extends beyond end of file 
>> file_offset 0x160, regions[n].size 0x9e2e20, image->size 0x40c000
>> warning: checksum areas are greater than image size. Invalid section table?
>> warning: checksum areas are greater than image size. Invalid section table?
>> No signature table present
>> Signature verification failed
>> b46476@uefi-workstation:/mnt$
>> 
>> 
>> What is your opinion on this? Is this sbsign tool issue?
>> 
>> 
>> Thanks,
>> Meenakshi
>> 
>> 
>> -Original Message-
>> From: Laszlo Ersek [mailto:ler...@redhat.com]
>> Sent: Wednesday, April 20, 2016 5:16 PM
>> To: Ard Biesheuvel ; Meenakshi Aggarwal 
>> 
>> Cc: edk2-devel@lists.01.org 
>> Subject: Re: [edk2] facing memory allocation failure on QEMU
>> 
>>> On 04/20/16 09:46, Ard Biesheuvel wrote:
>>> On 20 April 2016 at 09:33, Meenakshi Aggarwal 
>>>  wrote:
 Hi,
 
 
 I am trying to load a signed image from UEFI shell using QEMU, For any 
 signed image I faced following message (snapshot taken after loading grub):
 
 FS0:\> grubaa64-signed.efi
 FSOpen: Open '\grubaa64-signed.efi' Success
 FSOpen: Open '\grubaa64-signed.efi' Success
 FSOpen: Open '\grubaa64-signed.efi' Success
 FSOpen: Open '\grubaa64-signed.efi' Success
 AllocatePoolPages: failed to allocate 497135 pages
 AllocatePool: failed to allocate 2036264128 bytes
>>> 
>>> You should try to find out where this allocation is attempted.
>>> Allocating 2 GB of pool memory is obviously not going to work
>>> 
 DxeImageVerification: MeasureVariable (Pcr - 7, EventType - 
 80E0, VariableName - db, VendorGuid - 
 D719B2CB-3D3A-4596-A3BC-DAD00E67656F)
 MeasureBootPolicyVariable - Not Found
 InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B
 795F3C00 Loading driver at 

Re: [edk2] facing memory allocation failure on QEMU

2016-04-21 Thread Meenakshi Aggarwal
Hi Ard,

Thanks for your quick reply.


I took the latest image from linaro site

http://releases.linaro.org/14.08/openembedded/aarch64/vexpress64-openembedded_minimal-armv8-gcc-4.9_20140823-686.img.gz


run following commands on image:

zcat vexpress64-openembedded_minimal-armv8-gcc-4.9_20140823-686.img.gz > 
vexpress64-oe.img
sudo mount -o loop,offset=32256 vexpress64-oe.img /mnt
cd /mnt
sync
sudo umount /mnt


Signed this image and try to load Image.signed, but I face similar error on 
loading signed kernel image.


Please point me to the correct kernel image if mentioned image is not a valid 
one.

Also, I am following the below mentioned wiki page:
https://wiki.linaro.org/LEG/UEFIforQEMU


Here, flow of shim->grub->kernel is not mentioned, so I am trying to load 
kernel directly from shell using below command:

Image.signed root=/dev/vda2 console=ttyAMA0,38400n8 earlycon=pl011,0x900


Will this work in case of SECURE_BOOT?


Thanks,
Meenakshi

-Original Message-
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
Sent: Thursday, April 21, 2016 3:56 PM
To: Meenakshi Aggarwal 
Cc: Laszlo Ersek ; edk2-devel@lists.01.org 

Subject: Re: [edk2] facing memory allocation failure on QEMU


> On 21 apr. 2016, at 12:14, Meenakshi Aggarwal  
> wrote:
> 
> Hi,
> 
> 
> The issue seems more like of sbsigntool.
> 
> I used vexpress64-oe.img image from below link:
> http://releases.linaro.org/14.08/openembedded/aarch64/vexpress64-opene
> mbedded_minimal-armv8-gcc-4.9_20140823-686.img.gz
> 
> 
> I signed it using sbsigntool :
> sbsign --key DB.key --cert DB.crt --output Image.signed Image
> 

Do you mean you are signing the kernel image you took from that filesystem 
image? In that case, this is a known issue that was solved a long time ago. 
Please try signing a more recent kernel image.

> 
> 
> After that I launch QEMU and try to execute Image.signed, but its 
> verification got failed:
> 
> FSOpen: Open '\Image.signed' Success
> FSOpen: Open '\Image.signed' Success
> FatDiskIo: Cache Page OutBound occurred! 
> FatDiskIo: Cache Page OutBound occurred! 
> The image doesn't pass verification: 
> VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003E000A)/HD(1,MBR,
> 0x,0x3F,0x21FC0)/\Image.signed
> InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 
> 795EC8C0 Unloading driver at 0x000 Command Error Status: 
> Unsupported
> 
> 
> 
> So I verify its signature using sbverify, then its verification failed with 
> following output:
> 
> sbverify --cert DB.crt Image.signed
> warning: file-aligned section .text extends beyond end of file 
> file_offset 0x160, regions[n].size 0x9e2e20, image->size 0x40c000
> warning: checksum areas are greater than image size. Invalid section table?
> warning: checksum areas are greater than image size. Invalid section table?
> No signature table present
> Signature verification failed
> b46476@uefi-workstation:/mnt$
> 
> 
> What is your opinion on this? Is this sbsign tool issue?
> 
> 
> Thanks,
> Meenakshi
> 
> 
> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Wednesday, April 20, 2016 5:16 PM
> To: Ard Biesheuvel ; Meenakshi Aggarwal 
> 
> Cc: edk2-devel@lists.01.org 
> Subject: Re: [edk2] facing memory allocation failure on QEMU
> 
>> On 04/20/16 09:46, Ard Biesheuvel wrote:
>> On 20 April 2016 at 09:33, Meenakshi Aggarwal 
>>  wrote:
>>> Hi,
>>> 
>>> 
>>> I am trying to load a signed image from UEFI shell using QEMU, For any 
>>> signed image I faced following message (snapshot taken after loading grub):
>>> 
>>> FS0:\> grubaa64-signed.efi
>>> FSOpen: Open '\grubaa64-signed.efi' Success
>>> FSOpen: Open '\grubaa64-signed.efi' Success
>>> FSOpen: Open '\grubaa64-signed.efi' Success
>>> FSOpen: Open '\grubaa64-signed.efi' Success
>>> AllocatePoolPages: failed to allocate 497135 pages
>>> AllocatePool: failed to allocate 2036264128 bytes
>> 
>> You should try to find out where this allocation is attempted.
>> Allocating 2 GB of pool memory is obviously not going to work
>> 
>>> DxeImageVerification: MeasureVariable (Pcr - 7, EventType - 
>>> 80E0, VariableName - db, VendorGuid - 
>>> D719B2CB-3D3A-4596-A3BC-DAD00E67656F)
>>> MeasureBootPolicyVariable - Not Found
>>> InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B
>>> 795F3C00 Loading driver at 0x000781A3000 EntryPoint=0x000781A3400 
>>> Loading driver at 0x000781A3000 EntryPoint=0x000781A3400
>>> InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF
>>> 795D3AD8
>>> InstallProtocolInterface: 752F3136-4E16-4FDC-A22A-E5F46812F4CA 
>>> 7EF31980
>>> 
>>> 
>>> But image gets loaded successfully after this memory allocation failure. 
>>> These memory allocation failure is coming on executing any signed image.
>>> 
>>> 
>>> 

Re: [edk2] [PATCH v2 0/2] Report ACPI NFIT for reserved memory RAM disks

2016-04-21 Thread Laszlo Ersek
On 04/21/16 07:59, Wu, Hao A wrote:
> Hi Laszlo,
> 
> Thanks for the feedbacks, comments are made below.
> 
>> -Original Message-
>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>> Laszlo Ersek
>> Sent: Wednesday, April 20, 2016 7:08 PM
>> To: Wu, Hao A
>> Cc: Tian, Feng; Xiao Guangrong; Justen, Jordan L; edk2-de...@ml01.01.org;
>> Yao, Jiewen
>> Subject: Re: [edk2] [PATCH v2 0/2] Report ACPI NFIT for reserved memory
>> RAM disks
>>
>> Hi,
>>
>> On 04/20/16 03:58, Hao Wu wrote:
>>> Changes compared with V1:
>>> 1. Instead of creating a new NFIT for each registered reserved memory
>>>RAM disk, new cotent of the NFIT is appended to the existing one.
>>>
>>> 2. Report an NVDIMM root device in the \SB scope if there is no NFIT
>>>in the ACPI table.
>>>
>>> 3. Modify FDF files in OvmfPkg to make sure the report of the NVDIMM
>>>root device will be done correctly.
>>>
>>> Hao Wu (2):
>>>   MdeModulePkg RamDiskDxe: Report ACPI NFIT for reserved memory
>> RAM
>>> disks
>>>   OvmfPkg: Modify fdf files due to RamDiskDxe driver's adding ASL code
>>>
>>>  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl |  44 ++
>>>  .../Universal/Disk/RamDiskDxe/RamDiskDxe.inf   |  12 +
>>>  .../Universal/Disk/RamDiskDxe/RamDiskImpl.h|   6 +
>>>  .../Universal/Disk/RamDiskDxe/RamDiskProtocol.c| 520
>> +
>>>  OvmfPkg/OvmfPkgIa32.fdf|  12 +-
>>>  OvmfPkg/OvmfPkgIa32X64.fdf |  12 +-
>>>  OvmfPkg/OvmfPkgX64.fdf |  12 +-
>>>  7 files changed, 615 insertions(+), 3 deletions(-)
>>>  create mode 100644
>> MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl
>>>
>>
>> I see that Jordan already commented on patch #2, so I'll leave that to
>> him :) My questions / remarks are general.
>>
>> (1) About sharing NFIT between different clients:
>>
>> QEMU can emulate an NVDIMM device (see "hw/acpi/nvdimm.c"). (I'm
>> CC'ing Xiao Guangrong who authored it.) When QEMU is instructed to
>> create an NVDIMM device, it will also generate an SSDT table with an
>> NVDR object in it, and it will generate an NFIT table too.
>>
>> OVMF's ACPI platform driver downloads the generated ACPI payload
>> from QEMU near the beginning of BDS, and installs the tables. The
>> question is how those actions are ordered against the NFIT
>> installation / manipulation in RamDiskDxe.
>>
>> * If the RAM disks are created from HII, then the question is not
>>   relevant, because the HII RamDisk creation does not support the
>>   allocation of RAM disks from Reserved type memory (only from
>>   BootServicesData), so this code shouldn't apply to begin with.
>>
>> * Assuming some other parts of BDS register RAM disks allocated from
>>   reserved memory, then this code becomes relevant. I *think* that
>>   in this case, we'll be safe. Namely:
>>
>>   - if QEMU does not emulate an NVDIMM device, then both said SSDT
>> (with the NVDR) will be missing, and the NFIT table will be
>> missing too. This series recognizes this situation, and will
>> install both itself. Fine.
>>
>>   - If QEMU does emulate an NVDIMM device, then NFIT and NVDR (in
>> SSDT) will be present *before* this code should be called from
>> BDS. (Simply because OVMF's ACPI platform driver installs QEMU's
>> NFIT and SSDTs before the "rest of BDS" could register the RAM
>> disk.) This should again be fine, because this code will then
>> uninstall QEMU's NFIT, and reinstall a modified NFIT (appending
>> further NFIT Structures to the end of QEMU's original NFIT
>> table).
>>
>> * The question is what happens when a plain DXE_DRIVER module (with
>>   a depex on the RAM disk protocol, and nothing more) registers a
>>   RAM disk, allocated from reserved memory. Such a RAM disk
>>   registration could occur way before OVMF's ACPI platform driver
>>   gets a chance to download QEMU's NVDIMM-related tables (NFIT and
>>   SSDT). At the moment this is a theoretical question only (OVMF
>>   doesn't include such a DXE_DRIVER), but I think we should
>>   investigate it a little.
>>
> 
> This issue was also raised during our internal discussions.
> 
> Some OS will require the NVDIMM root device to be present to map the RAM
> disk memory to a block device in the OS. And I think the RamDiskDxe driver
> does not know whether the NVDIMM root device will be reported by platform.
> So I choose to publish NFIT & SSDT within RamDiskDxe driver to make sure
> those reserved memory type RAM disks can be recognized correctly by OS and
> hoping platform ACPI drivers can handle this case.

Okay.

>>   Note that this problem is not specific to OVMF. On any kind of
>>   platform, you could have a DXE_DRIVER that only depends on the RAM
>>   disk protocol, and registers a reserved memory RAM 

Re: [edk2] facing memory allocation failure on QEMU

2016-04-21 Thread Ard Biesheuvel

> On 21 apr. 2016, at 12:14, Meenakshi Aggarwal  
> wrote:
> 
> Hi,
> 
> 
> The issue seems more like of sbsigntool.
> 
> I used vexpress64-oe.img image from below link:
> http://releases.linaro.org/14.08/openembedded/aarch64/vexpress64-openembedded_minimal-armv8-gcc-4.9_20140823-686.img.gz
> 
> 
> I signed it using sbsigntool :
> sbsign --key DB.key --cert DB.crt --output Image.signed Image
> 

Do you mean you are signing the kernel image you took from that filesystem 
image? In that case, this is a known issue that was solved a long time ago. 
Please try signing a more recent kernel image.

> 
> 
> After that I launch QEMU and try to execute Image.signed, but its 
> verification got failed:
> 
> FSOpen: Open '\Image.signed' Success
> FSOpen: Open '\Image.signed' Success
> FatDiskIo: Cache Page OutBound occurred! 
> FatDiskIo: Cache Page OutBound occurred! 
> The image doesn't pass verification: 
> VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003E000A)/HD(1,MBR,0x,0x3F,0x21FC0)/\Image.signed
> InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 795EC8C0
> Unloading driver at 0x000
> Command Error Status: Unsupported
> 
> 
> 
> So I verify its signature using sbverify, then its verification failed with 
> following output:
> 
> sbverify --cert DB.crt Image.signed
> warning: file-aligned section .text extends beyond end of file
> file_offset 0x160, regions[n].size 0x9e2e20, image->size 0x40c000
> warning: checksum areas are greater than image size. Invalid section table?
> warning: checksum areas are greater than image size. Invalid section table?
> No signature table present
> Signature verification failed
> b46476@uefi-workstation:/mnt$
> 
> 
> What is your opinion on this? Is this sbsign tool issue?
> 
> 
> Thanks,
> Meenakshi
> 
> 
> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com] 
> Sent: Wednesday, April 20, 2016 5:16 PM
> To: Ard Biesheuvel ; Meenakshi Aggarwal 
> 
> Cc: edk2-devel@lists.01.org 
> Subject: Re: [edk2] facing memory allocation failure on QEMU
> 
>> On 04/20/16 09:46, Ard Biesheuvel wrote:
>> On 20 April 2016 at 09:33, Meenakshi Aggarwal 
>>  wrote:
>>> Hi,
>>> 
>>> 
>>> I am trying to load a signed image from UEFI shell using QEMU, For any 
>>> signed image I faced following message (snapshot taken after loading grub):
>>> 
>>> FS0:\> grubaa64-signed.efi
>>> FSOpen: Open '\grubaa64-signed.efi' Success
>>> FSOpen: Open '\grubaa64-signed.efi' Success
>>> FSOpen: Open '\grubaa64-signed.efi' Success
>>> FSOpen: Open '\grubaa64-signed.efi' Success
>>> AllocatePoolPages: failed to allocate 497135 pages
>>> AllocatePool: failed to allocate 2036264128 bytes
>> 
>> You should try to find out where this allocation is attempted.
>> Allocating 2 GB of pool memory is obviously not going to work
>> 
>>> DxeImageVerification: MeasureVariable (Pcr - 7, EventType - 80E0, 
>>> VariableName - db, VendorGuid - D719B2CB-3D3A-4596-A3BC-DAD00E67656F)
>>> MeasureBootPolicyVariable - Not Found
>>> InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 
>>> 795F3C00 Loading driver at 0x000781A3000 EntryPoint=0x000781A3400 
>>> Loading driver at 0x000781A3000 EntryPoint=0x000781A3400
>>> InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 
>>> 795D3AD8
>>> InstallProtocolInterface: 752F3136-4E16-4FDC-A22A-E5F46812F4CA 
>>> 7EF31980
>>> 
>>> 
>>> But image gets loaded successfully after this memory allocation failure. 
>>> These memory allocation failure is coming on executing any signed image.
>>> 
>>> 
>>> I want to know the reason behind this error message. Am I missing something?
>> 
>> Try to attach GDB when you run this. You can set a breakpoint on
>> AllocatePool() to figure out the call stack that results in the bogus
>> AllocatePool() call
> 
> I think it could be a bug in the tools used for signing the image, and also a 
> bug in the LoadImage() boot service that doesn't catch bogus fields in the 
> image.
> 
> Namely, if I filter the above log snippet through my sed script that replaces 
> common GUIDs with their symbolic constants, I get:
> 
>> FS0:\> grubaa64-signed.efi
>> FSOpen: Open '\grubaa64-signed.efi' Success
>> FSOpen: Open '\grubaa64-signed.efi' Success
>> FSOpen: Open '\grubaa64-signed.efi' Success
>> FSOpen: Open '\grubaa64-signed.efi' Success
>> AllocatePoolPages: failed to allocate 497135 pages
>> AllocatePool: failed to allocate 2036264128 bytes
>> DxeImageVerification: MeasureVariable (Pcr - 7, EventType - 80E0, 
>> VariableName - db, VendorGuid - [EfiImageSecurityDatabase]) 
>> MeasureBootPolicyVariable - Not Found
>> InstallProtocolInterface: [EfiLoadedImageProtocol] 795F3C00 Loading 
>> driver at 0x000781A3000 EntryPoint=0x000781A3400 Loading driver at 
>> 0x000781A3000 EntryPoint=0x000781A3400
>> InstallProtocolInterface: 

Re: [edk2] facing memory allocation failure on QEMU

2016-04-21 Thread Meenakshi Aggarwal
Hi,


The issue seems more like of sbsigntool.

I used vexpress64-oe.img image from below link:
http://releases.linaro.org/14.08/openembedded/aarch64/vexpress64-openembedded_minimal-armv8-gcc-4.9_20140823-686.img.gz


I signed it using sbsigntool :
sbsign --key DB.key --cert DB.crt --output Image.signed Image



After that I launch QEMU and try to execute Image.signed, but its verification 
got failed:

FSOpen: Open '\Image.signed' Success
FSOpen: Open '\Image.signed' Success
FatDiskIo: Cache Page OutBound occurred! 
FatDiskIo: Cache Page OutBound occurred! 
The image doesn't pass verification: 
VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003E000A)/HD(1,MBR,0x,0x3F,0x21FC0)/\Image.signed
InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 795EC8C0
Unloading driver at 0x000
Command Error Status: Unsupported



So I verify its signature using sbverify, then its verification failed with 
following output:

sbverify --cert DB.crt Image.signed
warning: file-aligned section .text extends beyond end of file
 file_offset 0x160, regions[n].size 0x9e2e20, image->size 0x40c000
warning: checksum areas are greater than image size. Invalid section table?
warning: checksum areas are greater than image size. Invalid section table?
No signature table present
Signature verification failed
b46476@uefi-workstation:/mnt$


What is your opinion on this? Is this sbsign tool issue?


Thanks,
Meenakshi


-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Wednesday, April 20, 2016 5:16 PM
To: Ard Biesheuvel ; Meenakshi Aggarwal 

Cc: edk2-devel@lists.01.org 
Subject: Re: [edk2] facing memory allocation failure on QEMU

On 04/20/16 09:46, Ard Biesheuvel wrote:
> On 20 April 2016 at 09:33, Meenakshi Aggarwal 
>  wrote:
>> Hi,
>>
>>
>> I am trying to load a signed image from UEFI shell using QEMU, For any 
>> signed image I faced following message (snapshot taken after loading grub):
>>
>> FS0:\> grubaa64-signed.efi
>> FSOpen: Open '\grubaa64-signed.efi' Success
>> FSOpen: Open '\grubaa64-signed.efi' Success
>> FSOpen: Open '\grubaa64-signed.efi' Success
>> FSOpen: Open '\grubaa64-signed.efi' Success
>> AllocatePoolPages: failed to allocate 497135 pages
>> AllocatePool: failed to allocate 2036264128 bytes
> 
> You should try to find out where this allocation is attempted.
> Allocating 2 GB of pool memory is obviously not going to work
> 
>> DxeImageVerification: MeasureVariable (Pcr - 7, EventType - 80E0, 
>> VariableName - db, VendorGuid - D719B2CB-3D3A-4596-A3BC-DAD00E67656F)
>> MeasureBootPolicyVariable - Not Found
>> InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 
>> 795F3C00 Loading driver at 0x000781A3000 EntryPoint=0x000781A3400 
>> Loading driver at 0x000781A3000 EntryPoint=0x000781A3400
>> InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 
>> 795D3AD8
>> InstallProtocolInterface: 752F3136-4E16-4FDC-A22A-E5F46812F4CA 
>> 7EF31980
>>
>>
>> But image gets loaded successfully after this memory allocation failure. 
>> These memory allocation failure is coming on executing any signed image.
>>
>>
>> I want to know the reason behind this error message. Am I missing something?
>>
> 
> Try to attach GDB when you run this. You can set a breakpoint on
> AllocatePool() to figure out the call stack that results in the bogus
> AllocatePool() call

I think it could be a bug in the tools used for signing the image, and also a 
bug in the LoadImage() boot service that doesn't catch bogus fields in the 
image.

Namely, if I filter the above log snippet through my sed script that replaces 
common GUIDs with their symbolic constants, I get:

> FS0:\> grubaa64-signed.efi
> FSOpen: Open '\grubaa64-signed.efi' Success
> FSOpen: Open '\grubaa64-signed.efi' Success
> FSOpen: Open '\grubaa64-signed.efi' Success
> FSOpen: Open '\grubaa64-signed.efi' Success
> AllocatePoolPages: failed to allocate 497135 pages
> AllocatePool: failed to allocate 2036264128 bytes
> DxeImageVerification: MeasureVariable (Pcr - 7, EventType - 80E0, 
> VariableName - db, VendorGuid - [EfiImageSecurityDatabase]) 
> MeasureBootPolicyVariable - Not Found
> InstallProtocolInterface: [EfiLoadedImageProtocol] 795F3C00 Loading 
> driver at 0x000781A3000 EntryPoint=0x000781A3400 Loading driver at 
> 0x000781A3000 EntryPoint=0x000781A3400
> InstallProtocolInterface: [EfiLoadedImageDevicePathProtocol] 795D3AD8
> InstallProtocolInterface: [EfiShellParametersProtocol] 7EF31980

Note how the error messages are printed after the FAT driver logs the opening 
of the signed binary, but before EfiLoadedImageProtocol is installed.

Actually, the error messages are printed even before the "DxeImageVerification: 
MeasureVariable ..." message.

That latter message comes from the following call path, in my opinion:

CoreLoadImageCommon()  

Re: [edk2] [Patch v3 21/23] OvmfPkg/PlatformBds: Add EnableQuietBoot and DisableQuietBoot

2016-04-21 Thread Ni, Ruiyu
Got you.
I will send the v4 to correct the OEMBadging.h issue,
after collecting all comments for the v3 series.

Regards,
Ray

From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Gary Lin
Sent: Thursday, April 21, 2016 4:42 PM
To: Ni, Ruiyu 
Cc: Justen, Jordan L ; edk2-devel@lists.01.org; 
Laszlo Ersek 
Subject: Re: [edk2] [Patch v3 21/23] OvmfPkg/PlatformBds: Add EnableQuietBoot 
and DisableQuietBoot

On Thu, Apr 21, 2016 at 02:58:11PM +0800, Ruiyu Ni wrote:
> EnableQuietBoot and DisableQuietBoot are copied from
> IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c.
> Because these two functions are not in UefiBootManagerLib.
>
I encountered the similar build errors to the previous patches.
Protocol/OemBadging.h has to be Protocol/OEMBadging.h
DisableQuietBoot() in BdsPlatform.h has unnecessary EFIAPI.

After fixing those two minor issues, this series works for me.

Tested-by Gary Lin >

> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ruiyu Ni >
> Cc: Jordan Justen 
> >
> Cc: Laszlo Ersek >
> ---
>  .../Library/PlatformBootManagerLib/BdsPlatform.h   |  33 +
>  .../PlatformBootManagerLib.inf |   3 +
>  OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c | 668 
> +
>  3 files changed, 704 insertions(+)
>  create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c
>
> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
> b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
> index 3d05999..8c17297 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 
> @@ -257,4 +262,32 @@ 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
> +EFIAPI
> +DisableQuietBoot (
> +  VOID
> +  );
> +
>  #endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
> diff --git 
> a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
> b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
> index edf8f14..3a427b3 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]
> @@ -60,6 +61,7 @@ [Pcd]
>gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable
>gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
>gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
> +  gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport   ## CONSUMES
>gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile
>
>  [Pcd.IA32, Pcd.X64]
> @@ -70,6 +72,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..5beb1ab
> --- /dev/null
> +++ b/OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c
> @@ -0,0 +1,668 @@
> +/** @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 
> 

Re: [edk2] [Patch v3 21/23] OvmfPkg/PlatformBds: Add EnableQuietBoot and DisableQuietBoot

2016-04-21 Thread Gary Lin
On Thu, Apr 21, 2016 at 02:58:11PM +0800, Ruiyu Ni wrote:
> EnableQuietBoot and DisableQuietBoot are copied from
> IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c.
> Because these two functions are not in UefiBootManagerLib.
> 
I encountered the similar build errors to the previous patches.
Protocol/OemBadging.h has to be Protocol/OEMBadging.h
DisableQuietBoot() in BdsPlatform.h has unnecessary EFIAPI.

After fixing those two minor issues, this series works for me.

Tested-by Gary Lin 

> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ruiyu Ni 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> ---
>  .../Library/PlatformBootManagerLib/BdsPlatform.h   |  33 +
>  .../PlatformBootManagerLib.inf |   3 +
>  OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c | 668 
> +
>  3 files changed, 704 insertions(+)
>  create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c
> 
> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
> b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
> index 3d05999..8c17297 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 
> @@ -257,4 +262,32 @@ 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
> +EFIAPI
> +DisableQuietBoot (
> +  VOID
> +  );
> +
>  #endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
> diff --git 
> a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
> b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
> index edf8f14..3a427b3 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]
> @@ -60,6 +61,7 @@ [Pcd]
>gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable
>gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
>gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
> +  gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport   ## CONSUMES
>gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile
>  
>  [Pcd.IA32, Pcd.X64]
> @@ -70,6 +72,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..5beb1ab
> --- /dev/null
> +++ b/OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c
> @@ -0,0 +1,668 @@
> +/** @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 

Re: [edk2] [patch 3/4] MdeModulePkg/EmmcDxe: Fix wrong typo on function comments

2016-04-21 Thread Qiu, Shumin
Reviewed-by: Qiu Shumin 

-Original Message-
From: Tian, Feng 
Sent: Thursday, April 21, 2016 4:31 PM
To: edk2-devel@lists.01.org
Cc: Qiu, Shumin
Subject: [patch 3/4] MdeModulePkg/EmmcDxe: Fix wrong typo on function comments

Cc: Qiu Shumin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian 
---
 MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c | 1 +  
MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c 
b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c
index b88d55d..2dd2981 100644
--- a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c
+++ b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c
@@ -492,6 +492,7 @@ Error:
 
   @param[in]  Private The EMMC driver private data structure.
   @param[in]  SlotThe slot number to check device present.
+  @param[in]  RemainingDevicePath The pointer to the remaining device path.
 
   @retval EFI_SUCCESS Successfully to discover the device and 
attach
   SdMmcIoProtocol to it.
diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h 
b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h
index a463e34..0c50d62 100644
--- a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h
+++ b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h
@@ -4,7 +4,7 @@
   This file defines common data structures, macro definitions and some module
   internal function header files.
 
-  Copyright (c) 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2015 - 2016, Intel Corporation. All rights 
+ reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at @@ -460,7 +460,7 @@ EmmcGetCsd (
 
   @param[in]  DeviceA pointer to the EMMC_DEVICE instance.
   @param[in]  Rca   The relative device address to use.
-  @param[out] Csd   The buffer to store the EMMC_CSD register data.
+  @param[out] Cid   The buffer to store the EMMC_CID register data.
 
   @retval EFI_SUCCESS   The request is executed successfully.
   @retval EFI_OUT_OF_RESOURCES  The request could not be executed due to a 
lack of resources.
--
2.7.1.windows.2

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


Re: [edk2] [patch 4/4] MdeModulePkg/EmmcDxe: Fix wrong coding style on close brace

2016-04-21 Thread Qiu, Shumin
Reviewed-by: Qiu Shumin 

-Original Message-
From: Tian, Feng 
Sent: Thursday, April 21, 2016 4:31 PM
To: edk2-devel@lists.01.org
Cc: Qiu, Shumin
Subject: [patch 4/4] MdeModulePkg/EmmcDxe: Fix wrong coding style on close brace

The close brace of EmmcDxeComponentNameGetControllerName should be at the 
beginning of a line.

Cc: Qiu Shumin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian 
---
 MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c 
b/MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c
index c9e9d08..c6545b6 100644
--- a/MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c
+++ b/MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c
@@ -1,7 +1,7 @@
 /** @file
   UEFI Component Name(2) protocol implementation for EmmcDxe driver.
 
-  Copyright (c) 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2015 - 2016, Intel Corporation. All rights 
+ reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at @@ -237,5 +237,6 @@ EmmcDxeComponentNameGetControllerName (
ControllerNameTable,
ControllerName,
(BOOLEAN)(This == )
-   );}
+   );
+}
 
--
2.7.1.windows.2

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


Re: [edk2] [patch 1/4] MdeModulePkg/MdeModulePkg.uni: Add SD related PCD description

2016-04-21 Thread Qiu, Shumin
Reviewed-by: Qiu Shumin 

-Original Message-
From: Tian, Feng 
Sent: Thursday, April 21, 2016 4:31 PM
To: edk2-devel@lists.01.org
Cc: Qiu, Shumin
Subject: [patch 1/4] MdeModulePkg/MdeModulePkg.uni: Add SD related PCD 
description

Cc: Shumin Qiu 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian 
---
 MdeModulePkg/MdeModulePkg.uni | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni 
index 64b404f..346f735 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -975,3 +975,6 @@

  "TRUE  - Use the optimized timing for best PS2 detection 
performance.\n"

  "FALSE - Use the normal timing to detect PS2."
 
+#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdSdMmcPciHostControllerMmioBase_PROMPT  
#language en-US "Mmio base address of pci-based SD/MMC host controller"
+
+#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdSdMmcPciHostControllerMmioBase_HELP  
#language en-US "This PCD specifies the PCI-based SD/MMC host controller mmio 
base address. Define the mmio base address of the pci-based SD/MMC host 
controller. If there are multiple SD/MMC host controllers, their mmio base 
addresses are calculated one by one from this base address."
--
2.7.1.windows.2

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


Re: [edk2] [patch 2/4] MdeModulePkg/Sd: Not explicitly compare BOOLEAN type with TRUE/FALSE

2016-04-21 Thread Qiu, Shumin
Reviewed-by: Qiu Shumin 

-Original Message-
From: Tian, Feng 
Sent: Thursday, April 21, 2016 4:31 PM
To: edk2-devel@lists.01.org
Cc: Qiu, Shumin
Subject: [patch 2/4] MdeModulePkg/Sd: Not explicitly compare BOOLEAN type with 
TRUE/FALSE

It's coding style update to follow EDKII coding style doc.

Cc: Qiu Shumin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian 
---
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c 
b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
index 31def72..b7240f2 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
@@ -162,7 +162,7 @@ ProcessAsyncTaskList (
   Link   = GetFirstNode (>Queue);
   if (!IsNull (>Queue, Link)) {
 Trb = SD_MMC_HC_TRB_FROM_THIS (Link);
-if (Private->Slot[Trb->Slot].MediaPresent == FALSE) {
+if (!Private->Slot[Trb->Slot].MediaPresent) {
   Status = EFI_NO_MEDIA;
   goto Done;
 }
@@ -244,7 +244,7 @@ SdMmcPciHcEnumerateDevice (
   for (Slot = 0; Slot < SD_MMC_HC_MAX_SLOT; Slot++) {
 if ((Private->Slot[Slot].Enable) && (Private->Slot[Slot].SlotType == 
RemovableSlot)) {
   Status = SdMmcHcCardDetect (Private->PciIo, Slot, );
-  if ((Status == EFI_MEDIA_CHANGED) && (MediaPresent == FALSE)) {
+  if ((Status == EFI_MEDIA_CHANGED) && !MediaPresent) {
 DEBUG ((EFI_D_INFO, "SdMmcPciHcEnumerateDevice: device disconnected at 
slot %d of pci %p\n", Slot, Private->PciIo));
 Private->Slot[Slot].MediaPresent = FALSE;
 //
@@ -272,7 +272,7 @@ SdMmcPciHcEnumerateDevice (
   >PassThru
   );
   }
-  if ((Status == EFI_MEDIA_CHANGED) && (MediaPresent == TRUE)) {
+  if ((Status == EFI_MEDIA_CHANGED) && MediaPresent) {
 DEBUG ((EFI_D_INFO, "SdMmcPciHcEnumerateDevice: device connected at 
slot %d of pci %p\n", Slot, Private->PciIo));
 //
 // Reset the specified slot of the SD/MMC Pci Host Controller @@ 
-622,7 +622,7 @@ SdMmcPciHcDriverBindingStart (
 Status = SdMmcHcCardDetect (PciIo, Slot, );
 if (EFI_ERROR (Status) && (Status != EFI_MEDIA_CHANGED)) {
   continue;
-} else if (MediaPresent == FALSE) {
+} else if (!MediaPresent) {
   DEBUG ((EFI_D_ERROR, "SdMmcHcCardDetect: No device attached in 
Slot[%d]!!!\n", Slot));
   continue;
 }
--
2.7.1.windows.2

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


[edk2] [patch 0/4] Fix coding style issue in SdMmc modules

2016-04-21 Thread Feng Tian
it includes:
1. Add SD related PCD description to MdeModulePkg.uni
2. Not explicitly compare BOOLEAN type with TRUE/FALSE
3. Fix typo on function comments
4. Fix wrong coding style on close brace

Feng Tian (4):
  MdeModulePkg/MdeModulePkg.uni: Add SD related PCD description
  MdeModulePkg/Sd: Not explicitly compare BOOLEAN type with TRUE/FALSE
  MdeModulePkg/EmmcDxe: Fix wrong typo on function comments
  MdeModulePkg/EmmcDxe: Fix wrong coding style on close brace

 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 8 
 MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c| 5 +++--
 MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c  | 1 +
 MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h  | 4 ++--
 MdeModulePkg/MdeModulePkg.uni  | 3 +++
 5 files changed, 13 insertions(+), 8 deletions(-)

-- 
2.7.1.windows.2

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


[edk2] [patch 3/4] MdeModulePkg/EmmcDxe: Fix wrong typo on function comments

2016-04-21 Thread Feng Tian
Cc: Qiu Shumin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian 
---
 MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c | 1 +
 MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c 
b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c
index b88d55d..2dd2981 100644
--- a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c
+++ b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c
@@ -492,6 +492,7 @@ Error:
 
   @param[in]  Private The EMMC driver private data structure.
   @param[in]  SlotThe slot number to check device present.
+  @param[in]  RemainingDevicePath The pointer to the remaining device path.
 
   @retval EFI_SUCCESS Successfully to discover the device and 
attach
   SdMmcIoProtocol to it.
diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h 
b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h
index a463e34..0c50d62 100644
--- a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h
+++ b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h
@@ -4,7 +4,7 @@
   This file defines common data structures, macro definitions and some module
   internal function header files.
 
-  Copyright (c) 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -460,7 +460,7 @@ EmmcGetCsd (
 
   @param[in]  DeviceA pointer to the EMMC_DEVICE instance.
   @param[in]  Rca   The relative device address to use.
-  @param[out] Csd   The buffer to store the EMMC_CSD register data.
+  @param[out] Cid   The buffer to store the EMMC_CID register data.
 
   @retval EFI_SUCCESS   The request is executed successfully.
   @retval EFI_OUT_OF_RESOURCES  The request could not be executed due to a 
lack of resources.
-- 
2.7.1.windows.2

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


[edk2] [patch 4/4] MdeModulePkg/EmmcDxe: Fix wrong coding style on close brace

2016-04-21 Thread Feng Tian
The close brace of EmmcDxeComponentNameGetControllerName should be
at the beginning of a line.

Cc: Qiu Shumin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian 
---
 MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c 
b/MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c
index c9e9d08..c6545b6 100644
--- a/MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c
+++ b/MdeModulePkg/Bus/Sd/EmmcDxe/ComponentName.c
@@ -1,7 +1,7 @@
 /** @file
   UEFI Component Name(2) protocol implementation for EmmcDxe driver.
 
-  Copyright (c) 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -237,5 +237,6 @@ EmmcDxeComponentNameGetControllerName (
ControllerNameTable,
ControllerName,
(BOOLEAN)(This == )
-   );}
+   );
+}
 
-- 
2.7.1.windows.2

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


Re: [edk2] [PATCH 3/3] MdeModulePkg DxeCore: Enhance MemoryAttributesTable installation

2016-04-21 Thread Yao, Jiewen
Thanks for the update.
Reviewed by: jiewen@intel.com


> -Original Message-
> From: Zeng, Star
> Sent: Thursday, April 21, 2016 3:20 PM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Gao, Liming
> ; Tian, Feng ; Ard Biesheuvel
> 
> Subject: [PATCH 3/3] MdeModulePkg DxeCore: Enhance
> MemoryAttributesTable installation
> 
> Current MemoryAttributesTable will be installed on ReadyToBoot event
> at TPL_NOTIFY level, it maybe incorrect when PcdHiiOsRuntimeSupport
> = TRUE as HiiDatabaseDxe will have runtime memory allocation for HII
> OS runtime support on and after ReadyToBoot. The issue was exposed at
> http://article.gmane.org/gmane.comp.bios.edk2.devel/10125.
> 
> To make sure the correctness of MemoryAttributesTable, this patch is
> to enhance MemoryAttributesTable installation to install
> MemoryAttributesTable on ReadyToBoot event at TPL_CALLBACK - 1 level
> to make sure it is at the last of ReadyToBoot event, and also hook
> runtime memory allocation after ReadyToBoot.
> 
> Cc: Jiewen Yao 
> Cc: Liming Gao 
> Cc: Feng Tian 
> Cc: Ard Biesheuvel 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng 
> ---
>  MdeModulePkg/Core/Dxe/DxeMain.h| 12 +++
>  MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c|  3 +
>  MdeModulePkg/Core/Dxe/Mem/Page.c   |  2 +
>  MdeModulePkg/Core/Dxe/Mem/Pool.c   |  2 +
>  MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c | 88
> ++
>  5 files changed, 92 insertions(+), 15 deletions(-)
> 
> diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h
> b/MdeModulePkg/Core/Dxe/DxeMain.h
> index edb7ff5b9fa5..82a3a9b4f2b7 100644
> --- a/MdeModulePkg/Core/Dxe/DxeMain.h
> +++ b/MdeModulePkg/Core/Dxe/DxeMain.h
> @@ -276,6 +276,8 @@ extern EFI_RUNTIME_SERVICES
> *gDxeCoreRT;
>  extern EFI_DXE_SERVICES *gDxeCoreDS;
>  extern EFI_HANDLE
> gDxeCoreImageHandle;
> 
> +extern BOOLEAN
> gMemoryMapTerminated;
> +
>  extern EFI_DECOMPRESS_PROTOCOL
> gEfiDecompress;
> 
>  extern EFI_RUNTIME_ARCH_PROTOCOL*gRuntime;
> @@ -2859,6 +2861,16 @@ CoreInitializeMemoryAttributesTable (
>);
> 
>  /**
> +  Install MemoryAttributesTable on memory allocation.
> +
> +  @param[in] MemoryType EFI memory type.
> +**/
> +VOID
> +InstallMemoryAttributesTableOnMemoryAllocation (
> +  IN EFI_MEMORY_TYPEMemoryType
> +  );
> +
> +/**
>Insert image record.
> 
>@param  RuntimeImageRuntime image information
> diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
> b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
> index 20ff02f663b2..30142f67d227 100644
> --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
> +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
> @@ -207,6 +207,7 @@ EFI_SYSTEM_TABLE  *gDxeCoreST = NULL;
>  EFI_RUNTIME_SERVICES  *gDxeCoreRT =
> 
>  EFI_HANDLEgDxeCoreImageHandle = NULL;
> 
> +BOOLEAN   gMemoryMapTerminated = FALSE;
> 
>  //
>  // EFI Decompress Protocol
> @@ -751,6 +752,8 @@ CoreExitBootServices (
>  return Status;
>}
> 
> +  gMemoryMapTerminated = TRUE;
> +
>//
>// Notify other drivers that we are exiting boot services.
>//
> diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c
> b/MdeModulePkg/Core/Dxe/Mem/Page.c
> index fa71bd87dfdc..dbdc71b59ca5 100644
> --- a/MdeModulePkg/Core/Dxe/Mem/Page.c
> +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
> @@ -1336,6 +1336,7 @@ CoreAllocatePages (
>Status = CoreInternalAllocatePages (Type, MemoryType, NumberOfPages,
> Memory);
>if (!EFI_ERROR (Status)) {
>  CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN)
> RETURN_ADDRESS (0), MemoryProfileActionAllocatePages, MemoryType,
> EFI_PAGES_TO_SIZE (NumberOfPages), (VOID *) (UINTN) *Memory);
> +InstallMemoryAttributesTableOnMemoryAllocation (MemoryType);
>}
>return Status;
>  }
> @@ -1444,6 +1445,7 @@ CoreFreePages (
>Status = CoreInternalFreePages (Memory, NumberOfPages,
> );
>if (!EFI_ERROR (Status)) {
>  CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN)
> RETURN_ADDRESS (0), MemoryProfileActionFreePages,
> (EFI_MEMORY_TYPE) 0, EFI_PAGES_TO_SIZE (NumberOfPages), (VOID *)
> (UINTN) Memory);
> +InstallMemoryAttributesTableOnMemoryAllocation (MemoryType);
>}
>return Status;
>  }
> diff --git a/MdeModulePkg/Core/Dxe/Mem/Pool.c
> b/MdeModulePkg/Core/Dxe/Mem/Pool.c
> index 5496a09cfa72..5eced88efb75 100644
> --- a/MdeModulePkg/Core/Dxe/Mem/Pool.c
> +++ b/MdeModulePkg/Core/Dxe/Mem/Pool.c
> @@ -277,6 +277,7 @@ CoreAllocatePool (
>Status = CoreInternalAllocatePool (PoolType, Size, Buffer);
>if (!EFI_ERROR (Status)) {
>  CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN)
> RETURN_ADDRESS (0), MemoryProfileActionAllocatePool, PoolType, Size,
> *Buffer);
> +

Re: [edk2] [PATCH] MdeModulePkg DxeCore: Call PeCoffExtraActionLib member after Constructor

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



> -Original Message-
> From: Zeng, Star
> Sent: Thursday, April 21, 2016 9:55 AM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Gao, Liming
> ; Tian, Feng 
> Subject: [PATCH] MdeModulePkg DxeCore: Call PeCoffExtraActionLib
> member after Constructor
> 
> Originally, the code block for "Report DXE Core image information to the
> PE/COFF
> Extra Action Library" was after ProcessLibraryConstructorList(). To fix an
> issue,
> ProcessLibraryConstructorList() was moved to be right after
> CoreInitializeGcdServices()
> at c5d5379937629f3061d08b8d9a3386a40152ca2c, but the code block was
> left.
> 
> As there maybe PeCoffExtraActionLib implementation need Constructor
> executed first,
> the patch is to move the code block for "Report DXE Core image information
> to the PE/COFF
> Extra Action Library" to be after ProcessLibraryConstructorList.
> 
> Cc: Jiewen Yao 
> Cc: Liming Gao 
> Cc: Feng Tian 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng 
> ---
>  MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 26
> +-
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
> b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
> index 20ff02f663b2..a458d6b64fee 100644
> --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
> +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
> @@ -291,19 +291,6 @@ DxeMain (
>ASSERT_EFI_ERROR (Status);
> 
>//
> -  // Report DXE Core image information to the PE/COFF Extra Action
> Library
> -  //
> -  ZeroMem (, sizeof (ImageContext));
> -  ImageContext.ImageAddress   =
> (EFI_PHYSICAL_ADDRESS)(UINTN)gDxeCoreLoadedImage->ImageBase;
> -  ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer
> ((VOID*)(UINTN)ImageContext.ImageAddress);
> -  ImageContext.SizeOfHeaders  = PeCoffGetSizeOfHeaders
> ((VOID*)(UINTN)ImageContext.ImageAddress);
> -  Status = PeCoffLoaderGetEntryPoint
> ((VOID*)(UINTN)ImageContext.ImageAddress, );
> -  if (Status == EFI_SUCCESS) {
> -ImageContext.EntryPoint =
> (EFI_PHYSICAL_ADDRESS)(UINTN)EntryPoint;
> -  }
> -  PeCoffLoaderRelocateImageExtraAction ();
> -
> -  //
>// Initialize the Global Coherency Domain Services
>//
>Status = CoreInitializeGcdServices (, MemoryBaseAddress,
> MemoryLength);
> @@ -317,6 +304,19 @@ DxeMain (
>PERF_START (NULL,"DXE", NULL, 0) ;
> 
>//
> +  // Report DXE Core image information to the PE/COFF Extra Action
> Library
> +  //
> +  ZeroMem (, sizeof (ImageContext));
> +  ImageContext.ImageAddress   =
> (EFI_PHYSICAL_ADDRESS)(UINTN)gDxeCoreLoadedImage->ImageBase;
> +  ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer
> ((VOID*)(UINTN)ImageContext.ImageAddress);
> +  ImageContext.SizeOfHeaders  = PeCoffGetSizeOfHeaders
> ((VOID*)(UINTN)ImageContext.ImageAddress);
> +  Status = PeCoffLoaderGetEntryPoint
> ((VOID*)(UINTN)ImageContext.ImageAddress, );
> +  if (Status == EFI_SUCCESS) {
> +ImageContext.EntryPoint =
> (EFI_PHYSICAL_ADDRESS)(UINTN)EntryPoint;
> +  }
> +  PeCoffLoaderRelocateImageExtraAction ();
> +
> +  //
>// Install the DXE Services Table into the EFI System Tables's
> Configuration Table
>//
>Status = CoreInstallConfigurationTable (,
> gDxeCoreDS);
> --
> 2.7.0.windows.1

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


[edk2] [PATCH 1/3] MdeModulePkg DxeCore: Fix a memory leak in InstallMemoryAttributesTable()

2016-04-21 Thread Star Zeng
Cc: Jiewen Yao 
Cc: Liming Gao 
Cc: Feng Tian 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c 
b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
index 416ed3dca846..0362212c8b0b 100644
--- a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
+++ b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
@@ -174,6 +174,8 @@ InstallMemoryAttributesTable (
 }
 MemoryMap = NEXT_MEMORY_DESCRIPTOR(MemoryMap, DescriptorSize);
   }
+  MemoryMap = MemoryMapStart;
+  FreePool (MemoryMap);
 
   Status = gBS->InstallConfigurationTable (, 
MemoryAttributesTable);
   ASSERT_EFI_ERROR (Status);
-- 
2.7.0.windows.1

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


[edk2] [PATCH 0/3] Enhance MemoryAttributesTable installation

2016-04-21 Thread Star Zeng
Current MemoryAttributesTable will be installed on ReadyToBoot event
at TPL_NOTIFY level, it maybe incorrect when PcdHiiOsRuntimeSupport
= TRUE as HiiDatabaseDxe will have runtime memory allocation for HII
OS runtime support on and after ReadyToBoot. The issue was exposed at
http://article.gmane.org/gmane.comp.bios.edk2.devel/10125.

To make sure the correctness of MemoryAttributesTable, this patch is
to enhance MemoryAttributesTable installation to install
MemoryAttributesTable on ReadyToBoot event at TPL_CALLBACK - 1 level
to make sure it is at the last of ReadyToBoot event, and also hook
runtime memory allocation after ReadyToBoot.

Cc: Jiewen Yao 
Cc: Liming Gao 
Cc: Feng Tian 
Cc: Ard Biesheuvel 

Star Zeng (3):
  MdeModulePkg DxeCore: Fix a memory leak in
InstallMemoryAttributesTable()
  MdeModulePkg DxeCore: Return memory type from internal free pool/pages
  MdeModulePkg DxeCore: Enhance MemoryAttributesTable installation

 MdeModulePkg/Core/Dxe/DxeMain.h| 61 ---
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c|  3 +
 MdeModulePkg/Core/Dxe/Mem/Imem.h   |  4 +-
 MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c|  6 +-
 MdeModulePkg/Core/Dxe/Mem/Page.c   | 15 +++-
 MdeModulePkg/Core/Dxe/Mem/Pool.c   | 23 --
 MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c | 90 ++
 7 files changed, 128 insertions(+), 74 deletions(-)

-- 
2.7.0.windows.1

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


[edk2] [PATCH 2/3] MdeModulePkg DxeCore: Return memory type from internal free pool/pages

2016-04-21 Thread Star Zeng
The following patch for MemoryAttributesTable will need the memory type.
And CoreUpdateProfile() can also use the memory type for check.

Cc: Jiewen Yao 
Cc: Liming Gao 
Cc: Feng Tian 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Core/Dxe/DxeMain.h | 49 ++---
 MdeModulePkg/Core/Dxe/Mem/Imem.h|  4 +-
 MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c |  6 +--
 MdeModulePkg/Core/Dxe/Mem/Page.c| 13 +--
 MdeModulePkg/Core/Dxe/Mem/Pool.c| 21 ---
 5 files changed, 34 insertions(+), 59 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h
index fefe5bec19d3..edb7ff5b9fa5 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.h
+++ b/MdeModulePkg/Core/Dxe/DxeMain.h
@@ -1270,33 +1270,6 @@ CoreAllocatePages (
   );
 
 /**
-  Allocates pages from the memory map.
-
-  @param  Type   The type of allocation to perform
-  @param  MemoryType The type of memory to turn the allocated pages
- into
-  @param  NumberOfPages  The number of pages to allocate
-  @param  Memory A pointer to receive the base allocated memory
- address
-
-  @return Status. On success, Memory is filled in with the base address 
allocated
-  @retval EFI_INVALID_PARAMETER  Parameters violate checking rules defined in
- spec.
-  @retval EFI_NOT_FOUND  Could not allocate pages match the 
requirement.
-  @retval EFI_OUT_OF_RESOURCES   No enough pages to allocate.
-  @retval EFI_SUCCESSPages successfully allocated.
-
-**/
-EFI_STATUS
-EFIAPI
-CoreInternalAllocatePages (
-  IN EFI_ALLOCATE_TYPE  Type,
-  IN EFI_MEMORY_TYPEMemoryType,
-  IN UINTN  NumberOfPages,
-  IN OUT EFI_PHYSICAL_ADDRESS  *Memory
-  );
-
-/**
   Frees previous allocated pages.
 
   @param  Memory Base address of memory being freed
@@ -1315,24 +1288,6 @@ CoreFreePages (
   );
 
 /**
-  Frees previous allocated pages.
-
-  @param  Memory Base address of memory being freed
-  @param  NumberOfPages  The number of pages to free
-
-  @retval EFI_NOT_FOUND  Could not find the entry that covers the range
-  @retval EFI_INVALID_PARAMETER  Address not aligned
-  @return EFI_SUCCESS -Pages successfully freed.
-
-**/
-EFI_STATUS
-EFIAPI
-CoreInternalFreePages (
-  IN EFI_PHYSICAL_ADDRESS   Memory,
-  IN UINTN  NumberOfPages
-  );
-
-/**
   This function returns a copy of the current memory map. The map is an array 
of
   memory descriptors, each of which describes a contiguous block of memory.
 
@@ -1435,6 +1390,7 @@ CoreFreePool (
   Frees pool.
 
   @param  Buffer The allocated pool entry to free
+  @param  PoolType   Pointer to pool type
 
   @retval EFI_INVALID_PARAMETER  Buffer is not a valid value.
   @retval EFI_SUCCESSPool successfully freed.
@@ -1443,7 +1399,8 @@ CoreFreePool (
 EFI_STATUS
 EFIAPI
 CoreInternalFreePool (
-  IN VOID*Buffer
+  IN VOID   *Buffer,
+  OUT EFI_MEMORY_TYPE   *PoolType OPTIONAL
   );
 
 /**
diff --git a/MdeModulePkg/Core/Dxe/Mem/Imem.h b/MdeModulePkg/Core/Dxe/Mem/Imem.h
index 6f4065e3b89b..fb53f95575f0 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Imem.h
+++ b/MdeModulePkg/Core/Dxe/Mem/Imem.h
@@ -112,6 +112,7 @@ CoreAllocatePoolI (
   Caller must have the memory lock held
 
   @param  Buffer The allocated pool entry to free
+  @param  PoolType   Pointer to pool type
 
   @retval EFI_INVALID_PARAMETER  Buffer not valid
   @retval EFI_SUCCESSBuffer successfully freed.
@@ -119,7 +120,8 @@ CoreAllocatePoolI (
 **/
 EFI_STATUS
 CoreFreePoolI (
-  IN VOID   *Buffer
+  IN VOID   *Buffer,
+  OUT EFI_MEMORY_TYPE   *PoolType OPTIONAL
   );
 
 
diff --git a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c 
b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
index 1f17947808e9..158803746126 100644
--- a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
+++ b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
@@ -1,7 +1,7 @@
 /** @file
   Support routines for UEFI memory profile.
 
-  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2014 - 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
@@ -730,7 +730,7 @@ UnregisterMemoryProfileImage (
 //
 // Use CoreInternalFreePool() that will not update profile for this 
FreePool action.
 //
-CoreInternalFreePool (DriverInfoData);
+

[edk2] [PATCH 3/3] MdeModulePkg DxeCore: Enhance MemoryAttributesTable installation

2016-04-21 Thread Star Zeng
Current MemoryAttributesTable will be installed on ReadyToBoot event
at TPL_NOTIFY level, it maybe incorrect when PcdHiiOsRuntimeSupport
= TRUE as HiiDatabaseDxe will have runtime memory allocation for HII
OS runtime support on and after ReadyToBoot. The issue was exposed at
http://article.gmane.org/gmane.comp.bios.edk2.devel/10125.

To make sure the correctness of MemoryAttributesTable, this patch is
to enhance MemoryAttributesTable installation to install
MemoryAttributesTable on ReadyToBoot event at TPL_CALLBACK - 1 level
to make sure it is at the last of ReadyToBoot event, and also hook
runtime memory allocation after ReadyToBoot.

Cc: Jiewen Yao 
Cc: Liming Gao 
Cc: Feng Tian 
Cc: Ard Biesheuvel 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Core/Dxe/DxeMain.h| 12 +++
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c|  3 +
 MdeModulePkg/Core/Dxe/Mem/Page.c   |  2 +
 MdeModulePkg/Core/Dxe/Mem/Pool.c   |  2 +
 MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c | 88 ++
 5 files changed, 92 insertions(+), 15 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h
index edb7ff5b9fa5..82a3a9b4f2b7 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.h
+++ b/MdeModulePkg/Core/Dxe/DxeMain.h
@@ -276,6 +276,8 @@ extern EFI_RUNTIME_SERVICES *gDxeCoreRT;
 extern EFI_DXE_SERVICES *gDxeCoreDS;
 extern EFI_HANDLE   gDxeCoreImageHandle;
 
+extern BOOLEAN  gMemoryMapTerminated;
+
 extern EFI_DECOMPRESS_PROTOCOL  gEfiDecompress;
 
 extern EFI_RUNTIME_ARCH_PROTOCOL*gRuntime;
@@ -2859,6 +2861,16 @@ CoreInitializeMemoryAttributesTable (
   );
 
 /**
+  Install MemoryAttributesTable on memory allocation.
+
+  @param[in] MemoryType EFI memory type.
+**/
+VOID
+InstallMemoryAttributesTableOnMemoryAllocation (
+  IN EFI_MEMORY_TYPEMemoryType
+  );
+
+/**
   Insert image record.
 
   @param  RuntimeImageRuntime image information
diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c 
b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
index 20ff02f663b2..30142f67d227 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
+++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
@@ -207,6 +207,7 @@ EFI_SYSTEM_TABLE  *gDxeCoreST = NULL;
 EFI_RUNTIME_SERVICES  *gDxeCoreRT = 
 EFI_HANDLEgDxeCoreImageHandle = NULL;
 
+BOOLEAN   gMemoryMapTerminated = FALSE;
 
 //
 // EFI Decompress Protocol
@@ -751,6 +752,8 @@ CoreExitBootServices (
 return Status;
   }
 
+  gMemoryMapTerminated = TRUE;
+
   //
   // Notify other drivers that we are exiting boot services.
   //
diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
index fa71bd87dfdc..dbdc71b59ca5 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Page.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
@@ -1336,6 +1336,7 @@ CoreAllocatePages (
   Status = CoreInternalAllocatePages (Type, MemoryType, NumberOfPages, Memory);
   if (!EFI_ERROR (Status)) {
 CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), 
MemoryProfileActionAllocatePages, MemoryType, EFI_PAGES_TO_SIZE 
(NumberOfPages), (VOID *) (UINTN) *Memory);
+InstallMemoryAttributesTableOnMemoryAllocation (MemoryType);
   }
   return Status;
 }
@@ -1444,6 +1445,7 @@ CoreFreePages (
   Status = CoreInternalFreePages (Memory, NumberOfPages, );
   if (!EFI_ERROR (Status)) {
 CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), 
MemoryProfileActionFreePages, (EFI_MEMORY_TYPE) 0, EFI_PAGES_TO_SIZE 
(NumberOfPages), (VOID *) (UINTN) Memory);
+InstallMemoryAttributesTableOnMemoryAllocation (MemoryType);
   }
   return Status;
 }
diff --git a/MdeModulePkg/Core/Dxe/Mem/Pool.c b/MdeModulePkg/Core/Dxe/Mem/Pool.c
index 5496a09cfa72..5eced88efb75 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Pool.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Pool.c
@@ -277,6 +277,7 @@ CoreAllocatePool (
   Status = CoreInternalAllocatePool (PoolType, Size, Buffer);
   if (!EFI_ERROR (Status)) {
 CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), 
MemoryProfileActionAllocatePool, PoolType, Size, *Buffer);
+InstallMemoryAttributesTableOnMemoryAllocation (PoolType);
   }
   return Status;
 }
@@ -505,6 +506,7 @@ CoreFreePool (
   Status = CoreInternalFreePool (Buffer, );
   if (!EFI_ERROR (Status)) {
 CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), 
MemoryProfileActionFreePool, (EFI_MEMORY_TYPE) 0, 0, Buffer);
+InstallMemoryAttributesTableOnMemoryAllocation (PoolType);
   }
   return Status;
 }
diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c 
b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
index 0362212c8b0b..3706b232472a 100644
--- 

[edk2] [patch] MdeModulePkg/HiiDatabaseDxe: Refine the logic for Hii runtime support code

2016-04-21 Thread Dandan Bi
The Hii runtime support feature will export the content of
HiiDatabase and the ConfigResp string to runtime buffer
after ReadyToBoot event is triggered. If some drivers
add/update/remove packages from Hiidatabase after ReadyToBoot:
Originally we will both export the content of HiiDatabase and
the ConfigResp string for all packages.
But now after investigation, we found only for form packages need
to export the content of HiiDatabase and the ConfigResp string,
for other packages just need to export the content of HiiDatabase.

Now this patch is to enhance this logic.

Cc: Liming Gao 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi 
---
 MdeModulePkg/Universal/HiiDatabaseDxe/Database.c   | 72 +-
 .../Universal/HiiDatabaseDxe/HiiDatabase.h |  4 +-
 .../Universal/HiiDatabaseDxe/HiiDatabaseEntry.c|  3 +-
 3 files changed, 61 insertions(+), 18 deletions(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
index def1eb7..0c0874e 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
@@ -17,10 +17,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 
 EFI_HII_PACKAGE_LIST_HEADER*gRTDatabaseInfoBuffer = NULL;
 EFI_STRING gRTConfigRespBuffer= NULL;
 UINTN  gDatabaseInfoSize = 0;
 UINTN  gConfigRespSize = 0;
+BOOLEANgExportConfigResp = FALSE;
+
 
 /**
   This function generates a HII_DATABASE_RECORD node and adds into hii 
database.
   This is a internal function.
 
@@ -737,11 +739,20 @@ RemoveFormPackages (
 
 RemoveEntryList (>IfrEntry);
 PackageList->PackageListHdr.PackageLength -= Package->FormPkgHdr.Length;
 FreePool (Package->IfrData);
 FreePool (Package);
-
+//
+// If Hii runtime support feature is enabled,
+// will export Hii info for runtime use after ReadyToBoot event triggered.
+// If some driver add/update/remove packages from HiiDatabase after 
ReadyToBoot,
+// will need to export the content of HiiDatabase.
+// But if add/update/remove form packages, also need to export the 
ConfigResp string
+//
+if (gExportAfterReadyToBoot) {
+  gExportConfigResp = TRUE;
+}
   }
 
   return EFI_SUCCESS;
 }
 
@@ -2484,10 +2495,20 @@ AddPackages (
  NotifyType,
  (VOID *) FormPackage,
  (UINT8) (PackageHeader.Type),
  DatabaseRecord->Handle
  );
+  //
+  // If Hii runtime support feature is enabled,
+  // will export Hii info for runtime use after ReadyToBoot event 
triggered.
+  // If some driver add/update/remove packages from HiiDatabase after 
ReadyToBoot,
+  // will need to export the content of HiiDatabase.
+  // But if add/update/remove form packages, also need to export the 
ConfigResp string.
+  //
+  if (gExportAfterReadyToBoot) {
+gExportConfigResp = TRUE;
+  }
   break;
 case EFI_HII_PACKAGE_KEYBOARD_LAYOUT:
   Status = InsertKeyboardLayoutPackage (
  PackageHdrPtr,
  NotifyType,
@@ -2779,20 +2800,20 @@ ExportPackageList (
 
   return EFI_SUCCESS;
 }
 
 /**
-This is an internal function,mainly use to get and update configuration 
settings information.
+This is an internal function,mainly use to get and update ConfigResp string.
 
 @param  This   A pointer to the EFI_HII_DATABASE_PROTOCOL 
instance.
 
 @retval EFI_SUCCESSGet the information successfully.
 @retval EFI_OUT_OF_RESOURCES   Not enough memory to store the Configuration 
Setting data.
 
 **/
 EFI_STATUS
-HiiGetConfigurationSetting(
+HiiGetConfigRespInfo(
   IN CONST EFI_HII_DATABASE_PROTOCOL*This
   )
 {
   EFI_STATUS  Status;
   HII_DATABASE_PRIVATE_DATA   *Private;
@@ -2803,15 +2824,10 @@ HiiGetConfigurationSetting(
   ConfigSize   = 0;
 
   Private = HII_DATABASE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
 
   //
-  // Get the HiiDatabase info.
-  //
-  HiiGetDatabaseInfo(This);
-
-  //
   // Get ConfigResp string
   //
   Status = 
HiiConfigRoutingExportConfig(>ConfigRouting,);
 
   if (!EFI_ERROR (Status)){
@@ -2983,13 +2999,22 @@ HiiNewPackageList (
   //
   // Check whether need to get the Database and configuration setting info.
   // Only after ReadyToBoot, need to do the export.
   //
   if (gExportAfterReadyToBoot) {
-HiiGetConfigurationSetting(This);
+//
+// There are new packages added into HiiDatabase, need to export the 
content of HiiDatabase.
+//
+HiiGetDatabaseInfo (This);
+//
+// If form packages added, also need to export the ConfigResp string.
+//
+if (gExportConfigResp) {
+  HiiGetConfigRespInfo 

[edk2] [patch] MdeModulePkg/HiiDatabaseDxe: Refine the coding style.

2016-04-21 Thread Dandan Bi
Cc: Liming Gao 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi 
---
 MdeModulePkg/Universal/HiiDatabaseDxe/Database.c | 42 
 MdeModulePkg/Universal/HiiDatabaseDxe/Image.c|  4 +--
 MdeModulePkg/Universal/HiiDatabaseDxe/String.c   |  4 +--
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
index 0c0874e..67779736 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
@@ -2826,31 +2826,31 @@ HiiGetConfigRespInfo(
   Private = HII_DATABASE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
 
   //
   // Get ConfigResp string
   //
-  Status = 
HiiConfigRoutingExportConfig(>ConfigRouting,);
+  Status = HiiConfigRoutingExportConfig (>ConfigRouting, 
);
 
-  if (!EFI_ERROR (Status)){
-ConfigSize = StrSize(ConfigAltResp);
-if (ConfigSize > gConfigRespSize){
+  if (!EFI_ERROR (Status)) {
+ConfigSize = StrSize (ConfigAltResp);
+if (ConfigSize > gConfigRespSize) {
   gConfigRespSize = ConfigSize;
-  if (gRTConfigRespBuffer != NULL){
-FreePool(gRTConfigRespBuffer);
+  if (gRTConfigRespBuffer != NULL) {
+FreePool (gRTConfigRespBuffer);
   }
-  gRTConfigRespBuffer = (EFI_STRING)AllocateRuntimeZeroPool(ConfigSize);
-  if (gRTConfigRespBuffer == NULL){
-FreePool(ConfigAltResp);
+  gRTConfigRespBuffer = (EFI_STRING) AllocateRuntimeZeroPool (ConfigSize);
+  if (gRTConfigRespBuffer == NULL) {
+FreePool (ConfigAltResp);
 DEBUG ((DEBUG_ERROR, "Not enough memory resource to get the ConfigResp 
string.\n"));
 return EFI_OUT_OF_RESOURCES;
   }
 } else {
-  ZeroMem(gRTConfigRespBuffer,gConfigRespSize);
+  ZeroMem (gRTConfigRespBuffer, gConfigRespSize);
 }
-CopyMem(gRTConfigRespBuffer,ConfigAltResp,ConfigSize);
+CopyMem (gRTConfigRespBuffer, ConfigAltResp, ConfigSize);
 gBS->InstallConfigurationTable (, 
gRTConfigRespBuffer);
-FreePool(ConfigAltResp);
+FreePool (ConfigAltResp);
   }
 
   return EFI_SUCCESS;
 
 }
@@ -2877,28 +2877,28 @@ HiiGetDatabaseInfo(
   DatabaseInfoSize = 0;
 
   //
   // Get HiiDatabase information.
   //
-  Status = HiiExportPackageLists(This, NULL, , DatabaseInfo);
+  Status = HiiExportPackageLists (This, NULL, , DatabaseInfo);
 
-  ASSERT(Status == EFI_BUFFER_TOO_SMALL);
+  ASSERT (Status == EFI_BUFFER_TOO_SMALL);
 
-  if(DatabaseInfoSize > gDatabaseInfoSize ) {
+  if (DatabaseInfoSize > gDatabaseInfoSize ) {
 gDatabaseInfoSize = DatabaseInfoSize;
-if (gRTDatabaseInfoBuffer != NULL){
-  FreePool(gRTDatabaseInfoBuffer);
+if (gRTDatabaseInfoBuffer != NULL) {
+  FreePool (gRTDatabaseInfoBuffer);
 }
-gRTDatabaseInfoBuffer = AllocateRuntimeZeroPool(DatabaseInfoSize);
-if (gRTDatabaseInfoBuffer == NULL){
+gRTDatabaseInfoBuffer = AllocateRuntimeZeroPool (DatabaseInfoSize);
+if (gRTDatabaseInfoBuffer == NULL) {
   DEBUG ((DEBUG_ERROR, "Not enough memory resource to get the HiiDatabase 
info.\n"));
   return EFI_OUT_OF_RESOURCES;
 }
   } else {
-ZeroMem(gRTDatabaseInfoBuffer,gDatabaseInfoSize);
+ZeroMem (gRTDatabaseInfoBuffer, gDatabaseInfoSize);
   }
-  Status = HiiExportPackageLists(This, NULL, , 
gRTDatabaseInfoBuffer);
+  Status = HiiExportPackageLists (This, NULL, , 
gRTDatabaseInfoBuffer);
   ASSERT_EFI_ERROR (Status);
   gBS->InstallConfigurationTable (, 
gRTDatabaseInfoBuffer);
 
   return EFI_SUCCESS;
 
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
index 612d57a..1480e53 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
@@ -793,11 +793,11 @@ HiiNewImage (
   //
   // Check whether need to get the contents of HiiDataBase.
   // Only after ReadyToBoot to do the export.
   //
   if (gExportAfterReadyToBoot) {
-HiiGetDatabaseInfo(>HiiDatabase);
+HiiGetDatabaseInfo (>HiiDatabase);
   }
 
   return EFI_SUCCESS;
 }
 
@@ -1189,11 +1189,11 @@ HiiSetImage (
   //
   // Check whether need to get the contents of HiiDataBase.
   // Only after ReadyToBoot to do the export.
   //
   if (gExportAfterReadyToBoot) {
-HiiGetDatabaseInfo(>HiiDatabase);
+HiiGetDatabaseInfo (>HiiDatabase);
   }
 
   return EFI_SUCCESS;
 
 }
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
index e55aa29..2227731 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
@@ -1567,11 +1567,11 @@ Done:
   // Check whether need to get the contents of HiiDataBase.
   // Only after ReadyToBoot to do the export.
   //
   if (gExportAfterReadyToBoot) {
 if (!EFI_ERROR (Status)) {
-  

[edk2] [Patch] BaseTools: Update FMP Capsule support to follow FDF spec

2016-04-21 Thread Yonghong Zhu
Current the FMP Capsule feature is supported, but its format has a little
different with FDF spec. so this patch 1) Align the FMP Capsule with FDF
spec. 2) fix some style issue, eg: Tab. 3) Add a SectionParser function to
check the section header info since this method is used in 7 places.

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu 
---
 BaseTools/Source/Python/GenFds/FdfParser.py | 60 -
 1 file changed, 34 insertions(+), 26 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py 
b/BaseTools/Source/Python/GenFds/FdfParser.py
index 28af09b..72fb3dc 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -53,11 +53,10 @@ from Common.Expression import *
 from Common import GlobalData
 from Common.String import ReplaceMacro
 
 from Common.Misc import tdict
 
-import re
 import Common.LongFilePathOs as os
 from Common.LongFilePathSupport import OpenLongFilePath as open
 
 ##define T_CHAR_SPACE' '
 ##define T_CHAR_NULL '\0'
@@ -104,11 +103,11 @@ def GetRealFileLine (File, Line):
 InsertedLines = 0
 for Profile in AllIncludeFileList:
 if Profile.IsLineInFile(Line):
 return Profile.GetLineInFile(Line)
 elif Line >= Profile.InsertStartLineNumber and Profile.Level == 1:
-   InsertedLines += Profile.GetTotalLines()
+InsertedLines += Profile.GetTotalLines()
 
 return (File, Line - InsertedLines)
 
 ## The exception class that used to report error messages when parsing FDF
 #
@@ -179,11 +178,11 @@ class IncludeFileProfile :
 
 def GetTotalLines(self):
 TotalLines = self.InsertAdjust + len(self.FileLinesList)
 
 for Profile in self.IncludeFileList:
-  TotalLines += Profile.GetTotalLines()
+TotalLines += Profile.GetTotalLines()
 
 return TotalLines
 
 def IsLineInFile(self, Line):
 if Line >= self.InsertStartLineNumber and Line < 
self.InsertStartLineNumber + self.GetTotalLines():
@@ -1396,10 +1395,24 @@ class FdfParser:
 FileLineTuple = GetRealFileLine(self.FileName, 
self.CurrentLineNumber)
 X.Message += ' near line %d, column %d: %s' \
 % (FileLineTuple[1], self.CurrentOffsetWithinLine + 1, 
self.Profile.FileLinesList[self.CurrentLineNumber - 
1][self.CurrentOffsetWithinLine :].rstrip('\n').rstrip('\r'))
 raise
 
+## SectionParser() method
+#
+#   Parse the file section info
+#   Exception will be raised if syntax error found
+#
+#   @param  self  The object pointer
+#   @param  section   The section string
+
+def SectionParser(self, section):
+S = section.upper()
+if not S.startswith("[DEFINES") and not S.startswith("[FD.") and not 
S.startswith("[FV.") and not S.startswith("[CAPSULE.") \
+and not S.startswith("[VTF.") and not S.startswith("[RULE.") and 
not S.startswith("[OPTIONROM.") and not S.startswith('[FMPPAYLOAD.'):
+raise Warning("Unknown section or section appear sequence error 
(The correct sequence should be [DEFINES], [FD.], [FV.], [Capsule.], [VTF.], 
[Rule.], [OptionRom.], [FMPPAYLOAD.])", self.FileName, self.CurrentLineNumber)
+
 ## __GetDefines() method
 #
 #   Get Defines section contents and store its data into AllMacrosList
 #
 #   @param  selfThe object pointer
@@ -1411,13 +1424,11 @@ class FdfParser:
 if not self.__GetNextToken():
 return False
 
 S = self.__Token.upper()
 if S.startswith("[") and not S.startswith("[DEFINES"):
-if not S.startswith("[FD.") and not S.startswith("[FV.") and not 
S.startswith("[CAPSULE.") \
-and not S.startswith("[VTF.") and not S.startswith("[RULE.") 
and not S.startswith("[OPTIONROM."):
-raise Warning("Unknown section or section appear sequence 
error (The correct sequence should be [DEFINES], [FD.], [FV.], [Capsule.], 
[VTF.], [Rule.], [OptionRom.])", self.FileName, self.CurrentLineNumber)
+self.SectionParser(S)
 self.__UndoToken()
 return False
 
 self.__UndoToken()
 if not self.__IsToken("[DEFINES", True):
@@ -2106,13 +2117,11 @@ class FdfParser:
 if not self.__GetNextToken():
 return False
 
 S = self.__Token.upper()
 if S.startswith("[") and not S.startswith("[FV."):
-if not S.startswith('[FMPPAYLOAD.') and not 
S.startswith("[CAPSULE.") \
-and not S.startswith("[VTF.") and not S.startswith("[RULE.") 
and not S.startswith("[OPTIONROM."):
-raise Warning("Unknown section or section appear sequence 
error (The correct sequence should be [FD.], [FV.], [Capsule.], [VTF.], 
[Rule.], [OptionRom.])", self.FileName, self.CurrentLineNumber)

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

2016-04-21 Thread Ni, Ruiyu
The changes set can be found in below GIT repos:
https://github.com/niruiyu/edk2/tree/Ovmf_Bds2


Regards,
Ray

>-Original Message-
>From: Ni, Ruiyu
>Sent: Thursday, April 21, 2016 2:58 PM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu 
>Subject: [Patch v3 00/23] Use MdeModulePkg/BDS in OVMF platform
>
>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().
>
>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/PlatformBds: Rename INF file
>  OvmfPkg/PlatformBds: Follow PlatformBootManagerLib interfaces
>  OvmfPkg/PlatformBds: use EfiBootManagerUpdateConsoleVariable
>  OvmfPkg/PlatformBds: link to UefiBootManagerLib
>  OvmfPkg/PlatformBds: Use ConvertDevicePathToText in DevicePathLib
>  OvmfPkg/PlatformBds: Initialize console variables in *BeforeConsole()
>  OvmfPkg/PlatformBds: Do not launch Boot Manager Menu
>  OvmfPkg/PlatformBds: Register boot options and hot keys.
>  OvmfPkg/PlatformBds: Remove unused local functions.
>  OvmfPkg/PlatformBds: Change PlatformBdsConnectSequence()
>  OvmfPkg/PlatformBds: Use EfiBootManagerRefreshAllBootOption()
>  OvmfPkg/PlatformBds: Remove PlatformBdsGetDriverOption()
>  OvmfPkg/PlatformBds: Use GetBootModeHob() in HobLib
>  OvmfPkg/PlatformBds: Remove unnecessary memory test
>  OvmfPkg/PlatformBds: Remove unused variables and function prototypes.
>  OvmfPkg/PlatformBds: Add EnableQuietBoot and DisableQuietBoot
>  OvmfPkg/PlatformBds: Remove unused C structures definitions.
>  OvmfPkg: Use MdeModulePkg/BDS
>
> 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   | 1371 ++
> .../Library/PlatformBootManagerLib/BdsPlatform.h   |  246 +++
> .../PlatformBootManagerLib.inf |   80 +
> .../Library/PlatformBootManagerLib/PlatformData.c  |   41 +
> .../Library/PlatformBootManagerLib/QemuKernel.c|  170 ++
> OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c |  668 +++
> .../Library/QemuNewBootOrderLib/ExtraRootBusMap.c  |  313 
> .../Library/QemuNewBootOrderLib/ExtraRootBusMap.h  |   40 +
> .../Library/QemuNewBootOrderLib/QemuBootOrderLib.c | 1913 
> .../QemuNewBootOrderLib/QemuBootOrderLib.inf   |   68 +
> OvmfPkg/OvmfPkgIa32.dsc|   45 +-
> OvmfPkg/OvmfPkgIa32.fdf|5 +
> OvmfPkg/OvmfPkgIa32X64.dsc |   47 +-
> OvmfPkg/OvmfPkgIa32X64.fdf |5 +
> OvmfPkg/OvmfPkgX64.dsc |   45 +-
> 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, 5077 insertions(+), 95 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
> create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c
> create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c
> create mode 100644 OvmfPkg/Library/QemuNewBootOrderLib/ExtraRootBusMap.c
> create mode 100644 OvmfPkg/Library/QemuNewBootOrderLib/ExtraRootBusMap.h
> create mode 100644 OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.c
> create mode 100644 OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.inf
>
>--
>2.7.0.windows.1

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


[edk2] [Patch v3 23/23] OvmfPkg: Use MdeModulePkg/BDS

2016-04-21 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| 45 ++--
 OvmfPkg/OvmfPkgIa32.fdf|  5 +
 OvmfPkg/OvmfPkgIa32X64.dsc | 47 +++---
 OvmfPkg/OvmfPkgIa32X64.fdf |  5 +
 OvmfPkg/OvmfPkgX64.dsc | 45 ++--
 OvmfPkg/OvmfPkgX64.fdf |  5 +
 6 files changed, 133 insertions(+), 19 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 0206dda..d9e9321 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)
+  !ifdef $(CSM_ENABLE)
   NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
-!endif
+  !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 v3 22/23] OvmfPkg/PlatformBds: Remove unused C structures definitions.

2016-04-21 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   | 47 --
 1 file changed, 47 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index 8c17297..43b487e 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 v3 19/23] OvmfPkg/PlatformBds: Remove unnecessary memory test

2016-04-21 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: 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 6c21407..e595979 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1128,62 +1128,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.
 
@@ -1293,9 +1237,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 6e5ca34..4bde841 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 v3 20/23] OvmfPkg/PlatformBds: Remove unused variables and function prototypes.

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

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index 4bde841..3d05999 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;
@@ -221,16 +220,6 @@ PlatformBdsShowProgress (
   );
 
 VOID
-PlatformBdsConnectSequence (
-  VOID
-  );
-
-EFI_STATUS
-ProcessCapsules (
-  EFI_BOOT_MODE BootMode
-  );
-
-VOID
 PlatformInitializeConsole (
   IN PLATFORM_CONSOLE_CONNECT_ENTRY   *PlatformConsole
   );
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 v3 16/23] OvmfPkg/PlatformBds: Use EfiBootManagerRefreshAllBootOption()

2016-04-21 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 
Cc: Jordan Justen 
Cc: 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 dc6bc7f..0284a9a 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -14,7 +14,6 @@
 
 #include "BdsPlatform.h"
 #include 
-#include 
 
 
 //
@@ -1338,14 +1337,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 2eab29a..ae3c268 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 v3 17/23] OvmfPkg/PlatformBds: Remove PlatformBdsGetDriverOption()

2016-04-21 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: 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 0284a9a..59ff097 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1129,31 +1129,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,
@@ -1307,11 +1282,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 ae3c268..6e5ca34 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 v3 18/23] OvmfPkg/PlatformBds: Use GetBootModeHob() in HobLib

2016-04-21 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: 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 59ff097..6c21407 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1240,7 +1240,6 @@ Routine Description:
 
 --*/
 {
-  EFI_STATUS Status;
   EFI_BOOT_MODE  BootMode;
 
   DEBUG ((EFI_D_INFO, "PlatformBootManagerAfterConsole\n"));
@@ -1284,7 +1283,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 v3 15/23] OvmfPkg/PlatformBds: Change PlatformBdsConnectSequence()

2016-04-21 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 
Cc: Jordan Justen 
Cc: 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 43a859c..dc6bc7f 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1075,7 +1075,6 @@ PlatformBdsRestoreNvVarsFromHardDisk (
 
 }
 
-
 VOID
 PlatformBdsConnectSequence (
   VOID
@@ -1112,14 +,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 ();
 
@@ -1338,9 +1338,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 v3 13/23] OvmfPkg/PlatformBds: Register boot options and hot keys.

2016-04-21 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   | 71 ++
 .../Library/PlatformBootManagerLib/BdsPlatform.h   |  1 +
 .../PlatformBootManagerLib.inf |  2 +
 3 files changed, 74 insertions(+)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 38e2943..d4bdbe5 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -88,6 +88,55 @@ 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);
+  }
+}
+
 //
 // BDS Platform Functions
 //
@@ -111,10 +160,32 @@ Returns:
 
 --*/
 {
+  EFI_INPUT_KEYEnter;
+  EFI_INPUT_KEYF2;
+  EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
+
   DEBUG ((EFI_D_INFO, "PlatformBootManagerBeforeConsole\n"));
   InstallDevicePathCallback ();
   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 796b53d..2eab29a 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 f9cbe65..edf8f14 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 SOMETIMES_CONSUMED
   gEfiDxeSmmReadyToLockProtocolGuid # PROTOCOL SOMETIMES_PRODUCED
+  gEfiLoadedImageProtocolGuid   # PROTOCOL SOMETIMES_PRODUCED
 
 [Guids]
   gEfiEndOfDxeEventGroupGuid
-- 
2.7.0.windows.1

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

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

2016-04-21 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 | 134 -
 .../QemuNewBootOrderLib/QemuBootOrderLib.inf   |   4 +-
 2 files changed, 80 insertions(+), 58 deletions(-)

diff --git a/OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.c 
b/OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.c
index 15065b7..f015422 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
@@ -13,10 +13,11 @@
   WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/
 
+#include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -253,8 +254,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 +303,7 @@ BootOrderAppend (
   }
 
   BootOrder->Data[BootOrder->Produced++] =
- ActiveOption->BootOption->BootCurrent;
+   (UINT16) ActiveOption->BootOption->OptionNumber;
   ActiveOption->Appended = TRUE;
   return RETURN_SUCCESS;
 }
@@ -310,14 +313,16 @@ BootOrderAppend (
 
   Create an array of ACTIVE_OPTION elements for a boot option list.
 
-  @param[in]  BootOptionList  A boot option list, created with
-  BdsLibEnumerateAllBootOption().
+  @param[in]  BootOptions  A boot option array, created by
+   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.
@@ -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;
+  (*ActiveOption)[*Count].BootOption = [Index];
   (*ActiveOption)[*Count].Appended   = FALSE;
 }
 ++*Count;
   }
-  Link = Link->ForwardLink;
 }
 
 if (ScanMode == 0) {
@@ -1440,8 +1440,12 @@ Match (
   IN  CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
   )
 {
-  CHAR16  *Converted;
-  

[edk2] [Patch v3 08/23] OvmfPkg/PlatformBds: use EfiBootManagerUpdateConsoleVariable

2016-04-21 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 
Cc: Jordan Justen 
Cc: 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 53b277d..dbbc579 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -185,7 +185,7 @@ Returns:
   //
   DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL 
*));
 
-  BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);
 
   //
   // Register COM1
@@ -212,9 +212,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
@@ -241,9 +241,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;
 }
@@ -323,8 +323,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);
@@ -373,7 +373,7 @@ Returns:
   GetGopDevicePath (DevicePath, );
   DevicePath = GopDevicePath;
 
-  BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);
 
   return EFI_SUCCESS;
 }
@@ -416,9 +416,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;
 }
@@ -680,13 +680,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 v3 09/23] OvmfPkg/PlatformBds: link to UefiBootManagerLib

2016-04-21 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
---
 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h  | 2 +-
 OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index cb72596..3234066 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
@@ -39,7 +39,7 @@ Abstract:
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 8cbbd12..18cd987 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -45,7 +45,7 @@ [LibraryClasses]
   BaseMemoryLib
   DebugLib
   PcdLib
-  GenericBdsLib
+  UefiBootManagerLib
   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 v3 07/23] OvmfPkg/PlatformBds: Follow PlatformBootManagerLib interfaces

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

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 +-
 .../PlatformBootManagerLib.inf |  8 ++---
 3 files changed, 24 insertions(+), 29 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 0bc02ba..53b277d 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
@@ -93,7 +93,7 @@ InstallDevicePathCallback (
 //
 VOID
 EFIAPI
-PlatformBdsInit (
+PlatformBootManagerBeforeConsole (
   VOID
   )
 /*++
@@ -111,7 +111,7 @@ Returns:
 
 --*/
 {
-  DEBUG ((EFI_D_INFO, "PlatformBdsInit\n"));
+  DEBUG ((EFI_D_INFO, "PlatformBootManagerBeforeConsole\n"));
   InstallDevicePathCallback ();
 }
 
@@ -1207,11 +1207,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
   )
 /*++
 
@@ -1221,26 +1218,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"));
 
   VisitAllInstancesOfProtocol (,
 ConnectRootBridge, NULL);
@@ -1554,6 +1537,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 6ba0d48..cb72596 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/PlatformBootManagerLib.inf 
b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 6a04b45..8cbbd12 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.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
@@ -14,11 +14,11 @@
 
 [Defines]
   INF_VERSION= 0x00010005
-  BASE_NAME  = PlatformBdsLib
-  FILE_GUID  = F844172E-9985-44f2-BADE-0DD783462E95
+  BASE_NAME  = PlatformBootManagerLib
+  FILE_GUID  = 

[edk2] [Patch v3 06/23] OvmfPkg/PlatformBds: Rename INF file

2016-04-21 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
---
 .../PlatformBootManagerLib/PlatformBdsLib.inf  | 73 --
 .../PlatformBootManagerLib.inf | 73 ++
 2 files changed, 73 insertions(+), 73 deletions(-)
 delete mode 100644 OvmfPkg/Library/PlatformBootManagerLib/PlatformBdsLib.inf
 create mode 100644 
OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBdsLib.inf 
b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBdsLib.inf
deleted file mode 100644
index 6a04b45..000
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBdsLib.inf
+++ /dev/null
@@ -1,73 +0,0 @@
-## @file
-#  Platform BDS customizations library.
-#
-#  Copyright (c) 2007 - 2015, 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.
-#  
-##
-
-[Defines]
-  INF_VERSION= 0x00010005
-  BASE_NAME  = PlatformBdsLib
-  FILE_GUID  = F844172E-9985-44f2-BADE-0DD783462E95
-  MODULE_TYPE= DXE_DRIVER
-  VERSION_STRING = 1.0
-  LIBRARY_CLASS  = PlatformBdsLib|DXE_DRIVER
-
-#
-# The following information is for reference only and not required by the 
build tools.
-#
-#  VALID_ARCHITECTURES   = IA32 X64 IPF EBC
-#
-
-[Sources]
-  BdsPlatform.c
-  PlatformData.c
-  QemuKernel.c
-  BdsPlatform.h
-
-[Packages]
-  MdePkg/MdePkg.dec
-  MdeModulePkg/MdeModulePkg.dec
-  IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
-  OvmfPkg/OvmfPkg.dec
-
-[LibraryClasses]
-  BaseLib
-  MemoryAllocationLib
-  UefiBootServicesTableLib
-  BaseMemoryLib
-  DebugLib
-  PcdLib
-  GenericBdsLib
-  PciLib
-  NvVarsFileLib
-  QemuFwCfgLib
-  LoadLinuxLib
-  QemuBootOrderLib
-  UefiLib
-
-[Pcd]
-  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile
-  gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent
-  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable
-  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
-
-[Pcd.IA32, Pcd.X64]
-  gEfiMdePkgTokenSpaceGuid.PcdFSBClock
-
-[Protocols]
-  gEfiDecompressProtocolGuid
-  gEfiPciRootBridgeIoProtocolGuid
-  gEfiS3SaveStateProtocolGuid   # PROTOCOL SOMETIMES_CONSUMED
-  gEfiDxeSmmReadyToLockProtocolGuid # PROTOCOL SOMETIMES_PRODUCED
-
-[Guids]
-  gEfiEndOfDxeEventGroupGuid
-  gRootBridgesConnectedEventGroupGuid
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
new file mode 100644
index 000..6a04b45
--- /dev/null
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -0,0 +1,73 @@
+## @file
+#  Platform BDS customizations library.
+#
+#  Copyright (c) 2007 - 2015, 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.
+#  
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = PlatformBdsLib
+  FILE_GUID  = F844172E-9985-44f2-BADE-0DD783462E95
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = PlatformBdsLib|DXE_DRIVER
+
+#
+# The following information is for reference only and not required by the 
build tools.
+#
+#  VALID_ARCHITECTURES   = IA32 X64 IPF EBC
+#
+
+[Sources]
+  BdsPlatform.c
+  PlatformData.c
+  QemuKernel.c
+  BdsPlatform.h
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  MemoryAllocationLib
+  UefiBootServicesTableLib
+  BaseMemoryLib
+  DebugLib
+  PcdLib
+  GenericBdsLib
+  PciLib
+  NvVarsFileLib
+  QemuFwCfgLib
+  LoadLinuxLib
+  QemuBootOrderLib
+  UefiLib
+
+[Pcd]
+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile
+  gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
+

[edk2] [Patch v3 12/23] OvmfPkg/PlatformBds: Do not launch Boot Manager Menu

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

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: 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 7fc2dd5..38e2943 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -114,6 +114,7 @@ Returns:
   DEBUG ((EFI_D_INFO, "PlatformBootManagerBeforeConsole\n"));
   InstallDevicePathCallback ();
   PlatformInitializeConsole (gPlatformConsole);
+  PcdSet16 (PcdPlatformBootTimeOut, GetFrontPageTimeoutFromQemu ());
 }
 
 
@@ -1277,8 +1278,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 fb22790..796b53d 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 00a7583..f9cbe65 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 v3 11/23] OvmfPkg/PlatformBds: Initialize console variables in *BeforeConsole()

2016-04-21 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   | 99 ++
 .../Library/PlatformBootManagerLib/BdsPlatform.h   | 31 +++
 .../Library/PlatformBootManagerLib/PlatformData.c  |  2 +-
 3 files changed, 23 insertions(+), 109 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index a4008fd..7fc2dd5 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -113,6 +113,7 @@ Returns:
 {
   DEBUG ((EFI_D_INFO, "PlatformBootManagerBeforeConsole\n"));
   InstallDevicePathCallback ();
+  PlatformInitializeConsole (gPlatformConsole);
 }
 
 
@@ -613,14 +614,17 @@ DetectAndPreparePlatformPciDevicePaths (
   BOOLEAN DetectVgaOnly
   )
 {
+  VisitAllInstancesOfProtocol (,
+ConnectRootBridge, NULL);
+
   mDetectVgaOnly = DetectVgaOnly;
   return VisitAllPciInstances (DetectAndPreparePlatformPciDevicePath);
 }
 
 
-EFI_STATUS
-PlatformBdsConnectConsole (
-  IN BDS_CONSOLE_CONNECT_ENTRY   *PlatformConsole
+VOID
+PlatformInitializeConsole (
+  IN PLATFORM_CONSOLE_CONNECT_ENTRY   *PlatformConsole
   )
 /*++
 
@@ -632,37 +636,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) {
 //
@@ -695,16 +679,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;
 }
 
 
@@ -1277,16 +1251,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
@@ -1400,31 +1364,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 (
@@ -1549,23 +1488,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 3234066..fb22790 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
+++ 

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

2016-04-21 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 
---
 .../Library/QemuNewBootOrderLib/ExtraRootBusMap.c  |  313 
 .../Library/QemuNewBootOrderLib/ExtraRootBusMap.h  |   40 +
 .../Library/QemuNewBootOrderLib/QemuBootOrderLib.c | 1891 
 .../QemuNewBootOrderLib/QemuBootOrderLib.inf   |   68 +
 4 files changed, 2312 insertions(+)
 create mode 100644 OvmfPkg/Library/QemuNewBootOrderLib/ExtraRootBusMap.c
 create mode 100644 OvmfPkg/Library/QemuNewBootOrderLib/ExtraRootBusMap.h
 create mode 100644 OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.c
 create mode 100644 OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.inf

diff --git a/OvmfPkg/Library/QemuNewBootOrderLib/ExtraRootBusMap.c 
b/OvmfPkg/Library/QemuNewBootOrderLib/ExtraRootBusMap.c
new file mode 100644
index 000..ec42214
--- /dev/null
+++ b/OvmfPkg/Library/QemuNewBootOrderLib/ExtraRootBusMap.c
@@ -0,0 +1,313 @@
+/** @file
+  Map positions of extra PCI root buses to bus numbers.
+
+  Copyright (C) 2015, Red Hat, Inc.
+
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "ExtraRootBusMap.h"
+
+//
+// The BusNumbers field is an array with Count elements. The elements increase
+// strictry monotonically. Zero is not an element (because the zero bus number
+// belongs to the "main" root bus, never to an extra root bus). Offset N in the
+// array maps the extra root bus with position (N+1) to its bus number (because
+// the root bus with position 0 is always the main root bus, therefore we don't
+// store it).
+//
+// If there are no extra root buses in the system, then Count is 0, and
+// BusNumbers is NULL.
+//
+struct EXTRA_ROOT_BUS_MAP_STRUCT {
+  UINT32 *BusNumbers;
+  UINTN  Count;
+};
+
+
+/**
+  An ORDERED_COLLECTION_USER_COMPARE function that compares root bridge
+  protocol device paths based on UID.
+
+  @param[in] UserStruct1  Pointer to the first ACPI_HID_DEVICE_PATH.
+
+  @param[in] UserStruct2  Pointer to the second ACPI_HID_DEVICE_PATH.
+
+  @retval <0  If UserStruct1 compares less than UserStruct2.
+
+  @retval  0  If UserStruct1 compares equal to UserStruct2.
+
+  @retval >0  If UserStruct1 compares greater than UserStruct2.
+**/
+STATIC
+INTN
+EFIAPI
+RootBridgePathCompare (
+  IN CONST VOID *UserStruct1,
+  IN CONST VOID *UserStruct2
+  )
+{
+  CONST ACPI_HID_DEVICE_PATH *Acpi1;
+  CONST ACPI_HID_DEVICE_PATH *Acpi2;
+
+  Acpi1 = UserStruct1;
+  Acpi2 = UserStruct2;
+
+  return Acpi1->UID < Acpi2->UID ? -1 :
+ Acpi1->UID > Acpi2->UID ?  1 :
+ 0;
+}
+
+
+/**
+  An ORDERED_COLLECTION_KEY_COMPARE function that compares a root bridge
+  protocol device path against a UID.
+
+  @param[in] StandaloneKey  Pointer to the bare UINT32 UID.
+
+  @param[in] UserStruct Pointer to the ACPI_HID_DEVICE_PATH with the
+embedded UINT32 UID.
+
+  @retval <0  If StandaloneKey compares less than UserStruct's key.
+
+  @retval  0  If StandaloneKey compares equal to UserStruct's key.
+
+  @retval >0  If StandaloneKey compares greater than UserStruct's key.
+**/
+STATIC
+INTN
+EFIAPI
+RootBridgePathKeyCompare (
+  IN CONST VOID *StandaloneKey,
+  IN CONST VOID *UserStruct
+  )
+{
+  CONST UINT32   *Uid;
+  CONST ACPI_HID_DEVICE_PATH *Acpi;
+
+  Uid  = StandaloneKey;
+  Acpi = UserStruct;
+
+  return *Uid < Acpi->UID ? -1 :
+ *Uid > Acpi->UID ?  1 :
+ 0;
+}
+
+
+/**
+  Create a structure that maps the relative positions of PCI root buses to bus
+  numbers.
+
+  In the "bootorder" fw_cfg file, QEMU refers to extra PCI root buses by their
+  positions, in relative root bus number order, not by their actual PCI bus
+  numbers. The ACPI HID device path nodes however that are associated with
+  PciRootBridgeIo protocol instances in the system have their UID fields set to
+  the bus numbers. Create a map that gives, for each extra PCI root bus's
+  position (ie. "serial number") its actual PCI bus number.
+
+  @param[out] ExtraRootBusMap  The data structure implementing the map.
+
+  @retval EFI_SUCCESS   ExtraRootBusMap has been populated.
+
+  @retval EFI_OUT_OF_RESOURCES  Memory allocation failed.
+
+  @retval EFI_ALREADY_STARTED   A duplicate root bus number has been found in
+the system. (This should never happen.)
+
+  @return   Error 

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

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

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Jordan Justen 
Cc: 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], 

[edk2] [Patch v3 10/23] OvmfPkg/PlatformBds: Use ConvertDevicePathToText in DevicePathLib

2016-04-21 Thread Ruiyu Ni
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 dbbc579..a4008fd 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -200,7 +200,7 @@ Returns:
   //
   // Print Device Path
   //
-  DevPathStr = DevicePathToStr(DevicePath);
+  DevPathStr = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
   if (DevPathStr != NULL) {
 DEBUG((
   EFI_D_INFO,
@@ -229,7 +229,7 @@ Returns:
   //
   // Print Device Path
   //
-  DevPathStr = DevicePathToStr(DevicePath);
+  DevPathStr = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
   if (DevPathStr != NULL) {
 DEBUG((
   EFI_D_INFO,
@@ -940,7 +940,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 18cd987..00a7583 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 v3 05/23] OvmfPkg: Duplicate PlatformBdsLib to PlatformBootManagerLib

2016-04-21 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 
---
 .../Library/PlatformBootManagerLib/BdsPlatform.c   | 1575 
 .../Library/PlatformBootManagerLib/BdsPlatform.h   |  292 
 .../PlatformBootManagerLib/PlatformBdsLib.inf  |   73 +
 .../Library/PlatformBootManagerLib/PlatformData.c  |   51 +
 .../Library/PlatformBootManagerLib/QemuKernel.c|  170 +++
 5 files changed, 2161 insertions(+)
 create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
 create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
 create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/PlatformBdsLib.inf
 create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
 create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
new file mode 100644
index 000..0bc02ba
--- /dev/null
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -0,0 +1,1575 @@
+/** @file
+  Platform BDS customizations.
+
+  Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "BdsPlatform.h"
+#include 
+#include 
+
+
+//
+// Global data
+//
+
+VOID  *mEfiDevPathNotifyReg;
+EFI_EVENT mEfiDevPathEvent;
+VOID  *mEmuVariableEventReg;
+EFI_EVENT mEmuVariableEvent;
+BOOLEAN   mDetectVgaOnly;
+UINT16mHostBridgeDevId;
+
+//
+// Table of host IRQs matching PCI IRQs A-D
+// (for configuring PCI Interrupt Line register)
+//
+CONST UINT8 PciHostIrqs[] = {
+  0x0a, 0x0a, 0x0b, 0x0b
+};
+
+//
+// Array Size macro
+//
+#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
+
+//
+// Type definitions
+//
+
+typedef
+EFI_STATUS
+(EFIAPI *PROTOCOL_INSTANCE_CALLBACK)(
+  IN EFI_HANDLE   Handle,
+  IN VOID *Instance,
+  IN VOID *Context
+  );
+
+/**
+  @param[in]  Handle - Handle of PCI device instance
+  @param[in]  PciIo - PCI IO protocol instance
+  @param[in]  Pci - PCI Header register block
+**/
+typedef
+EFI_STATUS
+(EFIAPI *VISIT_PCI_INSTANCE_CALLBACK)(
+  IN EFI_HANDLE   Handle,
+  IN EFI_PCI_IO_PROTOCOL  *PciIo,
+  IN PCI_TYPE00   *Pci
+  );
+
+
+//
+// Function prototypes
+//
+
+EFI_STATUS
+VisitAllInstancesOfProtocol (
+  IN EFI_GUID*Id,
+  IN PROTOCOL_INSTANCE_CALLBACK  CallBackFunction,
+  IN VOID*Context
+  );
+
+EFI_STATUS
+VisitAllPciInstancesOfProtocol (
+  IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction
+  );
+
+VOID
+InstallDevicePathCallback (
+  VOID
+  );
+
+//
+// BDS Platform Functions
+//
+VOID
+EFIAPI
+PlatformBdsInit (
+  VOID
+  )
+/*++
+
+Routine Description:
+
+  Platform Bds init. Incude the platform firmware vendor, revision
+  and so crc check.
+
+Arguments:
+
+Returns:
+
+  None.
+
+--*/
+{
+  DEBUG ((EFI_D_INFO, "PlatformBdsInit\n"));
+  InstallDevicePathCallback ();
+}
+
+
+EFI_STATUS
+EFIAPI
+ConnectRootBridge (
+  IN EFI_HANDLE  RootBridgeHandle,
+  IN VOID*Instance,
+  IN VOID*Context
+  )
+{
+  EFI_STATUS Status;
+
+  //
+  // Make the PCI bus driver connect the root bridge, non-recursively. This
+  // will produce a number of child handles with PciIo on them.
+  //
+  Status = gBS->ConnectController (
+  RootBridgeHandle, // ControllerHandle
+  NULL, // DriverImageHandle
+  NULL, // RemainingDevicePath -- produce all
+//   children
+  FALSE // Recursive
+  );
+  return Status;
+}
+
+
+EFI_STATUS
+PrepareLpcBridgeDevicePath (
+  IN EFI_HANDLEDeviceHandle
+  )
+/*++
+
+Routine Description:
+
+  Add IsaKeyboard to ConIn,
+  add IsaSerial to ConOut, ConIn, ErrOut.
+  LPC Bridge: 06 01 00
+
+Arguments:
+
+  DeviceHandle- Handle of PCIIO protocol.
+
+Returns:
+
+  EFI_SUCCESS - LPC bridge is added to ConOut, ConIn, and ErrOut.
+  EFI_STATUS  - No LPC bridge is added.
+
+--*/
+{
+  EFI_STATUSStatus;
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
+  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;
+  CHAR16*DevPathStr;
+
+  DevicePath = NULL;
+  Status = gBS->HandleProtocol (
+  DeviceHandle,
+  

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

2016-04-21 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().

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/PlatformBds: Rename INF file
  OvmfPkg/PlatformBds: Follow PlatformBootManagerLib interfaces
  OvmfPkg/PlatformBds: use EfiBootManagerUpdateConsoleVariable
  OvmfPkg/PlatformBds: link to UefiBootManagerLib
  OvmfPkg/PlatformBds: Use ConvertDevicePathToText in DevicePathLib
  OvmfPkg/PlatformBds: Initialize console variables in *BeforeConsole()
  OvmfPkg/PlatformBds: Do not launch Boot Manager Menu
  OvmfPkg/PlatformBds: Register boot options and hot keys.
  OvmfPkg/PlatformBds: Remove unused local functions.
  OvmfPkg/PlatformBds: Change PlatformBdsConnectSequence()
  OvmfPkg/PlatformBds: Use EfiBootManagerRefreshAllBootOption()
  OvmfPkg/PlatformBds: Remove PlatformBdsGetDriverOption()
  OvmfPkg/PlatformBds: Use GetBootModeHob() in HobLib
  OvmfPkg/PlatformBds: Remove unnecessary memory test
  OvmfPkg/PlatformBds: Remove unused variables and function prototypes.
  OvmfPkg/PlatformBds: Add EnableQuietBoot and DisableQuietBoot
  OvmfPkg/PlatformBds: Remove unused C structures definitions.
  OvmfPkg: Use MdeModulePkg/BDS

 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   | 1371 ++
 .../Library/PlatformBootManagerLib/BdsPlatform.h   |  246 +++
 .../PlatformBootManagerLib.inf |   80 +
 .../Library/PlatformBootManagerLib/PlatformData.c  |   41 +
 .../Library/PlatformBootManagerLib/QemuKernel.c|  170 ++
 OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c |  668 +++
 .../Library/QemuNewBootOrderLib/ExtraRootBusMap.c  |  313 
 .../Library/QemuNewBootOrderLib/ExtraRootBusMap.h  |   40 +
 .../Library/QemuNewBootOrderLib/QemuBootOrderLib.c | 1913 
 .../QemuNewBootOrderLib/QemuBootOrderLib.inf   |   68 +
 OvmfPkg/OvmfPkgIa32.dsc|   45 +-
 OvmfPkg/OvmfPkgIa32.fdf|5 +
 OvmfPkg/OvmfPkgIa32X64.dsc |   47 +-
 OvmfPkg/OvmfPkgIa32X64.fdf |5 +
 OvmfPkg/OvmfPkgX64.dsc |   45 +-
 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, 5077 insertions(+), 95 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
 create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c
 create mode 100644 OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c
 create mode 100644 OvmfPkg/Library/QemuNewBootOrderLib/ExtraRootBusMap.c
 create mode 100644 OvmfPkg/Library/QemuNewBootOrderLib/ExtraRootBusMap.h
 create mode 100644 OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.c
 create mode 100644 OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.inf

-- 
2.7.0.windows.1

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


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

2016-04-21 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 
Cc: Jordan Justen 
Cc: 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


Re: [edk2] [PATCH v2 0/2] Report ACPI NFIT for reserved memory RAM disks

2016-04-21 Thread Wu, Hao A
Hi Laszlo,

Thanks for the feedbacks, comments are made below.

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Laszlo Ersek
> Sent: Wednesday, April 20, 2016 7:08 PM
> To: Wu, Hao A
> Cc: Tian, Feng; Xiao Guangrong; Justen, Jordan L; edk2-de...@ml01.01.org;
> Yao, Jiewen
> Subject: Re: [edk2] [PATCH v2 0/2] Report ACPI NFIT for reserved memory
> RAM disks
> 
> Hi,
> 
> On 04/20/16 03:58, Hao Wu wrote:
> > Changes compared with V1:
> > 1. Instead of creating a new NFIT for each registered reserved memory
> >RAM disk, new cotent of the NFIT is appended to the existing one.
> >
> > 2. Report an NVDIMM root device in the \SB scope if there is no NFIT
> >in the ACPI table.
> >
> > 3. Modify FDF files in OvmfPkg to make sure the report of the NVDIMM
> >root device will be done correctly.
> >
> > Hao Wu (2):
> >   MdeModulePkg RamDiskDxe: Report ACPI NFIT for reserved memory
> RAM
> > disks
> >   OvmfPkg: Modify fdf files due to RamDiskDxe driver's adding ASL code
> >
> >  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl |  44 ++
> >  .../Universal/Disk/RamDiskDxe/RamDiskDxe.inf   |  12 +
> >  .../Universal/Disk/RamDiskDxe/RamDiskImpl.h|   6 +
> >  .../Universal/Disk/RamDiskDxe/RamDiskProtocol.c| 520
> +
> >  OvmfPkg/OvmfPkgIa32.fdf|  12 +-
> >  OvmfPkg/OvmfPkgIa32X64.fdf |  12 +-
> >  OvmfPkg/OvmfPkgX64.fdf |  12 +-
> >  7 files changed, 615 insertions(+), 3 deletions(-)
> >  create mode 100644
> MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl
> >
> 
> I see that Jordan already commented on patch #2, so I'll leave that to
> him :) My questions / remarks are general.
> 
> (1) About sharing NFIT between different clients:
> 
> QEMU can emulate an NVDIMM device (see "hw/acpi/nvdimm.c"). (I'm
> CC'ing Xiao Guangrong who authored it.) When QEMU is instructed to
> create an NVDIMM device, it will also generate an SSDT table with an
> NVDR object in it, and it will generate an NFIT table too.
> 
> OVMF's ACPI platform driver downloads the generated ACPI payload
> from QEMU near the beginning of BDS, and installs the tables. The
> question is how those actions are ordered against the NFIT
> installation / manipulation in RamDiskDxe.
> 
> * If the RAM disks are created from HII, then the question is not
>   relevant, because the HII RamDisk creation does not support the
>   allocation of RAM disks from Reserved type memory (only from
>   BootServicesData), so this code shouldn't apply to begin with.
> 
> * Assuming some other parts of BDS register RAM disks allocated from
>   reserved memory, then this code becomes relevant. I *think* that
>   in this case, we'll be safe. Namely:
> 
>   - if QEMU does not emulate an NVDIMM device, then both said SSDT
> (with the NVDR) will be missing, and the NFIT table will be
> missing too. This series recognizes this situation, and will
> install both itself. Fine.
> 
>   - If QEMU does emulate an NVDIMM device, then NFIT and NVDR (in
> SSDT) will be present *before* this code should be called from
> BDS. (Simply because OVMF's ACPI platform driver installs QEMU's
> NFIT and SSDTs before the "rest of BDS" could register the RAM
> disk.) This should again be fine, because this code will then
> uninstall QEMU's NFIT, and reinstall a modified NFIT (appending
> further NFIT Structures to the end of QEMU's original NFIT
> table).
> 
> * The question is what happens when a plain DXE_DRIVER module (with
>   a depex on the RAM disk protocol, and nothing more) registers a
>   RAM disk, allocated from reserved memory. Such a RAM disk
>   registration could occur way before OVMF's ACPI platform driver
>   gets a chance to download QEMU's NVDIMM-related tables (NFIT and
>   SSDT). At the moment this is a theoretical question only (OVMF
>   doesn't include such a DXE_DRIVER), but I think we should
>   investigate it a little.
> 

This issue was also raised during our internal discussions.

Some OS will require the NVDIMM root device to be present to map the RAM
disk memory to a block device in the OS. And I think the RamDiskDxe driver
does not know whether the NVDIMM root device will be reported by platform.
So I choose to publish NFIT & SSDT within RamDiskDxe driver to make sure
those reserved memory type RAM disks can be recognized correctly by OS and
hoping platform ACPI drivers can handle this case.

>   Note that this problem is not specific to OVMF. On any kind of
>   platform, you could have a DXE_DRIVER that only depends on the RAM
>   disk protocol, and registers a reserved memory RAM disk *before*
>   the platform's own ACPI platform driver installs an NFIT and an
>   SSDT with an NVDR in it. How is