[edk2] [RFC PATCH v4 10/12] ArmPlatformPkg/NorFlashDxe: allow reusability as a MM driver

2018-12-10 Thread Jagadeesh Ujja
Adapt the NorFlashDxe driver to be used as a MM_STANDALONE driver to
allow access to NOR flash for code executing in MM_STANDALONE mode.
This allows storing of EFI variables on NOR flash which is accessible
only via the MM STANDALONE mode software.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashBlockIoDxe.c |   2 +-
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c| 210 

 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h|   4 +-
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf  |   3 +
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c |  96 -
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf |  76 +++
 6 files changed, 302 insertions(+), 89 deletions(-)

diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashBlockIoDxe.c 
b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashBlockIoDxe.c
index 279b77c..4c002c7 100644
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashBlockIoDxe.c
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashBlockIoDxe.c
@@ -1,6 +1,6 @@
 /** @file  NorFlashBlockIoDxe.c
 
-  Copyright (c) 2011-2013, ARM Ltd. All rights reserved.
+  Copyright (c) 2011-2018, ARM Ltd. All rights reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c 
b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
index af40a4c..9c56010 100644
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
@@ -1,6 +1,6 @@
 /** @file  NorFlashDxe.c
 
-  Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
+  Copyright (c) 2011 - 2018, ARM Ltd. All rights reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
@@ -138,29 +138,102 @@ NorFlashCreateInstance (
 
   if (SupportFvb) {
 NorFlashFvbInitialize (Instance);
+if (!InMm ()) {
+Status = gBS->InstallMultipleProtocolInterfaces (
+&Instance->Handle,
+&gEfiDevicePathProtocolGuid, &Instance->DevicePath,
+&gEfiBlockIoProtocolGuid,  &Instance->BlockIoProtocol,
+&gEfiFirmwareVolumeBlockProtocolGuid, 
&Instance->FvbProtocol,
+NULL
+);
+if (EFI_ERROR(Status)) {
+  FreePool (Instance);
+  return Status;
+}
+} else {
+  //Install DevicePath Protocol
+  Status = gMmst->MmInstallProtocolInterface (
+&Instance->Handle,
+&gEfiDevicePathProtocolGuid,
+EFI_NATIVE_INTERFACE,
+&Instance->DevicePath
+);
+  if (EFI_ERROR(Status)) {
+FreePool (Instance);
+return Status;
+  }
+  //Install BlockIo Protocol
+  Status = gMmst->MmInstallProtocolInterface (
+&Instance->Handle,
+&gEfiBlockIoProtocolGuid,
+EFI_NATIVE_INTERFACE,
+&Instance->BlockIoProtocol
+);
+  if (EFI_ERROR(Status)) {
+FreePool (Instance);
+return Status;
+  }
 
-Status = gBS->InstallMultipleProtocolInterfaces (
-  &Instance->Handle,
-  &gEfiDevicePathProtocolGuid, &Instance->DevicePath,
-  &gEfiBlockIoProtocolGuid,  &Instance->BlockIoProtocol,
-  &gEfiFirmwareVolumeBlockProtocolGuid, &Instance->FvbProtocol,
-  NULL
-  );
-if (EFI_ERROR(Status)) {
-  FreePool (Instance);
-  return Status;
+  //Install FirmwareVolumeBlock Protocol
+  Status = gMmst->MmInstallProtocolInterface (
+&Instance->Handle,
+&gEfiSmmFirmwareVolumeBlockProtocolGuid,
+EFI_NATIVE_INTERFACE,
+&Instance->FvbProtocol
+);
+  if (EFI_ERROR(Status)) {
+FreePool (Instance);
+return Status;
+  }
 }
   } else {
-Status = gBS->InstallMultipleProtocolInterfaces (
-&Instance->Handle,
-&gEfiDevicePathProtocolGuid, &Instance->DevicePath,
-&gEfiBlockIoProtocolGuid,  &Instance->BlockIoProtocol,
-&gEfiDiskIoProtocolGuid, &Instance->DiskIoProtocol,
-NULL
-);
-if (EFI_ERROR(Status)) {
-  FreePool (Instance);
-  return Status;
+if (!InMm ()) {
+  Status = gBS->InstallMultipleProtocolInterfaces (
+  &Instance->Handle,
+  &gEfiDevicePathProtocolGuid, &Instance->DevicePath,
+ 

[edk2] [RFC PATCH v4 09/12] MdeModulePkg/VarCheckLib: allow MM_STANDALONE drivers to use this library

2018-12-10 Thread Jagadeesh Ujja
“VarCheckLib” library can be used by MM_STANDALONE drivers as well.
So add MM_STANDALONE as the module type this library supports

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf 
b/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
index 099f83d..c8cf810 100644
--- a/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+++ b/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
@@ -2,6 +2,7 @@
 #  Provides variable check services and database management.
 #
 #  Copyright (c) 2015, Intel Corporation. All rights reserved.
+#  Copyright (c) 2018, ARM Limited. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions
@@ -21,12 +22,12 @@
   FILE_GUID  = 63E12D08-0C5D-47F8-95E4-09F89D7506C5
   MODULE_TYPE= DXE_RUNTIME_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = VarCheckLib|DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER
+  LIBRARY_CLASS  = VarCheckLib|DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER MM_STANDALONE
 
 #
 # The following information is for reference only and not required by the 
build tools.
 #
-#  VALID_ARCHITECTURES   = IA32 X64
+#  VALID_ARCHITECTURES   = IA32 X64 AARCH64
 #
 
 [Sources]
-- 
2.7.4

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


[edk2] [RFC PATCH v4 08/12] MdeModulePkg/Variable/RuntimeDxe: adapt as a MM Standalone driver

2018-12-10 Thread Jagadeesh Ujja
Adapt the variable runtime dxe driver to be used as a MM_STANDALONE
driver to provide variable storage service in MM Standalone mode.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c   |  37 ++--
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c| 201 

 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf | 132 
+
 3 files changed, 312 insertions(+), 58 deletions(-)

diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index d100b1d..e8976c1 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -18,6 +18,7 @@
 
 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 (C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP
+Copyright (c) 2018, ARM Limited. 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
@@ -3277,19 +3278,21 @@ VariableServiceSetVariable (
 }
   }
 
-  //
-  // Special Handling for MOR Lock variable.
-  //
-  Status = SetVariableCheckHandlerMor (VariableName, VendorGuid, Attributes, 
PayloadSize, (VOID *) ((UINTN) Data + DataSize - PayloadSize));
-  if (Status == EFI_ALREADY_STARTED) {
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
 //
-// EFI_ALREADY_STARTED means the SetVariable() action is handled inside of 
SetVariableCheckHandlerMor().
-// Variable driver can just return SUCCESS.
+// Special Handling for MOR Lock variable.
 //
-return EFI_SUCCESS;
-  }
-  if (EFI_ERROR (Status)) {
-return Status;
+Status = SetVariableCheckHandlerMor (VariableName, VendorGuid, Attributes, 
PayloadSize, (VOID *) ((UINTN) Data + DataSize - PayloadSize));
+if (Status == EFI_ALREADY_STARTED) {
+  //
+  // EFI_ALREADY_STARTED means the SetVariable() action is handled inside 
of SetVariableCheckHandlerMor().
+  // Variable driver can just return SUCCESS.
+  //
+  return EFI_SUCCESS;
+}
+if (EFI_ERROR (Status)) {
+  return Status;
+}
   }
 
   Status = VarCheckLibSetVariableCheck (VariableName, VendorGuid, Attributes, 
PayloadSize, (VOID *) ((UINTN) Data + DataSize - PayloadSize), mRequestSource);
@@ -4098,12 +4101,14 @@ VariableWriteServiceInitialize (
 }
   }
 
-  ReleaseLockOnlyAtBootTime 
(&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+ReleaseLockOnlyAtBootTime 
(&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);
 
-  //
-  // Initialize MOR Lock variable.
-  //
-  MorLockInit ();
+//
+// Initialize MOR Lock variable.
+//
+MorLockInit ();
+  }
 
   return Status;
 }
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c
index 6dc19c2..59f3109 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c
@@ -15,6 +15,7 @@
   SmmVariableGetStatistics() should also do validation based on its own 
knowledge.
 
 Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2018, ARM Limited. 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
@@ -34,6 +35,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 
+#include 
+#include 
 #include 
 #include "Variable.h"
 
@@ -218,11 +221,19 @@ GetFtwProtocol (
   //
   // Locate Smm Fault Tolerent Write protocol
   //
-  Status = gSmst->SmmLocateProtocol (
-&gEfiSmmFaultTolerantWriteProtocolGuid,
-NULL,
-FtwProtocol
-);
+  if (PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = gMmst->MmLocateProtocol (
+  &gEfiSmmFaultTolerantWriteProtocolGuid,
+  NULL,
+  FtwProtocol
+  );
+  } else {
+Status = gSmst->SmmLocateProtocol (
+  &gEfiSmmFaultTolerantWriteProtocolGuid,
+  NULL,
+  FtwProtocol
+  );
+  }
   return Status;
 }
 
@@ -248,11 +259,19 @@ GetFvbByHandle (
   //
   // To get the SMM FVB protocol interface on the handle
   //
-  return gSmst->SmmHandleProtocol (
-  FvBlockHandle,
-  &gEfiSmmFirmwareVolumeBlockProtocolGuid,
-  (VOID **) FvBlock
-  );
+

[edk2] [RFC PATCH v4 07/12] MdeModulePkg/Variable/RuntimeDxe: adapt for usability with MM Standalone

2018-12-10 Thread Jagadeesh Ujja
Adapt the VariableSmmRuntimeDxe driver to communicate with a VariableSmm
driver that is implemented as a MM Standalone driver.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf|  1 +
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c   | 31 
+---
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf |  3 ++
 3 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
index 868981c..beba675 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
@@ -131,6 +131,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxUserNvVariableSpaceSize   ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdBoottimeReservedNvVariableSpaceSize  ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdReclaimVariableSpaceAtEndOfDxe  ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdStandaloneMmVariableEnabled
 
 [FeaturePcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics  ## CONSUMES # 
statistic the information of variable.
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c
index 85d655d..1902348 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c
@@ -14,6 +14,8 @@
   InitCommunicateBuffer() is really function to check the variable data size.
 
 Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2018, ARM Limited. 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
@@ -179,7 +181,11 @@ SendCommunicateBuffer (
   SMM_VARIABLE_COMMUNICATE_HEADER   *SmmVariableFunctionHeader;
 
   CommSize = DataSize + SMM_COMMUNICATE_HEADER_SIZE + 
SMM_VARIABLE_COMMUNICATE_HEADER_SIZE;
-  Status = mSmmCommunication->Communicate (mSmmCommunication, 
mVariableBufferPhysical, &CommSize);
+  if (PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = mSmmCommunication->Communicate (mSmmCommunication, 
mVariableBuffer, &CommSize);
+  } else {
+Status = mSmmCommunication->Communicate (mSmmCommunication, 
mVariableBufferPhysical, &CommSize);
+  }
   ASSERT_EFI_ERROR (Status);
 
   SmmCommunicateHeader  = (EFI_SMM_COMMUNICATE_HEADER *) mVariableBuffer;
@@ -991,9 +997,11 @@ SmmVariableReady (
 {
   EFI_STATUSStatus;
 
-  Status = gBS->LocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID 
**)&mSmmVariable);
-  if (EFI_ERROR (Status)) {
-return;
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = gBS->LocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID 
**)&mSmmVariable);
+if (EFI_ERROR (Status)) {
+  return;
+}
   }
 
   Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID 
**) &mSmmCommunication);
@@ -1069,13 +1077,14 @@ SmmVariableWriteReady (
 {
   EFI_STATUSStatus;
   VOID  *ProtocolOps;
-
-  //
-  // Check whether the protocol is installed or not.
-  //
-  Status = gBS->LocateProtocol (&gSmmVariableWriteGuid, NULL, (VOID **) 
&ProtocolOps);
-  if (EFI_ERROR (Status)) {
-return;
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+//
+// Check whether the protocol is installed or not.
+//
+Status = gBS->LocateProtocol (&gSmmVariableWriteGuid, NULL, (VOID **) 
&ProtocolOps);
+if (EFI_ERROR (Status)) {
+  return;
+}
   }
 
   //
diff --git 
a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
index bd73f7a..ce63fe6 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
@@ -87,6 +87,9 @@
   ## SOMETIMES_CONSUMES   ## Variable:L"dbt"
   gEfiImageSecurityDatabaseGuid
 
+[Pcd]
+  gEfiMdePkgTokenSpaceGuid.PcdStandaloneMmVariableEnabled
+
 [Depex]
   gEfiSmmCommunicationProtocolGuid
 
-- 
2.7.4

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


[edk2] [RFC PATCH v4 06/12] MdeModulePkg/FaultTolerantWriteDxe: allow reusability as a MM driver

2018-12-10 Thread Jagadeesh Ujja
Adapt the FaultTolerantWriteDxe driver to be used as a MM_STANDALONE
driver to provide UEFI fault tolerant write protocol functionality
for variable reclaim operation on EFI variables stored on a NOR flash
that is only accessible to code executing in MM Standalone mode.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf 
 |   1 +
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c   
 | 203 +++-
 
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf 
| 101 ++
 MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c  
 |  27 +--
 4 files changed, 271 insertions(+), 61 deletions(-)

diff --git 
a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf 
b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
index dcde58d..35b6c47 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
@@ -77,6 +77,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase  ## 
SOMETIMES_CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64## CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize  ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdStandaloneMmVariableEnabled
 
 #
 # gBS->CalculateCrc32() is consumed in EntryPoint.
diff --git 
a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c 
b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c
index 27fcab1..c5c9452 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c
@@ -44,6 +44,7 @@
   This driver need to make sure the CommBuffer is not in the SMRAM range.
 
 Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2018, ARM Limited. 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
@@ -55,13 +56,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 **/
 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "FaultTolerantWrite.h"
 #include "FaultTolerantWriteSmmCommon.h"
 #include 
+#include 
 
 EFI_EVENT mFvbRegistration = NULL;
 EFI_FTW_DEVICE*mFtwDevice  = NULL;
@@ -92,11 +96,19 @@ FtwGetFvbByHandle (
   //
   // To get the SMM FVB protocol interface on the handle
   //
-  return gSmst->SmmHandleProtocol (
-  FvBlockHandle,
-  &gEfiSmmFirmwareVolumeBlockProtocolGuid,
-  (VOID **) FvBlock
-  );
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+return gSmst->SmmHandleProtocol (
+FvBlockHandle,
+&gEfiSmmFirmwareVolumeBlockProtocolGuid,
+(VOID **) FvBlock
+);
+  } else {
+return gMmst->MmHandleProtocol (
+FvBlockHandle,
+&gEfiSmmFirmwareVolumeBlockProtocolGuid,
+(VOID **) FvBlock
+);
+  }
 }
 
 /**
@@ -119,11 +131,19 @@ FtwGetSarProtocol (
   //
   // Locate Smm Swap Address Range protocol
   //
-  Status = gSmst->SmmLocateProtocol (
-&gEfiSmmSwapAddressRangeProtocolGuid,
-NULL,
-SarProtocol
-);
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = gSmst->SmmLocateProtocol (
+  &gEfiSmmSwapAddressRangeProtocolGuid,
+  NULL,
+  SarProtocol
+  );
+  } else {
+Status = gMmst->MmLocateProtocol (
+  &gEfiSmmSwapAddressRangeProtocolGuid,
+  NULL,
+  SarProtocol
+  );
+  }
   return Status;
 }
 
@@ -158,13 +178,23 @@ GetFvbCountAndBuffer (
   BufferSize = 0;
   *NumberHandles = 0;
   *Buffer= NULL;
-  Status = gSmst->SmmLocateHandle (
-ByProtocol,
-&gEfiSmmFirmwareVolumeBlockProtocolGuid,
-NULL,
-&BufferSize,
-*Buffer
-);
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = gSmst->SmmLocateHandle (
+  ByProtocol,
+  &gEfiSmmFirmwareVolumeBlockProtocolGuid,
+  NULL,
+  &BufferSize,
+  *Buffer
+  );
+  } else {
+Status = gMmst->MmLocateHandle (
+  

[edk2] [RFC PATCH v4 05/12] MdePkg/Library: Add StandaloneMmRuntimeDxe library

2018-12-10 Thread Jagadeesh Ujja
To resuse some the libraries in both MM and non-MM mode, a mechanism to
determine the execution mode is required, i.e, in MM or non-MM. Add a
new library for use by non-MM code to determine the current execution
mode.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 MdePkg/Library/StandaloneMmRuntimeDxe/StandaloneMmRuntimeDxe.c   | 36 
+
 MdePkg/Library/StandaloneMmRuntimeDxe/StandaloneMmRuntimeDxe.inf | 42 

 2 files changed, 78 insertions(+)

diff --git a/MdePkg/Library/StandaloneMmRuntimeDxe/StandaloneMmRuntimeDxe.c 
b/MdePkg/Library/StandaloneMmRuntimeDxe/StandaloneMmRuntimeDxe.c
new file mode 100644
index 000..61ef59a
--- /dev/null
+++ b/MdePkg/Library/StandaloneMmRuntimeDxe/StandaloneMmRuntimeDxe.c
@@ -0,0 +1,36 @@
+/** @file
+  StandaloneMmRuntimeDxe Library.
+
+  Copyright (c) 2018, ARM Limited. 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 
+
+/**
+  This function allows the caller to determine if the driver is executing in
+  Standalone Management Mode(SMM).
+
+  This function returns TRUE if the driver is executing in SMM and FALSE if the
+  driver is not executing in SMM.
+
+  @retval  TRUE  The driver is executing in Standalone Management Mode (SMM).
+  @retval  FALSE The driver is not executing in Standalone Management Mode 
(SMM).
+
+**/
+BOOLEAN
+EFIAPI
+InMm (
+  VOID
+  )
+{
+  return FALSE;
+}
diff --git a/MdePkg/Library/StandaloneMmRuntimeDxe/StandaloneMmRuntimeDxe.inf 
b/MdePkg/Library/StandaloneMmRuntimeDxe/StandaloneMmRuntimeDxe.inf
new file mode 100644
index 000..741b229
--- /dev/null
+++ b/MdePkg/Library/StandaloneMmRuntimeDxe/StandaloneMmRuntimeDxe.inf
@@ -0,0 +1,42 @@
+## @file
+#  Provides StandaloneMmRuntimeDxe.
+#
+#  Copyright (c) 2018, ARM Limited. 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  = StandaloneMmRuntimeDxe
+  FILE_GUID  = 8099cfbf-9564-4c9b-9052-e66b1da88930
+  MODULE_TYPE= DXE_RUNTIME_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = StandaloneMmRuntimeDxe |DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER MM_STANDALONE
+
+#
+# The following information is for reference only and not required by the 
build tools.
+#
+#  VALID_ARCHITECTURES   = IA32 X64 AARCH64
+#
+
+[Sources]
+  StandaloneMmRuntimeDxe.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+  BaseLib
+  BaseMemoryLib
+  DebugLib
+  MemoryAllocationLib
-- 
2.7.4

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


[edk2] [RFC PATCH v4 04/12] MdePkg/Library/BaseLib/AArch64: Add AsmLfence function

2018-12-10 Thread Jagadeesh Ujja
Variable service driver includes a call to AsmLfence. To reuse this
driver on AArch64 based platforms, add an implementation of AsmLfence
that acts as a wrapper on the AArch64 specific MemoryFence function.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 MdePkg/Include/Library/BaseLib.h | 10 +
 MdePkg/Library/BaseLib/AArch64/AsmLfence.S   | 42 
 MdePkg/Library/BaseLib/AArch64/AsmLfence.asm | 41 +++
 MdePkg/Library/BaseLib/BaseLib.inf   |  2 +
 4 files changed, 95 insertions(+)

diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 8cc0869..595cf90 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -126,6 +126,16 @@ typedef struct {
 
 #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8
 
+/**
+  Performs a serializing operation on all load-from-memory instructions that
+  were issued prior the AsmLfence function.
+**/
+VOID
+EFIAPI
+AsmLfence (
+  VOID
+  );
+
 #endif  // defined (MDE_CPU_AARCH64)
 
 
diff --git a/MdePkg/Library/BaseLib/AArch64/AsmLfence.S 
b/MdePkg/Library/BaseLib/AArch64/AsmLfence.S
new file mode 100644
index 000..2fd804b
--- /dev/null
+++ b/MdePkg/Library/BaseLib/AArch64/AsmLfence.S
@@ -0,0 +1,42 @@
+##--
+#
+# AsmLfence() for AArch64
+#
+# Copyright (c) 2013-2018, ARM Ltd. All rights reserved.
+#
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD 
License
+# which accompanies this distribution.  The full text of the license may be 
found at
+# http://opensource.org/licenses/bsd-license.php.
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##--
+
+.text
+.p2align 2
+
+GCC_ASM_EXPORT(AsmLfence)
+
+# IMPORT
+GCC_ASM_IMPORT(MemoryFence)
+
+#/**
+#  Used to serialize load and store operations.
+#
+#  All loads and stores that proceed calls to this function are guaranteed to 
be
+#  globally visible when this function returns.
+#
+#**/
+#VOID
+#EFIAPI
+#AsmLfence (
+#  VOID
+#  );
+#
+ASM_PFX(AsmLfence):
+stp   x29, x30, [sp, #-16]!
+bl MemoryFence
+ldp   x29, x30, [sp], #0x10
+ret
diff --git a/MdePkg/Library/BaseLib/AArch64/AsmLfence.asm 
b/MdePkg/Library/BaseLib/AArch64/AsmLfence.asm
new file mode 100644
index 000..7dd5659
--- /dev/null
+++ b/MdePkg/Library/BaseLib/AArch64/AsmLfence.asm
@@ -0,0 +1,41 @@
+;--
+;
+; AsmLfence() for AArch64
+;
+; Copyright (c) 2013-2018, ARM Ltd. All rights reserved.
+;
+; This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD 
License
+; which accompanies this distribution.  The full text of the license may be 
found at
+; http://opensource.org/licenses/bsd-license.php.
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+;--
+
+  EXPORT AsmLfence
+  AREA BaseLib_LowLevel, CODE, READONLY
+  # IMPORT
+  GCC_ASM_IMPORT(MemoryFence)
+
+;/**
+;  Used to serialize load and store operations.
+;
+;  All loads and stores that proceed calls to this function are guaranteed to 
be
+;  globally visible when this function returns.
+;
+;**/
+;VOID
+;EFIAPI
+;AsmLfence (
+;  VOID
+;  );
+;
+AsmLfence
+stp   x29, x30, [sp, #-16]!
+bl MemoryFence
+ldp   x29, x30, [sp], #0x10
+ret
+
+  END
diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.inf
index b84e583..b7d7bcb 100644
--- a/MdePkg/Library/BaseLib/BaseLib.inf
+++ b/MdePkg/Library/BaseLib/BaseLib.inf
@@ -585,6 +585,7 @@
   Math64.c
 
   AArch64/MemoryFence.S | GCC
+  AArch64/AsmLfence.S   | GCC
   AArch64/SwitchStack.S | GCC
   AArch64/EnableInterrupts.S| GCC
   AArch64/DisableInterrupts.S   | GCC
@@ -593,6 +594,7 @@
   AArch64/CpuBreakpoint.S   | GCC
 
   AArch64/MemoryFence.asm   | MSFT
+  AArch64/AsmLfence.asm | MSFT
   AArch64/SwitchStack.asm   | MSFT
   AArch64/EnableInterrupts.asm  | MSFT
   AArch64/DisableInterrupts.asm | MSFT
-- 
2.7.4

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


[edk2] [RFC PATCH v4 03/12] MdePkg/Include: add StandaloneMmServicesTableLib header file

2018-12-10 Thread Jagadeesh Ujja
Some of the existing DXE drivers can be refactored to execute within
the Standalone MM execution environment as well. Allow such drivers to
get access to the Standalone MM services tables

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 MdePkg/Include/Library/StandaloneMmServicesTableLib.h | 45 
 1 file changed, 45 insertions(+)

diff --git a/MdePkg/Include/Library/StandaloneMmServicesTableLib.h 
b/MdePkg/Include/Library/StandaloneMmServicesTableLib.h
new file mode 100644
index 000..6e834a8
--- /dev/null
+++ b/MdePkg/Include/Library/StandaloneMmServicesTableLib.h
@@ -0,0 +1,45 @@
+/** @file
+  Provides a service to retrieve a pointer to the Standalone MM Services Table.
+  Only available to Standalone MM module types.
+
+Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
+
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD 
License
+which accompanies this distribution.  The full text of the license may be 
found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __MM_SERVICES_TABLE_LIB_H__
+#define __MM_SERVICES_TABLE_LIB_H__
+
+#include 
+#include 
+
+
+extern EFI_MM_SYSTEM_TABLE *gMmst;
+
+
+/**
+  This function allows the caller to determine if the driver is executing in
+  Standalone Management Mode(SMM).
+
+  This function returns TRUE if the driver is executing in SMM and FALSE if the
+  driver is not executing in SMM.
+
+  @retval  TRUE  The driver is executing in Standalone Management Mode (SMM).
+  @retval  FALSE The driver is not executing in Standalone Management Mode 
(SMM).
+
+**/
+BOOLEAN
+EFIAPI
+InMm (
+  VOID
+  );
+
+#endif
-- 
2.7.4

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


[edk2] [RFC PATCH v4 02/12] MdePkg: Add a PCD to enable secure storage of variables

2018-12-10 Thread Jagadeesh Ujja
Add a flag that allows selecting the variables to be stored on a
secure or a non-secure non-volatile memory. In case of secure storage
of variables, the variable service will be implemented by code executing
within the Standalone MM.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 MdePkg/MdePkg.dec | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 712bd46..dc2277d 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -2073,6 +2073,11 @@
   # @Prompt Fixed Debug Message Print Level.
   
gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel|0x|UINT32|0x30001016
 
+  ## This flag is used to enable the Secure Storage for the Variables.
+  #  TRUE  - Secure variable storage supported by Standalone MM code.
+  #  FALSE - Non secure variable storage.
+  
gEfiMdePkgTokenSpaceGuid.PcdStandaloneMmVariableEnabled|FALSE|BOOLEAN|0x30001017
+
 [PcdsFixedAtBuild,PcdsPatchableInModule]
   ## Indicates the maximum length of unicode string used in the following
   #  BaseLib functions: StrLen(), StrSize(), StrCmp(), StrnCmp(), StrCpy(), 
StrnCpy()
-- 
2.7.4

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


[edk2] [RFC PATCH v4 01/12] StandaloneMmPkg: Pull in additonal libraries from staging branch

2018-12-10 Thread Jagadeesh Ujja
Three additional library packages are being pulled into StandaloneMmPkg
from the staging area in order to support the secure variable service.
The three packages being pulled in are
  - StandaloneMmHobLib
  - StandaloneMmMemoryAllocationLib
  - StandaloneMmServicesTableLib

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf  
 |   2 +-
 
StandaloneMmPkg/Library/StandaloneMmHobLib/AArch64/StandaloneMmCoreHobLibInternal.c
 |  64 ++
 StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.c
 | 655 
 StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf  
 |  48 ++
 
StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.c
   | 824 
 
StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
 |  45 ++
 
StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c
 |  64 ++
 
StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
   |  36 +
 8 files changed, 1737 insertions(+), 1 deletion(-)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf 
b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
index db19d3c..ac036e3 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
@@ -24,7 +24,7 @@
   MODULE_TYPE= MM_CORE_STANDALONE
   VERSION_STRING = 1.0
   PI_SPECIFICATION_VERSION   = 0x00010032
-  LIBRARY_CLASS  = HobLib|MM_CORE_STANDALONE MM_STANDALONE
+  LIBRARY_CLASS  = HobLib|MM_CORE_STANDALONE
 
 #
 #  VALID_ARCHITECTURES   = AARCH64
diff --git 
a/StandaloneMmPkg/Library/StandaloneMmHobLib/AArch64/StandaloneMmCoreHobLibInternal.c
 
b/StandaloneMmPkg/Library/StandaloneMmHobLib/AArch64/StandaloneMmCoreHobLibInternal.c
new file mode 100644
index 000..ac5a1c0
--- /dev/null
+++ 
b/StandaloneMmPkg/Library/StandaloneMmHobLib/AArch64/StandaloneMmCoreHobLibInternal.c
@@ -0,0 +1,64 @@
+/** @file
+  HOB Library implementation for Standalone MM Core.
+
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2018, ARM Limited. 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 
+
+//
+// Cache copy of HobList pointer.
+//
+extern VOID *gHobList;
+
+EFI_HOB_HANDOFF_INFO_TABLE*
+HobConstructor (
+  IN VOID   *EfiMemoryBegin,
+  IN UINTN  EfiMemoryLength,
+  IN VOID   *EfiFreeMemoryBottom,
+  IN VOID   *EfiFreeMemoryTop
+  )
+{
+  EFI_HOB_HANDOFF_INFO_TABLE  *Hob;
+  EFI_HOB_GENERIC_HEADER  *HobEnd;
+
+  Hob= EfiFreeMemoryBottom;
+  HobEnd = (EFI_HOB_GENERIC_HEADER *)(Hob+1);
+
+  Hob->Header.HobType = EFI_HOB_TYPE_HANDOFF;
+  Hob->Header.HobLength   = sizeof(EFI_HOB_HANDOFF_INFO_TABLE);
+  Hob->Header.Reserved= 0;
+
+  HobEnd->HobType = EFI_HOB_TYPE_END_OF_HOB_LIST;
+  HobEnd->HobLength   = sizeof(EFI_HOB_GENERIC_HEADER);
+  HobEnd->Reserved= 0;
+
+  Hob->Version = EFI_HOB_HANDOFF_TABLE_VERSION;
+  Hob->BootMode= BOOT_WITH_FULL_CONFIGURATION;
+
+  Hob->EfiMemoryTop= (UINTN)EfiMemoryBegin + EfiMemoryLength;
+  Hob->EfiMemoryBottom = (UINTN)EfiMemoryBegin;
+  Hob->EfiFreeMemoryTop= (UINTN)EfiFreeMemoryTop;
+  Hob->EfiFreeMemoryBottom = (EFI_PHYSICAL_ADDRESS)(UINTN)(HobEnd+1);
+  Hob->EfiEndOfHobList = (EFI_PHYSICAL_ADDRESS)(UINTN)HobEnd;
+
+  gHobList = Hob;
+
+  return Hob;
+}
diff --git a/StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.c 
b/StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.c
new file mode 100644
index 000..591a78c
--- /dev/null
+++ b/StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.c
@@ -0,0 +1,655 @@
+/** @file
+  HOB Library implementation for Standalone MM Core.
+
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2018, ARM Limited. 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 LI

[edk2] [RFC PATCH v4 00/12] Extend secure variable service to be usable from Standalone MM

2018-12-10 Thread Jagadeesh Ujja
Changes since v3: 
- Addressed all the comments from Liming Gao
  - Added a AArch64 implementation of AsmLfence which is a wrapper for
MemoryFence. The changes in variable service driver in v3 of this
patchset that used MemoryFence instead of AsmLfence have been removed.
  - Added StandaloneMmServicesTableLib.h and StandaloneMmRuntimeDxe
library into MdePkg.
  - Renamed PcdStandaloneMmEnable as PcdStandaloneMmVariableEnabled and
added to in to MdePkg.
  - Now with above changes, edk2 packages don't need to depend on
StandaloneMmPkg/StandaloneMmPkg.dec
- Addressed comments from Ting Ye
  - Removed the hacks in the v3 version.
  - Will relook into the “TimerWrapp.c” file and add a appropriate
implementation of this for MM Standalone mode code.

Changes since v2: 
- Added 'Contributed-under' tag, removed Change-ID tag and
  maintained a single signed-off-by for the all the patches.  

Changes since v1:
- Addressed all the comments from Liming Gao
  - Removed the use of #ifdef/#else/#endif and used a Pcd instead to
select between MM and non-MM paths.
  - Removed all dependencies on edk2-platforms.
  - Dropped the use of mMmst and used gSmst instead.
  - Added a dummy implementation UefiRuntimeServiceTableLib for
MM_STANDALONE usage
- Replaced all uses of AsmLfence with MemoryFence from variable
  service code.
- Add a new StandaloneMmRuntimeDxe library to for use by non-MM code.

This RFC patch series extends the existing secure variable service support for
use with Standalone MM. This is applicable to paltforms that use Standalone 
Management Mode to protect access to non-volatile memory (NOR flash in case 
of these patches) used to store the secure EFI variables.

The first patch pulls in additional libraries from the staging branch of 
StandaloneMmPkg into the edk2's StandaloneMmPkg. The existing secure variable 
service implementation supports only the traditional MM mode and so the rest 
of the patches extends the existing secure variable service support to be 
useable with Standalone MM mode as well.

This patch series is being posted as an RFC to get feedback on the approach 
taken
in these patches.

Jagadeesh Ujja (12):
  StandaloneMmPkg: Pull in additonal libraries from staging branch
  MdePkg: Add a PCD to enable secure storage of variables
  MdePkg/Include: add StandaloneMmServicesTableLib header file
  MdePkg/Library/BaseLib/AArch64: Add AsmLfence function
  MdePkg/Library: Add StandaloneMmRuntimeDxe library
  MdeModulePkg/FaultTolerantWriteDxe: allow reusability as a MM driver
  MdeModulePkg/Variable/RuntimeDxe: adapt for usability with MM
Standalone
  MdeModulePkg/Variable/RuntimeDxe: adapt as a MM Standalone driver
  MdeModulePkg/VarCheckLib: allow MM_STANDALONE drivers to use this
library
  ArmPlatformPkg/NorFlashDxe: allow reusability as a MM driver
  SecurityPkg/AuthVariableLib: allow MM_STANDALONE drivers to use this
library
  CryptoPkg/BaseCryptLib: allow MM_STANDALONE drivers to use this
library

 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashBlockIoDxe.c
 |   2 +-
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c   
 | 210 -
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h   
 |   4 +-
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf 
 |   3 +
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c
 |  96 +--
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf
 |  76 ++
 CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
 |   7 +-
 CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf 
 |   4 +
 CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c  
 |  15 +-
 MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf   
 |   5 +-
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf 
 |   1 +
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c   
 | 203 +++--
 
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf 
| 101 +++
 MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c  
 |  27 +-
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c  
 |  37 +-
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf  
 |   1 +
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c   
 | 201 -
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c 
 |  31 +-
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf   
 |   3 +
 MdeModulePkg/Univer

Re: [edk2] [RFC PATCH v3 00/11] Extend secure variable service to be usable from Standalone MM

2018-12-10 Thread jagadeesh ujja
Hi Liming,

On Thu, Nov 29, 2018 at 9:27 PM Gao, Liming  wrote:
>
> My comment is below.
>
> 1. Please don't update MemoryFence() implementation. It will impact all 
> consumer code. AsmLfence() is X86 specific API. You can implement the 
> internal function in the arch specific source file to call AsmLfence() for 
> X86 and call MemoryFence() for ARM. This internal function will be called in 
> the common logic.
> 2. On StandaloneMmServicesTableLib.h, I suggest to add it into MdePkg, and 
> add StandaloneMmRuntimeDxe library into MdePkg. This library sets gMmst is 
> NULL, and always return FALSE in InMm().
> 3. On PcdStandaloneMmEnable, I also suggest to add it into MdePkg. It can be 
> used to control the driver logic in the different packages.
>
> With 2 & 3, other edk2 packages don't need to depend on 
> StandaloneMmPkg/StandaloneMmPkg.dec

Thank you for your comments. All your comments have been addressed and
the next version of this patchset will include appropriate changes
based on your comments.

Regards,
Jagadeesh.

>
> > -Original Message-
> > From: Jagadeesh Ujja [mailto:jagadeesh.u...@arm.com]
> > Sent: Wednesday, November 28, 2018 5:35 PM
> > To: edk2-devel@lists.01.org; Gao, Liming ; Zhang, 
> > Chao B ; leif.lindh...@linaro.org;
> > ard.biesheu...@linaro.org
> > Subject: [RFC PATCH v3 00/11] Extend secure variable service to be usable 
> > from Standalone MM
> >
> > Changes since v2:
> > - Added 'Contributed-under' tag, removed Change-ID tag and
> >   maintained a single signed-off-by for the all the patches.
> >
> > Changes since v1:
> > - Addressed all the comments from Liming Gao
> >   - Removed the use of #ifdef/#else/#endif and used a Pcd instead to
> > select between MM and non-MM paths.
> >   - Removed all dependencies on edk2-platforms.
> >   - Dropped the use of mMmst and used gSmst instead.
> >   - Added a dummy implementation UefiRuntimeServiceTableLib for
> > MM_STANDALONE usage
> > - Replaced all uses of AsmLfence with MemoryFence from variable
> >   service code.
> > - Add a new StandaloneMmRuntimeDxe library to for use by non-MM code.
> >
> > This RFC patch series extends the existing secure variable service support 
> > for
> > use with Standalone MM. This is applicable to paltforms that use Standalone
> > Management Mode to protect access to non-volatile memory (NOR flash in case
> > of these patches) used to store the secure EFI variables.
> >
> > The first patch pulls in additional libraries from the staging branch of
> > StandaloneMmPkg into the edk2's StandaloneMmPkg. The existing secure 
> > variable
> > service implementation supports only the traditional MM mode and so the rest
> > of the patches extends the existing secure variable service support to be
> > useable with Standalone MM mode as well.
> >
> > This patch series is being posted as an RFC to get feedback on the approach 
> > taken
> > in these patches.
> >
> > Jagadeesh Ujja (11):
> >   MdeModulePkg/Variable: replace all uses of AsmLfence with MemoryFence
> >   StandaloneMmPkg: Pull in additonal libraries from staging branch
> >   MdeModulePkg/Library: Add StandaloneMmRuntimeDxe library
> >   ArmPlatformPkg/NorFlashDxe: allow reusability as a MM driver
> >   MdeModulePkg/FaultTolerantWriteDxe: allow reusability as a MM driver
> >   MdeModulePkg/Variable/RuntimeDxe: adapt for usability with MM
> > Standalone
> >   MdeModulePkg/Variable/RuntimeDxe: adapt as a MM Standalone driver
> >   SecurityPkg/AuthVariableLib: allow MM_STANDALONE drivers to use this
> > library
> >   MdeModulePkg/VarCheckLib: allow MM_STANDALONE drivers to use this
> > library
> >   CryptoPkg/BaseCryptLib: allow MM_STANDALONE drivers to use this
> > library
> >   CryptoPkg/BaseCryptLib: Hack to get time in MM Standalone mode
> >
> >  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
> > |   3 +
> >  ArmPlatformPkg/Drivers/NorFlashDxe/{NorFlashDxe.inf => 
> > NorFlashStandaloneMm.inf}
> > |  28 +-
> >  CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> > |   8 +-
> >  CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
> > |   5 +
> >  MdeModulePkg/Library/{VarCheckLib/VarCheckLib.inf => 
> > StandaloneMmRuntimeDxe/StandaloneMmRuntimeDxe.inf}
> > |  22 +-
> >  MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> > |   5 +-
> >  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
> > |   2 +
> >  MdeModulePkg/Universal/FaultTolerantWriteDxe/{FaultTolerantWriteDxe.inf => 
> > FaultTolerantWriteStandaloneMm.inf}   |
> > 53 +-
> >  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
> > |   2 +
> >  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
> > |   4 +
> >  MdeModulePkg/Universal/Variable/RuntimeDxe/{VariableRuntimeDxe.inf => 
> > VariableStandaloneMm.inf}
> > | 107 ++-
> >  SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
> > |   5 +-
> >  StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
> > |   2 +-
> >  Standalon

Re: [edk2] [PATCH] MdeModulePkg/FileExplorerLib: avoid packed struct for program data

2018-12-10 Thread Wu, Hao A
> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Saturday, December 08, 2018 6:25 PM
> To: edk2-devel@lists.01.org
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ruiyu; Ard Biesheuvel
> Subject: [PATCH] MdeModulePkg/FileExplorerLib: avoid packed struct for
> program data
> 
> Struct packing is only necessary for data structures whose in-memory
> representation is covered by the PI or UEFI specs, and may deviate
> from the ordinary C rules for alignment.
> 
> So in case of FileExplorerLib, this applies to the device path struct
> only, and other structures used to carry program data should not be
> packed, or we may end up with alignment faults on architectures such
> as ARM, which don't permit load/store double or multiple instructions
> to access memory locations that are not 32-bit aligned.
> 
> E.g., the following call in FileExplorerLibConstructor()
> 
>   InitializeListHead (&gFileExplorerPrivate.FsOptionMenu->Head);
> 
> which is emitted as follows for 32-bit ARM/Thumb2 by Clang-5.0
> 
> 3de0:   b510push{r4, lr}
> 3de2:   4604mov r4, r0
> ...
> 3de8:   e9c4 4400   strdr4, r4, [r4]
> 3dec:   bd10pop {r4, pc}
> 
> will perform a double-word store on the first argument, passed in
> register r0, assuming that the pointer type of the argument is
> enough to guarantee that the value is suitably aligned.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
>  MdeModulePkg/Library/FileExplorerLib/FileExplorer.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.h
> b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.h
> index bf1450dbd581..603185abe4b1 100644
> --- a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.h
> +++ b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.h
> @@ -51,6 +51,8 @@ typedef struct {
>EFI_DEVICE_PATH_PROTOCOL   End;
>  } HII_VENDOR_DEVICE_PATH;
> 
> +#pragma pack()
> +
>  typedef struct {
>EFI_HANDLEDeviceHandle;
>EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
> @@ -100,8 +102,6 @@ typedef struct {
> 
>  #define FILE_EXPLORER_PRIVATE_FROM_THIS(a)  CR (a,
> FILE_EXPLORER_CALLBACK_DATA, FeConfigAccess,
> FILE_EXPLORER_CALLBACK_DATA_SIGNATURE)
> 
> -#pragma pack()
> -

Reviewed-by: Hao Wu 

Best Regards,
Hao Wu

>  extern UINT8FileExplorerVfrBin[];
> 
>  #define MENU_OPTION_SIGNATURE  SIGNATURE_32 ('m', 'e', 'n', 'u')
> --
> 2.19.2

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


[edk2] [PATCH 2/2] SecurityPkg/Tcg: Fix typos in TcgDxe.c and Tcg2Dxe.c

2018-12-10 Thread Shenglei Zhang
Change EFI_RETURNING_FROM_EFI_APPLICATOIN to
EFI_RETURNING_FROM_EFI_APPLICATION.
https://bugzilla.tianocore.org/show_bug.cgi?id=1368

Cc: Chao Zhang 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 4 ++--
 SecurityPkg/Tcg/TcgDxe/TcgDxe.c   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c 
b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
index aa463b287e..662637f3e3 100644
--- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
+++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
@@ -2314,10 +2314,10 @@ OnReadyToBoot (
 //
 Status = TcgMeasureAction (
4,
-   EFI_RETURNING_FROM_EFI_APPLICATOIN
+   EFI_RETURNING_FROM_EFI_APPLICATION
);
 if (EFI_ERROR (Status)) {
-  DEBUG ((EFI_D_ERROR, "%a not Measured. Error!\n", 
EFI_RETURNING_FROM_EFI_APPLICATOIN));
+  DEBUG ((EFI_D_ERROR, "%a not Measured. Error!\n", 
EFI_RETURNING_FROM_EFI_APPLICATION));
 }
 
 //
diff --git a/SecurityPkg/Tcg/TcgDxe/TcgDxe.c b/SecurityPkg/Tcg/TcgDxe/TcgDxe.c
index 21837fe3d3..3889fb4a81 100644
--- a/SecurityPkg/Tcg/TcgDxe/TcgDxe.c
+++ b/SecurityPkg/Tcg/TcgDxe/TcgDxe.c
@@ -1180,10 +1180,10 @@ OnReadyToBoot (
 // 6. Not first attempt, meaning a return from last attempt
 //
 Status = TcgMeasureAction (
-   EFI_RETURNING_FROM_EFI_APPLICATOIN
+   EFI_RETURNING_FROM_EFI_APPLICATION
);
 if (EFI_ERROR (Status)) {
-  DEBUG ((EFI_D_ERROR, "%a not Measured. Error!\n", 
EFI_RETURNING_FROM_EFI_APPLICATOIN));
+  DEBUG ((EFI_D_ERROR, "%a not Measured. Error!\n", 
EFI_RETURNING_FROM_EFI_APPLICATION));
 }
   }
 
-- 
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/2] MdePkg/IndustryStandard: Fix a typo in UefiTcgPlatform.h

2018-12-10 Thread Shenglei Zhang
Change EFI_RETURNING_FROM_EFI_APPLICATOIN to
EFI_RETURNING_FROM_EFI_APPLICATION.
https://bugzilla.tianocore.org/show_bug.cgi?id=1368

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 MdePkg/Include/IndustryStandard/UefiTcgPlatform.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdePkg/Include/IndustryStandard/UefiTcgPlatform.h 
b/MdePkg/Include/IndustryStandard/UefiTcgPlatform.h
index 2d223f4ea7..96784708ae 100644
--- a/MdePkg/Include/IndustryStandard/UefiTcgPlatform.h
+++ b/MdePkg/Include/IndustryStandard/UefiTcgPlatform.h
@@ -56,7 +56,7 @@
 
 #define EFI_CALLING_EFI_APPLICATION \
   "Calling EFI Application from Boot Option"
-#define EFI_RETURNING_FROM_EFI_APPLICATOIN  \
+#define EFI_RETURNING_FROM_EFI_APPLICATION  \
   "Returning from EFI Application from Boot Option"
 #define EFI_EXIT_BOOT_SERVICES_INVOCATION   \
   "Exit Boot Services Invocation"
-- 
2.18.0.windows.1

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


[edk2] [PATCH 0/2] Fix typos in MdePkg and SecurityPkg

2018-12-10 Thread Shenglei Zhang
Change EFI_RETURNING_FROM_EFI_APPLICATOIN to
EFI_RETURNING_FROM_EFI_APPLICATION.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Chao Zhang 
Cc: Jiewen Yao 
Shenglei Zhang (2):
  MdePkg/IndustryStandard: Fix a typo in UefiTcgPlatform.h
  SecurityPkg/Tcg: Fix typos in TcgDxe.c and Tcg2Dxe.c

 MdePkg/Include/IndustryStandard/UefiTcgPlatform.h | 2 +-
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 4 ++--
 SecurityPkg/Tcg/TcgDxe/TcgDxe.c   | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

-- 
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 edk2-platforms] Platform/AMD/OverdriveBoard: fix byte order of default MAC addresses

2018-12-10 Thread Gao, Liming
If PCD is related to one structure in DEC/DSC, it can be refer as structure 
pointer in C source code. Here is wiki for its usage: 
https://github.com/lgao4/edk2/wiki/StrucutrePcd-Usage

Thanks
Liming
>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>Andrew Fish via edk2-devel
>Sent: Tuesday, December 11, 2018 7:39 AM
>To: Leif Lindholm 
>Cc: edk2-devel@lists.01.org
>Subject: Re: [edk2] [PATCH edk2-platforms] Platform/AMD/OverdriveBoard:
>fix byte order of default MAC addresses
>
>
>
>> On Dec 10, 2018, at 3:33 PM, Leif Lindholm  wrote:
>>
>> On Mon, Dec 10, 2018 at 11:51:43PM +0100, Ard Biesheuvel wrote:
>>> On Mon, 10 Dec 2018 at 23:14, Leif Lindholm 
>wrote:

 On Wed, Dec 05, 2018 at 09:10:48PM +0100, Ard Biesheuvel wrote:
> The PCDs containing the default MAC addresses are of type UINT64,
> and so the byte order needs to be inverted. As they are currently,
> both default MAC addresses are invalid since they have the multicast
> bit set.

 Ah, oops.
 That would also prevent them from being "locally administered" and
 hence permissible without registering an entry in the OUI.

 However, to reduce someone interpreting the _new_ values that way
 instead, could you do one of:
 - Adding a comment explaining these are in reverse byte order.
 or
 - Convert them to the new Array type PCD[1], to make the bytes appear
  in natural order?

 [1] edk2 72a1d77694d51914c0dd6aa97dbfa58634b0a4a5
>>>
>>> How does one refer to such a PCD from C code?
>>
>> Good question :)
>>
>
>Seems like you would need cast the pointer to the data structure in the C
>code. If I understand correctly the change in the PCD creation code is you can
>now better structure the data, but it is no different on the consumer end and
>you got a blob of bytes in both cases.
>
>Thanks,
>
>Andrew Fish
>
>> /
>>Leif
>>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
> Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
>b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> index 05433d4472e8..2843e51f93f7 100644
> --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> @@ -469,8 +469,8 @@ DEFINE DO_CAPSULE   = FALSE
>   gAmdModulePkgTokenSpaceGuid.PcdPort1NetSpeed|1
>
> [PcdsDynamicDefault.common]
> -  gAmdStyxTokenSpaceGuid.PcdEthMacA|0x02A1A2A3A4A5
> -  gAmdStyxTokenSpaceGuid.PcdEthMacB|0x02B1B2B3B4B5
> +  gAmdStyxTokenSpaceGuid.PcdEthMacA|0xA5A4A3A2A102
> +  gAmdStyxTokenSpaceGuid.PcdEthMacB|0xB5B4B3B2B102
>
> [PcdsPatchableInModule]
>   gAmdModulePkgTokenSpaceGuid.PcdXgbeUseMacFromIscp|TRUE
> --
> 2.19.2
>
>> ___
>> 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] [PATCH edk2-platforms] Platform/AMD/OverdriveBoard: fix byte order of default MAC addresses

2018-12-10 Thread Andrew Fish via edk2-devel



> On Dec 10, 2018, at 3:33 PM, Leif Lindholm  wrote:
> 
> On Mon, Dec 10, 2018 at 11:51:43PM +0100, Ard Biesheuvel wrote:
>> On Mon, 10 Dec 2018 at 23:14, Leif Lindholm  wrote:
>>> 
>>> On Wed, Dec 05, 2018 at 09:10:48PM +0100, Ard Biesheuvel wrote:
 The PCDs containing the default MAC addresses are of type UINT64,
 and so the byte order needs to be inverted. As they are currently,
 both default MAC addresses are invalid since they have the multicast
 bit set.
>>> 
>>> Ah, oops.
>>> That would also prevent them from being "locally administered" and
>>> hence permissible without registering an entry in the OUI.
>>> 
>>> However, to reduce someone interpreting the _new_ values that way
>>> instead, could you do one of:
>>> - Adding a comment explaining these are in reverse byte order.
>>> or
>>> - Convert them to the new Array type PCD[1], to make the bytes appear
>>>  in natural order?
>>> 
>>> [1] edk2 72a1d77694d51914c0dd6aa97dbfa58634b0a4a5
>> 
>> How does one refer to such a PCD from C code?
> 
> Good question :)
> 

Seems like you would need cast the pointer to the data structure in the C code. 
If I understand correctly the change in the PCD creation code is you can now 
better structure the data, but it is no different on the consumer end and you 
got a blob of bytes in both cases. 

Thanks,

Andrew Fish

> /
>Leif
> 
 Contributed-under: TianoCore Contribution Agreement 1.1
 Signed-off-by: Ard Biesheuvel 
 ---
 Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
 b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
 index 05433d4472e8..2843e51f93f7 100644
 --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
 +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
 @@ -469,8 +469,8 @@ DEFINE DO_CAPSULE   = FALSE
   gAmdModulePkgTokenSpaceGuid.PcdPort1NetSpeed|1
 
 [PcdsDynamicDefault.common]
 -  gAmdStyxTokenSpaceGuid.PcdEthMacA|0x02A1A2A3A4A5
 -  gAmdStyxTokenSpaceGuid.PcdEthMacB|0x02B1B2B3B4B5
 +  gAmdStyxTokenSpaceGuid.PcdEthMacA|0xA5A4A3A2A102
 +  gAmdStyxTokenSpaceGuid.PcdEthMacB|0xB5B4B3B2B102
 
 [PcdsPatchableInModule]
   gAmdModulePkgTokenSpaceGuid.PcdXgbeUseMacFromIscp|TRUE
 --
 2.19.2
 
> ___
> 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 edk2-platforms] Platform/AMD/OverdriveBoard: fix byte order of default MAC addresses

2018-12-10 Thread Leif Lindholm
On Mon, Dec 10, 2018 at 11:51:43PM +0100, Ard Biesheuvel wrote:
> On Mon, 10 Dec 2018 at 23:14, Leif Lindholm  wrote:
> >
> > On Wed, Dec 05, 2018 at 09:10:48PM +0100, Ard Biesheuvel wrote:
> > > The PCDs containing the default MAC addresses are of type UINT64,
> > > and so the byte order needs to be inverted. As they are currently,
> > > both default MAC addresses are invalid since they have the multicast
> > > bit set.
> >
> > Ah, oops.
> > That would also prevent them from being "locally administered" and
> > hence permissible without registering an entry in the OUI.
> >
> > However, to reduce someone interpreting the _new_ values that way
> > instead, could you do one of:
> > - Adding a comment explaining these are in reverse byte order.
> > or
> > - Convert them to the new Array type PCD[1], to make the bytes appear
> >   in natural order?
> >
> > [1] edk2 72a1d77694d51914c0dd6aa97dbfa58634b0a4a5
>
> How does one refer to such a PCD from C code?

Good question :)

/
Leif

> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Ard Biesheuvel 
> > > ---
> > >  Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
> > > b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > > index 05433d4472e8..2843e51f93f7 100644
> > > --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > > +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > > @@ -469,8 +469,8 @@ DEFINE DO_CAPSULE   = FALSE
> > >gAmdModulePkgTokenSpaceGuid.PcdPort1NetSpeed|1
> > >
> > >  [PcdsDynamicDefault.common]
> > > -  gAmdStyxTokenSpaceGuid.PcdEthMacA|0x02A1A2A3A4A5
> > > -  gAmdStyxTokenSpaceGuid.PcdEthMacB|0x02B1B2B3B4B5
> > > +  gAmdStyxTokenSpaceGuid.PcdEthMacA|0xA5A4A3A2A102
> > > +  gAmdStyxTokenSpaceGuid.PcdEthMacB|0xB5B4B3B2B102
> > >
> > >  [PcdsPatchableInModule]
> > >gAmdModulePkgTokenSpaceGuid.PcdXgbeUseMacFromIscp|TRUE
> > > --
> > > 2.19.2
> > >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms] Platform/AMD/OverdriveBoard: fix byte order of default MAC addresses

2018-12-10 Thread Ard Biesheuvel
On Mon, 10 Dec 2018 at 23:14, Leif Lindholm  wrote:
>
> On Wed, Dec 05, 2018 at 09:10:48PM +0100, Ard Biesheuvel wrote:
> > The PCDs containing the default MAC addresses are of type UINT64,
> > and so the byte order needs to be inverted. As they are currently,
> > both default MAC addresses are invalid since they have the multicast
> > bit set.
>
> Ah, oops.
> That would also prevent them from being "locally administered" and
> hence permissible without registering an entry in the OUI.
>
> However, to reduce someone interpreting the _new_ values that way
> instead, could you do one of:
> - Adding a comment explaining these are in reverse byte order.
> or
> - Convert them to the new Array type PCD[1], to make the bytes appear
>   in natural order?
>
> [1] edk2 72a1d77694d51914c0dd6aa97dbfa58634b0a4a5
>

How does one refer to such a PCD from C code?


> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel 
> > ---
> >  Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
> > b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > index 05433d4472e8..2843e51f93f7 100644
> > --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > @@ -469,8 +469,8 @@ DEFINE DO_CAPSULE   = FALSE
> >gAmdModulePkgTokenSpaceGuid.PcdPort1NetSpeed|1
> >
> >  [PcdsDynamicDefault.common]
> > -  gAmdStyxTokenSpaceGuid.PcdEthMacA|0x02A1A2A3A4A5
> > -  gAmdStyxTokenSpaceGuid.PcdEthMacB|0x02B1B2B3B4B5
> > +  gAmdStyxTokenSpaceGuid.PcdEthMacA|0xA5A4A3A2A102
> > +  gAmdStyxTokenSpaceGuid.PcdEthMacB|0xB5B4B3B2B102
> >
> >  [PcdsPatchableInModule]
> >gAmdModulePkgTokenSpaceGuid.PcdXgbeUseMacFromIscp|TRUE
> > --
> > 2.19.2
> >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms 0/2] Silicon/Styx: merge and simplify ACPI platform driver

2018-12-10 Thread Leif Lindholm
On Thu, Dec 06, 2018 at 01:12:02PM +0100, Ard Biesheuvel wrote:
> After fixing the iasl issue yesterday, I got a bit carried away and ended
> up rewriting most of the ACPI table generation logic for Styx. So this
> applies on top of the patches I sent out yesterday.
> 
> Patch #1 merges the DXE driver and the library, that are split in two for
> no good reason.
> 
> Patch #2 simplifies the MADT generation code.

I would be lying if I said I'd properly reviewed this series, but
superficially it looks good, and I trust you to have tested it
properly. So:
Reviewed-by: Leif Lindholm 

> Ard Biesheuvel (2):
>   Silicon/AMD/Styx: merge ACPI table drivers
>   Silicon/Styx/AcpiPlatformDxe: simplify MADT generation logic
> 
>  .../AMD/OverdriveBoard/OverdriveBoard.dsc |   1 -
>  Platform/LeMaker/CelloBoard/CelloBoard.dsc|   1 -
>  .../Overdrive1000Board/Overdrive1000Board.dsc |   1 -
>  .../AMD/OverdriveBoard/OverdriveBoard.fdf |   1 +
>  Platform/LeMaker/CelloBoard/CelloBoard.fdf|   1 +
>  .../Overdrive1000Board/Overdrive1000Board.fdf |   1 +
>  Silicon/AMD/Styx/AcpiTables/AcpiTables.inf|  85 -
>  .../AcpiPlatformDxe/AcpiPlatformDxe.inf   |  34 +-
>  .../AcpiPlatformDxe/AcpiPlatform.h}   |  11 +-
>  Silicon/AMD/Styx/AcpiTables/Madt.c| 318 --
>  .../Drivers/AcpiPlatformDxe/AcpiPlatform.c| 155 +
>  .../AcpiPlatformDxe/Csrt.aslc}|  13 +-
>  .../AcpiPlatformDxe/Dbg2.aslc}|  12 +-
>  .../AcpiPlatformDxe/Fadt.aslc}|  11 +-
>  .../AcpiPlatformDxe/Gtdt.aslc}|  20 +-
>  .../AcpiPlatformDxe/Iort.aslc}|  19 +-
>  .../Styx/Drivers/AcpiPlatformDxe/Madt.aslc| 117 +++
>  .../AcpiPlatformDxe/Mcfg.aslc}|  13 +-
>  .../AcpiPlatformDxe/Pptt.aslc}|  10 +-
>  .../AcpiPlatformDxe/Spcr.aslc}|  12 +-
>  20 files changed, 264 insertions(+), 572 deletions(-)
>  delete mode 100644 Silicon/AMD/Styx/AcpiTables/AcpiTables.inf
>  rename Silicon/AMD/Styx/{Common/AmdStyxAcpiLib.h => 
> Drivers/AcpiPlatformDxe/AcpiPlatform.h} (81%)
>  delete mode 100644 Silicon/AMD/Styx/AcpiTables/Madt.c
>  rename Silicon/AMD/Styx/{AcpiTables/Csrt.c => 
> Drivers/AcpiPlatformDxe/Csrt.aslc} (93%)
>  rename Silicon/AMD/Styx/{AcpiTables/Dbg2.c => 
> Drivers/AcpiPlatformDxe/Dbg2.aslc} (95%)
>  rename Silicon/AMD/Styx/{AcpiTables/Fadt.c => 
> Drivers/AcpiPlatformDxe/Fadt.aslc} (96%)
>  rename Silicon/AMD/Styx/{AcpiTables/Gtdt.c => 
> Drivers/AcpiPlatformDxe/Gtdt.aslc} (92%)
>  rename Silicon/AMD/Styx/{AcpiTables/Iort.c => 
> Drivers/AcpiPlatformDxe/Iort.aslc} (95%)
>  create mode 100644 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Madt.aslc
>  rename Silicon/AMD/Styx/{AcpiTables/Mcfg.c => 
> Drivers/AcpiPlatformDxe/Mcfg.aslc} (86%)
>  rename Silicon/AMD/Styx/{AcpiTables/Pptt.c => 
> Drivers/AcpiPlatformDxe/Pptt.aslc} (97%)
>  rename Silicon/AMD/Styx/{AcpiTables/Spcr.c => 
> Drivers/AcpiPlatformDxe/Spcr.aslc} (90%)
> 
> -- 
> 2.19.2
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms] Platform/AMD/OverdriveBoard: fix byte order of default MAC addresses

2018-12-10 Thread Leif Lindholm
On Wed, Dec 05, 2018 at 09:10:48PM +0100, Ard Biesheuvel wrote:
> The PCDs containing the default MAC addresses are of type UINT64,
> and so the byte order needs to be inverted. As they are currently,
> both default MAC addresses are invalid since they have the multicast
> bit set.

Ah, oops.
That would also prevent them from being "locally administered" and
hence permissible without registering an entry in the OUI.

However, to reduce someone interpreting the _new_ values that way
instead, could you do one of:
- Adding a comment explaining these are in reverse byte order.
or
- Convert them to the new Array type PCD[1], to make the bytes appear
  in natural order?

[1] edk2 72a1d77694d51914c0dd6aa97dbfa58634b0a4a5

/
Leif

> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
>  Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
> b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> index 05433d4472e8..2843e51f93f7 100644
> --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> @@ -469,8 +469,8 @@ DEFINE DO_CAPSULE   = FALSE
>gAmdModulePkgTokenSpaceGuid.PcdPort1NetSpeed|1
>  
>  [PcdsDynamicDefault.common]
> -  gAmdStyxTokenSpaceGuid.PcdEthMacA|0x02A1A2A3A4A5
> -  gAmdStyxTokenSpaceGuid.PcdEthMacB|0x02B1B2B3B4B5
> +  gAmdStyxTokenSpaceGuid.PcdEthMacA|0xA5A4A3A2A102
> +  gAmdStyxTokenSpaceGuid.PcdEthMacB|0xB5B4B3B2B102
>  
>  [PcdsPatchableInModule]
>gAmdModulePkgTokenSpaceGuid.PcdXgbeUseMacFromIscp|TRUE
> -- 
> 2.19.2
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more

2018-12-10 Thread Leif Lindholm
On Wed, Dec 05, 2018 at 07:50:14PM +0100, Ard Biesheuvel wrote:
> Primarily, this series gets rid of the hacked up way this platform
> patches the DSDT at build time, by #include'ing intermediate output
> of the iasl compiler [or some version of it, at least]
> 
> While at it, apply some other cleanups/improvements.

All but the last one seem like they're following some form of common
thread. But anyway:
Reviewed-by: Leif Lindholm 

> Ard Biesheuvel (6):
>   Silicon/AMD/Styx: move SOC version macros to common header
>   Silicon/AMD/Styx: move B1 revision peripherals to separate SSDT table
>   Silicon/AMD/Styx: move XGBE declarations to separate SSDT table
>   Silicon/AMD/Styx: emit DSDT as aml directly
>   Platform: add acpiview to Seattle/Styx platforms
>   Platform/AMD/OverdriveBoard: use default resolution for GOP
> 
>  .../AMD/OverdriveBoard/OverdriveBoard.dsc |   7 +-
>  Platform/LeMaker/CelloBoard/CelloBoard.dsc|   5 +-
>  .../Overdrive1000Board/Overdrive1000Board.dsc |   4 +-
>  .../AMD/OverdriveBoard/OverdriveBoard.fdf |   2 +-
>  Platform/LeMaker/CelloBoard/CelloBoard.fdf|   2 +-
>  .../Overdrive1000Board/Overdrive1000Board.fdf |   2 +-
>  Silicon/AMD/Styx/AcpiTables/AcpiAml.inf   |  29 ---
>  Silicon/AMD/Styx/AcpiTables/AcpiTables.inf|   3 -
>  .../AcpiPlatformDxe/AcpiPlatformDxe.inf   |  13 ++
>  Silicon/AMD/Styx/Common/AmdStyxAcpiLib.h  |   1 -
>  Silicon/AMD/Styx/Common/SocVersion.h  |  19 ++
>  Silicon/AMD/Styx/AcpiTables/Dsdt.c| 192 --
>  Silicon/AMD/Styx/AcpiTables/Iort.c|   6 +-
>  .../Drivers/AcpiPlatformDxe/AcpiPlatform.c| 137 -
>  .../StyxSataPlatformDxe/InitController.c  |   7 +-
>  .../StyxDtbLoaderLib/StyxDtbLoaderLib.c   |   7 +-
>  .../AcpiPlatformDxe}/Dsdt.asl | 180 
>  .../Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl   |  86 
>  .../Styx/Drivers/AcpiPlatformDxe/SsdtXgbe.asl | 135 
>  19 files changed, 395 insertions(+), 442 deletions(-)
>  delete mode 100644 Silicon/AMD/Styx/AcpiTables/AcpiAml.inf
>  create mode 100644 Silicon/AMD/Styx/Common/SocVersion.h
>  delete mode 100644 Silicon/AMD/Styx/AcpiTables/Dsdt.c
>  rename Silicon/AMD/Styx/{AcpiTables => Drivers/AcpiPlatformDxe}/Dsdt.asl 
> (72%)
>  create mode 100644 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl
>  create mode 100644 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtXgbe.asl
> 
> -- 
> 2.19.2
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [edk2-test][v3 Patch 2/3] uefi-sct/SctPkg:Add VerifySignature() Func Test

2018-12-10 Thread Supreeth Venkatesh
On Wed, 2018-12-05 at 13:51 +0800, Eric Jin wrote:
> Enable the BBTestVerifySignatureFunctionTest()
> with 2 checkpoints below, it should be success.
> The Certificate/Hash/Digest/signedData are updated
> correspondingly.
> a)Signed hash was verified against caller-provided
> hash of content, the signer's certificate was not
> found in RevokedDb, and was found in AllowedDb.
> b)Signer is found in both AllowedDb and RevokedDb,
> the signing was allowed by reference to TimeStampDb,
> and no hash matching content hash was found in RevokedDb.
> 
> Cc: Supreeth Venkatesh 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Jin 
Acked-by: Supreeth Venkatesh 

> ---
>  .../EFI/Protocol/PKCS7Verify/BlackBoxTest/Guid.c   |2 +
>  .../EFI/Protocol/PKCS7Verify/BlackBoxTest/Guid.h   |8 +
>  .../PKCS7Verify/BlackBoxTest/Pkcs7BBTestData.c | 1466
> +---
>  .../PKCS7Verify/BlackBoxTest/Pkcs7BBTestFunction.c |   86 ++
>  .../PKCS7Verify/BlackBoxTest/Pkcs7BBTestMain.c |   57 +-
>  .../PKCS7Verify/BlackBoxTest/Pkcs7BBTestMain.h |   25 +-
>  6 files changed, 1099 insertions(+), 545 deletions(-)
> 
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/PKCS7Verify/BlackBoxTest/Guid.c
> b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/PKCS7Verify/BlackBoxTest/Guid.c
> index 142f6d4..4d433c3 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/PKCS7Verify/BlackBoxTest/Guid.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/PKCS7Verify/BlackBoxTest/Guid.c
> @@ -42,3 +42,5 @@ EFI_GUID gPkcs7BBTestFunctionAssertionGuid001 =
> EFI_TEST_PKCS7BBTESTFUNCTION_ASS
>  EFI_GUID gPkcs7BBTestFunctionAssertionGuid002 =
> EFI_TEST_PKCS7BBTESTFUNCTION_ASSERTION_002_GUID;
>  EFI_GUID gPkcs7BBTestFunctionAssertionGuid003 =
> EFI_TEST_PKCS7BBTESTFUNCTION_ASSERTION_003_GUID;
>  EFI_GUID gPkcs7BBTestFunctionAssertionGuid004 =
> EFI_TEST_PKCS7BBTESTFUNCTION_ASSERTION_004_GUID;
> +EFI_GUID gPkcs7BBTestFunctionAssertionGuid005 =
> EFI_TEST_PKCS7BBTESTFUNCTION_ASSERTION_005_GUID;
> +EFI_GUID gPkcs7BBTestFunctionAssertionGuid006 =
> EFI_TEST_PKCS7BBTESTFUNCTION_ASSERTION_006_GUID;
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/PKCS7Verify/BlackBoxTest/Guid.h
> b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/PKCS7Verify/BlackBoxTest/Guid.h
> index ce980c9..94d2568 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/PKCS7Verify/BlackBoxTest/Guid.h
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/PKCS7Verify/BlackBoxTest/Guid.h
> @@ -81,3 +81,11 @@ extern EFI_GUID
> gPkcs7BBTestFunctionAssertionGuid003;
>  #define EFI_TEST_PKCS7BBTESTFUNCTION_ASSERTION_004_GUID \
>  { 0x912e23ef, 0x299c, 0x41ab, {0xa0, 0xf5, 0xfc, 0xbc, 0xf6, 0xfd,
> 0xd3, 0x32 }}
>  extern EFI_GUID gPkcs7BBTestFunctionAssertionGuid004;
> +
> +#define EFI_TEST_PKCS7BBTESTFUNCTION_ASSERTION_005_GUID \
> +{ 0x93740b06, 0xa186, 0x47ff, { 0xba, 0xc3, 0xdd, 0xa8, 0xcb, 0x7b,
> 0x18, 0x5e }}
> +extern EFI_GUID gPkcs7BBTestFunctionAssertionGuid005;
> +
> +#define EFI_TEST_PKCS7BBTESTFUNCTION_ASSERTION_006_GUID \
> +{ 0x37253616, 0xca42, 0x4082, { 0x90, 0xda, 0xdb, 0x69, 0x98, 0x22,
> 0xa0, 0xe6 }}
> +extern EFI_GUID gPkcs7BBTestFunctionAssertionGuid006;
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/PKCS7Verify/BlackBoxTest/Pkcs7B
> BTestData.c b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/PKCS7Verify/BlackBoxTest/Pkcs7B
> BTestData.c
> index 0511e00..9b66938 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/PKCS7Verify/BlackBoxTest/Pkcs7B
> BTestData.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/PKCS7Verify/BlackBoxTest/Pkcs7B
> BTestData.c
> @@ -25,541 +25,979 @@ Abstract:
>  --*/
>  
>  //
> +// Test Root Certificate ("TestRoot.cer")
> +//
> +GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TestRootCert[781] = {
> +  0x30, 0x82, 0x03, 0x09, 0x30, 0x82, 0x01, 0xF1, 0xA0, 0x03, 0x02,
> 0x01,
> +  0x02, 0x02, 0x10, 0xDE, 0x9F, 0x42, 0x91, 0x68, 0x16, 0xEA, 0x97,
> 0x4D,
> +  0xA1, 0x8A, 0x32, 0x25, 0xD6, 0xEE, 0x8D, 0x30, 0x0D, 0x06, 0x09,
> 0x2A,
> +  0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x30,
> 0x13,
> +  0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x08,
> 0x54,
> +  0x65, 0x73, 0x74, 0x52, 0x6F, 0x6F, 0x74, 0x30, 0x1E, 0x17, 0x0D,
> 0x31,
> +  0x38, 0x30, 0x31, 0x32, 0x35, 0x30, 0x32, 0x30, 0x35, 0x35, 0x30,
> 0x5A,
> +  0x17, 0x0D, 0x33, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35,
> 0x39,
> +  0x35, 0x39, 0x5A, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03,
> 0x55,
> +  0x04, 0x03, 0x13, 0x08, 0x54, 0x65, 0x73, 0x74, 0x52, 0x6F, 0x6F,
> 0x74,
> +  0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48,
> 0x86,
> +  0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F,
> 0x00,
> +  0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xA5, 0x97,
> 0x23,
> +  0x48, 0xBE, 0xCA, 0xC8, 0xE0, 0x88, 0xC6, 0xA2, 0xAF, 0x78, 0x60,
> 0x94,
> +  0x48, 0x3E, 0x82, 0xE7, 0xD5, 0x62, 0x01, 0x73, 0x00, 0xEA, 0x4

Re: [edk2] [PATCH] BaseTools/tools_def AARCH64: move GCC49/GGC5 to 4 KB section alignment

2018-12-10 Thread Leif Lindholm
On Mon, Dec 10, 2018 at 03:13:39PM +0100, Ard Biesheuvel wrote:
> Since 4 KB section alignment is required when mapping PE/COFF images
> with strict permissions, update the default section alignment when
> using GCC49 and GCC5 in RELEASE mode. Note that XIP modules such as
> SEC, PEIMs or PEI core are not affected by this change, since the
> override to 32 byte aligment remains in effect.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 

We have at least one platform in the wild that refuses to load
applications that don't have a 4KB aligned codeoffset.

>From experimentation, Visual Studio builds already enforce this on
AArch64.

I guess my only question/comment would be if GCC48 is left out
intentionally?

Reviewed-by: Leif Lindholm 
Tested-by: Leif Lindholm 

> ---
>  BaseTools/Conf/tools_def.template | 24 +++-
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/BaseTools/Conf/tools_def.template 
> b/BaseTools/Conf/tools_def.template
> index e0e68fd7fb49..5d34333dc54f 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -4263,11 +4263,11 @@ DEFINE GCC49_ARM_ASM_FLAGS   = 
> DEF(GCC48_ARM_ASM_FLAGS)
>  DEFINE GCC49_AARCH64_ASM_FLAGS   = DEF(GCC48_AARCH64_ASM_FLAGS)
>  DEFINE GCC49_ARM_CC_FLAGS= DEF(GCC48_ARM_CC_FLAGS)
>  DEFINE GCC49_ARM_CC_XIPFLAGS = DEF(GCC48_ARM_CC_XIPFLAGS)
> -DEFINE GCC49_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS)
> +DEFINE GCC49_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -mcmodel=small
>  DEFINE GCC49_AARCH64_CC_XIPFLAGS = DEF(GCC48_AARCH64_CC_XIPFLAGS)
>  DEFINE GCC49_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS)
>  DEFINE GCC49_ARM_DLINK2_FLAGS= DEF(GCC48_ARM_DLINK2_FLAGS)
> -DEFINE GCC49_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS)
> +DEFINE GCC49_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS) -z 
> common-page-size=0x1000
>  DEFINE GCC49_AARCH64_DLINK2_FLAGS= DEF(GCC48_AARCH64_DLINK2_FLAGS)
>  DEFINE GCC49_ARM_ASLDLINK_FLAGS  = DEF(GCC48_ARM_ASLDLINK_FLAGS)
>  DEFINE GCC49_AARCH64_ASLDLINK_FLAGS  = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
> @@ -5034,15 +5034,16 @@ RELEASE_GCC49_ARM_CC_FLAGS   = 
> DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-v
>  *_GCC49_AARCH64_VFRPP_FLAGS  = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> DEF(GCC_VFRPP_FLAGS)
>  *_GCC49_AARCH64_CC_XIPFLAGS  = DEF(GCC49_AARCH64_CC_XIPFLAGS)
>  
> -  DEBUG_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0 
> -mcmodel=small
> -  DEBUG_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -z 
> common-page-size=0x1000
> +  DEBUG_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0
> +  DEBUG_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS)
>DEBUG_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
>  
> -RELEASE_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) 
> -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny
> +RELEASE_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) 
> -Wno-unused-but-set-variable -Wno-unused-const-variable
>  RELEASE_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS)
> +RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
>  
> -  NOOPT_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0 
> -mcmodel=small
> -  NOOPT_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -z 
> common-page-size=0x1000 -O0
> +  NOOPT_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0
> +  NOOPT_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -O0
>NOOPT_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 -O0
>  
>  
> 
> @@ -5189,14 +5190,15 @@ RELEASE_GCC5_ARM_DLINK_FLAGS = 
> DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKS
>  *_GCC5_AARCH64_VFRPP_FLAGS   = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> DEF(GCC_VFRPP_FLAGS)
>  *_GCC5_AARCH64_CC_XIPFLAGS   = DEF(GCC5_AARCH64_CC_XIPFLAGS)
>  
> -  DEBUG_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
> -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=small
> -  DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -z 
> common-page-size=0x1000 -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto 
> -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 
> -Wno-lto-type-mismatch -mcmodel=small
> +  DEBUG_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
> -Wno-unused-but-set-variable -Wno-unused-const-variable
> +  DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os 
> -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 
> -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch
>DEBUG_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-

