[edk2] [platforms: PATCH v6 6/8] Marvell/Drivers: MvBoardDesc: Extend information for SdMmc

2018-11-18 Thread Marcin Wojtas
From: Tomasz Michalec 

Extend MvBoardDescSdMmcGet function to fill MV_BOARD_SDMMC_DESC
with Xenon specific info obtained from ArmadaBoardDescLib.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
Reviewed-by: Ard Biesheuvel 
---
 Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf|  1 +
 Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c  | 24 
+---
 Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.c |  1 -
 3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf 
b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf
index 41f72d6..0b93948 100644
--- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf
+++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf
@@ -47,6 +47,7 @@
   Silicon/Marvell/Marvell.dec
 
 [LibraryClasses]
+  ArmadaBoardDescLib
   ArmadaSoCDescLib
   DebugLib
   MemoryAllocationLib
diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c 
b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c
index 39dc06c..f71bfc4 100644
--- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c
+++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c
@@ -270,6 +270,7 @@ MvBoardDescSdMmcGet (
 {
   UINT8 *SdMmcDeviceEnabled;
   UINTN SdMmcCount, SdMmcDeviceTableSize, SdMmcIndex, Index;
+  UINTN SdMmcDevCount;
   MV_BOARD_SDMMC_DESC *BoardDesc;
   MV_SOC_SDMMC_DESC *SoCDesc;
   EFI_STATUS Status;
@@ -280,6 +281,13 @@ MvBoardDescSdMmcGet (
 return Status;
   }
 
+  /* Get per-board configuration of the controllers */
+  Status = ArmadaBoardDescSdMmcGet (, );
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "%a: ArmadaBoardDescSdMmcGet filed\n", __FUNCTION__));
+return Status;
+  }
+
   /*
* Obtain table with enabled SDMMC controllers
* which is represented as an array of UINT8 values
@@ -294,18 +302,12 @@ MvBoardDescSdMmcGet (
   SdMmcDeviceTableSize = PcdGetSize (PcdPciESdhci);
 
   /* Check if PCD with SDMMC controllers is correctly defined */
