Re: [edk2-devel] [PATCH v1 0/3] Enable RISC-V architecture for RISC-V EDK2 CI.

2020-04-24 Thread Sean via groups.io
Please run a a test PR with this patchset?  I would like to see how it impacts 
the build times.
Patche series look fine to me.

Reviewed-by: Sean Brogan 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58126): https://edk2.groups.io/g/devel/message/58126
Mute This Topic: https://groups.io/mt/72916297/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: Rebuild the description table after Reset Device

2020-04-24 Thread Guomin Jiang
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2694

When the USB fail and then Reset Device, it should rebuild description.

Signed-off-by: Guomin Jiang 
Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
---
 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c 
b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
index 4b4915c019..9f2d2cc87f 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
@@ -869,6 +869,11 @@ UsbIoPortReset (
 
   DEBUG (( EFI_D_INFO, "UsbIoPortReset: device is now ADDRESSED at %d\n", 
Dev->Address));
 
+  //
+  // The description will be invalid after reset, should rebuild it as well.
+  //
+  UsbBuildDescTable (Dev);
+
   //
   // Reset the current active configure, after this device
   // is in CONFIGURED state.
-- 
2.25.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58125): https://edk2.groups.io/g/devel/message/58125
Mute This Topic: https://groups.io/mt/73255478/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v1 0/2] Drop FrameworkHandle param from SaveFrameworkState()

2020-04-24 Thread brbarkel via groups.io
Reviewed-by: Bret Barkelew 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58124): https://edk2.groups.io/g/devel/message/58124
Mute This Topic: https://groups.io/mt/73179709/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH] ShellPkg: smbiosview - print field values as unsigned integers

2020-04-24 Thread Rebecca Cran
This prevents overflow when printing DWORD fields such as the type 17
tables's extended DIMM size.

Cc: Ray Ni 
Cc: Zhichao Gao 
Signed-off-by: Rebecca Cran 
---
 .../Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
index a75caff3de..be8b7c0a97 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
@@ -49,7 +49,7 @@
 #define PRINT_STRUCT_VALUE(pStruct, type, element) \
   do { \
 ShellPrintEx(-1,-1,L"%a",#element); \
-ShellPrintEx(-1,-1,L": %d\n", (pStruct->type->element)); \
+ShellPrintEx(-1,-1,L": %u\n", (pStruct->type->element)); \
   } while (0);
 
 #define PRINT_STRUCT_VALUE_H(pStruct, type, element) \
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58123): https://edk2.groups.io/g/devel/message/58123
Mute This Topic: https://groups.io/mt/73253250/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH] OvmfPkg: replace old EFI_D_ debug levels with new DEBUG_ ones

2020-04-24 Thread Rebecca Cran
Signed-off-by: Rebecca Cran 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
---
 OvmfPkg/AcpiPlatformDxe/EntryPoint.c  |  8 +-
 OvmfPkg/AcpiPlatformDxe/PciDecoding.c | 10 +--
 OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c   | 32 
 OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.c| 16 ++--
 OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c   |  2 +-
 OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.c|  2 +-
 OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c  |  2 +-
 OvmfPkg/Csm/LegacyBiosDxe/LegacyBios.c| 18 ++---
 OvmfPkg/Csm/LegacyBiosDxe/LegacyBootSupport.c | 80 +--
 OvmfPkg/Csm/LegacyBiosDxe/LegacyPci.c | 62 +++---
 OvmfPkg/Csm/LegacyBiosDxe/LegacySio.c |  2 +-
 OvmfPkg/Csm/LegacyBiosDxe/Thunk.c |  2 +-
 .../LegacyBootMaintUiLib/LegacyBootMaintUi.c  |  2 +-
 OvmfPkg/Csm/LegacyBootManagerLib/LegacyBm.c   |  6 +-
 OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c| 16 ++--
 .../IncompatiblePciDeviceSupport.c|  2 +-
 .../Library/AcpiTimerLib/BaseAcpiTimerLib.c   |  2 +-
 .../AcpiTimerLib/BaseRomAcpiTimerLib.c|  4 +-
 .../Library/AcpiTimerLib/DxeAcpiTimerLib.c|  2 +-
 OvmfPkg/Library/LoadLinuxLib/Linux.c  |  8 +-
 OvmfPkg/Library/NvVarsFileLib/FsAccess.c  | 16 ++--
 .../PciHostBridgeLib/PciHostBridgeLib.c   | 18 ++---
 .../PlatformBootManagerLib/BdsPlatform.c  | 30 +++
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c   |  6 +-
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c   |  2 +-
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c   |  6 +-
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c   |  8 +-
 .../SerializeVariablesLib.c   |  2 +-
 .../SmbiosVersionLib/DetectSmbiosVersionLib.c |  4 +-
 .../VirtioMmioDeviceLib/VirtioMmioDevice.c|  2 +-
 .../Library/XenHypercallLib/XenHypercall.c|  2 +-
 OvmfPkg/Library/XenIoMmioLib/XenIoMmioLib.c   |  4 +-
 OvmfPkg/PlatformDxe/Platform.c|  6 +-
 OvmfPkg/PlatformPei/FeatureControl.c  |  4 +-
 OvmfPkg/PlatformPei/Fv.c  |  2 +-
 OvmfPkg/PlatformPei/MemDetect.c   | 10 +--
 OvmfPkg/PlatformPei/Platform.c| 22 ++---
 OvmfPkg/PlatformPei/Xen.c |  4 +-
 .../FwBlockService.c  | 10 +--
 .../FwBlockServiceDxe.c   |  4 +-
 .../FwBlockServiceSmm.c   |  2 +-
 .../QemuFlash.c   | 14 ++--
 OvmfPkg/QemuVideoDxe/Driver.c | 10 +--
 OvmfPkg/QemuVideoDxe/Gop.c|  4 +-
 OvmfPkg/QemuVideoDxe/Initialize.c |  8 +-
 OvmfPkg/QemuVideoDxe/VbeShim.c|  4 +-
 OvmfPkg/SataControllerDxe/SataController.c| 12 +--
 OvmfPkg/Sec/SecMain.c | 22 ++---
 OvmfPkg/SmmAccess/SmmAccessPei.c  |  4 +-
 OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c   | 16 ++--
 OvmfPkg/VirtioGpuDxe/Commands.c   |  8 +-
 OvmfPkg/VirtioGpuDxe/DriverBinding.c  |  8 +-
 OvmfPkg/VirtioGpuDxe/VirtioGpu.h  |  2 +-
 OvmfPkg/XenBusDxe/EventChannel.c  |  2 +-
 OvmfPkg/XenBusDxe/GrantTable.c|  8 +-
 OvmfPkg/XenBusDxe/XenBus.c| 14 ++--
 OvmfPkg/XenBusDxe/XenBusDxe.c |  4 +-
 OvmfPkg/XenBusDxe/XenStore.c  | 28 +++
 OvmfPkg/XenIoPciDxe/XenIoPciDxe.c |  2 +-
 OvmfPkg/XenPvBlkDxe/BlockFront.c  | 50 ++--
 OvmfPkg/XenPvBlkDxe/BlockIo.c |  6 +-
 OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.c |  2 +-
 62 files changed, 335 insertions(+), 335 deletions(-)

diff --git a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c 
b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
index 4fd7abc0b4..f66f892911 100644
--- a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
+++ b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
@@ -39,12 +39,12 @@ OnRootBridgesConnected (
 {
   EFI_STATUS Status;
 
-  DEBUG ((EFI_D_INFO,
+  DEBUG ((DEBUG_INFO,
 "%a: root bridges have been connected, installing ACPI tables\n",
 __FUNCTION__));
   Status = InstallAcpiTables (FindAcpiTableProtocol ());
   if (EFI_ERROR (Status)) {
-DEBUG ((EFI_D_ERROR, "%a: InstallAcpiTables: %r\n", __FUNCTION__, Status));
+DEBUG ((DEBUG_ERROR, "%a: InstallAcpiTables: %r\n", __FUNCTION__, Status));
   }
   gBS->CloseEvent (Event);
 }
@@ -66,7 +66,7 @@ AcpiPlatformEntryPoint (
   // the full functionality.
   //
   if (PcdGetBool (PcdPciDisableBusEnumeration)) {
-DEBUG ((EFI_D_INFO, "%a: PCI or its enumeration disabled, installing "
+DEBUG ((DEBUG_INFO, "%a: PCI or its enumeration disabled, installing "
   "ACPI tables\n", __FUNCTION__));
 return InstallAcpiTables (FindAcpiTableProtocol ());
   }
@@ -81,7 +81,7 @@ AcpiPlatformEntryPoint (
   OnRootBridgesConnected, NULL /* Context */,
   , );
   if (!EFI_ERROR (Status)) {
-DEBUG ((EFI_D_INFO,
+DEBUG ((DEBUG_INFO,
   "%a: waiting for root bridges to be connected, 

[edk2-devel] [PATCH v3 4/7] OvmfPkg: Add Platform CI and configuration for Core CI

2020-04-24 Thread Michael Kubacki
From: Sean Brogan 

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2570

Add new Azure Pipeline definitions to build and run OvmfPkg with:
  * Ubuntu GCC5
  * Windows VS2019
Add PyTool based build of OvmfPkg
Add extdep for managing the iasl dependency
Add OvmfPkg.ci.yaml for Core CI
Add ReadMe.md for details and instructions

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Signed-off-by: Sean Brogan 
Signed-off-by: Michael Kubacki 
Acked-by: Laszlo Ersek 
Acked-by: Ard Biesheuvel 
Reviewed-by: Shenglei Zhang 
Reviewed-by: Bret Barkelew 
---
 OvmfPkg/OvmfPkg.ci.yaml   |  83 +++
 OvmfPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml| 133 ++
 OvmfPkg/PlatformCI/.azurepipelines/Windows-VS2019.yml | 138 +++
 OvmfPkg/PlatformCI/PlatformBuild.py   | 254 

 OvmfPkg/PlatformCI/ReadMe.md  | 137 +++
 OvmfPkg/PlatformCI/iasl_ext_dep.yaml  |  21 ++
 6 files changed, 766 insertions(+)

diff --git a/OvmfPkg/OvmfPkg.ci.yaml b/OvmfPkg/OvmfPkg.ci.yaml
new file mode 100644
index ..98992f0429ff
--- /dev/null
+++ b/OvmfPkg/OvmfPkg.ci.yaml
@@ -0,0 +1,83 @@
+## @file
+# Core CI configuration for OvmfPkg
+#
+# OvmfPkg is part of Platform Ci for builds so this is only
+# used for code analysis.
+#
+# Copyright (c) Microsoft Corporation
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+## options defined .pytool/Plugin/CompilerPlugin
+"CompilerPlugin": {
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/HostUnitTestCompilerPlugin
+"HostUnitTestCompilerPlugin": {
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/CharEncodingCheck
+"CharEncodingCheck": {
+"IgnoreFiles": []
+},
+
+## options defined .pytool/Plugin/DependencyCheck
+"DependencyCheck": {
+"AcceptableDependencies": [
+"MdePkg/MdePkg.dec",
+"MdeModulePkg/MdeModulePkg.dec",
+"OvmfPkg/OvmfPkg.dec",
+"NetworkPkg/NetworkPkg.dec",
+"SecurityPkg/SecurityPkg.dec",
+"UefiCpuPkg/UefiCpuPkg.dec",
+"ShellPkg/ShellPkg.dec",
+"EmbeddedPkg/EmbeddedPkg.dec",
+"SourceLevelDebugPkg/SourceLevelDebugPkg.dec"
+],
+# For host based unit tests
+"AcceptableDependencies-HOST_APPLICATION":[
+"UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec"
+],
+# For UEFI shell based apps
+"AcceptableDependencies-UEFI_APPLICATION":[],
+"IgnoreInf": []
+},
+
+## options defined .pytool/Plugin/DscCompleteCheck
+"DscCompleteCheck": {
+"IgnoreInf": [""],
+"DscPath": ""  # Don't support this test
+},
+
+## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck
+"HostUnitTestDscCompleteCheck": {
+"IgnoreInf": [""],
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/GuidCheck
+"GuidCheck": {
+"IgnoreGuidName": ["ResetVector", "XenResetVector"], # Expected 
duplication for gEfiFirmwareVolumeTopFileGuid
+"IgnoreGuidValue": [],
+"IgnoreFoldersAndFiles": [],
+"IgnoreDuplicates": [],
+},
+
+## options defined .pytool/Plugin/LibraryClassCheck
+"LibraryClassCheck": {
+"IgnoreHeaderFile": []
+},
+
+## options defined .pytool/Plugin/SpellCheck
+"SpellCheck": {
+"AuditOnly": True,   # Fails right now with over 270 errors
+"IgnoreFiles": [],   # use gitignore syntax to ignore errors 
in matching files
+"ExtendWords": [
+
+],   # words to extend to the dictionary for this package
+"IgnoreStandardPaths": [],   # Standard Plugin defined paths that 
should be ignore
+"AdditionalIncludePaths": [] # Additional paths to spell check 
(wildcards supported)
+}
+}
diff --git a/OvmfPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml 
b/OvmfPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml
new file mode 100644
index ..a47d273217ab
--- /dev/null
+++ b/OvmfPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml
@@ -0,0 +1,133 @@
+## @file
+# Azure Pipeline build file for building a platform.
+#
+# Platform: OVMF
+# OS: Ubuntu
+# Toolchain: GCC5
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+trigger:
+  - master
+pr:
+  - master
+
+jobs:
+  - job: Platform_CI
+variables:
+  package: 'OvmfPkg'
+  vm_image: 'ubuntu-latest'
+  should_run: true
+  run_flags: "MAKE_STARTUP_NSH=TRUE QEMU_HEADLESS=TRUE"
+
+#Use matrix to speed up the build process
+strategy:
+matrix:
+  OVMF_IA32_DEBUG:
+Build.File: "$(package)/PlatformCI/PlatformBuild.py"
+Build.Arch: "IA32"
+Build.Flags: ""
+Build.Target: "DEBUG"
+

[edk2-devel] [PATCH v3 5/7] .pytool: Update CI Settings to support Emulator, ArmVirt, and Ovmf packages

2020-04-24 Thread Michael Kubacki
From: Sean Brogan 

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2570

Update pytools configuration to enable EmulatorPkg, ArmVirtPkg,
and OvmfPkg.

Update documentation for the status of those packages.
Remove future work items that are now complete.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Sean Brogan 
Signed-off-by: Michael Kubacki 
Reviewed-by: Shenglei Zhang 
Reviewed-by: Bret Barkelew 
---
 .pytool/CISettings.py  |  7 +--
 .pytool/Plugin/SpellCheck/cspell.base.yaml | 14 ++
 .pytool/Readme.md  | 10 --
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/.pytool/CISettings.py b/.pytool/CISettings.py
index e373d17a6c34..7a8bd3380383 100644
--- a/.pytool/CISettings.py
+++ b/.pytool/CISettings.py
@@ -39,7 +39,9 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, 
SetupSettingsManag
 ''' return iterable of edk2 packages supported by this build.
 These should be edk2 workspace relative paths '''
 
-return ("MdePkg",
+return ("ArmVirtPkg",
+"EmulatorPkg",
+"MdePkg",
 "MdeModulePkg",
 "NetworkPkg",
 "PcAtChipsetPkg",
@@ -49,7 +51,8 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, 
SetupSettingsManag
 "ShellPkg",
 "FatPkg",
 "CryptoPkg",
-"UnitTestFrameworkPkg"
+"UnitTestFrameworkPkg",
+"OvmfPkg"
 )
 
 def GetArchitecturesSupported(self):
diff --git a/.pytool/Plugin/SpellCheck/cspell.base.yaml 
b/.pytool/Plugin/SpellCheck/cspell.base.yaml
index aa15170c013c..1ce5f6991104 100644
--- a/.pytool/Plugin/SpellCheck/cspell.base.yaml
+++ b/.pytool/Plugin/SpellCheck/cspell.base.yaml
@@ -164,5 +164,19 @@
 "Sdhci",
 "inmodule",
 "RISCV",
+"edksetup",
+"iscsi",
+"nvdata",
+"pytools",
+"NTDDI",
+"Wnonportable",
+"CLANGPDB",
+"nologo",
+"lldmap",
+"ASMLINK",
+"NODEFAULTLIB",
+"vcruntimed",
+"ucrtd",
+"msvcrtd",
 ]
 }
diff --git a/.pytool/Readme.md b/.pytool/Readme.md
index 135d283fe223..c7dce3b64ca0 100644
--- a/.pytool/Readme.md
+++ b/.pytool/Readme.md
@@ -6,11 +6,11 @@
 | :   | :-   | :   
  | :--- |
 | ArmPkg  |
 | ArmPlatformPkg  |
-| ArmVirtPkg  |
+| ArmVirtPkg  | SEE PACKAGE README | SEE PACKAGE README |
 | CryptoPkg   | :heavy_check_mark: | :heavy_check_mark: | Spell 
checking in audit mode
 | DynamicTablesPkg|
 | EmbeddedPkg |
-| EmulatorPkg |
+| EmulatorPkg | SEE PACKAGE README | SEE PACKAGE README | Spell 
checking in audit mode
 | FatPkg  | :heavy_check_mark: | :heavy_check_mark: |
 | FmpDevicePkg| :heavy_check_mark: | :heavy_check_mark: |
 | IntelFsp2Pkg|
@@ -18,7 +18,7 @@
 | MdeModulePkg| :heavy_check_mark: | :heavy_check_mark: | DxeIpl 
dependency on ArmPkg, Depends on StandaloneMmPkg, Spell checking in audit mode
 | MdePkg  | :heavy_check_mark: | :heavy_check_mark: | Spell 
checking in audit mode
 | NetworkPkg  | :heavy_check_mark: | :heavy_check_mark: | Spell 
checking in audit mode
-| OvmfPkg |
+| OvmfPkg | SEE PACKAGE README | SEE PACKAGE README | Spell 
checking in audit mode
 | PcAtChipsetPkg  | :heavy_check_mark: | :heavy_check_mark: |
 | SecurityPkg | :heavy_check_mark: | :heavy_check_mark: | Spell 
checking in audit mode
 | ShellPkg| :heavy_check_mark: | :heavy_check_mark: | Spell 
checking in audit mode, 3 modules are not being built by DSC
@@ -77,7 +77,7 @@ per package configuration which comes from this file.
 ## Running CI locally
 
 The EDKII Tools environment (and by extension the ci) is designed to support
-easily and consistantly running locally and in a cloud ci environment.  To do
+easily and consistently running locally and in a cloud ci environment.  To do
 that a few steps should be followed.  Details of EDKII Tools can be found in 
the
 [docs folder 
here](https://github.com/tianocore/edk2-pytool-extensions/tree/master/docs)
 
@@ -216,8 +216,6 @@ few standard scopes.
 * Visual Studio AARCH64 and ARM support
 * BaseTools C tools CI/PR and binary release process
 * BaseTools Python tools CI/PR process
-* Host based unit testing
 * Extensible private/closed source platform reporting
-* Platform builds, validation
 * UEFI SCTs
 * Other automation
-- 
2.16.3.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58119): https://edk2.groups.io/g/devel/message/58119
Mute This Topic: https://groups.io/mt/73251666/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 

[edk2-devel] [PATCH v3 6/7] .azurepipelines: Update Core CI build matrix to include platforms

2020-04-24 Thread Michael Kubacki
From: Sean Brogan 

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2570

Add ArmVirtPkg to Core CI matrix
Add EmulatorPkg to Core CI matrix
Add OvmfPkg to Core CI matrix

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Sean Brogan 
Signed-off-by: Michael Kubacki 
Reviewed-by: Shenglei Zhang 
Reviewed-by: Bret Barkelew 
---
 .azurepipelines/templates/pr-gate-build-job.yml | 5 +
 1 file changed, 5 insertions(+)

diff --git a/.azurepipelines/templates/pr-gate-build-job.yml 
b/.azurepipelines/templates/pr-gate-build-job.yml
index 61868554d43c..a9f89aa68451 100644
--- a/.azurepipelines/templates/pr-gate-build-job.yml
+++ b/.azurepipelines/templates/pr-gate-build-job.yml
@@ -44,6 +44,11 @@ jobs:
   TARGET_SECURITY:
 Build.Pkgs: 'SecurityPkg'
 Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
+  TARGET_PLATFORMS:
+# For Platforms only check code. Leave it to Platform CI
+# to build them.
+Build.Pkgs: 'ArmVirtPkg,EmulatorPkg,OvmfPkg'
+Build.Targets: 'NO-TARGET'
 
   workspace:
 clean: all
-- 
2.16.3.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58120): https://edk2.groups.io/g/devel/message/58120
Mute This Topic: https://groups.io/mt/73251669/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v3 3/7] EmulatorPkg: Add Platform CI and configuration for Core CI

2020-04-24 Thread Michael Kubacki
From: Sean Brogan 

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2570

Add new Azure Pipeline definitions to build and run EmulatorPkg with:
  * Ubuntu GCC5
  * Windows VS2019
Add PyTool based build of EmulatorPkg
Add EmulatorPkg.ci.yaml for Core CI
Add ReadMe.md for details and instructions

Cc: Jordan Justen 
Cc: Andrew Fish 
Cc: Ray Ni 
Signed-off-by: Sean Brogan 
Signed-off-by: Michael Kubacki 
Reviewed-by: Shenglei Zhang 
Reviewed-by: Bret Barkelew 
---
 EmulatorPkg/EmulatorPkg.ci.yaml   |  85 ++
 EmulatorPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml|  95 +++
 EmulatorPkg/PlatformCI/.azurepipelines/Windows-VS2019.yml |  85 ++
 EmulatorPkg/PlatformCI/PlatformBuild.py   | 272 

 EmulatorPkg/PlatformCI/ReadMe.md  | 128 +
 5 files changed, 665 insertions(+)

diff --git a/EmulatorPkg/EmulatorPkg.ci.yaml b/EmulatorPkg/EmulatorPkg.ci.yaml
new file mode 100644
index ..81f81780ec76
--- /dev/null
+++ b/EmulatorPkg/EmulatorPkg.ci.yaml
@@ -0,0 +1,85 @@
+## @file
+# Core CI configuration for EmulatorPkg
+#
+# EmulatorPkg is part of Platform Ci for builds so this is only
+# used for code analysis.
+#
+# Copyright (c) Microsoft Corporation
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+## options defined .pytool/Plugin/CompilerPlugin
+"CompilerPlugin": {
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/HostUnitTestCompilerPlugin
+"HostUnitTestCompilerPlugin": {
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/CharEncodingCheck
+"CharEncodingCheck": {
+"IgnoreFiles": []
+},
+
+## options defined .pytool/Plugin/DependencyCheck
+"DependencyCheck": {
+"AcceptableDependencies": [
+# For this platform all packages are allowed???
+"MdePkg/MdePkg.dec",
+"MdeModulePkg/MdeModulePkg.dec",
+"EmulatorPkg/EmulatorPkg.dec",
+"NetworkPkg/NetworkPkg.dec",
+"EmbeddedPkg/EmbeddedPkg.dec", ## is this one OK??
+],
+# For host based unit tests
+"AcceptableDependencies-HOST_APPLICATION":[
+"UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec"
+],
+# For UEFI shell based apps
+"AcceptableDependencies-UEFI_APPLICATION":[],
+"IgnoreInf": []
+},
+
+## options defined .pytool/Plugin/DscCompleteCheck
+"DscCompleteCheck": {
+"IgnoreInf": [""],
+"DscPath": ""  # Don't support this test
+},
+
+## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck
+"HostUnitTestDscCompleteCheck": {
+"IgnoreInf": [""],
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/GuidCheck
+"GuidCheck": {
+"IgnoreGuidName": [],
+"IgnoreGuidValue": [],
+"IgnoreFoldersAndFiles": [],
+"IgnoreDuplicates": [],
+},
+
+## options defined .pytool/Plugin/LibraryClassCheck
+"LibraryClassCheck": {
+"IgnoreHeaderFile": []
+},
+
+## options defined .pytool/Plugin/SpellCheck
+"SpellCheck": {
+"AuditOnly": True,   # Fails right now with over 270 errors
+"IgnoreFiles": [],   # use gitignore syntax to ignore errors 
in matching files
+"ExtendWords": [
+"setjump",
+"plong",
+"lparam",
+"lpdword",
+"lpthread",
+"lresult",
+],   # words to extend to the dictionary for this package
+"IgnoreStandardPaths": [],   # Standard Plugin defined paths that 
should be ignore
+"AdditionalIncludePaths": [] # Additional paths to spell check 
(wildcards supported)
+}
+}
diff --git a/EmulatorPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml 
b/EmulatorPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml
new file mode 100644
index ..12ef8226ff54
--- /dev/null
+++ b/EmulatorPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml
@@ -0,0 +1,95 @@
+## @file
+# Azure Pipeline build file for building a platform.
+#
+# Platform: EmulatorPkg
+# OS: Ubuntu
+# Toolchain: GCC5
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+trigger:
+  - master
+pr:
+  - master
+jobs:
+  - job: Platform_CI
+variables:
+  package: 'EmulatorPkg'
+  vm_image: 'ubuntu-latest'
+  should_run: false
+  run_flags: "MAKE_STARTUP_NSH=TRUE"
+
+#Use matrix to speed up the build process
+strategy:
+matrix:
+  EmulatorPkg_X64_DEBUG:
+Build.File: "$(package)/PlatformCI/PlatformBuild.py"
+Build.Arch: "X64"
+Build.Flags: ""
+Build.Target: "DEBUG"
+Run.Flags: $(run_flags)
+Run: $(should_run)
+  EmulatorPkg_X64_RELEASE:
+Build.File: 

[edk2-devel] [PATCH v3 0/7] Edk2 Platform and Core CI for ArmVirtPkg, EmulatorPkg, and OvmfPkg

2020-04-24 Thread Michael Kubacki
From: Michael Kubacki 

Attention: Reviewed-by is still needed from some package maintainers.
* 0002-ArmVirtPkg-Add-Platform-CI-and-configuration-for-Cor.patch
  * Laszlo Ersek 
  * Ard Biesheuvel 
  * Leif Lindholm 
* 0003-EmulatorPkg-Add-Platform-CI-and-configuration-for-Co.patch
  * Jordan Justen 
  * Andrew Fish 
  * Ray Ni 
* 0004-OvmfPkg-Add-Platform-CI-and-configuration-for-Core-C.patch
  * Jordan Justen 
  * Laszlo Ersek 
  * Ard Biesheuvel 

The following 7 patches add support for Azure DevOps based "Platform CI"
for ArmVirtPkg, OvmfPkg, and EmulatorPkg.

The patch set also adds ArmVirtPkg, OvmfPkg, and EmulatorPkg to Core CI
for the code evaluation tests (not compiling).

*Note about patch #7*:
On final commit to master, patch 7 will be committed after the builds are
defined for each package. These cannot be defined until patches 1-6 are
committed to master and the builds created in Azure Dev Ops. Once created,
the links in the ReadMe.rst file will be corrected and then patch #7 will
be committed. 

Changes for V3:
* Package Platform CI ReadMe’s have been moved to the PlatformCI folder
  and are in markdown format. Build status is not included in this
  readme but instead all combined in the edk2 readme to bring top level
  visibility to these builds since they will be required to pass for
  PR completion.
* Patch #7 added to convert edk2 readme to RST and add table of platform
  CI status badges.

Changes for V2:
* PlatformBuild.py, iasl dependency, and azurepipeline files have been
  moved into a PlatformCI folder within the respective package. 
* PlatformBuild.py - RequiredSubmodules function configured to read from
  edk2 .gitmodules to lower required updates.
* ReadMe files have been switched to reStructuredText to make Build Status
  table less distracting when viewing plaintext.

Branch: 
https://github.com/spbrogan/edk2/tree/PlatformAndCoreCIForOvmfArmVirtEmulatorPackages_v10

Please send feedback to the mailing list and do not leave feedback directly
on github.

On a separate note, shallow threading might not work on this patch series
due to changes made by the SMTP server. Please bear with me while I am
investigating if this can be changed.

Cc: Andrew Fish 
Cc: Ard Biesheuvel 
Cc: Bret Barkelew 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Leif Lindholm 
Cc: Liming Gao 
Cc: Michael D Kinney 
Cc: Ray Ni 
Cc: Sean Brogan 
Signed-off-by: Sean Brogan 
Signed-off-by: Michael Kubacki 

Sean Brogan (7):
  .azurepipelines: Add Platform CI template
  ArmVirtPkg: Add Platform CI and configuration for Core CI
  EmulatorPkg: Add Platform CI and configuration for Core CI
  OvmfPkg: Add Platform CI and configuration for Core CI
  .pytool: Update CI Settings to support Emulator, ArmVirt, and Ovmf
packages
  .azurepipelines: Update Core CI build matrix to include platforms
  ReadMe: Convert to rst and add Platform CI Status

 .azurepipelines/ReadMe.md |  50 +++
 .azurepipelines/templates/ReadMe.md   |  59 
 .azurepipelines/templates/platform-build-run-steps.yml| 134 
 .azurepipelines/templates/pr-gate-build-job.yml   |   5 +
 .pytool/CISettings.py |   7 +-
 .pytool/Plugin/SpellCheck/cspell.base.yaml|  14 +
 .pytool/Readme.md |  10 +-
 ArmVirtPkg/ArmVirtPkg.ci.yaml | 103 ++
 ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml |  89 +
 ArmVirtPkg/PlatformCI/PlatformBuild.py| 276 +++
 ArmVirtPkg/PlatformCI/ReadMe.md   | 125 +++
 ArmVirtPkg/PlatformCI/iasl_ext_dep.yaml   |  21 ++
 EmulatorPkg/EmulatorPkg.ci.yaml   |  85 +
 EmulatorPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml|  95 ++
 EmulatorPkg/PlatformCI/.azurepipelines/Windows-VS2019.yml |  85 +
 EmulatorPkg/PlatformCI/PlatformBuild.py   | 272 +++
 EmulatorPkg/PlatformCI/ReadMe.md  | 128 +++
 OvmfPkg/OvmfPkg.ci.yaml   |  83 +
 OvmfPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml| 133 
 OvmfPkg/PlatformCI/.azurepipelines/Windows-VS2019.yml | 138 
 OvmfPkg/PlatformCI/PlatformBuild.py   | 254 ++
 OvmfPkg/PlatformCI/ReadMe.md  | 137 
 OvmfPkg/PlatformCI/iasl_ext_dep.yaml  |  21 ++
 ReadMe.rst| 354 

 Readme.md | 235 -
 25 files changed, 2670 insertions(+), 243 deletions(-)
 create mode 100644 .azurepipelines/ReadMe.md
 create mode 100644 .azurepipelines/templates/ReadMe.md
 create mode 100644 .azurepipelines/templates/platform-build-run-steps.yml
 create mode 100644 ArmVirtPkg/ArmVirtPkg.ci.yaml
 create 

[edk2-devel] [PATCH v3 1/7] .azurepipelines: Add Platform CI template

2020-04-24 Thread Michael Kubacki
From: Sean Brogan 

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2570

Add template for Platform CI steps for a Pytools based build.
Add README to describe the template and how to use it.
Add helpful information for working with azurepipelines, templates, and
lessons learned.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Sean Brogan 
Signed-off-by: Michael Kubacki 
Reviewed-by: Shenglei Zhang 
Reviewed-by: Bret Barkelew 
---
 .azurepipelines/ReadMe.md  |  50 
 .azurepipelines/templates/ReadMe.md|  59 +
 .azurepipelines/templates/platform-build-run-steps.yml | 134 

 3 files changed, 243 insertions(+)

diff --git a/.azurepipelines/ReadMe.md b/.azurepipelines/ReadMe.md
new file mode 100644
index ..cf57d282c197
--- /dev/null
+++ b/.azurepipelines/ReadMe.md
@@ -0,0 +1,50 @@
+# Azure DevOps Pipelines
+
+These yml files are used to provide CI builds using the Azure DevOps Pipeline 
Service.
+Most of the CI leverages edk2-pytools to support cross platform building and 
execution.
+
+## Core CI
+
+Focused on building and testing all packages in Edk2 without an actual target 
platform.
+
+See `.pytools/ReadMe.py` for more details
+
+## Platform CI
+
+Focused on building a single target platform and confirming functionality on 
that platform.
+
+## Conventions
+
+* Files extension should be *.yml.  *.yaml is also supported but in Edk2 we 
use those for our package configuration.
+* Platform CI files should be in the `/.azurepipelines` folder.
+* Core CI files are in the root folder.
+* Shared templates are in the `templates` folder.
+* Top level CI files should be named `-.yml`
+
+## Links
+
+* Basic Azure Landing Site - 
https://docs.microsoft.com/en-us/azure/devops/pipelines/?view=azure-devops
+* Pipeline jobs - 
https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops=yaml
+* Pipeline yml scheme - 
https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops=schema%2Cparameter-schema
+* Pipeline expression - 
https://docs.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops
+* PyTools - https://github.com/tianocore/edk2-pytool-extensions and 
https://github.com/tianocore/edk2-pytool-library
+
+## Lessons Learned
+
+### Templates and parameters
+
+They are great but evil.  If they are used as part of determining the steps of 
a build they must resolve before the build starts.  They can not use variables 
set in a yml or determined as part of a matrix.  If they are used in a step 
then they can be bound late.
+
+### File matching patterns
+
+On Linux this can hang if there are too many files in the search list.
+
+### Templates and file splitting
+
+Suggestion is to do one big yaml file that does what you want for one of your 
targets.  Then do the second one and find the deltas.  From that you can start 
to figure out the right split of files, steps, jobs.
+
+### Conditional steps
+
+If you want the step to show up in the log but not run, use a step 
conditional. This is great when a platform doesn't currently support a feature 
but you want the builders to know that the features exists and maybe someday it 
will.
+
+If you want the step to not show up use a template step conditional wrapper.  
Beware this will be evaluated early (at build start).  This can hide things not 
needed on a given OS for example.
diff --git a/.azurepipelines/templates/ReadMe.md 
b/.azurepipelines/templates/ReadMe.md
new file mode 100644
index ..fa433e3ef597
--- /dev/null
+++ b/.azurepipelines/templates/ReadMe.md
@@ -0,0 +1,59 @@
+# CI Templates
+
+This folder contains azure pipeline yml templates for "Core" and "Platform" 
Continuous Integration and PR validation.
+
+## Common CI templates
+
+### basetools-build-steps.yml
+
+This template compiles the Edk2 basetools from source.  The steps in this 
template are
+conditional and will only run if variable `pkg_count` is greater than 0.
+
+It also has two conditional steps only used when the toolchain contains GCC. 
These two steps
+use `apt` to update the system packages and add those necessary for Edk2 
builds.
+
+## Core CI templates
+
+### pr-gate-build-job.yml
+
+This templates contains the jobs and most importantly the matrix of which 
packages and
+targets to run for Core CI.
+
+### pr-gate-steps.yml
+
+This template is the main Core CI template.  It controls all the steps run and 
is responsible for most functionality of the Core CI process.  This template 
sets
+the `pkg_count` variable using the `stuart_pr_eval` tool when the
+build type is "pull request"
+
+### spell-check-prereq-steps.yml
+
+This template installs the node based tools used by the spell checker plugin. 
The steps
+in this template are conditional and will only run if variable `pkg_count` is 
greater than 0.
+
+## Platform CI templates
+
+### platform-build-run-steps.yml
+

[edk2-devel] [PATCH v3 7/7] ReadMe: Convert to rst and add Platform CI Status

2020-04-24 Thread Michael Kubacki
From: Sean Brogan 

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2570

Convert workspace root Readme.md to reStructuredText
ReStructuredText supports building tables with syntax that is easier
to read in plain-text.
Rename as ReadMe.rst.
Add Platform CI Status Tables

Cc: Andrew Fish 
Cc: Laszlo Ersek 
Cc: Leif Lindholm 
Cc: Michael D Kinney 
Signed-off-by: Sean Brogan 
Signed-off-by: Michael Kubacki 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Bret Barkelew 
---
 ReadMe.rst | 354 
 Readme.md  | 235 -
 2 files changed, 354 insertions(+), 235 deletions(-)

diff --git a/ReadMe.rst b/ReadMe.rst
new file mode 100644
index ..c4a29b2809ba
--- /dev/null
+++ b/ReadMe.rst
@@ -0,0 +1,354 @@
+==
+EDK II Project
+==
+
+A modern, feature-rich, cross-platform firmware development
+environment for the UEFI and PI specifications from www.uefi.org.
+
+Core CI Build Status
+
+
+= = === 
===
+ Host Type & ToolchainBuild Status  Test Status Code Coverage
+= = === 
===
+Windows_VS2019_   |WindowsCiBuild|  |WindowsCiTest| 
|WindowsCiCoverage|
+Ubuntu_GCC5_  |UbuntuCiBuild|   |UbuntuCiTest|  
|UbuntuCiCoverage|
+= = === 
===
+
+`More CI Build information <.pytool/Readme.md>`__
+
+Platform CI Build Status
+
+
+Microsoft Windows VS2019
+
+
+= = = = 
==
+ ToolchainCONFIGDEBUG RELEASE   
NOOPT
+= = = = 
==
+EmulatorPkg_Win_VS2019_   | IA32|em32d|   |em32r|   
|em32n|
+| | X64 |em64d|   |em64r|   
|em64n|
+OvmfPkg_Win_VS2019_   | IA32|op32d|   |op32r|   
|op32n|
+| | X64 |op64d|   |op64r|   
|op64n|
+| | IA32 X64|op3264d| |op3264r| 
|op3264n|
+| | IA32 X64 FULL   |op3264fd||op3264fr|
|op3264fn|
+= = = = 
==
+
+Ubuntu 18.04 GCC5
+`
+
+= = = = 
==
+ ToolchainCONFIGDEBUG RELEASE   
NOOPT
+= = = = 
==
+ArmVirtPkg_Ubuntu_GCC5_   | AARCH64 |avAArch64du| |avAArch64ru| 
|avAArch64nu|
+| | ARM |avArmdu| |avArmru| 
|avArmnu|
+EmulatorPkg_Ubuntu_GCC5_  | IA32|em32du|  |em32ru|  
|em32nu|
+| | X64 |em64du|  |em64ru|  
|em64nu|
+OvmfPkg_Ubuntu_GCC5_  | IA32|op32du|  |op32ru|  
|op32nu|
+| | X64 |op64du|  |op64ru|  
|op64nu|
+| | IA32 X64|op3264du||op3264ru|
|op3264nu|
+| | IA32 X64 FULL   |op3264fdu|   |op3264fru|   
|op3264fru|
+= = = = 
==
+
+|TCBZ_2668|_ - EmulatorPkg Ubuntu GCC5 Segfaults during execution.
+
+|TCBZ_2639|_ - EmulatorPkg Ubuntu GCC5 Segfaults during execution.
+
+`More ArmVirtPkg CI Build Information `__
+
+`More EmulatorPkg CI Build Information `__
+
+`More OvmfPkg CI Build Information `__
+
+
+License Details
+---
+
+The majority of the content in the EDK II open source project uses a
+`BSD-2-Clause Plus Patent License `__. The EDK II open
+source project contains the following components that are covered by additional
+licenses:
+
+-  `BaseTools/Source/C/BrotliCompress/brotli 
`__
+-  `MdeModulePkg/Library/BrotliCustomDecompressLib/brotli 
`__
+-  `BaseTools/Source/C/LzmaCompress 
`__
+-  `MdeModulePkg/Library/LzmaCustomDecompressLib 
`__
+-  `IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk 
`__
+-  `BaseTools/Source/C/VfrCompile/Pccts 
`__
+-  `MdeModulePkg/Universal/RegularExpressionDxe/oniguruma 
`__
+-  `OvmfPkg `__
+-  `CryptoPkg/Library/OpensslLib/openssl 
`__
+-  `ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 

[edk2-devel] [PATCH v3 2/7] ArmVirtPkg: Add Platform CI and configuration for Core CI

2020-04-24 Thread Michael Kubacki
From: Sean Brogan 

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2570

Add new Azure Pipeline definitions to build and run ArmVirtPkg with:
  * Ubuntu GCC5
Add PyTool based build of ArmVirtPkg
Add extdep for managing the iasl dependency
Add ArmVirtPkg.ci.yaml for Core CI
Add ReadMe.md for details and instructions

Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Sean Brogan 
Signed-off-by: Michael Kubacki 
Reviewed-by: Shenglei Zhang 
Acked-by: Laszlo Ersek 
Acked-by: Ard Biesheuvel 
Reviewed-by: Bret Barkelew 
---
 ArmVirtPkg/ArmVirtPkg.ci.yaml | 103 
 ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml |  89 +++
 ArmVirtPkg/PlatformCI/PlatformBuild.py| 276 

 ArmVirtPkg/PlatformCI/ReadMe.md   | 125 +
 ArmVirtPkg/PlatformCI/iasl_ext_dep.yaml   |  21 ++
 5 files changed, 614 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtPkg.ci.yaml b/ArmVirtPkg/ArmVirtPkg.ci.yaml
new file mode 100644
index ..4553725ee528
--- /dev/null
+++ b/ArmVirtPkg/ArmVirtPkg.ci.yaml
@@ -0,0 +1,103 @@
+## @file
+# Core CI configuration for ArmVirtPkg
+#
+# ArmVirtPkg is part of Platform Ci for builds so this is only
+# used for code analysis.
+#
+# Copyright (c) Microsoft Corporation
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+## options defined .pytool/Plugin/CompilerPlugin
+"CompilerPlugin": {
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/HostUnitTestCompilerPlugin
+"HostUnitTestCompilerPlugin": {
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/CharEncodingCheck
+"CharEncodingCheck": {
+"IgnoreFiles": []
+},
+
+## options defined .pytool/Plugin/DependencyCheck
+"DependencyCheck": {
+"AcceptableDependencies": [
+"MdePkg/MdePkg.dec",
+"MdeModulePkg/MdeModulePkg.dec",
+"ArmVirtPkg/ArmVirtPkg.dec",
+"NetworkPkg/NetworkPkg.dec",
+"ArmPkg/ArmPkg.dec",
+"OvmfPkg/OvmfPkg.dec",
+"EmbeddedPkg/EmbeddedPkg.dec",
+"ArmPlatformPkg/ArmPlatformPkg.dec",
+"SecurityPkg/SecurityPkg.dec",
+"ShellPkg/ShellPkg.dec"  #Is this ok?
+],
+# For host based unit tests
+"AcceptableDependencies-HOST_APPLICATION":[
+"UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec"
+],
+# For UEFI shell based apps
+"AcceptableDependencies-UEFI_APPLICATION":[
+
+],
+"IgnoreInf": []
+},
+
+## options defined .pytool/Plugin/DscCompleteCheck
+"DscCompleteCheck": {
+"IgnoreInf": [""],
+"DscPath": ""  # Don't support this test
+},
+
+## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck
+"HostUnitTestDscCompleteCheck": {
+"IgnoreInf": [""],
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/GuidCheck
+"GuidCheck": {
+"IgnoreGuidName": [],
+"IgnoreGuidValue": [],
+"IgnoreFoldersAndFiles": [],
+"IgnoreDuplicates": [],
+},
+
+## options defined .pytool/Plugin/LibraryClassCheck
+"LibraryClassCheck": {
+"IgnoreHeaderFile": []
+},
+
+## options defined .pytool/Plugin/SpellCheck
+"SpellCheck": {
+"AuditOnly": False,   # Fails right now with over 270 errors
+"IgnoreFiles": [],   # use gitignore syntax to ignore errors 
in matching files
+"ExtendWords": [
+"setjump",
+"plong",
+"lparam",
+"lpdword",
+"lpthread",
+"lresult",
+"bootable",
+"bsymbolic",
+"endiannness",
+"fvmain",
+"multiboot",
+"qemu's",
+"ramdisk",
+"ramfb",
+"unbootable",
+"virt's",
+"werror",
+"xenio"
+],   # words to extend to the dictionary for this package
+"IgnoreStandardPaths": [],   # Standard Plugin defined paths that 
should be ignore
+"AdditionalIncludePaths": [] # Additional paths to spell check 
(wildcards supported)
+}
+}
diff --git a/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml 
b/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml
new file mode 100644
index ..b9452ec5bfaf
--- /dev/null
+++ b/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml
@@ -0,0 +1,89 @@
+## @file
+# Azure Pipeline build file for building a platform.
+#
+# Platform: ArmVirtQemu
+# OS: Ubuntu
+# Toolchain: GCC5
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+trigger:
+  - master
+pr:
+  - master
+
+jobs:
+  - job: Platform_CI
+variables:
+  package: 'ArmVirtPkg'
+  vm_image: 'ubuntu-latest'
+  should_run: 

Re: [EXTERNAL] [edk2-devel] [PATCH v2 3/6] EmulatorPkg: Add Platform CI and configuration for Core CI

2020-04-24 Thread Bret Barkelew via groups.io
Reviewed-by: Bret Barkelew 

- Bret


From: devel@edk2.groups.io  on behalf of Michael Kubacki 
via groups.io 
Sent: Monday, April 20, 2020 12:12:13 PM
To: devel@edk2.groups.io 
Cc: Jordan Justen ; Andrew Fish ; 
Ray Ni 
Subject: [EXTERNAL] [edk2-devel] [PATCH v2 3/6] EmulatorPkg: Add Platform CI 
and configuration for Core CI

From: Sean Brogan 

REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2570data=02%7C01%7CBret.Barkelew%40microsoft.com%7C60f1628fdb874f6eef3108d7e55ed95e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067846856524sdata=sD1c4yU98JcgeHNncveZX%2BA%2BfP211%2F8JZloAyO7%2BrUg%3Dreserved=0

Add new Azure Pipeline definitions to build and run EmulatorPkg with:
  * Ubuntu GCC5
  * Windows VS2019
Add PyTool based build of EmulatorPkg
Add EmulatorPkg.ci.yaml for Core CI
Add ReadMe.rst for status, details and instructions

Cc: Jordan Justen 
Cc: Andrew Fish 
Cc: Ray Ni 
Signed-off-by: Sean Brogan 
Signed-off-by: Michael Kubacki 
---
 EmulatorPkg/EmulatorPkg.ci.yaml   |  85 ++
 EmulatorPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml|  95 +++
 EmulatorPkg/PlatformCI/.azurepipelines/Windows-VS2019.yml |  85 ++
 EmulatorPkg/PlatformCI/PlatformBuild.py   | 272 

 EmulatorPkg/README.rst| 175 +
 5 files changed, 712 insertions(+)

diff --git a/EmulatorPkg/EmulatorPkg.ci.yaml b/EmulatorPkg/EmulatorPkg.ci.yaml
new file mode 100644
index ..81f81780ec76
--- /dev/null
+++ b/EmulatorPkg/EmulatorPkg.ci.yaml
@@ -0,0 +1,85 @@
+## @file
+# Core CI configuration for EmulatorPkg
+#
+# EmulatorPkg is part of Platform Ci for builds so this is only
+# used for code analysis.
+#
+# Copyright (c) Microsoft Corporation
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+## options defined .pytool/Plugin/CompilerPlugin
+"CompilerPlugin": {
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/HostUnitTestCompilerPlugin
+"HostUnitTestCompilerPlugin": {
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/CharEncodingCheck
+"CharEncodingCheck": {
+"IgnoreFiles": []
+},
+
+## options defined .pytool/Plugin/DependencyCheck
+"DependencyCheck": {
+"AcceptableDependencies": [
+# For this platform all packages are allowed???
+"MdePkg/MdePkg.dec",
+"MdeModulePkg/MdeModulePkg.dec",
+"EmulatorPkg/EmulatorPkg.dec",
+"NetworkPkg/NetworkPkg.dec",
+"EmbeddedPkg/EmbeddedPkg.dec", ## is this one OK??
+],
+# For host based unit tests
+"AcceptableDependencies-HOST_APPLICATION":[
+"UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec"
+],
+# For UEFI shell based apps
+"AcceptableDependencies-UEFI_APPLICATION":[],
+"IgnoreInf": []
+},
+
+## options defined .pytool/Plugin/DscCompleteCheck
+"DscCompleteCheck": {
+"IgnoreInf": [""],
+"DscPath": ""  # Don't support this test
+},
+
+## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck
+"HostUnitTestDscCompleteCheck": {
+"IgnoreInf": [""],
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/GuidCheck
+"GuidCheck": {
+"IgnoreGuidName": [],
+"IgnoreGuidValue": [],
+"IgnoreFoldersAndFiles": [],
+"IgnoreDuplicates": [],
+},
+
+## options defined .pytool/Plugin/LibraryClassCheck
+"LibraryClassCheck": {
+"IgnoreHeaderFile": []
+},
+
+## options defined .pytool/Plugin/SpellCheck
+"SpellCheck": {
+"AuditOnly": True,   # Fails right now with over 270 errors
+"IgnoreFiles": [],   # use gitignore syntax to ignore errors 
in matching files
+"ExtendWords": [
+"setjump",
+"plong",
+"lparam",
+"lpdword",
+"lpthread",
+"lresult",
+],   # words to extend to the dictionary for this package
+"IgnoreStandardPaths": [],   # Standard Plugin defined paths that 
should be ignore
+"AdditionalIncludePaths": [] # Additional paths to spell check 
(wildcards supported)
+}
+}
diff --git a/EmulatorPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml 
b/EmulatorPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml
new file mode 100644
index ..12ef8226ff54
--- /dev/null
+++ b/EmulatorPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml
@@ -0,0 +1,95 @@
+## @file
+# Azure Pipeline build file for building a platform.
+#
+# Platform: EmulatorPkg
+# OS: Ubuntu
+# Toolchain: GCC5
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+trigger:
+  - master
+pr:
+  - master
+jobs:
+  - job: 

Re: [EXTERNAL] Re: [edk2-devel] [PATCH v1 2/6] ArmVirtPkg: Add Platform CI and configuration for Core CI

2020-04-24 Thread Bret Barkelew via groups.io
Reviewed-by: Bret Barkelew 

- Bret


From: devel@edk2.groups.io  on behalf of Laszlo Ersek via 
groups.io 
Sent: Monday, April 20, 2020 4:08:53 AM
To: Rebecca Cran ; devel@edk2.groups.io 
; Sean Brogan 
Cc: Ard Biesheuvel ; Kinney, Michael D 

Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v1 2/6] ArmVirtPkg: Add Platform CI 
and configuration for Core CI

On 04/19/20 22:56, Rebecca Cran wrote:

> Where are those pages linked from (i.e. how would people find them)?

I've used the following three methods to find content in the wiki:

(1) web search

(2) if you open 

and click on the "Pages" box to the right, you get a small search field.

(3) grep a local clone of the wiki.

Not implying that these are convenient or efficient.

Thanks
Laszlo





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58113): https://edk2.groups.io/g/devel/message/58113
Mute This Topic: https://groups.io/mt/73250310/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [EXTERNAL] [PATCH v2 5/6] .pytool: Update CI Settings to support Emulator, ArmVirt, and Ovmf packages

2020-04-24 Thread Bret Barkelew via groups.io
Reviewed-by: Bret Barkelew 

- Bret


From: michael.kuba...@outlook.com 
Sent: Monday, April 20, 2020 12:12:15 PM
To: devel@edk2.groups.io 
Cc: Sean Brogan ; Bret Barkelew 
; Kinney, Michael D ; 
Liming Gao 
Subject: [EXTERNAL] [PATCH v2 5/6] .pytool: Update CI Settings to support 
Emulator, ArmVirt, and Ovmf packages

From: Sean Brogan 

REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2570data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cfcddced9f97b4eb3047908d7e55edc0f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067892859716sdata=jC3zSf4H9z%2FfX0EDnIhKc0nB9oITgNHh8d5y25LEPUs%3Dreserved=0

Update pytools configuration to enable EmulatorPkg, ArmVirtPkg,
and OvmfPkg.

Update documentation for the status of those packages.
Remove future work items that are now complete.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Sean Brogan 
Signed-off-by: Michael Kubacki 
---
 .pytool/CISettings.py  |  7 +--
 .pytool/Plugin/SpellCheck/cspell.base.yaml | 14 ++
 .pytool/Readme.md  | 10 --
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/.pytool/CISettings.py b/.pytool/CISettings.py
index e373d17a6c34..7a8bd3380383 100644
--- a/.pytool/CISettings.py
+++ b/.pytool/CISettings.py
@@ -39,7 +39,9 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, 
SetupSettingsManag
 ''' return iterable of edk2 packages supported by this build.
 These should be edk2 workspace relative paths '''

-return ("MdePkg",
+return ("ArmVirtPkg",
+"EmulatorPkg",
+"MdePkg",
 "MdeModulePkg",
 "NetworkPkg",
 "PcAtChipsetPkg",
@@ -49,7 +51,8 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, 
SetupSettingsManag
 "ShellPkg",
 "FatPkg",
 "CryptoPkg",
-"UnitTestFrameworkPkg"
+"UnitTestFrameworkPkg",
+"OvmfPkg"
 )

 def GetArchitecturesSupported(self):
diff --git a/.pytool/Plugin/SpellCheck/cspell.base.yaml 
b/.pytool/Plugin/SpellCheck/cspell.base.yaml
index aa15170c013c..1ce5f6991104 100644
--- a/.pytool/Plugin/SpellCheck/cspell.base.yaml
+++ b/.pytool/Plugin/SpellCheck/cspell.base.yaml
@@ -164,5 +164,19 @@
 "Sdhci",
 "inmodule",
 "RISCV",
+"edksetup",
+"iscsi",
+"nvdata",
+"pytools",
+"NTDDI",
+"Wnonportable",
+"CLANGPDB",
+"nologo",
+"lldmap",
+"ASMLINK",
+"NODEFAULTLIB",
+"vcruntimed",
+"ucrtd",
+"msvcrtd",
 ]
 }
diff --git a/.pytool/Readme.md b/.pytool/Readme.md
index 135d283fe223..c7dce3b64ca0 100644
--- a/.pytool/Readme.md
+++ b/.pytool/Readme.md
@@ -6,11 +6,11 @@
 | :   | :-   | :   
  | :--- |
 | ArmPkg  |
 | ArmPlatformPkg  |
-| ArmVirtPkg  |
+| ArmVirtPkg  | SEE PACKAGE README | SEE PACKAGE README |
 | CryptoPkg   | :heavy_check_mark: | :heavy_check_mark: | Spell 
checking in audit mode
 | DynamicTablesPkg|
 | EmbeddedPkg |
-| EmulatorPkg |
+| EmulatorPkg | SEE PACKAGE README | SEE PACKAGE README | Spell 
checking in audit mode
 | FatPkg  | :heavy_check_mark: | :heavy_check_mark: |
 | FmpDevicePkg| :heavy_check_mark: | :heavy_check_mark: |
 | IntelFsp2Pkg|
@@ -18,7 +18,7 @@
 | MdeModulePkg| :heavy_check_mark: | :heavy_check_mark: | DxeIpl 
dependency on ArmPkg, Depends on StandaloneMmPkg, Spell checking in audit mode
 | MdePkg  | :heavy_check_mark: | :heavy_check_mark: | Spell 
checking in audit mode
 | NetworkPkg  | :heavy_check_mark: | :heavy_check_mark: | Spell 
checking in audit mode
-| OvmfPkg |
+| OvmfPkg | SEE PACKAGE README | SEE PACKAGE README | Spell 
checking in audit mode
 | PcAtChipsetPkg  | :heavy_check_mark: | :heavy_check_mark: |
 | SecurityPkg | :heavy_check_mark: | :heavy_check_mark: | Spell 
checking in audit mode
 | ShellPkg| :heavy_check_mark: | :heavy_check_mark: | Spell 
checking in audit mode, 3 modules are not being built by DSC
@@ -77,7 +77,7 @@ per package configuration which comes from this file.
 ## Running CI locally

 The EDKII Tools environment (and by extension the ci) is designed to support
-easily and consistantly running locally and in a cloud ci environment.  To do
+easily and consistently running locally and in a cloud ci environment.  To do
 that a few steps should be followed.  Details of EDKII Tools can be found in 
the
 [docs folder 

Re: [edk2-devel] [EXTERNAL] [PATCH v2 0/6] Edk2 Platform and Core CI for ArmVirtPkg, EmulatorPkg, and OvmfPkg

2020-04-24 Thread Bret Barkelew via groups.io
Reviewed-by: Bret Barkelew 

- Bret


From: michael.kuba...@outlook.com 
Sent: Monday, April 20, 2020 12:12:10 PM
To: devel@edk2.groups.io 
Cc: Andrew Fish ; Ard Biesheuvel ; 
Bret Barkelew ; Jordan Justen 
; Laszlo Ersek ; Leif Lindholm 
; Liming Gao ; Kinney, Michael D 
; Ray Ni ; Sean Brogan 

Subject: [EXTERNAL] [PATCH v2 0/6] Edk2 Platform and Core CI for ArmVirtPkg, 
EmulatorPkg, and OvmfPkg

From: Michael Kubacki 

The following 6 patches adds support for "Platform CI" for ArmVirtPkg,
OvmfPkg, and EmulatorPkg.

Each readme has live status and links to the builds as well as details
of how to build and run the same way the CI server will.

ArmVirtPkg:
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspbrogan%2Fedk2%2Fblob%2FPlatformAndCoreCIForOvmfArmVirtEmulatorPackages_v9%2FArmVirtPkg%2FReadMe.rstdata=02%7C01%7CBret.Barkelew%40microsoft.com%7Cb385548db8bb448b7c0608d7e55ecd34%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067645466828sdata=IhxGbPWZmhb3vP1LZw%2FGVHgQ8Zjwxw3zzV%2FUZnAZFP8%3Dreserved=0

EmulatorPkg:
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspbrogan%2Fedk2%2Fblob%2FPlatformAndCoreCIForOvmfArmVirtEmulatorPackages_v9%2FEmulatorPkg%2FREADME.rstdata=02%7C01%7CBret.Barkelew%40microsoft.com%7Cb385548db8bb448b7c0608d7e55ecd34%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067645466828sdata=%2FdcY%2FtX0G2C%2BUeDokHAWrxngsHuhGE5hqj5XCzt%2Bza0%3Dreserved=0

OvmfPkg:
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspbrogan%2Fedk2%2Fblob%2FPlatformAndCoreCIForOvmfArmVirtEmulatorPackages_v9%2FOvmfPkg%2FREADME.rstdata=02%7C01%7CBret.Barkelew%40microsoft.com%7Cb385548db8bb448b7c0608d7e55ecd34%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067645466828sdata=AIEXWiak44VKWKSXYzT0wIiAybnU7BNSEij7Q76LfRY%3Dreserved=0

The patch set also adds ArmVirtPkg, OvmfPkg, and EmulatorPkg to Core CI for
the code evaluation tests (not compiling). Details of those tests are here:
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspbrogan%2Fedk2%2Ftree%2FPlatformAndCoreCIForOvmfArmVirtEmulatorPackages_v9%2F.pytooldata=02%7C01%7CBret.Barkelew%40microsoft.com%7Cb385548db8bb448b7c0608d7e55ecd34%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067645466828sdata=lmnZ8ZCGjE90eQIm0v9yQrOsb9kc7Ay4Zvh546SED3o%3Dreserved=0

Changes for V2:
* PlatformBuild.py, iasl dependency, and azurepipeline files have been
  moved into a PlatformCI folder within the respective package.
* PlatformBuild.py - RequiredSubmodules function configured to read from
  edk2 .gitmodules to lower required updates.
* ReadMe files have been switched to reStructuredText to make Build Status
  table less distracting when viewing plaintext.

Branch: 
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspbrogan%2Fedk2%2Ftree%2FPlatformAndCoreCIForOvmfArmVirtEmulatorPackages_v9data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cb385548db8bb448b7c0608d7e55ecd34%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067645466828sdata=%2B4L8vVR87hszN5zOvt1LqX%2BxiUiMpsOynhbdpgq5RFo%3Dreserved=0

Please send feedback to the mailing list and do not leave feedback directly
on github.

On a separate note, shallow threading might not work on this patch series
due to changes made by the SMTP server. Please bear with me while I am
investigating if this can be changed.

Cc: Andrew Fish 
Cc: Ard Biesheuvel 
Cc: Bret Barkelew 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Leif Lindholm 
Cc: Liming Gao 
Cc: Michael D Kinney 
Cc: Ray Ni 
Cc: Sean Brogan 
Signed-off-by: Sean Brogan 
Signed-off-by: Michael Kubacki 

Sean Brogan (6):
  .azurepipelines: Add Platform CI template
  ArmVirtPkg: Add Platform CI and configuration for Core CI
  EmulatorPkg: Add Platform CI and configuration for Core CI
  OvmfPkg: Add Platform CI and configuration for Core CI
  .pytool: Update CI Settings to support Emulator, ArmVirt, and Ovmf
packages
  .azurepipelines: Update Core CI build matrix to include platforms

 .azurepipelines/ReadMe.md |  50 
 .azurepipelines/templates/ReadMe.md   |  59 +
 .azurepipelines/templates/platform-build-run-steps.yml| 134 ++
 .azurepipelines/templates/pr-gate-build-job.yml   |   5 +
 .pytool/CISettings.py |   7 +-
 .pytool/Plugin/SpellCheck/cspell.base.yaml|  14 +
 .pytool/Readme.md |  10 +-
 ArmVirtPkg/ArmVirtPkg.ci.yaml | 103 
 ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml |  89 +++
 ArmVirtPkg/PlatformCI/PlatformBuild.py| 276 

 ArmVirtPkg/PlatformCI/iasl_ext_dep.yaml   |  21 ++
 ArmVirtPkg/ReadMe.rst | 139 ++
 EmulatorPkg/EmulatorPkg.ci.yaml  

Re: [edk2-devel] [PATCH v2 3/6] EmulatorPkg: Add Platform CI and configuration for Core CI

2020-04-24 Thread Bret Barkelew via groups.io
Reviewed-by: Bret Barkelew 

- Bret


From: devel@edk2.groups.io  on behalf of Ni, Ray via 
groups.io 
Sent: Tuesday, April 21, 2020 7:43:29 AM
To: devel@edk2.groups.io ; michael.kuba...@outlook.com 

Cc: Justen, Jordan L ; Andrew Fish 
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v2 3/6] EmulatorPkg: Add Platform 
CI and configuration for Core CI

Acked-by: Ray Ni 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Michael Kubacki
> Sent: Tuesday, April 21, 2020 3:12 AM
> To: devel@edk2.groups.io
> Cc: Justen, Jordan L ; Andrew Fish 
> ; Ni, Ray 
> Subject: [edk2-devel] [PATCH v2 3/6] EmulatorPkg: Add Platform CI and 
> configuration for Core CI
>
> From: Sean Brogan 
>
> REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2570data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cff0c73d3359d43cffe9c08d7e6026919%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230770344287401sdata=JvB7nU6x2k0pBImPCBErmajsH%2B%2FVfbZdrVV%2BZlKfwL0%3Dreserved=0
>
> Add new Azure Pipeline definitions to build and run EmulatorPkg with:
>   * Ubuntu GCC5
>   * Windows VS2019
> Add PyTool based build of EmulatorPkg
> Add EmulatorPkg.ci.yaml for Core CI
> Add ReadMe.rst for status, details and instructions
>
> Cc: Jordan Justen 
> Cc: Andrew Fish 
> Cc: Ray Ni 
> Signed-off-by: Sean Brogan 
> Signed-off-by: Michael Kubacki 
> ---
>  EmulatorPkg/EmulatorPkg.ci.yaml   |  85 ++
>  EmulatorPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml|  95 +++
>  EmulatorPkg/PlatformCI/.azurepipelines/Windows-VS2019.yml |  85 ++
>  EmulatorPkg/PlatformCI/PlatformBuild.py   | 272 
> 
>  EmulatorPkg/README.rst| 175 +
>  5 files changed, 712 insertions(+)
>
> diff --git a/EmulatorPkg/EmulatorPkg.ci.yaml b/EmulatorPkg/EmulatorPkg.ci.yaml
> new file mode 100644
> index ..81f81780ec76
> --- /dev/null
> +++ b/EmulatorPkg/EmulatorPkg.ci.yaml
> @@ -0,0 +1,85 @@
> +## @file
> +# Core CI configuration for EmulatorPkg
> +#
> +# EmulatorPkg is part of Platform Ci for builds so this is only
> +# used for code analysis.
> +#
> +# Copyright (c) Microsoft Corporation
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +{
> +## options defined .pytool/Plugin/CompilerPlugin
> +"CompilerPlugin": {
> +"DscPath": "" # Don't support this test
> +},
> +
> +## options defined .pytool/Plugin/HostUnitTestCompilerPlugin
> +"HostUnitTestCompilerPlugin": {
> +"DscPath": "" # Don't support this test
> +},
> +
> +## options defined .pytool/Plugin/CharEncodingCheck
> +"CharEncodingCheck": {
> +"IgnoreFiles": []
> +},
> +
> +## options defined .pytool/Plugin/DependencyCheck
> +"DependencyCheck": {
> +"AcceptableDependencies": [
> +# For this platform all packages are allowed???
> +"MdePkg/MdePkg.dec",
> +"MdeModulePkg/MdeModulePkg.dec",
> +"EmulatorPkg/EmulatorPkg.dec",
> +"NetworkPkg/NetworkPkg.dec",
> +"EmbeddedPkg/EmbeddedPkg.dec", ## is this one OK??
> +],
> +# For host based unit tests
> +"AcceptableDependencies-HOST_APPLICATION":[
> +"UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec"
> +],
> +# For UEFI shell based apps
> +"AcceptableDependencies-UEFI_APPLICATION":[],
> +"IgnoreInf": []
> +},
> +
> +## options defined .pytool/Plugin/DscCompleteCheck
> +"DscCompleteCheck": {
> +"IgnoreInf": [""],
> +"DscPath": ""  # Don't support this test
> +},
> +
> +## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck
> +"HostUnitTestDscCompleteCheck": {
> +"IgnoreInf": [""],
> +"DscPath": "" # Don't support this test
> +},
> +
> +## options defined .pytool/Plugin/GuidCheck
> +"GuidCheck": {
> +"IgnoreGuidName": [],
> +"IgnoreGuidValue": [],
> +"IgnoreFoldersAndFiles": [],
> +"IgnoreDuplicates": [],
> +},
> +
> +## options defined .pytool/Plugin/LibraryClassCheck
> +"LibraryClassCheck": {
> +"IgnoreHeaderFile": []
> +},
> +
> +## options defined .pytool/Plugin/SpellCheck
> +"SpellCheck": {
> +"AuditOnly": True,   # Fails right now with over 270 errors
> +"IgnoreFiles": [],   # use gitignore syntax to ignore errors 
> in matching files
> +"ExtendWords": [
> +"setjump",
> +"plong",
> +"lparam",
> +"lpdword",
> +"lpthread",
> +"lresult",
> +],   # words to extend to the dictionary for this package
> +"IgnoreStandardPaths": [],   # Standard Plugin defined paths that 
> should be ignore
> +"AdditionalIncludePaths": [] # Additional paths to spell check 
> 

Re: [EXTERNAL] [edk2-devel] [PATCH v2 2/6] ArmVirtPkg: Add Platform CI and configuration for Core CI

2020-04-24 Thread Bret Barkelew via groups.io
Reviewed-by: Bret Barkelew 

- Bret


From: devel@edk2.groups.io  on behalf of Michael Kubacki 
via groups.io 
Sent: Monday, April 20, 2020 12:12:12 PM
To: devel@edk2.groups.io 
Cc: Laszlo Ersek ; Ard Biesheuvel ; 
Leif Lindholm 
Subject: [EXTERNAL] [edk2-devel] [PATCH v2 2/6] ArmVirtPkg: Add Platform CI and 
configuration for Core CI

From: Sean Brogan 

REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2570data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cc40ddb755edc46ef3b2608d7e55ed80d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067830885007sdata=a6fVczCTqMGlZeTFwe6IRGnJE48jL00qa1W9qo1RU0A%3Dreserved=0

Add new Azure Pipeline definitions to build and run ArmVirtPkg with:
  * Ubuntu GCC5
Add PyTool based build of ArmVirtPkg
Add extdep for managing the iasl dependency
Add ArmVirtPkg.ci.yaml for Core CI
Add ReadMe.rst for status, details, and instructions

Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Sean Brogan 
Signed-off-by: Michael Kubacki 
---
 ArmVirtPkg/ArmVirtPkg.ci.yaml | 103 
 ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml |  89 +++
 ArmVirtPkg/PlatformCI/PlatformBuild.py| 276 

 ArmVirtPkg/PlatformCI/iasl_ext_dep.yaml   |  21 ++
 ArmVirtPkg/ReadMe.rst | 139 ++
 5 files changed, 628 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtPkg.ci.yaml b/ArmVirtPkg/ArmVirtPkg.ci.yaml
new file mode 100644
index ..4553725ee528
--- /dev/null
+++ b/ArmVirtPkg/ArmVirtPkg.ci.yaml
@@ -0,0 +1,103 @@
+## @file
+# Core CI configuration for ArmVirtPkg
+#
+# ArmVirtPkg is part of Platform Ci for builds so this is only
+# used for code analysis.
+#
+# Copyright (c) Microsoft Corporation
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+## options defined .pytool/Plugin/CompilerPlugin
+"CompilerPlugin": {
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/HostUnitTestCompilerPlugin
+"HostUnitTestCompilerPlugin": {
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/CharEncodingCheck
+"CharEncodingCheck": {
+"IgnoreFiles": []
+},
+
+## options defined .pytool/Plugin/DependencyCheck
+"DependencyCheck": {
+"AcceptableDependencies": [
+"MdePkg/MdePkg.dec",
+"MdeModulePkg/MdeModulePkg.dec",
+"ArmVirtPkg/ArmVirtPkg.dec",
+"NetworkPkg/NetworkPkg.dec",
+"ArmPkg/ArmPkg.dec",
+"OvmfPkg/OvmfPkg.dec",
+"EmbeddedPkg/EmbeddedPkg.dec",
+"ArmPlatformPkg/ArmPlatformPkg.dec",
+"SecurityPkg/SecurityPkg.dec",
+"ShellPkg/ShellPkg.dec"  #Is this ok?
+],
+# For host based unit tests
+"AcceptableDependencies-HOST_APPLICATION":[
+"UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec"
+],
+# For UEFI shell based apps
+"AcceptableDependencies-UEFI_APPLICATION":[
+
+],
+"IgnoreInf": []
+},
+
+## options defined .pytool/Plugin/DscCompleteCheck
+"DscCompleteCheck": {
+"IgnoreInf": [""],
+"DscPath": ""  # Don't support this test
+},
+
+## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck
+"HostUnitTestDscCompleteCheck": {
+"IgnoreInf": [""],
+"DscPath": "" # Don't support this test
+},
+
+## options defined .pytool/Plugin/GuidCheck
+"GuidCheck": {
+"IgnoreGuidName": [],
+"IgnoreGuidValue": [],
+"IgnoreFoldersAndFiles": [],
+"IgnoreDuplicates": [],
+},
+
+## options defined .pytool/Plugin/LibraryClassCheck
+"LibraryClassCheck": {
+"IgnoreHeaderFile": []
+},
+
+## options defined .pytool/Plugin/SpellCheck
+"SpellCheck": {
+"AuditOnly": False,   # Fails right now with over 270 errors
+"IgnoreFiles": [],   # use gitignore syntax to ignore errors 
in matching files
+"ExtendWords": [
+"setjump",
+"plong",
+"lparam",
+"lpdword",
+"lpthread",
+"lresult",
+"bootable",
+"bsymbolic",
+"endiannness",
+"fvmain",
+"multiboot",
+"qemu's",
+"ramdisk",
+"ramfb",
+"unbootable",
+"virt's",
+"werror",
+"xenio"
+],   # words to extend to the dictionary for this package
+"IgnoreStandardPaths": [],   # Standard Plugin defined paths that 
should be ignore
+"AdditionalIncludePaths": [] # Additional paths to spell check 
(wildcards supported)
+}
+}
diff --git a/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml 

Re: [EXTERNAL] [edk2-devel] [PATCH v2 1/6] .azurepipelines: Add Platform CI template

2020-04-24 Thread Bret Barkelew via groups.io
Reviewed-by: Bret Barkelew 

- Bret


From: devel@edk2.groups.io  on behalf of Michael Kubacki 
via groups.io 
Sent: Monday, April 20, 2020 12:12:11 PM
To: devel@edk2.groups.io 
Cc: Sean Brogan ; Bret Barkelew 
; Kinney, Michael D ; 
Liming Gao 
Subject: [EXTERNAL] [edk2-devel] [PATCH v2 1/6] .azurepipelines: Add Platform 
CI template

From: Sean Brogan 

REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2570data=02%7C01%7Cbret.barkelew%40microsoft.com%7Cbd31ac9439e54096f31808d7e55ed649%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067792915138sdata=emu31XA%2FKpr%2FSD4gy4DbcjYVj1PYaDMaaWk8GGtJwUU%3Dreserved=0

Add template for Platform CI steps for a Pytools based build.
Add README to describe the template and how to use it.
Add helpful information for working with azurepipelines, templates, and
lessons learned.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Sean Brogan 
Signed-off-by: Michael Kubacki 
---
 .azurepipelines/ReadMe.md  |  50 
 .azurepipelines/templates/ReadMe.md|  59 +
 .azurepipelines/templates/platform-build-run-steps.yml | 134 

 3 files changed, 243 insertions(+)

diff --git a/.azurepipelines/ReadMe.md b/.azurepipelines/ReadMe.md
new file mode 100644
index ..cf57d282c197
--- /dev/null
+++ b/.azurepipelines/ReadMe.md
@@ -0,0 +1,50 @@
+# Azure DevOps Pipelines
+
+These yml files are used to provide CI builds using the Azure DevOps Pipeline 
Service.
+Most of the CI leverages edk2-pytools to support cross platform building and 
execution.
+
+## Core CI
+
+Focused on building and testing all packages in Edk2 without an actual target 
platform.
+
+See `.pytools/ReadMe.py` for more details
+
+## Platform CI
+
+Focused on building a single target platform and confirming functionality on 
that platform.
+
+## Conventions
+
+* Files extension should be *.yml.  *.yaml is also supported but in Edk2 we 
use those for our package configuration.
+* Platform CI files should be in the `/.azurepipelines` folder.
+* Core CI files are in the root folder.
+* Shared templates are in the `templates` folder.
+* Top level CI files should be named `-.yml`
+
+## Links
+
+* Basic Azure Landing Site - 
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdevops%2Fpipelines%2F%3Fview%3Dazure-devopsdata=02%7C01%7Cbret.barkelew%40microsoft.com%7Cbd31ac9439e54096f31808d7e55ed649%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067792915138sdata=XPGqra1YU6OrOTx6cWKyKfETYLlvTrNm%2BoLmzv66fQ8%3Dreserved=0
+* Pipeline jobs - 
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdevops%2Fpipelines%2Fprocess%2Fphases%3Fview%3Dazure-devops%26tabs%3Dyamldata=02%7C01%7Cbret.barkelew%40microsoft.com%7Cbd31ac9439e54096f31808d7e55ed649%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067792915138sdata=FtXq1ps15kp5Vwjl95BksV0XOFV6X4oA2nxw9w983u0%3Dreserved=0
+* Pipeline yml scheme - 
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdevops%2Fpipelines%2Fyaml-schema%3Fview%3Dazure-devops%26tabs%3Dschema%252Cparameter-schemadata=02%7C01%7Cbret.barkelew%40microsoft.com%7Cbd31ac9439e54096f31808d7e55ed649%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067792915138sdata=T%2FqPGOWIgIN4TS%2BK116FWgdN3irKc4%2BlVqxG5LCpKwA%3Dreserved=0
+* Pipeline expression - 
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdevops%2Fpipelines%2Fprocess%2Fexpressions%3Fview%3Dazure-devopsdata=02%7C01%7Cbret.barkelew%40microsoft.com%7Cbd31ac9439e54096f31808d7e55ed649%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067792915138sdata=x5V2xgJQRV31fZ7pJbiuHXjAuOxAHTdHgYvtNvB%2F6Tc%3Dreserved=0
+* PyTools - 
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftianocore%2Fedk2-pytool-extensionsdata=02%7C01%7Cbret.barkelew%40microsoft.com%7Cbd31ac9439e54096f31808d7e55ed649%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067792915138sdata=uqzx7GHM7ahuQKGgm%2FWt2C5%2B9nQyQOCQLFpQkOiBt7M%3Dreserved=0
 and 
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftianocore%2Fedk2-pytool-librarydata=02%7C01%7Cbret.barkelew%40microsoft.com%7Cbd31ac9439e54096f31808d7e55ed649%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067792915138sdata=bL9qDvlEe4kAgM08xI%2FncpOiMBtyn8wA35M5j57tDgI%3Dreserved=0
+
+## Lessons Learned
+
+### Templates and parameters
+
+They are great but evil.  If they are used as part of determining the steps of 
a build they must resolve before the build starts.  They can not use variables 
set in a yml or determined as part of a matrix.  If they are used in a step 
then they can be bound late.
+
+### File matching patterns
+
+On Linux this can 

Re: [edk2-devel] [PATCH v2 3/6] EmulatorPkg: Add Platform CI and configuration for Core CI

2020-04-24 Thread Bret Barkelew via groups.io
Reviewed-by: Bret Barkelew 

- Bret


From: devel@edk2.groups.io  on behalf of Liming Gao via 
groups.io 
Sent: Tuesday, April 21, 2020 7:36:29 AM
To: devel@edk2.groups.io ; michael.kuba...@outlook.com 
; Ni, Ray 
Cc: Justen, Jordan L ; Andrew Fish 
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v2 3/6] EmulatorPkg: Add Platform 
CI and configuration for Core CI

Sean:
  I see some comments on Ovmf. If you make the change in Ovmf, please also 
update EmulatorPkg. I would like to keep the consistent style in 
EmulatorPkg/OvmfPkg.
  This change is good to me. Reviewed-by: Liming Gao 

Ray:
  If you have no comment, can you give Ack-by for this change?

Thanks
Liming
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Michael Kubacki
> Sent: Tuesday, April 21, 2020 3:12 AM
> To: devel@edk2.groups.io
> Cc: Justen, Jordan L ; Andrew Fish 
> ; Ni, Ray 
> Subject: [edk2-devel] [PATCH v2 3/6] EmulatorPkg: Add Platform CI and 
> configuration for Core CI
>
> From: Sean Brogan 
>
> REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2570data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cda746308e0184e5d75fe08d7e601664b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230766006138775sdata=pCu5hHjwcDLOBNmjxZzzBOKxI8Yso0IzZg%2Bp343H3v0%3Dreserved=0
>
> Add new Azure Pipeline definitions to build and run EmulatorPkg with:
>   * Ubuntu GCC5
>   * Windows VS2019
> Add PyTool based build of EmulatorPkg
> Add EmulatorPkg.ci.yaml for Core CI
> Add ReadMe.rst for status, details and instructions
>
> Cc: Jordan Justen 
> Cc: Andrew Fish 
> Cc: Ray Ni 
> Signed-off-by: Sean Brogan 
> Signed-off-by: Michael Kubacki 
> ---
>  EmulatorPkg/EmulatorPkg.ci.yaml   |  85 ++
>  EmulatorPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml|  95 +++
>  EmulatorPkg/PlatformCI/.azurepipelines/Windows-VS2019.yml |  85 ++
>  EmulatorPkg/PlatformCI/PlatformBuild.py   | 272 
> 
>  EmulatorPkg/README.rst| 175 +
>  5 files changed, 712 insertions(+)
>
> diff --git a/EmulatorPkg/EmulatorPkg.ci.yaml b/EmulatorPkg/EmulatorPkg.ci.yaml
> new file mode 100644
> index ..81f81780ec76
> --- /dev/null
> +++ b/EmulatorPkg/EmulatorPkg.ci.yaml
> @@ -0,0 +1,85 @@
> +## @file
> +# Core CI configuration for EmulatorPkg
> +#
> +# EmulatorPkg is part of Platform Ci for builds so this is only
> +# used for code analysis.
> +#
> +# Copyright (c) Microsoft Corporation
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +{
> +## options defined .pytool/Plugin/CompilerPlugin
> +"CompilerPlugin": {
> +"DscPath": "" # Don't support this test
> +},
> +
> +## options defined .pytool/Plugin/HostUnitTestCompilerPlugin
> +"HostUnitTestCompilerPlugin": {
> +"DscPath": "" # Don't support this test
> +},
> +
> +## options defined .pytool/Plugin/CharEncodingCheck
> +"CharEncodingCheck": {
> +"IgnoreFiles": []
> +},
> +
> +## options defined .pytool/Plugin/DependencyCheck
> +"DependencyCheck": {
> +"AcceptableDependencies": [
> +# For this platform all packages are allowed???
> +"MdePkg/MdePkg.dec",
> +"MdeModulePkg/MdeModulePkg.dec",
> +"EmulatorPkg/EmulatorPkg.dec",
> +"NetworkPkg/NetworkPkg.dec",
> +"EmbeddedPkg/EmbeddedPkg.dec", ## is this one OK??
> +],
> +# For host based unit tests
> +"AcceptableDependencies-HOST_APPLICATION":[
> +"UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec"
> +],
> +# For UEFI shell based apps
> +"AcceptableDependencies-UEFI_APPLICATION":[],
> +"IgnoreInf": []
> +},
> +
> +## options defined .pytool/Plugin/DscCompleteCheck
> +"DscCompleteCheck": {
> +"IgnoreInf": [""],
> +"DscPath": ""  # Don't support this test
> +},
> +
> +## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck
> +"HostUnitTestDscCompleteCheck": {
> +"IgnoreInf": [""],
> +"DscPath": "" # Don't support this test
> +},
> +
> +## options defined .pytool/Plugin/GuidCheck
> +"GuidCheck": {
> +"IgnoreGuidName": [],
> +"IgnoreGuidValue": [],
> +"IgnoreFoldersAndFiles": [],
> +"IgnoreDuplicates": [],
> +},
> +
> +## options defined .pytool/Plugin/LibraryClassCheck
> +"LibraryClassCheck": {
> +"IgnoreHeaderFile": []
> +},
> +
> +## options defined .pytool/Plugin/SpellCheck
> +"SpellCheck": {
> +"AuditOnly": True,   # Fails right now with over 270 errors
> +"IgnoreFiles": [],   # use gitignore syntax to ignore errors 
> in matching files
> +"ExtendWords": [
> +"setjump",
> +"plong",
> +"lparam",
> +"lpdword",
> +  

Re: [edk2-devel] [EXTERNAL] [PATCH v2 6/6] .azurepipelines: Update Core CI build matrix to include platforms

2020-04-24 Thread Bret Barkelew via groups.io
Reviewed-by: Bret Barkelew 

- Bret


From: michael.kuba...@outlook.com 
Sent: Monday, April 20, 2020 12:12:16 PM
To: devel@edk2.groups.io 
Cc: Sean Brogan ; Bret Barkelew 
; Kinney, Michael D ; 
Liming Gao 
Subject: [EXTERNAL] [PATCH v2 6/6] .azurepipelines: Update Core CI build matrix 
to include platforms

From: Sean Brogan 

REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2570data=02%7C01%7CBret.Barkelew%40microsoft.com%7C35a2a66b86534606737108d7e55edd1f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637230067914318497sdata=pzMfmnS84BV9p1xTmXFAyWyy%2F8RI%2FZ8XaXCxMHf6sB8%3Dreserved=0

Add ArmVirtPkg to Core CI matrix
Add EmulatorPkg to Core CI matrix
Add OvmfPkg to Core CI matrix

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Sean Brogan 
Signed-off-by: Michael Kubacki 
---
 .azurepipelines/templates/pr-gate-build-job.yml | 5 +
 1 file changed, 5 insertions(+)

diff --git a/.azurepipelines/templates/pr-gate-build-job.yml 
b/.azurepipelines/templates/pr-gate-build-job.yml
index 61868554d43c..a9f89aa68451 100644
--- a/.azurepipelines/templates/pr-gate-build-job.yml
+++ b/.azurepipelines/templates/pr-gate-build-job.yml
@@ -44,6 +44,11 @@ jobs:
   TARGET_SECURITY:
 Build.Pkgs: 'SecurityPkg'
 Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
+  TARGET_PLATFORMS:
+# For Platforms only check code. Leave it to Platform CI
+# to build them.
+Build.Pkgs: 'ArmVirtPkg,EmulatorPkg,OvmfPkg'
+Build.Targets: 'NO-TARGET'

   workspace:
 clean: all
--
2.16.3.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58103): https://edk2.groups.io/g/devel/message/58103
Mute This Topic: https://groups.io/mt/73250277/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [EXTERNAL] Re: [PATCH v2 0/6] Edk2 Platform and Core CI for ArmVirtPkg, EmulatorPkg, and OvmfPkg

2020-04-24 Thread Bret Barkelew via groups.io
Reviewed-by: Bret Barkelew 

- Bret


From: devel@edk2.groups.io  on behalf of Laszlo Ersek via 
groups.io 
Sent: Friday, April 24, 2020 7:33:11 AM
To: Sean Brogan ; michael.kuba...@outlook.com 
; devel@edk2.groups.io 
Cc: Andrew Fish ; Ard Biesheuvel ; 
Bret Barkelew ; Jordan Justen 
; Leif Lindholm ; Liming Gao 
; Kinney, Michael D ; Ray Ni 

Subject: Re: [edk2-devel] [EXTERNAL] Re: [PATCH v2 0/6] Edk2 Platform and Core 
CI for ArmVirtPkg, EmulatorPkg, and OvmfPkg

On 04/23/20 02:45, Sean Brogan wrote:
> I was hoping that because it wasn't "HTML tag soup" that build status could 
> be front and center in the package readme as I find that more in line with 
> expectations on github based projects.   Nesting it deeper in the package 
> just means less people find it when looking at your package.   But I could 
> see a few ways to solve it so I am looking for feedback and alignment before 
> doing anything else.
>
> Option 1.
>
> 1. Add the Platform CI build status for the three platforms to the Edk2 repo 
> readme since these are platforms in edk2 this makes sense and brings the most 
> visibility to their status and the existence of the builds.
> 2. Convert edk2 repo readme to RST so it avoids "HTML tag soup"
> 3. Move the remaining part of the OvmfPkg/Readme.rst file into 
> OvmfPkg/PlatformCI/Readme.md  (I prefer MD when not doing large tables of 
> links as it is easier to write and slightly easier to read as plain text).
> 4. Do step 3 for ArmVirtPkg and EmulatorPkg too
>
> Option 2.
> 1. Leave the ReadMe.rst at the root of each package but only include the 
> build status table and add a link to the PlatformCi/ReadMe.md
> 2. Move the Pytool and Platform CI focused readme contents to 
> PlatformCI/ReadMe.md
>
> Option 3.
>
> Something else.
>
> Finally does anyone have a strong preference for ReadMe vs README vs readme 
> vs Readme vs ReAdMe?  I see a mix of these in the edk2 code tree.

Sorry, I didn't mean to ignore this sub-thread, I just got to see the
other email (about the V10 branch) first. My understanding is that V10
has come to a resolution about the questions above; and I'm happy with
V10 (as I stated in that thread).

Thanks!
Laszlo





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58104): https://edk2.groups.io/g/devel/message/58104
Mute This Topic: https://groups.io/mt/73210237/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v4 3/6] OvmfPkg: Add VBE2 mode info structure to LegacyVgaBios.h

2020-04-24 Thread Rebecca Cran
bhyve uses the older VESA BIOS Extensions 2.0, so add the mode info
structure to IndustryStandard/LegacyVgaBios.h

Signed-off-by: Rebecca Cran 
Acked-by: Laszlo Ersek 
---
 .../Include/IndustryStandard/LegacyVgaBios.h  | 38 +++
 1 file changed, 38 insertions(+)

diff --git a/OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h 
b/OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h
index 317dac3a56..38360a68b2 100644
--- a/OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h
+++ b/OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h
@@ -86,6 +86,44 @@ typedef struct {
   UINT32 MaxPixelClockHz;
   UINT8  Reserved[190];
 } VBE_MODE_INFO;
+
+typedef struct {
+  UINT16 ModeAttr;
+  UINT8  WindowAAttr;
+  UINT8  WindowBAttr;
+  UINT16 WindowGranularityKB;
+  UINT16 WindowSizeKB;
+  UINT16 WindowAStartSegment;
+  UINT16 WindowBStartSegment;
+  UINT32 WindowPositioningAddress;
+  UINT16 BytesPerScanLine;
+
+  UINT16 Width;
+  UINT16 Height;
+  UINT8  CharCellWidth;
+  UINT8  CharCellHeight;
+  UINT8  NumPlanes;
+  UINT8  BitsPerPixel;
+  UINT8  NumBanks;
+  UINT8  MemoryModel;
+  UINT8  BankSizeKB;
+  UINT8  NumImagePagesLessOne;
+  UINT8  Vbe3;
+
+  UINT8  RedMaskSize;
+  UINT8  RedMaskPos;
+  UINT8  GreenMaskSize;
+  UINT8  GreenMaskPos;
+  UINT8  BlueMaskSize;
+  UINT8  BlueMaskPos;
+  UINT8  ReservedMaskSize;
+  UINT8  ReservedMaskPos;
+  UINT8  DirectColorModeInfo;
+
+  UINT32 LfbAddress;
+  UINT32 OffScreenAddress;
+  UINT16 OffScreenSizeKB;
+} VBE2_MODE_INFO;
 #pragma pack ()
 
 #endif
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58099): https://edk2.groups.io/g/devel/message/58099
Mute This Topic: https://groups.io/mt/73248061/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v4 5/6] BhyvePkg: Add PlatformPei

2020-04-24 Thread Rebecca Cran
Make a copy of OvmfPkg/PlatformPei under BhyvePkg with the changes
that are needed to support the bhyve hypervisor.

Signed-off-by: Rebecca Cran 
---
 BhyvePkg/License.txt  |   4 +
 BhyvePkg/PlatformPei/AmdSev.c | 106 +
 BhyvePkg/PlatformPei/ClearCache.c | 111 +
 BhyvePkg/PlatformPei/Cmos.c   |  58 +++
 BhyvePkg/PlatformPei/Cmos.h   |  50 ++
 BhyvePkg/PlatformPei/FeatureControl.c |  21 +
 BhyvePkg/PlatformPei/Fv.c |  94 
 BhyvePkg/PlatformPei/MemDetect.c  | 627 ++
 BhyvePkg/PlatformPei/Platform.c   | 607 +
 BhyvePkg/PlatformPei/Platform.h   | 137 ++
 BhyvePkg/PlatformPei/PlatformPei.inf  | 113 +
 11 files changed, 1928 insertions(+)
 create mode 100644 BhyvePkg/PlatformPei/AmdSev.c
 create mode 100644 BhyvePkg/PlatformPei/ClearCache.c
 create mode 100644 BhyvePkg/PlatformPei/Cmos.c
 create mode 100644 BhyvePkg/PlatformPei/Cmos.h
 create mode 100644 BhyvePkg/PlatformPei/FeatureControl.c
 create mode 100644 BhyvePkg/PlatformPei/Fv.c
 create mode 100644 BhyvePkg/PlatformPei/MemDetect.c
 create mode 100644 BhyvePkg/PlatformPei/Platform.c
 create mode 100644 BhyvePkg/PlatformPei/Platform.h
 create mode 100644 BhyvePkg/PlatformPei/PlatformPei.inf

diff --git a/BhyvePkg/License.txt b/BhyvePkg/License.txt
index cf41faacbf..2930e5372a 100644
--- a/BhyvePkg/License.txt
+++ b/BhyvePkg/License.txt
@@ -1,5 +1,8 @@
 Copyright (c) 2020, Rebecca Cran 
 Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
+Copyright (C) 2018, Red Hat, Inc.
+Copyright (c) 2017, Advanced Micro Devices. All rights reserved.
+Copyright (C) 2016, Red Hat, Inc.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 Copyright (c) 2015 Nahanni Systems
 Copyright (C) 2015, Red Hat, Inc.
@@ -8,6 +11,7 @@ Copyright (c) 2014, Pluribus Networks, Inc.
 Copyright (C) 2013, Red Hat, Inc.
 Copyright (c) 2012, 2013, Red Hat, Inc.
 Copyright (c) 2011, Bei Guan 
+Copyright (c) 2011, Andrei Warkentin 
 Portions copyright (c) 2011, Apple Inc. All rights reserved.
 Portions copyright (c) 2010,Apple Inc. All rights reserved.
 
diff --git a/BhyvePkg/PlatformPei/AmdSev.c b/BhyvePkg/PlatformPei/AmdSev.c
new file mode 100644
index 00..e484f4b311
--- /dev/null
+++ b/BhyvePkg/PlatformPei/AmdSev.c
@@ -0,0 +1,106 @@
+/**@file
+  Initialize Secure Encrypted Virtualization (SEV) support
+
+  Copyright (c) 2017, Advanced Micro Devices. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+//
+// The package level header files this module uses
+//
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "Platform.h"
+
+/**
+
+  Function checks if SEV support is available, if present then it sets
+  the dynamic PcdPteMemoryEncryptionAddressOrMask with memory encryption mask.
+
+  **/
+VOID
+AmdSevInitialize (
+  VOID
+  )
+{
+  CPUID_MEMORY_ENCRYPTION_INFO_EBX  Ebx;
+  UINT64EncryptionMask;
+  RETURN_STATUS PcdStatus;
+
+  //
+  // Check if SEV is enabled
+  //
+  if (!MemEncryptSevIsEnabled ()) {
+return;
+  }
+
+  //
+  // CPUID Fn8000_001F[EBX] Bit 0:5 (memory encryption bit position)
+  //
+  AsmCpuid (CPUID_MEMORY_ENCRYPTION_INFO, NULL, , NULL, NULL);
+  EncryptionMask = LShiftU64 (1, Ebx.Bits.PtePosBits);
+
+  //
+  // Set Memory Encryption Mask PCD
+  //
+  PcdStatus = PcdSet64S (PcdPteMemoryEncryptionAddressOrMask, EncryptionMask);
+  ASSERT_RETURN_ERROR (PcdStatus);
+
+  DEBUG ((DEBUG_INFO, "SEV is enabled (mask 0x%lx)\n", EncryptionMask));
+
+  //
+  // Set Pcd to Deny the execution of option ROM when security
+  // violation.
+  //
+  PcdStatus = PcdSet32S (PcdOptionRomImageVerificationPolicy, 0x4);
+  ASSERT_RETURN_ERROR (PcdStatus);
+
+  //
+  // When SMM is required, cover the pages containing the initial SMRAM Save
+  // State Map with a memory allocation HOB:
+  //
+  // There's going to be a time interval between our decrypting those pages for
+  // SMBASE relocation and re-encrypting the same pages after SMBASE
+  // relocation. We shall ensure that the DXE phase stay away from those pages
+  // until after re-encryption, in order to prevent an information leak to the
+  // hypervisor.
+  //
+  if (FeaturePcdGet (PcdSmmSmramRequire) && (mBootMode != BOOT_ON_S3_RESUME)) {
+RETURN_STATUS LocateMapStatus;
+UINTN MapPagesBase;
+UINTN MapPagesCount;
+
+LocateMapStatus = MemEncryptSevLocateInitialSmramSaveStateMapPages (
+,
+
+);
+ASSERT_RETURN_ERROR (LocateMapStatus);
+
+if (mQ35SmramAtDefaultSmbase) {
+  //
+  // The initial SMRAM Save State Map has been covered as part of a larger
+  // reserved memory allocation in InitializeRamRegions().
+  //
+  ASSERT (SMM_DEFAULT_SMBASE <= MapPagesBase);
+  ASSERT (
+(MapPagesBase + 

[edk2-devel] [PATCH v4 0/6] Add BhyvePkg, to support the bhyve hypervisor

2020-04-24 Thread Rebecca Cran
- Updated License.txt
- Added copyright headers for myself
- Changed license from BSD-2-Clause to BSD-2-Clause-Patent
  following email from Leif indicating that such relicensing
  is valid without contacting all original authors
- Fixed BhyveFwCtlLib bug: due to Hdr being UINTN instead of
  UINT32, an extra 4 bytes were being sent per transaction
- Other changes from review feedback

Cc: Andrew Fish 
Cc: Laszlo Ersek 
Cc: Leif Lindholm 
Cc: Michael D Kinney 

Signed-off-by: Rebecca Cran 

Rebecca Cran (6):
  OvmfPkg: Add bhyve support into AcpiTimerLib
  OvmfPkg: Add QemuFwCfgLibNull
  OvmfPkg: Add VBE2 mode info structure to LegacyVgaBios.h
  Add BhyvePkg, to support the bhyve hypervisor
  BhyvePkg: Add PlatformPei
  BhyvePkg: Add AcpiPlatformDxe

 BhyvePkg/AcpiPlatformDxe/AcpiPlatform.c   |  251 +++
 BhyvePkg/AcpiPlatformDxe/AcpiPlatform.h   |   77 +
 BhyvePkg/AcpiPlatformDxe/AcpiPlatformDxe.inf  |   65 +
 BhyvePkg/AcpiPlatformDxe/Bhyve.c  |  132 ++
 BhyvePkg/AcpiPlatformDxe/EntryPoint.c |   90 +
 BhyvePkg/AcpiPlatformDxe/PciDecoding.c|  192 ++
 BhyvePkg/AcpiTables/AcpiTables.inf|   39 +
 BhyvePkg/AcpiTables/Dsdt.asl  | 1140 +++
 BhyvePkg/AcpiTables/Facp.aslc |   76 +
 BhyvePkg/AcpiTables/Facs.aslc |   80 +
 BhyvePkg/AcpiTables/Hpet.aslc |   72 +
 BhyvePkg/AcpiTables/Madt.aslc |  145 ++
 BhyvePkg/AcpiTables/Mcfg.aslc |   57 +
 BhyvePkg/AcpiTables/Platform.h|   72 +
 BhyvePkg/AcpiTables/Spcr.aslc |   63 +
 BhyvePkg/AcpiTables/Ssdt.asl  |   15 +
 BhyvePkg/BhyvePkg.dec |  171 ++
 BhyvePkg/BhyvePkgDefines.fdf.inc  |   85 +
 BhyvePkg/BhyvePkgX64.dsc  |  847 +
 BhyvePkg/BhyvePkgX64.fdf  |  490 +
 BhyvePkg/BhyveRfbDxe/BhyveRfbDxe.inf  |   68 +
 BhyvePkg/BhyveRfbDxe/ComponentName.c  |  201 ++
 BhyvePkg/BhyveRfbDxe/Gop.h|  149 ++
 BhyvePkg/BhyveRfbDxe/GopDriver.c  |  543 ++
 BhyvePkg/BhyveRfbDxe/GopScreen.c  |  393 
 BhyvePkg/BhyveRfbDxe/VbeShim.asm  |  342 
 BhyvePkg/BhyveRfbDxe/VbeShim.c|  259 +++
 BhyvePkg/BhyveRfbDxe/VbeShim.h|  912 +
 BhyvePkg/BhyveRfbDxe/VbeShim.sh   |   80 +
 BhyvePkg/FvmainCompactScratchEnd.fdf.inc  |   65 +
 BhyvePkg/Include/Library/BhyveFwCtlLib.h  |   47 +
 .../Library/BhyveFwCtlLib/BhyveFwCtlLib.c |  426 +
 .../Library/BhyveFwCtlLib/BhyveFwCtlLib.inf   |   41 +
 .../PlatformBootManagerLib/BdsPlatform.c  | 1660 +
 .../PlatformBootManagerLib/BdsPlatform.h  |  190 ++
 .../PlatformBootManagerLib.inf|   75 +
 .../PlatformBootManagerLib/PlatformData.c |  171 ++
 BhyvePkg/License.txt  |   68 +
 BhyvePkg/PlatformPei/AmdSev.c |  106 ++
 BhyvePkg/PlatformPei/ClearCache.c |  111 ++
 BhyvePkg/PlatformPei/Cmos.c   |   58 +
 BhyvePkg/PlatformPei/Cmos.h   |   50 +
 BhyvePkg/PlatformPei/FeatureControl.c |   21 +
 BhyvePkg/PlatformPei/Fv.c |   94 +
 BhyvePkg/PlatformPei/MemDetect.c  |  627 +++
 BhyvePkg/PlatformPei/Platform.c   |  607 ++
 BhyvePkg/PlatformPei/Platform.h   |  137 ++
 BhyvePkg/PlatformPei/PlatformPei.inf  |  113 ++
 BhyvePkg/SmbiosPlatformDxe/Bhyve.c|   43 +
 .../SmbiosPlatformDxe/SmbiosPlatformDxe.c |  245 +++
 .../SmbiosPlatformDxe/SmbiosPlatformDxe.h |   52 +
 .../SmbiosPlatformDxe/SmbiosPlatformDxe.inf   |   55 +
 BhyvePkg/VarStore.fdf.inc |  115 ++
 Maintainers.txt   |8 +
 OvmfPkg/Include/IndustryStandard/Bhyve.h  |   16 +
 .../Include/IndustryStandard/LegacyVgaBios.h  |   38 +
 OvmfPkg/Include/OvmfPlatforms.h   |1 +
 .../AcpiTimerLib/BaseAcpiTimerLibBhyve.c  |   32 +
 .../AcpiTimerLib/BaseAcpiTimerLibBhyve.inf|   30 +
 .../Library/QemuFwCfgLib/QemuFwCfgLibNull.inf |   37 +
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgNull.c  |  209 +++
 Readme.md |1 +
 62 files changed, 12655 insertions(+)
 create mode 100644 BhyvePkg/AcpiPlatformDxe/AcpiPlatform.c
 create mode 100644 BhyvePkg/AcpiPlatformDxe/AcpiPlatform.h
 create mode 100644 BhyvePkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
 create mode 100644 BhyvePkg/AcpiPlatformDxe/Bhyve.c
 create mode 100644 BhyvePkg/AcpiPlatformDxe/EntryPoint.c
 create mode 100644 BhyvePkg/AcpiPlatformDxe/PciDecoding.c
 create mode 100644 BhyvePkg/AcpiTables/AcpiTables.inf
 create mode 100644 BhyvePkg/AcpiTables/Dsdt.asl
 create mode 100644 BhyvePkg/AcpiTables/Facp.aslc
 create mode 100644 BhyvePkg/AcpiTables/Facs.aslc
 create mode 100644 BhyvePkg/AcpiTables/Hpet.aslc
 create mode 100644 

[edk2-devel] [PATCH v4 2/6] OvmfPkg: Add QemuFwCfgLibNull

2020-04-24 Thread Rebecca Cran
Add a null implementation library for QemuFwCfgLib, in order to
support building PciHostBridgeLib for bhyve.

Signed-off-by: Rebecca Cran 
---
 .../Library/QemuFwCfgLib/QemuFwCfgLibNull.inf |  37 
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgNull.c  | 209 ++
 2 files changed, 246 insertions(+)
 create mode 100644 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf
 create mode 100644 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgNull.c

diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf 
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf
new file mode 100644
index 00..09f86c2b02
--- /dev/null
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf
@@ -0,0 +1,37 @@
+## @file
+#
+#  Stateful, implicitly initialized fw_cfg library.
+#
+#  Copyright (C) 2013, Red Hat, Inc.
+#  Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.
+#  Copyright (c) 2017, AMD Incorporated. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = QemuFwCfgLibNull
+  FILE_GUID  = B9D1A1F2-01E2-4732-982D-C7F9ED51AC6B
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = QemuFwCfgLib
+
+#
+# The following information is for reference only and not required by the 
build tools.
+#
+#  VALID_ARCHITECTURES   = IA32 X64
+#
+
+[Sources]
+  QemuFwCfgLibInternal.h
+  QemuFwCfgNull.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[LibraryClasses]
+  DebugLib
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgNull.c 
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgNull.c
new file mode 100644
index 00..e2cc5f3406
--- /dev/null
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgNull.c
@@ -0,0 +1,209 @@
+/** @file
+
+  Stateful and implicitly initialized fw_cfg library implementation.
+
+  Copyright (C) 2013, Red Hat, Inc.
+  Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.
+  Copyright (c) 2017, Advanced Micro Devices. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+#include 
+#include 
+
+/**
+  Returns a boolean indicating if the firmware configuration interface
+  is available or not.
+
+  This function may change fw_cfg state.
+
+  @retvalTRUE   The interface is available
+  @retvalFALSE  The interface is not available
+
+**/
+BOOLEAN
+EFIAPI
+QemuFwCfgIsAvailable (
+  VOID
+  )
+{
+  return FALSE;
+}
+
+
+/**
+  Selects a firmware configuration item for reading.
+
+  Following this call, any data read from this item will start from
+  the beginning of the configuration item's data.
+
+  @param[in] QemuFwCfgItem - Firmware Configuration item to read
+
+**/
+VOID
+EFIAPI
+QemuFwCfgSelectItem (
+  IN FIRMWARE_CONFIG_ITEM   QemuFwCfgItem
+  )
+{
+  ASSERT (FALSE);
+}
+
+
+/**
+  Reads firmware configuration bytes into a buffer
+
+  If called multiple times, then the data read will
+  continue at the offset of the firmware configuration
+  item where the previous read ended.
+
+  @param[in] Size - Size in bytes to read
+  @param[in] Buffer - Buffer to store data into
+
+**/
+VOID
+EFIAPI
+QemuFwCfgReadBytes (
+  IN UINTN  Size,
+  IN VOID   *Buffer  OPTIONAL
+  )
+{
+  ASSERT (FALSE);
+}
+
+
+/**
+  Writes firmware configuration bytes from a buffer
+
+  If called multiple times, then the data written will
+  continue at the offset of the firmware configuration
+  item where the previous write ended.
+
+  @param[in] Size - Size in bytes to write
+  @param[in] Buffer - Buffer to read data from
+
+**/
+VOID
+EFIAPI
+QemuFwCfgWriteBytes (
+  IN UINTN  Size,
+  IN VOID   *Buffer
+  )
+{
+  ASSERT (FALSE);
+}
+
+
+/**
+  Skip bytes in the firmware configuration item.
+
+  Increase the offset of the firmware configuration item without transferring
+  bytes between the item and a caller-provided buffer. Subsequent read, write
+  or skip operations will commence at the increased offset.
+
+  @param[in] Size  Number of bytes to skip.
+**/
+VOID
+EFIAPI
+QemuFwCfgSkipBytes (
+  IN UINTN  Size
+  )
+{
+  ASSERT (FALSE);
+}
+
+
+/**
+  Reads a UINT8 firmware configuration value
+
+  @returnValue of Firmware Configuration item read
+
+**/
+UINT8
+EFIAPI
+QemuFwCfgRead8 (
+  VOID
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+
+/**
+  Reads a UINT16 firmware configuration value
+
+  @returnValue of Firmware Configuration item read
+
+**/
+UINT16
+EFIAPI
+QemuFwCfgRead16 (
+  VOID
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+
+/**
+  Reads a UINT32 firmware configuration value
+
+  @returnValue of Firmware Configuration item read
+
+**/
+UINT32
+EFIAPI
+QemuFwCfgRead32 (
+  VOID
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+
+/**
+  Reads a UINT64 firmware configuration value
+
+  @returnValue of Firmware 

[edk2-devel] [PATCH v4 6/6] BhyvePkg: Add AcpiPlatformDxe

2020-04-24 Thread Rebecca Cran
Make a copy of OvmfPkg/AcpiPlatformDxe under BhyvePkg, with the changes
needed to support the bhyve hypervisor.

Signed-off-by: Rebecca Cran 
---
 BhyvePkg/AcpiPlatformDxe/AcpiPlatform.c  | 251 +++
 BhyvePkg/AcpiPlatformDxe/AcpiPlatform.h  |  77 ++
 BhyvePkg/AcpiPlatformDxe/AcpiPlatformDxe.inf |  65 +
 BhyvePkg/AcpiPlatformDxe/Bhyve.c | 132 ++
 BhyvePkg/AcpiPlatformDxe/EntryPoint.c|  90 +++
 BhyvePkg/AcpiPlatformDxe/PciDecoding.c   | 192 ++
 6 files changed, 807 insertions(+)
 create mode 100644 BhyvePkg/AcpiPlatformDxe/AcpiPlatform.c
 create mode 100644 BhyvePkg/AcpiPlatformDxe/AcpiPlatform.h
 create mode 100644 BhyvePkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
 create mode 100644 BhyvePkg/AcpiPlatformDxe/Bhyve.c
 create mode 100644 BhyvePkg/AcpiPlatformDxe/EntryPoint.c
 create mode 100644 BhyvePkg/AcpiPlatformDxe/PciDecoding.c

diff --git a/BhyvePkg/AcpiPlatformDxe/AcpiPlatform.c 
b/BhyvePkg/AcpiPlatformDxe/AcpiPlatform.c
new file mode 100644
index 00..31bbf6c474
--- /dev/null
+++ b/BhyvePkg/AcpiPlatformDxe/AcpiPlatform.c
@@ -0,0 +1,251 @@
+/** @file
+  OVMF ACPI Platform Driver
+
+  Copyright (c) 2020, Rebecca Cran 
+  Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "AcpiPlatform.h"
+
+EFI_STATUS
+EFIAPI
+InstallAcpiTable (
+  IN   EFI_ACPI_TABLE_PROTOCOL   *AcpiProtocol,
+  IN   VOID  *AcpiTableBuffer,
+  IN   UINTN AcpiTableBufferSize,
+  OUT  UINTN *TableKey
+  )
+{
+  return AcpiProtocol->InstallAcpiTable (
+ AcpiProtocol,
+ AcpiTableBuffer,
+ AcpiTableBufferSize,
+ TableKey
+ );
+}
+
+
+/**
+  Locate the first instance of a protocol.  If the protocol requested is an
+  FV protocol, then it will return the first FV that contains the ACPI table
+  storage file.
+
+  @param  Instance  Return pointer to the first instance of the protocol
+
+  @return EFI_SUCCESS   The function completed successfully.
+  @return EFI_NOT_FOUND The protocol could not be located.
+  @return EFI_OUT_OF_RESOURCES  There are not enough resources to find the 
protocol.
+
+**/
+EFI_STATUS
+LocateFvInstanceWithTables (
+  OUT EFI_FIRMWARE_VOLUME2_PROTOCOL **Instance
+  )
+{
+  EFI_STATUSStatus;
+  EFI_HANDLE*HandleBuffer;
+  UINTN NumberOfHandles;
+  EFI_FV_FILETYPE   FileType;
+  UINT32FvStatus;
+  EFI_FV_FILE_ATTRIBUTESAttributes;
+  UINTN Size;
+  UINTN Index;
+  EFI_FIRMWARE_VOLUME2_PROTOCOL *FvInstance;
+
+  FvStatus = 0;
+
+  //
+  // Locate protocol.
+  //
+  Status = gBS->LocateHandleBuffer (
+   ByProtocol,
+   ,
+   NULL,
+   ,
+   
+   );
+  if (EFI_ERROR (Status)) {
+//
+// Defined errors at this time are not found and out of resources.
+//
+return Status;
+  }
+
+  //
+  // Looking for FV with ACPI storage file
+  //
+  for (Index = 0; Index < NumberOfHandles; Index++) {
+//
+// Get the protocol on this handle
+// This should not fail because of LocateHandleBuffer
+//
+Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ ,
+ (VOID**) 
+ );
+ASSERT_EFI_ERROR (Status);
+
+//
+// See if it has the ACPI storage file
+//
+Status = FvInstance->ReadFile (
+   FvInstance,
+   (EFI_GUID*)PcdGetPtr (PcdAcpiTableStorageFile),
+   NULL,
+   ,
+   ,
+   ,
+   
+   );
+
+//
+// If we found it, then we are done
+//
+if (Status == EFI_SUCCESS) {
+  *Instance = FvInstance;
+  break;
+}
+  }
+
+  //
+  // Our exit status is determined by the success of the previous operations
+  // If the protocol was found, Instance already points to it.
+  //
+
+  //
+  // Free any allocated buffers
+  //
+  gBS->FreePool (HandleBuffer);
+
+  return Status;
+}
+
+
+/**
+  Find ACPI tables in an FV and install them.
+
+  This is now a fall-back path. Normally, we will search for tables provided
+  by the VMM first.
+
+  If that fails, we use this function to load the ACPI tables from an FV. The
+  sources for the FV based tables is located under OvmfPkg/AcpiTables.
+
+  @param  AcpiTable Protocol instance pointer
+
+**/
+EFI_STATUS
+EFIAPI
+InstallOvmfFvTables (
+  IN  EFI_ACPI_TABLE_PROTOCOL *AcpiTable
+  )
+{
+  EFI_STATUS   Status;
+  

[edk2-devel] [PATCH v4 1/6] OvmfPkg: Add bhyve support into AcpiTimerLib

2020-04-24 Thread Rebecca Cran
On bhyve, the ACPI timer is located at a fixed IO address; it need
not be programmed into, nor fetched from, the PMBA -- power
management base address -- register of the PCI host bridge.

Signed-off-by: Rebecca Cran 
Reviewed-by: Laszlo Ersek 
---
 OvmfPkg/Include/IndustryStandard/Bhyve.h  | 16 ++
 OvmfPkg/Include/OvmfPlatforms.h   |  1 +
 .../AcpiTimerLib/BaseAcpiTimerLibBhyve.c  | 32 +++
 .../AcpiTimerLib/BaseAcpiTimerLibBhyve.inf| 30 +
 4 files changed, 79 insertions(+)
 create mode 100644 OvmfPkg/Include/IndustryStandard/Bhyve.h
 create mode 100644 OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c
 create mode 100644 OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf

diff --git a/OvmfPkg/Include/IndustryStandard/Bhyve.h 
b/OvmfPkg/Include/IndustryStandard/Bhyve.h
new file mode 100644
index 00..02ce5587ee
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/Bhyve.h
@@ -0,0 +1,16 @@
+/** @file
+  Various register numbers and value bits based on FreeBSD's bhyve
+  at r359530.
+  - https://svnweb.freebsd.org/base?view=revision=359530
+
+  Copyright (C) 2020, Rebecca Cran 
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef __BHYVE_H__
+#define __BHYVE_H__
+
+#define BHYVE_ACPI_TIMER_IO_ADDR 0x408
+
+#endif // __BHYVE_H__
diff --git a/OvmfPkg/Include/OvmfPlatforms.h b/OvmfPkg/Include/OvmfPlatforms.h
index 59459231e8..77dd818e30 100644
--- a/OvmfPkg/Include/OvmfPlatforms.h
+++ b/OvmfPkg/Include/OvmfPlatforms.h
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 //
 // OVMF Host Bridge DID Address
diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c 
b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c
new file mode 100644
index 00..f927e27188
--- /dev/null
+++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c
@@ -0,0 +1,32 @@
+/** @file
+  Provide InternalAcpiGetTimerTick for the bhyve instance of the
+  Base ACPI Timer Library
+
+  Copyright (C) 2020, Rebecca Cran 
+  Copyright (C) 2014, Gabriel L. Somlo 
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+#include 
+
+/**
+  Internal function to read the current tick counter of ACPI.
+
+  Read the current ACPI tick counter using the counter address cached
+  by this instance's constructor.
+
+  @return The tick counter read.
+
+**/
+UINT32
+InternalAcpiGetTimerTick (
+  VOID
+  )
+{
+  //
+  // Return the current ACPI timer value.
+  //
+  return IoRead32 (BHYVE_ACPI_TIMER_IO_ADDR);
+}
diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf 
b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf
new file mode 100644
index 00..14b7479e67
--- /dev/null
+++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf
@@ -0,0 +1,30 @@
+## @file
+#  Base ACPI Timer Library Instance for Bhyve.
+#
+#  Copyright (C) 2020, Rebecca Cran 
+#  Copyright (C) 2014, Gabriel L. Somlo 
+#  Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = BaseAcpiTimerLibBhyve
+  FILE_GUID  = A5E3B247-7302-11EA-9C04-3CECEF0C1C08
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = TimerLib
+
+[Sources]
+  AcpiTimerLib.c
+  AcpiTimerLib.h
+  BaseAcpiTimerLibBhyve.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[LibraryClasses]
+  IoLib
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58097): https://edk2.groups.io/g/devel/message/58097
Mute This Topic: https://groups.io/mt/73248059/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 5/5] OvmfPkg/OvmfXen: Introduce DEBUG_ON_HYPERVISOR_CONSOLE build flag

2020-04-24 Thread Laszlo Ersek
On 04/23/20 11:53, Anthony PERARD wrote:
> Introduce DEBUG_ON_HYPERVISOR_CONSOLE build flag to enable logging
> debug output to the Xen console.
> 
> This will work with both Xen HVM guest and Xen PVH guest whereas the
> default PlatformDebugLibIoPort works only in HVM when QEMU is present.
> 
> Signed-off-by: Anthony PERARD 
> ---
>  OvmfPkg/OvmfXen.dsc | 13 +
>  1 file changed, 13 insertions(+)
> 
> diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
> index 4859faf1bff7..0a8fd26990a3 100644
> --- a/OvmfPkg/OvmfXen.dsc
> +++ b/OvmfPkg/OvmfXen.dsc
> @@ -205,14 +205,22 @@ [LibraryClasses]
>
> Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLib.inf
>
> TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
>
> RealTimeClockLib|OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.inf
> +!ifdef $(DEBUG_ON_HYPERVISOR_CONSOLE)
> +  
> DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPortNocheck.inf
> +!else
>DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
> +!endif
>  
>  [LibraryClasses.common]
>BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
>  
>  [LibraryClasses.common.SEC]
>QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf
> +!ifdef $(DEBUG_ON_HYPERVISOR_CONSOLE)
> +  
> DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPortNocheck.inf
> +!else
>
> DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
> +!endif

(1) This part can be simplified with an !ifndef, instead, I think. (When
DEBUG_ON_HYPERVISOR_CONSOLE is defined, then the default resolution can
take effect for SEC too.)

If you wish I can change this for you as well. Alternatively, if you'd
rather repost, that's OK too. (And maybe Phil intends to review more of
the patches in this series; I'm not sure.)

>
> ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
>
> ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf
>  !if $(SOURCE_DEBUG_ENABLE) == TRUE
> @@ -405,6 +413,11 @@ [PcdsFixedAtBuild]
>#
>  !include NetworkPkg/NetworkPcds.dsc.inc
>  
> +!ifdef $(DEBUG_ON_HYPERVISOR_CONSOLE)
> +  ## Set Xen's debug IO port for PlatformDebugLibIoPort
> +  gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort|0xe9
> +!endif
> +
># IRQs 5, 9, 10, 11 are level-triggered
>gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20
>  
> 

With (1) updated:

Reviewed-by: Laszlo Ersek 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58095): https://edk2.groups.io/g/devel/message/58095
Mute This Topic: https://groups.io/mt/73215163/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v5 03/12] OvmfPkg/MptScsiDxe: Report name of driver

2020-04-24 Thread Carsey, Jaben
I don't remember reviewing this previously (not recently at least), maybe the 
RB should be CC?

One comment inline below.

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Nikita
> Leshenko
> Sent: Friday, April 24, 2020 10:59 AM
> To: devel@edk2.groups.io
> Cc: Nikita Leshenko ;
> liran.a...@oracle.com; aaron.yo...@oracle.com; Justen, Jordan L
> ; Laszlo Ersek ; Ard
> Biesheuvel ; Carsey, Jaben
> 
> Subject: [edk2-devel] [PATCH v5 03/12] OvmfPkg/MptScsiDxe: Report name
> of driver
> 
> Install Component Name protocols to have a nice display name for the driver
> in places such as UEFI shell.
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
> Signed-off-by: Nikita Leshenko 
> Reviewed-by: Laszlo Ersek 
> Reviewed-by: Jaben Carsey 
> Reviewed-by: Liran Alon 
> ---
>  OvmfPkg/MptScsiDxe/MptScsi.c | 61
> ++--
>  1 file changed, 59 insertions(+), 2 deletions(-)
> 
> diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
> index 581d3909b84d..64949a809022 100644
> --- a/OvmfPkg/MptScsiDxe/MptScsi.c
> +++ b/OvmfPkg/MptScsiDxe/MptScsi.c
> @@ -69,6 +69,63 @@ EFI_DRIVER_BINDING_PROTOCOL
> mMptScsiDriverBinding = {
>NULL, // DriverBindingHandle, filled as well  };
> 
> +//
> +// Component Name
> +//
> +
> +STATIC
> +EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {
> +  { "eng;en", L"LSI Fusion MPT SCSI Driver" },
> +  { NULL, NULL   }
> +};
> +
> +STATIC
> +EFI_COMPONENT_NAME_PROTOCOL mComponentName;
> +
> +EFI_STATUS
> +EFIAPI
> +MptScsiGetDriverName (
> +  IN  EFI_COMPONENT_NAME_PROTOCOL *This,
> +  IN  CHAR8   *Language,
> +  OUT CHAR16  **DriverName
> +  )
> +{
> +  return LookupUnicodeString2 (
> +   Language,
> +   This->SupportedLanguages,
> +   mDriverNameTable,
> +   DriverName,
> +   (BOOLEAN)(This == ) // Iso639Language
> +   );
> +}
> +
> +EFI_STATUS
> +EFIAPI
> +MptScsiGetDeviceName (
> +  IN  EFI_COMPONENT_NAME_PROTOCOL *This,
> +  IN  EFI_HANDLE  DeviceHandle,
> +  IN  EFI_HANDLE  ChildHandle,
> +  IN  CHAR8   *Language,
> +  OUT CHAR16  **ControllerName
> +  )
> +{
> +  return EFI_UNSUPPORTED;
> +}
> +
> +STATIC
> +EFI_COMPONENT_NAME_PROTOCOL mComponentName = {
> +  ,
> +  ,
> +  "eng" // SupportedLanguages, ISO 639-2 language codes };
> +
> +STATIC
> +EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 = {
> +  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)
> ,
> +  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)
> ,
> +  "en" // SupportedLanguages, RFC 4646 language codes };

I think that the }; needs to be outside of the comment for both of these 
structures.

> +
>  //
>  // Entry Point
>  //
> @@ -85,7 +142,7 @@ MptScsiEntryPoint (
> SystemTable,
> ,
> ImageHandle, // The handle to install onto
> -   NULL, // TODO Component name
> -   NULL // TODO Component name
> +   ,
> +   
> );
>  }
> --
> 2.20.1
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58094): https://edk2.groups.io/g/devel/message/58094
Mute This Topic: https://groups.io/mt/73247263/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 4/5] OvmfPkg/PlatformDebugLibIoPort: Introduce a Nocheck variant

2020-04-24 Thread Laszlo Ersek
On 04/23/20 11:53, Anthony PERARD wrote:
> Introduce PlatformRomDebugLibIoPortNocheck which doesn't try to detect
> the debug IO port. Instead, debug logs are always written to the IO port.
> 
> Signed-off-by: Anthony PERARD 
> ---
>  ...f => PlatformRomDebugLibIoPortNocheck.inf} | 15 ++-
>  .../DebugIoPortNocheck.c  | 25 +++
>  2 files changed, 32 insertions(+), 8 deletions(-)
>  copy OvmfPkg/Library/PlatformDebugLibIoPort/{PlatformRomDebugLibIoPort.inf 
> => PlatformRomDebugLibIoPortNocheck.inf} (65%)
>  create mode 100644 
> OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortNocheck.c
> 
> diff --git 
> a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf 
> b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPortNocheck.inf
> similarity index 65%
> copy from OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
> copy to 
> OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPortNocheck.inf
> index 8f721d249dd5..34034e1eb887 100644
> --- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
> +++ 
> b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPortNocheck.inf
> @@ -1,9 +1,8 @@
>  ## @file
> -#  Instance of Debug Library for the QEMU debug console port.
> +#  Instance of Debug Library for an hypervisor debug console port.
>  #  It uses Print Library to produce formatted output strings.
>  #
> -#  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> -#  Copyright (c) 2017, Red Hat, Inc.
> +#  Copyright (c) 2020, Citrix Systems, Inc.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -12,11 +11,11 @@
>  
>  [Defines]
>INF_VERSION= 0x00010005
> -  BASE_NAME  = PlatformRomDebugLibIoPort
> -  FILE_GUID  = CEB0D9D3-328F-4C24-8C02-28FA1986AE1B
> +  BASE_NAME  = PlatformRomDebugLibIoPortNocheck
> +  FILE_GUID  = 92AEB68E-C2CF-466E-9AB2-3F5E713F7DE6
>MODULE_TYPE= BASE
>VERSION_STRING = 1.0
> -  LIBRARY_CLASS  = DebugLib|SEC
> +  LIBRARY_CLASS  = DebugLib|SEC PEI_CORE PEIM DXE_CORE 
> DXE_DRIVER DXE_RUNTIME_DRIVER SMM_CORE DXE_SMM_DRIVER UEFI_DRIVER 
> UEFI_APPLICATION

(1) The simple way to say the same is to just drop the "|..." part :)

But I can fix this up for you.

>CONSTRUCTOR= PlatformRomDebugLibIoPortConstructor
>  
>  #
> @@ -24,10 +23,10 @@ [Defines]
>  #
>  
>  [Sources]
> -  DebugIoPortQemu.c
> +  DebugIoPortNocheck.c
>DebugLib.c
> -  DebugLibDetect.h
>DebugLibDetectRom.c
> +  DebugLibDetect.h

(2) The re-ordering of "DebugLibDetect.h" is curious. Maybe you may have
an LC_COLLATE setting that sorts "." after "R"?

Anyway I can re-sort this when I merge the series.

>  
>  [Packages]
>MdePkg/MdePkg.dec
> diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortNocheck.c 
> b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortNocheck.c
> new file mode 100644
> index ..0ef7920a8fb8
> --- /dev/null
> +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortNocheck.c
> @@ -0,0 +1,25 @@
> +/** @file
> +  Dectection code for hypervisor debug port.
> +
> +  Copyright (c) 2020, Citrix Systems, Inc.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include "DebugLibDetect.h"
> +
> +/**
> +  Always return TRUE without detection as the debug I/O port is always
> +  present.
> +
> +  @retval TRUE   The debug I/O port is always present.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +PlatformDebugLibIoPortDetect (
> +  VOID
> +  )
> +{
> +  return TRUE;
> +}
> 

Reviewed-by: Laszlo Ersek 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58093): https://edk2.groups.io/g/devel/message/58093
Mute This Topic: https://groups.io/mt/73215162/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] MdeModulePkg/DeviceManagerUiLib: connect all before creating menu page

2020-04-24 Thread Ard Biesheuvel

On 4/19/20 10:06 AM, Bi, Dandan wrote:

Ok, thanks Ard!
Reviewed-by: Dandan Bi  for this patch.



Hao, Jian,

I intend to merge this patch next week, unless you have any objections.


Thanks,
Ard.



-Original Message-
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Ard Biesheuvel
Sent: Sunday, April 12, 2020 4:22 PM
To: Bi, Dandan ; devel@edk2.groups.io;
ler...@redhat.com
Cc: Gao, Zhichao ; Ni, Ray ;
Wang, Jian J ; Wu, Hao A 
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/DeviceManagerUiLib:
connect all before creating menu page

On 4/12/20 9:55 AM, Bi, Dandan wrote:

Hi Ard,

It seems that the root cause is the 'Network Device List' in the device

manager menu is crated before EfiBootManagerConnectAll () is called in
UiEntry function.

If we choose to add the EfiBootManagerConnectAll() in

DeviceManagerUiLib with this patch, could we don't call the
EfiBootManagerConnectAll() in UiEntry to avoid it's called twice when enter
UiApp?




DeviceManagerUiLib is optional - this seems to be the purpose of the
modular nature of UiApp with the NULL library class resolution.

Removing EfiBootManagerConnectAll() from UiApp itself means it may not
ever be called.







-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58092): https://edk2.groups.io/g/devel/message/58092
Mute This Topic: https://groups.io/mt/72879609/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 05/12] OvmfPkg/MptScsiDxe: Install stubbed EXT_SCSI_PASS_THRU

2020-04-24 Thread Nikita Leshenko
Support dynamic insertion and removal of the protocol

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
Signed-off-by: Nikita Leshenko 
Reviewed-by: Laszlo Ersek 
---
 OvmfPkg/MptScsiDxe/MptScsi.c  | 181 +-
 OvmfPkg/MptScsiDxe/MptScsiDxe.inf |   5 +-
 2 files changed, 183 insertions(+), 3 deletions(-)

diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
index 4e2f8f2296fb..40d392c2346f 100644
--- a/OvmfPkg/MptScsiDxe/MptScsi.c
+++ b/OvmfPkg/MptScsiDxe/MptScsi.c
@@ -11,9 +11,12 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 //
@@ -22,6 +25,109 @@
 //
 #define MPT_SCSI_BINDING_VERSION 0x10
 
+//
+// Runtime Structures
+//
+
+#define MPT_SCSI_DEV_SIGNATURE SIGNATURE_32 ('M','P','T','S')
+typedef struct {
+  UINT32  Signature;
+  EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru;
+  EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode;
+} MPT_SCSI_DEV;
+
+#define MPT_SCSI_FROM_PASS_THRU(PassThruPtr) \
+  CR (PassThruPtr, MPT_SCSI_DEV, PassThru, MPT_SCSI_DEV_SIGNATURE)
+
+//
+// Ext SCSI Pass Thru
+//
+
+STATIC
+EFI_STATUS
+EFIAPI
+MptScsiPassThru (
+  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL*This,
+  IN UINT8  *Target,
+  IN UINT64 Lun,
+  IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
+  IN EFI_EVENT  Event OPTIONAL
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+STATIC
+EFI_STATUS
+EFIAPI
+MptScsiGetNextTargetLun (
+  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL*This,
+  IN OUT UINT8  **Target,
+  IN OUT UINT64 *Lun
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+STATIC
+EFI_STATUS
+EFIAPI
+MptScsiGetNextTarget (
+  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL   *This,
+  IN OUT UINT8 **Target
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+STATIC
+EFI_STATUS
+EFIAPI
+MptScsiBuildDevicePath (
+  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL   *This,
+  IN UINT8 *Target,
+  IN UINT64Lun,
+  IN OUT EFI_DEVICE_PATH_PROTOCOL  **DevicePath
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+STATIC
+EFI_STATUS
+EFIAPI
+MptScsiGetTargetLun (
+  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL   *This,
+  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePath,
+  OUT UINT8**Target,
+  OUT UINT64   *Lun
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+STATIC
+EFI_STATUS
+EFIAPI
+MptScsiResetChannel (
+  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL   *This
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+STATIC
+EFI_STATUS
+EFIAPI
+MptScsiResetTargetLun (
+  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL   *This,
+  IN UINT8 *Target,
+  IN UINT64Lun
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
 //
 // Driver Binding
 //
@@ -90,7 +196,49 @@ MptScsiControllerStart (
   IN EFI_DEVICE_PATH_PROTOCOL   *RemainingDevicePath OPTIONAL
   )
 {
-  return EFI_UNSUPPORTED;
+  EFI_STATUS   Status;
+  MPT_SCSI_DEV *Dev;
+
+  Dev = AllocateZeroPool (sizeof (*Dev));
+  if (Dev == NULL) {
+return EFI_OUT_OF_RESOURCES;
+  }
+
+  Dev->Signature = MPT_SCSI_DEV_SIGNATURE;
+
+  //
+  // Host adapter channel, doesn't exist
+  //
+  Dev->PassThruMode.AdapterId = MAX_UINT32;
+  Dev->PassThruMode.Attributes =
+EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL |
+EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL;
+
+  Dev->PassThru.Mode = >PassThruMode;
+  Dev->PassThru.PassThru = 
+  Dev->PassThru.GetNextTargetLun = 
+  Dev->PassThru.BuildDevicePath = 
+  Dev->PassThru.GetTargetLun = 
+  Dev->PassThru.ResetChannel = 
+  Dev->PassThru.ResetTargetLun = 
+  Dev->PassThru.GetNextTarget = 
+
+  Status = gBS->InstallProtocolInterface (
+  ,
+  ,
+  EFI_NATIVE_INTERFACE,
+  >PassThru
+  );
+  if (EFI_ERROR (Status)) {
+goto FreePool;
+  }
+
+  return EFI_SUCCESS;
+
+FreePool:
+  FreePool (Dev);
+
+  return Status;
 }
 
 STATIC
@@ -103,7 +251,36 @@ MptScsiControllerStop (
   IN  EFI_HANDLE*ChildHandleBuffer
   )
 {
-  return EFI_UNSUPPORTED;
+  EFI_STATUS  Status;
+  EFI_EXT_SCSI_PASS_THRU_PROTOCOL *PassThru;
+  MPT_SCSI_DEV*Dev;
+
+  Status = gBS->OpenProtocol (
+  ControllerHandle,
+  ,
+  (VOID **),
+  This->DriverBindingHandle,
+  ControllerHandle,
+  EFI_OPEN_PROTOCOL_GET_PROTOCOL // Lookup only
+  );
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  Dev = 

[edk2-devel] [PATCH v5 02/12] OvmfPkg/MptScsiDxe: Install DriverBinding Protocol

2020-04-24 Thread Nikita Leshenko
In order to probe and connect to the MptScsi device we need this
protocol. Currently it does nothing.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
Signed-off-by: Nikita Leshenko 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Liran Alon 
---
 OvmfPkg/MptScsiDxe/MptScsi.c  | 67 ++-
 OvmfPkg/MptScsiDxe/MptScsiDxe.inf |  1 +
 2 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
index c6c8142dfde6..581d3909b84d 100644
--- a/OvmfPkg/MptScsiDxe/MptScsi.c
+++ b/OvmfPkg/MptScsiDxe/MptScsi.c
@@ -9,8 +9,66 @@
 
 **/
 
+#include 
 #include 
 
+//
+// Higher versions will be used before lower, 0x10-0xffef is the version
+// range for IVH (Indie Hardware Vendors)
+//
+#define MPT_SCSI_BINDING_VERSION 0x10
+
+//
+// Driver Binding
+//
+
+STATIC
+EFI_STATUS
+EFIAPI
+MptScsiControllerSupported (
+  IN EFI_DRIVER_BINDING_PROTOCOL*This,
+  IN EFI_HANDLE ControllerHandle,
+  IN EFI_DEVICE_PATH_PROTOCOL   *RemainingDevicePath OPTIONAL
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+STATIC
+EFI_STATUS
+EFIAPI
+MptScsiControllerStart (
+  IN EFI_DRIVER_BINDING_PROTOCOL*This,
+  IN EFI_HANDLE ControllerHandle,
+  IN EFI_DEVICE_PATH_PROTOCOL   *RemainingDevicePath OPTIONAL
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+STATIC
+EFI_STATUS
+EFIAPI
+MptScsiControllerStop (
+  IN EFI_DRIVER_BINDING_PROTOCOL*This,
+  IN  EFI_HANDLEControllerHandle,
+  IN  UINTN NumberOfChildren,
+  IN  EFI_HANDLE*ChildHandleBuffer
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+STATIC
+EFI_DRIVER_BINDING_PROTOCOL mMptScsiDriverBinding = {
+  ,
+  ,
+  ,
+  MPT_SCSI_BINDING_VERSION,
+  NULL, // ImageHandle, filled by EfiLibInstallDriverBindingComponentName2
+  NULL, // DriverBindingHandle, filled as well
+};
+
 //
 // Entry Point
 //
@@ -22,5 +80,12 @@ MptScsiEntryPoint (
   IN EFI_SYSTEM_TABLE *SystemTable
   )
 {
-  return EFI_UNSUPPORTED;
+  return EfiLibInstallDriverBindingComponentName2 (
+   ImageHandle,
+   SystemTable,
+   ,
+   ImageHandle, // The handle to install onto
+   NULL, // TODO Component name
+   NULL // TODO Component name
+   );
 }
diff --git a/OvmfPkg/MptScsiDxe/MptScsiDxe.inf 
b/OvmfPkg/MptScsiDxe/MptScsiDxe.inf
index b4006a7c2d97..53585068684f 100644
--- a/OvmfPkg/MptScsiDxe/MptScsiDxe.inf
+++ b/OvmfPkg/MptScsiDxe/MptScsiDxe.inf
@@ -24,3 +24,4 @@ [Packages]
 
 [LibraryClasses]
   UefiDriverEntryPoint
+  UefiLib
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58080): https://edk2.groups.io/g/devel/message/58080
Mute This Topic: https://groups.io/mt/73247261/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 12/12] OvmfPkg/MptScsiDxe: Reset device on ExitBootServices()

2020-04-24 Thread Nikita Leshenko
This causes the device to forget about the reply frame. We allocated the
reply frame in EfiBootServicesData type memory, and code executing after
ExitBootServices() is permitted to overwrite it.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
Signed-off-by: Nikita Leshenko 
Reviewed-by: Laszlo Ersek 
---
 OvmfPkg/MptScsiDxe/MptScsi.c | 33 -
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
index 9cb5088bfbf9..d8649cf45541 100644
--- a/OvmfPkg/MptScsiDxe/MptScsi.c
+++ b/OvmfPkg/MptScsiDxe/MptScsi.c
@@ -57,6 +57,7 @@ typedef struct {
   UINT32  StallPerPollUsec;
   EFI_PCI_IO_PROTOCOL *PciIo;
   UINT64  OriginalPciAttributes;
+  EFI_EVENT   ExitBoot;
   MPT_SCSI_DMA_BUFFER *Dma;
   EFI_PHYSICAL_ADDRESSDmaPhysical;
   VOID*DmaMapping;
@@ -750,6 +751,20 @@ MptScsiResetChannel (
   return EFI_UNSUPPORTED;
 }
 
+STATIC
+VOID
+EFIAPI
+MptScsiExitBoot (
+  IN  EFI_EVENT Event,
+  IN  VOID  *Context
+  )
+{
+  MPT_SCSI_DEV *Dev;
+
+  Dev = Context;
+  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context));
+  MptScsiReset (Dev);
+}
 STATIC
 EFI_STATUS
 EFIAPI
@@ -943,6 +958,17 @@ MptScsiControllerStart (
 goto Unmap;
   }
 
+  Status = gBS->CreateEvent (
+  EVT_SIGNAL_EXIT_BOOT_SERVICES,
+  TPL_CALLBACK,
+  ,
+  Dev,
+  >ExitBoot
+  );
+  if (EFI_ERROR (Status)) {
+goto UninitDev;
+  }
+
   //
   // Host adapter channel, doesn't exist
   //
@@ -967,11 +993,14 @@ MptScsiControllerStart (
   >PassThru
   );
   if (EFI_ERROR (Status)) {
-goto UninitDev;
+goto CloseExitBoot;
   }
 
   return EFI_SUCCESS;
 
+CloseExitBoot:
+  gBS->CloseEvent (Dev->ExitBoot);
+
 UninitDev:
   MptScsiReset (Dev);
 
@@ -1047,6 +1076,8 @@ MptScsiControllerStop (
 return Status;
   }
 
+  gBS->CloseEvent (Dev->ExitBoot);
+
   MptScsiReset (Dev);
 
   Dev->PciIo->Unmap (
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58087): https://edk2.groups.io/g/devel/message/58087
Mute This Topic: https://groups.io/mt/73247274/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 00/12] OvmfPkg: Support booting from Fusion-MPT SCSI controllers

2020-04-24 Thread Nikita Leshenko
This series adds driver support for:
- LSI53C1030
- SAS1068
- SAS1068E

These controllers are widely supported by QEMU, VirtualBox and VMWare.
This work is part of the more general agenda of enhancing OVMF boot
device support to have feature parity with SeaBIOS.

I pushed a copy of these patches to
https://github.com/nikital/edk2/tree/mptscsi_v5
Previous versions:
https://github.com/nikital/edk2/tree/mptscsi_v4
https://github.com/nikital/edk2/tree/mptscsi_v3
https://github.com/nikital/edk2/tree/mptscsi (v2)

v4->v5:
- Sort maintainers and protocols
- Fix bug when restoring PCI attributes (Use Set instead of Enable)
- Separate packed structs and aligned unions
- STATIC_ASSERT for init request size
- Add support for multiple targets from the beginning
- Use PCI_BAR_IDX0 in door bell
- Code convention improvements
- Add DEBUG_VERBOSE message seen in PvScsiExitBoot
- Return EFI_INVALID_PARAMETER in GetNextTarget
- STATIC_ASSERT for MaxTarget
- Move PCD near PvScsi
- A lot of fixes for PassThru (comments, error handling, casting)
- Support 64-bit DMA

v3->v4:
- Add ExitBootServices
- Rework error handling in PassThru
- SPDX license
- Made compilation conditional
- Squash GetTargetLun and BuildDevicePath commits
- Added #include 
- Use PCI_BAR_IDX0
- Code convention improvements

v2->v3:
- Change error handling style
- Add comments about target size and zero unused target bytes
- Remove internal Reviewed-by
- Fix problems reported by PatchCheck.py
- Use SetupGit.py

v1->v2:
- Map() DMAed buffers
- Fixed various code convention issues
- Newer debug macros
- Updated INF version

Thanks,
Nikita

Nikita Leshenko (12):
  OvmfPkg/MptScsiDxe: Create empty driver
  OvmfPkg/MptScsiDxe: Install DriverBinding Protocol
  OvmfPkg/MptScsiDxe: Report name of driver
  OvmfPkg/MptScsiDxe: Probe PCI devices and look for MptScsi
  OvmfPkg/MptScsiDxe: Install stubbed EXT_SCSI_PASS_THRU
  OvmfPkg/MptScsiDxe: Report targets and one LUN
  OvmfPkg/MptScsiDxe: Build and decode DevicePath
  OvmfPkg/MptScsiDxe: Open PciIo protocol for later use
  OvmfPkg/MptScsiDxe: Set and restore PCI attributes
  OvmfPkg/MptScsiDxe: Initialize hardware
  OvmfPkg/MptScsiDxe: Implement the PassThru method
  OvmfPkg/MptScsiDxe: Reset device on ExitBootServices()

 Maintainers.txt   |3 +-
 .../Include/IndustryStandard/FusionMptScsi.h  |  160 +++
 OvmfPkg/MptScsiDxe/MptScsi.c  | 1199 +
 OvmfPkg/MptScsiDxe/MptScsiDxe.inf |   42 +
 OvmfPkg/OvmfPkg.dec   |7 +
 OvmfPkg/OvmfPkgIa32.dsc   |4 +
 OvmfPkg/OvmfPkgIa32.fdf   |3 +
 OvmfPkg/OvmfPkgIa32X64.dsc|4 +
 OvmfPkg/OvmfPkgIa32X64.fdf|3 +
 OvmfPkg/OvmfPkgX64.dsc|4 +
 OvmfPkg/OvmfPkgX64.fdf|3 +
 11 files changed, 1431 insertions(+), 1 deletion(-)
 create mode 100644 OvmfPkg/Include/IndustryStandard/FusionMptScsi.h
 create mode 100644 OvmfPkg/MptScsiDxe/MptScsi.c
 create mode 100644 OvmfPkg/MptScsiDxe/MptScsiDxe.inf

-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58089): https://edk2.groups.io/g/devel/message/58089
Mute This Topic: https://groups.io/mt/73247322/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 06/12] OvmfPkg/MptScsiDxe: Report targets and one LUN

2020-04-24 Thread Nikita Leshenko
The controller supports up to 8 targets in practice (Not reported by the
controller, but based on the implementation of the virtual device),
report them in GetNextTarget and GetNextTargetLun. The firmware will
then try to communicate with them and create a block device for each one
that responds.

Support for multiple LUNs will be implemented in another series.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
Signed-off-by: Nikita Leshenko 
---
 OvmfPkg/MptScsiDxe/MptScsi.c  | 62 ++-
 OvmfPkg/MptScsiDxe/MptScsiDxe.inf |  4 ++
 OvmfPkg/OvmfPkg.dec   |  4 ++
 3 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
index 40d392c2346f..5e0544c8d9d2 100644
--- a/OvmfPkg/MptScsiDxe/MptScsi.c
+++ b/OvmfPkg/MptScsiDxe/MptScsi.c
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -34,6 +35,7 @@ typedef struct {
   UINT32  Signature;
   EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru;
   EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode;
+  UINT8   MaxTarget;
 } MPT_SCSI_DEV;
 
 #define MPT_SCSI_FROM_PASS_THRU(PassThruPtr) \
@@ -57,6 +59,22 @@ MptScsiPassThru (
   return EFI_UNSUPPORTED;
 }
 
+STATIC
+BOOLEAN
+IsTargetInitialized (
+  IN UINT8  *Target
+  )
+{
+  UINTN Idx;
+
+  for (Idx = 0; Idx < TARGET_MAX_BYTES; ++Idx) {
+if (Target[Idx] != 0xFF) {
+  return TRUE;
+}
+  }
+  return FALSE;
+}
+
 STATIC
 EFI_STATUS
 EFIAPI
@@ -66,7 +84,28 @@ MptScsiGetNextTargetLun (
   IN OUT UINT64 *Lun
   )
 {
-  return EFI_UNSUPPORTED;
+  MPT_SCSI_DEV *Dev;
+
+  Dev = MPT_SCSI_FROM_PASS_THRU (This);
+  //
+  // Currently support only LUN 0, so hardcode it
+  //
+  if (!IsTargetInitialized (*Target)) {
+ZeroMem (*Target, TARGET_MAX_BYTES);
+*Lun = 0;
+  } else if (**Target > Dev->MaxTarget || *Lun > 0) {
+return EFI_INVALID_PARAMETER;
+  } else if (**Target < Dev->MaxTarget) {
+//
+// This device interface support 256 targets only, so it's enough to
+// increment the LSB of Target, as it will never overflow.
+//
+**Target += 1;
+  } else {
+return EFI_NOT_FOUND;
+  }
+
+  return EFI_SUCCESS;
 }
 
 STATIC
@@ -77,7 +116,24 @@ MptScsiGetNextTarget (
   IN OUT UINT8 **Target
   )
 {
-  return EFI_UNSUPPORTED;
+  MPT_SCSI_DEV *Dev;
+
+  Dev = MPT_SCSI_FROM_PASS_THRU (This);
+  if (!IsTargetInitialized (*Target)) {
+ZeroMem (*Target, TARGET_MAX_BYTES);
+  } else if (**Target > Dev->MaxTarget) {
+return EFI_INVALID_PARAMETER;
+  } else if (**Target < Dev->MaxTarget) {
+//
+// This device interface support 256 targets only, so it's enough to
+// increment the LSB of Target, as it will never overflow.
+//
+**Target += 1;
+  } else {
+return EFI_NOT_FOUND;
+  }
+
+  return EFI_SUCCESS;
 }
 
 STATIC
@@ -206,6 +262,8 @@ MptScsiControllerStart (
 
   Dev->Signature = MPT_SCSI_DEV_SIGNATURE;
 
+  Dev->MaxTarget = PcdGet8 (PcdMptScsiMaxTargetLimit);
+
   //
   // Host adapter channel, doesn't exist
   //
diff --git a/OvmfPkg/MptScsiDxe/MptScsiDxe.inf 
b/OvmfPkg/MptScsiDxe/MptScsiDxe.inf
index 9f7c98829ee1..4862ff9dd497 100644
--- a/OvmfPkg/MptScsiDxe/MptScsiDxe.inf
+++ b/OvmfPkg/MptScsiDxe/MptScsiDxe.inf
@@ -24,6 +24,7 @@ [Packages]
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
+  BaseMemoryLib
   DebugLib
   MemoryAllocationLib
   UefiBootServicesTableLib
@@ -33,3 +34,6 @@ [LibraryClasses]
 [Protocols]
   gEfiExtScsiPassThruProtocolGuid## BY_START
   gEfiPciIoProtocolGuid  ## TO_START
+
+[FixedPcd]
+  gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiMaxTargetLimit   ## CONSUMES
diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 28030391cff2..2d09444bbb16 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -163,6 +163,10 @@ [PcdsFixedAtBuild]
   #  polling loop iteration.
   gUefiOvmfPkgTokenSpaceGuid.PcdPvScsiWaitForCmpStallInUsecs|5|UINT32|0x38
 
+  ## Set the *inclusive* number of targets that MptScsi exposes for scan
+  #  by ScsiBusDxe.
+  gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiMaxTargetLimit|7|UINT8|0x39
+
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase|0x0|UINT32|0x8
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize|0x0|UINT32|0x9
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize|0x0|UINT32|0xa
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58090): https://edk2.groups.io/g/devel/message/58090
Mute This Topic: https://groups.io/mt/73247325/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 11/12] OvmfPkg/MptScsiDxe: Implement the PassThru method

2020-04-24 Thread Nikita Leshenko
Machines should be able to boot after this commit. Tested with different
Linux distributions (Ubuntu, CentOS) and different Windows
versions (Windows 7, Windows 10, Server 2016).

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
Signed-off-by: Nikita Leshenko 
---
 .../Include/IndustryStandard/FusionMptScsi.h  |   9 +
 OvmfPkg/MptScsiDxe/MptScsi.c  | 409 +-
 OvmfPkg/MptScsiDxe/MptScsiDxe.inf |   3 +
 OvmfPkg/OvmfPkg.dec   |   3 +
 4 files changed, 422 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/Include/IndustryStandard/FusionMptScsi.h 
b/OvmfPkg/Include/IndustryStandard/FusionMptScsi.h
index 655d629d902e..99778d1537da 100644
--- a/OvmfPkg/Include/IndustryStandard/FusionMptScsi.h
+++ b/OvmfPkg/Include/IndustryStandard/FusionMptScsi.h
@@ -44,6 +44,15 @@
 
 #define MPT_IOC_WHOINIT_ROM_BIOS 0x02
 
+#define MPT_SCSIIO_REQUEST_CONTROL_TXDIR_NONE  (0x00 << 24)
+#define MPT_SCSIIO_REQUEST_CONTROL_TXDIR_WRITE (0x01 << 24)
+#define MPT_SCSIIO_REQUEST_CONTROL_TXDIR_READ  (0x02 << 24)
+
+#define MPT_SCSI_IOCSTATUS_SUCCESS  0x
+#define MPT_SCSI_IOCSTATUS_DEVICE_NOT_THERE 0x0043
+#define MPT_SCSI_IOCSTATUS_DATA_OVERRUN 0x0044
+#define MPT_SCSI_IOCSTATUS_DATA_UNDERRUN0x0045
+
 //
 // Device structures
 //
diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
index 15d671b544c2..9cb5088bfbf9 100644
--- a/OvmfPkg/MptScsiDxe/MptScsi.c
+++ b/OvmfPkg/MptScsiDxe/MptScsi.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -30,19 +31,50 @@
 // Runtime Structures
 //
 
+typedef struct {
+  MPT_SCSI_REQUEST_ALIGNEDIoRequest;
+  MPT_SCSI_IO_REPLY_ALIGNED   IoReply;
+  //
+  // As EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET.SenseDataLength is defined
+  // as UINT8, defining here SenseData size to MAX_UINT8 will guarantee it
+  // cannot overflow when passed to device.
+  //
+  UINT8   Sense[MAX_UINT8];
+  //
+  // This size of the data is arbitrarily chosen.
+  // It seems to be sufficient for all I/O requests sent through
+  // EFI_SCSI_PASS_THRU_PROTOCOL.PassThru() for common boot scenarios.
+  //
+  UINT8   Data[0x2000];
+} MPT_SCSI_DMA_BUFFER;
+
 #define MPT_SCSI_DEV_SIGNATURE SIGNATURE_32 ('M','P','T','S')
 typedef struct {
   UINT32  Signature;
   EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru;
   EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode;
   UINT8   MaxTarget;
+  UINT32  StallPerPollUsec;
   EFI_PCI_IO_PROTOCOL *PciIo;
   UINT64  OriginalPciAttributes;
+  MPT_SCSI_DMA_BUFFER *Dma;
+  EFI_PHYSICAL_ADDRESSDmaPhysical;
+  VOID*DmaMapping;
+  BOOLEAN IoReplyEnqueued;
 } MPT_SCSI_DEV;
 
 #define MPT_SCSI_FROM_PASS_THRU(PassThruPtr) \
   CR (PassThruPtr, MPT_SCSI_DEV, PassThru, MPT_SCSI_DEV_SIGNATURE)
 
+#define MPT_SCSI_DMA_ADDR(Dev, MemberName) \
+  (Dev->DmaPhysical + OFFSET_OF (MPT_SCSI_DMA_BUFFER, MemberName))
+
+#define MPT_SCSI_DMA_ADDR_HIGH(Dev, MemberName) \
+  ((UINT32)(MPT_SCSI_DMA_ADDR (Dev, MemberName) >> 32))
+
+#define MPT_SCSI_DMA_ADDR_LOW(Dev, MemberName) \
+  ((UINT32)MPT_SCSI_DMA_ADDR (Dev, MemberName))
+
 //
 // Hardware functions
 //
@@ -157,6 +189,9 @@ MptScsiInit (
 "Req supports 255 targets only (max target is 254)");
   Req.MaxDevices = Dev->MaxTarget + 1;
   Req.MaxBuses = 1;
+  Req.ReplyFrameSize = sizeof Dev->Dma->IoReply.Data;
+  Req.HostMfaHighAddr = MPT_SCSI_DMA_ADDR_HIGH (Dev, IoRequest);
+  Req.SenseBufferHighAddr = MPT_SCSI_DMA_ADDR_HIGH (Dev, Sense);
 
   //
   // Send controller init through doorbell
@@ -218,6 +253,289 @@ MptScsiInit (
   return EFI_SUCCESS;
 }
 
+STATIC
+EFI_STATUS
+ReportHostAdapterError (
+  OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
+  )
+{
+  DEBUG ((DEBUG_ERROR, "%a: fatal error in scsi request\n", __FUNCTION__));
+  Packet->InTransferLength  = 0;
+  Packet->OutTransferLength = 0;
+  Packet->SenseDataLength   = 0;
+  Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER;
+  Packet->TargetStatus  = EFI_EXT_SCSI_STATUS_TARGET_TASK_ABORTED;
+  return EFI_DEVICE_ERROR;
+}
+
+STATIC
+EFI_STATUS
+ReportHostAdapterOverrunError (
+  OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
+  )
+{
+  Packet->SenseDataLength = 0;
+  Packet->HostAdapterStatus =
+EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN;
+  Packet->TargetStatus = EFI_EXT_SCSI_STATUS_TARGET_GOOD;
+  return EFI_BAD_BUFFER_SIZE;
+}
+
+STATIC
+EFI_STATUS
+MptScsiPopulateRequest (
+  IN MPT_SCSI_DEV   *Dev,
+  IN UINT8  Target,
+  IN UINT64 Lun,
+  IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
+  )
+{
+  MPT_SCSI_REQUEST_WITH_SG *Request;
+
+  

[edk2-devel] [PATCH v5 01/12] OvmfPkg/MptScsiDxe: Create empty driver

2020-04-24 Thread Nikita Leshenko
In preparation for implementing LSI Fusion MPT SCSI devices, create a
basic scaffolding for a driver.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
Signed-off-by: Nikita Leshenko 
Reviewed-by: Liran Alon 
Reviewed-by: Laszlo Ersek 
---
 Maintainers.txt   |  3 ++-
 OvmfPkg/MptScsiDxe/MptScsi.c  | 26 ++
 OvmfPkg/MptScsiDxe/MptScsiDxe.inf | 26 ++
 OvmfPkg/OvmfPkgIa32.dsc   |  4 
 OvmfPkg/OvmfPkgIa32.fdf   |  3 +++
 OvmfPkg/OvmfPkgIa32X64.dsc|  4 
 OvmfPkg/OvmfPkgIa32X64.fdf|  3 +++
 OvmfPkg/OvmfPkgX64.dsc|  4 
 OvmfPkg/OvmfPkgX64.fdf|  3 +++
 9 files changed, 75 insertions(+), 1 deletion(-)
 create mode 100644 OvmfPkg/MptScsiDxe/MptScsi.c
 create mode 100644 OvmfPkg/MptScsiDxe/MptScsiDxe.inf

diff --git a/Maintainers.txt b/Maintainers.txt
index 1733225722b6..896ac5821fc6 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -435,7 +435,8 @@ OvmfPkg: CSM modules
 F: OvmfPkg/Csm/
 R: David Woodhouse 
 
-OvmfPkg: PVSCSI driver
+OvmfPkg: MptScsi and PVSCSI driver
+F: OvmfPkg/MptScsiDxe/
 F: OvmfPkg/PvScsiDxe/
 R: Liran Alon 
 R: Nikita Leshenko 
diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
new file mode 100644
index ..c6c8142dfde6
--- /dev/null
+++ b/OvmfPkg/MptScsiDxe/MptScsi.c
@@ -0,0 +1,26 @@
+/** @file
+
+  This driver produces Extended SCSI Pass Thru Protocol instances for
+  LSI Fusion MPT SCSI devices.
+
+  Copyright (C) 2020, Oracle and/or its affiliates.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+
+//
+// Entry Point
+//
+
+EFI_STATUS
+EFIAPI
+MptScsiEntryPoint (
+  IN EFI_HANDLE   ImageHandle,
+  IN EFI_SYSTEM_TABLE *SystemTable
+  )
+{
+  return EFI_UNSUPPORTED;
+}
diff --git a/OvmfPkg/MptScsiDxe/MptScsiDxe.inf 
b/OvmfPkg/MptScsiDxe/MptScsiDxe.inf
new file mode 100644
index ..b4006a7c2d97
--- /dev/null
+++ b/OvmfPkg/MptScsiDxe/MptScsiDxe.inf
@@ -0,0 +1,26 @@
+## @file
+# This driver produces Extended SCSI Pass Thru Protocol instances for
+# LSI Fusion MPT SCSI devices.
+#
+# Copyright (C) 2020, Oracle and/or its affiliates.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 1.29
+  BASE_NAME  = MptScsiDxe
+  FILE_GUID  = 2B3DB5DD-B315-4961-8454-0AFF3C811B19
+  MODULE_TYPE= UEFI_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= MptScsiEntryPoint
+
+[Sources]
+  MptScsi.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  UefiDriverEntryPoint
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index cbc5f0e583bc..158a5e9f39bd 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -49,6 +49,7 @@ [Defines]
   # Device drivers
   #
   DEFINE PVSCSI_ENABLE   = TRUE
+  DEFINE MPT_SCSI_ENABLE = TRUE
 
   #
   # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
@@ -744,6 +745,9 @@ [Components]
   OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
 !if $(PVSCSI_ENABLE) == TRUE
   OvmfPkg/PvScsiDxe/PvScsiDxe.inf
+!endif
+!if $(MPT_SCSI_ENABLE) == TRUE
+  OvmfPkg/MptScsiDxe/MptScsiDxe.inf
 !endif
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
   
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 8e43f4264ecc..fd81b6fa8bed 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -233,6 +233,9 @@ [FV.DXEFV]
 !if $(PVSCSI_ENABLE) == TRUE
 INF  OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
+!if $(MPT_SCSI_ENABLE) == TRUE
+INF  OvmfPkg/MptScsiDxe/MptScsiDxe.inf
+!endif
 
 !if $(SECURE_BOOT_ENABLE) == TRUE
   INF  
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 6d69cc6cb56f..a6c5a1d9d050 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -48,6 +48,7 @@ [Defines]
   # Device drivers
   #
   DEFINE PVSCSI_ENABLE   = TRUE
+  DEFINE MPT_SCSI_ENABLE = TRUE
 
   #
   # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
@@ -756,6 +757,9 @@ [Components.X64]
   OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
 !if $(PVSCSI_ENABLE) == TRUE
   OvmfPkg/PvScsiDxe/PvScsiDxe.inf
+!endif
+!if $(MPT_SCSI_ENABLE) == TRUE
+  OvmfPkg/MptScsiDxe/MptScsiDxe.inf
 !endif
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
   
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index 25af9fbed48a..f71134a65931 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -234,6 +234,9 @@ [FV.DXEFV]
 !if $(PVSCSI_ENABLE) == TRUE
 INF  OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
+!if $(MPT_SCSI_ENABLE) == TRUE
+INF  

[edk2-devel] [PATCH v5 10/12] OvmfPkg/MptScsiDxe: Initialize hardware

2020-04-24 Thread Nikita Leshenko
Reset and send the IO controller initialization request. The reply is
read back to complete the doorbell function but it isn't useful to us
because it doesn't contain relevant data or status codes.

See "LSI53C1030 PCI-X to Dual Channel Ultra320 SCSI Multifunction
Controller" technical manual for more information.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
Signed-off-by: Nikita Leshenko 
---
 .../Include/IndustryStandard/FusionMptScsi.h  | 128 
 OvmfPkg/MptScsiDxe/MptScsi.c  | 187 +-
 2 files changed, 314 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/Include/IndustryStandard/FusionMptScsi.h 
b/OvmfPkg/Include/IndustryStandard/FusionMptScsi.h
index df9bdc2f0348..655d629d902e 100644
--- a/OvmfPkg/Include/IndustryStandard/FusionMptScsi.h
+++ b/OvmfPkg/Include/IndustryStandard/FusionMptScsi.h
@@ -20,4 +20,132 @@
 #define LSI_SAS1068_PCI_DEVICE_ID 0x0054
 #define LSI_SAS1068E_PCI_DEVICE_ID 0x0058
 
+#define MPT_REG_DOORBELL  0x00
+#define MPT_REG_WRITE_SEQ 0x04
+#define MPT_REG_HOST_DIAG 0x08
+#define MPT_REG_TEST  0x0c
+#define MPT_REG_DIAG_DATA 0x10
+#define MPT_REG_DIAG_ADDR 0x14
+#define MPT_REG_ISTATUS   0x30
+#define MPT_REG_IMASK 0x34
+#define MPT_REG_REQ_Q 0x40
+#define MPT_REG_REP_Q 0x44
+
+#define MPT_DOORBELL_RESET 0x40
+#define MPT_DOORBELL_HANDSHAKE 0x42
+
+#define MPT_IMASK_DOORBELL 0x01
+#define MPT_IMASK_REPLY0x08
+
+#define MPT_MESSAGE_HDR_FUNCTION_SCSI_IO_REQUEST 0x00
+#define MPT_MESSAGE_HDR_FUNCTION_IOC_INIT0x02
+
+#define MPT_SG_ENTRY_TYPE_SIMPLE 0x01
+
+#define MPT_IOC_WHOINIT_ROM_BIOS 0x02
+
+//
+// Device structures
+//
+
+#pragma pack (1)
+typedef struct {
+  UINT8 WhoInit;
+  UINT8 Reserved1;
+  UINT8 ChainOffset;
+  UINT8 Function;
+  UINT8 Flags;
+  UINT8 MaxDevices;
+  UINT8 MaxBuses;
+  UINT8 MessageFlags;
+  UINT32MessageContext;
+  UINT16ReplyFrameSize;
+  UINT16Reserved2;
+  UINT32HostMfaHighAddr;
+  UINT32SenseBufferHighAddr;
+} MPT_IO_CONTROLLER_INIT_REQUEST;
+
+typedef struct {
+  UINT8 WhoInit;
+  UINT8 Reserved1;
+  UINT8 MessageLength;
+  UINT8 Function;
+  UINT8 Flags;
+  UINT8 MaxDevices;
+  UINT8 MaxBuses;
+  UINT8 MessageFlags;
+  UINT32MessageContext;
+  UINT16Reserved2;
+  UINT16IocStatus;
+  UINT32IocLogInfo;
+} MPT_IO_CONTROLLER_INIT_REPLY;
+
+typedef struct {
+  UINT8 TargetId;
+  UINT8 Bus;
+  UINT8 ChainOffset;
+  UINT8 Function;
+  UINT8 CdbLength;
+  UINT8 SenseBufferLength;
+  UINT8 Reserved;
+  UINT8 MessageFlags;
+  UINT32MessageContext;
+  UINT8 Lun[8];
+  UINT32Control;
+  UINT8 Cdb[16];
+  UINT32DataLength;
+  UINT32SenseBufferLowAddress;
+} MPT_SCSI_IO_REQUEST;
+
+typedef struct {
+  UINT32Length: 24;
+  UINT32EndOfList:  1;
+  UINT32Is64BitAddress: 1;
+  //
+  // True when the buffer contains data to be transfered. Otherwise it's the
+  // destination buffer
+  //
+  UINT32BufferContainsData: 1;
+  UINT32LocalAddress:   1;
+  UINT32ElementType:2;
+  UINT32EndOfBuffer:1;
+  UINT32LastElement:1;
+  UINT64DataBufferAddress;
+} MPT_SG_ENTRY_SIMPLE;
+
+typedef struct {
+  UINT8 TargetId;
+  UINT8 Bus;
+  UINT8 MessageLength;
+  UINT8 Function;
+  UINT8 CdbLength;
+  UINT8 SenseBufferLength;
+  UINT8 Reserved;
+  UINT8 MessageFlags;
+  UINT32MessageContext;
+  UINT8 ScsiStatus;
+  UINT8 ScsiState;
+  UINT16IocStatus;
+  UINT32IocLogInfo;
+  UINT32TransferCount;
+  UINT32SenseCount;
+  UINT32ResponseInfo;
+} MPT_SCSI_IO_REPLY;
+
+typedef struct {
+  MPT_SCSI_IO_REQUEST Header;
+  MPT_SG_ENTRY_SIMPLE Sg;
+} MPT_SCSI_REQUEST_WITH_SG;
+#pragma pack ()
+
+typedef union {
+  MPT_SCSI_IO_REPLYData;
+  UINT64   Uint64; // 8 byte alignment required by HW
+} MPT_SCSI_IO_REPLY_ALIGNED;
+
+typedef union {
+  MPT_SCSI_REQUEST_WITH_SG Data;
+  UINT64   Uint64; // 8 byte alignment required by HW
+} MPT_SCSI_REQUEST_ALIGNED;
+
 #endif // __FUSION_MPT_SCSI_H__
diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
index e88ac2867a75..15d671b544c2 100644
--- a/OvmfPkg/MptScsiDxe/MptScsi.c
+++ b/OvmfPkg/MptScsiDxe/MptScsi.c
@@ -43,6 +43,181 @@ typedef struct {
 #define MPT_SCSI_FROM_PASS_THRU(PassThruPtr) \
   CR (PassThruPtr, MPT_SCSI_DEV, PassThru, MPT_SCSI_DEV_SIGNATURE)
 
+//
+// Hardware functions
+//
+
+STATIC
+EFI_STATUS
+Out32 (
+  IN MPT_SCSI_DEV   *Dev,
+  IN UINT32 Addr,
+  IN UINT32 Data
+  )
+{
+  return Dev->PciIo->Io.Write (
+  Dev->PciIo,
+  EfiPciIoWidthUint32,
+  PCI_BAR_IDX0,
+  Addr,
+  1,
+  
+  );
+}
+

[edk2-devel] [PATCH v5 09/12] OvmfPkg/MptScsiDxe: Set and restore PCI attributes

2020-04-24 Thread Nikita Leshenko
Enable the IO Space and Bus Mastering and restore the original values
when the device is stopped. This is a standard procedure in PCI
drivers.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
Signed-off-by: Nikita Leshenko 
Reviewed-by: Liran Alon 
Reviewed-by: Laszlo Ersek 
---
 OvmfPkg/MptScsiDxe/MptScsi.c | 65 +++-
 1 file changed, 64 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
index ed7fabf8b471..e88ac2867a75 100644
--- a/OvmfPkg/MptScsiDxe/MptScsi.c
+++ b/OvmfPkg/MptScsiDxe/MptScsi.c
@@ -37,6 +37,7 @@ typedef struct {
   EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode;
   UINT8   MaxTarget;
   EFI_PCI_IO_PROTOCOL *PciIo;
+  UINT64  OriginalPciAttributes;
 } MPT_SCSI_DEV;
 
 #define MPT_SCSI_FROM_PASS_THRU(PassThruPtr) \
@@ -334,6 +335,53 @@ MptScsiControllerStart (
 goto FreePool;
   }
 
+  Status = Dev->PciIo->Attributes (
+ Dev->PciIo,
+ EfiPciIoAttributeOperationGet,
+ 0,
+ >OriginalPciAttributes
+ );
+  if (EFI_ERROR (Status)) {
+goto CloseProtocol;
+  }
+
+  //
+  // Enable I/O Space & Bus-Mastering
+  //
+  Status = Dev->PciIo->Attributes (
+ Dev->PciIo,
+ EfiPciIoAttributeOperationEnable,
+ (EFI_PCI_IO_ATTRIBUTE_IO |
+  EFI_PCI_IO_ATTRIBUTE_BUS_MASTER),
+ NULL
+ );
+  if (EFI_ERROR (Status)) {
+goto CloseProtocol;
+  }
+
+  //
+  // Signal device supports 64-bit DMA addresses
+  //
+  Status = Dev->PciIo->Attributes (
+ Dev->PciIo,
+ EfiPciIoAttributeOperationEnable,
+ EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE,
+ NULL
+ );
+  if (EFI_ERROR (Status)) {
+//
+// Warn user that device will only be using 32-bit DMA addresses.
+//
+// Note that this does not prevent the device/driver from working
+// and therefore we only warn and continue as usual.
+//
+DEBUG ((
+  DEBUG_WARN,
+  "%a: failed to enable 64-bit DMA addresses\n",
+  __FUNCTION__
+  ));
+  }
+
   //
   // Host adapter channel, doesn't exist
   //
@@ -358,11 +406,19 @@ MptScsiControllerStart (
   >PassThru
   );
   if (EFI_ERROR (Status)) {
-goto CloseProtocol;
+goto RestoreAttributes;
   }
 
   return EFI_SUCCESS;
 
+RestoreAttributes:
+  Dev->PciIo->Attributes (
+Dev->PciIo,
+EfiPciIoAttributeOperationSet,
+Dev->OriginalPciAttributes,
+NULL
+);
+
 CloseProtocol:
   gBS->CloseProtocol (
  ControllerHandle,
@@ -414,6 +470,13 @@ MptScsiControllerStop (
 return Status;
   }
 
+  Dev->PciIo->Attributes (
+Dev->PciIo,
+EfiPciIoAttributeOperationSet,
+Dev->OriginalPciAttributes,
+NULL
+);
+
   gBS->CloseProtocol (
  ControllerHandle,
  ,
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58085): https://edk2.groups.io/g/devel/message/58085
Mute This Topic: https://groups.io/mt/73247269/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 04/12] OvmfPkg/MptScsiDxe: Probe PCI devices and look for MptScsi

2020-04-24 Thread Nikita Leshenko
The MptScsiControllerSupported function is called on handles passed in
by the ConnectController() boot service and if the handle is the
lsi53c1030 controller the function would return success. A successful
return value will attach our driver to the device.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
Signed-off-by: Nikita Leshenko 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Liran Alon 
---
 .../Include/IndustryStandard/FusionMptScsi.h  | 23 +
 OvmfPkg/MptScsiDxe/MptScsi.c  | 49 ++-
 OvmfPkg/MptScsiDxe/MptScsiDxe.inf |  5 ++
 3 files changed, 76 insertions(+), 1 deletion(-)
 create mode 100644 OvmfPkg/Include/IndustryStandard/FusionMptScsi.h

diff --git a/OvmfPkg/Include/IndustryStandard/FusionMptScsi.h 
b/OvmfPkg/Include/IndustryStandard/FusionMptScsi.h
new file mode 100644
index ..df9bdc2f0348
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/FusionMptScsi.h
@@ -0,0 +1,23 @@
+/** @file
+
+  Macros and type definitions for LSI Fusion MPT SCSI devices.
+
+  Copyright (C) 2020, Oracle and/or its affiliates.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __FUSION_MPT_SCSI_H__
+#define __FUSION_MPT_SCSI_H__
+
+//
+// Device offsets and constants
+//
+
+#define LSI_LOGIC_PCI_VENDOR_ID 0x1000
+#define LSI_53C1030_PCI_DEVICE_ID 0x0030
+#define LSI_SAS1068_PCI_DEVICE_ID 0x0054
+#define LSI_SAS1068E_PCI_DEVICE_ID 0x0058
+
+#endif // __FUSION_MPT_SCSI_H__
diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
index 64949a809022..4e2f8f2296fb 100644
--- a/OvmfPkg/MptScsiDxe/MptScsi.c
+++ b/OvmfPkg/MptScsiDxe/MptScsi.c
@@ -9,7 +9,11 @@
 
 **/
 
+#include 
+#include 
+#include 
 #include 
+#include 
 #include 
 
 //
@@ -31,7 +35,50 @@ MptScsiControllerSupported (
   IN EFI_DEVICE_PATH_PROTOCOL   *RemainingDevicePath OPTIONAL
   )
 {
-  return EFI_UNSUPPORTED;
+  EFI_STATUS  Status;
+  EFI_PCI_IO_PROTOCOL *PciIo;
+  PCI_TYPE00  Pci;
+
+  Status = gBS->OpenProtocol (
+  ControllerHandle,
+  ,
+  (VOID **),
+  This->DriverBindingHandle,
+  ControllerHandle,
+  EFI_OPEN_PROTOCOL_BY_DRIVER
+  );
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  Status = PciIo->Pci.Read (
+PciIo,
+EfiPciIoWidthUint32,
+0,
+sizeof (Pci) / sizeof (UINT32),
+
+);
+  if (EFI_ERROR (Status)) {
+goto Done;
+  }
+
+  if (Pci.Hdr.VendorId == LSI_LOGIC_PCI_VENDOR_ID &&
+  (Pci.Hdr.DeviceId == LSI_53C1030_PCI_DEVICE_ID ||
+   Pci.Hdr.DeviceId == LSI_SAS1068_PCI_DEVICE_ID ||
+   Pci.Hdr.DeviceId == LSI_SAS1068E_PCI_DEVICE_ID)) {
+Status = EFI_SUCCESS;
+  } else {
+Status = EFI_UNSUPPORTED;
+  }
+
+Done:
+  gBS->CloseProtocol (
+ ControllerHandle,
+ ,
+ This->DriverBindingHandle,
+ ControllerHandle
+ );
+  return Status;
 }
 
 STATIC
diff --git a/OvmfPkg/MptScsiDxe/MptScsiDxe.inf 
b/OvmfPkg/MptScsiDxe/MptScsiDxe.inf
index 53585068684f..414b96e5a248 100644
--- a/OvmfPkg/MptScsiDxe/MptScsiDxe.inf
+++ b/OvmfPkg/MptScsiDxe/MptScsiDxe.inf
@@ -21,7 +21,12 @@ [Sources]
 
 [Packages]
   MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
+  UefiBootServicesTableLib
   UefiDriverEntryPoint
   UefiLib
+
+[Protocols]
+  gEfiPciIoProtocolGuid## TO_START
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58082): https://edk2.groups.io/g/devel/message/58082
Mute This Topic: https://groups.io/mt/73247264/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 03/12] OvmfPkg/MptScsiDxe: Report name of driver

2020-04-24 Thread Nikita Leshenko
Install Component Name protocols to have a nice display name for the
driver in places such as UEFI shell.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
Signed-off-by: Nikita Leshenko 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Jaben Carsey 
Reviewed-by: Liran Alon 
---
 OvmfPkg/MptScsiDxe/MptScsi.c | 61 ++--
 1 file changed, 59 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
index 581d3909b84d..64949a809022 100644
--- a/OvmfPkg/MptScsiDxe/MptScsi.c
+++ b/OvmfPkg/MptScsiDxe/MptScsi.c
@@ -69,6 +69,63 @@ EFI_DRIVER_BINDING_PROTOCOL mMptScsiDriverBinding = {
   NULL, // DriverBindingHandle, filled as well
 };
 
+//
+// Component Name
+//
+
+STATIC
+EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {
+  { "eng;en", L"LSI Fusion MPT SCSI Driver" },
+  { NULL, NULL   }
+};
+
+STATIC
+EFI_COMPONENT_NAME_PROTOCOL mComponentName;
+
+EFI_STATUS
+EFIAPI
+MptScsiGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL *This,
+  IN  CHAR8   *Language,
+  OUT CHAR16  **DriverName
+  )
+{
+  return LookupUnicodeString2 (
+   Language,
+   This->SupportedLanguages,
+   mDriverNameTable,
+   DriverName,
+   (BOOLEAN)(This == ) // Iso639Language
+   );
+}
+
+EFI_STATUS
+EFIAPI
+MptScsiGetDeviceName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL *This,
+  IN  EFI_HANDLE  DeviceHandle,
+  IN  EFI_HANDLE  ChildHandle,
+  IN  CHAR8   *Language,
+  OUT CHAR16  **ControllerName
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+STATIC
+EFI_COMPONENT_NAME_PROTOCOL mComponentName = {
+  ,
+  ,
+  "eng" // SupportedLanguages, ISO 639-2 language codes
+};
+
+STATIC
+EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 = {
+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ,
+  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ,
+  "en" // SupportedLanguages, RFC 4646 language codes
+};
+
 //
 // Entry Point
 //
@@ -85,7 +142,7 @@ MptScsiEntryPoint (
SystemTable,
,
ImageHandle, // The handle to install onto
-   NULL, // TODO Component name
-   NULL // TODO Component name
+   ,
+   
);
 }
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58081): https://edk2.groups.io/g/devel/message/58081
Mute This Topic: https://groups.io/mt/73247263/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 08/12] OvmfPkg/MptScsiDxe: Open PciIo protocol for later use

2020-04-24 Thread Nikita Leshenko
This will give us an exclusive access to the PciIo of this device
after it was started and until is will be stopped.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
Signed-off-by: Nikita Leshenko 
Reviewed-by: Liran Alon 
Reviewed-by: Laszlo Ersek 
---
 OvmfPkg/MptScsiDxe/MptScsi.c | 30 +-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
index dc4b854659f9..ed7fabf8b471 100644
--- a/OvmfPkg/MptScsiDxe/MptScsi.c
+++ b/OvmfPkg/MptScsiDxe/MptScsi.c
@@ -36,6 +36,7 @@ typedef struct {
   EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru;
   EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode;
   UINT8   MaxTarget;
+  EFI_PCI_IO_PROTOCOL *PciIo;
 } MPT_SCSI_DEV;
 
 #define MPT_SCSI_FROM_PASS_THRU(PassThruPtr) \
@@ -321,6 +322,18 @@ MptScsiControllerStart (
 
   Dev->MaxTarget = PcdGet8 (PcdMptScsiMaxTargetLimit);
 
+  Status = gBS->OpenProtocol (
+  ControllerHandle,
+  ,
+  (VOID **)>PciIo,
+  This->DriverBindingHandle,
+  ControllerHandle,
+  EFI_OPEN_PROTOCOL_BY_DRIVER
+  );
+  if (EFI_ERROR (Status)) {
+goto FreePool;
+  }
+
   //
   // Host adapter channel, doesn't exist
   //
@@ -345,11 +358,19 @@ MptScsiControllerStart (
   >PassThru
   );
   if (EFI_ERROR (Status)) {
-goto FreePool;
+goto CloseProtocol;
   }
 
   return EFI_SUCCESS;
 
+CloseProtocol:
+  gBS->CloseProtocol (
+ ControllerHandle,
+ ,
+ This->DriverBindingHandle,
+ ControllerHandle
+ );
+
 FreePool:
   FreePool (Dev);
 
@@ -393,6 +414,13 @@ MptScsiControllerStop (
 return Status;
   }
 
+  gBS->CloseProtocol (
+ ControllerHandle,
+ ,
+ This->DriverBindingHandle,
+ ControllerHandle
+ );
+
   FreePool (Dev);
 
   return Status;
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58084): https://edk2.groups.io/g/devel/message/58084
Mute This Topic: https://groups.io/mt/73247268/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 07/12] OvmfPkg/MptScsiDxe: Build and decode DevicePath

2020-04-24 Thread Nikita Leshenko
Used to identify the individual disks in the hardware tree.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
Signed-off-by: Nikita Leshenko 
Reviewed-by: Liran Alon 
Reviewed-by: Laszlo Ersek 
---
 OvmfPkg/MptScsiDxe/MptScsi.c | 61 ++--
 1 file changed, 59 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
index 5e0544c8d9d2..dc4b854659f9 100644
--- a/OvmfPkg/MptScsiDxe/MptScsi.c
+++ b/OvmfPkg/MptScsiDxe/MptScsi.c
@@ -146,7 +146,36 @@ MptScsiBuildDevicePath (
   IN OUT EFI_DEVICE_PATH_PROTOCOL  **DevicePath
   )
 {
-  return EFI_UNSUPPORTED;
+  MPT_SCSI_DEV *Dev;
+  SCSI_DEVICE_PATH *ScsiDevicePath;
+
+  if (DevicePath == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  //
+  // This device support 256 targets only, so it's enough to dereference
+  // the LSB of Target.
+  //
+  Dev = MPT_SCSI_FROM_PASS_THRU (This);
+  if (*Target > Dev->MaxTarget || Lun > 0) {
+return EFI_NOT_FOUND;
+  }
+
+  ScsiDevicePath = AllocateZeroPool (sizeof (*ScsiDevicePath));
+  if (ScsiDevicePath == NULL) {
+return EFI_OUT_OF_RESOURCES;
+  }
+
+  ScsiDevicePath->Header.Type  = MESSAGING_DEVICE_PATH;
+  ScsiDevicePath->Header.SubType   = MSG_SCSI_DP;
+  ScsiDevicePath->Header.Length[0] = (UINT8)sizeof (*ScsiDevicePath);
+  ScsiDevicePath->Header.Length[1] = (UINT8)(sizeof (*ScsiDevicePath) >> 8);
+  ScsiDevicePath->Pun  = *Target;
+  ScsiDevicePath->Lun  = (UINT16)Lun;
+
+  *DevicePath = >Header;
+  return EFI_SUCCESS;
 }
 
 STATIC
@@ -159,7 +188,35 @@ MptScsiGetTargetLun (
   OUT UINT64   *Lun
   )
 {
-  return EFI_UNSUPPORTED;
+  MPT_SCSI_DEV *Dev;
+  SCSI_DEVICE_PATH *ScsiDevicePath;
+
+  if (DevicePath == NULL ||
+  Target == NULL || *Target == NULL || Lun == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  if (DevicePath->Type!= MESSAGING_DEVICE_PATH ||
+  DevicePath->SubType != MSG_SCSI_DP) {
+return EFI_UNSUPPORTED;
+  }
+
+  Dev = MPT_SCSI_FROM_PASS_THRU (This);
+  ScsiDevicePath = (SCSI_DEVICE_PATH *)DevicePath;
+  if (ScsiDevicePath->Pun > Dev->MaxTarget ||
+  ScsiDevicePath->Lun > 0) {
+return EFI_NOT_FOUND;
+  }
+
+  ZeroMem (*Target, TARGET_MAX_BYTES);
+  //
+  // This device support 256 targets only, so it's enough to set the LSB
+  // of Target.
+  //
+  **Target = (UINT8)ScsiDevicePath->Pun;
+  *Lun = ScsiDevicePath->Lun;
+
+  return EFI_SUCCESS;
 }
 
 STATIC
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58091): https://edk2.groups.io/g/devel/message/58091
Mute This Topic: https://groups.io/mt/73247326/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 3/5] OvmfPkg/PlatformDebugLibIoPort: factor out debug port detection

2020-04-24 Thread Laszlo Ersek
On 04/23/20 11:53, Anthony PERARD wrote:
> Factor out debug port detection in PlatformDebugLibIoPort.
> 
> Signed-off-by: Anthony PERARD 
> ---
>  .../PlatformDebugLibIoPort.inf|  1 +
>  .../PlatformRomDebugLibIoPort.inf |  1 +
>  .../PlatformDebugLibIoPort/DebugLibDetect.h   |  6 
>  .../PlatformDebugLibIoPort/DebugIoPortQemu.c  | 34 +++
>  .../Library/PlatformDebugLibIoPort/DebugLib.c | 16 -
>  5 files changed, 36 insertions(+), 22 deletions(-)
>  create mode 100644 OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortQemu.c
> 
> diff --git 
> a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf 
> b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
> index c09f312ffb1d..94ab9105077a 100644
> --- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
> +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
> @@ -24,6 +24,7 @@ [Defines]
>  #
>  
>  [Sources]
> +  DebugIoPortQemu.c
>DebugLib.c
>DebugLibDetect.c
>DebugLibDetect.h
> diff --git 
> a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf 
> b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
> index ab27f6327a38..8f721d249dd5 100644
> --- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
> +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
> @@ -24,6 +24,7 @@ [Defines]
>  #
>  
>  [Sources]
> +  DebugIoPortQemu.c
>DebugLib.c
>DebugLibDetect.h
>DebugLibDetectRom.c
> diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h 
> b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h
> index 4677c85ac3c4..6d08909dbc58 100644
> --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h
> +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h
> @@ -12,12 +12,6 @@
>  
>  #include 
>  
> -//
> -// The constant value that is read from the debug I/O port
> -//
> -#define BOCHS_DEBUG_PORT_MAGIC0xE9
> -
> -
>  /**
>Helper function to return whether the virtual machine has a debug I/O port.
>PlatformDebugLibIoPortFound can call this function directly or cache the
> diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortQemu.c 
> b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortQemu.c
> new file mode 100644
> index ..bf9119807a6c
> --- /dev/null
> +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortQemu.c
> @@ -0,0 +1,34 @@
> +/** @file
> +  Detection code for QEMU debug port.
> +
> +  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> +  Copyright (c) 2012, Red Hat, Inc.
> +  Copyright (c) 2020, Citrix Systems, Inc.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include 
> +#include 
> +#include "DebugLibDetect.h"
> +
> +//
> +// The constant value that is read from the debug I/O port
> +//
> +#define BOCHS_DEBUG_PORT_MAGIC0xE9
> +
> +/**
> +  Return the result of detecting the debug I/O port device.
> +
> +  @retval TRUE   if the debug I/O port device was detected.
> +  @retval FALSE  otherwise
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +PlatformDebugLibIoPortDetect (
> +  VOID
> +  )
> +{
> +  return IoRead8 (PcdGet16 (PcdDebugIoPort)) == BOCHS_DEBUG_PORT_MAGIC;
> +}
> diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c 
> b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> index ec2e677afd8d..dffb20822d18 100644
> --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> @@ -359,19 +359,3 @@ DebugPrintLevelEnabled (
>  {
>return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 
> 0);
>  }
> -
> -/**
> -  Return the result of detecting the debug I/O port device.
> -
> -  @retval TRUE   if the debug I/O port device was detected.
> -  @retval FALSE  otherwise
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -PlatformDebugLibIoPortDetect (
> -  VOID
> -  )
> -{
> -  return IoRead8 (PcdGet16 (PcdDebugIoPort)) == BOCHS_DEBUG_PORT_MAGIC;
> -}
> 

Reviewed-by: Laszlo Ersek 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58078): https://edk2.groups.io/g/devel/message/58078
Mute This Topic: https://groups.io/mt/73215166/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 2/5] OvmfPkg/PlatformDebugLibIoPort: Reword QEMU to hypervisor

2020-04-24 Thread Laszlo Ersek
On 04/23/20 11:53, Anthony PERARD wrote:
> We are going to reuse PlatformDebugLibIoPort to use debug IO port from
> hypervisors that aren't QEMU, so reword "QEMU" to "hypervisor" in the
> descriptions.
> 
> Signed-off-by: Anthony PERARD 
> ---
>  OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h| 2 +-
>  OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c  | 2 +-
>  OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c| 2 +-
>  OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h 
> b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h
> index 71a7f33aaf17..4677c85ac3c4 100644
> --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h
> +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h
> @@ -1,5 +1,5 @@
>  /** @file
> -  Base Debug library instance for QEMU debug port.
> +  Base Debug library instance for hypervisor debug port.
>It uses PrintLib to send debug messages to a fixed I/O port.
>  
>Copyright (c) 2017, Red Hat, Inc.
> diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c 
> b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> index 3dfa3126c3d0..ec2e677afd8d 100644
> --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> @@ -1,5 +1,5 @@
>  /** @file
> -  Base Debug library instance for QEMU debug port.
> +  Base Debug library instance for hypervisor debug port.
>It uses PrintLib to send debug messages to a fixed I/O port.
>  
>Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c 
> b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c
> index 2c659e7aea0a..8c466e64e0a6 100644
> --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c
> +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c
> @@ -1,5 +1,5 @@
>  /** @file
> -  Detection code for QEMU debug port.
> +  Detection code for hypervisor debug port.
>Non-SEC instance, caches the result of detection.
>  
>Copyright (c) 2017, Red Hat, Inc.
> diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c 
> b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c
> index 03ba4a0a7b08..8cbdbd94fc0e 100644
> --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c
> +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c
> @@ -1,5 +1,5 @@
>  /** @file
> -  Detection code for QEMU debug port.
> +  Detection code for hypervisor debug port.
>SEC instance, cannot cache the result of detection.
>  
>Copyright (c) 2017, Red Hat, Inc.
> 

Reviewed-by: Laszlo Ersek 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58077): https://edk2.groups.io/g/devel/message/58077
Mute This Topic: https://groups.io/mt/73215160/21656
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] OvmfPkg: Add DxeResetSystemLibBhyve

2020-04-24 Thread Laszlo Ersek
On 04/23/20 05:02, Rebecca Cran wrote:
> Introduce the DxeResetSystemLibBhyve library to support powering off
> bhyve guests.

(1) Please replace all "DxeResetSystemLibBhyve" references in the patch
(code, commit message, subject line, file names) with
"BaseResetSystemLibBhyve".

The reason is that the library instance you are introducing is suitable
for all firmware phases and module types. We don't perform any action
that would preclude a particular firmware phase. And we also don't have
phase-specific opportunities for performance improvements. And so it
makes sense to make this a BASE library, and support the broadest
collection of module types.

> 
> Signed-off-by: Rebecca Cran 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> ---
>  OvmfPkg/Include/IndustryStandard/Bhyve.h  |  2 +
>  .../ResetSystemLib/DxeResetShutdownBhyve.c| 43 +++
>  .../ResetSystemLib/DxeResetSystemLibBhyve.inf | 38 
>  3 files changed, 83 insertions(+)
>  create mode 100644 OvmfPkg/Library/ResetSystemLib/DxeResetShutdownBhyve.c
>  create mode 100644 OvmfPkg/Library/ResetSystemLib/DxeResetSystemLibBhyve.inf
> 
> diff --git a/OvmfPkg/Include/IndustryStandard/Bhyve.h 
> b/OvmfPkg/Include/IndustryStandard/Bhyve.h
> index 02ce5587ee..9745d62688 100644
> --- a/OvmfPkg/Include/IndustryStandard/Bhyve.h
> +++ b/OvmfPkg/Include/IndustryStandard/Bhyve.h
> @@ -13,4 +13,6 @@
>  
>  #define BHYVE_ACPI_TIMER_IO_ADDR 0x408
>  
> +#define BHYVE_PM_VALUE 0x408
> +
>  #endif // __BHYVE_H__
> diff --git a/OvmfPkg/Library/ResetSystemLib/DxeResetShutdownBhyve.c 
> b/OvmfPkg/Library/ResetSystemLib/DxeResetShutdownBhyve.c
> new file mode 100644
> index 00..cb30d75ee2
> --- /dev/null
> +++ b/OvmfPkg/Library/ResetSystemLib/DxeResetShutdownBhyve.c
> @@ -0,0 +1,43 @@
> +/** @file
> +  DXE Reset System Library Shutdown API implementation for bhyve.
> +
> +  Copyright (C) 2020, Rebecca Cran 
> +  Copyright (C) 2020, Red Hat, Inc.
> +  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#include// BIT13
> +
> +#include // CpuDeadLoop()
> +#include   // IoOr16()
> +#include  // ResetShutdown()
> +#include   // BHYVE_PM_VALUE

(2) Note that you are adding BHYVE_PM_VALUE to
"OvmfPkg/Include/IndustryStandard/Bhyve.h" (very correctly), and
presently, "OvmfPlatforms.h" does not include "Bhyve.h".

Therefore I suggest replacing the above #include with one for
"IndustryStandard/Bhyve.h".

(And then please re-sort the #include directives.)

> +
> +EFI_STATUS
> +EFIAPI
> +DxeResetInit (
> +  IN EFI_HANDLE   ImageHandle,
> +  IN EFI_SYSTEM_TABLE *SystemTable
> +  )
> +{
> +  return EFI_SUCCESS;
> +}
> +

(3) A CONSTRUCTOR does not look necessary for this library instance.

> +/**
> +  Calling this function causes the system to enter a power state equivalent
> +  to the ACPI G2/S5 or G3 states.
> +
> +  System shutdown should not return, if it returns, it means the system does
> +  not support shut down reset.
> +**/
> +VOID
> +EFIAPI
> +ResetShutdown (
> +  VOID
> +  )
> +{
> +  IoBitFieldWrite16 (BHYVE_PM_VALUE, 10, 13, 5);
> +  IoOr16 (BHYVE_PM_VALUE, BIT13);
> +  CpuDeadLoop ();
> +}
> diff --git a/OvmfPkg/Library/ResetSystemLib/DxeResetSystemLibBhyve.inf 
> b/OvmfPkg/Library/ResetSystemLib/DxeResetSystemLibBhyve.inf
> new file mode 100644
> index 00..c7923a4755
> --- /dev/null
> +++ b/OvmfPkg/Library/ResetSystemLib/DxeResetSystemLibBhyve.inf
> @@ -0,0 +1,38 @@
> +## @file
> +#  DXE library instance for ResetSystem library class for bhyve

(4) Please update this comment too.

> +#
> +#  Copyright (C) 2020, Red Hat, Inc.
> +#  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent

(5) I think your (C) notice is needed here.

> +#
> +##
> +
> +[Defines]
> +  INF_VERSION= 1.29
> +  BASE_NAME  = DxeResetSystemLibBhyve
> +  FILE_GUID  = 88a12688-98f5-44a6-bf4b-7894706a2d11
> +  MODULE_TYPE= DXE_DRIVER

(6) Flip this to BASE please.

> +  VERSION_STRING = 1.0
> +  LIBRARY_CLASS  = ResetSystemLib|DXE_DRIVER 
> DXE_RUNTIME_DRIVER SMM_CORE DXE_SMM_DRIVER UEFI_DRIVER UEFI_APPLICATION

(7) Please drop the module type restrictions (the part starting with "|").

Thanks!
Laszlo

> +  CONSTRUCTOR= DxeResetInit
> +
> +#
> +# The following information is for reference only and not required by the 
> build
> +# tools.
> +#
> +#  VALID_ARCHITECTURES   = IA32 X64
> +#
> +
> +[Sources]
> +  DxeResetShutdownBhyve.c
> +  ResetSystemLib.c
> +
> +[Packages]
> +  MdeModulePkg/MdeModulePkg.dec
> +  MdePkg/MdePkg.dec
> +  OvmfPkg/OvmfPkg.dec
> +
> +[LibraryClasses]
> +  BaseLib
> +  IoLib
> +  TimerLib
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.


Re: [edk2-devel] [PATCH v4 11/13] OvmfPkg/MptScsiDxe: Implement the PassThru method

2020-04-24 Thread Nikita Leshenko



> On 20 Apr 2020, at 20:30, Laszlo Ersek  wrote:
> 
> On 04/14/20 19:38, Nikita Leshenko wrote:
>> Machines should be able to boot after this commit. Tested with different
>> Linux distributions (Ubuntu, CentOS) and different Windows
>> versions (Windows 7, Windows 10, Server 2016).
>> 
>> Ref: 
>> https://urldefense.com/v3/__https://bugzilla.tianocore.org/show_bug.cgi?id=2390__;!!GqivPVa7Brio!JfeG4MsveGF5K9VB4618njXWmMprNv9SIfBg5g6ZHp5jolyqIheckAunOt0SAymJ0j1Ywg$
>>  
>> Signed-off-by: Nikita Leshenko 
>> ---
>> .../Include/IndustryStandard/FusionMptScsi.h  |  19 +-
>> OvmfPkg/MptScsiDxe/MptScsi.c  | 369 +-
>> OvmfPkg/MptScsiDxe/MptScsiDxe.inf |   3 +
>> OvmfPkg/OvmfPkg.dec   |   3 +
>> 4 files changed, 390 insertions(+), 4 deletions(-)
>> 
> [...]
> 
> (12) Does this device support 64-bit DMA?
Yes it does, but in an inconvenient way. The high 32 bits are passed in the
handshake (SenseBufferHighAddr, HostMfaHighAddr) and the low 32 bits are passed
on the request queue/SenseBufferLowAddress. Now that I think about it again,
since we have only one request, reply and buffer, I'll just enable dual-cycle
and pass the high addresses on initialization.

> [...]
> (15) I don't see why hoisting MPT_SCSIIO_REQUEST_CONTROL_TXDIR_NONE
> before the "switch" is helpful. That value can only take effect if the
> XxxTransferLength field (matching the direction) is zero. But I don't
> think those explicit zero checks buy us much.
> 
> I would simply remove the zero comparisons, and always go with either
> TXDIR_READ or TXDIR_WRITE (dependent on Packet->DataDirection). And, in
> case the data size is zero, then just set / copy zero bytes.
We can't just set/copy zero bytes. If transfer size is zero, we must set
MPT_SCSIIO_REQUEST_CONTROL_TXDIR_NONE, otherwise the device (at least under
QEMU) will complain. But I'll simplify the code by setting TXDIR_NONE only if
the transfer size is zero.

> [...]
> (19) Assuming we can expose the reply frame, but not the request, will
> the driver continue to behave fine (without explicit rollback actions
> for the reply frame)?
> 
> Does "IoReplyEnqueued" help with handling this?
Yes, IoReply is put on a queue and the device may use it to communicate errors
in case the request fails. If the request fails and we get an IoReply, we set
IoReplyEnqueued to FALSE so that we know to enqueue it on the next request. If
we fail while *submitting* the request, the reply frame will remain enqueued
(IoReplyEnqueued == TRUE) and we'll be able to use it for a following request.

> 
> (Just a question, not necessarily a code change request.)
> 
> [...]
>> +  if (Reply == Dev->Dma->IoRequest.Data.Header.MessageContext) {
>> +//
>> +// This is a turbo reply, everything is good
>> +//
>> +Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK;
>> +Packet->TargetStatus = EFI_EXT_SCSI_STATUS_TARGET_GOOD;
> 
> (20) Does "turbo reply" mean that you have to update neither
> XxxTransferLength, nor SenseDataLength, on output?
Turbo reply means that the command was successful, which means that we don't
need to update XxxTransferLength. I think we need to zero SenseDataLength
since successful commands don't generate SENSE data.

> [...]
> (23) Would it make sense to check that the device only *lowers*
> SenseDataLength with the above assignment?
Yes, will add that.

> [...]
> I think TransferCount should be set in all cases. Does the device really
> only set TransferCount for TARGET_GOOD?
I assumed that it only updates it when TARGET_GOOD for some reason, but I
checked again and I was wrong. I will read TransferCount unconditionally.

> [...]
>> +[Pcd]
>> +  gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiStallPerPollUsec ## CONSUMES
> 
> (36) General -- can you run "BaseTools/Scripts/SetupGit.py" in your edk2
> clone? It will improve the file order in which changes are formatted
> into patch files. A patch is easier to read if the INF, DEC, and header
> file changes come first.
Sorry, I'm pretty sure I ran it in the past, I'll run it again...

ACK on the rest of the comments (also in the other patches).
Nikita
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58075): https://edk2.groups.io/g/devel/message/58075
Mute This Topic: https://groups.io/mt/73015391/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 2/2] BhyvePkg: Update BhyvePkgX64.dsc to use DxeResetSystemLibBhyve

2020-04-24 Thread Laszlo Ersek
On 04/23/20 05:02, Rebecca Cran wrote:
> bhyve uses a different method for powering off guests than OVMF, so
> use the new DxeResetSystemLibBhyve library to support that.
> 
> Signed-off-by: Rebecca Cran 
> Cc: Peter Grehan 
> ---
>  BhyvePkg/BhyvePkgX64.dsc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BhyvePkg/BhyvePkgX64.dsc b/BhyvePkg/BhyvePkgX64.dsc
> index 51e565994c..554adeb9b9 100644
> --- a/BhyvePkg/BhyvePkgX64.dsc
> +++ b/BhyvePkg/BhyvePkgX64.dsc
> @@ -173,7 +173,7 @@
>DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
>  !endif
>  
> -  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
> +  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLibBhyve.inf
>LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
>IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf
>
> DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
> 

This patch should be submitted later, because it depends on both your
BhyvePkg series, and on patch#1 in this series.

Further, under patch#1, I'm going to recommend to call this instance
BaseResetSystemLibBhyve, not "Dxe...". I'll explain why under patch#1.

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58074): https://edk2.groups.io/g/devel/message/58074
Mute This Topic: https://groups.io/mt/73211875/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 2/2] UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI.

2020-04-24 Thread Laszlo Ersek
On 04/22/20 11:01, Dong, Eric wrote:
> From: "Dong, Eric" 
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2683
> 
> In PEI phase, AP already been waked up through ApInitConfig,
> so it can directly wake up it through change wakup buffer
> instead of use ApInitReconfig flag. It can save some time.
> 
> Change code to only use ApInitReconfig flag in DXE phase
> which must need to update the wake up buffer.
> 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Cc: Chandana Kumar 
> Signed-off-by: Eric Dong 
> ---
> V2:
> 1. Enhance code to remove CpuMpData->ApLoopMode == ApInHltLoop check.
> 
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 13 +++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 2e87aa1f06..6d3a0ccc72 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -1818,7 +1818,14 @@ MpInitLibInitialize (
>// Wakeup APs to do some AP initialize sync (Microcode & MTRR)
>//
>if (CpuMpData->CpuCount > 1) {
> -CpuMpData->InitFlag = ApInitReconfig;
> +if (OldCpuMpData != NULL) {
> +  //
> +  // Only needs to use this flag for DXE phase to update the wake up
> +  // buffer. Wakeup buffer allocated in PEI phase is no longer valid
> +  // in DXE.
> +  //
> +  CpuMpData->InitFlag = ApInitReconfig;
> +}
>  WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData, TRUE);
>  //
>  // Wait for all APs finished initialization
> @@ -1826,7 +1833,9 @@ MpInitLibInitialize (
>  while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {
>CpuPause ();
>  }
> -CpuMpData->InitFlag = ApInitDone;
> +if (OldCpuMpData != NULL) {
> +  CpuMpData->InitFlag = ApInitDone;
> +}
>  for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
>SetApState (>CpuData[Index], CpuStateIdle);
>  }
> 

Hm. The only feedback I could provide for this patch is a regression
test result. However, seeing how Ray has outstanding questions for this
patch, I think I'll delay my testing to the next version (or do it later
for this version, if Ray is ultimately OK with it).

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58073): https://edk2.groups.io/g/devel/message/58073
Mute This Topic: https://groups.io/mt/73191564/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.

2020-04-24 Thread Laszlo Ersek
On 04/22/20 13:47, Ni, Ray wrote:
> Eric,
> It's natural to use the volatile registers value derived from BSP in 
> ApInitReconfig path.
> So I still prefer to use the code I suggested in the review comment to the v1 
> patch.
> 
> We can remove the below line that specially for ApInitReconfig path in 
> MpInitLbInitialize().
> https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/Library/MpInitLib/MpLib.c#L1783:
>   CopyMem (>CpuData[Index].VolatileRegisters, 
> , sizeof (CPU_VOLATILE_REGISTERS));

Sorry I didn't mean to disagree or disregard this feedback.

Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58072): https://edk2.groups.io/g/devel/message/58072
Mute This Topic: https://groups.io/mt/73191434/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.

2020-04-24 Thread Laszlo Ersek
On 04/22/20 11:01, Dong, Eric wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2683
> 
> This patch fixes an assertion because AP can't find the CpuMpData.
> When AP is waken up through Init-Sipi-Sipi, AP's IDT should
> be restored to pre-allocated buffer so AP can get the CpuMpData
> through the IDT base address.
> Current code already has logic to handle this when CpuMpData->
> InitFlag is ApInitConfig but misses the logic
> when CpuMpData->InitFlag is ApInitReconfig.
> This patch fixes this gap.
> 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Cc: Chandana Kumar 
> Signed-off-by: Eric Dong 
> ---
> V2:
> 1. Enhance code comments.
> 
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 64a4c3546e..2e87aa1f06 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -692,6 +692,16 @@ ApWakeupFunction (
>  //
>  RestoreVolatileRegisters 
> (>CpuData[ProcessorNumber].VolatileRegisters, TRUE);
>} else {
> +if (CpuMpData->InitFlag == ApInitReconfig) {
> +  //
> +  // Initialize AP volatile registers in ApInitReconfig path.
> +  // ApInitReconfig happens when:
> +  // 1. AP is re-enabled after it's disabled, in either PEI or DXE 
> phase.
> +  // 2. AP is initialized in DXE phase.
> +  //
> +  RestoreVolatileRegisters 
> (>CpuData[0].VolatileRegisters, FALSE);
> +}
> +
>  //
>  // The CPU driver might not flush TLB for APs on spot after updating
>  // page attributes. AP in mwait loop mode needs to take care of it 
> when
> 

Thanks for spelling out the scenarios when this code path could be taken.

None of both cases seem to apply to OVMF (CPUs are initialized by
CpuMpPei, and I don't think I've ever tested CPI disable/enable). So I
don't expect any regression here.

Acked-by: Laszlo Ersek 

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58071): https://edk2.groups.io/g/devel/message/58071
Mute This Topic: https://groups.io/mt/73191434/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v1 1/1] INF Spec: Add file dependency to [Sources] syntax

2020-04-24 Thread PierreGondois
Hello Bob,
Thank you for your answer, and I understand you need time to discuss before 
approving a solution.

I have two suggestions:
1. About the third option you described, it seems one of the issues is that the 
dependency depicted in the INF file is not accurate. To solve this, we could 
modify build_rule.txt to add a new rule stating that ".aml" files generate 
".amlhex" files. ".amlhex" files would contain the exact same content as what 
our ".hex" file currently contains, this is just a renaming. Having an ASL file 
in a module would then trigger 2 rules of build_rule.txt, the first one 
compiling the ASL file to AML, and a second one compiling the AML file to a 
".amlhex" file. Maybe this will require modifications of the Makefile 
generation.
E.g.: in a ".inf" file:
[Sources]
  file1.asl
  file2.c

The Makefile generated would then look like:
file1.aml:
  "$(ASL)"  file1.asl # Generate file1.aml from file1.asl

file1.amlhex: file1.aml
  AmlToHex  file1.aml # Generate file1.amlhex from file1.aml

file2.obj: file1.amlhex   # file2.obj is dependent on amlhex
  "$(CC)"   file2.c

This solution would not require a modification of the INF specification. It 
would however require to parse file2.c during the Makefile generation step, and 
if file2.c includes a ".amlhex" file, add it to the list of prerequisite in the 
Makefile.
The following rule:
file2.obj: file1.amlhex   # file2.obj is dependent on file1.amlhex
  "$(CC)"   file2.c
could also be splitted in 2:
file2.c: file1.amlhex # file2.c is dependent on file1.amlhex
file2.obj: file2.c# file2.obj is dependent on file1.c
  "$(CC)"   file2.c


2. One other solution would be to hard code during the Makefile generation that 
all ".obj" files (obtained by compilation of C files) are dependent on a 
prerequisite named "AML_FILES" (it's an example), and that the "AML_FILES" 
prerequisite is fulfilled by building all the ASL files. This would mean that 
in edk2, ASL files are always built before C files.
E.g.: in a ".inf" file:
[Sources]
  file1.asl
  file2.asl
  file3.c

The Makefile generated would then look like:
AML_FILES:
  file1.aml
  file2.aml

file1.aml:
  "$(ASL)"  file1.asl  # Generate file1.aml from file1.asl

file2.aml:
  "$(ASL)"  file2.asl  # Generate file2.aml from file2.asl

file3.obj: AML_FILES   # Fulfil the "AML_FILES" prerequisite before
  "$(CC)"   file3.c# creating file3.obj

This solution would also not describe the real dependency, being between 
file1.hex, file2.hex and file1.c.

Please let me know what you think, or if you have any suggestion on how to make 
this change,
Regards,

Pierre

-Original Message-
From: Feng, Bob C  
Sent: Thursday, April 23, 2020 10:37 AM
To: Pierre Gondois ; devel@edk2.groups.io; Kinney, 
Michael D ; Sami Mujawar ; 
Gao, Liming 
Cc: nd 
Subject: RE: [edk2-devel] [PATCH v1 1/1] INF Spec: Add file dependency to 
[Sources] syntax

Hi Pierre,

Sorry for the late response. I have no good idea to resolve the concern about 
the INF syntax change, but I think the ASL compilation should not be done in 
AutoGen phase.

I summarize the solutions that we have discussed.
1. Put the ASL build target before the C build target. 
This solution would not work when the make program enable multiple-threads.
2. Separate your original driver into a lib and a driver. The library include 
the asl file and the driver include c files. Make the driver depends on the 
library, so that the library can be built before the driver and the .hex file 
will be generated before build the c file.
This solution break the module functional integrity.
3. Add the syntax in INF file to support source file dependency between source 
file.
This solution should work. But the dependency descripted in the Makefile 
looks not accurate since you would see a cfile.obj depends on a aslfile.aml. 
The cfile.obj should depend on aslfile.hex, but basetool only know the output 
of a ASL file is a AML file. And this solution looks complicated.
4. Build ASL in AutoGen phase.
Compilation activities should belong to Make phase. 

We might need to figure out a better solution.

Thanks,
Bob

-Original Message-
From: Pierre Gondois 
Sent: Tuesday, April 21, 2020 2:16 AM
To: devel@edk2.groups.io; Kinney, Michael D ; Feng, 
Bob C ; Sami Mujawar ; Gao, Liming 

Cc: nd 
Subject: RE: [edk2-devel] [PATCH v1 1/1] INF Spec: Add file dependency to 
[Sources] syntax

Hello Bob, Michael and Liming,
I don't have a clear idea on which direction to go in order to enable building 
ASL files before C files in edk2. I would need an answer to agree on which 
direction I should continue to investigate. For the record, the matching patch 
in edk2 is available at https://edk2.groups.io/g/devel/message/56662 and
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2425

Regards,
Pierre

-Original Message-
From: Pierre Gondois
Sent: Wednesday, April 15, 2020 4:41 PM
To: devel@edk2.groups.io; 

Re: [edk2-devel] [PATCH] BaseTools/PatchCheck.py: Add LicenseCheck

2020-04-24 Thread Leif Lindholm
On Fri, Apr 24, 2020 at 18:13:58 +0200, Laszlo Ersek wrote:
> On 04/22/20 18:01, Liming Gao wrote:
> > Mike:
> >   The checker purpose is to make sure the correct license be used for new 
> > added file. If the file has the different license, it should be reviewed 
> > carefully. 
> >   
> >   I remember we still have one open for third party non bsd+patent
> >   code (the detail can refer to
> >   https://edk2.groups.io/g/devel/message/41639). Now, there is no
> >   non bsd+patent license files to be added in edk2 after edk2
> >   switches to bsd+patent license.
> 
> Some files introduced by Rebecca's BhyvePkg patch series come under the
> 2-clause BSD License, and not the 2-clause BSD + Patent License. And
> Rebecca cannot relicense them because she's not the (sole) copyright holder.

I disagree.
BSD+Patent is a pure superset of BSD - this was the logic by which the
whole EDK2 project was relicensed in the first place. Rebecca can
definitely add the explicit patent grant as part of the contribution.

The explicit patent grant of course affects only the contributor, and
users of the contributed code, not the original source (and the
originating project would not be able to take modifications back
without accepting the amended license).

> Readme.md states:
> 
> 4. It is preferred that contributions are submitted using the same
>copyright license as the base project. When that is not possible,
>then contributions using the following licenses can be accepted:
>* BSD (2-clause): http://opensource.org/licenses/BSD-2-Clause
>* BSD (3-clause): http://opensource.org/licenses/BSD-3-Clause
>* MIT: http://opensource.org/licenses/MIT
>* Python-2.0: http://opensource.org/licenses/Python-2.0
>* Zlib: http://opensource.org/licenses/Zlib
> [...]
>Contributions using other licenses might be accepted, but further
>review will be required.
> 
> This seems to imply that the "normal" 2-clause BSDL does not require
> "further review".

And I still hold the opinion that I held when I posted the message
referenced above - we do not today have any real policy here.

Now, as per my comment above, I don't think that applies in this
situation, but it is still somethihg we must resolve (i.e. take an
active decision about) before we accept any non BSD+Patent content
into any of our BSD+Patent trees.

/
Leif

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58069): https://edk2.groups.io/g/devel/message/58069
Mute This Topic: https://groups.io/mt/73190372/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] BaseTools/PatchCheck.py: Add LicenseCheck

2020-04-24 Thread Laszlo Ersek
On 04/22/20 18:01, Liming Gao wrote:
> Mike:
>   The checker purpose is to make sure the correct license be used for new 
> added file. If the file has the different license, it should be reviewed 
> carefully. 
>   
>   I remember we still have one open for third party non bsd+patent code (the 
> detail can refer to https://edk2.groups.io/g/devel/message/41639). Now, there 
> is no non bsd+patent license files to be added in edk2 after edk2 switches to 
> bsd+patent license. 

Some files introduced by Rebecca's BhyvePkg patch series come under the
2-clause BSD License, and not the 2-clause BSD + Patent License. And
Rebecca cannot relicense them because she's not the (sole) copyright holder.

Readme.md states:

4. It is preferred that contributions are submitted using the same
   copyright license as the base project. When that is not possible,
   then contributions using the following licenses can be accepted:
   * BSD (2-clause): http://opensource.org/licenses/BSD-2-Clause
   * BSD (3-clause): http://opensource.org/licenses/BSD-3-Clause
   * MIT: http://opensource.org/licenses/MIT
   * Python-2.0: http://opensource.org/licenses/Python-2.0
   * Zlib: http://opensource.org/licenses/Zlib
[...]
   Contributions using other licenses might be accepted, but further
   review will be required.

This seems to imply that the "normal" 2-clause BSDL does not require
"further review".

Thanks
Laszlo

>> -Original Message-
>> From: Kinney, Michael D 
>> Sent: Wednesday, April 22, 2020 11:41 PM
>> To: devel@edk2.groups.io; Gao, Liming ; Zhang, 
>> Shenglei ; Kinney, Michael D
>> 
>> Cc: Feng, Bob C 
>> Subject: RE: [edk2-devel] [PATCH] BaseTools/PatchCheck.py: Add LicenseCheck
>>
>> Hi Liming,
>>
>> I do not see this change checking that the license is in a proper
>> SPDX Identifier statement?
>>
>>  https://spdx.org/ids-how
>>
>> Only checking the for a license name is not sufficient.
>>
>> A file may be covered by more than one license.  What is the behavior in
>> this case?
>>
>> The EDK II project has BSD-2-Clause-Patent as the preferred license, but
>> other licenses are allowed.  We use PatchCheck.py in EDK II CI.  Will this
>> change block file added with a different allowed license?
>>
>> I think these questions should be addressed in the file header of this
>> source file, so the behavior of PatchCheck.py is clearly defined.
>>
>> Thanks,
>>
>> Mike
>>
>>> -Original Message-
>>> From: devel@edk2.groups.io  On
>>> Behalf Of Liming Gao
>>> Sent: Wednesday, April 22, 2020 12:02 AM
>>> To: Zhang, Shenglei ;
>>> devel@edk2.groups.io
>>> Cc: Feng, Bob C 
>>> Subject: Re: [edk2-devel] [PATCH]
>>> BaseTools/PatchCheck.py: Add LicenseCheck
>>>
>>> Shenglei:
>>>   Please submit BZ to describe it. The license should
>>> be BSD-2-Clause-Patent.
>>>
>>> Thanks
>>> Liming
 -Original Message-
 From: Zhang, Shenglei 
 Sent: Wednesday, April 22, 2020 2:57 PM
 To: devel@edk2.groups.io
 Cc: Feng, Bob C ; Gao, Liming
>>> 
 Subject: [PATCH] BaseTools/PatchCheck.py: Add
>>> LicenseCheck

 For files to be added to the tree, this feature will
>>> check
 whether it has BSD license.

 Cc: Bob Feng 
 Cc: Liming Gao 
 Signed-off-by: Shenglei Zhang
>>> 
 ---
  BaseTools/Scripts/PatchCheck.py | 52
>>> -
  1 file changed, 51 insertions(+), 1 deletion(-)

 diff --git a/BaseTools/Scripts/PatchCheck.py
>>> b/BaseTools/Scripts/PatchCheck.py
 index 13da6967785d..15663d02a3c0 100755
 --- a/BaseTools/Scripts/PatchCheck.py
 +++ b/BaseTools/Scripts/PatchCheck.py
 @@ -491,6 +491,53 @@ class GitDiffCheck:
  print(prefix, line)
  count += 1

 +class LicenseCheck():
 +
 +def __init__(self, diff):
 +self.ok = True
 +self.startcheck = False
 +self.license = True
 +lines = diff.splitlines(True)
 +count = len(lines)
 +line_index = 0
 +for line in lines:
 +if line.startswith('--- /dev/null'):
 +nextline = lines[line_index + 1]
 +added_file =
>>> self.Readdedfileformat.search(nextline).group(1)
 +added_file_extension =
>>> os.path.splitext(added_file)[1]
 +if added_file_extension in
>>> self.file_extension_list:
 +self.startcheck = True
 +self.license = False
 +if self.startcheck and self.license_name
>>> in line:
 +self.license = True
 +if line_index + 1 == count or
>>> lines[line_index + 1].startswith('diff --') and
>>> self.startcheck:
 +if not self.license:
 +self.error(added_file)
 +self.startcheck = False
 +self.license = True
 +line_index = line_index + 1
 +
 +def 

Re: [edk2-devel] [PATCH v3 4/6] Add BhyvePkg, to support the bhyve hypervisor

2020-04-24 Thread Rebecca Cran


> On Apr 24, 2020, at 4:11 AM, Laszlo Ersek  wrote:
> 
> So, if you are *completely* sure you didn't change anything on those
> copies, relative to their fork-off point originals, then I guess it's OK
> to not add your (C).

Okay. There are some that are really simple, since I did re-sync them:

bcran@photon:~/src/uefi/edk2$ diff -U3 BhyvePkg/FvmainCompactScratchEnd.fdf.inc 
OvmfPkg/FvmainCompactScratchEnd.fdf.inc 
bcran@photon:~/src/uefi/edk2$ 
bcran@photon:~/src/uefi/edk2$ diff -U3 BhyvePkg/VarStore.fdf.inc 
OvmfPkg/VarStore.fdf.inc 
bcran@photon:~/src/uefi/edk2$ 
bcran@photon:~/src/uefi/edk2$ diff -U3 BhyvePkg/PlatformPei/AmdSev.c 
OvmfPkg/PlatformPei/AmdSev.c 
bcran@photon:~/src/uefi/edk2$
bcran@photon:~/src/uefi/edk2$ diff -U3 BhyvePkg/PlatformPei/ClearCache.c 
OvmfPkg/PlatformPei/ClearCache.c 
bcran@photon:~/src/uefi/edk2$ 
…

— 
Rebecca Cran

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58067): https://edk2.groups.io/g/devel/message/58067
Mute This Topic: https://groups.io/mt/73165367/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH edk2-platforms v3 16/24] Silicon/NXP: Add Chassis2 Package

2020-04-24 Thread Leif Lindholm
On Fri, Apr 24, 2020 at 02:42:13 +, Pankaj Bansal (OSS) wrote:
> > > > Why would multiple modules need to initialize the serial port?
> > >
> > > That's how the DebugLib has been designed.
> > > DebugLib is used by all modules to print info on console.
> > > BaseDebugLibSerialPortConstructor calls SerialPortInitialize.
> > > So SerialPortInitialize is called by all the modules.
> > 
> > Sure, but the bit where ChassisLib returns the active clock
> > configuration does not need to happen for each initialization.
> > That value can be cached.
> 
> The only mechanism I know for passing a cached value between different modules
> is either use PCDs or use HOBs.
> We have already explored both in https://edk2.groups.io/g/devel/message/57254
> and https://edk2.groups.io/g/devel/message/56530 

That was discussing what to do with regards to the generic 16550
driver. If we go with Laszlo's suggestion[1] for a separate
SerialUartClockLib instead of adding a vendor GUID HOB *into the
generic driver*, that does not preclude your using a HOB to cache the
value in your platform code for later use in your own
SerialUartClockLib implementation.

[1] https://edk2.groups.io/g/devel/message/56767

> Moreover the compiler can optimize the PcdDcfgBigEndian evaluation.
> So no overhead would be observed in evaluating PcdDcfgBigEndian in every call.

I don't question that, but that was always going to be the case anyway
- especially with LTO. The point is reducing code duplication -
especially for weird and wacky hardware workarounds.

/
Leif

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58066): https://edk2.groups.io/g/devel/message/58066
Mute This Topic: https://groups.io/mt/73008827/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [EXTERNAL] Re: [PATCH v2 0/6] Edk2 Platform and Core CI for ArmVirtPkg, EmulatorPkg, and OvmfPkg

2020-04-24 Thread Laszlo Ersek
On 04/23/20 02:45, Sean Brogan wrote:
> I was hoping that because it wasn't "HTML tag soup" that build status could 
> be front and center in the package readme as I find that more in line with 
> expectations on github based projects.   Nesting it deeper in the package 
> just means less people find it when looking at your package.   But I could 
> see a few ways to solve it so I am looking for feedback and alignment before 
> doing anything else. 
> 
> Option 1.
> 
> 1. Add the Platform CI build status for the three platforms to the Edk2 repo 
> readme since these are platforms in edk2 this makes sense and brings the most 
> visibility to their status and the existence of the builds. 
> 2. Convert edk2 repo readme to RST so it avoids "HTML tag soup"
> 3. Move the remaining part of the OvmfPkg/Readme.rst file into 
> OvmfPkg/PlatformCI/Readme.md  (I prefer MD when not doing large tables of 
> links as it is easier to write and slightly easier to read as plain text).   
> 4. Do step 3 for ArmVirtPkg and EmulatorPkg too
> 
> Option 2.
> 1. Leave the ReadMe.rst at the root of each package but only include the 
> build status table and add a link to the PlatformCi/ReadMe.md
> 2. Move the Pytool and Platform CI focused readme contents to 
> PlatformCI/ReadMe.md
> 
> Option 3.
> 
> Something else.
> 
> Finally does anyone have a strong preference for ReadMe vs README vs readme 
> vs Readme vs ReAdMe?  I see a mix of these in the edk2 code tree.   

Sorry, I didn't mean to ignore this sub-thread, I just got to see the
other email (about the V10 branch) first. My understanding is that V10
has come to a resolution about the questions above; and I'm happy with
V10 (as I stated in that thread).

Thanks!
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58065): https://edk2.groups.io/g/devel/message/58065
Mute This Topic: https://groups.io/mt/73210237/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms][PATCH v1 0/4] Platform: Add initial support for N1SDP board

2020-04-24 Thread Pranav Madhu
Arm's N1SDP is a Arm v8.2-A Neoverse N1 CPU based reference design platform
primariliy intended for development on Arm64 based platform. This patch series
adds initial platform support for this board.

The first two patches in this series adds the platform libary implementation
and the required edk2 build files for this platform. The third patch adds a
custom implementation of the PciExpressLib due to a PCIe integration issue
which results in all config space accesses to non-existing BDFs resulting in
a Serror (bus abort). To avoid this, the N1SDP specific PciExpressLib
implementation provides a workaround for this issue. The fourth patch in this
series adds the platform library for the PciHostBridge and enables support
for the all the possible devices connected behind the PCIe.

Deepak Pandey (4):
  Platform/ARM/N1SDP: Add platform library implementation
  Platform/ARM/N1SDP: Add EDK2 build system files
  Platform/ARM/N1SDP: Implement n1sdp specific PciExpressLib
  Platform/ARM/N1SDP: Enable devices connected over PCIe

 Platform/ARM/N1SdpPkg/N1SdpPlatform.dec |   51 +
 Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc |  261 
 Platform/ARM/N1SdpPkg/N1SdpPlatform.fdf |  294 
 Platform/ARM/N1SdpPkg/Library/PciExpressLib/PciExpressLib.inf   |   40 +
 Platform/ARM/N1SdpPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf |   49 +
 Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLib.inf   |   64 +
 Platform/ARM/N1SdpPkg/Include/N1SdpPlatform.h   |   68 +
 Platform/ARM/N1SdpPkg/Library/PciExpressLib/PciExpressLib.c | 1540 

 Platform/ARM/N1SdpPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   |  187 +++
 Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLib.c |   67 +
 Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLibMem.c  |  153 ++
 Platform/ARM/N1SdpPkg/Library/PlatformLib/AArch64/Helper.S  |   84 ++
 12 files changed, 2858 insertions(+)
 create mode 100644 Platform/ARM/N1SdpPkg/N1SdpPlatform.dec
 create mode 100644 Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc
 create mode 100644 Platform/ARM/N1SdpPkg/N1SdpPlatform.fdf
 create mode 100644 
Platform/ARM/N1SdpPkg/Library/PciExpressLib/PciExpressLib.inf
 create mode 100644 
Platform/ARM/N1SdpPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
 create mode 100644 Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLib.inf
 create mode 100644 Platform/ARM/N1SdpPkg/Include/N1SdpPlatform.h
 create mode 100644 Platform/ARM/N1SdpPkg/Library/PciExpressLib/PciExpressLib.c
 create mode 100644 
Platform/ARM/N1SdpPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
 create mode 100644 Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLib.c
 create mode 100644 Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLibMem.c
 create mode 100644 Platform/ARM/N1SdpPkg/Library/PlatformLib/AArch64/Helper.S

-- 
2.7.4


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58060): https://edk2.groups.io/g/devel/message/58060
Mute This Topic: https://groups.io/mt/73241663/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms][PATCH v1 2/4] Platform/ARM/N1SDP: Add EDK2 build system files

2020-04-24 Thread Pranav Madhu
From: Deepak Pandey 

Add EDK Build system files for Neoverse N1 System Development Platform.

Signed-off-by: Pranav Madhu 
---
 Platform/ARM/N1SdpPkg/N1SdpPlatform.dec |  31 +++
 Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc | 222 
 Platform/ARM/N1SdpPkg/N1SdpPlatform.fdf | 272 
 3 files changed, 525 insertions(+)

diff --git a/Platform/ARM/N1SdpPkg/N1SdpPlatform.dec 
b/Platform/ARM/N1SdpPkg/N1SdpPlatform.dec
new file mode 100644
index ..c8efe7b31d51
--- /dev/null
+++ b/Platform/ARM/N1SdpPkg/N1SdpPlatform.dec
@@ -0,0 +1,31 @@
+#
+#  Copyright (c) 2018 - 2020, ARM Limited. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+[Defines]
+  DEC_SPECIFICATION  = 0x0001001A
+  PACKAGE_NAME   = N1SdpPkg
+  PACKAGE_GUID   = b6d2d197-76d0-401f-a3e0-826a26f350c9
+  PACKAGE_VERSION= 0.1
+
+
+#
+# Include Section - list of Include Paths that are provided by this package.
+#   Comments are used for Keywords and Module Types.
+#
+
+[Includes.common]
+  Include# Root include for the package
+
+[Guids.common]
+  gArmN1SdpTokenSpaceGuid =  { 0xab93eb78, 0x60d7, 0x4099, { 0xac, 0xeb, 0x6d, 
0xb5, 0x02, 0x58, 0x7c, 0x24 } }
+
+[PcdsFixedAtBuild]
+
+  # Secondary DDR memory
+  gArmN1SdpTokenSpaceGuid.PcdDramBlock2Base|0|UINT64|0x0001
+
+  # External memory
+  gArmN1SdpTokenSpaceGuid.PcdExtMemorySpace|0|UINT64|0x0002
diff --git a/Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc 
b/Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc
new file mode 100644
index ..95552328065a
--- /dev/null
+++ b/Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc
@@ -0,0 +1,222 @@
+#
+#  Copyright (c) 2018 - 2020, ARM Limited. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+
+[Defines]
+  PLATFORM_NAME  = n1sdp
+  PLATFORM_GUID  = 9af67d31-7de8-4a71-a9a8-a597a27659ce
+  PLATFORM_VERSION   = 0.1
+  DSC_SPECIFICATION  = 0x0001001B
+  OUTPUT_DIRECTORY   = Build/$(PLATFORM_NAME)
+  SUPPORTED_ARCHITECTURES= AARCH64|ARM
+  BUILD_TARGETS  = NOOPT|DEBUG|RELEASE
+  SKUID_IDENTIFIER   = DEFAULT
+  FLASH_DEFINITION   = Platform/ARM/N1SdpPkg/N1SdpPlatform.fdf
+  BUILD_NUMBER   = 1
+
+!include Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
+
+[LibraryClasses.common]
+  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+  ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
+  
ArmPlatformSysConfigLib|Platform/ARM/VExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
+  ArmPlatformLib|Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLib.inf
+  BasePathLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+  
EfiResetSystemLib|ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf
+  NorFlashPlatformLib|Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
+
+[LibraryClasses.common.SEC]
+  HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
+  
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+  
PeiServicesTablePointerLib|ArmPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
+
+[LibraryClasses.common.PEI_CORE, LibraryClasses.common.PEIM]
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
+  
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+  PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+  PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+  
PeiServicesTablePointerLib|ArmPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
+  
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
+
+[LibraryClasses.common.PEI_CORE]
+  PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
+
+[LibraryClasses.common.PEIM]
+  PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
+
+[LibraryClasses.common.DXE_CORE]
+  DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
+  HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
+  

[edk2-devel] [edk2-platforms][PATCH v1 4/4] Platform/ARM/N1SDP: Enable devices connected over PCIe

2020-04-24 Thread Pranav Madhu
From: Deepak Pandey 

N1SDP platform includes a PCIe root complex to which a AHCI, GbE and
USB controllers are attached as an endpoint. So implement the
PciHostBridgeLib glue layer and enable support for PCIe controller
and all the devices connected over the PCIe bus.

Signed-off-by: Pranav Madhu 
---
 Platform/ARM/N1SdpPkg/N1SdpPlatform.dec |  20 +++
 Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc |  35 
 Platform/ARM/N1SdpPkg/N1SdpPlatform.fdf |  22 +++
 Platform/ARM/N1SdpPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf |  49 +
 Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLib.inf   |  12 ++
 Platform/ARM/N1SdpPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   | 187 

 Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLibMem.c  |  28 ++-
 7 files changed, 352 insertions(+), 1 deletion(-)

diff --git a/Platform/ARM/N1SdpPkg/N1SdpPlatform.dec 
b/Platform/ARM/N1SdpPkg/N1SdpPlatform.dec
index c8efe7b31d51..eebc62fea23b 100644
--- a/Platform/ARM/N1SdpPkg/N1SdpPlatform.dec
+++ b/Platform/ARM/N1SdpPkg/N1SdpPlatform.dec
@@ -24,6 +24,26 @@ [Guids.common]
 
 [PcdsFixedAtBuild]
 
+  # PCIe
+  gArmN1SdpTokenSpaceGuid.PcdPcieBusCount|18|UINT32|0x0004
+  gArmN1SdpTokenSpaceGuid.PcdPcieBusMax|17|UINT32|0x0005
+  gArmN1SdpTokenSpaceGuid.PcdPcieBusMin|0|UINT32|0x0006
+  
gArmN1SdpTokenSpaceGuid.PcdPcieExpressBaseAddress|0x7000|UINT32|0x0007
+  gArmN1SdpTokenSpaceGuid.PcdPcieIoBase|0x0|UINT32|0x0008
+  gArmN1SdpTokenSpaceGuid.PcdPcieIoMaxBase|0x00FF|UINT32|0x0009
+  gArmN1SdpTokenSpaceGuid.PcdPcieIoSize|0x0100|UINT32|0x000A
+  gArmN1SdpTokenSpaceGuid.PcdPcieIoTranslation|0x7520|UINT32|0x000B
+  gArmN1SdpTokenSpaceGuid.PcdPcieMmio32Base|0x7120|UINT32|0x000C
+  gArmN1SdpTokenSpaceGuid.PcdPcieMmio32MaxBase|0x751F|UINT32|0x000D
+  gArmN1SdpTokenSpaceGuid.PcdPcieMmio32Size|0x0400|UINT32|0x000E
+  gArmN1SdpTokenSpaceGuid.PcdPcieMmio32Translation|0x0|UINT32|0x000F
+  gArmN1SdpTokenSpaceGuid.PcdPcieMmio64Base|0x09|UINT64|0x0010
+  gArmN1SdpTokenSpaceGuid.PcdPcieMmio64MaxBase|0x28|UINT64|0x0011
+  gArmN1SdpTokenSpaceGuid.PcdPcieMmio64Size|0x20|UINT64|0x0012
+  gArmN1SdpTokenSpaceGuid.PcdPcieMmio64Translation|0x0|UINT64|0x0013
+  
gArmN1SdpTokenSpaceGuid.PcdPcieRootPortConfigBaseAddress|0x6000|UINT32|0x0014
+  
gArmN1SdpTokenSpaceGuid.PcdPcieRootPortConfigBaseSize|0x1000|UINT32|0x0015
+
   # Secondary DDR memory
   gArmN1SdpTokenSpaceGuid.PcdDramBlock2Base|0|UINT64|0x0001
 
diff --git a/Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc 
b/Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc
index 53be9699d99e..3ee524349281 100644
--- a/Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc
+++ b/Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc
@@ -35,6 +35,9 @@ [LibraryClasses.common]
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
   TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
 
+  #USB Requirement
+  UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
+
 [LibraryClasses.common.SEC]
   HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
   
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
@@ -86,6 +89,9 @@ [LibraryClasses.common.UEFI_DRIVER, 
LibraryClasses.common.UEFI_APPLICATION, Libr
 #
 

 
+[PcdsFeatureFlag.common]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
+
 [PcdsFixedAtBuild.common]
   gArmTokenSpaceGuid.PcdVFPEnabled|1
 
@@ -109,6 +115,10 @@ [PcdsFixedAtBuild.common]
   gArmTokenSpaceGuid.PcdGicDistributorBase|0x3000
   gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x300C
 
+  # PCIe
+  gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|24
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport|FALSE
+
   # PL011 - Serial Terminal
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x2A40
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200
@@ -202,6 +212,9 @@ [Components.common]
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   }
 
+  # Human Interface Support
+  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+
   # FAT filesystem + GPT/MBR partitioning
   MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
@@ -221,6 +234,28 @@ [Components.common]
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   }
 
+  # Required by PCI
+  ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
+
+  # PCI Support
+  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
+
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8010004F
+  }
+
   # AHCI Support
   MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
   MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
+
+  # SATA Controller
+  

[edk2-devel] [edk2-platforms][PATCH v1 3/4] Platform/ARM/N1SDP: Implement n1sdp specific PciExpressLib

2020-04-24 Thread Pranav Madhu
From: Deepak Pandey 

A slave error is generated when host accesses the config space of
non-available device or unimplemented function on a given bus. So
implement a n1sdp specific PciExpressLib library with a workaround to
return 0x for all such access.

Signed-off-by: Pranav Madhu 
---
 Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc   |4 +
 Platform/ARM/N1SdpPkg/Library/PciExpressLib/PciExpressLib.inf |   40 +
 Platform/ARM/N1SdpPkg/Library/PciExpressLib/PciExpressLib.c   | 1540 

 3 files changed, 1584 insertions(+)

diff --git a/Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc 
b/Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc
index 95552328065a..53be9699d99e 100644
--- a/Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc
+++ b/Platform/ARM/N1SdpPkg/N1SdpPlatform.dsc
@@ -65,6 +65,10 @@ [LibraryClasses.common.DXE_CORE]
 
 [LibraryClasses.common.DXE_DRIVER]
   FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
+  
PciHostBridgeLib|Platform/ARM/N1SdpPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+  PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
+  PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
+  PciExpressLib|Platform/ARM/N1SdpPkg/Library/PciExpressLib/PciExpressLib.inf
 
 [LibraryClasses.common.DXE_RUNTIME_DRIVER]
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
diff --git a/Platform/ARM/N1SdpPkg/Library/PciExpressLib/PciExpressLib.inf 
b/Platform/ARM/N1SdpPkg/Library/PciExpressLib/PciExpressLib.inf
new file mode 100644
index ..f8a85cbb8fed
--- /dev/null
+++ b/Platform/ARM/N1SdpPkg/Library/PciExpressLib/PciExpressLib.inf
@@ -0,0 +1,40 @@
+## @file
+#  Instance of PCI Express Library using the 256 MB PCI Express MMIO window.
+#
+#  PCI Express Library that uses the 256 MB PCI Express MMIO window to perform
+#  PCI Configuration cycles. Layers on top of an I/O Library instance.
+#
+#  Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = BasePciExpressLib
+  MODULE_UNI_FILE= BasePciExpressLib.uni
+  FILE_GUID  = 52c06b64-a45e-4906-b9ee-abe1acc286bb
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = PciExpressLib
+
+[Sources]
+  PciExpressLib.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  Platform/ARM/N1SdpPkg/N1SdpPlatform.dec
+
+[FixedPcd]
+  gArmN1SdpTokenSpaceGuid.PcdPcieRootPortConfigBaseAddress
+  gArmN1SdpTokenSpaceGuid.PcdPcieRootPortConfigBaseSize
+
+[LibraryClasses]
+  BaseLib
+  PcdLib
+  DebugLib
+  IoLib
+
+[Pcd]
+  gArmN1SdpTokenSpaceGuid.PcdPcieExpressBaseAddress  ## CONSUMES
diff --git a/Platform/ARM/N1SdpPkg/Library/PciExpressLib/PciExpressLib.c 
b/Platform/ARM/N1SdpPkg/Library/PciExpressLib/PciExpressLib.c
new file mode 100644
index ..f983acdee5a5
--- /dev/null
+++ b/Platform/ARM/N1SdpPkg/Library/PciExpressLib/PciExpressLib.c
@@ -0,0 +1,1540 @@
+/** @file
+*  Functions in this library instance make use of MMIO functions in IoLib to
+*  access memory mapped PCI configuration space.
+*
+*  All assertions for I/O operations are handled in MMIO functions in the IoLib
+*  Library.
+*
+*  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+*
+*  Copyright (c) 2020, ARM Limited. All rights reserved.
+*
+*  SPDX-License-Identifier: BSD-2-Clause-Patent
+*
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+  Assert the validity of a PCI address. A valid PCI address should contain 1's
+  only in the low 32 bits.
+
+  @param  A The address to validate.
+**/
+#define ASSERT_INVALID_PCI_ADDRESS(A) \
+  ASSERT (((A) & ~0x) == 0)
+
+#define EFI_PCIE_ADDRESS(bus, dev, func, reg) \
+  (UINT64) ( \
+  (((UINTN) bus) << 20) | \
+  (((UINTN) dev) << 15) | \
+  (((UINTN) func) << 12) | \
+  (((UINTN) (reg)) < 4096 ? ((UINTN) (reg)) : (UINT64) (LShiftU64 ((UINT64) 
(reg), 32
+
+#define GET_PCIE_BASE_ADDRESS(Address)  (Address & 0xF800)
+
+/* Root port Entry, BDF Entries Count */
+#define BDF_TABLE_ENTRY_SIZE4
+#define BDF_TABLE_HEADER_COUNT  2
+#define BDF_TABLE_HEADER_SIZE   8
+
+/* BDF table offsets for PCIe */
+#define PCIE_BDF_TABLE_OFFSET   0
+
+#define GET_BUS_NUM(Address)((Address>>20) & 0x7f)
+#define GET_DEV_NUM(Address)((Address>>15) & 0x1f)
+#define GET_FUNC_NUM(Address)   ((Address>>12) & 0x07)
+#define GET_REG_NUM(Address)((Address) & 0xFFF)
+
+/**
+  BDF Table structure : (Header + BDF Entries)
+  ---
+  ROOT PORT ADDRESS
+  BDF ENTRIES COUNT
+  BDF ENTRY 0
+  BDF ENTRY 1
+  BDF ENTRY 2
+  BDF ENTRY 3
+  BDF ENTRY 4
+  ...
+  BDF ENTRY N
+  --
+**/
+
+UINTN DummyPciData = 0x;
+
+/**
+  Registers a PCI device so PCI configuration registers may be accessed after
+  SetVirtualAddressMap().
+
+  Registers the PCI 

[edk2-devel] [edk2-platforms][PATCH v1 1/4] Platform/ARM/N1SDP: Add platform library implementation

2020-04-24 Thread Pranav Madhu
From: Deepak Pandey 

N1SDP (Neoverse N1 System Development Platform) platform library support.
This includes the virtual memory map and helper functions for platform
intialization.

Signed-off-by: Pranav Madhu 
---
 Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLib.inf  |  52 
 Platform/ARM/N1SdpPkg/Include/N1SdpPlatform.h  |  68 +++
 Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLib.c|  67 +++
 Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLibMem.c | 127 

 Platform/ARM/N1SdpPkg/Library/PlatformLib/AArch64/Helper.S |  84 +
 5 files changed, 398 insertions(+)

diff --git a/Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLib.inf 
b/Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLib.inf
new file mode 100644
index ..1ba29657cbf6
--- /dev/null
+++ b/Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLib.inf
@@ -0,0 +1,52 @@
+## @file
+#
+#  Copyright (c) 2018-2020, ARM Limited. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = ArmN1SdpLib
+  FILE_GUID  = 87c525cd-e1a2-469e-994c-c28cd0c7bd0d
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = ArmPlatformLib
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Platform/ARM/N1SdpPkg/N1SdpPlatform.dec
+
+[LibraryClasses]
+  ArmLib
+  DebugLib
+  HobLib
+  IoLib
+  MemoryAllocationLib
+  SerialPortLib
+
+[Sources.common]
+  PlatformLibMem.c
+  PlatformLib.c
+
+[Sources.AARCH64]
+  AArch64/Helper.S | GCC
+
+[FixedPcd]
+  gArmTokenSpaceGuid.PcdSystemMemoryBase
+  gArmTokenSpaceGuid.PcdSystemMemorySize
+  gArmTokenSpaceGuid.PcdArmPrimaryCore
+  gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
+
+  gArmN1SdpTokenSpaceGuid.PcdDramBlock2Base
+
+[Guids]
+  gEfiHobListGuid  ## CONSUMES  ## SystemTable
+
+[Ppis]
+  gArmMpCoreInfoPpiGuid
diff --git a/Platform/ARM/N1SdpPkg/Include/N1SdpPlatform.h 
b/Platform/ARM/N1SdpPkg/Include/N1SdpPlatform.h
new file mode 100644
index ..9ab4617c3c90
--- /dev/null
+++ b/Platform/ARM/N1SdpPkg/Include/N1SdpPlatform.h
@@ -0,0 +1,68 @@
+/** @file
+*
+* Copyright (c) 2018 - 2020, ARM Limited. All rights reserved.
+*
+* SPDX-License-Identifier: BSD-2-Clause-Patent
+*
+**/
+
+#ifndef __N1SDP_PLATFORM_H__
+#define __N1SDP_PLATFORM_H__
+
+#define N1SDP_DRAM_BLOCK1_SIZE   SIZE_2GB
+
+//**
+// Platform Memory Map
+//**
+
+// SubSystem Peripherals - UART0
+#define N1SDP_UART0_BASE 0x2A40
+#define N1SDP_UART0_SZ   SIZE_64KB
+
+// SubSystem Peripherals - UART1
+#define N1SDP_UART1_BASE 0x2A41
+#define N1SDP_UART1_SZ   SIZE_64KB
+
+// SubSystem Peripherals - Generic Watchdog
+#define N1SDP_GENERIC_WDOG_BASE  0x2A44
+#define N1SDP_GENERIC_WDOG_SZSIZE_128KB
+
+// SubSystem Peripherals - GIC(600)
+#define N1SDP_GIC_BASE   0x3000
+#define N1SDP_GICR_BASE  0x300C
+#define N1SDP_GIC_SZ SIZE_256KB
+#define N1SDP_GICR_SZSIZE_1MB
+
+// SubSystem non-secure SRAM
+#define N1SDP_NON_SECURE_SRAM_BASE   0x0600
+#define N1SDP_NON_SECURE_SRAM_SZ SIZE_64KB
+
+// AXI Expansion peripherals
+#define N1SDP_EXP_PERIPH_BASE0   0x1C00
+#define N1SDP_EXP_PERIPH_BASE0_SZ0x130
+
+// Base address to a structure of type N1SDP_PLAT_INFO which is pre-populated
+// by a earlier boot stage
+#define N1SDP_PLAT_INFO_STRUCT_BASE  (N1SDP_NON_SECURE_SRAM_BASE + \
+  0x8000)
+
+/*
+ * Platform information structure stored in non secure SRAM
+ * Platform information are passed from the trusted firmware with the below
+ * structure format. The elements of N1SDP_PLAT_INFO should be always in sync
+ * with the structure in trusted firmware
+ */
+#pragma pack(1)
+typedef struct {
+  /*! 0 - Single Chip, 1 - Chip to Chip (C2C) */
+  BOOLEAN MultichipMode;
+  /*! Slave count in C2C mode */
+  UINT8   SlaveCount;
+  /*! Local DDR memory size in GigaBytes */
+  UINT8   LocalDdrSize;
+  /*! Remote DDR memory size in GigaBytes */
+  UINT8   RemoteDdrSize;
+} N1SDP_PLAT_INFO;
+#pragma pack()
+
+#endif
diff --git a/Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLib.c 
b/Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLib.c
new file mode 100644
index ..e9efd7a2d5c2
--- /dev/null
+++ b/Platform/ARM/N1SdpPkg/Library/PlatformLib/PlatformLib.c
@@ -0,0 +1,67 @@
+/** @file
+*
+*  Copyright 

Re: [edk2-devel] [PATCH 1/1] BaseTools: convert diff.order to LF-only

2020-04-24 Thread Laszlo Ersek
On 04/22/20 17:46, Leif Lindholm wrote:
> SetupGit.py sets the git config option diff.orderFile to
> {edk2 directory}/BaseTools/Conf/diff.order, to override the default order
> in which files are shown in a diff/patch/whatever. This is in imitation
> of what is done manually in Laszlo's Unkempt Guide.
> 
> However, the version currently in the tree is in CRLF format, which makes
> git interpret e.g. *.c as matching on *.c, finding no matches and
> failing to apply the desired reordering. Note: this is true regardless of
> whether running on Linux or Windows.
> 
> Convert the file to LF-only to make it work as expected.
> 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Signed-off-by: Leif Lindholm 
> ---
> 
> I'm not going to reveal just how much time I wasted on this before I
> figured out what was going wrong...
> 
> I am intending to start prototyping the overall CRLF->native
> conversion shortly, but this needs resolving regardless, and in fact we
> will need to override the line ending conversion for this file in
> gitattributes. 
> 
> Arguably, the same logic could be applied to the gitattributes file
> itself (in the same directory), but since every effective line in that
> has an explicit option following the glob, it triggers no issues at
> present.
> 
> This bug is quite likely also behind some accusations I've made on
> people not following the correct patch submission process, for which I
> apologise.
> 
> Finally, a question: did we have some way of overriding the PatchCheck.py
> step in mergify? This patch gets an error per line...
> If not, should I submit a separate patch adding yet another exception to
> PatchCheck.py
> 
> /
> Leif
> 
>  BaseTools/Conf/diff.order | 26 +-
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/BaseTools/Conf/diff.order b/BaseTools/Conf/diff.order
> index 4361817012c9..f1534f6c187c 100644
> --- a/BaseTools/Conf/diff.order
> +++ b/BaseTools/Conf/diff.order
> @@ -1,13 +1,13 @@
> -#
> -# Copyright (c) 2019, Linaro Ltd. All rights reserved.
> -#
> -# SPDX-License-Identifier: BSD-2-Clause-Patent
> -#
> -*.dec
> -*.dsc.inc
> -*.dsc
> -*.fdf
> -*.inf
> -*.h
> -*.vfr
> -*.c
> +#
> +# Copyright (c) 2019, Linaro Ltd. All rights reserved.
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +*.dec
> +*.dsc.inc
> +*.dsc
> +*.fdf
> +*.inf
> +*.h
> +*.vfr
> +*.c
> 

Reviewed-by: Laszlo Ersek 

(I must admit that I use my multi-project shared order file, configured
in my ~/.gitconfig file.)

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58059): https://edk2.groups.io/g/devel/message/58059
Mute This Topic: https://groups.io/mt/73198992/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH V2 0/7] CryptoPkg: Retire the deprecated functions

2020-04-24 Thread Laszlo Ersek
Hi Zhichao,

On 04/23/20 10:46, Zhichao Gao wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1898
> 
> Retire below deprecated functions:
> MD4, ARC4, TDES, AES ECB MODE, HMAC MD5, HMAC SHA1
> 
> Update the Crypto Driver's version to indicate the binary change.
> 
> Cc: Jian J Wang 
> Cc: Xiaoyu Lu 
> Cc: Siyuan Fu 
> Cc: Michael D Kinney 
> Cc: Jiewen Yao 
> Cc: Laszlo Ersek 
> Signed-off-by: Zhichao Gao 
> 
> Zhichao Gao (7):
>   CryptoPkg/BaseCrpytLib: Retire MD4 algorithm
>   CryptoPkg/BaseCryptLib: Retire ARC4 algorithm
>   CryptoPkg/BaseCryptLib: Retire the Tdes algorithm
>   CryptoPkg/BaseCryptLib: Retire Aes Ecb mode algorithm
>   CryptoPkg/BaseCryptLib: Retire HMAC MD5 algorithm
>   CryptoPkg/BaseCryptLib: Retire HMAC SHA1 algorithm
>   CryptoPkg/Crypto.h: Update the version of Crypto Driver

I'm drowning in stuff to take care of; I cannot review this series.
Thanks for your understanding.

Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58058): https://edk2.groups.io/g/devel/message/58058
Mute This Topic: https://groups.io/mt/73214643/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 0/6] Edk2 Platform and Core CI for ArmVirtPkg, EmulatorPkg, and OvmfPkg

2020-04-24 Thread Ard Biesheuvel

On 4/24/20 2:12 PM, Laszlo Ersek wrote:

On 04/24/20 07:55, Sean Brogan wrote:

Thanks for providing feedback.
My V10 branch is up which will be sent to the mailing list tomorrow as the V3 
patch set unless there are any changes requested.

This now includes a 7th patch which converts the edk2 ReadMe.md to ReadMe.rst 
and shows the Platform CI status.  The other package ReadMe files that describe 
how to run locally have been updated to remove the status and some text 
changed.  Finally they were moved into the PlatformCI folder.  This should now 
align with Laszlo's requests.

https://github.com/spbrogan/edk2/tree/PlatformAndCoreCIForOvmfArmVirtEmulatorPackages_v10


For your commit 3ce12a4eaa4d ("ArmVirtPkg: Add Platform CI and
configuration for Core CI", 2020-04-23):

Acked-by: Laszlo Ersek 

For your commit bdd9493c68a7 ("OvmfPkg: Add Platform CI and
configuration for Core CI", 2020-04-23):

Acked-by: Laszlo Ersek 



Likewise.

For the 7 patches on the branch above, at commit d5e4e7a6d5e2823fcda5, 
wherever it matters (or where it doesn't)


Acked-by: Ard Biesheuvel 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58057): https://edk2.groups.io/g/devel/message/58057
Mute This Topic: https://groups.io/mt/73157228/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v3 4/6] Add BhyvePkg, to support the bhyve hypervisor

2020-04-24 Thread Laszlo Ersek
On 04/24/20 07:54, Rebecca Cran wrote:
> 
>> On Apr 23, 2020, at 3:42 AM, Laszlo Ersek  wrote:
>>
>> BUt, I *think* the language seen in "OvmfPkg/License.txt" should
>> accommodate that too. It goes:
>>
>>  Some files are subject to the following license, the [...] license.
>>  Those files are located in:
>>  - [directory]
>>  - [directory]
>>
>> It says "some files", and where they are. It doesn't seem to imply that
>> *all* files under those directories are covered by the non-default license.
>>
>> So please just list all those module directories in this (non-default)
>> part of "BhyvePkg/License.txt" that have *at least one* file covered by
>> "BSD-2-Clause".
> 
> 
> Would it also be ok to use the following language?
> 
> Some files are subject to the following license, the BSD-2-Clause license.
> Those files are located in:
> 
> AcpiPlatformDxe/Bhyve.c
> PlatformPei/MemDetect.c
> PlatformPei/Platform.c

probably "located *at*" (not "in"), if we are listing the files
themselves. And yes, this is entirely OK, as long as you can collect
those files individually!

> I think I’ve fixed the rest of the changes you’ve requested. I’m ready to 
> send the v4 series once I get clarification about whether I should add my own 
> copyright line to files I’ve copied from OvmfPkg and made no changes to, or 
> only deletions or other very minor changes.

I've attempted to answer that under your other email.

Thanks!
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58056): https://edk2.groups.io/g/devel/message/58056
Mute This Topic: https://groups.io/mt/73165367/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 0/6] Edk2 Platform and Core CI for ArmVirtPkg, EmulatorPkg, and OvmfPkg

2020-04-24 Thread Laszlo Ersek
On 04/24/20 14:12, Laszlo Ersek wrote:
> On 04/24/20 07:55, Sean Brogan wrote:
>> Thanks for providing feedback.  
>> My V10 branch is up which will be sent to the mailing list tomorrow as the 
>> V3 patch set unless there are any changes requested.
>>
>> This now includes a 7th patch which converts the edk2 ReadMe.md to 
>> ReadMe.rst and shows the Platform CI status.  The other package ReadMe files 
>> that describe how to run locally have been updated to remove the status and 
>> some text changed.  Finally they were moved into the PlatformCI folder.  
>> This should now align with Laszlo's requests.  
>>
>> https://github.com/spbrogan/edk2/tree/PlatformAndCoreCIForOvmfArmVirtEmulatorPackages_v10
> 
> For your commit 3ce12a4eaa4d ("ArmVirtPkg: Add Platform CI and
> configuration for Core CI", 2020-04-23):
> 
> Acked-by: Laszlo Ersek 
> 
> For your commit bdd9493c68a7 ("OvmfPkg: Add Platform CI and
> configuration for Core CI", 2020-04-23):
> 
> Acked-by: Laszlo Ersek 

For your commit d5e4e7a6d5e2 ("ReadMe: Convert to rst and add Platform
CI Status", 2020-04-23):

Reviewed-by: Laszlo Ersek 

as I've made a reasonable effort to proof-read it, in plaintext (not
rendered) format, comparing it to the format being replaced.

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58055): https://edk2.groups.io/g/devel/message/58055
Mute This Topic: https://groups.io/mt/73157228/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 0/6] Edk2 Platform and Core CI for ArmVirtPkg, EmulatorPkg, and OvmfPkg

2020-04-24 Thread Laszlo Ersek
On 04/24/20 07:55, Sean Brogan wrote:
> Thanks for providing feedback.  
> My V10 branch is up which will be sent to the mailing list tomorrow as the V3 
> patch set unless there are any changes requested.
> 
> This now includes a 7th patch which converts the edk2 ReadMe.md to ReadMe.rst 
> and shows the Platform CI status.  The other package ReadMe files that 
> describe how to run locally have been updated to remove the status and some 
> text changed.  Finally they were moved into the PlatformCI folder.  This 
> should now align with Laszlo's requests.  
> 
> https://github.com/spbrogan/edk2/tree/PlatformAndCoreCIForOvmfArmVirtEmulatorPackages_v10

For your commit 3ce12a4eaa4d ("ArmVirtPkg: Add Platform CI and
configuration for Core CI", 2020-04-23):

Acked-by: Laszlo Ersek 

For your commit bdd9493c68a7 ("OvmfPkg: Add Platform CI and
configuration for Core CI", 2020-04-23):

Acked-by: Laszlo Ersek 

Thanks!
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58054): https://edk2.groups.io/g/devel/message/58054
Mute This Topic: https://groups.io/mt/73157228/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH edk2-platforms 1/1] Silicon/NXP: rework IoAccessLib to use single function pointer struct

2020-04-24 Thread Leif Lindholm
On Thu, Apr 23, 2020 at 14:16:28 +, Pankaj Bansal wrote:
> 
> 
> > -Original Message-
> > From: Leif Lindholm 
> > Sent: Thursday, April 23, 2020 3:39 PM
> > To: devel@edk2.groups.io
> > Cc: Meenakshi Aggarwal ; Pankaj Bansal
> > 
> > Subject: [PATCH edk2-platforms 1/1] Silicon/NXP: rework IoAccessLib to use
> > single function pointer struct
> > 
> > For whatever reason, the function pointer structs (and their retrieval
> > functions) were split up on data size boundary - separate for 16-bit,
> > 32-bit, and 64-bit.
> > 
> > This makes the already tedious boilerplate require to deal with these
> > hardware quirks even worse, so unify them into a single function pointer
> > struct and retrieval function.
> > 
> > Cc: Meenakshi Aggarwal 
> > Cc: Pankaj Bansal 
> > Signed-off-by: Leif Lindholm 
> > ---
> > 
> > Meenakshi, Pankaj - I have no hardware to verify that this patch works,
> > but it builds cleanlyi and isn't exactly complex.
> > I will need R-b from at least one of you, and ideally Tested-by as well.
> > 
> 
> Reviewed-by: Pankaj Bansal 
> Tested-by: Pankaj Bansal 

Thanks!
Pushed as ce617e442c70.

/
Leif

> >  Silicon/NXP/Include/Library/IoAccessLib.h | 52 ++--
> >  Silicon/NXP/Library/IoAccessLib/IoAccessLib.c | 82 ---
> >  2 files changed, 22 insertions(+), 112 deletions(-)
> > 
> > diff --git a/Silicon/NXP/Include/Library/IoAccessLib.h
> > b/Silicon/NXP/Include/Library/IoAccessLib.h
> > index 0b708d544fa7..0f5b19dcf149 100644
> > --- a/Silicon/NXP/Include/Library/IoAccessLib.h
> > +++ b/Silicon/NXP/Include/Library/IoAccessLib.h
> > @@ -15,40 +15,26 @@
> >  ///  Structure to have pointer to R/W
> >  ///  Mmio operations for 16 bits.
> >  ///
> > -typedef struct _MMIO_OPERATIONS_16 {
> > +typedef struct _MMIO_OPERATIONS {
> >UINT16 (*Read16) (UINTN Address);
> >UINT16 (*Write16) (UINTN Address, UINT16 Value);
> >UINT16 (*Or16) (UINTN Address, UINT16 OrData);
> >UINT16 (*And16) (UINTN Address, UINT16 AndData);
> >UINT16 (*AndThenOr16) (UINTN Address, UINT16 AndData, UINT16 OrData);
> > -} MMIO_OPERATIONS_16;
> > -
> > -///
> > -///  Structure to have pointer to R/W
> > -///  Mmio operations for 32 bits.
> > -///
> > -typedef struct _MMIO_OPERATIONS_32 {
> >UINT32 (*Read32) (UINTN Address);
> >UINT32 (*Write32) (UINTN Address, UINT32 Value);
> >UINT32 (*Or32) (UINTN Address, UINT32 OrData);
> >UINT32 (*And32) (UINTN Address, UINT32 AndData);
> >UINT32 (*AndThenOr32) (UINTN Address, UINT32 AndData, UINT32 OrData);
> > -} MMIO_OPERATIONS_32;
> > -
> > -///
> > -///  Structure to have pointer to R/W
> > -///  Mmio operations for 64 bits.
> > -///
> > -typedef struct _MMIO_OPERATIONS_64 {
> >UINT64 (*Read64) (UINTN Address);
> >UINT64 (*Write64) (UINTN Address, UINT64 Value);
> >UINT64 (*Or64) (UINTN Address, UINT64 OrData);
> >UINT64 (*And64) (UINTN Address, UINT64 AndData);
> >UINT64 (*AndThenOr64) (UINTN Address, UINT64 AndData, UINT64 OrData);
> > -} MMIO_OPERATIONS_64;
> > +} MMIO_OPERATIONS;
> > 
> >  /**
> > -  Function to return pointer to 16 bit Mmio operations.
> > +  Function to return pointer to Mmio operations.
> > 
> >@param  Swap  Flag to tell if Swap is needed or not
> >  on Mmio Operations.
> > @@ -56,36 +42,8 @@ typedef struct _MMIO_OPERATIONS_64 {
> >@return   Pointer to Mmio Operations.
> > 
> >  **/
> > -MMIO_OPERATIONS_16 *
> > -GetMmioOperations16  (
> > -  IN  BOOLEAN  Swap
> > -  );
> > -
> > -/**
> > -  Function to return pointer to 32 bit Mmio operations.
> > -
> > -  @param  Swap  Flag to tell if Swap is needed or not
> > -on Mmio Operations.
> > -
> > -  @return   Pointer to Mmio Operations.
> > -
> > -**/
> > -MMIO_OPERATIONS_32 *
> > -GetMmioOperations32  (
> > -  IN  BOOLEAN  Swap
> > -  );
> > -
> > -/**
> > -  Function to return pointer to 64 bit Mmio operations.
> > -
> > -  @param  Swap  Flag to tell if Swap is needed or not
> > -on Mmio Operations.
> > -
> > -  @return   Pointer to Mmio Operations.
> > -
> > -**/
> > -MMIO_OPERATIONS_64 *
> > -GetMmioOperations64  (
> > +MMIO_OPERATIONS *
> > +GetMmioOperations  (
> >IN  BOOLEAN  Swap
> >);
> > 
> > diff --git a/Silicon/NXP/Library/IoAccessLib/IoAccessLib.c
> > b/Silicon/NXP/Library/IoAccessLib/IoAccessLib.c
> > index 6ed83d019a6e..33039afda40f 100644
> > --- a/Silicon/NXP/Library/IoAccessLib/IoAccessLib.c
> > +++ b/Silicon/NXP/Library/IoAccessLib/IoAccessLib.c
> > @@ -301,39 +301,17 @@ SwapMmioAnd64 (
> >return MmioAnd64 (Address, SwapBytes64 (AndData));
> >  }
> > 
> > -STATIC MMIO_OPERATIONS_16 SwappingFunctions16 = {
> > +STATIC MMIO_OPERATIONS SwappingFunctions = {
> >SwapMmioRead16,
> >SwapMmioWrite16,
> >SwapMmioOr16,
> >SwapMmioAnd16,
> >SwapMmioAndThenOr16,
> > -};
> > -
> > -STATIC MMIO_OPERATIONS_16 NonSwappingFunctions16 = {
> > -  MmioRead16,
> > -  MmioWrite16,
> > -  MmioOr16,
> > -  MmioAnd16,
> > - 

Re: [edk2-devel] [PATCH edk2-platforms v3 01/24] Silicon/NXP: Add I2c lib

2020-04-24 Thread Leif Lindholm
On Fri, Apr 24, 2020 at 06:53:15 +, Pankaj Bansal (OSS) wrote:
> > > +/**
> > > +  Early init I2C for reading the sysclk from I2c slave device.
> > > +  I2c bus clock is determined from the clock input to I2c controller.
> > > +  The clock input to I2c controller is derived from the sysclk.
> > > +  sysclk is determined by clock generator, which is controller by i2c.
> > > +
> > > +  So, it's a chicken-egg problem to read the sysclk from clock generator.
> > > +  To break this cycle (i.e. to read the sysclk), we setup the i2c bus 
> > > clock to
> > > +  lowest value, in the hope that it won't be out of clock generator's 
> > > supported
> > > +  i2c clock frequency. Once we have the correct sysclk, we can setup the
> > > +  correct i2c bus clock.
> > > +
> > > +  @param[in] Base   Base Address of I2c controller's registers
> > > +
> > > +  @return  EFI_SUCCESS  successfuly setup the i2c bus for reading sysclk
> > > +**/
> > > +EFI_STATUS
> > > +I2cEarlyInitialize (
> > > +  IN UINTN  Base
> > > +  )
> > > +{
> > > +  I2C_REGS *Regs;
> > > +  UINT8Ibfd;
> > > +
> > > +  Regs = (I2C_REGS *)Base;
> > > +  if (FeaturePcdGet (PcdI2cErratumA009203)) {
> > > +// Apply Erratum A-009203 before writing Ibfd register
> > 
> > It is an improvement, but there is still nothing in here that makes it
> > obvious why this is being done twice. The referenced u-boot patch does
> > it only once.
> 
> It's not necessary to call I2cEarlyInitialize for all I2c controllers.
> This function has been written so that i2c bus can be initialized to read the 
> system clock
> from a clock generator or an FPFA.
> 
> To make a call to I2cInitialize, we need to know the I2cBusClock, which is a 
> derivative of
> System clock. I2cBusClock is calculated after PLL multiplication to system 
> clock.
> Therefore, we won't be able to call I2cInitialize without knowing System 
> clock.
> 
> The idea is that for i2c controller to which clock generator or an FPFA is 
> connected, we first
> Call I2cEarlyInitialize. Then we read system clock and then we can call 
> I2cInitialize for that
> Controller as well as any other i2c controller(s) in the system.
> 
> So, for all i2c controllers (except one) I2cInitialize would be called and 
> not I2cEarlyInitialize

OK. So, I am OK with that as en end result, but since the function is
not used at all in this patchset, can it be purged from here and
introduced just before it is needed with a subsequent set?
That will make its intended use *much* more clear.

/
Leif

> > 
> > Hmm, furthermore, I don't see this function called at all? Why is it
> > included? If you delete it (and its declaration in .h), I'm OK with
> > the result.
> > 
> > > +I2cErratumA009203 (Base);
> > > +  }
> > > +
> > > +  if (MmioRead8 ((UINTN)>Ibdbg) & I2C_IBDBG_GLFLT_EN) {
> > > +Ibfd = ARRAY_LAST_ELEM (mI2cClockDivisorGlitchEnabled).Ibfd;
> > > +  } else {
> > > +Ibfd = ARRAY_LAST_ELEM (mI2cClockDivisorGlitchDisabled).Ibfd;
> > > +  }
> > > +
> > > +  MmioWrite8 ((UINTN)>Ibfd, Ibfd);
> > > +
> > > +  I2cReset (Base);
> > > +
> > > +  return EFI_SUCCESS;
> > > +}
> > >

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58052): https://edk2.groups.io/g/devel/message/58052
Mute This Topic: https://groups.io/mt/73008796/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH edk2-platforms v3 21/24] Platform/NXP: Use FV rules from ArmVirtPkg

2020-04-24 Thread Leif Lindholm
On Fri, Apr 24, 2020 at 06:24:55 +, Pankaj Bansal (OSS) wrote:
> > ArmVirtPkg
> > 
> > On Wed, Apr 15, 2020 at 17:43:39 +0530, Pankaj Bansal wrote:
> > > From: Pankaj Bansal 
> > >
> > > FVRules.fdf.inc is being replaced by the ArmVirtPkg/ArmVirtRules.fdf.inc
> > > at commit hash 746c5b6238f1ee55deb4b3ec32a6d732e27eeeaa
> > 
> > This is better - but why?
> > 
> 
> The intent is to remain as close as possible to reference platform, so that 
> any future changes can be ported easily.

Fair enough.
Reviewed-by: Leif Lindholm 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58051): https://edk2.groups.io/g/devel/message/58051
Mute This Topic: https://groups.io/mt/73008845/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v3 0/6] Add BhyvePkg, to support the bhyve hypervisor

2020-04-24 Thread Laszlo Ersek
On 04/22/20 18:48, Rebecca Cran wrote:
> On 4/22/20 9:21 AM, Laszlo Ersek wrote:
> 
>> OK, that makes sense -- but, without the ResetSystemLib instance, are
>> you able to boot the BhyvePkg platform firmware in a bhyve guest? Does
>> (for example) the "reset -c" UEFI Shell command work?
> 
> "reset -c" works, but "reset -s" doesn't. But that's a long-standing
> bug, going back to the UDK2014-based builds so I don't think it's ever
> worked.
> 
>> Does the ResetSystem runtime service work, in v3?
> 
> Rebooting works, but powering off doesn't, but as mentioned above that's
> not a regression.
> 
> 

OK, thanks!
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58050): https://edk2.groups.io/g/devel/message/58050
Mute This Topic: https://groups.io/mt/73165352/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v3 4/6] Add BhyvePkg, to support the bhyve hypervisor

2020-04-24 Thread Laszlo Ersek
On 04/23/20 22:08, Rebecca Cran wrote:
> 
>> On Apr 23, 2020, at 3:19 AM, Laszlo Ersek  wrote:
>>
>> (2) If you are contributing this new file in "Pluribus Networks, Inc"
>> colors, then please extend the year to 2020 on that line. Otherwise, if
>> you are contributing this on your own behalf (as work derived from
>> Pluribus Networks's earlier work), then please add your own (C) on top
>> as well, marking the year 2020.
>>
>> My point is that the year is 2020, when this file is being introduced in
>> edk2. Thus, there should be a (C) notice naming the year 2020.
> 
> Unfortunately I’m not contributing for Pluribus Networks — that’s why we have 
> to keep some files are BSD-2-Clause.
> Should I add my own copyright line for _all_ files I’m adding under BhyvePkg, 
> or just those that have new/changed content? For example there are several 
> files such as BhyvePkg/PlatformPei/AmdSev.c that I copied verbatim from 
> OvmfPkg that I’d feel especially uncomfortable with claiming copyright over.

If you're 100% sure that you are copying a file from elsewhere in the
tree, as it was at some particular commit of the git history, without
any changes introduced at all as part of the copying, then I guess it's
OK to not add your own copyright.

Normally, this is not difficult to verify for a reviewer, as the
"--find-copies-harder" option of "git show" can find the origin (the
file) of the copy, and display the copy (the new file) in terms of
changes to the origin.

However, the above only works in reference to the *direct pre-patch
state* of the tree. In other words, "--find-copies-harder" cannot
identify a file that, checked out at an *earlier* commit, could be
considered the origin of the copy you are creating *now*.

And given that some of these files were forked from edk2 master in 2014
or so (?), it's not easy to tell whether any difference *now* flagged by
"--find-copies-harder" is

- a difference introduced genuinely by your forking,
- or a more recent change to the *original* that has not been
forward-ported to your fork.

In such cases the ideal solution is to rebase the work; in other words,
re-fork the bhyve stuff from current edk2 / OvmfPkg content. But, I'm
not sure you have capacity for that; it may not be necessary even
functionally speaking; and even to me as the initial reviewer of
BhyvePkg content as one of the stewards, it only matters because of the
copyright notices. (And obviously I'm not a lawyer...)

So, if you are *completely* sure you didn't change anything on those
copies, relative to their fork-off point originals, then I guess it's OK
to not add your (C).

Thanks,
Laszlo

>> (9) I think we should delete the MIT license. At this stage, I can't see
>> anything MIT-covered under BhyvePkg. Do you agree?
> 
> Yes, I agree. I’ll proceed with that change.
> 
> — 
> Rebecca Cran
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58049): https://edk2.groups.io/g/devel/message/58049
Mute This Topic: https://groups.io/mt/73165367/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] FW: Discussion: Basetools a separate repo

2020-04-24 Thread Laszlo Ersek
On 04/22/20 21:30, macarl via [] wrote:
> I think you've got it. The version of basetools will be carried via a 
> pip-requirements file.
> 
> Where would "pip install -r pip-requirements.txt" *fetch* the required 
> basetools version from?
> I believe that it has a cache internal to pip. But if you want to fetch a 
> basetools that hasn't been fetched before, yes, it would require a network 
> download. Alternatively, if you're without internet access, you can check it 
> out locally and use the pip install -e.
> 
> Can you please explain the effects of the "pip install -e in more detail?
> So I'm a little murky on how it works but I believe that it creates symlinks 
> or some other mechanism to repoint the global python module (global meaning 
> your pip install or virtualenv). This is something that works automatically. 
> The setup.py in the root of the repo takes care of this since it's used also 
> to package the pip module. You can do pip install -e., and it just works 
> (tm). Any basetools commit you check out (once it is in it's own repo, going 
> back a given basetools commit two years ago is unfortunately not as easy) 
> will work with pip install -e with not setup or configuration on your part as 
> a developer. I use this whenever I work on the pytools and it works quite 
> well. It will also show up in the BuildToolsReport and pip freeze as being 
> locally installed and it will tell you the git commit it is currently at.
> 
> I agree- I think we're trending towards very very frequent releases for 
> basetools to provide high granularity. But that is pending community feedback 
> and the decision of the tools maintainer. It is certainly trivial to automate 
> the release pipeline in such a way that a release with every commit that 
> passes CI is easy and mostly automatic for the maintainers.

Thank you. All of the above sounds nice.

I'm carefully optimistic about these changes, and am not opposing them
at this point. I hope I can find the time to test these features once
they are being proposed in code form.

Regarding the frequent (automatic) release tagging for the separate
basetools repo -- that too sounds great; I just think it will need
manual work on the edk2 side, i.e. to keep "pip-requirements.txt"
bumped. While that work sounds quite "menial", I much hope that it can
be integrated into the basetools development requirements -- "whenever
you get something into basetools, and the system tags a new release
automatically, be sure to post a patch to edk2 for advancing it to the
new basetools release".

Thanks!
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58048): https://edk2.groups.io/g/devel/message/58048
Mute This Topic: https://groups.io/mt/73069134/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v4 3/3] BaseTools: BaseTools changes for RISC-V platform.

2020-04-24 Thread Bob Feng
Hi Abner,

I found the BaseTools build failure with GCC5 and this patch break Intel 
internal CI. Would you please have a check?

make[1]: Entering directory 
'/opt/TCAgent/work/184220821286c462/Edk2/BaseTools/Source/C/Common'
gcc  -c  -I .. -I ../Include/Common -I ../Include/ -I 
../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/X64/ -MD 
-fshort-wchar -fno-strict-aliasing -fwrapv -fno-delete-null-pointer-checks 
-Wall -Werror -Wno-deprecated-declarations -Wno-stringop-truncation 
-Wno-restrict -Wno-unused-result -nostdlib -g -O2  BasePeCoff.c -o BasePeCoff.o
In file included from BasePeCoff.c:16:0:
PeCoffLib.h:44:13: error: expected ')' before '+' token
   IN VOID   *FileHandle,
 ^
PeCoffLib.h:44:36: error: expected ')' before '&' token
PeCoffLib.h:67:3: error: unknown type name 'PE_COFF_LOADER_READ_FILE'
   UINT32ImageCodeMemoryType;
   ^
BasePeCoff.c: In function 'PeCoffLoaderGetPeHeader':
BasePeCoff.c:117:12: error: called object is not a function or function pointer
BasePeCoff.c: In function 'PeCoffLoaderGetImageInfo':
BasePeCoff.c:402:18: error: called object is not a function or function pointer
 if (DebugDirectoryEntryRva >= SectionHeader.VirtualAddress &&
  ^
BasePeCoff.c:429:20: error: called object is not a function or function pointer
   if (DebugEntry.Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
^
BasePeCoff.c:467:16: error: called object is not a function or function pointer
   if (DebugDirectoryEntryRva >= SectionHeader.VirtualAddress &&
^
BasePeCoff.c:521:18: error: called object is not a function or function pointer
 if (DebugEntry.Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
  ^
BasePeCoff.c: In function 'PeCoffLoaderLoadImage':
BasePeCoff.c:963:14: error: called object is not a function or function pointer
   ImageContext->PeCoffHeaderOffset +
  ^
BasePeCoff.c:984:14: error: called object is not a function or function pointer
BasePeCoff.c:1049:18: error: called object is not a function or function pointer
BasePeCoff.c:1056:18: error: called object is not a function or function pointer
BasePeCoff.c:1183:22: error: called object is not a function or function pointer
 // Should we apply fix up to this field according to the size 
difference between PE and TE?
  ^
BasePeCoff.c:1190:22: error: called object is not a function or function pointer
 ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
  ^
BasePeCoff.c: At top level:
cc1: error: unrecognized command line option '-Wno-restrict' [-Werror]
cc1: error: unrecognized command line option '-Wno-stringop-truncation' 
[-Werror]
cc1: all warnings being treated as errors
../Makefiles/footer.makefile:21: recipe for target 'BasePeCoff.o' failed
make[1]: *** [BasePeCoff.o] Error 1
make[1]: Leaving directory 
'/opt/TCAgent/work/184220821286c462/Edk2/BaseTools/Source/C/Common'
GNUmakefile:77: recipe for target 'Common' failed
make: *** [Common] Error 2
make: Leaving directory 
'/opt/TCAgent/work/184220821286c462/Edk2/BaseTools/Source/C'
Build environment: Linux-4.15.0-76-generic-x86_64-with-Ubuntu-16.04-xenial
Build start time: 10:39:01, Apr.23 2020

Thanks,
Bob

-Original Message-
From: Abner Chang  
Sent: Thursday, April 23, 2020 9:53 PM
To: devel@edk2.groups.io
Cc: abner.ch...@hpe.com; Gilbert Chen ; Daniel Helmut 
Schaefer ; Leif Lindholm ; 
Feng, Bob C ; Gao, Liming 
Subject: [PATCH v4 3/3] BaseTools: BaseTools changes for RISC-V platform.

Tools definitions template file changes for building EDK2 RISC-V platform.

Signed-off-by: Abner Chang 
Co-authored-by: Gilbert Chen 
Co-authored-by: Daniel Helmut Schaefer 
Reviewed-by: Leif Lindholm 

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Leif Lindholm 
Cc: Gilbert Chen 
---
 BaseTools/Conf/tools_def.template | 53 +--
 1 file changed, 51 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 88d7ab8cab..c7e19f4544 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3,7 +3,7 @@
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.

 #  Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.

 #  Copyright (c) 2015, Hewlett-Packard Development Company, L.P.

-#  (C) Copyright 2016 Hewlett Packard Enterprise Development LP

+#  (C) Copyright 2020, Hewlett Packard Enterprise Development LP

 #  Copyright (c) Microsoft Corporation

 #

 #  SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -267,11 +267,12 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
 #   Intel(r) ACPI Compiler from

 #   https://acpica.org/downloads

 #   GCC5-Linux,Windows-  Requires:

-# GCC 5 with LTO support, targeting 
x86_64-linux-gnu, 

Re: [edk2-devel] [PATCH 1/1] ShellPkg: Add support for input with separately reported modifiers

2020-04-24 Thread Laszlo Ersek
On 04/22/20 18:55, vit9696 wrote:

> In fact, there are really many mistakes in UEFI spec even besides
> this one, but we do not know where to report them. E.g. last thing we
> saw was ByRegisterNotify description in LocateHandleBuffer, which was
> mistakingly copy-pasted from LocateHandle.
Please join the UEFI forum:

https://uefi.org/membership

And then you get access to the Mantis bug tracker where you can file
tickets about UEFI spec issues.

(Most recently, I filed
 just this Monday,
about some typos in the UEFI spec.)

Personally, I used the "Company Representative Sign Up" form, because
Red Hat had already been a "contributing member" company
.

If your company doesn't want that kind of (paid) membership, I think you
-- plural -- could become an "adopter", or you -- singular -- could even
become an "individual adopter".

The page  lists a number of individual
adopters, so it's definitely a functional process. And I believe
individual adopters can access the Mantis bug tracker.

Michael and Andrew, please correct the above if necessary.

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58046): https://edk2.groups.io/g/devel/message/58046
Mute This Topic: https://groups.io/mt/71133729/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH] NetworkPkg/IScsiDxe: Enhance the check for array boundary

2020-04-24 Thread Zhang, Shenglei
Array 'TargetUrl' of size 255 may use index value(s) 255 and 256.
So enhance the boundary check to ensure the index is valid.

Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Signed-off-by: Shenglei Zhang 
---
 NetworkPkg/IScsiDxe/IScsiDhcp.c  | 2 +-
 NetworkPkg/IScsiDxe/IScsiDhcp6.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp.c b/NetworkPkg/IScsiDxe/IScsiDhcp.c
index 7ce9bf575012..afa8a86cd419 100644
--- a/NetworkPkg/IScsiDxe/IScsiDhcp.c
+++ b/NetworkPkg/IScsiDxe/IScsiDhcp.c
@@ -122,7 +122,7 @@ IScsiDhcpExtractRootPath (
   //
   if ((!NET_IS_DIGIT (*(Field->Str))) && (*(Field->Str) != '[')) {
 ConfigNvData->DnsMode = TRUE;
-if (Field->Len > sizeof (ConfigNvData->TargetUrl)) {
+if ((Field->Len + 2) > sizeof (ConfigNvData->TargetUrl)) {
   return EFI_INVALID_PARAMETER;
 }
 CopyMem (>TargetUrl, Field->Str, Field->Len);
diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp6.c b/NetworkPkg/IScsiDxe/IScsiDhcp6.c
index 86a872adeccc..691650b7334f 100644
--- a/NetworkPkg/IScsiDxe/IScsiDhcp6.c
+++ b/NetworkPkg/IScsiDxe/IScsiDhcp6.c
@@ -161,7 +161,7 @@ IScsiDhcp6ExtractRootPath (
   // Server name is expressed as domain name, just save it.
   //
   if (ConfigNvData->DnsMode) {
-if (Field->Len > sizeof (ConfigNvData->TargetUrl)) {
+if ((Field->Len + 2) > sizeof (ConfigNvData->TargetUrl)) {
   return EFI_INVALID_PARAMETER;
 }
 CopyMem (>TargetUrl, Field->Str, Field->Len);
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58045): https://edk2.groups.io/g/devel/message/58045
Mute This Topic: https://groups.io/mt/73237833/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 1/7] OvmfPkg: introduce QemuFwCfgSimpleParserLib

2020-04-24 Thread Philippe Mathieu-Daudé

On 4/24/20 9:53 AM, Laszlo Ersek wrote:

We already parse some boolean and integer values from named fw_cfg files
(usually into PCDs), and we're going to cover more. Add a dedicated
library for centralizing the parsing logic.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Per Sundstrom 
Cc: Philippe Mathieu-Daudé 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2681
Signed-off-by: Laszlo Ersek 
---
  OvmfPkg/OvmfPkg.dec   |   4 +
  OvmfPkg/OvmfPkgIa32.dsc   |   1 +
  OvmfPkg/OvmfPkgIa32X64.dsc|   1 +
  OvmfPkg/OvmfPkgX64.dsc|   1 +
  OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h| 128 
+++
  OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf |  27 ++
  OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParser.c  | 398 

  7 files changed, 560 insertions(+)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 28030391cff2..8a46fe73344e 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -60,6 +60,10 @@ [LibraryClasses]
#
QemuFwCfgS3Lib|Include/Library/QemuFwCfgS3Lib.h
  
+  ##  @libraryclass  Parse the contents of named fw_cfg files as simple

+  #  (scalar) data types.
+  QemuFwCfgSimpleParserLib|Include/Library/QemuFwCfgSimpleParserLib.h
+
##  @libraryclass  Rewrite the BootOrder NvVar based on QEMU's "bootorder"
#  fw_cfg file.
#
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index d5e90c001370..5e2972063110 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -160,6 +160,7 @@ [LibraryClasses]
UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf

SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
+  
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf

MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/BaseMemEncryptSevLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 066f49aeaee0..18e6909a33fa 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -164,6 +164,7 @@ [LibraryClasses]
UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf

SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
+  
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf

MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/BaseMemEncryptSevLib.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index ac510522a9ff..3d24cc4c1cfb 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -164,6 +164,7 @@ [LibraryClasses]
UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf

SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
+  
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf

MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/BaseMemEncryptSevLib.inf
diff --git a/OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h 
b/OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h
new file mode 100644
index ..c6062bae8770
--- /dev/null
+++ b/OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h
@@ -0,0 +1,128 @@
+/** @file
+  Parse the contents of named fw_cfg files as simple (scalar) data types.
+
+  Copyright (C) 2020, Red Hat, Inc.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef QEMU_FW_CFG_SIMPLE_PARSER_LIB_H_
+#define QEMU_FW_CFG_SIMPLE_PARSER_LIB_H_
+
+#include 
+
+/**
+  Look up FileName with QemuFwCfgFindFile() from QemuFwCfgLib. Read the fw_cfg
+  file into a small array with automatic storage duration. Parse the array as
+  the textual representation of a BOOLEAN.
+
+  @param[in] FileName  The name of the fw_cfg file to look up and parse.
+
+  @param[out] ValueOn success, Value is TRUE if the contents of the fw_cfg
+   file case-insensitively match "true", "yes", "y",
+   "enable", "enabled", "1".
+
+   On success, Value is FALSE if the contents of the fw_cfg
+   file case-insensitively match "false", "no", "n",
+   "disable", "disabled", "0".
+
+   

Re: [edk2-devel] [PATCH 0/7] OvmfPkg, ArmVirtPkg: control PXE v4/v6 boot support from the QEMU cmdline

2020-04-24 Thread Ard Biesheuvel

On 4/24/20 9:53 AM, Laszlo Ersek wrote:

Ref:https://bugzilla.tianocore.org/show_bug.cgi?id=2681
Repo:   https://pagure.io/lersek/edk2.git
Branch: pxe_fw_cfg

With this series applied, the QEMU command line options listed below
control whether the guest firmware supports PXEv4 / PXEv6 boot. And
correspondingly, whether UefiBootManagerLib generates *new* PXEv4 /
PXEv6 boot options automatically. (Existent boot options are never
deleted in response to just the flags below.)

   -fw_cfg name=opt/org.tianocore/IPv4PXESupport,string=[yn]

   -fw_cfg name=opt/org.tianocore/IPv6PXESupport,string=[yn]

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Leif Lindholm 
Cc: Per Sundstrom 
Cc: Philippe Mathieu-Daudé 

Thanks
Laszlo

Laszlo Ersek (7):
   OvmfPkg: introduce QemuFwCfgSimpleParserLib
   OvmfPkg/PlatformPei: parse "X-PciMmio64Mb" with
 QemuFwCfgSimpleParserLib
   OvmfPkg/PlatformPei: use QemuFwCfgParseBool in
 UPDATE_BOOLEAN_PCD_FROM_...
   OvmfPkg/QemuFwCfgDxeLib: allow UEFI_DRIVER modules
   OvmfPkg: control PXEv4 / PXEv6 boot support from the QEMU command line
   ArmVirtPkg/QemuFwCfgLib: allow UEFI_DRIVER modules
   ArmVirtPkg: control PXEv4 / PXEv6 boot support from the QEMU command
 line



Very useful,thanks!

For the series,

Reviewed-by: Ard Biesheuvel 


  ArmVirtPkg/ArmVirtQemu.dsc|  13 +
  ArmVirtPkg/ArmVirtQemuKernel.dsc  |  13 +
  ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf  |   2 +-
  OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h| 128 
+++
  OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcd.c|  39 ++
  OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcdProducerLib.inf   |  33 ++
  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf  |   2 +-
  OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParser.c  | 398 

  OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf |  27 ++
  OvmfPkg/OvmfPkg.dec   |   4 +
  OvmfPkg/OvmfPkgIa32.dsc   |  10 +
  OvmfPkg/OvmfPkgIa32X64.dsc|  11 +
  OvmfPkg/OvmfPkgX64.dsc|  10 +
  OvmfPkg/PlatformPei/MemDetect.c   |  36 +-
  OvmfPkg/PlatformPei/Platform.c|  47 
+--
  OvmfPkg/PlatformPei/PlatformPei.inf   |   1 +
  16 files changed, 712 insertions(+), 62 deletions(-)
  create mode 100644 OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h
  create mode 100644 OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcd.c
  create mode 100644 OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcdProducerLib.inf
  create mode 100644 
OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParser.c
  create mode 100644 
OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58043): https://edk2.groups.io/g/devel/message/58043
Mute This Topic: https://groups.io/mt/73236891/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 3/7] OvmfPkg/PlatformPei: use QemuFwCfgParseBool in UPDATE_BOOLEAN_PCD_FROM_...

2020-04-24 Thread Philippe Mathieu-Daudé

On 4/24/20 9:53 AM, Laszlo Ersek wrote:

The UPDATE_BOOLEAN_PCD_FROM_FW_CFG() macro currently calls the
module-private helper function GetNamedFwCfgBoolean(). Replace the latter
with QemuFwCfgParseBool() from QemuFwCfgSimpleParserLib.

This change is compatible with valid strings accepted previously.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Per Sundstrom 
Cc: Philippe Mathieu-Daudé 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2681
Signed-off-by: Laszlo Ersek 
---
  OvmfPkg/PlatformPei/Platform.c | 47 +---
  1 file changed, 2 insertions(+), 45 deletions(-)

diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 088e616a980c..3b850c2c2626 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -27,6 +27,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -254,56 +255,12 @@ MemMapInitialization (
ASSERT_RETURN_ERROR (PcdStatus);
  }
  
-EFI_STATUS

-GetNamedFwCfgBoolean (
-  IN  CHAR8   *FwCfgFileName,
-  OUT BOOLEAN *Setting
-  )
-{
-  EFI_STATUS   Status;
-  FIRMWARE_CONFIG_ITEM FwCfgItem;
-  UINTNFwCfgSize;
-  UINT8Value[3];
-
-  Status = QemuFwCfgFindFile (FwCfgFileName, , );
-  if (EFI_ERROR (Status)) {
-return Status;
-  }
-  if (FwCfgSize > sizeof Value) {
-return EFI_BAD_BUFFER_SIZE;
-  }
-  QemuFwCfgSelectItem (FwCfgItem);
-  QemuFwCfgReadBytes (FwCfgSize, Value);


Until here QemuFwCfgGetAsString(), OK.


-
-  if ((FwCfgSize == 1) ||
-  (FwCfgSize == 2 && Value[1] == '\n') ||
-  (FwCfgSize == 3 && Value[1] == '\r' && Value[2] == '\n')) {


StripNewline(), OK.


-switch (Value[0]) {
-  case '0':
-  case 'n':
-  case 'N':
-*Setting = FALSE;


mFalseString[], OK.

(And we get disable[d] + false).


-return EFI_SUCCESS;
-
-  case '1':
-  case 'y':
-  case 'Y':
-*Setting = TRUE;


mTrueString[], OK.

(And we get enable[d] + true).


-return EFI_SUCCESS;
-
-  default:
-break;
-}
-  }
-  return EFI_PROTOCOL_ERROR;
-}
-
  #define UPDATE_BOOLEAN_PCD_FROM_FW_CFG(TokenName)   \
do {  \
  BOOLEAN   Setting;  \
  RETURN_STATUS PcdStatus;\
  \
-if (!EFI_ERROR (GetNamedFwCfgBoolean (  \
+if (!RETURN_ERROR (QemuFwCfgParseBool ( \


:)

Reviewed-by: Philippe Mathieu-Daude 


"opt/ovmf/" #TokenName, ))) { \
PcdStatus = PcdSetBoolS (TokenName, Setting); \
ASSERT_RETURN_ERROR (PcdStatus);  \




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58042): https://edk2.groups.io/g/devel/message/58042
Mute This Topic: https://groups.io/mt/73236894/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 2/7] OvmfPkg/PlatformPei: parse "X-PciMmio64Mb" with QemuFwCfgSimpleParserLib

2020-04-24 Thread Philippe Mathieu-Daudé

On 4/24/20 9:53 AM, Laszlo Ersek wrote:

Replace the

- QemuFwCfgFindFile(),
- QemuFwCfgSelectItem(),
- QemuFwCfgReadBytes(),
- AsciiStrDecimalToUint64()

sequence in the GetFirstNonAddress() function with a call to
QemuFwCfgSimpleParserLib.

This change is compatible with valid strings accepted previously.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Per Sundstrom 
Cc: Philippe Mathieu-Daudé 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2681
Signed-off-by: Laszlo Ersek 
---
  OvmfPkg/PlatformPei/PlatformPei.inf |  1 +
  OvmfPkg/PlatformPei/MemDetect.c | 36 
  2 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf 
b/OvmfPkg/PlatformPei/PlatformPei.inf
index 19f2424981bc..e72ef7963d97 100644
--- a/OvmfPkg/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/PlatformPei/PlatformPei.inf
@@ -60,6 +60,7 @@ [LibraryClasses]
PeimEntryPoint
QemuFwCfgLib
QemuFwCfgS3Lib
+  QemuFwCfgSimpleParserLib
MtrrLib
MemEncryptSevLib
PcdLib
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
index 47dc9c543719..f32df937f9ba 100644
--- a/OvmfPkg/PlatformPei/MemDetect.c
+++ b/OvmfPkg/PlatformPei/MemDetect.c
@@ -33,6 +33,7 @@ Module Name:
  #include 
  #include 
  #include 
+#include 
  
  #include "Platform.h"

  #include "Cmos.h"
@@ -336,7 +337,7 @@ GetFirstNonAddress (
  {
UINT64   FirstNonAddress;
UINT64   Pci64Base, Pci64Size;
-  CHAR8MbString[7 + 1];


Replaced by UINT64_STRING_MAX_SIZE + CRLF_LENGTH, way safer.


+  UINT32   FwCfgPciMmio64Mb;
EFI_STATUS   Status;
FIRMWARE_CONFIG_ITEM FwCfgItem;
UINTNFwCfgSize;
@@ -379,25 +380,30 @@ GetFirstNonAddress (
  
//

// See if the user specified the number of megabytes for the 64-bit PCI host
-  // aperture. The number of non-NUL characters in MbString allows for
-  // 9,999,999 MB, which is approximately 10 TB.
+  // aperture. Accept an aperture size up to 16TB.
//
// As signaled by the "X-" prefix, this knob is experimental, and might go
// away at any time.
//
-  Status = QemuFwCfgFindFile ("opt/ovmf/X-PciMmio64Mb", ,
- );
-  if (!EFI_ERROR (Status)) {
-if (FwCfgSize >= sizeof MbString) {
-  DEBUG ((EFI_D_WARN,
-"%a: ignoring malformed 64-bit PCI host aperture size from fw_cfg\n",
-__FUNCTION__));
-} else {
-  QemuFwCfgSelectItem (FwCfgItem);
-  QemuFwCfgReadBytes (FwCfgSize, MbString);


Up to here is QemuFwCfgGetAsString(), OK.


-  MbString[FwCfgSize] = '\0';


StripNewline(), OK.


-  Pci64Size = LShiftU64 (AsciiStrDecimalToUint64 (MbString), 20);
+  Status = QemuFwCfgParseUint32 ("opt/ovmf/X-PciMmio64Mb", FALSE,


ParseAsHex=False, so we use AsciiStrDecimalToUint64S(), OK.


+ );
+  switch (Status) {
+  case EFI_UNSUPPORTED:
+  case EFI_NOT_FOUND:
+break;
+  case EFI_SUCCESS:
+if (FwCfgPciMmio64Mb <= 0x100) {
+  Pci64Size = LShiftU64 (FwCfgPciMmio64Mb, 20);


16TB, OK.


+  break;
  }
+//
+// fall through
+//
+  default:
+DEBUG ((DEBUG_WARN,
+  "%a: ignoring malformed 64-bit PCI host aperture size from fw_cfg\n",
+  __FUNCTION__));
+break;
}
  
if (Pci64Size == 0) {




The new API is very clean!

Reviewed-by: Philippe Mathieu-Daude 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58041): https://edk2.groups.io/g/devel/message/58041
Mute This Topic: https://groups.io/mt/73236892/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v3 2/2] UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI.

2020-04-24 Thread Dong, Eric
From: "Dong, Eric" 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2683

In PEI phase, AP already been waked up through ApInitConfig,
so it can directly wake up it through change wakup buffer
instead of use ApInitReconfig flag. It can save some time.

Change code to only use ApInitReconfig flag in DXE phase
which must need to update the wake up buffer.

Cc: Laszlo Ersek 
Cc: Chandana Kumar 
Signed-off-by: Eric Dong 
Reviewed-by: Ray Ni 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 7fd757b428..64528fd1e7 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1820,7 +1820,14 @@ MpInitLibInitialize (
   // Wakeup APs to do some AP initialize sync (Microcode & MTRR)
   //
   if (CpuMpData->CpuCount > 1) {
-CpuMpData->InitFlag = ApInitReconfig;
+if (OldCpuMpData != NULL) {
+  //
+  // Only needs to use this flag for DXE phase to update the wake up
+  // buffer. Wakeup buffer allocated in PEI phase is no longer valid
+  // in DXE.
+  //
+  CpuMpData->InitFlag = ApInitReconfig;
+}
 WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData, TRUE);
 //
 // Wait for all APs finished initialization
@@ -1828,7 +1835,9 @@ MpInitLibInitialize (
 while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {
   CpuPause ();
 }
-CpuMpData->InitFlag = ApInitDone;
+if (OldCpuMpData != NULL) {
+  CpuMpData->InitFlag = ApInitDone;
+}
 for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
   SetApState (>CpuData[Index], CpuStateIdle);
 }
-- 
2.23.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58038): https://edk2.groups.io/g/devel/message/58038
Mute This Topic: https://groups.io/mt/73237632/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v3 0/2] UefiCpuPkg/MpInitLib: Fix ASSERT in AP procedure

2020-04-24 Thread Dong, Eric
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2683
 
This patch serial used to fix an ASSERT issue. Because AP can't find
the CpuMpData through IDT, it raised the ASSERT.

V3:
1. Remove invalid save Volatile Registers process. Refine restore
   Volatile Registers process.

V2: 
1. Enhance code comments.
2. Enhance code to remove CpuMpData->ApLoopMode == ApInHltLoop check.
 
Cc: Ray Ni  
Cc: Laszlo Ersek  
Cc: Chandana Kumar  


Eric Dong (2):
  UefiCpuPkg/MpInitLib: Restore IDT context for APs.
  UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI.

 UefiCpuPkg/Library/MpInitLib/MpLib.c | 47 
 1 file changed, 34 insertions(+), 13 deletions(-)

-- 
2.23.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58039): https://edk2.groups.io/g/devel/message/58039
Mute This Topic: https://groups.io/mt/73237633/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v3 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.

2020-04-24 Thread Dong, Eric
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2683

This patch fixes an assertion because AP can't find the CpuMpData.
When AP is waken up through Init-Sipi-Sipi, AP's IDT should
be restored to pre-allocated buffer so AP can get the CpuMpData
through the IDT base address.
Current code already has logic to handle this when CpuMpData->
InitFlag is ApInitConfig but misses the logic
when CpuMpData->InitFlag is ApInitReconfig.
This patch fixes this gap.

Cc: Ray Ni 
Cc: Laszlo Ersek 
Cc: Chandana Kumar 
Signed-off-by: Eric Dong 
---
V3:
  Remove invalid save volatile registers process. Refine restore
  volatile registers process.

V2: 
  Enhance code to remove CpuMpData->ApLoopMode == ApInHltLoop check. 

 UefiCpuPkg/Library/MpInitLib/MpLib.c | 34 +++-
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 64a4c3546e..7fd757b428 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -686,18 +686,31 @@ ApWakeupFunction (
 WAKEUP_AP_SIGNAL,
 0
 );
-  if (CpuMpData->ApLoopMode == ApInHltLoop) {
-//
-// Restore AP's volatile registers saved
-//
-RestoreVolatileRegisters 
(>CpuData[ProcessorNumber].VolatileRegisters, TRUE);
-  } else {
+
+  if (CpuMpData->InitFlag == ApInitReconfig) {
 //
-// The CPU driver might not flush TLB for APs on spot after updating
-// page attributes. AP in mwait loop mode needs to take care of it when
-// woken up.
+// ApInitReconfig happens when:
+// 1. AP is re-enabled after it's disabled, in either PEI or DXE phase.
+// 2. AP is initialized in DXE phase. 
+// In either case, use the volatile registers value derived from BSP.
+// NOTE: IDTR.BASE stored in CpuMpData->CpuData[0].VolatileRegisters 
points to a
+//   different IDT shared by all APs.
 //
-CpuFlushTlb ();
+RestoreVolatileRegisters (>CpuData[0].VolatileRegisters, 
FALSE);
+  }  else {
+if (CpuMpData->ApLoopMode == ApInHltLoop) {
+  //
+  // Restore AP's volatile registers saved before AP is halted
+  //
+  RestoreVolatileRegisters 
(>CpuData[ProcessorNumber].VolatileRegisters, TRUE);
+} else {
+  //
+  // The CPU driver might not flush TLB for APs on spot after updating
+  // page attributes. AP in mwait loop mode needs to take care of it 
when
+  // woken up.
+  //
+  CpuFlushTlb ();
+}
   }
 
   if (GetApState (>CpuData[ProcessorNumber]) == CpuStateReady) {
@@ -1780,7 +1793,6 @@ MpInitLibInitialize (
   InitializeSpinLock(>CpuData[Index].ApLock);
   CpuMpData->CpuData[Index].CpuHealthy = (CpuInfoInHob[Index].Health == 
0)? TRUE:FALSE;
   CpuMpData->CpuData[Index].ApFunction = 0;
-  CopyMem (>CpuData[Index].VolatileRegisters, 
, sizeof (CPU_VOLATILE_REGISTERS));
 }
   }
 
-- 
2.23.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58040): https://edk2.groups.io/g/devel/message/58040
Mute This Topic: https://groups.io/mt/73237635/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 7/7] ArmVirtPkg: control PXEv4 / PXEv6 boot support from the QEMU command line

2020-04-24 Thread Laszlo Ersek
Port the DSC file changes from the similarly titled OvmfPkg patch in this
series to ArmVirtPkg.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Per Sundstrom 
Cc: Philippe Mathieu-Daudé 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2681
Signed-off-by: Laszlo Ersek 
---
 ArmVirtPkg/ArmVirtQemu.dsc   | 13 +
 ArmVirtPkg/ArmVirtQemuKernel.dsc | 13 +
 2 files changed, 26 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 1233f1ece484..3f649c91d8d6 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -58,6 +58,7 @@ [LibraryClasses.common]
   
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
   QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
   QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
+  
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
   
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
 
   
ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
@@ -256,6 +257,12 @@ [PcdsDynamicDefault.common]
   gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosDocRev|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated|FALSE
 
+  #
+  # IPv4 and IPv6 PXE Boot support.
+  #
+  gEfiNetworkPkgTokenSpaceGuid.PcdIPv4PXESupport|0x01
+  gEfiNetworkPkgTokenSpaceGuid.PcdIPv6PXESupport|0x01
+
   #
   # TPM2 support
   #
@@ -430,6 +437,12 @@ [Components.common]
   # Networking stack
   #
 !include NetworkPkg/NetworkComponents.dsc.inc
+
+  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf {
+
+  NULL|OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcdProducerLib.inf
+  }
+
 !if $(NETWORK_TLS_ENABLE) == TRUE
   NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf {
 
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index 0af91f21b7b7..2a6fd6bc06be 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -56,6 +56,7 @@ [LibraryClasses.common]
   
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
   QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
   QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
+  
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
   
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
 
   
ArmVirtMemInfoLib|ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf
@@ -239,6 +240,12 @@ [PcdsDynamicDefault.common]
   gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosDocRev|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated|FALSE
 
+  #
+  # IPv4 and IPv6 PXE Boot support.
+  #
+  gEfiNetworkPkgTokenSpaceGuid.PcdIPv4PXESupport|0x01
+  gEfiNetworkPkgTokenSpaceGuid.PcdIPv6PXESupport|0x01
+
 

 #
 # Components Section - list of all EDK II Modules needed by this Platform
@@ -369,6 +376,12 @@ [Components.common]
   # Networking stack
   #
 !include NetworkPkg/NetworkComponents.dsc.inc
+
+  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf {
+
+  NULL|OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcdProducerLib.inf
+  }
+
 !if $(NETWORK_TLS_ENABLE) == TRUE
   NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf {
 
-- 
2.19.1.3.g30247aa5d201


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58037): https://edk2.groups.io/g/devel/message/58037
Mute This Topic: https://groups.io/mt/73236898/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 2/7] OvmfPkg/PlatformPei: parse "X-PciMmio64Mb" with QemuFwCfgSimpleParserLib

2020-04-24 Thread Laszlo Ersek
Replace the

- QemuFwCfgFindFile(),
- QemuFwCfgSelectItem(),
- QemuFwCfgReadBytes(),
- AsciiStrDecimalToUint64()

sequence in the GetFirstNonAddress() function with a call to
QemuFwCfgSimpleParserLib.

This change is compatible with valid strings accepted previously.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Per Sundstrom 
Cc: Philippe Mathieu-Daudé 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2681
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/PlatformPei/PlatformPei.inf |  1 +
 OvmfPkg/PlatformPei/MemDetect.c | 36 
 2 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf 
b/OvmfPkg/PlatformPei/PlatformPei.inf
index 19f2424981bc..e72ef7963d97 100644
--- a/OvmfPkg/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/PlatformPei/PlatformPei.inf
@@ -60,6 +60,7 @@ [LibraryClasses]
   PeimEntryPoint
   QemuFwCfgLib
   QemuFwCfgS3Lib
+  QemuFwCfgSimpleParserLib
   MtrrLib
   MemEncryptSevLib
   PcdLib
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
index 47dc9c543719..f32df937f9ba 100644
--- a/OvmfPkg/PlatformPei/MemDetect.c
+++ b/OvmfPkg/PlatformPei/MemDetect.c
@@ -33,6 +33,7 @@ Module Name:
 #include 
 #include 
 #include 
+#include 
 
 #include "Platform.h"
 #include "Cmos.h"
@@ -336,7 +337,7 @@ GetFirstNonAddress (
 {
   UINT64   FirstNonAddress;
   UINT64   Pci64Base, Pci64Size;
-  CHAR8MbString[7 + 1];
+  UINT32   FwCfgPciMmio64Mb;
   EFI_STATUS   Status;
   FIRMWARE_CONFIG_ITEM FwCfgItem;
   UINTNFwCfgSize;
@@ -379,25 +380,30 @@ GetFirstNonAddress (
 
   //
   // See if the user specified the number of megabytes for the 64-bit PCI host
-  // aperture. The number of non-NUL characters in MbString allows for
-  // 9,999,999 MB, which is approximately 10 TB.
+  // aperture. Accept an aperture size up to 16TB.
   //
   // As signaled by the "X-" prefix, this knob is experimental, and might go
   // away at any time.
   //
-  Status = QemuFwCfgFindFile ("opt/ovmf/X-PciMmio64Mb", ,
- );
-  if (!EFI_ERROR (Status)) {
-if (FwCfgSize >= sizeof MbString) {
-  DEBUG ((EFI_D_WARN,
-"%a: ignoring malformed 64-bit PCI host aperture size from fw_cfg\n",
-__FUNCTION__));
-} else {
-  QemuFwCfgSelectItem (FwCfgItem);
-  QemuFwCfgReadBytes (FwCfgSize, MbString);
-  MbString[FwCfgSize] = '\0';
-  Pci64Size = LShiftU64 (AsciiStrDecimalToUint64 (MbString), 20);
+  Status = QemuFwCfgParseUint32 ("opt/ovmf/X-PciMmio64Mb", FALSE,
+ );
+  switch (Status) {
+  case EFI_UNSUPPORTED:
+  case EFI_NOT_FOUND:
+break;
+  case EFI_SUCCESS:
+if (FwCfgPciMmio64Mb <= 0x100) {
+  Pci64Size = LShiftU64 (FwCfgPciMmio64Mb, 20);
+  break;
 }
+//
+// fall through
+//
+  default:
+DEBUG ((DEBUG_WARN,
+  "%a: ignoring malformed 64-bit PCI host aperture size from fw_cfg\n",
+  __FUNCTION__));
+break;
   }
 
   if (Pci64Size == 0) {
-- 
2.19.1.3.g30247aa5d201



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58031): https://edk2.groups.io/g/devel/message/58031
Mute This Topic: https://groups.io/mt/73236892/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 4/7] OvmfPkg/QemuFwCfgDxeLib: allow UEFI_DRIVER modules

2020-04-24 Thread Laszlo Ersek
We don't distribute UEFI_DRIVER modules stand-alone that were built as
part of an OVMF platform. OVMF's UEFI_DRIVERs are allowed to inherit
platform dependencies.

By enabling UEFI_DRIVERs to consume QemuFwCfgDxeLib, we can hook
fw_cfg-based NULL class libraries into UEFI drivers, e.g. in order to set
dynamic PCDs.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Per Sundstrom 
Cc: Philippe Mathieu-Daudé 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2681
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf 
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
index c331c5e7220a..48899ff1236a 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
@@ -16,7 +16,7 @@ [Defines]
   FILE_GUID  = 80474090-55e7-4c28-b25c-9f236ba41f28
   MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = QemuFwCfgLib|DXE_DRIVER DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER
+  LIBRARY_CLASS  = QemuFwCfgLib|DXE_DRIVER DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER UEFI_DRIVER
 
   CONSTRUCTOR= QemuFwCfgInitialize
 
-- 
2.19.1.3.g30247aa5d201



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58034): https://edk2.groups.io/g/devel/message/58034
Mute This Topic: https://groups.io/mt/73236895/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 1/7] OvmfPkg: introduce QemuFwCfgSimpleParserLib

2020-04-24 Thread Laszlo Ersek
We already parse some boolean and integer values from named fw_cfg files
(usually into PCDs), and we're going to cover more. Add a dedicated
library for centralizing the parsing logic.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Per Sundstrom 
Cc: Philippe Mathieu-Daudé 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2681
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec   |   4 +
 OvmfPkg/OvmfPkgIa32.dsc   |   1 +
 OvmfPkg/OvmfPkgIa32X64.dsc|   1 +
 OvmfPkg/OvmfPkgX64.dsc|   1 +
 OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h| 128 
+++
 OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf |  27 ++
 OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParser.c  | 398 

 7 files changed, 560 insertions(+)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 28030391cff2..8a46fe73344e 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -60,6 +60,10 @@ [LibraryClasses]
   #
   QemuFwCfgS3Lib|Include/Library/QemuFwCfgS3Lib.h
 
+  ##  @libraryclass  Parse the contents of named fw_cfg files as simple
+  #  (scalar) data types.
+  QemuFwCfgSimpleParserLib|Include/Library/QemuFwCfgSimpleParserLib.h
+
   ##  @libraryclass  Rewrite the BootOrder NvVar based on QEMU's "bootorder"
   #  fw_cfg file.
   #
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index d5e90c001370..5e2972063110 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -160,6 +160,7 @@ [LibraryClasses]
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   
SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
   QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
+  
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
   VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
   LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf
   
MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/BaseMemEncryptSevLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 066f49aeaee0..18e6909a33fa 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -164,6 +164,7 @@ [LibraryClasses]
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   
SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
   QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
+  
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
   VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
   LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf
   
MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/BaseMemEncryptSevLib.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index ac510522a9ff..3d24cc4c1cfb 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -164,6 +164,7 @@ [LibraryClasses]
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   
SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
   QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
+  
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
   VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
   LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf
   
MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/BaseMemEncryptSevLib.inf
diff --git a/OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h 
b/OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h
new file mode 100644
index ..c6062bae8770
--- /dev/null
+++ b/OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h
@@ -0,0 +1,128 @@
+/** @file
+  Parse the contents of named fw_cfg files as simple (scalar) data types.
+
+  Copyright (C) 2020, Red Hat, Inc.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef QEMU_FW_CFG_SIMPLE_PARSER_LIB_H_
+#define QEMU_FW_CFG_SIMPLE_PARSER_LIB_H_
+
+#include 
+
+/**
+  Look up FileName with QemuFwCfgFindFile() from QemuFwCfgLib. Read the fw_cfg
+  file into a small array with automatic storage duration. Parse the array as
+  the textual representation of a BOOLEAN.
+
+  @param[in] FileName  The name of the fw_cfg file to look up and parse.
+
+  @param[out] ValueOn success, Value is TRUE if the contents of the fw_cfg
+   file case-insensitively match "true", "yes", "y",
+   "enable", "enabled", "1".
+
+   On success, Value is FALSE if the contents of the fw_cfg
+   file case-insensitively match "false", "no", "n",
+   "disable", "disabled", "0".
+
+   On failure, Value is not changed.
+
+  @retval RETURN_SUCCESS 

[edk2-devel] [PATCH 5/7] OvmfPkg: control PXEv4 / PXEv6 boot support from the QEMU command line

2020-04-24 Thread Laszlo Ersek
Add a minimal, NULL class library called "PxeBcPcdProducerLib" for setting
the "PcdIPv4PXESupport" and "PcdIPv6PXESupport" PCDs of NetworkPkg, from
fw_cfg.

These PCDs control whether the UefiPxeBcDxe driver supports PXEv4 / PXEv6
boot. If a PXE version is disabled, the corresponding LoadFile protocol
instance is not produced by UefiPxeBcDxe, and so
EfiBootManagerRefreshAllBootOption() in UefiBootManagerLib does not
generate corresponding *new* boot options either. (Existent boot options
are not deleted.)

Hook the library into the UefiPxeBcDxe driver. (The driver is already
included from "NetworkComponents.dsc.inc", but we can list it again in the
DSC file, for providing  overrides.)

In OVMF, the PCDs could be set in PlatformPei too, but ArmVirtQemu does
not have fw_cfg access in the PEI phase. Hence a NULL class library that
can be linked into UefiPxeBcDxe.

When listing the PCDs under [PcdsDynamicDefault], stick with the DEC
default values.

QEMU switches:

  -fw_cfg name=opt/org.tianocore/IPv4PXESupport,string=[yn]

  -fw_cfg name=opt/org.tianocore/IPv6PXESupport,string=[yn]

The "opt/org.tianocore" prefix follows the "opt/RFQDN/" recommendation
from QEMU's "docs/specs/fw_cfg.txt".

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Per Sundstrom 
Cc: Philippe Mathieu-Daudé 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2681
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkgIa32.dsc |  9 +
 OvmfPkg/OvmfPkgIa32X64.dsc  | 10 +
 OvmfPkg/OvmfPkgX64.dsc  |  9 +
 OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcdProducerLib.inf | 33 
+
 OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcd.c  | 39 

 5 files changed, 100 insertions(+)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 5e2972063110..fcd9779b5ba2 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -605,6 +605,10 @@ [PcdsDynamicDefault]
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
 !endif
 
+  # IPv4 and IPv6 PXE Boot support.
+  gEfiNetworkPkgTokenSpaceGuid.PcdIPv4PXESupport|0x01
+  gEfiNetworkPkgTokenSpaceGuid.PcdIPv6PXESupport|0x01
+
 [PcdsDynamicHii]
 !if $(TPM_ENABLE) == TRUE && $(TPM_CONFIG_ENABLE) == TRUE
   
gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS
@@ -822,6 +826,11 @@ [Components]
   #
 !include NetworkPkg/NetworkComponents.dsc.inc
 
+  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf {
+
+  NULL|OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcdProducerLib.inf
+  }
+
 !if $(NETWORK_TLS_ENABLE) == TRUE
   NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf {
 
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 18e6909a33fa..1626d2415a2c 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -616,6 +616,11 @@ [PcdsDynamicDefault]
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
 !endif
 
+[PcdsDynamicDefault.X64]
+  # IPv4 and IPv6 PXE Boot support.
+  gEfiNetworkPkgTokenSpaceGuid.PcdIPv4PXESupport|0x01
+  gEfiNetworkPkgTokenSpaceGuid.PcdIPv6PXESupport|0x01
+
 [PcdsDynamicHii]
 !if $(TPM_ENABLE) == TRUE && $(TPM_CONFIG_ENABLE) == TRUE
   
gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS
@@ -834,6 +839,11 @@ [Components.X64]
   #
 !include NetworkPkg/NetworkComponents.dsc.inc
 
+  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf {
+
+  NULL|OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcdProducerLib.inf
+  }
+
 !if $(NETWORK_TLS_ENABLE) == TRUE
   NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf {
 
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 3d24cc4c1cfb..65cfe957761b 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -615,6 +615,10 @@ [PcdsDynamicDefault]
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
 !endif
 
+  # IPv4 and IPv6 PXE Boot support.
+  gEfiNetworkPkgTokenSpaceGuid.PcdIPv4PXESupport|0x01
+  gEfiNetworkPkgTokenSpaceGuid.PcdIPv6PXESupport|0x01
+
 [PcdsDynamicHii]
 !if $(TPM_ENABLE) == TRUE && $(TPM_CONFIG_ENABLE) == TRUE
   
gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS
@@ -832,6 +836,11 @@ [Components]
   #
 !include NetworkPkg/NetworkComponents.dsc.inc
 
+  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf {
+
+  NULL|OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcdProducerLib.inf
+  }
+
 !if $(NETWORK_TLS_ENABLE) == TRUE
   NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf {
 
diff --git 

[edk2-devel] [PATCH 6/7] ArmVirtPkg/QemuFwCfgLib: allow UEFI_DRIVER modules

2020-04-24 Thread Laszlo Ersek
We don't distribute UEFI_DRIVER modules stand-alone that were built as
part of an ArmVirtQemu* platform. ArmVirtQemu* UEFI_DRIVERs are allowed to
inherit platform dependencies.

By enabling UEFI_DRIVERs to consume QemuFwCfgLib, we can hook fw_cfg-based
NULL class libraries into UEFI drivers, e.g. in order to set dynamic PCDs.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Per Sundstrom 
Cc: Philippe Mathieu-Daudé 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2681
Signed-off-by: Laszlo Ersek 
---
 ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf 
b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
index 4d27d7d30bd3..feceed5f9341 100644
--- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
+++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
@@ -15,7 +15,7 @@ [Defines]
   FILE_GUID  = B271F41F-B841-48A9-BA8D-545B4BC2E2BF
   MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = QemuFwCfgLib|DXE_DRIVER
+  LIBRARY_CLASS  = QemuFwCfgLib|DXE_DRIVER UEFI_DRIVER
 
   CONSTRUCTOR= QemuFwCfgInitialize
 
-- 
2.19.1.3.g30247aa5d201



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58036): https://edk2.groups.io/g/devel/message/58036
Mute This Topic: https://groups.io/mt/73236897/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 3/7] OvmfPkg/PlatformPei: use QemuFwCfgParseBool in UPDATE_BOOLEAN_PCD_FROM_...

2020-04-24 Thread Laszlo Ersek
The UPDATE_BOOLEAN_PCD_FROM_FW_CFG() macro currently calls the
module-private helper function GetNamedFwCfgBoolean(). Replace the latter
with QemuFwCfgParseBool() from QemuFwCfgSimpleParserLib.

This change is compatible with valid strings accepted previously.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Per Sundstrom 
Cc: Philippe Mathieu-Daudé 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2681
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/PlatformPei/Platform.c | 47 +---
 1 file changed, 2 insertions(+), 45 deletions(-)

diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 088e616a980c..3b850c2c2626 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -254,56 +255,12 @@ MemMapInitialization (
   ASSERT_RETURN_ERROR (PcdStatus);
 }
 
-EFI_STATUS
-GetNamedFwCfgBoolean (
-  IN  CHAR8   *FwCfgFileName,
-  OUT BOOLEAN *Setting
-  )
-{
-  EFI_STATUS   Status;
-  FIRMWARE_CONFIG_ITEM FwCfgItem;
-  UINTNFwCfgSize;
-  UINT8Value[3];
-
-  Status = QemuFwCfgFindFile (FwCfgFileName, , );
-  if (EFI_ERROR (Status)) {
-return Status;
-  }
-  if (FwCfgSize > sizeof Value) {
-return EFI_BAD_BUFFER_SIZE;
-  }
-  QemuFwCfgSelectItem (FwCfgItem);
-  QemuFwCfgReadBytes (FwCfgSize, Value);
-
-  if ((FwCfgSize == 1) ||
-  (FwCfgSize == 2 && Value[1] == '\n') ||
-  (FwCfgSize == 3 && Value[1] == '\r' && Value[2] == '\n')) {
-switch (Value[0]) {
-  case '0':
-  case 'n':
-  case 'N':
-*Setting = FALSE;
-return EFI_SUCCESS;
-
-  case '1':
-  case 'y':
-  case 'Y':
-*Setting = TRUE;
-return EFI_SUCCESS;
-
-  default:
-break;
-}
-  }
-  return EFI_PROTOCOL_ERROR;
-}
-
 #define UPDATE_BOOLEAN_PCD_FROM_FW_CFG(TokenName)   \
   do {  \
 BOOLEAN   Setting;  \
 RETURN_STATUS PcdStatus;\
 \
-if (!EFI_ERROR (GetNamedFwCfgBoolean (  \
+if (!RETURN_ERROR (QemuFwCfgParseBool ( \
   "opt/ovmf/" #TokenName, ))) { \
   PcdStatus = PcdSetBoolS (TokenName, Setting); \
   ASSERT_RETURN_ERROR (PcdStatus);  \
-- 
2.19.1.3.g30247aa5d201



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58033): https://edk2.groups.io/g/devel/message/58033
Mute This Topic: https://groups.io/mt/73236894/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 0/7] OvmfPkg, ArmVirtPkg: control PXE v4/v6 boot support from the QEMU cmdline

2020-04-24 Thread Laszlo Ersek
Ref:https://bugzilla.tianocore.org/show_bug.cgi?id=2681
Repo:   https://pagure.io/lersek/edk2.git
Branch: pxe_fw_cfg

With this series applied, the QEMU command line options listed below
control whether the guest firmware supports PXEv4 / PXEv6 boot. And
correspondingly, whether UefiBootManagerLib generates *new* PXEv4 /
PXEv6 boot options automatically. (Existent boot options are never
deleted in response to just the flags below.)

  -fw_cfg name=opt/org.tianocore/IPv4PXESupport,string=[yn]

  -fw_cfg name=opt/org.tianocore/IPv6PXESupport,string=[yn]

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Leif Lindholm 
Cc: Per Sundstrom 
Cc: Philippe Mathieu-Daudé 

Thanks
Laszlo

Laszlo Ersek (7):
  OvmfPkg: introduce QemuFwCfgSimpleParserLib
  OvmfPkg/PlatformPei: parse "X-PciMmio64Mb" with
QemuFwCfgSimpleParserLib
  OvmfPkg/PlatformPei: use QemuFwCfgParseBool in
UPDATE_BOOLEAN_PCD_FROM_...
  OvmfPkg/QemuFwCfgDxeLib: allow UEFI_DRIVER modules
  OvmfPkg: control PXEv4 / PXEv6 boot support from the QEMU command line
  ArmVirtPkg/QemuFwCfgLib: allow UEFI_DRIVER modules
  ArmVirtPkg: control PXEv4 / PXEv6 boot support from the QEMU command
line

 ArmVirtPkg/ArmVirtQemu.dsc|  13 +
 ArmVirtPkg/ArmVirtQemuKernel.dsc  |  13 +
 ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf  |   2 +-
 OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h| 128 
+++
 OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcd.c|  39 ++
 OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcdProducerLib.inf   |  33 ++
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf  |   2 +-
 OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParser.c  | 398 

 OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf |  27 ++
 OvmfPkg/OvmfPkg.dec   |   4 +
 OvmfPkg/OvmfPkgIa32.dsc   |  10 +
 OvmfPkg/OvmfPkgIa32X64.dsc|  11 +
 OvmfPkg/OvmfPkgX64.dsc|  10 +
 OvmfPkg/PlatformPei/MemDetect.c   |  36 +-
 OvmfPkg/PlatformPei/Platform.c|  47 +--
 OvmfPkg/PlatformPei/PlatformPei.inf   |   1 +
 16 files changed, 712 insertions(+), 62 deletions(-)
 create mode 100644 OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h
 create mode 100644 OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcd.c
 create mode 100644 OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcdProducerLib.inf
 create mode 100644 
OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParser.c
 create mode 100644 
OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf

-- 
2.19.1.3.g30247aa5d201


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58030): https://edk2.groups.io/g/devel/message/58030
Mute This Topic: https://groups.io/mt/73236891/21656
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] Features/Intel/AdvancedFeaturePkg: Remove temporary build workaround

2020-04-24 Thread Heng Luo
Dear all,
I combined 2 patches into one following Eric's suggestion, new patch have been 
sent out, please help to review.

Thanks,
Heng

> -Original Message-
> From: Ni, Ray 
> Sent: Friday, April 24, 2020 1:03 PM
> To: Luo, Heng ; devel@edk2.groups.io
> Cc: Michael Kubacki ; Gao, Liming
> ; Dong, Eric 
> Subject: RE: [PATCH 1/2] Features/Intel/AdvancedFeaturePkg: Remove
> temporary build workaround
> 
> Thanks for the explanation. Make sense to me.
> 
> 
> > -Original Message-
> > From: Luo, Heng 
> > Sent: Friday, April 24, 2020 9:06 AM
> > To: Ni, Ray ; devel@edk2.groups.io
> > Cc: Michael Kubacki ; Gao, Liming
> > ; Dong, Eric 
> > Subject: RE: [PATCH 1/2] Features/Intel/AdvancedFeaturePkg: Remove
> > temporary build workaround
> >
> > Hi Ray,
> > Option 1, In current implement, the usage of AdvancedFeaturePkg in board
> DSC is:
> >
> > !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc # invoke
> > section "[Packages]", define default Feature PCD
> > #option: [PcdsFeatureFlag], board can override default Feature PCD here,
> enable specific feature.
> > !include Include/AdvancedFeatures.dsc
> >
> > Option 2, if there is no AdvancedFeaturesPcd.dsc, we can move section
> > "[Packages]" to AdvancedFeatures.dsc, there is 2 concerns here:
> > 1. there is no default Feature PCD now, we need to add
> > [PcdsFeatureFlag] below in every OpenBoardPkg.dsc. if we add a new
> > feature, we have to change all OpenBoardPkg.dsc files,  but in option
> > 1, we just need to change AdvancedFeaturesPcd.dsc [PcdsFeatureFlag]
> >   gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable
> |FALSE
> >   gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable
> |FALSE
> >   .
> >
> > 2. we define FeaturePCDs before section "[Packages]", it does work, but it
> looks strange.
> >
> > So I would like option 1, but I also agree option2 if you think it is 
> > better.
> >
> > Thanks,
> > Heng
> > > -Original Message-
> > > From: Ni, Ray 
> > > Sent: Thursday, April 23, 2020 7:43 PM
> > > To: Luo, Heng ; devel@edk2.groups.io
> > > Cc: Michael Kubacki ; Gao, Liming
> > > ; Dong, Eric 
> > > Subject: RE: [PATCH 1/2] Features/Intel/AdvancedFeaturePkg: Remove
> > > temporary build workaround
> > >
> > > Heng,
> > > Any reason to create a separate Pcd.dsc file?
> > >
> > > > -Original Message-
> > > > From: Luo, Heng 
> > > > Sent: Thursday, April 23, 2020 4:43 PM
> > > > To: devel@edk2.groups.io
> > > > Cc: Michael Kubacki ; Gao, Liming
> > > > ; Dong, Eric ; Ni, Ray
> > > > 
> > > > Subject: [PATCH 1/2] Features/Intel/AdvancedFeaturePkg: Remove
> > > > temporary build workaround
> > > >
> > > > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2688
> > > >
> > > > Remove
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround,
> > > > Add
> > > Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
> > > > to support Feature PCDs.
> > > >
> > > > Cc: Michael Kubacki 
> > > > Cc: Liming Gao 
> > > > Cc: Eric Dong 
> > > > Cc: Ray Ni 
> > > > Signed-off-by: Heng Luo 
> > > > ---
> > > >  Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> > > |  2 +-
> > > >  Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
> > > | 41
> > > > +
> > > >
> > >
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Temporar
> > > yBuildWorkaround.c   | 31 ---
> > > > 
> > > >
> > > >
> > >
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Temporar
> > > yBu
> > > > ildWorkaround.dsc | 76 --
> > > > --
> > > >
> > > >
> > >
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Temporar
> > > yBu
> > > > ildWorkaround.inf | 60 ---
> > > > -
> > > >  5 files changed, 42 insertions(+), 168 deletions(-)
> > > >
> > > > diff --git
> > > > a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> > > > b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> > > > index ea879680ba..e509ef3e1b 100644
> > > > --- a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> > > > +++ b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> > > > @@ -30,7 +30,7 @@
> > > >PEI_ARCH= IA32
> > > >
> > > >DXE_ARCH= X64
> > > >
> > > >
> > > >
> > > > -!include
> > > >
> > >
> AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaro
> > > und.d
> > > > sc
> > > >
> > > > +!include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> 
> > > ##
> > > > ##
> > > >
> > > >  #
> > > >
> > > > diff --git
> > > >
> a/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.ds
> > > > c
> > > >
> b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.ds
> > > > c

Re: [edk2-devel] [edk2-platforms] [PATCH V1 1/2] CometlakeOpenBoardPkg: Add BDS Hook Dxe Driver

2020-04-24 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

> -Original Message-
> From: Desimone, Nathaniel L 
> Sent: Wednesday, April 22, 2020 4:40 AM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Chaganty, Rangasai V
> ; Kethi Reddy, Deepika
> ; Esakkithevar, Kathappan
> ; Agyeman, Prince
> ; Michael Kubacki
> 
> Subject: [edk2-platforms] [PATCH V1 1/2] CometlakeOpenBoardPkg: Add BDS
> Hook Dxe Driver
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2336
> 
> Added a DXE driver that registers the minimum platform BDS hook points, to
> WhiskeylakeURvp board.
> These hooks are triggered on the BDS hook events
> 
> What was done:
> 
> * Included an instance of BdsHookLib and BoardBootManagerLib from
> BoardModulePkg
> 
> * Included BdsHookDxe to register the callbacks implemented in BdsHookLib
> 
> Signed-off-by: Nate DeSimone 
> Cc: Chasel Chiu 
> Cc: Rangasai V Chaganty 
> Cc: Deepika Kethi Reddy 
> Cc: Kathappan Esakkithevar 
> Cc: Prince Agyeman 
> Cc: Michael Kubacki 
> ---
>  .../CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc  | 4
> 
>  .../CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.fdf  | 1
> +
>  2 files changed, 5 insertions(+)
> 
> diff --git
> a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.d
> sc
> b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.d
> sc
> index 14e82ba34d..958a2d0c50 100644
> ---
> a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.d
> sc
> +++
> b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.d
> s
> +++ c
> @@ -224,6 +224,8 @@
>###
> 
> DxePolicyUpdateLib|$(PLATFORM_BOARD_PACKAGE)/Policy/Library/DxePolic
> yUpdateLib/DxePolicyUpdateLib.inf
> 
> DxeTbtPolicyLib|$(PLATFORM_BOARD_PACKAGE)/Features/Tbt/Library/DxeTb
> tPolicyLib/DxeTbtPolicyLib.inf
> +
> +
> BoardBdsHookLib|BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHo
> okLib
> + .inf
> +
> BoardBootManagerLib|BoardModulePkg/Library/BoardBootManagerLib/Bo
> ardBo
> + otManagerLib.inf
> 
>###
># Board-specific
> @@ -452,3 +454,5 @@
>$(PLATFORM_BOARD_PACKAGE)/Acpi/BoardAcpiDxe/BoardAcpiDxe.inf
>  !endif
>BoardModulePkg/LegacySioDxe/LegacySioDxe.inf
> +  BoardModulePkg/BoardBdsHookDxe/BoardBdsHookDxe.inf
> +
> diff --git
> a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.f
> df
> b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.f
> df
> index e2d40bcbb6..31f4d22311 100644
> ---
> a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.f
> df
> +++
> b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.f
> d
> +++ f
> @@ -346,6 +346,7 @@ INF
> MdeModulePkg/Universal/Console/GraphicsOutputDxe/GraphicsOutputDxe.
> inf
>  INF  MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
>  INF  BoardModulePkg/LegacySioDxe/LegacySioDxe.inf
>  INF  MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf
> +INF  BoardModulePkg/BoardBdsHookDxe/BoardBdsHookDxe.inf
> 
>  INF  ShellPkg/Application/Shell/Shell.inf
> 
> --
> 2.26.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58028): https://edk2.groups.io/g/devel/message/58028
Mute This Topic: https://groups.io/mt/73182361/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] MdeModulePkg/PciHostBridge: Update Mem and PMem Limit Checks

2020-04-24 Thread Wasim Khan


> -Original Message-
> From: Ard Biesheuvel 
> Sent: Friday, April 24, 2020 11:38 AM
> To: devel@edk2.groups.io; Wasim Khan ; Ard
> Biesheuvel 
> Cc: Varun Sethi ; Wu, Hao A ; Ni, Ray
> 
> Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PciHostBridge: Update Mem
> and PMem Limit Checks
> 
> On 4/24/20 6:35 AM, Wasim Khan via groups.io wrote:
> >
> >
> >> -Original Message-
> >> From: Ard Biesheuvel 
> >> Sent: Friday, April 24, 2020 12:27 AM
> >> To: Wasim Khan 
> >> Cc: edk2-devel-groups-io ; Varun Sethi
> >> ; Wu, Hao A ; Ni, Ray
> >> 
> >> Subject: Re: [PATCH] MdeModulePkg/PciHostBridge: Update Mem and PMem
> >> Limit Checks
> >>
> >> On Thu, 23 Apr 2020 at 12:43, Wasim Khan  wrote:
> >>>
> >>> With Address Translation Support, it is possible and also correct
> >>> that Mem and Pmem Limit cross the 4GB boundary.
> >>> Update the checks so that Mem/PMem Limit should not cross 4GB from
> >>> the Mem/PMem Base address.
> >>>
> >>> Signed-off-by: Wasim Khan 
> >>> ---
> >>>   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c | 8 
> >>>   1 file changed, 4 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> >>> b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> >>> index d304fae..9cf7e98 100644
> >>> --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> >>> +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> >>> @@ -117,8 +117,8 @@ CreateRootBridge (
> >>> // Make sure Mem and MemAbove4G apertures are valid
> >>> //
> >>> if (RESOURCE_VALID (>Mem)) {
> >>> -ASSERT (Bridge->Mem.Limit < SIZE_4GB);
> >>> -if (Bridge->Mem.Limit >= SIZE_4GB) {
> >>> +ASSERT (Bridge->Mem.Limit < (Bridge->Mem.Base + SIZE_4GB));
> >>> +if (Bridge->Mem.Limit >= (Bridge->Mem.Base + SIZE_4GB)) {
> >>> return NULL;
> >>>   }
> >>> }
> >>> @@ -129,8 +129,8 @@ CreateRootBridge (
> >>>   }
> >>> }
> >>> if (RESOURCE_VALID (>PMem)) {
> >>> -ASSERT (Bridge->PMem.Limit < SIZE_4GB);
> >>> -if (Bridge->PMem.Limit >= SIZE_4GB) {
> >>> +ASSERT (Bridge->PMem.Limit < (Bridge->PMem.Base + SIZE_4GB));
> >>> +if (Bridge->PMem.Limit >= (Bridge->PMem.Base + SIZE_4GB)) {
> >>> return NULL;
> >>>   }
> >>> }
> >>> --
> >>> 2.7.4
> >>>
> >>
> >> This is not the right fix.
> >>
> >> The translation offset should be taken into account for these checks
> >
> > Thanks for the review Ard.
> > device address = host address + translation offset.
> > Mem and Pmem represents "device address" , so that are already taking
> translation offset into account.
> >
> 
> OK, apparently I am missing something.
> 
> For the MMIO32 window, the limit has to be < 4 GB, since the whole region
> needs to be 32-bit addressable. Otherwise, how are you going to allocate a 32-
> bit BAR from the part of the window that is > 4 GB ?
> 

OK, it is correct that we can not allocate 32-bit BAR from the part of window 
that is > 4GB.
Thanks for catching it.
Thanks Ard, Ray for the good discussion.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58027): https://edk2.groups.io/g/devel/message/58027
Mute This Topic: https://groups.io/mt/73215737/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH] Remove temporary build workaround in Features/Intel/AdvancedFeaturePkg

2020-04-24 Thread Heng Luo
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2688

Remove Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround,
Add Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
to support Feature PCDs.
Use AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc instead of
AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc

Cc: Liming Gao 
Cc: Eric Dong 
Cc: Ray Ni 
Signed-off-by: Heng Luo 
---
 Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc   
 |  2 +-
 Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc  
 | 41 +
 
Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c
   | 31 ---
 
Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc
 | 76 

 
Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.inf
 | 60 
 Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc
 |  2 +-
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
 |  2 +-
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc  
 |  2 +-
 Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc   
 |  2 +-
 Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc   
 |  2 +-
 Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
 |  2 +-
 11 files changed, 48 insertions(+), 174 deletions(-)

diff --git a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc 
b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index ea879680ba..e509ef3e1b 100644
--- a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -30,7 +30,7 @@
   PEI_ARCH= IA32
   DXE_ARCH= X64
 
-!include 
AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc
+!include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
 
 

 #
diff --git a/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc 
b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
new file mode 100644
index 00..2eacec18a0
--- /dev/null
+++ b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
@@ -0,0 +1,41 @@
+## @file
+#  DSC file for defining Pcd of advanced features.
+#
+#  This file is intended to be included into another package so advanced 
features
+#  can be conditionally built by enabling the respective feature via its 
FeaturePCD.
+#
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+#
+# The section references the package DEC files,
+# it allow a FeaturePCD to be used in a conditional statement
+#
+[Packages]
+  MdePkg/MdePkg.dec
+  AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
+  Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
+  NetworkFeaturePkg/NetworkFeaturePkg.dec
+  IpmiFeaturePkg/IpmiFeaturePkg.dec
+  S3FeaturePkg/S3FeaturePkg.dec
+  SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+  UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+  LogoFeaturePkg/LogoFeaturePkg.dec
+
+#
+# The section below sets all PCDs to FALSE in this DSC file so the feature is 
not enabled by default.
+# Board can set PCDs to TRUE in its DSC file to enable a subset of advanced 
features
+#
+[PcdsFeatureFlag]
+  gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable
|FALSE
+  gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable  
|FALSE
+  gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable
|FALSE
+  gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable  
|FALSE
+  gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable  
|FALSE
+  gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable
|FALSE
+  gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable
|FALSE
+  gLogoFeaturePkgTokenSpaceGuid.PcdLogoFeatureEnable  
|FALSE
+  gLogoFeaturePkgTokenSpaceGuid.PcdJpgEnable  
|FALSE
diff --git 
a/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c
 
b/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c
deleted file mode 100644
index 2cd91b06f0..00
--- 
a/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/** @file
-  Source code file for a temporary build workaround.
-
-  The purpose of this workaround is described in 

Re: [edk2-devel] [edk2-platforms: PATCH V1] MinPlatformPkg/PlatformInitPei: Create Library Instance of ReportCpuHobLib.

2020-04-24 Thread Chiu, Chasel

Reviewed-by: Chasel Chiu mailto:chasel.c...@intel.com>>


From: Kumar, Chandana C 
Sent: Friday, April 24, 2020 1:19 PM
To: devel@edk2.groups.io 
Cc: Chaganty, Rangasai V ; Chiu, Chasel 
; Desimone, Nathaniel L 
Subject: [edk2-platforms: PATCH V1] MinPlatformPkg/PlatformInitPei: Create 
Library Instance of ReportCpuHobLib.

Create an Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overriden using Library instance in Platform.

Initial Patch to create ReportCpuHobLib.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2674

Signed-off-by: Chandana Kumar 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
---
 Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h
| 23 +++
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec   
|  6 --
 
Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
   | 32 
 
Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 | 27 +++
 4 files changed, 86 insertions(+), 2 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h 
b/Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h
new file mode 100644
index 00..337e17f154
--- /dev/null
+++ b/Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h
@@ -0,0 +1,23 @@
+/** @file
+
+  Report CPU HOB library
+
+  This library report the CPU HOB with Physical Address bits.
+
+Copyright (c) 2020, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _REPORT_CPU_HOB_LIB_H_
+#define _REPORT_CPU_HOB_LIB_H_
+
+#include 
+#include 
+
+VOID
+ReportCpuHob (
+  VOID
+  );
+
+#endif
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
index 5bec4eee3a..7ef189dac8 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
@@ -6,7 +6,7 @@
 # INF files to generate AutoGen.c and AutoGen.h files
 # for the build infrastructure.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -73,7 +73,9 @@
   TestPointLib|Include/Library/TestPointLib.h
   TestPointCheckLib|Include/Library/TestPointCheckLib.h

-SetCacheMtrrLib|Include/Library/SetCacheMtrrLib.h
+  SetCacheMtrrLib|Include/Library/SetCacheMtrrLib.h
+
+  ReportCpuHobLib|Include/Library/ReportCpuHobLib.h

 [PcdsFixedAtBuild, PcdsPatchableInModule]

diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
new file mode 100644
index 00..aa2565343c
--- /dev/null
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
@@ -0,0 +1,32 @@
+/** @file
+  Source code file for Report CPU HOB library.
+
+Copyright (c) 2020, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+
+VOID
+ReportCpuHob (
+  VOID
+  )
+{
+  UINT8 PhysicalAddressBits;
+  UINT32RegEax;
+
+  AsmCpuid (0x8000, , NULL, NULL, NULL);
+  if (RegEax >= 0x8008) {
+AsmCpuid (0x8008, , NULL, NULL, NULL);
+PhysicalAddressBits = (UINT8) RegEax;
+  } else {
+PhysicalAddressBits = 36;
+  }
+
+  ///
+  /// Create a CPU hand-off information
+  ///
+  BuildCpuHob (PhysicalAddressBits, 16);
+}
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
new file mode 100644
index 00..ae6ec901a1
--- /dev/null
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
@@ -0,0 +1,27 @@
+### @file
+# Component information file for the Report CPU HOB library.
+#
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = ReportCpuHobLib
+  FILE_GUID  = F19AA754-CE24-448D-B755-1F939B00C25D
+  VERSION_STRING = 1.0
+  MODULE_TYPE= BASE
+  LIBRARY_CLASS  = ReportCpuHobLib
+
+[LibraryClasses]
+  BaseLib
+  HobLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MinPlatformPkg/MinPlatformPkg.dec
+
+[Sources]
+  PeiReportFvLib.c
--
2.16.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58025): https://edk2.groups.io/g/devel/message/58025
Mute This 

  1   2   >