回复: [edk2-devel] [PATCH v2 04/10] EmulatorPkg: add OrderedCollectionLib class resolution

2021-01-18 Thread gaoliming
Acked-by: Liming Gao 

> -邮件原件-
> 发件人: bounce+27952+70500+4905953+8761...@groups.io
>  代表 Laszlo Ersek
> 发送时间: 2021年1月19日 0:48
> 收件人: devel@edk2.groups.io
> 抄送: Andrew Fish ; Jordan Justen
> ; Philippe Mathieu-Daudé
> ; Ray Ni 
> 主题: Re: [edk2-devel] [PATCH v2 04/10] EmulatorPkg: add
> OrderedCollectionLib class resolution
> 
> Ping -- Ray, can you please check this?; it's a one-liner patch.
> 
> Thanks.
> Laszlo
> 
> On 01/13/21 09:54, Laszlo Ersek wrote:
> > A subsequent patch in the series will make the
> >
> >   ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
> >
> > instance dependent on the OrderedCollectionLib class. Because the shell
> > binary in this platform consumes the above UefiShellCommandLib instance,
> > resolve OrderedCollectionLib.
> >
> > Cc: Andrew Fish 
> > Cc: Jordan Justen 
> > Cc: Philippe Mathieu-Daudé 
> > Cc: Ray Ni 
> > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3151
> > Signed-off-by: Laszlo Ersek 
> > ---
> >
> > Notes:
> > v2:
> > - new patch
> >
> >  EmulatorPkg/EmulatorPkg.dsc | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
> > index de8144844c57..9ecc37334305 100644
> > --- a/EmulatorPkg/EmulatorPkg.dsc
> > +++ b/EmulatorPkg/EmulatorPkg.dsc
> > @@ -453,6 +453,7 @@ [Components]
> >
> NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1Com
> mandsLib.inf
> >
> NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1
> CommandsLib.inf
> >
> HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingL
> ib.inf
> > +
> OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLi
> b/BaseOrderedCollectionRedBlackTreeLib.inf
> >SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
> >PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> >  #
> SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
> >
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70533): https://edk2.groups.io/g/devel/message/70533
Mute This Topic: https://groups.io/mt/79946827/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v0] Platform/NXP: Add Dynamic Acpi for layerscape platforms

2021-01-18 Thread Vikas Singh via groups.io
On Mon, Jan 18, 2021 at 10:25 PM Leif Lindholm  wrote:
>
> +Sami,
>
> On Sat, Jan 16, 2021 at 10:15:41 +0530, Vikas Singh wrote:
> > On Sun, Jan 10, 2021 at 8:56 AM Leif Lindholm  wrote:
> > >
> > > On Tue, Dec 29, 2020 at 12:55:58 +0530, Vikas Singh wrote:
> > > > These changes intend to add
> > >
> > > Hopefully they actually do.
> > >
> > > > - Common Configuration Manager (CM) for all fsl platforms.
> > > > - Platform headers consumed by CM for LX2160ARDB.
> > > > - Clk dsdt properties for LX2160ARDB.
> > >
> > > This sounds like (at least) three patches.
> > >
> > Leif, I plan to disintegrate the complete changes into 2 patch set's
> > and will be sharing this series early next week.
> > set1: Add Common Configuration Manager (CM) for all fsl platforms and
> > headers consumed by CM for LX2160ARDB.
> > set2: Add platform specific DSDT generator and Clk dsdt properties for
> > LX2160ARDB.
>
> This sounds sensible.
>
> > > >
> > > > Signed-off-by: Vikas Singh 
> > > > ---
> > > >  .../ConfigurationManager/ConfigurationManager.dec  |  24 +
> > > >  .../ConfigurationManager.dsc.inc   |  21 +
> > > >  .../ConfigurationManagerDxe/ConfigurationManager.c | 709 
> > > > +
> > > >  .../ConfigurationManagerDxe/ConfigurationManager.h | 229 +++
> > > >  .../ConfigurationManagerDxe.inf|  52 ++
> > > >  .../Include/PlatformAcpiTableGenerator.h   |  20 +
> > > >  Platform/NXP/Env.cshrc |  73 +++
> > > >  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl   |  40 ++
> > > >  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl  |  15 +
> > > >  .../AcpiTablesInclude/PlatformAcpiDsdtLib.inf  |  39 ++
> > > >  .../PlatformAcpiDsdtLib/RawDsdtGenerator.c | 146 +
> > > >  .../AcpiTablesInclude/PlatformAcpiLib.h|  24 +
> > > >  Platform/NXP/LX2160aRdbPkg/Include/Platform.h  | 244 +++
> > > >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec   |   6 +-
> > > >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc   |  30 +
> > > >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf   |  12 +
> > > >  Platform/NXP/build.sh  | 121 
> > > >  17 files changed, 1804 insertions(+), 1 deletion(-)
> > > >  create mode 100644 
> > > > Platform/NXP/ConfigurationManager/ConfigurationManager.dec
> > > >  create mode 100644 
> > > > Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
> > > >  create mode 100644 
> > > > Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> > > >  create mode 100644 
> > > > Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > > >  create mode 100644 
> > > > Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
> > > >  create mode 100644 
> > > > Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> > > >  create mode 100755 Platform/NXP/Env.cshrc
> > > >  create mode 100644 
> > > > Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
> > > >  create mode 100644 
> > > > Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
> > > >  create mode 100644 
> > > > Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
> > > >  create mode 100644 
> > > > Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
> > > >  create mode 100644 
> > > > Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
> > > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/Include/Platform.h
> > > >  create mode 100755 Platform/NXP/build.sh
> > > >
>
> > > > diff --git 
> > > > a/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > > >  
> > > > b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > > > new file mode 100644
> > > > index 000..cf09ef9
> > > > --- /dev/null
> > > > +++ 
> > > > b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > > > @@ -0,0 +1,229 @@
> > > > +/** @file
> > > > +  Configuration Manager headers
> > > > +
> > > > +  Copyright 2020 NXP
> > > > +  Copyright 2020 Puresoftware Ltd
> > > > +
> > > > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > > > +
> > > > +  @par Glossary:
> > > > +- Cm or CM   - Configuration Manager
> > > > +- Obj or OBJ - Object
> > > > +**/
> > > > +
> > > > +#ifndef CONFIGURATION_MANAGER_H__
> > > > +#define CONFIGURATION_MANAGER_H__
> > > > +
> > > > +#include 
> > > > +#include 
> > > > +
> > > > +/** The configuration manager version
> > > > +*/
> > > > +#define CONFIGURATION_MANAGER_REVISION CREATE_REVISION (0, 0)
> > > > +
> > > > +/** The OEM ID
> > > > +*/
> > > > +#define CFG_MGR_OEM_ID{ 'N', 'X', 'P', ' ', ' ', ' ' }
> > > > +
> > > > +/** A helper macro for populating the GIC CPU information
> > > > + */
> > > > +#define GICC_ENTRY(   \
> > > > +CPUInterfaceNumber,

Re: [edk2-devel] [PATCH v2 05/10] UefiPayloadPkg: add OrderedCollectionLib class resolution

2021-01-18 Thread Guo Dong

Reviewed-by: Guo Dong 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Laszlo
> Ersek
> Sent: Monday, January 18, 2021 9:49 AM
> To: devel@edk2.groups.io
> Cc: You, Benjamin ; Dong, Guo
> ; Ma, Maurice ; Philippe
> Mathieu-Daudé 
> Subject: Re: [edk2-devel] [PATCH v2 05/10] UefiPayloadPkg: add
> OrderedCollectionLib class resolution
> 
> Ping -- Benjamin, Guo, Maurice, this is a one-liner for UefiPayloadPkg;
> please approve.
> 
> Thanks
> Laszlo
> 
> On 01/13/21 09:54, Laszlo Ersek wrote:
> > A subsequent patch in the series will make the
> >
> >   ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
> >
> > instance dependent on the OrderedCollectionLib class. Because the shell
> > binary in this platform consumes the above UefiShellCommandLib instance,
> > resolve OrderedCollectionLib.
> >
> > Cc: Benjamin You 
> > Cc: Guo Dong 
> > Cc: Maurice Ma 
> > Cc: Philippe Mathieu-Daudé 
> > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3151
> > Signed-off-by: Laszlo Ersek 
> > ---
> >
> > Notes:
> > v2:
> > - new patch
> >
> >  UefiPayloadPkg/UefiPayloadPkg.dsc | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc
> b/UefiPayloadPkg/UefiPayloadPkg.dsc
> > index ae62a9c4d66b..24dab157f1ef 100644
> > --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
> > +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
> > @@ -556,6 +556,7 @@ [Components.X64]
> >
> DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
> >DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
> >
> HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib
> .inf
> > +
> OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib
> /BaseOrderedCollectionRedBlackTreeLib.inf
> >PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
> >
> > ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
> >
> ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandL
> ib.inf
> >
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70531): https://edk2.groups.io/g/devel/message/70531
Mute This Topic: https://groups.io/mt/79646583/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] TianoCore Bug Triage - APAC / NAMO - Tue, 01/19/2021 6:30pm-7:30pm #cal-reminder

2021-01-18 Thread devel@edk2.groups.io Calendar
*Reminder:* TianoCore Bug Triage - APAC / NAMO

*When:* Tuesday, 19 January 2021, 6:30pm to 7:30pm, (GMT-08:00) America/Los 
Angeles

*Where:* 
https://meetingsamer34.webex.com/meetingsamer34/j.php?MTID=mb96c5bd411bd010e1e6d43a6f6c65f45

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=1042697 )

*Organizer:* Liming Gao gaolim...@byosoft.com.cn ( 
gaolim...@byosoft.com.cn?subject=Re:%20Event:%20TianoCore%20Bug%20Triage%20-%20APAC%20%2F%20NAMO
 )

*Description:*

TianoCore Bug Triage - APAC / NAMO

Hosted by Liming Gao

https://meetingsamer34.webex.com/meetingsamer34/j.php?MTID=mb96c5bd411bd010e1e6d43a6f6c65f45

Wednesday, Jan 20, 2021 10:30 am | 50 minutes | (UTC+08:00) Beijing, Chongqing, 
Hong Kong, Urumqi

Occurs every Wednesday effective 1/20/2021 from 10:30 AM to 11:20 AM, 
(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi

Meeting number: 126 867 1239

Password: ZhqYQunw246 (94797869 from video systems)

d8edc6c9604344b08f727b4bf054eaac_20210120T023000Z

Join by video system

Dial 1268671...@meetingsamer34.webex.com

You can also dial 173.243.2.68 and enter your meeting number.

Join by phone

Use VoIP only


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70530): https://edk2.groups.io/g/devel/message/70530
Mute This Topic: https://groups.io/mt/79942957/21656
Mute #cal-reminder:https://edk2.groups.io/g/devel/mutehashtag/cal-reminder
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Patch 1/2 V4] BaseTools: Convert Split tool to python

2021-01-18 Thread Yuwei Chen
Reviewed-by: Yuwei Chen