-  if (SdMmcDeviceTableSize > SdMmcCount) {
+  if ((SdMmcDeviceTableSize > SdMmcCount) ||
+  (SdMmcDeviceTableSize < SdMmcDevCount)) {
 DEBUG ((DEBUG_ERROR, "%a: Wrong PcdPciESdhci format\n", __FUNCTION__));
 return EFI_INVALID_PARAMETER;
   }
 
-  /* Allocate and fill board description */
-  BoardDesc = AllocateZeroPool (SdMmcDeviceTableSize * sizeof 
(MV_BOARD_SDMMC_DESC));
-  if (BoardDesc == NULL) {
-DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__));
-return EFI_OUT_OF_RESOURCES;
-  }
-
   SdMmcIndex = 0;
   for (Index = 0; Index < SdMmcDeviceTableSize; Index++) {
 if (!SdMmcDeviceEnabled[Index]) {
@@ -313,6 +315,12 @@ MvBoardDescSdMmcGet (
   continue;
 }
 
+if (SdMmcIndex >= SdMmcDevCount) {
+  DEBUG ((DEBUG_ERROR,
+"%a: More enabled devices than returned by ArmadaBoardDescSdMmcGet\n",
+__FUNCTION__));
+  return EFI_INVALID_PARAMETER;
+}
 BoardDesc[SdMmcIndex].SoC = [Index];
 SdMmcIndex++;
   }
diff --git a/Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.c 
b/Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.c
index c5cf904..116e9d4 100644
--- a/Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.c
+++ b/Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.c
@@ -189,7 +189,6 @@ NonDiscoverableEntryPoint (
   if (EFI_ERROR(Status)) {
 return Status;
   }
-  BoardDescProtocol->BoardDescFree (SdMmcBoardDesc);
 
   return EFI_SUCCESS;
 }
-- 
2.7.4

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


[edk2] [platforms: PATCH v6 5/8] Marvell/Armada80x0Db: Introduce board description library

2018-11-18 Thread Marcin Wojtas
From: Tomasz Michalec 

This patch implements ArmadaBoarDescLib library for
Armada8040 Development Board and add to it ArmadaBoardDescSdMmcGet
function with description of connected Xenon host controllers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
---
 Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc 
 |  3 +
 
Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf
 | 34 +++
 
Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c
   | 60 
 3 files changed, 97 insertions(+)
 create mode 100644 
Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf
 create mode 100644 
Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c

diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc 
b/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc
index 92e2dc8..42f7bd3 100644
--- a/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc
+++ b/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc
@@ -54,6 +54,9 @@
 [Components.AARCH64]
   Silicon/Marvell/Armada7k8k/AcpiTables/Armada80x0Db.inf
 
+[LibraryClasses.common]
+  
ArmadaBoardDescLib|Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf
+
 

 #
 # Pcd Section - list of all EDK II PCD Entries defined by this Platform
diff --git 
a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf
 
b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf
new file mode 100644
index 000..2d39d96
--- /dev/null
+++ 
b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf
@@ -0,0 +1,34 @@
+## @file
+#
+#  Copyright (C) 2018, Marvell International Ltd. and its affiliates
+#
+#  This program and the accompanying materials are licensed and made available
+#  under the terms and conditions of the BSD License which accompanies this
+#  distribution. The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
+#  IMPLIED.
+#
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = Armada80x0DbBoardDescLib
+  FILE_GUID  = fee9e874-1481-4b4f-9882-966bd0d1310f
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = ArmadaBoardDescLib
+
+[Sources]
+  Armada80x0DbBoardDescLib.c
+
+[Packages]
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Marvell/Marvell.dec
+
+[LibraryClasses]
+  DebugLib
+  IoLib
diff --git 
a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c
 
b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c
new file mode 100644
index 000..feb69ad
--- /dev/null
+++ 
b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c
@@ -0,0 +1,60 @@
+/**
+*
+*  Copyright (C) 2018, Marvell International Ltd. and its affiliates.
+*
+*  This program and the accompanying materials are licensed and made available
+*  under the terms and conditions of the BSD License which accompanies this
+*  distribution. The full text of the license may be found at
+*  http://opensource.org/licenses/bsd-license.php
+*
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+*
+**/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+//
+// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib
+//
+STATIC
+MV_BOARD_SDMMC_DESC mSdMmcDescTemplate[] = {
+  { /* eMMC 0xF06E */
+0, /* SOC will be filled by MvBoardDescDxe */
+0, /* SdMmcDevCount will be filled by MvBoardDescDxe */
+TRUE,  /* Xenon1v8Enabled */
+TRUE,  /* Xenon8BitBusEnabled */
+TRUE,  /* XenonSlowModeEnabled */
+0x40,  /* XenonTuningStepDivisor */
+EmbeddedSlot /* SlotType */
+  },
+  { /* SD/MMC 0xF278 */
+0, /* SOC will be filled by MvBoardDescDxe */
+0, /* SdMmcDevCount will be filled by MvBoardDescDxe */
+FALSE, /* Xenon1v8Enabled */
+FALSE, /* Xenon8BitBusEnabled */
+FALSE, /* XenonSlowModeEnabled */
+0x19,  /* XenonTuningStepDivisor */
+EmbeddedSlot /* SlotType */
+  }
+};
+
+EFI_STATUS
+EFIAPI
+ArmadaBoardDescSdMmcGet (
+  OUT UINTN   *SdMmcDevCount,
+  OUT MV_BOARD_SDMMC_DESC **SdMmcDesc
+  )
+{
+  *SdMmcDesc = mSdMmcDescTemplate;
+  *SdMmcDevCount = ARRAY_SIZE (mSdMmcDescTemplate);
+
+  return EFI_SUCCESS;
+}
-- 
2.7.4

___
edk2-devel mailing list

[edk2] [platforms: PATCH v6 4/8] Marvell/Armada70x0Db: Introduce board description library

2018-11-18 Thread Marcin Wojtas
From: Tomasz Michalec 

This patch implements ArmadaBoarDescLib library for
Armada7040 Development Board and add to it ArmadaBoardDescSdMmcGet
function with description of connected Xenon host controllers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
---
 Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc 
 |  3 +
 
Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf
 | 34 +++
 
Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c
   | 60 
 3 files changed, 97 insertions(+)
 create mode 100644 
Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf
 create mode 100644 
Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c

diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc 
b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc
index e0bf447..a935f36 100644
--- a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc
+++ b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc
@@ -54,6 +54,9 @@
 [Components.AARCH64]
   Silicon/Marvell/Armada7k8k/AcpiTables/Armada70x0Db.inf
 
+[LibraryClasses.common]
+  
ArmadaBoardDescLib|Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf
+
 

 #
 # Pcd Section - list of all EDK II PCD Entries defined by this Platform
diff --git 
a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf
 
b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf
new file mode 100644
index 000..b26f55b
--- /dev/null
+++ 
b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf
@@ -0,0 +1,34 @@
+## @file
+#
+#  Copyright (C) 2018, Marvell International Ltd. and its affiliates
+#
+#  This program and the accompanying materials are licensed and made available
+#  under the terms and conditions of the BSD License which accompanies this
+#  distribution. The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
+#  IMPLIED.
+#
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = Armada70x0DbBoardDescLib
+  FILE_GUID  = 3164c8d9-19d4-4ad6-8196-cea094b1ddf1
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = ArmadaBoardDescLib
+
+[Sources]
+  Armada70x0DbBoardDescLib.c
+
+[Packages]
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Marvell/Marvell.dec
+
+[LibraryClasses]
+  DebugLib
+  IoLib
diff --git 
a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c
 
b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c
new file mode 100644
index 000..48c68e4
--- /dev/null
+++ 
b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c
@@ -0,0 +1,60 @@
+/**
+*
+*  Copyright (C) 2018, Marvell International Ltd. and its affiliates.
+*
+*  This program and the accompanying materials are licensed and made available
+*  under the terms and conditions of the BSD License which accompanies this
+*  distribution. The full text of the license may be found at
+*  http://opensource.org/licenses/bsd-license.php
+*
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+*
+**/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+//
+// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib
+//
+STATIC
+MV_BOARD_SDMMC_DESC mSdMmcDescTemplate[] = {
+  { /* eMMC 0xF06E */
+0, /* SOC will be filled by MvBoardDescDxe */
+0, /* SdMmcDevCount will be filled by MvBoardDescDxe */
+FALSE, /* Xenon1v8Enabled */
+FALSE, /* Xenon8BitBusEnabled */
+TRUE,  /* XenonSlowModeEnabled */
+0x40,  /* XenonTuningStepDivisor */
+EmbeddedSlot /* SlotType */
+  },
+  { /* SD/MMC 0xF278 */
+0, /* SOC will be filled by MvBoardDescDxe */
+0, /* SdMmcDevCount will be filled by MvBoardDescDxe */
+FALSE, /* Xenon1v8Enabled */
+FALSE, /* Xenon8BitBusEnabled */
+FALSE, /* XenonSlowModeEnabled */
+0x19,  /* XenonTuningStepDivisor */
+EmbeddedSlot /* SlotType */
+  }
+};
+
+EFI_STATUS
+EFIAPI
+ArmadaBoardDescSdMmcGet (
+  OUT UINTN   *SdMmcDevCount,
+  OUT MV_BOARD_SDMMC_DESC **SdMmcDesc
+  )
+{
+  *SdMmcDesc = mSdMmcDescTemplate;
+  *SdMmcDevCount = ARRAY_SIZE (mSdMmcDescTemplate);
+
+  return EFI_SUCCESS;
+}
-- 
2.7.4

___
edk2-devel mailing list

[edk2] [platforms: PATCH v6 3/8] SolidRun/Armada80x0McBin: Introduce board description library

2018-11-18 Thread Marcin Wojtas
From: Tomasz Michalec 

This patch implements ArmadaBoarDescLib library for
Armada80x0McBin comunity board and add to it ArmadaBoardDescSdMmcGet
function with description of connected Xenon host controllers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
---
 Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc  
   |  3 +
 
Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf
 | 34 +++
 
Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c
   | 60 
 3 files changed, 97 insertions(+)
 create mode 100644 
Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf
 create mode 100644 
Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c

diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc 
b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc
index 52e2b9b..077224d 100644
--- a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc
+++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc
@@ -55,6 +55,9 @@
 [Components.AARCH64]
   Silicon/Marvell/Armada7k8k/AcpiTables/Armada80x0McBin.inf
 
+[LibraryClasses.common]
+  
ArmadaBoardDescLib|Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf
+
 

 #
 # Pcd Section - list of all EDK II PCD Entries defined by this Platform
diff --git 
a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf
 
b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf
new file mode 100644
index 000..63a4f66
--- /dev/null
+++ 
b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf
@@ -0,0 +1,34 @@
+## @file
+#
+#  Copyright (C) 2018, Marvell International Ltd. and its affiliates
+#
+#  This program and the accompanying materials are licensed and made available
+#  under the terms and conditions of the BSD License which accompanies this
+#  distribution. The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
+#  IMPLIED.
+#
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = ArmadaMcBinBoardDescLib
+  FILE_GUID  = 8208558f-5f33-46e2-b5c5-43354384389e
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = ArmadaBoardDescLib
+
+[Sources]
+  Armada80x0McBinBoardDescLib.c
+
+[Packages]
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Marvell/Marvell.dec
+
+[LibraryClasses]
+  DebugLib
+  IoLib
diff --git 
a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c
 
b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c
new file mode 100644
index 000..d52adfc
--- /dev/null
+++ 
b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c
@@ -0,0 +1,60 @@
+/**
+*
+*  Copyright (C) 2018, Marvell International Ltd. and its affiliates.
+*
+*  This program and the accompanying materials are licensed and made available
+*  under the terms and conditions of the BSD License which accompanies this
+*  distribution. The full text of the license may be found at
+*  http://opensource.org/licenses/bsd-license.php
+*
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+*
+**/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+//
+// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib
+//
+STATIC
+MV_BOARD_SDMMC_DESC mMcBinSdMmcDescTemplate[] = {
+  { /* eMMC 0xF06E */
+0, /* SOC will be filled by MvBoardDescDxe */
+0, /* SdMmcDevCount will be filled by MvBoardDescDxe */
+FALSE, /* Xenon1v8Enabled */
+TRUE,  /* Xenon8BitBusEnabled */
+TRUE,  /* XenonSlowModeEnabled */
+0x40,  /* XenonTuningStepDivisor */
+EmbeddedSlot /* SlotType */
+  },
+  { /* SD/MMC 0xF278 */
+0, /* SOC will be filled by MvBoardDescDxe */
+0, /* SdMmcDevCount will be filled by MvBoardDescDxe */
+FALSE, /* Xenon1v8Enabled */
+FALSE, /* Xenon8BitBusEnabled */
+FALSE, /* XenonSlowModeEnabled */
+0x19,  /* XenonTuningStepDivisor */
+EmbeddedSlot /* SlotType */
+  }
+};
+
+EFI_STATUS
+EFIAPI
+ArmadaBoardDescSdMmcGet (
+  OUT UINTN   *SdMmcDevCount,
+  OUT MV_BOARD_SDMMC_DESC **SdMmcDesc
+  )
+{
+  *SdMmcDesc = mMcBinSdMmcDescTemplate;
+  

[edk2] [platforms: PATCH v6 2/8] Marvell/Library: ArmadaBoardDescLib: Extend SDMMC information

2018-11-18 Thread Marcin Wojtas
From: Tomasz Michalec 

Added fields specific for Xenon host controller and declaration
of ArmadaBoardDescSdMmcGet function.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
Reviewed-by: Ard Biesheuvel 
---
 Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 21 +++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h 
b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h
index ee8e06e..3fe2988 100644
--- a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h
+++ b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h
@@ -55,11 +55,30 @@ typedef struct {
 //
 // SDMMC devices per-board description
 //
+typedef enum {
+  RemovableSlot,
+  EmbeddedSlot,
+  SharedBusSlot,
+  UnknownSlot
+} MV_SDMMC_SLOT_TYPE;
+
 typedef struct {
   MV_SOC_SDMMC_DESC *SoC;
-  UINTN  SdMmcDevCount;
+  UINTNSdMmcDevCount;
+  BOOLEAN  Xenon1v8Enabled;
+  BOOLEAN  Xenon8BitBusEnabled;
+  BOOLEAN  XenonSlowModeEnabled;
+  UINT8XenonTuningStepDivisor;
+  MV_SDMMC_SLOT_TYPE SlotType;
 } MV_BOARD_SDMMC_DESC;
 
+EFI_STATUS
+EFIAPI
+ArmadaBoardDescSdMmcGet (
+  OUT UINTN   *SdMmcDevCount,
+  OUT MV_BOARD_SDMMC_DESC **SdMmcDesc
+  );
+
 //
 // XHCI devices per-board description
 //
-- 
2.7.4

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


[edk2] [platforms: PATCH v6 1/8] Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride

2018-11-18 Thread Marcin Wojtas
The newest changes in the SdMmcOverride protocol added additional
arguments to the NotifyPhase and Capability routines. Update
according places in the Synquacer Emmc driver.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
Reviewed-by: Ard Biesheuvel 
---
 Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c 
b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
index e0987c9..47f5ccc 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
@@ -72,6 +72,8 @@ STATIC VOID *mEventRegistration;
   @param[in]  ControllerHandle  The EFI_HANDLE of the controller.
   @param[in]  Slot  The 0 based slot index.
   @param[in,out]  SdMmcHcSlotCapability The SDHCI capability structure.
+  @param[in,out]  BaseClkFreq   The base clock frequency value that
+optionally can be updated.
 
   @retval EFI_SUCCESS   The override function completed successfully.
   @retval EFI_NOT_FOUND The specified controller or slot does not 
exist.
@@ -84,7 +86,8 @@ EFIAPI
 SynQuacerSdMmcCapability (
   IN  EFI_HANDLE  ControllerHandle,
   IN  UINT8   Slot,
-  IN  OUT VOID*SdMmcHcSlotCapability
+  IN OUT  VOID*SdMmcHcSlotCapability,
+  IN OUT  UINT32  *BaseClkFreq
   )
 {
   UINT64 Capability;
@@ -117,6 +120,7 @@ SynQuacerSdMmcCapability (
   @param[in]  PhaseType The type of operation and whether the
 hook is invoked right before (pre) or
 right after (post)
+  @param[in,out]  PhaseData The pointer to a phase-specific data.
 
   @retval EFI_SUCCESS   The override function completed successfully.
   @retval EFI_NOT_FOUND The specified controller or slot does not 
exist.
@@ -129,7 +133,8 @@ EFIAPI
 SynQuacerSdMmcNotifyPhase (
   IN  EFI_HANDLE  ControllerHandle,
   IN  UINT8   Slot,
-  IN  EDKII_SD_MMC_PHASE_TYPE PhaseType
+  IN  EDKII_SD_MMC_PHASE_TYPE PhaseType,
+  IN OUT  VOID   *PhaseData
   )
 {
   if (ControllerHandle != mSdMmcControllerHandle) {
-- 
2.7.4

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


[edk2] [platforms: PATCH v6 0/8] Armada7k8k Xenon driver rework

2018-11-18 Thread Marcin Wojtas
Hi,

The sixth version of the patchset applies minor correction in the
last patch and also simplifies the BoardDesc library callbacks.
There is no unnecessary allocation now.

Patches are available in the github:
https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/xenon-upstream-r20181119

Generic driver patches with fixes and extended SdMmcOverride protocol:
https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/sdmmc-override-upstream-r20181109

I'm looking forward to the comments and remarks.

Best regards,
Marcin

Changelog:
v5->v6:
* 3,4,5
  - pass the pointer to the static table directly instead of
the copy allocation

* 6/8
  - remove freeing SdMmc board description structure in
NonDiscoverableDevicesDxe, as from now on the static
table will be used

* 8/8
  - change SdMmcOverride protocol comment to '#PRODUCES'
  - s/Controler/Controller/
  - remove freeing board description structure

v4->v5:
* 1,2,6/8
  - add Ard's RB

* 2,3,4,5
  - change parameters to OUT
  - assign count only after allocation is successful

* 7/8 & 8/8
  - split driver rework patches into two steps

v3->v4:
* 1/7:
  - add Ard's RB

* 2/7:
  - use local enum definition for SlotType in order not to include MdeModulePkg
private header

* 7/7:
  - rework capability handling, without using the structure defined in the
MdeModulePkg header

v2->v3
* 1/7:
  - rename NotifyPhase parameter to PhaseData

* 7/7:
  - rename NotifyPhase parameter to PhaseData
  - update UHS_MODE_SEL only for HS200/HS400
 in XenonSdMmcHcUhsSignaling
  - use local macros for standard SDHC registers in order not to
include private MdeModulePkg header

v1 -> v2
* 1/7 and 7/7 - adjust to modified SdMmcOverride
  NotifyPhase and Capability routines


Marcin Wojtas (2):
  Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride
  Marvell/Drivers: XenonDxe: Remove SdMmcPciHcDxe files

Tomasz Michalec (6):
  Marvell/Library: ArmadaBoardDescLib: Extend SDMMC information
  SolidRun/Armada80x0McBin: Introduce board description library
  Marvell/Armada70x0Db: Introduce board description library
  Marvell/Armada80x0Db: Introduce board description library
  Marvell/Drivers: MvBoardDesc: Extend information for SdMmc
  Marvell/Drivers: XenonDxe: Switch to use generic SdMmcPciHcDxe

 Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc  
   |3 +-
 Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc 
   |3 +
 Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc 
   |3 +
 Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc  
   |3 +
 Silicon/Marvell/Armada7k8k/Armada7k8k.fdf  
   |3 +-
 
Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf
   |   34 +
 
Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf
   |   34 +
 
Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf
 |   34 +
 Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf   
   |1 +
 Silicon/Marvell/Drivers/SdMmc/XenonDxe/{SdMmcPciHcDxe.inf => XenonDxe.inf} 
   |   33 +-
 Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.h 
   |  791 
 Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHci.h   
   |  550 --
 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonPciHci.h   
   |  151 ++
 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdMmcOverride.h
   |   53 +
 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdhci.h
   |  131 +-
 Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h   
   |   21 +-
 
Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c
 |   60 +
 
Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c
 |   60 +
 
Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c
   |   60 +
 Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c 
   |   24 +-
 Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.c
   |1 -
 Silicon/Marvell/Drivers/SdMmc/XenonDxe/ComponentName.c 
   |  211 ---
 Silicon/Marvell/Drivers/SdMmc/XenonDxe/EmmcDevice.c
   | 1164 
 Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdDevice.c  
   | 1190 
 Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.c 
   | 1320 

[edk2] 答复: EmulatorPkg/Unix/Host fixed numeric pad function

2018-11-18 Thread Liu Yu
Liming,



  Ok, because the origin code in Unix Host numeric pad has no function in shell 
environment .

I have tested the X11 ABI on my hand (Ubuntu 18.04), no matter “numlock” is 
activated or not ,we can’t get “XK_KP_0 ~ XK_KP_9” from  XGetKeyboardMapping  
We just can get “numLock” key status.









发送自 Windows 10 版邮件应用




发件人: Gao, Liming 
发送时间: Monday, November 19, 2018 8:52:10 AM
收件人: Liu Yu; "af...@apple.com; jordan.l.jus...@intel.com ; ruiyu.ni"@intel.com
抄送: edk2-devel@lists.01.org
主题: RE: [edk2] EmulatorPkg/Unix/Host fixed numeric pad function

Yu:
  Could you add the reason why make this change?

  Besides, please add Contributed-under: TianoCore Contribution Agreement 1.1 
before Signed-off-by. And, add Cc: to the package maintainers. Then, use git 
send-email to send this patch.

Thanks
Liming
>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Liu
>Yu
>Sent: Sunday, November 18, 2018 10:54 PM
>To: "af...@apple.com; jordan.l.jus...@intel.com ; ruiyu.ni"@intel.com
>Cc: edk2-devel@lists.01.org
>Subject: [edk2] EmulatorPkg/Unix/Host fixed numeric pad function
>
>add numeric pad key map
>
>Signed-off-by: Pedroa Liu 
>---
>  EmulatorPkg/Unix/Host/X11GraphicsWindow.c | 54 ++-
>
>  1 file changed, 43 insertions(+), 11 deletions(-)
>
>diff --git a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
>b/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
>index a3cc28c223..573f0f1bfd 100644
>--- a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
>+++ b/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
>@@ -271,7 +271,14 @@ handleKeyEvent (
>  }
>}
>
>-  // Skipping EFI_MENU_KEY_PRESSED and EFI_SYS_REQ_PRESSED
>+  if ((ev->xkey.state & Mod2Mask) == 0) {
>+Drv->KeyState.KeyToggleState &= ~EFI_NUM_LOCK_ACTIVE;
>+  } else {
>+if (Make) {
>+  Drv->KeyState.KeyToggleState |= EFI_NUM_LOCK_ACTIVE;
>+}
>+  }
>+ // Skipping EFI_MENU_KEY_PRESSED and EFI_SYS_REQ_PRESSED
>
>switch (*KeySym) {
>case XK_Control_R:
>@@ -328,35 +335,70 @@ handleKeyEvent (
>  break;
>
>case XK_KP_Home:
>+if ((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE))) {
>+  KeyData.Key.UnicodeChar = L'7'; break;
>+}
>case XK_Home:   KeyData.Key.ScanCode = SCAN_HOME; break;
>
>case XK_KP_End:
>+if ((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE))) {
>+  KeyData.Key.UnicodeChar = L'1'; break;
>+}
>case XK_End:KeyData.Key.ScanCode = SCAN_END; break;
>
>case XK_KP_Left:
>+if ((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE))) {
>+  KeyData.Key.UnicodeChar = L'4'; break;
>+}
>case XK_Left:   KeyData.Key.ScanCode = SCAN_LEFT; break;
>
>case XK_KP_Right:
>+if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+  KeyData.Key.UnicodeChar = L'6'; break;
>+}
>case XK_Right:  KeyData.Key.ScanCode = SCAN_RIGHT; break;
>
>case XK_KP_Up:
>+if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+  KeyData.Key.UnicodeChar = L'8'; break;
>+}
>case XK_Up: KeyData.Key.ScanCode = SCAN_UP; break;
>
>case XK_KP_Down:
>+if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+  KeyData.Key.UnicodeChar = L'2'; break;
>+}
>case XK_Down:   KeyData.Key.ScanCode = SCAN_DOWN; break;
>
>case XK_KP_Delete:
>+if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+  KeyData.Key.UnicodeChar = L'.'; break;
>+}
>case XK_Delete:   KeyData.Key.ScanCode = SCAN_DELETE; break;
>
>case XK_KP_Insert:
>+if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+  KeyData.Key.UnicodeChar = L'0';break;
>+}
>case XK_Insert: KeyData.Key.ScanCode = SCAN_INSERT; break;
>
>case XK_KP_Page_Up:
>+if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+  KeyData.Key.UnicodeChar = L'9'; break;
>+}
>case XK_Page_Up:KeyData.Key.ScanCode = SCAN_PAGE_UP; break;
>
>case XK_KP_Page_Down:
>+if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ 

Re: [edk2] [PATCH v2] MdeModulePkg: Remove PcdIdentifyMappingPageTablePtr

2018-11-18 Thread Zeng, Star
Reviewed-by: Star Zeng 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Shenglei 
Zhang
Sent: Monday, November 19, 2018 12:39 PM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu ; Zeng, Star 
Subject: [edk2] [PATCH v2] MdeModulePkg: Remove PcdIdentifyMappingPageTablePtr

PcdIdentifyMappingPageTablePtr was used to share page table buffer between 
modules.
Buf after some changes on 2015/07/17, it was useless and could be removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1304

