[edk2] [Patch] SecurityPkg OpalPasswordDxe: Suppress option for special device.

2016-04-06 Thread Eric Dong
According to current Pyrite SSC Spec 1.00, there is no parameter
for RevertSP method. So suppress KeepUserData option for the
Pyrite Ssc type device.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong 
Cc: Feng Tian 
---
 SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c 
b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
index eb7d59b..94dce6c 100644
--- a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
+++ b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
@@ -374,7 +374,13 @@ HiiSelectDiskAction (
 
 case HII_KEY_ID_GOTO_REVERT:
   gHiiConfiguration.AvailableFields |= HII_FIELD_PASSWORD;
-  gHiiConfiguration.AvailableFields |= HII_FIELD_KEEP_USER_DATA;
+  if (OpalDisk->SupportedAttributes.PyriteSsc != 1) {
+//
+// According to current Pyrite SSC Spec 1.00, there is no parameter 
for RevertSP method.
+// So issue RevertSP method without any parameter by suppress 
KeepUserData option.
+//
+gHiiConfiguration.AvailableFields |= HII_FIELD_KEEP_USER_DATA;
+  }
   if (AvailActions.RevertKeepDataForced) {
 gHiiConfiguration.AvailableFields |= HII_FIELD_KEEP_USER_DATA_FORCED;
   }
@@ -611,6 +617,14 @@ HiiPopulateDiskInfoForm(
 // Default initialize keep user Data to be true
 //
 gHiiConfiguration.KeepUserData = 1;
+if (OpalDisk->SupportedAttributes.PyriteSsc == 1) {
+  //
+  // According to current Pyrite SSC Spec 1.00, there is no parameter 
for RevertSP method.
+  // So issue RevertSP method without any parameter by set default 
value to FALSE.
+  //
+  gHiiConfiguration.KeepUserData = 0;
+}
+
   }
 }
   }
-- 
2.6.4.windows.1

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


Re: [edk2] [Patch] BaseTools: Add support to merge Prebuild and Postbuild into build Process

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

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Yonghong Zhu
> Sent: Tuesday, April 05, 2016 3:04 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch] BaseTools: Add support to merge Prebuild and
> Postbuild into build Process
> 
> This feature is enhance build tool to incorporate execution of prebuild
> and postbuild.
> 
> 1.Prebuild script
> a.DEFINE PREBUILD in DSC [Defines] section
> b.Build command -D PREBUILD to override the one in DSC [Defines] section
> 1)If PREBUILD is a file, then this file will be used as prebuild script.
> 2)If PREBUILD is empty, then prebuild script will be disabled.
> 3)If PREBUILD is not defined in [Defines] section and not passed in on
> command line, then prebuild script is also disabled.
> 
> 2.Prebuild option
> a.All options of build tool
> b.TARGET, ARCH and TOOL_CHAIN_TAG value, Those value will be from
> target.txt file if they are not in build command line.
> c.Additional options following prebuild definition. Quotes are needed
> when these additional options are present.
> d.Quotes would also be required if the path to the prebuild command
> contains space or special characters.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu 
> ---
>  BaseTools/Source/Python/Common/BuildToolError.py   |   4 +-
>  BaseTools/Source/Python/Common/DataType.py |   5 +-
>  BaseTools/Source/Python/Common/DscClassObject.py   |  17 +-
>  BaseTools/Source/Python/Common/GlobalData.py   |   1 +
>  .../Source/Python/CommonDataClass/PlatformClass.py |  26 ++-
>  .../Source/Python/Workspace/MetaFileParser.py  |   6 +-
>  .../Source/Python/Workspace/WorkspaceDatabase.py   |  33 +++-
>  BaseTools/Source/Python/build/build.py | 198
> -
>  8 files changed, 268 insertions(+), 22 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Common/BuildToolError.py
> b/BaseTools/Source/Python/Common/BuildToolError.py
> index 0a393fe..bee5850 100644
> --- a/BaseTools/Source/Python/Common/BuildToolError.py
> +++ b/BaseTools/Source/Python/Common/BuildToolError.py
> @@ -1,9 +1,9 @@
>  ## @file
>  # Standardized Error Hanlding infrastructures.
>  #
> -# 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
>  # http://opensource.org/licenses/bsd-license.php
>  #
> @@ -76,10 +76,12 @@ AUTOGEN_ERROR = 0xF000
>  PARSER_ERROR = 0xF001
>  BUILD_ERROR = 0xF002
>  GENFDS_ERROR = 0xF003
>  ECC_ERROR = 0xF004
>  EOT_ERROR = 0xF005
> +PREBUILD_ERROR = 0xF007
> +POSTBUILD_ERROR = 0xF008
>  DDC_ERROR = 0xF009
>  WARNING_AS_ERROR = 0xF006
>  MIGRATION_ERROR = 0xF010
>  PCD_VALIDATION_INFO_ERROR = 0xF011
>  PCD_VARIABLE_ATTRIBUTES_ERROR = 0xF012
> diff --git a/BaseTools/Source/Python/Common/DataType.py
> b/BaseTools/Source/Python/Common/DataType.py
> index 4fd46ed..1fe1ee4 100644
> --- a/BaseTools/Source/Python/Common/DataType.py
> +++ b/BaseTools/Source/Python/Common/DataType.py
> @@ -1,9 +1,9 @@
>  ## @file
>  # This file is used to define common static strings used by INF/DEC/DSC files
>  #
> -# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
> +# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
>  # Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
>  # This program and the accompanying materials
>  # are licensed and made available under the terms and conditions of the BSD
> License
>  # which accompanies this distribution.  The full text of the license may be
> found at
>  # http://opensource.org/licenses/bsd-license.php
> @@ -408,11 +408,12 @@ TAB_DSC_DEFINES_RFC_LANGUAGES =
> 'RFC_LANGUAGES'
>  TAB_DSC_DEFINES_ISO_LANGUAGES = 'ISO_LANGUAGES'
>  TAB_DSC_DEFINES_DEFINE = 'DEFINE'
>  TAB_DSC_DEFINES_VPD_TOOL_GUID = 'VPD_TOOL_GUID'
>  TAB_FIX_LOAD_TOP_MEMORY_ADDRESS =
> 'FIX_LOAD_TOP_MEMORY_ADDRESS'
>  TAB_DSC_DEFINES_EDKGLOBAL = 'EDK_GLOBAL'
> -
> +TAB_DSC_PREBUILD = 'PREBUILD'
> +TAB_DSC_POSTBUILD = 'POSTBUILD'
>  #
>  # TargetTxt Definitions
>  #
>  TAB_TAT_DEFINES_ACTIVE_PLATFORM = 'ACTIVE_PLATFORM'
>  TAB_TAT_DEFINES_ACTIVE_MODULE = 'ACTIVE_MODULE'
> diff --git a/BaseTools/Source/Python/Common/DscClassObject.py
> b/BaseTools/Source/Python/Common/DscClassObject.py
> index 788a75e..c2fa1c2 100644
> --- a/BaseTools/Source/Python/Common/DscClassObject.py
> +++ b/BaseTools/Source/Python/Common/DscClassObject.py
> @@ -1,9 +1,9 @@
>  ## @file
>  # This file is used to define each component of DSC file
>  #
> -# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
> +# Copyright (c) 2007 - 2016, Intel Corporation. All rights 

Re: [edk2] [Patch] BaseTools: Enhance --Pcd which override by build option

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

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Yonghong Zhu
> Sent: Tuesday, April 05, 2016 12:32 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch] BaseTools: Enhance --Pcd which override by build
> option
> 
> This patch 1) enhance the help info for --pcd to use " but not '.
> 2) Add the condition statements for build option Pcd type check.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu 
> ---
>  BaseTools/Source/Python/AutoGen/AutoGen.py | 2 ++
>  BaseTools/Source/Python/build/build.py | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> b/BaseTools/Source/Python/AutoGen/AutoGen.py
> index e9e46c2..f29d368 100644
> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> @@ -350,10 +350,12 @@ class WorkspaceAutoGen(AutoGen):
>  DecPcds = {}
>  DecPcdsKey = set()
>  PGen = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, 
> Arch)
>  if GlobalData.BuildOptionPcd:
>  for i, pcd in enumerate(GlobalData.BuildOptionPcd):
> +if type(pcd) is tuple:
> +continue
>  (pcdname, pcdvalue) = pcd.split('=')
>  if not pcdvalue:
>  EdkLogger.error('build', AUTOGEN_ERROR, "No Value 
> specified
> for the PCD %s." % (pcdname))
>  if '.' in pcdname:
>  (TokenSpaceGuidCName, TokenCName) = 
> pcdname.split('.')
> diff --git a/BaseTools/Source/Python/build/build.py
> b/BaseTools/Source/Python/build/build.py
> index 5c1fda1..ece79ea 100644
> --- a/BaseTools/Source/Python/build/build.py
> +++ b/BaseTools/Source/Python/build/build.py
> @@ -1939,11 +1939,11 @@ def MyOptionParser():
>   "will override the setting in [BuildOptions] section of 
> platform DSC.")
>  Parser.add_option("-N", "--no-cache", action="store_true",
> dest="DisableCache", default=False, help="Disable build cache mechanism")
>  Parser.add_option("--conf", action="store", type="string",
> dest="ConfDirectory", help="Specify the customized Conf directory.")
>  Parser.add_option("--check-usage", action="store_true",
> dest="CheckUsage", default=False, help="Check usage content of entries
> listed in INF file.")
>  Parser.add_option("--ignore-sources", action="store_true",
> dest="IgnoreSources", default=False, help="Focus to a binary build and
> ignore all source files")
> -Parser.add_option("--pcd", action="append", dest="OptionPcd",
> help="Set PCD value by command line. Format: 'PcdName=Value' ")
> +Parser.add_option("--pcd", action="append", dest="OptionPcd",
> help="Set PCD value by command line. Format: \"PcdName=Value\" ")
>  Parser.add_option("-l", "--cmd-len", action="store", type="int",
> dest="CommandLength", help="Specify the maximum line length of build
> command. Default is 4096.")
> 
>  (Opt, Args) = Parser.parse_args()
>  return (Opt, Args)
> 
> --
> 2.6.1.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] MdeModulePkg/Bds: Fix build failures of VS tool chain

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

-Original Message-
From: Ni, Ruiyu 
Sent: Thursday, April 07, 2016 10:14 AM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu; Qiu, Shumin
Subject: [Patch] MdeModulePkg/Bds: Fix build failures of VS tool chain

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

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 2eb8971..beb2eaf 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -699,6 +699,7 @@ BmExpandUriDevicePath (
 Handles = NULL;
   }
 
+  FileBuffer = NULL;
   for (Index = 0; Index < HandleCount; Index++) {
 FileBuffer = BmGetFileBufferFromLoadFile (Handles[Index], FilePath, 
FullPath, FileSize);
 if (FileBuffer != NULL) {
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
index c6ac242..29c1bfa 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
@@ -232,7 +232,7 @@ BmSetMemoryTypeInformationVariable (
 // Do not count the reserved memory occupied by RAM Disk.
 //
 if (CurrentMemoryTypeInformation[Index1].Type == EfiReservedMemoryType) {
-  CurrentMemoryTypeInformation[Index1].NumberOfPages -= RamDiskSizeInPages;
+  CurrentMemoryTypeInformation[Index1].NumberOfPages -= (UINT32) 
+ RamDiskSizeInPages;
 }
 
 //
--
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] MdeModulePkg/Bds: Fix build failures of VS tool chain

2016-04-06 Thread Wang, Sunny (HPS SW)
Thanks for fixing this.
Reviewed-by: Sunny Wang 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ruiyu Ni
Sent: Thursday, April 07, 2016 10:14 AM
To: edk2-devel@lists.01.org
Cc: Ruiyu Ni ; Shumin Qiu 
Subject: [edk2] [Patch] MdeModulePkg/Bds: Fix build failures of VS tool chain

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

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 2eb8971..beb2eaf 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -699,6 +699,7 @@ BmExpandUriDevicePath (
 Handles = NULL;
   }
 
+  FileBuffer = NULL;
   for (Index = 0; Index < HandleCount; Index++) {
 FileBuffer = BmGetFileBufferFromLoadFile (Handles[Index], FilePath, 
FullPath, FileSize);
 if (FileBuffer != NULL) {
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
index c6ac242..29c1bfa 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
@@ -232,7 +232,7 @@ BmSetMemoryTypeInformationVariable (
 // Do not count the reserved memory occupied by RAM Disk.
 //
 if (CurrentMemoryTypeInformation[Index1].Type == EfiReservedMemoryType) {
-  CurrentMemoryTypeInformation[Index1].NumberOfPages -= RamDiskSizeInPages;
+  CurrentMemoryTypeInformation[Index1].NumberOfPages -= (UINT32) 
+ RamDiskSizeInPages;
 }
 
 //
--
2.7.0.windows.1

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


[edk2] [Patch] MdeModulePkg/Bds: Fix build failures of VS tool chain

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

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 2eb8971..beb2eaf 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -699,6 +699,7 @@ BmExpandUriDevicePath (
 Handles = NULL;
   }
 
+  FileBuffer = NULL;
   for (Index = 0; Index < HandleCount; Index++) {
 FileBuffer = BmGetFileBufferFromLoadFile (Handles[Index], FilePath, 
FullPath, FileSize);
 if (FileBuffer != NULL) {
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
index c6ac242..29c1bfa 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
@@ -232,7 +232,7 @@ BmSetMemoryTypeInformationVariable (
 // Do not count the reserved memory occupied by RAM Disk.
 //
 if (CurrentMemoryTypeInformation[Index1].Type == EfiReservedMemoryType) {
-  CurrentMemoryTypeInformation[Index1].NumberOfPages -= RamDiskSizeInPages;
+  CurrentMemoryTypeInformation[Index1].NumberOfPages -= (UINT32) 
RamDiskSizeInPages;
 }
 
 //
-- 
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 03/12] FatBinPkg: Change to 2-clause BSD license

2016-04-06 Thread Ni, Ruiyu
My understanding is:
Shell is a very standalone project so the binary package was
created for a certain level of isolation. And it does save build
time. It also assumes that most of the users don't need to
source debug the Shell.

Fat is similar to Shell. But I agree the build time saving is not
noticeable comparing to Shell because after all it's just a normal
driver.

FatBinPkg was widely referenced by many platforms. So in order
to not break existing customers, we would like to keep it.

If our original recommendation was to use FatBinPkg, I think
now our recommendation is to use FatPkg.

In someday, when FatBinPkg is no longer referenced by any
platform, we can safely remove it.

Regards,
Ray

From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo 
Ersek
Sent: Thursday, April 7, 2016 2:05 AM
To: Justen, Jordan L ; edk2-de...@ml01.01.org
Cc: Ni, Ruiyu 
Subject: Re: [edk2] [PATCH 03/12] FatBinPkg: Change to 2-clause BSD license

On 04/06/16 17:14, Jordan Justen wrote:
> The FatPkg is now open source. Update FatBinPkg license to match
> FatPkg.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jordan Justen 
> >
> Cc: Ruiyu Ni >
> ---
>  FatBinPkg/FatBinPkg.dec |  2 +-
>  FatBinPkg/License.txt   | 53 
> ++---
>  2 files changed, 20 insertions(+), 35 deletions(-)

I understand this would follow the example of ShellBinPkg, but,
actually, I don't even understand why ShellBinPkg exists (in binary
form) in the tree.

Could we drop FatBinPkg instead of this patch? After the license update,
it's no different from any other UEFI_DRIVER (/ PEIM), management-wise.

Thanks
Laszlo

> diff --git a/FatBinPkg/FatBinPkg.dec b/FatBinPkg/FatBinPkg.dec
> index 1676086..6ac577a 100644
> --- a/FatBinPkg/FatBinPkg.dec
> +++ b/FatBinPkg/FatBinPkg.dec
> @@ -1,5 +1,5 @@
>  ## @file
> -# This package provides binary device drivers to support the FAT32 file 
> system. This package is separated from other packages because it uses a 
> different license.
> +# This package provides binary device drivers to support the FAT32 file 
> system.
>  #
>  # This package provides FAT drivers which are not licensed under BSD.
>  # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
> diff --git a/FatBinPkg/License.txt b/FatBinPkg/License.txt
> index 59b71bd..be68999 100644
> --- a/FatBinPkg/License.txt
> +++ b/FatBinPkg/License.txt
> @@ -1,40 +1,25 @@
> -Copyright (c) 2006, Intel Corporation. All rights reserved.
> +Copyright (c) 2012, Intel Corporation. All rights reserved.
>
>  Redistribution and use in source and binary forms, with or without
> -modification, are permitted provided that the following conditions are
> -met:
> +modification, are permitted provided that the following conditions
> +are met:
>
> -  .  Redistributions of source code must retain the above copyright
> - notice, this list of conditions and the following disclaimer.
> -
> -  .  Redistributions in binary form must reproduce the above copyright
> - notice, this list of conditions and the following disclaimer in
> - the documentation and/or other materials provided with the
> - distribution.
> -
> -  .  Neither the name of Intel nor the names of its contributors may
> - be used to endorse or promote products derived from this software
> - without specific prior written permission.
> +* Redistributions of source code must retain the above copyright
> +  notice, this list of conditions and the following disclaimer.
> +* Redistributions in binary form must reproduce the above copyright
> +  notice, this list of conditions and the following disclaimer in
> +  the documentation and/or other materials provided with the
> +  distribution.
>
>  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> -
> -Additional terms: In addition to the forgoing, redistribution and use
> -of the code is conditioned upon the FAT 32 File System Driver and all
> -derivative works thereof being used for and designed only to read
> -and/or write to a file system that is directly managed by Intel's

Re: [edk2] [PATCH V2 0/8] Move S3Ready() functional code from AcpiS3SaveDxe to S3SaveStateDxe

2016-04-06 Thread Yao, Jiewen
MdeModelPkg/IntelFrameworkModulePkg reviewed by: jiewen@intel.com

> -Original Message-
> From: Zeng, Star
> Sent: Wednesday, April 6, 2016 8:40 PM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Tian, Feng ;
> Fan, Jeff ; Laszlo Ersek ; Justen,
> Jordan L 
> Subject: [PATCH V2 0/8] Move S3Ready() functional code from
> AcpiS3SaveDxe to S3SaveStateDxe
> 
> The S3Ready() functional code in AcpiS3SaveDxe of
> IntelFrameworkModulePkg
> is to do ACPI S3 Context save. In fact, that is not really related to
> Intel framework ACPI S3 protocol.
> 
> IntelFrameworkModulePkg will be deprecated step by step, so move the
> functional code to MdeModulePkg and S3SaveStateDxe is a good place.
> The ACPI global variable related code is leaved as is in
> IntelFrameworkModulePkg
> AcpiS3SaveDxe for compatibility.
> PcdS3BootScriptStackSize is also moved from IntelFrameworkModulePkg.
> 
> The functional code need to get ACPI FACS table and consume LockBoxLib,
> so need to be before DxeSmmReadyToLock that will shut down SMM lock
> box
> interface, EndOfDxe is a good time point (OVMF AcpiS3SaveDxe has the
> reference implementation).
> 
> After the movement, AcpiS3SaveDxe in OvmfPkg could be retired.
> With this patch series, I did S3 test on real platform and normal boot for
> OVMF.
> 
> Laszlo & Jordan, could you help confirm the S3 functionality for OVMF?
> 
> V2:
> Major change to V1 is to introduce a new PCD PcdAcpiS3Enable.
> It is for the concern to V1, detailed discussion about V1 is at
> http://article.gmane.org/gmane.comp.bios.edk2.devel/10261
> 
> Cc: Jiewen Yao 
> Cc: Feng Tian 
> Cc: Jeff Fan 
> Cc: Laszlo Ersek 
> Cc: Jordan Justen 
> Star Zeng (8):
>   MdeModulePkg: Introduce new PCD PcdAcpiS3Enable
>   OvmfPkg: Set PcdAcpiS3Enable according to QemuFwCfgS3Enabled()
>   OvmfPkg: Install LockBox protocol in constructor of LockBoxDxeLib
>   MdeModulePkg S3SaveStateDxe: Consume PcdAcpiS3Enable to control
> the
> code
>   MdeModulePkg S3SaveStateDxe: Move S3Ready() functional code from
> AcpiS3SaveDxe
>   OvmfPkg: Retire AcpiS3SaveDxe
>   IntelFrameworkModulePkg AcpiS3SaveDxe: Consume PcdAcpiS3Enable to
> control the code
>   IntelFrameworkModulePkg AcpiS3SaveDxe: Remove S3Ready() functional
> code
> 
>  .../IntelFrameworkModulePkg.dec|   8 +-
>  .../IntelFrameworkModulePkg.uni|   6 +-
>  .../Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c  | 455
> +
>  .../Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf |  12 +-
>  .../Acpi/AcpiS3SaveDxe/AcpiVariableThunkPlatform.c |   6 +-
>  MdeModulePkg/MdeModulePkg.dec  |  12 +
>  MdeModulePkg/MdeModulePkg.uni  |  10 +
>  .../Acpi/S3SaveStateDxe/AcpiS3ContextSave.c| 212 +-
>  .../Acpi/S3SaveStateDxe/InternalS3SaveState.h  |  18 +-
>  .../Universal/Acpi/S3SaveStateDxe/S3SaveState.c|  17 +-
>  .../Acpi/S3SaveStateDxe/S3SaveStateDxe.inf |  22 +-
>  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf|  77 
>  OvmfPkg/Library/LockBoxLib/LockBoxDxe.c|  31 +-
>  OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf   |   6 +-
>  OvmfPkg/OvmfPkgIa32.dsc|   2 +-
>  OvmfPkg/OvmfPkgIa32.fdf|   3 +-
>  OvmfPkg/OvmfPkgIa32X64.dsc |   2 +-
>  OvmfPkg/OvmfPkgIa32X64.fdf |   3 +-
>  OvmfPkg/OvmfPkgX64.dsc |   2 +-
>  OvmfPkg/OvmfPkgX64.fdf |   3 +-
>  OvmfPkg/PlatformPei/Platform.c |   4 +-
>  OvmfPkg/PlatformPei/PlatformPei.inf|   3 +-
>  22 files changed, 226 insertions(+), 688 deletions(-)
>  rename OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c =>
> MdeModulePkg/Universal/Acpi/S3SaveStateDxe/AcpiS3ContextSave.c (74%)
>  delete mode 100644 OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
> 
> --
> 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] SecurityPkg/Tpm12CommandLib: Fix Tpm12NvWriteValue cmd.

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

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Derek Lin
> Sent: Thursday, April 7, 2016 9:55 AM
> To: edk2-devel@lists.01.org
> Cc: Derek Lin 
> Subject: [edk2] [PATCH] SecurityPkg/Tpm12CommandLib: Fix
> Tpm12NvWriteValue cmd.
> 
> Fix command length endian.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Derek Lin 
> ---
>  SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c | 11
> +++
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c
> b/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c
> index 7baafa8..e176b00 100644
> --- a/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c
> +++ b/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c
> @@ -2,6 +2,7 @@
>Implement TPM1.2 NV storage related command.
> 
>  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved. 
> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD
> License
>  which accompanies this distribution.  The full text of the license may be
> found at
> @@ -199,8 +200,9 @@ Tpm12NvWriteValue (
>  {
>EFI_STATUS  Status;
>TPM_CMD_NV_WRITE_VALUE  Command;
> +  UINT32  CommandLength;
>TPM_RSP_COMMAND_HDR Response;
> -  UINT32  Length;
> +  UINT32  ResponseLength;
> 
>if (DataSize > sizeof (Command.Data)) {
>  return EFI_UNSUPPORTED;
> @@ -210,14 +212,15 @@ Tpm12NvWriteValue (
>// send Tpm command TPM_ORD_NV_WriteValue
>//
>Command.Hdr.tag   = SwapBytes16 (TPM_TAG_RQU_COMMAND);
> -  Command.Hdr.paramSize = SwapBytes32 (sizeof (Command) -
> sizeof(Command.Data) + DataSize);
> +  CommandLength = sizeof (Command) - sizeof(Command.Data) +
> DataSize;
> +  Command.Hdr.paramSize = SwapBytes32 (CommandLength);
>Command.Hdr.ordinal   = SwapBytes32 (TPM_ORD_NV_WriteValue);
>Command.NvIndex   = SwapBytes32 (NvIndex);
>Command.Offset= SwapBytes32 (Offset);
>Command.DataSize  = SwapBytes32 (DataSize);
>CopyMem (Command.Data, Data, DataSize);
> -  Length = sizeof (Response);
> -  Status = Tpm12SubmitCommand (Command.Hdr.paramSize, (UINT8
> *), , (UINT8 *));
> +  ResponseLength = sizeof (Response);
> +  Status = Tpm12SubmitCommand (CommandLength, (UINT8
> *), , (UINT8 *));
>if (EFI_ERROR (Status)) {
>  return Status;
>}
> --
> 2.7.4.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] SecurityPkg/Tpm12CommandLib: Fix Tpm12NvWriteValue cmd.

2016-04-06 Thread Derek Lin
Fix command length endian.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Derek Lin 
---
 SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c 
b/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c
index 7baafa8..e176b00 100644
--- a/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c
+++ b/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c
@@ -2,6 +2,7 @@
   Implement TPM1.2 NV storage related command.
 
 Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved. 
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -199,8 +200,9 @@ Tpm12NvWriteValue (
 {
   EFI_STATUS  Status;
   TPM_CMD_NV_WRITE_VALUE  Command;
+  UINT32  CommandLength;
   TPM_RSP_COMMAND_HDR Response;
-  UINT32  Length;
+  UINT32  ResponseLength;
 
   if (DataSize > sizeof (Command.Data)) {
 return EFI_UNSUPPORTED;
@@ -210,14 +212,15 @@ Tpm12NvWriteValue (
   // send Tpm command TPM_ORD_NV_WriteValue
   //
   Command.Hdr.tag   = SwapBytes16 (TPM_TAG_RQU_COMMAND);
-  Command.Hdr.paramSize = SwapBytes32 (sizeof (Command) - sizeof(Command.Data) 
+ DataSize);
+  CommandLength = sizeof (Command) - sizeof(Command.Data) + DataSize;
+  Command.Hdr.paramSize = SwapBytes32 (CommandLength);
   Command.Hdr.ordinal   = SwapBytes32 (TPM_ORD_NV_WriteValue);
   Command.NvIndex   = SwapBytes32 (NvIndex);
   Command.Offset= SwapBytes32 (Offset);
   Command.DataSize  = SwapBytes32 (DataSize);
   CopyMem (Command.Data, Data, DataSize);
-  Length = sizeof (Response);
-  Status = Tpm12SubmitCommand (Command.Hdr.paramSize, (UINT8 *), 
, (UINT8 *));
+  ResponseLength = sizeof (Response);
+  Status = Tpm12SubmitCommand (CommandLength, (UINT8 *), 
, (UINT8 *));
   if (EFI_ERROR (Status)) {
 return Status;
   }
-- 
2.7.4.windows.1

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


Re: [edk2] [PATCH V2 0/8] Move S3Ready() functional code from AcpiS3SaveDxe to S3SaveStateDxe

2016-04-06 Thread Zeng, Star

On 2016/4/7 0:04, Laszlo Ersek wrote:

Hi Star,

On 04/06/16 14:40, Star Zeng wrote:

The S3Ready() functional code in AcpiS3SaveDxe of IntelFrameworkModulePkg
is to do ACPI S3 Context save. In fact, that is not really related to
Intel framework ACPI S3 protocol.

IntelFrameworkModulePkg will be deprecated step by step, so move the
functional code to MdeModulePkg and S3SaveStateDxe is a good place.
The ACPI global variable related code is leaved as is in IntelFrameworkModulePkg
AcpiS3SaveDxe for compatibility.
PcdS3BootScriptStackSize is also moved from IntelFrameworkModulePkg.

The functional code need to get ACPI FACS table and consume LockBoxLib,
so need to be before DxeSmmReadyToLock that will shut down SMM lock box
interface, EndOfDxe is a good time point (OVMF AcpiS3SaveDxe has the
reference implementation).

After the movement, AcpiS3SaveDxe in OvmfPkg could be retired.
With this patch series, I did S3 test on real platform and normal boot for OVMF.

Laszlo & Jordan, could you help confirm the S3 functionality for OVMF?

V2:
Major change to V1 is to introduce a new PCD PcdAcpiS3Enable.
It is for the concern to V1, detailed discussion about V1 is at
http://article.gmane.org/gmane.comp.bios.edk2.devel/10261


* I like this version very much. I tested it extensively:

   guest OS  SMM  S3   OVMFQEMU  tests done
 enabled  enabled  platformmachine type
     ---  ---  --    ---
   Fedorano   no   X64 pcnormal boot
   Fedorano   yes  X64 pcnormal boot, S3
   Fedorayes  no   Ia32X64 q35   normal boot
   Fedorayes  yes  Ia32X64 q35   normal boot, S3
   Win 8.1   yes  no   Ia32X64 q35   normal boot
   Win 8.1   yes  yes  Ia32X64 q35   normal boot, S3

All tests passed with your series applied.

* Beyond the functional testing, I also compared OVMF log files. Namely,
I ran all six tests both without and with your series, capturing the
OVMF logs (12 log files in total), and for each one of the six test
cases, I compared the without-patches log against the with-patches log.

Everything looks good. The changes incurred by your patches can be
tracked to the logs. In addition, I found two interesting changes:

(1) With your patches applied, when S3 is disabled -- and regardless of
SMM --, the EfiS3SaveStateProtocol is also not produced. This is an
improvement (= memory saving) for OVMF, because at the moment, OVMF
knows not to consume EfiS3SaveStateProtocol when S3 is disabled, but it
cannot prevent EfiS3SaveStateProtocol from being produced. With your
patches, EfiS3SaveStateProtocol is not even produced, which is welcome.

(2) in the two cases when the platform is Ia32X64 and S3 is enabled, I
found that

   TotalPageTableSize - 42 pages

changed to

   AcpiS3ContextSave TotalPageTableSize - 0xE pages

with your patches applied.

This is due to your commit 353f5ba92f94

   IntelFrameworkModulePkg AcpiS3SaveDxe: Reduce reserved memory
   consumption"

which OvmfPkg's clone of AcpiS3SaveDxe has been missing (we had forked
it before your commit). With your patches applied, this improvement gets
applied to OVMF automatically. That is also very welcome. :)

* I want the mailing list to preserve my log files (described above).
Since they are quite big when uncompressed, and I cannot send binary
attachments to the list, I tarred them, compressed the tarball with xz,
and attached the base64-encoded tar.xz. It is not big in this form (~43 KB).

* You can add

Tested-by: Laszlo Ersek 

to patches #1 through #6 . My testing covered OvmfPkg and the new
MdeModulePkg code. I didn't test the IntelFrameworkModulePkg changes
(patches #7 and #8).

Should you significantly modify these patches (for v3) in response to
another reviewer's comments, then please do not apply my Tested-by. If
the changes are trivial, then it is okay to keep my Tested-by.

* I will also reply with review comments to some of the individual
patches. None of my comments will be functional, only cosmetic.

Please send a v3 with those cosmetic warts fixed up. (If you will have
no other changes in v3, then you can keep all of my Tested-by tags from
above, of course.)


Thanks for the comments, R-b and good test results. That make me 
confident to the patches' quality.


Thanks,
Star



Thank you!
Laszlo



Cc: Jiewen Yao 
Cc: Feng Tian 
Cc: Jeff Fan 
Cc: Laszlo Ersek 
Cc: Jordan Justen 
Star Zeng (8):
   MdeModulePkg: Introduce new PCD PcdAcpiS3Enable
   OvmfPkg: Set PcdAcpiS3Enable according to QemuFwCfgS3Enabled()
   OvmfPkg: Install LockBox protocol in constructor of LockBoxDxeLib
   MdeModulePkg S3SaveStateDxe: Consume PcdAcpiS3Enable to control the
 code
   MdeModulePkg S3SaveStateDxe: Move 

Re: [edk2] [PATCH V2 3/8] OvmfPkg: Install LockBox protocol in constructor of LockBoxDxeLib

2016-04-06 Thread Zeng, Star

The comments below are fair enough, accepted.

Thanks,
Star

On 2016/4/7 0:24, Laszlo Ersek wrote:

On 04/06/16 14:40, Star Zeng wrote:

Currently, the LockBox protocol is installed in entrypoint of
OVMF AcpiS3SaveDxe, that is strange.


(6) please remove the phrase

   that is strange

It is not strange; the commit message for the change justified it. (In
other words, what the patch does is fine, but the code being removed is
not strange or unjustified.)


We can let the first driver run with LockBoxDxeLib linked to have its
library constructor to install LockBox protocol on the ImageHandle.
As other drivers may have gEfiLockBoxProtocolGuid dependency,
the first driver () should run before them.


(7) Please remove "()" here; it is confusing.



The later patches to retire AcpiS3SaveDxe for OVMF depends on this patch.

Cc: Laszlo Ersek 
Cc: Jordan Justen 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
  OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c   | 13 +---
  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf  |  6 +-
  OvmfPkg/Library/LockBoxLib/LockBoxDxe.c  | 31 ++--
  OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf |  6 +-
  4 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c 
b/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
index e3ff23410145..176f598fe686 100644
--- a/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
+++ b/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
@@ -6,7 +6,7 @@
End-of-Dxe event.

  Copyright (c) 2014-2015, Red Hat, Inc.
-Copyright (c) 2006 - 2013, 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
@@ -28,12 +28,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
  #include 
  #include 
  #include 
-#include 
  #include 
  #include 
  #include 
  #include 
-#include 
  #include 

  EFI_GUID  mAcpiS3IdtrProfileGuid = {
@@ -538,15 +536,6 @@ InstallEndOfDxeCallback (
  return EFI_LOAD_ERROR;
}

-  if (!FeaturePcdGet (PcdSmmSmramRequire)) {
-Status = gBS->InstallMultipleProtocolInterfaces (
-,
-, NULL,
-NULL
-);
-ASSERT_EFI_ERROR (Status);
-  }
-
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_CALLBACK,
diff --git a/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf 
b/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
index a288b954b791..f067fc7bf0e5 100644
--- a/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
+++ b/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
@@ -1,7 +1,7 @@
  ## @file
  # AcpiS3Save module installs EndOfDxe callback to prepare S3 boot data.
  #
-# Copyright (c) 2006 - 2011, 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
@@ -36,7 +36,6 @@ [Packages]
MdeModulePkg/MdeModulePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
-  OvmfPkg/OvmfPkg.dec

  [LibraryClasses]
PcdLib
@@ -49,7 +48,6 @@ [LibraryClasses]
LockBoxLib
DebugLib
DxeServicesLib
-  QemuFwCfgLib

  [Guids]
gEfiAcpiVariableGuid  # ALWAYS_CONSUMED
@@ -59,7 +57,6 @@ [Guids]
gEfiEndOfDxeEventGroupGuid## CONSUMES  ## Event

  [Protocols]
-  gEfiLockBoxProtocolGuid   # PROTOCOL SOMETIMES_PRODUCED
gEfiLegacyBiosProtocolGuid# PROTOCOL ALWAYS_CONSUMED
gEfiLegacyRegion2ProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
gFrameworkEfiMpServiceProtocolGuid# PROTOCOL SOMETIMES_CONSUMED
@@ -71,7 +68,6 @@ [Pcd]
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3AcpiReservedMemorySize## 
CONSUMES
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3BootScriptStackSize   ## 
CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable
-  gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire## 
CONSUMES

  [Depex]
gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
diff --git a/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c 
b/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c
index c8f2ec8a4ee4..5d2d21fdb495 100644
--- a/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c
+++ b/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c
@@ -1,6 +1,6 @@
  /** @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 

Re: [edk2] [PATCH V2 2/8] OvmfPkg: Set PcdAcpiS3Enable according to QemuFwCfgS3Enabled()

2016-04-06 Thread Zeng, Star

On 2016/4/7 0:16, Laszlo Ersek wrote:

On 04/06/16 14:40, Star Zeng wrote:

Also need to declare PcdAcpiS3Enable as DynamicDefault in *.dsc.

Cc: Laszlo Ersek 
Cc: Jordan Justen 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
  OvmfPkg/OvmfPkgIa32.dsc | 1 +
  OvmfPkg/OvmfPkgIa32X64.dsc  | 1 +
  OvmfPkg/OvmfPkgX64.dsc  | 1 +
  OvmfPkg/PlatformPei/Platform.c  | 4 +++-
  OvmfPkg/PlatformPei/PlatformPei.inf | 3 ++-
  5 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 9e5b47738bd3..8136b80769b4 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -462,6 +462,7 @@ [PcdsDynamicDefault]
gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size|0x0

gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|TRUE


(1) Although this is not a "hard" requirement, and also not an
all-too-well defined one, I like to keep PCD settings "clustered" by
token space. (Functional relations are a stronger clustering guideline,
but this new PCD is not functionally related to any other PCD we have in
here.)

Thus, can you please locate

   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution

just a bit higher up (it is not visible in the context), and insert
PcdAcpiS3Enable right under it?

For the other DSC files as well. Thanks.

(2) Please set the default value to FALSE.

More comments below:



# Set video resolution for text setup.
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 6e4da4ff55c4..92f98fe23fcc 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -470,6 +470,7 @@ [PcdsDynamicDefault]
gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size|0x8

gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|TRUE

# Set video resolution for text setup.
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 3d6d43ef73ab..9e60b498f97d 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -469,6 +469,7 @@ [PcdsDynamicDefault]
gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size|0x8

gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|TRUE

# Set video resolution for text setup.
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 509343e0bee5..5774c61ad2a7 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -1,7 +1,7 @@
  /**@file
Platform PEI driver

-  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
@@ -585,6 +585,8 @@ InitializePlatform (
if (QemuFwCfgS3Enabled ()) {
  DEBUG ((EFI_D_INFO, "S3 support was detected on QEMU\n"));
  mS3Supported = TRUE;
+  } else {
+PcdSetBoolS (PcdAcpiS3Enable, FALSE);
}


(3) So, this else branch should be eliminated, and the opposite setting
(-> TRUE) should occur on the existent branch.

(4) Please either use PcdSetBool(), or check the return status of
PcdSetBoolS(). My vote would be PcdSetBool(), but if you prefer
PcdSetBoolS(), please add an ASSERT_EFI_ERROR().


I accept all the comments except this one I will select PcdSetBoolS() + 
ASSERT_EFI_ERROR() as PcdSetBool will be disabled at some day by 
DISABLE_NEW_DEPRECATED_INTERFACES.


Thanks,
Star





S3Verification ();
diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf 
b/OvmfPkg/PlatformPei/PlatformPei.inf
index 5b643a358f1f..de574684ebf2 100644
--- a/OvmfPkg/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/PlatformPei/PlatformPei.inf
@@ -2,7 +2,7 @@
  #  Platform PEI driver
  #
  #  This module provides platform specific function to detect boot mode.
-#  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
@@ -95,6 +95,7 @@ [Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack
gEfiMdeModulePkgTokenSpaceGuid.PcdPropertiesTableEnable
gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable


(5) Similarly to (1), please move this right under

   gEfiMdeModulePkgTokenSpaceGuid.PcdPropertiesTableEnable

Thanks!
Laszlo



  [FixedPcd]

[edk2] Building a SMM_CORE module as an XIP image

2016-04-06 Thread Achin Gupta
Hi All,

I am prototyping the proposal made in ECR #1390 (MM in Standalone mode etc) on
the Juno and FVP ARM development platforms. The prototype mainly has a module of
type SMM_CORE that contains:

a. The MM Foundation code in Standalone mode. Lets call the entry point of this
   module SmmMain().

b. Libraries that a) depends upon.

I am able to build this module as a PE/COFF executable. Lets call it
SmmCore.efi. An SMM_CORE module is usually dispatched during DXE. In my use
case, I want to dispatch it from ARM Trusted firmware. To do this I need to
build this module so that:

1. It is an XIP image that can be copied by ARM Trusted Firmware from Flash to
   volatile memory
2. ARM TF is able to pass control to SmmMain() without requiring understand a
   file format like PE/COFF or ELF. Ideally, it should just be enough to pass
   control to the first address of the image.
3. It should be possble to include standalone SMM drivers in this image in the
   future that the MM Foundation can dispatch.

Being a complete newbie, the closest existing solution that I could see is the
mechanism that is used build and run FD images for the Juno and FVP ARM
development platforms. AFAIU, the BL33_AP_UEFI.fd has a branch instruction at
its lowest address that jumps to the _ModuleEntryPoint() of the SEC module. The
SEC module (ArmPlatformPkg/PrePi/PeiMPCore.inf) is pulled into the
FVMAIN_COMPACT as a Terse executable in a file of type
EFI_FV_FILETYPE_SECURITY_CORE..

So, I wrote a SmmCore.fdf similar to ArmVExpress-FVP-AArch64.fdf that pulls in
SmmCore.inf into FV.FVMAIN_COMPACT by tweaking [Rule.Common.SEC] to
[Rule.Common.SMM_CORE]. This pulls in the SmmCore.efi as a SEC File in the
firmware volume.

This hackery creates a SmmCore.fd where the first instruction is a branch. Just
like the BL33_AP_UEFI.fd, ARM TF should be able to load and run this file as
described in 2. above. However, I see that the branch is not to
SmmMain(). Instead it is to the _ModuleEntryPoint() from a DriverEntryPoint
library that the SmmCore.inf depends upon. On closer inspection, I see that the
SmmCore.efi was build with _ModuleEntryPoint() passed as the parameter the
Linker's "-e" and "-u" flags.

I tried adding a build option to SmmCore.dsc to change the entry point as
follows:

*_*_*_DLINK_FLAGS = --entry SmmMain

This appends the correct "-e" option to the linker flags but the branch is still
not to SmmMain().

Having run out of ideas that are within the bounds of the EDK2 build system, I
would like to know:

a. Is this the right approach to fulfill the requirements in at least 1) & 2)
   above?

b. Is it actually possible to make the hack above work? If so, then what am I
   missing?

Any help in this matter will be greatly appreciated. Please let me know if you
need any clarifications.

thanks a lot,
Achin
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

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


Re: [edk2] [PATCH 04/21] ArmVirtPkg/FdtClientDxe: implement new driver

2016-04-06 Thread Laszlo Ersek
On 04/06/16 18:15, Ard Biesheuvel wrote:
> This implements a new DXE driver FdtClientDxe to produce the FDT client
> protocol based on a device tree image supplied by the virt host.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel 
> ---
>  ArmVirtPkg/FdtClientDxe/FdtClientDxe.c   | 236 
>  ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf |  48 
>  2 files changed, 284 insertions(+)

Starting with the INF file:

> diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf 
> b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> new file mode 100644
> index ..55a1e680ce7c
> --- /dev/null
> +++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> @@ -0,0 +1,48 @@
> +## @file
> +#  FDT client driver
> +#
> +#  Copyright (c) 2016, Linaro Ltd. All rights reserved.
> +#
> +#  This program and the accompanying materials are
> +#  licensed and made available under the terms and conditions of the BSD 
> License
> +#  which accompanies this distribution.  The full text of the license may be 
> found at
> +#  http://opensource.org/licenses/bsd-license.php
> +#
> +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION= 0x00010005
> +  BASE_NAME  = FdtClientDxe
> +  FILE_GUID  = 9A871B00-1C16-4F61-8D2C-93B6654B5AD6
> +  MODULE_TYPE= DXE_DRIVER
> +  VERSION_STRING = 1.0
> +  ENTRY_POINT= InitializeFdtClientDxe
> +
> +[Sources]
> +  FdtClientDxe.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  ArmVirtPkg/ArmVirtPkg.dec
> +  EmbeddedPkg/EmbeddedPkg.dec
> +
> +[LibraryClasses]
> +  BaseLib
> +  PcdLib
> +  UefiDriverEntryPoint
> +  FdtLib
> +  HobLib
> +  UefiBootServicesTableLib

(5) For new code, please strive to keep the Packages / LibraryClasses /
etc sections in INF files sorted. First, it looks nice; second (more
importantly), it helps you verify that you list all the library classes
explicitly that you depend on.

For example, DebugLib.h is included from the source code (correctly),
but DebugLib is not present here (it should be). The linker succeeds
because one of the library instances we depend on pulls in DebugLib
anyway, but it's not nice. Concord can be reached if the C source
includes Library/*.h headers until the compiler stops whining (and
nothing more), and if the LibraryClasses section is consequently matched
to the include list (+ UefiDriverEntryPoint).

Similarly, PcdLib looks superfluous. Etc.

> +
> +[Protocols]
> +  gFdtClientProtocolGuid

(6) Please add "## PRODUCES".

> +
> +[Guids]
> +  gFdtHobGuid
> +
> +[Depex]
> +  TRUE
>

C file:

> diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c 
> b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
> new file mode 100644
> index ..716194ef798a
> --- /dev/null
> +++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
> @@ -0,0 +1,236 @@
> +/** @file
> +*  FDT client driver
> +*
> +*  Copyright (c) 2016, Linaro Ltd. All rights reserved.
> +*
> +*  This program and the accompanying materials are
> +*  licensed and made available under the terms and conditions of the BSD 
> License
> +*  which accompanies this distribution.  The full text of the license may be 
> found at
> +*  http://opensource.org/licenses/bsd-license.php
> +*
> +*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> +*
> +**/
> +
> +#include 
> +#include 
> +#include 

(7) Can you remove BaseLib.h and UefiLib.h? Hmmm wait, BaseLib.h is
needed for AsciiStrCmp() below.

What about UefiLib.h though?

> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 

(8)  should be unnecessary.

> +#include 
> +
> +#include 
> +
> +STATIC VOID  *mDeviceTreeBase;
> +
> +STATIC
> +EFI_STATUS
> +GetNodeProperty (
> +  IN  FDT_CLIENT_PROTOCOL *This,
> +  IN  INT32   Node,
> +  IN  CONST CHAR8 *PropertyName,
> +  OUT CONST VOID  **Prop,
> +  OUT UINTN   *PropSize OPTIONAL
> +  )
> +{
> +  INT32 Len;
> +
> +  ASSERT (mDeviceTreeBase != NULL);
> +
> +  *Prop = fdt_getprop (mDeviceTreeBase, Node, PropertyName, );
> +  if (*Prop == NULL) {
> +return EFI_NOT_FOUND;
> +  }
> +
> +  if (PropSize != NULL) {
> +*PropSize = Len;

(9) I think we can present the property size directly as UINT32 in the
protocol interface.

> +  }
> +  return EFI_SUCCESS;
> +}
> +
> +STATIC
> +EFI_STATUS
> +SetNodeProperty (
> +  IN  FDT_CLIENT_PROTOCOL *This,
> +  IN  INT32   Node,
> +  IN  CONST CHAR8 *PropertyName,
> +  IN  CONST VOID  *Prop,
> +  IN  UINTN   PropSize
> +  )
> +{
> +  INT32 Ret;
> +
> +  ASSERT (mDeviceTreeBase != 

Re: [edk2] [PATCH 03/21] ArmVirtPkg: drop dependency on PeiPcdLib for PEI Pcd.inf

2016-04-06 Thread Laszlo Ersek
On 04/06/16 18:15, Ard Biesheuvel wrote:
> The PcdPeim dynamic PCD driver is dispatched explicitly via an 'A PRIORI'
> declaration in the platform DSC. Without that declaration, the PEI module
> can never be dispatched since it transitively depends on protocols it

(4) s/protocols/the PPI/

with that,

Reviewed-by: Laszlo Ersek 

> produces itself via PeiPcdLib. So use the NULL PcdLib explicitly only for
> this driver.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel 
> ---
>  ArmVirtPkg/ArmVirtQemu.dsc | 5 -
>  ArmVirtPkg/ArmVirtQemu.fdf | 3 ---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
> index a1a281303ac4..5a158c2de94b 100644
> --- a/ArmVirtPkg/ArmVirtQemu.dsc
> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
> @@ -255,7 +255,10 @@ [Components.common]
>#
>ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
>MdeModulePkg/Core/Pei/PeiMain.inf
> -  MdeModulePkg/Universal/PCD/Pei/Pcd.inf
> +  MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
> +
> +  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> +  }
>ArmPlatformPkg/PlatformPei/PlatformPeim.inf
>ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
>ArmPkg/Drivers/CpuPei/CpuPei.inf
> diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
> index ef456539cc62..600e10882434 100644
> --- a/ArmVirtPkg/ArmVirtQemu.fdf
> +++ b/ArmVirtPkg/ArmVirtQemu.fdf
> @@ -262,9 +262,6 @@ [FV.FVMAIN_COMPACT]
>  READ_LOCK_CAP  = TRUE
>  READ_LOCK_STATUS   = TRUE
>  
> -  APRIORI PEI {
> -INF  MdeModulePkg/Universal/PCD/Pei/Pcd.inf
> -  }
>INF ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
>INF MdeModulePkg/Core/Pei/PeiMain.inf
>INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf
> 

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


Re: [edk2] [PATCH 02/21] ArmVirtPkg: drop dependency on DxePcdLib for DXE Pcd.inf

2016-04-06 Thread Laszlo Ersek
On 04/06/16 18:15, Ard Biesheuvel wrote:
> The PcdDxe dynamic PCD driver is dispatched explicitly via an 'A PRIORI'
> declaration in the platform DSC. Without that declaration, the DXE driver
> can never be dispatched since it transitively depends on protocols it
> produces itself via DxePcdLib. So use the NULL PcdLib explicitly only for
> this driver.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel 
> ---
>  ArmVirtPkg/ArmVirtQemu.dsc   | 5 -
>  ArmVirtPkg/ArmVirtQemuKernel.dsc | 5 -
>  ArmVirtPkg/ArmVirtXen.dsc| 5 -
>  3 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
> index e626df768f85..a1a281303ac4 100644
> --- a/ArmVirtPkg/ArmVirtQemu.dsc
> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
> @@ -274,7 +274,10 @@ [Components.common]
>  
>
> NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
>}
> -  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> +  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
> +
> +  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> +  }
>  
>#
># Architectural Protocols
> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc 
> b/ArmVirtPkg/ArmVirtQemuKernel.dsc
> index bfa4dbe9fd8c..925a1fdec0e2 100644
> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
> @@ -255,7 +255,10 @@ [Components.common]
>  
>
> NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
>}
> -  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> +  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
> +
> +  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> +  }
>  
>#
># Architectural Protocols
> diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
> index 43f093a63f3e..6a542f2447de 100644
> --- a/ArmVirtPkg/ArmVirtXen.dsc
> +++ b/ArmVirtPkg/ArmVirtXen.dsc
> @@ -178,7 +178,10 @@ [Components.common]
>  
>
> NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
>}
> -  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> +  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
> +
> +  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> +  }
>  
>#
># Architectural Protocols
> 

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


Re: [edk2] [PATCH 01/21] ArmVirtPkg: introduce FdtClientProtocol

2016-04-06 Thread Laszlo Ersek
On 04/06/16 18:14, Ard Biesheuvel wrote:
> This introduces the FdtClientProtocol, which will be used to expose the
> device tree provided by the host to other DXE drivers.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel 
> ---
>  ArmVirtPkg/ArmVirtPkg.dec   |  3 +
>  ArmVirtPkg/Include/Protocol/FdtClient.h | 89 
>  2 files changed, 92 insertions(+)
> 
> diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
> index b6ff63677837..fa908253b320 100644
> --- a/ArmVirtPkg/ArmVirtPkg.dec
> +++ b/ArmVirtPkg/ArmVirtPkg.dec
> @@ -34,6 +34,9 @@ [Guids.common]
>gArmVirtTokenSpaceGuid = { 0x0B6F5CA7, 0x4F53, 0x445A, { 0xB7, 0x6E, 0x2E, 
> 0x36, 0x5B, 0x80, 0x63, 0x66 } }
>gEarlyPL011BaseAddressGuid   = { 0xB199DEA9, 0xFD5C, 0x4A84, { 0x80, 
> 0x82, 0x2F, 0x41, 0x70, 0x78, 0x03, 0x05 } }
>  
> +[Protocols]
> +  gFdtClientProtocolGuid = { 0xE11FACA0, 0x4710, 0x4C8E, { 0xA7, 0xA2, 0x01, 
> 0xBA, 0xA2, 0x59, 0x1B, 0x4C } }
> +
>  [PcdsFixedAtBuild, PcdsPatchableInModule]
>#
># This is the physical address where the device tree is expected to be 
> stored
> diff --git a/ArmVirtPkg/Include/Protocol/FdtClient.h 
> b/ArmVirtPkg/Include/Protocol/FdtClient.h
> new file mode 100644
> index ..b7cf8191b5ab
> --- /dev/null
> +++ b/ArmVirtPkg/Include/Protocol/FdtClient.h
> @@ -0,0 +1,89 @@
> +/** @file

(1) Please steal the disclaimer from the beginning of
"OvmfPkg/Include/Protocol/VirtioDevice.h", and tack it here.

> +
> +  Copyright (c) 2016, Linaro Ltd. All rights reserved.
> +
> +  This program and the accompanying materials
> +  are licensed and made available under the terms and conditions of the BSD 
> License
> +  which accompanies this distribution.  The full text of the license may be 
> found at
> +  http://opensource.org/licenses/bsd-license.php
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> +
> +**/
> +
> +#ifndef __FDT_CLIENT_PROTOCOL_H__
> +#define __FDT_CLIENT_PROTOCOL_H__
> +

(2) Usually the word PROTOCOL is not added to the include guard. (I'm
sure you can find some counter-examples, but still :))

(3) Please add a macro here that is suitable for initializing GUID
objects with static storage duration.

(An "extern EFI_GUID ..." at the end of the file may not be necessary,
if you are against it -- we seem to have discussed that BaseTools
generates that declaration. If you don't feel strongly about it, I'd
prefer to stick with the current tradition. I don't insist.)

Regarding the rest of the patch, it looks sane, but of course all such
interfaces emerge from the actual callers' needs, so I will try to look
at the protocol's implementation, and how it is used. Until then, the
rest looks okay to me.

Thanks!
Laszlo

> +//
> +// Protocol interface structure
> +//
> +typedef struct _FDT_CLIENT_PROTOCOL FDT_CLIENT_PROTOCOL;
> +
> +typedef
> +EFI_STATUS
> +(EFIAPI *FDT_CLIENT_GET_NODE_PROPERTY) (
> +  IN  FDT_CLIENT_PROTOCOL *This,
> +  IN  INT32   Node,
> +  IN  CONST CHAR8 *PropertyName,
> +  OUT CONST VOID  **Prop,
> +  OUT UINTN   *PropSize OPTIONAL
> +  );
> +
> +typedef
> +EFI_STATUS
> +(EFIAPI *FDT_CLIENT_SET_NODE_PROPERTY) (
> +  IN  FDT_CLIENT_PROTOCOL *This,
> +  IN  INT32   Node,
> +  IN  CONST CHAR8 *PropertyName,
> +  IN  CONST VOID  *Prop,
> +  IN  UINTN   PropSize
> +  );
> +
> +typedef
> +EFI_STATUS
> +(EFIAPI *FDT_CLIENT_FIND_COMPATIBLE_NODE) (
> +  IN  FDT_CLIENT_PROTOCOL *This,
> +  IN  CONST CHAR8 *CompatibleString,
> +  OUT INT32   *Node
> +  );
> +
> +typedef
> +EFI_STATUS
> +(EFIAPI *FDT_CLIENT_FIND_COMPATIBLE_NODE_PROPERTY) (
> +  IN  FDT_CLIENT_PROTOCOL *This,
> +  IN  CONST CHAR8 *CompatibleString,
> +  IN  CONST CHAR8 *PropertyName,
> +  OUT CONST VOID  **Prop,
> +  OUT UINTN   *PropSize OPTIONAL
> +  );
> +
> +typedef
> +EFI_STATUS
> +(EFIAPI *FDT_CLIENT_FIND_COMPATIBLE_NODE_REG) (
> +  IN  FDT_CLIENT_PROTOCOL *This,
> +  IN  CONST CHAR8 *CompatibleString,
> +  OUT CONST VOID  **Reg,
> +  OUT UINTN   *RegElemSize,
> +  OUT UINTN   *RegSize
> +  );
> +
> +typedef
> +EFI_STATUS
> +(EFIAPI *FDT_CLIENT_GET_CHOSEN_NODE) (
> +  IN  FDT_CLIENT_PROTOCOL *This,
> +  OUT INT32   *Node
> +  );
> +
> +struct _FDT_CLIENT_PROTOCOL {
> +  FDT_CLIENT_GET_NODE_PROPERTY GetNodeProperty;
> +  FDT_CLIENT_SET_NODE_PROPERTY SetNodeProperty;
> +
> +  FDT_CLIENT_FIND_COMPATIBLE_NODE  FindCompatibleNode;
> +  FDT_CLIENT_FIND_COMPATIBLE_NODE_PROPERTY FindCompatibleNodeProperty;
> +  FDT_CLIENT_FIND_COMPATIBLE_NODE_REG  

Re: [edk2] [PATCH 04/12] ArmVirtPkg: Convert to build FatPkg from source

2016-04-06 Thread Laszlo Ersek
On 04/06/16 17:14, Jordan Justen wrote:
> Now that FatPkg is open source (and therefore can be included in the
> EDK II tree) we build and use it directly.
> 
> Note: Not build tested
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> ---
>  ArmVirtPkg/ArmVirtQemu.dsc   | 1 +
>  ArmVirtPkg/ArmVirtQemu.fdf   | 4 ++--
>  ArmVirtPkg/ArmVirtQemuKernel.dsc | 1 +
>  ArmVirtPkg/ArmVirtQemuKernel.fdf | 4 ++--
>  ArmVirtPkg/ArmVirtXen.dsc| 3 ++-
>  ArmVirtPkg/ArmVirtXen.fdf| 4 ++--
>  6 files changed, 10 insertions(+), 7 deletions(-)

Reviewed-by: Laszlo Ersek 

For ArmVirtPkg/ArmVirtQemu:
Tested-by: Laszlo Ersek 

For ArmVirtPkg/ArmVirtXen:
Build-tested-by: Laszlo Ersek 

(Feel free to simply add all three tags.)

Thanks
Laszlo

> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
> index e626df7..dda5514 100644
> --- a/ArmVirtPkg/ArmVirtQemu.dsc
> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
> @@ -334,6 +334,7 @@
>MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  FatPkg/EnhancedFatDxe/Fat.inf
>  
>#
># Bds
> diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
> index ef45653..0a19273 100644
> --- a/ArmVirtPkg/ArmVirtQemu.fdf
> +++ b/ArmVirtPkg/ArmVirtQemu.fdf
> @@ -1,7 +1,7 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2015, 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
> @@ -151,7 +151,7 @@ READ_LOCK_STATUS   = TRUE
>#
>INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> -  INF FatBinPkg/EnhancedFatDxe/Fat.inf
> +  INF FatPkg/EnhancedFatDxe/Fat.inf
>INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
>  
>#
> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc 
> b/ArmVirtPkg/ArmVirtQemuKernel.dsc
> index bfa4dbe..db34022 100644
> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
> @@ -313,6 +313,7 @@
>MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  FatPkg/EnhancedFatDxe/Fat.inf
>  
>#
># Bds
> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf 
> b/ArmVirtPkg/ArmVirtQemuKernel.fdf
> index 7491f80..26db3fc 100644
> --- a/ArmVirtPkg/ArmVirtQemuKernel.fdf
> +++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf
> @@ -1,7 +1,7 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2015, 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
> @@ -172,7 +172,7 @@ READ_LOCK_STATUS   = TRUE
>#
>INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> -  INF FatBinPkg/EnhancedFatDxe/Fat.inf
> +  INF FatPkg/EnhancedFatDxe/Fat.inf
>INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
>  
>#
> diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
> index 43f093a..dfd270d 100644
> --- a/ArmVirtPkg/ArmVirtXen.dsc
> +++ b/ArmVirtPkg/ArmVirtXen.dsc
> @@ -1,7 +1,7 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2015, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2015 - 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
> @@ -216,6 +216,7 @@
>MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  FatPkg/EnhancedFatDxe/Fat.inf
>  
>#
># Bds
> diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
> index d7d4612..6288803 100644
> --- a/ArmVirtPkg/ArmVirtXen.fdf
> +++ b/ArmVirtPkg/ArmVirtXen.fdf
> @@ -1,7 +1,7 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  

Re: [edk2] [PATCH 03/12] FatBinPkg: Change to 2-clause BSD license

2016-04-06 Thread Laszlo Ersek
On 04/06/16 17:14, Jordan Justen wrote:
> The FatPkg is now open source. Update FatBinPkg license to match
> FatPkg.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jordan Justen 
> Cc: Ruiyu Ni 
> ---
>  FatBinPkg/FatBinPkg.dec |  2 +-
>  FatBinPkg/License.txt   | 53 
> ++---
>  2 files changed, 20 insertions(+), 35 deletions(-)

I understand this would follow the example of ShellBinPkg, but,
actually, I don't even understand why ShellBinPkg exists (in binary
form) in the tree.

Could we drop FatBinPkg instead of this patch? After the license update,
it's no different from any other UEFI_DRIVER (/ PEIM), management-wise.

Thanks
Laszlo

> diff --git a/FatBinPkg/FatBinPkg.dec b/FatBinPkg/FatBinPkg.dec
> index 1676086..6ac577a 100644
> --- a/FatBinPkg/FatBinPkg.dec
> +++ b/FatBinPkg/FatBinPkg.dec
> @@ -1,5 +1,5 @@
>  ## @file
> -# This package provides binary device drivers to support the FAT32 file 
> system. This package is separated from other packages because it uses a 
> different license. 
> +# This package provides binary device drivers to support the FAT32 file 
> system.
>  #
>  # This package provides FAT drivers which are not licensed under BSD.
>  # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
> diff --git a/FatBinPkg/License.txt b/FatBinPkg/License.txt
> index 59b71bd..be68999 100644
> --- a/FatBinPkg/License.txt
> +++ b/FatBinPkg/License.txt
> @@ -1,40 +1,25 @@
> -Copyright (c) 2006, Intel Corporation. All rights reserved.
> +Copyright (c) 2012, Intel Corporation. All rights reserved.
>  
>  Redistribution and use in source and binary forms, with or without
> -modification, are permitted provided that the following conditions are
> -met:
> +modification, are permitted provided that the following conditions
> +are met:
>  
> -  .  Redistributions of source code must retain the above copyright
> - notice, this list of conditions and the following disclaimer.
> -
> -  .  Redistributions in binary form must reproduce the above copyright
> - notice, this list of conditions and the following disclaimer in
> - the documentation and/or other materials provided with the
> - distribution.
> -
> -  .  Neither the name of Intel nor the names of its contributors may
> - be used to endorse or promote products derived from this software
> - without specific prior written permission.
> +* Redistributions of source code must retain the above copyright
> +  notice, this list of conditions and the following disclaimer.
> +* Redistributions in binary form must reproduce the above copyright
> +  notice, this list of conditions and the following disclaimer in
> +  the documentation and/or other materials provided with the
> +  distribution.
>  
>  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> -
> -Additional terms: In addition to the forgoing, redistribution and use
> -of the code is conditioned upon the FAT 32 File System Driver and all
> -derivative works thereof being used for and designed only to read
> -and/or write to a file system that is directly managed by Intel's
> -Extensible Firmware Initiative (EFI) Specification v. 1.0 and later
> -and/or the Unified Extensible Firmware Interface (UEFI) Forum's UEFI
> -Specifications v.2.0 and later (together the "UEFI Specifications");
> -only as necessary to emulate an implementation of the UEFI Specifications;
> -and to create firmware, applications, utilities and/or drivers.
> -
> +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
> +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> +COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
> +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
> +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
> +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> +POSSIBILITY OF SUCH DAMAGE.
> 

___

Re: [edk2] [PATCH 02/12] FatPkg: Add Contributions.txt

2016-04-06 Thread Laszlo Ersek
On 04/06/16 17:14, Jordan Justen wrote:
> This is copied from MdePkg/Contributions.txt
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jordan Justen 
> Cc: Ruiyu Ni 
> ---
>  FatPkg/Contributions.txt | 218 
> +++
>  1 file changed, 218 insertions(+)
>  create mode 100644 FatPkg/Contributions.txt

Reviewed-by: Laszlo Ersek 

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


Re: [edk2] [PATCH 01/12] FatPkg: Update License.txt to have the full license text

2016-04-06 Thread Laszlo Ersek
On 04/06/16 17:14, Jordan Justen wrote:
> The script replaced the contents of License.txt will the words the

s/will the words/with the words of/

> shortened text that we include in the headers to files. Instead, use

s/headers to/source/

> the full text. This is copied from MdePkg/License.txt.

With the above fixed (you may deviate from my suggestions of course):

Reviewed-by: Laszlo Ersek 

Thanks
Laszlo

> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jordan Justen 
> Cc: Ruiyu Ni 
> ---
>  FatPkg/License.txt | 29 ++---
>  1 file changed, 22 insertions(+), 7 deletions(-)
> 
> diff --git a/FatPkg/License.txt b/FatPkg/License.txt
> index 2bed9de..be68999 100644
> --- a/FatPkg/License.txt
> +++ b/FatPkg/License.txt
> @@ -1,10 +1,25 @@
> -Copyright (c) 2006, Intel Corporation. All rights reserved.
> +Copyright (c) 2012, Intel Corporation. All rights reserved.
>  
> -This program and the accompanying materials are licensed and made available
> -under the terms and conditions of the BSD License which accompanies this
> -distribution. The full text of the license may be found at
> -http://opensource.org/licenses/bsd-license.php
> +Redistribution and use in source and binary forms, with or without
> +modification, are permitted provided that the following conditions
> +are met:
>  
> -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> +* Redistributions of source code must retain the above copyright
> +  notice, this list of conditions and the following disclaimer.
> +* Redistributions in binary form must reproduce the above copyright
> +  notice, this list of conditions and the following disclaimer in
> +  the documentation and/or other materials provided with the
> +  distribution.
>  
> +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
> +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> +COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
> +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
> +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
> +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> +POSSIBILITY OF SUCH DAMAGE.
> 

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


Re: [edk2] [PATCH 1/2] OvmfPkg: disable PcdHiiOsRuntimeSupport

2016-04-06 Thread Laszlo Ersek
On 04/06/16 19:32, Jordan Justen wrote:
> Reviewed-by: Jordan Justen 

Commit eccc28bfcb91b5d72adf173d7404652c7aa63c26.

Thank you!
Laszlo

> 
> On 2016-03-29 10:51:29, Laszlo Ersek wrote:
>> Edk2 commit 8a45f80edad4 ("MdeModulePkg: Make HII configuration settings
>> available to OS runtime") implements the optional UEFI feature described
>> in "31.2.11.1 OS Runtime Utilization" in UEFI v2.6.
>>
>> While this feature might show benefits down the road even in QEMU virtual
>> machines, at the moment it only presents drawbacks:
>> - it increases the EfiRuntimeServicesData footprint,
>> - it triggers HII compatibility problems between edk2 and external drivers
>>   unconditionally, even if the end-user is not interested in HII and/or in
>>   configuring said drivers (see
>>   
>>   and  for an
>>   example).
>>
>> While the feature was being introduced, popular demand for a controlling
>> Feature PCD rose (see
>> ), which is why
>> we can set it now to FALSE.
>>
>> Cc: Jordan Justen 
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Laszlo Ersek 
>> ---
>>  OvmfPkg/OvmfPkgIa32.dsc| 1 +
>>  OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
>>  OvmfPkg/OvmfPkgX64.dsc | 1 +
>>  3 files changed, 3 insertions(+)
>>
>> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
>> index fd05dac19a91..96d451daffe9 100644
>> --- a/OvmfPkg/OvmfPkgIa32.dsc
>> +++ b/OvmfPkg/OvmfPkgIa32.dsc
>> @@ -361,6 +361,7 @@ [LibraryClasses.common.SMM_CORE]
>>  #
>>  
>> 
>>  [PcdsFeatureFlag]
>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdHiiOsRuntimeSupport|FALSE
>>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE
>>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|TRUE
>>gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress|FALSE
>> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
>> index 37b429720409..69320fe25f5a 100644
>> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
>> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
>> @@ -366,6 +366,7 @@ [LibraryClasses.common.SMM_CORE]
>>  #
>>  
>> 
>>  [PcdsFeatureFlag]
>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdHiiOsRuntimeSupport|FALSE
>>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE
>>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|TRUE
>>gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress|FALSE
>> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
>> index aeca10fdea6c..f5071ecf27fd 100644
>> --- a/OvmfPkg/OvmfPkgX64.dsc
>> +++ b/OvmfPkg/OvmfPkgX64.dsc
>> @@ -366,6 +366,7 @@ [LibraryClasses.common.SMM_CORE]
>>  #
>>  
>> 
>>  [PcdsFeatureFlag]
>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdHiiOsRuntimeSupport|FALSE
>>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE
>>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|TRUE
>>gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress|FALSE
>> -- 
>> 1.8.3.1
>>
>>
>> ___
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel

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


Re: [edk2] [PATCH] OvmfPkg: remove PcdMaxHardwareErrorVariableSize from the DSC files

2016-04-06 Thread Laszlo Ersek
On 04/06/16 19:34, Jordan Justen wrote:
> Reviewed-by: Jordan Justen 

Commit 29d0259e06ee0d0772d1068e02fb2242542fad2a.

Thanks!
Laszlo

> On 2016-03-25 04:02:25, Laszlo Ersek wrote:
>> PcdMaxHardwareErrorVariableSize sets the size limit for individual
>> Hardware Error Record Variables (see "7.2.3 Hardware Error Record
>> Persistence" and "Appendix P, Hardware Error Record Persistence Usage" in
>> the UEFI-2.6 spec).
>>
>> Since Hardware Error Record Persistence is an optional firmware feature,
>> according to the spec, and OVMF does not enable it -- it inherits
>> PcdHwErrStorageSize and PcdHardwareErrorRecordLevel with zero values --,
>> the PcdMaxHardwareErrorVariableSize setting in our DSC files has no
>> effect. Remove it in order to eliminate future confusion.
>>
>> Cc: Jordan Justen 
>> Cc: Star Zeng 
>> Suggested-by: Star Zeng 
>> Ref: http://thread.gmane.org/gmane.comp.bios.edk2.devel/9743/focus=9780
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Laszlo Ersek 
>> Reviewed-by: Star Zeng 
>> ---
>>  OvmfPkg/OvmfPkgIa32.dsc| 1 -
>>  OvmfPkg/OvmfPkgIa32X64.dsc | 1 -
>>  OvmfPkg/OvmfPkgX64.dsc | 1 -
>>  3 files changed, 3 deletions(-)
>>
>> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
>> index 5b56fe9d3911..1e25eb2718a1 100644
>> --- a/OvmfPkg/OvmfPkgIa32.dsc
>> +++ b/OvmfPkg/OvmfPkgIa32.dsc
>> @@ -382,7 +382,6 @@ [PcdsFixedAtBuild]
>>gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
>>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
>>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
>> -  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000
>>gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000
>>  
>>gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
>> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
>> index f81b2b81006f..98f0dc4439a6 100644
>> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
>> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
>> @@ -387,7 +387,6 @@ [PcdsFixedAtBuild]
>>gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
>>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
>>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
>> -  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000
>>gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000
>>  
>>gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
>> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
>> index f5d84282866e..b70f81502db7 100644
>> --- a/OvmfPkg/OvmfPkgX64.dsc
>> +++ b/OvmfPkg/OvmfPkgX64.dsc
>> @@ -387,7 +387,6 @@ [PcdsFixedAtBuild]
>>gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
>>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
>>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
>> -  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000
>>gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000
>>  
>>gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
>> -- 
>> 1.8.3.1
>>

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


Re: [edk2] [PATCH] OvmfPkg: remove PcdMaxHardwareErrorVariableSize from the DSC files

2016-04-06 Thread Jordan Justen
Reviewed-by: Jordan Justen 

On 2016-03-25 04:02:25, Laszlo Ersek wrote:
> PcdMaxHardwareErrorVariableSize sets the size limit for individual
> Hardware Error Record Variables (see "7.2.3 Hardware Error Record
> Persistence" and "Appendix P, Hardware Error Record Persistence Usage" in
> the UEFI-2.6 spec).
> 
> Since Hardware Error Record Persistence is an optional firmware feature,
> according to the spec, and OVMF does not enable it -- it inherits
> PcdHwErrStorageSize and PcdHardwareErrorRecordLevel with zero values --,
> the PcdMaxHardwareErrorVariableSize setting in our DSC files has no
> effect. Remove it in order to eliminate future confusion.
> 
> Cc: Jordan Justen 
> Cc: Star Zeng 
> Suggested-by: Star Zeng 
> Ref: http://thread.gmane.org/gmane.comp.bios.edk2.devel/9743/focus=9780
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> Reviewed-by: Star Zeng 
> ---
>  OvmfPkg/OvmfPkgIa32.dsc| 1 -
>  OvmfPkg/OvmfPkgIa32X64.dsc | 1 -
>  OvmfPkg/OvmfPkgX64.dsc | 1 -
>  3 files changed, 3 deletions(-)
> 
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index 5b56fe9d3911..1e25eb2718a1 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -382,7 +382,6 @@ [PcdsFixedAtBuild]
>gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000
>gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000
>  
>gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index f81b2b81006f..98f0dc4439a6 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -387,7 +387,6 @@ [PcdsFixedAtBuild]
>gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000
>gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000
>  
>gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index f5d84282866e..b70f81502db7 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -387,7 +387,6 @@ [PcdsFixedAtBuild]
>gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000
>gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000
>  
>gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
> -- 
> 1.8.3.1
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 1/2] OvmfPkg: disable PcdHiiOsRuntimeSupport

2016-04-06 Thread Jordan Justen
Reviewed-by: Jordan Justen 

On 2016-03-29 10:51:29, Laszlo Ersek wrote:
> Edk2 commit 8a45f80edad4 ("MdeModulePkg: Make HII configuration settings
> available to OS runtime") implements the optional UEFI feature described
> in "31.2.11.1 OS Runtime Utilization" in UEFI v2.6.
> 
> While this feature might show benefits down the road even in QEMU virtual
> machines, at the moment it only presents drawbacks:
> - it increases the EfiRuntimeServicesData footprint,
> - it triggers HII compatibility problems between edk2 and external drivers
>   unconditionally, even if the end-user is not interested in HII and/or in
>   configuring said drivers (see
>   
>   and  for an
>   example).
> 
> While the feature was being introduced, popular demand for a controlling
> Feature PCD rose (see
> ), which is why
> we can set it now to FALSE.
> 
> Cc: Jordan Justen 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  OvmfPkg/OvmfPkgIa32.dsc| 1 +
>  OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
>  OvmfPkg/OvmfPkgX64.dsc | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index fd05dac19a91..96d451daffe9 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -361,6 +361,7 @@ [LibraryClasses.common.SMM_CORE]
>  #
>  
> 
>  [PcdsFeatureFlag]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdHiiOsRuntimeSupport|FALSE
>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE
>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|TRUE
>gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress|FALSE
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 37b429720409..69320fe25f5a 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -366,6 +366,7 @@ [LibraryClasses.common.SMM_CORE]
>  #
>  
> 
>  [PcdsFeatureFlag]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdHiiOsRuntimeSupport|FALSE
>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE
>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|TRUE
>gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress|FALSE
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index aeca10fdea6c..f5071ecf27fd 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -366,6 +366,7 @@ [LibraryClasses.common.SMM_CORE]
>  #
>  
> 
>  [PcdsFeatureFlag]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdHiiOsRuntimeSupport|FALSE
>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE
>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|TRUE
>gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress|FALSE
> -- 
> 1.8.3.1
> 
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [wave 3 PATCH v2 00/17] OvmfPkg, ArmVirtPkg: VirtIo 1.0

2016-04-06 Thread Laszlo Ersek
On 04/06/16 16:57, Jordan Justen wrote:
> On 2016-04-06 05:40:10, Laszlo Ersek wrote:
>> Version 2 of
>> .
>>
>> Public branch: .
>>
>> * The following patches are new:
>>
>>   v2 06/17 OvmfPkg: IndustryStandard: factor out Virtio095.h
>>   v2 07/17 OvmfPkg: IndustryStandard: factor out Virtio095Net.h
> 
> Reviewed-by: Jordan Justen 
> 
>>
>>   They should be reviewed by Jordan, please.
>>
>> * The patch below has been modified, addressing Jordan's v1 comments:
>>
>>   v2 08/17 OvmfPkg: IndustryStandard: add definitions from the VirtIo 1.0 
>> spec
> 
> Acked-by: Jordan Justen 

Thank you very much.

Series pushed as b1bb6f5961d8..3898f4922879.

Cheers!
Laszlo

>>
>>   It needs an ACK or a review from Jordan, please.
>>
>> * The rest of the series is covered with reviews and ACKs from v1.
>>
>> * The following patches have been trivially updated (while keeping their
>>   tags), to account for the above three:
>>
>>   v2 09/17 OvmfPkg: VirtioLib: add Virtio10WriteFeatures() function
>>   v2 14/17 OvmfPkg: VirtioNetDxe: adapt virtio-net packet header size to 
>> virtio-1.0
>>   v2 15/17 OvmfPkg: Virtio10Dxe: non-transitional driver for virtio-1.0 PCI 
>> devices
>>
>> * All six new or modified patches have individual notes on them.
>>
>> Cc: Ard Biesheuvel 
>> Cc: Jordan Justen 
>>
>> Thanks
>> Laszlo

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


Re: [edk2] [PATCH V2 0/8] Move S3Ready() functional code from AcpiS3SaveDxe to S3SaveStateDxe

2016-04-06 Thread Laszlo Ersek
On 04/06/16 18:04, Laszlo Ersek wrote:
> Hi Star,
> 
> On 04/06/16 14:40, Star Zeng wrote:
>> The S3Ready() functional code in AcpiS3SaveDxe of IntelFrameworkModulePkg
>> is to do ACPI S3 Context save. In fact, that is not really related to
>> Intel framework ACPI S3 protocol.
>>
>> IntelFrameworkModulePkg will be deprecated step by step, so move the
>> functional code to MdeModulePkg and S3SaveStateDxe is a good place.
>> The ACPI global variable related code is leaved as is in 
>> IntelFrameworkModulePkg
>> AcpiS3SaveDxe for compatibility.
>> PcdS3BootScriptStackSize is also moved from IntelFrameworkModulePkg.
>>
>> The functional code need to get ACPI FACS table and consume LockBoxLib,
>> so need to be before DxeSmmReadyToLock that will shut down SMM lock box
>> interface, EndOfDxe is a good time point (OVMF AcpiS3SaveDxe has the
>> reference implementation).
>>
>> After the movement, AcpiS3SaveDxe in OvmfPkg could be retired.
>> With this patch series, I did S3 test on real platform and normal boot for 
>> OVMF.
>>
>> Laszlo & Jordan, could you help confirm the S3 functionality for OVMF?
>>
>> V2:
>> Major change to V1 is to introduce a new PCD PcdAcpiS3Enable.
>> It is for the concern to V1, detailed discussion about V1 is at
>> http://article.gmane.org/gmane.comp.bios.edk2.devel/10261
> 
> * I like this version very much.

I forgot to add:

I've verified that this version implements the following points from
:

> * If that DepEx cannot be fixed, then:
>
>   - the fake lockbox protocol interface should be installed if and
> only if (QemuFwCfgS3Enabled() && !FeaturePcdGet
> (PcdSmmSmramRequire))
>
>   - the fake lockbox protocol interface should be installed in
> LockBoxDxeLibInitialize() indeed, but that library instance should
> *not* be linked into the DXE_CORE. It is perfectly fine if
> S3SaveStateDxe does it (which links against LockBoxLib through
> PiDxeS3BootScriptLib anyway).
>
> * S3SaveStateDxe should allow OVMF to prevent the installation of the
> * End-of-DXE callback (i.e., prevent the saving of the ACPI S3
> * Context). On QEMU, this is a dynamic question.

Notably, as we had discussed, PcdSmmSmramRequire need not be checked in
LockBoxDxeLibInitialize() explicitly, because that library instance
already asserts that PcdSmmSmramRequire is FALSE. So it's all good.

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


Re: [edk2] [PATCH V2 6/8] OvmfPkg: Retire AcpiS3SaveDxe

2016-04-06 Thread Laszlo Ersek
On 04/06/16 14:40, Star Zeng wrote:
> The same functional code has been in S3SaveStateDxe,
> OVMF AcpiS3SaveDxe can be retired now.
> 
> Cc: Laszlo Ersek 
> Cc: Jordan Justen 
> Cc: Jiewen Yao 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng 
> ---
>  OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c  | 549 
> 
>  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf |  73 -
>  OvmfPkg/OvmfPkgIa32.dsc |   1 -
>  OvmfPkg/OvmfPkgIa32.fdf |   3 +-
>  OvmfPkg/OvmfPkgIa32X64.dsc  |   1 -
>  OvmfPkg/OvmfPkgIa32X64.fdf  |   3 +-
>  OvmfPkg/OvmfPkgX64.dsc  |   1 -
>  OvmfPkg/OvmfPkgX64.fdf  |   3 +-
>  8 files changed, 3 insertions(+), 631 deletions(-)
>  delete mode 100644 OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
>  delete mode 100644 OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf

Reviewed-by: Laszlo Ersek 

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


Re: [edk2] [PATCH 00/21] VirtFdtDxe refactoring

2016-04-06 Thread Ard Biesheuvel
On 6 April 2016 at 18:14, Ard Biesheuvel  wrote:
> This is the first step towards getting rid of the kludge which is VirtFdtDxe.
>
> This series addresses the cases where other DXE drivers rely on dynamic PCDs
> populated by VirtFdtDxe, which requires it to execute first using an A PRIORI
> declaration. Instead, this series moves the DT node parsing to the respective
> users, using a new FDT client protocol which can be used in the various
> depexes.
>
> The next step is to split the remaining handling performed by VirtFdtDxe into
> drivers appropriate for the platforms, i.e., virtio for QEMU and xeniommio for
> Xen domU.
>
> This is somewhat rough around the edges, but is mostly intended to elicit
> discussion, and I fully expect these changes to make it into the tree looking
> a lot different from this v1.
>

Branch available here
https://git.linaro.org/people/ard.biesheuvel/uefi-next.git/shortlog/refs/heads/virt-fdt-refactor

> Ard Biesheuvel (21):
>   ArmVirtPkg: introduce FdtClientProtocol
>   ArmVirtPkg: drop dependency on DxePcdLib for DXE Pcd.inf
>   ArmVirtPkg: drop dependency on PeiPcdLib for PEI Pcd.inf
>   ArmVirtPkg/FdtClientDxe: implement new driver
>   ArmVirtPkg: add FdtClientDxe to the ArmVirtPkg platforms
>   ArmVirtPkg/ArmGicArchLib: move to FdtClient protocol
>   ArmVirtPkg/VirtFdtDxe: remove GIC discovery
>   ArmVirtPkg/ArmVirtPsciResetSystemLib: move to FDT client protocol
>   ArmVirtPkg/VirtFdtDxe: drop detection of PSCI method
>   ArmVirtPkg: implement ArmVirtTimerFdtClientLib
>   ArmVirtPkg: move TimerDxe to FDT client library
>   ArmVirtPkg/VirtFdtDxe: remove timer DT node handling
>   ArmVirtPkg/QemuFwCfgLib: move to FDT client protocol
>   ArmVirtPkg/VirtFdtDxe: remove handling of fw_cfg DT node
>   ArmVirtPkg/PciHostBridgeDxe: move to FDT client protocol
>   ArmVirtPkg/BaseCachingPciExpressLib: construct at first invocation
>   ArmVirtPkg/VirtFdtDxe: drop PCI host bridge handling
>   ArmVirtPkg: implement ArmVirtRtcFdtClientLib
>   ArmVirtPkg: move QEMU based platforms to ArmVirtRtcFdtClientLib
>   ArmVirtPkg/VirtFdtDxe: drop RTC handling
>   ArmVirtPkg: get rid of A PRIORI DXE declarations for VirtFdtDxe
>
>  ArmVirtPkg/ArmVirtPkg.dec  | 
>  21 +-
>  ArmVirtPkg/ArmVirtQemu.dsc | 
>  35 +-
>  ArmVirtPkg/ArmVirtQemu.fdf | 
>   8 +-
>  ArmVirtPkg/ArmVirtQemuKernel.dsc   | 
>  30 +-
>  ArmVirtPkg/ArmVirtQemuKernel.fdf   | 
>   5 +-
>  ArmVirtPkg/ArmVirtXen.dsc  | 
>  25 +-
>  ArmVirtPkg/ArmVirtXen.fdf  | 
>   5 +-
>  ArmVirtPkg/FdtClientDxe/FdtClientDxe.c | 
> 236 
>  ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf   | 
>  48 +++
>  ArmVirtPkg/Include/Protocol/FdtClient.h| 
>  89 +
>  ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c   | 
>  84 -
>  ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.inf | 
>  15 +-
>  ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.c   | 
>  38 +-
>  ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf | 
>  11 +-
>  ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.c | 
>  69 
>  ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.inf   | 
>  48 +++
>  ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.c | 
>  90 +
>  ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf   | 
>  50 +++
>  ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf   | 
>   1 -
>  ArmVirtPkg/Library/BaseCachingPciExpressLib/PciExpressLib.c| 
>  16 +-
>  ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 
>  73 +++-
>  ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf   | 
>  12 +-
>  ArmVirtPkg/PciHostBridgeDxe/PciHostBridge.c| 
> 233 +++-
>  ArmVirtPkg/PciHostBridgeDxe/PciHostBridge.h| 
>   2 +
>  ArmVirtPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf   | 
>  16 +-
>  ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c | 
> 395 +---
>  ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf   | 
>  27 --
>  27 files changed, 1112 insertions(+), 570 deletions(-)
>  create mode 100644 ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
>  create mode 100644 ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
>  create mode 100644 ArmVirtPkg/Include/Protocol/FdtClient.h
>  create mode 100644 
> 

Re: [edk2] [PATCH V2 4/8] MdeModulePkg S3SaveStateDxe: Consume PcdAcpiS3Enable to control the code

2016-04-06 Thread Laszlo Ersek
On 04/06/16 14:40, Star Zeng wrote:
> Cc: Feng Tian 
> Cc: Jiewen Yao 
> Cc: Laszlo Ersek 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng 
> ---
>  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c  | 5 -
>  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf | 5 -
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c 
> b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
> index 60cd9b1b3be6..0c6c76191cf4 100644
> --- a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
> +++ b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
> @@ -1,7 +1,7 @@
>  /** @file
>Implementation for S3 Boot Script Saver state driver.
>  
> -  Copyright (c) 2006 - 2013, 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
> @@ -907,6 +907,9 @@ InitializeS3SaveState (
>)
>  {
>  
> +  if (!PcdGetBool (PcdAcpiS3Enable)) {
> +return EFI_LOAD_ERROR;
> +  }
>  
>return  gBS->InstallProtocolInterface (
>,
> diff --git a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf 
> b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
> index 2f021ed90a30..6a7a43a0a06b 100644
> --- a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
> +++ b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
> @@ -3,7 +3,7 @@
>  #
>  # It will install S3 Save State protocol to store or record various IO 
> operations to be replayed during an S3 resume.
>  #
> -# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
> +# Copyright (c) 2009 - 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
> @@ -52,6 +52,9 @@ [Protocols]
>gEfiS3SaveStateProtocolGuid## PRODUCES
>  
>  
> +[Pcd]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable ## CONSUMES
> +
>  [Depex]
>TRUE
>  
> 

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


Re: [edk2] [PATCH V2 3/8] OvmfPkg: Install LockBox protocol in constructor of LockBoxDxeLib

2016-04-06 Thread Laszlo Ersek
On 04/06/16 14:40, Star Zeng wrote:
> Currently, the LockBox protocol is installed in entrypoint of
> OVMF AcpiS3SaveDxe, that is strange.

(6) please remove the phrase

  that is strange

It is not strange; the commit message for the change justified it. (In
other words, what the patch does is fine, but the code being removed is
not strange or unjustified.)

> We can let the first driver run with LockBoxDxeLib linked to have its
> library constructor to install LockBox protocol on the ImageHandle.
> As other drivers may have gEfiLockBoxProtocolGuid dependency,
> the first driver () should run before them.

(7) Please remove "()" here; it is confusing.

> 
> The later patches to retire AcpiS3SaveDxe for OVMF depends on this patch.
> 
> Cc: Laszlo Ersek 
> Cc: Jordan Justen 
> Cc: Jiewen Yao 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng 
> ---
>  OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c   | 13 +---
>  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf  |  6 +-
>  OvmfPkg/Library/LockBoxLib/LockBoxDxe.c  | 31 
> ++--
>  OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf |  6 +-
>  4 files changed, 36 insertions(+), 20 deletions(-)
> 
> diff --git a/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c 
> b/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
> index e3ff23410145..176f598fe686 100644
> --- a/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
> +++ b/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
> @@ -6,7 +6,7 @@
>End-of-Dxe event.
>  
>  Copyright (c) 2014-2015, Red Hat, Inc.
> -Copyright (c) 2006 - 2013, 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
> @@ -28,12 +28,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
> EXPRESS OR IMPLIED.
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  
>  EFI_GUID  mAcpiS3IdtrProfileGuid = {
> @@ -538,15 +536,6 @@ InstallEndOfDxeCallback (
>  return EFI_LOAD_ERROR;
>}
>  
> -  if (!FeaturePcdGet (PcdSmmSmramRequire)) {
> -Status = gBS->InstallMultipleProtocolInterfaces (
> -,
> -, NULL,
> -NULL
> -);
> -ASSERT_EFI_ERROR (Status);
> -  }
> -
>Status = gBS->CreateEventEx (
>EVT_NOTIFY_SIGNAL,
>TPL_CALLBACK,
> diff --git a/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf 
> b/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
> index a288b954b791..f067fc7bf0e5 100644
> --- a/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
> +++ b/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
> @@ -1,7 +1,7 @@
>  ## @file
>  # AcpiS3Save module installs EndOfDxe callback to prepare S3 boot data.
>  #
> -# Copyright (c) 2006 - 2011, 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
> @@ -36,7 +36,6 @@ [Packages]
>MdeModulePkg/MdeModulePkg.dec
>IntelFrameworkPkg/IntelFrameworkPkg.dec
>IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
> -  OvmfPkg/OvmfPkg.dec
>  
>  [LibraryClasses]
>PcdLib
> @@ -49,7 +48,6 @@ [LibraryClasses]
>LockBoxLib
>DebugLib
>DxeServicesLib
> -  QemuFwCfgLib
>  
>  [Guids]
>gEfiAcpiVariableGuid  # ALWAYS_CONSUMED
> @@ -59,7 +57,6 @@ [Guids]
>gEfiEndOfDxeEventGroupGuid## CONSUMES  ## Event
>  
>  [Protocols]
> -  gEfiLockBoxProtocolGuid   # PROTOCOL SOMETIMES_PRODUCED
>gEfiLegacyBiosProtocolGuid# PROTOCOL ALWAYS_CONSUMED
>gEfiLegacyRegion2ProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
>gFrameworkEfiMpServiceProtocolGuid# PROTOCOL SOMETIMES_CONSUMED
> @@ -71,7 +68,6 @@ [Pcd]
>gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3AcpiReservedMemorySize
> ## CONSUMES
>gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3BootScriptStackSize   
> ## CONSUMES
>gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable
> -  gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire
> ## CONSUMES
>  
>  [Depex]
>gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
> diff --git a/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c 
> b/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c
> index c8f2ec8a4ee4..5d2d21fdb495 100644
> --- a/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c
> +++ b/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c
> @@ -1,6 +1,6 @@
>  /** @file
>  
> -  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
> +  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
>  
>This 

[edk2] [PATCH 21/21] ArmVirtPkg: get rid of A PRIORI DXE declarations for VirtFdtDxe

2016-04-06 Thread Ard Biesheuvel
We no longer care when VirtFdtDxe executes, since the dependencies are now
all resolved via protocols. So drop the A PRIORI declaration.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/ArmVirtQemu.fdf   | 4 
 ArmVirtPkg/ArmVirtQemuKernel.fdf | 4 
 ArmVirtPkg/ArmVirtXen.fdf| 4 
 3 files changed, 12 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
index ed48cabc28d2..f432e40c43eb 100644
--- a/ArmVirtPkg/ArmVirtQemu.fdf
+++ b/ArmVirtPkg/ArmVirtQemu.fdf
@@ -101,10 +101,6 @@ [FV.FvMain]
 READ_LOCK_CAP  = TRUE
 READ_LOCK_STATUS   = TRUE
 
-  APRIORI DXE {
-INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
-INF ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
-  }
   INF MdeModulePkg/Core/Dxe/DxeMain.inf
   INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
   INF ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQemuKernel.fdf
index c431355eda3d..1a9338629974 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.fdf
+++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf
@@ -123,10 +123,6 @@ [FV.FvMain]
 READ_LOCK_CAP  = TRUE
 READ_LOCK_STATUS   = TRUE
 
-  APRIORI DXE {
-INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
-INF ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
-  }
   INF MdeModulePkg/Core/Dxe/DxeMain.inf
   INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
   INF ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
index f25c649ba2ca..6b954dc4cba2 100644
--- a/ArmVirtPkg/ArmVirtXen.fdf
+++ b/ArmVirtPkg/ArmVirtXen.fdf
@@ -123,10 +123,6 @@ [FV.FvMain]
 READ_LOCK_CAP  = TRUE
 READ_LOCK_STATUS   = TRUE
 
-  APRIORI DXE {
-INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
-INF ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
-  }
   INF MdeModulePkg/Core/Dxe/DxeMain.inf
   INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
   INF ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
-- 
2.5.0

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


Re: [edk2] [PATCH V2 2/8] OvmfPkg: Set PcdAcpiS3Enable according to QemuFwCfgS3Enabled()

2016-04-06 Thread Laszlo Ersek
On 04/06/16 14:40, Star Zeng wrote:
> Also need to declare PcdAcpiS3Enable as DynamicDefault in *.dsc.
> 
> Cc: Laszlo Ersek 
> Cc: Jordan Justen 
> Cc: Jiewen Yao 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng 
> ---
>  OvmfPkg/OvmfPkgIa32.dsc | 1 +
>  OvmfPkg/OvmfPkgIa32X64.dsc  | 1 +
>  OvmfPkg/OvmfPkgX64.dsc  | 1 +
>  OvmfPkg/PlatformPei/Platform.c  | 4 +++-
>  OvmfPkg/PlatformPei/PlatformPei.inf | 3 ++-
>  5 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index 9e5b47738bd3..8136b80769b4 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -462,6 +462,7 @@ [PcdsDynamicDefault]
>gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size|0x0
>  
>gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|TRUE

(1) Although this is not a "hard" requirement, and also not an
all-too-well defined one, I like to keep PCD settings "clustered" by
token space. (Functional relations are a stronger clustering guideline,
but this new PCD is not functionally related to any other PCD we have in
here.)

Thus, can you please locate

  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution

just a bit higher up (it is not visible in the context), and insert
PcdAcpiS3Enable right under it?

For the other DSC files as well. Thanks.

(2) Please set the default value to FALSE.

More comments below:

>  
># Set video resolution for text setup.
>gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 6e4da4ff55c4..92f98fe23fcc 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -470,6 +470,7 @@ [PcdsDynamicDefault]
>gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size|0x8
>  
>gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|TRUE
>  
># Set video resolution for text setup.
>gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index 3d6d43ef73ab..9e60b498f97d 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -469,6 +469,7 @@ [PcdsDynamicDefault]
>gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size|0x8
>  
>gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|TRUE
>  
># Set video resolution for text setup.
>gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640
> diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
> index 509343e0bee5..5774c61ad2a7 100644
> --- a/OvmfPkg/PlatformPei/Platform.c
> +++ b/OvmfPkg/PlatformPei/Platform.c
> @@ -1,7 +1,7 @@
>  /**@file
>Platform PEI driver
>  
> -  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
> @@ -585,6 +585,8 @@ InitializePlatform (
>if (QemuFwCfgS3Enabled ()) {
>  DEBUG ((EFI_D_INFO, "S3 support was detected on QEMU\n"));
>  mS3Supported = TRUE;
> +  } else {
> +PcdSetBoolS (PcdAcpiS3Enable, FALSE);
>}

(3) So, this else branch should be eliminated, and the opposite setting
(-> TRUE) should occur on the existent branch.

(4) Please either use PcdSetBool(), or check the return status of
PcdSetBoolS(). My vote would be PcdSetBool(), but if you prefer
PcdSetBoolS(), please add an ASSERT_EFI_ERROR().

>  
>S3Verification ();
> diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf 
> b/OvmfPkg/PlatformPei/PlatformPei.inf
> index 5b643a358f1f..de574684ebf2 100644
> --- a/OvmfPkg/PlatformPei/PlatformPei.inf
> +++ b/OvmfPkg/PlatformPei/PlatformPei.inf
> @@ -2,7 +2,7 @@
>  #  Platform PEI driver
>  #
>  #  This module provides platform specific function to detect boot mode.
> -#  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
> @@ -95,6 +95,7 @@ [Pcd]
>gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack
>gEfiMdeModulePkgTokenSpaceGuid.PcdPropertiesTableEnable
>gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable

(5) Similarly to (1), please move this right under

  gEfiMdeModulePkgTokenSpaceGuid.PcdPropertiesTableEnable

Thanks!
Laszlo

>  
>  [FixedPcd]
>gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
> 

___
edk2-devel 

[edk2] [PATCH 19/21] ArmVirtPkg: move QEMU based platforms to ArmVirtRtcFdtClientLib

2016-04-06 Thread Ard Biesheuvel
This moves QEMU based platforms to ArmVirtRtcFdtClientLib, so that we no
longer have to rely on VirtFdtDxe to execute first and set the RTC base
address in a dynamic PCD.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/ArmVirtQemu.dsc   | 5 -
 ArmVirtPkg/ArmVirtQemuKernel.dsc | 5 -
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 9942c0228687..ab29b8450185 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -290,7 +290,10 @@ [Components.common]
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
   
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
   EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
-  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
+  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf {
+
+  NULL|ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.inf
+  }
   EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
 
   MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index 1e4d176a1f82..a590b42fe235 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -268,7 +268,10 @@ [Components.common]
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
   
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
   EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
-  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
+  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf {
+
+  NULL|ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.inf
+  }
   EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
 
   MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
-- 
2.5.0

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


[edk2] [PATCH 16/21] ArmVirtPkg/BaseCachingPciExpressLib: construct at first invocation

2016-04-06 Thread Ard Biesheuvel
Instead of using a constructor, which may reference a dynamic PCD which is
set by the DXE entry point of its user, defer the assignment of the global
mPciExpressBaseAddress until the first the library is actually invoked.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf |  1 -
 ArmVirtPkg/Library/BaseCachingPciExpressLib/PciExpressLib.c  | 16 

 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git 
a/ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf 
b/ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
index f6a346d49f22..5374f1b9a369 100644
--- a/ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
+++ b/ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
@@ -23,7 +23,6 @@ [Defines]
   MODULE_TYPE= BASE
   VERSION_STRING = 1.0
   LIBRARY_CLASS  = PciExpressLib|DXE_DRIVER UEFI_DRIVER 
UEFI_APPLICATION
-  CONSTRUCTOR= PciExpressLibInitialize
 
 #
 #  VALID_ARCHITECTURES   = ARM AARCH64
diff --git a/ArmVirtPkg/Library/BaseCachingPciExpressLib/PciExpressLib.c 
b/ArmVirtPkg/Library/BaseCachingPciExpressLib/PciExpressLib.c
index 6479f53b3714..6135d49a7854 100644
--- a/ArmVirtPkg/Library/BaseCachingPciExpressLib/PciExpressLib.c
+++ b/ArmVirtPkg/Library/BaseCachingPciExpressLib/PciExpressLib.c
@@ -68,18 +68,7 @@ PciExpressRegisterForRuntimeAccess (
   return RETURN_UNSUPPORTED;
 }
 
-STATIC UINT64 mPciExpressBaseAddress;
-
-RETURN_STATUS
-EFIAPI
-PciExpressLibInitialize (
-  VOID
-  )
-{
-  mPciExpressBaseAddress = PcdGet64 (PcdPciExpressBaseAddress);
-  return RETURN_SUCCESS;
-}
-
+STATIC UINT64 mPciExpressBaseAddress = 0xULL;
 
 /**
   Gets the base address of PCI Express.
@@ -92,6 +81,9 @@ GetPciExpressBaseAddress (
   VOID
   )
 {
+  if (mPciExpressBaseAddress == 0xULL) {
+mPciExpressBaseAddress = PcdGet64 (PcdPciExpressBaseAddress);
+  }
   return (VOID*)(UINTN) mPciExpressBaseAddress;
 }
 
-- 
2.5.0

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


Re: [edk2] [PATCH 06/12] CorebootPayloadPkg: Convert to build FatPkg from source

2016-04-06 Thread Jordan Justen
On 2016-04-06 08:57:01, Agyeman, Prince wrote:
> Jordan,
>Will the FatPkg move into the EDKII repo then  ? 

Yes. It should be added to EDK II later today. (Before this patch
would be pushed.)

-Jordan

> 
> -Original Message-
> From: Justen, Jordan L 
> Sent: Wednesday, April 6, 2016 8:15 AM
> To: edk2-devel@lists.01.org
> Cc: Justen, Jordan L ; Ma, Maurice 
> ; Agyeman, Prince 
> Subject: [PATCH 06/12] CorebootPayloadPkg: Convert to build FatPkg from source
> 
> Now that FatPkg is open source (and therefore can be included in the EDK II 
> tree) we build and use it directly.
> 
> Note: Build tested with GCC 5.3 on IA32 and IA32+X64.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jordan Justen 
> Cc: Maurice Ma 
> Cc: Prince Agyeman 
> ---
>  CorebootPayloadPkg/CorebootPayloadPkg.fdf| 8 ++--
>  CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc| 3 ++-
>  CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc | 3 ++-
>  3 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/CorebootPayloadPkg/CorebootPayloadPkg.fdf 
> b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
> index c160e43..cf04bec 100644
> --- a/CorebootPayloadPkg/CorebootPayloadPkg.fdf
> +++ b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
> @@ -3,7 +3,7 @@
>  #
>  # Provides drivers and definitions to create uefi payload for coreboot. 
>  #
> -# Copyright (c) 2014 - 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 that 
> accompanies this distribution.  
>  # The full text of the license may be found at @@ -138,11 +138,7 @@ INF 
> MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
>  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
>  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
>  
> -!if $(ARCH) == IA32
> -INF RuleOverride = BINARY USE = IA32 FatBinPkg/EnhancedFatDxe/Fat.inf -!else 
> -INF RuleOverride = BINARY USE = X64 FatBinPkg/EnhancedFatDxe/Fat.inf -!endif
> +INF FatPkg/EnhancedFatDxe/Fat.inf
>  
>  #
>  # Usb Support
> diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc 
> b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
> index 2c37e44..dfc03d6 100644
> --- a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
> +++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
> @@ -3,7 +3,7 @@
>  #
>  # Provides drivers and definitions to create uefi payload for coreboot. 
>  #
> -# Copyright (c) 2014 - 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 that 
> accompanies this distribution.  
>  # The full text of the license may be found at @@ -326,6 +326,7 @@
>MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  FatPkg/EnhancedFatDxe/Fat.inf
>DuetPkg/SataControllerDxe/SataControllerDxe.inf  
>MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
>MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
> diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc 
> b/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
> index cfaf304..a8df8b1 100644
> --- a/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
> +++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
> @@ -3,7 +3,7 @@
>  #
>  # Provides drivers and definitions to create uefi payload for coreboot. 
>  #
> -# Copyright (c) 2014 - 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 that 
> accompanies this distribution.  
>  # The full text of the license may be found at @@ -328,6 +328,7 @@
>MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  FatPkg/EnhancedFatDxe/Fat.inf
>DuetPkg/SataControllerDxe/SataControllerDxe.inf  
>MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
>MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
> --
> 2.7.0
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 14/21] ArmVirtPkg/VirtFdtDxe: remove handling of fw_cfg DT node

2016-04-06 Thread Ard Biesheuvel
Remove the handling of the fw_cfg DT node from VirtFdtDxe now that the
fw_cfg client library has been moved to the FDT client protocol, and no
longer relies on VirtFdtDxe to pass this information via dynamic PCDs.
Since the PCDs in question are now no longer used, remove them from the
various DEC and DSC files as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/ArmVirtPkg.dec|  5 --
 ArmVirtPkg/ArmVirtQemu.dsc   |  4 --
 ArmVirtPkg/ArmVirtQemuKernel.dsc |  4 --
 ArmVirtPkg/ArmVirtXen.dsc|  4 --
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c   | 49 
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf |  3 --
 6 files changed, 69 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
index 73136adf62c6..9f98f28f01e1 100644
--- a/ArmVirtPkg/ArmVirtPkg.dec
+++ b/ArmVirtPkg/ArmVirtPkg.dec
@@ -59,11 +59,6 @@ [PcdsFixedAtBuild, PcdsPatchableInModule]
   #
   gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x65, 0x60, 0xA6, 0xDF, 
0x19, 0xB4, 0xD3, 0x11, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 
0x4D}|VOID*|0x0007
 
-[PcdsDynamic, PcdsFixedAtBuild]
-  gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress|0x0|UINT64|0x0004
-  gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress|0x0|UINT64|0x0005
-  gArmVirtTokenSpaceGuid.PcdFwCfgDmaAddress|0x0|UINT64|0x0009
-
 [PcdsFeatureFlag]
   #
   # "Map PCI MMIO as Cached"
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index ee9d37c2d660..4eb350e805d4 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -221,10 +221,6 @@ [PcdsDynamicDefault.common]
   gArmPlatformTokenSpaceGuid.PcdPciMmio32Size|0x0
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x0
 
-  gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress|0x0
-  gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress|0x0
-  gArmVirtTokenSpaceGuid.PcdFwCfgDmaAddress|0x0
-
   #
   # Set video resolution for boot options and for text setup.
   # PlatformDxe can set the former at runtime.
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index f41dd19da583..32484fffa126 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -206,10 +206,6 @@ [PcdsDynamicDefault.common]
   gArmPlatformTokenSpaceGuid.PcdPciMmio32Size|0x0
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x0
 
-  gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress|0x0
-  gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress|0x0
-  gArmVirtTokenSpaceGuid.PcdFwCfgDmaAddress|0x0
-
   #
   # Set video resolution for boot options and for text setup.
   # PlatformDxe can set the former at runtime.
diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
index 7ea46514dad3..0af82be42913 100644
--- a/ArmVirtPkg/ArmVirtXen.dsc
+++ b/ArmVirtPkg/ArmVirtXen.dsc
@@ -142,10 +142,6 @@ [PcdsDynamicDefault.common]
   gArmPlatformTokenSpaceGuid.PcdPciMmio32Size|0x0
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x0
 
-  gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress|0x0
-  gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress|0x0
-  gArmVirtTokenSpaceGuid.PcdFwCfgDmaAddress|0x0
-
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
 
 

diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c 
b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
index 368618956be1..0a47092e35ce 100644
--- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
+++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
@@ -45,7 +45,6 @@ typedef enum {
   PropertyTypeRtc,
   PropertyTypeVirtio,
   PropertyTypeUart,
-  PropertyTypeFwCfg,
   PropertyTypePciHost,
   PropertyTypeXen,
 } PROPERTY_TYPE;
@@ -59,7 +58,6 @@ STATIC CONST PROPERTY CompatibleProperties[] = {
   { PropertyTypeRtc, "arm,pl031" },
   { PropertyTypeVirtio,  "virtio,mmio"   },
   { PropertyTypeUart,"arm,pl011" },
-  { PropertyTypeFwCfg,   "qemu,fw-cfg-mmio"  },
   { PropertyTypePciHost, "pci-host-ecam-generic" },
   { PropertyTypeXen, "xen,xen"   },
   { PropertyTypeUnknown, ""  }
@@ -279,12 +277,6 @@ InitializeVirtFdtDxe (
   VIRTIO_TRANSPORT_DEVICE_PATH   *DevicePath;
   EFI_HANDLE Handle;
   UINT64 RegBase;
-  UINT64 FwCfgSelectorAddress;
-  UINT64 FwCfgSelectorSize;
-  UINT64 FwCfgDataAddress;
-  UINT64 FwCfgDataSize;
-  UINT64 FwCfgDmaAddress;
-  UINT64 FwCfgDmaSize;
   BOOLEANHavePci;
 
   Hob = GetFirstGuidHob();
@@ -338,47 +330,6 @@ InitializeVirtFdtDxe (
   HavePci = TRUE;
   break;
 
-case PropertyTypeFwCfg:
-  ASSERT (Len == 2 * sizeof (UINT64));
-
-  FwCfgDataAddress = fdt64_to_cpu (((UINT64 *)RegProp)[0]);
-  FwCfgDataSize= 8;
-  

[edk2] [PATCH 18/21] ArmVirtPkg: implement ArmVirtRtcFdtClientLib

2016-04-06 Thread Ard Biesheuvel
This implements a library ArmVirtRtcFdtClientLib which is intended to
be incorporated into RealTimeClockRuntimeDxe via NULL library class
resolution. This allows us to make RealTimeClockRuntimeDxe depend on the
FDT client protocol, and discover the RTC base address from the device tree
directly rather than relying on VirtFdtDxe to set the dynamic PCDs.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.c   | 69 

 ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.inf | 48 
++
 2 files changed, 117 insertions(+)

diff --git a/ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.c 
b/ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.c
new file mode 100644
index ..9af50d641234
--- /dev/null
+++ b/ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.c
@@ -0,0 +1,69 @@
+/** @file
+  FDT client library for ARM's PL031 RTC driver
+
+  Copyright (c) 2016, Linaro Ltd. All rights reserved.
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+EFI_STATUS
+EFIAPI
+ArmVirtRtcFdtClientLibConstructor (
+  IN EFI_HANDLEImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_STATUSStatus;
+  FDT_CLIENT_PROTOCOL   *FdtClient;
+  INT32 Node;
+  CONST VOID*Reg;
+  UINTN RegSize;
+  UINT64RegBase;
+
+  Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  Status = FdtClient->FindCompatibleNode (FdtClient, "arm,pl031", );
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  Status = FdtClient->GetNodeProperty (FdtClient, Node, "reg", , );
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  ASSERT (RegSize == 16);
+
+  RegBase = fdt64_to_cpu (((UINT64 *)Reg)[0]);
+  ASSERT (RegBase < MAX_UINT32);
+
+  PcdSet32 (PcdPL031RtcBase, (UINT32)RegBase);
+
+  DEBUG ((EFI_D_INFO, "Found PL031 RTC @ 0x%Lx\n", RegBase));
+
+  Status = FdtClient->SetNodeProperty (FdtClient, Node, "status", "disabled", 
8);
+  if (EFI_ERROR (Status)) {
+  DEBUG ((EFI_D_WARN, "Failed to set PL031 status to 'disabled'\n"));
+  }
+
+  return EFI_SUCCESS;
+}
+
diff --git 
a/ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.inf 
b/ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.inf
new file mode 100644
index ..93a78d115d2c
--- /dev/null
+++ b/ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.inf
@@ -0,0 +1,48 @@
+#/** @file
+#  FDT client library for ARM's PL031 RTC driver
+#
+#  Copyright (c) 2016, Linaro Ltd. All rights reserved.
+#
+#  This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD 
License
+#  which accompanies this distribution. The full text of the license may be 
found at
+#  http://opensource.org/licenses/bsd-license.php
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+#
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = ArmVirtRtcFdtClientLib
+  FILE_GUID  = 13173319-B270-4669-8592-3BB2B31E9E29
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = ArmVirtRtcFdtClientLib
+  CONSTRUCTOR= ArmVirtRtcFdtClientLibConstructor
+
+[Sources]
+  ArmVirtRtcFdtClientLib.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  ArmVirtPkg/ArmVirtPkg.dec
+  MdePkg/MdePkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+
+[LibraryClasses]
+  DebugLib
+  BaseLib
+  FdtLib
+  PcdLib
+
+[Protocols]
+  gFdtClientProtocolGuid
+
+[Pcd]
+  gArmPlatformTokenSpaceGuid.PcdPL031RtcBase
+
+[Depex]
+  gFdtClientProtocolGuid
-- 
2.5.0

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


[edk2] [PATCH 15/21] ArmVirtPkg/PciHostBridgeDxe: move to FDT client protocol

2016-04-06 Thread Ard Biesheuvel
Instead of relying on VirtFdtDxe to populate various dynamic PCDs with
information retrieved from the host provided device tree, perform the
PCI ECAM related DT node parsing directly in PciHostBridgeDxe.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/PciHostBridgeDxe/PciHostBridge.c  | 233 ++--
 ArmVirtPkg/PciHostBridgeDxe/PciHostBridge.h  |   2 +
 ArmVirtPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf |  16 +-
 3 files changed, 227 insertions(+), 24 deletions(-)

diff --git a/ArmVirtPkg/PciHostBridgeDxe/PciHostBridge.c 
b/ArmVirtPkg/PciHostBridgeDxe/PciHostBridge.c
index 735c7f216318..cf9496fb1f15 100644
--- a/ArmVirtPkg/PciHostBridgeDxe/PciHostBridge.c
+++ b/ArmVirtPkg/PciHostBridgeDxe/PciHostBridge.c
@@ -79,6 +79,198 @@ PCI_HOST_BRIDGE_INSTANCE mPciHostBridgeInstanceTemplate = {
 // Implementation
 //
 
+STATIC UINT64 mIoBase, mIoSize, mIoTranslation;
+STATIC UINT64 mMmioBase, mMmioSize, mMmioTranslation;
+STATIC UINT32 mBusMin, mBusMax;
+
+//
+// We expect the "ranges" property of "pci-host-ecam-generic" to consist of
+// records like this.
+//
+#pragma pack (1)
+typedef struct {
+  UINT32 Type;
+  UINT64 ChildBase;
+  UINT64 CpuBase;
+  UINT64 Size;
+} DTB_PCI_HOST_RANGE_RECORD;
+#pragma pack ()
+
+#define DTB_PCI_HOST_RANGE_RELOCATABLE  BIT31
+#define DTB_PCI_HOST_RANGE_PREFETCHABLE BIT30
+#define DTB_PCI_HOST_RANGE_ALIASED  BIT29
+#define DTB_PCI_HOST_RANGE_MMIO32   BIT25
+#define DTB_PCI_HOST_RANGE_MMIO64   (BIT25 | BIT24)
+#define DTB_PCI_HOST_RANGE_IO   BIT24
+#define DTB_PCI_HOST_RANGE_TYPEMASK (BIT31 | BIT30 | BIT29 | BIT25 | BIT24)
+
+/**
+  Process the device tree node describing the generic PCI host controller.
+
+  param[in] FdtClient   Pointer to the FDT client protocol
+
+  param[in] NodeOffset of the device tree node whose "compatible"
+property is "pci-host-ecam-generic".
+
+  @retval EFI_SUCCESS Parsing successful, properties parsed from Node
+  have been stored in dynamic PCDs.
+
+  @retval EFI_PROTOCOL_ERROR  Parsing failed. PCDs are left unchanged.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+ProcessPciHost (
+  FDT_CLIENT_PROTOCOL *FdtClient,
+  IN INT32Node
+  )
+{
+  UINT64 ConfigBase, ConfigSize;
+  CONST VOID *Prop;
+  UINTN  Len;
+  UINT32 RecordIdx;
+  EFI_STATUS Status;
+  UINT32 Tmp;
+
+  Status = FdtClient->GetNodeProperty (FdtClient, Node, "reg", , );
+  if (EFI_ERROR (Status) || Prop == NULL || Len != 2 * sizeof(UINT64)) {
+DEBUG ((EFI_D_ERROR, "%a: 'reg' property not found or invalid\n",
+  __FUNCTION__));
+return EFI_PROTOCOL_ERROR;
+  }
+
+  //
+  // Fetch the ECAM window.
+  //
+  ConfigBase = fdt64_to_cpu (((CONST UINT64 *)Prop)[0]);
+  ConfigSize = fdt64_to_cpu (((CONST UINT64 *)Prop)[1]);
+
+  //
+  // Fetch the bus range (note: inclusive).
+  //
+  Status = FdtClient->GetNodeProperty (FdtClient, Node, "bus-range", , 
);
+  if (EFI_ERROR (Status) || Prop == NULL || Len != 2 * sizeof(UINT32)) {
+DEBUG ((EFI_D_ERROR, "%a: 'bus-range' not found or invalid\n",
+  __FUNCTION__));
+return EFI_PROTOCOL_ERROR;
+  }
+  mBusMin = fdt32_to_cpu (((CONST UINT32 *)Prop)[0]);
+  mBusMax = fdt32_to_cpu (((CONST UINT32 *)Prop)[1]);
+
+  //
+  // Sanity check: the config space must accommodate all 4K register bytes of
+  // all 8 functions of all 32 devices of all buses.
+  //
+  if (mBusMax < mBusMin || mBusMax - mBusMin == MAX_UINT32 ||
+  DivU64x32 (ConfigSize, SIZE_4KB * 8 * 32) < mBusMax - mBusMin + 1) {
+DEBUG ((EFI_D_ERROR, "%a: invalid 'bus-range' and/or 'reg'\n",
+  __FUNCTION__));
+return EFI_PROTOCOL_ERROR;
+  }
+
+  //
+  // Iterate over "ranges".
+  //
+  Status = FdtClient->GetNodeProperty (FdtClient, Node, "ranges", , );
+  if (EFI_ERROR (Status) || Prop == NULL || Len == 0 ||
+  Len % sizeof (DTB_PCI_HOST_RANGE_RECORD) != 0) {
+DEBUG ((EFI_D_ERROR, "%a: 'ranges' not found or invalid\n", __FUNCTION__));
+return EFI_PROTOCOL_ERROR;
+  }
+
+  //
+  // mIoBase, IoTranslation, mMmioBase and MmioTranslation are initialized only
+  // in order to suppress '-Werror=maybe-uninitialized' warnings *incorrectly*
+  // emitted by some gcc versions.
+  //
+  mIoBase = 0;
+  mIoTranslation = 0;
+  mMmioBase = 0;
+  mMmioTranslation = 0;
+
+  //
+  // IoSize and MmioSize are initialized to zero because the logic below
+  // requires it.
+  //
+  mIoSize = 0;
+  mMmioSize = 0;
+  for (RecordIdx = 0; RecordIdx < Len / sizeof (DTB_PCI_HOST_RANGE_RECORD);
+   ++RecordIdx) {
+CONST DTB_PCI_HOST_RANGE_RECORD *Record;
+
+Record = (CONST DTB_PCI_HOST_RANGE_RECORD *)Prop + RecordIdx;
+switch (fdt32_to_cpu (Record->Type) & DTB_PCI_HOST_RANGE_TYPEMASK) {
+case DTB_PCI_HOST_RANGE_IO:
+  mIoBase = fdt64_to_cpu (Record->ChildBase);
+  mIoSize = fdt64_to_cpu 

[edk2] [PATCH 20/21] ArmVirtPkg/VirtFdtDxe: drop RTC handling

2016-04-06 Thread Ard Biesheuvel
The RTC driver no longer relies on VirtFdtDxe to set the pl031 RTC base
address in a dynamic PCD, so drop the handling altogether.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c   | 36 
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf |  6 
 2 files changed, 42 deletions(-)

diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c 
b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
index 31e0ca7db8b4..0eb4932606ea 100644
--- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
+++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
@@ -42,7 +42,6 @@ typedef struct {
 
 typedef enum {
   PropertyTypeUnknown,
-  PropertyTypeRtc,
   PropertyTypeVirtio,
   PropertyTypeUart,
   PropertyTypeXen,
@@ -54,7 +53,6 @@ typedef struct {
 } PROPERTY;
 
 STATIC CONST PROPERTY CompatibleProperties[] = {
-  { PropertyTypeRtc, "arm,pl031" },
   { PropertyTypeVirtio,  "virtio,mmio"   },
   { PropertyTypeUart,"arm,pl011" },
   { PropertyTypeXen, "xen,xen"   },
@@ -96,7 +94,6 @@ InitializeVirtFdtDxe (
   VOID   *Hob;
   VOID   *DeviceTreeBase;
   INT32  Node, Prev;
-  INT32  RtcNode;
   EFI_STATUS Status;
   CONST CHAR8*Type;
   INT32  Len;
@@ -119,7 +116,6 @@ InitializeVirtFdtDxe (
 
   DEBUG ((EFI_D_INFO, "%a: DTB @ 0x%p\n", __FUNCTION__, DeviceTreeBase));
 
-  RtcNode = -1;
   //
   // Now enumerate the nodes and install peripherals that we are interested in,
   // i.e., GIC, RTC and virtio MMIO nodes
@@ -196,18 +192,6 @@ InitializeVirtFdtDxe (
   }
   break;
 
-case PropertyTypeRtc:
-  ASSERT (Len == 16);
-
-  RegBase = fdt64_to_cpu (((UINT64 *)RegProp)[0]);
-  ASSERT (RegBase < MAX_UINT32);
-
-  PcdSet32 (PcdPL031RtcBase, (UINT32)RegBase);
-
-  DEBUG ((EFI_D_INFO, "Found PL031 RTC @ 0x%Lx\n", RegBase));
-  RtcNode = Node;
-  break;
-
 case PropertyTypeXen:
   ASSERT (Len == 16);
 
@@ -233,25 +217,5 @@ InitializeVirtFdtDxe (
 }
   }
 
-  if (!FeaturePcdGet (PcdPureAcpiBoot)) {
-//
-// Only install the FDT as a configuration table if we want to leave it up
-// to the OS to decide whether it prefers ACPI over DT.
-//
-Status = gBS->InstallConfigurationTable (, DeviceTreeBase);
-ASSERT_EFI_ERROR (Status);
-
-//
-// UEFI takes ownership of the RTC hardware, and exposes its functionality
-// through the UEFI Runtime Services GetTime, SetTime, etc. This means we
-// need to disable it in the device tree to prevent the OS from attaching 
its
-// device driver as well.
-//
-if ((RtcNode != -1) &&
-fdt_setprop_string (DeviceTreeBase, RtcNode, "status",
-  "disabled") != 0) {
-  DEBUG ((EFI_D_WARN, "Failed to set PL031 status to 'disabled'\n"));
-}
-  }
   return EFI_SUCCESS;
 }
diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf 
b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
index 8ebce337747f..dcad1e085e5b 100644
--- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
+++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
@@ -49,12 +49,6 @@ [Guids]
   gVirtioMmioTransportGuid
   gFdtHobGuid
 
-[Pcd]
-  gArmPlatformTokenSpaceGuid.PcdPL031RtcBase
-
-[FeaturePcd]
-  gArmVirtTokenSpaceGuid.PcdPureAcpiBoot
-
 [Protocols]
   gEfiDevicePathProtocolGuid
 
-- 
2.5.0

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


[edk2] [PATCH 13/21] ArmVirtPkg/QemuFwCfgLib: move to FDT client protocol

2016-04-06 Thread Ard Biesheuvel
Make this library depend on the FDT client protocol to access the
host supplied device tree directly rather than depending on VirtFdtDxe
to set them using dynamic PCDs.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c   | 73 ++--
 ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf | 12 ++--
 2 files changed, 72 insertions(+), 13 deletions(-)

diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c 
b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
index 303dc520c6eb..1cb372562b62 100644
--- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
+++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
@@ -20,6 +20,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+
+#include 
 
 STATIC UINTN mFwCfgSelectorAddress;
 STATIC UINTN mFwCfgDataAddress;
@@ -109,14 +113,70 @@ QemuFwCfgIsAvailable (
 }
 
 
-RETURN_STATUS
+EFI_STATUS
 EFIAPI
 QemuFwCfgInitialize (
-  VOID
+  IN EFI_HANDLEImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
   )
 {
-  mFwCfgSelectorAddress = (UINTN)PcdGet64 (PcdFwCfgSelectorAddress);
-  mFwCfgDataAddress = (UINTN)PcdGet64 (PcdFwCfgDataAddress);
+  EFI_STATUSStatus;
+  FDT_CLIENT_PROTOCOL   *FdtClient;
+  CONST VOID*Reg;
+  UINTN RegElemSize, RegSize;
+  UINT64FwCfgSelectorSize;
+  UINT64FwCfgDataSize;
+  UINT64FwCfgDmaSize;
+
+  Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  Status = FdtClient->FindCompatibleNodeReg (FdtClient,
+ "qemu,fw-cfg-mmio",
+ ,
+ ,
+ );
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  ASSERT (RegElemSize == sizeof (UINT64));
+  ASSERT (RegSize == 2 * sizeof (UINT64));
+
+  mFwCfgDataAddress = fdt64_to_cpu (((UINT64 *)Reg)[0]);
+  FwCfgDataSize = 8;
+  mFwCfgSelectorAddress = mFwCfgDataAddress + FwCfgDataSize;
+  FwCfgSelectorSize = 2;
+
+  //
+  // The following ASSERT()s express
+  //
+  //   Address + Size - 1 <= MAX_UINTN
+  //
+  // for both registers, that is, that the last byte in each MMIO range is
+  // expressible as a MAX_UINTN. The form below is mathematically
+  // equivalent, and it also prevents any unsigned overflow before the
+  // comparison.
+  //
+  ASSERT (mFwCfgSelectorAddress <= MAX_UINTN - FwCfgSelectorSize + 1);
+  ASSERT (mFwCfgDataAddress <= MAX_UINTN - FwCfgDataSize + 1);
+
+  DEBUG ((EFI_D_INFO, "Found FwCfg @ 0x%Lx/0x%Lx\n", mFwCfgSelectorAddress,
+mFwCfgDataAddress));
+
+  if (fdt64_to_cpu (((UINT64 *)Reg)[1]) >= 0x18) {
+mFwCfgDmaAddress  = mFwCfgDataAddress + 0x10;
+FwCfgDmaSize  = 0x08;
+
+//
+// See explanation above.
+//
+ASSERT (mFwCfgDmaAddress <= MAX_UINTN - FwCfgDmaSize + 1);
+
+DEBUG ((EFI_D_INFO, "Found FwCfg DMA @ 0x%Lx\n", mFwCfgDmaAddress));
+  }
 
   if (InternalQemuFwCfgIsAvailable ()) {
 UINT32 Signature;
@@ -128,13 +188,12 @@ QemuFwCfgInitialize (
   // For DMA support, we require the DTB to advertise the register, and the
   // feature bitmap (which we read without DMA) to confirm the feature.
   //
-  if (PcdGet64 (PcdFwCfgDmaAddress) != 0) {
+  if (mFwCfgDmaAddress != 0) {
 UINT32 Features;
 
 QemuFwCfgSelectItem (QemuFwCfgItemInterfaceVersion);
 Features = QemuFwCfgRead32 ();
 if ((Features & BIT1) != 0) {
-  mFwCfgDmaAddress = PcdGet64 (PcdFwCfgDmaAddress);
   InternalQemuFwCfgReadBytes = DmaReadBytes;
 }
   }
@@ -143,7 +202,7 @@ QemuFwCfgInitialize (
   mFwCfgDataAddress = 0;
 }
   }
-  return RETURN_SUCCESS;
+  return EFI_SUCCESS;
 }
 
 
diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf 
b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
index 298aa6edfb26..a4ae2a3f9d22 100644
--- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
+++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
@@ -20,7 +20,7 @@ [Defines]
   INF_VERSION= 0x00010005
   BASE_NAME  = QemuFwCfgLib
   FILE_GUID  = B271F41F-B841-48A9-BA8D-545B4BC2E2BF
-  MODULE_TYPE= BASE
+  MODULE_TYPE= DXE_DRIVER
   VERSION_STRING = 1.0
   LIBRARY_CLASS  = QemuFwCfgLib|DXE_DRIVER
 
@@ -46,9 +46,9 @@ [LibraryClasses]
   BaseMemoryLib
   DebugLib
   IoLib
-  PcdLib
 
-[Pcd]
-  gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress
-  gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress
-  gArmVirtTokenSpaceGuid.PcdFwCfgDmaAddress
+[Protocols]
+  gFdtClientProtocolGuid
+
+[Depex]
+  gFdtClientProtocolGuid
-- 
2.5.0


[edk2] [PATCH 17/21] ArmVirtPkg/VirtFdtDxe: drop PCI host bridge handling

2016-04-06 Thread Ard Biesheuvel
Now that the PCI host bridge driver parses the DT node that describes
the PCI host bridge directly via the FDT client protocol, we can drop the
handling from VirtFdtDxe completely.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/ArmVirtQemu.dsc   |   7 -
 ArmVirtPkg/ArmVirtQemuKernel.dsc |   7 -
 ArmVirtPkg/ArmVirtXen.dsc|   7 -
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c   | 203 
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf |   9 -
 5 files changed, 233 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 4eb350e805d4..9942c0228687 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -212,13 +212,6 @@ [PcdsDynamicDefault.common]
   ## PL031 RealTimeClock
   gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0
 
-  gArmPlatformTokenSpaceGuid.PcdPciBusMin|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciBusMax|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciIoBase|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciIoSize|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciIoTranslation|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciMmio32Base|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciMmio32Size|0x0
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x0
 
   #
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index 32484fffa126..1e4d176a1f82 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -197,13 +197,6 @@ [PcdsDynamicDefault.common]
   ## PL031 RealTimeClock
   gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0
 
-  gArmPlatformTokenSpaceGuid.PcdPciBusMin|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciBusMax|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciIoBase|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciIoSize|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciIoTranslation|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciMmio32Base|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciMmio32Size|0x0
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x0
 
   #
diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
index 0af82be42913..2677c1900c49 100644
--- a/ArmVirtPkg/ArmVirtXen.dsc
+++ b/ArmVirtPkg/ArmVirtXen.dsc
@@ -133,13 +133,6 @@ [PcdsDynamicDefault.common]
   ## PL031 RealTimeClock
   gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0
 
-  gArmPlatformTokenSpaceGuid.PcdPciBusMin|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciBusMax|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciIoBase|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciIoSize|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciIoTranslation|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciMmio32Base|0x0
-  gArmPlatformTokenSpaceGuid.PcdPciMmio32Size|0x0
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x0
 
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c 
b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
index 0a47092e35ce..31e0ca7db8b4 100644
--- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
+++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
@@ -45,7 +45,6 @@ typedef enum {
   PropertyTypeRtc,
   PropertyTypeVirtio,
   PropertyTypeUart,
-  PropertyTypePciHost,
   PropertyTypeXen,
 } PROPERTY_TYPE;
 
@@ -58,7 +57,6 @@ STATIC CONST PROPERTY CompatibleProperties[] = {
   { PropertyTypeRtc, "arm,pl031" },
   { PropertyTypeVirtio,  "virtio,mmio"   },
   { PropertyTypeUart,"arm,pl011" },
-  { PropertyTypePciHost, "pci-host-ecam-generic" },
   { PropertyTypeXen, "xen,xen"   },
   { PropertyTypeUnknown, ""  }
 };
@@ -88,176 +86,6 @@ GetTypeFromNode (
   return PropertyTypeUnknown;
 }
 
-//
-// We expect the "ranges" property of "pci-host-ecam-generic" to consist of
-// records like this.
-//
-#pragma pack (1)
-typedef struct {
-  UINT32 Type;
-  UINT64 ChildBase;
-  UINT64 CpuBase;
-  UINT64 Size;
-} DTB_PCI_HOST_RANGE_RECORD;
-#pragma pack ()
-
-#define DTB_PCI_HOST_RANGE_RELOCATABLE  BIT31
-#define DTB_PCI_HOST_RANGE_PREFETCHABLE BIT30
-#define DTB_PCI_HOST_RANGE_ALIASED  BIT29
-#define DTB_PCI_HOST_RANGE_MMIO32   BIT25
-#define DTB_PCI_HOST_RANGE_MMIO64   (BIT25 | BIT24)
-#define DTB_PCI_HOST_RANGE_IO   BIT24
-#define DTB_PCI_HOST_RANGE_TYPEMASK (BIT31 | BIT30 | BIT29 | BIT25 | BIT24)
-
-/**
-  Process the device tree node describing the generic PCI host controller.
-
-  param[in] DeviceTreeBase  Pointer to the device tree.
-
-  param[in] NodeOffset of the device tree node whose "compatible"
-property is "pci-host-ecam-generic".
-
-  param[in] RegProp Pointer to the "reg" property of Node. The caller
-is responsible for ensuring that the size of the
-property is 4 UINT32 cells.
-
-  @retval EFI_SUCCESS Parsing successful, properties parsed from Node
-  have been stored in dynamic PCDs.
-
-  @retval EFI_PROTOCOL_ERROR  Parsing failed. PCDs are left unchanged.
-**/
-STATIC

[edk2] [PATCH 08/21] ArmVirtPkg/ArmVirtPsciResetSystemLib: move to FDT client protocol

2016-04-06 Thread Ard Biesheuvel
Instead of relying on VirtFdtDxe to detect the PSCI method, move our
EfiResetSystemLib to the FDT client protocol to interrogate the device
tree directly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.c   | 
38 +---
 ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf | 
11 +++---
 2 files changed, 41 insertions(+), 8 deletions(-)

diff --git 
a/ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.c 
b/ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.c
index 88332f56fd9c..1cedb943d841 100644
--- a/ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.c
+++ b/ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.c
@@ -26,19 +26,49 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
+#include 
+
 STATIC UINT32 mArmPsciMethod;
 
-RETURN_STATUS
+EFI_STATUS
 EFIAPI
 ArmPsciResetSystemLibConstructor (
-  VOID
+  IN EFI_HANDLEImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
   )
 {
-  mArmPsciMethod = PcdGet32 (PcdArmPsciMethod);
-  return RETURN_SUCCESS;
+  EFI_STATUSStatus;
+  FDT_CLIENT_PROTOCOL   *FdtClient;
+  CONST VOID*Prop;
+
+  Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  Status = FdtClient->FindCompatibleNodeProperty (FdtClient,
+  "arm,psci-0.2",
+  "method",
+  ,
+  NULL);
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  if (AsciiStrnCmp (Prop, "hvc", 3) == 0) {
+mArmPsciMethod = 1;
+  } else if (AsciiStrnCmp (Prop, "smc", 3) == 0) {
+mArmPsciMethod = 2;
+  } else {
+DEBUG ((EFI_D_ERROR, "%a: Unknown PSCI method \"%a\"\n", __FUNCTION__,
+  Prop));
+return EFI_NOT_FOUND;
+  }
+  return EFI_SUCCESS;
 }
 
 /**
diff --git 
a/ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf 
b/ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf
index 86d6104ca258..4b1668f54e8f 100644
--- a/ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf
+++ b/ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf
@@ -18,9 +18,9 @@ [Defines]
   INF_VERSION= 0x00010005
   BASE_NAME  = ArmVirtPsciResetSystemLib
   FILE_GUID  = c81d76ed-66fa-44a3-ac4a-f163120187a9
-  MODULE_TYPE= BASE
+  MODULE_TYPE= DXE_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = EfiResetSystemLib
+  LIBRARY_CLASS  = EfiResetSystemLib|DXE_DRIVER 
DXE_RUNTIME_DRIVER
   CONSTRUCTOR= ArmPsciResetSystemLibConstructor
 
 [Sources]
@@ -38,5 +38,8 @@ [LibraryClasses]
   ArmSmcLib
   ArmHvcLib
 
-[Pcd]
-  gArmVirtTokenSpaceGuid.PcdArmPsciMethod
+[Protocols]
+  gFdtClientProtocolGuid
+
+[Depex]
+  gFdtClientProtocolGuid
-- 
2.5.0

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


[edk2] [PATCH 12/21] ArmVirtPkg/VirtFdtDxe: remove timer DT node handling

2016-04-06 Thread Ard Biesheuvel
The timer code no longer relies on VirtFdtDxe to set the PCDs, so remove
the handling of the timer node and the references to those PCDs.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c   | 39 +---
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf |  4 --
 2 files changed, 1 insertion(+), 42 deletions(-)

diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c 
b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
index 4a4713cf6ad8..368618956be1 100644
--- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
+++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
@@ -45,7 +45,6 @@ typedef enum {
   PropertyTypeRtc,
   PropertyTypeVirtio,
   PropertyTypeUart,
-  PropertyTypeTimer,
   PropertyTypeFwCfg,
   PropertyTypePciHost,
   PropertyTypeXen,
@@ -60,20 +59,12 @@ STATIC CONST PROPERTY CompatibleProperties[] = {
   { PropertyTypeRtc, "arm,pl031" },
   { PropertyTypeVirtio,  "virtio,mmio"   },
   { PropertyTypeUart,"arm,pl011" },
-  { PropertyTypeTimer,   "arm,armv7-timer"   },
-  { PropertyTypeTimer,   "arm,armv8-timer"   },
   { PropertyTypeFwCfg,   "qemu,fw-cfg-mmio"  },
   { PropertyTypePciHost, "pci-host-ecam-generic" },
   { PropertyTypeXen, "xen,xen"   },
   { PropertyTypeUnknown, ""  }
 };
 
-typedef struct {
-  UINT32  Type;
-  UINT32  Number;
-  UINT32  Flags;
-} INTERRUPT_PROPERTY;
-
 STATIC
 PROPERTY_TYPE
 GetTypeFromNode (
@@ -288,8 +279,6 @@ InitializeVirtFdtDxe (
   VIRTIO_TRANSPORT_DEVICE_PATH   *DevicePath;
   EFI_HANDLE Handle;
   UINT64 RegBase;
-  CONST INTERRUPT_PROPERTY   *InterruptProp;
-  INT32  SecIntrNum, IntrNum, VirtIntrNum, HypIntrNum;
   UINT64 FwCfgSelectorAddress;
   UINT64 FwCfgSelectorSize;
   UINT64 FwCfgDataAddress;
@@ -339,7 +328,7 @@ InitializeVirtFdtDxe (
 // TODO use #cells root properties instead
 //
 RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", );
-ASSERT ((RegProp != NULL) || (PropType == PropertyTypeTimer));
+ASSERT (RegProp != NULL);
 
 switch (PropType) {
 case PropertyTypePciHost:
@@ -449,32 +438,6 @@ InitializeVirtFdtDxe (
   RtcNode = Node;
   break;
 
-case PropertyTypeTimer:
-  //
-  // - interrupts : Interrupt list for secure, non-secure, virtual and
-  //  hypervisor timers, in that order.
-  //
-  InterruptProp = fdt_getprop (DeviceTreeBase, Node, "interrupts", );
-  ASSERT (Len == 36 || Len == 48);
-
-  SecIntrNum = fdt32_to_cpu (InterruptProp[0].Number)
-   + (InterruptProp[0].Type ? 16 : 0);
-  IntrNum = fdt32_to_cpu (InterruptProp[1].Number)
-+ (InterruptProp[1].Type ? 16 : 0);
-  VirtIntrNum = fdt32_to_cpu (InterruptProp[2].Number)
-+ (InterruptProp[2].Type ? 16 : 0);
-  HypIntrNum = Len < 48 ? 0 : fdt32_to_cpu (InterruptProp[3].Number)
-  + (InterruptProp[3].Type ? 16 : 0);
-
-  DEBUG ((EFI_D_INFO, "Found Timer interrupts %d, %d, %d, %d\n",
-SecIntrNum, IntrNum, VirtIntrNum, HypIntrNum));
-
-  PcdSet32 (PcdArmArchTimerSecIntrNum, SecIntrNum);
-  PcdSet32 (PcdArmArchTimerIntrNum, IntrNum);
-  PcdSet32 (PcdArmArchTimerVirtIntrNum, VirtIntrNum);
-  PcdSet32 (PcdArmArchTimerHypIntrNum, HypIntrNum);
-  break;
-
 case PropertyTypeXen:
   ASSERT (Len == 16);
 
diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf 
b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
index 5526fd19250e..c928e826c258 100644
--- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
+++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
@@ -53,10 +53,6 @@ [Pcd]
   gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress
   gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress
   gArmVirtTokenSpaceGuid.PcdFwCfgDmaAddress
-  gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum
-  gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
-  gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum
-  gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
   gArmPlatformTokenSpaceGuid.PcdPL031RtcBase
   gArmPlatformTokenSpaceGuid.PcdPciBusMin
   gArmPlatformTokenSpaceGuid.PcdPciBusMax
-- 
2.5.0

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


[edk2] [PATCH 11/21] ArmVirtPkg: move TimerDxe to FDT client library

2016-04-06 Thread Ard Biesheuvel
Move to the new dedicated to ArmVirtTimerFdtClientLib to populate the
various timer related PCDs at driver load time rather than relying on
VirtFdtDxe to do it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/ArmVirtQemu.dsc   | 5 
-
 ArmVirtPkg/ArmVirtQemuKernel.dsc | 5 
-
 ArmVirtPkg/ArmVirtXen.dsc| 5 
-
 ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf | 3 
+++
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index dac37c90f96b..ee9d37c2d660 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -313,7 +313,10 @@ [Components.common]
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
-  ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+  ArmPkg/Drivers/TimerDxe/TimerDxe.inf {
+
+  
NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
+  }
 !if $(SECURE_BOOT_ENABLE) == TRUE
   ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedDxe.inf
 !else
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index 6d0946776f76..f41dd19da583 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -291,7 +291,10 @@ [Components.common]
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
-  ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+  ArmPkg/Drivers/TimerDxe/TimerDxe.inf {
+
+  
NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
+  }
 !if $(SECURE_BOOT_ENABLE) == TRUE
   ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedDxe.inf
 !else
diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
index 9cf51d5554ea..7ea46514dad3 100644
--- a/ArmVirtPkg/ArmVirtXen.dsc
+++ b/ArmVirtPkg/ArmVirtXen.dsc
@@ -202,7 +202,10 @@ [Components.common]
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
-  ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+  ArmPkg/Drivers/TimerDxe/TimerDxe.inf {
+
+  
NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
+  }
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
 
   #
diff --git 
a/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf 
b/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
index b694c5c817a5..50af25f691e2 100644
--- a/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
+++ b/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
@@ -45,3 +45,6 @@ [Pcd]
   gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
   gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum
   gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
+
+[Depex]
+  gFdtClientProtocolGuid
-- 
2.5.0

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


[edk2] [PATCH 05/21] ArmVirtPkg: add FdtClientDxe to the ArmVirtPkg platforms

2016-04-06 Thread Ard Biesheuvel
Add FdtClientDxe to the various platforms under ArmVirtPkg, which will be
required when we update the shared ArmGicArchLib to depend on it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/ArmVirtQemu.dsc   | 1 +
 ArmVirtPkg/ArmVirtQemu.fdf   | 1 +
 ArmVirtPkg/ArmVirtQemuKernel.dsc | 1 +
 ArmVirtPkg/ArmVirtQemuKernel.fdf | 1 +
 ArmVirtPkg/ArmVirtXen.dsc| 1 +
 ArmVirtPkg/ArmVirtXen.fdf| 1 +
 6 files changed, 6 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 5a158c2de94b..fb42946f4f45 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -328,6 +328,7 @@ [Components.common]
   # Platform Driver
   #
   ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
+  ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
   ArmVirtPkg/HighMemDxe/HighMemDxe.inf
   OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
index 600e10882434..ed48cabc28d2 100644
--- a/ArmVirtPkg/ArmVirtQemu.fdf
+++ b/ArmVirtPkg/ArmVirtQemu.fdf
@@ -108,6 +108,7 @@ [FV.FvMain]
   INF MdeModulePkg/Core/Dxe/DxeMain.inf
   INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
   INF ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
+  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
   INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
 
   #
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index 925a1fdec0e2..cb14972f9bac 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -306,6 +306,7 @@ [Components.common]
   # Platform Driver
   #
   ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
+  ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
   OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   OvmfPkg/VirtioNetDxe/VirtioNet.inf
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQemuKernel.fdf
index 7491f8042bd7..c431355eda3d 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.fdf
+++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf
@@ -130,6 +130,7 @@ [FV.FvMain]
   INF MdeModulePkg/Core/Dxe/DxeMain.inf
   INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
   INF ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
+  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
 
   #
   # PI DXE Drivers producing Architectural Protocols (EFI Services)
diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
index 6a542f2447de..f46a79c45e15 100644
--- a/ArmVirtPkg/ArmVirtXen.dsc
+++ b/ArmVirtPkg/ArmVirtXen.dsc
@@ -212,6 +212,7 @@ [Components.common]
   # Platform Driver
   #
   ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
+  ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
 
   #
   # FAT filesystem + GPT/MBR partitioning
diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
index d7d4612de2ef..f25c649ba2ca 100644
--- a/ArmVirtPkg/ArmVirtXen.fdf
+++ b/ArmVirtPkg/ArmVirtXen.fdf
@@ -130,6 +130,7 @@ [FV.FvMain]
   INF MdeModulePkg/Core/Dxe/DxeMain.inf
   INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
   INF ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
+  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
 
   #
   # PI DXE Drivers producing Architectural Protocols (EFI Services)
-- 
2.5.0

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


[edk2] [PATCH 10/21] ArmVirtPkg: implement ArmVirtTimerFdtClientLib

2016-04-06 Thread Ard Biesheuvel
This implements a library ArmVirtTimerFdtClientLib which is intended to
be incorporated into TimerDxe via NULL library class resolution. This
allows us to make TimerDxe depend on the FDT client protocol, and
discover the timer interrupts from the device tree directly rather than
relying on VirtFdtDxe to set the dynamic PCDs.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.c   | 90 

 ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf | 47 
++
 2 files changed, 137 insertions(+)

diff --git 
a/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.c 
b/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.c
new file mode 100644
index ..0001f8fbcd82
--- /dev/null
+++ b/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.c
@@ -0,0 +1,90 @@
+/** @file
+  FDT client library for ARM's TimerDxe
+
+  Copyright (c) 2016, Linaro Ltd. All rights reserved.
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+typedef struct {
+  UINT32  Type;
+  UINT32  Number;
+  UINT32  Flags;
+} INTERRUPT_PROPERTY;
+
+EFI_STATUS
+EFIAPI
+ArmVirtTimerFdtClientLibConstructor (
+  IN EFI_HANDLEImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_STATUSStatus;
+  FDT_CLIENT_PROTOCOL   *FdtClient;
+  CONST INTERRUPT_PROPERTY  *InterruptProp;
+  UINTN PropSize;
+  INT32 SecIntrNum, IntrNum, VirtIntrNum, HypIntrNum;
+
+  Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  Status = FdtClient->FindCompatibleNodeProperty (FdtClient,
+  "arm,armv7-timer",
+  "interrupts",
+  (CONST VOID 
**),
+  );
+  if (Status == EFI_NOT_FOUND) {
+Status = FdtClient->FindCompatibleNodeProperty (FdtClient,
+"arm,armv8-timer",
+"interrupts",
+(CONST VOID 
**),
+);
+  }
+
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  //
+  // - interrupts : Interrupt list for secure, non-secure, virtual and
+  //  hypervisor timers, in that order.
+  //
+  ASSERT (PropSize == 36 || PropSize == 48);
+
+  SecIntrNum = fdt32_to_cpu (InterruptProp[0].Number)
+   + (InterruptProp[0].Type ? 16 : 0);
+  IntrNum = fdt32_to_cpu (InterruptProp[1].Number)
++ (InterruptProp[1].Type ? 16 : 0);
+  VirtIntrNum = fdt32_to_cpu (InterruptProp[2].Number)
++ (InterruptProp[2].Type ? 16 : 0);
+  HypIntrNum = PropSize < 48 ? 0 : fdt32_to_cpu (InterruptProp[3].Number)
+   + (InterruptProp[3].Type ? 16 : 0);
+
+  DEBUG ((EFI_D_INFO, "Found Timer interrupts %d, %d, %d, %d\n",
+SecIntrNum, IntrNum, VirtIntrNum, HypIntrNum));
+
+  PcdSet32 (PcdArmArchTimerSecIntrNum, SecIntrNum);
+  PcdSet32 (PcdArmArchTimerIntrNum, IntrNum);
+  PcdSet32 (PcdArmArchTimerVirtIntrNum, VirtIntrNum);
+  PcdSet32 (PcdArmArchTimerHypIntrNum, HypIntrNum);
+
+  return EFI_SUCCESS;
+}
+
diff --git 
a/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf 
b/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
new file mode 100644
index ..b694c5c817a5
--- /dev/null
+++ b/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
@@ -0,0 +1,47 @@
+#/** @file
+#  FDT client library for ARM's TimerDxe
+#
+#  Copyright (c) 2016, Linaro Ltd. All rights reserved.
+#
+#  This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD 
License
+#  which accompanies this distribution. The full text of the license may be 
found at
+#  http://opensource.org/licenses/bsd-license.php
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+#
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = ArmVirtTimerFdtClientLib
+  FILE_GUID   

[edk2] [PATCH 03/21] ArmVirtPkg: drop dependency on PeiPcdLib for PEI Pcd.inf

2016-04-06 Thread Ard Biesheuvel
The PcdPeim dynamic PCD driver is dispatched explicitly via an 'A PRIORI'
declaration in the platform DSC. Without that declaration, the PEI module
can never be dispatched since it transitively depends on protocols it
produces itself via PeiPcdLib. So use the NULL PcdLib explicitly only for
this driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/ArmVirtQemu.dsc | 5 -
 ArmVirtPkg/ArmVirtQemu.fdf | 3 ---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index a1a281303ac4..5a158c2de94b 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -255,7 +255,10 @@ [Components.common]
   #
   ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
   MdeModulePkg/Core/Pei/PeiMain.inf
-  MdeModulePkg/Universal/PCD/Pei/Pcd.inf
+  MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
+
+  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  }
   ArmPlatformPkg/PlatformPei/PlatformPeim.inf
   ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
   ArmPkg/Drivers/CpuPei/CpuPei.inf
diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
index ef456539cc62..600e10882434 100644
--- a/ArmVirtPkg/ArmVirtQemu.fdf
+++ b/ArmVirtPkg/ArmVirtQemu.fdf
@@ -262,9 +262,6 @@ [FV.FVMAIN_COMPACT]
 READ_LOCK_CAP  = TRUE
 READ_LOCK_STATUS   = TRUE
 
-  APRIORI PEI {
-INF  MdeModulePkg/Universal/PCD/Pei/Pcd.inf
-  }
   INF ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
   INF MdeModulePkg/Core/Pei/PeiMain.inf
   INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf
-- 
2.5.0

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


[edk2] [PATCH 09/21] ArmVirtPkg/VirtFdtDxe: drop detection of PSCI method

2016-04-06 Thread Ard Biesheuvel
The detection of the PSCI method has been moved to the EfiResetSystemLib
implementation, so drop the handling from VirtFdtDxe. Since no users
remain of gArmVirtTokenSpaceGuid.PcdArmPsciMethod, remove that as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/ArmVirtPkg.dec|  8 
 ArmVirtPkg/ArmVirtQemu.dsc   |  2 --
 ArmVirtPkg/ArmVirtQemuKernel.dsc |  2 --
 ArmVirtPkg/ArmVirtXen.dsc|  2 --
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c   | 19 +--
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf |  1 -
 6 files changed, 1 insertion(+), 33 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
index adbd5e319a09..73136adf62c6 100644
--- a/ArmVirtPkg/ArmVirtPkg.dec
+++ b/ArmVirtPkg/ArmVirtPkg.dec
@@ -60,14 +60,6 @@ [PcdsFixedAtBuild, PcdsPatchableInModule]
   gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x65, 0x60, 0xA6, 0xDF, 
0x19, 0xB4, 0xD3, 0x11, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 
0x4D}|VOID*|0x0007
 
 [PcdsDynamic, PcdsFixedAtBuild]
-  #
-  # ARM PSCI function invocations can be done either through hypervisor
-  # calls (HVC) or secure monitor calls (SMC).
-  # PcdArmPsciMethod == 1 : use HVC
-  # PcdArmPsciMethod == 2 : use SMC
-  #
-  gArmVirtTokenSpaceGuid.PcdArmPsciMethod|0|UINT32|0x0003
-
   gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress|0x0|UINT64|0x0004
   gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress|0x0|UINT64|0x0005
   gArmVirtTokenSpaceGuid.PcdFwCfgDmaAddress|0x0|UINT64|0x0009
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 6dbd6571fbee..dac37c90f96b 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -221,8 +221,6 @@ [PcdsDynamicDefault.common]
   gArmPlatformTokenSpaceGuid.PcdPciMmio32Size|0x0
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x0
 
-  gArmVirtTokenSpaceGuid.PcdArmPsciMethod|0
-
   gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress|0x0
   gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress|0x0
   gArmVirtTokenSpaceGuid.PcdFwCfgDmaAddress|0x0
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index c36de5cc4294..6d0946776f76 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -206,8 +206,6 @@ [PcdsDynamicDefault.common]
   gArmPlatformTokenSpaceGuid.PcdPciMmio32Size|0x0
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x0
 
-  gArmVirtTokenSpaceGuid.PcdArmPsciMethod|0
-
   gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress|0x0
   gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress|0x0
   gArmVirtTokenSpaceGuid.PcdFwCfgDmaAddress|0x0
diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
index 72bc4745309b..9cf51d5554ea 100644
--- a/ArmVirtPkg/ArmVirtXen.dsc
+++ b/ArmVirtPkg/ArmVirtXen.dsc
@@ -146,8 +146,6 @@ [PcdsDynamicDefault.common]
   gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress|0x0
   gArmVirtTokenSpaceGuid.PcdFwCfgDmaAddress|0x0
 
-  gArmVirtTokenSpaceGuid.PcdArmPsciMethod|0
-
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
 
 

diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c 
b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
index 0e308497e79e..4a4713cf6ad8 100644
--- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
+++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
@@ -46,7 +46,6 @@ typedef enum {
   PropertyTypeVirtio,
   PropertyTypeUart,
   PropertyTypeTimer,
-  PropertyTypePsci,
   PropertyTypeFwCfg,
   PropertyTypePciHost,
   PropertyTypeXen,
@@ -63,7 +62,6 @@ STATIC CONST PROPERTY CompatibleProperties[] = {
   { PropertyTypeUart,"arm,pl011" },
   { PropertyTypeTimer,   "arm,armv7-timer"   },
   { PropertyTypeTimer,   "arm,armv8-timer"   },
-  { PropertyTypePsci,"arm,psci-0.2"  },
   { PropertyTypeFwCfg,   "qemu,fw-cfg-mmio"  },
   { PropertyTypePciHost, "pci-host-ecam-generic" },
   { PropertyTypeXen, "xen,xen"   },
@@ -292,7 +290,6 @@ InitializeVirtFdtDxe (
   UINT64 RegBase;
   CONST INTERRUPT_PROPERTY   *InterruptProp;
   INT32  SecIntrNum, IntrNum, VirtIntrNum, HypIntrNum;
-  CONST CHAR8*PsciMethod;
   UINT64 FwCfgSelectorAddress;
   UINT64 FwCfgSelectorSize;
   UINT64 FwCfgDataAddress;
@@ -342,8 +339,7 @@ InitializeVirtFdtDxe (
 // TODO use #cells root properties instead
 //
 RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", );
-ASSERT ((RegProp != NULL) || (PropType == PropertyTypeTimer) ||
-  (PropType == PropertyTypePsci));
+ASSERT ((RegProp != NULL) || (PropType == PropertyTypeTimer));
 
 switch (PropType) {
 case PropertyTypePciHost:
@@ -479,19 +475,6 @@ InitializeVirtFdtDxe (
   PcdSet32 (PcdArmArchTimerHypIntrNum, HypIntrNum);
   break;
 
-case PropertyTypePsci:
-  

[edk2] [PATCH 01/21] ArmVirtPkg: introduce FdtClientProtocol

2016-04-06 Thread Ard Biesheuvel
This introduces the FdtClientProtocol, which will be used to expose the
device tree provided by the host to other DXE drivers.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/ArmVirtPkg.dec   |  3 +
 ArmVirtPkg/Include/Protocol/FdtClient.h | 89 
 2 files changed, 92 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
index b6ff63677837..fa908253b320 100644
--- a/ArmVirtPkg/ArmVirtPkg.dec
+++ b/ArmVirtPkg/ArmVirtPkg.dec
@@ -34,6 +34,9 @@ [Guids.common]
   gArmVirtTokenSpaceGuid = { 0x0B6F5CA7, 0x4F53, 0x445A, { 0xB7, 0x6E, 0x2E, 
0x36, 0x5B, 0x80, 0x63, 0x66 } }
   gEarlyPL011BaseAddressGuid   = { 0xB199DEA9, 0xFD5C, 0x4A84, { 0x80, 
0x82, 0x2F, 0x41, 0x70, 0x78, 0x03, 0x05 } }
 
+[Protocols]
+  gFdtClientProtocolGuid = { 0xE11FACA0, 0x4710, 0x4C8E, { 0xA7, 0xA2, 0x01, 
0xBA, 0xA2, 0x59, 0x1B, 0x4C } }
+
 [PcdsFixedAtBuild, PcdsPatchableInModule]
   #
   # This is the physical address where the device tree is expected to be stored
diff --git a/ArmVirtPkg/Include/Protocol/FdtClient.h 
b/ArmVirtPkg/Include/Protocol/FdtClient.h
new file mode 100644
index ..b7cf8191b5ab
--- /dev/null
+++ b/ArmVirtPkg/Include/Protocol/FdtClient.h
@@ -0,0 +1,89 @@
+/** @file
+
+  Copyright (c) 2016, Linaro Ltd. All rights reserved.
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __FDT_CLIENT_PROTOCOL_H__
+#define __FDT_CLIENT_PROTOCOL_H__
+
+//
+// Protocol interface structure
+//
+typedef struct _FDT_CLIENT_PROTOCOL FDT_CLIENT_PROTOCOL;
+
+typedef
+EFI_STATUS
+(EFIAPI *FDT_CLIENT_GET_NODE_PROPERTY) (
+  IN  FDT_CLIENT_PROTOCOL *This,
+  IN  INT32   Node,
+  IN  CONST CHAR8 *PropertyName,
+  OUT CONST VOID  **Prop,
+  OUT UINTN   *PropSize OPTIONAL
+  );
+
+typedef
+EFI_STATUS
+(EFIAPI *FDT_CLIENT_SET_NODE_PROPERTY) (
+  IN  FDT_CLIENT_PROTOCOL *This,
+  IN  INT32   Node,
+  IN  CONST CHAR8 *PropertyName,
+  IN  CONST VOID  *Prop,
+  IN  UINTN   PropSize
+  );
+
+typedef
+EFI_STATUS
+(EFIAPI *FDT_CLIENT_FIND_COMPATIBLE_NODE) (
+  IN  FDT_CLIENT_PROTOCOL *This,
+  IN  CONST CHAR8 *CompatibleString,
+  OUT INT32   *Node
+  );
+
+typedef
+EFI_STATUS
+(EFIAPI *FDT_CLIENT_FIND_COMPATIBLE_NODE_PROPERTY) (
+  IN  FDT_CLIENT_PROTOCOL *This,
+  IN  CONST CHAR8 *CompatibleString,
+  IN  CONST CHAR8 *PropertyName,
+  OUT CONST VOID  **Prop,
+  OUT UINTN   *PropSize OPTIONAL
+  );
+
+typedef
+EFI_STATUS
+(EFIAPI *FDT_CLIENT_FIND_COMPATIBLE_NODE_REG) (
+  IN  FDT_CLIENT_PROTOCOL *This,
+  IN  CONST CHAR8 *CompatibleString,
+  OUT CONST VOID  **Reg,
+  OUT UINTN   *RegElemSize,
+  OUT UINTN   *RegSize
+  );
+
+typedef
+EFI_STATUS
+(EFIAPI *FDT_CLIENT_GET_CHOSEN_NODE) (
+  IN  FDT_CLIENT_PROTOCOL *This,
+  OUT INT32   *Node
+  );
+
+struct _FDT_CLIENT_PROTOCOL {
+  FDT_CLIENT_GET_NODE_PROPERTY GetNodeProperty;
+  FDT_CLIENT_SET_NODE_PROPERTY SetNodeProperty;
+
+  FDT_CLIENT_FIND_COMPATIBLE_NODE  FindCompatibleNode;
+  FDT_CLIENT_FIND_COMPATIBLE_NODE_PROPERTY FindCompatibleNodeProperty;
+  FDT_CLIENT_FIND_COMPATIBLE_NODE_REG  FindCompatibleNodeReg;
+
+  FDT_CLIENT_GET_CHOSEN_NODE   GetChosenNode;
+};
+
+#endif
-- 
2.5.0

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


[edk2] [PATCH 00/21] VirtFdtDxe refactoring

2016-04-06 Thread Ard Biesheuvel
This is the first step towards getting rid of the kludge which is VirtFdtDxe.

This series addresses the cases where other DXE drivers rely on dynamic PCDs
populated by VirtFdtDxe, which requires it to execute first using an A PRIORI
declaration. Instead, this series moves the DT node parsing to the respective
users, using a new FDT client protocol which can be used in the various
depexes.

The next step is to split the remaining handling performed by VirtFdtDxe into
drivers appropriate for the platforms, i.e., virtio for QEMU and xeniommio for
Xen domU.

This is somewhat rough around the edges, but is mostly intended to elicit
discussion, and I fully expect these changes to make it into the tree looking
a lot different from this v1.

Ard Biesheuvel (21):
  ArmVirtPkg: introduce FdtClientProtocol
  ArmVirtPkg: drop dependency on DxePcdLib for DXE Pcd.inf
  ArmVirtPkg: drop dependency on PeiPcdLib for PEI Pcd.inf
  ArmVirtPkg/FdtClientDxe: implement new driver
  ArmVirtPkg: add FdtClientDxe to the ArmVirtPkg platforms
  ArmVirtPkg/ArmGicArchLib: move to FdtClient protocol
  ArmVirtPkg/VirtFdtDxe: remove GIC discovery
  ArmVirtPkg/ArmVirtPsciResetSystemLib: move to FDT client protocol
  ArmVirtPkg/VirtFdtDxe: drop detection of PSCI method
  ArmVirtPkg: implement ArmVirtTimerFdtClientLib
  ArmVirtPkg: move TimerDxe to FDT client library
  ArmVirtPkg/VirtFdtDxe: remove timer DT node handling
  ArmVirtPkg/QemuFwCfgLib: move to FDT client protocol
  ArmVirtPkg/VirtFdtDxe: remove handling of fw_cfg DT node
  ArmVirtPkg/PciHostBridgeDxe: move to FDT client protocol
  ArmVirtPkg/BaseCachingPciExpressLib: construct at first invocation
  ArmVirtPkg/VirtFdtDxe: drop PCI host bridge handling
  ArmVirtPkg: implement ArmVirtRtcFdtClientLib
  ArmVirtPkg: move QEMU based platforms to ArmVirtRtcFdtClientLib
  ArmVirtPkg/VirtFdtDxe: drop RTC handling
  ArmVirtPkg: get rid of A PRIORI DXE declarations for VirtFdtDxe

 ArmVirtPkg/ArmVirtPkg.dec  |  
21 +-
 ArmVirtPkg/ArmVirtQemu.dsc |  
35 +-
 ArmVirtPkg/ArmVirtQemu.fdf |   
8 +-
 ArmVirtPkg/ArmVirtQemuKernel.dsc   |  
30 +-
 ArmVirtPkg/ArmVirtQemuKernel.fdf   |   
5 +-
 ArmVirtPkg/ArmVirtXen.dsc  |  
25 +-
 ArmVirtPkg/ArmVirtXen.fdf  |   
5 +-
 ArmVirtPkg/FdtClientDxe/FdtClientDxe.c | 
236 
 ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf   |  
48 +++
 ArmVirtPkg/Include/Protocol/FdtClient.h|  
89 +
 ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c   |  
84 -
 ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.inf |  
15 +-
 ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.c   |  
38 +-
 ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf |  
11 +-
 ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.c |  
69 
 ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.inf   |  
48 +++
 ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.c |  
90 +
 ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf   |  
50 +++
 ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf   |   
1 -
 ArmVirtPkg/Library/BaseCachingPciExpressLib/PciExpressLib.c|  
16 +-
 ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c |  
73 +++-
 ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf   |  
12 +-
 ArmVirtPkg/PciHostBridgeDxe/PciHostBridge.c| 
233 +++-
 ArmVirtPkg/PciHostBridgeDxe/PciHostBridge.h|   
2 +
 ArmVirtPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf   |  
16 +-
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c | 
395 +---
 ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf   |  
27 --
 27 files changed, 1112 insertions(+), 570 deletions(-)
 create mode 100644 ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
 create mode 100644 ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
 create mode 100644 ArmVirtPkg/Include/Protocol/FdtClient.h
 create mode 100644 
ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.c
 create mode 100644 
ArmVirtPkg/Library/ArmVirtRtcFdtClientLib/ArmVirtRtcFdtClientLib.inf
 create mode 100644 
ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.c
 create mode 100644 
ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf

-- 
2.5.0

___
edk2-devel mailing list

[edk2] [PATCH 04/21] ArmVirtPkg/FdtClientDxe: implement new driver

2016-04-06 Thread Ard Biesheuvel
This implements a new DXE driver FdtClientDxe to produce the FDT client
protocol based on a device tree image supplied by the virt host.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/FdtClientDxe/FdtClientDxe.c   | 236 
 ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf |  48 
 2 files changed, 284 insertions(+)

diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c 
b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
new file mode 100644
index ..716194ef798a
--- /dev/null
+++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
@@ -0,0 +1,236 @@
+/** @file
+*  FDT client driver
+*
+*  Copyright (c) 2016, Linaro Ltd. All rights reserved.
+*
+*  This program and the accompanying materials are
+*  licensed and made available under the terms and conditions of the BSD 
License
+*  which accompanies this distribution.  The full text of the license may be 
found at
+*  http://opensource.org/licenses/bsd-license.php
+*
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+*
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+STATIC VOID  *mDeviceTreeBase;
+
+STATIC
+EFI_STATUS
+GetNodeProperty (
+  IN  FDT_CLIENT_PROTOCOL *This,
+  IN  INT32   Node,
+  IN  CONST CHAR8 *PropertyName,
+  OUT CONST VOID  **Prop,
+  OUT UINTN   *PropSize OPTIONAL
+  )
+{
+  INT32 Len;
+
+  ASSERT (mDeviceTreeBase != NULL);
+
+  *Prop = fdt_getprop (mDeviceTreeBase, Node, PropertyName, );
+  if (*Prop == NULL) {
+return EFI_NOT_FOUND;
+  }
+
+  if (PropSize != NULL) {
+*PropSize = Len;
+  }
+  return EFI_SUCCESS;
+}
+
+STATIC
+EFI_STATUS
+SetNodeProperty (
+  IN  FDT_CLIENT_PROTOCOL *This,
+  IN  INT32   Node,
+  IN  CONST CHAR8 *PropertyName,
+  IN  CONST VOID  *Prop,
+  IN  UINTN   PropSize
+  )
+{
+  INT32 Ret;
+
+  ASSERT (mDeviceTreeBase != NULL);
+
+  Ret = fdt_setprop (mDeviceTreeBase, Node, PropertyName, Prop, 
(UINT32)PropSize);
+  if (Ret != 0) {
+return EFI_DEVICE_ERROR;
+  }
+
+  return EFI_SUCCESS;
+}
+
+STATIC
+EFI_STATUS
+EFIAPI
+FindCompatibleNode (
+  IN  FDT_CLIENT_PROTOCOL *This,
+  IN  CONST CHAR8 *CompatibleString,
+  OUT INT32   *Node
+  )
+{
+  INT32  NextNode, PrevNode;
+  CONST CHAR8*Type, *Compatible;
+  INT32  Len;
+
+  ASSERT (mDeviceTreeBase != NULL);
+
+  if (Node == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  for (PrevNode = 0;; PrevNode = NextNode) {
+NextNode = fdt_next_node (mDeviceTreeBase, PrevNode, NULL);
+if (NextNode < 0) {
+  break;
+}
+
+Type = fdt_getprop (mDeviceTreeBase, NextNode, "compatible", );
+if (Type == NULL) {
+  continue;
+}
+
+//
+// A 'compatible' node may contain a sequence of NULL terminated
+// compatible strings so check each one
+//
+for (Compatible = Type; Compatible < Type + Len && *Compatible;
+ Compatible += 1 + AsciiStrLen (Compatible)) {
+  if (AsciiStrCmp (CompatibleString, Compatible) == 0) {
+*Node = NextNode;
+return EFI_SUCCESS;
+  }
+}
+  }
+  return EFI_NOT_FOUND;
+}
+
+STATIC
+EFI_STATUS
+EFIAPI
+FindCompatibleNodeProperty (
+  IN  FDT_CLIENT_PROTOCOL *This,
+  IN  CONST CHAR8 *CompatibleString,
+  IN  CONST CHAR8 *PropertyName,
+  OUT CONST VOID  **Prop,
+  OUT UINTN   *PropSize OPTIONAL
+  )
+{
+  EFI_STATUSStatus;
+  INT32 Node;
+
+  Status = FindCompatibleNode (This, CompatibleString, );
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  return GetNodeProperty (This, Node, PropertyName, Prop, PropSize);
+}
+
+STATIC
+EFI_STATUS
+EFIAPI
+FindCompatibleNodeReg (
+  IN  FDT_CLIENT_PROTOCOL *This,
+  IN  CONST CHAR8 *CompatibleString,
+  OUT CONST VOID  **Reg,
+  OUT UINTN   *RegElemSize,
+  OUT UINTN   *RegSize
+  )
+{
+  EFI_STATUSStatus;
+
+  //
+  // Get the 'reg' property of this node. For now, we will assume
+  // 8 byte quantities for base and size, respectively.
+  // TODO use #cells root properties instead
+  //
+  Status = FindCompatibleNodeProperty (This, CompatibleString, "reg", Reg, 
RegSize);
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  *RegElemSize = 8;
+
+  return EFI_SUCCESS;
+}
+
+STATIC
+EFI_STATUS
+GetChosenNode (
+  IN  FDT_CLIENT_PROTOCOL *This,
+  OUT INT32   *Node
+  )
+{
+  INT32 NewNode;
+
+  ASSERT (mDeviceTreeBase != NULL);
+
+  NewNode = fdt_path_offset (mDeviceTreeBase, "/chosen");
+  if (NewNode < 0) {
+NewNode = fdt_add_subnode (mDeviceTreeBase, 0, "/chosen");
+  }
+
+  if (NewNode < 0) {
+return 

Re: [edk2] [PATCH V2 0/8] Move S3Ready() functional code from AcpiS3SaveDxe to S3SaveStateDxe

2016-04-06 Thread Laszlo Ersek
Hi Star,

On 04/06/16 14:40, Star Zeng wrote:
> The S3Ready() functional code in AcpiS3SaveDxe of IntelFrameworkModulePkg
> is to do ACPI S3 Context save. In fact, that is not really related to
> Intel framework ACPI S3 protocol.
> 
> IntelFrameworkModulePkg will be deprecated step by step, so move the
> functional code to MdeModulePkg and S3SaveStateDxe is a good place.
> The ACPI global variable related code is leaved as is in 
> IntelFrameworkModulePkg
> AcpiS3SaveDxe for compatibility.
> PcdS3BootScriptStackSize is also moved from IntelFrameworkModulePkg.
> 
> The functional code need to get ACPI FACS table and consume LockBoxLib,
> so need to be before DxeSmmReadyToLock that will shut down SMM lock box
> interface, EndOfDxe is a good time point (OVMF AcpiS3SaveDxe has the
> reference implementation).
> 
> After the movement, AcpiS3SaveDxe in OvmfPkg could be retired.
> With this patch series, I did S3 test on real platform and normal boot for 
> OVMF.
> 
> Laszlo & Jordan, could you help confirm the S3 functionality for OVMF?
> 
> V2:
> Major change to V1 is to introduce a new PCD PcdAcpiS3Enable.
> It is for the concern to V1, detailed discussion about V1 is at
> http://article.gmane.org/gmane.comp.bios.edk2.devel/10261

* I like this version very much. I tested it extensively:

  guest OS  SMM  S3   OVMFQEMU  tests done
enabled  enabled  platformmachine type
    ---  ---  --    ---
  Fedorano   no   X64 pcnormal boot
  Fedorano   yes  X64 pcnormal boot, S3
  Fedorayes  no   Ia32X64 q35   normal boot
  Fedorayes  yes  Ia32X64 q35   normal boot, S3
  Win 8.1   yes  no   Ia32X64 q35   normal boot
  Win 8.1   yes  yes  Ia32X64 q35   normal boot, S3

All tests passed with your series applied.

* Beyond the functional testing, I also compared OVMF log files. Namely,
I ran all six tests both without and with your series, capturing the
OVMF logs (12 log files in total), and for each one of the six test
cases, I compared the without-patches log against the with-patches log.

Everything looks good. The changes incurred by your patches can be
tracked to the logs. In addition, I found two interesting changes:

(1) With your patches applied, when S3 is disabled -- and regardless of
SMM --, the EfiS3SaveStateProtocol is also not produced. This is an
improvement (= memory saving) for OVMF, because at the moment, OVMF
knows not to consume EfiS3SaveStateProtocol when S3 is disabled, but it
cannot prevent EfiS3SaveStateProtocol from being produced. With your
patches, EfiS3SaveStateProtocol is not even produced, which is welcome.

(2) in the two cases when the platform is Ia32X64 and S3 is enabled, I
found that

  TotalPageTableSize - 42 pages

changed to

  AcpiS3ContextSave TotalPageTableSize - 0xE pages

with your patches applied.

This is due to your commit 353f5ba92f94

  IntelFrameworkModulePkg AcpiS3SaveDxe: Reduce reserved memory
  consumption"

which OvmfPkg's clone of AcpiS3SaveDxe has been missing (we had forked
it before your commit). With your patches applied, this improvement gets
applied to OVMF automatically. That is also very welcome. :)

* I want the mailing list to preserve my log files (described above).
Since they are quite big when uncompressed, and I cannot send binary
attachments to the list, I tarred them, compressed the tarball with xz,
and attached the base64-encoded tar.xz. It is not big in this form (~43 KB).

* You can add

Tested-by: Laszlo Ersek 

to patches #1 through #6 . My testing covered OvmfPkg and the new
MdeModulePkg code. I didn't test the IntelFrameworkModulePkg changes
(patches #7 and #8).

Should you significantly modify these patches (for v3) in response to
another reviewer's comments, then please do not apply my Tested-by. If
the changes are trivial, then it is okay to keep my Tested-by.

* I will also reply with review comments to some of the individual
patches. None of my comments will be functional, only cosmetic.

Please send a v3 with those cosmetic warts fixed up. (If you will have
no other changes in v3, then you can keep all of my Tested-by tags from
above, of course.)

Thank you!
Laszlo


> Cc: Jiewen Yao 
> Cc: Feng Tian 
> Cc: Jeff Fan 
> Cc: Laszlo Ersek 
> Cc: Jordan Justen 
> Star Zeng (8):
>   MdeModulePkg: Introduce new PCD PcdAcpiS3Enable
>   OvmfPkg: Set PcdAcpiS3Enable according to QemuFwCfgS3Enabled()
>   OvmfPkg: Install LockBox protocol in constructor of LockBoxDxeLib
>   MdeModulePkg S3SaveStateDxe: Consume PcdAcpiS3Enable to control the
> code
>   MdeModulePkg S3SaveStateDxe: Move S3Ready() functional code from
> AcpiS3SaveDxe
>   OvmfPkg: Retire AcpiS3SaveDxe
>   

[edk2] Performance identifier mismatch in TrEEDxe.c and TrEEPei.c

2016-04-06 Thread Nguyen Quang Huy (FGA.BU18)
Hello all,

I am studying about measuring the boot performance with PERF_START_EX and 
PERF_STOP_EX. I notice that in both files SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c and 
SecurityPkg/Tcg/TrEEPei/TrEEPei.c the input identifier value of the 
PERF_STOP_EX is one bigger  than the input identifier value of PERF_START_EX. 
As I see from 
MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c and  
MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c, the identifier 
value is also used to match a PERF_STOP_EX to a PERF_START_EX. So my 
understanding is that if we use different identifiers we will not be able to 
find the measurement record specified by the PERF_STOP_EX or we will find a 
wrong one. As the results the EndTimeStamp of the measurement record created by 
PERF_START_EX will be zero. Thus I wonder why the input identifiers of these 
two macros in these two files are different. What are the purpose to do this? 
Could anybody give me some help on this?

Thanks,

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


Re: [edk2] [PATCH 04/12] ArmVirtPkg: Convert to build FatPkg from source

2016-04-06 Thread Ard Biesheuvel
On 6 April 2016 at 17:14, Jordan Justen  wrote:
> Now that FatPkg is open source (and therefore can be included in the
> EDK II tree) we build and use it directly.
>
> Note: Not build tested
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 

Reviewed-by: Ard Biesheuvel 

> ---
>  ArmVirtPkg/ArmVirtQemu.dsc   | 1 +
>  ArmVirtPkg/ArmVirtQemu.fdf   | 4 ++--
>  ArmVirtPkg/ArmVirtQemuKernel.dsc | 1 +
>  ArmVirtPkg/ArmVirtQemuKernel.fdf | 4 ++--
>  ArmVirtPkg/ArmVirtXen.dsc| 3 ++-
>  ArmVirtPkg/ArmVirtXen.fdf| 4 ++--
>  6 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
> index e626df7..dda5514 100644
> --- a/ArmVirtPkg/ArmVirtQemu.dsc
> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
> @@ -334,6 +334,7 @@
>MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  FatPkg/EnhancedFatDxe/Fat.inf
>
>#
># Bds
> diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
> index ef45653..0a19273 100644
> --- a/ArmVirtPkg/ArmVirtQemu.fdf
> +++ b/ArmVirtPkg/ArmVirtQemu.fdf
> @@ -1,7 +1,7 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2015, 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
> @@ -151,7 +151,7 @@ READ_LOCK_STATUS   = TRUE
>#
>INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> -  INF FatBinPkg/EnhancedFatDxe/Fat.inf
> +  INF FatPkg/EnhancedFatDxe/Fat.inf
>INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
>
>#
> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc 
> b/ArmVirtPkg/ArmVirtQemuKernel.dsc
> index bfa4dbe..db34022 100644
> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
> @@ -313,6 +313,7 @@
>MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  FatPkg/EnhancedFatDxe/Fat.inf
>
>#
># Bds
> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf 
> b/ArmVirtPkg/ArmVirtQemuKernel.fdf
> index 7491f80..26db3fc 100644
> --- a/ArmVirtPkg/ArmVirtQemuKernel.fdf
> +++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf
> @@ -1,7 +1,7 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2015, 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
> @@ -172,7 +172,7 @@ READ_LOCK_STATUS   = TRUE
>#
>INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> -  INF FatBinPkg/EnhancedFatDxe/Fat.inf
> +  INF FatPkg/EnhancedFatDxe/Fat.inf
>INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
>
>#
> diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
> index 43f093a..dfd270d 100644
> --- a/ArmVirtPkg/ArmVirtXen.dsc
> +++ b/ArmVirtPkg/ArmVirtXen.dsc
> @@ -1,7 +1,7 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2015, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2015 - 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
> @@ -216,6 +216,7 @@
>MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  FatPkg/EnhancedFatDxe/Fat.inf
>
>#
># Bds
> diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
> index d7d4612..6288803 100644
> --- a/ArmVirtPkg/ArmVirtXen.fdf
> +++ b/ArmVirtPkg/ArmVirtXen.fdf
> @@ -1,7 +1,7 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2015, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2015 - 2016, Intel Corporation. All 

Re: [edk2] [PATCH 05/12] BeagleBoardPkg: Convert to build FatPkg from source

2016-04-06 Thread Ard Biesheuvel
On 6 April 2016 at 17:14, Jordan Justen  wrote:
> Now that FatPkg is open source (and therefore can be included in the
> EDK II tree) we build and use it directly.
>
> Note: Not build tested
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jordan Justen 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 

Reviewed-by: Ard Biesheuvel 

> ---
>  BeagleBoardPkg/BeagleBoardPkg.dsc | 3 ++-
>  BeagleBoardPkg/BeagleBoardPkg.fdf | 4 ++--
>  2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc 
> b/BeagleBoardPkg/BeagleBoardPkg.dsc
> index 17f9f8e..aedaf4e 100644
> --- a/BeagleBoardPkg/BeagleBoardPkg.dsc
> +++ b/BeagleBoardPkg/BeagleBoardPkg.dsc
> @@ -2,7 +2,7 @@
>  # Beagle board package.
>  #
>  # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
> -# Copyright (c) 2015, 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
> @@ -427,6 +427,7 @@
>MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  FatPkg/EnhancedFatDxe/Fat.inf
>
>#
># USB
> diff --git a/BeagleBoardPkg/BeagleBoardPkg.fdf 
> b/BeagleBoardPkg/BeagleBoardPkg.fdf
> index b17ad7d..733b5a4 100644
> --- a/BeagleBoardPkg/BeagleBoardPkg.fdf
> +++ b/BeagleBoardPkg/BeagleBoardPkg.fdf
> @@ -1,7 +1,7 @@
>  # FLASH layout file for Beagle board.
>  #
>  # Copyright (c) 2009, Apple Inc. All rights reserved.
> -# Copyright (c) 2015, 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
> @@ -159,7 +159,7 @@ FvNameGuid = d0dd3e90-343d-4cb3-8f69-772214989282
>#
>INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> -  INF FatBinPkg/EnhancedFatDxe/Fat.inf
> +  INF FatPkg/EnhancedFatDxe/Fat.inf
>INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
>
>#
> --
> 2.7.0
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 09/12] EmulatorPkg: Convert to always build FatPkg

2016-04-06 Thread Andrew Fish

> On Apr 6, 2016, at 8:14 AM, Jordan Justen  wrote:
> 
> Now that FatPkg is open source (and therefore can be included in the
> EDK II tree) we always build and use it directly.
> 
> Build and boot tested with GCC 5.3 on X64, but I did not test
> attaching a disk image with a FAT filesystem.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jordan Justen 
> Cc: Andrew Fish 
> ---
> EmulatorPkg/EmulatorPkg.dsc | 2 --
> EmulatorPkg/EmulatorPkg.fdf | 5 -

Should BUILD_FAT also be removed from EmulatorPkg/build.sh? Otherwise looks 
good.

Reviewed-by: Andrew Fish 

Thanks,

Andrew Fish

> 2 files changed, 7 deletions(-)
> 
> diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
> index 73bb64c..f516adf 100644
> --- a/EmulatorPkg/EmulatorPkg.dsc
> +++ b/EmulatorPkg/EmulatorPkg.dsc
> @@ -373,9 +373,7 @@
>   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>   }
> 
> -!if $(BUILD_FAT)
>   FatPkg/EnhancedFatDxe/Fat.inf
> -!endif
> 
> !ifndef $(USE_OLD_SHELL)
>   ShellPkg/Application/Shell/Shell.inf {
> diff --git a/EmulatorPkg/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf
> index 8ac9098..377de59 100644
> --- a/EmulatorPkg/EmulatorPkg.fdf
> +++ b/EmulatorPkg/EmulatorPkg.fdf
> @@ -203,12 +203,7 @@ INF  
> MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> INF  MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
> INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> 
> -
> -!if $(BUILD_FAT)
> INF FatPkg/EnhancedFatDxe/Fat.inf
> -!else
> -INF  RuleOverride = BINARY FatBinPkg/EnhancedFatDxe/Fat.inf
> -!endif
> 
> !ifndef $(USE_OLD_SHELL)
> INF  ShellPkg/Application/Shell/Shell.inf
> -- 
> 2.7.0
> 

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


[edk2] [PATCH 05/12] BeagleBoardPkg: Convert to build FatPkg from source

2016-04-06 Thread Jordan Justen
Now that FatPkg is open source (and therefore can be included in the
EDK II tree) we build and use it directly.

Note: Not build tested

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
---
 BeagleBoardPkg/BeagleBoardPkg.dsc | 3 ++-
 BeagleBoardPkg/BeagleBoardPkg.fdf | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc 
b/BeagleBoardPkg/BeagleBoardPkg.dsc
index 17f9f8e..aedaf4e 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.dsc
+++ b/BeagleBoardPkg/BeagleBoardPkg.dsc
@@ -2,7 +2,7 @@
 # Beagle board package.
 #
 # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
-# Copyright (c) 2015, 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
@@ -427,6 +427,7 @@
   MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
 
   #
   # USB
diff --git a/BeagleBoardPkg/BeagleBoardPkg.fdf 
b/BeagleBoardPkg/BeagleBoardPkg.fdf
index b17ad7d..733b5a4 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.fdf
+++ b/BeagleBoardPkg/BeagleBoardPkg.fdf
@@ -1,7 +1,7 @@
 # FLASH layout file for Beagle board.
 #
 # Copyright (c) 2009, Apple Inc. All rights reserved.
-# Copyright (c) 2015, 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
@@ -159,7 +159,7 @@ FvNameGuid = d0dd3e90-343d-4cb3-8f69-772214989282
   #
   INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
-  INF FatBinPkg/EnhancedFatDxe/Fat.inf
+  INF FatPkg/EnhancedFatDxe/Fat.inf
   INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
 
   #
-- 
2.7.0

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


[edk2] [PATCH 09/12] EmulatorPkg: Convert to always build FatPkg

2016-04-06 Thread Jordan Justen
Now that FatPkg is open source (and therefore can be included in the
EDK II tree) we always build and use it directly.

Build and boot tested with GCC 5.3 on X64, but I did not test
attaching a disk image with a FAT filesystem.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Andrew Fish 
---
 EmulatorPkg/EmulatorPkg.dsc | 2 --
 EmulatorPkg/EmulatorPkg.fdf | 5 -
 2 files changed, 7 deletions(-)

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index 73bb64c..f516adf 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -373,9 +373,7 @@
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   }
 
-!if $(BUILD_FAT)
   FatPkg/EnhancedFatDxe/Fat.inf
-!endif
 
 !ifndef $(USE_OLD_SHELL)
   ShellPkg/Application/Shell/Shell.inf {
diff --git a/EmulatorPkg/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf
index 8ac9098..377de59 100644
--- a/EmulatorPkg/EmulatorPkg.fdf
+++ b/EmulatorPkg/EmulatorPkg.fdf
@@ -203,12 +203,7 @@ INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
 INF  MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
 INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
 
-
-!if $(BUILD_FAT)
 INF FatPkg/EnhancedFatDxe/Fat.inf
-!else
-INF  RuleOverride = BINARY FatBinPkg/EnhancedFatDxe/Fat.inf
-!endif
 
 !ifndef $(USE_OLD_SHELL)
 INF  ShellPkg/Application/Shell/Shell.inf
-- 
2.7.0

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


[edk2] [PATCH 02/12] FatPkg: Add Contributions.txt

2016-04-06 Thread Jordan Justen
This is copied from MdePkg/Contributions.txt

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Ruiyu Ni 
---
 FatPkg/Contributions.txt | 218 +++
 1 file changed, 218 insertions(+)
 create mode 100644 FatPkg/Contributions.txt

diff --git a/FatPkg/Contributions.txt b/FatPkg/Contributions.txt
new file mode 100644
index 000..f87cbd7
--- /dev/null
+++ b/FatPkg/Contributions.txt
@@ -0,0 +1,218 @@
+
+==
+= Code Contributions =
+==
+
+To make a contribution to a TianoCore project, follow these steps.
+1. Create a change description in the format specified below to
+   use in the source control commit log.
+2. Your commit message must include your "Signed-off-by" signature,
+   and "Contributed-under" message.
+3. Your "Contributed-under" message explicitly states that the
+   contribution is made under the terms of the specified
+   contribution agreement.  Your "Contributed-under" message
+   must include the name of contribution agreement and version.
+   For example: Contributed-under: TianoCore Contribution Agreement 1.0
+   The "TianoCore Contribution Agreement" is included below in
+   this document.
+4. Submit your code to the TianoCore project using the process
+   that the project documents on its web page.  If the process is
+   not documented, then submit the code on development email list
+   for the project.
+5. It is preferred that contributions are submitted using the same
+   copyright license as the base project. When that is not possible,
+   then contributions using the following licenses can be accepted:
+   * BSD (2-clause): http://opensource.org/licenses/BSD-2-Clause
+   * BSD (3-clause): http://opensource.org/licenses/BSD-3-Clause
+   * MIT: http://opensource.org/licenses/MIT
+   * Python-2.0: http://opensource.org/licenses/Python-2.0
+   * Zlib: http://opensource.org/licenses/Zlib
+
+   Contributions of code put into the public domain can also be
+   accepted.
+
+   Contributions using other licenses might be accepted, but further
+   review will be required.
+
+=
+= Change Description / Commit Message / Patch Email =
+=
+
+Your change description should use the standard format for a
+commit message, and must include your "Signed-off-by" signature
+and the "Contributed-under" message.
+
+== Sample Change Description / Commit Message =
+
+=== Start of sample patch email message ===
+
+From: Contributor Name 
+Subject: [PATCH] CodeModule: Brief-single-line-summary
+
+Full-commit-message
+
+Contributed-under: TianoCore Contribution Agreement 1.0
+Signed-off-by: Contributor Name 
+---
+
+An extra message for the patch email which will not be considered part
+of the commit message can be added here.
+
+Patch content inline or attached
+
+=== End of sample patch email message ===
+
+=== Notes for sample patch email ===
+
+* The first line of commit message is taken from the email's subject
+  line following [PATCH]. The remaining portion of the commit message
+  is the email's content until the '---' line.
+* git format-patch is one way to create this format
+
+=== Definitions for sample patch email ===
+
+* "CodeModule" is a short idenfier for the affected code.  For
+  example MdePkg, or MdeModulePkg UsbBusDxe.
+* "Brief-single-line-summary" is a short summary of the change.
+* The entire first line should be less than ~70 characters.
+* "Full-commit-message" a verbose multiple line comment describing
+  the change.  Each line should be less than ~70 characters.
+* "Contributed-under" explicitely states that the contribution is
+  made under the terms of the contribtion agreement.  This
+  agreement is included below in this document.
+* "Signed-off-by" is the contributor's signature identifying them
+  by their real/legal name and their email address.
+
+
+= TianoCore Contribution Agreement 1.0 =
+
+
+INTEL CORPORATION ("INTEL") MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
+INFORMATION AND/OR OTHER MATERIALS FOR USE IN THE TIANOCORE OPEN SOURCE
+PROJECT (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE
+TERMS AND CONDITIONS OF THIS AGREEMENT BETWEEN YOU AND INTEL AND/OR THE
+TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR
+REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE
+CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
+BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS
+AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
+AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
+USE THE CONTENT.
+
+Unless 

[edk2] [PATCH 00/12] Cleanups to follow FatPkg license update

2016-04-06 Thread Jordan Justen
web: https://github.com/jljusten/edk2/tree/fatpkg-open-source-cleanups-v1

git: https://github.com/jljusten/edk2.git fatpkg-open-source-cleanups-v1

The license update to FatPkg is expected to be pushed later today.

Following the license update, I recommend these changes.

Jordan Justen (12):
  FatPkg: Update License.txt to have the full license text
  FatPkg: Add Contributions.txt
  FatBinPkg: Change to 2-clause BSD license
  ArmVirtPkg: Convert to build FatPkg from source
  BeagleBoardPkg: Convert to build FatPkg from source
  CorebootPayloadPkg: Convert to build FatPkg from source
  DuetPkg scripts: Support building with GCC45 - GCC49
  DuetPkg: Convert to build FatPkg from source
  EmulatorPkg: Convert to always build FatPkg
  Nt32Pkg: Convert to build FatPkg from source
  OvmfPkg: Convert to using FatPkg in the EDK II tree
  Vlv2TbltDevicePkg: Convert to build FatPkg from source

 ArmVirtPkg/ArmVirtQemu.dsc   |   1 +
 ArmVirtPkg/ArmVirtQemu.fdf   |   4 +-
 ArmVirtPkg/ArmVirtQemuKernel.dsc |   1 +
 ArmVirtPkg/ArmVirtQemuKernel.fdf |   4 +-
 ArmVirtPkg/ArmVirtXen.dsc|   3 +-
 ArmVirtPkg/ArmVirtXen.fdf|   4 +-
 BeagleBoardPkg/BeagleBoardPkg.dsc|   3 +-
 BeagleBoardPkg/BeagleBoardPkg.fdf|   4 +-
 CorebootPayloadPkg/CorebootPayloadPkg.fdf|   8 +-
 CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc|   3 +-
 CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc |   3 +-
 DuetPkg/DuetPkg.fdf  |   5 +-
 DuetPkg/DuetPkgIa32.dsc  |   3 +-
 DuetPkg/DuetPkgX64.dsc   |   3 +-
 DuetPkg/PostBuild.sh |   8 +-
 DuetPkg/build32.sh   |  24 ++-
 DuetPkg/build64.sh   |  24 ++-
 EmulatorPkg/EmulatorPkg.dsc  |   2 -
 EmulatorPkg/EmulatorPkg.fdf  |   5 -
 FatBinPkg/FatBinPkg.dec  |   2 +-
 FatBinPkg/License.txt|  53 ++
 FatPkg/Contributions.txt | 218 +++
 FatPkg/License.txt   |  29 ++-
 Nt32Pkg/Nt32Pkg.dsc  |   3 +-
 Nt32Pkg/Nt32Pkg.fdf  |   4 +-
 OvmfPkg/OvmfPkgIa32.dsc  |   1 +
 OvmfPkg/OvmfPkgIa32.fdf  |   4 +-
 OvmfPkg/OvmfPkgIa32X64.dsc   |   3 +-
 OvmfPkg/OvmfPkgIa32X64.fdf   |   4 +-
 OvmfPkg/OvmfPkgX64.dsc   |   1 +
 OvmfPkg/OvmfPkgX64.fdf   |   4 +-
 Vlv2TbltDevicePkg/PlatformPkg.fdf|   7 +-
 Vlv2TbltDevicePkg/PlatformPkgGcc.fdf |   7 +-
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc  |   1 +
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc|   1 +
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc |   1 +
 36 files changed, 357 insertions(+), 98 deletions(-)
 create mode 100644 FatPkg/Contributions.txt

-- 
2.7.0

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


[edk2] [PATCH 11/12] OvmfPkg: Convert to using FatPkg in the EDK II tree

2016-04-06 Thread Jordan Justen
Now that FatPkg is open source (and therefore can be included in the
EDK II tree) we build and use it directly.

Build tested with GCC 5.3 on IA32 and X64. Boot tested to UEFI Shell
on IA32 and UEFI Linux on X64.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Laszlo Ersek 
---
 OvmfPkg/OvmfPkgIa32.dsc| 1 +
 OvmfPkg/OvmfPkgIa32.fdf| 4 ++--
 OvmfPkg/OvmfPkgIa32X64.dsc | 3 ++-
 OvmfPkg/OvmfPkgIa32X64.fdf | 4 ++--
 OvmfPkg/OvmfPkgX64.dsc | 1 +
 OvmfPkg/OvmfPkgX64.fdf | 4 ++--
 6 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 9e5b477..ac737f0 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -604,6 +604,7 @@
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
   MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
   MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
   MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
   OvmfPkg/SataControllerDxe/SataControllerDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index fc203f2..b52bac9 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -1,7 +1,7 @@
 ## @file
 #  Open Virtual Machine Firmware: FDF
 #
-#  Copyright (c) 2006 - 2015, 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
@@ -275,7 +275,7 @@ INF  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
 INF  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
 INF  
MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
 
-INF  RuleOverride = BINARY FatBinPkg/EnhancedFatDxe/Fat.inf
+INF  FatPkg/EnhancedFatDxe/Fat.inf
 
 !ifndef $(USE_OLD_SHELL)
 INF  ShellPkg/Application/Shell/Shell.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 6e4da4f..1a5cf50 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -53,7 +53,7 @@
 
 [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
   GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
-  
+
 

 #
 # SKU Identification section - list of all SKU IDs supported by this Platform.
@@ -613,6 +613,7 @@
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
   MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
   MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
   MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
   OvmfPkg/SataControllerDxe/SataControllerDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index d3f46f3..c082101 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -1,7 +1,7 @@
 ## @file
 #  Open Virtual Machine Firmware: FDF
 #
-#  Copyright (c) 2006 - 2015, 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
@@ -275,7 +275,7 @@ INF  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
 INF  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
 INF  
MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
 
-INF  RuleOverride = BINARY USE = X64 FatBinPkg/EnhancedFatDxe/Fat.inf
+INF  FatPkg/EnhancedFatDxe/Fat.inf
 
 !ifndef $(USE_OLD_SHELL)
 INF  ShellPkg/Application/Shell/Shell.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 3d6d43e..59af47e 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -611,6 +611,7 @@
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
   MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
   MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
   MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
   OvmfPkg/SataControllerDxe/SataControllerDxe.inf
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 15ef13a..130249b 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -1,7 +1,7 @@
 ## @file
 #  Open Virtual Machine Firmware: FDF
 #
-#  Copyright (c) 2006 - 2015, 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
@@ -275,7 +275,7 @@ INF  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
 INF  

[edk2] [PATCH 10/12] Nt32Pkg: Convert to build FatPkg from source

2016-04-06 Thread Jordan Justen
Now that FatPkg is open source (and therefore can be included in the
EDK II tree) we build and use it directly.

Note: Not build tested

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Ruiyu Ni 
---
 Nt32Pkg/Nt32Pkg.dsc | 3 ++-
 Nt32Pkg/Nt32Pkg.fdf | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Nt32Pkg/Nt32Pkg.dsc b/Nt32Pkg/Nt32Pkg.dsc
index 966a7de..ada0a2d 100644
--- a/Nt32Pkg/Nt32Pkg.dsc
+++ b/Nt32Pkg/Nt32Pkg.dsc
@@ -4,7 +4,7 @@
 # The Emulation Platform can be used to debug individual modules, prior to 
creating
 #a real platform. This also provides an example for how an DSC is created.
 #
-# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
 # Copyright (c) 2015, Hewlett-Packard Development Company, L.P.
 # (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #
@@ -409,6 +409,7 @@
   MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
   MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf ##This driver follows 
UEFI specification definition
   MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf##This driver follows 
UEFI specification definition
diff --git a/Nt32Pkg/Nt32Pkg.fdf b/Nt32Pkg/Nt32Pkg.fdf
index a10c12f..d7b2696 100644
--- a/Nt32Pkg/Nt32Pkg.fdf
+++ b/Nt32Pkg/Nt32Pkg.fdf
@@ -1,7 +1,7 @@
 ## @file
 # This is NT32 FDF file with UEFI HII features enabled
 #
-# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
 # (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #
 #This program and the accompanying materials
@@ -276,7 +276,7 @@ INF  ShellBinPkg/UefiShell/UefiShell.inf
 INF  EdkShellBinPkg/FullShell/FullShell.inf
 !endif
 
-INF FatBinPkg/EnhancedFatDxe/Fat.inf
+INF FatPkg/EnhancedFatDxe/Fat.inf
 
 FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
 SECTION RAW = MdeModulePkg/Logo/Logo.bmp
-- 
2.7.0

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


[edk2] [PATCH 12/12] Vlv2TbltDevicePkg: Convert to build FatPkg from source

2016-04-06 Thread Jordan Justen
Now that FatPkg is open source (and therefore can be included in the
EDK II tree) we build and use it directly.

Note: Not build tested

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: David Wei 
Cc: Tim He 
---
 Vlv2TbltDevicePkg/PlatformPkg.fdf   | 7 +++
 Vlv2TbltDevicePkg/PlatformPkgGcc.fdf| 7 +++
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 1 +
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 1 +
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc| 1 +
 5 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformPkg.fdf 
b/Vlv2TbltDevicePkg/PlatformPkg.fdf
index 53d9dd4..f0c57b8 100644
--- a/Vlv2TbltDevicePkg/PlatformPkg.fdf
+++ b/Vlv2TbltDevicePkg/PlatformPkg.fdf
@@ -1,7 +1,7 @@
 #/** @file
 # FDF file of Platform.
 #
-# Copyright (c) 2008  - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.
 #  

 # This program and the accompanying materials are licensed and made available 
under
 # the terms and conditions of the BSD License that accompanies this 
distribution.  
@@ -657,9 +657,8 @@ INF PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
 #
 # FAT file system
 #
-FILE DRIVER = 961578FE-B6B7-44c3-AF35-6BC705CD2B1F {
-SECTION PE32 = FatBinPkg/EnhancedFatDxe/$(EDK_DXE_ARCHITECTURE)/Fat.efi
-  }
+INF FatPkg/EnhancedFatDxe/Fat.inf
+
 #
 # UEFI Shell
 #
diff --git a/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf 
b/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
index d26530c..6474429 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
+++ b/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
@@ -1,7 +1,7 @@
 #/** @file
 # FDF file of Platform.
 #
-# Copyright (c) 2008  - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.
 #  

 # This program and the accompanying materials are licensed and made available 
under
 # the terms and conditions of the BSD License that accompanies this 
distribution.  
@@ -614,9 +614,8 @@ INF PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
 #
 # FAT file system
 #
-FILE DRIVER = 961578FE-B6B7-44c3-AF35-6BC705CD2B1F {
-SECTION PE32 = FatBinPkg/EnhancedFatDxe/$(EDK_DXE_ARCHITECTURE)/Fat.efi
-  }
+INF FatPkg/EnhancedFatDxe/Fat.inf
+
 #
 # UEFI Shell
 #
diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
index c78ff87..d76f08e 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
@@ -1400,6 +1400,7 @@ 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/fTPMInitPeim.inf
   MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
 !if $(SATA_ENABLE) == TRUE
   
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/SataController.inf
 !endif
diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
index dd5f383..b0dabd9 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
@@ -1381,6 +1381,7 @@ 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/fTPMInitPeim.inf
   MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
 !if $(SATA_ENABLE) == TRUE
   
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/SataController.inf
 !endif
diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
index 7b04efa..bc5cfd8 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
@@ -1387,6 +1387,7 @@ 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/fTPMInitPeim.inf
   MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
 !if $(SATA_ENABLE) == TRUE
   
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/SataController.inf
 !endif
-- 
2.7.0

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


[edk2] [PATCH 03/12] FatBinPkg: Change to 2-clause BSD license

2016-04-06 Thread Jordan Justen
The FatPkg is now open source. Update FatBinPkg license to match
FatPkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Ruiyu Ni 
---
 FatBinPkg/FatBinPkg.dec |  2 +-
 FatBinPkg/License.txt   | 53 ++---
 2 files changed, 20 insertions(+), 35 deletions(-)

diff --git a/FatBinPkg/FatBinPkg.dec b/FatBinPkg/FatBinPkg.dec
index 1676086..6ac577a 100644
--- a/FatBinPkg/FatBinPkg.dec
+++ b/FatBinPkg/FatBinPkg.dec
@@ -1,5 +1,5 @@
 ## @file
-# This package provides binary device drivers to support the FAT32 file 
system. This package is separated from other packages because it uses a 
different license. 
+# This package provides binary device drivers to support the FAT32 file system.
 #
 # This package provides FAT drivers which are not licensed under BSD.
 # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
diff --git a/FatBinPkg/License.txt b/FatBinPkg/License.txt
index 59b71bd..be68999 100644
--- a/FatBinPkg/License.txt
+++ b/FatBinPkg/License.txt
@@ -1,40 +1,25 @@
-Copyright (c) 2006, Intel Corporation. All rights reserved.
+Copyright (c) 2012, Intel Corporation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
+modification, are permitted provided that the following conditions
+are met:
 
-  .  Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-  .  Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-  .  Neither the name of Intel nor the names of its contributors may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
+* Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in
+  the documentation and/or other materials provided with the
+  distribution.
 
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Additional terms: In addition to the forgoing, redistribution and use
-of the code is conditioned upon the FAT 32 File System Driver and all
-derivative works thereof being used for and designed only to read
-and/or write to a file system that is directly managed by Intel's
-Extensible Firmware Initiative (EFI) Specification v. 1.0 and later
-and/or the Unified Extensible Firmware Interface (UEFI) Forum's UEFI
-Specifications v.2.0 and later (together the "UEFI Specifications");
-only as necessary to emulate an implementation of the UEFI Specifications;
-and to create firmware, applications, utilities and/or drivers.
-
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
-- 
2.7.0

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


[edk2] [PATCH 06/12] CorebootPayloadPkg: Convert to build FatPkg from source

2016-04-06 Thread Jordan Justen
Now that FatPkg is open source (and therefore can be included in the
EDK II tree) we build and use it directly.

Note: Build tested with GCC 5.3 on IA32 and IA32+X64.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Maurice Ma 
Cc: Prince Agyeman 
---
 CorebootPayloadPkg/CorebootPayloadPkg.fdf| 8 ++--
 CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc| 3 ++-
 CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc | 3 ++-
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/CorebootPayloadPkg/CorebootPayloadPkg.fdf 
b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
index c160e43..cf04bec 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkg.fdf
+++ b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
@@ -3,7 +3,7 @@
 #
 # Provides drivers and definitions to create uefi payload for coreboot. 
 #
-# Copyright (c) 2014 - 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 that accompanies this 
distribution.  
 # The full text of the license may be found at
@@ -138,11 +138,7 @@ INF 
MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
 INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
 INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
 
-!if $(ARCH) == IA32
-INF RuleOverride = BINARY USE = IA32 FatBinPkg/EnhancedFatDxe/Fat.inf
-!else
-INF RuleOverride = BINARY USE = X64 FatBinPkg/EnhancedFatDxe/Fat.inf
-!endif
+INF FatPkg/EnhancedFatDxe/Fat.inf
 
 #
 # Usb Support
diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc 
b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
index 2c37e44..dfc03d6 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
+++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
@@ -3,7 +3,7 @@
 #
 # Provides drivers and definitions to create uefi payload for coreboot. 
 #
-# Copyright (c) 2014 - 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 that accompanies this 
distribution.  
 # The full text of the license may be found at
@@ -326,6 +326,7 @@
   MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
   DuetPkg/SataControllerDxe/SataControllerDxe.inf  
   MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
   MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf 
diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc 
b/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
index cfaf304..a8df8b1 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
+++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
@@ -3,7 +3,7 @@
 #
 # Provides drivers and definitions to create uefi payload for coreboot. 
 #
-# Copyright (c) 2014 - 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 that accompanies this 
distribution.  
 # The full text of the license may be found at
@@ -328,6 +328,7 @@
   MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
   DuetPkg/SataControllerDxe/SataControllerDxe.inf  
   MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
   MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf 
-- 
2.7.0

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


[edk2] [PATCH 04/12] ArmVirtPkg: Convert to build FatPkg from source

2016-04-06 Thread Jordan Justen
Now that FatPkg is open source (and therefore can be included in the
EDK II tree) we build and use it directly.

Note: Not build tested

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
---
 ArmVirtPkg/ArmVirtQemu.dsc   | 1 +
 ArmVirtPkg/ArmVirtQemu.fdf   | 4 ++--
 ArmVirtPkg/ArmVirtQemuKernel.dsc | 1 +
 ArmVirtPkg/ArmVirtQemuKernel.fdf | 4 ++--
 ArmVirtPkg/ArmVirtXen.dsc| 3 ++-
 ArmVirtPkg/ArmVirtXen.fdf| 4 ++--
 6 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index e626df7..dda5514 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -334,6 +334,7 @@
   MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
 
   #
   # Bds
diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
index ef45653..0a19273 100644
--- a/ArmVirtPkg/ArmVirtQemu.fdf
+++ b/ArmVirtPkg/ArmVirtQemu.fdf
@@ -1,7 +1,7 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015, 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
@@ -151,7 +151,7 @@ READ_LOCK_STATUS   = TRUE
   #
   INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
-  INF FatBinPkg/EnhancedFatDxe/Fat.inf
+  INF FatPkg/EnhancedFatDxe/Fat.inf
   INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
 
   #
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index bfa4dbe..db34022 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -313,6 +313,7 @@
   MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
 
   #
   # Bds
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQemuKernel.fdf
index 7491f80..26db3fc 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.fdf
+++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf
@@ -1,7 +1,7 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015, 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
@@ -172,7 +172,7 @@ READ_LOCK_STATUS   = TRUE
   #
   INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
-  INF FatBinPkg/EnhancedFatDxe/Fat.inf
+  INF FatPkg/EnhancedFatDxe/Fat.inf
   INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
 
   #
diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
index 43f093a..dfd270d 100644
--- a/ArmVirtPkg/ArmVirtXen.dsc
+++ b/ArmVirtPkg/ArmVirtXen.dsc
@@ -1,7 +1,7 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 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
@@ -216,6 +216,7 @@
   MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
 
   #
   # Bds
diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
index d7d4612..6288803 100644
--- a/ArmVirtPkg/ArmVirtXen.fdf
+++ b/ArmVirtPkg/ArmVirtXen.fdf
@@ -1,7 +1,7 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015, 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
@@ -163,7 +163,7 @@ READ_LOCK_STATUS   = TRUE
   #
   INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
-  INF 

[edk2] [PATCH 07/12] DuetPkg scripts: Support building with GCC45 - GCC49

2016-04-06 Thread Jordan Justen
Build tested with GCC 5.3 with both IA32 and X64. Unfortunately both
seemed to hang very early when boot tested on QEMU.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Ruiyu Ni 
---
 DuetPkg/PostBuild.sh |  8 
 DuetPkg/build32.sh   | 24 ++--
 DuetPkg/build64.sh   | 24 ++--
 3 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/DuetPkg/PostBuild.sh b/DuetPkg/PostBuild.sh
index c77c0f3..f032de3 100755
--- a/DuetPkg/PostBuild.sh
+++ b/DuetPkg/PostBuild.sh
@@ -6,7 +6,7 @@
 #  and platform building, so just use a sh file to do post build commands.
 #  Originally, following post building command is for EfiLoader module.
 #
-#  Copyright (c) 2010, Intel Corporation. All rights reserved.
+#  Copyright (c) 2010 - 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
@@ -53,11 +53,11 @@ case "$2" in
UNIXGCC)
  export TOOLTAG=UNIXGCC
  ;;
-   GCC44)
- export TOOLTAG=GCC44
+   GCC4*)
+ export TOOLTAG=$2
  ;;
*)
- echo Invalid tool tag, should be only UNIXGCC or GCC44
+ echo Invalid tool tag, should be only UNIXGCC or GCC4\*
  return 1
 esac
 
diff --git a/DuetPkg/build32.sh b/DuetPkg/build32.sh
index 5e99aba..c15c996 100755
--- a/DuetPkg/build32.sh
+++ b/DuetPkg/build32.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Copyright (c) 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2010 - 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
@@ -57,7 +57,27 @@ case `uname` in
   fi
   ;;
   Linux*)
-TARGET_TOOLS=GCC44
+gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
+case $gcc_version in
+  4.5.*)
+TARGET_TOOLS=GCC45
+;;
+  4.6.*)
+TARGET_TOOLS=GCC46
+;;
+  4.7.*)
+TARGET_TOOLS=GCC47
+;;
+  4.8.*)
+TARGET_TOOLS=GCC48
+;;
+  4.9.*|4.1[0-9].*|5.*.*)
+TARGET_TOOLS=GCC49
+;;
+  *)
+TARGET_TOOLS=GCC44
+;;
+esac
 ;;
 
 esac
diff --git a/DuetPkg/build64.sh b/DuetPkg/build64.sh
index d215116..0401c56 100755
--- a/DuetPkg/build64.sh
+++ b/DuetPkg/build64.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Copyright (c) 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2010 - 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
@@ -56,7 +56,27 @@ case `uname` in
   fi
   ;;
   Linux*)
-TARGET_TOOLS=GCC44
+gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
+case $gcc_version in
+  4.5.*)
+TARGET_TOOLS=GCC45
+;;
+  4.6.*)
+TARGET_TOOLS=GCC46
+;;
+  4.7.*)
+TARGET_TOOLS=GCC47
+;;
+  4.8.*)
+TARGET_TOOLS=GCC48
+;;
+  4.9.*|4.1[0-9].*|5.*.*)
+TARGET_TOOLS=GCC49
+;;
+  *)
+TARGET_TOOLS=GCC44
+;;
+esac
 ;;
 
 esac
-- 
2.7.0

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


[edk2] [PATCH 01/12] FatPkg: Update License.txt to have the full license text

2016-04-06 Thread Jordan Justen
The script replaced the contents of License.txt will the words the
shortened text that we include in the headers to files. Instead, use
the full text. This is copied from MdePkg/License.txt.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Ruiyu Ni 
---
 FatPkg/License.txt | 29 ++---
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/FatPkg/License.txt b/FatPkg/License.txt
index 2bed9de..be68999 100644
--- a/FatPkg/License.txt
+++ b/FatPkg/License.txt
@@ -1,10 +1,25 @@
-Copyright (c) 2006, Intel Corporation. All rights reserved.
+Copyright (c) 2012, Intel Corporation. All rights reserved.
 
-This program and the accompanying materials are licensed and made available
-under the terms and conditions of the BSD License which accompanies this
-distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
 
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+* Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in
+  the documentation and/or other materials provided with the
+  distribution.
 
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
-- 
2.7.0

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


Re: [edk2] [wave 3 PATCH v2 00/17] OvmfPkg, ArmVirtPkg: VirtIo 1.0

2016-04-06 Thread Jordan Justen
On 2016-04-06 05:40:10, Laszlo Ersek wrote:
> Version 2 of
> .
> 
> Public branch: .
> 
> * The following patches are new:
> 
>   v2 06/17 OvmfPkg: IndustryStandard: factor out Virtio095.h
>   v2 07/17 OvmfPkg: IndustryStandard: factor out Virtio095Net.h

Reviewed-by: Jordan Justen 

> 
>   They should be reviewed by Jordan, please.
> 
> * The patch below has been modified, addressing Jordan's v1 comments:
> 
>   v2 08/17 OvmfPkg: IndustryStandard: add definitions from the VirtIo 1.0 spec

Acked-by: Jordan Justen 

> 
>   It needs an ACK or a review from Jordan, please.
> 
> * The rest of the series is covered with reviews and ACKs from v1.
> 
> * The following patches have been trivially updated (while keeping their
>   tags), to account for the above three:
> 
>   v2 09/17 OvmfPkg: VirtioLib: add Virtio10WriteFeatures() function
>   v2 14/17 OvmfPkg: VirtioNetDxe: adapt virtio-net packet header size to 
> virtio-1.0
>   v2 15/17 OvmfPkg: Virtio10Dxe: non-transitional driver for virtio-1.0 PCI 
> devices
> 
> * All six new or modified patches have individual notes on them.
> 
> Cc: Ard Biesheuvel 
> Cc: Jordan Justen 
> 
> Thanks
> Laszlo
> 
> Laszlo Ersek (17):
>   OvmfPkg: VIRTIO_DEVICE_PROTOCOL: widen the Features bitmap to 64 bits
>   OvmfPkg: VIRTIO_DEVICE_PROTOCOL: remove GetQueueAddress() member
>   OvmfPkg: VIRTIO_DEVICE_PROTOCOL: pass VRING object to
> SetQueueAddress()
>   OvmfPkg: VirtioBlkDxe: don't clear non-negotiable feature bits
>   OvmfPkg: VirtioRngDxe: clear all feature bits more explicitly
>   OvmfPkg: IndustryStandard: factor out Virtio095.h
>   OvmfPkg: IndustryStandard: factor out Virtio095Net.h
>   OvmfPkg: IndustryStandard: add definitions from the VirtIo 1.0 spec
>   OvmfPkg: VirtioLib: add Virtio10WriteFeatures() function
>   OvmfPkg: VirtioBlkDxe: adapt feature negotiation to virtio-1.0
>   OvmfPkg: VirtioNetDxe: adapt feature negotiation to virtio-1.0
>   OvmfPkg: VirtioRngDxe: adapt feature negotiation to virtio-1.0
>   OvmfPkg: VirtioScsiDxe: adapt feature negotiation to virtio-1.0
>   OvmfPkg: VirtioNetDxe: adapt virtio-net packet header size to
> virtio-1.0
>   OvmfPkg: Virtio10Dxe: non-transitional driver for virtio-1.0 PCI
> devices
>   OvmfPkg: include Virtio10Dxe
>   ArmVirtPkg: include Virtio10Dxe from OvmfPkg
> 
>  ArmVirtPkg/ArmVirtQemu.dsc   |1 +
>  ArmVirtPkg/ArmVirtQemu.fdf   |1 +
>  ArmVirtPkg/ArmVirtQemuKernel.dsc |1 +
>  ArmVirtPkg/ArmVirtQemuKernel.fdf |1 +
>  OvmfPkg/Include/IndustryStandard/Virtio.h|  159 +--
>  OvmfPkg/Include/IndustryStandard/Virtio10.h  |   81 ++
>  OvmfPkg/Include/IndustryStandard/Virtio10Net.h   |   32 +
>  OvmfPkg/Include/IndustryStandard/VirtioNet.h |   81 +-
>  OvmfPkg/Include/IndustryStandard/{Virtio.h => Virtio095.h}   |8 +-
>  OvmfPkg/Include/IndustryStandard/{VirtioNet.h => Virtio095Net.h} |   10 +-
>  OvmfPkg/Include/Library/VirtioLib.h  |   46 +
>  OvmfPkg/Include/Protocol/VirtioDevice.h  |   42 +-
>  OvmfPkg/Library/VirtioLib/VirtioLib.c|   75 ++
>  OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c   |1 -
>  OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h   |   15 +-
>  OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c  |   37 +-
>  OvmfPkg/OvmfPkgIa32.dsc  |1 +
>  OvmfPkg/OvmfPkgIa32.fdf  |1 +
>  OvmfPkg/OvmfPkgIa32X64.dsc   |1 +
>  OvmfPkg/OvmfPkgIa32X64.fdf   |1 +
>  OvmfPkg/OvmfPkgX64.dsc   |1 +
>  OvmfPkg/OvmfPkgX64.fdf   |1 +
>  OvmfPkg/Virtio10Dxe/Virtio10.c   | 1061 
> 
>  OvmfPkg/Virtio10Dxe/Virtio10.h   |   56 ++
>  OvmfPkg/Virtio10Dxe/Virtio10.inf |   40 +
>  OvmfPkg/VirtioBlkDxe/VirtioBlk.c |   33 +-
>  OvmfPkg/VirtioNetDxe/DriverBinding.c |2 +-
>  OvmfPkg/VirtioNetDxe/SnpInitialize.c |   64 +-
>  OvmfPkg/VirtioNetDxe/VirtioNet.h |2 +-
>  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c |1 -
>  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h |   15 +-
>  

[edk2] 答复: 答复: [EDK2]an issue that PXE boot failed when received a NACK from the DHCP server

2016-04-06 Thread Liuxilong (A)
Hi Siyuan, Ard and Michael:
 I am  very sorry to reply you  so late because of busy work. The 
attachment is the DHCP log when the issue happens.
 First of all, Let me introduce the environment in detail:
 Multiple boards connect to the DHCP server through a switch . The MAC 
of each board is the same and building VLAN through the switch to isolate each 
board.
All of boards power on and do the PXE booting at the same time. On this 
occasion, some of the boards fail to boot through PXE and print ” Network 
Device Error” before exit.
 We use the EDK2 dhcp code.Thank your help!

Best regards
Liu Xilong
发件人: Fu, Siyuan [mailto:siyuan...@intel.com]
发送时间: 2016年3月31日 16:38
收件人: Liuxilong (A); Ard Biesheuvel
抄送: edk2-devel@lists.01.org; Tian, Feng; Zeng, Star
主题: RE: [edk2] 答复: [EDK2]an issue that PXE boot failed when received a NACK 
from the DHCP server

Hi, Xilong

That’s really weird case, could you provide a capture file of the network 
traffic on the DHCP side, and also the network topology to help understand the 
problem?

Best Regards
Siyuan


From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Liuxilong (A)
Sent: Thursday, March 31, 2016 4:29 PM
To: Ard Biesheuvel >
Cc: edk2-devel@lists.01.org; Tian, Feng 
>; Zeng, Star 
>
Subject: [edk2] 答复: [EDK2]an issue that PXE boot failed when received a NACK 
from the DHCP server

Hi Ard:
  I am sure of it. The offer and NAK is from the same DHCP server.
Best regards
Liu Xilong

-邮件原件-
发件人: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
发送时间: 2016年3月31日 15:43
收件人: Liuxilong (A)
抄送: edk2-devel@lists.01.org; 
feng.t...@intel.com; 
star.z...@intel.com
主题: Re: [edk2] [EDK2]an issue that PXE boot failed when received a NACK from 
the DHCP server

On 31 March 2016 at 08:40, Liuxilong (A) 
> wrote:
> Hi Folks:
>
> Recently, we used our board to do some tests about PXE booting and
> encountered an issue . Sometimes the PXE booting would fail when the
> PXE client sent a request to confirm IP but received the NACK from the
> DHCP server, which is displayed in the figure below.
>
> On this occasion, the function DhcpHandleRequest in the Dhcp4Io.c from
> EDKII MdeModulePkg will return device error and stop the PXE boot. The
> related code is as following:
>
> We think the strategy of code when receiving the NACK from the DHCP
> server is not robust enough. Is it possible to optimize the strategy?
> Such as adding some kind of retry mechanism when the client receives
> the NACK from the DHCP.
>

Are you positively sure that the OFFER and the NAK are from the same DHCP 
server?
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


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


[edk2] [wave 3 PATCH v2 09/17] OvmfPkg: VirtioLib: add Virtio10WriteFeatures() function

2016-04-06 Thread Laszlo Ersek
In VirtIo 1.0, a device can reject a self-inconsistent feature bitmap
through the new VSTAT_FEATURES_OK status bit. (For example if the driver
requests a higher level feature but clears a prerequisite feature.) This
function is a small wrapper around
VIRTIO_DEVICE_PROTOCOL.SetGuestFeatures() that also verifies if the VirtIo
1.0 device accepts the feature bitmap.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
Tested-by: Ard Biesheuvel 
Reviewed-by: Jordan Justen 
---

Notes:
v2:
- no need to include  explicitly,
   exposes all versions [Jordan]

 OvmfPkg/Include/Library/VirtioLib.h   | 46 
 OvmfPkg/Library/VirtioLib/VirtioLib.c | 75 
 2 files changed, 121 insertions(+)

diff --git a/OvmfPkg/Include/Library/VirtioLib.h 
b/OvmfPkg/Include/Library/VirtioLib.h
index decd4418af3d..5badfb32917f 100644
--- a/OvmfPkg/Include/Library/VirtioLib.h
+++ b/OvmfPkg/Include/Library/VirtioLib.h
@@ -185,8 +185,54 @@ VirtioFlush (
   IN VIRTIO_DEVICE_PROTOCOL *VirtIo,
   IN UINT16 VirtQueueId,
   IN OUT VRING  *Ring,
   IN DESC_INDICES   *Indices,
   OUTUINT32 *UsedLenOPTIONAL
   );
 
+
+/**
+
+  Report the feature bits to the VirtIo 1.0 device that the VirtIo 1.0 driver
+  understands.
+
+  In VirtIo 1.0, a device can reject a self-inconsistent feature bitmap through
+  the new VSTAT_FEATURES_OK status bit. (For example if the driver requests a
+  higher level feature but clears a prerequisite feature.) This function is a
+  small wrapper around VIRTIO_DEVICE_PROTOCOL.SetGuestFeatures() that also
+  verifies if the VirtIo 1.0 device accepts the feature bitmap.
+
+  @param[in] VirtIoReport feature bits to this device.
+
+  @param[in] Features  The set of feature bits that the driver wishes
+   to report. The caller is responsible to perform
+   any masking before calling this function; the
+   value is directly written with
+   VIRTIO_DEVICE_PROTOCOL.SetGuestFeatures().
+
+  @param[in,out] DeviceStatus  On input, the status byte most recently written
+   to the device's status register. On output (even
+   on error), DeviceStatus will be updated so that
+   it is suitable for further status bit
+   manipulation and writing to the device's status
+   register.
+
+  @retval  EFI_SUCCESS  The device accepted the configuration in Features.
+
+  @return  EFI_UNSUPPORTED  The device rejected the configuration in Features.
+
+  @retval  EFI_UNSUPPORTED  VirtIo->Revision is smaller than 1.0.0.
+
+  @return   Error codes from the SetGuestFeatures(),
+SetDeviceStatus(), GetDeviceStatus() member
+functions.
+
+**/
+EFI_STATUS
+EFIAPI
+Virtio10WriteFeatures (
+  IN VIRTIO_DEVICE_PROTOCOL *VirtIo,
+  IN UINT64 Features,
+  IN OUT UINT8  *DeviceStatus
+  );
+
 #endif // _VIRTIO_LIB_H_
diff --git a/OvmfPkg/Library/VirtioLib/VirtioLib.c 
b/OvmfPkg/Library/VirtioLib/VirtioLib.c
index 4b1d78b5a03e..845f206369a3 100644
--- a/OvmfPkg/Library/VirtioLib/VirtioLib.c
+++ b/OvmfPkg/Library/VirtioLib/VirtioLib.c
@@ -335,7 +335,82 @@ VirtioFlush (
 UsedElem = >Used.UsedElem[LastUsedIdx % Ring->QueueSize];
 ASSERT (UsedElem->Id == Indices->HeadDescIdx);
 *UsedLen = UsedElem->Len;
   }
 
   return EFI_SUCCESS;
 }
+
+
+/**
+
+  Report the feature bits to the VirtIo 1.0 device that the VirtIo 1.0 driver
+  understands.
+
+  In VirtIo 1.0, a device can reject a self-inconsistent feature bitmap through
+  the new VSTAT_FEATURES_OK status bit. (For example if the driver requests a
+  higher level feature but clears a prerequisite feature.) This function is a
+  small wrapper around VIRTIO_DEVICE_PROTOCOL.SetGuestFeatures() that also
+  verifies if the VirtIo 1.0 device accepts the feature bitmap.
+
+  @param[in] VirtIoReport feature bits to this device.
+
+  @param[in] Features  The set of feature bits that the driver wishes
+   to report. The caller is responsible to perform
+   any masking before calling this function; the
+   value is directly written with
+   VIRTIO_DEVICE_PROTOCOL.SetGuestFeatures().
+
+  @param[in,out] DeviceStatus  On input, the status byte most recently written
+   to the device's status register. On output (even
+   on error), 

[edk2] [PATCH V2 6/8] OvmfPkg: Retire AcpiS3SaveDxe

2016-04-06 Thread Star Zeng
The same functional code has been in S3SaveStateDxe,
OVMF AcpiS3SaveDxe can be retired now.

Cc: Laszlo Ersek 
Cc: Jordan Justen 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
 OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c  | 549 
 OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf |  73 -
 OvmfPkg/OvmfPkgIa32.dsc |   1 -
 OvmfPkg/OvmfPkgIa32.fdf |   3 +-
 OvmfPkg/OvmfPkgIa32X64.dsc  |   1 -
 OvmfPkg/OvmfPkgIa32X64.fdf  |   3 +-
 OvmfPkg/OvmfPkgX64.dsc  |   1 -
 OvmfPkg/OvmfPkgX64.fdf  |   3 +-
 8 files changed, 3 insertions(+), 631 deletions(-)
 delete mode 100644 OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
 delete mode 100644 OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf

diff --git a/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c 
b/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
deleted file mode 100644
index 176f598fe686..
--- a/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/** @file
-  This is a replacement for the ACPI S3 Save protocol.
-
-  The ACPI S3 Save protocol used to be defined in the S3 boot path
-  specification 0.9. Instead, the same functionality is now hooked to the
-  End-of-Dxe event.
-
-Copyright (c) 2014-2015, Red Hat, Inc.
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-EFI_GUID  mAcpiS3IdtrProfileGuid = {
-  0xdea652b0, 0xd587, 0x4c54, { 0xb5, 0xb4, 0xc6, 0x82, 0xe7, 0xa0, 0xaa, 0x3d 
}
-};
-
-/**
-  Allocate memory below 4G memory address.
-
-  This function allocates memory below 4G memory address.
-
-  @param  MemoryType   Memory type of memory to allocate.
-  @param  Size Size of memory to allocate.
-  
-  @return Allocated address for output.
-
-**/
-VOID*
-AllocateMemoryBelow4G (
-  IN EFI_MEMORY_TYPEMemoryType,
-  IN UINTN  Size
-  )
-{
-  UINTN Pages;
-  EFI_PHYSICAL_ADDRESS  Address;
-  EFI_STATUSStatus;
-  VOID* Buffer;
-
-  Pages = EFI_SIZE_TO_PAGES (Size);
-  Address = 0x;
-
-  Status  = gBS->AllocatePages (
-   AllocateMaxAddress,
-   MemoryType,
-   Pages,
-   
-   );
-  ASSERT_EFI_ERROR (Status);
-
-  Buffer = (VOID *) (UINTN) Address;
-  ZeroMem (Buffer, Size);
-
-  return Buffer;
-}
-
-/**
-
-  This function scan ACPI table in RSDT.
-
-  @param Rsdt  ACPI RSDT
-  @param Signature ACPI table signature
-
-  @return ACPI table
-
-**/
-VOID *
-ScanTableInRSDT (
-  IN EFI_ACPI_DESCRIPTION_HEADER*Rsdt,
-  IN UINT32 Signature
-  )
-{
-  UINTN  Index;
-  UINT32 EntryCount;
-  UINT32 *EntryPtr;
-  EFI_ACPI_DESCRIPTION_HEADER*Table;
-
-  if (Rsdt == NULL) {
-return NULL;
-  }
-
-  EntryCount = (Rsdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / 
sizeof(UINT32);
-  
-  EntryPtr = (UINT32 *)(Rsdt + 1);
-  for (Index = 0; Index < EntryCount; Index ++, EntryPtr ++) {
-Table = (EFI_ACPI_DESCRIPTION_HEADER *)((UINTN)(*EntryPtr));
-if (Table->Signature == Signature) {
-  return Table;
-}
-  }
-  
-  return NULL;
-}
-
-/**
-
-  This function scan ACPI table in XSDT.
-
-  @param Xsdt  ACPI XSDT
-  @param Signature ACPI table signature
-
-  @return ACPI table
-
-**/
-VOID *
-ScanTableInXSDT (
-  IN EFI_ACPI_DESCRIPTION_HEADER*Xsdt,
-  IN UINT32 Signature
-  )
-{
-  UINTN  Index;
-  UINT32 EntryCount;
-  UINT64 EntryPtr;
-  UINTN  BasePtr;
-  EFI_ACPI_DESCRIPTION_HEADER*Table;
-
-  if (Xsdt == NULL) {
-return NULL;
-  }
-
-  EntryCount = (Xsdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / 
sizeof(UINT64);
-  
-  BasePtr = (UINTN)(Xsdt + 1);
-  for (Index = 0; Index < EntryCount; Index ++) {
-CopyMem (, (VOID *)(BasePtr + Index * sizeof(UINT64)), 
sizeof(UINT64));
-Table = (EFI_ACPI_DESCRIPTION_HEADER *)((UINTN)(EntryPtr));
-if (Table->Signature == Signature) {
-  return Table;
-}
-  }
-  
-  return NULL;
-}
-
-/**
-  To find Facs in FADT.
-
-  @param Fadt   FADT table pointer
-  
-  

[edk2] [wave 3 PATCH v2 10/17] OvmfPkg: VirtioBlkDxe: adapt feature negotiation to virtio-1.0

2016-04-06 Thread Laszlo Ersek
Relative to virtio-0.9.5, virtio-1.0 reverses the order of queue discovery
and feature negotiation. In virtio-1.0, feature negotiation has to
complete first, and the device can also reject a self-inconsistent feature
request through the new VSTAT_FEATURES_OK status bit. (For example if the
driver requests a higher level feature but clears a prerequisite feature.)

Furthermore, we retain the VIRTIO_F_VERSION_1 feature bit if the
VIRTIO_DEVICE_PROTOCOL provider has high enough revision.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
Tested-by: Ard Biesheuvel 
Reviewed-by: Jordan Justen 
---
 OvmfPkg/VirtioBlkDxe/VirtioBlk.c | 25 
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
index 8257effac22d..f1c3f87e2027 100644
--- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
+++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
@@ -688,14 +688,28 @@ VirtioBlkInit (
 
 Status = VIRTIO_CFG_READ (Dev, Topology.OptIoSize, );
 if (EFI_ERROR (Status)) {
   goto Failed;
 }
   }
 
+  Features &= VIRTIO_BLK_F_BLK_SIZE | VIRTIO_BLK_F_TOPOLOGY | VIRTIO_BLK_F_RO |
+  VIRTIO_BLK_F_FLUSH | VIRTIO_F_VERSION_1;
+
+  //
+  // In virtio-1.0, feature negotiation is expected to complete before queue
+  // discovery, and the device can also reject the selected set of features.
+  //
+  if (Dev->VirtIo->Revision >= VIRTIO_SPEC_REVISION (1, 0, 0)) {
+Status = Virtio10WriteFeatures (Dev->VirtIo, Features, );
+if (EFI_ERROR (Status)) {
+  goto Failed;
+}
+  }
+
   //
   // step 4b -- allocate virtqueue
   //
   Status = Dev->VirtIo->SetQueueSel (Dev->VirtIo, 0);
   if (EFI_ERROR (Status)) {
 goto Failed;
   }
@@ -735,19 +749,20 @@ VirtioBlkInit (
 goto ReleaseQueue;
   }
 
 
   //
   // step 5 -- Report understood features.
   //
-  Features &= VIRTIO_BLK_F_BLK_SIZE | VIRTIO_BLK_F_TOPOLOGY | VIRTIO_BLK_F_RO |
-  VIRTIO_BLK_F_FLUSH;
-  Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features);
-  if (EFI_ERROR (Status)) {
-goto ReleaseQueue;
+  if (Dev->VirtIo->Revision < VIRTIO_SPEC_REVISION (1, 0, 0)) {
+Features &= ~(UINT64)VIRTIO_F_VERSION_1;
+Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features);
+if (EFI_ERROR (Status)) {
+  goto ReleaseQueue;
+}
   }
 
   //
   // step 6 -- initialization complete
   //
   NextDevStat |= VSTAT_DRIVER_OK;
   Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat);
-- 
1.8.3.1


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


[edk2] [PATCH V2 8/8] IntelFrameworkModulePkg AcpiS3SaveDxe: Remove S3Ready() functional code

2016-04-06 Thread Star Zeng
The S3Ready() functional code has been moved to S3SaveStateDxe in
MdeModulePkg, the ACPI global variable related code is leaved as is
for compatibility.
PcdS3BootScriptStackSize is also moved to MdeModulePkg.

Cc: Jiewen Yao 
Cc: Jeff Fan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
Reviewed-by: Jiewen Yao 
---
 .../IntelFrameworkModulePkg.dec|   8 +-
 .../IntelFrameworkModulePkg.uni|   6 +-
 .../Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c  | 451 +
 .../Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf |   9 -
 .../Acpi/AcpiS3SaveDxe/AcpiVariableThunkPlatform.c |   6 +-
 5 files changed, 8 insertions(+), 472 deletions(-)

diff --git a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec 
b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
index 8bbde8e2c9c8..a609f1bb1eb2 100644
--- a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
+++ b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
@@ -4,7 +4,7 @@
 # This package contains the definitions and module implementation
 # which follows Intel EFI Framework Specification.
 #
-# 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
@@ -248,12 +248,6 @@ [PcdsFixedAtBuild, PcdsDynamic, PcdsDynamicEx, 
PcdsPatchableInModule]
   # @Prompt Reserved S3 Boot ACPI Memory Size
   
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3AcpiReservedMemorySize|0x8000|UINT32|0x3006
 
-  ## Specify memory size for boot script executor stack usage in S3 phase.
-  #  The default size 32K. When changing the value make sure the memory size 
is large enough 
-  #  to meet boot script executor requirement in the S3 phase.
-  # @Prompt Reserved S3 Boot Script Stack ACPI Memory Size
-  
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3BootScriptStackSize|0x8000|UINT32|0x3007
-
   ## Specify the end of address below 1MB for the OPROM.
   #  The last shadowed OpROM should not exceed this address.
   # @Prompt Top Address of Shadowed Legacy OpROM
diff --git a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.uni 
b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.uni
index 8528f5d375bd..f858537cd5a4 100644
--- a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.uni
+++ b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.uni
@@ -4,7 +4,7 @@
 // This package contains the definitions and module implementation
 // which follows Intel EFI Framework Specification.
 //
-// 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
@@ -79,10 +79,6 @@
 
 #string 
STR_gEfiIntelFrameworkModulePkgTokenSpaceGuid_PcdS3AcpiReservedMemorySize_HELP  
#language en-US "Specify memory size with page number for a pre-allocated 
reserved memory to be used by PEI in S3 phase. The default size 32K. When 
changing the value make sure the memory size is large enough to meet PEI 
requirement in the S3 phase."
 
-#string 
STR_gEfiIntelFrameworkModulePkgTokenSpaceGuid_PcdS3BootScriptStackSize_PROMPT  
#language en-US "Reserved S3 Boot Script Stack ACPI Memory Size"
-
-#string 
STR_gEfiIntelFrameworkModulePkgTokenSpaceGuid_PcdS3BootScriptStackSize_HELP  
#language en-US "Specify memory size for boot script executor stack usage in S3 
phase. The default size 32K. When changing the value make sure the memory size 
is large enough to meet boot script executor requirement in the S3 phase."
-
 #string 
STR_gEfiIntelFrameworkModulePkgTokenSpaceGuid_PcdEndOpromShadowAddress_PROMPT  
#language en-US "Top Address of Shadowed Legacy OpROM"
 
 #string 
STR_gEfiIntelFrameworkModulePkgTokenSpaceGuid_PcdEndOpromShadowAddress_HELP  
#language en-US "Specify the end of address below 1MB for the OPROM. The last 
shadowed OpROM should not exceed this address."
diff --git a/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c 
b/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c
index 390defe1c084..62ac635cd14f 100644
--- a/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c
+++ b/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c
@@ -2,7 +2,7 @@
   This is an implementation of the ACPI S3 Save protocol.  This is defined in
   S3 boot path specification 0.9.
 
-Copyright (c) 2006 - 2015, 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
@@ -16,27 +16,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, 

[edk2] [PATCH V2 1/8] MdeModulePkg: Introduce new PCD PcdAcpiS3Enable

2016-04-06 Thread Star Zeng
Platform can configure the PCD statically or dynamically
to control if ACPI S3 will be enabled.
S3 related modules can consume the PCD to control the code.

Cc: Feng Tian 
Cc: Jiewen Yao 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
 MdeModulePkg/MdeModulePkg.dec | 6 ++
 MdeModulePkg/MdeModulePkg.uni | 6 ++
 2 files changed, 12 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index aa9e8066d8a6..f57e5c591722 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1504,6 +1504,12 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, 
PcdsDynamicEx]
   # @Prompt Mmio base address of pci-based SD/MMC host controller.
   
gEfiMdeModulePkgTokenSpaceGuid.PcdSdMmcPciHostControllerMmioBase|0xd000|UINT32|0x30001043
 
+  ## Indicates if ACPI S3 will be enabled.
+  #   TRUE  - ACPI S3 will be enabled.
+  #   FALSE - ACPI S3 will be disabled.
+  # @Prompt ACPI S3 Enable.
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|TRUE|BOOLEAN|0x0110
+
 [PcdsPatchableInModule]
   ## Specify memory size with page number for PEI code when
   #  Loading Module at Fixed Address feature is enabled.
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index 75659c115f1f..cbd4ad31b2b4 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -325,6 +325,12 @@

   "TRUE  - to set NX for stack."

   "FALSE - Not to set NX for stack."
 
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdAcpiS3Enable_PROMPT  #language 
en-US "ACPI S3 Enable"
+
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdAcpiS3Enable_HELP  #language 
en-US "Indicates if ACPI S3 will be enabled."
+   
   "TRUE  - ACPI S3 will be enabled."
+   
   "FALSE - ACPI S3 will be disabled."
+
 #string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdVarCheckVfrDriverGuidArray_PROMPT  
#language en-US "Driver guid array of VFR drivers for VarCheckHiiBin generation"
 
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdVarCheckVfrDriverGuidArray_HELP  
#language en-US "This PCD to include the driver guid of VFR drivers for 
VarCheckHiiBin generation."
-- 
2.7.0.windows.1

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


[edk2] [PATCH V2 4/8] MdeModulePkg S3SaveStateDxe: Consume PcdAcpiS3Enable to control the code

2016-04-06 Thread Star Zeng
Cc: Feng Tian 
Cc: Jiewen Yao 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c  | 5 -
 MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf | 5 -
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c 
b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
index 60cd9b1b3be6..0c6c76191cf4 100644
--- a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
+++ b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
@@ -1,7 +1,7 @@
 /** @file
   Implementation for S3 Boot Script Saver state driver.
 
-  Copyright (c) 2006 - 2013, 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
@@ -907,6 +907,9 @@ InitializeS3SaveState (
   )
 {
 
+  if (!PcdGetBool (PcdAcpiS3Enable)) {
+return EFI_LOAD_ERROR;
+  }
 
   return  gBS->InstallProtocolInterface (
   ,
diff --git a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf 
b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
index 2f021ed90a30..6a7a43a0a06b 100644
--- a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
+++ b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
@@ -3,7 +3,7 @@
 #
 # It will install S3 Save State protocol to store or record various IO 
operations to be replayed during an S3 resume.
 #
-# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 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
@@ -52,6 +52,9 @@ [Protocols]
   gEfiS3SaveStateProtocolGuid## PRODUCES
 
 
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable ## CONSUMES
+
 [Depex]
   TRUE
 
-- 
2.7.0.windows.1

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


[edk2] [PATCH V2 5/8] MdeModulePkg S3SaveStateDxe: Move S3Ready() functional code from AcpiS3SaveDxe

2016-04-06 Thread Star Zeng
The S3Ready() functional code in AcpiS3SaveDxe of IntelFrameworkModulePkg
is to do ACPI S3 Context save. In fact, that is not really related to
Intel framework ACPI S3 protocol.

IntelFrameworkModulePkg will be deprecated step by step, so move the
functional code to MdeModulePkg and S3SaveStateDxe is a good place.
The ACPI global variable related code is leaved as is in IntelFrameworkModulePkg
AcpiS3SaveDxe for compatibility.
PcdS3BootScriptStackSize is also moved from IntelFrameworkModulePkg.

The functional code need to get ACPI FACS table and consume LockBoxLib,
so need to be before DxeSmmReadyToLock that will shut down SMM lock box
interface, EndOfDxe is a good point (OVMF AcpiS3SaveDxe has the reference
implementation).

Cc: Jiewen Yao 
Cc: Feng Tian 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
Reviewed-by: Jiewen Yao 
---
 MdeModulePkg/MdeModulePkg.dec  |   6 +
 MdeModulePkg/MdeModulePkg.uni  |   4 +
 .../Acpi/S3SaveStateDxe/AcpiS3ContextSave.c| 532 +
 .../Acpi/S3SaveStateDxe/InternalS3SaveState.h  |  18 +-
 .../Universal/Acpi/S3SaveStateDxe/S3SaveState.c|  12 +
 .../Acpi/S3SaveStateDxe/S3SaveStateDxe.inf |  17 +-
 6 files changed, 587 insertions(+), 2 deletions(-)
 create mode 100644 
MdeModulePkg/Universal/Acpi/S3SaveStateDxe/AcpiS3ContextSave.c

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index f57e5c591722..7f50c88eeb16 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1510,6 +1510,12 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, 
PcdsDynamicEx]
   # @Prompt ACPI S3 Enable.
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|TRUE|BOOLEAN|0x0110
 
+  ## Specify memory size for boot script executor stack usage in S3 phase.
+  #  The default size 32K. When changing the value make sure the memory size 
is large enough 
+  #  to meet boot script executor requirement in the S3 phase.
+  # @Prompt Reserved S3 Boot Script Stack ACPI Memory Size
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptStackSize|0x8000|UINT32|0x0200
+
 [PcdsPatchableInModule]
   ## Specify memory size with page number for PEI code when
   #  Loading Module at Fixed Address feature is enabled.
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index cbd4ad31b2b4..44f740e96afe 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -331,6 +331,10 @@

   "TRUE  - ACPI S3 will be enabled."

   "FALSE - ACPI S3 will be disabled."
 
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdS3BootScriptStackSize_PROMPT  
#language en-US "Reserved S3 Boot Script Stack ACPI Memory Size"
+
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdS3BootScriptStackSize_HELP  
#language en-US "Specify memory size for boot script executor stack usage in S3 
phase. The default size 32K. When changing the value make sure the memory size 
is large enough to meet boot script executor requirement in the S3 phase."
+
 #string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdVarCheckVfrDriverGuidArray_PROMPT  
#language en-US "Driver guid array of VFR drivers for VarCheckHiiBin generation"
 
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdVarCheckVfrDriverGuidArray_HELP  
#language en-US "This PCD to include the driver guid of VFR drivers for 
VarCheckHiiBin generation."
diff --git a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/AcpiS3ContextSave.c 
b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/AcpiS3ContextSave.c
new file mode 100644
index ..a973d2db059a
--- /dev/null
+++ b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/AcpiS3ContextSave.c
@@ -0,0 +1,532 @@
+/** @file
+  This is the implementation to save ACPI S3 Context.
+
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+//
+// 8 extra pages for PF handler.
+//
+#define EXTRA_PAGE_TABLE_PAGES   8
+
+EFI_GUID  mAcpiS3IdtrProfileGuid = {
+  0xdea652b0, 0xd587, 0x4c54, { 0xb5, 0xb4, 0xc6, 0x82, 0xe7, 0xa0, 0xaa, 0x3d 
}
+};
+
+/**
+  Allocate memory below 4G memory address.
+
+  This function allocates memory below 4G memory address.
+
+  @param  MemoryType   

[edk2] [wave 3 PATCH v2 13/17] OvmfPkg: VirtioScsiDxe: adapt feature negotiation to virtio-1.0

2016-04-06 Thread Laszlo Ersek
Relative to virtio-0.9.5, virtio-1.0 reverses the order of queue discovery
and feature negotiation. In virtio-1.0, feature negotiation has to
complete first, and the device can also reject a self-inconsistent feature
request through the new VSTAT_FEATURES_OK status bit. (For example if the
driver requests a higher level feature but clears a prerequisite feature.)

Furthermore, we retain the VIRTIO_F_VERSION_1 feature bit if the
VIRTIO_DEVICE_PROTOCOL provider has high enough revision.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
Tested-by: Ard Biesheuvel 
Reviewed-by: Jordan Justen 
---
 OvmfPkg/VirtioScsiDxe/VirtioScsi.c | 27 +++-
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c 
b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
index 162577bcb961..c080404330e5 100644
--- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
+++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
@@ -796,14 +796,27 @@ VirtioScsiInit (
 // We must be able to halve it for bidirectional transfers
 // (see EFI_BAD_BUFFER_SIZE in PopulateRequest()).
 //
 Status = EFI_UNSUPPORTED;
 goto Failed;
   }
 
+  Features &= VIRTIO_SCSI_F_INOUT | VIRTIO_F_VERSION_1;
+
+  //
+  // In virtio-1.0, feature negotiation is expected to complete before queue
+  // discovery, and the device can also reject the selected set of features.
+  //
+  if (Dev->VirtIo->Revision >= VIRTIO_SPEC_REVISION (1, 0, 0)) {
+Status = Virtio10WriteFeatures (Dev->VirtIo, Features, );
+if (EFI_ERROR (Status)) {
+  goto Failed;
+}
+  }
+
   //
   // step 4b -- allocate request virtqueue
   //
   Status = Dev->VirtIo->SetQueueSel (Dev->VirtIo, VIRTIO_SCSI_REQUEST_QUEUE);
   if (EFI_ERROR (Status)) {
 goto Failed;
   }
@@ -843,22 +856,22 @@ VirtioScsiInit (
   //
   Status = Dev->VirtIo->SetQueueAddress (Dev->VirtIo, >Ring);
   if (EFI_ERROR (Status)) {
 goto ReleaseQueue;
   }
 
   //
-  // step 5 -- Report understood features and guest-tuneables. We want none of
-  // the known (or unknown) VIRTIO_SCSI_F_* or VIRTIO_F_* capabilities (see
-  // virtio-0.9.5, Appendices B and I), except bidirectional transfers.
+  // step 5 -- Report understood features and guest-tuneables.
   //
-  Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo,
-  Features & VIRTIO_SCSI_F_INOUT);
-  if (EFI_ERROR (Status)) {
-goto ReleaseQueue;
+  if (Dev->VirtIo->Revision < VIRTIO_SPEC_REVISION (1, 0, 0)) {
+Features &= ~(UINT64)VIRTIO_F_VERSION_1;
+Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features);
+if (EFI_ERROR (Status)) {
+  goto ReleaseQueue;
+}
   }
 
   //
   // We expect these maximum sizes from the host. Since they are
   // guest-negotiable, ask for them rather than just checking them.
   //
   Status = VIRTIO_CFG_WRITE (Dev, CdbSize, VIRTIO_SCSI_CDB_SIZE);
-- 
1.8.3.1


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


[edk2] [wave 3 PATCH v2 15/17] OvmfPkg: Virtio10Dxe: non-transitional driver for virtio-1.0 PCI devices

2016-04-06 Thread Laszlo Ersek
This driver implements the VIRTIO_DEVICE_PROTOCOL for non-transitional PCI
devices, based on the virtio-1.0 specification (csprd05). Non-transitional
means that it only binds QEMU's virtio-xxx-pci devices that receive the
",disable-legacy=on,disable-modern=off" properties on the QEMU command
line. These devices have distinct PCI Device IDs from those that are bound
by VirtioPciDeviceDxe.

The central abstraction of this driver is the VIRTIO_1_0_CONFIG type. It
is practically a "fat pointer" to a register block. The pointed-to
register block
- may or may not exist (the latter being mostly useful for virtio-1.0
  devices that have no device-specific registers),
- lives in one of the device's BARs,
- lives in an IO or MMIO BAR,
- lives at an offset relative to the BAR start,
- has its size also maintained.

Such VIRTIO_1_0_CONFIG "fat pointers" (i.e., the locations of the register
blocks) are parsed from vendor capabilities that reside in the device's
standard PCI capabilities list (in PCI config space).

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
Tested-by: Ard Biesheuvel 
Acked-by: Jordan Justen 
---

Notes:
v2:
- no need to include  explicitly,
   exposes all versions [Jordan]

 OvmfPkg/Virtio10Dxe/Virtio10.inf |   40 +
 OvmfPkg/Virtio10Dxe/Virtio10.h   |   56 ++
 OvmfPkg/Virtio10Dxe/Virtio10.c   | 1061 
 3 files changed, 1157 insertions(+)

diff --git a/OvmfPkg/Virtio10Dxe/Virtio10.inf b/OvmfPkg/Virtio10Dxe/Virtio10.inf
new file mode 100644
index ..f868d1cfc449
--- /dev/null
+++ b/OvmfPkg/Virtio10Dxe/Virtio10.inf
@@ -0,0 +1,40 @@
+## @file
+# A non-transitional driver for VirtIo 1.0 PCI devices.
+#
+# Copyright (C) 2016, 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.
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = Virtio10
+  FILE_GUID  = 0170F60C-1D40-4651-956D-F0BD9879D527
+  MODULE_TYPE= UEFI_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= Virtio10EntryPoint
+
+[Sources]
+  Virtio10.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[LibraryClasses]
+  BaseMemoryLib
+  DebugLib
+  MemoryAllocationLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+  UefiLib
+
+[Protocols]
+  gEfiPciIoProtocolGuid ## TO_START
+  gVirtioDeviceProtocolGuid ## BY_START
diff --git a/OvmfPkg/Virtio10Dxe/Virtio10.h b/OvmfPkg/Virtio10Dxe/Virtio10.h
new file mode 100644
index ..2fbe27f1cfee
--- /dev/null
+++ b/OvmfPkg/Virtio10Dxe/Virtio10.h
@@ -0,0 +1,56 @@
+/** @file
+  Private definitions of the VirtIo 1.0 driver.
+
+  Copyright (C) 2016, 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.
+**/
+
+#ifndef _VIRTIO_1_0_DXE_H_
+#define _VIRTIO_1_0_DXE_H_
+
+#include 
+#include 
+
+#define VIRTIO_1_0_SIGNATURE SIGNATURE_32 ('V', 'I', 'O', '1')
+
+//
+// Type of the PCI BAR that contains a VirtIo 1.0 config structure.
+//
+typedef enum {
+  Virtio10BarTypeMem,
+  Virtio10BarTypeIo
+} VIRTIO_1_0_BAR_TYPE;
+
+//
+// The type below defines the access to a VirtIo 1.0 config structure.
+//
+typedef struct {
+  BOOLEAN Exists;  // The device exposes this structure
+  VIRTIO_1_0_BAR_TYPE BarType;
+  UINT8   Bar;
+  UINT32  Offset;  // Offset into BAR where structure starts
+  UINT32  Length;  // Length of structure in BAR.
+} VIRTIO_1_0_CONFIG;
+
+typedef struct {
+  UINT32 Signature;
+  VIRTIO_DEVICE_PROTOCOL VirtIo;
+  EFI_PCI_IO_PROTOCOL*PciIo;
+  UINT64 OriginalPciAttributes;
+  VIRTIO_1_0_CONFIG  CommonConfig;   // Common settings
+  VIRTIO_1_0_CONFIG  NotifyConfig;   // Notifications
+  UINT32 NotifyOffsetMultiplier;
+  VIRTIO_1_0_CONFIG  SpecificConfig; // Device specific settings
+} VIRTIO_1_0_DEV;
+
+#define VIRTIO_1_0_FROM_VIRTIO_DEVICE(Device) \
+  CR (Device, VIRTIO_1_0_DEV, VirtIo, VIRTIO_1_0_SIGNATURE)
+
+#endif 

[edk2] [wave 3 PATCH v2 06/17] OvmfPkg: IndustryStandard: factor out Virtio095.h

2016-04-06 Thread Laszlo Ersek
In the upcoming virtio-1.0 series, we'll introduce "Virtio10.h". However,
the "Virtio.h" header file should continue to expose the generic type and
macro definitions for all virtio versions that OvmfPkg supports. Therefore
extract "Virtio095.h" like this:

  Virtio.h -> Virtio095.h

so that in the upcoming patches, we can insert "Virtio10.h" in the middle
of the inclusion chain.

This follows the example of "Acpi.h" and "Pci.h" under
"MdePkg/Include/IndustryStandard".

Cc: Jordan Justen 
Cc: Ard Biesheuvel 
Suggested-by: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---

Notes:
v2:
- new in v2 [Jordan]

 OvmfPkg/Include/IndustryStandard/Virtio.h  | 159 
+---
 OvmfPkg/Include/IndustryStandard/{Virtio.h => Virtio095.h} |   8 +-
 2 files changed, 8 insertions(+), 159 deletions(-)

diff --git a/OvmfPkg/Include/IndustryStandard/Virtio.h 
b/OvmfPkg/Include/IndustryStandard/Virtio.h
index fcf7b67431f9..e1682fc69a42 100644
--- a/OvmfPkg/Include/IndustryStandard/Virtio.h
+++ b/OvmfPkg/Include/IndustryStandard/Virtio.h
@@ -1,13 +1,13 @@
 /** @file
 
-  Generic type and macro definitions corresponding to the virtio-0.9.5
-  specification.
+  Generic type and macro definitions corresponding to the virtio
+  specifications.
 
-  Copyright (C) 2012, Red Hat, Inc.
+  Copyright (C) 2012-2016, Red Hat, Inc.
   Portion of Copyright (C) 2013, ARM Ltd.
 
   This program and the accompanying materials are licensed and made available
   under the terms and conditions of the BSD License which accompanies this
   distribution. The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php
 
@@ -15,161 +15,10 @@
   WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
 
 #ifndef _VIRTIO_H_
 #define _VIRTIO_H_
 
-#include 
-
-//
-// VirtIo Subsystem Device IDs
-//
-#define VIRTIO_SUBSYSTEM_NETWORK_CARD   1
-#define VIRTIO_SUBSYSTEM_BLOCK_DEVICE   2
-#define VIRTIO_SUBSYSTEM_CONSOLE3
-#define VIRTIO_SUBSYSTEM_ENTROPY_SOURCE 4
-#define VIRTIO_SUBSYSTEM_MEMORY_BALLOONING  5
-#define VIRTIO_SUBSYSTEM_IO_MEMORY  6
-#define VIRTIO_SUBSYSTEM_RPMSG  7
-#define VIRTIO_SUBSYSTEM_SCSI_HOST  8
-#define VIRTIO_SUBSYSTEM_9P_TRANSPORT   9
-#define VIRTIO_SUBSYSTEM_MAC80211_WLAN  10
-
-//
-// Virtio IDs
-//
-#define VIRTIO_VENDOR_ID0x1AF4
-#define VIRTIO_MMIO_MAGIC   0x74726976 // "virt"
-
-
-//
-// VirtIo Device Specific Configuration Offsets
-//
-#define VIRTIO_DEVICE_SPECIFIC_CONFIGURATION_OFFSET_PCI 20
-#define VIRTIO_DEVICE_SPECIFIC_CONFIGURATION_OFFSET_PCI_WITH_MSI_X  24
-#define VIRTIO_DEVICE_SPECIFIC_CONFIGURATION_OFFSET_MMIO0x100
-
-//
-// PCI VirtIo Header Offsets
-//
-#define VIRTIO_PCI_OFFSET_DEVICE_FEATURES   0x00
-#define VIRTIO_PCI_OFFSET_GUEST_FEATURES0x04
-#define VIRTIO_PCI_OFFSET_QUEUE_ADDRESS 0x08
-#define VIRTIO_PCI_OFFSET_QUEUE_SIZE0x0C
-#define VIRTIO_PCI_OFFSET_QUEUE_SELECT  0x0E
-#define VIRTIO_PCI_OFFSET_QUEUE_NOTIFY  0x10
-#define VIRTIO_PCI_OFFSET_QUEUE_DEVICE_STATUS   0x12
-#define VIRTIO_PCI_OFFSET_QUEUE_DEVICE_ISR  0x13
-
-//
-// MMIO VirtIo Header Offsets
-//
-#define VIRTIO_MMIO_OFFSET_MAGIC0x00
-#define VIRTIO_MMIO_OFFSET_VERSION  0x04
-#define VIRTIO_MMIO_OFFSET_DEVICE_ID0x08
-#define VIRTIO_MMIO_OFFSET_VENDOR_ID0x0C
-#define VIRTIO_MMIO_OFFSET_HOST_FEATURES0x10
-#define VIRTIO_MMIO_OFFSET_HOST_FEATURES_SEL0x14
-#define VIRTIO_MMIO_OFFSET_GUEST_FEATURES   0x20
-#define VIRTIO_MMIO_OFFSET_GUEST_FEATURES_SEL   0x24
-#define VIRTIO_MMIO_OFFSET_GUEST_PAGE_SIZE  0x28
-#define VIRTIO_MMIO_OFFSET_QUEUE_SEL0x30
-#define VIRTIO_MMIO_OFFSET_QUEUE_NUM_MAX0x34
-#define VIRTIO_MMIO_OFFSET_QUEUE_NUM0x38
-#define VIRTIO_MMIO_OFFSET_QUEUE_ALIGN  0x3C
-#define VIRTIO_MMIO_OFFSET_QUEUE_PFN0x40
-#define VIRTIO_MMIO_OFFSET_QUEUE_NOTIFY 0x50
-#define VIRTIO_MMIO_OFFSET_INTERRUPT_STATUS 0x60
-#define VIRTIO_MMIO_OFFSET_INTERRUPT_ACK0x64
-#define VIRTIO_MMIO_OFFSET_STATUS   0x70
-
-//
-// Data in the communication area is defined as packed and accessed as
-// volatile.
-//
-// Some structures contain arrays with dynamically determined size. In such
-// cases the array and its sibling fields are replaced with pointers.
-//
-// All indices (variables and fields named *Idx) are free-running and wrap
-// around after 0x. The queue size reported by the host is always an
-// integral power of 2, not greater than 32768. Actual array indices are
-// consistently 

[edk2] [wave 3 PATCH v2 08/17] OvmfPkg: IndustryStandard: add definitions from the VirtIo 1.0 spec

2016-04-06 Thread Laszlo Ersek
These header files are intentionally minimal, and intentionally kept apart
from the VirtIo 0.9.5 headers.

The header inclusion chains end up like this (the Virtio10*.h header files
in the middle are new):

  Virtio.h-> Virtio10.h-> Virtio095.h

 ^ ^
 | |

  VirtioNet.h -> Virtio10Net.h -> Virtio095Net.h

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
Tested-by: Ard Biesheuvel 
---

Notes:
v2:
- keep Ard's Tested-by
- rebase on top of Virtio095.h and Virtio095Net.h [Jordan]
- rename the "Legacy" field in VIRTIO_1_0_NET_REQ to "V0_9_5" [Jordan]
  (The original suggestion was V0_95; however that doesn't reflect the
  dots in the actual spec version string -- it is virtio-0.9.5, not
  virtio-0.95.)
- I'm fine with an Acked-by for this, of course

 OvmfPkg/Include/IndustryStandard/Virtio.h   |  2 +-
 OvmfPkg/Include/IndustryStandard/Virtio10.h | 81 

 OvmfPkg/Include/IndustryStandard/{VirtioNet.h => Virtio10Net.h} | 24 --
 OvmfPkg/Include/IndustryStandard/VirtioNet.h|  2 +-
 4 files changed, 100 insertions(+), 9 deletions(-)

diff --git a/OvmfPkg/Include/IndustryStandard/Virtio.h 
b/OvmfPkg/Include/IndustryStandard/Virtio.h
index e1682fc69a42..dddec388318e 100644
--- a/OvmfPkg/Include/IndustryStandard/Virtio.h
+++ b/OvmfPkg/Include/IndustryStandard/Virtio.h
@@ -15,10 +15,10 @@
   WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
 
 #ifndef _VIRTIO_H_
 #define _VIRTIO_H_
 
-#include 
+#include 
 
 #endif // _VIRTIO_H_
diff --git a/OvmfPkg/Include/IndustryStandard/Virtio10.h 
b/OvmfPkg/Include/IndustryStandard/Virtio10.h
new file mode 100644
index ..de692c1d1ee9
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/Virtio10.h
@@ -0,0 +1,81 @@
+/** @file
+  Definitions from the VirtIo 1.0 specification (csprd05).
+
+  Copyright (C) 2016, 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.
+**/
+
+#ifndef _VIRTIO_1_0_H_
+#define _VIRTIO_1_0_H_
+
+#include 
+
+//
+// Structures for parsing the VirtIo 1.0 specific PCI capabilities from the
+// config space
+//
+#pragma pack (1)
+typedef struct {
+  UINT8 CapId;   // Capability identifier (generic)
+  UINT8 CapNext; // Link to next capability (generic)
+} VIRTIO_PCI_CAP_LINK;
+
+typedef struct {
+  UINT8  ConfigType; // Identifies the specific VirtIo 1.0 config structure
+  UINT8  Bar;// The BAR that contains the structure
+  UINT8  Padding[3];
+  UINT32 Offset; // Offset within Bar until the start of the structure
+  UINT32 Length; // Length of the structure
+} VIRTIO_PCI_CAP;
+#pragma pack ()
+
+//
+// Values for the VIRTIO_PCI_CAP.ConfigType field
+//
+#define VIRTIO_PCI_CAP_COMMON_CFG 1 // Common configuration
+#define VIRTIO_PCI_CAP_NOTIFY_CFG 2 // Notifications
+#define VIRTIO_PCI_CAP_DEVICE_CFG 4 // Device specific configuration
+
+//
+// Structure pointed-to by Bar and Offset in VIRTIO_PCI_CAP when ConfigType is
+// VIRTIO_PCI_CAP_COMMON_CFG
+//
+#pragma pack (1)
+typedef struct {
+  UINT32 DeviceFeatureSelect;
+  UINT32 DeviceFeature;
+  UINT32 DriverFeatureSelect;
+  UINT32 DriverFeature;
+  UINT16 MsixConfig;
+  UINT16 NumQueues;
+  UINT8  DeviceStatus;
+  UINT8  ConfigGeneration;
+  UINT16 QueueSelect;
+  UINT16 QueueSize;
+  UINT16 QueueMsixVector;
+  UINT16 QueueEnable;
+  UINT16 QueueNotifyOff;
+  UINT64 QueueDesc;
+  UINT64 QueueAvail;
+  UINT64 QueueUsed;
+} VIRTIO_PCI_COMMON_CFG;
+#pragma pack ()
+
+//
+// VirtIo 1.0 device status bits
+//
+#define VSTAT_FEATURES_OK BIT3
+
+//
+// VirtIo 1.0 reserved (device-independent) feature bits
+//
+#define VIRTIO_F_VERSION_1 BIT32
+
+#endif // _VIRTIO_1_0_H_
diff --git a/OvmfPkg/Include/IndustryStandard/VirtioNet.h 
b/OvmfPkg/Include/IndustryStandard/Virtio10Net.h
similarity index 51%
copy from OvmfPkg/Include/IndustryStandard/VirtioNet.h
copy to OvmfPkg/Include/IndustryStandard/Virtio10Net.h
index db4882abaef3..cfd25fc4148d 100644
--- a/OvmfPkg/Include/IndustryStandard/VirtioNet.h
+++ b/OvmfPkg/Include/IndustryStandard/Virtio10Net.h
@@ -1,22 +1,32 @@
 /** @file
-  Virtio Network Device specific type and macro definitions corresponding to
-  the virtio specifications.
+  Definitions from the VirtIo 1.0 specification (csprd05), specifically for the
+  network device.
 
-  Copyright (C) 2013-2016, Red Hat, Inc.

[edk2] [wave 3 PATCH v2 17/17] ArmVirtPkg: include Virtio10Dxe from OvmfPkg

2016-04-06 Thread Laszlo Ersek
Cc: Ard Biesheuvel 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
Reviewed-by: Ard Biesheuvel 
Tested-by: Ard Biesheuvel 
Reviewed-by: Jordan Justen 
---
 ArmVirtPkg/ArmVirtQemu.dsc   | 1 +
 ArmVirtPkg/ArmVirtQemuKernel.dsc | 1 +
 ArmVirtPkg/ArmVirtQemu.fdf   | 1 +
 ArmVirtPkg/ArmVirtQemuKernel.fdf | 1 +
 4 files changed, 4 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index e626df768f85..c4275a389e2b 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -360,14 +360,15 @@ [Components.common]
 
   #
   # PCI support
   #
   ArmVirtPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
   OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
+  OvmfPkg/Virtio10Dxe/Virtio10.inf
 
   #
   # Video support
   #
   OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf {
 
   BltLib|OptionRomPkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index bfa4dbe9fd8c..b33e96f5d7e8 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -345,14 +345,15 @@ [Components.common]
 
   #
   # PCI support
   #
   ArmVirtPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
   OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
+  OvmfPkg/Virtio10Dxe/Virtio10.inf
 
   #
   # Video support
   #
   OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf {
 
   BltLib|OptionRomPkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
index ef456539cc62..9d1503cfc7c8 100644
--- a/ArmVirtPkg/ArmVirtQemu.fdf
+++ b/ArmVirtPkg/ArmVirtQemu.fdf
@@ -212,14 +212,15 @@ [FV.FvMain]
 
   #
   # PCI support
   #
   INF ArmVirtPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
   INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
   INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
+  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
 
   #
   # Video support
   #
   INF OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
   INF OvmfPkg/PlatformDxe/Platform.inf
 
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQemuKernel.fdf
index 7491f8042bd7..472e0fe810d4 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.fdf
+++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf
@@ -230,14 +230,15 @@ [FV.FvMain]
 
   #
   # PCI support
   #
   INF ArmVirtPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
   INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
   INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
+  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
 
   #
   # Video support
   #
   INF OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
   INF OvmfPkg/PlatformDxe/Platform.inf
 
-- 
1.8.3.1

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


[edk2] [wave 3 PATCH v2 14/17] OvmfPkg: VirtioNetDxe: adapt virtio-net packet header size to virtio-1.0

2016-04-06 Thread Laszlo Ersek
In virtio-0.9.5, the size of the virtio-net packet header depends on
whether the VIRTIO_NET_F_MRG_RXBUF feature is negotiated -- the
"num_buffers" field is only appended to the header if the feature is
negotiated.

Since we never negotiate this feature, VirtioNetDxe never allocates room
for the "num_buffers" field.

With virtio-1.0, the "num_buffers" field is always there (although it
doesn't carry useful information without VIRTIO_NET_F_MRG_RXBUF). Adapt
the buffers that depend on the virtio-net header size (otherwise we have
skewed / truncated packets).

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
Tested-by: Ard Biesheuvel 
Reviewed-by: Jordan Justen 
---

Notes:
v2:
- rename the "Legacy" field in VIRTIO_1_0_NET_REQ to "V0_9_5" [Jordan]
- no need to include  explicitly,
   exposes all versions [Jordan]

 OvmfPkg/VirtioNetDxe/VirtioNet.h |  2 +-
 OvmfPkg/VirtioNetDxe/SnpInitialize.c | 36 
 2 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/OvmfPkg/VirtioNetDxe/VirtioNet.h b/OvmfPkg/VirtioNetDxe/VirtioNet.h
index 2d3f3d87eb11..710859bc6115 100644
--- a/OvmfPkg/VirtioNetDxe/VirtioNet.h
+++ b/OvmfPkg/VirtioNetDxe/VirtioNet.h
@@ -85,15 +85,15 @@ typedef struct {
   UINT8   *RxBuf;// VirtioNetInitRx
   UINT16  RxLastUsed;// VirtioNetInitRx
 
   VRING   TxRing;// VirtioNetInitRing
   UINT16  TxMaxPending;  // VirtioNetInitTx
   UINT16  TxCurPending;  // VirtioNetInitTx
   UINT16  *TxFreeStack;  // VirtioNetInitTx
-  VIRTIO_NET_REQ  TxSharedReq;   // VirtioNetInitTx
+  VIRTIO_1_0_NET_REQ  TxSharedReq;   // VirtioNetInitTx
   UINT16  TxLastUsed;// VirtioNetInitTx
 } VNET_DEV;
 
 
 //
 // In order to avoid duplication of interface documentation, please find all
 // leading comments near the respective function / variable definitions (not
diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c 
b/OvmfPkg/VirtioNetDxe/SnpInitialize.c
index 38012a0df8d6..430670a980f2 100644
--- a/OvmfPkg/VirtioNetDxe/SnpInitialize.c
+++ b/OvmfPkg/VirtioNetDxe/SnpInitialize.c
@@ -134,52 +134,66 @@ ReleaseQueue:
 STATIC
 EFI_STATUS
 EFIAPI
 VirtioNetInitTx (
   IN OUT VNET_DEV *Dev
   )
 {
+  UINTN TxSharedReqSize;
   UINTN PktIdx;
 
   Dev->TxMaxPending = (UINT16) MIN (Dev->TxRing.QueueSize / 2,
  VNET_MAX_PENDING);
   Dev->TxCurPending = 0;
   Dev->TxFreeStack  = AllocatePool (Dev->TxMaxPending *
 sizeof *Dev->TxFreeStack);
   if (Dev->TxFreeStack == NULL) {
 return EFI_OUT_OF_RESOURCES;
   }
 
+  //
+  // In VirtIo 1.0, the NumBuffers field is mandatory. In 0.9.5, it depends on
+  // VIRTIO_NET_F_MRG_RXBUF, which we never negotiate.
+  //
+  TxSharedReqSize = (Dev->VirtIo->Revision < VIRTIO_SPEC_REVISION (1, 0, 0)) ?
+sizeof Dev->TxSharedReq.V0_9_5 :
+sizeof Dev->TxSharedReq;
+
   for (PktIdx = 0; PktIdx < Dev->TxMaxPending; ++PktIdx) {
 UINT16 DescIdx;
 
 DescIdx = (UINT16) (2 * PktIdx);
 Dev->TxFreeStack[PktIdx] = DescIdx;
 
 //
 // For each possibly pending packet, lay out the descriptor for the common
 // (unmodified by the host) virtio-net request header.
 //
 Dev->TxRing.Desc[DescIdx].Addr  = (UINTN) >TxSharedReq;
-Dev->TxRing.Desc[DescIdx].Len   = sizeof Dev->TxSharedReq;
+Dev->TxRing.Desc[DescIdx].Len   = (UINT32) TxSharedReqSize;
 Dev->TxRing.Desc[DescIdx].Flags = VRING_DESC_F_NEXT;
 Dev->TxRing.Desc[DescIdx].Next  = (UINT16) (DescIdx + 1);
 
 //
 // The second descriptor of each pending TX packet is updated on the fly,
 // but it always terminates the descriptor chain of the packet.
 //
 Dev->TxRing.Desc[DescIdx + 1].Flags = 0;
   }
 
   //
   // virtio-0.9.5, Appendix C, Packet Transmission
   //
-  Dev->TxSharedReq.Flags   = 0;
-  Dev->TxSharedReq.GsoType = VIRTIO_NET_HDR_GSO_NONE;
+  Dev->TxSharedReq.V0_9_5.Flags   = 0;
+  Dev->TxSharedReq.V0_9_5.GsoType = VIRTIO_NET_HDR_GSO_NONE;
+
+  //
+  // For VirtIo 1.0 only -- the field exists, but it is unused
+  //
+  Dev->TxSharedReq.NumBuffers = 0;
 
   //
   // virtio-0.9.5, 2.4.2 Receiving Used Buffers From the Device
   //
   MemoryFence ();
   Dev->TxLastUsed = *Dev->TxRing.Used.Idx;
   ASSERT (Dev->TxLastUsed == 0);
@@ -219,27 +233,36 @@ STATIC
 EFI_STATUS
 EFIAPI
 VirtioNetInitRx (
   IN OUT VNET_DEV *Dev
   )
 {
   EFI_STATUS Status;
+  UINTN  VirtioNetReqSize;
   UINTN  RxBufSize;
   UINT16 RxAlwaysPending;
   UINTN  PktIdx;
   UINT16 DescIdx;
   UINT8  *RxPtr;
 
   //
+  // In VirtIo 1.0, the NumBuffers field is 

[edk2] [wave 3 PATCH v2 16/17] OvmfPkg: include Virtio10Dxe

2016-04-06 Thread Laszlo Ersek
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
Tested-by: Ard Biesheuvel 
Reviewed-by: Jordan Justen 
---
 OvmfPkg/OvmfPkgIa32.dsc| 1 +
 OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
 OvmfPkg/OvmfPkgX64.dsc | 1 +
 OvmfPkg/OvmfPkgIa32.fdf| 1 +
 OvmfPkg/OvmfPkgIa32X64.fdf | 1 +
 OvmfPkg/OvmfPkgX64.fdf | 1 +
 6 files changed, 6 insertions(+)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 9e5b47738bd3..226c3d357376 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -574,14 +574,15 @@ [Components]
 !ifdef $(CSM_ENABLE)
   NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
 !endif
   }
 
   OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
   OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
+  OvmfPkg/Virtio10Dxe/Virtio10.inf
   OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   OvmfPkg/VirtioRngDxe/VirtioRng.inf
   OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf
   OvmfPkg/XenBusDxe/XenBusDxe.inf
   OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 6e4da4ff55c4..d4ceea4ac6f5 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -583,14 +583,15 @@ [Components.X64]
 !ifdef $(CSM_ENABLE)
   NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
 !endif
   }
 
   OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
   OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
+  OvmfPkg/Virtio10Dxe/Virtio10.inf
   OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   OvmfPkg/VirtioRngDxe/VirtioRng.inf
   OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf
   OvmfPkg/XenBusDxe/XenBusDxe.inf
   OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 3d6d43ef73ab..5bd1d2581f8c 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -581,14 +581,15 @@ [Components]
 !ifdef $(CSM_ENABLE)
   NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
 !endif
   }
 
   OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
   OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
+  OvmfPkg/Virtio10Dxe/Virtio10.inf
   OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   OvmfPkg/VirtioRngDxe/VirtioRng.inf
   OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf
   OvmfPkg/XenBusDxe/XenBusDxe.inf
   OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index fc203f2856c3..40a8976869f6 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -215,14 +215,15 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
 INF  PcAtChipsetPkg/KbcResetDxe/Reset.inf
 INF  MdeModulePkg/Universal/Metronome/Metronome.inf
 INF  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
 
 INF  OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
 INF  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
+INF  OvmfPkg/Virtio10Dxe/Virtio10.inf
 INF  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
 INF  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
 INF  OvmfPkg/VirtioRngDxe/VirtioRng.inf
 INF  OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf
 INF  OvmfPkg/XenBusDxe/XenBusDxe.inf
 INF  OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
 
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index d3f46f38f6c8..8e98dfcd7f3d 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -215,14 +215,15 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
 INF  PcAtChipsetPkg/KbcResetDxe/Reset.inf
 INF  MdeModulePkg/Universal/Metronome/Metronome.inf
 INF  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
 
 INF  OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
 INF  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
+INF  OvmfPkg/Virtio10Dxe/Virtio10.inf
 INF  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
 INF  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
 INF  OvmfPkg/VirtioRngDxe/VirtioRng.inf
 INF  OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf
 INF  OvmfPkg/XenBusDxe/XenBusDxe.inf
 INF  OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
 
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 15ef13a2cd0c..918004d68c44 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -215,14 +215,15 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
 INF  PcAtChipsetPkg/KbcResetDxe/Reset.inf
 INF  MdeModulePkg/Universal/Metronome/Metronome.inf
 INF  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
 
 INF  OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
 INF  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
+INF  OvmfPkg/Virtio10Dxe/Virtio10.inf
 INF  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
 INF  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
 INF  OvmfPkg/VirtioRngDxe/VirtioRng.inf
 

[edk2] [wave 3 PATCH v2 00/17] OvmfPkg, ArmVirtPkg: VirtIo 1.0

2016-04-06 Thread Laszlo Ersek
Version 2 of
.

Public branch: .

* The following patches are new:

  v2 06/17 OvmfPkg: IndustryStandard: factor out Virtio095.h
  v2 07/17 OvmfPkg: IndustryStandard: factor out Virtio095Net.h

  They should be reviewed by Jordan, please.

* The patch below has been modified, addressing Jordan's v1 comments:

  v2 08/17 OvmfPkg: IndustryStandard: add definitions from the VirtIo 1.0 spec

  It needs an ACK or a review from Jordan, please.

* The rest of the series is covered with reviews and ACKs from v1.

* The following patches have been trivially updated (while keeping their
  tags), to account for the above three:

  v2 09/17 OvmfPkg: VirtioLib: add Virtio10WriteFeatures() function
  v2 14/17 OvmfPkg: VirtioNetDxe: adapt virtio-net packet header size to 
virtio-1.0
  v2 15/17 OvmfPkg: Virtio10Dxe: non-transitional driver for virtio-1.0 PCI 
devices

* All six new or modified patches have individual notes on them.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 

Thanks
Laszlo

Laszlo Ersek (17):
  OvmfPkg: VIRTIO_DEVICE_PROTOCOL: widen the Features bitmap to 64 bits
  OvmfPkg: VIRTIO_DEVICE_PROTOCOL: remove GetQueueAddress() member
  OvmfPkg: VIRTIO_DEVICE_PROTOCOL: pass VRING object to
SetQueueAddress()
  OvmfPkg: VirtioBlkDxe: don't clear non-negotiable feature bits
  OvmfPkg: VirtioRngDxe: clear all feature bits more explicitly
  OvmfPkg: IndustryStandard: factor out Virtio095.h
  OvmfPkg: IndustryStandard: factor out Virtio095Net.h
  OvmfPkg: IndustryStandard: add definitions from the VirtIo 1.0 spec
  OvmfPkg: VirtioLib: add Virtio10WriteFeatures() function
  OvmfPkg: VirtioBlkDxe: adapt feature negotiation to virtio-1.0
  OvmfPkg: VirtioNetDxe: adapt feature negotiation to virtio-1.0
  OvmfPkg: VirtioRngDxe: adapt feature negotiation to virtio-1.0
  OvmfPkg: VirtioScsiDxe: adapt feature negotiation to virtio-1.0
  OvmfPkg: VirtioNetDxe: adapt virtio-net packet header size to
virtio-1.0
  OvmfPkg: Virtio10Dxe: non-transitional driver for virtio-1.0 PCI
devices
  OvmfPkg: include Virtio10Dxe
  ArmVirtPkg: include Virtio10Dxe from OvmfPkg

 ArmVirtPkg/ArmVirtQemu.dsc   |1 +
 ArmVirtPkg/ArmVirtQemu.fdf   |1 +
 ArmVirtPkg/ArmVirtQemuKernel.dsc |1 +
 ArmVirtPkg/ArmVirtQemuKernel.fdf |1 +
 OvmfPkg/Include/IndustryStandard/Virtio.h|  159 +--
 OvmfPkg/Include/IndustryStandard/Virtio10.h  |   81 ++
 OvmfPkg/Include/IndustryStandard/Virtio10Net.h   |   32 +
 OvmfPkg/Include/IndustryStandard/VirtioNet.h |   81 +-
 OvmfPkg/Include/IndustryStandard/{Virtio.h => Virtio095.h}   |8 +-
 OvmfPkg/Include/IndustryStandard/{VirtioNet.h => Virtio095Net.h} |   10 +-
 OvmfPkg/Include/Library/VirtioLib.h  |   46 +
 OvmfPkg/Include/Protocol/VirtioDevice.h  |   42 +-
 OvmfPkg/Library/VirtioLib/VirtioLib.c|   75 ++
 OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c   |1 -
 OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h   |   15 +-
 OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c  |   37 +-
 OvmfPkg/OvmfPkgIa32.dsc  |1 +
 OvmfPkg/OvmfPkgIa32.fdf  |1 +
 OvmfPkg/OvmfPkgIa32X64.dsc   |1 +
 OvmfPkg/OvmfPkgIa32X64.fdf   |1 +
 OvmfPkg/OvmfPkgX64.dsc   |1 +
 OvmfPkg/OvmfPkgX64.fdf   |1 +
 OvmfPkg/Virtio10Dxe/Virtio10.c   | 1061 

 OvmfPkg/Virtio10Dxe/Virtio10.h   |   56 ++
 OvmfPkg/Virtio10Dxe/Virtio10.inf |   40 +
 OvmfPkg/VirtioBlkDxe/VirtioBlk.c |   33 +-
 OvmfPkg/VirtioNetDxe/DriverBinding.c |2 +-
 OvmfPkg/VirtioNetDxe/SnpInitialize.c |   64 +-
 OvmfPkg/VirtioNetDxe/VirtioNet.h |2 +-
 OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c |1 -
 OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h |   15 +-
 OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c  |   40 +-
 OvmfPkg/VirtioRngDxe/VirtioRng.c |   31 +-
 OvmfPkg/VirtioScsiDxe/VirtioScsi.c   |   32 +-
 34 files changed, 1580 insertions(+), 394 deletions(-)
 copy OvmfPkg/Include/IndustryStandard/{Virtio.h => Virtio095.h} (94%)
 copy 

[edk2] [wave 3 PATCH v2 03/17] OvmfPkg: VIRTIO_DEVICE_PROTOCOL: pass VRING object to SetQueueAddress()

2016-04-06 Thread Laszlo Ersek
In virtio-1.0, it is not enough to pass the base address of the virtio
queue to the hypervisor (as a frame number); instead it will want the
addresses of the descriptor table, the available ring, and the used ring
separately. Pass the VRING object to the SetQueueAddress() member
function; this will enable a virtio-1.0 implementation. Convert the
current producers and consumers to this prototype.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
Tested-by: Ard Biesheuvel 
Reviewed-by: Jordan Justen 
---
 OvmfPkg/Include/Protocol/VirtioDevice.h | 12 
++--
 OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h  |  4 ++--
 OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h|  4 ++--
 OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c |  7 ---
 OvmfPkg/VirtioBlkDxe/VirtioBlk.c|  3 +--
 OvmfPkg/VirtioNetDxe/SnpInitialize.c|  3 +--
 OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c |  6 +++---
 OvmfPkg/VirtioRngDxe/VirtioRng.c|  3 +--
 OvmfPkg/VirtioScsiDxe/VirtioScsi.c  |  3 +--
 9 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/OvmfPkg/Include/Protocol/VirtioDevice.h 
b/OvmfPkg/Include/Protocol/VirtioDevice.h
index f8afa7120a4c..910a4866e7ac 100644
--- a/OvmfPkg/Include/Protocol/VirtioDevice.h
+++ b/OvmfPkg/Include/Protocol/VirtioDevice.h
@@ -15,14 +15,16 @@
   WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
 
 #ifndef __VIRTIO_DEVICE_H__
 #define __VIRTIO_DEVICE_H__
 
+#include 
+
 // VirtIo Specification Revision: Major[31:24].Minor[23:16].Revision[15:0
 #define VIRTIO_SPEC_REVISION(major,minor,revision) \
   major) & 0xFF) << 24) | (((minor) & 0xFF) << 16) | ((revision) & 0x))
 
 #define VIRTIO_DEVICE_PROTOCOL_GUID { \
   0xfa920010, 0x6785, 0x4941, {0xb6, 0xec, 0x49, 0x8c, 0x57, 0x9f, 0x16, 0x0a 
}\
   }
@@ -123,32 +125,30 @@ typedef
 EFI_STATUS
 (EFIAPI *VIRTIO_SET_GUEST_FEATURES) (
   IN VIRTIO_DEVICE_PROTOCOL  *This,
   IN UINT64   Features
   );
 
 /**
-  Write the queue address field in the Virtio Header.
-
-  The parameter Address must be the base address of the virtqueue divided
-  by 4096.
+  Write the queue address field(s) in the Virtio Header.
 
   @param[in] This This instance of VIRTIO_DEVICE_PROTOCOL
 
-  @param[in] Address  The 32-bit Queue Address field
+  @param[in] Ring The initialized VRING object to take the
+  addresses from.
 
   @retval EFI_SUCCESS The data was written successfully.
   @retval EFI_UNSUPPORTED The underlying IO device doesn't support the
   provided address offset and write size.
 **/
 typedef
 EFI_STATUS
 (EFIAPI *VIRTIO_SET_QUEUE_ADDRESS) (
   IN VIRTIO_DEVICE_PROTOCOL  *This,
-  IN UINT32   Address
+  IN VRING   *Ring
   );
 
 /**
 
   Write the queue select field in the Virtio Header.
 
   Writing to the queue select field sets the index of the queue to which
diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h 
b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
index 3b1e90ba9f3b..4130dbc043df 100644
--- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
+++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
@@ -108,16 +108,16 @@ EFIAPI
 VirtioMmioSetQueueSel (
   VIRTIO_DEVICE_PROTOCOL *This,
   UINT16  Sel
   );
 
 EFI_STATUS
 VirtioMmioSetQueueAddress (
-  VIRTIO_DEVICE_PROTOCOL *This,
-  UINT32  Address
+  IN VIRTIO_DEVICE_PROTOCOL  *This,
+  IN VRING   *Ring
   );
 
 EFI_STATUS
 EFIAPI
 VirtioMmioSetQueueAlignment (
   VIRTIO_DEVICE_PROTOCOL *This,
   UINT32  Alignment
diff --git a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h 
b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h
index 95f82611e295..8f17a16c88f5 100644
--- a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h
+++ b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h
@@ -120,16 +120,16 @@ VirtioPciSetGuestFeatures (
   IN VIRTIO_DEVICE_PROTOCOL  *This,
   IN UINT64   Features
   );
 
 EFI_STATUS
 EFIAPI
 VirtioPciSetQueueAddress (
-  VIRTIO_DEVICE_PROTOCOL *This,
-  UINT32 Address
+  IN VIRTIO_DEVICE_PROTOCOL  *This,
+  IN VRING   *Ring
   );
 
 EFI_STATUS
 EFIAPI
 VirtioPciSetQueueSel (
   VIRTIO_DEVICE_PROTOCOL *This,
   UINT16 Sel
diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c 
b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c
index 2cd293ab88d9..53c734f6b1af 100644
--- 

[edk2] [wave 3 PATCH v2 02/17] OvmfPkg: VIRTIO_DEVICE_PROTOCOL: remove GetQueueAddress() member

2016-04-06 Thread Laszlo Ersek
This function was never consumed by drivers, and the current prototype is
unsupportable with virtio-1.0. Remove the function from the protocol
definition, and drop the current (unused) implementations.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
Tested-by: Ard Biesheuvel 
Reviewed-by: Jordan Justen 
---
 OvmfPkg/Include/Protocol/VirtioDevice.h | 22 

 OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h  |  7 ---
 OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h|  7 ---
 OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c  |  1 -
 OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c | 20 
--
 OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c|  1 -
 OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c | 19 
-
 7 files changed, 77 deletions(-)

diff --git a/OvmfPkg/Include/Protocol/VirtioDevice.h 
b/OvmfPkg/Include/Protocol/VirtioDevice.h
index 15750f450cb2..f8afa7120a4c 100644
--- a/OvmfPkg/Include/Protocol/VirtioDevice.h
+++ b/OvmfPkg/Include/Protocol/VirtioDevice.h
@@ -123,35 +123,14 @@ typedef
 EFI_STATUS
 (EFIAPI *VIRTIO_SET_GUEST_FEATURES) (
   IN VIRTIO_DEVICE_PROTOCOL  *This,
   IN UINT64   Features
   );
 
 /**
-  Read the queue address field from the Virtio Header.
-
-  QueueAddress is the address of the virtqueue divided by 4096.
-
-  @param[in] This This instance of VIRTIO_DEVICE_PROTOCOL
-
-  @param[out] QueueAddressThe 32-bit queue address field.
-
-  @retval EFI_SUCCESS The data was read successfully.
-  @retval EFI_UNSUPPORTED The underlying IO device doesn't support the
-  provided address offset and read size.
-  @retval EFI_INVALID_PARAMETER   QueueAddress is NULL
-**/
-typedef
-EFI_STATUS
-(EFIAPI *VIRTIO_GET_QUEUE_ADDRESS) (
-  IN  VIRTIO_DEVICE_PROTOCOL *This,
-  OUT UINT32 *QueueAddress
-  );
-
-/**
   Write the queue address field in the Virtio Header.
 
   The parameter Address must be the base address of the virtqueue divided
   by 4096.
 
   @param[in] This This instance of VIRTIO_DEVICE_PROTOCOL
 
@@ -352,15 +331,14 @@ struct _VIRTIO_DEVICE_PROTOCOL {
   UINT32  Revision;
   /// From the Virtio Spec
   INT32   SubSystemDeviceId;
 
   VIRTIO_GET_DEVICE_FEATURES  GetDeviceFeatures;
   VIRTIO_SET_GUEST_FEATURES   SetGuestFeatures;
 
-  VIRTIO_GET_QUEUE_ADDRESSGetQueueAddress;
   VIRTIO_SET_QUEUE_ADDRESSSetQueueAddress;
 
   VIRTIO_SET_QUEUE_SELSetQueueSel;
 
   VIRTIO_SET_QUEUE_NOTIFY SetQueueNotify;
 
   VIRTIO_SET_QUEUE_ALIGN  SetQueueAlign;
diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h 
b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
index d445c3dc197d..3b1e90ba9f3b 100644
--- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
+++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
@@ -66,21 +66,14 @@ EFIAPI
 VirtioMmioGetDeviceFeatures (
   IN VIRTIO_DEVICE_PROTOCOL *This,
   OUT UINT64*DeviceFeatures
   );
 
 EFI_STATUS
 EFIAPI
-VirtioMmioGetQueueAddress (
-  IN  VIRTIO_DEVICE_PROTOCOL *This,
-  OUT UINT32 *QueueAddress
-  );
-
-EFI_STATUS
-EFIAPI
 VirtioMmioGetQueueSize (
   IN  VIRTIO_DEVICE_PROTOCOL  *This,
   OUT UINT16  *QueueNumMax
   );
 
 EFI_STATUS
 EFIAPI
diff --git a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h 
b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h
index 812061dc0c25..95f82611e295 100644
--- a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h
+++ b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h
@@ -84,21 +84,14 @@ EFIAPI
 VirtioPciGetDeviceFeatures (
   IN VIRTIO_DEVICE_PROTOCOL *This,
   OUT UINT64*DeviceFeatures
   );
 
 EFI_STATUS
 EFIAPI
-VirtioPciGetQueueAddress (
-  IN  VIRTIO_DEVICE_PROTOCOL *This,
-  OUT UINT32 *QueueAddress
-  );
-
-EFI_STATUS
-EFIAPI
 VirtioPciGetQueueSize (
   IN  VIRTIO_DEVICE_PROTOCOL  *This,
   OUT UINT16  *QueueNumMax
   );
 
 EFI_STATUS
 EFIAPI
diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c 
b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
index 4af9dd0ac296..b1d443ea7007 100644
--- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
+++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
@@ -21,15 +21,14 @@
 #include "VirtioMmioDevice.h"
 
 static VIRTIO_DEVICE_PROTOCOL mMmioDeviceProtocolTemplate = {
 0, // Revision
 0, // SubSystemDeviceId
 VirtioMmioGetDeviceFeatures,   // GetDeviceFeatures
 VirtioMmioSetGuestFeatures,   

[edk2] [wave 3 PATCH v2 07/17] OvmfPkg: IndustryStandard: factor out Virtio095Net.h

2016-04-06 Thread Laszlo Ersek
In the upcoming virtio-1.0 series, we'll introduce "Virtio10Net.h".
However, the "VirtioNet.h" header file should continue to expose the
Virtio Network Device specific type and macro definitions for all virtio
versions that OvmfPkg supports. Therefore extract "Virtio095Net.h" like
this:

  VirtioNet.h -> Virtio095Net.h

so that in the upcoming patches, we can insert "Virtio10Net.h" in the
middle of the inclusion chain.

This follows the example of "Acpi.h" and "Pci.h" under
"MdePkg/Include/IndustryStandard".

Cc: Jordan Justen 
Cc: Ard Biesheuvel 
Suggested-by: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---

Notes:
v2:
- new in v2 [Jordan]

 OvmfPkg/Include/IndustryStandard/{VirtioNet.h => Virtio095Net.h} | 10 +--
 OvmfPkg/Include/IndustryStandard/VirtioNet.h | 81 
+---
 2 files changed, 8 insertions(+), 83 deletions(-)

diff --git a/OvmfPkg/Include/IndustryStandard/VirtioNet.h 
b/OvmfPkg/Include/IndustryStandard/Virtio095Net.h
similarity index 91%
copy from OvmfPkg/Include/IndustryStandard/VirtioNet.h
copy to OvmfPkg/Include/IndustryStandard/Virtio095Net.h
index 34bf15a5883d..819604289efa 100644
--- a/OvmfPkg/Include/IndustryStandard/VirtioNet.h
+++ b/OvmfPkg/Include/IndustryStandard/Virtio095Net.h
@@ -1,27 +1,27 @@
 /** @file
   Virtio Network Device specific type and macro definitions corresponding to
   the virtio-0.9.5 specification.
 
-  Copyright (C) 2013, Red Hat, Inc.
+  Copyright (C) 2013-2016, 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.
 
 **/
 
-#ifndef _VIRTIO_NET_H_
-#define _VIRTIO_NET_H_
+#ifndef _VIRTIO_0_9_5_NET_H_
+#define _VIRTIO_0_9_5_NET_H_
 
-#include 
+#include 
 
 //
 // virtio-0.9.5, Appendix C: Network Device
 //
 #pragma pack(1)
 typedef struct {
   UINT8  Mac[6];
@@ -90,8 +90,8 @@ typedef struct {
 
 //
 // Link Status Bits in VIRTIO_NET_CONFIG.LinkStatus
 //
 #define VIRTIO_NET_S_LINK_UP  BIT0
 #define VIRTIO_NET_S_ANNOUNCE BIT1
 
-#endif // _VIRTIO_NET_H_
+#endif // _VIRTIO_0_9_5_NET_H_
diff --git a/OvmfPkg/Include/IndustryStandard/VirtioNet.h 
b/OvmfPkg/Include/IndustryStandard/VirtioNet.h
index 34bf15a5883d..db4882abaef3 100644
--- a/OvmfPkg/Include/IndustryStandard/VirtioNet.h
+++ b/OvmfPkg/Include/IndustryStandard/VirtioNet.h
@@ -1,97 +1,22 @@
 /** @file
   Virtio Network Device specific type and macro definitions corresponding to
-  the virtio-0.9.5 specification.
+  the virtio specifications.
 
-  Copyright (C) 2013, Red Hat, Inc.
+  Copyright (C) 2013-2016, 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.
 
 **/
 
 #ifndef _VIRTIO_NET_H_
 #define _VIRTIO_NET_H_
 
-#include 
-
-//
-// virtio-0.9.5, Appendix C: Network Device
-//
-#pragma pack(1)
-typedef struct {
-  UINT8  Mac[6];
-  UINT16 LinkStatus;
-} VIRTIO_NET_CONFIG;
-#pragma pack()
-
-#define OFFSET_OF_VNET(Field) OFFSET_OF (VIRTIO_NET_CONFIG, Field)
-#define SIZE_OF_VNET(Field)   (sizeof ((VIRTIO_NET_CONFIG *) 0)->Field)
-
-//
-// Queue Identifiers
-//
-#define VIRTIO_NET_Q_RX 0
-#define VIRTIO_NET_Q_TX 1
-
-//
-// Feature Bits
-//
-#define VIRTIO_NET_F_CSUM   BIT0  // host to checksum outgoing packets
-#define VIRTIO_NET_F_GUEST_CSUM BIT1  // guest to checksum incoming packets
-#define VIRTIO_NET_F_MACBIT5  // MAC available to guest
-#define VIRTIO_NET_F_GSOBIT6  // deprecated
-#define VIRTIO_NET_F_GUEST_TSO4 BIT7  // guest can receive TSOv4
-#define VIRTIO_NET_F_GUEST_TSO6 BIT8  // guest can receive TSOv6
-#define VIRTIO_NET_F_GUEST_ECN  BIT9  // guest can receive TSO with ECN
-#define VIRTIO_NET_F_GUEST_UFO  BIT10 // guest can receive UFO
-#define VIRTIO_NET_F_HOST_TSO4  BIT11 // host can receive TSOv4
-#define VIRTIO_NET_F_HOST_TSO6  BIT12 // host can receive TSOv6
-#define VIRTIO_NET_F_HOST_ECN   BIT13 // host can receive TSO with ECN
-#define VIRTIO_NET_F_HOST_UFO   BIT14 // host can receive UFO
-#define VIRTIO_NET_F_MRG_RXBUF  BIT15 // guest can merge receive buffers
-#define VIRTIO_NET_F_STATUS BIT16 // link status available to guest
-#define 

[edk2] [wave 3 PATCH v2 04/17] OvmfPkg: VirtioBlkDxe: don't clear non-negotiable feature bits

2016-04-06 Thread Laszlo Ersek
VirtioBlkDxe only recognizes virtio-block feature bits that the device
offers non-negotiably. Nonetheless, in preparation for the following
patches, don't try to clear them even for simplicity.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
Tested-by: Ard Biesheuvel 
Reviewed-by: Jordan Justen 
---
 OvmfPkg/VirtioBlkDxe/VirtioBlk.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
index daccc7a5d06b..8257effac22d 100644
--- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
+++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
@@ -733,20 +733,19 @@ VirtioBlkInit (
   Status = Dev->VirtIo->SetQueueAddress (Dev->VirtIo, >Ring);
   if (EFI_ERROR (Status)) {
 goto ReleaseQueue;
   }
 
 
   //
-  // step 5 -- Report understood features. There are no virtio-blk specific
-  // features to negotiate in virtio-0.9.5, plus we do not want any of the
-  // device-independent (known or unknown) VIRTIO_F_* capabilities (see
-  // Appendix B).
+  // step 5 -- Report understood features.
   //
-  Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, 0);
+  Features &= VIRTIO_BLK_F_BLK_SIZE | VIRTIO_BLK_F_TOPOLOGY | VIRTIO_BLK_F_RO |
+  VIRTIO_BLK_F_FLUSH;
+  Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features);
   if (EFI_ERROR (Status)) {
 goto ReleaseQueue;
   }
 
   //
   // step 6 -- initialization complete
   //
-- 
1.8.3.1


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


[edk2] [wave 3 PATCH v2 05/17] OvmfPkg: VirtioRngDxe: clear all feature bits more explicitly

2016-04-06 Thread Laszlo Ersek
This too is in preparation for the following patches.

After this patch, all four drivers manage their feature bits with explicit
masking.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
Tested-by: Ard Biesheuvel 
Reviewed-by: Jordan Justen 
---
 OvmfPkg/VirtioRngDxe/VirtioRng.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/VirtioRngDxe/VirtioRng.c b/OvmfPkg/VirtioRngDxe/VirtioRng.c
index 290bddeeecae..d916534aac63 100644
--- a/OvmfPkg/VirtioRngDxe/VirtioRng.c
+++ b/OvmfPkg/VirtioRngDxe/VirtioRng.c
@@ -290,15 +290,16 @@ VirtioRngInit (
   }
 
   //
   // step 5 -- Report understood features and guest-tuneables. None are
   // currently defined for VirtioRng, and no generic features are needed by
   // this driver.
   //
-  Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, 0);
+  Features &= 0;
+  Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features);
   if (EFI_ERROR (Status)) {
 goto ReleaseQueue;
   }
 
   //
   // step 6 -- initialization complete
   //
-- 
1.8.3.1


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


[edk2] [wave 3 PATCH v2 01/17] OvmfPkg: VIRTIO_DEVICE_PROTOCOL: widen the Features bitmap to 64 bits

2016-04-06 Thread Laszlo Ersek
The virtio-1.0 spec widens the Features bitmap to 64 bits. Modify the
declarations of the GetDeviceFeatures() and SetGuestFeatures() protocol
member functions accordingly.

Normally, a protocol cannot be changed in incompatible ways if the GUID
stays the same; however, we've always been extremely clear that
VIRTIO_DEVICE_PROTOCOL is internal to edk2. See for example the top of
"OvmfPkg/Include/Protocol/VirtioDevice.h".

In this patch, all producers and consumers of the GetDeviceFeatures() and
SetGuestFeatures() protocol members are updated.

The drivers that currently produce these members are "legacy" drivers (in
virtio-1.0 terminology), and they cannot (and will not) handle feature
bits above BIT31. Therefore their conversion is only for compatibility
with the modified protocol interface. The consumers will be responsible
for checking the VIRTIO_DEVICE_PROTOCOL.Revision field, and for not
passing feature bits that these backends cannot handle.

The VirtioMmioGetDeviceFeatures() implementation stores the result of an
MmioRead32() call with normal assignment, so it needs no change beyond
adapting its prototype.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
Tested-by: Ard Biesheuvel 
Reviewed-by: Jordan Justen 
---
 OvmfPkg/Include/Protocol/VirtioDevice.h |  8 
 OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h  |  4 ++--
 OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h|  4 ++--
 OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c | 10 +++---
 OvmfPkg/VirtioBlkDxe/VirtioBlk.c|  2 +-
 OvmfPkg/VirtioNetDxe/DriverBinding.c|  2 +-
 OvmfPkg/VirtioNetDxe/SnpInitialize.c|  2 +-
 OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c | 17 
+
 OvmfPkg/VirtioRngDxe/VirtioRng.c|  2 +-
 OvmfPkg/VirtioScsiDxe/VirtioScsi.c  |  2 +-
 10 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/OvmfPkg/Include/Protocol/VirtioDevice.h 
b/OvmfPkg/Include/Protocol/VirtioDevice.h
index 48fca2e14c25..15750f450cb2 100644
--- a/OvmfPkg/Include/Protocol/VirtioDevice.h
+++ b/OvmfPkg/Include/Protocol/VirtioDevice.h
@@ -93,41 +93,41 @@ EFI_STATUS
   );
 
 /**
   Read the device features field from the Virtio Header.
 
   @param[in] This This instance of VIRTIO_DEVICE_PROTOCOL
 
-  @param[out] DeviceFeatures  The 32-bit device features field.
+  @param[out] DeviceFeatures  The device features field.
 
   @retval EFI_SUCCESS The data was read successfully.
   @retval EFI_UNSUPPORTED The underlying IO device doesn't support the
   provided address offset and read size.
   @retval EFI_INVALID_PARAMETER   DeviceFeatures is NULL
 **/
 typedef
 EFI_STATUS
 (EFIAPI *VIRTIO_GET_DEVICE_FEATURES) (
   IN VIRTIO_DEVICE_PROTOCOL *This,
-  OUT UINT32*DeviceFeatures
+  OUT UINT64*DeviceFeatures
   );
 
 /**
   Write the guest features field in the Virtio Header.
 
   @param[in] This This instance of VIRTIO_DEVICE_PROTOCOL
 
-  @param[in] Features The 32-bit guest guest features field
+  @param[in] Features The guest features field
 
 **/
 typedef
 EFI_STATUS
 (EFIAPI *VIRTIO_SET_GUEST_FEATURES) (
   IN VIRTIO_DEVICE_PROTOCOL  *This,
-  IN UINT32   Features
+  IN UINT64   Features
   );
 
 /**
   Read the queue address field from the Virtio Header.
 
   QueueAddress is the address of the virtqueue divided by 4096.
 
diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h 
b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
index 3e4e5606ccad..d445c3dc197d 100644
--- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
+++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
@@ -61,15 +61,15 @@ VirtioMmioDeviceWrite (
   IN  UINT64Value
   );
 
 EFI_STATUS
 EFIAPI
 VirtioMmioGetDeviceFeatures (
   IN VIRTIO_DEVICE_PROTOCOL *This,
-  OUT UINT32*DeviceFeatures
+  OUT UINT64*DeviceFeatures
   );
 
 EFI_STATUS
 EFIAPI
 VirtioMmioGetQueueAddress (
   IN  VIRTIO_DEVICE_PROTOCOL *This,
   OUT UINT32 *QueueAddress
@@ -137,11 +137,11 @@ VirtioMmioSetPageSize (
   UINT32  PageSize
   );
 
 EFI_STATUS
 EFIAPI
 VirtioMmioSetGuestFeatures (
   VIRTIO_DEVICE_PROTOCOL *This,
-  UINT32  Features
+  UINT64  Features
   );
 
 #endif // _VIRTIO_MMIO_DEVICE_INTERNAL_H_
diff --git a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h 
b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h
index 6311ae849d18..812061dc0c25 100644
--- 

Re: [edk2] [PATCH 0/4] Move S3Ready() functional code from AcpiS3SaveDxe to S3SaveStateDxe

2016-04-06 Thread Zeng, Star

On 2016/4/1 1:12, Laszlo Ersek wrote:

On 03/31/16 17:10, Zeng, Star wrote:

On 2016/3/31 19:47, Laszlo Ersek wrote:



Therefore, if this subsystem in edk2 is being reworked, my preference
would be the following:

(1) Please fix the DepEx bug in BootScriptExecutorDxe first, if
possible. Instead, BootScriptExecutorDxe should *inherit* such a DepEx,
from the appropriate LockBox library instance.


DepEx for BootScriptExecutorDxe may could be removed, but LockBox
protocol is still needed to be installed (at least at SMM lock box
solution) as there is other driver that has callback on LockBox
protocol, for example FirmwarePerformanceDxe driver need have entrypoint
run as early as possible and has callback on LockBox protocol to save
lock box data, although FirmwarePerformanceDxe  is not included in OVMF.
I prefer to keep the Depex for BootScriptExecutorDxe.


Okay, that works for me.


(2) If option (1) above is not possible -- or would be extremely messy
--, then I'm fine to stick with the current DepEx. In this case however,
the SMM-less build of OVMF will have to continue installing the fake
protocol interface, hence I would like to continue abusing the DepEx bug
for saving memory as well. Therefore, the installation of the fake
lockbox protocol interface should continue to depend on *both*
QemuFwCfgS3Enabled() *and* (!PcdSmmSmramRequire).

Furthermore, you will notice that OVMF offers no QemuFwCfgLib instance
-- no QemuFwCfgS3Enabled() function -- that is suitable for the
DXE_CORE. Which means you won't be able to implement my above request in
code that is supposed to run within the DXE_CORE.


Do not know that before, thanks for the info.

Yes, QemuFwCfgS3Enabled() can be used in LockBoxDxeLib.
When S3 enabled, LockBox protocol will be installed on the ImageHandle
of the first driver LockBoxDxeLib linked.
When S3 disabled, LockBox protocol will be not installed.
No need to check PcdSmmSmramRequire as LockBoxDxeLib will be not and
built and linked at PcdSmmSmramRequire = TRUE.
Then the behavior about the LockBox protocol installation will be with
current OVMF AcpiS3SaveDxe.


Okay.

Also, good point about LockBoxDxeLib not being used in the SMM-ful build
anyway -- in fact the shared LockBoxLibInitialize() function in
"OvmfPkg/Library/LockBoxLib/LockBoxLib.c" ASSERT()s that
PcdSmmSmramRequire is turned off.


(3) It should remain possible for OVMF to prevent the new driver from
saving the ACPI S3 Context (i.e., prevent the installation of the
End-of-DXE callback) if QEMU S3 support is disabled. If you add a
dynamic boolean PCD for this, that could work; OVMF could set that PCD
during PEI.


In the EndOfDxe callback: AcpiS3ContextSaveOnEndOfDxe can check if
LockBox protocol has been installed, if not, return with event closed
directly.


H, this is not good enough, I'm afraid. Namely, in the SMM build,
the LockBox protocol (the real one) will be installed unconditionally.
And, even for the SMM build, S3 can be disabled on the QEMU command line
dynamically -- it is a valid configuration.

In this case, the ACPI S3 Context should not be saved.


What do you think about my other idea:


I will go to introduce a new PCD 
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable that can be easily 
configured and consumed.

V2 patch series will be sent out soon, please take review to them.

Thanks,
Star




Actually, here's an idea that should solve it all, without a new PCD:
you could introduce a small library class that S3SaveStateDxe would
depend on, and the platform would provide. The platform would provide an
initialization function, and S3SaveStateDxe would call the function
early.

The entry point function of S3SaveStateDxe, InitializeS3SaveState(),
only installs EFI_S3_SAVE_STATE_PROTOCOL at the moment. With your
current patch series, the End-of-DXE callback installation is added to
the entry point function as well. Calling the platform init function
that I'm talking about before *both* of those steps would be optimal.

In OVMF's library instance, OVMF could force S3SaveStateDxe to exit
early (with EFI_ABORTED or EFI_LOAD_ERROR), *without* triggering an
assertion failure. Plus, OVMF could also install the fake lockbox
protocol interface explicitly, if necessary, in this initialization
function.

Beyond preserving the various features discussed above, this approach
would also prevent the installation of EFI_S3_SAVE_STATE_PROTOCOL, if
QEMU S3 is disabled. That's fine -- OVMF already makes sure that it
consumes that protocol (i.e., writes an S3 boot script) only if QEMU S3
is enabled.

I think this is the approach I would prefer the most -- a new library
class with a single initialization function (not a constructor!),
provided by the platform, and called by S3SaveStateDxe as the very first
step in the entry point. If this function fails, then S3SaveStateDxe
should exit in a *controlled* manner (not a failed ASSERT()).


Again, this would be my first preference.

Now, I do realize that you might not want to 

Re: [edk2] [PATCH] MdeModulePkg/UefiBootManagerLib: API BmIsValidLoadOptionVariableName

2016-04-06 Thread Wang, Sunny (HPS SW)
Looks good to me.
Reviewed-by: Sunny Wang 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Palmer, 
Thomas
Sent: Tuesday, April 05, 2016 3:52 AM
To: edk2-devel@lists.01.org
Cc: ruiyu...@intel.com; feng.t...@intel.com; star.z...@intel.com
Subject: [edk2] [PATCH] MdeModulePkg/UefiBootManagerLib: API 
BmIsValidLoadOptionVariableName

Redfine the BmIsValidLoadOptionVariableName function to allow public use. 
Change name to EfiBootManagerIsValidLoadOptionVariableName to match naming 
scheme. Check that VariableName is never NULL and allow OptionType and 
OptionNumber to be optional.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Thomas Palmer 
---
 MdeModulePkg/Include/Library/UefiBootManagerLib.h  | 23 -
 .../Library/UefiBootManagerLib/BmLoadOption.c  | 38 ++
 2 files changed, 46 insertions(+), 15 deletions(-)

diff --git a/MdeModulePkg/Include/Library/UefiBootManagerLib.h 
b/MdeModulePkg/Include/Library/UefiBootManagerLib.h
index afb4271..e3555b5 100644
--- a/MdeModulePkg/Include/Library/UefiBootManagerLib.h
+++ b/MdeModulePkg/Include/Library/UefiBootManagerLib.h
@@ -2,7 +2,7 @@
   Provide Boot Manager related library APIs.
 
 Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP
+(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -731,4 +731,25 
@@ EFIAPI  EfiBootManagerProcessLoadOption (
   EFI_BOOT_MANAGER_LOAD_OPTION   *LoadOption
   );
+
+/**
+  Check whether the VariableName is a valid load option variable name
+  and return the load option type and option number.
+
+  @param VariableName The name of the load option variable.
+  @param OptionType   Return the load option type.
+  @param OptionNumber Return the load option number.
+
+  @retval TRUE  The variable name is valid; The load option type and
+load option number is returned.
+  @retval FALSE The variable name is NOT valid.
+**/
+BOOLEAN
+EFIAPI
+EfiBootManagerIsValidLoadOptionVariableName (
+  IN CHAR16 *VariableName,
+  OUT EFI_BOOT_MANAGER_LOAD_OPTION_TYPE *OptionType   OPTIONAL,
+  OUT UINT16*OptionNumber OPTIONAL
+  );
+
 #endif
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
index 696e995..8201255 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
@@ -2,7 +2,7 @@
   Load option library functions which relate with creating and processing load 
options.
 
 Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP
+(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -775,16 +775,21 
@@ BmValidateOption (
   @retval FALSE The variable name is NOT valid.
 **/
 BOOLEAN
-BmIsValidLoadOptionVariableName (
+EFIAPI
+EfiBootManagerIsValidLoadOptionVariableName (
   IN CHAR16 *VariableName,
-  OUT EFI_BOOT_MANAGER_LOAD_OPTION_TYPE *OptionType,
-  OUT UINT16*OptionNumber
+  OUT EFI_BOOT_MANAGER_LOAD_OPTION_TYPE *OptionType   OPTIONAL,
+  OUT UINT16*OptionNumber OPTIONAL
   )
 {
   UINTN VariableNameLen;
   UINTN Index;
   UINTN Uint;
 
+  if (VariableName == NULL) {
+return FALSE;
+  }
+
   VariableNameLen = StrLen (VariableName);
 
   if (VariableNameLen <= 4) {
@@ -803,14 +808,19 @@ BmIsValidLoadOptionVariableName (
 return FALSE;
   }
 
-  *OptionType = (EFI_BOOT_MANAGER_LOAD_OPTION_TYPE) Index;
-  *OptionNumber = 0;
-  for (Index = VariableNameLen - 4; Index < VariableNameLen; Index++) {
-Uint = BmCharToUint (VariableName[Index]);
-if (Uint == -1) {
-  break;
-} else {
-  *OptionNumber = (UINT16) Uint + *OptionNumber * 0x10;
+  if (OptionType != NULL) {
+*OptionType = (EFI_BOOT_MANAGER_LOAD_OPTION_TYPE) Index;  }
+
+  if (OptionNumber != NULL) {
+*OptionNumber = 0;
+for (Index = VariableNameLen - 4; Index < VariableNameLen; Index++) {
+  Uint = BmCharToUint (VariableName[Index]);
+  if (Uint == -1) {
+break;
+  } else {
+*OptionNumber = (UINT16) Uint + *OptionNumber * 0x10;
+  }
 }
   }
 
@@ -853,7 +863,7 @@ 

[edk2] SMBUS device address mapping

2016-04-06 Thread Galla Rao
Hello All,


Am trying to get SMBUS slave addresses

(EFIAPI *EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE) (
  IN EFI_SMBUS_HC_PROTOCOL  * This,
  IN  BOOLEAN   ArpAll,
  IN  EFI_SMBUS_UDID* SmbusUdid, OPTIONAL
  IN OUT  EFI_SMBUS_DEVICE_ADDRESS  * SlaveAddress OPTIONAL
  );

The function returns EFI_SUCCESS.

There are no values in SmbusUdid,SlaveAddress

Also called ArpMap, This function also returns EFI_SUCCESS but there are no
values in SmbusDeviceMap

EFI_STATUS
(EFIAPI *EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP) (
  IN EFI_SMBUS_HC_PROTOCOL  * This,
  IN OUT  UINTN *Length,
  IN OUT  EFI_SMBUS_DEVICE_MAP  **SmbusDeviceMap
  );


Please let me know whether the UEFI SMBUS driver does not publish this data?

What is the alternative mechanism to get all the SMBUS slave address which
are enumerated under SMBUS

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


Re: [edk2] [Patch] NetworkPkg: Add RAM disk boot support to HTTP Boot driver.

2016-04-06 Thread Ye, Ting
Siyuan,

Some minor comments to the patch:

1. Add perform parameter check  for ImageType in HttpBootGetFileFromCache().
2. Update function description of HttpBootStart/HttpBootLoadFile for 
EFI_INVALID_PARAMETER since we now add further check.
3. Add EFI_INVALID_PARAMETER to function description of HttpBootCheckImageType
4. In HttpBootCheckImageType, ImageType is checked but others are skipped. Not 
necessary?
5. Is EFI_NOT_FOUND irrelevant to HttpBootRegisterRamDisk? I see 
EFI_UNSUPPORTED returned below. Please double check.

Others are good to me.

Reviewed-by: Ye Ting 

Thanks,
Ting


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Fu Siyuan
Sent: Thursday, March 31, 2016 11:37 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; Wu, Jiaxin 
Subject: [edk2] [Patch] NetworkPkg: Add RAM disk boot support to HTTP Boot 
driver.

This patch updates the HTTP Boot driver to support the download and boot a RAM 
disk image from HTTP server.
The HTTP RAM disk boot is described in section 23.7 "HTTP Boot" in UEFI 2.6. 
HTTP server could provide either an UEFI image or a RAM disk image for the HTTP 
boot client to use. The RAM disk image must contain a UEFI compliant file 
system in it.
HTTP boot driver will identify the image type either by the "Content-Type"
entity header filed or by the file name extension as below:
  "application/efi" or *.efi -> EFI Image
  *.iso  -> CD/DVD Image
  *.img  -> Virtual Disk Image

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Cc: El-Haj-Mahmoud Samer 
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c  |  35 ++--
 NetworkPkg/HttpBootDxe/HttpBootClient.h  |   5 +-
 NetworkPkg/HttpBootDxe/HttpBootDxe.h |  19 +
 NetworkPkg/HttpBootDxe/HttpBootDxe.inf   |   3 +
 NetworkPkg/HttpBootDxe/HttpBootImpl.c| 130 ++---
 NetworkPkg/HttpBootDxe/HttpBootSupport.c | 135 +++ 
 NetworkPkg/HttpBootDxe/HttpBootSupport.h |  44 ++
 7 files changed, 319 insertions(+), 52 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index 0c47293..0e30b22 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -570,6 +570,7 @@ HttpBootFreeCacheList (
   @param[out] Buffer  The memory buffer to transfer the file 
to. IF Buffer is NULL,
   then the size of the requested file is 
returned in
   BufferSize.
+  @param[out] ImageType   The image type of the downloaded file.
 
   @retval EFI_SUCCESS  Successfully created.
   @retval Others   Failed to create HttpIo.
@@ -580,7 +581,8 @@ HttpBootGetFileFromCache (
   IN HTTP_BOOT_PRIVATE_DATA   *Private,
   IN CHAR16   *Uri,
   IN OUT UINTN*BufferSize,
- OUT UINT8*Buffer
+ OUT UINT8*Buffer,
+ OUT HTTP_BOOT_IMAGE_TYPE *ImageType
   )
 {
   LIST_ENTRY  *Entry;
@@ -603,7 +605,12 @@ HttpBootGetFileFromCache (
 (StrCmp (Uri, Cache->RequestData->Url) == 0)) 
 {
   //
-  // Hit cache, check buffer size.
+  // Hit in cache, record image type.
+  //
+  *ImageType  = Cache->ImageType;
+
+  //
+  // Check buffer size.
   //
   if (*BufferSize < Cache->EntityLength) {
 *BufferSize = Cache->EntityLength; @@ -712,6 +719,7 @@ 
HttpBootGetBootFileCallback (
   @param[out]  Buffer  The memory buffer to transfer the file to. 
IF Buffer is NULL,
then the size of the requested file is 
returned in
BufferSize.
+  @param[out]  ImageType   The image type of the downloaded file.
 
   @retval EFI_SUCCESS  The file was loaded.
   @retval EFI_INVALID_PARAMETERBufferSize is NULL or Buffer Size is not 
NULL but Buffer is NULL.
@@ -727,7 +735,8 @@ HttpBootGetBootFile (
   IN HTTP_BOOT_PRIVATE_DATA   *Private,
   IN BOOLEAN  HeaderOnly,
   IN OUT UINTN*BufferSize,
- OUT UINT8*Buffer
+ OUT UINT8*Buffer,
+ OUT HTTP_BOOT_IMAGE_TYPE *ImageType
   )
 {
   EFI_STATUS Status;
@@ -750,7 +759,7 @@ HttpBootGetBootFile (
   ASSERT (Private != NULL);
   ASSERT (Private->HttpCreated);
 
-  if (BufferSize == NULL) {
+  if (BufferSize == NULL || ImageType == NULL) {
 return EFI_INVALID_PARAMETER;
   }
 
@@ -767,7 +776,7 @@ HttpBootGetBootFile (
   }
   AsciiStrToUnicodeStr (Private->BootFileUri, Url);
   if (!HeaderOnly) {
-Status = 

Re: [edk2] [PATCH v2 2/2] NetworkPkg: Add new macros and refine codes

2016-04-06 Thread Zhang, Lubo
Yes , the label of the patch should be PATCH v2 1/2,  may be the patch order 
generated upside down.
thanks for review.

Lubo 
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Subramanian, Sriram (EG Servers Platform SW)
Sent: Wednesday, April 06, 2016 4:27 PM
To: Zhang, Lubo ; edk2-devel@lists.01.org
Cc: Ye, Ting ; Fu, Siyuan ; Wu, Jiaxin 

Subject: Re: [edk2] [PATCH v2 2/2] NetworkPkg: Add new macros and refine codes

I believe this is PATCH v2 1/2, and not 2/2 as stated in the subject.

Looks fine.
Reviewed-by: Sriram Subramanian 

Thanks,
Sriram.

-Original Message-
From: Zhang Lubo [mailto:lubo.zh...@intel.com]
Sent: Wednesday, April 6, 2016 11:53 AM
To: edk2-devel@lists.01.org
Cc: Subramanian, Sriram (EG Servers Platform SW) ; Fu Siyuan 
; Ye Ting ; Wu Jiaxin 

Subject: [PATCH v2 2/2] NetworkPkg: Add new macros and refine codes

v2:
*refine some codes

Add 2 macros in NetLib.h
#define  IP4_MASK_MAX  32
#define  IP6_PREFIX_MAX128
we will use these two macros to check the max mask/prefix length, instead of
#define  IP4_MASK_NUM  33
#define  IP6_PREFIX_NUM129
which means a valid number
This will make the code readability and maintainability.

Cc: Subramanian Sriram 
Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/Ip6Dxe/Ip6Common.c | 4 ++--
 NetworkPkg/Ip6Dxe/Ip6Icmp.c   | 4 ++--
 NetworkPkg/Ip6Dxe/Ip6Impl.c   | 2 +-
 NetworkPkg/Ip6Dxe/Ip6Nd.c | 2 +-
 NetworkPkg/Ip6Dxe/Ip6Route.c  | 8 
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/NetworkPkg/Ip6Dxe/Ip6Common.c b/NetworkPkg/Ip6Dxe/Ip6Common.c 
index 4f71d05..fc9bb6c 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Common.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Common.c
@@ -426,11 +426,11 @@ Ip6RemoveAddr (
   LIST_ENTRY   *Entry;
   LIST_ENTRY   *Next;
   IP6_ADDRESS_INFO *AddrInfo;
   EFI_IPv6_ADDRESS SnMCastAddr;
 
-  if (IsListEmpty (AddressList) || *AddressCount < 1 || PrefixLength > 
IP6_PREFIX_NUM) {
+  if (IsListEmpty (AddressList) || *AddressCount < 1 || PrefixLength > 
+ IP6_PREFIX_MAX) {
 return EFI_INVALID_PARAMETER;
   }
 
   Status = EFI_NOT_FOUND;
 
@@ -604,11 +604,11 @@ Ip6CopyAddressByPrefix (
   UINT8 Byte;
   UINT8 Bit;
   UINT8 Mask;
 
   ASSERT (Dest != NULL && Src != NULL);
-  ASSERT (PrefixLength < IP6_PREFIX_NUM);
+  ASSERT (PrefixLength <= IP6_PREFIX_MAX);
 
   Byte = (UINT8) (PrefixLength / 8);
   Bit  = (UINT8) (PrefixLength % 8);
 
   ZeroMem (Dest, sizeof (EFI_IPv6_ADDRESS)); diff --git 
a/NetworkPkg/Ip6Dxe/Ip6Icmp.c b/NetworkPkg/Ip6Dxe/Ip6Icmp.c index 
f6a9bb4..7566395 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Icmp.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Icmp.c
@@ -471,18 +471,18 @@ Ip6GetPrefix (
   UINT8 Byte;
   UINT8 Bit;
   UINT8 Mask;
   UINT8 Value;
 
-  ASSERT ((Prefix != NULL) && (PrefixLength < IP6_PREFIX_NUM));
+  ASSERT ((Prefix != NULL) && (PrefixLength < IP6_PREFIX_MAX));
 
   if (PrefixLength == 0) {
 ZeroMem (Prefix, sizeof (EFI_IPv6_ADDRESS));
 return ;
   }
 
-  if (PrefixLength >= IP6_PREFIX_NUM - 1) {
+  if (PrefixLength >= IP6_PREFIX_MAX) {
 return ;
   }
 
   Byte  = (UINT8) (PrefixLength / 8);
   Bit   = (UINT8) (PrefixLength % 8);
diff --git a/NetworkPkg/Ip6Dxe/Ip6Impl.c b/NetworkPkg/Ip6Dxe/Ip6Impl.c index 
b186c0a..4e827a9 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Impl.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Impl.c
@@ -840,11 +840,11 @@ EfiIp6Routes (
   IP6_PROTOCOL  *IpInstance;
   EFI_STATUSStatus;
   EFI_TPL   OldTpl;
   IP6_SERVICE   *IpSb;
 
-  if ((This == NULL) || (PrefixLength >= IP6_PREFIX_NUM)) {
+  if ((This == NULL) || (PrefixLength > IP6_PREFIX_MAX)) {
 return EFI_INVALID_PARAMETER;
   }
 
   IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This);
   IpSb   = IpInstance->Service;
diff --git a/NetworkPkg/Ip6Dxe/Ip6Nd.c b/NetworkPkg/Ip6Dxe/Ip6Nd.c index 
2c8be42..2cd382c 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Nd.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Nd.c
@@ -196,11 +196,11 @@ Ip6CreatePrefixListEntry (
   IP6_ROUTE_ENTRY   *RtEntry;
   LIST_ENTRY*ListHead;
   LIST_ENTRY*Entry;
   IP6_PREFIX_LIST_ENTRY *TmpPrefixEntry;
 
-  if (Prefix == NULL || PreferredLifetime > ValidLifetime || PrefixLength >= 
IP6_PREFIX_NUM) {
+  if (Prefix == NULL || PreferredLifetime > ValidLifetime || 
+ PrefixLength > IP6_PREFIX_MAX) {
 return NULL;
   }
 
   NET_CHECK_SIGNATURE (IpSb, IP6_SERVICE_SIGNATURE);
 
diff --git a/NetworkPkg/Ip6Dxe/Ip6Route.c b/NetworkPkg/Ip6Dxe/Ip6Route.c 

Re: [edk2] [PATCH v2 2/2] NetworkPkg: Add new macros and refine codes

2016-04-06 Thread Subramanian, Sriram (EG Servers Platform SW)
I believe this is PATCH v2 1/2, and not 2/2 as stated in the subject.

Looks fine.
Reviewed-by: Sriram Subramanian 

Thanks,
Sriram.

-Original Message-
From: Zhang Lubo [mailto:lubo.zh...@intel.com] 
Sent: Wednesday, April 6, 2016 11:53 AM
To: edk2-devel@lists.01.org
Cc: Subramanian, Sriram (EG Servers Platform SW) ; Fu Siyuan 
; Ye Ting ; Wu Jiaxin 

Subject: [PATCH v2 2/2] NetworkPkg: Add new macros and refine codes

v2:
*refine some codes

Add 2 macros in NetLib.h
#define  IP4_MASK_MAX  32
#define  IP6_PREFIX_MAX128
we will use these two macros to check the max mask/prefix length,
instead of
#define  IP4_MASK_NUM  33
#define  IP6_PREFIX_NUM129
which means a valid number
This will make the code readability and maintainability.

Cc: Subramanian Sriram 
Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/Ip6Dxe/Ip6Common.c | 4 ++--
 NetworkPkg/Ip6Dxe/Ip6Icmp.c   | 4 ++--
 NetworkPkg/Ip6Dxe/Ip6Impl.c   | 2 +-
 NetworkPkg/Ip6Dxe/Ip6Nd.c | 2 +-
 NetworkPkg/Ip6Dxe/Ip6Route.c  | 8 
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/NetworkPkg/Ip6Dxe/Ip6Common.c b/NetworkPkg/Ip6Dxe/Ip6Common.c
index 4f71d05..fc9bb6c 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Common.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Common.c
@@ -426,11 +426,11 @@ Ip6RemoveAddr (
   LIST_ENTRY   *Entry;
   LIST_ENTRY   *Next;
   IP6_ADDRESS_INFO *AddrInfo;
   EFI_IPv6_ADDRESS SnMCastAddr;
 
-  if (IsListEmpty (AddressList) || *AddressCount < 1 || PrefixLength > 
IP6_PREFIX_NUM) {
+  if (IsListEmpty (AddressList) || *AddressCount < 1 || PrefixLength > 
IP6_PREFIX_MAX) {
 return EFI_INVALID_PARAMETER;
   }
 
   Status = EFI_NOT_FOUND;
 
@@ -604,11 +604,11 @@ Ip6CopyAddressByPrefix (
   UINT8 Byte;
   UINT8 Bit;
   UINT8 Mask;
 
   ASSERT (Dest != NULL && Src != NULL);
-  ASSERT (PrefixLength < IP6_PREFIX_NUM);
+  ASSERT (PrefixLength <= IP6_PREFIX_MAX);
 
   Byte = (UINT8) (PrefixLength / 8);
   Bit  = (UINT8) (PrefixLength % 8);
 
   ZeroMem (Dest, sizeof (EFI_IPv6_ADDRESS));
diff --git a/NetworkPkg/Ip6Dxe/Ip6Icmp.c b/NetworkPkg/Ip6Dxe/Ip6Icmp.c
index f6a9bb4..7566395 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Icmp.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Icmp.c
@@ -471,18 +471,18 @@ Ip6GetPrefix (
   UINT8 Byte;
   UINT8 Bit;
   UINT8 Mask;
   UINT8 Value;
 
-  ASSERT ((Prefix != NULL) && (PrefixLength < IP6_PREFIX_NUM));
+  ASSERT ((Prefix != NULL) && (PrefixLength < IP6_PREFIX_MAX));
 
   if (PrefixLength == 0) {
 ZeroMem (Prefix, sizeof (EFI_IPv6_ADDRESS));
 return ;
   }
 
-  if (PrefixLength >= IP6_PREFIX_NUM - 1) {
+  if (PrefixLength >= IP6_PREFIX_MAX) {
 return ;
   }
 
   Byte  = (UINT8) (PrefixLength / 8);
   Bit   = (UINT8) (PrefixLength % 8);
diff --git a/NetworkPkg/Ip6Dxe/Ip6Impl.c b/NetworkPkg/Ip6Dxe/Ip6Impl.c
index b186c0a..4e827a9 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Impl.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Impl.c
@@ -840,11 +840,11 @@ EfiIp6Routes (
   IP6_PROTOCOL  *IpInstance;
   EFI_STATUSStatus;
   EFI_TPL   OldTpl;
   IP6_SERVICE   *IpSb;
 
-  if ((This == NULL) || (PrefixLength >= IP6_PREFIX_NUM)) {
+  if ((This == NULL) || (PrefixLength > IP6_PREFIX_MAX)) {
 return EFI_INVALID_PARAMETER;
   }
 
   IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This);
   IpSb   = IpInstance->Service;
diff --git a/NetworkPkg/Ip6Dxe/Ip6Nd.c b/NetworkPkg/Ip6Dxe/Ip6Nd.c
index 2c8be42..2cd382c 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Nd.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Nd.c
@@ -196,11 +196,11 @@ Ip6CreatePrefixListEntry (
   IP6_ROUTE_ENTRY   *RtEntry;
   LIST_ENTRY*ListHead;
   LIST_ENTRY*Entry;
   IP6_PREFIX_LIST_ENTRY *TmpPrefixEntry;
 
-  if (Prefix == NULL || PreferredLifetime > ValidLifetime || PrefixLength >= 
IP6_PREFIX_NUM) {
+  if (Prefix == NULL || PreferredLifetime > ValidLifetime || PrefixLength > 
IP6_PREFIX_MAX) {
 return NULL;
   }
 
   NET_CHECK_SIGNATURE (IpSb, IP6_SERVICE_SIGNATURE);
 
diff --git a/NetworkPkg/Ip6Dxe/Ip6Route.c b/NetworkPkg/Ip6Dxe/Ip6Route.c
index bba365c..af417ad 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Route.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Route.c
@@ -133,11 +133,11 @@ Ip6FindRouteEntry (
 
   ASSERT (Destination != NULL || NextHop != NULL);
 
   RtEntry = NULL;
 
-  for (Index = IP6_PREFIX_NUM - 1; Index >= 0; Index--) {
+  for (Index = IP6_PREFIX_MAX; Index >= 0; Index--) {
 NET_LIST_FOR_EACH (Entry, >RouteArea[Index]) {
   RtEntry = NET_LIST_USER_STRUCT (Entry, IP6_ROUTE_ENTRY, Link);
 
   if (Destination != NULL) {
 if (NetIp6IsNetEqual (Destination, >Destination, 

Re: [edk2] [wave 3 PATCH 00/15] OvmfPkg, ArmVirtPkg: VirtIo 1.0

2016-04-06 Thread Laszlo Ersek
On 04/06/16 07:40, Jordan Justen wrote:
> On 2016-03-14 05:53:17, Laszlo Ersek wrote:
>> This series enables OvmfPkg and ArmVirtPkg to work with non-transitional
>> VirtIo 1.0 PCI devices. The first 12 patches rework our edk2-only,
>> private VIRTIO_DEVICE_PROTOCOL (and its two existent implementations),
>> and adapt the four device drivers we have. (The 1.0 specification is not
>> fully backwards compatible.) This is done without disturbing the current
>> (legacy, 0.9.5) functionality.
>>
>> Patch 13 adds a VIRTIO_DEVICE_PROTOCOL implementation that conforms to
>> VirtIo 1.0.
>>
>> Patches 14 and 15 include the new driver in OvmfPkg and ArmVirtPkg.
>>
>> Public branch: .
>>
>> If you would like to test this series with VirtIo 1.0 devices, patch 13
>> has some instructions about the QEMU command line. If you also want to
>> boot Linux guests on them, then you will need a fairly recent (4.2 or
>> 4.3+) guest kernel, *plus* the following (pending) QEMU bugfix:
>> .
>>
>> Cc: Ard Biesheuvel 
>> Cc: Jordan Justen 
>>
>> Laszlo Ersek (15):
>>   OvmfPkg: VIRTIO_DEVICE_PROTOCOL: widen the Features bitmap to 64 bits
>>   OvmfPkg: VIRTIO_DEVICE_PROTOCOL: remove GetQueueAddress() member
>>   OvmfPkg: VIRTIO_DEVICE_PROTOCOL: pass VRING object to
>> SetQueueAddress()
>>   OvmfPkg: VirtioBlkDxe: don't clear non-negotiable feature bits
>>   OvmfPkg: VirtioRngDxe: clear all feature bits more explicitly
> 
> These 5 are Reviewed-by: Jordan Justen 
> 
>>   OvmfPkg: IndustryStandard: add definitions from the VirtIo 1.0 spec
> 
> I'd like to see Virtio.h and VirtioNet.h get all version defines. (For
> a quick VirtioNet.h hack, what if we include Virtio10Net.h after the
> related 0.95 defs?)

I feel real un-clean about this. I think I changed my mind about "a lot
of churn for nothing".

Let me submit a small patch first, separately, that breaks out
Virtio095.h and Virtio095Net.h, and keeps the current Virtio.h and
VirtioNet.h files as thin wrappers around them.

Then, as another step, I can rebase my main series so that it inserts
the virtio-1.0 definitions (Virtio10Net.h and Virtio10.h) in-between. I
agree this should be cleaner and follow the edk2 practice more closely.

Thanks!
Laszlo

> With that and V0_95:
> Reviewed-by: Jordan Justen 
> 
> (Maybe Acked-by would be more appropriate given that I didn't check
> the actual specs, but it seems like I gave you too much grief to not
> add r-b. :)
> 
>>   OvmfPkg: VirtioLib: add Virtio10WriteFeatures() function
>>   OvmfPkg: VirtioBlkDxe: adapt feature negotiation to virtio-1.0
>>   OvmfPkg: VirtioNetDxe: adapt feature negotiation to virtio-1.0
>>   OvmfPkg: VirtioRngDxe: adapt feature negotiation to virtio-1.0
>>   OvmfPkg: VirtioScsiDxe: adapt feature negotiation to virtio-1.0
>>   OvmfPkg: VirtioNetDxe: adapt virtio-net packet header size to
>> virtio-1.0
> 
> These 6 are Reviewed-by: Jordan Justen 
> 
>>   OvmfPkg: Virtio10Dxe: non-transitional driver for virtio-1.0 PCI
>> devices
> 
> Acked-by: Jordan Justen 
> 
>>   OvmfPkg: include Virtio10Dxe
>>   ArmVirtPkg: include Virtio10Dxe from OvmfPkg
>>
> 
> These 2 are Reviewed-by: Jordan Justen 
> 
>>  ArmVirtPkg/ArmVirtQemu.dsc  |1 +
>>  ArmVirtPkg/ArmVirtQemuKernel.dsc|1 +
>>  OvmfPkg/OvmfPkgIa32.dsc |1 +
>>  OvmfPkg/OvmfPkgIa32X64.dsc  |1 +
>>  OvmfPkg/OvmfPkgX64.dsc  |1 +
>>  ArmVirtPkg/ArmVirtQemu.fdf  |1 +
>>  ArmVirtPkg/ArmVirtQemuKernel.fdf|1 +
>>  OvmfPkg/OvmfPkgIa32.fdf |1 +
>>  OvmfPkg/OvmfPkgIa32X64.fdf  |1 +
>>  OvmfPkg/OvmfPkgX64.fdf  |1 +
>>  OvmfPkg/Virtio10Dxe/Virtio10.inf|   40 +
>>  OvmfPkg/Include/IndustryStandard/Virtio10.h |   81 ++
>>  OvmfPkg/Include/IndustryStandard/Virtio10Net.h  |   31 +
>>  OvmfPkg/Include/Library/VirtioLib.h |   47 +
>>  OvmfPkg/Include/Protocol/VirtioDevice.h |   42 +-
>>  OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h  |   15 +-
>>  OvmfPkg/Virtio10Dxe/Virtio10.h  |   56 ++
>>  OvmfPkg/VirtioNetDxe/VirtioNet.h|4 +-
>>  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h|   15 +-
>>  OvmfPkg/Library/VirtioLib/VirtioLib.c   |  

  1   2   >