> -Original Message-
> From: Feng, Bob C 
> Sent: Tuesday, January 19, 2021 9:28 AM
> To: devel@edk2.groups.io
> Cc: Liming Gao ; Chen, Christine
> 
> Subject: [Patch 1/2 V4] BaseTools: Convert Split tool to python
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3165
> 
> There are 2 reasons to convert Split tool from C to Python.
> 1. We are in the process of moving the Basetools Python code to a separate
> repository. But there still are many C tools under edk2/BaseTools. To make all
> Basetools be in the separate repo, we can convert the C tools to Python tools.
> 2. The original Split tool is very slow. This python tool can reduce 90% time.
> 
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> Cc: Yuwei Chen 
> ---
> V3: No change for this patch.
> V4: Update the version to 2.0
>  BaseTools/Source/C/Split/Split.c| 466 
>  BaseTools/BinWrappers/PosixLike/Split   |  31 +-
>  BaseTools/BinWrappers/WindowsLike/Split.bat |   3 +
>  BaseTools/Source/C/GNUmakefile  |   1 -
>  BaseTools/Source/C/Makefile |   1 -
>  BaseTools/Source/C/Split/GNUmakefile|  17 -
>  BaseTools/Source/C/Split/Makefile   |  16 -
>  BaseTools/Source/Python/Split/Split.py  | 202 +
>  BaseTools/Source/Python/Split/__init__.py   |  10 +
>  9 files changed, 223 insertions(+), 524 deletions(-)  delete mode 100644
> BaseTools/Source/C/Split/Split.c  create mode 100644
> BaseTools/BinWrappers/WindowsLike/Split.bat
>  delete mode 100644 BaseTools/Source/C/Split/GNUmakefile
>  delete mode 100644 BaseTools/Source/C/Split/Makefile  create mode
> 100644 BaseTools/Source/Python/Split/Split.py
>  create mode 100644 BaseTools/Source/Python/Split/__init__.py
> 
> diff --git a/BaseTools/Source/C/Split/Split.c
> b/BaseTools/Source/C/Split/Split.c
> deleted file mode 100644
> index be0ee124bfe0..
> --- a/BaseTools/Source/C/Split/Split.c
> +++ /dev/null
> @@ -1,466 +0,0 @@
> -/** @file
> -
> -  Split a file into two pieces at the request offset.
> -
> -Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.
> -SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -**/
> -
> -// GC_TODO: fix comment to start with /*++ -#include  -#include
>  -#include  -#ifdef __GNUC__ -#include  -
> #else -#include  -#endif -#include  -#include "ParseInf.h"
> -#include "CommonLib.h"
> -#include "EfiUtilityMsgs.h"
> -//
> -// Utility Name
> -//
> -#define UTILITY_NAME  "Split"
> -
> -//
> -// Utility version information
> -//
> -#define UTILITY_MAJOR_VERSION 1
> -#define UTILITY_MINOR_VERSION 0
> -
> -void
> -Version (
> -  void
> -  )
> -/*++
> -
> -Routine Description:
> -
> -  Displays the standard utility information to SDTOUT
> -
> -Arguments:
> -
> -  None
> -
> -Returns:
> -
> -  None
> -
> ---*/
> -{
> -  printf ("%s Version %d.%d Build %s\n", UTILITY_NAME,
> UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION); -}
> -
> -void
> -Usage (
> -  void
> -  )
> -/*++
> -
> -Routine Description:
> -
> -  GC_TODO: Add function description
> -
> -Arguments:
> -
> -
> -Returns:
> -
> -  GC_TODO: add return values
> -
> ---*/
> -{
> -  Version();
> -  printf ("Copyright (c) 1999-2017 Intel Corporation. All rights 
> reserved.\n");
> -  printf ("\n  SplitFile creates two Binary files either in the same 
> directory as
> the current working\n");
> -  printf ("  directory or in the specified directory.\n");
> -  printf ("\nUsage: \n\
> -   Split\n\
> - -f, --filename inputFile to split\n\
> - -s, --split VALUE the number of bytes in the first file\n\
> - [-p, --prefix OutputDir]\n\
> - [-o, --firstfile Filename1]\n\
> - [-t, --secondfile Filename2]\n\
> - [-v, --verbose]\n\
> - [--version]\n\
> - [-q, --quiet disable all messages except fatal errors]\n\
> - [-d, --debug[#]\n\
> - [-h, --help]\n");
> -}
> -
> -EFI_STATUS
> -GetSplitValue (
> -  IN CONST CHAR8* SplitValueString,
> -  OUT UINT64 *ReturnValue
> -)
> -{
> -  UINT64 len = 0;
> -  UINT64 base = 1;
> -  UINT64 index = 0;
> -  UINT64 number = 0;
> -  CHAR8 lastCHAR = 0;
> -  EFI_STATUS Status = EFI_SUCCESS;
> -
> -  if (SplitValueString != NULL){
> -len = strlen(SplitValueString);
> -  }
> -
> -  if (len == 0) {
> -return EFI_ABORTED;
> -  }
> -
> -  Status = AsciiStringToUint64 (SplitValueString, FALSE, ReturnValue);
> -  if (!EFI_ERROR (Status)) {
> -return Status;
> -  }
> -
> -  if (SplitValueString[0] == '0' && (SplitValueString[1] == 'x' ||
> SplitValueString[1] == 'X')) {
> -Status = AsciiStringToUint64 (SplitValueString, TRUE, ReturnValue);
> -if (!EFI_ERROR (Status)) {
> -  return Status;
> -}
> -  }
> -
> -  lastCHAR = (CHAR8)toupper((int)SplitValueString[len - 1]);
> -
> -  if (lastCHAR != 'K' && lastCHAR != 'M' && lastCHAR != 'G') {
> -return STATUS_ERROR;
> -  }
> -
> -  for (;index < len - 1; ++index) {
> -if (!isdigit((int)SplitValueString[index])) {
> -  return EFI_ABO

Re: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to python

2021-01-18 Thread Bob Feng
That’s is good suggestion.

Thanks,
Bob

From: devel@edk2.groups.io  On Behalf Of gaoliming
Sent: Tuesday, January 19, 2021 9:10 AM
To: devel@edk2.groups.io; Feng, Bob C 
Subject: 回复: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to 
python

Bob:
 The code logic is fine. This is a big change. I suggest to update tool version 
from 1.0 to 2.0. With this change, Reviewed-by: Liming Gao 
mailto:gaolim...@byosoft.com.cn>>

Thanks
Liming
发件人: 
bounce+27952+70509+4905953+8761...@groups.io
 
mailto:bounce+27952+70509+4905953+8761...@groups.io>>
 代表 Bob Feng
发送时间: 2021年1月19日 7:57
收件人: devel@edk2.groups.io; 
gaolim...@byosoft.com.cn
主题: Re: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to python

Liming,

I have sent the patch V3 that is to move the unit test to tests/Split folder.

Do you have any other concerns about this patch?

Thanks,
Bob

From: Feng, Bob C
Sent: Friday, January 15, 2021 9:50 AM
To: devel@edk2.groups.io; 
gaolim...@byosoft.com.cn
Cc: Feng, Bob C mailto:bob.c.f...@intel.com>>
Subject: RE: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to 
python

Hi Liming,

1. The test framework can be used for both incremental test and functionality 
test. We can do more discussion when I send out this framework for review.
2. Yes, I agree to add a sub folder under the test folder. I’ll update the 
patch.

Is there any other comments before I send the patch V2?

Thanks,
Bob

From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> On Behalf Of gaoliming
Sent: Friday, January 15, 2021 9:13 AM
To: Feng, Bob C mailto:bob.c.f...@intel.com>>; 
devel@edk2.groups.io
Subject: 回复: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to 
python

Bob:
 Thanks for your planning sharing. For BaseTools test, I still have some 
questions.


1. For test framework, is it the incremental test framework or the 
functionality test framework or both?

2. For BaseTools\Source\Python\tests\test_split.py, it creates new 
directory ‘tests’ for test case scripts, and use test_split.py for split tool. 
So, new tool test script will follow the same style. Besides, split tool is 
simple. It may not have its special test case. But, Fce/FMMT are too complex. 
They need the different bios images as their test cases. Then, where are those 
test cases placed into? I would prefer to place the test script and its test 
cases into the same directory. So, I would propose to create the subdirectory 
in ‘tests’ for each tool test, such as Split for this case. Then, every tool 
can place its test script and test case into its own directory.

Thanks
Liming
发件人: 
tosubbounce+27952+0+...@groups.io 
mailto:tosubbounce+27952+0+...@groups.io>> 
代表 Bob Feng
发送时间: 2021年1月14日 10:46
收件人: gaoliming mailto:gaolim...@byosoft.com.cn>>; 
devel@edk2.groups.io
主题: Re: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to python

Good questions. I answer them inline.

Thanks,
Bob

On Thu, Jan 14, 2021 at 08:53 AM, gaoliming wrote:
Bob:
Have you plan to convert all C tools to Python tools? Or only some ones?
I am still investigating the feasibility of converting the C tools to Python 
tools. Some C tools are simple but some are complex. I hope all the C tools can 
be converted to Python tools so that all the tools can be moved to the 
BaseTools separate repo. I think we can file some BZs to track the progress of 
the C tools conversion. And I hope there could be more volunteers to be 
involved in this work.

Here are the discussions about the benefit and process of moving BaseTools out 
of the edk2 repo for reference.
https://edk2.groups.io/g/devel/topic/76572200#64993
https://edk2.groups.io/g/rfc/topic/74009714#270
https://edk2.groups.io/g/devel/topic/73069134#58048
Can you share your planning for the changes in BaseTools?
Except for this patch, my current work for Basetools are:
1. Re-write the FMMT/FCE with Python and propose to add these 2 tools to the 
edk2 BaseTools.
2. Prepare to publish the Basetools incremental build regression test cases and 
test framework.
And, I see you also add unittest for new split tool. Can you introduce the
unittest framework for python tool? If so, new added tool can follow the
same way to add unittest.
The unittest is the python build-in library for the unit test. 
https://docs.python.org/3/library/unittest.html
I provide the unit test is to help you to review this patch. From the unit test 
case, it will be easy to
see if this tool's behavior is as expected.

I think for the python code development, we can try our best to follow this 
document. 
https://edk2-docs.gitbook.io/edk-ii-python-development-process-specification/

Thanks
Liming
-邮件原件-
发件人: 
bou

[edk2-devel] [Patch 2/2 V4] BaseTools: Add unittest for Split tool

2021-01-18 Thread Bob Feng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3165

This patch is to add the unit test for Split python tool

Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
---
V3: Move test_split.py to tests/Sprit folder
V4: No change on V4
 .../Source/Python/tests/Split/test_split.py   | 111 ++
 1 file changed, 111 insertions(+)
 create mode 100644 BaseTools/Source/Python/tests/Split/test_split.py

diff --git a/BaseTools/Source/Python/tests/Split/test_split.py 
b/BaseTools/Source/Python/tests/Split/test_split.py
new file mode 100644
index ..82f71ecf5372
--- /dev/null
+++ b/BaseTools/Source/Python/tests/Split/test_split.py
@@ -0,0 +1,111 @@
+# @file
+#  Split a file into two pieces at the request offset.
+#
+#  Copyright (c) 2021, Intel Corporation. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+# Import Modules
+import unittest
+import tempfile
+import os
+import shutil
+import Split.Split as sp
+import struct as st
+
+
+class TestSplit(unittest.TestCase):
+def setUp(self):
+self.WORKSPACE = tempfile.mkdtemp()
+self.binary_file = os.path.join(self.WORKSPACE, "Binary.bin")
+self.create_inputfile()
+
+def tearDown(self):
+if os.path.exists(self.WORKSPACE):
+shutil.rmtree(self.WORKSPACE)
+
+def test_splitFile_position(self):
+position = [-1, 0, 256, 512, 700, 1024, 2048]
+result = [(0, 1024), (0, 1024), (256, 768),
+  (512, 512), (700, 324), (1024, 0), (1024, 0)]
+for index, po in enumerate(position):
+try:
+sp.splitFile(self.binary_file, po)
+except Exception as e:
+self.assertTrue(False, msg="splitFile function error")
+
+output1 = os.path.join(self.WORKSPACE, "Binary.bin1")
+output2 = os.path.join(self.WORKSPACE, "Binary.bin2")
+with open(output1, "rb") as f1:
+size1 = len(f1.read())
+with open(output2, "rb") as f2:
+size2 = len(f2.read())
+
+ex_result = result[index]
+self.assertEqual(size1, ex_result[0])
+self.assertEqual(size2, ex_result[1])
+
+def create_inputfile(self):
+with open(self.binary_file, "wb") as fout:
+for i in range(512):
+fout.write(st.pack("https://edk2.groups.io/g/devel/message/70527
Mute This Topic: https://groups.io/mt/79941901/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch 1/2 V4] BaseTools: Convert Split tool to python

2021-01-18 Thread Bob Feng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3165

There are 2 reasons to convert Split tool from C to Python.
1. We are in the process of moving the Basetools Python code
to a separate repository. But there still are many C tools under
edk2/BaseTools. To make all Basetools be in the separate repo,
we can convert the C tools to Python tools.
2. The original Split tool is very slow. This python tool can reduce
90% time.

Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
---
V3: No change for this patch. 
V4: Update the version to 2.0
 BaseTools/Source/C/Split/Split.c| 466 
 BaseTools/BinWrappers/PosixLike/Split   |  31 +-
 BaseTools/BinWrappers/WindowsLike/Split.bat |   3 +
 BaseTools/Source/C/GNUmakefile  |   1 -
 BaseTools/Source/C/Makefile |   1 -
 BaseTools/Source/C/Split/GNUmakefile|  17 -
 BaseTools/Source/C/Split/Makefile   |  16 -
 BaseTools/Source/Python/Split/Split.py  | 202 +
 BaseTools/Source/Python/Split/__init__.py   |  10 +
 9 files changed, 223 insertions(+), 524 deletions(-)
 delete mode 100644 BaseTools/Source/C/Split/Split.c
 create mode 100644 BaseTools/BinWrappers/WindowsLike/Split.bat
 delete mode 100644 BaseTools/Source/C/Split/GNUmakefile
 delete mode 100644 BaseTools/Source/C/Split/Makefile
 create mode 100644 BaseTools/Source/Python/Split/Split.py
 create mode 100644 BaseTools/Source/Python/Split/__init__.py

diff --git a/BaseTools/Source/C/Split/Split.c b/BaseTools/Source/C/Split/Split.c
deleted file mode 100644
index be0ee124bfe0..
--- a/BaseTools/Source/C/Split/Split.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/** @file
-
-  Split a file into two pieces at the request offset.
-
-Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-// GC_TODO: fix comment to start with /*++
-#include 
-#include 
-#include 
-#ifdef __GNUC__
-#include 
-#else
-#include 
-#endif
-#include 
-#include "ParseInf.h"
-#include "CommonLib.h"
-#include "EfiUtilityMsgs.h"
-//
-// Utility Name
-//
-#define UTILITY_NAME  "Split"
-
-//
-// Utility version information
-//
-#define UTILITY_MAJOR_VERSION 1
-#define UTILITY_MINOR_VERSION 0
-
-void
-Version (
-  void
-  )
-/*++
-
-Routine Description:
-
-  Displays the standard utility information to SDTOUT
-
-Arguments:
-
-  None
-
-Returns:
-
-  None
-
---*/
-{
-  printf ("%s Version %d.%d Build %s\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, 
UTILITY_MINOR_VERSION, __BUILD_VERSION);
-}
-
-void
-Usage (
-  void
-  )
-/*++
-
-Routine Description:
-
-  GC_TODO: Add function description
-
-Arguments:
-
-
-Returns:
-
-  GC_TODO: add return values
-
---*/
-{
-  Version();
-  printf ("Copyright (c) 1999-2017 Intel Corporation. All rights reserved.\n");
-  printf ("\n  SplitFile creates two Binary files either in the same directory 
as the current working\n");
-  printf ("  directory or in the specified directory.\n");
-  printf ("\nUsage: \n\
-   Split\n\
- -f, --filename inputFile to split\n\
- -s, --split VALUE the number of bytes in the first file\n\
- [-p, --prefix OutputDir]\n\
- [-o, --firstfile Filename1]\n\
- [-t, --secondfile Filename2]\n\
- [-v, --verbose]\n\
- [--version]\n\
- [-q, --quiet disable all messages except fatal errors]\n\
- [-d, --debug[#]\n\
- [-h, --help]\n");
-}
-
-EFI_STATUS
-GetSplitValue (
-  IN CONST CHAR8* SplitValueString,
-  OUT UINT64 *ReturnValue
-)
-{
-  UINT64 len = 0;
-  UINT64 base = 1;
-  UINT64 index = 0;
-  UINT64 number = 0;
-  CHAR8 lastCHAR = 0;
-  EFI_STATUS Status = EFI_SUCCESS;
-
-  if (SplitValueString != NULL){
-len = strlen(SplitValueString);
-  }
-
-  if (len == 0) {
-return EFI_ABORTED;
-  }
-
-  Status = AsciiStringToUint64 (SplitValueString, FALSE, ReturnValue);
-  if (!EFI_ERROR (Status)) {
-return Status;
-  }
-
-  if (SplitValueString[0] == '0' && (SplitValueString[1] == 'x' || 
SplitValueString[1] == 'X')) {
-Status = AsciiStringToUint64 (SplitValueString, TRUE, ReturnValue);
-if (!EFI_ERROR (Status)) {
-  return Status;
-}
-  }
-
-  lastCHAR = (CHAR8)toupper((int)SplitValueString[len - 1]);
-
-  if (lastCHAR != 'K' && lastCHAR != 'M' && lastCHAR != 'G') {
-return STATUS_ERROR;
-  }
-
-  for (;index < len - 1; ++index) {
-if (!isdigit((int)SplitValueString[index])) {
-  return EFI_ABORTED;
-}
-  }
-
-  number = atol (SplitValueString);
-  if (lastCHAR == 'K')
-base = 1024;
-  else if (lastCHAR == 'M')
-base = 1024*1024;
-  else
-base = 1024*1024*1024;
-
-  *ReturnValue = number*base;
-
-  return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CountVerboseLevel (
-  IN CONST CHAR8* VerboseLevelString,
-  IN CONST UINT64 Length,
-  OUT UINT64 *ReturnValue
-)
-{
-  UINT64 i = 0;
-  for (;i < Length; ++i) {
-if (VerboseLevelString[i] != 'v' && VerboseLevelString[i] != 'V') {
-  return EFI_ABORTED;
-}
-++(*ReturnValue);
-  }
-
-  return EFI_SUCCESS;
-

[edk2-devel] [PATCH v6 04/11] OvmfPkg/PciHostBridgeLib: Extract InitRootBridge() / UninitRootBridge()

2021-01-18 Thread Jiahui Cen via groups.io
Extract InitRootBridge() / UninitRootBridge() to PciHostBridgeUtilityLib
as common utility functions. No change of functionality.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Anthony Perard 
Cc: Julien Grall 
Signed-off-by: Jiahui Cen 
Signed-off-by: Yubo Miao 
---
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf   |   2 -
 OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf |   8 +
 OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h   |  77 
++
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridge.h|  56 
---
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 158 
+---
 OvmfPkg/Library/PciHostBridgeLib/XenSupport.c   |   3 +-
 OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c   | 158 

 7 files changed, 249 insertions(+), 213 deletions(-)

diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
index cec3f1631a72..7944f94b7743 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
@@ -37,7 +37,6 @@ [Packages]
 [LibraryClasses]
   BaseMemoryLib
   DebugLib
-  DevicePathLib
   MemoryAllocationLib
   PcdLib
   PciHostBridgeUtilityLib
@@ -51,5 +50,4 @@ [Pcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size
-  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
   gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
diff --git 
a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf 
b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
index 1ba8ec3e03c7..e3d0a3740952 100644
--- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
+++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
@@ -30,8 +30,16 @@ [Sources]
   PciHostBridgeUtilityLib.c
 
 [Packages]
+  MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
+  BaseMemoryLib
   DebugLib
+  DevicePathLib
+  MemoryAllocationLib
+  PcdLib
+
+[Pcd]
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
index 5ea25ed2f4f4..8a1ddc2f5e02 100644
--- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
+++ b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
@@ -14,6 +14,83 @@
 #define __PCI_HOST_BRIDGE_UTILITY_LIB_H__
 
 
+#include 
+
+
+/**
+  Utility function to initialize a PCI_ROOT_BRIDGE structure.
+
+  @param[in]  Supports Supported attributes.
+
+  @param[in]  Attributes   Initial attributes.
+
+  @param[in]  AllocAttributes  Allocation attributes.
+
+  @param[in]  RootBusNumberThe bus number to store in RootBus.
+
+  @param[in]  MaxSubBusNumber  The inclusive maximum bus number that can be
+   assigned to any subordinate bus found behind any
+   PCI bridge hanging off this root bus.
+
+   The caller is repsonsible for ensuring that
+   RootBusNumber <= MaxSubBusNumber. If
+   RootBusNumber equals MaxSubBusNumber, then the
+   root bus has no room for subordinate buses.
+
+  @param[in]  Io   IO aperture.
+
+  @param[in]  Mem  MMIO aperture.
+
+  @param[in]  MemAbove4G   MMIO aperture above 4G.
+
+  @param[in]  PMem Prefetchable MMIO aperture.
+
+  @param[in]  PMemAbove4G  Prefetchable MMIO aperture above 4G.
+
+  @param[out] RootBus  The PCI_ROOT_BRIDGE structure (allocated by the
+   caller) that should be filled in by this
+   function.
+
+  @retval EFI_SUCCESS   Initialization successful. A device path
+consisting of an ACPI device path node, with
+UID = RootBusNumber, has been allocated and
+linked into RootBus.
+
+  @retval EFI_OUT_OF_RESOURCES  Memory allocation failed.
+**/
+EFI_STATUS
+EFIAPI
+PciHostBridgeUtilityInitRootBridge (
+  IN  UINT64   Supports,
+  IN  UINT64   Attributes,
+  IN  UINT64   AllocAttributes,
+  IN  UINT8RootBusNumber,
+  IN  UINT8MaxSubBusNumber,
+  IN  PCI_ROOT_BRIDGE_APERTURE *Io,
+  IN  PCI_ROOT_BRIDGE_APERTURE *Mem,
+  IN  PCI_ROOT_BRIDGE_APERTURE *MemAbove4G,
+  IN  PCI_ROOT_BRIDGE_APERTURE *PMem,
+  IN  PCI_ROOT_BRIDGE_APERTURE *PMemAbove4G,
+  OUT PCI_ROOT_BRIDGE  *RootBus
+  );
+
+
+/**
+  Utility function to uninitialize a PCI_ROOT_BRIDGE structur

[edk2-devel] [PATCH v6 03/11] OvmfPkg/PciHostBridgeLib: List missing PcdLib dependency

2021-01-18 Thread Jiahui Cen via groups.io
OvmfPkg/PciHostBridgeLib instance fails to list its PcdLib dependency,
both between the #include directives, and in the INF file. So let's list
the dependency.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Anthony Perard 
Cc: Julien Grall 
Signed-off-by: Jiahui Cen 
---
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 1 +
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   | 1 +
 OvmfPkg/Library/PciHostBridgeLib/XenSupport.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
index 4c56f3c90b3b..cec3f1631a72 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
@@ -39,6 +39,7 @@ [LibraryClasses]
   DebugLib
   DevicePathLib
   MemoryAllocationLib
+  PcdLib
   PciHostBridgeUtilityLib
   PciLib
   QemuFwCfgLib
diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
index 4a176347fd49..bf32455b9f0d 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c 
b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
index e161f14375ca..95ed0a280b9b 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
+++ b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "PciHostBridge.h"
-- 
2.29.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70516): https://edk2.groups.io/g/devel/message/70516
Mute This Topic: https://groups.io/mt/79941619/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 08/11] OvmfPkg/PciHostBridgeUtilityLib: Extend parameter list of GetRootBridges

2021-01-18 Thread Jiahui Cen via groups.io
Extend parameter list of PciHostBridgeUtilityGetRootBridges() with
DmaAbove4G, NoExtendedConfigSpace to support for ArmVirtPkg.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Signed-off-by: Jiahui Cen 
Signed-off-by: Yubo Miao 
---
 OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf |  4 ---
 OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h   | 24 
--
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c |  5 +++
 OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c   | 34 
+++-
 4 files changed, 39 insertions(+), 28 deletions(-)

diff --git 
a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf 
b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
index fdae8cfe872e..83a734c1725e 100644
--- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
+++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
@@ -39,9 +39,5 @@ [LibraryClasses]
   DebugLib
   DevicePathLib
   MemoryAllocationLib
-  PcdLib
   PciLib
   QemuFwCfgLib
-
-[Pcd]
-  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
index 2b7d5d3725c3..a0ea44d96a67 100644
--- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
+++ b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
@@ -102,23 +102,27 @@ PciHostBridgeUtilityUninitRootBridge (
 /**
   Utility function to return all the root bridge instances in an array.
 
-  @param[out] CountThe number of root bridge instances.
+  @param[out] Count  The number of root bridge instances.
 
-  @param[in]  Attributes   Initial attributes.
+  @param[in]  Attributes Initial attributes.
 
-  @param[in]  AllocAttributes  Allocation attributes.
+  @param[in]  AllocAttributesAllocation attributes.
 
-  @param[in]  Io   IO aperture.
+  @param[in]  DmaAbove4G DMA above 4GB memory.
 
-  @param[in]  Mem  MMIO aperture.
+  @param[in]  NoExtendedConfigSpace  No Extended Config Space.
 
-  @param[in]  MemAbove4G   MMIO aperture above 4G.
+  @param[in]  Io IO aperture.
 
-  @param[in]  PMem Prefetchable MMIO aperture.
+  @param[in]  MemMMIO aperture.
 
-  @param[in]  PMemAbove4G  Prefetchable MMIO aperture above 4G.
+  @param[in]  MemAbove4G MMIO aperture above 4G.
 
-  @return  All the root bridge instances in an array.
+  @param[in]  PMem   Prefetchable MMIO aperture.
+
+  @param[in]  PMemAbove4GPrefetchable MMIO aperture above 4G.
+
+  @returnAll the root bridge instances in an array.
 **/
 PCI_ROOT_BRIDGE *
 EFIAPI
@@ -126,6 +130,8 @@ PciHostBridgeUtilityGetRootBridges (
   OUT UINTN*Count,
   IN  UINT64   Attributes,
   IN  UINT64   AllocationAttributes,
+  IN  BOOLEAN  DmaAbove4G,
+  IN  BOOLEAN  NoExtendedConfigSpace,
   IN  PCI_ROOT_BRIDGE_APERTURE *Io,
   IN  PCI_ROOT_BRIDGE_APERTURE *Mem,
   IN  PCI_ROOT_BRIDGE_APERTURE *MemAbove4G,
diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
index 6ac41ff853a9..91b9e6baa1e8 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -9,6 +9,9 @@
 **/
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -80,6 +83,8 @@ PciHostBridgeGetRootBridges (
 Count,
 Attributes,
 AllocationAttributes,
+FALSE,
+PcdGet16 (PcdOvmfHostBridgePciDevId) != INTEL_Q35_MCH_DEVICE_ID,
 &Io,
 &Mem,
 &MemAbove4G,
diff --git a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c 
b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
index b1e74a469d50..1d78984b83ad 100644
--- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
+++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
@@ -12,12 +12,10 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -192,23 +190,27 @@ PciHostBridgeUtilityUninitRootBridge (
 /**
   Utility function to return all the root bridge instances in an array.
 
-  @param[out] CountThe number of root bridge instances.
+  @param[out] Count  The number of root bridge instances.
 
-  @param[in]  Attributes   Initial attributes.
+  @param[in]  Attributes Initial attributes.
 
-  @param[in]  AllocAttributes  Allocation attributes.
+  @param[in]  AllocAttributesAllocation attributes.
 
-  @param[in]  Io   IO aperture.
+  @param[in]  DmaAbove4G DMA abov

[edk2-devel] [PATCH v6 11/11] ArmVirtPkg/ArmVirtQemu: Add support for HotPlug

2021-01-18 Thread Jiahui Cen via groups.io
It is necessary to add padding for hotplugable PCI Devices like
pcie-root-port.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059

Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Jiahui Cen 
Signed-off-by: Yubo Miao 
---
 ArmVirtPkg/ArmVirtQemu.dsc   | 1 +
 ArmVirtPkg/ArmVirtQemuKernel.dsc | 1 +
 ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 1 +
 3 files changed, 3 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index a11ffd9ba553..d77c226d80ee 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -488,6 +488,7 @@ [Components.common]
 
   NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
   }
+  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
   OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
   OvmfPkg/Virtio10Dxe/Virtio10.inf
 
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index c27752b4d5e5..92f327eec4fb 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -424,6 +424,7 @@ [Components.common]
 
   NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
   }
+  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
   OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
   OvmfPkg/Virtio10Dxe/Virtio10.inf
 
diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc 
b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
index 1752fee12b79..5b1d10057545 100644
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
@@ -162,6 +162,7 @@ [FV.FvMain]
   INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
   INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
   INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
   INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
   INF OvmfPkg/Virtio10Dxe/Virtio10.inf
 
-- 
2.29.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70524): https://edk2.groups.io/g/devel/message/70524
Mute This Topic: https://groups.io/mt/79941634/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 10/11] ArmVirtPkg/FdtPciHostBridgeLib: Add extra pci root buses support

2021-01-18 Thread Jiahui Cen via groups.io
In order to take advantages of extra pci root buses in ArmVirtPkg, it is
necessary to scan extra root buses when getting root briges. And now
PciHostBridgeUtilityLib already provides a set of utility functions that
support for extra pci root buses, like PciHostBridgeUtilityGetRootBridges()
/ PciHostBridgeUtilityFreeRootBridges(). So let's rebase
ArmVirtPkg/FdtPciHostBridgeLib to PciHostBridgeUtilityGetRootBridges() /
PciHostBridgeUtilityFreeRootBridges() to extend ArmVirtPkg with extra
pci root buses support.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059

Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Jiahui Cen 
Signed-off-by: Yubo Miao 
---
 ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c | 22 

 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c 
b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
index 3ec7992b6331..0099b8e3c391 100644
--- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
+++ b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
@@ -272,8 +272,6 @@ ProcessPciHost (
   return Status;
 }
 
-STATIC PCI_ROOT_BRIDGE mRootBridge;
-
 /**
   Return all the root bridge instances in an array.
 
@@ -361,8 +359,8 @@ PciHostBridgeGetRootBridges (
   PMemAbove4G.Base = MAX_UINT64;
   PMemAbove4G.Limit= 0;
 
-  Status = PciHostBridgeUtilityInitRootBridge (
-Attributes,
+  return PciHostBridgeUtilityGetRootBridges (
+Count,
 Attributes,
 AllocationAttributes,
 TRUE,
@@ -373,19 +371,8 @@ PciHostBridgeGetRootBridges (
 &Mem,
 &MemAbove4G,
 &PMem,
-&PMemAbove4G,
-&mRootBridge
+&PMemAbove4G
 );
-  if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR, "%a: failed to initialize PCI host bridge: %r\n",
-  __FUNCTION__, Status));
-*Count = 0;
-return NULL;
-  }
-
-  *Count = 1;
-
-  return &mRootBridge;
 }
 
 /**
@@ -402,8 +389,7 @@ PciHostBridgeFreeRootBridges (
   UINTN   Count
   )
 {
-  ASSERT (Count == 1);
-  PciHostBridgeUtilityUninitRootBridge (Bridges);
+  PciHostBridgeUtilityFreeRootBridges (Bridges, Count);
 }
 
 /**
-- 
2.29.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70523): https://edk2.groups.io/g/devel/message/70523
Mute This Topic: https://groups.io/mt/79941630/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 09/11] OvmfPkg/PciHostBridgeUtilityLib: Extend GetRootBridges() with BusMin/BusMax

2021-01-18 Thread Jiahui Cen via groups.io
Extend parameter list of PciHostBridgeUtilityGetRootBridges() with BusMin/
BusMax, so that the utility function could be compatible with ArmVirtPkg
who uses mutable bus range [BusMin, BusMax] insteand of [0, PCI_MAX_BUS].

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Signed-off-by: Jiahui Cen 
---
 OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h |  6 
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   |  2 ++
 OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c | 30 

 3 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
index a0ea44d96a67..d2dc18a1afad 100644
--- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
+++ b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
@@ -112,6 +112,10 @@ PciHostBridgeUtilityUninitRootBridge (
 
   @param[in]  NoExtendedConfigSpace  No Extended Config Space.
 
+  @param[in]  BusMin Minimum Bus number, inclusive.
+
+  @param[in]  BusMax Maximum Bus number, inclusive.
+
   @param[in]  Io IO aperture.
 
   @param[in]  MemMMIO aperture.
@@ -132,6 +136,8 @@ PciHostBridgeUtilityGetRootBridges (
   IN  UINT64   AllocationAttributes,
   IN  BOOLEAN  DmaAbove4G,
   IN  BOOLEAN  NoExtendedConfigSpace,
+  IN  UINTNBusMin,
+  IN  UINTNBusMax,
   IN  PCI_ROOT_BRIDGE_APERTURE *Io,
   IN  PCI_ROOT_BRIDGE_APERTURE *Mem,
   IN  PCI_ROOT_BRIDGE_APERTURE *MemAbove4G,
diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
index 91b9e6baa1e8..7d9fb0fb293a 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -85,6 +85,8 @@ PciHostBridgeGetRootBridges (
 AllocationAttributes,
 FALSE,
 PcdGet16 (PcdOvmfHostBridgePciDevId) != INTEL_Q35_MCH_DEVICE_ID,
+0,
+PCI_MAX_BUS,
 &Io,
 &Mem,
 &MemAbove4G,
diff --git a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c 
b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
index 1d78984b83ad..69bed5c7843f 100644
--- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
+++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
@@ -200,6 +200,10 @@ PciHostBridgeUtilityUninitRootBridge (
 
   @param[in]  NoExtendedConfigSpace  No Extended Config Space.
 
+  @param[in]  BusMin Minimum Bus number, inclusive.
+
+  @param[in]  BusMax Maximum Bus number, inclusive.
+
   @param[in]  Io IO aperture.
 
   @param[in]  MemMMIO aperture.
@@ -220,6 +224,8 @@ PciHostBridgeUtilityGetRootBridges (
   IN  UINT64   AllocationAttributes,
   IN  BOOLEAN  DmaAbove4G,
   IN  BOOLEAN  NoExtendedConfigSpace,
+  IN  UINTNBusMin,
+  IN  UINTNBusMax,
   IN  PCI_ROOT_BRIDGE_APERTURE *Io,
   IN  PCI_ROOT_BRIDGE_APERTURE *Mem,
   IN  PCI_ROOT_BRIDGE_APERTURE *MemAbove4G,
@@ -236,6 +242,13 @@ PciHostBridgeUtilityGetRootBridges (
   UINTNLastRootBridgeNumber;
   UINTNRootBridgeNumber;
 
+  if (BusMin > BusMax || BusMax > PCI_MAX_BUS) {
+DEBUG ((DEBUG_ERROR, "%a: invalid bus range with BusMin %d and BusMax 
%d\n",
+  __FUNCTION__, BusMin, BusMax));
+*Count = 0;
+return NULL;
+  }
+
   //
   // QEMU provides the number of extra root buses, shortening the exhaustive
   // search below. If there is no hint, the feature is missing.
@@ -247,7 +260,14 @@ PciHostBridgeUtilityGetRootBridges (
 QemuFwCfgSelectItem (FwCfgItem);
 QemuFwCfgReadBytes (FwCfgSize, &ExtraRootBridges);
 
-if (ExtraRootBridges > PCI_MAX_BUS) {
+//
+// Validate the number of extra root bridges. As BusMax is inclusive, the
+// max bus count is (BusMax - BusMin + 1). From that, the "main" root bus
+// is always givin, so the max count for the "extra" root bridges is one
+// less, i.e. (BusMax - BusMin). If QEME hint exceeds that, we have invalid
+// behavior.
+//
+if (ExtraRootBridges > BusMax - BusMin) {
   DEBUG ((DEBUG_ERROR, "%a: invalid count of extra root buses (%Lu) "
 "reported by QEMU\n", __FUNCTION__, ExtraRootBridges));
   *Count = 0;
@@ -271,15 +291,15 @@ PciHostBridgeUtilityGetRootBridges (
   //
   // The "main" root bus is always there.
   //
-  LastRootBridgeNumber = 0;
+  LastRootBridgeNumber = BusMin;
 
   //
   // Scan all other root buses. If function 0 of any device on a bus returns a
   // VendorId register value different from all-bits-one, then that bus is
   // alive.
   //
-  for (RootBridgeNumber = 1;
-   

[edk2-devel] [PATCH v6 07/11] OvmfPkg/PciHostBridgeLib: Extract GetRootBridges() / FreeRootBridges()

2021-01-18 Thread Jiahui Cen via groups.io
Extract PciHostBridgeGetRootBridges() / PciHostBridgeFreeRootBridges() to
PciHostBridgeUtilityLib as common utility functions to share support for
scanning extra root bridges.

No change of functionality.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Signed-off-by: Jiahui Cen 
Signed-off-by: Yubo Miao 
---
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf   |   1 -
 OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf |   6 +
 OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h   |  50 +
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 138 
+-
 OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c   | 197 

 5 files changed, 257 insertions(+), 135 deletions(-)

diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
index 72458262cb42..4610a0c1490b 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
@@ -41,7 +41,6 @@ [LibraryClasses]
   PcdLib
   PciHostBridgeUtilityLib
   PciLib
-  QemuFwCfgLib
 
 [Pcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase
diff --git 
a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf 
b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
index 4d6764b702f4..fdae8cfe872e 100644
--- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
+++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
@@ -39,3 +39,9 @@ [LibraryClasses]
   DebugLib
   DevicePathLib
   MemoryAllocationLib
+  PcdLib
+  PciLib
+  QemuFwCfgLib
+
+[Pcd]
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
index a44ad5034520..2b7d5d3725c3 100644
--- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
+++ b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
@@ -99,6 +99,56 @@ PciHostBridgeUtilityUninitRootBridge (
   );
 
 
+/**
+  Utility function to return all the root bridge instances in an array.
+
+  @param[out] CountThe number of root bridge instances.
+
+  @param[in]  Attributes   Initial attributes.
+
+  @param[in]  AllocAttributes  Allocation attributes.
+
+  @param[in]  Io   IO aperture.
+
+  @param[in]  Mem  MMIO aperture.
+
+  @param[in]  MemAbove4G   MMIO aperture above 4G.
+
+  @param[in]  PMem Prefetchable MMIO aperture.
+
+  @param[in]  PMemAbove4G  Prefetchable MMIO aperture above 4G.
+
+  @return  All the root bridge instances in an array.
+**/
+PCI_ROOT_BRIDGE *
+EFIAPI
+PciHostBridgeUtilityGetRootBridges (
+  OUT UINTN*Count,
+  IN  UINT64   Attributes,
+  IN  UINT64   AllocationAttributes,
+  IN  PCI_ROOT_BRIDGE_APERTURE *Io,
+  IN  PCI_ROOT_BRIDGE_APERTURE *Mem,
+  IN  PCI_ROOT_BRIDGE_APERTURE *MemAbove4G,
+  IN  PCI_ROOT_BRIDGE_APERTURE *PMem,
+  IN  PCI_ROOT_BRIDGE_APERTURE *PMemAbove4G
+  );
+
+
+/**
+  Utility function to free root bridge instances array from
+  PciHostBridgeUtilityGetRootBridges().
+
+  @param[in] Bridges  The root bridge instances array.
+  @param[in] CountThe count of the array.
+**/
+VOID
+EFIAPI
+PciHostBridgeUtilityFreeRootBridges (
+  IN PCI_ROOT_BRIDGE *Bridges,
+  IN UINTN   Count
+  );
+
+
 /**
   Utility function to inform the platform that the resource conflict happens.
 
diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
index 8758d7c12bf0..6ac41ff853a9 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -9,9 +9,6 @@
 **/
 #include 
 
-#include 
-#include 
-
 #include 
 #include 
 
@@ -21,8 +18,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include "PciHostBridge.h"
 
 
@@ -44,14 +39,6 @@ PciHostBridgeGetRootBridges (
   UINTN *Count
   )
 {
-  EFI_STATUS   Status;
-  FIRMWARE_CONFIG_ITEM FwCfgItem;
-  UINTNFwCfgSize;
-  UINT64   ExtraRootBridges;
-  PCI_ROOT_BRIDGE  *Bridges;
-  UINTNInitialized;
-  UINTNLastRootBridgeNumber;
-  UINTNRootBridgeNumber;
   UINT64   Attributes;
   UINT64   AllocationAttributes;
   PCI_ROOT_BRIDGE_APERTURE Io;
@@ -89,123 +76,16 @@ PciHostBridgeGetRootBridges (
   Mem.Base = PcdGet64 (PcdPciMmio32Base);
   Mem.Limit = PcdGet64 (PcdPciMmio32Base) + (PcdGet64 (PcdPciMmio32Size) - 1);
 
-  *Count = 0;
-
-  //
-  // QEMU provides the number of extra root buses, shortening the exhaustive
-  // search below. If there is no hint, the feature is missing.
-  //
-  Status = QemuFwCfgFindFile ("etc/extra-pci-roots", &FwCfgItem, &FwCfg

[edk2-devel] [PATCH v6 02/11] ArmVirtPkg: Refactor with PciHostBridgeUtilityLib

2021-01-18 Thread Jiahui Cen via groups.io
Eliminate currently duplicated code in ArmVirtPkg with the common utility
class PciHostBridgeUtilityLib.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059

Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Sami Mujawar 
Signed-off-by: Jiahui Cen 
Signed-off-by: Yubo Miao 
Reviewed-by: Laszlo Ersek 
---
 ArmVirtPkg/ArmVirtKvmTool.dsc  |  1 +
 ArmVirtPkg/ArmVirtQemu.dsc |  1 +
 ArmVirtPkg/ArmVirtQemuKernel.dsc   |  1 +
 ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf |  2 +
 ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c   | 44 
++--
 5 files changed, 8 insertions(+), 41 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc
index bf008be50fcb..e027b17bec1b 100644
--- a/ArmVirtPkg/ArmVirtKvmTool.dsc
+++ b/ArmVirtPkg/ArmVirtKvmTool.dsc
@@ -58,6 +58,7 @@ [LibraryClasses.common]
   
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
   PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
   
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
+  
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
 
   
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index ef5d6dbeaddc..a11ffd9ba553 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -78,6 +78,7 @@ [LibraryClasses.common]
   
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
   PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
   
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
+  
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
 
 !if $(TPM2_ENABLE) == TRUE
   Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index f8f5f7f4b94b..c27752b4d5e5 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -76,6 +76,7 @@ [LibraryClasses.common]
   
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
   PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
   
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
+  
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
   
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
 
 [LibraryClasses.common.DXE_DRIVER]
diff --git a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf 
b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
index 277ccfd24546..01d39626d14c 100644
--- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
+++ b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
@@ -31,12 +31,14 @@ [Packages]
   ArmVirtPkg/ArmVirtPkg.dec
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
   DebugLib
   DevicePathLib
   DxeServicesTableLib
   MemoryAllocationLib
+  PciHostBridgeUtilityLib
   PciPcdProducerLib
 
 [FixedPcd]
diff --git a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c 
b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
index 496b192d2291..d554479bf0de 100644
--- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
+++ b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
@@ -7,12 +7,13 @@
 
 **/
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include 
@@ -50,11 +51,6 @@ STATIC EFI_PCI_ROOT_BRIDGE_DEVICE_PATH 
mEfiPciRootBridgeDevicePath = {
   }
 };
 
-GLOBAL_REMOVE_IF_UNREFERENCED
-CHAR16 *mPciHostBridgeLibAcpiAddressSpaceTypeStr[] = {
-  L"Mem", L"I/O", L"Bus"
-};
-
 //
 // We expect the "ranges" property of "pci-host-ecam-generic" to consist of
 // records like this.
@@ -435,39 +431,5 @@ PciHostBridgeResourceConflict (
   VOID  *Configuration
   )
 {
-  EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor;
-  UINTN RootBridgeIndex;
-  DEBUG ((EFI_D_ERROR, "PciHostBridge: Resource conflict happens!\n"));
-
-  RootBridgeIndex = 0;
-  Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Configuration;
-  while (Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) {
-DEBUG ((EFI_D_ERROR, "RootBridge[%d]:\n", RootBridgeIndex++));
-for (; Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR; Descriptor++) {
-  ASSERT (Descriptor->ResType <
-  (sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr) /
-   size

[edk2-devel] [PATCH v6 01/11] OvmfPkg: Introduce PciHostBridgeUtilityLib class

2021-01-18 Thread Jiahui Cen via groups.io
Introduce a new PciHostBridgeUtilityLib class to share duplicate code
between OvmfPkg and ArmVirtPkg.

Extract function PciHostBridgeUtilityResourceConflict from
PciHostBridgeResourceConflict in OvmfPkg/PciHostBridgeLib.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Rebecca Cran 
Cc: Peter Grehan 
Cc: Anthony Perard 
Cc: Julien Grall 
Signed-off-by: Jiahui Cen 
Signed-off-by: Yubo Miao 
Reviewed-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec |  4 +
 OvmfPkg/AmdSev/AmdSevX64.dsc|  1 +
 OvmfPkg/Bhyve/BhyveX64.dsc  |  1 +
 OvmfPkg/OvmfPkgIa32.dsc |  1 +
 OvmfPkg/OvmfPkgIa32X64.dsc  |  1 +
 OvmfPkg/OvmfPkgX64.dsc  |  1 +
 OvmfPkg/OvmfXen.dsc |  1 +
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf   |  1 +
 OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf | 37 
++
 OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h   | 38 
++
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 41 
+-
 OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c   | 78 

 12 files changed, 166 insertions(+), 39 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 54804962ec02..4348bb45c64a 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -49,6 +49,10 @@ [LibraryClasses]
   #  access.
   PciCapPciSegmentLib|Include/Library/PciCapPciSegmentLib.h
 
+  ##  @libraryclass  Provide common utility functions to PciHostBridgeLib
+  #  instances in ArmVirtPkg and OvmfPkg.
+  PciHostBridgeUtilityLib|Include/Library/PciHostBridgeUtilityLib.h
+
   ##  @libraryclass  Register a status code handler for printing the Boot
   #  Manager's LoadImage() and StartImage() preparations, and
   #  return codes, to the UEFI console.
diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index dad8635c3388..62e97dbe320a 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -669,6 +669,7 @@ [Components]
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
 
   PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+  
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
   NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf
   }
   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 33edf3d2d6b5..9547523018e9 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -662,6 +662,7 @@ [Components]
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
 
   PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+  
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
   NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf
   }
   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 75c5f46a7786..3555bd1691f2 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -747,6 +747,7 @@ [Components]
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
 
   PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+  
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
   NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf
   }
   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 8693248b4ea0..d668c5c8eda8 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -761,6 +761,7 @@ [Components.X64]
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
 
   PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+  
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
   NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf
   }
   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 70ff2bcf2342..ff32efb5ba8b 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -759,6 +759,7 @@ [Components]
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
 
   PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+  
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
   NULL|OvmfPkg/Libr

[edk2-devel] [PATCH v6 05/11] OvmfPkg/PciHostBridgeUtilityLib: Extend parameters of InitRootBridge()

2021-01-18 Thread Jiahui Cen via groups.io
Extend parameter list of PciHostBridgeUtilityInitRootBridge() with
DmaAbove4G and NoExtendedConfigSpace to prepare for sharing with
ArmVirtPkg.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Anthony Perard 
Cc: Julien Grall 
Signed-off-by: Jiahui Cen 
Signed-off-by: Yubo Miao 
---
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf   |  1 +
 OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf |  4 --
 OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h   | 56 
+
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c |  5 ++
 OvmfPkg/Library/PciHostBridgeLib/XenSupport.c   |  1 +
 OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c   | 63 
+++-
 6 files changed, 73 insertions(+), 57 deletions(-)

diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
index 7944f94b7743..72458262cb42 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
@@ -50,4 +50,5 @@ [Pcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
   gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
diff --git 
a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf 
b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
index e3d0a3740952..4d6764b702f4 100644
--- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
+++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
@@ -39,7 +39,3 @@ [LibraryClasses]
   DebugLib
   DevicePathLib
   MemoryAllocationLib
-  PcdLib
-
-[Pcd]
-  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
index 8a1ddc2f5e02..a44ad5034520 100644
--- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
+++ b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
@@ -20,43 +20,49 @@
 /**
   Utility function to initialize a PCI_ROOT_BRIDGE structure.
 
-  @param[in]  Supports Supported attributes.
+  @param[in]  Supports   Supported attributes.
 
-  @param[in]  Attributes   Initial attributes.
+  @param[in]  Attributes Initial attributes.
 
-  @param[in]  AllocAttributes  Allocation attributes.
+  @param[in]  AllocAttributesAllocation attributes.
 
-  @param[in]  RootBusNumberThe bus number to store in RootBus.
+  @param[in]  DmaAbove4G DMA above 4GB memory.
 
-  @param[in]  MaxSubBusNumber  The inclusive maximum bus number that can be
-   assigned to any subordinate bus found behind any
-   PCI bridge hanging off this root bus.
+  @param[in]  NoExtendedConfigSpace  No Extended Config Space.
 
-   The caller is repsonsible for ensuring that
-   RootBusNumber <= MaxSubBusNumber. If
-   RootBusNumber equals MaxSubBusNumber, then the
-   root bus has no room for subordinate buses.
+  @param[in]  RootBusNumber  The bus number to store in RootBus.
 
-  @param[in]  Io   IO aperture.
+  @param[in]  MaxSubBusNumberThe inclusive maximum bus number that can
+ be assigned to any subordinate bus found
+ behind any PCI bridge hanging off this
+ root bus.
 
-  @param[in]  Mem  MMIO aperture.
+ The caller is repsonsible for ensuring
+ that RootBusNumber <= MaxSubBusNumber. If
+ RootBusNumber equals MaxSubBusNumber, then
+ the root bus has no room for subordinate
+ buses.
 
-  @param[in]  MemAbove4G   MMIO aperture above 4G.
+  @param[in]  Io IO aperture.
 
-  @param[in]  PMem Prefetchable MMIO aperture.
+  @param[in]  MemMMIO aperture.
 
-  @param[in]  PMemAbove4G  Prefetchable MMIO aperture above 4G.
+  @param[in]  MemAbove4G MMIO aperture above 4G.
 
-  @param[out] RootBus  The PCI_ROOT_BRIDGE structure (allocated by the
-   caller) that should be filled in by this
-   function.
+  @param[in]  PMem   Prefetchable MMIO aperture.
 
-  @retval EFI_SUCCESS   Initialization successful. A device path
-consisting of an ACPI device path node, with
-

[edk2-devel] [PATCH v6 06/11] ArmVirtPkg/FdtPciHostBridgeLib: Refactor init/uninit of root bridge

2021-01-18 Thread Jiahui Cen via groups.io
Rebase ArmVirtPkg/FdtPciHostBridgeLib to the new
PciHostBridgeUtilityInitRootBridge()/PciHostBridgeUtilityUninitRootBridge()
utility functions.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059

Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Jiahui Cen 
Signed-off-by: Yubo Miao 
---
 ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf |   1 +
 ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c   | 124 
++--
 2 files changed, 61 insertions(+), 64 deletions(-)

diff --git a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf 
b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
index 01d39626d14c..b813a0851d2a 100644
--- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
+++ b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
@@ -34,6 +34,7 @@ [Packages]
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
+  BaseMemoryLib
   DebugLib
   DevicePathLib
   DxeServicesTableLib
diff --git a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c 
b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
index d554479bf0de..3ec7992b6331 100644
--- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
+++ b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
@@ -7,6 +7,7 @@
 
 **/
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -20,37 +21,6 @@
 #include 
 #include 
 
-#pragma pack(1)
-typedef struct {
-  ACPI_HID_DEVICE_PATH AcpiDevicePath;
-  EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
-#pragma pack ()
-
-STATIC EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath = {
-  {
-{
-  ACPI_DEVICE_PATH,
-  ACPI_DP,
-  {
-(UINT8) (sizeof(ACPI_HID_DEVICE_PATH)),
-(UINT8) ((sizeof(ACPI_HID_DEVICE_PATH)) >> 8)
-  }
-},
-EISA_PNP_ID(0x0A03),
-0
-  },
-
-  {
-END_DEVICE_PATH_TYPE,
-END_ENTIRE_DEVICE_PATH_SUBTYPE,
-{
-  END_DEVICE_PATH_LENGTH,
-  0
-}
-  }
-};
-
 //
 // We expect the "ranges" property of "pci-host-ecam-generic" to consist of
 // records like this.
@@ -319,11 +289,18 @@ PciHostBridgeGetRootBridges (
   UINTN *Count
   )
 {
-  UINT64  IoBase, IoSize;
-  UINT64  Mmio32Base, Mmio32Size;
-  UINT64  Mmio64Base, Mmio64Size;
-  UINT32  BusMin, BusMax;
-  EFI_STATUS  Status;
+  UINT64   IoBase, IoSize;
+  UINT64   Mmio32Base, Mmio32Size;
+  UINT64   Mmio64Base, Mmio64Size;
+  UINT32   BusMin, BusMax;
+  EFI_STATUS   Status;
+  UINT64   Attributes;
+  UINT64   AllocationAttributes;
+  PCI_ROOT_BRIDGE_APERTURE Io;
+  PCI_ROOT_BRIDGE_APERTURE Mem;
+  PCI_ROOT_BRIDGE_APERTURE MemAbove4G;
+  PCI_ROOT_BRIDGE_APERTURE PMem;
+  PCI_ROOT_BRIDGE_APERTURE PMemAbove4G;
 
   if (PcdGet64 (PcdPciExpressBaseAddress) == 0) {
 DEBUG ((EFI_D_INFO, "%a: PCI host bridge not present\n", __FUNCTION__));
@@ -341,33 +318,29 @@ PciHostBridgeGetRootBridges (
 return NULL;
   }
 
-  *Count = 1;
+  ZeroMem (&Io, sizeof (Io));
+  ZeroMem (&Mem, sizeof (Mem));
+  ZeroMem (&MemAbove4G, sizeof (MemAbove4G));
+  ZeroMem (&PMem, sizeof (PMem));
+  ZeroMem (&PMemAbove4G, sizeof (PMemAbove4G));
 
-  mRootBridge.Segment   = 0;
-  mRootBridge.Supports  = EFI_PCI_ATTRIBUTE_ISA_IO_16 |
-  EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO |
-  EFI_PCI_ATTRIBUTE_VGA_IO_16  |
-  EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16;
-  mRootBridge.Attributes= mRootBridge.Supports;
+  Attributes   = EFI_PCI_ATTRIBUTE_ISA_IO_16 |
+ EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO |
+ EFI_PCI_ATTRIBUTE_VGA_IO_16  |
+ EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16;
 
-  mRootBridge.DmaAbove4G= TRUE;
-  mRootBridge.NoExtendedConfigSpace = FALSE;
-  mRootBridge.ResourceAssigned  = FALSE;
+  AllocationAttributes = EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM;
 
-  mRootBridge.AllocationAttributes  = EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM;
-
-  mRootBridge.Bus.Base  = BusMin;
-  mRootBridge.Bus.Limit = BusMax;
-  mRootBridge.Io.Base   = IoBase;
-  mRootBridge.Io.Limit  = IoBase + IoSize - 1;
-  mRootBridge.Mem.Base  = Mmio32Base;
-  mRootBridge.Mem.Limit = Mmio32Base + Mmio32Size - 1;
+  Io.Base  = IoBase;
+  Io.Limit = IoBase + IoSize - 1;
+  Mem.Base = Mmio32Base;
+  Mem.Limit= Mmio32Base + Mmio32Size - 1;
 
   if (sizeof (UINTN) == sizeof (UINT64)) {
-mRootBridge.MemAbove4G.Base   = Mmio64Base;
-mRootBridge.MemAbove4G.Limit  = Mmio64Base + Mmio64Size - 1;
+MemAbove4G.Base= Mmio64Base;
+MemAbove4G.Limit   = Mmio64Base + Mmi

[edk2-devel] [PATCH v6 00/11] Add extra pci roots support for Arm

2021-01-18 Thread Jiahui Cen via groups.io
v5->v6:
* Annotate library functions with EFIAPI, IN/OUT, @param[in]/[out].
* Split BusMin/BusMax addtion in PciHostBridgeUtilityGetRootBridges() into
  a separate patch [09/11].
* Add more detailed commit message for patch [10/11].

v4->v5:
* Revert some risky renames.
* Explicitly list PcdLib dependency.
* Fix issues reported by PatchCheck.py.

v3->v4:
* Refactor InitRootBridges/UninitRootBridges/GetRootBridges/FreeRootBridges.
* Fix library dependencies.

v2->v3:
* Rename utility functions under the PciHostBridgeUtilityLib namespace.
* Remove some unused Library dependencies.
* Sort the Include headers.

v1->v2:
* Separated into four patches.
* Factor the same logic parts into a new library.

v4: https://edk2.groups.io/g/devel/message/70147
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059
QEMU: 
https://lore.kernel.org/qemu-devel/20201119014841.7298-1-cenjia...@huawei.com/

This patch series adds support for extra pci roots for ARM.

In order to avoid duplicated codes, we introduce a new library
PciHostBridgeUtilityLib which extracts common interfaces from
OvmfPkg/PciHostBridgeLib. It provides conflicts informing and extra pci
roots scanning. Using the utility lib, the uefi could scan for extra
root buses and recognize multiple roots for ARM.

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Rebecca Cran 
Cc: Peter Grehan 
Cc: Anthony Perard 
Cc: Julien Grall 
Cc: Leif Lindholm 
Cc: Sami Mujawar 
Signed-off-by: Jiahui Cen 
Signed-off-by: Yubo Miao 

Jiahui Cen (11):
  OvmfPkg: Introduce PciHostBridgeUtilityLib class
  ArmVirtPkg: Refactor with PciHostBridgeUtilityLib
  OvmfPkg/PciHostBridgeLib: List missing PcdLib dependency
  OvmfPkg/PciHostBridgeLib: Extract InitRootBridge() /
UninitRootBridge()
  OvmfPkg/PciHostBridgeUtilityLib: Extend parameters of InitRootBridge()
  ArmVirtPkg/FdtPciHostBridgeLib: Refactor init/uninit of root bridge
  OvmfPkg/PciHostBridgeLib: Extract GetRootBridges() / FreeRootBridges()
  OvmfPkg/PciHostBridgeUtilityLib: Extend parameter list of
GetRootBridges
  OvmfPkg/PciHostBridgeUtilityLib: Extend GetRootBridges() with
BusMin/BusMax
  ArmVirtPkg/FdtPciHostBridgeLib: Add extra pci root buses support
  ArmVirtPkg/ArmVirtQemu: Add support for HotPlug

 OvmfPkg/OvmfPkg.dec
|   4 +
 ArmVirtPkg/ArmVirtKvmTool.dsc  
|   1 +
 ArmVirtPkg/ArmVirtQemu.dsc 
|   2 +
 ArmVirtPkg/ArmVirtQemuKernel.dsc   
|   2 +
 OvmfPkg/AmdSev/AmdSevX64.dsc   
|   1 +
 OvmfPkg/Bhyve/BhyveX64.dsc 
|   1 +
 OvmfPkg/OvmfPkgIa32.dsc
|   1 +
 OvmfPkg/OvmfPkgIa32X64.dsc 
|   1 +
 OvmfPkg/OvmfPkgX64.dsc 
|   1 +
 OvmfPkg/OvmfXen.dsc
|   1 +
 ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf 
|   3 +
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf  
|   4 +-
 OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
|  43 +++
 OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h  
| 185 +++
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridge.h   
|  56 
 ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c   
| 164 --
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
| 324 +---
 OvmfPkg/Library/PciHostBridgeLib/XenSupport.c  
|   5 +-
 OvmfPkg/Library/{PciHostBridgeLib/PciHostBridgeLib.c => 
PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c} | 281 +
 ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc   
|   1 +
 20 files changed, 467 insertions(+), 614 deletions(-)
 create mode 100644 
OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
 create mode 100644 OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
 copy OvmfPkg/Library/{PciHostBridgeLib/PciHostBridgeLib.c => 
PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c} (50%)

-- 
2.29.2



-

回复: [edk2-devel] Updated Event: TianoCore Bug Triage - APAC / NAMO #cal-invite

2021-01-18 Thread gaoliming
Hi, all

 The following issues will be reviewed in this week meeting. 

 


  3174

EDK2

Code

unassig...@tianocore.org

UNCO

EDKII Platform level Redfish packet encode/decode library 
 

Sun 22:49

abner.ch...@hpe.com


  3169

Tianocor

Code

unassig...@tianocore.org

UNCO

Support Tcg2Smm under Standalone MM environment 
 

Fri 13:20

kun@microsoft.com


  3170

EDK2

Code

unassig...@tianocore.org

UNCO

NetworkPkg/Library/DxeHttpIoLib: Http boot failure with no initializes timeout 
value.  

Fri 01:08

gregx@intel.com


  3168

Tianocor

Code

unassig...@tianocore.org

UNCO

Add non-MMRAM memory protection for Standalone MM environment 
 

Thu 21:08

kun@microsoft.com


  3166

EDK2

Code

unassig...@tianocore.org

UNCO

CoreValidateHandle() is unsafe. 
 

Wed 22:57

af...@apple.com


  2831

EDK2

Code

zhichao@intel.com

UNCO

UefiBootManagerLib is not specs compliant with regards to 
EFI_EVENT_GROUP_READY_TO_BOOT 
 

Wed 12:37

p...@akeo.ie


  3164

EDK2

Code

unassig...@tianocore.org

UNCO

IndustryStandard/SmBios.h has incorrectly capitalized filename 
 

2021-01-12

l...@nuviainc.com


  2557

Tianocor

Code

michael.d.kin...@intel.com

UNCO

New SPI Serial bus resource descriptor 
 

2021-01-11

john.ga...@huawei.com


  3157

EDK2

Code

unassig...@tianocore.org

UNCO

Openssl allocatepool failed in PEI phase when Image buffer is large then 64K 
 

2021-01-10

larry...@ami.com.tw


  3161

EDK2

Code

unassig...@tianocore.org

UNCO

Build failed on os.makedirs() for .cache 
 

2021-01-08

af...@apple.com


  3144

EDK2

Code

unassig...@tianocore.org

UNCO

Initialize Real Non-volatile storage 
 

2021-01-07

vu.d...@xelex.com.vn


  3156

EDK2

Code

unassig...@tianocore.org

UNCO

Core CI, Platform CI: issues with the  
 "ubuntu-latest" VM image

2021-01-06

ler...@redhat.com


  3135

EDK2

Code

unassig...@tianocore.org

UNCO

Boot would be first place after resetting BootOrder by efibootmgr 
 

2021-01-05

walon...@hpe.com

 

Thanks

Liming

 

发件人: bounce+27952+70511+4905953+8761...@groups.io 
 代表 devel@edk2.groups.io Calendar
发送时间: 2021年1月19日 8:54
收件人: devel@edk2.groups.io
主题: [edk2-devel] Updated Event: TianoCore Bug Triage - APAC / NAMO #cal-invite

 

TianoCore Bug Triage - APAC / NAMO

When:
Tuesday, 19 January 2021
6:30pm to 7:30pm
(UTC-08:00) America/Los Angeles 
Repeats: Weekly on Tuesday 

Where:
https://meetingsamer34.webex.com/meetingsamer34/j.php?MTID=mb96c5bd411bd010e1e6d43a6f6c65f45
 

Organizer: Liming Gao gaolim...@byosoft.com.cn 


Description:

TianoCore Bug Triage - APAC / NAMO

Hosted by Liming Gao

 

https://meetingsamer34.webex.com/meetingsamer34/j.php?MTID=mb96c5bd411bd010e1e6d43a6f6c65f45

Wednesday, Jan 20, 2021 10:30 am | 50 minutes | (UTC+08:00) Beijing, Chongqing, 
Hong Kong, Urumqi

Occurs every Wednesday effective 1/20/2021 from 10:30 AM to 11:20 AM, 
(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi

Meeting number: 126 867 1239

Password: ZhqYQunw246 (94797869 from video systems)

d8edc6c9604344b08f727b4bf054eaac_20210120T023000Z

 

Join by video system

Dial 1268671...@meetingsamer34.webex.com 
 

You can also dial 173.243.2.68 and enter your meeting number.

 

Join by phone

Use VoIP only





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70513): https://edk2.groups.io/g/devel/message/70513
Mute This Topic: https://groups.io/mt/79941591/21656
Mute #cal-invite:https://edk

回复: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to python

2021-01-18 Thread gaoliming
Bob:

 The code logic is fine. This is a big change. I suggest to update tool version 
from 1.0 to 2.0. With this change, Reviewed-by: Liming Gao 


 

Thanks

Liming

发件人: bounce+27952+70509+4905953+8761...@groups.io 
 代表 Bob Feng
发送时间: 2021年1月19日 7:57
收件人: devel@edk2.groups.io; gaolim...@byosoft.com.cn
主题: Re: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to python

 

Liming,

 

I have sent the patch V3 that is to move the unit test to tests/Split folder.

 

Do you have any other concerns about this patch?

 

Thanks,

Bob

 

From: Feng, Bob C 
Sent: Friday, January 15, 2021 9:50 AM
To: devel@edk2.groups.io  ; 
gaolim...@byosoft.com.cn  
Cc: Feng, Bob C mailto:bob.c.f...@intel.com> >
Subject: RE: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to 
python

 

Hi Liming,

 

1. The test framework can be used for both incremental test and functionality 
test. We can do more discussion when I send out this framework for review.

2. Yes, I agree to add a sub folder under the test folder. I’ll update the 
patch.

 

Is there any other comments before I send the patch V2?

 

Thanks,

Bob

 

From: devel@edk2.groups.io   mailto:devel@edk2.groups.io> > On Behalf Of gaoliming
Sent: Friday, January 15, 2021 9:13 AM
To: Feng, Bob C mailto:bob.c.f...@intel.com> >; 
devel@edk2.groups.io  
Subject: 回复: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to 
python

 

Bob:

 Thanks for your planning sharing. For BaseTools test, I still have some 
questions. 

 

1.  For test framework, is it the incremental test framework or the 
functionality test framework or both? 

2.  For BaseTools\Source\Python\tests\test_split.py, it creates new 
directory ‘tests’ for test case scripts, and use test_split.py for split tool. 
So, new tool test script will follow the same style. Besides, split tool is 
simple. It may not have its special test case. But, Fce/FMMT are too complex. 
They need the different bios images as their test cases. Then, where are those 
test cases placed into? I would prefer to place the test script and its test 
cases into the same directory. So, I would propose to create the subdirectory 
in ‘tests’ for each tool test, such as Split for this case. Then, every tool 
can place its test script and test case into its own directory. 

 

Thanks

Liming

发件人: tosubbounce+27952+0+...@groups.io 
  mailto:tosubbounce+27952+0+...@groups.io> > 代表 Bob Feng
发送时间: 2021年1月14日 10:46
收件人: gaoliming mailto:gaolim...@byosoft.com.cn> >; 
devel@edk2.groups.io  
主题: Re: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to python

 

Good questions. I answer them inline.

Thanks,
Bob

On Thu, Jan 14, 2021 at 08:53 AM, gaoliming wrote:

Bob:
Have you plan to convert all C tools to Python tools? Or only some ones?

I am still investigating the feasibility of converting the C tools to Python 
tools. Some C tools are simple but some are complex. I hope all the C tools can 
be converted to Python tools so that all the tools can be moved to the 
BaseTools separate repo. I think we can file some BZs to track the progress of 
the C tools conversion. And I hope there could be more volunteers to be 
involved in this work.

Here are the discussions about the benefit and process of moving BaseTools out 
of the edk2 repo for reference.

https://edk2.groups.io/g/devel/topic/76572200#64993 

https://edk2.groups.io/g/rfc/topic/74009714#270 

https://edk2.groups.io/g/devel/topic/73069134#58048

Can you share your planning for the changes in BaseTools?

Except for this patch, my current work for Basetools are:
1. Re-write the FMMT/FCE with Python and propose to add these 2 tools to the 
edk2 BaseTools.
2. Prepare to publish the Basetools incremental build regression test cases and 
test framework.

And, I see you also add unittest for new split tool. Can you introduce the
unittest framework for python tool? If so, new added tool can follow the
same way to add unittest.

The unittest is the python build-in library for the unit test. 
https://docs.python.org/3/library/unittest.html 
I provide the unit test is to help you to review this patch. From the unit test 
case, it will be easy to
see if this tool's behavior is as expected. 

I think for the python code development, we can try our best to follow this 
document. 
https://edk2-docs.gitbook.io/edk-ii-python-development-process-specification/ 


Thanks
Liming

-邮件原件-
发件人: bounce+27952+70232+4905953+8761...@groups.io 
 
mailto:bounce+27952+70232+4905953+8761...@groups.io> > 代表 Bob Feng
发送时间: 2021年1月13日 17:56
收件人: devel@edk2.groups.io  
主题: [edk2-devel] [Patch 0/2] Convert Split tool to python

There are 2 reasons to convert Split tool from C to Python.

1. We are

[edk2-devel] Updated Event: TianoCore Bug Triage - APAC / NAMO #cal-invite

2021-01-18 Thread devel@edk2.groups.io Calendar
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Groups.io Inc//Groups.io Calendar//EN
METHOD:PUBLISH
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:America/Los_Angeles
LAST-MODIFIED:20201011T015911Z
TZURL:http://tzurl.org/zoneinfo-outlook/America/Los_Angeles
X-LIC-LOCATION:America/Los_Angeles
BEGIN:DAYLIGHT
TZNAME:PDT
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
DTSTART:19700308T02
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZNAME:PST
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
DTSTART:19701101T02
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
X-GIOIDS:Repeat:14221
UID:mlda.1580078539586725120.r...@groups.io
DTSTAMP:20210119T005400Z
ORGANIZER;CN=Liming Gao:mailto:gaolim...@byosoft.com.cn
DTSTART;TZID=America/Los_Angeles:20210119T183000
DTEND;TZID=America/Los_Angeles:20210119T193000
RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
SUMMARY:TianoCore Bug Triage - APAC / NAMO
DESCRIPTION:TianoCore Bug Triage - APAC / NAMO\n\nHosted by Liming Gao\n\
 nhttps://meetingsamer34.webex.com/meetingsamer34/j.php?MTID=mb96c5bd411bd
 010e1e6d43a6f6c65f45\n\nWednesday\, Jan 20\, 2021 10:30 am | 50 minutes |
  (UTC+08:00) Beijing\, Chongqing\, Hong Kong\, Urumqi\n\nOccurs every Wed
 nesday effective 1/20/2021 from 10:30 AM to 11:20 AM\, (UTC+08:00) Beijin
 g\, Chongqing\, Hong Kong\, Urumqi\n\nMeeting number: 126 867 1239\n\nPas
 sword: ZhqYQunw246 (94797869 from video systems)\n\nd8edc6c9604344b08f727
 b4bf054eaac_20210120T023000Z\n\nJoin by video system\n\nDial 1268671239@m
 eetingsamer34.webex.com\n\nYou can also dial 173.243.2.68 and enter your 
 meeting number.\n\nJoin by phone\n\nUse VoIP only
LOCATION:https://meetingsamer34.webex.com/meetingsamer34/j.php?MTID=mb96c
 5bd411bd010e1e6d43a6f6c65f45
SEQUENCE:0
END:VEVENT
END:VCALENDAR


invite.ics
Description: application/ics


回复: [edk2-devel] [edk2-platforms PATCH v2] Intel Platforms: add OrderedCollectionLib class resolution

2021-01-18 Thread gaoliming
Reviewed-by: Liming Gao 

> -邮件原件-
> 发件人: bounce+27952+70497+4905953+8761...@groups.io
>  代表 Laszlo Ersek
> 发送时间: 2021年1月18日 16:48
> 收件人: edk2-devel-groups-io 
> 抄送: Chasel Chiu ; Eric Dong
> ; Kelly Steele ; Liming Gao
> ; Michael D Kinney
> ; Nate DeSimone
> ; Philippe Mathieu-Daudé
> ; Yi Qian ; Zailiang Sun
> 
> 主题: [edk2-devel] [edk2-platforms PATCH v2] Intel Platforms: add
> OrderedCollectionLib class resolution
> 
> The edk2 patch
> 
>   ShellPkg/ShellCommandLib: add ShellSortFileList
> 
> for BZ#3151 will make the
> 
>   ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
> 
> instance dependent on the OrderedCollectionLib class. Because the shell
> binaries in the Intel platform DSCs consume the above UefiShellCommandLib
> instance, resolve the OrderedCollectionLib class in them.
> 
> Cc: Chasel Chiu 
> Cc: Eric Dong 
> Cc: Kelly Steele 
> Cc: Liming Gao 
> Cc: Michael D Kinney 
> Cc: Nate DeSimone 
> Cc: Philippe Mathieu-Daudé 
> Cc: Yi Qian 
> Cc: Zailiang Sun 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3151
> Signed-off-by: Laszlo Ersek 
> ---
> 
> Notes:
> v2:
> 
> - extract OpenBoardPkg update from CometlakeURvp, GalagoPro3,
>   KabylakeRvp3, BoardX58Ich10, UpXtreme, WhiskeylakeURvp to
>   "MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc" [Liming]
> 
> - do not pick up Phil's and Nate's R-b, due to the above change
> 
>  Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 1 +
>  Platform/Intel/QuarkPlatformPkg/Quark.dsc   | 1 +
>  Platform/Intel/QuarkPlatformPkg/QuarkMin.dsc| 1 +
>  Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc| 1 +
>  Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc | 1 +
>  5 files changed, 5 insertions(+)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> index 5e3405d54785..cb40e111b5dd 100644
> --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> @@ -96,6 +96,7 @@ [LibraryClasses.common]
>ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
>FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
>SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
> +
> OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLi
> b/BaseOrderedCollectionRedBlackTreeLib.inf
> 
>#
># CPU
> diff --git a/Platform/Intel/QuarkPlatformPkg/Quark.dsc
> b/Platform/Intel/QuarkPlatformPkg/Quark.dsc
> index 9f64dcb62724..e29c7465b1e4 100644
> --- a/Platform/Intel/QuarkPlatformPkg/Quark.dsc
> +++ b/Platform/Intel/QuarkPlatformPkg/Quark.dsc
> @@ -912,6 +912,7 @@ [Components.IA32]
> 
> NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1Com
> mandsLib.inf
> 
> NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1
> CommandsLib.inf
> 
> HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingL
> ib.inf
> +
> OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLi
> b/BaseOrderedCollectionRedBlackTreeLib.inf
>PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> 
> BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgC
> ommandLib.inf
> 
> diff --git a/Platform/Intel/QuarkPlatformPkg/QuarkMin.dsc
> b/Platform/Intel/QuarkPlatformPkg/QuarkMin.dsc
> index db144aab75ae..6fdfba9a58dc 100644
> --- a/Platform/Intel/QuarkPlatformPkg/QuarkMin.dsc
> +++ b/Platform/Intel/QuarkPlatformPkg/QuarkMin.dsc
> @@ -639,6 +639,7 @@ [Components.IA32]
> 
> NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1Com
> mandsLib.inf
> 
> NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1
> CommandsLib.inf
> 
> HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingL
> ib.inf
> +
> OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLi
> b/BaseOrderedCollectionRedBlackTreeLib.inf
>PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> 
> BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgC
> ommandLib.inf
> 
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> index 4fa3e2013120..409f31c982d7 100644
> --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> @@ -1152,6 +1152,7 @@ [Components.IA32]
> 
> NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1Com
> mandsLib.inf
> 
> NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1
> CommandsLib.inf
> 
> HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingL
> ib.inf
> +
> OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLi
> b/BaseOrderedCollectionRedBlackTreeLib.inf
>PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> 
> BcfgCommandLib|ShellPkg/Library/

Re: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to python

2021-01-18 Thread Bob Feng
Liming,

I have sent the patch V3 that is to move the unit test to tests/Split folder.

Do you have any other concerns about this patch?

Thanks,
Bob

From: Feng, Bob C
Sent: Friday, January 15, 2021 9:50 AM
To: devel@edk2.groups.io; gaolim...@byosoft.com.cn
Cc: Feng, Bob C 
Subject: RE: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to 
python

Hi Liming,

1. The test framework can be used for both incremental test and functionality 
test. We can do more discussion when I send out this framework for review.
2. Yes, I agree to add a sub folder under the test folder. I’ll update the 
patch.

Is there any other comments before I send the patch V2?

Thanks,
Bob

From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> On Behalf Of gaoliming
Sent: Friday, January 15, 2021 9:13 AM
To: Feng, Bob C mailto:bob.c.f...@intel.com>>; 
devel@edk2.groups.io
Subject: 回复: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to 
python

Bob:
 Thanks for your planning sharing. For BaseTools test, I still have some 
questions.


1. For test framework, is it the incremental test framework or the 
functionality test framework or both?

2. For BaseTools\Source\Python\tests\test_split.py, it creates new 
directory ‘tests’ for test case scripts, and use test_split.py for split tool. 
So, new tool test script will follow the same style. Besides, split tool is 
simple. It may not have its special test case. But, Fce/FMMT are too complex. 
They need the different bios images as their test cases. Then, where are those 
test cases placed into? I would prefer to place the test script and its test 
cases into the same directory. So, I would propose to create the subdirectory 
in ‘tests’ for each tool test, such as Split for this case. Then, every tool 
can place its test script and test case into its own directory.

Thanks
Liming
发件人: 
tosubbounce+27952+0+...@groups.io 
mailto:tosubbounce+27952+0+...@groups.io>> 
代表 Bob Feng
发送时间: 2021年1月14日 10:46
收件人: gaoliming mailto:gaolim...@byosoft.com.cn>>; 
devel@edk2.groups.io
主题: Re: [edk2-devel] 回复: [edk2-devel] [Patch 0/2] Convert Split tool to python

Good questions. I answer them inline.

Thanks,
Bob

On Thu, Jan 14, 2021 at 08:53 AM, gaoliming wrote:
Bob:
Have you plan to convert all C tools to Python tools? Or only some ones?
I am still investigating the feasibility of converting the C tools to Python 
tools. Some C tools are simple but some are complex. I hope all the C tools can 
be converted to Python tools so that all the tools can be moved to the 
BaseTools separate repo. I think we can file some BZs to track the progress of 
the C tools conversion. And I hope there could be more volunteers to be 
involved in this work.

Here are the discussions about the benefit and process of moving BaseTools out 
of the edk2 repo for reference.
https://edk2.groups.io/g/devel/topic/76572200#64993
https://edk2.groups.io/g/rfc/topic/74009714#270
https://edk2.groups.io/g/devel/topic/73069134#58048
Can you share your planning for the changes in BaseTools?
Except for this patch, my current work for Basetools are:
1. Re-write the FMMT/FCE with Python and propose to add these 2 tools to the 
edk2 BaseTools.
2. Prepare to publish the Basetools incremental build regression test cases and 
test framework.
And, I see you also add unittest for new split tool. Can you introduce the
unittest framework for python tool? If so, new added tool can follow the
same way to add unittest.
The unittest is the python build-in library for the unit test. 
https://docs.python.org/3/library/unittest.html
I provide the unit test is to help you to review this patch. From the unit test 
case, it will be easy to
see if this tool's behavior is as expected.

I think for the python code development, we can try our best to follow this 
document. 
https://edk2-docs.gitbook.io/edk-ii-python-development-process-specification/

Thanks
Liming
-邮件原件-
发件人: 
bounce+27952+70232+4905953+8761...@groups.io
mailto:bounce+27952+70232+4905953+8761...@groups.io>>
 代表 Bob Feng
发送时间: 2021年1月13日 17:56
收件人: devel@edk2.groups.io
主题: [edk2-devel] [Patch 0/2] Convert Split tool to python

There are 2 reasons to convert Split tool from C to Python.

1. We are in the process of moving the Basetools Python code

to a separate repository. But there still are many C tools under

edk2/BaseTools. To make all Basetools be in the separate repo,

we can convert the C tools to Python tools.

2. The original Split tool is very slow. This python tool can reduce

90% time

Bob Feng (2):
BaseTools: Convert Split tool to python
BaseTools: Add unittest for Split tool

BaseTools/Source/C/Split/Split.c | 466 
BaseTools/BinWrappers/PosixLike/Split | 31 +-
BaseTools/BinWrappers/WindowsLike/Split.bat | 3 +
BaseToo