v2:
1.Remove PcdIdentifyMappingPageTablePtr in MdeModulePkg.uni.
2.Update the commit message.

Cc: Star Zeng 
Cc: Jian J Wang 
Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
---
 MdeModulePkg/MdeModulePkg.dec | 6 --  MdeModulePkg/MdeModulePkg.uni | 4 

 2 files changed, 10 deletions(-)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec 
index 428eeeb670..0abacc1a90 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2007,12 +2007,6 @@
   # @ValidList  0x8001 | 0x0
   
gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptTablePrivateSmmDataPtr|0x0|UINT64|0x00030001
 
-  ## This dynamic PCD hold an address to point to the memory of page table. 
The page table establishes a 1:1
-  #  Virtual to Physical mapping according to the processor physical address 
bits.
-  # @Prompt Identify Mapping Page Table pointer.
-  # @ValidList  0x8001 | 0x0
-  
gEfiMdeModulePkgTokenSpaceGuid.PcdIdentifyMappingPageTablePtr|0x0|UINT64|0x00030002
-
   ## This dynamic PCD holds the information if there is any test key used by 
the platform.
   # @Prompt If there is any test key used by the platform.
   gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed|FALSE|BOOLEAN|0x00030003
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni 
index 5fa7a6ae30..038e848505 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -914,10 +914,6 @@

   "this PCD to be TURE if and only if all runtime driver has seperated 
Code/Data\n"

   "section. If PE code/data sections are merged, the result is 
unpredictable.\n"
 
-#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdIdentifyMappingPageTablePtr_PROMPT  
#language en-US "Identify Mapping Page Table pointer."
-
-#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdIdentifyMappingPageTablePtr_HELP 
 #language en-US "This dynamic PCD hold an address to point to the memory of 
page table. The page table establishes a 1:1\n"
-   
 "Virtual to Physical mapping according to the processor 
physical address bits."
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdShadowPeimOnBoot_HELP  #language 
en-US "Indicates if to shadow PEIM and PeiCore after memory is ready.\n"

  "This PCD is used on other boot path except for S3 boot.\n"

  "TRUE  - Shadow PEIM and PeiCore after memory is ready.\n"
--
2.18.0.windows.1

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


Re: [edk2] [PATCH 6/8] IntelFrameworkPkg: Remove the redundant INFs

2018-11-18 Thread Gao, Liming
Mike:
  The long term goal is to remove IntelFrameworkPkg. I propose to remove its 
contents step by step. Now, some unused modules or header files are very clear. 
They can be removed now. But, others (such as Legacy definitions) are still 
consumed by LegacyBios and 8259/8254 drivers. We have no solution or clear plan 
to drop legacy support. They may still be kept for a while. 

Thanks
Liming
>-Original Message-
>From: Kinney, Michael D
>Sent: Wednesday, November 14, 2018 1:18 PM
>To: Zhang, Shenglei ; Ni, Ruiyu
>; edk2-devel@lists.01.org; Kinney, Michael D
>
>Cc: Gao, Liming 
>Subject: RE: [edk2] [PATCH 6/8] IntelFrameworkPkg: Remove the redundant
>INFs
>
>Shenglei,
>
>I would prefer we work towards the goal of removing
>the use of the Intel Framework Packages by all platforms
>so the entire packages can be removed from edk2/master.
>
>This would be better than trying to remove a few items
>at a time.
>
>Thanks,
>
>Mike
>
>> -Original Message-
>> From: Zhang, Shenglei
>> Sent: Tuesday, November 13, 2018 7:32 PM
>> To: Ni, Ruiyu ; edk2-
>> de...@lists.01.org
>> Cc: Kinney, Michael D ;
>> Gao, Liming 
>> Subject: RE: [edk2] [PATCH 6/8] IntelFrameworkPkg:
>> Remove the redundant INFs
>>
>> Ray
>> Thanks for your constructive comments. I'll improve it
>> in next version.
>>
>> Thanks,
>> Shenglei
>> > -Original Message-
>> > From: Ni, Ruiyu
>> > Sent: Wednesday, November 14, 2018 11:12 AM
>> > To: Zhang, Shenglei ; edk2-
>> de...@lists.01.org
>> > Cc: Kinney, Michael D ;
>> Gao, Liming
>> > 
>> > Subject: Re: [edk2] [PATCH 6/8] IntelFrameworkPkg:
>> Remove the redundant
>> > INFs
>> >
>> > On 11/13/2018 4:35 PM, Shenglei Zhang wrote:
>> > > All INFs of unused Library instances in
>> IntelFrameworkPkg
>> > > are removed as they are not actually used.
>> > > https://bugzilla.tianocore.org/show_bug.cgi?id=1190
>> > >
>> > > Cc: Liming Gao 
>> > > Cc: Michael D Kinney 
>> > > Contributed-under: TianoCore Contribution Agreement
>> 1.1
>> > > Signed-off-by: Shenglei Zhang
>> 
>> > > ---
>> > >   IntelFrameworkPkg/IntelFrameworkPkg.dsc | 7 -
>> --
>> > >   1 file changed, 7 deletions(-)
>> > >
>> > > diff --git
>> a/IntelFrameworkPkg/IntelFrameworkPkg.dsc
>> > b/IntelFrameworkPkg/IntelFrameworkPkg.dsc
>> > > index bd5df8c5d9..802a80e3eb 100644
>> > > --- a/IntelFrameworkPkg/IntelFrameworkPkg.dsc
>> > > +++ b/IntelFrameworkPkg/IntelFrameworkPkg.dsc
>> > > @@ -63,13 +63,6 @@
>> > >   #   generated for it, but the binary will not
>> be put into any firmware
>> > volume.
>> > >   #
>> > >
>> >
>> ###
>> ###
>> > #
>> > > -[Components]
>> > > -
>> IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.i
>> nf
>> > > -
>> IntelFrameworkPkg/Library/FrameworkUefiLib/FrameworkUef
>> iLib.inf
>> > > -
>> >
>> IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DxeSmm
>> DriverEntryP
>> > oint.inf
>> > > -
>> >
>> IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/PeiSmbusL
>> ibSmbusPpi.in
>> > f
>> > > -
>> >
>> IntelFrameworkPkg/Library/PeiHobLibFramework/PeiHobLibF
>> ramework.inf
>> > > -
>> > >   [BuildOptions]
>> > > *_*_*_CC_FLAGS = -D
>> DISABLE_NEW_DEPRECATED_INTERFACES
>> > >
>> > >
>> > Shenglei,
>> > You cannot remove the INF in the separate patch like
>> this.
>> > You should either put this patch in the first patch
>> in your serial,
>> > or combine the DSC change with your library removal.
>> > The goal is the the build won't fail when committing
>> the patches one by one.
>> >
>> > --
>> > Thanks,
>> > Ray
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v3 0/6] ArmPkg related changes for StandaloneMM package

2018-11-18 Thread Sughosh Ganu
hi Ard,

On Thu Oct 25, 2018 at 01:02:33PM +0530, Sughosh Ganu wrote:
> The following patch series adds support for Management Mode related
> changes for aarch64 based platforms.
> 
> Changes since v2:
> Based on review comments from Ard, moved the memory attribute updation
> changes out of DebugPeCoffExtraActionLib into an extra action library
> added in StandaloneMM package. The patch for setting the memory
> attributes, now under StandaloneMmPkg directory, will be submitted
> separately from this series.

Can you please review the V3 of this series. Based on your review
comments, i have moved the memory attribute updation into an extra
action lib added under StandaloneMmPkg. Can you please check if these
updated patches for ArmPkg[1] and the one under StandaloneMmPkg[2] are
fine.

I had put you and Leif on Cc while sending out the patches, but i
think that the mailserver deleted those, which is why you may have
missed the patches.

-sughosh

[1] - https://lists.01.org/pipermail/edk2-devel/2018-October/031377.html
[2] - https://lists.01.org/pipermail/edk2-devel/2018-October/031384.html

> 
> 
> Achin Gupta (5):
>   ArmPkg: Add PCDs needed for MM communication driver.
>   ArmPkg/Drivers: Add EFI_MM_COMMUNICATION_PROTOCOL DXE driver.
>   ArmPkg/Include: Add MM interface SVC return codes.
>   ArmPkg/ArmMmuLib: Add MMU Library suitable for use in S-EL0.
>   ArmPkg/ArmMmuLib: Add MMU library inf file suitable for use in S-EL0.
> 
> Sughosh Ganu (1):
>   ArmPkg/Include: Fix the SPM version SVC ID
> 
>  ArmPkg/ArmPkg.dec
> |   3 +
>  ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
> |  56 +++
>  ArmPkg/Library/ArmMmuLib/{ArmMmuPeiLib.inf => ArmMmuStandaloneMmCoreLib.inf} 
> |  23 +-
>  ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h
> |  28 ++
>  ArmPkg/Include/IndustryStandard/ArmMmSvc.h   
> |   9 +-
>  ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c  
> | 395 
>  ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuStandaloneMmCoreLib.c 
> | 204 ++
>  7 files changed, 704 insertions(+), 14 deletions(-)
>  create mode 100644 ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
>  copy ArmPkg/Library/ArmMmuLib/{ArmMmuPeiLib.inf => 
> ArmMmuStandaloneMmCoreLib.inf} (51%)
>  create mode 100644 ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h
>  create mode 100644 ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c
>  create mode 100644 
> ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuStandaloneMmCoreLib.c
> 
> -- 
> 2.7.4
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

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


Re: [edk2] [PATCH v3 0/6] ArmPkg related changes for StandaloneMM package

2018-11-18 Thread Sughosh Ganu
hi Ard,

On Thu Oct 25, 2018 at 01:02:33PM +0530, Sughosh Ganu wrote:
> The following patch series adds support for Management Mode related
> changes for aarch64 based platforms.
> 
> Changes since v2:
> Based on review comments from Ard, moved the memory attribute updation
> changes out of DebugPeCoffExtraActionLib into an extra action library
> added in StandaloneMM package. The patch for setting the memory
> attributes, now under StandaloneMmPkg directory, will be submitted
> separately from this series.

Can you please review the V3 of this series. Based on your review
comments, i have moved the memory attribute updation into an extra
action lib added under StandaloneMmPkg. Can you please check if these
updated patches for ArmPkg[1] and the one under StandaloneMmPkg[2] are
fine.

I had put you and Leif on Cc while sending out the patches, but i
think that the mailserver deleted those, which is why you may have
missed the patches.

-sughosh

[1] - https://lists.01.org/pipermail/edk2-devel/2018-October/031377.html
[2] - https://lists.01.org/pipermail/edk2-devel/2018-October/031384.html

> 
> 
> Achin Gupta (5):
>   ArmPkg: Add PCDs needed for MM communication driver.
>   ArmPkg/Drivers: Add EFI_MM_COMMUNICATION_PROTOCOL DXE driver.
>   ArmPkg/Include: Add MM interface SVC return codes.
>   ArmPkg/ArmMmuLib: Add MMU Library suitable for use in S-EL0.
>   ArmPkg/ArmMmuLib: Add MMU library inf file suitable for use in S-EL0.
> 
> Sughosh Ganu (1):
>   ArmPkg/Include: Fix the SPM version SVC ID
> 
>  ArmPkg/ArmPkg.dec
> |   3 +
>  ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
> |  56 +++
>  ArmPkg/Library/ArmMmuLib/{ArmMmuPeiLib.inf => ArmMmuStandaloneMmCoreLib.inf} 
> |  23 +-
>  ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h
> |  28 ++
>  ArmPkg/Include/IndustryStandard/ArmMmSvc.h   
> |   9 +-
>  ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c  
> | 395 
>  ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuStandaloneMmCoreLib.c 
> | 204 ++
>  7 files changed, 704 insertions(+), 14 deletions(-)
>  create mode 100644 ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
>  copy ArmPkg/Library/ArmMmuLib/{ArmMmuPeiLib.inf => 
> ArmMmuStandaloneMmCoreLib.inf} (51%)
>  create mode 100644 ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h
>  create mode 100644 ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c
>  create mode 100644 
> ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuStandaloneMmCoreLib.c
> 
> -- 
> 2.7.4
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

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


[edk2] [PATCH 2/3] IntelFrameworkModulePkg: Remove PeiS3Lib and PeiRecoveryLib

2018-11-18 Thread Shenglei Zhang
As was described in 5933acc3cb1ac1a344a34342d0ac46d3afed929a,
there was no code using AcpiS3ResumeOs() interface in S3Lib and
PeiRecoverFirmware() interface in RecoveryLib.
PeiS3Lib and PeiRecoveryLib were deprecated,so they should be removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1299

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../IntelFrameworkModulePkg.dsc   |  2 -
 .../Library/PeiRecoveryLib/PeiRecoveryLib.c   | 50 --
 .../Library/PeiRecoveryLib/PeiRecoveryLib.inf | 50 --
 .../Library/PeiRecoveryLib/PeiRecoveryLib.uni | 23 -
 .../Library/PeiS3Lib/PeiS3Lib.c   | 51 ---
 .../Library/PeiS3Lib/PeiS3Lib.inf | 49 --
 .../Library/PeiS3Lib/PeiS3Lib.uni | 23 -
 7 files changed, 248 deletions(-)
 delete mode 100644 
IntelFrameworkModulePkg/Library/PeiRecoveryLib/PeiRecoveryLib.c
 delete mode 100644 
IntelFrameworkModulePkg/Library/PeiRecoveryLib/PeiRecoveryLib.inf
 delete mode 100644 
IntelFrameworkModulePkg/Library/PeiRecoveryLib/PeiRecoveryLib.uni
 delete mode 100644 IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.c
 delete mode 100644 IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf
 delete mode 100644 IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.uni

diff --git a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc 
b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc
index 894c5340a0..28e8a3f6e1 100644
--- a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc
+++ b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc
@@ -110,8 +110,6 @@
 [Components]
   
IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
   
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
-  IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf
-  IntelFrameworkModulePkg/Library/PeiRecoveryLib/PeiRecoveryLib.inf
   
IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
   
IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeReportStatusCodeLibFramework.inf
   
IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
diff --git a/IntelFrameworkModulePkg/Library/PeiRecoveryLib/PeiRecoveryLib.c 
b/IntelFrameworkModulePkg/Library/PeiRecoveryLib/PeiRecoveryLib.c
deleted file mode 100644
index d9430483d5..00
--- a/IntelFrameworkModulePkg/Library/PeiRecoveryLib/PeiRecoveryLib.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/** @file
-  This Library uses Framework RecoveryModule PPI to do system recovery.
-
-  This library instance is no longer used and module using this library
-  class should update to directly locate EFI_PEI_RECOVERY_MODULE_PPI defined
-  in PI 1.2 specification.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD 
License
-which accompanies this distribution.  The full text of the license may be 
found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-/**
-  Calling this function causes the system do recovery.
-
-  @retval EFI_SUCESS   Sucess to do recovery.
-  @retval Others   Fail to do recovery.
-**/
-EFI_STATUS
-EFIAPI
-PeiRecoverFirmware (
-  VOID
-  )
-{
-  EFI_STATUS  Status;
-  EFI_PEI_RECOVERY_MODULE_PPI *PeiRecovery;
-
-  Status = PeiServicesLocatePpi (
- ,
- 0,
- NULL,
- (VOID **)
- );
-  ASSERT_EFI_ERROR (Status);
-
-  return PeiRecovery->LoadRecoveryCapsule ((EFI_PEI_SERVICES  **) 
GetPeiServicesTablePointer(), PeiRecovery);
-}
-
diff --git a/IntelFrameworkModulePkg/Library/PeiRecoveryLib/PeiRecoveryLib.inf 
b/IntelFrameworkModulePkg/Library/PeiRecoveryLib/PeiRecoveryLib.inf
deleted file mode 100644
index f62b42e40f..00
--- a/IntelFrameworkModulePkg/Library/PeiRecoveryLib/PeiRecoveryLib.inf
+++ /dev/null
@@ -1,50 +0,0 @@
-## @file
-#  PEIM Recovery Library supports system recovery boot.
-#
-#  This library instance is no longer used and module using this library
-#  class should update to directly locate EFI_PEI_RECOVERY_MODULE_PPI defined
-#  in PI 1.2 specification.
-#
-#  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-#
-#  This program and the accompanying materials
-#  are licensed and made available under the terms and conditions of the BSD 
License
-#  which accompanies this distribution. The full text of the license may be 
found at
-#  http://opensource.org/licenses/bsd-license.php
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN 

[edk2] [PATCH 0/3] Remove S3Lib and RecoveryLib class

2018-11-18 Thread Shenglei Zhang
S3Lib and RecoveryLib have been deprecated since 2009.
There is no code using AcpiS3ResumeOs() interface in 
S3Lib and PeiRecoverFirmware() interface in RecoveryLib.
So they can be removed from edk2 repo.
https://bugzilla.tianocore.org/show_bug.cgi?id=1299

Cc: Zailiang Sun 
Cc: Star Zeng 
Cc: Jian J Wang 
Cc: Ruiyu Ni 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
Shenglei Zhang (3):
  MdeModulePkg: Remove PeiS3LibNull and PeiRecoveryLibNull
  IntelFrameworkModulePkg: Remove PeiS3Lib and PeiRecoveryLib
  Vlv2TbltDevicePkg: Remove PeiS3Lib in DSC

 .../IntelFrameworkModulePkg.dsc   |  2 -
 .../Library/PeiRecoveryLib/PeiRecoveryLib.c   | 50 --
 .../Library/PeiRecoveryLib/PeiRecoveryLib.inf | 50 --
 .../Library/PeiRecoveryLib/PeiRecoveryLib.uni | 23 -
 .../Library/PeiS3Lib/PeiS3Lib.c   | 51 ---
 .../Library/PeiS3Lib/PeiS3Lib.inf | 49 --
 .../Library/PeiS3Lib/PeiS3Lib.uni | 23 -
 MdeModulePkg/Core/DxeIplPeim/DxeIpl.h |  2 -
 .../PeiRecoveryLibNull/PeiRecoveryLibNull.c   | 34 -
 .../PeiRecoveryLibNull/PeiRecoveryLibNull.inf | 39 --
 .../PeiRecoveryLibNull/PeiRecoveryLibNull.uni | 24 -
 .../Library/PeiS3LibNull/PeiS3LibNull.c   | 35 -
 .../Library/PeiS3LibNull/PeiS3LibNull.inf | 40 ---
 .../Library/PeiS3LibNull/PeiS3LibNull.uni | 24 -
 MdeModulePkg/MdeModulePkg.dec | 10 
 MdeModulePkg/MdeModulePkg.dsc |  2 -
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc   |  3 --
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc |  3 --
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc  |  3 --
 19 files changed, 467 deletions(-)
 delete mode 100644 
IntelFrameworkModulePkg/Library/PeiRecoveryLib/PeiRecoveryLib.c
 delete mode 100644 
IntelFrameworkModulePkg/Library/PeiRecoveryLib/PeiRecoveryLib.inf
 delete mode 100644 
IntelFrameworkModulePkg/Library/PeiRecoveryLib/PeiRecoveryLib.uni
 delete mode 100644 IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.c
 delete mode 100644 IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf
 delete mode 100644 IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.uni
 delete mode 100644 MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.c
 delete mode 100644 
MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf
 delete mode 100644 
MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.uni
 delete mode 100644 MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.c
 delete mode 100644 MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.inf
 delete mode 100644 MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.uni

-- 
2.18.0.windows.1

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


[edk2] [PATCH 3/3] Vlv2TbltDevicePkg: Remove PeiS3Lib in DSC

2018-11-18 Thread Shenglei Zhang
PeiS3Lib is not actually used in Vlv2TbltDevicePkg, so it
is removed in DSC.
https://bugzilla.tianocore.org/show_bug.cgi?id=1299

Cc: Zailiang Sun 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 3 ---
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 3 ---
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc| 3 ---
 3 files changed, 9 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
index f0a689c2c4..736155f4e0 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
@@ -180,9 +180,6 @@
   TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
 !endif
-!if $(S3_ENABLE) == TRUE
-  S3Lib|IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf
-!endif
 
   
OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
 !if $(CAPSULE_ENABLE) == TRUE
diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
index c7908818b4..3bb37a34ab 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
@@ -180,9 +180,6 @@
   TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
 !endif
-!if $(S3_ENABLE) == TRUE
-  S3Lib|IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf
-!endif
 
   
OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
 !if $(CAPSULE_ENABLE) == TRUE
diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
index cc8ad9508e..1e405dfb1b 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
@@ -180,9 +180,6 @@
   TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
 !endif
-!if $(S3_ENABLE) == TRUE
-  S3Lib|IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf
-!endif
 
   
OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
 !if $(CAPSULE_ENABLE) == TRUE
-- 
2.18.0.windows.1

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


[edk2] [PATCH 1/3] MdeModulePkg: Remove PeiS3LibNull and PeiRecoveryLibNull

2018-11-18 Thread Shenglei Zhang
As was described in 5933acc3cb1ac1a344a34342d0ac46d3afed929a,
there was no code using AcpiS3ResumeOs() interface in S3Lib and
PeiRecoverFirmware() interface in RecoveryLib.
PeiS3LibNull and PeiRecoveryLibNull were deprecated,
so they should be removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1299

Cc: Star Zeng 
Cc: Jian J Wang 
Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 MdeModulePkg/Core/DxeIplPeim/DxeIpl.h |  2 -
 .../PeiRecoveryLibNull/PeiRecoveryLibNull.c   | 34 
 .../PeiRecoveryLibNull/PeiRecoveryLibNull.inf | 39 --
 .../PeiRecoveryLibNull/PeiRecoveryLibNull.uni | 24 ---
 .../Library/PeiS3LibNull/PeiS3LibNull.c   | 35 
 .../Library/PeiS3LibNull/PeiS3LibNull.inf | 40 ---
 .../Library/PeiS3LibNull/PeiS3LibNull.uni | 24 ---
 MdeModulePkg/MdeModulePkg.dec | 10 -
 MdeModulePkg/MdeModulePkg.dsc |  2 -
 9 files changed, 210 deletions(-)
 delete mode 100644 MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.c
 delete mode 100644 
MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf
 delete mode 100644 
MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.uni
 delete mode 100644 MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.c
 delete mode 100644 MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.inf
 delete mode 100644 MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.uni

diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h 
b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
index 9ea88a399b..bd0c967d75 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
@@ -44,8 +44,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
diff --git a/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.c 
b/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.c
deleted file mode 100644
index f39a21b711..00
--- a/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/** @file
-  Null Recovery Library instance does nothing and returns unsupported status.
-
-  This library instance is no longer used and module using this library
-  class should update to directly locate EFI_PEI_RECOVERY_MODULE_PPI defined
-  in PI 1.2 specification.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD 
License
-which accompanies this distribution.  The full text of the license may be 
found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-#include 
-#include 
-
-/**
-  Calling this function causes the system do recovery boot path.
-
-  @retval EFI_UNSUPPORTED   Recovery is not supported.
-**/
-EFI_STATUS
-EFIAPI
-PeiRecoverFirmware (
-  VOID
-  )
-{
-  return EFI_UNSUPPORTED;
-}
-
diff --git a/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf 
b/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf
deleted file mode 100644
index c1cdd70162..00
--- a/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf
+++ /dev/null
@@ -1,39 +0,0 @@
-## @file
-#  Null Recovery library instance for PEIM module
-#  This library instance is no longer used and module using this library
-#  class should update to directly locate EFI_PEI_RECOVERY_MODULE_PPI defined
-#  in PI 1.2 specification.
-#
-#  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-#  This program and the accompanying materials
-#  are licensed and made available under the terms and conditions of the BSD 
License
-#  which accompanies this distribution.  The full text of the license may be 
found at
-#  http://opensource.org/licenses/bsd-license.php
-#
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
-#
-##
-
-[Defines]
-  INF_VERSION= 0x00010005
-  BASE_NAME  = PeiRecoveryLibNull
-  MODULE_UNI_FILE= PeiRecoveryLibNull.uni
-  FILE_GUID  = 41789FB9-02AC-4484-BD40-A3147D7EDA25
-  MODULE_TYPE= PEIM
-  VERSION_STRING = 1.0
-  LIBRARY_CLASS  = RecoveryLib|PEIM
-
-#
-# The following information is for reference only and not required by the 
build tools.
-#
-#  VALID_ARCHITECTURES   = IA32 X64 EBC (EBC is for build only)
-#
-
-[Sources]
-  PeiRecoveryLibNull.c
-
-[Packages]
-  MdePkg/MdePkg.dec
-  MdeModulePkg/MdeModulePkg.dec
-
diff --git 

[edk2] [PATCH v2] MdeModulePkg: Remove PcdIdentifyMappingPageTablePtr

2018-11-18 Thread Shenglei Zhang
PcdIdentifyMappingPageTablePtr was used to share page
table buffer between modules.
Buf after some changes on 2015/07/17, it was useless
and could be removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1304

v2:
1.Remove PcdIdentifyMappingPageTablePtr in MdeModulePkg.uni.
2.Update the commit message.

Cc: Star Zeng 
Cc: Jian J Wang 
Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
---
 MdeModulePkg/MdeModulePkg.dec | 6 --
 MdeModulePkg/MdeModulePkg.uni | 4 
 2 files changed, 10 deletions(-)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 428eeeb670..0abacc1a90 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2007,12 +2007,6 @@
   # @ValidList  0x8001 | 0x0
   
gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptTablePrivateSmmDataPtr|0x0|UINT64|0x00030001
 
-  ## This dynamic PCD hold an address to point to the memory of page table. 
The page table establishes a 1:1
-  #  Virtual to Physical mapping according to the processor physical address 
bits.
-  # @Prompt Identify Mapping Page Table pointer.
-  # @ValidList  0x8001 | 0x0
-  
gEfiMdeModulePkgTokenSpaceGuid.PcdIdentifyMappingPageTablePtr|0x0|UINT64|0x00030002
-
   ## This dynamic PCD holds the information if there is any test key used by 
the platform.
   # @Prompt If there is any test key used by the platform.
   gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed|FALSE|BOOLEAN|0x00030003
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index 5fa7a6ae30..038e848505 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -914,10 +914,6 @@

   "this PCD to be TURE if and only if all runtime driver has seperated 
Code/Data\n"

   "section. If PE code/data sections are merged, the result is 
unpredictable.\n"
 
-#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdIdentifyMappingPageTablePtr_PROMPT  
#language en-US "Identify Mapping Page Table pointer."
-
-#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdIdentifyMappingPageTablePtr_HELP 
 #language en-US "This dynamic PCD hold an address to point to the memory of 
page table. The page table establishes a 1:1\n"
-   
 "Virtual to Physical mapping according to the processor 
physical address bits."
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdShadowPeimOnBoot_HELP  #language 
en-US "Indicates if to shadow PEIM and PeiCore after memory is ready.\n"

  "This PCD is used on other boot path except for S3 boot.\n"

  "TRUE  - Shadow PEIM and PeiCore after memory is ready.\n"
-- 
2.18.0.windows.1

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


[edk2] [patch] MdePkg: check Length para before use in DevPathToTextUsbWWID

2018-11-18 Thread Dandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1336

In function DevPathToTextUsbWWID, the Length parameter is used
without check. This patch is to add check before using it.

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 MdePkg/Library/UefiDevicePathLib/DevicePathToText.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c 
b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
index 97d279eeb2..678f3d0a92 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
@@ -970,11 +970,11 @@ DevPathToTextUsbWWID (
 
   UsbWWId = DevPath;
 
   SerialNumberStr = (CHAR16 *) ((UINT8 *) UsbWWId + sizeof 
(USB_WWID_DEVICE_PATH));
   Length = (UINT16) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) 