Re: [edk2] [PATCH] ShellPkg: Remove ShellPkg wrapper header files

2018-12-10 Thread Leif Lindholm
Hi Marcin,

This EDK2 patch has been pushed, making all of the Armada platforms
stop building. Can you have a look please?

Regards,

Leif

On Thu, Nov 15, 2018 at 03:45:28PM +0800, Shenglei Zhang wrote:
> These wrapper header files are not referenced by all
> open source, so they are removed.
> https://bugzilla.tianocore.org/show_bug.cgi?id=158
> 
> Cc: Jaben Carsey 
> Cc: Ruiyu Ni 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang 
> ---
>  ShellPkg/Include/Protocol/EfiShell.h  | 21 ---
>  .../Include/Protocol/EfiShellDynamicCommand.h | 21 ---
>  .../Include/Protocol/EfiShellParameters.h | 20 --
>  ShellPkg/Include/ShellBase.h  | 20 --
>  4 files changed, 82 deletions(-)
>  delete mode 100644 ShellPkg/Include/Protocol/EfiShell.h
>  delete mode 100644 ShellPkg/Include/Protocol/EfiShellDynamicCommand.h
>  delete mode 100644 ShellPkg/Include/Protocol/EfiShellParameters.h
>  delete mode 100644 ShellPkg/Include/ShellBase.h
> 
> diff --git a/ShellPkg/Include/Protocol/EfiShell.h 
> b/ShellPkg/Include/Protocol/EfiShell.h
> deleted file mode 100644
> index 8e3c2fe4de..00
> --- a/ShellPkg/Include/Protocol/EfiShell.h
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -/** @file
> -  EFI Shell protocol as defined in the UEFI Shell 2.0 specification 
> including errata.
> -
> -  (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
> -  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
> -  This program and the accompanying materials
> -  are licensed and made available under the terms and conditions of the BSD 
> License
> -  which accompanies this distribution.  The full text of the license may be 
> found at
> -  http://opensource.org/licenses/bsd-license.php
> -
> -  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> -  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> -
> -**/
> -
> -#ifndef __EFI_SHELL_PROTOCOL_H__WRAPPER__
> -#define __EFI_SHELL_PROTOCOL_H__WRAPPER__
> -
> -#include 
> -
> -#endif
> diff --git a/ShellPkg/Include/Protocol/EfiShellDynamicCommand.h 
> b/ShellPkg/Include/Protocol/EfiShellDynamicCommand.h
> deleted file mode 100644
> index 50f9398ec6..00
> --- a/ShellPkg/Include/Protocol/EfiShellDynamicCommand.h
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -/** @file
> -  EFI Shell Dynamic Command registration protocol
> -
> -  (C) Copyright 2012-2014 Hewlett-Packard Development Company, L.P.
> -  Copyright (c) 2016, Intel Corporation. All rights reserved.
> -  This program and the accompanying materials
> -  are licensed and made available under the terms and conditions of the BSD 
> License
> -  which accompanies this distribution.  The full text of the license may be 
> found at
> -  http://opensource.org/licenses/bsd-license.php
> -
> -  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> -  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> -
> -**/
> -
> -#ifndef __EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_H__WRAPPER__
> -#define __EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_H__WRAPPER__
> -
> -#include 
> -
> -#endif
> diff --git a/ShellPkg/Include/Protocol/EfiShellParameters.h 
> b/ShellPkg/Include/Protocol/EfiShellParameters.h
> deleted file mode 100644
> index 184b029ffa..00
> --- a/ShellPkg/Include/Protocol/EfiShellParameters.h
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -/** @file
> -  EFI Shell protocol as defined in the UEFI Shell 2.0 specification.
> -
> -  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
> -  This program and the accompanying materials
> -  are licensed and made available under the terms and conditions of the BSD 
> License
> -  which accompanies this distribution.  The full text of the license may be 
> found at
> -  http://opensource.org/licenses/bsd-license.php
> -
> -  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> -  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> -
> -**/
> -
> -#ifndef __EFI_SHELL_PARAMETERS_PROTOCOL_H__WRAPPER__
> -#define __EFI_SHELL_PARAMETERS_PROTOCOL_H__WRAPPER__
> -
> -#include 
> -
> -#endif
> diff --git a/ShellPkg/Include/ShellBase.h b/ShellPkg/Include/ShellBase.h
> deleted file mode 100644
> index 725ce5242f..00
> --- a/ShellPkg/Include/ShellBase.h
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -/** @file
> -  Root include file for Shell Package modules that utilize the SHELL_RETURN 
> type
> -
> -  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
> -  This program and the accompanying materials
> -  are licensed and made available under the terms and conditions of the BSD 
> License
> -  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 UND

Re: [edk2] [PATCH] BaseTools/tools_def AARCH64: move GCC49/GGC5 to 4 KB section alignment

2018-12-10 Thread Laszlo Ersek
On 12/10/18 19:12, Ard Biesheuvel wrote:
> On Mon, 10 Dec 2018 at 19:08, Laszlo Ersek  wrote:
>>
>> On 12/10/18 15:13, Ard Biesheuvel wrote:
>>> Since 4 KB section alignment is required when mapping PE/COFF images
>>> with strict permissions, update the default section alignment when
>>> using GCC49 and GCC5 in RELEASE mode. Note that XIP modules such as
>>> SEC, PEIMs or PEI core are not affected by this change, since the
>>> override to 32 byte aligment remains in effect.
>>>
>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>> Signed-off-by: Ard Biesheuvel 
>>> ---
>>>  BaseTools/Conf/tools_def.template | 24 +++-
>>>  1 file changed, 13 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/BaseTools/Conf/tools_def.template 
>>> b/BaseTools/Conf/tools_def.template
>>> index e0e68fd7fb49..5d34333dc54f 100755
>>> --- a/BaseTools/Conf/tools_def.template
>>> +++ b/BaseTools/Conf/tools_def.template
>>> @@ -4263,11 +4263,11 @@ DEFINE GCC49_ARM_ASM_FLAGS   = 
>>> DEF(GCC48_ARM_ASM_FLAGS)
>>>  DEFINE GCC49_AARCH64_ASM_FLAGS   = DEF(GCC48_AARCH64_ASM_FLAGS)
>>>  DEFINE GCC49_ARM_CC_FLAGS= DEF(GCC48_ARM_CC_FLAGS)
>>>  DEFINE GCC49_ARM_CC_XIPFLAGS = DEF(GCC48_ARM_CC_XIPFLAGS)
>>> -DEFINE GCC49_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
>>> DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS)
>>> +DEFINE GCC49_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
>>> DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -mcmodel=small
>>>  DEFINE GCC49_AARCH64_CC_XIPFLAGS = DEF(GCC48_AARCH64_CC_XIPFLAGS)
>>>  DEFINE GCC49_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS)
>>>  DEFINE GCC49_ARM_DLINK2_FLAGS= DEF(GCC48_ARM_DLINK2_FLAGS)
>>> -DEFINE GCC49_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS)
>>> +DEFINE GCC49_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS) -z 
>>> common-page-size=0x1000
>>>  DEFINE GCC49_AARCH64_DLINK2_FLAGS= DEF(GCC48_AARCH64_DLINK2_FLAGS)
>>>  DEFINE GCC49_ARM_ASLDLINK_FLAGS  = DEF(GCC48_ARM_ASLDLINK_FLAGS)
>>>  DEFINE GCC49_AARCH64_ASLDLINK_FLAGS  = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
>>> @@ -5034,15 +5034,16 @@ RELEASE_GCC49_ARM_CC_FLAGS   = 
>>> DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-v
>>>  *_GCC49_AARCH64_VFRPP_FLAGS  = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
>>> DEF(GCC_VFRPP_FLAGS)
>>>  *_GCC49_AARCH64_CC_XIPFLAGS  = DEF(GCC49_AARCH64_CC_XIPFLAGS)
>>>
>>> -  DEBUG_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0 
>>> -mcmodel=small
>>> -  DEBUG_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -z 
>>> common-page-size=0x1000
>>> +  DEBUG_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0
>>> +  DEBUG_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS)
>>>DEBUG_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
>>>
>>> -RELEASE_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) 
>>> -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny
>>> +RELEASE_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) 
>>> -Wno-unused-but-set-variable -Wno-unused-const-variable
>>>  RELEASE_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS)
>>> +RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
>>>
>>> -  NOOPT_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0 
>>> -mcmodel=small
>>> -  NOOPT_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -z 
>>> common-page-size=0x1000 -O0
>>> +  NOOPT_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0
>>> +  NOOPT_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -O0
>>>NOOPT_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 -O0
>>>
>>>  
>>> 
>>> @@ -5189,14 +5190,15 @@ RELEASE_GCC5_ARM_DLINK_FLAGS = 
>>> DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKS
>>>  *_GCC5_AARCH64_VFRPP_FLAGS   = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
>>> DEF(GCC_VFRPP_FLAGS)
>>>  *_GCC5_AARCH64_CC_XIPFLAGS   = DEF(GCC5_AARCH64_CC_XIPFLAGS)
>>>
>>> -  DEBUG_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
>>> -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=small
>>> -  DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -z 
>>> common-page-size=0x1000 -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto 
>>> -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 
>>> -Wno-lto-type-mismatch -mcmodel=small
>>> +  DEBUG_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
>>> -Wno-unused-but-set-variable -Wno-unused-const-variable
>>> +  DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os 
>>> -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 
>>> -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch
>>>DEBUG_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
>>>
>>> -RELEASE_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
>>> -Wno-un

Re: [edk2] [PATCH] BaseTools/tools_def AARCH64: move GCC49/GGC5 to 4 KB section alignment

2018-12-10 Thread Ard Biesheuvel
On Mon, 10 Dec 2018 at 19:08, Laszlo Ersek  wrote:
>
> On 12/10/18 15:13, Ard Biesheuvel wrote:
> > Since 4 KB section alignment is required when mapping PE/COFF images
> > with strict permissions, update the default section alignment when
> > using GCC49 and GCC5 in RELEASE mode. Note that XIP modules such as
> > SEC, PEIMs or PEI core are not affected by this change, since the
> > override to 32 byte aligment remains in effect.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel 
> > ---
> >  BaseTools/Conf/tools_def.template | 24 +++-
> >  1 file changed, 13 insertions(+), 11 deletions(-)
> >
> > diff --git a/BaseTools/Conf/tools_def.template 
> > b/BaseTools/Conf/tools_def.template
> > index e0e68fd7fb49..5d34333dc54f 100755
> > --- a/BaseTools/Conf/tools_def.template
> > +++ b/BaseTools/Conf/tools_def.template
> > @@ -4263,11 +4263,11 @@ DEFINE GCC49_ARM_ASM_FLAGS   = 
> > DEF(GCC48_ARM_ASM_FLAGS)
> >  DEFINE GCC49_AARCH64_ASM_FLAGS   = DEF(GCC48_AARCH64_ASM_FLAGS)
> >  DEFINE GCC49_ARM_CC_FLAGS= DEF(GCC48_ARM_CC_FLAGS)
> >  DEFINE GCC49_ARM_CC_XIPFLAGS = DEF(GCC48_ARM_CC_XIPFLAGS)
> > -DEFINE GCC49_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> > DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS)
> > +DEFINE GCC49_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> > DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -mcmodel=small
> >  DEFINE GCC49_AARCH64_CC_XIPFLAGS = DEF(GCC48_AARCH64_CC_XIPFLAGS)
> >  DEFINE GCC49_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS)
> >  DEFINE GCC49_ARM_DLINK2_FLAGS= DEF(GCC48_ARM_DLINK2_FLAGS)
> > -DEFINE GCC49_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS)
> > +DEFINE GCC49_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS) -z 
> > common-page-size=0x1000
> >  DEFINE GCC49_AARCH64_DLINK2_FLAGS= DEF(GCC48_AARCH64_DLINK2_FLAGS)
> >  DEFINE GCC49_ARM_ASLDLINK_FLAGS  = DEF(GCC48_ARM_ASLDLINK_FLAGS)
> >  DEFINE GCC49_AARCH64_ASLDLINK_FLAGS  = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
> > @@ -5034,15 +5034,16 @@ RELEASE_GCC49_ARM_CC_FLAGS   = 
> > DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-v
> >  *_GCC49_AARCH64_VFRPP_FLAGS  = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> > DEF(GCC_VFRPP_FLAGS)
> >  *_GCC49_AARCH64_CC_XIPFLAGS  = DEF(GCC49_AARCH64_CC_XIPFLAGS)
> >
> > -  DEBUG_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0 
> > -mcmodel=small
> > -  DEBUG_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -z 
> > common-page-size=0x1000
> > +  DEBUG_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0
> > +  DEBUG_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS)
> >DEBUG_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
> >
> > -RELEASE_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) 
> > -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny
> > +RELEASE_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) 
> > -Wno-unused-but-set-variable -Wno-unused-const-variable
> >  RELEASE_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS)
> > +RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
> >
> > -  NOOPT_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0 
> > -mcmodel=small
> > -  NOOPT_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -z 
> > common-page-size=0x1000 -O0
> > +  NOOPT_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0
> > +  NOOPT_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -O0
> >NOOPT_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 -O0
> >
> >  
> > 
> > @@ -5189,14 +5190,15 @@ RELEASE_GCC5_ARM_DLINK_FLAGS = 
> > DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKS
> >  *_GCC5_AARCH64_VFRPP_FLAGS   = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> > DEF(GCC_VFRPP_FLAGS)
> >  *_GCC5_AARCH64_CC_XIPFLAGS   = DEF(GCC5_AARCH64_CC_XIPFLAGS)
> >
> > -  DEBUG_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
> > -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=small
> > -  DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -z 
> > common-page-size=0x1000 -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto 
> > -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 
> > -Wno-lto-type-mismatch -mcmodel=small
> > +  DEBUG_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
> > -Wno-unused-but-set-variable -Wno-unused-const-variable
> > +  DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os 
> > -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 
> > -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch
> >DEBUG_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
> >
> > -RELEASE_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
> > -Wno-unused-but-set-variable -Wno-unused-const-varia

Re: [edk2] [PATCH] BaseTools/tools_def AARCH64: move GCC49/GGC5 to 4 KB section alignment

2018-12-10 Thread Laszlo Ersek
On 12/10/18 15:13, Ard Biesheuvel wrote:
> Since 4 KB section alignment is required when mapping PE/COFF images
> with strict permissions, update the default section alignment when
> using GCC49 and GCC5 in RELEASE mode. Note that XIP modules such as
> SEC, PEIMs or PEI core are not affected by this change, since the
> override to 32 byte aligment remains in effect.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
>  BaseTools/Conf/tools_def.template | 24 +++-
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/BaseTools/Conf/tools_def.template 
> b/BaseTools/Conf/tools_def.template
> index e0e68fd7fb49..5d34333dc54f 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -4263,11 +4263,11 @@ DEFINE GCC49_ARM_ASM_FLAGS   = 
> DEF(GCC48_ARM_ASM_FLAGS)
>  DEFINE GCC49_AARCH64_ASM_FLAGS   = DEF(GCC48_AARCH64_ASM_FLAGS)
>  DEFINE GCC49_ARM_CC_FLAGS= DEF(GCC48_ARM_CC_FLAGS)
>  DEFINE GCC49_ARM_CC_XIPFLAGS = DEF(GCC48_ARM_CC_XIPFLAGS)
> -DEFINE GCC49_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS)
> +DEFINE GCC49_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -mcmodel=small
>  DEFINE GCC49_AARCH64_CC_XIPFLAGS = DEF(GCC48_AARCH64_CC_XIPFLAGS)
>  DEFINE GCC49_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS)
>  DEFINE GCC49_ARM_DLINK2_FLAGS= DEF(GCC48_ARM_DLINK2_FLAGS)
> -DEFINE GCC49_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS)
> +DEFINE GCC49_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS) -z 
> common-page-size=0x1000
>  DEFINE GCC49_AARCH64_DLINK2_FLAGS= DEF(GCC48_AARCH64_DLINK2_FLAGS)
>  DEFINE GCC49_ARM_ASLDLINK_FLAGS  = DEF(GCC48_ARM_ASLDLINK_FLAGS)
>  DEFINE GCC49_AARCH64_ASLDLINK_FLAGS  = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
> @@ -5034,15 +5034,16 @@ RELEASE_GCC49_ARM_CC_FLAGS   = 
> DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-v
>  *_GCC49_AARCH64_VFRPP_FLAGS  = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> DEF(GCC_VFRPP_FLAGS)
>  *_GCC49_AARCH64_CC_XIPFLAGS  = DEF(GCC49_AARCH64_CC_XIPFLAGS)
>  
> -  DEBUG_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0 
> -mcmodel=small
> -  DEBUG_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -z 
> common-page-size=0x1000
> +  DEBUG_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0
> +  DEBUG_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS)
>DEBUG_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
>  
> -RELEASE_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) 
> -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny
> +RELEASE_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) 
> -Wno-unused-but-set-variable -Wno-unused-const-variable
>  RELEASE_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS)
> +RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
>  
> -  NOOPT_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0 
> -mcmodel=small
> -  NOOPT_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -z 
> common-page-size=0x1000 -O0
> +  NOOPT_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0
> +  NOOPT_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -O0
>NOOPT_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 -O0
>  
>  
> 
> @@ -5189,14 +5190,15 @@ RELEASE_GCC5_ARM_DLINK_FLAGS = 
> DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKS
>  *_GCC5_AARCH64_VFRPP_FLAGS   = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> DEF(GCC_VFRPP_FLAGS)
>  *_GCC5_AARCH64_CC_XIPFLAGS   = DEF(GCC5_AARCH64_CC_XIPFLAGS)
>  
> -  DEBUG_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
> -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=small
> -  DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -z 
> common-page-size=0x1000 -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto 
> -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 
> -Wno-lto-type-mismatch -mcmodel=small
> +  DEBUG_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
> -Wno-unused-but-set-variable -Wno-unused-const-variable
> +  DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os 
> -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 
> -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch
>DEBUG_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
>  
> -RELEASE_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
> -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny
> +RELEASE_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
> -Wno-unused-but-set-variable -Wno-unused-const-variable
>  RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS)

Re: [edk2] SCT bugzilla topic?

2018-12-10 Thread Supreeth Venkatesh
Thanks Mike.
Looks good to me. I guess we can populate version field later to v2.7.0 (or 
something other than "UNSPECIFIED" later) .

Leif,

Please go ahead and raise a feature request and let us know.

Supreeth

-Original Message-
From: Kinney, Michael D 
Sent: Monday, December 10, 2018 11:37 AM
To: Supreeth Venkatesh ; Jin, Eric 
; Leif Lindholm ; Kinney, Michael 
D 
Cc: edk2-devel@lists.01.org; Dong Wei 
Subject: RE: SCT bugzilla topic?

Supreeth,

I have created the "EDK2 Test" product with the "UEFI-SCT" component.

Please review and let me know if there are any additional changes required.

Best regards,

Mike

> -Original Message-
> From: Supreeth Venkatesh
> [mailto:supreeth.venkat...@arm.com]
> Sent: Monday, December 10, 2018 8:40 AM
> To: Jin, Eric ; Leif Lindholm
> ; Kinney, Michael D
> 
> Cc: edk2-devel@lists.01.org; Dong Wei 
> Subject: RE: SCT bugzilla topic?
>
> I guess we are in agreement that "EDK2-Test" product and "UEFI-SCT"
> component in Bugzilla  is required.
>
> Mike,
> Can you please help create this and let us know?
>
> Thanks,
> Supreeth
>
> -Original Message-
> From: Jin, Eric 
> Sent: Monday, December 10, 2018 2:43 AM
> To: Leif Lindholm ; Kinney, Michael D
> 
> Cc: Supreeth Venkatesh ; edk2-
> de...@lists.01.org; Dong Wei 
> Subject: RE: SCT bugzilla topic?
>
> Hi Leif,
>
> We had better use "UEFI SCT" as the component.
> Other SCTs or test suites may be arranged in the EDK2-Test in future
> as the intention of EDK2-Test if my understanding is correct. Thanks.
>
> Best Regards
> Eric
>
> -Original Message-
> From: Leif Lindholm 
> Sent: Monday, December 10, 2018 4:14 PM
> To: Kinney, Michael D 
> Cc: Jin, Eric ; Supreeth Venkatesh
> ; edk2-devel@lists.01.org; Dong Wei
> 
> Subject: Re: SCT bugzilla topic?
>
> Hi Mike,
>
> I think we're agreed on an "EDK2 Test" product with an "SCT"
> component.
> (Although that should probably be "UEFI SCT" for clarity.)
>
> Regards,
>
> Leif
>
> On Mon, Dec 10, 2018 at 03:02:57AM +, Kinney, Michael D wrote:
> > I can update BZ once there is a clear decision on what
> is required.
> >
> > Mike
> >
> > > -Original Message-
> > > From: Jin, Eric
> > > Sent: Sunday, December 9, 2018 6:19 PM
> > > To: Supreeth Venkatesh ;
> Leif Lindholm
> > > ; edk2- de...@lists.01.org
> > > Cc: Kinney, Michael D ;
> Dong Wei
> > > ; Jin, Eric 
> > > Subject: RE: SCT bugzilla topic?
> > >
> > > Supreeth and Leif,
> > >
> > > UEFI-SCT is open source project now, the mantis is not
> proper
> > > option. We had better use the Bugzilla as edk2.
> > > Could the stewards help to create the Edk2 Test
> Product and SCT
> > > component if most members want to split test with
> edk2?
> > >
> > > Best Regards
> > > Eric
> > >
> > > -Original Message-
> > > From: Supreeth Venkatesh 
> > > Sent: Tuesday, December 4, 2018 3:37 AM
> > > To: Leif Lindholm ; edk2-
> > > de...@lists.01.org
> > > Cc: Jin, Eric ; Kinney, Michael D
> > > ; Dong Wei
> 
> > > Subject: RE: SCT bugzilla topic?
> > >
> > > Leif,
> > >
> > > Earlier, we used to use UTWG Mantis (for feature
> requests
> > > - https://mantis.uefi.org/mantis/view.php).
> > > After, UEFI-SCT became Open source, we did discuss to
> have the same
> > > infrastructure setup as edk2, which means using
> Bugzilla.
> > > However, I don't think we have created a SCT component
> or
> > > Edk2 Test Product yet.
> > >
> > > Your email reminds me one more task after the SCT
> component / Edk2
> > > Test product is created i.e., to migrate over
> remaining UTWG issues
> > > to Bugzilla.
> > >
> > > Once Eric chimes in/agrees, we will request Mike to
> create
> > > Edk2 Test Product within Bugzilla.
> > >
> > > Thanks,
> > > Supreeth
> > >
> > > -Original Message-
> > > From: Leif Lindholm 
> > > Sent: Monday, December 3, 2018 8:47 AM
> > > To: edk2-devel@lists.01.org
> > > Cc: Eric Jin ; Supreeth Venkatesh
> > > ; Michael D Kinney
> > > 
> > > Subject: SCT bugzilla topic?
> > >
> > > Hi Eric, Supreeth, Mike,
> > >
> > > I was looking to raise a feature request on UEFI SCT
> and didn't spot
> > > such a product. Should we create one?
> > >
> > > Or perhaps we should have an EDK2 Test product with an
> SCT
> > > component?
> > >
> > > Regards,
> > >
> > > Leif
> > > IMPORTANT NOTICE: The contents of this email and any
> attachments are
> > > confidential and may also be privileged.
> > > If you are not the intended recipient, please notify
> the sender
> > > immediately and do not disclose the contents to any
> other person,
> > > use it for any purpose, or store or copy the
> information in any
> > > medium. Thank you.
> IMPORTANT NOTICE: The contents of this email and any attachments are
> confidential and may also be privileged.
> If you are not the intended recipient, please notify the sender
> immediately and do not disclose the contents to any other person, use
> it for any purpose, or store or copy the information in any medium.
> Thank you.
IMPORTANT NOTICE: The contents of

Re: [edk2] SCT bugzilla topic?

2018-12-10 Thread Kinney, Michael D
Supreeth,

I have created the "EDK2 Test" product with the "UEFI-SCT" component.

Please review and let me know if there are any additional changes required.

Best regards,

Mike

> -Original Message-
> From: Supreeth Venkatesh
> [mailto:supreeth.venkat...@arm.com]
> Sent: Monday, December 10, 2018 8:40 AM
> To: Jin, Eric ; Leif Lindholm
> ; Kinney, Michael D
> 
> Cc: edk2-devel@lists.01.org; Dong Wei 
> Subject: RE: SCT bugzilla topic?
> 
> I guess we are in agreement that "EDK2-Test" product and
> "UEFI-SCT" component in Bugzilla  is required.
> 
> Mike,
> Can you please help create this and let us know?
> 
> Thanks,
> Supreeth
> 
> -Original Message-
> From: Jin, Eric 
> Sent: Monday, December 10, 2018 2:43 AM
> To: Leif Lindholm ; Kinney,
> Michael D 
> Cc: Supreeth Venkatesh ; edk2-
> de...@lists.01.org; Dong Wei 
> Subject: RE: SCT bugzilla topic?
> 
> Hi Leif,
> 
> We had better use "UEFI SCT" as the component.
> Other SCTs or test suites may be arranged in the EDK2-Test
> in future as the intention of EDK2-Test if my
> understanding is correct. Thanks.
> 
> Best Regards
> Eric
> 
> -Original Message-
> From: Leif Lindholm 
> Sent: Monday, December 10, 2018 4:14 PM
> To: Kinney, Michael D 
> Cc: Jin, Eric ; Supreeth Venkatesh
> ; edk2-devel@lists.01.org;
> Dong Wei 
> Subject: Re: SCT bugzilla topic?
> 
> Hi Mike,
> 
> I think we're agreed on an "EDK2 Test" product with an
> "SCT" component.
> (Although that should probably be "UEFI SCT" for clarity.)
> 
> Regards,
> 
> Leif
> 
> On Mon, Dec 10, 2018 at 03:02:57AM +, Kinney, Michael
> D wrote:
> > I can update BZ once there is a clear decision on what
> is required.
> >
> > Mike
> >
> > > -Original Message-
> > > From: Jin, Eric
> > > Sent: Sunday, December 9, 2018 6:19 PM
> > > To: Supreeth Venkatesh ;
> Leif Lindholm
> > > ; edk2- de...@lists.01.org
> > > Cc: Kinney, Michael D ;
> Dong Wei
> > > ; Jin, Eric 
> > > Subject: RE: SCT bugzilla topic?
> > >
> > > Supreeth and Leif,
> > >
> > > UEFI-SCT is open source project now, the mantis is not
> proper
> > > option. We had better use the Bugzilla as edk2.
> > > Could the stewards help to create the Edk2 Test
> Product and SCT
> > > component if most members want to split test with
> edk2?
> > >
> > > Best Regards
> > > Eric
> > >
> > > -Original Message-
> > > From: Supreeth Venkatesh 
> > > Sent: Tuesday, December 4, 2018 3:37 AM
> > > To: Leif Lindholm ; edk2-
> > > de...@lists.01.org
> > > Cc: Jin, Eric ; Kinney, Michael D
> > > ; Dong Wei
> 
> > > Subject: RE: SCT bugzilla topic?
> > >
> > > Leif,
> > >
> > > Earlier, we used to use UTWG Mantis (for feature
> requests
> > > - https://mantis.uefi.org/mantis/view.php).
> > > After, UEFI-SCT became Open source, we did discuss to
> have the same
> > > infrastructure setup as edk2, which means using
> Bugzilla.
> > > However, I don't think we have created a SCT component
> or
> > > Edk2 Test Product yet.
> > >
> > > Your email reminds me one more task after the SCT
> component / Edk2
> > > Test product is created i.e., to migrate over
> remaining UTWG issues
> > > to Bugzilla.
> > >
> > > Once Eric chimes in/agrees, we will request Mike to
> create
> > > Edk2 Test Product within Bugzilla.
> > >
> > > Thanks,
> > > Supreeth
> > >
> > > -Original Message-
> > > From: Leif Lindholm 
> > > Sent: Monday, December 3, 2018 8:47 AM
> > > To: edk2-devel@lists.01.org
> > > Cc: Eric Jin ; Supreeth Venkatesh
> > > ; Michael D Kinney
> > > 
> > > Subject: SCT bugzilla topic?
> > >
> > > Hi Eric, Supreeth, Mike,
> > >
> > > I was looking to raise a feature request on UEFI SCT
> and didn't spot
> > > such a product. Should we create one?
> > >
> > > Or perhaps we should have an EDK2 Test product with an
> SCT
> > > component?
> > >
> > > Regards,
> > >
> > > Leif
> > > IMPORTANT NOTICE: The contents of this email and any
> attachments are
> > > confidential and may also be privileged.
> > > If you are not the intended recipient, please notify
> the sender
> > > immediately and do not disclose the contents to any
> other person,
> > > use it for any purpose, or store or copy the
> information in any
> > > medium. Thank you.
> IMPORTANT NOTICE: The contents of this email and any
> attachments are confidential and may also be privileged.
> If you are not the intended recipient, please notify the
> sender immediately and do not disclose the contents to any
> other person, use it for any purpose, or store or copy the
> information in any medium. Thank you.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] SCT bugzilla topic?

2018-12-10 Thread Supreeth Venkatesh
I guess we are in agreement that "EDK2-Test" product and "UEFI-SCT" component 
in Bugzilla  is required.

Mike,
Can you please help create this and let us know?

Thanks,
Supreeth

-Original Message-
From: Jin, Eric 
Sent: Monday, December 10, 2018 2:43 AM
To: Leif Lindholm ; Kinney, Michael D 

Cc: Supreeth Venkatesh ; edk2-devel@lists.01.org; 
Dong Wei 
Subject: RE: SCT bugzilla topic?

Hi Leif,

We had better use "UEFI SCT" as the component.
Other SCTs or test suites may be arranged in the EDK2-Test in future as the 
intention of EDK2-Test if my understanding is correct. Thanks.

Best Regards
Eric

-Original Message-
From: Leif Lindholm 
Sent: Monday, December 10, 2018 4:14 PM
To: Kinney, Michael D 
Cc: Jin, Eric ; Supreeth Venkatesh 
; edk2-devel@lists.01.org; Dong Wei 

Subject: Re: SCT bugzilla topic?

Hi Mike,

I think we're agreed on an "EDK2 Test" product with an "SCT" component.
(Although that should probably be "UEFI SCT" for clarity.)

Regards,

Leif

On Mon, Dec 10, 2018 at 03:02:57AM +, Kinney, Michael D wrote:
> I can update BZ once there is a clear decision on what is required.
>
> Mike
>
> > -Original Message-
> > From: Jin, Eric
> > Sent: Sunday, December 9, 2018 6:19 PM
> > To: Supreeth Venkatesh ; Leif Lindholm
> > ; edk2- de...@lists.01.org
> > Cc: Kinney, Michael D ; Dong Wei
> > ; Jin, Eric 
> > Subject: RE: SCT bugzilla topic?
> >
> > Supreeth and Leif,
> >
> > UEFI-SCT is open source project now, the mantis is not proper
> > option. We had better use the Bugzilla as edk2.
> > Could the stewards help to create the Edk2 Test Product and SCT
> > component if most members want to split test with edk2?
> >
> > Best Regards
> > Eric
> >
> > -Original Message-
> > From: Supreeth Venkatesh 
> > Sent: Tuesday, December 4, 2018 3:37 AM
> > To: Leif Lindholm ; edk2-
> > de...@lists.01.org
> > Cc: Jin, Eric ; Kinney, Michael D
> > ; Dong Wei 
> > Subject: RE: SCT bugzilla topic?
> >
> > Leif,
> >
> > Earlier, we used to use UTWG Mantis (for feature requests
> > - https://mantis.uefi.org/mantis/view.php).
> > After, UEFI-SCT became Open source, we did discuss to have the same
> > infrastructure setup as edk2, which means using Bugzilla.
> > However, I don't think we have created a SCT component or
> > Edk2 Test Product yet.
> >
> > Your email reminds me one more task after the SCT component / Edk2
> > Test product is created i.e., to migrate over remaining UTWG issues
> > to Bugzilla.
> >
> > Once Eric chimes in/agrees, we will request Mike to create
> > Edk2 Test Product within Bugzilla.
> >
> > Thanks,
> > Supreeth
> >
> > -Original Message-
> > From: Leif Lindholm 
> > Sent: Monday, December 3, 2018 8:47 AM
> > To: edk2-devel@lists.01.org
> > Cc: Eric Jin ; Supreeth Venkatesh
> > ; Michael D Kinney
> > 
> > Subject: SCT bugzilla topic?
> >
> > Hi Eric, Supreeth, Mike,
> >
> > I was looking to raise a feature request on UEFI SCT and didn't spot
> > such a product. Should we create one?
> >
> > Or perhaps we should have an EDK2 Test product with an SCT
> > component?
> >
> > Regards,
> >
> > Leif
> > IMPORTANT NOTICE: The contents of this email and any attachments are
> > confidential and may also be privileged.
> > If you are not the intended recipient, please notify the sender
> > immediately and do not disclose the contents to any other person,
> > use it for any purpose, or store or copy the information in any
> > medium. Thank you.
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg.

2018-12-10 Thread Ard Biesheuvel
On Mon, 10 Dec 2018 at 15:40, Laszlo Ersek  wrote:
>
> Hi Ard,
>
> On 12/10/18 09:36, Ard Biesheuvel wrote:
>
> > Could anyone remind me why we have OpensslLib and OpensslLibCrypto?
> > Since these are static libraries, only the referenced objects should
> > be included in the final module anyway, so OpensslLibCrypto seems
> > redundant to me.
>
> please see commit 823005621ef4 ("CryptoPkg/OpensslLib: introduce
> OpensslLibCrypto instance", 2017-02-25).
>

Right, fair enough.


> >> Namely, please *prepend* a patch to the series that simply deletes the
> >> "[Components.IA32, Components.X64]" line, bringing all these drivers to
> >> ARM/AARCH64, in the NetworkPkg.dsc build. Once we validate the new patch
> >> separately (simply by test-building it), then the current patch can
> >> simply replace the component list with the !include directive -- and
> >> such a replacement won't incur arch-specific changes.
> >>
> >
> > Ack
>
> Liming and I strongly disagreed on this point, and I yielded. Please see
> the sub-thread that ended with the following comment:
>
> e790855d-2cd9-1820-7187-0ec1dc52dabc@redhat.com">http://mid.mail-archive.com/e790855d-2cd9-1820-7187-0ec1dc52dabc@redhat.com
>
> (Alternative link:
> .)
>

As long as we end up with a NetworkPkg.dsc that covers everything for
all arches, I'm fine with whichever order we apply the changes.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools/Conf/tools_def.template: drop ARM/AARCH support from GCC46/GCC47

2018-12-10 Thread Ard Biesheuvel
On Mon, 10 Dec 2018 at 16:25, Laszlo Ersek  wrote:
>
> On 12/08/18 10:32, Ard Biesheuvel wrote:
> > This drops ARM and AARCH64 support from the GCC46 and GCC47 toolchain
> > definitions, which are on the list to be removed, along with VS2003,
> > VS2005, VS2008, VS2010, DDK3790, UNIXGCC, GCC44, GCC45, ELFGCC, CYGGCC,
> > ICC, ICC11 and MYTOOLS.
> >
> > Since GCC46 and GCC47 are the only ones on that list that support ARM
> > and/or AARCH64, let's give Liming a hand and cover the ARM side of
> > things first, so that everything that remains to be removed is x86
> > only.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel 
> > ---
> >  BaseTools/Conf/tools_def.template | 143 ++--
> >  1 file changed, 14 insertions(+), 129 deletions(-)
> >
> > diff --git a/BaseTools/Conf/tools_def.template 
> > b/BaseTools/Conf/tools_def.template
> > index e0e68fd7fb49..3bc140d8f241 100755
> > --- a/BaseTools/Conf/tools_def.template
> > +++ b/BaseTools/Conf/tools_def.template
> > @@ -368,13 +368,13 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
> >  #   Intel(r) ACPI Compiler from
> >  #   https://acpica.org/downloads
> >  #   GCC46   -Linux,Windows-  Requires:
> > -# GCC 4.6 targeting x86_64-linux-gnu or 
> > arm-linux-gnueabi
> > +# GCC 4.6 targeting x86_64-linux-gnu
> >  #Optional:
> >  # Required to build platforms or ACPI tables:
> >  #   Intel(r) ACPI Compiler from
> >  #   https://acpica.org/downloads
> >  #   GCC47   -Linux,Windows-  Requires:
> > -# GCC 4.7 targeting x86_64-linux-gnu, 
> > aarch64-linux-gnu, or arm-linux-gnueabi
> > +# GCC 4.7 targeting x86_64-linux-gnu
> >  #Optional:
> >  # Required to build platforms or ACPI tables:
> >  #   Intel(r) ACPI Compiler from
> > @@ -4199,12 +4199,6 @@ DEFINE GCC46_IA32_DLINK2_FLAGS   = 
> > DEF(GCC45_IA32_DLINK2_FLAGS)
> >  DEFINE GCC46_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS)
> >  DEFINE GCC46_X64_DLINK2_FLAGS= DEF(GCC45_X64_DLINK2_FLAGS)
> >  DEFINE GCC46_ASM_FLAGS   = DEF(GCC45_ASM_FLAGS)
> > -DEFINE GCC46_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
> > DEF(GCC_ASM_FLAGS) -mlittle-endian
> > -DEFINE GCC46_ARM_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> > DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations
> > -DEFINE GCC46_ARM_CC_XIPFLAGS = -D__ARM_FEATURE_UNALIGNED=0
> > -DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) 
> > -Wl,--oformat=elf32-littlearm
> > -DEFINE GCC46_ARM_DLINK2_FLAGS= DEF(GCC_DLINK2_FLAGS_COMMON) 
> > -Wl,--defsym=PECOFF_HEADER_SIZE=0x220
> > -DEFINE GCC46_ARM_ASLDLINK_FLAGS  = DEF(GCC_ARM_ASLDLINK_FLAGS) 
> > -Wl,--oformat=elf32-littlearm
> >
> >  DEFINE GCC47_IA32_CC_FLAGS   = DEF(GCC46_IA32_CC_FLAGS)
> >  DEFINE GCC47_X64_CC_FLAGS= DEF(GCC46_X64_CC_FLAGS)
> > @@ -4215,18 +4209,6 @@ DEFINE GCC47_IA32_DLINK2_FLAGS   = 
> > DEF(GCC46_IA32_DLINK2_FLAGS)
> >  DEFINE GCC47_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS)
> >  DEFINE GCC47_X64_DLINK2_FLAGS= DEF(GCC46_X64_DLINK2_FLAGS)
> >  DEFINE GCC47_ASM_FLAGS   = DEF(GCC46_ASM_FLAGS)
> > -DEFINE GCC47_ARM_ASM_FLAGS   = DEF(GCC46_ARM_ASM_FLAGS)
> > -DEFINE GCC47_AARCH64_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
> > DEF(GCC_ASM_FLAGS) -mlittle-endian
> > -DEFINE GCC47_ARM_CC_FLAGS= DEF(GCC46_ARM_CC_FLAGS)
> > -DEFINE GCC47_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS)
> > -DEFINE GCC47_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> > -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS)
> > -DEFINE GCC47_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
> > -DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
> > -DEFINE GCC47_ARM_DLINK2_FLAGS= DEF(GCC46_ARM_DLINK2_FLAGS)
> > -DEFINE GCC47_AARCH64_DLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS)
> > -DEFINE GCC47_AARCH64_DLINK2_FLAGS= DEF(GCC_DLINK2_FLAGS_COMMON) 
> > -Wl,--defsym=PECOFF_HEADER_SIZE=0x228
> > -DEFINE GCC47_ARM_ASLDLINK_FLAGS  = DEF(GCC46_ARM_ASLDLINK_FLAGS)
> > -DEFINE GCC47_AARCH64_ASLDLINK_FLAGS  = DEF(GCC_AARCH64_ASLDLINK_FLAGS)
> >
> >  DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC47_IA32_CC_FLAGS)
> >  DEFINE GCC48_X64_CC_FLAGS= DEF(GCC47_X64_CC_FLAGS)
> > @@ -4237,18 +4219,18 @@ DEFINE GCC48_IA32_DLINK2_FLAGS   = 
> > DEF(GCC47_IA32_DLINK2_FLAGS)
> >  DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC47_X64_DLINK_FLAGS)
> >  DEFINE GCC48_X64_DLINK2_FLAGS= DEF(GCC47_X64_DLINK2_FLAGS)
> >  DEFINE GCC48_ASM_FLAGS   = DEF(GCC47_ASM_FLAGS)
> >

Re: [edk2] [PATCH] BaseTools/Conf/tools_def.template: drop ARM/AARCH support from GCC46/GCC47

2018-12-10 Thread Laszlo Ersek
On 12/08/18 10:32, Ard Biesheuvel wrote:
> This drops ARM and AARCH64 support from the GCC46 and GCC47 toolchain
> definitions, which are on the list to be removed, along with VS2003,
> VS2005, VS2008, VS2010, DDK3790, UNIXGCC, GCC44, GCC45, ELFGCC, CYGGCC,
> ICC, ICC11 and MYTOOLS.
> 
> Since GCC46 and GCC47 are the only ones on that list that support ARM
> and/or AARCH64, let's give Liming a hand and cover the ARM side of
> things first, so that everything that remains to be removed is x86
> only.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
>  BaseTools/Conf/tools_def.template | 143 ++--
>  1 file changed, 14 insertions(+), 129 deletions(-)
> 
> diff --git a/BaseTools/Conf/tools_def.template 
> b/BaseTools/Conf/tools_def.template
> index e0e68fd7fb49..3bc140d8f241 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -368,13 +368,13 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
>  #   Intel(r) ACPI Compiler from
>  #   https://acpica.org/downloads
>  #   GCC46   -Linux,Windows-  Requires:
> -# GCC 4.6 targeting x86_64-linux-gnu or 
> arm-linux-gnueabi
> +# GCC 4.6 targeting x86_64-linux-gnu
>  #Optional:
>  # Required to build platforms or ACPI tables:
>  #   Intel(r) ACPI Compiler from
>  #   https://acpica.org/downloads
>  #   GCC47   -Linux,Windows-  Requires:
> -# GCC 4.7 targeting x86_64-linux-gnu, 
> aarch64-linux-gnu, or arm-linux-gnueabi
> +# GCC 4.7 targeting x86_64-linux-gnu
>  #Optional:
>  # Required to build platforms or ACPI tables:
>  #   Intel(r) ACPI Compiler from
> @@ -4199,12 +4199,6 @@ DEFINE GCC46_IA32_DLINK2_FLAGS   = 
> DEF(GCC45_IA32_DLINK2_FLAGS)
>  DEFINE GCC46_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS)
>  DEFINE GCC46_X64_DLINK2_FLAGS= DEF(GCC45_X64_DLINK2_FLAGS)
>  DEFINE GCC46_ASM_FLAGS   = DEF(GCC45_ASM_FLAGS)
> -DEFINE GCC46_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
> DEF(GCC_ASM_FLAGS) -mlittle-endian
> -DEFINE GCC46_ARM_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations
> -DEFINE GCC46_ARM_CC_XIPFLAGS = -D__ARM_FEATURE_UNALIGNED=0
> -DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) 
> -Wl,--oformat=elf32-littlearm
> -DEFINE GCC46_ARM_DLINK2_FLAGS= DEF(GCC_DLINK2_FLAGS_COMMON) 
> -Wl,--defsym=PECOFF_HEADER_SIZE=0x220
> -DEFINE GCC46_ARM_ASLDLINK_FLAGS  = DEF(GCC_ARM_ASLDLINK_FLAGS) 
> -Wl,--oformat=elf32-littlearm
>  
>  DEFINE GCC47_IA32_CC_FLAGS   = DEF(GCC46_IA32_CC_FLAGS)
>  DEFINE GCC47_X64_CC_FLAGS= DEF(GCC46_X64_CC_FLAGS)
> @@ -4215,18 +4209,6 @@ DEFINE GCC47_IA32_DLINK2_FLAGS   = 
> DEF(GCC46_IA32_DLINK2_FLAGS)
>  DEFINE GCC47_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS)
>  DEFINE GCC47_X64_DLINK2_FLAGS= DEF(GCC46_X64_DLINK2_FLAGS)
>  DEFINE GCC47_ASM_FLAGS   = DEF(GCC46_ASM_FLAGS)
> -DEFINE GCC47_ARM_ASM_FLAGS   = DEF(GCC46_ARM_ASM_FLAGS)
> -DEFINE GCC47_AARCH64_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
> DEF(GCC_ASM_FLAGS) -mlittle-endian
> -DEFINE GCC47_ARM_CC_FLAGS= DEF(GCC46_ARM_CC_FLAGS)
> -DEFINE GCC47_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS)
> -DEFINE GCC47_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS)
> -DEFINE GCC47_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
> -DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
> -DEFINE GCC47_ARM_DLINK2_FLAGS= DEF(GCC46_ARM_DLINK2_FLAGS)
> -DEFINE GCC47_AARCH64_DLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS)
> -DEFINE GCC47_AARCH64_DLINK2_FLAGS= DEF(GCC_DLINK2_FLAGS_COMMON) 
> -Wl,--defsym=PECOFF_HEADER_SIZE=0x228
> -DEFINE GCC47_ARM_ASLDLINK_FLAGS  = DEF(GCC46_ARM_ASLDLINK_FLAGS)
> -DEFINE GCC47_AARCH64_ASLDLINK_FLAGS  = DEF(GCC_AARCH64_ASLDLINK_FLAGS)
>  
>  DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC47_IA32_CC_FLAGS)
>  DEFINE GCC48_X64_CC_FLAGS= DEF(GCC47_X64_CC_FLAGS)
> @@ -4237,18 +4219,18 @@ DEFINE GCC48_IA32_DLINK2_FLAGS   = 
> DEF(GCC47_IA32_DLINK2_FLAGS)
>  DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC47_X64_DLINK_FLAGS)
>  DEFINE GCC48_X64_DLINK2_FLAGS= DEF(GCC47_X64_DLINK2_FLAGS)
>  DEFINE GCC48_ASM_FLAGS   = DEF(GCC47_ASM_FLAGS)
> -DEFINE GCC48_ARM_ASM_FLAGS   = DEF(GCC47_ARM_ASM_FLAGS)
> -DEFINE GCC48_AARCH64_ASM_FLAGS   = DEF(GCC47_AARCH64_ASM_FLAGS)
> -DEFINE GCC48_ARM_CC_FLAGS= DEF(GCC47_ARM_CC_FLAGS)
> -DEFINE GCC48_ARM

Re: [edk2] [PATCH] MdeModulePkg/FileExplorerLib: avoid packed struct for program data

2018-12-10 Thread Leif Lindholm
On Mon, Dec 10, 2018 at 02:39:01PM +, Gao, Liming wrote:
> Ard:
>   I agree this change.
> 
> Leif:
>   On the duplicated definition of HII_VENDOR_DEVICE_PATH,
>   MdeModulePkg DriverSampleDxe first defines it and use it as the
>   driver level definition. Other UEFI HII driver may refer to the
>   driver sample driver and define the same structure. One
>   centralized header file can be defined for the default HII vendor
>   device path. If the driver wants to use the different one, it can
>   define its own structure.

Exactly. You're correct, my comment was imprecise. But the fact that
29 locations use the same default HII vendor device patch definition
suggests that there would be value in having a centralised default to
refer to.

I raised https://bugzilla.tianocore.org/show_bug.cgi?id=1388

Actually, I found there are 3 more in edk2-platforms :)

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

Regards,

Leif

> 
> Thanks
> Liming
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Leif 
> > Lindholm
> > Sent: Monday, December 10, 2018 8:26 PM
> > To: Ard Biesheuvel 
> > Cc: Wu, Hao A ; Ni, Ruiyu ; 
> > edk2-devel@lists.01.org
> > Subject: Re: [edk2] [PATCH] MdeModulePkg/FileExplorerLib: avoid packed 
> > struct for program data
> > 
> > On Sat, Dec 08, 2018 at 11:24:31AM +0100, Ard Biesheuvel wrote:
> > > Struct packing is only necessary for data structures whose in-memory
> > > representation is covered by the PI or UEFI specs, and may deviate
> > > from the ordinary C rules for alignment.
> > >
> > > So in case of FileExplorerLib, this applies to the device path struct
> > > only, and other structures used to carry program data should not be
> > > packed, or we may end up with alignment faults on architectures such
> > > as ARM, which don't permit load/store double or multiple instructions
> > > to access memory locations that are not 32-bit aligned.
> > >
> > > E.g., the following call in FileExplorerLibConstructor()
> > >
> > >   InitializeListHead (&gFileExplorerPrivate.FsOptionMenu->Head);
> > >
> > > which is emitted as follows for 32-bit ARM/Thumb2 by Clang-5.0
> > >
> > > 3de0:   b510push{r4, lr}
> > > 3de2:   4604mov r4, r0
> > > ...
> > > 3de8:   e9c4 4400   strdr4, r4, [r4]
> > > 3dec:   bd10pop {r4, pc}
> > >
> > > will perform a double-word store on the first argument, passed in
> > > register r0, assuming that the pointer type of the argument is
> > > enough to guarantee that the value is suitably aligned.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Ard Biesheuvel 
> > 
> > I agree with the architectural rationale.
> > 
> > However, I also decided to have a look.
> > 
> > $ git grep "} HII_VENDOR_DEVICE_PATH;"
> > EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h:}
> >  HII_VENDOR_DEVICE_PATH;
> > EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrLibrary.h:}
> >  HII_VENDOR_DEVICE_PATH;
> > EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c:} 
> > HII_VENDOR_DEVICE_PATH;
> > EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c:} HII_VENDOR_DEVICE_PATH;
> > IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.h:} 
> > HII_VENDOR_DEVICE_PATH;
> > IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h:} HII_VENDOR_DEVICE_PATH;
> > MdeModulePkg/Application/UiApp/Ui.h:} HII_VENDOR_DEVICE_PATH;
> > MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h:} 
> > HII_VENDOR_DEVICE_PATH;
> > MdeModulePkg/Library/BootManagerUiLib/BootManager.h:} 
> > HII_VENDOR_DEVICE_PATH;
> > MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.h:} 
> > HII_VENDOR_DEVICE_PATH;
> > MdeModulePkg/Library/FileExplorerLib/FileExplorer.h:} 
> > HII_VENDOR_DEVICE_PATH;
> > MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanup.h:} 
> > HII_VENDOR_DEVICE_PATH;
> > MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h:} 
> > HII_VENDOR_DEVICE_PATH;
> > MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h:} 
> > HII_VENDOR_DEVICE_PATH;
> > MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSample.c:} 
> > HII_VENDOR_DEVICE_PATH;
> > MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.h:} 
> > HII_VENDOR_DEVICE_PATH;
> > MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c:} 
> > HII_VENDOR_DEVICE_PATH;
> > NetworkPkg/IScsiDxe/IScsiConfig.h:} HII_VENDOR_DEVICE_PATH;
> > NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.h:} HII_VENDOR_DEVICE_PATH;
> > QuarkPlatformPkg/Platform/Dxe/Setup/SetupPlatform.h:} 
> > HII_VENDOR_DEVICE_PATH;
> > SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h:} HII_VENDOR_DEVICE_PATH;
> > SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.h:} HII_VENDOR_DEVICE_PATH;
> > SecurityPkg/Tcg/TcgConfigDxe/TcgConfigImpl.h:} HII_VENDOR_DEVICE_PATH;
> > SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProvider.h:}

Re: [edk2] [Patch V2] BaseTools: Fixed the build fail issue for cases

2018-12-10 Thread Gao, Liming
Leif:
  OK. I understand your point. 

Thanks
Liming
> -Original Message-
> From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> Sent: Monday, December 10, 2018 10:45 PM
> To: Gao, Liming 
> Cc: Feng, Bob C ; edk2-devel@lists.01.org
> Subject: Re: [edk2] [Patch V2] BaseTools: Fixed the build fail issue for cases
> 
> On Mon, Dec 10, 2018 at 02:36:59PM +, Gao, Liming wrote:
> > Leif:
> >   So, you don't think to need highlight which commit causes the
> >   regression issue in the commit message. I suggest to put this
> >   information into BZ description instead of commit message.
> 
> Oh, I absolutely want the commit hash in the message.
> And ideally in a longer form, like Linux requires:
> 12-characters of hash followed by the subject of the faulty commit
> inside (""). But the format is just a question of taste, the
> information is what is important.
> 
> If I happen to lose internet connection, I still want to be able to
> see which previous commit is being fixed by a patch.
> 
> But it shouldn't come in the form:
> V2:
> ...
> V1:
> ...
> 
> It should just form part of a coherent commit message.
> The development history of a patch is not interesting to the master
> branch of the repository.
> 
> Regards,
> 
> Leif
> 
> 
> > Thanks
> > Liming
> > > -Original Message-
> > > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> > > Leif Lindholm
> > > Sent: Monday, December 10, 2018 8:30 PM
> > > To: Feng, Bob C 
> > > Cc: edk2-devel@lists.01.org; Gao, Liming 
> > > Subject: Re: [edk2] [Patch V2] BaseTools: Fixed the build fail issue for 
> > > cases
> > >
> > > Hi Bob,
> > >
> > > On Mon, Dec 10, 2018 at 09:16:58AM +0800, BobCF wrote:
> > > > From: "Feng, Bob C" 
> > > >
> > > > V2:
> > >
> > > Patch version information does not belong in the commit message.
> > > It belongs in a cover letter, or if a cover letter is not used, you
> > > can put these details below the --- line. This way it gets filtered
> > > out by git.
> > >
> > > The patch commit message should end up being a description of what the
> > > patch is and does, not the development process that got us there.
> > >
> > > Regards,
> > >
> > > Leif
> > >
> > > > update the commit log. This issue is introduced by
> > > > the commit 72a1d77694d51914c0dd6aa97dbfa58634b0a4a5
> > > >
> > > > V1:
> > > > https://bugzilla.tianocore.org/show_bug.cgi?id=1386
> > > > 1. There is no Pcd value assignment in Dsc file
> > > > 2. There are duplicate Pcd filed assignment
> > > >
> > > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > > Signed-off-by: Bob Feng 
> > > > Cc: Liming Gao 
> > > > ---
> > > >  BaseTools/Source/Python/Workspace/BuildClassObject.py | 2 +-
> > > >  BaseTools/Source/Python/Workspace/MetaFileParser.py   | 2 +-
> > > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
> > > > b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> > > > index 008eee1a16..d02232b546 100644
> > > > --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> > > > +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> > > > @@ -289,11 +289,11 @@ class StructurePcd(PcdClassObject):
> > > >  if DefaultStoreName not in self.SkuOverrideValues[SkuName]:
> > > >  self.SkuOverrideValues[SkuName][DefaultStoreName] = 
> > > > OrderedDict()
> > > >  if DimensionAttr not in 
> > > > self.SkuOverrideValues[SkuName][DefaultStoreName]:
> > > >  
> > > > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr] = 
> > > > collections.OrderedDict()
> > > >  if FieldName in 
> > > > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr]:
> > > > -del 
> > > > self.SkuOverrideValues[SkuName][DefaultStoreName][FieldName][DimensionAttr]
> > > > +del 
> > > > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName]
> > > >  
> > > > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName]
> > > >  = [Value.strip(), FileName, LineNo]
> > > >  return 
> > > > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName]
> > > >
> > > >  def SetPcdMode (self, PcdMode):
> > > >  self.PcdMode = PcdMode
> > > > diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py 
> > > > b/BaseTools/Source/Python/Workspace/MetaFileParser.py
> > > > index 4bd52619a9..eaedba0c12 100644
> > > > --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
> > > > +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
> > > > @@ -1201,11 +1201,11 @@ class DscParser(MetaFileParser):
> > > >  else:
> > > >  self._ValueList = None
> > > >  return
> > > >  TokenList = GetSplitValueList(self._CurrentLine, 
> > > > TAB_VALUE_SPLIT, 1)
> > > >  self._CurrentPcdName = TokenList[0]
> > > > -if TokenList[1].strip().s

Re: [edk2] [RFC PATCH 3/7] MdeModulePkg/Dxe/Page: take MAX_ALLOC_ADDRESS into account

2018-12-10 Thread Ard Biesheuvel
On Mon, 10 Dec 2018 at 15:52, Gao, Liming  wrote:
>
> Ard:
>   I prefer to define MAX_ALLOC_ADDRESS together with MAX_ADDRESS in 
> ProcessorBind.h. I don't want to leave the choice to override 
> MAX_ALLOC_ADDRESS definition.
>

Seems reasonable. What should be the value for X64?

> Thanks
> Liming
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ard 
> > Biesheuvel
> > Sent: Monday, December 10, 2018 3:23 PM
> > To: Wang, Jian J 
> > Cc: Andrew Jones ; Wu, Hao A ; 
> > edk2-devel@lists.01.org; Gao, Liming
> > ; Kinney, Michael D ; 
> > Laszlo Ersek 
> > Subject: Re: [edk2] [RFC PATCH 3/7] MdeModulePkg/Dxe/Page: take 
> > MAX_ALLOC_ADDRESS into account
> >
> > On Mon, 10 Dec 2018 at 03:04, Wang, Jian J  wrote:
> > >
> > > Hi Ard,
> > >
> > > I think MAX_ALLOC_ADDRESS will affect other archs besides ARM. Please do 
> > > enough
> > > test for them (IA32/X64 for my concern).
> > >
> >
> > For all other architectures, MAX_ADDRESS == MAX_ALLOC_ADDRESS is
> > always true, so these changes only affect AARCH64.
> >
> > > In addition, do you think it's safer to replace MAX_ADDRESS with 
> > > MAX_ALLOC_ADDRESS
> > > in MemoryAllocationLib like following situation?
> > >
> > > (MdeModulePkg\Library\DxeCoreMemoryAllocationLib\MemoryAllocationLib.c)
> > > VOID *
> > > InternalAllocateCopyPool (
> > >   IN EFI_MEMORY_TYPE  PoolType,
> > >   IN UINTNAllocationSize,
> > >   IN CONST VOID   *Buffer
> > >   )
> > > {
> > >   VOID  *Memory;
> > >
> > >   ASSERT (Buffer != NULL);
> > >   ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
> > >   ...
> >
> > This assert ensures that the copied buffer does not extend across the
> > end of the address space and wraps. This is a separate concern, and is
> > similar to numerous other occurrences of MAX_ADDRESS that maybe we
> > should update as well at some point. However, it does not affect page
> > allocation at all, it only puts an upper bound on the *size* of the
> > allocation. So the changes as they are will be sufficient to ensure
> > that AllocateCopyPool() does not allocate from a region that is not
> > addressable by the CPU.
> > ___
> > 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] [RFC PATCH 3/7] MdeModulePkg/Dxe/Page: take MAX_ALLOC_ADDRESS into account

2018-12-10 Thread Gao, Liming
Keep the same value of MAX_ADDRESS. There is no change now. 

Thanks
Liming
> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Monday, December 10, 2018 10:54 PM
> To: Gao, Liming 
> Cc: Wang, Jian J ; Andrew Jones ; 
> Wu, Hao A ;
> edk2-devel@lists.01.org; Kinney, Michael D ; 
> Laszlo Ersek 
> Subject: Re: [edk2] [RFC PATCH 3/7] MdeModulePkg/Dxe/Page: take 
> MAX_ALLOC_ADDRESS into account
> 
> On Mon, 10 Dec 2018 at 15:52, Gao, Liming  wrote:
> >
> > Ard:
> >   I prefer to define MAX_ALLOC_ADDRESS together with MAX_ADDRESS in 
> > ProcessorBind.h. I don't want to leave the choice to
> override MAX_ALLOC_ADDRESS definition.
> >
> 
> Seems reasonable. What should be the value for X64?
> 
> > Thanks
> > Liming
> > > -Original Message-
> > > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> > > Ard Biesheuvel
> > > Sent: Monday, December 10, 2018 3:23 PM
> > > To: Wang, Jian J 
> > > Cc: Andrew Jones ; Wu, Hao A ; 
> > > edk2-devel@lists.01.org; Gao, Liming
> > > ; Kinney, Michael D ; 
> > > Laszlo Ersek 
> > > Subject: Re: [edk2] [RFC PATCH 3/7] MdeModulePkg/Dxe/Page: take 
> > > MAX_ALLOC_ADDRESS into account
> > >
> > > On Mon, 10 Dec 2018 at 03:04, Wang, Jian J  wrote:
> > > >
> > > > Hi Ard,
> > > >
> > > > I think MAX_ALLOC_ADDRESS will affect other archs besides ARM. Please 
> > > > do enough
> > > > test for them (IA32/X64 for my concern).
> > > >
> > >
> > > For all other architectures, MAX_ADDRESS == MAX_ALLOC_ADDRESS is
> > > always true, so these changes only affect AARCH64.
> > >
> > > > In addition, do you think it's safer to replace MAX_ADDRESS with 
> > > > MAX_ALLOC_ADDRESS
> > > > in MemoryAllocationLib like following situation?
> > > >
> > > > (MdeModulePkg\Library\DxeCoreMemoryAllocationLib\MemoryAllocationLib.c)
> > > > VOID *
> > > > InternalAllocateCopyPool (
> > > >   IN EFI_MEMORY_TYPE  PoolType,
> > > >   IN UINTNAllocationSize,
> > > >   IN CONST VOID   *Buffer
> > > >   )
> > > > {
> > > >   VOID  *Memory;
> > > >
> > > >   ASSERT (Buffer != NULL);
> > > >   ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
> > > >   ...
> > >
> > > This assert ensures that the copied buffer does not extend across the
> > > end of the address space and wraps. This is a separate concern, and is
> > > similar to numerous other occurrences of MAX_ADDRESS that maybe we
> > > should update as well at some point. However, it does not affect page
> > > allocation at all, it only puts an upper bound on the *size* of the
> > > allocation. So the changes as they are will be sufficient to ensure
> > > that AllocateCopyPool() does not allocate from a region that is not
> > > addressable by the CPU.
> > > ___
> > > 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 v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg.

2018-12-10 Thread Laszlo Ersek
Hi Ard,

On 12/10/18 09:36, Ard Biesheuvel wrote:

> Could anyone remind me why we have OpensslLib and OpensslLibCrypto?
> Since these are static libraries, only the referenced objects should
> be included in the final module anyway, so OpensslLibCrypto seems
> redundant to me.

please see commit 823005621ef4 ("CryptoPkg/OpensslLib: introduce
OpensslLibCrypto instance", 2017-02-25).

>> Namely, please *prepend* a patch to the series that simply deletes the
>> "[Components.IA32, Components.X64]" line, bringing all these drivers to
>> ARM/AARCH64, in the NetworkPkg.dsc build. Once we validate the new patch
>> separately (simply by test-building it), then the current patch can
>> simply replace the component list with the !include directive -- and
>> such a replacement won't incur arch-specific changes.
>>
> 
> Ack

Liming and I strongly disagreed on this point, and I yielded. Please see
the sub-thread that ended with the following comment:

e790855d-2cd9-1820-7187-0ec1dc52dabc@redhat.com">http://mid.mail-archive.com/e790855d-2cd9-1820-7187-0ec1dc52dabc@redhat.com

(Alternative link:
.)

[...]

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


Re: [edk2] [PATCH] MdeModulePkg/FileExplorerLib: avoid packed struct for program data

2018-12-10 Thread Gao, Liming
Ard:
  I agree this change.

Leif:
  On the duplicated definition of HII_VENDOR_DEVICE_PATH, MdeModulePkg 
DriverSampleDxe first defines it and use it as the driver level definition. 
Other UEFI HII driver may refer to the driver sample driver and define the same 
structure. One centralized header file can be defined for the default HII 
vendor device path. If the driver wants to use the different one, it can define 
its own structure. 

Thanks
Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Leif 
> Lindholm
> Sent: Monday, December 10, 2018 8:26 PM
> To: Ard Biesheuvel 
> Cc: Wu, Hao A ; Ni, Ruiyu ; 
> edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH] MdeModulePkg/FileExplorerLib: avoid packed struct 
> for program data
> 
> On Sat, Dec 08, 2018 at 11:24:31AM +0100, Ard Biesheuvel wrote:
> > Struct packing is only necessary for data structures whose in-memory
> > representation is covered by the PI or UEFI specs, and may deviate
> > from the ordinary C rules for alignment.
> >
> > So in case of FileExplorerLib, this applies to the device path struct
> > only, and other structures used to carry program data should not be
> > packed, or we may end up with alignment faults on architectures such
> > as ARM, which don't permit load/store double or multiple instructions
> > to access memory locations that are not 32-bit aligned.
> >
> > E.g., the following call in FileExplorerLibConstructor()
> >
> >   InitializeListHead (&gFileExplorerPrivate.FsOptionMenu->Head);
> >
> > which is emitted as follows for 32-bit ARM/Thumb2 by Clang-5.0
> >
> > 3de0:   b510push{r4, lr}
> > 3de2:   4604mov r4, r0
> > ...
> > 3de8:   e9c4 4400   strdr4, r4, [r4]
> > 3dec:   bd10pop {r4, pc}
> >
> > will perform a double-word store on the first argument, passed in
> > register r0, assuming that the pointer type of the argument is
> > enough to guarantee that the value is suitably aligned.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel 
> 
> I agree with the architectural rationale.
> 
> However, I also decided to have a look.
> 
> $ git grep "} HII_VENDOR_DEVICE_PATH;"
> EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h:} 
> HII_VENDOR_DEVICE_PATH;
> EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrLibrary.h:}
>  HII_VENDOR_DEVICE_PATH;
> EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c:} HII_VENDOR_DEVICE_PATH;
> EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c:} HII_VENDOR_DEVICE_PATH;
> IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.h:} 
> HII_VENDOR_DEVICE_PATH;
> IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h:} HII_VENDOR_DEVICE_PATH;
> MdeModulePkg/Application/UiApp/Ui.h:} HII_VENDOR_DEVICE_PATH;
> MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h:} 
> HII_VENDOR_DEVICE_PATH;
> MdeModulePkg/Library/BootManagerUiLib/BootManager.h:} HII_VENDOR_DEVICE_PATH;
> MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.h:} 
> HII_VENDOR_DEVICE_PATH;
> MdeModulePkg/Library/FileExplorerLib/FileExplorer.h:} HII_VENDOR_DEVICE_PATH;
> MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanup.h:} 
> HII_VENDOR_DEVICE_PATH;
> MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h:} HII_VENDOR_DEVICE_PATH;
> MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h:} 
> HII_VENDOR_DEVICE_PATH;
> MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSample.c:} 
> HII_VENDOR_DEVICE_PATH;
> MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.h:} 
> HII_VENDOR_DEVICE_PATH;
> MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c:} 
> HII_VENDOR_DEVICE_PATH;
> NetworkPkg/IScsiDxe/IScsiConfig.h:} HII_VENDOR_DEVICE_PATH;
> NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.h:} HII_VENDOR_DEVICE_PATH;
> QuarkPlatformPkg/Platform/Dxe/Setup/SetupPlatform.h:} HII_VENDOR_DEVICE_PATH;
> SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h:} HII_VENDOR_DEVICE_PATH;
> SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.h:} HII_VENDOR_DEVICE_PATH;
> SecurityPkg/Tcg/TcgConfigDxe/TcgConfigImpl.h:} HII_VENDOR_DEVICE_PATH;
> SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProvider.h:}
>  HII_VENDOR_DEVICE_PATH;
> SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManager.h:} 
> HII_VENDOR_DEVICE_PATH;
> SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.h:} 
> HII_VENDOR_DEVICE_PATH;
> SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h:}
>  HII_VENDOR_DEVICE_PATH;
> Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.h:} 
> HII_VENDOR_DEVICE_PATH;
> Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.c:} 
> HII_VENDOR_DEVICE_PATH;
> 
> Now, I will confess to being lazy and not manually checking all of
> them, but 100% of the ones I did check were identical (except in
> packedness).
> 
> Does this

Re: [edk2] [RFC PATCH 3/7] MdeModulePkg/Dxe/Page: take MAX_ALLOC_ADDRESS into account

2018-12-10 Thread Gao, Liming
Ard:
  I prefer to define MAX_ALLOC_ADDRESS together with MAX_ADDRESS in 
ProcessorBind.h. I don't want to leave the choice to override MAX_ALLOC_ADDRESS 
definition. 

Thanks
Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ard 
> Biesheuvel
> Sent: Monday, December 10, 2018 3:23 PM
> To: Wang, Jian J 
> Cc: Andrew Jones ; Wu, Hao A ; 
> edk2-devel@lists.01.org; Gao, Liming
> ; Kinney, Michael D ; 
> Laszlo Ersek 
> Subject: Re: [edk2] [RFC PATCH 3/7] MdeModulePkg/Dxe/Page: take 
> MAX_ALLOC_ADDRESS into account
> 
> On Mon, 10 Dec 2018 at 03:04, Wang, Jian J  wrote:
> >
> > Hi Ard,
> >
> > I think MAX_ALLOC_ADDRESS will affect other archs besides ARM. Please do 
> > enough
> > test for them (IA32/X64 for my concern).
> >
> 
> For all other architectures, MAX_ADDRESS == MAX_ALLOC_ADDRESS is
> always true, so these changes only affect AARCH64.
> 
> > In addition, do you think it's safer to replace MAX_ADDRESS with 
> > MAX_ALLOC_ADDRESS
> > in MemoryAllocationLib like following situation?
> >
> > (MdeModulePkg\Library\DxeCoreMemoryAllocationLib\MemoryAllocationLib.c)
> > VOID *
> > InternalAllocateCopyPool (
> >   IN EFI_MEMORY_TYPE  PoolType,
> >   IN UINTNAllocationSize,
> >   IN CONST VOID   *Buffer
> >   )
> > {
> >   VOID  *Memory;
> >
> >   ASSERT (Buffer != NULL);
> >   ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
> >   ...
> 
> This assert ensures that the copied buffer does not extend across the
> end of the address space and wraps. This is a separate concern, and is
> similar to numerous other occurrences of MAX_ADDRESS that maybe we
> should update as well at some point. However, it does not affect page
> allocation at all, it only puts an upper bound on the *size* of the
> allocation. So the changes as they are will be sufficient to ensure
> that AllocateCopyPool() does not allocate from a region that is not
> addressable by the CPU.
> ___
> 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 V2] BaseTools: Fixed the build fail issue for cases

2018-12-10 Thread Gao, Liming
Leif:
  So, you don't think to need highlight which commit causes the regression 
issue in the commit message. I suggest to put this information into BZ 
description instead of commit message. 

Thanks
Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Leif 
> Lindholm
> Sent: Monday, December 10, 2018 8:30 PM
> To: Feng, Bob C 
> Cc: edk2-devel@lists.01.org; Gao, Liming 
> Subject: Re: [edk2] [Patch V2] BaseTools: Fixed the build fail issue for cases
> 
> Hi Bob,
> 
> On Mon, Dec 10, 2018 at 09:16:58AM +0800, BobCF wrote:
> > From: "Feng, Bob C" 
> >
> > V2:
> 
> Patch version information does not belong in the commit message.
> It belongs in a cover letter, or if a cover letter is not used, you
> can put these details below the --- line. This way it gets filtered
> out by git.
> 
> The patch commit message should end up being a description of what the
> patch is and does, not the development process that got us there.
> 
> Regards,
> 
> Leif
> 
> > update the commit log. This issue is introduced by
> > the commit 72a1d77694d51914c0dd6aa97dbfa58634b0a4a5
> >
> > V1:
> > https://bugzilla.tianocore.org/show_bug.cgi?id=1386
> > 1. There is no Pcd value assignment in Dsc file
> > 2. There are duplicate Pcd filed assignment
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Bob Feng 
> > Cc: Liming Gao 
> > ---
> >  BaseTools/Source/Python/Workspace/BuildClassObject.py | 2 +-
> >  BaseTools/Source/Python/Workspace/MetaFileParser.py   | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
> > b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> > index 008eee1a16..d02232b546 100644
> > --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> > +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> > @@ -289,11 +289,11 @@ class StructurePcd(PcdClassObject):
> >  if DefaultStoreName not in self.SkuOverrideValues[SkuName]:
> >  self.SkuOverrideValues[SkuName][DefaultStoreName] = 
> > OrderedDict()
> >  if DimensionAttr not in 
> > self.SkuOverrideValues[SkuName][DefaultStoreName]:
> >  
> > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr] = 
> > collections.OrderedDict()
> >  if FieldName in 
> > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr]:
> > -del 
> > self.SkuOverrideValues[SkuName][DefaultStoreName][FieldName][DimensionAttr]
> > +del 
> > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName]
> >  
> > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName] 
> > = [Value.strip(), FileName, LineNo]
> >  return 
> > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName]
> >
> >  def SetPcdMode (self, PcdMode):
> >  self.PcdMode = PcdMode
> > diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py 
> > b/BaseTools/Source/Python/Workspace/MetaFileParser.py
> > index 4bd52619a9..eaedba0c12 100644
> > --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
> > +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
> > @@ -1201,11 +1201,11 @@ class DscParser(MetaFileParser):
> >  else:
> >  self._ValueList = None
> >  return
> >  TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 
> > 1)
> >  self._CurrentPcdName = TokenList[0]
> > -if TokenList[1].strip().startswith("{CODE"):
> > +if len(TokenList) == 2 and 
> > TokenList[1].strip().startswith("{CODE"):
> >  self._PcdDataTypeCODE = True
> >  self._PcdCodeValue = TokenList[1].strip()
> >
> >  if self._PcdDataTypeCODE:
> >  if self._CurrentLine.endswith(")}"):
> > --
> > 2.19.1.windows.1
> >
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch V2] BaseTools: Fixed the build fail issue for cases

2018-12-10 Thread Leif Lindholm
On Mon, Dec 10, 2018 at 02:36:59PM +, Gao, Liming wrote:
> Leif:
>   So, you don't think to need highlight which commit causes the
>   regression issue in the commit message. I suggest to put this
>   information into BZ description instead of commit message.

Oh, I absolutely want the commit hash in the message.
And ideally in a longer form, like Linux requires:
12-characters of hash followed by the subject of the faulty commit
inside (""). But the format is just a question of taste, the
information is what is important.

If I happen to lose internet connection, I still want to be able to
see which previous commit is being fixed by a patch.

But it shouldn't come in the form:
V2:
...
V1:
...

It should just form part of a coherent commit message.
The development history of a patch is not interesting to the master
branch of the repository.

Regards,

Leif


> Thanks
> Liming
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Leif 
> > Lindholm
> > Sent: Monday, December 10, 2018 8:30 PM
> > To: Feng, Bob C 
> > Cc: edk2-devel@lists.01.org; Gao, Liming 
> > Subject: Re: [edk2] [Patch V2] BaseTools: Fixed the build fail issue for 
> > cases
> > 
> > Hi Bob,
> > 
> > On Mon, Dec 10, 2018 at 09:16:58AM +0800, BobCF wrote:
> > > From: "Feng, Bob C" 
> > >
> > > V2:
> > 
> > Patch version information does not belong in the commit message.
> > It belongs in a cover letter, or if a cover letter is not used, you
> > can put these details below the --- line. This way it gets filtered
> > out by git.
> > 
> > The patch commit message should end up being a description of what the
> > patch is and does, not the development process that got us there.
> > 
> > Regards,
> > 
> > Leif
> > 
> > > update the commit log. This issue is introduced by
> > > the commit 72a1d77694d51914c0dd6aa97dbfa58634b0a4a5
> > >
> > > V1:
> > > https://bugzilla.tianocore.org/show_bug.cgi?id=1386
> > > 1. There is no Pcd value assignment in Dsc file
> > > 2. There are duplicate Pcd filed assignment
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Bob Feng 
> > > Cc: Liming Gao 
> > > ---
> > >  BaseTools/Source/Python/Workspace/BuildClassObject.py | 2 +-
> > >  BaseTools/Source/Python/Workspace/MetaFileParser.py   | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
> > > b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> > > index 008eee1a16..d02232b546 100644
> > > --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> > > +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> > > @@ -289,11 +289,11 @@ class StructurePcd(PcdClassObject):
> > >  if DefaultStoreName not in self.SkuOverrideValues[SkuName]:
> > >  self.SkuOverrideValues[SkuName][DefaultStoreName] = 
> > > OrderedDict()
> > >  if DimensionAttr not in 
> > > self.SkuOverrideValues[SkuName][DefaultStoreName]:
> > >  
> > > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr] = 
> > > collections.OrderedDict()
> > >  if FieldName in 
> > > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr]:
> > > -del 
> > > self.SkuOverrideValues[SkuName][DefaultStoreName][FieldName][DimensionAttr]
> > > +del 
> > > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName]
> > >  
> > > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName]
> > >  = [Value.strip(), FileName, LineNo]
> > >  return 
> > > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName]
> > >
> > >  def SetPcdMode (self, PcdMode):
> > >  self.PcdMode = PcdMode
> > > diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py 
> > > b/BaseTools/Source/Python/Workspace/MetaFileParser.py
> > > index 4bd52619a9..eaedba0c12 100644
> > > --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
> > > +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
> > > @@ -1201,11 +1201,11 @@ class DscParser(MetaFileParser):
> > >  else:
> > >  self._ValueList = None
> > >  return
> > >  TokenList = GetSplitValueList(self._CurrentLine, 
> > > TAB_VALUE_SPLIT, 1)
> > >  self._CurrentPcdName = TokenList[0]
> > > -if TokenList[1].strip().startswith("{CODE"):
> > > +if len(TokenList) == 2 and 
> > > TokenList[1].strip().startswith("{CODE"):
> > >  self._PcdDataTypeCODE = True
> > >  self._PcdCodeValue = TokenList[1].strip()
> > >
> > >  if self._PcdDataTypeCODE:
> > >  if self._CurrentLine.endswith(")}"):
> > > --
> > > 2.19.1.windows.1
> > >
> > > ___
> > > edk2-devel mailing list
> > > edk2-devel@lists.01.org
> > > https://lists.01.org/mailman/listinfo/edk2-devel
> > _

[edk2] [PATCH] BaseTools/tools_def AARCH64: move GCC49/GGC5 to 4 KB section alignment

2018-12-10 Thread Ard Biesheuvel
Since 4 KB section alignment is required when mapping PE/COFF images
with strict permissions, update the default section alignment when
using GCC49 and GCC5 in RELEASE mode. Note that XIP modules such as
SEC, PEIMs or PEI core are not affected by this change, since the
override to 32 byte aligment remains in effect.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 24 +++-
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index e0e68fd7fb49..5d34333dc54f 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4263,11 +4263,11 @@ DEFINE GCC49_ARM_ASM_FLAGS   = 
DEF(GCC48_ARM_ASM_FLAGS)
 DEFINE GCC49_AARCH64_ASM_FLAGS   = DEF(GCC48_AARCH64_ASM_FLAGS)
 DEFINE GCC49_ARM_CC_FLAGS= DEF(GCC48_ARM_CC_FLAGS)
 DEFINE GCC49_ARM_CC_XIPFLAGS = DEF(GCC48_ARM_CC_XIPFLAGS)
-DEFINE GCC49_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS)
+DEFINE GCC49_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -mcmodel=small
 DEFINE GCC49_AARCH64_CC_XIPFLAGS = DEF(GCC48_AARCH64_CC_XIPFLAGS)
 DEFINE GCC49_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS)
 DEFINE GCC49_ARM_DLINK2_FLAGS= DEF(GCC48_ARM_DLINK2_FLAGS)
-DEFINE GCC49_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS)
+DEFINE GCC49_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS) -z 
common-page-size=0x1000
 DEFINE GCC49_AARCH64_DLINK2_FLAGS= DEF(GCC48_AARCH64_DLINK2_FLAGS)
 DEFINE GCC49_ARM_ASLDLINK_FLAGS  = DEF(GCC48_ARM_ASLDLINK_FLAGS)
 DEFINE GCC49_AARCH64_ASLDLINK_FLAGS  = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
@@ -5034,15 +5034,16 @@ RELEASE_GCC49_ARM_CC_FLAGS   = 
DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-v
 *_GCC49_AARCH64_VFRPP_FLAGS  = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_VFRPP_FLAGS)
 *_GCC49_AARCH64_CC_XIPFLAGS  = DEF(GCC49_AARCH64_CC_XIPFLAGS)
 
-  DEBUG_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0 
-mcmodel=small
-  DEBUG_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -z 
common-page-size=0x1000
+  DEBUG_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0
+  DEBUG_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS)
   DEBUG_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
 
-RELEASE_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) 
-Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny
+RELEASE_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) 
-Wno-unused-but-set-variable -Wno-unused-const-variable
 RELEASE_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS)
+RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
 
-  NOOPT_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0 
-mcmodel=small
-  NOOPT_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -z 
common-page-size=0x1000 -O0
+  NOOPT_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0
+  NOOPT_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -O0
   NOOPT_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 -O0
 
 

@@ -5189,14 +5190,15 @@ RELEASE_GCC5_ARM_DLINK_FLAGS = 
DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKS
 *_GCC5_AARCH64_VFRPP_FLAGS   = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_VFRPP_FLAGS)
 *_GCC5_AARCH64_CC_XIPFLAGS   = DEF(GCC5_AARCH64_CC_XIPFLAGS)
 
-  DEBUG_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
-Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=small
-  DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -z 
common-page-size=0x1000 -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto 
-llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 
-Wno-lto-type-mismatch -mcmodel=small
+  DEBUG_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
-Wno-unused-but-set-variable -Wno-unused-const-variable
+  DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os 
-L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 
-Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch
   DEBUG_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
 
-RELEASE_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
-Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny
+RELEASE_GCC5_AARCH64_CC_FLAGS= DEF(GCC5_AARCH64_CC_FLAGS) -flto 
-Wno-unused-but-set-variable -Wno-unused-const-variable
 RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os 
-L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 
-Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch
+RELEASE_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
 
-  NOOPT_GCC5_AARCH64_CC

Re: [edk2] [PATCH] BaseTools/Conf/tools_def.template: drop ARM/AARCH support from GCC46/GCC47

2018-12-10 Thread Leif Lindholm
On Sat, Dec 08, 2018 at 10:32:42AM +0100, Ard Biesheuvel wrote:
> This drops ARM and AARCH64 support from the GCC46 and GCC47 toolchain
> definitions, which are on the list to be removed, along with VS2003,
> VS2005, VS2008, VS2010, DDK3790, UNIXGCC, GCC44, GCC45, ELFGCC, CYGGCC,
> ICC, ICC11 and MYTOOLS.
> 
> Since GCC46 and GCC47 are the only ones on that list that support ARM
> and/or AARCH64, let's give Liming a hand and cover the ARM side of
> things first, so that everything that remains to be removed is x86
> only.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 

I think I would personally prefer to see this folded into the "drop
unused GCCnn profiles", but I'll leave that to the discretion of the
BaseTools maintainers.

GCC47_AARCH64* was always a bit cringeworthy, so glad to see it go :)

>From an ARM perspective:
Reviewed-by: Leif Lindholm 

> ---
>  BaseTools/Conf/tools_def.template | 143 ++--
>  1 file changed, 14 insertions(+), 129 deletions(-)
> 
> diff --git a/BaseTools/Conf/tools_def.template 
> b/BaseTools/Conf/tools_def.template
> index e0e68fd7fb49..3bc140d8f241 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -368,13 +368,13 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
>  #   Intel(r) ACPI Compiler from
>  #   https://acpica.org/downloads
>  #   GCC46   -Linux,Windows-  Requires:
> -# GCC 4.6 targeting x86_64-linux-gnu or 
> arm-linux-gnueabi
> +# GCC 4.6 targeting x86_64-linux-gnu
>  #Optional:
>  # Required to build platforms or ACPI tables:
>  #   Intel(r) ACPI Compiler from
>  #   https://acpica.org/downloads
>  #   GCC47   -Linux,Windows-  Requires:
> -# GCC 4.7 targeting x86_64-linux-gnu, 
> aarch64-linux-gnu, or arm-linux-gnueabi
> +# GCC 4.7 targeting x86_64-linux-gnu
>  #Optional:
>  # Required to build platforms or ACPI tables:
>  #   Intel(r) ACPI Compiler from
> @@ -4199,12 +4199,6 @@ DEFINE GCC46_IA32_DLINK2_FLAGS   = 
> DEF(GCC45_IA32_DLINK2_FLAGS)
>  DEFINE GCC46_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS)
>  DEFINE GCC46_X64_DLINK2_FLAGS= DEF(GCC45_X64_DLINK2_FLAGS)
>  DEFINE GCC46_ASM_FLAGS   = DEF(GCC45_ASM_FLAGS)
> -DEFINE GCC46_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
> DEF(GCC_ASM_FLAGS) -mlittle-endian
> -DEFINE GCC46_ARM_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations
> -DEFINE GCC46_ARM_CC_XIPFLAGS = -D__ARM_FEATURE_UNALIGNED=0
> -DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) 
> -Wl,--oformat=elf32-littlearm
> -DEFINE GCC46_ARM_DLINK2_FLAGS= DEF(GCC_DLINK2_FLAGS_COMMON) 
> -Wl,--defsym=PECOFF_HEADER_SIZE=0x220
> -DEFINE GCC46_ARM_ASLDLINK_FLAGS  = DEF(GCC_ARM_ASLDLINK_FLAGS) 
> -Wl,--oformat=elf32-littlearm
>  
>  DEFINE GCC47_IA32_CC_FLAGS   = DEF(GCC46_IA32_CC_FLAGS)
>  DEFINE GCC47_X64_CC_FLAGS= DEF(GCC46_X64_CC_FLAGS)
> @@ -4215,18 +4209,6 @@ DEFINE GCC47_IA32_DLINK2_FLAGS   = 
> DEF(GCC46_IA32_DLINK2_FLAGS)
>  DEFINE GCC47_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS)
>  DEFINE GCC47_X64_DLINK2_FLAGS= DEF(GCC46_X64_DLINK2_FLAGS)
>  DEFINE GCC47_ASM_FLAGS   = DEF(GCC46_ASM_FLAGS)
> -DEFINE GCC47_ARM_ASM_FLAGS   = DEF(GCC46_ARM_ASM_FLAGS)
> -DEFINE GCC47_AARCH64_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
> DEF(GCC_ASM_FLAGS) -mlittle-endian
> -DEFINE GCC47_ARM_CC_FLAGS= DEF(GCC46_ARM_CC_FLAGS)
> -DEFINE GCC47_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS)
> -DEFINE GCC47_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS)
> -DEFINE GCC47_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
> -DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
> -DEFINE GCC47_ARM_DLINK2_FLAGS= DEF(GCC46_ARM_DLINK2_FLAGS)
> -DEFINE GCC47_AARCH64_DLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS)
> -DEFINE GCC47_AARCH64_DLINK2_FLAGS= DEF(GCC_DLINK2_FLAGS_COMMON) 
> -Wl,--defsym=PECOFF_HEADER_SIZE=0x228
> -DEFINE GCC47_ARM_ASLDLINK_FLAGS  = DEF(GCC46_ARM_ASLDLINK_FLAGS)
> -DEFINE GCC47_AARCH64_ASLDLINK_FLAGS  = DEF(GCC_AARCH64_ASLDLINK_FLAGS)
>  
>  DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC47_IA32_CC_FLAGS)
>  DEFINE GCC48_X64_CC_FLAGS= DEF(GCC47_X64_CC_FLAGS)
> @@ -4237,18 +4219,18 @@ DEFINE GCC48_IA32_DLINK2_FLAGS   = 
> DEF(GCC47_IA32_DLINK2_FLAGS)
>  DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC47_X64_DLINK_FLAGS)
>  DEFINE GCC48_X64_DLINK2_FLAGS= DEF

Re: [edk2] [PATCH] BaseTools/Conf/tools_def.template: drop ARM/AARCH support from GCC46/GCC47

2018-12-10 Thread Ard Biesheuvel
On Mon, 10 Dec 2018 at 13:50, Leif Lindholm  wrote:
>
> On Sat, Dec 08, 2018 at 10:32:42AM +0100, Ard Biesheuvel wrote:
> > This drops ARM and AARCH64 support from the GCC46 and GCC47 toolchain
> > definitions, which are on the list to be removed, along with VS2003,
> > VS2005, VS2008, VS2010, DDK3790, UNIXGCC, GCC44, GCC45, ELFGCC, CYGGCC,
> > ICC, ICC11 and MYTOOLS.
> >
> > Since GCC46 and GCC47 are the only ones on that list that support ARM
> > and/or AARCH64, let's give Liming a hand and cover the ARM side of
> > things first, so that everything that remains to be removed is x86
> > only.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel 
>
> I think I would personally prefer to see this folded into the "drop
> unused GCCnn profiles", but I'll leave that to the discretion of the
> BaseTools maintainers.
>

That would be fine with me as well, I just contributed this to save
Liming the effort of disentangling the ARM pieces)

> GCC47_AARCH64* was always a bit cringeworthy, so glad to see it go :)
>
> From an ARM perspective:
> Reviewed-by: Leif Lindholm 
>

Thanks

> > ---
> >  BaseTools/Conf/tools_def.template | 143 ++--
> >  1 file changed, 14 insertions(+), 129 deletions(-)
> >
> > diff --git a/BaseTools/Conf/tools_def.template 
> > b/BaseTools/Conf/tools_def.template
> > index e0e68fd7fb49..3bc140d8f241 100755
> > --- a/BaseTools/Conf/tools_def.template
> > +++ b/BaseTools/Conf/tools_def.template
> > @@ -368,13 +368,13 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
> >  #   Intel(r) ACPI Compiler from
> >  #   https://acpica.org/downloads
> >  #   GCC46   -Linux,Windows-  Requires:
> > -# GCC 4.6 targeting x86_64-linux-gnu or 
> > arm-linux-gnueabi
> > +# GCC 4.6 targeting x86_64-linux-gnu
> >  #Optional:
> >  # Required to build platforms or ACPI tables:
> >  #   Intel(r) ACPI Compiler from
> >  #   https://acpica.org/downloads
> >  #   GCC47   -Linux,Windows-  Requires:
> > -# GCC 4.7 targeting x86_64-linux-gnu, 
> > aarch64-linux-gnu, or arm-linux-gnueabi
> > +# GCC 4.7 targeting x86_64-linux-gnu
> >  #Optional:
> >  # Required to build platforms or ACPI tables:
> >  #   Intel(r) ACPI Compiler from
> > @@ -4199,12 +4199,6 @@ DEFINE GCC46_IA32_DLINK2_FLAGS   = 
> > DEF(GCC45_IA32_DLINK2_FLAGS)
> >  DEFINE GCC46_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS)
> >  DEFINE GCC46_X64_DLINK2_FLAGS= DEF(GCC45_X64_DLINK2_FLAGS)
> >  DEFINE GCC46_ASM_FLAGS   = DEF(GCC45_ASM_FLAGS)
> > -DEFINE GCC46_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
> > DEF(GCC_ASM_FLAGS) -mlittle-endian
> > -DEFINE GCC46_ARM_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> > DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations
> > -DEFINE GCC46_ARM_CC_XIPFLAGS = -D__ARM_FEATURE_UNALIGNED=0
> > -DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) 
> > -Wl,--oformat=elf32-littlearm
> > -DEFINE GCC46_ARM_DLINK2_FLAGS= DEF(GCC_DLINK2_FLAGS_COMMON) 
> > -Wl,--defsym=PECOFF_HEADER_SIZE=0x220
> > -DEFINE GCC46_ARM_ASLDLINK_FLAGS  = DEF(GCC_ARM_ASLDLINK_FLAGS) 
> > -Wl,--oformat=elf32-littlearm
> >
> >  DEFINE GCC47_IA32_CC_FLAGS   = DEF(GCC46_IA32_CC_FLAGS)
> >  DEFINE GCC47_X64_CC_FLAGS= DEF(GCC46_X64_CC_FLAGS)
> > @@ -4215,18 +4209,6 @@ DEFINE GCC47_IA32_DLINK2_FLAGS   = 
> > DEF(GCC46_IA32_DLINK2_FLAGS)
> >  DEFINE GCC47_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS)
> >  DEFINE GCC47_X64_DLINK2_FLAGS= DEF(GCC46_X64_DLINK2_FLAGS)
> >  DEFINE GCC47_ASM_FLAGS   = DEF(GCC46_ASM_FLAGS)
> > -DEFINE GCC47_ARM_ASM_FLAGS   = DEF(GCC46_ARM_ASM_FLAGS)
> > -DEFINE GCC47_AARCH64_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
> > DEF(GCC_ASM_FLAGS) -mlittle-endian
> > -DEFINE GCC47_ARM_CC_FLAGS= DEF(GCC46_ARM_CC_FLAGS)
> > -DEFINE GCC47_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS)
> > -DEFINE GCC47_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
> > -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS)
> > -DEFINE GCC47_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
> > -DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
> > -DEFINE GCC47_ARM_DLINK2_FLAGS= DEF(GCC46_ARM_DLINK2_FLAGS)
> > -DEFINE GCC47_AARCH64_DLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS)
> > -DEFINE GCC47_AARCH64_DLINK2_FLAGS= DEF(GCC_DLINK2_FLAGS_COMMON) 
> > -Wl,--defsym=PECOFF_HEADER_SIZE=0x228
> > -DEFINE GCC47_ARM_ASLDLINK_FLAGS  = DEF(GCC46_ARM_ASLDLINK_FLAGS)
> > -DEFINE GCC47_AARCH64_ASLDLINK_FLAGS  = DEF(GCC_AARCH64_ASLDLINK_FLA

[edk2] [PATCH v2 edk2-platforms 19/20] Platform/Broadcom/RPi3 *NON-OSI*: Add USB Host driver

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Drivers/DwUsbHostDxe/ComponentName.c  |  219 +++
 Platform/Broadcom/Bcm283x/Drivers/DwUsbHostDxe/DriverBinding.c  |  269 
 Platform/Broadcom/Bcm283x/Drivers/DwUsbHostDxe/DwUsbHostDxe.c   | 1644 

 Platform/Broadcom/Bcm283x/Drivers/DwUsbHostDxe/DwUsbHostDxe.h   |  159 ++
 Platform/Broadcom/Bcm283x/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf |   52 +
 Platform/Broadcom/Bcm283x/Drivers/DwUsbHostDxe/DwcHw.h  |  782 
++
 Platform/Broadcom/Bcm283x/Drivers/DwUsbHostDxe/License.txt  |  340 
 7 files changed, 3465 insertions(+)

diff --git a/Platform/Broadcom/Bcm283x/Drivers/DwUsbHostDxe/ComponentName.c 
b/Platform/Broadcom/Bcm283x/Drivers/DwUsbHostDxe/ComponentName.c
new file mode 100644
index ..6e2709b13c9b
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Drivers/DwUsbHostDxe/ComponentName.c
@@ -0,0 +1,219 @@
+/** @file
+ *
+ *  Copyright (c) 2018, Andrey Warkentin 
+ *
+ *  SPDX-License-Identifier: GPL-2.0+
+ *
+ **/
+
+#include "DwUsbHostDxe.h"
+
+STATIC
+EFI_STATUS
+EFIAPI
+ComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8*Language,
+  OUT CHAR16   **DriverName
+);
+
+STATIC
+EFI_STATUS
+EFIAPI
+ComponentNameGetControllerName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL *This,
+  IN  EFI_HANDLE  ControllerHandle,
+  IN  EFI_HANDLE  ChildHandle,
+  IN  CHAR8   *Language,
+  OUT CHAR16  **ControllerName
+  );
+
+//
+// EFI Component Name Protocol
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gComponentName = {
+  ComponentNameGetDriverName,
+  ComponentNameGetControllerName,
+  "eng"
+};
+
+//
+// EFI Component Name 2 Protocol
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 = {
+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ComponentNameGetDriverName,
+  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ComponentNameGetControllerName,
+  "en"
+};
+
+
+STATIC EFI_UNICODE_STRING_TABLE mDriverName[] = {
+  {
+"eng;en",
+(CHAR16 *)L"Raspberry Pi USB Host Driver"
+  },
+  {
+NULL,
+NULL
+  }
+};
+
+STATIC EFI_UNICODE_STRING_TABLE mDeviceName[] = {
+  {
+"eng;en",
+(CHAR16 *)L"Raspberry Pi USB Host"
+  },
+  {
+NULL,
+NULL
+  }
+};
+
+/**
+  Retrieves a Unicode string that is the user readable name of the driver.
+
+  This function retrieves the user readable name of a driver in the form of a
+  Unicode string. If the driver specified by This has a user readable name in
+  the language specified by Language, then a pointer to the driver name is
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
+  by This does not support the language specified by Language,
+  then EFI_UNSUPPORTED is returned.
+
+  @param  This[in]  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL 
or
+EFI_COMPONENT_NAME_PROTOCOL instance.
+
+  @param  Language[in]  A pointer to a Null-terminated ASCII string
+array indicating the language. This is the
+language of the driver name that the caller is
+requesting, and it must match one of the
+languages specified in SupportedLanguages. The
+number of languages supported by a driver is up
+to the driver writer. Language is specified
+in RFC 4646 or ISO 639-2 language code format.
+
+  @param  DriverName[out]   A pointer to the Unicode string to return.
+This Unicode string is the name of the
+driver specified by This in the language
+specified by Language.
+
+  @retval EFI_SUCCESS   The Unicode string for the Driver specified by
+This and the language specified by Language was
+returned in DriverName.
+
+  @retval EFI_INVALID_PARAMETER Language is NULL.
+
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.
+
+  @retval EFI_UNSUPPORTED   The driver specified by This does not support
+the language specified by Language.
+
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+ComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8*Language,
+  OUT CHAR16   **DriverName
+  )
+{
+  return LookupUnicodeString2 (
+   Language,
+   This->SupportedLanguages,
+   mDriverName,
+   DriverName,
+   (BOOLEAN)(This == &gComponentName)
+   );
+}
+
+/**
+  Retrieves a Unicode string that is the user readable name of the controller
+  that is being mana

[edk2] [PATCH v2 edk2-platforms 18/20] Platform/Broadcom/RPi3 *NON-OSI*: Add Device Tree binaries

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/DeviceTree/License.txt  |  340 ++
 Platform/Broadcom/Bcm283x/DeviceTree/bcm2710-rpi-3-b-plus.dtb |  Bin 0 -> 
25617 bytes
 Platform/Broadcom/Bcm283x/DeviceTree/bcm2710-rpi-3-b-plus.dts | 1263 

 Platform/Broadcom/Bcm283x/DeviceTree/bcm2710-rpi-3-b.dtb  |  Bin 0 -> 
25354 bytes
 Platform/Broadcom/Bcm283x/DeviceTree/bcm2710-rpi-3-b.dts  | 1259 
+++
 5 files changed, 2862 insertions(+)

diff --git a/Platform/Broadcom/Bcm283x/DeviceTree/License.txt 
b/Platform/Broadcom/Bcm283x/DeviceTree/License.txt
new file mode 100644
index ..1603937dad82
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/DeviceTree/License.txt
@@ -0,0 +1,340 @@
+GNU GENERAL PUBLIC LICENSE
+   Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's

[edk2] [PATCH v2 edk2-platforms 17/20] Platform/Broadcom/RPi3 *NON-OSI*: Add ATF binaries

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Binary/License.txt |  26 +
 Platform/Broadcom/Bcm283x/Binary/README.md   |  41 
 Platform/Broadcom/Bcm283x/Binary/bl1.bin | Bin 0 -> 18801 bytes
 Platform/Broadcom/Bcm283x/Binary/fip.bin | Bin 0 -> 41714 bytes
 4 files changed, 67 insertions(+)

diff --git a/Platform/Broadcom/Bcm283x/Binary/License.txt 
b/Platform/Broadcom/Bcm283x/Binary/License.txt
new file mode 100644
index ..b98dc643227e
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Binary/License.txt
@@ -0,0 +1,26 @@
+Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 
modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice, 
this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+
+* Neither the name of ARM nor the names of its contributors may be used to
+  endorse or promote products derived from this software without specific prior
+  written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 
FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Platform/Broadcom/Bcm283x/Binary/README.md 
b/Platform/Broadcom/Bcm283x/Binary/README.md
new file mode 100644
index ..9811a1286093
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Binary/README.md
@@ -0,0 +1,41 @@
+ARM Trusted Firmware for Raspberry Pi 3
+===
+
+The `bl1` and `fip` ATF binaries, found in this directory, were built from
+the [latest ATF](https://github.com/ARM-software/arm-trusted-firmware)
+(commit c3859557) using Linaro's GCC 5.5 compiler with:
+
+```
+make PLAT=rpi3 PRELOADED_BL33_BASE=0x3 RPI3_PRELOADED_DTB_BASE=0x1 
SUPPORT_VFP=1 RPI3_USE_UEFI_MAP=1 fip all
+```
+
+This results in the following memory mapping:
+
+```
+0x +-+
+   |   ROM   | BL1
+0x0001 +-+
+   |   DTB   | (Loaded by the VideoCore)
+0x0002 +-+
+   |   FIP   |
+0x0003 +-+
+   | |
+   |  UEFI PAYLOAD   |
+   | |
+0x0020 +-+
+   |   Secure SRAM   | BL2, BL31
+0x0030 +-+
+   |   Secure DRAM   | BL32 (Secure payload)
+0x0040 +-+
+   | |
+   | |
+   | Non-secure DRAM | BL33
+   | |
+   | |
+0x0100 +-+
+   | |
+   |   ...   |
+   | |
+0x3F00 +-+
+   |   I/O   |
+```
diff --git a/Platform/Broadcom/Bcm283x/Binary/bl1.bin 
b/Platform/Broadcom/Bcm283x/Binary/bl1.bin
new file mode 100644
index 
..e25138828d0a4ddb24772abb1a60eefc334666b5
GIT binary patch
literal 18801
zcmeHud2|%#mG7;pmedFVtpy|tJ-S*z4DF582<)+{TLO%YF^IMyw%@2*ivhC;Enpe2
zRTADp&Ya2NoOkF$@l}1x-M+hhw@Q@U820D96C>N0$f-gpvNVO-6r%k^_LFjhV53f>
zzYYB^p(#wZhayBm(40?m)v%ZRF-jkU{?@RJdpUDVq_0@Qvl>>=KM8BSMAN6D9c2X^
zv}!gTC9-IZXdThl_aE5oz6A)Ol0}J=O^M4yanPmrUEBE6z%_}qi$f`XQKFzu
zlVZ_?G$rnX41{DgYzORyWMj?6p-TMP#*g+gylWdj3`8X%sIOlv1lmB)R$NV@Mf2q+
zY4d>}JWrcSYDNxGR%4SA-?^DI?>kETG0>;<^-cF@D)C*r!0X4PiJ}^Q9sQugsR%T^
zW2zF8L8m(ZKusahN`})&mx1t%~~5>0PQR^krEJ6wr3iAo6aZSmWc_!Ag6
z`56X&xUWmf4DJH$r=?NBrxUaj_-e#D|7a!d7m4LPR23=2^S_NbBGxi5Ce4?hcK6f$
z3TXVu>I#)XZeBsnU^%~vzTYcJS`*qLzY-q@C2Lj%?d)EP7gLhfKy+cZh2moYa~$X{
zx3%XUwhAHXdf#-#Z|vK6?76XLKQ{Io`^9@z>$YethdSW8QZ5C&;8{(g13fpB7t2Z#
zv}wTee+aU&&~*P;CC>ZC@)`!-q9RS70s5}E1#NvkX*|Abte|y4K4Ov@&cGb(htrS!
z?UHhWQSQh3M%HhErgcf#{e7FzN8o|+H4LXX!y1D17Ravw@_ZjU`DI^Uc2vsJ_nzf=
zrMw8T{AXPU*sfUT3wKkT?+aCk5sBtYoZHy#nk(iF>b7Kn7plG-GWM_MT}fv`}>i_+g$!>kYVAtMjMZ
z

[edk2] [PATCH v2 edk2-platforms 16/20] Platform/Broadcom/RPi3: Add Raspberry Pi 3 Platform

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/RaspberryPiPkg.dec |  63 ++
 Platform/Broadcom/Bcm283x/RaspberryPiPkg.dsc | 636 
 Platform/Broadcom/Bcm283x/RaspberryPiPkg.fdf | 450 ++
 Platform/Broadcom/Bcm283x/Readme.md  | 263 
 4 files changed, 1412 insertions(+)

diff --git a/Platform/Broadcom/Bcm283x/RaspberryPiPkg.dec 
b/Platform/Broadcom/Bcm283x/RaspberryPiPkg.dec
new file mode 100644
index ..51f2f07aab8a
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/RaspberryPiPkg.dec
@@ -0,0 +1,63 @@
+## @file
+#
+#  Copyright (c) 2016, Linaro, Ltd. All rights reserved.
+#  Copyright (c) 2017 - 2018, Andrei Warkentin 
+#
+#  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]
+  DEC_SPECIFICATION  = 0x0001001A
+  PACKAGE_NAME   = RaspberryPiPkg
+  PACKAGE_GUID   = DFA0CA8B-F3AC-4607-96AC-46FA04B84DCC
+  PACKAGE_VERSION= 0.1
+
+[Includes]
+  Include
+
+[Protocols]
+  gRaspberryPiFirmwareProtocolGuid = { 0x0ACA9535, 0x7AD0, 0x4286, { 0xB0, 
0x2E, 0x87, 0xFA, 0x7E, 0x2A, 0x57, 0x11 } }
+  gRaspberryPiConfigAppliedProtocolGuid = { 0x0ACA, 0x7AD0, 0x4286, { 
0xB0, 0x2E, 0x87, 0xFA, 0x7E, 0x2A, 0x57, 0x11 } }
+  gRaspberryPiMmcHostProtocolGuid = { 0x3e591c00, 0x9e4a, 0x11df, {0x92, 0x44, 
0x00, 0x02, 0xA5, 0xF5, 0xF5, 0x1B } }
+  gExtendedTextOutputProtocolGuid = { 0x387477ff, 0xffc7, 0xffd2, {0x8e, 0x39, 
0x0, 0xff, 0xc9, 0x69, 0x72, 0x3b } }
+
+[Guids]
+  gRaspberryPiTokenSpaceGuid = {0xCD7CC258, 0x31DB, 0x11E6, {0x9F, 0xD3, 0x63, 
0xB0, 0xB8, 0xEE, 0xD6, 0xB5}}
+  gRaspberryPiFdtFileGuid = {0xDF5DA223, 0x1D27, 0x47C3, { 0x8D, 0x1B, 0x9A, 
0x41, 0xB5, 0x5A, 0x18, 0xBC}}
+  gRaspberryPiEventResetGuid = {0xCD7CC258, 0x31DB, 0x11E6, {0x9F, 0xD3, 0x63, 
0xB4, 0xB4, 0xE4, 0xD4, 0xB4}}
+  gConfigDxeFormSetGuid = {0xCD7CC258, 0x31DB, 0x22E6, {0x9F, 0x22, 0x63, 
0xB0, 0xB8, 0xEE, 0xD6, 0xB5}}
+
+[PcdsFixedAtBuild.common]
+  gRaspberryPiTokenSpaceGuid.PcdFdtBaseAddress|0x1|UINT32|0x0001
+  gRaspberryPiTokenSpaceGuid.PcdFirmwareBlockSize|0x0|UINT32|0x0002
+  gRaspberryPiTokenSpaceGuid.PcdNvStorageEventLogBase|0x0|UINT32|0x0003
+  gRaspberryPiTokenSpaceGuid.PcdNvStorageEventLogSize|0x0|UINT32|0x0004
+  gRaspberryPiTokenSpaceGuid.PcdNvStorageVariableBase|0x0|UINT32|0x0005
+  gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwSpareBase|0x0|UINT32|0x0006
+  gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwWorkingBase|0x0|UINT32|0x0007
+  gRaspberryPiTokenSpaceGuid.PcdBootEpochSeconds|0x0|UINT64|0x0008
+
+[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
+  gRaspberryPiTokenSpaceGuid.PcdHypEnable|0|UINT32|0x0009
+  gRaspberryPiTokenSpaceGuid.PcdHypLogMask|0|UINT32|0x000a
+  gRaspberryPiTokenSpaceGuid.PcdHypWindowsDebugHook|0|UINT32|0x000b
+  gRaspberryPiTokenSpaceGuid.PcdHypWin2000Mask|0|UINT32|0x000c
+  gRaspberryPiTokenSpaceGuid.PcdCpuClock|0|UINT32|0x000d
+  gRaspberryPiTokenSpaceGuid.PcdSdIsArasan|0|UINT32|0x000e
+  gRaspberryPiTokenSpaceGuid.PcdMmcForce1Bit|0|UINT32|0x000f
+  gRaspberryPiTokenSpaceGuid.PcdMmcForceDefaultSpeed|0|UINT32|0x0010
+  gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpeedMHz|0|UINT32|0x0011
+  gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMHz|0|UINT32|0x0012
+  gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti|0|UINT32|0x0013
+  gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG|0|UINT32|0x0014
+  gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit|0|UINT32|0x0015
+  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes|0|UINT32|0x0017
+  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|0|UINT32|0x0018
diff --git a/Platform/Broadcom/Bcm283x/RaspberryPiPkg.dsc 
b/Platform/Broadcom/Bcm283x/RaspberryPiPkg.dsc
new file mode 100644
index ..8610fae0b92f
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/RaspberryPiPkg.dsc
@@ -0,0 +1,636 @@
+# @file
+#
+#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
+#  Copyright (c) 2014, Linaro Limited. All rights reserved.
+#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2017 - 2018, Andrei Warkentin 
+#
+#  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 WARR

[edk2] [PATCH v2 edk2-platforms 15/20] Platform/Broadcom/RPi3: Add Platform Config driver

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Drivers/ConfigDxe/ConfigDxe.c| 356 

 Platform/Broadcom/Bcm283x/Drivers/ConfigDxe/ConfigDxe.inf  |  81 +
 Platform/Broadcom/Bcm283x/Drivers/ConfigDxe/ConfigDxeFormSetGuid.h |  23 ++
 Platform/Broadcom/Bcm283x/Drivers/ConfigDxe/ConfigDxeHii.uni   | 100 ++
 Platform/Broadcom/Bcm283x/Drivers/ConfigDxe/ConfigDxeHii.vfr   | 306 
+
 5 files changed, 866 insertions(+)

diff --git a/Platform/Broadcom/Bcm283x/Drivers/ConfigDxe/ConfigDxe.c 
b/Platform/Broadcom/Bcm283x/Drivers/ConfigDxe/ConfigDxe.c
new file mode 100644
index ..4e3c68ca2994
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Drivers/ConfigDxe/ConfigDxe.c
@@ -0,0 +1,356 @@
+/** @file
+ *
+ *  Copyright (c) 2018, Andrei Warkentin 
+ *
+ *  This program and the accompanying materials
+ *  are licensed and made available under the terms and conditions of the BSD 
License
+ *  which accompanies this distribution.  The full text of the license may be 
found at
+ *  http://opensource.org/licenses/bsd-license.php
+ *
+ *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+ *
+ **/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "ConfigDxeFormSetGuid.h"
+
+extern UINT8 ConfigDxeHiiBin[];
+extern UINT8 ConfigDxeStrings[];
+
+STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
+
+typedef struct {
+  VENDOR_DEVICE_PATH VendorDevicePath;
+  EFI_DEVICE_PATH_PROTOCOL End;
+} HII_VENDOR_DEVICE_PATH;
+
+STATIC HII_VENDOR_DEVICE_PATH mVendorDevicePath = {
+  {
+{
+  HARDWARE_DEVICE_PATH,
+  HW_VENDOR_DP,
+  {
+(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
+(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+  }
+},
+CONFIGDXE_FORM_SET_GUID
+  },
+  {
+END_DEVICE_PATH_TYPE,
+END_ENTIRE_DEVICE_PATH_SUBTYPE,
+{
+  (UINT8) (END_DEVICE_PATH_LENGTH),
+  (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
+}
+  }
+};
+
+
+STATIC EFI_STATUS
+InstallHiiPages (
+  VOID
+  )
+{
+  EFI_STATUS Status;
+  EFI_HII_HANDLE HiiHandle;
+  EFI_HANDLE DriverHandle;
+
+  DriverHandle = NULL;
+  Status = gBS->InstallMultipleProtocolInterfaces (&DriverHandle,
+  &gEfiDevicePathProtocolGuid,
+  &mVendorDevicePath,
+  NULL);
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  HiiHandle = HiiAddPackages (&gConfigDxeFormSetGuid,
+  DriverHandle,
+  ConfigDxeStrings,
+  ConfigDxeHiiBin,
+  NULL);
+
+  if (HiiHandle == NULL) {
+gBS->UninstallMultipleProtocolInterfaces (DriverHandle,
+  &gEfiDevicePathProtocolGuid,
+  &mVendorDevicePath,
+  NULL);
+return EFI_OUT_OF_RESOURCES;
+  }
+  return EFI_SUCCESS;
+}
+
+
+STATIC EFI_STATUS
+SetupVariables (
+  VOID
+  )
+{
+  UINTN Size;
+  UINT32 Var32;
+  EFI_STATUS Status;
+
+  /*
+   * Create the vars with default value.
+   * If we don't, forms won't be able to update.
+   */
+
+  Size = sizeof (UINT32);
+  Status = gRT->GetVariable(L"CpuClock",
+&gConfigDxeFormSetGuid,
+NULL,  &Size, &Var32);
+  if (EFI_ERROR (Status)) {
+PcdSet32 (PcdCpuClock, PcdGet32 (PcdCpuClock));
+  }
+
+  Size = sizeof (UINT32);
+  Status = gRT->GetVariable(L"SdIsArasan",
+&gConfigDxeFormSetGuid,
+NULL,  &Size, &Var32);
+  if (EFI_ERROR (Status)) {
+PcdSet32 (PcdSdIsArasan, PcdGet32 (PcdSdIsArasan));
+  }
+
+  Size = sizeof (UINT32);
+  Status = gRT->GetVariable(L"MmcDisableMulti",
+&gConfigDxeFormSetGuid,
+NULL,  &Size, &Var32);
+  if (EFI_ERROR (Status)) {
+PcdSet32 (PcdMmcDisableMulti, PcdGet32 (PcdMmcDisableMulti));
+  }
+
+  Size = sizeof (UINT32);
+  Status = gRT->GetVariable(L"MmcForce1Bit",
+&gConfigDxeFormSetGuid,
+NULL,  &Size, &Var32);
+  if (EFI_ERROR (Status)) {
+PcdSet32 (PcdMmcForce1Bit, PcdGet32 (PcdMmcForce1Bit));
+  }
+
+  Size = sizeof (UINT32);
+  Status = gRT->GetVariable(L"MmcForceDefaultSpeed",
+&gConfigDxeFormSetGuid,
+NULL,  &Size, &Var32);
+  if (EFI_ERROR (Status)) {
+PcdSet32 (PcdMmcForceDefaultSpeed, PcdGet32 (PcdMmcForceDefaultSpeed));
+  }
+
+  Size = sizeof (UINT32);
+  Status = gRT->GetVariable(L"MmcSdDefaultSpeedMHz",
+&gConfigDxeFormSetGuid,
+NULL,  &Size, &Var32);
+  if (EFI_ERROR (Status)) {
+PcdSet32 (PcdMmcSdDefaultSpeedMHz, PcdGet32 (PcdMmcSdDefaultSpeedMHz));
+  }

[edk2] [PATCH v2 edk2-platforms 14/20] Platform/Broadcom/RPi3: Add NV Storage driver

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Drivers/VarBlockServiceDxe/FileIo.c   | 
196 
 Platform/Broadcom/Bcm283x/Drivers/VarBlockServiceDxe/FvbInfo.c  | 
118 +++
 Platform/Broadcom/Bcm283x/Drivers/VarBlockServiceDxe/VarBlockService.c  | 
984 
 Platform/Broadcom/Bcm283x/Drivers/VarBlockServiceDxe/VarBlockService.h  | 
217 +
 Platform/Broadcom/Bcm283x/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.c   | 
334 +++
 Platform/Broadcom/Bcm283x/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.inf |  
93 ++
 6 files changed, 1942 insertions(+)

diff --git a/Platform/Broadcom/Bcm283x/Drivers/VarBlockServiceDxe/FileIo.c 
b/Platform/Broadcom/Bcm283x/Drivers/VarBlockServiceDxe/FileIo.c
new file mode 100644
index ..961de586c78b
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Drivers/VarBlockServiceDxe/FileIo.c
@@ -0,0 +1,196 @@
+/** @file
+ *
+ *  Copyright (c) 2018, Andrei Warkentin 
+ *  Copyright (c) 2007-2009, 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 "VarBlockService.h"
+
+
+EFI_STATUS
+FileWrite (
+  IN EFI_FILE_PROTOCOL *File,
+  IN UINTN Offset,
+  IN UINTN Buffer,
+  IN UINTN Size
+  )
+{
+  EFI_STATUS Status;
+
+  Status = File->SetPosition (File, Offset);
+  ASSERT_EFI_ERROR (Status);
+  if (!EFI_ERROR (Status)) {
+Status = File->Write (File, &Size, (VOID *) Buffer);
+ASSERT_EFI_ERROR (Status);
+  }
+  return Status;
+}
+
+
+VOID
+FileClose (
+  IN  EFI_FILE_PROTOCOL *File
+  )
+{
+  File->Flush (File);
+  File->Close (File);
+}
+
+
+EFI_STATUS
+FileOpen (
+  IN  EFI_DEVICE_PATH_PROTOCOL *Device,
+  IN  CHAR16 *MappedFile,
+  OUT EFI_FILE_PROTOCOL **File,
+  IN  UINT64 OpenMode
+  )
+{
+  EFI_HANDLEHandle;
+  EFI_FILE_HANDLE   Root;
+  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL   *Volume;
+  EFI_STATUSStatus;
+
+  *File = NULL;
+
+  Status = gBS->LocateDevicePath (
+  &gEfiSimpleFileSystemProtocolGuid,
+  &Device,
+  &Handle
+  );
+
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  Status = gBS->HandleProtocol (
+  Handle,
+  &gEfiSimpleFileSystemProtocolGuid,
+  (void **) &Volume
+  );
+  ASSERT_EFI_ERROR (Status);
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  //
+  // Open the root directory of the volume
+  //
+  Root = NULL;
+  Status = Volume->OpenVolume (
+ Volume,
+ &Root
+ );
+  ASSERT_EFI_ERROR (Status);
+  ASSERT (Root != NULL);
+
+  //
+  // Open file
+  //
+  Status = Root->Open (
+   Root,
+   File,
+   MappedFile,
+   OpenMode,
+   0
+   );
+  if (EFI_ERROR (Status)) {
+*File = NULL;
+  }
+
+  //
+  // Close the Root directory
+  //
+  Root->Close (Root);
+  return Status;
+}
+
+
+EFI_STATUS
+CheckStore (
+  IN  EFI_HANDLE SimpleFileSystemHandle,
+  OUT EFI_DEVICE_PATH_PROTOCOL **Device
+  )
+{
+  EFI_STATUS Status;
+  EFI_BLOCK_IO_PROTOCOL *BlkIo;
+  EFI_FILE_PROTOCOL *File;
+
+  *Device = NULL;
+  Status  = gBS->HandleProtocol (
+   SimpleFileSystemHandle,
+   &gEfiBlockIoProtocolGuid,
+   (VOID*)&BlkIo
+   );
+
+  if (EFI_ERROR (Status)) {
+goto ErrHandle;
+  }
+  if (!BlkIo->Media->MediaPresent) {
+DEBUG ((DEBUG_ERROR, "FwhMappedFile: Media not present!\n"));
+Status = EFI_NO_MEDIA;
+goto ErrHandle;
+  }
+  if (BlkIo->Media->ReadOnly) {
+DEBUG ((DEBUG_ERROR, "FwhMappedFile: Media is read-only!\n"));
+Status = EFI_ACCESS_DENIED;
+goto ErrHandle;
+  }
+
+  Status = FileOpen (DevicePathFromHandle (SimpleFileSystemHandle),
+ mFvInstance->MappedFile, &File,
+ EFI_FILE_MODE_READ);
+  if (EFI_ERROR (Status)) {
+goto ErrHandle;
+  }
+
+  /* We found it! Maybe do more checks...? */
+
+  FileClose (File);
+  *Device = DuplicateDevicePath (DevicePathFromHandle 
(SimpleFileSystemHandle));
+
+  ASSERT (*Device != NULL);
+
+ErrHandle:
+  return Status;
+}
+
+
+EFI_STATUS
+CheckStoreExists (
+  IN  EFI_DEVICE_PATH_PROTOCOL *Device
+  )
+{
+  EFI_HANDLE Handle;
+  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Volume;
+  EFI_STATUS Status;
+
+  Status = gBS->LocateDevicePath (
+  &gEfiSimpleFileSystemProtocolG

[edk2] [PATCH v2 edk2-platforms 13/20] Platform/Broadcom/RPi3: Add SMBIOS driver

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c   | 
915 
 Platform/Broadcom/Bcm283x/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf |  
56 ++
 2 files changed, 971 insertions(+)

diff --git 
a/Platform/Broadcom/Bcm283x/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c 
b/Platform/Broadcom/Bcm283x/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
new file mode 100644
index ..36b953d9c5f4
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -0,0 +1,915 @@
+/** @file
+ *
+ *  Static SMBIOS Table for ARM platform
+ *  Derived from EmulatorPkg package
+ *
+ *  Note SMBIOS 2.7.1 Required structures:
+ *  BIOS Information (Type 0)
+ *  System Information (Type 1)
+ *  Board Information (Type 2)
+ *  System Enclosure (Type 3)
+ *  Processor Information (Type 4) - CPU Driver
+ *  Cache Information (Type 7) - For cache that is external to processor
+ *  System Slots (Type 9) - If system has slots
+ *  Physical Memory Array (Type 16)
+ *  Memory Device (Type 17) - For each socketed system-memory Device
+ *  Memory Array Mapped Address (Type 19) - One per contiguous block per 
Physical Memroy Array
+ *  System Boot Information (Type 32)
+ *
+ *  Copyright (c) 2017-2018, Andrey Warkentin 
+ *  Copyright (c) 2013, Linaro.org
+ *  Copyright (c) 2012, Apple Inc. All rights reserved.
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ *  This program and the accompanying materials
+ *  are licensed and made available under the terms and conditions of the BSD 
License
+ *  which accompanies this distribution.  The full text of the license may be 
found at
+ *  http://opensource.org/licenses/bsd-license.php
+ *
+ *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+ *
+ **/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
+
+/***
+SMBIOS data definition  TYPE0  BIOS Information
+/
+SMBIOS_TABLE_TYPE0 mBIOSInfoType0 = {
+  { EFI_SMBIOS_TYPE_BIOS_INFORMATION, sizeof (SMBIOS_TABLE_TYPE0), 0 },
+  1,// Vendor String
+  2,// BiosVersion String
+  0x0,  // BiosSegment
+  3,// BiosReleaseDate String
+  0x1F, // BiosSize
+  { // BiosCharacteristics
+0,//  Reserved  :2;  ///< Bits 0-1.
+0,//  Unknown   :1;
+0,//  BiosCharacteristicsNotSupported   :1;
+0,//  IsaIsSupported:1;
+0,//  McaIsSupported:1;
+0,//  EisaIsSupported   :1;
+0,//  PciIsSupported:1;
+0,//  PcmciaIsSupported :1;
+0,//  PlugAndPlayIsSupported:1;
+0,//  ApmIsSupported:1;
+0,//  BiosIsUpgradable  :1;
+0,//  BiosShadowingAllowed  :1;
+0,//  VlVesaIsSupported :1;
+0,//  EscdSupportIsAvailable:1;
+0,//  BootFromCdIsSupported :1;
+1,//  SelectableBootIsSupported :1;
+0,//  RomBiosIsSocketed :1;
+0,//  BootFromPcmciaIsSupported :1;
+0,//  EDDSpecificationIsSupported   :1;
+0,//  JapaneseNecFloppyIsSupported  :1;
+0,//  JapaneseToshibaFloppyIsSupported  :1;
+0,//  Floppy525_360IsSupported  :1;
+0,//  Floppy525_12IsSupported   :1;
+0,//  Floppy35_720IsSupported   :1;
+0,//  Floppy35_288IsSupported   :1;
+0,//  PrintScreenIsSupported:1;
+0,//  Keyboard8042IsSupported   :1;
+0,//  SerialIsSupported :1;
+0,//  PrinterIsSupported:1;
+0,//  CgaMonoIsSupported:1;
+0,//  NecPc98   :1;
+0 //  ReservedForVendor :32; ///< Bits 32-63. Bits 
32-47 reserved for BIOS vendor
+///< and bits 48-63 reserved for System Vendor.
+  },
+  {   // BIOSCharacteristicsExtensionBytes[]
+0x01, //  AcpiIsSupported   :1;
+  //  UsbLegacyIsSupported  :1;
+  //  AgpIsSupported:1;
+  //  I2OBootIsSupported:1;
+  //  Ls120BootIsSupported  :1;
+  //  AtapiZipDriveBootIsSupported  :1;
+  /

[edk2] [PATCH v2 edk2-platforms 12/20] Platform/Broadcom/RPi3: Add SD Host driver

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Drivers/SdHostDxe/SdHostDxe.c| 830 

 Platform/Broadcom/Bcm283x/Drivers/SdHostDxe/SdHostDxe.inf  |  54 ++
 Platform/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836SdHost.h |  92 +++
 3 files changed, 976 insertions(+)

diff --git a/Platform/Broadcom/Bcm283x/Drivers/SdHostDxe/SdHostDxe.c 
b/Platform/Broadcom/Bcm283x/Drivers/SdHostDxe/SdHostDxe.c
new file mode 100644
index ..7dd76098c8a1
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Drivers/SdHostDxe/SdHostDxe.c
@@ -0,0 +1,830 @@
+/** @file
+ *
+ *  Copyright (c) 2017, Andrei Warkentin 
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ *  This program and the accompanying materials
+ *  are licensed and made available under the terms and conditions of the BSD 
License
+ *  which accompanies this distribution.  The full text of the license may be 
found at
+ *  http://opensource.org/licenses/bsd-license.php
+ *
+ *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+ *
+ **/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define SDHOST_BLOCK_BYTE_LENGTH512
+
+// Driver Timing Parameters
+#define CMD_STALL_AFTER_POLL_US 1
+#define CMD_MIN_POLL_TOTAL_TIME_US  10 // 100ms
+#define CMD_MAX_POLL_COUNT  (CMD_MIN_POLL_TOTAL_TIME_US / 
CMD_STALL_AFTER_POLL_US)
+#define CMD_MAX_RETRY_COUNT 3
+#define CMD_STALL_AFTER_RETRY_US20 // 20us
+#define FIFO_MAX_POLL_COUNT 100
+#define STALL_TO_STABILIZE_US   1 // 10ms
+
+#define IDENT_MODE_SD_CLOCK_FREQ_HZ 40 // 400KHz
+
+// Macros adopted from MmcDxe internal header
+#define SDHOST_R0_READY_FOR_DATABIT8
+#define SDHOST_R0_CURRENTSTATE(Response)((Response >> 9) & 0xF)
+
+#define DEBUG_MMCHOST_SD   DEBUG_VERBOSE
+#define DEBUG_MMCHOST_SD_INFO  DEBUG_INFO
+#define DEBUG_MMCHOST_SD_ERROR DEBUG_ERROR
+
+STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL   *mFwProtocol;
+
+// Per Physical Layer Simplified Specs
+#ifndef NDEBUG
+STATIC CONST CHAR8* mStrSdState[] = { "idle", "ready", "ident", "stby",
+  "tran", "data", "rcv", "prg", "dis",
+  "ina" };
+STATIC CONST CHAR8 *mFsmState[] = { "identmode", "datamode", "readdata",
+"writedata", "readwait", "readcrc",
+"writecrc", "writewait1", "powerdown",
+"powerup", "writestart1", "writestart2",
+"genpulses", "writewait2", "?",
+"startpowdown" };
+#endif /* NDEBUG */
+STATIC UINT32 mLastGoodCmd = MMC_GET_INDX(MMC_CMD0);
+
+STATIC inline BOOLEAN
+IsAppCmd(
+  VOID
+  )
+{
+  return mLastGoodCmd == MMC_CMD55;
+}
+
+STATIC BOOLEAN
+IsBusyCmd(
+  IN  UINT32 MmcCmd
+  )
+{
+  if (IsAppCmd()) {
+return FALSE;
+  }
+
+  return MmcCmd == MMC_CMD7 || MmcCmd == MMC_CMD12;
+}
+
+STATIC BOOLEAN
+IsWriteCmd(
+  IN  UINT32 MmcCmd
+  )
+{
+  if (IsAppCmd()) {
+return FALSE;
+  }
+
+  return MmcCmd == MMC_CMD24 || MmcCmd == MMC_CMD25;
+}
+
+STATIC BOOLEAN
+IsReadCmd(
+  IN  UINT32 MmcCmd,
+  IN  UINT32 Argument
+  )
+{
+  if (MmcCmd == MMC_CMD8 && !IsAppCmd()) {
+if (Argument == CMD8_MMC_ARG) {
+  DEBUG((DEBUG_MMCHOST_SD, "Sending MMC CMD8 variant\n"));
+  return TRUE;
+} else {
+  ASSERT (Argument == CMD8_SD_ARG);
+  DEBUG((DEBUG_MMCHOST_SD, "Sending SD CMD8 variant\n"));
+  return FALSE;
+}
+  }
+
+  return
+(MmcCmd == MMC_CMD6 && !IsAppCmd()) ||
+(MmcCmd == MMC_CMD17 && !IsAppCmd()) ||
+(MmcCmd == MMC_CMD18 && !IsAppCmd()) ||
+(MmcCmd == MMC_CMD13 && IsAppCmd()) ||
+(MmcCmd == MMC_ACMD22 && IsAppCmd()) ||
+(MmcCmd == MMC_ACMD51 && IsAppCmd());
+}
+
+STATIC VOID
+SdHostDumpRegisters(
+  VOID
+  )
+{
+  DEBUG((DEBUG_MMCHOST_SD, "SdHost: Registers Dump:\n"));
+  DEBUG((DEBUG_MMCHOST_SD, "  CMD:  0x%8.8X\n", MmioRead32(SDHOST_CMD)));
+  DEBUG((DEBUG_MMCHOST_SD, "  ARG:  0x%8.8X\n", MmioRead32(SDHOST_ARG)));
+  DEBUG((DEBUG_MMCHOST_SD, "  TOUT: 0x%8.8X\n", MmioRead32(SDHOST_TOUT)));
+  DEBUG((DEBUG_MMCHOST_SD, "  CDIV: 0x%8.8X\n", MmioRead32(SDHOST_CDIV)));
+  DEBUG((DEBUG_MMCHOST_SD, "  RSP0: 0x%8.8X\n", MmioRead32(SDHOST_RSP0)));
+  DEBUG((DEBUG_MMCHOST_SD, "  RSP1: 0x%8.8X\n", MmioRead32(SDHOST_RSP1)));
+  DEBUG((DEBUG_MMCHOST_SD, "  RSP2: 0x%8.8X\n", MmioRead32(SDHOST_RSP2)));
+  DEBUG((DEBUG_MMCHOST_SD, "  RSP3: 0x%8.8X\n", MmioRead32(SDHOST_RSP3)));
+  DEBUG((DEBUG_MMCHOST_SD, "  HSTS: 0x%8.8X\n", MmioRe

[edk2] [PATCH v2 edk2-platforms 11/20] Platform/Broadcom/RPi3: Add Arasan MMC driver

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.c   | 730 

 Platform/Broadcom/Bcm283x/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.h   |  50 
++
 Platform/Broadcom/Bcm283x/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf |  53 
++
 Platform/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836MmcHs.h   | 199 
++
 4 files changed, 1032 insertions(+)

diff --git 
a/Platform/Broadcom/Bcm283x/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.c 
b/Platform/Broadcom/Bcm283x/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.c
new file mode 100644
index ..a070b6d5d8d9
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.c
@@ -0,0 +1,730 @@
+/** @file
+ *
+ *  Copyright (c) 2017, Andrei Warkentin 
+ *  Copyright (c) Microsoft 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 "ArasanMmcHostDxe.h"
+
+#define DEBUG_MMCHOST_SD DEBUG_VERBOSE
+
+BOOLEAN PreviousIsCardPresent = FALSE;
+UINT32 LastExecutedCommand = (UINT32) -1;
+
+STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
+
+/**
+   These SD commands are optional, according to the SD Spec
+**/
+BOOLEAN
+IgnoreCommand(
+  UINT32 Command
+  )
+{
+  switch (Command) {
+  case MMC_CMD20:
+return TRUE;
+  default:
+return FALSE;
+  }
+}
+
+/**
+   Translates a generic SD command into the format used by the Arasan SD Host 
Controller
+**/
+UINT32
+TranslateCommand(
+  UINT32 Command,
+  UINT32 Argument
+  )
+{
+  UINT32 Translation = 0x;
+
+  if (LastExecutedCommand == CMD55) {
+switch (Command) {
+case MMC_CMD6:
+  Translation = ACMD6;
+  DEBUG((DEBUG_MMCHOST_SD, "ACMD6\n"));
+  break;
+case MMC_ACMD22:
+  Translation = ACMD22;
+  DEBUG((DEBUG_MMCHOST_SD, "ACMD22\n"));
+  break;
+case MMC_ACMD41:
+  Translation = ACMD41;
+  DEBUG((DEBUG_MMCHOST_SD, "ACMD41\n"));
+  break;
+case MMC_ACMD51:
+  Translation = ACMD51;
+  DEBUG((DEBUG_MMCHOST_SD, "ACMD51\n"));
+  break;
+default:
+  DEBUG((DEBUG_ERROR, "ArasanMMCHost: TranslateCommand(): Unrecognized App 
command: %d\n", Command));
+}
+  } else {
+switch (Command) {
+case MMC_CMD0:
+  Translation = CMD0;
+  break;
+case MMC_CMD1:
+  Translation = CMD1;
+  break;
+case MMC_CMD2:
+  Translation = CMD2;
+  break;
+case MMC_CMD3:
+  Translation = CMD3;
+  break;
+case MMC_CMD5:
+  Translation = CMD5;
+  break;
+case MMC_CMD6:
+  Translation = CMD6;
+  break;
+case MMC_CMD7:
+  Translation = CMD7;
+  break;
+case MMC_CMD8: {
+  if (Argument == CMD8_SD_ARG) {
+Translation = CMD8_SD;
+DEBUG((DEBUG_MMCHOST_SD, "Sending SD CMD8 variant\n"));
+  } else {
+ASSERT (Argument == CMD8_MMC_ARG);
+Translation = CMD8_MMC;
+DEBUG((DEBUG_MMCHOST_SD, "Sending MMC CMD8 variant\n"));
+  }
+  break;
+}
+case MMC_CMD9:
+  Translation = CMD9;
+  break;
+case MMC_CMD11:
+  Translation = CMD11;
+  break;
+case MMC_CMD12:
+  Translation = CMD12;
+  break;
+case MMC_CMD13:
+  Translation = CMD13;
+  break;
+case MMC_CMD16:
+  Translation = CMD16;
+  break;
+case MMC_CMD17:
+  Translation = CMD17;
+  break;
+case MMC_CMD18:
+  Translation = CMD18;
+  break;
+case MMC_CMD23:
+  Translation = CMD23;
+  break;
+case MMC_CMD24:
+  Translation = CMD24;
+  break;
+case MMC_CMD25:
+  Translation = CMD25;
+  break;
+case MMC_CMD55:
+  Translation = CMD55;
+  break;
+default:
+  DEBUG((DEBUG_ERROR, "ArasanMMCHost: TranslateCommand(): Unrecognized 
Command: %d\n", Command));
+}
+  }
+
+  return Translation;
+}
+
+/**
+   Repeatedly polls a register until its value becomes correct, or until 
MAX_RETRY_COUNT polls is reached
+**/
+EFI_STATUS
+PollRegisterWithMask(
+ IN UINTN Register,
+ IN UINTN Mask,
+ IN UINTN ExpectedValue
+ )
+{
+  UINTN RetryCount = 0;
+
+  while (RetryCount < MAX_RETRY_COUNT) {
+if ((MmioRead32(Register) & Mask) != ExpectedValue) {
+  RetryCount++;
+  gBS->Stall(STALL_AFTER_RETRY_US);
+} else {
+  break;
+}
+  }
+
+  if (RetryCount == MAX_RETRY_COUNT) {
+return EFI_TIMEOUT;
+  }
+
+  return EFI_SUCCESS;
+}
+
+STATIC
+EFI_STATUS
+S

[edk2] [PATCH v2 edk2-platforms 10/20] Platform/Broadcom/RPi3: Add Base MMC driver

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Drivers/PiMmcDxe/ComponentName.c | 163 
 Platform/Broadcom/Bcm283x/Drivers/PiMmcDxe/Diagnostics.c   | 256 +
 Platform/Broadcom/Bcm283x/Drivers/PiMmcDxe/Mmc.c   | 458 +
 Platform/Broadcom/Bcm283x/Drivers/PiMmcDxe/Mmc.h   | 533 
+++
 Platform/Broadcom/Bcm283x/Drivers/PiMmcDxe/MmcBlockIo.c| 473 ++
 Platform/Broadcom/Bcm283x/Drivers/PiMmcDxe/MmcDebug.c  | 169 
 Platform/Broadcom/Bcm283x/Drivers/PiMmcDxe/MmcDxe.inf  |  58 ++
 Platform/Broadcom/Bcm283x/Drivers/PiMmcDxe/MmcIdentification.c | 993 

 Platform/Broadcom/Bcm283x/Include/Protocol/DwUsb.h |  53 ++
 Platform/Broadcom/Bcm283x/Include/Protocol/PiMmcHost.h | 187 
 10 files changed, 3343 insertions(+)

diff --git a/Platform/Broadcom/Bcm283x/Drivers/PiMmcDxe/ComponentName.c 
b/Platform/Broadcom/Bcm283x/Drivers/PiMmcDxe/ComponentName.c
new file mode 100644
index ..80eb4ff9a870
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Drivers/PiMmcDxe/ComponentName.c
@@ -0,0 +1,163 @@
+/** @file
+ *
+ *  Component Name Protocol implementation for the MMC DXE driver
+ *
+ *  Copyright (c) 2011, ARM Limited. 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 "Mmc.h"
+
+//
+// EFI Component Name Protocol
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gMmcComponentName = 
{
+  MmcGetDriverName,
+  MmcGetControllerName,
+  "eng"
+};
+
+//
+// EFI Component Name 2 Protocol
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gMmcComponentName2 
= {
+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) MmcGetDriverName,
+  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) MmcGetControllerName,
+  "en"
+};
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE
+mMmcDriverNameTable[] = {
+  {"eng;en", L"MMC/SD Card Interface Driver"},
+  {NULL,  NULL}
+};
+
+/**
+  Retrieves a Unicode string that is the user readable name of the driver.
+
+  This function retrieves the user readable name of a driver in the form of a
+  Unicode string. If the driver specified by This has a user readable name in
+  the language specified by Language, then a pointer to the driver name is
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
+  by This does not support the language specified by Language,
+  then EFI_UNSUPPORTED is returned.
+
+  @param  This  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL 
or
+EFI_COMPONENT_NAME_PROTOCOL instance.
+  @param  Language  A pointer to a Null-terminated ASCII string
+array indicating the language. This is the
+language of the driver name that the caller is
+requesting, and it must match one of the
+languages specified in SupportedLanguages. The
+number of languages supported by a driver is up
+to the driver writer. Language is specified
+in RFC 4646 or ISO 639-2 language code format.
+  @param  DriverNameA pointer to the Unicode string to return.
+This Unicode string is the name of the
+driver specified by This in the language
+specified by Language.
+
+  @retval EFI_SUCCESS   The Unicode string for the Driver specified by
+This and the language specified by Language was
+returned in DriverName.
+  @retval EFI_INVALID_PARAMETER Language is NULL.
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.
+  @retval EFI_UNSUPPORTED   The driver specified by This does not support
+the language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+MmcGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8*Language,
+  OUT CHAR16   **DriverName
+  )
+{
+  return LookupUnicodeString2 (
+   Language,
+   This->SupportedLanguages,
+   mMmcDriverNameTable,
+   DriverName,
+   (BOOLEAN)(This == &gMmcComponentName)
+   );
+}
+
+/**
+  Retrieves a Unicode string that is the user readable name of the controller
+  that is being managed by a driver.
+
+  This fun

[edk2] [PATCH v2 edk2-platforms 09/20] Platform/Broadcom/RPi3: Add Graphic Console driver

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Drivers/GraphicsConsoleDxe/ComponentName.c   
  |  183 ++
 Platform/Broadcom/Bcm283x/Drivers/GraphicsConsoleDxe/GraphicsConsole.c 
  | 1836 
 Platform/Broadcom/Bcm283x/Drivers/GraphicsConsoleDxe/GraphicsConsole.h 
  |  591 +++
 Platform/Broadcom/Bcm283x/Drivers/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
  |   74 +
 Platform/Broadcom/Bcm283x/Drivers/GraphicsConsoleDxe/GraphicsConsoleDxe.uni
  |   19 +
 
Platform/Broadcom/Bcm283x/Drivers/GraphicsConsoleDxe/GraphicsConsoleDxeExtra.uni
 |   20 +
 Platform/Broadcom/Bcm283x/Drivers/GraphicsConsoleDxe/NewFont.c 
  |  288 +++
 Platform/Broadcom/Bcm283x/Include/Protocol/ExtendedTextOut.h   
  |   36 +
 8 files changed, 3047 insertions(+)

diff --git 
a/Platform/Broadcom/Bcm283x/Drivers/GraphicsConsoleDxe/ComponentName.c 
b/Platform/Broadcom/Bcm283x/Drivers/GraphicsConsoleDxe/ComponentName.c
new file mode 100644
index ..e5935b19a250
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Drivers/GraphicsConsoleDxe/ComponentName.c
@@ -0,0 +1,183 @@
+/** @file
+ *
+ *  Copyright (c) 2018, Andrei Warkentin 
+ *  Copyright (c) 2006-2016, Intel Corporation. All rights reserved.
+ *
+ *  This program and the accompanying materials
+ *  are licensed and made available under the terms and conditions of the BSD 
License
+ *  which accompanies this distribution.  The full text of the license may be 
found at
+ *  http://opensource.org/licenses/bsd-license.php
+ *
+ *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+ *
+ **/
+
+#include "GraphicsConsole.h"
+
+//
+// EFI Component Name Protocol
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  
gGraphicsConsoleComponentName = {
+  GraphicsConsoleComponentNameGetDriverName,
+  GraphicsConsoleComponentNameGetControllerName,
+  "eng"
+};
+
+//
+// EFI Component Name 2 Protocol
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL 
gGraphicsConsoleComponentName2 = {
+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) 
GraphicsConsoleComponentNameGetDriverName,
+  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) 
GraphicsConsoleComponentNameGetControllerName,
+  "en"
+};
+
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE 
mGraphicsConsoleDriverNameTable[] = {
+  {
+"eng;en",
+(CHAR16 *)L"Graphics Console Driver"
+  },
+  {
+NULL,
+NULL
+  }
+};
+
+/**
+  Retrieves a Unicode string that is the user readable name of the driver.
+
+  This function retrieves the user readable name of a driver in the form of a
+  Unicode string. If the driver specified by This has a user readable name in
+  the language specified by Language, then a pointer to the driver name is
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
+  by This does not support the language specified by Language,
+  then EFI_UNSUPPORTED is returned.
+
+  @param  This[in]  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL 
or
+EFI_COMPONENT_NAME_PROTOCOL instance.
+
+  @param  Language[in]  A pointer to a Null-terminated ASCII string
+array indicating the language. This is the
+language of the driver name that the caller is
+requesting, and it must match one of the
+languages specified in SupportedLanguages. The
+number of languages supported by a driver is up
+to the driver writer. Language is specified
+in RFC 4646 or ISO 639-2 language code format.
+
+  @param  DriverName[out]   A pointer to the Unicode string to return.
+This Unicode string is the name of the
+driver specified by This in the language
+specified by Language.
+
+  @retval EFI_SUCCESS   The Unicode string for the Driver specified by
+This and the language specified by Language was
+returned in DriverName.
+
+  @retval EFI_INVALID_PARAMETER Language is NULL.
+
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.
+
+  @retval EFI_UNSUPPORTED   The driver specified by This does not support
+the language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+GraphicsConsoleComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8*Language,
+  OUT CHAR16   **DriverName
+  )
+{
+  return LookupUnicodeString2 (
+   Language,
+   This->SupportedLanguages,
+   mGraphicsConsoleDriverNameTable,
+

[edk2] [PATCH v2 edk2-platforms 08/20] Platform/Broadcom/RPi3: Add Display driver

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Drivers/DisplayDxe/ComponentName.c | 222 +++
 Platform/Broadcom/Bcm283x/Drivers/DisplayDxe/DisplayDxe.c| 606 

 Platform/Broadcom/Bcm283x/Drivers/DisplayDxe/DisplayDxe.h|  43 ++
 Platform/Broadcom/Bcm283x/Drivers/DisplayDxe/DisplayDxe.inf  |  71 +++
 Platform/Broadcom/Bcm283x/Drivers/DisplayDxe/Screenshot.c| 379 
 5 files changed, 1321 insertions(+)

diff --git a/Platform/Broadcom/Bcm283x/Drivers/DisplayDxe/ComponentName.c 
b/Platform/Broadcom/Bcm283x/Drivers/DisplayDxe/ComponentName.c
new file mode 100644
index ..e639826c60b1
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Drivers/DisplayDxe/ComponentName.c
@@ -0,0 +1,222 @@
+/** @file
+ *
+ *  Copyright (c) 2018, Andrei Warkentin 
+ *  Copyright (c) 2006-2016, Intel Corporation. All rights reserved.
+ *
+ *  This program and the accompanying materials
+ *  are licensed and made available under the terms and conditions of the BSD 
License
+ *  which accompanies this distribution.  The full text of the license may be 
found at
+ *  http://opensource.org/licenses/bsd-license.php
+ *
+ *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+ *
+ **/
+
+#include "DisplayDxe.h"
+
+STATIC
+EFI_STATUS
+EFIAPI
+ComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8*Language,
+  OUT CHAR16   **DriverName
+);
+
+STATIC
+EFI_STATUS
+EFIAPI
+ComponentNameGetControllerName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL *This,
+  IN  EFI_HANDLE  ControllerHandle,
+  IN  EFI_HANDLE  ChildHandle,
+  IN  CHAR8   *Language,
+  OUT CHAR16  **ControllerName
+  );
+
+//
+// EFI Component Name Protocol
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gComponentName = {
+  ComponentNameGetDriverName,
+  ComponentNameGetControllerName,
+  "eng"
+};
+
+//
+// EFI Component Name 2 Protocol
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 = {
+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ComponentNameGetDriverName,
+  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ComponentNameGetControllerName,
+  "en"
+};
+
+
+STATIC EFI_UNICODE_STRING_TABLE mDriverName[] = {
+  {
+"eng;en",
+(CHAR16 *)L"Raspberry Pi Display Driver"
+  },
+  {
+NULL,
+NULL
+  }
+};
+
+STATIC EFI_UNICODE_STRING_TABLE mDeviceName[] = {
+  {
+"eng;en",
+(CHAR16 *)L"Raspberry Pi Framebuffer"
+  },
+  {
+NULL,
+NULL
+  }
+};
+
+/**
+  Retrieves a Unicode string that is the user readable name of the driver.
+
+  This function retrieves the user readable name of a driver in the form of a
+  Unicode string. If the driver specified by This has a user readable name in
+  the language specified by Language, then a pointer to the driver name is
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
+  by This does not support the language specified by Language,
+  then EFI_UNSUPPORTED is returned.
+
+  @param  This[in]  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL 
or
+EFI_COMPONENT_NAME_PROTOCOL instance.
+
+  @param  Language[in]  A pointer to a Null-terminated ASCII string
+array indicating the language. This is the
+language of the driver name that the caller is
+requesting, and it must match one of the
+languages specified in SupportedLanguages. The
+number of languages supported by a driver is up
+to the driver writer. Language is specified
+in RFC 4646 or ISO 639-2 language code format.
+
+  @param  DriverName[out]   A pointer to the Unicode string to return.
+This Unicode string is the name of the
+driver specified by This in the language
+specified by Language.
+
+  @retval EFI_SUCCESS   The Unicode string for the Driver specified by
+This and the language specified by Language was
+returned in DriverName.
+
+  @retval EFI_INVALID_PARAMETER Language is NULL.
+
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.
+
+  @retval EFI_UNSUPPORTED   The driver specified by This does not support
+the language specified by Language.
+
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+ComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8*Language,
+  OUT CHAR16   **DriverName
+  )
+{
+  return Looku

[edk2] [PATCH v2 edk2-platforms 07/20] Platform/Broadcom/RPi3: Add Firmware driver

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c   | 1085 

 Platform/Broadcom/Bcm283x/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf |   49 +
 Platform/Broadcom/Bcm283x/Include/Protocol/RaspberryPiFirmware.h|  131 +++
 3 files changed, 1265 insertions(+)

diff --git a/Platform/Broadcom/Bcm283x/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c 
b/Platform/Broadcom/Bcm283x/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
new file mode 100644
index ..50f3ed3f1e36
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
@@ -0,0 +1,1085 @@
+/** @file
+ *
+ *  Copyright (c) 2017-2018, Andrei Warkentin 
+ *  Copyright (c) 2016, Linaro, Ltd. All rights reserved.
+ *
+ *  This program and the accompanying materials
+ *  are licensed and made available under the terms and conditions of the BSD 
License
+ *  which accompanies this distribution.  The full text of the license may be 
found at
+ *  http://opensource.org/licenses/bsd-license.php
+ *
+ *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+ *
+ **/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+//
+// The number of statically allocated buffer pages
+//
+#define NUM_PAGES   1
+
+//
+// The number of iterations to perform when waiting for the mailbox
+// status to change
+//
+#define MAX_TRIES   0x10
+
+STATIC VOID  *mDmaBuffer;
+STATIC VOID  *mDmaBufferMapping;
+STATIC UINTN mDmaBufferBusAddress;
+
+STATIC SPIN_LOCK mMailboxLock;
+
+STATIC
+BOOLEAN
+DrainMailbox (
+  VOID
+  )
+{
+  INTNTries;
+  UINT32  Val;
+
+  //
+  // Get rid of stale response data in the mailbox
+  //
+  Tries = 0;
+  do {
+Val = MmioRead32 (BCM2836_MBOX_BASE_ADDRESS + BCM2836_MBOX_STATUS_OFFSET);
+if (Val & (1U << BCM2836_MBOX_STATUS_EMPTY)) {
+  return TRUE;
+}
+ArmDataSynchronizationBarrier ();
+MmioRead32 (BCM2836_MBOX_BASE_ADDRESS + BCM2836_MBOX_READ_OFFSET);
+  } while (++Tries < MAX_TRIES);
+
+  return FALSE;
+}
+
+STATIC
+BOOLEAN
+MailboxWaitForStatusCleared (
+  IN  UINTN   StatusMask
+  )
+{
+  INTNTries;
+  UINT32  Val;
+
+  //
+  // Get rid of stale response data in the mailbox
+  //
+  Tries = 0;
+  do {
+Val = MmioRead32 (BCM2836_MBOX_BASE_ADDRESS + BCM2836_MBOX_STATUS_OFFSET);
+if ((Val & StatusMask) == 0) {
+  return TRUE;
+}
+ArmDataSynchronizationBarrier ();
+  } while (++Tries < MAX_TRIES);
+
+  return FALSE;
+}
+
+STATIC
+EFI_STATUS
+MailboxTransaction (
+  INUINTN   Length,
+  INUINTN   Channel,
+  OUT   UINT32  *Result
+  )
+{
+  if (Channel >= BCM2836_MBOX_NUM_CHANNELS) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  //
+  // Get rid of stale response data in the mailbox
+  //
+  if (!DrainMailbox ()) {
+DEBUG ((DEBUG_ERROR, "%a: timeout waiting for mailbox to drain\n",
+  __FUNCTION__));
+return EFI_TIMEOUT;
+  }
+
+  //
+  // Wait for the 'output register full' bit to become clear
+  //
+  if (!MailboxWaitForStatusCleared (1U << BCM2836_MBOX_STATUS_FULL)) {
+DEBUG ((DEBUG_ERROR, "%a: timeout waiting for outbox to become empty\n",
+  __FUNCTION__));
+return EFI_TIMEOUT;
+  }
+
+  ArmDataSynchronizationBarrier ();
+
+  //
+  // Start the mailbox transaction
+  //
+  MmioWrite32 (BCM2836_MBOX_BASE_ADDRESS + BCM2836_MBOX_WRITE_OFFSET,
+(UINT32)((UINTN)mDmaBufferBusAddress | Channel));
+
+  ArmDataSynchronizationBarrier ();
+
+  //
+  // Wait for the 'input register empty' bit to clear
+  //
+  if (!MailboxWaitForStatusCleared (1U << BCM2836_MBOX_STATUS_EMPTY)) {
+DEBUG ((DEBUG_ERROR, "%a: timeout waiting for inbox to become full\n",
+  __FUNCTION__));
+return EFI_TIMEOUT;
+  }
+
+  //
+  // Read back the result
+  //
+  ArmDataSynchronizationBarrier ();
+  *Result = MmioRead32 (BCM2836_MBOX_BASE_ADDRESS + BCM2836_MBOX_READ_OFFSET);
+  ArmDataSynchronizationBarrier ();
+
+  return EFI_SUCCESS;
+}
+
+#pragma pack(1)
+typedef struct {
+  UINT32BufferSize;
+  UINT32Response;
+} RPI_FW_BUFFER_HEAD;
+
+typedef struct {
+  UINT32TagId;
+  UINT32TagSize;
+  UINT32TagValueSize;
+} RPI_FW_TAG_HEAD;
+
+typedef struct {
+  UINT32  DeviceId;
+  UINT32  PowerState;
+} RPI_FW_POWER_STATE_TAG;
+
+typedef struct {
+  RPI_FW_BUFFER_HEADBufferHead;
+  RPI_FW_TAG_HEAD   TagHead;
+  RPI_FW_POWER_STATE_TAGTagBody;
+  UINT32EndTag;
+} RPI_FW_SET_POWER_STATE_CMD;
+#pragma pack()
+
+STATIC
+EFI_STATUS
+EFIAPI
+RpiFirmwareSetPowerState (
+  IN  UINT32DeviceId,
+  IN  BOOLEAN   PowerState,
+  IN  BOOLEAN   Wait
+  )
+{
+  RPI_FW_SET_POWER_STATE_CMD  *Cmd;
+  EFI_STATUSStatus;
+  UINT32   

[edk2] [PATCH v2 edk2-platforms 06/20] Platform/Broadcom/RPi3: Add Interrupt and Device Tree drivers

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Drivers/Bcm2836InterruptDxe/Bcm2836InterruptDxe.c   
| 367 +++
 Platform/Broadcom/Bcm283x/Drivers/Bcm2836InterruptDxe/Bcm2836InterruptDxe.inf 
|  48 +++
 Platform/Broadcom/Bcm283x/Drivers/RpiFdtDxe/RpiFdtDxe.c   
| 370 
 Platform/Broadcom/Bcm283x/Drivers/RpiFdtDxe/RpiFdtDxe.inf 
|  53 +++
 4 files changed, 838 insertions(+)

diff --git 
a/Platform/Broadcom/Bcm283x/Drivers/Bcm2836InterruptDxe/Bcm2836InterruptDxe.c 
b/Platform/Broadcom/Bcm283x/Drivers/Bcm2836InterruptDxe/Bcm2836InterruptDxe.c
new file mode 100644
index ..dda61665031d
--- /dev/null
+++ 
b/Platform/Broadcom/Bcm283x/Drivers/Bcm2836InterruptDxe/Bcm2836InterruptDxe.c
@@ -0,0 +1,367 @@
+/** @file
+ *
+ *  Copyright (c) 2016, Linaro, Ltd. All rights reserved.
+ *
+ *  This program and the accompanying materials
+ *  are licensed and made available under the terms and conditions of the BSD 
License
+ *  which accompanies this distribution.  The full text of the license may be 
found at
+ *  http://opensource.org/licenses/bsd-license.php
+ *
+ *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+ *
+ **/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+//
+// This currently only implements support for the architected timer interrupts
+// on the per-CPU interrupt controllers.
+//
+#define NUM_IRQS(4)
+
+#ifdef MDE_CPU_AARCH64
+#define ARM_ARCH_EXCEPTION_IRQ  EXCEPT_AARCH64_IRQ
+#else
+#define ARM_ARCH_EXCEPTION_IRQ  EXCEPT_ARM_IRQ
+#endif
+
+STATIC CONST
+EFI_PHYSICAL_ADDRESS RegBase = FixedPcdGet32 (PcdInterruptBaseAddress);
+
+//
+// Notifications
+//
+STATIC EFI_EVENTmExitBootServicesEvent;
+STATIC HARDWARE_INTERRUPT_HANDLER   mRegisteredInterruptHandlers[NUM_IRQS];
+
+/**
+  Shutdown our hardware
+
+  DXE Core will disable interrupts and turn off the timer and disable 
interrupts
+  after all the event handlers have run.
+
+  @param[in]  Event   The Event that is being processed
+  @param[in]  Context Event Context
+**/
+STATIC
+VOID
+EFIAPI
+ExitBootServicesEvent (
+  IN EFI_EVENT  Event,
+  IN VOID   *Context
+  )
+{
+  // Disable all interrupts
+  MmioWrite32 (RegBase + BCM2836_INTC_TIMER_CONTROL_OFFSET, 0);
+}
+
+/**
+  Enable interrupt source Source.
+
+  @param This Instance pointer for this protocol
+  @param Source   Hardware source of the interrupt
+
+  @retval EFI_SUCCESS   Source interrupt enabled.
+  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.
+
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+EnableInterruptSource (
+  IN EFI_HARDWARE_INTERRUPT_PROTOCOL*This,
+  IN HARDWARE_INTERRUPT_SOURCE  Source
+  )
+{
+  if (Source >= NUM_IRQS) {
+ASSERT(FALSE);
+return EFI_UNSUPPORTED;
+  }
+
+  MmioOr32 (RegBase + BCM2836_INTC_TIMER_CONTROL_OFFSET, 1 << Source);
+
+  return EFI_SUCCESS;
+}
+
+
+/**
+  Disable interrupt source Source.
+
+  @param This Instance pointer for this protocol
+  @param Source   Hardware source of the interrupt
+
+  @retval EFI_SUCCESS   Source interrupt disabled.
+  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.
+
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+DisableInterruptSource (
+  IN EFI_HARDWARE_INTERRUPT_PROTOCOL*This,
+  IN HARDWARE_INTERRUPT_SOURCE  Source
+  )
+{
+  if (Source >= NUM_IRQS) {
+ASSERT(FALSE);
+return EFI_UNSUPPORTED;
+  }
+
+  MmioAnd32 (RegBase + BCM2836_INTC_TIMER_CONTROL_OFFSET, ~(1 << Source));
+
+  return EFI_SUCCESS;
+}
+
+/**
+  Register Handler for the specified interrupt source.
+
+  @param This Instance pointer for this protocol
+  @param Source   Hardware source of the interrupt
+  @param Handler  Callback for interrupt. NULL to unregister
+
+  @retval EFI_SUCCESS Source was updated to support Handler.
+  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.
+
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+RegisterInterruptSource (
+  IN EFI_HARDWARE_INTERRUPT_PROTOCOL*This,
+  IN HARDWARE_INTERRUPT_SOURCE  Source,
+  IN HARDWARE_INTERRUPT_HANDLER Handler
+  )
+{
+  if (Source >= NUM_IRQS) {
+ASSERT (FALSE);
+return EFI_UNSUPPORTED;
+  }
+
+  if (Handler == NULL && mRegisteredInterruptHandlers[Source] == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  if (Handler != NULL && mRegisteredInterruptHandlers[Source] != NULL) {
+return EFI_ALREADY_STARTED;
+  }
+
+  mRegisteredInterruptHandlers[Source] = Handler;
+  return EnableInterruptSource(This, Source);
+}
+
+
+/**
+  Return current state of interrupt source Source.
+
+  @param This Instance pointer for this protocol
+  @param Source   Hardware source of the interrupt
+  @param InterruptState  TRUE: source enabled, FALSE: sour

[edk2] [PATCH v2 edk2-platforms 05/20] Platform/Broadcom/RPi3: Add Boot Manager library

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Library/PlatformBootManagerLib/PlatformBm.c  
 | 831 
 Platform/Broadcom/Bcm283x/Library/PlatformBootManagerLib/PlatformBm.h  
 |  60 ++
 
Platform/Broadcom/Bcm283x/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
 |  90 +++
 3 files changed, 981 insertions(+)

diff --git 
a/Platform/Broadcom/Bcm283x/Library/PlatformBootManagerLib/PlatformBm.c 
b/Platform/Broadcom/Bcm283x/Library/PlatformBootManagerLib/PlatformBm.c
new file mode 100644
index ..58eeb117c769
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Library/PlatformBootManagerLib/PlatformBm.c
@@ -0,0 +1,831 @@
+/** @file
+ *
+ *  Copyright (c) 2018, Pete Batard 
+ *  Copyright (c) 2017-2018, Andrei Warkentin 
+ *  Copyright (c) 2016, Linaro Ltd. All rights reserved.
+ *  Copyright (c) 2015-2016, Red Hat, Inc.
+ *  Copyright (c) 2014, ARM Ltd. All rights reserved.
+ *  Copyright (c) 2004-2016, Intel Corporation. All rights reserved.
+ *
+ *  This program and the accompanying materials
+ *  are licensed and made available under the terms and conditions of the BSD 
License
+ *  which accompanies this distribution.  The full text of the license may be 
found at
+ *  http://opensource.org/licenses/bsd-license.php
+ *
+ *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+ *
+ **/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "PlatformBm.h"
+
+#define BOOT_PROMPT L"ESC (setup), F1 (shell), ENTER (boot)"
+
+#define DP_NODE_LEN(Type) { (UINT8)sizeof (Type), (UINT8)(sizeof (Type) >> 8) }
+
+#pragma pack (1)
+typedef struct {
+  VENDOR_DEVICE_PATH SerialDxe;
+  UART_DEVICE_PATH   Uart;
+  VENDOR_DEFINED_DEVICE_PATH TermType;
+  EFI_DEVICE_PATH_PROTOCOL   End;
+} PLATFORM_SERIAL_CONSOLE;
+#pragma pack ()
+
+typedef struct {
+  VENDOR_DEVICE_PATHCustom;
+  USB_DEVICE_PATH   Hub;
+  USB_DEVICE_PATH   Dev;
+  EFI_DEVICE_PATH_PROTOCOL  EndDevicePath;
+} PLATFORM_USB_DEV;
+
+typedef struct {
+  VENDOR_DEVICE_PATHCustom;
+  EFI_DEVICE_PATH_PROTOCOL  EndDevicePath;
+} PLATFORM_SD_DEV;
+
+#define DW_USB_DXE_FILE_GUID { \
+  0x4bf1704c, 0x03f4, 0x46d5, \
+  { 0xbc, 0xa6, 0x82, 0xfa, 0x58, 0x0b, 0xad, 0xfd } \
+  }
+
+#define ARASAN_MMC_DXE_FILE_GUID { \
+  0x100c2cfa, 0xb586, 0x4198, \
+  { 0x9b, 0x4c, 0x16, 0x83, 0xd1, 0x95, 0xb1, 0xda } \
+  }
+
+#define SDHOST_MMC_DXE_FILE_GUID { \
+  0x58abd787, 0xf64d, 0x4ca2, \
+  { 0xa0, 0x34, 0xb9, 0xac, 0x2d, 0x5a, 0xd0, 0xcf } \
+  }
+
+STATIC PLATFORM_SD_DEV mArasan = {
+  //
+  // VENDOR_DEVICE_PATH ArasanMMCHostDxe
+  //
+  {
+{ HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DP_NODE_LEN (VENDOR_DEVICE_PATH) },
+ARASAN_MMC_DXE_FILE_GUID
+  },
+
+  //
+  // EFI_DEVICE_PATH_PROTOCOL End
+  //
+  {
+END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
+DP_NODE_LEN (EFI_DEVICE_PATH_PROTOCOL)
+  }
+};
+
+STATIC PLATFORM_SD_DEV mSDHost = {
+  //
+  // VENDOR_DEVICE_PATH SdHostDxe
+  //
+  {
+{ HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DP_NODE_LEN (VENDOR_DEVICE_PATH) },
+SDHOST_MMC_DXE_FILE_GUID
+  },
+
+  //
+  // EFI_DEVICE_PATH_PROTOCOL End
+  //
+  {
+END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
+DP_NODE_LEN (EFI_DEVICE_PATH_PROTOCOL)
+  }
+};
+
+STATIC PLATFORM_USB_DEV mUsbHubPort = {
+  //
+  // VENDOR_DEVICE_PATH DwUsbHostDxe
+  //
+  {
+{ HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DP_NODE_LEN (VENDOR_DEVICE_PATH) },
+DW_USB_DXE_FILE_GUID
+  },
+
+  //
+  // USB_DEVICE_PATH Hub
+  //
+  {
+{ MESSAGING_DEVICE_PATH, MSG_USB_DP, DP_NODE_LEN (USB_DEVICE_PATH) },
+0, 0
+  },
+
+  //
+  // USB_DEVICE_PATH Dev
+  //
+  {
+{ MESSAGING_DEVICE_PATH, MSG_USB_DP, DP_NODE_LEN (USB_DEVICE_PATH) },
+1, 0
+  },
+
+  //
+  // EFI_DEVICE_PATH_PROTOCOL End
+  //
+  {
+END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
+DP_NODE_LEN (EFI_DEVICE_PATH_PROTOCOL)
+  }
+};
+
+#define SERIAL_DXE_FILE_GUID { \
+  0xD3987D4B, 0x971A, 0x435F, \
+  { 0x8C, 0xAF, 0x49, 0x67, 0xEB, 0x62, 0x72, 0x41 } \
+  }
+
+STATIC PLATFORM_SERIAL_CONSOLE mSerialConsole = {
+  //
+  // VENDOR_DEVICE_PATH SerialDxe
+  //
+  {
+{ HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DP_NODE_LEN (VENDOR_DEVICE_PATH) },
+SERIAL_DXE_FILE_GUID
+  },
+
+  //
+  // UART_DEVICE_PATH Uart
+  //
+  {
+{ MESSAGING_DEVICE_PATH, MSG_UART_DP, DP_NODE_LEN (UART_DEVICE_PATH) },
+0,  // Reserved
+FixedPcdGet64 (PcdUartDefaultBaudRate), // BaudRate
+FixedPcdGet8 (PcdUartDefaultDataBits),  // DataBits
+FixedPcdGet8 (PcdUar

[edk2] [PATCH v2 edk2-platforms 04/20] Platform/Broadcom/RPi3: Add ACPI Tables

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/AcpiTables/AcpiTables.inf |  51 ++
 Platform/Broadcom/Bcm283x/AcpiTables/Csrt.aslc  | 337 +
 Platform/Broadcom/Bcm283x/AcpiTables/Dbg2.aslc  |  32 ++
 Platform/Broadcom/Bcm283x/AcpiTables/Dsdt.asl   | 523 
 Platform/Broadcom/Bcm283x/AcpiTables/Fadt.aslc  |  50 ++
 Platform/Broadcom/Bcm283x/AcpiTables/Gtdt.aslc  |  31 ++
 Platform/Broadcom/Bcm283x/AcpiTables/Madt.aslc  |  60 +++
 Platform/Broadcom/Bcm283x/AcpiTables/Pep.asl|  92 
 Platform/Broadcom/Bcm283x/AcpiTables/Pep.c  |  84 
 Platform/Broadcom/Bcm283x/AcpiTables/Pep.h  | 126 +
 Platform/Broadcom/Bcm283x/AcpiTables/Platform.h |  82 +++
 Platform/Broadcom/Bcm283x/AcpiTables/Rhpx.asl   | 201 
 Platform/Broadcom/Bcm283x/AcpiTables/Sdhc.asl   | 105 
 Platform/Broadcom/Bcm283x/AcpiTables/Spcr.asl   |  53 ++
 Platform/Broadcom/Bcm283x/AcpiTables/Uart.asl   | 155 ++
 15 files changed, 1982 insertions(+)

diff --git a/Platform/Broadcom/Bcm283x/AcpiTables/AcpiTables.inf 
b/Platform/Broadcom/Bcm283x/AcpiTables/AcpiTables.inf
new file mode 100644
index ..db0270270cf9
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/AcpiTables/AcpiTables.inf
@@ -0,0 +1,51 @@
+#/** @file
+#
+#  ACPI table data and ASL sources required to boot the platform.
+#
+#  Copyright (c) 2017, Andrey Warkentin 
+#  Copyright (c) Microsoft 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  = AcpiTables
+  FILE_GUID  = 7E374E25-8E01-4FEE-87F2-390C23C606CD
+  MODULE_TYPE= USER_DEFINED
+  VERSION_STRING = 1.0
+
+#
+# The following information is for reference only and not required by the 
build tools.
+#
+#  VALID_ARCHITECTURES   = AARCH64
+#
+
+[Sources]
+  Platform.h
+  Madt.aslc
+  Fadt.aslc
+  Dbg2.aslc
+  Gtdt.aslc
+  Dsdt.asl
+  Csrt.aslc
+  Spcr.asl
+
+[Packages]
+  MdePkg/MdePkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+
+[FixedPcd]
+  gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress
+
+[BuildOptions]
+  # The default '-mcmodel=small' used with DEBUG produces a GenFw error when 
compiling CSRT.acpi:
+  # "AARCH64 small code model requires identical ELF and PE/COFF section 
offsets modulo 4 KB."
+  GCC:DEBUG_*_AARCH64_CC_FLAGS = -mcmodel=tiny
diff --git a/Platform/Broadcom/Bcm283x/AcpiTables/Csrt.aslc 
b/Platform/Broadcom/Bcm283x/AcpiTables/Csrt.aslc
new file mode 100644
index ..926942ec8da3
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/AcpiTables/Csrt.aslc
@@ -0,0 +1,337 @@
+/** @file
+ *
+ *  Core System Resource Table (CSRT)
+ *
+ *  Copyright (c) Microsoft 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 "Platform.h"
+
+#define DMA_MAX_REQ_LINES 32
+
+#pragma pack(push, 1)
+
+//
+// DMA Controller Vendor Data for RPi3
+//
+typedef struct
+{
+UINT32 Length;
+UINT32 Type;
+UINT64 ChannelsBaseAddress;
+UINT32 ChannelsBaseSize;
+UINT64 ControllerBaseAddress;
+UINT32 ControllerBaseSize;
+UINT32 ChannelCount;
+UINT32 ControllerInterrupt;
+UINT32 MinimumRequestLine;
+UINT32 MaximumRequestLine;
+BOOLEAN CacheCoherent;
+} DMA_CONTROLLER_VENDOR_DATA;
+
+//
+// DMA Controller on RPi3
+//
+typedef struct
+{
+EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER DmaControllerHeader;
+DMA_CONTROLLER_VENDOR_DATA ControllerVendorData;
+} RD_DMA_CONTROLLER;
+
+//
+// DMA Channel Vendor Data for RPi3
+//
+typedef struct
+{
+UINT32 ChannelNumber;
+UINT32 Chann

[edk2] [PATCH v2 edk2-platforms 03/20] Platform/Broadcom/RPi3: Add GPIO and RTC libraries

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2837Gpio.h   
   |  50 +
 Platform/Broadcom/Bcm283x/Include/Library/GpioLib.h
   |  33 +++
 Platform/Broadcom/Bcm283x/Include/Utils.h  
   |  33 +++
 Platform/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c
   |  79 +++
 Platform/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf  
   |  39 
 
Platform/Broadcom/Bcm283x/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.c
   | 222 
 
Platform/Broadcom/Bcm283x/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
 |  43 
 7 files changed, 499 insertions(+)

diff --git a/Platform/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2837Gpio.h 
b/Platform/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2837Gpio.h
new file mode 100644
index ..27e6665f1745
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2837Gpio.h
@@ -0,0 +1,50 @@
+/** @file
+ *
+ *  Copyright (c) 2018, Andrei Warkentin 
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ *  This program and the accompanying materials
+ *  are licensed and made available under the terms and conditions of the BSD 
License
+ *  which accompanies this distribution.  The full text of the license may be 
found at
+ *  http://opensource.org/licenses/bsd-license.php
+ *
+ *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+ *
+ **/
+
+#ifndef __BCM2837GPIO_H__
+#define __BCM2837GPIO_H__
+
+#define GPIO_BASE_ADDRESS  (BCM2836_SOC_REGISTERS + 0x0020)
+
+#define GPIO_GPFSEL0   (GPIO_BASE_ADDRESS + 0x00)
+#define GPIO_GPFSEL1   (GPIO_BASE_ADDRESS + 0x04)
+#define GPIO_GPFSEL2   (GPIO_BASE_ADDRESS + 0x08)
+#define GPIO_GPFSEL3   (GPIO_BASE_ADDRESS + 0x0C)
+#define GPIO_GPFSEL4   (GPIO_BASE_ADDRESS + 0x10)
+#define GPIO_GPFSEL5   (GPIO_BASE_ADDRESS + 0x14)
+
+#define GPIO_GPCLR0(GPIO_BASE_ADDRESS + 0x28)
+#define GPIO_GPCLR1(GPIO_BASE_ADDRESS + 0x2C)
+
+#define GPIO_GPSET0(GPIO_BASE_ADDRESS + 0x1C)
+#define GPIO_GPSET1(GPIO_BASE_ADDRESS + 0x20)
+
+#define GPIO_FSEL_INPUT0x0
+#define GPIO_FSEL_OUTPUT   0x1
+#define GPIO_FSEL_ALT0 0x4
+#define GPIO_FSEL_ALT1 0x5
+#define GPIO_FSEL_ALT2 0x6
+#define GPIO_FSEL_ALT3 0x7
+#define GPIO_FSEL_ALT4 0x3
+#define GPIO_FSEL_ALT5 0x2
+
+#define GPIO_FSEL_PINS_PER_REGISTER 10
+#define GPIO_FSEL_BITS_PER_PIN  3
+#define GPIO_FSEL_MASK  ((1 << GPIO_FSEL_BITS_PER_PIN) - 1)
+
+#define GPIO_PINS  54
+
+#endif // __BCM2837GPIO_H__
+
diff --git a/Platform/Broadcom/Bcm283x/Include/Library/GpioLib.h 
b/Platform/Broadcom/Bcm283x/Include/Library/GpioLib.h
new file mode 100644
index ..ca9da4b11a87
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Include/Library/GpioLib.h
@@ -0,0 +1,33 @@
+/** @file
+ *
+ *  GPIO manipulation.
+ *
+ *  Copyright (c) 2018, Andrei Warkentin 
+ *
+ *  This program and the accompanying materials
+ *  are licensed and made available under the terms and conditions of the BSD 
License
+ *  which accompanies this distribution.  The full text of the license may be 
found at
+ *  http://opensource.org/licenses/bsd-license.php
+ *
+ *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+ *
+ **/
+
+#ifndef __GPIO_LIB__
+#define __GPIO_LIB__
+
+#include 
+
+VOID
+GpioPinFuncSet(
+  IN  UINTN Pin,
+  IN  UINTN Function
+  );
+
+UINTN
+GpioPinFuncGet(
+  IN  UINTN Pin
+  );
+
+#endif /* __GPIO_LIB__ */
diff --git a/Platform/Broadcom/Bcm283x/Include/Utils.h 
b/Platform/Broadcom/Bcm283x/Include/Utils.h
new file mode 100644
index ..47713275de3f
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Include/Utils.h
@@ -0,0 +1,33 @@
+/** @file
+ *
+ *  Copyright (c) 2018, Andrei Warkentin 
+ *
+ *  This program and the accompanying materials
+ *  are licensed and made available under the terms and conditions of the BSD 
License
+ *  which accompanies this distribution.  The full text of the license may be 
found at
+ *  http://opensource.org/licenses/bsd-license.php
+ *
+ *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+ *
+ **/
+
+#ifndef UTILS_H
+#define UTILS_H
+
+#define _IX_BITS(sm, bg) ((bg) - (sm) + 1)
+#define _IX_MASK(sm, bg) ((1ul << _IX_BITS((sm), (bg))) - 1)
+#define _X(val, sm, bg) ((val) >> (sm)) & _IX_MASK((sm), (bg))
+#define X(val, ix1, ix2) (((ix1) < (ix2)) ? _X((val), (ix1), (ix2)) :   \
+  _X((val), (ix2), (ix1)))
+
+#define _I(val, sm, bg)  (((va

[edk2] [PATCH v2 edk2-platforms 02/20] Platform/Broadcom/RPi3: Add Platform library

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h   
  |  70 +
 Platform/Broadcom/Bcm283x/Include/IndustryStandard/RpiFirmware.h   
  |  93 
 
Platform/Broadcom/Bcm283x/Library/RaspberryPiPlatformLib/AArch64/RaspberryPiHelper.S
 | 107 +
 Platform/Broadcom/Bcm283x/Library/RaspberryPiPlatformLib/RaspberryPi.c 
  |  99 
 Platform/Broadcom/Bcm283x/Library/RaspberryPiPlatformLib/RaspberryPiMem.c  
  | 160 
 
Platform/Broadcom/Bcm283x/Library/RaspberryPiPlatformLib/RaspberryPiPlatformLib.inf
  |  64 
 6 files changed, 593 insertions(+)

diff --git a/Platform/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h 
b/Platform/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
new file mode 100644
index ..bd30324ff073
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
@@ -0,0 +1,70 @@
+/** @file
+ *
+ *  Copyright (c) 2017, Andrei Warkentin 
+ *  Copyright (c) 2016, Linaro Limited. All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice, this
+ *  list of conditions and the following disclaimer.
+ *
+ *  Redistributions in binary form must reproduce the above copyright notice,
+ *  this list of conditions and the following disclaimer in the documentation
+ *  and/or other materials provided with the distribution.
+ *
+ *  Neither the name of ARM nor the names of its contributors may be used
+ *  to endorse or promote products derived from this software without specific
+ *  prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ *
+ **/
+
+/*
+ * Both "core" and SoC perpherals (1M each).
+ */
+#define BCM2836_SOC_REGISTERS   0x3f00
+#define BCM2836_SOC_REGISTER_LENGTH 0x0200
+
+/* Synopsis DW2/DWC USB 2.0 OTG. */
+#define BCM2836_USB_DW2_BASE_ADDRESS0x3f98
+
+/*
+ * Offset between the CPU's view and the VC's view of system memory.
+ */
+#define BCM2836_DMA_DEVICE_OFFSET   0xc000
+
+/* watchdog constants */
+#define BCM2836_WDOG_BASE_ADDRESS   0x3f10
+#define BCM2836_WDOG_PASSWORD   0x5a00
+#define BCM2836_WDOG_RSTC_OFFSET0x001c
+#define BCM2836_WDOG_WDOG_OFFSET0x0024
+#define BCM2836_WDOG_RSTC_WRCFG_MASK0x0030
+#define BCM2836_WDOG_RSTC_WRCFG_FULL_RESET  0x0020
+
+/* mailbox interface constants */
+#define BCM2836_MBOX_BASE_ADDRESS   0x3f00b880
+#define BCM2836_MBOX_READ_OFFSET0x
+#define BCM2836_MBOX_STATUS_OFFSET  0x0018
+#define BCM2836_MBOX_CONFIG_OFFSET  0x001c
+#define BCM2836_MBOX_WRITE_OFFSET   0x0020
+
+#define BCM2836_MBOX_STATUS_FULL0x1f
+#define BCM2836_MBOX_STATUS_EMPTY   0x1e
+
+#define BCM2836_MBOX_NUM_CHANNELS   16
+
+/* interrupt controller constants */
+#define BCM2836_INTC_TIMER_CONTROL_OFFSET   0x0040
+#define BCM2836_INTC_TIMER_PENDING_OFFSET   0x0060
diff --git a/Platform/Broadcom/Bcm283x/Include/IndustryStandard/RpiFirmware.h 
b/Platform/Broadcom/Bcm283x/Include/IndustryStandard/RpiFirmware.h
new file mode 100644
index ..83f8633c26cf
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Include/IndustryStandard/RpiFirmware.h
@@ -0,0 +1,93 @@
+/** @file
+ *
+ * Copyright (c) 2016, Linaro Limited. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain t

[edk2] [PATCH v2 edk2-platforms 01/20] Platform/Broadcom/RPi3: Add Reset and Memory Init libraries

2018-12-10 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Broadcom/Bcm283x/Library/MemoryInitPeiLib/MemoryInitPeiLib.c   | 183 

 Platform/Broadcom/Bcm283x/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf |  51 
++
 Platform/Broadcom/Bcm283x/Library/ResetLib/ResetLib.c   | 104 
+++
 Platform/Broadcom/Bcm283x/Library/ResetLib/ResetLib.inf |  46 
+
 4 files changed, 384 insertions(+)

diff --git 
a/Platform/Broadcom/Bcm283x/Library/MemoryInitPeiLib/MemoryInitPeiLib.c 
b/Platform/Broadcom/Bcm283x/Library/MemoryInitPeiLib/MemoryInitPeiLib.c
new file mode 100644
index ..81d810b5d428
--- /dev/null
+++ b/Platform/Broadcom/Bcm283x/Library/MemoryInitPeiLib/MemoryInitPeiLib.c
@@ -0,0 +1,183 @@
+/** @file
+ *
+ *  Copyright (c) 2017-2018, Andrey Warkentin 
+ *  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
+ *
+ *  This program and the accompanying materials
+ *  are licensed and made available under the terms and conditions of the BSD 
License
+ *  which accompanies this distribution.  The full text of the license may be 
found at
+ *  http://opensource.org/licenses/bsd-license.php
+ *
+ *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+ *
+ **/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+extern UINT64 mSystemMemoryEnd;
+
+VOID
+BuildMemoryTypeInformationHob (
+  VOID
+  );
+
+STATIC
+VOID
+InitMmu (
+  IN ARM_MEMORY_REGION_DESCRIPTOR  *MemoryTable
+  )
+{
+
+  VOID  *TranslationTableBase;
+  UINTN TranslationTableSize;
+  RETURN_STATUS Status;
+
+  //Note: Because we called PeiServicesInstallPeiMemory() before to call 
InitMmu() the MMU Page Table resides in
+  //  DRAM (even at the top of DRAM as it is the first permanent memory 
allocation)
+  Status = ArmConfigureMmu (MemoryTable, &TranslationTableBase, 
&TranslationTableSize);
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "Error: Failed to enable MMU\n"));
+  }
+}
+
+STATIC
+VOID
+AddAndRTSData(ARM_MEMORY_REGION_DESCRIPTOR *Desc)
+{
+  BuildResourceDescriptorHob (
+  EFI_RESOURCE_SYSTEM_MEMORY,
+  EFI_RESOURCE_ATTRIBUTE_PRESENT |
+  EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+  EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+  EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+  EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
+  EFI_RESOURCE_ATTRIBUTE_TESTED,
+  Desc->PhysicalBase,
+  Desc->Length
+  );
+
+  BuildMemoryAllocationHob (
+Desc->PhysicalBase,
+Desc->Length,
+EfiRuntimeServicesData
+);
+}
+
+STATIC
+VOID
+AddAndReserved(ARM_MEMORY_REGION_DESCRIPTOR *Desc)
+{
+  BuildResourceDescriptorHob (
+  EFI_RESOURCE_SYSTEM_MEMORY,
+  EFI_RESOURCE_ATTRIBUTE_PRESENT |
+  EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+  EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+  EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+  EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
+  EFI_RESOURCE_ATTRIBUTE_TESTED,
+  Desc->PhysicalBase,
+  Desc->Length
+  );
+
+  BuildMemoryAllocationHob (
+Desc->PhysicalBase,
+Desc->Length,
+EfiReservedMemoryType
+);
+}
+
+STATIC
+VOID
+AddAndMmio(ARM_MEMORY_REGION_DESCRIPTOR *Desc)
+{
+  BuildResourceDescriptorHob (
+  EFI_RESOURCE_SYSTEM_MEMORY,
+  (EFI_RESOURCE_ATTRIBUTE_PRESENT|
+   EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+   EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
+   EFI_RESOURCE_ATTRIBUTE_TESTED),
+  Desc->PhysicalBase,
+  Desc->Length
+  );
+
+  BuildMemoryAllocationHob (
+Desc->PhysicalBase,
+Desc->Length,
+EfiMemoryMappedIO
+);
+}
+
+/*++
+
+Routine Description:
+
+
+
+Arguments:
+
+  FileHandle  - Handle of the file being invoked.
+  PeiServices - Describes the list of possible PEI Services.
+
+Returns:
+
+  Status

[edk2] [PATCH v2 edk2-platforms 00/20] Platform/Broadcom: Add Raspberry Pi 3 support

2018-12-10 Thread Pete Batard
Version History:

* v2: Break down the content into logical entities of more manageable size.
  Please pay attention to the *NON-OSI* tagged patches, that should be
  applied to edk2-non-osi instead of edk2-platforms.

Preamble:

Because of its price point, ease of use and availability, the Raspberry Pi is
undeniably one of the most successful ARM platform in existence today. Its
widespread adoption therefore makes it a perfect fit as an EDK2 platform.

However, up until now, the Raspberry Pi hasn't been supported as a bona fide
platform in our repository. This series of patches remedies that by introducing
the Raspberry Pi 3 Model B and Model B+ as a viable EDK2 platforms.

With regards to the latter:
* Even though the ARM Trusted Firmware binary blobs are subject to a
  BSD-3-Clause licence, which may be compatible with the EDK2 one, we chose
  to follow the lead of other platforms that provide ATF binaries in non OSI.
* The Device Tree binaries (and source descriptors) are subject to a GPLv2
  license, as per the ones published by the Raspberry Pi Foundation.
* The DwUsbHostDxe driver is subject to a GPLv2 license
* The Logo source code is under an EDK2 license, but the logo itself, which
  we obtained authorisation to use from the Raspberry Pi Foundation itself,
  after detailing our planned usage, is subject to the trademark licensing
  terms put forward by the Raspberry Pi Foundation, and therefore we chose
  to move the whole Logo driver under non OSI.

Additional Notes:

* We chose to introduce the platform under Broadcom/Bcm283x/ as we consider
  first, that additional Broadcom platforms may be introduced, and second that
  even though only Bcm2837 (i.e. Pi 3) platforms are supported from the current
  RaspberryPiPkg, support may be added for Bcm2836 (Pi 2) in the future, hence
  our decision to use a generic Bcm283x/ subdirectory.
* The ARM Trusted Firmware being used is a vanilla version built from the
  latest tree, as we worked with that project to get necessary patches
  integrated.
* Detailed instructions on how to build and test the platform firmware are
  included in the Readme.md found at the root of the platform.
* As detailed in the Readme, the resulting platform firmware has been
  successfully used to install and run Linux OSes, such as Ubuntu 18.10, as
  well as Windows 10 1809 (*full* UI version, not IoT).

Regards,

/Pete

Pete Batard (16):
  Platform/Broadcom/RPi3: Add Reset and Memory Init libraries
  Platform/Broadcom/RPi3: Add Platform library
  Platform/Broadcom/RPi3: Add GPIO and RTC libraries
  Platform/Broadcom/RPi3: Add ACPI Tables
  Platform/Broadcom/RPi3: Add Boot Manager library
  Platform/Broadcom/RPi3: Add Interrupt and Device Tree drivers
  Platform/Broadcom/RPi3: Add Firmware driver
  Platform/Broadcom/RPi3: Add Display driver
  Platform/Broadcom/RPi3: Add Graphic Console driver
  Platform/Broadcom/RPi3: Add Base MMC driver
  Platform/Broadcom/RPi3: Add Arasan MMC driver
  Platform/Broadcom/RPi3: Add SD Host driver
  Platform/Broadcom/RPi3: Add SMBIOS driver
  Platform/Broadcom/RPi3: Add NV Storage driver
  Platform/Broadcom/RPi3: Add Platform Config driver
  Platform/Broadcom/RPi3: Add Raspberry Pi 3 Platform

 .../Bcm283x/AcpiTables/AcpiTables.inf |   51 +
 .../Broadcom/Bcm283x/AcpiTables/Csrt.aslc |  337 +++
 .../Broadcom/Bcm283x/AcpiTables/Dbg2.aslc |   32 +
 Platform/Broadcom/Bcm283x/AcpiTables/Dsdt.asl |  523 +
 .../Broadcom/Bcm283x/AcpiTables/Fadt.aslc |   50 +
 .../Broadcom/Bcm283x/AcpiTables/Gtdt.aslc |   31 +
 .../Broadcom/Bcm283x/AcpiTables/Madt.aslc |   60 +
 Platform/Broadcom/Bcm283x/AcpiTables/Pep.asl  |   92 +
 Platform/Broadcom/Bcm283x/AcpiTables/Pep.c|   84 +
 Platform/Broadcom/Bcm283x/AcpiTables/Pep.h|  126 ++
 .../Broadcom/Bcm283x/AcpiTables/Platform.h|   82 +
 Platform/Broadcom/Bcm283x/AcpiTables/Rhpx.asl |  201 ++
 Platform/Broadcom/Bcm283x/AcpiTables/Sdhc.asl |  105 +
 Platform/Broadcom/Bcm283x/AcpiTables/Spcr.asl |   53 +
 Platform/Broadcom/Bcm283x/AcpiTables/Uart.asl |  155 ++
 .../ArasanMmcHostDxe/ArasanMmcHostDxe.c   |  730 +++
 .../ArasanMmcHostDxe/ArasanMmcHostDxe.h   |   50 +
 .../ArasanMmcHostDxe/ArasanMmcHostDxe.inf |   53 +
 .../Bcm2836InterruptDxe/Bcm2836InterruptDxe.c |  367 
 .../Bcm2836InterruptDxe.inf   |   48 +
 .../Bcm283x/Drivers/ConfigDxe/ConfigDxe.c |  356 
 .../Bcm283x/Drivers/ConfigDxe/ConfigDxe.inf   |   81 +
 .../Drivers/ConfigDxe/ConfigDxeFormSetGuid.h  |   23 +
 .../Drivers/ConfigDxe/ConfigDxeHii.uni|  100 +
 .../Drivers/ConfigDxe/ConfigDxeHii.vfr|  306 +++
 .../Drivers/DisplayDxe/ComponentName.c|  222 ++
 .../Bcm283x/Drivers/DisplayDxe/DisplayDxe.c   |  606 ++
 .../Bcm283x/Drivers/DisplayDxe/DisplayDxe.h   |   43 +
 .../Bcm283x/Drivers/DisplayDxe/DisplayDxe.inf |   71 +
 .../Bcm283x/Drivers/DisplayDxe/Screenshot.c   |  379 
 .../GraphicsConsoleDxe/ComponentName.c|  183 ++
 .../Graphic

Re: [edk2] [RFC] Remove unused tool chain configuration in BaseTools/Conf/tools_def.template

2018-12-10 Thread Gao, Liming
Leif:
  Thanks for your suggestion. I will work out the patch set serials to remove 
those tool chains. I don't remember the usage model of UNIXGCC. II will wait 
for Rebecca response. 

Thanks
Liming
> -Original Message-
> From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> Sent: Monday, December 10, 2018 7:57 PM
> To: Gao, Liming 
> Cc: edk2-devel@lists.01.org; Laszlo Ersek (ler...@redhat.com) 
> ; af...@apple.com; Kinney, Michael D
> ; Rebecca Cran 
> Subject: Re: [RFC] Remove unused tool chain configuration in 
> BaseTools/Conf/tools_def.template
> 
> On Thu, Dec 06, 2018 at 02:42:35PM +, Gao, Liming wrote:
> > Hi, all
> >   tools_def.template includes all tool chains. Some are not used any
> >   more. And, there is no verification for them. So, I propose to
> >   remove them. They are VS2003, VS2005, VS2008, VS2010, DDK3790,
> >   UNIXGCC, GCC44, GCC45, GCC46, GCC47, ELFGCC, CYGGCC, ICC, ICC11,
> >   MYTOOLS. If you still use some one of them, please let me know.
> 
> This sounds good to me.
> 
> However, may I suggest splitting this up into several patches, such
> that if we need to revert one of the deletions, we would not need to
> reinstate all of them.
> 
> I would propose:
> - One patch for VS20nn
> - One patch for GCCnn
> - One patch for UNIXGCC, ELFGCC, CYGGCC
> 
> I can't really judge what a suitable mashup/split between DDK3790,
> ICC, ICC11, and MYTOOLS would be.
> 
> On a sidenote, I think Rebecca said at least FreeBSD were using
> UNIXGCC(?) since the plain GCC toolchain profiles did not support
> cross compiling. I am pretty sure that is not accurate these days -
> did you look into that after the community call?
> 
> Regards.
> 
> Leif
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Optimize string concatenation

2018-12-10 Thread Leif Lindholm
On Mon, Dec 10, 2018 at 12:09:23PM +, Feng, Bob C wrote:
> For the "customized deepcopy" and "cache for uni file parser" data,
> you can see the AutoGen is not slower. The whole Build Duration is
> longer because Make Duration is longer while Make Duration time
> depends on the external make, compiler and linker. So it's not the
> patch make the build slow down.
> 
> Yes,  it's not faster either. I think that because the Ovmf platform
> is relatively simple.  From the build tool source code point of
> view, the customized deepcopy will take effect if the platform
> enabled multiple SKU or there are many expressions in metadata file
> to be evaluated. And the "cache for uni file parser" needs there are
> many uni files.  The Ovmf platform looks not a good platform to demo
> the effect of this patch.

But surely we should not introduce patches said to improve performance
when the only data we have available shows that they slow things down?

If the performance data is not representative, then it is worthless.

Don't get me wrong - if you say "and for this secret platform I can't
share with you, it improves build performance by X", then I may be OK
with a minor slowdown on the platforms I do have available to test, if
X is not minor.

But if the improvement is only theoretical, and we have no evidence
that it helps real platforms, it should not be committed.

Regards,

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


Re: [edk2] [Patch V2] BaseTools: Fixed the build fail issue for cases

2018-12-10 Thread Leif Lindholm
Hi Bob,

On Mon, Dec 10, 2018 at 09:16:58AM +0800, BobCF wrote:
> From: "Feng, Bob C" 
> 
> V2:

Patch version information does not belong in the commit message.
It belongs in a cover letter, or if a cover letter is not used, you
can put these details below the --- line. This way it gets filtered
out by git.

The patch commit message should end up being a description of what the
patch is and does, not the development process that got us there.

Regards,

Leif

> update the commit log. This issue is introduced by
> the commit 72a1d77694d51914c0dd6aa97dbfa58634b0a4a5
> 
> V1:
> https://bugzilla.tianocore.org/show_bug.cgi?id=1386
> 1. There is no Pcd value assignment in Dsc file
> 2. There are duplicate Pcd filed assignment
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> ---
>  BaseTools/Source/Python/Workspace/BuildClassObject.py | 2 +-
>  BaseTools/Source/Python/Workspace/MetaFileParser.py   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
> b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> index 008eee1a16..d02232b546 100644
> --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> @@ -289,11 +289,11 @@ class StructurePcd(PcdClassObject):
>  if DefaultStoreName not in self.SkuOverrideValues[SkuName]:
>  self.SkuOverrideValues[SkuName][DefaultStoreName] = OrderedDict()
>  if DimensionAttr not in 
> self.SkuOverrideValues[SkuName][DefaultStoreName]:
>  self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr] 
> = collections.OrderedDict()
>  if FieldName in 
> self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr]:
> -del 
> self.SkuOverrideValues[SkuName][DefaultStoreName][FieldName][DimensionAttr]
> +del 
> self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName]
>  
> self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName] = 
> [Value.strip(), FileName, LineNo]
>  return 
> self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName]
>  
>  def SetPcdMode (self, PcdMode):
>  self.PcdMode = PcdMode
> diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py 
> b/BaseTools/Source/Python/Workspace/MetaFileParser.py
> index 4bd52619a9..eaedba0c12 100644
> --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
> +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
> @@ -1201,11 +1201,11 @@ class DscParser(MetaFileParser):
>  else:
>  self._ValueList = None
>  return
>  TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
>  self._CurrentPcdName = TokenList[0]
> -if TokenList[1].strip().startswith("{CODE"):
> +if len(TokenList) == 2 and TokenList[1].strip().startswith("{CODE"):
>  self._PcdDataTypeCODE = True
>  self._PcdCodeValue = TokenList[1].strip()
>  
>  if self._PcdDataTypeCODE:
>  if self._CurrentLine.endswith(")}"):
> -- 
> 2.19.1.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg/FileExplorerLib: avoid packed struct for program data

2018-12-10 Thread Leif Lindholm
On Sat, Dec 08, 2018 at 11:24:31AM +0100, Ard Biesheuvel wrote:
> Struct packing is only necessary for data structures whose in-memory
> representation is covered by the PI or UEFI specs, and may deviate
> from the ordinary C rules for alignment.
> 
> So in case of FileExplorerLib, this applies to the device path struct
> only, and other structures used to carry program data should not be
> packed, or we may end up with alignment faults on architectures such
> as ARM, which don't permit load/store double or multiple instructions
> to access memory locations that are not 32-bit aligned.
> 
> E.g., the following call in FileExplorerLibConstructor()
> 
>   InitializeListHead (&gFileExplorerPrivate.FsOptionMenu->Head);
> 
> which is emitted as follows for 32-bit ARM/Thumb2 by Clang-5.0
> 
> 3de0:   b510push{r4, lr}
> 3de2:   4604mov r4, r0
> ...
> 3de8:   e9c4 4400   strdr4, r4, [r4]
> 3dec:   bd10pop {r4, pc}
> 
> will perform a double-word store on the first argument, passed in
> register r0, assuming that the pointer type of the argument is
> enough to guarantee that the value is suitably aligned.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 

I agree with the architectural rationale.

However, I also decided to have a look.

$ git grep "} HII_VENDOR_DEVICE_PATH;"
EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h:} 
HII_VENDOR_DEVICE_PATH;
EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrLibrary.h:}
 HII_VENDOR_DEVICE_PATH;
EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c:} HII_VENDOR_DEVICE_PATH;
EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c:} HII_VENDOR_DEVICE_PATH;
IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.h:} 
HII_VENDOR_DEVICE_PATH;
IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h:} HII_VENDOR_DEVICE_PATH;
MdeModulePkg/Application/UiApp/Ui.h:} HII_VENDOR_DEVICE_PATH;
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h:} 
HII_VENDOR_DEVICE_PATH;
MdeModulePkg/Library/BootManagerUiLib/BootManager.h:} HII_VENDOR_DEVICE_PATH;
MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.h:} 
HII_VENDOR_DEVICE_PATH;
MdeModulePkg/Library/FileExplorerLib/FileExplorer.h:} HII_VENDOR_DEVICE_PATH;
MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanup.h:} 
HII_VENDOR_DEVICE_PATH;
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h:} HII_VENDOR_DEVICE_PATH;
MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h:} HII_VENDOR_DEVICE_PATH;
MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSample.c:} 
HII_VENDOR_DEVICE_PATH;
MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.h:} HII_VENDOR_DEVICE_PATH;
MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c:} 
HII_VENDOR_DEVICE_PATH;
NetworkPkg/IScsiDxe/IScsiConfig.h:} HII_VENDOR_DEVICE_PATH;
NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.h:} HII_VENDOR_DEVICE_PATH;
QuarkPlatformPkg/Platform/Dxe/Setup/SetupPlatform.h:} HII_VENDOR_DEVICE_PATH;
SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h:} HII_VENDOR_DEVICE_PATH;
SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.h:} HII_VENDOR_DEVICE_PATH;
SecurityPkg/Tcg/TcgConfigDxe/TcgConfigImpl.h:} HII_VENDOR_DEVICE_PATH;
SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProvider.h:}
 HII_VENDOR_DEVICE_PATH;
SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManager.h:} 
HII_VENDOR_DEVICE_PATH;
SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.h:} 
HII_VENDOR_DEVICE_PATH;
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h:} 
HII_VENDOR_DEVICE_PATH;
Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.h:} HII_VENDOR_DEVICE_PATH;
Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.c:} HII_VENDOR_DEVICE_PATH;

Now, I will confess to being lazy and not manually checking all of
them, but 100% of the ones I did check were identical (except in
packedness).

Does this definition belong in a central header somewhere rather than
in 29 (and counting) different locations, implemented differently?

/
Leif

> ---
>  MdeModulePkg/Library/FileExplorerLib/FileExplorer.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.h 
> b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.h
> index bf1450dbd581..603185abe4b1 100644
> --- a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.h
> +++ b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.h
> @@ -51,6 +51,8 @@ typedef struct {
>EFI_DEVICE_PATH_PROTOCOL   End;
>  } HII_VENDOR_DEVICE_PATH;
>  
> +#pragma pack()
> +
>  typedef struct {
>EFI_HANDLEDeviceHandle;
>EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
> @@ -100,8 +102,6 @@ typedef struct {
>  
>  #define FILE_EXPLORER_PRIVATE_FROM_THIS(a)  CR (a, 
> FILE_EXPLORER_CALLBACK_DATA, FeConfigAccess, 
> FILE_EXPLOR

Re: [edk2] [Patch] BaseTools: Optimize string concatenation

2018-12-10 Thread Feng, Bob C
Hi Leif,

For the "customized deepcopy" and "cache for uni file parser" data, you can see 
the AutoGen is not slower. The whole Build Duration is longer because Make 
Duration is longer while Make Duration time depends on the external make, 
compiler and linker. So it's not the patch make the build slow down.

Yes,  it's not faster either. I think that because the Ovmf platform is 
relatively simple.  From the build tool source code point of view, the 
customized deepcopy will take effect if the platform enabled multiple SKU or 
there are many expressions in metadata file to be evaluated. And the "cache for 
uni file parser" needs there are many uni files.  The Ovmf platform looks not a 
good platform to demo the effect of this patch.


Thanks,
Bob

-Original Message-
From: Leif Lindholm [mailto:leif.lindh...@linaro.org] 
Sent: Monday, December 10, 2018 6:48 PM
To: Feng, Bob C 
Cc: edk2-devel@lists.01.org; Carsey, Jaben ; Gao, 
Liming 
Subject: Re: [edk2] [Patch] BaseTools: Optimize string concatenation

Hi Bob,

Thanks.

I am a little bit confused by the "customized deepcopy" and "cache for uni file 
parser" data. These look like they are slowing down rather than speeding up the 
build.

Regards,

Leif

On Wed, Dec 05, 2018 at 02:51:58AM +, Feng, Bob C wrote:
> Hi,
> 
> I have added the performance data in BZ
> https://bugzilla.tianocore.org/show_bug.cgi?id=1288 . Please have a 
> review.
> 
> Thanks,
> Bob
> 
> 
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Feng, Bob C
> Sent: Sunday, November 11, 2018 8:41 AM
> To: Leif Lindholm 
> Cc: Carsey, Jaben ; edk2-devel@lists.01.org; 
> Gao, Liming 
> Subject: Re: [edk2] [Patch] BaseTools: Optimize string concatenation
> 
> Hi Leif,
> 
> I use my desktop to do the benchmark.
> CPU: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
> Memory: 16G
> OS: Win10
> 
> I'll add the performance detailed data to BZ.
> 
> -Bob
> 
> -Original Message-
> From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> Sent: Friday, November 9, 2018 7:49 PM
> To: Feng, Bob C 
> Cc: edk2-devel@lists.01.org; Carsey, Jaben ; 
> Gao, Liming 
> Subject: Re: [edk2] [Patch] BaseTools: Optimize string concatenation
> 
> Hi Bob,
> 
> On Fri, Nov 09, 2018 at 03:25:04AM +, Feng, Bob C wrote:
> > Yes. I should show the data.
> > 
> > My unites scripts is as below. The parameter lines is a string list 
> > which size is 43395. The test result is
> > 
> > ''.join(String list) time:  0.042262 String += String time  :  
> > 3.822699
> > 
> > def TestPlus(lines):
> > str_target = ""
> > 
> > for line in lines:
> > str_target += line
> > 
> > return str_target
> > 
> > def TestJoin(lines):
> > str_target = []
> > 
> > for line in lines:
> > str_target.append(line)
> > 
> > return "".join(str_target)
> > 
> > def CompareStrCat():
> > lines = GetStrings()
> > print (len(lines))
> > 
> > begin = time.perf_counter()
> > for _ in range(10):
> > TestJoin(lines)
> > end = time.perf_counter() - begin
> > print ("''.join(String list) time: %f" % end)
> > 
> > begin = time.perf_counter()
> > for _ in range(10):
> > TestPlus(lines)
> > end = time.perf_counter() - begin
> > print ("String += String time: %f" % end)
> > 
> > For build OvmfX64, it's not very effective, it saves 2~3 second in 
> > Parse/AutoGen phase, because OvmfX64 is relatively simple. It does 
> > not enable much features such as Multiple SKU and structure PCD by 
> > default and there is no big size Autogen.c/Autogen.h/Makefile 
> > generated either. but for the complex platform, this patch will be 
> > much effective. The unites above simulates a real case that there is 
> > a
> > 43395 lines of Autogen.c generated.
> 
> I beg to differ. Shaving 2-3 seconds off the autogen phase is a substantial 
> improvement.
> 
> However, on my wimpy 24-core Cortex-A53 system, the effect is not noticeable 
> (fluctuates between 1:56-1:58 whether with or without this patch).
> 
> And even on my x86 workstation, I see no measurable difference (12-13s).
> What is the hardware you are benchmarking on?
> 
> It does not appear to be detrimental to performance on any of my platforms, 
> but I would like to see some more measurements, and I would like to see that 
> logged with some more detail in bugzilla.
> 
> Regards,
> 
> Leif
> 
> > Since this patch mostly effect the Parser/AutoGen phase, I just use 
> > "build genmake" to show the improvement data.
> > The final result for clean build is:
> > Current code:  17 seconds
> > After patch:  15 seconds
> > 
> > Details:
> > Current data:
> > 
> > d:\edk2 (master -> origin)
> > λ build genmake -p OvmfPkg\OvmfPkgIa32X64.dsc -a IA32 -a X64 -t
> > VS2015x86 Build environment: Windows-10-10.0.10240 Build start time: 
> > 10:12:32, Nov.09 2018
> > 
> > WORKSPACE= d:\edk2
> > ECP_SOURCE   = d:\edk2\edkcompati

Re: [edk2] [RFC] Remove unused tool chain configuration in BaseTools/Conf/tools_def.template

2018-12-10 Thread Leif Lindholm
On Thu, Dec 06, 2018 at 02:42:35PM +, Gao, Liming wrote:
> Hi, all
>   tools_def.template includes all tool chains. Some are not used any
>   more. And, there is no verification for them. So, I propose to
>   remove them. They are VS2003, VS2005, VS2008, VS2010, DDK3790,
>   UNIXGCC, GCC44, GCC45, GCC46, GCC47, ELFGCC, CYGGCC, ICC, ICC11,
>   MYTOOLS. If you still use some one of them, please let me know.

This sounds good to me.

However, may I suggest splitting this up into several patches, such
that if we need to revert one of the deletions, we would not need to
reinstate all of them.

I would propose:
- One patch for VS20nn
- One patch for GCCnn
- One patch for UNIXGCC, ELFGCC, CYGGCC

I can't really judge what a suitable mashup/split between DDK3790,
ICC, ICC11, and MYTOOLS would be.

On a sidenote, I think Rebecca said at least FreeBSD were using
UNIXGCC(?) since the plain GCC toolchain profiles did not support
cross compiling. I am pretty sure that is not accurate these days -
did you look into that after the community call?

Regards.

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


Re: [edk2] [Patch] BaseTools: Optimize string concatenation

2018-12-10 Thread Leif Lindholm
Hi Bob,

Thanks.

I am a little bit confused by the "customized deepcopy" and "cache for
uni file parser" data. These look like they are slowing down rather
than speeding up the build.

Regards,

Leif

On Wed, Dec 05, 2018 at 02:51:58AM +, Feng, Bob C wrote:
> Hi,
> 
> I have added the performance data in BZ
> https://bugzilla.tianocore.org/show_bug.cgi?id=1288 . Please have a
> review.
> 
> Thanks,
> Bob
> 
> 
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Feng, 
> Bob C
> Sent: Sunday, November 11, 2018 8:41 AM
> To: Leif Lindholm 
> Cc: Carsey, Jaben ; edk2-devel@lists.01.org; Gao, 
> Liming 
> Subject: Re: [edk2] [Patch] BaseTools: Optimize string concatenation
> 
> Hi Leif,
> 
> I use my desktop to do the benchmark.
> CPU: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
> Memory: 16G
> OS: Win10
> 
> I'll add the performance detailed data to BZ.
> 
> -Bob
> 
> -Original Message-
> From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> Sent: Friday, November 9, 2018 7:49 PM
> To: Feng, Bob C 
> Cc: edk2-devel@lists.01.org; Carsey, Jaben ; Gao, 
> Liming 
> Subject: Re: [edk2] [Patch] BaseTools: Optimize string concatenation
> 
> Hi Bob,
> 
> On Fri, Nov 09, 2018 at 03:25:04AM +, Feng, Bob C wrote:
> > Yes. I should show the data.
> > 
> > My unites scripts is as below. The parameter lines is a string list 
> > which size is 43395. The test result is
> > 
> > ''.join(String list) time:  0.042262
> > String += String time  :  3.822699
> > 
> > def TestPlus(lines):
> > str_target = ""
> > 
> > for line in lines:
> > str_target += line
> > 
> > return str_target
> > 
> > def TestJoin(lines):
> > str_target = []
> > 
> > for line in lines:
> > str_target.append(line)
> > 
> > return "".join(str_target)
> > 
> > def CompareStrCat():
> > lines = GetStrings()
> > print (len(lines))
> > 
> > begin = time.perf_counter()
> > for _ in range(10):
> > TestJoin(lines)
> > end = time.perf_counter() - begin
> > print ("''.join(String list) time: %f" % end)
> > 
> > begin = time.perf_counter()
> > for _ in range(10):
> > TestPlus(lines)
> > end = time.perf_counter() - begin
> > print ("String += String time: %f" % end)
> > 
> > For build OvmfX64, it's not very effective, it saves 2~3 second in 
> > Parse/AutoGen phase, because OvmfX64 is relatively simple. It does not 
> > enable much features such as Multiple SKU and structure PCD by default 
> > and there is no big size Autogen.c/Autogen.h/Makefile generated 
> > either. but for the complex platform, this patch will be much 
> > effective. The unites above simulates a real case that there is a
> > 43395 lines of Autogen.c generated.
> 
> I beg to differ. Shaving 2-3 seconds off the autogen phase is a substantial 
> improvement.
> 
> However, on my wimpy 24-core Cortex-A53 system, the effect is not noticeable 
> (fluctuates between 1:56-1:58 whether with or without this patch).
> 
> And even on my x86 workstation, I see no measurable difference (12-13s).
> What is the hardware you are benchmarking on?
> 
> It does not appear to be detrimental to performance on any of my platforms, 
> but I would like to see some more measurements, and I would like to see that 
> logged with some more detail in bugzilla.
> 
> Regards,
> 
> Leif
> 
> > Since this patch mostly effect the Parser/AutoGen phase, I just use 
> > "build genmake" to show the improvement data.
> > The final result for clean build is:
> > Current code:  17 seconds
> > After patch:  15 seconds
> > 
> > Details:
> > Current data:
> > 
> > d:\edk2 (master -> origin)
> > λ build genmake -p OvmfPkg\OvmfPkgIa32X64.dsc -a IA32 -a X64 -t
> > VS2015x86 Build environment: Windows-10-10.0.10240 Build start time: 
> > 10:12:32, Nov.09 2018
> > 
> > WORKSPACE= d:\edk2
> > ECP_SOURCE   = d:\edk2\edkcompatibilitypkg
> > EDK_SOURCE   = d:\edk2\edkcompatibilitypkg
> > EFI_SOURCE   = d:\edk2\edkcompatibilitypkg
> > EDK_TOOLS_PATH   = d:\edk2\basetools
> > EDK_TOOLS_BIN= d:\edk2\basetools\bin\win32
> > CONF_PATH= d:\edk2\conf
> > 
> > Architecture(s)  = IA32 X64
> > Build target = DEBUG
> > Toolchain= VS2015x86
> > 
> > Active Platform  = d:\edk2\OvmfPkg\OvmfPkgIa32X64.dsc
> > Flash Image Definition   = d:\edk2\OvmfPkg\OvmfPkgIa32X64.fdf
> > 
> > Processing meta-data ... done!
> > Generating code . done!
> > Generating makefile . done!
> > Generating code .. done!
> > Generating makefile .. done!
> > 
> > - Done -
> > Build end time: 10:12:49, Nov.09 2018
> > Build total time: 00:00:17
> > 
> > After applying this patch:
> > 
> > d:\edk2 (master -> origin)
> > λ build genmake -p OvmfPkg\OvmfPkgIa32X64.dsc -a IA32 -a X64 -
> > Build environment: Windows-10-10.0.10240  
> > Build start time: 10:11:41, Nov.09 2018   

Re: [edk2] SCT bugzilla topic?

2018-12-10 Thread Jin, Eric
Hi Leif,

We had better use "UEFI SCT" as the component. 
Other SCTs or test suites may be arranged in the EDK2-Test in future as the 
intention of EDK2-Test if my understanding is correct. Thanks.

Best Regards
Eric

-Original Message-
From: Leif Lindholm  
Sent: Monday, December 10, 2018 4:14 PM
To: Kinney, Michael D 
Cc: Jin, Eric ; Supreeth Venkatesh 
; edk2-devel@lists.01.org; Dong Wei 

Subject: Re: SCT bugzilla topic?

Hi Mike,

I think we're agreed on an "EDK2 Test" product with an "SCT" component.
(Although that should probably be "UEFI SCT" for clarity.)

Regards,

Leif

On Mon, Dec 10, 2018 at 03:02:57AM +, Kinney, Michael D wrote:
> I can update BZ once there is a clear decision on what is required.
> 
> Mike
> 
> > -Original Message-
> > From: Jin, Eric
> > Sent: Sunday, December 9, 2018 6:19 PM
> > To: Supreeth Venkatesh ; Leif Lindholm 
> > ; edk2- de...@lists.01.org
> > Cc: Kinney, Michael D ; Dong Wei 
> > ; Jin, Eric 
> > Subject: RE: SCT bugzilla topic?
> > 
> > Supreeth and Leif,
> > 
> > UEFI-SCT is open source project now, the mantis is not proper 
> > option. We had better use the Bugzilla as edk2.
> > Could the stewards help to create the Edk2 Test Product and SCT 
> > component if most members want to split test with edk2?
> > 
> > Best Regards
> > Eric
> > 
> > -Original Message-
> > From: Supreeth Venkatesh 
> > Sent: Tuesday, December 4, 2018 3:37 AM
> > To: Leif Lindholm ; edk2- 
> > de...@lists.01.org
> > Cc: Jin, Eric ; Kinney, Michael D 
> > ; Dong Wei 
> > Subject: RE: SCT bugzilla topic?
> > 
> > Leif,
> > 
> > Earlier, we used to use UTWG Mantis (for feature requests
> > - https://mantis.uefi.org/mantis/view.php).
> > After, UEFI-SCT became Open source, we did discuss to have the same 
> > infrastructure setup as edk2, which means using Bugzilla.
> > However, I don't think we have created a SCT component or
> > Edk2 Test Product yet.
> > 
> > Your email reminds me one more task after the SCT component / Edk2 
> > Test product is created i.e., to migrate over remaining UTWG issues 
> > to Bugzilla.
> > 
> > Once Eric chimes in/agrees, we will request Mike to create
> > Edk2 Test Product within Bugzilla.
> > 
> > Thanks,
> > Supreeth
> > 
> > -Original Message-
> > From: Leif Lindholm 
> > Sent: Monday, December 3, 2018 8:47 AM
> > To: edk2-devel@lists.01.org
> > Cc: Eric Jin ; Supreeth Venkatesh 
> > ; Michael D Kinney 
> > 
> > Subject: SCT bugzilla topic?
> > 
> > Hi Eric, Supreeth, Mike,
> > 
> > I was looking to raise a feature request on UEFI SCT and didn't spot 
> > such a product. Should we create one?
> > 
> > Or perhaps we should have an EDK2 Test product with an SCT 
> > component?
> > 
> > Regards,
> > 
> > Leif
> > IMPORTANT NOTICE: The contents of this email and any attachments are 
> > confidential and may also be privileged.
> > If you are not the intended recipient, please notify the sender 
> > immediately and do not disclose the contents to any other person, 
> > use it for any purpose, or store or copy the information in any 
> > medium. Thank you.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg.

2018-12-10 Thread Ard Biesheuvel
On Fri, 23 Nov 2018 at 11:57, Laszlo Ersek  wrote:
>
> +Ard, +Leif
>
> On 11/22/18 06:21, Fu Siyuan wrote:
> > This patch provides a set of include segment files for platform owner to
> > easily enable/disable network stack support on their platform.
> >
> > For DSC, there are:
> > - a "NetworkDefines.dsc.inc" for the [Defines] section(s),
> > - a "NetworkLibs.dsc.inc" for the [LibraryClasses*] section(s),
> > - a "NetworkPcds.dsc.inc" for the [Pcds*] section(s),
> > - a "NetworkComponents.dsc.inc" for the [Components*] section(s).
> > For FDF, there is:
> > - a "Network.fdf.inc" for the [Fv*] section(s).
> >
> > These files can be added to the platform DSC/FDF file by using
> >   !include NetworkPkg/xxx
> > where "xxx" is the *.inc file name.
> >
> > A set of flags can be changed before the include line or in build command
> > line ("-D FLAG=VALUE") to enable or disable related feature set, please
> > check "NetworkDefines.dsc.inc" for a detail description of each flag.
> >
> > The default value of these flags are:
> >   DEFINE NETWORK_ENABLE = TRUE
> >   DEFINE NETWORK_SNP_ENABLE = TRUE
> >   DEFINE NETWORK_IP4_ENABLE = TRUE
> >   DEFINE NETWORK_IP6_ENABLE = TRUE
> >   DEFINE NETWORK_TLS_ENABLE = TRUE
> >   DEFINE NETWORK_HTTP_BOOT_ENABLE   = TRUE
> >   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
> >   DEFINE NETWORK_IPSEC_ENABLE   = TRUE
> >   DEFINE NETWORK_ISCSI_ENABLE   = TRUE
> >   DEFINE NETWORK_VLAN_ENABLE= TRUE
> >
> > Related BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1293
> >
> > Cc: Jiaxin Wu 
> > Cc: Ting Ye 
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Fu Siyuan 
> > ---
> >
> > Notes:
> > v2:
> > 1. Split the "Network.dsc.inc" in to 4 files for different sections in 
> > DSC
> > file. This could provide more flexibility to platform owner to use the
> > include files.
> > 2. Clarify the OpenSSL dependency of TLS, iSCSI and IPsec enable flag.
> > 3. Use "!error" statement for incorrect flag value check.
> > 4. Other decoration work according to Laszlo's comments.
> >
> >  NetworkPkg/Network.fdf.inc   |  69 ++
> >  NetworkPkg/NetworkComponents.dsc.inc |  71 ++
> >  NetworkPkg/NetworkDefines.dsc.inc| 138 
> >  NetworkPkg/NetworkLibs.dsc.inc   |  25 
> >  NetworkPkg/NetworkPcds.dsc.inc   |  22 
> >  NetworkPkg/NetworkPkg.dsc|  28 +---
> >  6 files changed, 331 insertions(+), 22 deletions(-)
> >
> > diff --git a/NetworkPkg/Network.fdf.inc b/NetworkPkg/Network.fdf.inc
> > new file mode 100644
> > index ..abd4c6c363d5
> > --- /dev/null
> > +++ b/NetworkPkg/Network.fdf.inc
> > @@ -0,0 +1,69 @@
> > +## @file
> > +# Network FDF include file for All Architectures.
> > +#
> > +# This file can be included to a platform FDF by using "!include 
> > NetworkPkg/Network.fdf.inc"
> > +# to add EDKII network stack drivers according to the value of flags 
> > described in
> > +# "NetworkDefines.dsc.inc".
> > +#
> > +# 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.
> > +#
> > +
> > +!if $(NETWORK_ENABLE) == TRUE
> > +  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
> > +
> > +  !if $(NETWORK_SNP_ENABLE) == TRUE
> > +INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_VLAN_ENABLE) == TRUE
> > +INF  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
> > +  !endif
> > +
> > +  INF  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> > +
> > +  !if $(NETWORK_IP4_ENABLE) == TRUE
> > +INF  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
> > +INF  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
> > +INF  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
> > +INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> > +INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_IP6_ENABLE) == TRUE
> > +INF  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> > +INF  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> > +INF  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> > +INF  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> > +  !endif
> > +
> > +  INF  NetworkPkg/TcpDxe/TcpDxe.inf
> > +  INF  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> > +
> > +  !if $(NETWORK_TLS_ENABLE) == TRUE
> > +INF  NetworkPkg/TlsDxe/TlsDxe.inf
> > +INF  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
> 

Re: [edk2] SCT bugzilla topic?

2018-12-10 Thread Leif Lindholm
Hi Mike,

I think we're agreed on an "EDK2 Test" product with an "SCT" component.
(Although that should probably be "UEFI SCT" for clarity.)

Regards,

Leif

On Mon, Dec 10, 2018 at 03:02:57AM +, Kinney, Michael D wrote:
> I can update BZ once there is a clear decision on what is required.
> 
> Mike
> 
> > -Original Message-
> > From: Jin, Eric
> > Sent: Sunday, December 9, 2018 6:19 PM
> > To: Supreeth Venkatesh ; Leif
> > Lindholm ; edk2-
> > de...@lists.01.org
> > Cc: Kinney, Michael D ; Dong
> > Wei ; Jin, Eric 
> > Subject: RE: SCT bugzilla topic?
> > 
> > Supreeth and Leif,
> > 
> > UEFI-SCT is open source project now, the mantis is not
> > proper option. We had better use the Bugzilla as edk2.
> > Could the stewards help to create the Edk2 Test Product
> > and SCT component if most members want to split test with
> > edk2?
> > 
> > Best Regards
> > Eric
> > 
> > -Original Message-
> > From: Supreeth Venkatesh 
> > Sent: Tuesday, December 4, 2018 3:37 AM
> > To: Leif Lindholm ; edk2-
> > de...@lists.01.org
> > Cc: Jin, Eric ; Kinney, Michael D
> > ; Dong Wei 
> > Subject: RE: SCT bugzilla topic?
> > 
> > Leif,
> > 
> > Earlier, we used to use UTWG Mantis (for feature requests
> > - https://mantis.uefi.org/mantis/view.php).
> > After, UEFI-SCT became Open source, we did discuss to have
> > the same infrastructure setup as edk2, which means using
> > Bugzilla.
> > However, I don't think we have created a SCT component or
> > Edk2 Test Product yet.
> > 
> > Your email reminds me one more task after the SCT
> > component / Edk2 Test product is created i.e., to migrate
> > over remaining UTWG issues to Bugzilla.
> > 
> > Once Eric chimes in/agrees, we will request Mike to create
> > Edk2 Test Product within Bugzilla.
> > 
> > Thanks,
> > Supreeth
> > 
> > -Original Message-
> > From: Leif Lindholm 
> > Sent: Monday, December 3, 2018 8:47 AM
> > To: edk2-devel@lists.01.org
> > Cc: Eric Jin ; Supreeth Venkatesh
> > ; Michael D Kinney
> > 
> > Subject: SCT bugzilla topic?
> > 
> > Hi Eric, Supreeth, Mike,
> > 
> > I was looking to raise a feature request on UEFI SCT and
> > didn't spot such a product. Should we create one?
> > 
> > Or perhaps we should have an EDK2 Test product with an SCT
> > component?
> > 
> > Regards,
> > 
> > Leif
> > IMPORTANT NOTICE: The contents of this email and any
> > attachments are confidential and may also be privileged.
> > If you are not the intended recipient, please notify the
> > sender immediately and do not disclose the contents to any
> > other person, use it for any purpose, or store or copy the
> > information in any medium. Thank you.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] IntelFsp2Pkg: Add FspmArchConfigPpi to support Dispatch mode

2018-12-10 Thread Zeng, Star

Hi Chasel,

Two minor comments are added inline.

On 2018/12/7 21:30, Chasel, Chiu wrote:

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

In Dispatch mode FSP may consume PPI directly so creating
FSPM_ARCH_CONFIG_PPI to align with FSPM_ARCH_UPD.

Test: Verified on internal platform to boot with this PPI
installed successfully.

Cc: Nate DeSimone 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu 
---
  IntelFsp2Pkg/Include/Ppi/FspmArchConfigPpi.h | 41 
+
  IntelFsp2Pkg/IntelFsp2Pkg.dec|  3 +++
  2 files changed, 44 insertions(+)

diff --git a/IntelFsp2Pkg/Include/Ppi/FspmArchConfigPpi.h 
b/IntelFsp2Pkg/Include/Ppi/FspmArchConfigPpi.h
new file mode 100644
index 00..5b3dac5b04
--- /dev/null
+++ b/IntelFsp2Pkg/Include/Ppi/FspmArchConfigPpi.h
@@ -0,0 +1,41 @@
+/** @file
+  Header file for FSP-M Arch Config PPI
+
+ @copyright
+  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.
+
+**/
+
+#ifndef _FSPM_ARCH_CONFIG_PPI_H_
+#define _FSPM_ARCH_CONFIG_PPI_H_
+
+///
+/// Global ID for the FSPM_ARCH_CONFIG_PPI.
+///
+#define FSPM_ARCH_CONFIG_GUID \
+  { \
+0x824d5a3a, 0xaf92, 0x4c0c, { 0x9f, 0x19, 0x19, 0x52, 0x6d, 0xca, 0x4a, 
0xbb } \
+  }
+
+///
+/// This PPI provides FSP-M Arch Config PPI.


How about adding more description about this PPI is used for dispatch mode?


+///
+typedef struct {
+  UINT8 Revision;
+  UINT8 Reserved[3];
+  VOID  *NvsBufferPtr;
+  UINT32BootLoaderTolumSize;
+  UINT8 Reserved1[8];
+} FSPM_ARCH_CONFIG_PPI;


Could the definition be aligned with FSPM_ARCH_UPD in 
IntelFsp2Pkg\Include\FspEas\FspApi.h? Then we can use typedef to define 
it like below.


typedef FSPM_ARCH_UPD FSPM_ARCH_CONFIG_PPI;

Otherwise, please add description for the fields like FSPM_ARCH_UPD did.


Thanks,
Star


+
+extern EFI_GUID gFspmArchConfigPpiGuid;
+
+#endif // _FSPM_ARCH_CONFIG_PPI_H_
diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dec b/IntelFsp2Pkg/IntelFsp2Pkg.dec
index 50496241da..de1bece562 100644
--- a/IntelFsp2Pkg/IntelFsp2Pkg.dec
+++ b/IntelFsp2Pkg/IntelFsp2Pkg.dec
@@ -70,6 +70,9 @@
gFspPerformanceDataGuid   = { 0x56ed21b6, 0xba23, 0x429e, { 
0x89, 0x32, 0x37, 0x6d, 0x8e, 0x18, 0x2e, 0xe3 } }
gFspEventEndOfFirmwareGuid= { 0xbd44f629, 0xeae7, 0x4198, { 
0x87, 0xf1, 0x39, 0xfa, 0xb0, 0xfd, 0x71, 0x7e } }
  
+[Ppis]

+  gFspmArchConfigPpiGuid= { 0x824d5a3a, 0xaf92, 0x4c0c, { 
0x9f, 0x19, 0x19, 0x52, 0x6d, 0xca, 0x4a, 0xbb } }
+
  [PcdsFixedAtBuild]
gIntelFsp2PkgTokenSpaceGuid.PcdGlobalDataPointerAddress 
|0xFED00108|UINT32|0x0001
gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamBase 
|0xFEF0|UINT32|0x10001001



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