UsbWWId) - sizeof (USB_WWID_DEVICE_PATH)) / sizeof (CHAR16));
-  if (SerialNumberStr [Length - 1] != 0) {
+  if (Length >= 1 && SerialNumberStr [Length - 1] != 0) {
 //
 // In case no NULL terminator in SerialNumber, create a new one with NULL 
terminator
 //
 NewStr = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), 
SerialNumberStr);
 ASSERT (NewStr != NULL);
-- 
2.18.0.windows.1

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


[edk2] [patch] MdePkg: Check input Ptrs in GetSectionFromAnyFvByFileType

2018-11-18 Thread Dandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1337

In function GetSectionFromAnyFvByFileType, the input parameter "Buffer"
and "size" should not be NULL, so add ASSERT here to avoid any checker
report that the NULL pointer may be used.

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 MdePkg/Library/DxeServicesLib/DxeServicesLib.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/MdePkg/Library/DxeServicesLib/DxeServicesLib.c 
b/MdePkg/Library/DxeServicesLib/DxeServicesLib.c
index d4f366425f..e78d51cb92 100644
--- a/MdePkg/Library/DxeServicesLib/DxeServicesLib.c
+++ b/MdePkg/Library/DxeServicesLib/DxeServicesLib.c
@@ -251,10 +251,13 @@ GetSectionFromAnyFvByFileType  (
   UINTN Key;
   EFI_GUID  NameGuid;
   EFI_FV_FILE_ATTRIBUTESAttributes;
   EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
 
+  ASSERT (Buffer != NULL);
+  ASSERT (Size != NULL);
+
   //
   // Locate all available FVs.
   //
   HandleBuffer = NULL;
   Status = gBS->LocateHandleBuffer (
-- 
2.18.0.windows.1

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


Re: [edk2] [PATCH v1 1/1] UefiCpuPkg: [CVE-2017-5715] Stuff RSB before RSM

2018-11-18 Thread Dong, Eric
Reviewed-by: Eric Dong 

> -Original Message-
> From: Wu, Hao A
> Sent: Friday, November 16, 2018 9:37 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A ; Yao, Jiewen ;
> Laszlo Ersek ; Kinney, Michael D
> ; Dong, Eric 
> Subject: [PATCH v1 1/1] UefiCpuPkg: [CVE-2017-5715] Stuff RSB before RSM
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1093
> 
> Return Stack Buffer (RSB) is used to predict the target of RET
> instructions. When the RSB underflows, some processors may fall back to
> using branch predictors. This might impact software using the retpoline
> mitigation strategy on those processors.
> 
> This commit will add RSB stuffing logic before returning from SMM (the RSM
> instruction) to avoid interfering with non-SMM usage of the retpoline
> technique.
> 
> After the stuffing, RSB entries will contain a trap like:
> 
> SpecTrap:
> pause
> lfence
> jmp SpecTrap
> 
> A more detailed explanation of the purpose of commit is under the
> 'Branch target injection mitigation' section of the below link:
> https://software.intel.com/security-software-guidance/insights/host-
> firmware-speculative-execution-side-channel-mitigation
> 
> This commit introduces a .INC file that contains the RSB logic and it can
> be included by .ASM files. This file is placed at directory
> 'UefiCpuPkg/Include/'.
> 
> Cc: Jiewen Yao 
> Cc: Laszlo Ersek 
> Cc: Michael D Kinney 
> Cc: Eric Dong 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Hao Wu 
> ---
>  UefiCpuPkg/Include/StuffRsbAsm.inc  | 60 
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm |  5 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.asm  |  5 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm  |  5 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.asm   |  5 +-
>  5 files changed, 76 insertions(+), 4 deletions(-)
> 
> diff --git a/UefiCpuPkg/Include/StuffRsbAsm.inc
> b/UefiCpuPkg/Include/StuffRsbAsm.inc
> new file mode 100644
> index 00..df36ad
> --- /dev/null
> +++ b/UefiCpuPkg/Include/StuffRsbAsm.inc
> @@ -0,0 +1,60 @@
> +;--
>  ;
> +; Copyright (c) 2018, Intel Corporation. All rights reserved.
> +; This program and the accompanying materials
> +; are licensed and made available under the terms and conditions of the BSD
> License
> +; which accompanies this distribution.  The full text of the license may be
> found at
> +; http://opensource.org/licenses/bsd-license.php.
> +;
> +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +;
> +; Module Name:
> +;
> +;   StuffRsbAsm.inc
> +;
> +; Abstract:
> +;
> +;   This file provides macro definitions for stuffing the Return Stack Buffer
> (RSB)
> +;   for .ASM files.
> +;
> +;---
> +
> +RSB_STUFF_ENTRIESEqu20h
> +
> +;
> +; parameters:
> +; @param 1: register to use as counter (e.g. IA32:eax, X64:rax)
> +; @param 2: stack pointer to restore   (IA32:esp, X64:rsp)
> +; @param 3: the size of a stack frame  (IA32:4, X64:8)
> +;
> +StuffRsb MACRO   Reg, StackPointer, Size
> + local   Unroll1, Unroll2, SpecTrap1, SpecTrap2, StuffLoop
> + mov Reg, RSB_STUFF_ENTRIES / 2
> +Unroll1:
> + callUnroll2
> +SpecTrap1:
> + pause
> + lfence
> + jmp SpecTrap1
> +Unroll2:
> + callStuffLoop
> +SpecTrap2:
> + pause
> + lfence
> + jmp SpecTrap2
> +StuffLoop:
> + dec Reg
> + jnz Unroll1
> + add StackPointer, RSB_STUFF_ENTRIES * Size ; Restore the 
> stack
> pointer
> + ENDM
> +
> +;
> +; RSB stuffing macros for IA32 and X64
> +;
> +StuffRsb32   MACRO
> + StuffRsbeax, esp, 4
> + ENDM
> +
> +StuffRsb64   MACRO
> + StuffRsbrax, rsp, 8
> + ENDM
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm
> b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm
> index ac1a9b48dd..ea906d6434 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm
> @@ -1,5 +1,5 @@
>  
> ;--
>  ;
> -; Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
> +; Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
>  ; This program and the accompanying materials
>  ; are licensed and made available under the terms and conditions of the BSD
> License
>  ; which accompanies this distribution.  The full text of the license may be
> found at
> @@ -22,6 +22,8 @@
>  .model  flat,C
>  .xmm
> 
> +INCLUDEStuffRsbAsm.inc
> +
>  DSC_OFFSETEQU 0fb00h
>  DSC_GDTPTREQU 30h
>  DSC_GDTSIZEQU 38h

Re: [edk2] [platforms: PATCH v5 8/8] Marvell/Drivers: XenonDxe: Switch to use generic SdMmcPciHcDxe

2018-11-18 Thread Ard Biesheuvel
On Sun, 18 Nov 2018 at 14:20, Marcin Wojtas  wrote:
>
> Hi Ard,
>
>
> > > +**/
> > > +EFI_STATUS
> > > +EFIAPI
> > > +XenonHcRwMmio (
> > > +  IN EFI_PCI_IO_PROTOCOL   *PciIo,
> > > +  IN UINT8 BarIndex,
> > > +  IN UINT32Offset,
> > > +  IN BOOLEAN   Read,
> > > +  IN UINT8 Count,
> > > +  IN OUT VOID  *Data
> > > +  )
> > > +{
> > > +  EFI_STATUS   Status;
> > > +
> > > +  if ((PciIo == NULL) || (Data == NULL))  {
> > > +return EFI_INVALID_PARAMETER;
> > > +  }
> > > +
> > > +  if ((Count != 1) && (Count != 2) && (Count != 4) && (Count != 8)) {
> > > +return EFI_INVALID_PARAMETER;
> > > +  }
> > > +
> > > +  if (Read) {
> > > +Status = PciIo->Mem.Read (
> > > +  PciIo,
> > > +  EfiPciIoWidthUint8,
> > > +  BarIndex,
> > > +  (UINT64) Offset,
> > > +  Count,
> > > +  Data
> > > +  );
> > > +  } else {
> > > +Status = PciIo->Mem.Write (
> > > +  PciIo,
> > > +  EfiPciIoWidthUint8,
> > > +  BarIndex,
> > > +  (UINT64) Offset,
> > > +  Count,
> > > +  Data
> > > +  );
> > > +  }
> > > +
> >
> > I guess this is an issue that existed before in the code, but it looks
> > like you are only doing byte for byte reads and writes here. Is that
> > intentional?
> >
>
> XenonHcRwMmio is 1:1 to generic MdeModulePkg's SdMmcHcRwMmio, as well
> as all other SdMmc mmio accessors. I really prefer not to modify any
> of them and keep the code aligned as-is.
>

Fair enough.


> > > +  return Status;
> > > +}
> > > +
> > > +/**
> > > +  Do OR operation with the value of the specified SD/MMC host controller 
> > > mmio register.
> > > +
> > > +  @param[in] PciIo The PCI IO protocol instance.
> > > +  @param[in] BarIndex  The BAR index of the standard PCI 
> > > Configuration
> > > +   header to use as the base address for the 
> > > memory
> > > +   operation to perform.
> > > +  @param[in] OffsetThe offset within the selected BAR to 
> > > start the
> > > +   memory operation.
> > > +  @param[in] Count The width of the mmio register in bytes.
> > > +   Must be 1, 2 , 4 or 8 bytes.
> > > +  @param[in] OrDataThe pointer to the data used to do OR 
> > > operation.
> > > +   The caller is responsible for having 
> > > ownership of
> > > +   the data buffer and ensuring its size not 
> > > less than
> > > +   Count bytes.
> > > +
> > > +  @retval EFI_INVALID_PARAMETER The PciIo or OrData is NULL or the Count 
> > > is not valid.
> > > +  @retval EFI_SUCCESS   The OR operation succeeds.
> > > +  @retval OthersThe OR operation fails.
> > > +
> > > +**/
> > > +EFI_STATUS
> > > +EFIAPI
> > > +XenonHcOrMmio (
> > > +  IN  EFI_PCI_IO_PROTOCOL  *PciIo,
> > > +  IN  UINT8BarIndex,
> > > +  IN  UINT32   Offset,
> > > +  IN  UINT8Count,
> > > +  IN  VOID *OrData
> > > +  )
> > > +{
> > > +  EFI_STATUS   Status;
> > > +  UINT64   Data;
> > > +  UINT64   Or;
> > > +
> > > +  Status = XenonHcRwMmio (PciIo, BarIndex, Offset, TRUE, Count, );
> > > +  if (EFI_ERROR (Status)) {
> > > +return Status;
> > > +  }
> > > +
> > > +  if (Count == 1) {
> > > +Or = *(UINT8*) OrData;
> > > +  } else if (Count == 2) {
> > > +Or = *(UINT16*) OrData;
> > > +  } else if (Count == 4) {
> > > +Or = *(UINT32*) OrData;
> > > +  } else if (Count == 8) {
> > > +Or = *(UINT64*) OrData;
> > > +  } else {
> > > +return EFI_INVALID_PARAMETER;
> > > +  }
> > > +
> > > +  Data  |= Or;
> > > +  Status = XenonHcRwMmio (PciIo, BarIndex, Offset, FALSE, Count, );
> > > +
> > > +  return Status;
> > > +}
> > > +
> > > +/**
> > > +  Do AND operation with the value of the specified SD/MMC host 
> > > controller mmio register.
> > > +
> > > +  @param[in] PciIo The PCI IO protocol instance.
> > > +  @param[in] BarIndex  The BAR index of the standard PCI 
> > > Configuration
> > > +   header to use as the base address for the 
> > > memory
> > > +   operation to perform.
> > > +  @param[in] OffsetThe offset within the selected BAR to 
> > > start the
> > > +   memory operation.
> > > +  @param[in] Count The width of the mmio register in bytes.
> > > +  

Re: [edk2] [PATCH v2 2/2] SecurityPkg/OpalPWSupportLib: [CVE-2017-5753] Fix bounds check bypass

2018-11-18 Thread Dong, Eric
Reviewed-by: Eric Dong 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Hao Wu
> Sent: Friday, November 16, 2018 12:13 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A ; Laszlo Ersek ;
> Yao, Jiewen ; Zhang, Chao B
> ; Zeng, Star 
> Subject: [edk2] [PATCH v2 2/2] SecurityPkg/OpalPWSupportLib: [CVE-2017-
> 5753] Fix bounds check bypass
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1194
> 
> Speculative execution is used by processor to avoid having to wait for
> data to arrive from memory, or for previous operations to finish, the
> processor may speculate as to what will be executed.
> 
> If the speculation is incorrect, the speculatively executed instructions
> might leave hints such as which memory locations have been brought into
> cache. Malicious actors can use the bounds check bypass method (code
> gadgets with controlled external inputs) to infer data values that have
> been used in speculative operations to reveal secrets which should not
> otherwise be accessed.
> 
> This commit will focus on the SMI handler(s) registered within the
> OpalPasswordSupportLib and insert AsmLfence API to mitigate the bounds
> check bypass issue.
> 
> For SMI handler SmmOpalPasswordHandler():
> 
> Under "case SMM_FUNCTION_SET_OPAL_PASSWORD:",
> '>OpalDevicePath' can points to a potential cross boundary
> access of the 'CommBuffer' (controlled external inputs) during speculative
> execution. This cross boundary access pointer is later passed as parameter
> 'DevicePath' into function OpalSavePasswordToSmm().
> 
> Within function OpalSavePasswordToSmm(), 'DevicePathLen' is an access to
> the content in 'DevicePath' and can be inferred by code:
> "CompareMem (>OpalDevicePath, DevicePath, DevicePathLen)". One
> can
> observe which part of the content within either '>OpalDevicePath' or
> 'DevicePath' was brought into cache to possibly reveal the value of
> 'DevicePathLen'.
> 
> Hence, this commit adds a AsmLfence() after the boundary/range checks of
> 'CommBuffer' to prevent the speculative execution.
> 
> A more detailed explanation of the purpose of commit is under the
> 'Bounds check bypass mitigation' section of the below link:
> https://software.intel.com/security-software-guidance/insights/host-
> firmware-speculative-execution-side-channel-mitigation
> 
> And the document at:
> https://software.intel.com/security-software-guidance/api-
> app/sites/default/files/337879-analyzing-potential-bounds-Check-bypass-
> vulnerabilities.pdf
> 
> Cc: Star Zeng 
> Cc: Chao Zhang 
> Cc: Jiewen Yao 
> Cc: Laszlo Ersek 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Hao Wu 
> ---
>  SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportLib.c | 7
> ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git
> a/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportLib.c
> b/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportLib.c
> index e377e9ca79..1c3bfffb86 100644
> ---
> a/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportLib.c
> +++
> b/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportLib.c
> @@ -1,7 +1,7 @@
>  /** @file
>Implementation of Opal password support library.
> 
> -Copyright (c) 2016, Intel Corporation. All rights reserved.
> +Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD
> License
>  which accompanies this distribution.  The full text of the license may be
> found at
> @@ -706,6 +706,11 @@ SmmOpalPasswordHandler (
>  Status = EFI_INVALID_PARAMETER;
>  goto EXIT;
>}
> +  //
> +  // The AsmLfence() call here is to ensure the above range checks for 
> the
> +  // CommBuffer have been completed before calling into
> OpalSavePasswordToSmm().
> +  //
> +  AsmLfence ();
> 
>Status = OpalSavePasswordToSmm (>OpalDevicePath,
> DeviceBuffer->Password, DeviceBuffer->PasswordLength);
>break;
> --
> 2.12.0.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] EmulatorPkg Unix Host Segmentation fault.

2018-11-18 Thread Jordan Justen
On 2018-11-18 14:37:09, Andrew Fish wrote:
> 
> 
> > On Nov 18, 2018, at 4:07 AM, Liu Yu  wrote:
> > 
> > sorry your  path can't fix this issue.   if this path just turn off 
> > optimization option within sec.c not global project.
> > 
> > I have tested different version GCC such as (GCC4,8, GCC5.x, GCC7.x)  
> > and all of them can duplicate this issue  (Ubuntu 16.04, 16.10,18.04 )
> > 
> > I have traced this issue on my hand.
> > 
> > you can see Dispatcher.c (MdeModulePkg/Pei/DIspatcher/) Line 792:
> > 
> > 
> > 790  if (StackOffsetPositive) {
> > 791   SecCoreData = (CONST EFI_SEC_PEI_HAND_OFF *)((UINTN)(VOID 
> > *)SecCoreData + StackOffset);
> > 792  Private = (PEI_CORE_INSTANCE *)((UINTN)(VOID *)Private + 
> > StackOffset);
> > 793 } else {
> > 794  ..
> > 795  ..
> > 796}
> > 
> >  790 --792 disassembly code
> > 
> >  0x10200f2ca :test %r14b,%r14b
> >  0x10200f2cd :je 0x10200f2df 
> > 
> >  0x10200f2cf :mov 0x38(%rsp),%rax
> >  0x10200f2d4 :lea 0x0(%rbp,%rax,1),%r14
> >  0x10200f2d9 :lea (%rbx,%rax,1),%rbp
> > 
> >  we can see Private value have been stored in %rbp  (rbp register be 
> > used as general register )   so when call 
> > TemporaryRamSupportPpi->TemporaryRamMigration()
> > 
> 
> The calling conventions define RBP as non-volatile must be preserved
> by callee. Using RBP as the frame pointer is optional.

This is kind of a mess. I think the definition of
EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI is really to blame. It probably
should not have been spec'd as 'change stack and return'. Instead, it
should have been given a new function pointer to switch-stack and call
into.

By returning with a switched stack, we don't really know what the
returning code could do with regard to the stack. For example, it
could have saved the stack value on the stack and then pop it into a
register and somehow switch the stack back to the old stack. It seems
unlikely, but I don't think anything prevents it.

Additionally, there is the issue of rbp/ebp being used as a frame
pointer. This can lead to some variables being used from the temp ram
location after we return from TemporaryRamMigration. (Assuming rbp/ebp
is not adjusted to point to the new stack.)

So, is it safe to adjust rbp? Unknown. It may not be if rbp is not
used as a frame pointer. Is it safe to *not* adjust rbp and
potentially allow the old temp ram stack to be used? Unknown.

Now, if TemporaryRamMigration received a new function to call into, we
can safely assume that the new stack transition would proceed as
expected without having to worry if a compiler is using rbp/ebp as a
framepointer or not.

Another advantage could have been that something like the BasePkg
SwitchStack function could have been used, hopefully preventing people
from trying to write error prone assembly code for
TemporaryRamMigration.

-Jordan

> Is it possible the assembly coder is assuming RBP is a frame
> pointer? That would imply for gcc/clang the correct answer would be
> to have compiler flags force frame pointer usage?
> 
> Assuming -O 0 does something seems like we are matching an
> implementation at a given point in time. I'd rather force the frame
> pointer usage (that is optional in the ABI) if that fixes the RBP
> usage assumption. I guess the other option would be to have
> different assembler if the compiler is using frame pointers or not.
> and I don't think we have that concept.
> 
> Given this is the common frame pointer pattern:
> 
> pushq   %rbp
> movq%rsp, %rbp
> ...
> popq%rbp
> retq
> 
> It follows the calling convention rules even if the frame pointer is
> not in general use. Thus it only seems like you would hit issues
> when you move the stack around.
> 
> Thanks,
> 
> Andrew Fish
> 
> PS Xcode clang always emits the frame pointer. 
> 
> > this function would modify rbp value because it treat rbp as "stack base 
> > address ".
> > 
> > 816 MigrateMemoryPages (Private, TRUE);
> > 
> > // Private pointer point to other address, so this function would get a 
> > NULL pointer that result in segment fault
> > 
> > I think we can turn off optimization options like this.
> > 
> > 1. modify  EmulatorPkg.dsc
> > 
> >   MdeModulePkg/Core/Pei/PeiMain.inf {
> >  
> >   GCC:*_*_*_CC_FLAGS = -O0
> >   }
> > 
> > Reference GCC Manual description:
> > 
> >   -O also turns on -fomit-frame-pointer on machines where doing so does 
> > not interfere with debugging.
> > 
> > 
> > 
> > 在 2018/11/18 下午5:27, Jordan Justen 写道:
> >> On 2018-11-17 20:51:11, Liu Yu wrote:
> >>> OS: Ubuntu
> >>> 
> >>> Toolchain:GCC48
> >> I don't have gcc-4.8, so I couldn't reproduce the issue, but I wonder
> >> if this branch can fix the issue for you?
> >> 
> >> https://github.com/jljusten/edk2/tree/emulator-temp-ram
> >> 
> >> You can fetch this branch locally to a branch named `test` with a
> >> command like this:
> >> 
> >> $ git fetch --no-tags 

Re: [edk2] [PATCH v2] MdeModulePkg/SdDxe: Fix potential NULL pointer access

2018-11-18 Thread Wu, Hao A
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jeff
> Brasen
> Sent: Friday, November 16, 2018 4:10 PM
> To: edk2-devel@lists.01.org
> Cc: Jeff Brasen
> Subject: [edk2] [PATCH v2] MdeModulePkg/SdDxe: Fix potential NULL pointer
> access
> 
> SdReadWrite can be called with a NULL Token for synchronous operations.
> Add guard for DEBUG print to only print event pointer with Token is not
> NULL.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jeff Brasen 

Thanks.

Reviewed-by: Hao Wu  and pushed at
5a16ba3ae18e6528cb83039951e15a4b76004949

Best Regards,
Hao Wu

> ---
>  MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> index b8d115a..a4695ff 100644
> --- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> +++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> @@ -670,8 +670,9 @@ SdReadWrite (
>  if (EFI_ERROR (Status)) {
>return Status;
>  }
> -DEBUG ((DEBUG_BLKIO, "Sd%a(): Lba 0x%x BlkNo 0x%x Event %p with %r\n",
> IsRead ? "Read" : "Write", Lba, BlockNum, Token->Event, Status));
> -
> +DEBUG ((DEBUG_BLKIO, "Sd%a(): Lba 0x%x BlkNo 0x%x Event %p
> with %r\n",
> +  IsRead ? "Read" : "Write", Lba, BlockNum,
> +  (Token != NULL) ? Token->Event : NULL, Status));
>  Lba   += BlockNum;
>  Buffer = (UINT8*)Buffer + BufferSize;
>  Remaining -= BlockNum;
> --
> 2.7.4
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] EmulatorPkg/Unix/Host fixed numeric pad function

2018-11-18 Thread Gao, Liming
Yu:
  Could you add the reason why make this change? 

  Besides, please add Contributed-under: TianoCore Contribution Agreement 1.1 
before Signed-off-by. And, add Cc: to the package maintainers. Then, use git 
send-email to send this patch. 

Thanks
Liming
>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Liu
>Yu
>Sent: Sunday, November 18, 2018 10:54 PM
>To: "af...@apple.com; jordan.l.jus...@intel.com ; ruiyu.ni"@intel.com
>Cc: edk2-devel@lists.01.org
>Subject: [edk2] EmulatorPkg/Unix/Host fixed numeric pad function
>
>add numeric pad key map
>
>Signed-off-by: Pedroa Liu 
>---
>  EmulatorPkg/Unix/Host/X11GraphicsWindow.c | 54 ++-
>
>  1 file changed, 43 insertions(+), 11 deletions(-)
>
>diff --git a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
>b/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
>index a3cc28c223..573f0f1bfd 100644
>--- a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
>+++ b/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
>@@ -271,7 +271,14 @@ handleKeyEvent (
>  }
>    }
>
>-  // Skipping EFI_MENU_KEY_PRESSED and EFI_SYS_REQ_PRESSED
>+  if ((ev->xkey.state & Mod2Mask) == 0) {
>+    Drv->KeyState.KeyToggleState &= ~EFI_NUM_LOCK_ACTIVE;
>+  } else {
>+    if (Make) {
>+  Drv->KeyState.KeyToggleState |= EFI_NUM_LOCK_ACTIVE;
>+    }
>+  }
>+ // Skipping EFI_MENU_KEY_PRESSED and EFI_SYS_REQ_PRESSED
>
>    switch (*KeySym) {
>    case XK_Control_R:
>@@ -328,35 +335,70 @@ handleKeyEvent (
>  break;
>
>    case XK_KP_Home:
>+    if ((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE))) {
>+  KeyData.Key.UnicodeChar = L'7'; break;
>+    }
>    case XK_Home:   KeyData.Key.ScanCode = SCAN_HOME; break;
>
>    case XK_KP_End:
>+    if ((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE))) {
>+  KeyData.Key.UnicodeChar = L'1'; break;
>+    }
>    case XK_End:    KeyData.Key.ScanCode = SCAN_END; break;
>
>    case XK_KP_Left:
>+    if ((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE))) {
>+  KeyData.Key.UnicodeChar = L'4'; break;
>+    }
>    case XK_Left:   KeyData.Key.ScanCode = SCAN_LEFT; break;
>
>    case XK_KP_Right:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+  KeyData.Key.UnicodeChar = L'6'; break;
>+    }
>    case XK_Right:  KeyData.Key.ScanCode = SCAN_RIGHT; break;
>
>    case XK_KP_Up:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+  KeyData.Key.UnicodeChar = L'8'; break;
>+    }
>    case XK_Up: KeyData.Key.ScanCode = SCAN_UP; break;
>
>    case XK_KP_Down:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+  KeyData.Key.UnicodeChar = L'2'; break;
>+    }
>    case XK_Down:   KeyData.Key.ScanCode = SCAN_DOWN; break;
>
>    case XK_KP_Delete:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+  KeyData.Key.UnicodeChar = L'.'; break;
>+    }
>    case XK_Delete:   KeyData.Key.ScanCode = SCAN_DELETE; break;
>
>    case XK_KP_Insert:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+  KeyData.Key.UnicodeChar = L'0';break;
>+    }
>    case XK_Insert: KeyData.Key.ScanCode = SCAN_INSERT; break;
>
>    case XK_KP_Page_Up:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+  KeyData.Key.UnicodeChar = L'9'; break;
>+    }
>    case XK_Page_Up:    KeyData.Key.ScanCode = SCAN_PAGE_UP; break;
>
>    case XK_KP_Page_Down:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+  KeyData.Key.UnicodeChar = L'3'; break;
>+    }
>    case XK_Page_Down:  KeyData.Key.ScanCode = SCAN_PAGE_DOWN; break;
>
>+  case XK_KP_Begin:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+  KeyData.Key.UnicodeChar = L'5'; break;
>+    }
>+    /* no map efi scan code */ break;
>    case XK_Escape: KeyData.Key.ScanCode = SCAN_ESC; break;
>
>    case XK_Pause:  KeyData.Key.ScanCode = SCAN_PAUSE; break;
>@@ -431,16 +473,6 @@ handleKeyEvent (
>    case XK_KP_Decimal    : 

Re: [edk2] [PATCH 2/2] Fixes: f89c018f3d "EmulatorPkg/Win: Enable 64bit (SEC, PEI, DXE all run at 64bit)"

2018-11-18 Thread Jordan Justen
Pushed as 90fa59f685. Thanks for the contribution!

-Jordan

On 2018-11-18 04:32:50, Liu Yu wrote:
> Fixes: f89c018f3d "EmulatorPkg/Win: Enable 64bit  (SEC,PEI,DXE all run 
> at 64bit)"
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> 
> Signed-off-by: Pedroa Liu 
> 
> diff --git a/EmulatorPkg/build.sh b/EmulatorPkg/build.sh
> index 3abdab1db9..9ed59387d1 100755
> --- a/EmulatorPkg/build.sh
> +++ b/EmulatorPkg/build.sh
> @@ -179,16 +179,16 @@ then
>     PROCESSOR=$HOST_PROCESSOR
>   fi
> 
> +BUILD_OUTPUT_DIR=$WORKSPACE/Build/Emulator$PROCESSOR
> +
>   case $PROCESSOR in
>     IA32)
>   ARCH_SIZE=32
> -    BUILD_OUTPUT_DIR=$WORKSPACE/Build/Emulator32
>   LIB_NAMES="ld-linux.so.2 libdl.so.2 crt1.o crti.o crtn.o"
>   LIB_SEARCH_PATHS="/usr/lib/i386-linux-gnu /usr/lib32 /lib32 
> /usr/lib /lib"
>   ;;
>     X64)
>   ARCH_SIZE=64
> -    BUILD_OUTPUT_DIR=$WORKSPACE/Build/EmulatorX64
>   LIB_NAMES="ld-linux-x86-64.so.2 libdl.so.2 crt1.o crti.o crtn.o"
>   LIB_SEARCH_PATHS="/usr/lib/x86_64-linux-gnu /usr/lib64 /lib64 
> /usr/lib /lib"
>   ;;
> -- 
> 2.17.1
> 
> 在 2018/11/18 下午3:12, Jordan Justen 写道:
> > I think 32-bit version is incorrect too.
> >
> > Can you delete BUILD_OUTPUT_DIR from both IA32 and X64 cases, and
> > following the case use:
> >
> > BUILD_OUTPUT_DIR=$WORKSPACE/Build/Emulator$PROCESSOR
> >
> > Can you add this to the commit message:
> >
> > Fixes: f89c018f3d "EmulatorPkg/Win: Enable 64bit (SEC,PEI,DXE all run at 
> > 64bit)"
> >
> > -Jordan
> >
> > On 2018-11-17 20:13:02, Liu Yu wrote:
> >> correction BUILD_OUTPUT_DIR path
> >>
> >> Contributed-under: TianoCore Contribution Agreement 1.1
> >>
> >> Signed-off-by: Pedroa Liu 
> >> ---
> >>    EmulatorPkg/build.sh | 2 +-
> >>    1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/EmulatorPkg/build.sh b/EmulatorPkg/build.sh
> >> index 339c6b3b4f..3abdab1db9 100755
> >> --- a/EmulatorPkg/build.sh
> >> +++ b/EmulatorPkg/build.sh
> >> @@ -188,7 +188,7 @@ case $PROCESSOR in
> >>    ;;
> >>      X64)
> >>    ARCH_SIZE=64
> >> -    BUILD_OUTPUT_DIR=$WORKSPACE/Build/Emulator
> >> +    BUILD_OUTPUT_DIR=$WORKSPACE/Build/EmulatorX64
> >>    LIB_NAMES="ld-linux-x86-64.so.2 libdl.so.2 crt1.o crti.o crtn.o"
> >>    LIB_SEARCH_PATHS="/usr/lib/x86_64-linux-gnu /usr/lib64 /lib64
> >> /usr/lib /lib"
> >>    ;;
> >> -- 
> >> 2.17.1
> >>
> >> ___
> >> edk2-devel mailing list
> >> edk2-devel@lists.01.org
> >> https://lists.01.org/mailman/listinfo/edk2-devel
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] EmulatorPkg Unix Host Segmentation fault.

2018-11-18 Thread Andrew Fish


> On Nov 18, 2018, at 4:07 AM, Liu Yu  wrote:
> 
> sorry your  path can't fix this issue.   if this path just turn off 
> optimization option within sec.c not global project.
> 
> I have tested different version GCC such as (GCC4,8, GCC5.x, GCC7.x)  
> and all of them can duplicate this issue  (Ubuntu 16.04, 16.10,18.04 )
> 
> I have traced this issue on my hand.
> 
> you can see Dispatcher.c (MdeModulePkg/Pei/DIspatcher/) Line 792:
> 
> 
> 790  if (StackOffsetPositive) {
> 791   SecCoreData = (CONST EFI_SEC_PEI_HAND_OFF *)((UINTN)(VOID 
> *)SecCoreData + StackOffset);
> 792  Private = (PEI_CORE_INSTANCE *)((UINTN)(VOID *)Private + 
> StackOffset);
> 793 } else {
> 794  ..
> 795  ..
> 796}
> 
>  790 --792 disassembly code
> 
>  0x10200f2ca :test %r14b,%r14b
>  0x10200f2cd :je 0x10200f2df 
> 
>  0x10200f2cf :mov 0x38(%rsp),%rax
>  0x10200f2d4 :lea 0x0(%rbp,%rax,1),%r14
>  0x10200f2d9 :lea (%rbx,%rax,1),%rbp
> 
>  we can see Private value have been stored in %rbp  (rbp register be 
> used as general register )   so when call 
> TemporaryRamSupportPpi->TemporaryRamMigration()
> 

The calling conventions define RBP as non-volatile must be preserved by callee. 
Using RBP as the frame pointer is optional. 

Is it possible the assembly coder is assuming RBP is a frame pointer? That 
would imply for gcc/clang the correct answer would be to have compiler flags 
force frame pointer usage? 

Assuming -O 0 does something seems like we are matching an implementation at a 
given point in time. I'd rather force the frame pointer usage (that is optional 
in the ABI) if that fixes the RBP usage assumption. I guess the other option 
would be to have different assembler if the compiler is using frame pointers or 
not. and I don't think we have that concept. 

Given this is the common frame pointer pattern:

pushq   %rbp
movq%rsp, %rbp
...
popq%rbp
retq

It follows the calling convention rules even if the frame pointer is not in 
general use. Thus it only seems like you would hit issues when you move the 
stack around. 

Thanks,

Andrew Fish

PS Xcode clang always emits the frame pointer. 

> this function would modify rbp value because it treat rbp as "stack base 
> address ".
> 
> 816 MigrateMemoryPages (Private, TRUE);
> 
> // Private pointer point to other address, so this function would get a 
> NULL pointer that result in segment fault
> 
> I think we can turn off optimization options like this.
> 
> 1. modify  EmulatorPkg.dsc
> 
>   MdeModulePkg/Core/Pei/PeiMain.inf {
>  
>   GCC:*_*_*_CC_FLAGS = -O0
>   }
> 
> Reference GCC Manual description:
> 
>   -O also turns on -fomit-frame-pointer on machines where doing so does 
> not interfere with debugging.
> 
> 
> 
> 在 2018/11/18 下午5:27, Jordan Justen 写道:
>> On 2018-11-17 20:51:11, Liu Yu wrote:
>>> OS: Ubuntu
>>> 
>>> Toolchain:GCC48
>> I don't have gcc-4.8, so I couldn't reproduce the issue, but I wonder
>> if this branch can fix the issue for you?
>> 
>> https://github.com/jljusten/edk2/tree/emulator-temp-ram
>> 
>> You can fetch this branch locally to a branch named `test` with a
>> command like this:
>> 
>> $ git fetch --no-tags https://github.com/jljusten/edk2.git 
>> emulator-temp-ram:test
>> 
>> Then checkout the `test` branch to try it.
>> 
>> First, there is some patches to cleanup Sec, but then I added a patch:
>> 
>> 53a432e149 "EmulatorPkg/Sec: Disable optimizations for TemporaryRamMigration 
>> function"
>> 
>> Which I hope might help in your case.
>> 
>> -Jordan
>> 
>>> Issue Description :
>>> 
>>>   Program received signal SIGSEGV, Segmentation fault.
>>>at 
>>> /home/pedroa/workspace/orign/edkcrb/MdeModulePkg/Core/Pei/Memory/MemoryServices.c:129
>>> 129  Private->MemoryPages.Size = (UINTN) 
>>> (Private->HobList.HandoffInformationTable->EfiMemoryTop -
>>> 
>>> 
>>> if the GCC optimization option is used not -O0 so the "rbp" register will 
>>> be used as "general register"
>>> 
>>> in the SecTemporaryRamSupport function as below, this function will modify 
>>> the rbp (as general register not stack base address pointer)value that 
>>> result in program crash.
>>> 
>>> ASM_PFX(SecTemporaryRamSupport):
>>>   // Adjust callers %rbp to account for stack move
>>>   subq%rdx, %rbp // Calc offset of %rbp in Temp Memory
>>>   addq%r8,  %rbp // add in permanent base to offset
>>> 
>>> ___
>>> edk2-devel mailing list
>>> edk2-devel@lists.01.org
>>> https://lists.01.org/mailman/listinfo/edk2-devel

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


Re: [edk2] [platforms: PATCH v5 8/8] Marvell/Drivers: XenonDxe: Switch to use generic SdMmcPciHcDxe

2018-11-18 Thread Marcin Wojtas
Hi Ard,


> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +XenonHcRwMmio (
> > +  IN EFI_PCI_IO_PROTOCOL   *PciIo,
> > +  IN UINT8 BarIndex,
> > +  IN UINT32Offset,
> > +  IN BOOLEAN   Read,
> > +  IN UINT8 Count,
> > +  IN OUT VOID  *Data
> > +  )
> > +{
> > +  EFI_STATUS   Status;
> > +
> > +  if ((PciIo == NULL) || (Data == NULL))  {
> > +return EFI_INVALID_PARAMETER;
> > +  }
> > +
> > +  if ((Count != 1) && (Count != 2) && (Count != 4) && (Count != 8)) {
> > +return EFI_INVALID_PARAMETER;
> > +  }
> > +
> > +  if (Read) {
> > +Status = PciIo->Mem.Read (
> > +  PciIo,
> > +  EfiPciIoWidthUint8,
> > +  BarIndex,
> > +  (UINT64) Offset,
> > +  Count,
> > +  Data
> > +  );
> > +  } else {
> > +Status = PciIo->Mem.Write (
> > +  PciIo,
> > +  EfiPciIoWidthUint8,
> > +  BarIndex,
> > +  (UINT64) Offset,
> > +  Count,
> > +  Data
> > +  );
> > +  }
> > +
>
> I guess this is an issue that existed before in the code, but it looks
> like you are only doing byte for byte reads and writes here. Is that
> intentional?
>

XenonHcRwMmio is 1:1 to generic MdeModulePkg's SdMmcHcRwMmio, as well
as all other SdMmc mmio accessors. I really prefer not to modify any
of them and keep the code aligned as-is.

Best regards,
Marcin

> > +  return Status;
> > +}
> > +
> > +/**
> > +  Do OR operation with the value of the specified SD/MMC host controller 
> > mmio register.
> > +
> > +  @param[in] PciIo The PCI IO protocol instance.
> > +  @param[in] BarIndex  The BAR index of the standard PCI 
> > Configuration
> > +   header to use as the base address for the 
> > memory
> > +   operation to perform.
> > +  @param[in] OffsetThe offset within the selected BAR to start 
> > the
> > +   memory operation.
> > +  @param[in] Count The width of the mmio register in bytes.
> > +   Must be 1, 2 , 4 or 8 bytes.
> > +  @param[in] OrDataThe pointer to the data used to do OR 
> > operation.
> > +   The caller is responsible for having 
> > ownership of
> > +   the data buffer and ensuring its size not 
> > less than
> > +   Count bytes.
> > +
> > +  @retval EFI_INVALID_PARAMETER The PciIo or OrData is NULL or the Count 
> > is not valid.
> > +  @retval EFI_SUCCESS   The OR operation succeeds.
> > +  @retval OthersThe OR operation fails.
> > +
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +XenonHcOrMmio (
> > +  IN  EFI_PCI_IO_PROTOCOL  *PciIo,
> > +  IN  UINT8BarIndex,
> > +  IN  UINT32   Offset,
> > +  IN  UINT8Count,
> > +  IN  VOID *OrData
> > +  )
> > +{
> > +  EFI_STATUS   Status;
> > +  UINT64   Data;
> > +  UINT64   Or;
> > +
> > +  Status = XenonHcRwMmio (PciIo, BarIndex, Offset, TRUE, Count, );
> > +  if (EFI_ERROR (Status)) {
> > +return Status;
> > +  }
> > +
> > +  if (Count == 1) {
> > +Or = *(UINT8*) OrData;
> > +  } else if (Count == 2) {
> > +Or = *(UINT16*) OrData;
> > +  } else if (Count == 4) {
> > +Or = *(UINT32*) OrData;
> > +  } else if (Count == 8) {
> > +Or = *(UINT64*) OrData;
> > +  } else {
> > +return EFI_INVALID_PARAMETER;
> > +  }
> > +
> > +  Data  |= Or;
> > +  Status = XenonHcRwMmio (PciIo, BarIndex, Offset, FALSE, Count, );
> > +
> > +  return Status;
> > +}
> > +
> > +/**
> > +  Do AND operation with the value of the specified SD/MMC host controller 
> > mmio register.
> > +
> > +  @param[in] PciIo The PCI IO protocol instance.
> > +  @param[in] BarIndex  The BAR index of the standard PCI 
> > Configuration
> > +   header to use as the base address for the 
> > memory
> > +   operation to perform.
> > +  @param[in] OffsetThe offset within the selected BAR to start 
> > the
> > +   memory operation.
> > +  @param[in] Count The width of the mmio register in bytes.
> > +   Must be 1, 2 , 4 or 8 bytes.
> > +  @param[in] AndData   The pointer to the data used to do AND 
> > operation.
> > +   The caller is responsible for having 
> > ownership of
> > +   the data buffer and ensuring its size not 
> > less than
> > +

[edk2] EmulatorPkg/Unix/Host fixed numeric pad function

2018-11-18 Thread Liu Yu
add numeric pad key map

Signed-off-by: Pedroa Liu 
---
  EmulatorPkg/Unix/Host/X11GraphicsWindow.c | 54 ++-
  1 file changed, 43 insertions(+), 11 deletions(-)

diff --git a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c 
b/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
index a3cc28c223..573f0f1bfd 100644
--- a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
+++ b/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
@@ -271,7 +271,14 @@ handleKeyEvent (
  }
    }

-  // Skipping EFI_MENU_KEY_PRESSED and EFI_SYS_REQ_PRESSED
+  if ((ev->xkey.state & Mod2Mask) == 0) {
+    Drv->KeyState.KeyToggleState &= ~EFI_NUM_LOCK_ACTIVE;
+  } else {
+    if (Make) {
+  Drv->KeyState.KeyToggleState |= EFI_NUM_LOCK_ACTIVE;
+    }
+  }
+ // Skipping EFI_MENU_KEY_PRESSED and EFI_SYS_REQ_PRESSED

    switch (*KeySym) {
    case XK_Control_R:
@@ -328,35 +335,70 @@ handleKeyEvent (
  break;

    case XK_KP_Home:
+    if ((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | 
EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState & 
(EFI_NUM_LOCK_ACTIVE))) {
+  KeyData.Key.UnicodeChar = L'7'; break;
+    }
    case XK_Home:   KeyData.Key.ScanCode = SCAN_HOME; break;

    case XK_KP_End:
+    if ((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | 
EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState & 
(EFI_NUM_LOCK_ACTIVE))) {
+  KeyData.Key.UnicodeChar = L'1'; break;
+    }
    case XK_End:    KeyData.Key.ScanCode = SCAN_END; break;

    case XK_KP_Left:
+    if ((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | 
EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState & 
(EFI_NUM_LOCK_ACTIVE))) {
+  KeyData.Key.UnicodeChar = L'4'; break;
+    }
    case XK_Left:   KeyData.Key.ScanCode = SCAN_LEFT; break;

    case XK_KP_Right:
+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | 
EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState & 
(EFI_NUM_LOCK_ACTIVE)) ){
+  KeyData.Key.UnicodeChar = L'6'; break;
+    }
    case XK_Right:  KeyData.Key.ScanCode = SCAN_RIGHT; break;

    case XK_KP_Up:
+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | 
EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState & 
(EFI_NUM_LOCK_ACTIVE)) ){
+  KeyData.Key.UnicodeChar = L'8'; break;
+    }
    case XK_Up: KeyData.Key.ScanCode = SCAN_UP; break;

    case XK_KP_Down:
+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | 
EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState & 
(EFI_NUM_LOCK_ACTIVE)) ){
+  KeyData.Key.UnicodeChar = L'2'; break;
+    }
    case XK_Down:   KeyData.Key.ScanCode = SCAN_DOWN; break;

    case XK_KP_Delete:
+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | 
EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState & 
(EFI_NUM_LOCK_ACTIVE)) ){
+  KeyData.Key.UnicodeChar = L'.'; break;
+    }
    case XK_Delete:   KeyData.Key.ScanCode = SCAN_DELETE; break;

    case XK_KP_Insert:
+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | 
EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState & 
(EFI_NUM_LOCK_ACTIVE)) ){
+  KeyData.Key.UnicodeChar = L'0';break;
+    }
    case XK_Insert: KeyData.Key.ScanCode = SCAN_INSERT; break;

    case XK_KP_Page_Up:
+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | 
EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState & 
(EFI_NUM_LOCK_ACTIVE)) ){
+  KeyData.Key.UnicodeChar = L'9'; break;
+    }
    case XK_Page_Up:    KeyData.Key.ScanCode = SCAN_PAGE_UP; break;

    case XK_KP_Page_Down:
+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | 
EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState & 
(EFI_NUM_LOCK_ACTIVE)) ){
+  KeyData.Key.UnicodeChar = L'3'; break;
+    }
    case XK_Page_Down:  KeyData.Key.ScanCode = SCAN_PAGE_DOWN; break;

+  case XK_KP_Begin:
+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | 
EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState & 
(EFI_NUM_LOCK_ACTIVE)) ){
+  KeyData.Key.UnicodeChar = L'5'; break;
+    }
+    /* no map efi scan code */ break;
    case XK_Escape: KeyData.Key.ScanCode = SCAN_ESC; break;

    case XK_Pause:  KeyData.Key.ScanCode = SCAN_PAUSE; break;
@@ -431,16 +473,6 @@ handleKeyEvent (
    case XK_KP_Decimal    : KeyData.Key.UnicodeChar = L'.'; break;
    case XK_KP_Divide : KeyData.Key.UnicodeChar = L'/'; break;

-  case XK_KP_0    : KeyData.Key.UnicodeChar = L'0'; break;
-  case XK_KP_1    : KeyData.Key.UnicodeChar = L'1'; break;
-  case XK_KP_2    : KeyData.Key.UnicodeChar = L'2'; break;
-  case XK_KP_3    : KeyData.Key.UnicodeChar = L'3'; break;
-  case XK_KP_4    : KeyData.Key.UnicodeChar = L'4'; break;
-  case XK_KP_5    : KeyData.Key.UnicodeChar = L'5'; break;
-  case XK_KP_6    : KeyData.Key.UnicodeChar = L'6'; break;
-  case XK_KP_7    : KeyData.Key.UnicodeChar = L'7'; break;
-  case XK_KP_8    : KeyData.Key.UnicodeChar = L'8'; break;
-  case XK_KP_9    : KeyData.Key.UnicodeChar 

Re: [edk2] [PATCH 2/2] Fixes: f89c018f3d "EmulatorPkg/Win: Enable 64bit (SEC, PEI, DXE all run at 64bit)"

2018-11-18 Thread Liu Yu
Fixes: f89c018f3d "EmulatorPkg/Win: Enable 64bit  (SEC,PEI,DXE all run 
at 64bit)"

Contributed-under: TianoCore Contribution Agreement 1.1

Signed-off-by: Pedroa Liu 

diff --git a/EmulatorPkg/build.sh b/EmulatorPkg/build.sh
index 3abdab1db9..9ed59387d1 100755
--- a/EmulatorPkg/build.sh
+++ b/EmulatorPkg/build.sh
@@ -179,16 +179,16 @@ then
    PROCESSOR=$HOST_PROCESSOR
  fi

+BUILD_OUTPUT_DIR=$WORKSPACE/Build/Emulator$PROCESSOR
+
  case $PROCESSOR in
    IA32)
  ARCH_SIZE=32
-    BUILD_OUTPUT_DIR=$WORKSPACE/Build/Emulator32
  LIB_NAMES="ld-linux.so.2 libdl.so.2 crt1.o crti.o crtn.o"
  LIB_SEARCH_PATHS="/usr/lib/i386-linux-gnu /usr/lib32 /lib32 
/usr/lib /lib"
  ;;
    X64)
  ARCH_SIZE=64
-    BUILD_OUTPUT_DIR=$WORKSPACE/Build/EmulatorX64
  LIB_NAMES="ld-linux-x86-64.so.2 libdl.so.2 crt1.o crti.o crtn.o"
  LIB_SEARCH_PATHS="/usr/lib/x86_64-linux-gnu /usr/lib64 /lib64 
/usr/lib /lib"
  ;;
-- 
2.17.1

在 2018/11/18 下午3:12, Jordan Justen 写道:
> I think 32-bit version is incorrect too.
>
> Can you delete BUILD_OUTPUT_DIR from both IA32 and X64 cases, and
> following the case use:
>
> BUILD_OUTPUT_DIR=$WORKSPACE/Build/Emulator$PROCESSOR
>
> Can you add this to the commit message:
>
> Fixes: f89c018f3d "EmulatorPkg/Win: Enable 64bit (SEC,PEI,DXE all run at 
> 64bit)"
>
> -Jordan
>
> On 2018-11-17 20:13:02, Liu Yu wrote:
>> correction BUILD_OUTPUT_DIR path
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>>
>> Signed-off-by: Pedroa Liu 
>> ---
>>    EmulatorPkg/build.sh | 2 +-
>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/EmulatorPkg/build.sh b/EmulatorPkg/build.sh
>> index 339c6b3b4f..3abdab1db9 100755
>> --- a/EmulatorPkg/build.sh
>> +++ b/EmulatorPkg/build.sh
>> @@ -188,7 +188,7 @@ case $PROCESSOR in
>>    ;;
>>      X64)
>>    ARCH_SIZE=64
>> -    BUILD_OUTPUT_DIR=$WORKSPACE/Build/Emulator
>> +    BUILD_OUTPUT_DIR=$WORKSPACE/Build/EmulatorX64
>>    LIB_NAMES="ld-linux-x86-64.so.2 libdl.so.2 crt1.o crti.o crtn.o"
>>    LIB_SEARCH_PATHS="/usr/lib/x86_64-linux-gnu /usr/lib64 /lib64
>> /usr/lib /lib"
>>    ;;
>> -- 
>> 2.17.1
>>
>> ___
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] EmulatorPkg Unix Host Segmentation fault.

2018-11-18 Thread Liu Yu
sorry your  path can't fix this issue.   if this path just turn off 
optimization option within sec.c not global project.

I have tested different version GCC such as (GCC4,8, GCC5.x, GCC7.x)  
and all of them can duplicate this issue  (Ubuntu 16.04, 16.10,18.04 )

I have traced this issue on my hand.

you can see Dispatcher.c (MdeModulePkg/Pei/DIspatcher/) Line 792:


790  if (StackOffsetPositive) {
791   SecCoreData = (CONST EFI_SEC_PEI_HAND_OFF *)((UINTN)(VOID 
*)SecCoreData + StackOffset);
792  Private = (PEI_CORE_INSTANCE *)((UINTN)(VOID *)Private + 
StackOffset);
793     } else {
794  ..
795  ..
796    }

  790 --792 disassembly code

  0x10200f2ca :    test %r14b,%r14b
  0x10200f2cd :    je 0x10200f2df 

  0x10200f2cf :    mov 0x38(%rsp),%rax
  0x10200f2d4 :    lea 0x0(%rbp,%rax,1),%r14
  0x10200f2d9 :    lea (%rbx,%rax,1),%rbp

  we can see Private value have been stored in %rbp  (rbp register be 
used as general register )   so when call 
TemporaryRamSupportPpi->TemporaryRamMigration()

this function would modify rbp value because it treat rbp as "stack base 
address ".

816     MigrateMemoryPages (Private, TRUE);

// Private pointer point to other address, so this function would get a 
NULL pointer that result in segment fault

I think we can turn off optimization options like this.

1. modify  EmulatorPkg.dsc

       MdeModulePkg/Core/Pei/PeiMain.inf {
  
   GCC:*_*_*_CC_FLAGS = -O0
   }

Reference GCC Manual description:

   -O also turns on -fomit-frame-pointer on machines where doing so does 
not interfere with debugging.



在 2018/11/18 下午5:27, Jordan Justen 写道:
> On 2018-11-17 20:51:11, Liu Yu wrote:
>> OS: Ubuntu
>>
>> Toolchain:GCC48
> I don't have gcc-4.8, so I couldn't reproduce the issue, but I wonder
> if this branch can fix the issue for you?
>
> https://github.com/jljusten/edk2/tree/emulator-temp-ram
>
> You can fetch this branch locally to a branch named `test` with a
> command like this:
>
> $ git fetch --no-tags https://github.com/jljusten/edk2.git 
> emulator-temp-ram:test
>
> Then checkout the `test` branch to try it.
>
> First, there is some patches to cleanup Sec, but then I added a patch:
>
> 53a432e149 "EmulatorPkg/Sec: Disable optimizations for TemporaryRamMigration 
> function"
>
> Which I hope might help in your case.
>
> -Jordan
>
>> Issue Description :
>>
>>Program received signal SIGSEGV, Segmentation fault.
>> at 
>> /home/pedroa/workspace/orign/edkcrb/MdeModulePkg/Core/Pei/Memory/MemoryServices.c:129
>> 129  Private->MemoryPages.Size = (UINTN) 
>> (Private->HobList.HandoffInformationTable->EfiMemoryTop -
>>
>>
>> if the GCC optimization option is used not -O0 so the "rbp" register will be 
>> used as "general register"
>>
>> in the SecTemporaryRamSupport function as below, this function will modify 
>> the rbp (as general register not stack base address pointer)value that 
>> result in program crash.
>>
>> ASM_PFX(SecTemporaryRamSupport):
>>// Adjust callers %rbp to account for stack move
>>subq%rdx, %rbp // Calc offset of %rbp in Temp Memory
>>addq%r8,  %rbp // add in permanent base to offset
>>
>> ___
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] EmulatorPkg Unix Host Segmentation fault.

2018-11-18 Thread Jordan Justen
On 2018-11-17 20:51:11, Liu Yu wrote:
> OS: Ubuntu
> 
> Toolchain:GCC48

I don't have gcc-4.8, so I couldn't reproduce the issue, but I wonder
if this branch can fix the issue for you?

https://github.com/jljusten/edk2/tree/emulator-temp-ram

You can fetch this branch locally to a branch named `test` with a
command like this:

$ git fetch --no-tags https://github.com/jljusten/edk2.git 
emulator-temp-ram:test

Then checkout the `test` branch to try it.

First, there is some patches to cleanup Sec, but then I added a patch:

53a432e149 "EmulatorPkg/Sec: Disable optimizations for TemporaryRamMigration 
function"

Which I hope might help in your case.

-Jordan

> 
> Issue Description :
> 
>   Program received signal SIGSEGV, Segmentation fault.
>at 
> /home/pedroa/workspace/orign/edkcrb/MdeModulePkg/Core/Pei/Memory/MemoryServices.c:129
> 129  Private->MemoryPages.Size = (UINTN) 
> (Private->HobList.HandoffInformationTable->EfiMemoryTop -
> 
> 
> if the GCC optimization option is used not -O0 so the "rbp" register will be 
> used as "general register"
> 
> in the SecTemporaryRamSupport function as below, this function will modify 
> the rbp (as general register not stack base address pointer)value that result 
> in program crash.
> 
> ASM_PFX(SecTemporaryRamSupport):
>   // Adjust callers %rbp to account for stack move
>   subq%rdx, %rbp // Calc offset of %rbp in Temp Memory
>   addq%r8,  %rbp // add in permanent base to offset
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel