Re: [edk2] Obtaining TCG final events on systems without TCG2 log support

2018-12-14 Thread Yao, Jiewen
thanks
i will raise the topic in next tcg pc client meeting.


thank you!
Yao, Jiewen


> 在 2018年12月14日,下午5:32,Laszlo Ersek  写道:
> 
>> On 12/13/18 19:55, Matthew Garrett wrote:
>>> On Thu, Dec 13, 2018 at 01:36:09PM +0100, Laszlo Ersek wrote:
>>> 
>>> (2) EFI_TCG2_FINAL_EVENTS_TABLE is defined with TCG_PCR_EVENT2 entries
>>> *only*. TCG_PCR_EVENT is not accommodated.
>>> 
>>> 
>>> That's the contradiction. If a platform is unable to produce
>>> TCG_PCR_EVENT2 entries in GetEventLog(), it is fairly certainly also
>>> unable to produce them in the final events table.
>> 
>> If a platform is unable to produce them in the final events table then 
>> it's violating the spec.
> 
> The question is why it's made impossible to comply with the spec if the
> platform only supports the 1.2 format.
> 
>> If the platform only offers the 1.2 log format 
>> then it seems reasonable to expect that the events in the final events 
>> table would only contain a SHA1, but a TCG_PCR_EVENT2 structure that 
>> only contains SHA1s isn't significantly more complicated than an old 
>> style event.
>> 
> 
> OK... I guess that can be a valid interpretation. Would you please file
> a TianoCore BZ ticket about it, as a feature request?
> 
> - URL: https://bugzilla.tianocore.org
> - Product: Tianocore Feature Requests
> - Component: Code
> - Package: SecurityPkg
> 
> (I'm assuming this isn't a regression, i.e., it's not the case that the
> feature used to work, but commit fd46e831bc33 regressed it.)
> 
> Thanks,
> Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Obtaining TCG final events on systems without TCG2 log support

2018-12-14 Thread Matthew Garrett
On Fri, Dec 14, 2018 at 10:32:29AM +0100, Laszlo Ersek wrote:
> On 12/13/18 19:55, Matthew Garrett wrote:
> > If a platform is unable to produce them in the final events table then 
> > it's violating the spec.
> 
> The question is why it's made impossible to comply with the spec if the
> platform only supports the 1.2 format.

If a platform can't implement the spec then the platform violates the 
spec :)

> > If the platform only offers the 1.2 log format 
> > then it seems reasonable to expect that the events in the final events 
> > table would only contain a SHA1, but a TCG_PCR_EVENT2 structure that 
> > only contains SHA1s isn't significantly more complicated than an old 
> > style event.
> > 
> 
> OK... I guess that can be a valid interpretation. Would you please file
> a TianoCore BZ ticket about it, as a feature request?

Will do.

> (I'm assuming this isn't a regression, i.e., it's not the case that the
> feature used to work, but commit fd46e831bc33 regressed it.)

It looks like fd46e831bc33 didn't change anything significant here, so I 
don't think this is a regression.

-- 
Matthew Garrett | mj...@srcf.ucam.org
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 4/7] MdeModulePkg PeiCore: Remove the using of PcdPeiCoreMaxPpiSupported

2018-12-14 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1405

Background as below.

Problem:
As static configuration from the PCDs, the binary PeiCore (for example
in FSP binary with dispatch mode) could not predict how many FVs,
Files or PPIs for different platforms.

Burden:
Platform developers need configure the PCDs accordingly for different
platforms.

To solve the problem and remove the burden, we can update code to
remove the using of PcdPeiCoreMaxFvSupported, PcdPeiCoreMaxPeimPerFv
and PcdPeiCoreMaxPpiSupported by extending buffer dynamically for FV,
File and PPI management.

This patch removes the using of PcdPeiCoreMaxPpiSupported in PeiCore.

Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Liming Gao 
Cc: Ruiyu Ni 
Cc: Michael D Kinney 
Cc: Nate DeSimone 
Cc: Chasel Chiu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c |   8 +-
 MdeModulePkg/Core/Pei/PeiMain.h   |  59 +++--
 MdeModulePkg/Core/Pei/PeiMain.inf |   1 -
 MdeModulePkg/Core/Pei/PeiMain/PeiMain.c   |  30 ++-
 MdeModulePkg/Core/Pei/Ppi/Ppi.c   | 355 ++
 5 files changed, 254 insertions(+), 199 deletions(-)

diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c 
b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
index 71440bab9488..55a300adbdb8 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -1062,7 +1062,7 @@ PeiDispatcher (
   // Process the Notify list and dispatch any notifies for
   // newly installed PPIs.
   //
-  ProcessNotifyList (Private);
+  ProcessDispatchNotifyList (Private);
 }
   }
 }
@@ -1209,10 +1209,10 @@ PeiDispatcher (
 // Process the Notify list and dispatch any notifies for
 // newly installed PPIs.
 //
-ProcessNotifyList (Private);
+ProcessDispatchNotifyList (Private);
 
 //
-// Recheck SwitchStackSignal after ProcessNotifyList()
+// Recheck SwitchStackSignal after ProcessDispatchNotifyList()
 // in case PeiInstallPeiMemory() is done in a callback with
 // EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH.
 //
@@ -1253,7 +1253,7 @@ PeiDispatcher (
   // Process the Notify list and dispatch any notifies for
   // newly installed PPIs.
   //
-  ProcessNotifyList (Private);
+  ProcessDispatchNotifyList (Private);
 }
   }
 }
diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMain.h
index b248118087ad..c6c932c3e233 100644
--- a/MdeModulePkg/Core/Pei/PeiMain.h
+++ b/MdeModulePkg/Core/Pei/PeiMain.h
@@ -66,37 +66,60 @@ typedef union {
 } PEI_PPI_LIST_POINTERS;
 
 ///
-/// PPI database structure which contains two link: PpiList and NotifyList. 
PpiList
-/// is in head of PpiListPtrs array and notify is in end of PpiListPtrs.
+/// Number of PEI_PPI_LIST_POINTERS to grow by each time we run out of room
 ///
+#define PPI_GROWTH_STEP 64
+#define CALLBACK_NOTIFY_GROWTH_STEP 32
+#define DISPATCH_NOTIFY_GROWTH_STEP 8
+
 typedef struct {
+  UINTN CurrentCount;
+  UINTN MaxCount;
+  UINTN LastDispatchedCount;
   ///
-  /// index of end of PpiList link list.
+  /// MaxCount number of entries.
   ///
-  INTNPpiListEnd;
+  PEI_PPI_LIST_POINTERS *PpiPtrs;
+} PEI_PPI_LIST;
+
+typedef struct {
+  UINTN CurrentCount;
+  UINTN MaxCount;
   ///
-  /// index of end of notify link list.
+  /// MaxCount number of entries.
   ///
-  INTNNotifyListEnd;
+  PEI_PPI_LIST_POINTERS *NotifyPtrs;
+} PEI_CALLBACK_NOTIFY_LIST;
+
+typedef struct {
+  UINTN CurrentCount;
+  UINTN MaxCount;
+  UINTN LastDispatchedCount;
   ///
-  /// index of the dispatched notify list.
+  /// MaxCount number of entries.
   ///
-  INTNDispatchListEnd;
+  PEI_PPI_LIST_POINTERS *NotifyPtrs;
+} PEI_DISPATCH_NOTIFY_LIST;
+
+///
+/// PPI database structure which contains three links:
+/// PpiList, CallbackNotifyList and DispatchNotifyList.
+///
+typedef struct {
   ///
-  /// index of last installed Ppi description in PpiList link list.
+  /// PPI List.
   ///
-  INTNLastDispatchedInstall;
+  PEI_PPI_LIST  PpiList;
   ///
-  /// index of last dispatched notify in Notify link list.
+  /// Notify List at dispatch level.
   ///
-  INTNLastDispatchedNotify;
+  PEI_CALLBACK_NOTIFY_LIST  CallbackNotifyList;
   ///
-  /// Ppi database has the PcdPeiCoreMaxPpiSupported number of entries.
+  /// Notify List at callback level.
   ///
-  PEI_PPI_LIST_POINTERS   *PpiListPtrs;
+  PEI_DISPATCH_NOTIFY_LIST  DispatchNotifyList;
 } PEI_PPI_DATABASE;
 
-
 //
 // 

[edk2] [PATCH 0/7] Remove PcdPeiCoreMaxXXX PCDs

2018-12-14 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1405

Repo: g...@github.com:lzeng14/edk2.git
Branch: RemovePcdPeiCoreMaxXXX

Background as below.

Problem:
As static configuration from the PCDs, the binary PeiCore (for example
in FSP binary with dispatch mode) could not predict how many FVs,
Files or PPIs for different platforms.

Burden:
Platform developers need configure the PCDs accordingly for different
platforms.

To solve the problem and remove the burden, we can update code to
remove the using of PcdPeiCoreMaxFvSupported, PcdPeiCoreMaxPeimPerFv
and PcdPeiCoreMaxPpiSupported by extending buffer dynamically for FV,
File and PPI management.

Test done:
Build code with VS2012, VS2015 and GCC49.
Boot Nt32, Ovmf (including 32, 3264 and 64 with no SMM) to UEFI SHELL.
Boot some internal platforms (including a platform with dispatch mode
FSP binary) to UEFI SHELL and Windows.

More test will be welcome and appreciated. :)

Patches to update edk2-platforms Repo will be sent out separately.

Star Zeng (7):
  MdeModulePkg PeiCore: Remove the using of PcdPeiCoreMaxPeimPerFv
  SecurityPkg Tcg(2)Pei: Remove the using of PcdPeiCoreMaxFvSupported
  MdeModulePkg PeiCore: Remove the using of PcdPeiCoreMaxFvSupported
  MdeModulePkg PeiCore: Remove the using of PcdPeiCoreMaxPpiSupported
  OvmfPkg: Remove PcdPeiCoreMaxXXX PCDs' statement
  Vlv2TbltDevicePkg: Remove PcdPeiCoreMaxXXX PCDs' statement
  MdeModulePkg: Remove PcdPeiCoreMaxXXX PCDs

 MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 207 +--
 MdeModulePkg/Core/Pei/FwVol/FwVol.c   |  67 -
 MdeModulePkg/Core/Pei/PeiMain.h   |  91 +--
 MdeModulePkg/Core/Pei/PeiMain.inf |   3 -
 MdeModulePkg/Core/Pei/PeiMain/PeiMain.c   |  94 +++
 MdeModulePkg/Core/Pei/Ppi/Ppi.c   | 355 ++
 MdeModulePkg/MdeModulePkg.dec |  13 -
 MdeModulePkg/MdeModulePkg.uni |  12 -
 OvmfPkg/OvmfPkgIa32.dsc   |   2 -
 OvmfPkg/OvmfPkgIa32X64.dsc|   2 -
 OvmfPkg/OvmfPkgX64.dsc|   2 -
 SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c |  59 +++--
 SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf   |   1 -
 SecurityPkg/Tcg/TcgPei/TcgPei.c   |  59 +++--
 SecurityPkg/Tcg/TcgPei/TcgPei.inf |   1 -
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc   |   2 -
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc |   2 -
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc  |   2 -
 18 files changed, 560 insertions(+), 414 deletions(-)

-- 
2.7.0.windows.1

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


[edk2] [PATCH 1/7] MdeModulePkg PeiCore: Remove the using of PcdPeiCoreMaxPeimPerFv

2018-12-14 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1405

Background as below.

Problem:
As static configuration from the PCDs, the binary PeiCore (for example
in FSP binary with dispatch mode) could not predict how many FVs,
Files or PPIs for different platforms.

Burden:
Platform developers need configure the PCDs accordingly for different
platforms.

To solve the problem and remove the burden, we can update code to
remove the using of PcdPeiCoreMaxFvSupported, PcdPeiCoreMaxPeimPerFv
and PcdPeiCoreMaxPpiSupported by extending buffer dynamically for FV,
File and PPI management.

This patch removes the using of PcdPeiCoreMaxPeimPerFv in PeiCore.

Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Liming Gao 
Cc: Ruiyu Ni 
Cc: Michael D Kinney 
Cc: Nate DeSimone 
Cc: Chasel Chiu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 199 --
 MdeModulePkg/Core/Pei/PeiMain.h   |  17 ++-
 MdeModulePkg/Core/Pei/PeiMain.inf |   1 -
 MdeModulePkg/Core/Pei/PeiMain/PeiMain.c   |  48 +++
 4 files changed, 157 insertions(+), 108 deletions(-)

diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c 
b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
index f6bb35a5fe8d..71440bab9488 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -41,7 +41,8 @@ DiscoverPeimsAndOrderWithApriori (
   UINTN   PeimCount;
   EFI_GUID*Guid;
   EFI_PEI_FILE_HANDLE *TempFileHandles;
-  EFI_GUID*FileGuid;
+  EFI_GUID*TempFileGuid;
+  UINTN   TempPeimCount;
   EFI_PEI_FIRMWARE_VOLUME_PPI *FvPpi;
   EFI_FV_FILE_INFOFileInfo;
 
@@ -51,38 +52,106 @@ DiscoverPeimsAndOrderWithApriori (
   // Walk the FV and find all the PEIMs and the Apriori file.
   //
   AprioriFileHandle = NULL;
-  Private->CurrentFvFileHandles[0] = NULL;
+  Private->CurrentFvFileHandles = NULL;
   Guid = NULL;
-  FileHandle = NULL;
-  TempFileHandles = Private->FileHandles;
-  FileGuid= Private->FileGuid;
 
   //
-  // If the current Fv has been scanned, directly get its cachable record.
+  // If the current Fv has been scanned, directly get its cached records.
   //
-  if (Private->Fv[Private->CurrentPeimFvCount].ScanFv) {
-CopyMem (Private->CurrentFvFileHandles, 
Private->Fv[Private->CurrentPeimFvCount].FvFileHandles, sizeof 
(EFI_PEI_FILE_HANDLE) * PcdGet32 (PcdPeiCoreMaxPeimPerFv));
+  if (CoreFileHandle->ScanFv) {
+Private->CurrentFvFileHandles = CoreFileHandle->FvFileHandles;
 return;
   }
 
+  if (Private->TempPeimCount == 0) {
+//
+// Initialize the temp buffers.
+//
+Private->TempPeimCount = 32;
+Private->TempFileHandles = AllocatePool (sizeof (EFI_PEI_FILE_HANDLE) * 
32);
+ASSERT (Private->TempFileHandles != NULL);
+Private->TempFileGuid= AllocatePool (sizeof (EFI_GUID) * 32);
+ASSERT (Private->TempFileGuid != NULL);
+  }
+  TempFileHandles = Private->TempFileHandles;
+  TempFileGuid= Private->TempFileGuid;
+
   //
-  // Go ahead to scan this Fv, and cache FileHandles within it.
+  // Go ahead to scan this Fv, get PeimCount and cache FileHandles within it 
to TempFileHandles.
   //
-  Status = EFI_NOT_FOUND;
-  for (PeimCount = 0; PeimCount <= PcdGet32 (PcdPeiCoreMaxPeimPerFv); 
PeimCount++) {
+  PeimCount = 0;
+  FileHandle = NULL;
+  TempPeimCount = 0;
+  do {
 Status = FvPpi->FindFileByType (FvPpi, 
PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE, CoreFileHandle->FvHandle, 
);
-if (Status != EFI_SUCCESS || PeimCount == PcdGet32 
(PcdPeiCoreMaxPeimPerFv)) {
-  break;
+if (!EFI_ERROR (Status)) {
+  if (TempPeimCount < Private->TempPeimCount) {
+TempFileHandles[TempPeimCount] = FileHandle;
+TempPeimCount++;
+  }
+  PeimCount++;
 }
+  } while (!EFI_ERROR (Status));
 
-Private->CurrentFvFileHandles[PeimCount] = FileHandle;
+  DEBUG ((
+DEBUG_INFO,
+"%a(): Found 0x%x PEI FFS files in the %dth FV\n",
+__FUNCTION__,
+PeimCount,
+Private->CurrentPeimFvCount
+));
+
+  if (PeimCount == 0) {
+//
+// No PEIM FFS file is found, set ScanFv flag and return.
+//
+CoreFileHandle->ScanFv = TRUE;
+return;
+  }
+
+  if (PeimCount > Private->TempPeimCount) {
+//
+// The temp buffers are too small, allocate bigger ones.
+//
+TempFileHandles = AllocatePool (sizeof (EFI_PEI_FILE_HANDLE) * PeimCount);
+ASSERT (TempFileHandles != NULL);
+CopyMem (
+  TempFileHandles,
+  Private->TempFileHandles,
+  sizeof (EFI_PEI_FILE_HANDLE) * Private->TempPeimCount
+  );
+Private->TempFileHandles = TempFileHandles;
+TempFileGuid = AllocatePool (sizeof (EFI_GUID) * PeimCount);
+ASSERT (TempFileGuid != NULL);
+CopyMem (
+  TempFileGuid,
+ 

[edk2] [PATCH 2/7] SecurityPkg Tcg(2)Pei: Remove the using of PcdPeiCoreMaxFvSupported

2018-12-14 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1405

Background as below.

Problem:
As static configuration from the PCDs, the binary PeiCore (for example
in FSP binary with dispatch mode) could not predict how many FVs,
Files or PPIs for different platforms.

Burden:
Platform developers need configure the PCDs accordingly for different
platforms.

To solve the problem and remove the burden, we can update PeiCore to
remove the using of PcdPeiCoreMaxFvSupported, PcdPeiCoreMaxPeimPerFv
and PcdPeiCoreMaxPpiSupported by extending buffer dynamically for FV,
File and PPI management.

This patch removes the using of PcdPeiCoreMaxFvSupported in Tcg(2)Pei.

Cc: Chao Zhang 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c   | 59 +++--
 SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf |  1 -
 SecurityPkg/Tcg/TcgPei/TcgPei.c | 59 +++--
 SecurityPkg/Tcg/TcgPei/TcgPei.inf   |  1 -
 4 files changed, 74 insertions(+), 46 deletions(-)

diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c 
b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
index 09ef0c70a50b..152e3f737b56 100644
--- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
+++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
@@ -71,10 +71,17 @@ EFI_PEI_PPI_DESCRIPTOR  mTpmInitializationDonePpiList = {
   NULL
 };
 
+//
+// Number of firmware blobs to grow by each time we run out of room
+//
+#define FIRMWARE_BLOB_GROWTH_STEP 4
+
 EFI_PLATFORM_FIRMWARE_BLOB *mMeasuredBaseFvInfo;
+UINT32 mMeasuredMaxBaseFvIndex = 0;
 UINT32 mMeasuredBaseFvIndex = 0;
 
 EFI_PLATFORM_FIRMWARE_BLOB *mMeasuredChildFvInfo;
+UINT32 mMeasuredMaxChildFvIndex = 0;
 UINT32 mMeasuredChildFvIndex = 0;
 
 /**
@@ -615,13 +622,20 @@ MeasureFvImage (
   //
   // Add new FV into the measured FV list.
   //
-  ASSERT (mMeasuredBaseFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported));
-  if (mMeasuredBaseFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported)) {
-mMeasuredBaseFvInfo[mMeasuredBaseFvIndex].BlobBase   = FvBase;
-mMeasuredBaseFvInfo[mMeasuredBaseFvIndex].BlobLength = FvLength;
-mMeasuredBaseFvIndex++;
+  if (mMeasuredBaseFvIndex >= mMeasuredMaxBaseFvIndex) {
+mMeasuredBaseFvInfo = ReallocatePool (
+sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * 
mMeasuredMaxBaseFvIndex,
+sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * 
(mMeasuredMaxBaseFvIndex + FIRMWARE_BLOB_GROWTH_STEP),
+mMeasuredBaseFvInfo
+);
+ASSERT (mMeasuredBaseFvInfo != NULL);
+mMeasuredMaxBaseFvIndex = mMeasuredMaxBaseFvIndex + 
FIRMWARE_BLOB_GROWTH_STEP;
   }
 
+  mMeasuredBaseFvInfo[mMeasuredBaseFvIndex].BlobBase   = FvBase;
+  mMeasuredBaseFvInfo[mMeasuredBaseFvIndex].BlobLength = FvLength;
+  mMeasuredBaseFvIndex++;
+
   return Status;
 }
 
@@ -724,20 +738,26 @@ FirmwareVolmeInfoPpiNotifyCallback (
   //
   if (Fv->ParentFvName != NULL || Fv->ParentFileName != NULL ) {
 
-ASSERT (mMeasuredChildFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported));
-if (mMeasuredChildFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported)) {
-  //
-  // Check whether FV is in the measured child FV list.
-  //
-  for (Index = 0; Index < mMeasuredChildFvIndex; Index++) {
-if (mMeasuredChildFvInfo[Index].BlobBase == (EFI_PHYSICAL_ADDRESS) 
(UINTN) Fv->FvInfo) {
-  return EFI_SUCCESS;
-}
+if (mMeasuredChildFvIndex >= mMeasuredMaxChildFvIndex) {
+  mMeasuredChildFvInfo = ReallocatePool (
+   sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * 
mMeasuredMaxChildFvIndex,
+   sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * 
(mMeasuredMaxChildFvIndex + FIRMWARE_BLOB_GROWTH_STEP),
+   mMeasuredChildFvInfo
+   );
+  ASSERT (mMeasuredChildFvInfo != NULL);
+  mMeasuredMaxChildFvIndex = mMeasuredMaxChildFvIndex + 
FIRMWARE_BLOB_GROWTH_STEP;
+}
+//
+// Check whether FV is in the measured child FV list.
+//
+for (Index = 0; Index < mMeasuredChildFvIndex; Index++) {
+  if (mMeasuredChildFvInfo[Index].BlobBase == (EFI_PHYSICAL_ADDRESS) 
(UINTN) Fv->FvInfo) {
+return EFI_SUCCESS;
   }
-  mMeasuredChildFvInfo[mMeasuredChildFvIndex].BlobBase   = 
(EFI_PHYSICAL_ADDRESS) (UINTN) Fv->FvInfo;
-  mMeasuredChildFvInfo[mMeasuredChildFvIndex].BlobLength = Fv->FvInfoSize;
-  mMeasuredChildFvIndex++;
 }
+mMeasuredChildFvInfo[mMeasuredChildFvIndex].BlobBase   = 
(EFI_PHYSICAL_ADDRESS) (UINTN) Fv->FvInfo;
+mMeasuredChildFvInfo[mMeasuredChildFvIndex].BlobLength = Fv->FvInfoSize;
+mMeasuredChildFvIndex++;
 return EFI_SUCCESS;
   }
 
@@ -761,11 +781,6 @@ PeimEntryMP (
 {
   EFI_STATUSStatus;
 
-  mMeasuredBaseFvInfo  = (EFI_PLATFORM_FIRMWARE_BLOB *) AllocateZeroPool 
(sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * PcdGet32 (PcdPeiCoreMaxFvSupported));
-  ASSERT 

[edk2] [PATCH] ArmVirtPkg/ArmVirt.dsc.inc: define TcpIoLib resolution unconditionally

2018-12-14 Thread Ard Biesheuvel
Commit 9a67ba261fe9 ("ArmVirtPkg: Replace obsoleted network drivers
from platform DSC/FDF") failed to take into account that the now
unconditionally included IScsiDxe.inf from NetworkPkg requires a
resolution for TcpIoLib. Since specifying such a resolution is harmless
for platforms that have no networking enabled, let's just fix things
by dropping the conditionals around it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/ArmVirt.dsc.inc | 2 --
 1 file changed, 2 deletions(-)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index c3549c84d4c6..89c2db074711 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -80,9 +80,7 @@
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
   UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
   IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
-!if $(NETWORK_IP6_ENABLE) == TRUE
   TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
-!endif
 !if $(HTTP_BOOT_ENABLE) == TRUE
   HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
 !endif
-- 
2.17.1

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


[edk2] [PATCH v2 0/3] Introduce two public functions and remove internal ones

2018-12-14 Thread Shenglei Zhang
Introduce public functions CharToUpper and AsciiToUpper.
Remove internal functions InternalCharToUpper and InternalBaseLibAsciiToUpper.

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Cc: Leif Lindholm 
Cc: Laszlo Ersek 
Cc: Michael D Kinney 
Cc: Liming Gao 
Shenglei Zhang (3):
  BaseTools/Common: Remove InternalCharToUpper
  MdePkg/BaseLib: Remove the unused function InternalCharToUpper
  MdePkg/BaseLib: Introduce CharToUpper and AsciiToUpper publicly

 BaseTools/Source/C/Common/CommonLib.c | 16 ++---
 BaseTools/Source/C/Common/CommonLib.h |  4 ---
 MdePkg/Include/Library/BaseLib.h  | 40 +
 MdePkg/Library/BaseLib/BaseLibInternals.h | 42 ---
 MdePkg/Library/BaseLib/SafeString.c   |  8 ++---
 MdePkg/Library/BaseLib/String.c   | 35 ---
 6 files changed, 53 insertions(+), 92 deletions(-)

-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 3/3] MdePkg/BaseLib: Remove InternalCharToUpper and InternalBaseLibAsciiToUpper

2018-12-14 Thread Shenglei Zhang
InternalCharToUpper and InternalBaseLibAsciiToUpper are internal functions
and now we will introduce public functions that have the same effects.
So I remove their definition in BaseLibInternals.h.
https://bugzilla.tianocore.org/show_bug.cgi?id=1369

Cc: Leif Lindholm 
Cc: Laszlo Ersek 
Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 MdePkg/Library/BaseLib/BaseLibInternals.h | 42 ---
 1 file changed, 42 deletions(-)

diff --git a/MdePkg/Library/BaseLib/BaseLibInternals.h 
b/MdePkg/Library/BaseLib/BaseLibInternals.h
index 8855231c1a..9db925b157 100644
--- a/MdePkg/Library/BaseLib/BaseLibInternals.h
+++ b/MdePkg/Library/BaseLib/BaseLibInternals.h
@@ -469,28 +469,6 @@ InternalIsDecimalDigitCharacter (
   );
 
 
-/**
-  Convert a Unicode character to upper case only if
-  it maps to a valid small-case ASCII character.
-
-  This internal function only deal with Unicode character
-  which maps to a valid small-case ASCII character, i.e.
-  L'a' to L'z'. For other Unicode character, the input character
-  is returned directly.
-
-  @param  Char  The character to convert.
-
-  @retval LowerCharacter   If the Char is with range L'a' to L'z'.
-  @retval UnchangedOtherwise.
-
-**/
-CHAR16
-EFIAPI
-InternalCharToUpper (
-  IN  CHAR16Char
-  );
-
-
 /**
   Convert a Unicode character to numerical value.
 
@@ -552,26 +530,6 @@ InternalAsciiIsDecimalDigitCharacter (
   );
 
 
-/**
-  Converts a lowercase Ascii character to upper one.
-
-  If Chr is lowercase Ascii character, then converts it to upper one.
-
-  If Value >= 0xA0, then ASSERT().
-  If (Value & 0x0F) >= 0x0A, then ASSERT().
-
-  @param  Chr   one Ascii character
-
-  @return The uppercase value of Ascii character
-
-**/
-CHAR8
-EFIAPI
-InternalBaseLibAsciiToUpper (
-  IN  CHAR8 Chr
-  );
-
-
 /**
   Check if a ASCII character is a hexadecimal character.
 
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 1/3] BaseTools/Common: Remove InternalCharToUpper

2018-12-14 Thread Shenglei Zhang
InternalCharToUpper is an internal function.
So now remove InternalCharToUpper and replace it with a public
function CharToUpper in all places.
https://bugzilla.tianocore.org/show_bug.cgi?id=1369

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 BaseTools/Source/C/Common/CommonLib.c | 16 ++--
 BaseTools/Source/C/Common/CommonLib.h |  4 
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/BaseTools/Source/C/Common/CommonLib.c 
b/BaseTools/Source/C/Common/CommonLib.c
index 5c40fdb5fd..878b593a4e 100644
--- a/BaseTools/Source/C/Common/CommonLib.c
+++ b/BaseTools/Source/C/Common/CommonLib.c
@@ -740,18 +740,6 @@ Returns:
 #endif
 }
 
-CHAR16
-InternalCharToUpper (
-CHAR16Char
-  )
-{
-  if (Char >= L'a' && Char <= L'z') {
-return (CHAR16) (Char - (L'a' - L'A'));
-  }
-
-  return Char;
-}
-
 UINTN
 StrnLenS (
CONST CHAR16  *String,
@@ -1089,7 +1077,7 @@ StrHexToUint64S (
 String++;
   }
 
-  if (InternalCharToUpper (*String) == L'X') {
+  if (CharToUpper (*String) == L'X') {
 if (*(String - 1) != L'0') {
   *Data = 0;
   return RETURN_SUCCESS;
@@ -1264,7 +1252,7 @@ InternalHexCharToUintn (
 return Char - L'0';
   }
 
-  return (10 + InternalCharToUpper (Char) - L'A');
+  return (10 + CharToUpper (Char) - L'A');
 }
 
 
diff --git a/BaseTools/Source/C/Common/CommonLib.h 
b/BaseTools/Source/C/Common/CommonLib.h
index 4e1541bc70..b81584c7d4 100644
--- a/BaseTools/Source/C/Common/CommonLib.h
+++ b/BaseTools/Source/C/Common/CommonLib.h
@@ -304,10 +304,6 @@ StrnLenS (
UINTN MaxSize
   );
 
-CHAR16
-InternalCharToUpper (
-CHAR16Char
-  );
 
 INTN
 StrCmp (
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 2/3] MdePkg/BaseLib: Introduce CharToUpper and AsciiToUpper publicly

2018-12-14 Thread Shenglei Zhang
Introduce two public functions CharToUpper and AsciiToUpper.
They have the same functions as InternalCharToUpper and
InternalBaseLibAsciiToUpper.Considering the internal functions will
be removed,so directly I change their function names to the public ones'.
https://bugzilla.tianocore.org/show_bug.cgi?id=1369

v2:Update the commit message and title

Cc: Leif Lindholm 
Cc: Laszlo Ersek 
Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 MdePkg/Include/Library/BaseLib.h| 40 +
 MdePkg/Library/BaseLib/SafeString.c |  8 +++---
 MdePkg/Library/BaseLib/String.c | 35 +
 3 files changed, 51 insertions(+), 32 deletions(-)

diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 8cc086983d..b861d82287 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -2720,6 +2720,46 @@ AsciiStrnToUnicodeStrS (
   OUT UINTN *DestinationLength
   );
 
+/**
+  Convert a Unicode character to upper case only if
+  it maps to a valid small-case ASCII character.
+
+  This internal function only deal with Unicode character
+  which maps to a valid small-case ASCII character, i.e.
+  L'a' to L'z'. For other Unicode character, the input character
+  is returned directly.
+
+  @param  Char  The character to convert.
+
+  @retval LowerCharacter   If the Char is with range L'a' to L'z'.
+  @retval UnchangedOtherwise.
+
+**/
+CHAR16
+EFIAPI
+CharToUpper (
+  IN  CHAR16Char
+  );
+
+/**
+  Converts a lowercase Ascii character to upper one.
+
+  If Chr is lowercase Ascii character, then converts it to upper one.
+
+  If Value >= 0xA0, then ASSERT().
+  If (Value & 0x0F) >= 0x0A, then ASSERT().
+
+  @param  Chr   one Ascii character
+
+  @return The uppercase value of Ascii character
+
+**/
+CHAR8
+EFIAPI
+AsciiToUpper (
+  IN  CHAR8 Chr
+  );
+
 /**
   Converts an 8-bit value to an 8-bit BCD value.
 
diff --git a/MdePkg/Library/BaseLib/SafeString.c 
b/MdePkg/Library/BaseLib/SafeString.c
index 417497cbc9..17f88b46d8 100644
--- a/MdePkg/Library/BaseLib/SafeString.c
+++ b/MdePkg/Library/BaseLib/SafeString.c
@@ -905,7 +905,7 @@ StrHexToUintnS (
 String++;
   }
 
-  if (InternalCharToUpper (*String) == L'X') {
+  if (CharToUpper (*String) == L'X') {
 if (*(String - 1) != L'0') {
   *Data = 0;
   return RETURN_SUCCESS;
@@ -1036,7 +1036,7 @@ StrHexToUint64S (
 String++;
   }
 
-  if (InternalCharToUpper (*String) == L'X') {
+  if (CharToUpper (*String) == L'X') {
 if (*(String - 1) != L'0') {
   *Data = 0;
   return RETURN_SUCCESS;
@@ -2459,7 +2459,7 @@ AsciiStrHexToUintnS (
 String++;
   }
 
-  if (InternalBaseLibAsciiToUpper (*String) == 'X') {
+  if (AsciiToUpper (*String) == 'X') {
 if (*(String - 1) != '0') {
   *Data = 0;
   return RETURN_SUCCESS;
@@ -2586,7 +2586,7 @@ AsciiStrHexToUint64S (
 String++;
   }
 
-  if (InternalBaseLibAsciiToUpper (*String) == 'X') {
+  if (AsciiToUpper (*String) == 'X') {
 if (*(String - 1) != '0') {
   *Data = 0;
   return RETURN_SUCCESS;
diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c
index e6df12797d..ced1b3f975 100644
--- a/MdePkg/Library/BaseLib/String.c
+++ b/MdePkg/Library/BaseLib/String.c
@@ -552,7 +552,7 @@ InternalIsDecimalDigitCharacter (
 **/
 CHAR16
 EFIAPI
-InternalCharToUpper (
+CharToUpper (
   IN  CHAR16Char
   )
 {
@@ -586,7 +586,7 @@ InternalHexCharToUintn (
 return Char - L'0';
   }
 
-  return (10 + InternalCharToUpper (Char) - L'A');
+  return (10 + CharToUpper (Char) - L'A');
 }
 
 /**
@@ -1166,27 +1166,6 @@ AsciiStrCmp (
   return *FirstString - *SecondString;
 }
 
-/**
-  Converts a lowercase Ascii character to upper one.
-
-  If Chr is lowercase Ascii character, then converts it to upper one.
-
-  If Value >= 0xA0, then ASSERT().
-  If (Value & 0x0F) >= 0x0A, then ASSERT().
-
-  @param  Chr   one Ascii character
-
-  @return The uppercase value of Ascii character
-
-**/
-CHAR8
-EFIAPI
-InternalBaseLibAsciiToUpper (
-  IN  CHAR8 Chr
-  )
-{
-  return (UINT8) ((Chr >= 'a' && Chr <= 'z') ? Chr - ('a' - 'A') : Chr);
-}
 
 /**
   Convert a ASCII character to numerical value.
@@ -1211,7 +1190,7 @@ InternalAsciiHexCharToUintn (
 return Char - '0';
   }
 
-  return (10 + InternalBaseLibAsciiToUpper (Char) - 'A');
+  return (10 + AsciiToUpper (Char) - 'A');
 }
 
 
@@ -1260,13 +1239,13 @@ AsciiStriCmp (
   ASSERT (AsciiStrSize (FirstString));
   ASSERT (AsciiStrSize (SecondString));
 
-  UpperFirstString  = InternalBaseLibAsciiToUpper (*FirstString);
-  UpperSecondString = InternalBaseLibAsciiToUpper (*SecondString);
+  UpperFirstString  = AsciiToUpper (*FirstString);
+  UpperSecondString = AsciiToUpper (*SecondString);
   while ((*FirstString != '\0') && (*SecondString 

Re: [edk2] Obtaining TCG final events on systems without TCG2 log support

2018-12-14 Thread Laszlo Ersek
On 12/13/18 19:55, Matthew Garrett wrote:
> On Thu, Dec 13, 2018 at 01:36:09PM +0100, Laszlo Ersek wrote:
> 
>> (2) EFI_TCG2_FINAL_EVENTS_TABLE is defined with TCG_PCR_EVENT2 entries
>> *only*. TCG_PCR_EVENT is not accommodated.
>>
>>
>> That's the contradiction. If a platform is unable to produce
>> TCG_PCR_EVENT2 entries in GetEventLog(), it is fairly certainly also
>> unable to produce them in the final events table.
> 
> If a platform is unable to produce them in the final events table then 
> it's violating the spec.

The question is why it's made impossible to comply with the spec if the
platform only supports the 1.2 format.

> If the platform only offers the 1.2 log format 
> then it seems reasonable to expect that the events in the final events 
> table would only contain a SHA1, but a TCG_PCR_EVENT2 structure that 
> only contains SHA1s isn't significantly more complicated than an old 
> style event.
> 

OK... I guess that can be a valid interpretation. Would you please file
a TianoCore BZ ticket about it, as a feature request?

- URL: https://bugzilla.tianocore.org
- Product: Tianocore Feature Requests
- Component: Code
- Package: SecurityPkg

(I'm assuming this isn't a regression, i.e., it's not the case that the
feature used to work, but commit fd46e831bc33 regressed it.)

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


Re: [edk2] [PATCH 5/7] OvmfPkg: Remove PcdPeiCoreMaxXXX PCDs' statement

2018-12-14 Thread Ard Biesheuvel
On Fri, 14 Dec 2018 at 11:29, Star Zeng  wrote:
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1405
>
> The codes have been updated to not use PcdPeiCoreMaxFvSupported,
> PcdPeiCoreMaxPeimPerFv and PcdPeiCoreMaxPpiSupported, so their
> statement in platform DSC could be removed.
>
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Cc: Anthony Perard 
> Cc: Julien Grall 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 

Reviewed-by: Ard Biesheuvel 

> ---
>  OvmfPkg/OvmfPkgIa32.dsc| 2 --
>  OvmfPkg/OvmfPkgIa32X64.dsc | 2 --
>  OvmfPkg/OvmfPkgX64.dsc | 2 --
>  3 files changed, 6 deletions(-)
>
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index eccf34d3d1cb..f61ad8105728 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -437,8 +437,6 @@ [PcdsFixedAtBuild]
>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1
>gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
>gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
>  !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 4ac4faf5dc18..914f809d4bac 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -442,8 +442,6 @@ [PcdsFixedAtBuild]
>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1
>gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
>gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
>  !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index ecd5db416c47..4605970f30c9 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -442,8 +442,6 @@ [PcdsFixedAtBuild]
>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1
>gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
>gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
>  !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> --
> 2.7.0.windows.1
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools: Fix PcdArray issue

2018-12-14 Thread BobCF
https://bugzilla.tianocore.org/show_bug.cgi?id=1390
1. support hex number for array index
2. support Non-Dynamic Pcd for array data type
3. support {} and {CODE()} for array data type

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Ard Biesheuvel 
---
 BaseTools/Source/Python/Common/Misc.py|  6 ++
 .../Python/Workspace/BuildClassObject.py  |  3 +-
 .../Source/Python/Workspace/DscBuildData.py   | 59 ---
 3 files changed, 45 insertions(+), 23 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index b063f064fb..ea09f85e70 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -2144,10 +2144,16 @@ def CopyDict(ori_dict):
 if isinstance(ori_dict[key],(dict,OrderedDict)):
 new_dict[key] = CopyDict(ori_dict[key])
 else:
 new_dict[key] = ori_dict[key]
 return new_dict
+
+#
+# Remove the c/c++ comments: // and /* */
+#
+def RemoveCComments(ctext):
+return re.sub('//.*?\n|/\*.*?\*/', '\n', ctext, flags=re.S)
 ##
 #
 # This acts like the main() function for the script, unless it is 'import'ed 
into another
 # script.
 #
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index 008eee1a16..e9a1195fd2 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -17,11 +17,11 @@ import collections
 import re
 from collections import OrderedDict
 from Common.Misc import CopyDict
 import copy
 StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_\[\]]*$')
-ArrayIndex = re.compile("\[\s*\d{0,1}\s*\]")
+ArrayIndex = re.compile("\[\s*[0-9a-fA-FxX]*\s*\]")
 ## PcdClassObject
 #
 # This Class is used for PcdObject
 #
 # @param object: Inherited from object class
@@ -82,10 +82,11 @@ class PcdClassObject(object):
 dimension = ArrayIndex.findall(self._DatumType)
 for item in dimension:
 maxsize = item.lstrip("[").rstrip("]").strip()
 if not maxsize:
 maxsize = "-1"
+maxsize = str(int(maxsize,16)) if maxsize.startswith(("0x","0X")) 
else maxsize
 self._Capacity.append(maxsize)
 if hasattr(self, "SkuOverrideValues"):
 for sku in self.SkuOverrideValues:
 for defaultstore in self.SkuOverrideValues[sku]:
 fields = self.SkuOverrideValues[sku][defaultstore]
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index b485c75a84..37fb8d56b6 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -31,11 +31,11 @@ from .MetaDataTable import *
 from .MetaFileTable import *
 from .MetaFileParser import *
 
 from .WorkspaceCommon import GetDeclaredPcd
 from Common.Misc import AnalyzeDscPcd
-from Common.Misc import ProcessDuplicatedInf
+from Common.Misc import ProcessDuplicatedInf,RemoveCComments
 import re
 from Common.Parsing import IsValidWord
 from Common.VariableAttributes import VariableAttributes
 import Common.GlobalData as GlobalData
 import subprocess
@@ -1573,11 +1573,11 @@ class DscBuildData(PlatformBuildClassObject):
 mindefaultstorename = 
DefaultStoreObj.GetMin(PcdDefaultStoreSet)
 
str_pcd_obj.SkuInfoList[self.SkuIdMgr.SystemSkuId].HiiDefaultValue = 
str_pcd_obj.SkuInfoList[self.SkuIdMgr.SystemSkuId].DefaultStoreDict[mindefaultstorename]
 
 for str_pcd_obj in S_pcd_set.values():
 
-str_pcd_obj.MaxDatumSize = 
self.GetStructurePcdMaxSize(str_pcd_obj)
+str_pcd_obj.MaxDatumSize = 
DscBuildData.GetStructurePcdMaxSize(str_pcd_obj)
 Pcds[str_pcd_obj.TokenCName, str_pcd_obj.TokenSpaceGuidCName] 
= str_pcd_obj
 Pcds[str_pcd_obj.TokenCName, 
str_pcd_obj.TokenSpaceGuidCName].CustomAttribute['IsStru']=True
 
 for pcdkey in Pcds:
 pcd = Pcds[pcdkey]
@@ -1687,13 +1687,14 @@ class DscBuildData(PlatformBuildClassObject):
 if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue:
 Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
 Pcds[PcdCName, 
TokenSpaceGuid].DscRawValue[SkuName][TAB_DEFAULT_STORES_DEFAULT] = Settings[0]
 return Pcds
 
-def GetStructurePcdMaxSize(self, str_pcd):
+@staticmethod
+def GetStructurePcdMaxSize(str_pcd):
 pcd_default_value = str_pcd.DefaultValue
-sku_values = [skuobj.HiiDefaultValue if str_pcd.Type in 
[self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], 
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]] else skuobj.DefaultValue for 
skuobj in str_pcd.SkuInfoList.values()]
+sku_values = [skuobj.HiiDefaultValue if str_pcd.Type in 

Re: [edk2] [PATCH v2] ShellPkg/UefiShellDebug1CommandsLib: Remove the unused function CharToUpper

2018-12-14 Thread Laszlo Ersek
On 12/14/18 08:56, Shenglei Zhang wrote:
> CharToUpper is an unused function, so it will be removed.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1399
> 
> v2:Update the title.
> 
> Cc: Laszlo Ersek 
> Cc: Jaben Carsey 
> Cc: Ruiyu Ni 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang 
> ---
>  .../UefiShellDebug1CommandsLib.c  | 28 ---
>  1 file changed, 28 deletions(-)
> 
> diff --git 
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c 
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c
> index bd4dfa98f7..480441b0f9 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c
> @@ -113,34 +113,6 @@ UefiShellDebug1CommandsLibDestructor (
>return (EFI_SUCCESS);
>  }
>  
> -/**
> -  Convert a Unicode character to upper case only if
> -  it maps to a valid small-case ASCII character.
> -
> -  This internal function only deal with Unicode character
> -  which maps to a valid small-case ASCII character, i.e.
> -  L'a' to L'z'. For other Unicode character, the input character
> -  is returned directly.
> -
> -  @param  Char  The character to convert.
> -
> -  @retval LowerCharacter   If the Char is with range L'a' to L'z'.
> -  @retval UnchangedOtherwise.
> -
> -
> -  //Stolen from MdePkg Baselib
> -**/
> -CHAR16
> -CharToUpper (
> -  IN  CHAR16Char
> -  )
> -{
> -  if (Char >= L'a' && Char <= L'z') {
> -return (CHAR16) (Char - (L'a' - L'A'));
> -  }
> -
> -  return Char;
> -}
>  
>  /**
>Function returns a system configuration table that is stored in the
> 

Reviewed-by: Laszlo Ersek 

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


Re: [edk2] [Patch] BaseTools: Fix PcdArray issue

2018-12-14 Thread Philippe Mathieu-Daudé
Hi Bob,

On 12/14/18 10:55 AM, BobCF wrote:
> https://bugzilla.tianocore.org/show_bug.cgi?id=1390
> 1. support hex number for array index
> 2. support Non-Dynamic Pcd for array data type
> 3. support {} and {CODE()} for array data type
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> Cc: Ard Biesheuvel 
> ---
>  BaseTools/Source/Python/Common/Misc.py|  6 ++
>  .../Python/Workspace/BuildClassObject.py  |  3 +-
>  .../Source/Python/Workspace/DscBuildData.py   | 59 ---
>  3 files changed, 45 insertions(+), 23 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Common/Misc.py 
> b/BaseTools/Source/Python/Common/Misc.py
> index b063f064fb..ea09f85e70 100644
> --- a/BaseTools/Source/Python/Common/Misc.py
> +++ b/BaseTools/Source/Python/Common/Misc.py
> @@ -2144,10 +2144,16 @@ def CopyDict(ori_dict):
>  if isinstance(ori_dict[key],(dict,OrderedDict)):
>  new_dict[key] = CopyDict(ori_dict[key])
>  else:
>  new_dict[key] = ori_dict[key]
>  return new_dict
> +
> +#
> +# Remove the c/c++ comments: // and /* */
> +#
> +def RemoveCComments(ctext):
> +return re.sub('//.*?\n|/\*.*?\*/', '\n', ctext, flags=re.S)

What about multi-line comments?

>  ##
>  #
>  # This acts like the main() function for the script, unless it is 'import'ed 
> into another
>  # script.
>  #
> diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
> b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> index 008eee1a16..e9a1195fd2 100644
> --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> @@ -17,11 +17,11 @@ import collections
>  import re
>  from collections import OrderedDict
>  from Common.Misc import CopyDict
>  import copy
>  StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_\[\]]*$')
> -ArrayIndex = re.compile("\[\s*\d{0,1}\s*\]")
> +ArrayIndex = re.compile("\[\s*[0-9a-fA-FxX]*\s*\]")

These regex changes seems easily unit-testable, is it possible to add
some tests? In particular the RemoveCComments() seems fragile.

>  ## PcdClassObject
>  #
>  # This Class is used for PcdObject
>  #
>  # @param object: Inherited from object class
> @@ -82,10 +82,11 @@ class PcdClassObject(object):
>  dimension = ArrayIndex.findall(self._DatumType)
>  for item in dimension:
>  maxsize = item.lstrip("[").rstrip("]").strip()
>  if not maxsize:
>  maxsize = "-1"
> +maxsize = str(int(maxsize,16)) if 
> maxsize.startswith(("0x","0X")) else maxsize
>  self._Capacity.append(maxsize)
>  if hasattr(self, "SkuOverrideValues"):
>  for sku in self.SkuOverrideValues:
>  for defaultstore in self.SkuOverrideValues[sku]:
>  fields = self.SkuOverrideValues[sku][defaultstore]
> diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
> b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index b485c75a84..37fb8d56b6 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -31,11 +31,11 @@ from .MetaDataTable import *
>  from .MetaFileTable import *
>  from .MetaFileParser import *
>  
>  from .WorkspaceCommon import GetDeclaredPcd
>  from Common.Misc import AnalyzeDscPcd
> -from Common.Misc import ProcessDuplicatedInf
> +from Common.Misc import ProcessDuplicatedInf,RemoveCComments
>  import re
>  from Common.Parsing import IsValidWord
>  from Common.VariableAttributes import VariableAttributes
>  import Common.GlobalData as GlobalData
>  import subprocess
> @@ -1573,11 +1573,11 @@ class DscBuildData(PlatformBuildClassObject):
>  mindefaultstorename = 
> DefaultStoreObj.GetMin(PcdDefaultStoreSet)
>  
> str_pcd_obj.SkuInfoList[self.SkuIdMgr.SystemSkuId].HiiDefaultValue = 
> str_pcd_obj.SkuInfoList[self.SkuIdMgr.SystemSkuId].DefaultStoreDict[mindefaultstorename]
>  
>  for str_pcd_obj in S_pcd_set.values():
>  
> -str_pcd_obj.MaxDatumSize = 
> self.GetStructurePcdMaxSize(str_pcd_obj)
> +str_pcd_obj.MaxDatumSize = 
> DscBuildData.GetStructurePcdMaxSize(str_pcd_obj)

This static change isn't described in the commit, if you think this
isn't worth a separate commit, can you add a note about it?

>  Pcds[str_pcd_obj.TokenCName, 
> str_pcd_obj.TokenSpaceGuidCName] = str_pcd_obj
>  Pcds[str_pcd_obj.TokenCName, 
> str_pcd_obj.TokenSpaceGuidCName].CustomAttribute['IsStru']=True
>  
>  for pcdkey in Pcds:
>  pcd = Pcds[pcdkey]
> @@ -1687,13 +1687,14 @@ class DscBuildData(PlatformBuildClassObject):
>  if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue:
>  Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
>  Pcds[PcdCName, 
> 

Re: [edk2] [PATCH] Maintainers.txt: Change package maintainer and reviewer of CryptoPkg.

2018-12-14 Thread Laszlo Ersek
On 12/14/18 01:47, Ye, Ting wrote:
> Thanks all for the info and follow up. Laszlo, please let me know if there is 
> additional step you think I need follow, thanks.

In the future, please let's make sure that the maintainer that is about
to give up the role posts the maintenance change *in advance*.

It's not a rule I invented or even campaigned for, but it's there, and
so we should attempt to follow it.

No more comments on this particular update.

Thanks,
Laszlo

> From: Long, Qin
> Sent: Friday, December 14, 2018 2:30 AM
> To: Gao, Liming ; Laszlo Ersek ; Ye, 
> Ting 
> Cc: edk2-devel@lists.01.org
> Subject: RE: [edk2] [PATCH] Maintainers.txt: Change package maintainer and 
> reviewer of CryptoPkg.
> 
> Confirmed by Long, Qin mailto:qin.l...@intel.com>>
> 
> (And sorry for this rule breaking caused by me. I didn't notice this updates.)
> 
> Best Regards & Thanks,
> LONG, Qin
> 
> From: Gao, Liming
> Sent: Thursday, December 13, 2018 9:15 PM
> To: Laszlo Ersek mailto:ler...@redhat.com>>; Ye, Ting 
> mailto:ting...@intel.com>>; Long, Qin 
> mailto:qin.l...@intel.com>>
> Cc: edk2-devel@lists.01.org
> Subject: RE: [edk2] [PATCH] Maintainers.txt: Change package maintainer and 
> reviewer of CryptoPkg.
> 
> Laszlo:
>   Yes. Long, Qin should send this patch. Because Long, Qin changes to another 
> work group for a while, he doesn't work on edk2 project. Ting directly sends 
> the patch to remove his name. I just include Long, Qin, and let him confirm 
> this change.
> 
> Thanks
> Liming
>> -Original Message-
>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
>> Laszlo Ersek
>> Sent: Thursday, December 13, 2018 6:38 PM
>> To: Ye, Ting mailto:ting...@intel.com>>
>> Cc: edk2-devel@lists.01.org
>> Subject: Re: [edk2] [PATCH] Maintainers.txt: Change package maintainer and 
>> reviewer of CryptoPkg.
>>
>> Hi Ting,
>>
>> On 12/13/18 08:41, tye1 wrote:
>>> Cc: Gang Wei mailto:gang@intel.com>>
>>> Cc: Jian Wang mailto:jian.j.w...@intel.com>>
>>>
>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>> Signed-off-by: Ting Ye mailto:ting...@intel.com>>
>>> ---
>>>  Maintainers.txt | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Maintainers.txt b/Maintainers.txt
>>> index 001d8ba010..d5cb305da9 100644
>>> --- a/Maintainers.txt
>>> +++ b/Maintainers.txt
>>> @@ -102,8 +102,9 @@ S: Maintained
>>>
>>>  CryptoPkg
>>>  W: https://github.com/tianocore/tianocore.github.io/wiki/CryptoPkg
>>> -M: Qin Long mailto:qin.l...@intel.com>>
>>>  M: Ting Ye mailto:ting...@intel.com>>
>>> +R: Gang Wei mailto:gang@intel.com>>
>>> +R: Jian Wang mailto:jian.j.w...@intel.com>>
>>>
>>>  DynamicTablesPkg
>>>  W: https://github.com/tianocore/tianocore.github.io/wiki/DynamicTablesPkg
>>>
>>
>> This patch does not conform to the rule that we added lately; please see
>> commit 9ebef6c0a7d3 ("Maintainers.txt: Add the rule to hand over the
>> package maintain role", 2018-11-29).
>>
>> In other words, the patch should be sent out by Qin Long. Even though
>> you co-maintain CryptoPkg with Qin Long, you shouldn't be able to
>> deprive Qin Long from the role.
>>
>> Thanks,
>> Laszlo
>> ___
>> 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] [edk2-platforms PATCH 0/2] Remove PcdPeiCoreMaxXXX PCDs

2018-12-14 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1405

https://lists.01.org/pipermail/edk2-devel/2018-December/033985.html
is going to remove PcdPeiCoreMaxFvSupported, PcdPeiCoreMaxPeimPerFv
and PcdPeiCoreMaxPpiSupported in edk2 Repo, this patch series is to
update edk2-platforms Repo accordingly, these patches will be pushed
after [PATCH 4/7] and before [PATCH 7/7] at
https://lists.01.org/pipermail/edk2-devel/2018-December/033985.html
after code review.

Star Zeng (2):
  KabylakeOpenBoardPkg: Remove PcdPeiCoreMaxXXX PCDs' statement
  PurleyOpenBoardPkg: Remove PcdPeiCoreMaxXXX PCDs' statement

 .../Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc| 7 +--
 .../Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkgPcd.dsc | 2 --
 2 files changed, 1 insertion(+), 8 deletions(-)

-- 
2.7.0.windows.1

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


[edk2] [edk2-platforms PATCH 1/2] KabylakeOpenBoardPkg: Remove PcdPeiCoreMaxXXX PCDs' statement

2018-12-14 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1405

The codes have been updated to not use PcdPeiCoreMaxFvSupported,
PcdPeiCoreMaxPeimPerFv and PcdPeiCoreMaxPpiSupported, so their
statement in platform DSC could be removed.

Cc: Chasel Chiu 
Cc: Michael A Kubacki 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 .../Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc| 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git 
a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc 
b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc
index 92b9ad8bcf60..35f383ecef33 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Platform description.
 #
-# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 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.
@@ -62,14 +62,9 @@ [PcdsFixedAtBuild.common]
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x5000
   gEfiMdeModulePkgTokenSpaceGuid.PcdHwErrStorageSize|0x0800
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x400
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|30
-
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|60
-
 
   gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport|FALSE
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPpiSupported|128
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout|1
 !if $(TARGET) == RELEASE
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0
-- 
2.7.0.windows.1

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


[edk2] [edk2-platforms PATCH 2/2] PurleyOpenBoardPkg: Remove PcdPeiCoreMaxXXX PCDs' statement

2018-12-14 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1405

The codes have been updated to not use PcdPeiCoreMaxFvSupported,
PcdPeiCoreMaxPeimPerFv and PcdPeiCoreMaxPpiSupported, so their
statement in platform DSC could be removed.

Cc: Shifei A Lu 
Cc: Xiaohu Zhou 
Cc: Isaac W Oram 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkgPcd.dsc | 2 --
 1 file changed, 2 deletions(-)

diff --git 
a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkgPcd.dsc 
b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkgPcd.dsc
index bfe32aba1c5c..bfdf5c0c3874 100644
--- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkgPcd.dsc
+++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkgPcd.dsc
@@ -91,8 +91,6 @@ [PcdsFixedAtBuild.common]
   gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|0x0
   gEfiMdePkgTokenSpaceGuid.PcdFSBClock|1
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeiStackSize|0x10
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|32
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPpiSupported|128
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0x170
 
   gEfiCpuTokenSpaceGuid.PcdCpuIEDRamSize|0x40
-- 
2.7.0.windows.1

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


[edk2] Line endings: Was "Re: [edk2-test][Patch] uefi-sct/SctPkg:Correct macro name style in HwErrRecVariable Test"

2018-12-14 Thread Leif Lindholm
Hmm, this gets me thinking...

We were discussing before about doing a line ending conversion in
edk2, and let the git gools provide native line endings (as designed).

Is this a good opportunity to run a pilot with edk2-test, where much
less history will be lost?

Regards,

Leif

On Fri, Dec 14, 2018 at 07:12:31AM +, Jin, Eric wrote:
> Hello Supreeth,
> 
> I use "Apply Patch Serial" operation provided by TortoiseGit to do the 
> applying.
> The operation is equivalent to "git.exe am --3way --ignore-space-change 
> --keep-cr Fix.patch"
> 
> What is your command to apply patch?
> 
> I observe the same failure with "git.exe am Fix.patch" and 
> "--ignore-space-change " is the key.
> I am not sure if it is the mail-patch-conversion cause or not.
> 
> And the patch "[edk2][edk2-test][PATCH v1 1/1] uefi-sct: Change line endings 
> to CR LF. "  also has the same failure behavior without 
> "--ignore-space-change " on my side. 
> 
> Best Regards
> Eric
> 
> -Original Message-
> From: Supreeth Venkatesh  
> Sent: Thursday, December 13, 2018 5:07 AM
> To: Jin, Eric ; edk2-devel@lists.01.org
> Cc: Leif Lindholm 
> Subject: Re: [edk2-test][Patch] uefi-sct/SctPkg:Correct macro name style in 
> HwErrRecVariable Test
> 
> 
> Eric,
> 
> Nothing wrong with code.
> 
> However, when applying this patch with git am, I encounter the below errors. 
> (not sure if it is related to mailbox configuration).
> Not sure if it is my mailbox, could you please test it on your side using git 
> am and let me know?
> 
> git am
> ./patches/0001_SctPkg\:Correct_macro_name_style_in_HwErrRecVariable_Te
> st.mbox
> Applying: uefi-sct/SctPkg:Correct macro name style in HwErrRecVariable Test
> error: patch failed: uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxT
> est/VariableServicesBBTestMain.h:131
> error: uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxT
> est/VariableServicesBBTestMain.h: patch does not apply
> error: patch failed: uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxT
> est/VariableServicesBBTestFunction.c:2855
> error: uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxT
> est/VariableServicesBBTestFunction.c: patch does not apply Patch failed at 
> 0001 uefi-sct/SctPkg:Correct macro name style in HwErrRecVariable Test Use 
> 'git am --show-current-patch' to see the failed patch When you have resolved 
> this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
> 
> Thanks,
> Supreeth
> On Wed, 2018-12-12 at 11:32 +0800, Eric Jin wrote:
> > Name macros appropriately to follow the rule in coding standards 
> > specification.
> > Change the following macro from variable style 
> > HwErrRecVariableNameLength HwErrRecVariableNamePrefixLength 
> > HwErrRecVariableNameIndexLength to macro style.
> > HW_ERR_REC_VARIABLE_NAME_LEN
> > HW_ERR_REC_VARIABLE_NAME_PREFIX_LEN
> > HW_ERR_REC_VARIABLE_NAME_INDEX_LEN
> > 
> > Cc: Leif Lindholm 
> > Cc: Supreeth Venkatesh 
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Eric Jin 
> > ---
> >  uefi-
> > sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> > xTest/VariableServicesBBTestMain.h |  6 +++---
> >  uefi-
> > sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> > xTest/VariableServicesBBTestFunction.c | 22 +++---
> >  2 files changed, 14 insertions(+), 14 deletions(-)
> > 
> > diff --git a/uefi-
> > sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> > xTest/VariableServicesBBTestMain.h b/uefi- 
> > sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> > xTest/VariableServicesBBTestMain.h
> > index 426b762..7eaa56d 100644
> > --- a/uefi-
> > sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> > xTest/VariableServicesBBTestMain.h
> > +++ b/uefi-
> > sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> > xTest/VariableServicesBBTestMain.h
> > @@ -131,9 +131,9 @@ Abstract:
> >  // The prefix length is 8, index length is 4.
> >  // Consider the tail of string, the name length is 13.
> >  //
> > -#define HwErrRecVariableNameLength   13
> > -#define HwErrRecVariableNamePrefixLength 8 -#define 
> > HwErrRecVariableNameIndexLength  4
> > +#define HW_ERR_REC_VARIABLE_NAME_LEN   13
> > +#define HW_ERR_REC_VARIABLE_NAME_PREFIX_LEN8
> > +#define HW_ERR_REC_VARIABLE_NAME_INDEX_LEN 4
> >  
> >  //
> >  // Global Variables
> > diff --git a/uefi-
> > sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> > xTest/VariableServicesBBTestFunction.c b/uefi- 
> > sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> > xTest/VariableServicesBBTestFunction.c
> > index a016476..015a78a 100644
> > --- a/uefi-
> > 

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

2018-12-14 Thread Jagadeesh Ujja
Hi Liming,

On Thu, Dec 13, 2018 at 8:02 PM Gao, Liming  wrote:
>
> I add my comments.

Thanks for the clarification. Will fix the patches accordingly.

Regards,
Jagadeesh.

>
> > -Original Message-
> > From: Jagadeesh Ujja [mailto:jagadeesh.u...@arm.com]
> > Sent: Thursday, December 13, 2018 8:00 PM
> > To: Gao, Liming 
> > Cc: edk2-devel@lists.01.org; Zhang, Chao B ; Leif 
> > Lindholm 
> > Subject: Re: [edk2] [RFC PATCH v4 00/12] Extend secure variable service to 
> > be usable from Standalone MM
> >
> > Hi Liming
> >
> > On Wed, Dec 12, 2018 at 8:44 PM Gao, Liming  wrote:
> > >
> > > This version is better. I have some comments on edk2 coding style.
> >
> > Thank you for your review. Please see reply to your comments below.
> >
> > >
> > > 1. This patch set can't be applied in edk2 trunk. Seemly, they base on 
> > > previous version edk2.
> >
> > The v4 patchset was based on the tip of the edk2 master branch on the
> > day it was posted. The commit id on which this series was based is
> > "f7f94ffe".
> >
> So, can you fork edk2 tree and upload these changes into your branch in fork 
> edk2 tree? If so, it will be easy for review.
>
> > > 2. Pcd is for Standalone MM Code, not specific for Variable. So, I 
> > > suggest to use the generic name PcdStandaloneMmCodeEnabled. Its
> > description is also required to be updated.
> >
> > The intention of the changes done in the patchset is to reuse the
> > variable service driver in MM_STANDALONE mode. There could be
> > platforms that enable Standalone MM mode but would not want a  secure
> > storage for EFI variables. In which case, the PCD named
> > PcdStandaloneMmCodeEnabled would not be sufficient. And this the
> > reason it was named " PcdStandaloneMmVariableEnabled".
> >
> I see this PCD is also used in 
> CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c. So, I understand it is 
> general purpose, not only for Variable.
> If it is for Variable only, please define this PCD into MdeModulePkg instead 
> of MdePkg.
>
> > > 3. Library header file name (StandaloneMmServicesTableLib.h) is also 
> > > library class name. Library class name and header file mapping
> > is required to be listed in MdePkg.dec file [LibraryClasses] section. And, 
> > this header file doesn't need to include Library/DebugLib.h,
> > because it doesn't depend on it.
> > > 4. Library implementation INF file (StandaloneMmRuntimeDxe.inf) should 
> > > list its library class name in LIBRARY_CLASS of [Defines]
> > section. Its library class name is StandaloneMmServicesTableLib. And, 
> > MdePkg library implementation depends on MdePkg.dec only in
> > [Packages] section.
> > > 5. Library implementation should implement all interfaces defined in 
> > > library class header file. StandaloneMmRuntimeDxe library
> > should initialize gMmst as NULL if it has no real value. 
> > StandaloneMmRuntimeDxe library doesn't depend on any other library class. It
> > doesn't need to list other library class in its [LibraryClasses] section of 
> > INF file.
> >
> > Point 3, 4 and 5 will be fixed
> >
> > > 6. When other module depends on this library class header file, it should 
> > > list StandaloneMmServicesTableLib in its [LibraryClasses]
> > section of INF file.
> > > 7. Platform DSC also needs to list LibraryClassName|Library 
> > > implementation INF in [LibraryClasses] section.
> >
> > Points 6 and 7 are taken care and are part of edk2platform specific
> > changes, will post those changes soon
> >
> > > 8. I don't suggest to add AsmLfence API in BaseLib for AArch64, because 
> > > it is X86 specific API. I suggest to update Variable driver with
> > the wrapper function FenceFunc() for AsmLfence() and MemoryFence(). 
> > FenceFunc can be implemented for the different arch in
> > Variable driver. Variable driver will call FenceFunc() instead of 
> > AsmLfence(). So, only variable driver is required to be updated. There is
> > no change in BaseLib.
> > >
> > Okay, the variable driver can be updated to call a wrapper
> > "FenceFunc()" but wouldn't it be useful to add the architecture
> > specific implantation of this in BaseLib. In that way, not just the
> > variable driver but other drivers can use this implementation of
> > "FenceFunc()". For instance,
> > FaultTolerantWriteDxe/FaultTolerantWriteSmm.c does calls to
> > AsmLfence() and an architecture specific implementation of
> > "FenceFunc()" in BaseLib can be reused in FaultTolerantWriteDxe driver
> > as well.
> >
> Now, there are two drivers VariableSmm and FaultTolerantWriteSmm that have 
> this usage. For sharing the code, I prefer not to add new API, and
> change AsmLfence() as the generic API for all processors. It is similar to 
> current patch. But, I would like to see one AsmLfence() declaration in 
> BaseLib.h.
> Its description can list the different behavior for the different processors. 
> Then, you add its implementation for Arm and AArch64 arch.
>
> > > > -Original Message-
> > > > From: Jagadeesh Ujja 

[edk2] [PATCH 3/7] MdeModulePkg PeiCore: Remove the using of PcdPeiCoreMaxFvSupported

2018-12-14 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1405

Background as below.

Problem:
As static configuration from the PCDs, the binary PeiCore (for example
in FSP binary with dispatch mode) could not predict how many FVs,
Files or PPIs for different platforms.

Burden:
Platform developers need configure the PCDs accordingly for different
platforms.

To solve the problem and remove the burden, we can update PeiCore to
remove the using of PcdPeiCoreMaxFvSupported, PcdPeiCoreMaxPeimPerFv
and PcdPeiCoreMaxPpiSupported by extending buffer dynamically for FV,
File and PPI management.

This patch removes the using of PcdPeiCoreMaxFvSupported in PeiCore.

Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Liming Gao 
Cc: Ruiyu Ni 
Cc: Michael D Kinney 
Cc: Nate DeSimone 
Cc: Chasel Chiu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Core/Pei/FwVol/FwVol.c | 67 ++---
 MdeModulePkg/Core/Pei/PeiMain.h | 15 +++-
 MdeModulePkg/Core/Pei/PeiMain.inf   |  1 -
 MdeModulePkg/Core/Pei/PeiMain/PeiMain.c | 16 
 4 files changed, 75 insertions(+), 24 deletions(-)

diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c 
b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
index 5629c9a1ce20..0a67b96bf1e3 100644
--- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c
+++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
@@ -503,6 +503,10 @@ PeiInitializeFv (
 );
   ASSERT_EFI_ERROR (Status);
 
+  PrivateData->Fv = AllocateZeroPool (sizeof (PEI_CORE_FV_HANDLE) * 
FV_GROWTH_STEP);
+  ASSERT (PrivateData->Fv != NULL);
+  PrivateData->MaxFvCount = FV_GROWTH_STEP;
+
   //
   // Update internal PEI_CORE_FV array.
   //
@@ -560,6 +564,7 @@ FirmwareVolmeInfoPpiNotifyCallback (
   VOID  *DepexData;
   BOOLEAN   IsFvInfo2;
   UINTN CurFvCount;
+  VOID  *TempPtr;
 
   Status   = EFI_SUCCESS;
   PrivateData  = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
@@ -626,10 +631,21 @@ FirmwareVolmeInfoPpiNotifyCallback (
   }
 }
 
-if (PrivateData->FvCount >= PcdGet32 (PcdPeiCoreMaxFvSupported)) {
-  DEBUG ((EFI_D_ERROR, "The number of Fv Images (%d) exceed the max 
supported FVs (%d) in Pei", PrivateData->FvCount + 1, PcdGet32 
(PcdPeiCoreMaxFvSupported)));
-  DEBUG ((EFI_D_ERROR, "PcdPeiCoreMaxFvSupported value need be 
reconfigurated in DSC"));
-  ASSERT (FALSE);
+if (PrivateData->FvCount >= PrivateData->MaxFvCount) {
+  //
+  // Run out of room, grow the buffer.
+  //
+  TempPtr = AllocateZeroPool (
+  sizeof (PEI_CORE_FV_HANDLE) * (PrivateData->MaxFvCount + 
FV_GROWTH_STEP)
+  );
+  ASSERT (TempPtr != NULL);
+  CopyMem (
+TempPtr,
+PrivateData->Fv,
+sizeof (PEI_CORE_FV_HANDLE) * PrivateData->MaxFvCount
+);
+  PrivateData->Fv = TempPtr;
+  PrivateData->MaxFvCount = PrivateData->MaxFvCount + FV_GROWTH_STEP;
 }
 
 //
@@ -2157,7 +2173,6 @@ FindNextCoreFvHandle (
 }
   }
 
-  ASSERT (Private->FvCount <= PcdGet32 (PcdPeiCoreMaxFvSupported));
   if (Instance >= Private->FvCount) {
 return NULL;
   }
@@ -2205,7 +2220,7 @@ PeiReinitializeFv (
   //
   // Fixup all FvPpi pointers for the implementation in flash to permanent 
memory.
   //
-  for (Index = 0; Index < PcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) {
+  for (Index = 0; Index < PrivateData->FvCount; Index ++) {
 if (PrivateData->Fv[Index].FvPpi == OldFfsFvPpi) {
   PrivateData->Fv[Index].FvPpi = 
 }
@@ -2233,7 +2248,7 @@ PeiReinitializeFv (
   //
   // Fixup all FvPpi pointers for the implementation in flash to permanent 
memory.
   //
-  for (Index = 0; Index < PcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) {
+  for (Index = 0; Index < PrivateData->FvCount; Index ++) {
 if (PrivateData->Fv[Index].FvPpi == OldFfsFvPpi) {
   PrivateData->Fv[Index].FvPpi = 
 }
@@ -2263,9 +2278,23 @@ AddUnknownFormatFvInfo (
   )
 {
   PEI_CORE_UNKNOW_FORMAT_FV_INFO*NewUnknownFv;
+  VOID  *TempPtr;
 
-  if (PrivateData->UnknownFvInfoCount + 1 >= PcdGet32 
(PcdPeiCoreMaxFvSupported)) {
-return EFI_OUT_OF_RESOURCES;
+  if (PrivateData->UnknownFvInfoCount >= PrivateData->MaxUnknownFvInfoCount) {
+//
+// Run out of room, grow the buffer.
+//
+TempPtr = AllocateZeroPool (
+sizeof (PEI_CORE_UNKNOW_FORMAT_FV_INFO) * 
(PrivateData->MaxUnknownFvInfoCount + FV_GROWTH_STEP)
+);
+ASSERT (TempPtr != NULL);
+CopyMem (
+  TempPtr,
+  PrivateData->UnknownFvInfo,
+  sizeof (PEI_CORE_UNKNOW_FORMAT_FV_INFO) * 
PrivateData->MaxUnknownFvInfoCount
+  );
+PrivateData->UnknownFvInfo = TempPtr;
+PrivateData->MaxUnknownFvInfoCount = PrivateData->MaxUnknownFvInfoCount + 
FV_GROWTH_STEP;
   }
 
   NewUnknownFv = >UnknownFvInfo[PrivateData->UnknownFvInfoCount];
@@ -2368,6 

[edk2] [PATCH 7/7] MdeModulePkg: Remove PcdPeiCoreMaxXXX PCDs

2018-12-14 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1405

The codes have been updated to not use PcdPeiCoreMaxFvSupported,
PcdPeiCoreMaxPeimPerFv and PcdPeiCoreMaxPpiSupported.

The patch removes them in MdeModulePkg.dec.

Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Liming Gao 
Cc: Ruiyu Ni 
Cc: Michael D Kinney 
Cc: Nate DeSimone 
Cc: Chasel Chiu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 MdeModulePkg/MdeModulePkg.dec | 13 -
 MdeModulePkg/MdeModulePkg.uni | 12 
 2 files changed, 25 deletions(-)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 0abacc1a901f..5585ce603596 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1053,23 +1053,10 @@ [PcdsFixedAtBuild, PcdsPatchableInModule]
   # @Prompt VPD base address.
   gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0|UINT32|0x00010010
 
-  ## Maximum number of FV is supported by PeiCore's dispatching.
-  # @Prompt Maximum number of FV supported by PeiCore.
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6|UINT32|0x00010030
-
-  ## Maximum File count in every FV is supported by PeiCore's dispatching.
-  #  PeiCore supported File type includes PEIM, Combined PEIM and FV.
-  # @Prompt Maximum File count per FV supported by PeiCore.
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32|UINT32|0x00010031
-
   ## Maximum stack size for PeiCore.
   # @Prompt Maximum stack size for PeiCore.
   
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeiStackSize|0x2|UINT32|0x00010032
 
-  ## Maximum PPI count is supported by PeiCore's PPI database.
-  # @Prompt Maximum PPI count supported by PeiCore.
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPpiSupported|64|UINT32|0x00010033
-
   ## The maximum size of a single non-HwErr type variable.
   # @Prompt Maximum variable size.
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x400|UINT32|0x3003
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index 038e8485054b..fbea62dac8da 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -69,22 +69,10 @@
 
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdVpdBaseAddress_HELP  #language 
en-US "VPD type PCD allows a developer to point to an absolute physical address 
PCDVPDBASEADDRESS to store PCD value."
 
-#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPeiCoreMaxFvSupported_PROMPT  
#language en-US "Maximum number of FV supported by PeiCore"
-
-#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPeiCoreMaxFvSupported_HELP  
#language en-US "Maximum number of FV is supported by PeiCore's dispatching."
-
-#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPeiCoreMaxPeimPerFv_PROMPT  
#language en-US "Maximum File count per FV supported by PeiCore"
-
-#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPeiCoreMaxPeimPerFv_HELP  
#language en-US "Maximum File count in every FV is supported by PeiCore's 
dispatching. PeiCore supported File type includes PEIM, Combined PEIM and FV."
-
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPeiCoreMaxPeiStackSize_PROMPT  
#language en-US "Maximum stack size for PeiCore"
 
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPeiCoreMaxPeiStackSize_HELP  
#language en-US "Maximum stack size for PeiCore."
 
-#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPeiCoreMaxPpiSupported_PROMPT  
#language en-US "Maximum PPI count supported by PeiCore"
-
-#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPeiCoreMaxPpiSupported_HELP  
#language en-US "Maximum PPI count is supported by PeiCore's PPI database."
-
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMaxVariableSize_PROMPT  
#language en-US "Maximum variable size"
 
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMaxVariableSize_HELP  #language 
en-US "The maximum size of a single non-HwErr type variable."
-- 
2.7.0.windows.1

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


[edk2] [PATCH 5/7] OvmfPkg: Remove PcdPeiCoreMaxXXX PCDs' statement

2018-12-14 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1405

The codes have been updated to not use PcdPeiCoreMaxFvSupported,
PcdPeiCoreMaxPeimPerFv and PcdPeiCoreMaxPpiSupported, so their
statement in platform DSC could be removed.

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Anthony Perard 
Cc: Julien Grall 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 OvmfPkg/OvmfPkgIa32.dsc| 2 --
 OvmfPkg/OvmfPkgIa32X64.dsc | 2 --
 OvmfPkg/OvmfPkgX64.dsc | 2 --
 3 files changed, 6 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index eccf34d3d1cb..f61ad8105728 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -437,8 +437,6 @@ [PcdsFixedAtBuild]
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1
   gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
   gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
 !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 4ac4faf5dc18..914f809d4bac 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -442,8 +442,6 @@ [PcdsFixedAtBuild]
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1
   gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
   gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
 !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index ecd5db416c47..4605970f30c9 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -442,8 +442,6 @@ [PcdsFixedAtBuild]
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1
   gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
   gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
 !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
-- 
2.7.0.windows.1

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


[edk2] [PATCH 6/7] Vlv2TbltDevicePkg: Remove PcdPeiCoreMaxXXX PCDs' statement

2018-12-14 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1405

The codes have been updated to not use PcdPeiCoreMaxFvSupported,
PcdPeiCoreMaxPeimPerFv and PcdPeiCoreMaxPpiSupported, so their
statement in platform DSC could be removed.

Cc: Zailiang Sun 
Cc: Yi Qian 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 2 --
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 2 --
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc| 2 --
 3 files changed, 6 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
index f8ad29df5986..d43611550285 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
@@ -663,10 +663,8 @@ [PcdsFixedAtBuild.common]
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x400
   gEfiCpuTokenSpaceGuid.PcdCpuIEDRamSize|0x40
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3AcpiReservedMemorySize|0x1
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|50
   gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport|FALSE
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPpiSupported|128
   gEfiCpuTokenSpaceGuid.PcdCpuSmmApSyncTimeout|1000
 !if $(S4_ENABLE) == TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|TRUE
diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
index ca3b2ff90287..a33816c4d18b 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
@@ -663,10 +663,8 @@ [PcdsFixedAtBuild.common]
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x400
   gEfiCpuTokenSpaceGuid.PcdCpuIEDRamSize|0x40
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3AcpiReservedMemorySize|0x1
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|50
   gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport|FALSE
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPpiSupported|128
   gEfiCpuTokenSpaceGuid.PcdCpuSmmApSyncTimeout|1000
 !if $(S4_ENABLE) == TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|TRUE
diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
index 81f36bd73b28..b50731f25ffb 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
@@ -663,10 +663,8 @@ [PcdsFixedAtBuild.common]
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x400
   gEfiCpuTokenSpaceGuid.PcdCpuIEDRamSize|0x40
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3AcpiReservedMemorySize|0x1
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|50
   gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport|FALSE
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPpiSupported|128
   gEfiCpuTokenSpaceGuid.PcdCpuSmmApSyncTimeout|1000
 !if $(S4_ENABLE) == TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|TRUE
-- 
2.7.0.windows.1

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


Re: [edk2] [PATCH v2 2/3] MdePkg/BaseLib: Introduce CharToUpper and AsciiToUpper publicly

2018-12-14 Thread Leif Lindholm
On Fri, Dec 14, 2018 at 04:20:27PM +0800, Shenglei Zhang wrote:
> Introduce two public functions CharToUpper and AsciiToUpper.
> They have the same functions as InternalCharToUpper and
> InternalBaseLibAsciiToUpper.Considering the internal functions will
> be removed,so directly I change their function names to the public ones'.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1369
> 
> v2:Update the commit message and title

Patch revision information does not belong in the commit message.
Please move underneath the --- line, or keep it in the cover letter
please.

I also think the function deletion should be moved to 3/3, where the
declarations are deleted. This was what I meant by my feedback on v1.

Regards,

Leif
 
> Cc: Leif Lindholm 
> Cc: Laszlo Ersek 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang 
> ---
>  MdePkg/Include/Library/BaseLib.h| 40 +
>  MdePkg/Library/BaseLib/SafeString.c |  8 +++---
>  MdePkg/Library/BaseLib/String.c | 35 +
>  3 files changed, 51 insertions(+), 32 deletions(-)
> 
> diff --git a/MdePkg/Include/Library/BaseLib.h 
> b/MdePkg/Include/Library/BaseLib.h
> index 8cc086983d..b861d82287 100644
> --- a/MdePkg/Include/Library/BaseLib.h
> +++ b/MdePkg/Include/Library/BaseLib.h
> @@ -2720,6 +2720,46 @@ AsciiStrnToUnicodeStrS (
>OUT UINTN *DestinationLength
>);
>  
> +/**
> +  Convert a Unicode character to upper case only if
> +  it maps to a valid small-case ASCII character.
> +
> +  This internal function only deal with Unicode character
> +  which maps to a valid small-case ASCII character, i.e.
> +  L'a' to L'z'. For other Unicode character, the input character
> +  is returned directly.
> +
> +  @param  Char  The character to convert.
> +
> +  @retval LowerCharacter   If the Char is with range L'a' to L'z'.
> +  @retval UnchangedOtherwise.
> +
> +**/
> +CHAR16
> +EFIAPI
> +CharToUpper (
> +  IN  CHAR16Char
> +  );
> +
> +/**
> +  Converts a lowercase Ascii character to upper one.
> +
> +  If Chr is lowercase Ascii character, then converts it to upper one.
> +
> +  If Value >= 0xA0, then ASSERT().
> +  If (Value & 0x0F) >= 0x0A, then ASSERT().
> +
> +  @param  Chr   one Ascii character
> +
> +  @return The uppercase value of Ascii character
> +
> +**/
> +CHAR8
> +EFIAPI
> +AsciiToUpper (
> +  IN  CHAR8 Chr
> +  );
> +
>  /**
>Converts an 8-bit value to an 8-bit BCD value.
>  
> diff --git a/MdePkg/Library/BaseLib/SafeString.c 
> b/MdePkg/Library/BaseLib/SafeString.c
> index 417497cbc9..17f88b46d8 100644
> --- a/MdePkg/Library/BaseLib/SafeString.c
> +++ b/MdePkg/Library/BaseLib/SafeString.c
> @@ -905,7 +905,7 @@ StrHexToUintnS (
>  String++;
>}
>  
> -  if (InternalCharToUpper (*String) == L'X') {
> +  if (CharToUpper (*String) == L'X') {
>  if (*(String - 1) != L'0') {
>*Data = 0;
>return RETURN_SUCCESS;
> @@ -1036,7 +1036,7 @@ StrHexToUint64S (
>  String++;
>}
>  
> -  if (InternalCharToUpper (*String) == L'X') {
> +  if (CharToUpper (*String) == L'X') {
>  if (*(String - 1) != L'0') {
>*Data = 0;
>return RETURN_SUCCESS;
> @@ -2459,7 +2459,7 @@ AsciiStrHexToUintnS (
>  String++;
>}
>  
> -  if (InternalBaseLibAsciiToUpper (*String) == 'X') {
> +  if (AsciiToUpper (*String) == 'X') {
>  if (*(String - 1) != '0') {
>*Data = 0;
>return RETURN_SUCCESS;
> @@ -2586,7 +2586,7 @@ AsciiStrHexToUint64S (
>  String++;
>}
>  
> -  if (InternalBaseLibAsciiToUpper (*String) == 'X') {
> +  if (AsciiToUpper (*String) == 'X') {
>  if (*(String - 1) != '0') {
>*Data = 0;
>return RETURN_SUCCESS;
> diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c
> index e6df12797d..ced1b3f975 100644
> --- a/MdePkg/Library/BaseLib/String.c
> +++ b/MdePkg/Library/BaseLib/String.c
> @@ -552,7 +552,7 @@ InternalIsDecimalDigitCharacter (
>  **/
>  CHAR16
>  EFIAPI
> -InternalCharToUpper (
> +CharToUpper (
>IN  CHAR16Char
>)
>  {
> @@ -586,7 +586,7 @@ InternalHexCharToUintn (
>  return Char - L'0';
>}
>  
> -  return (10 + InternalCharToUpper (Char) - L'A');
> +  return (10 + CharToUpper (Char) - L'A');
>  }
>  
>  /**
> @@ -1166,27 +1166,6 @@ AsciiStrCmp (
>return *FirstString - *SecondString;
>  }
>  
> -/**
> -  Converts a lowercase Ascii character to upper one.
> -
> -  If Chr is lowercase Ascii character, then converts it to upper one.
> -
> -  If Value >= 0xA0, then ASSERT().
> -  If (Value & 0x0F) >= 0x0A, then ASSERT().
> -
> -  @param  Chr   one Ascii character
> -
> -  @return The uppercase value of Ascii character
> -
> -**/
> -CHAR8
> -EFIAPI
> -InternalBaseLibAsciiToUpper (
> -  IN  CHAR8 Chr
> -  )
> -{
> -  return (UINT8) ((Chr >= 'a' && Chr <= 'z') ? Chr - ('a' 

Re: [edk2] Line endings: Was "Re: [edk2-test][Patch] uefi-sct/SctPkg:Correct macro name style in HwErrRecVariable Test"

2018-12-14 Thread Laszlo Ersek
On 12/14/18 18:12, Supreeth Venkatesh wrote:
> On Fri, 2018-12-14 at 14:24 +0100, Laszlo Ersek wrote:
>> On 12/14/18 11:59, Leif Lindholm wrote:
>>> Hmm, this gets me thinking...
>>>
>>> We were discussing before about doing a line ending conversion in
>>> edk2, and let the git gools provide native line endings (as
>>> designed).
>>>
>>> Is this a good opportunity to run a pilot with edk2-test, where
>>> much
>>> less history will be lost?
>>
>> Well, history won't be lost, in the sense that people running "git
>> blame" will need one more execution of "git blame" (to "look past"
>> the
>> whitespace change commit), but yes, it will result in a minor
>> inconvenience.
>>
>> And, I think, converting the edk2-test repo would not be a bad test
>> at all.
>>
> Thanks Leif/Laszlo. I volunteer to try the tool. However, I admit that
> I have not tried this before, any pointers/instructions on how to do
> this?

I imagine you'd run a "find" command to locate all source/text files
(skip ".git"), then feed them to xargs / dos2unix.

The trick is more in the git settings, once the internal representation
has been converted to LF only. I'm thinking that "core.whitespace",
"am.keepcr" and "core.autocrlf" should be set the "right way". (= to be
researched)

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


Re: [edk2] [PATCH edk2-platforms 19/27] Silicon/NXP: Add i.MX6 ACPI tables

2018-12-14 Thread Leif Lindholm
On Fri, Sep 21, 2018 at 08:26:12AM +, Chris Co wrote:
> This adds baseline ACPI table support for booting Windows on
> NXP i.MX6 SoCs.  Platforms may override these tables as necessary.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Christopher Co 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> ---
>  Silicon/NXP/iMX6Pkg/AcpiTables/Csrt.aslc | 408 
>  Silicon/NXP/iMX6Pkg/AcpiTables/Dbg2.aslc | 142 +++
>  Silicon/NXP/iMX6Pkg/AcpiTables/Dsdt-Common.h | 106 +
>  Silicon/NXP/iMX6Pkg/AcpiTables/Dsdt-Enet.asl | 106 +
>  Silicon/NXP/iMX6Pkg/AcpiTables/Dsdt-Gfx.asl  |  74 
>  Silicon/NXP/iMX6Pkg/AcpiTables/Dsdt-Gpio.asl |  55 +++
>  Silicon/NXP/iMX6Pkg/AcpiTables/Dsdt-I2c.asl  |  67 
>  Silicon/NXP/iMX6Pkg/AcpiTables/Dsdt-PCIe.asl | 298 ++
>  Silicon/NXP/iMX6Pkg/AcpiTables/Dsdt-Platform.asl | 106 +
>  Silicon/NXP/iMX6Pkg/AcpiTables/Dsdt-Pwm.asl  |  85 
>  Silicon/NXP/iMX6Pkg/AcpiTables/Dsdt-Sdhc.asl | 133 +++
>  Silicon/NXP/iMX6Pkg/AcpiTables/Dsdt-Spi.asl  | 103 +
>  Silicon/NXP/iMX6Pkg/AcpiTables/Dsdt-TrEE.asl |  33 ++
>  Silicon/NXP/iMX6Pkg/AcpiTables/Fadt.aslc |  60 +++
>  Silicon/NXP/iMX6Pkg/AcpiTables/Madt.aslc | 120 ++
>  Silicon/NXP/iMX6Pkg/AcpiTables/Mcfg.aslc |  92 +
>  Silicon/NXP/iMX6Pkg/AcpiTables/Spcr.aslc |  95 +
>  Silicon/NXP/iMX6Pkg/AcpiTables/Tpm2.aslc |  53 +++
>  18 files changed, 2136 insertions(+)

Shouldn't there be a .inf in this patch as well?
Oh, no, this is used as an include directory, and ... hmm.
This gets a bit grotty later.

Ard, could you suggest a better way of laying this out?

> 
> diff --git a/Silicon/NXP/iMX6Pkg/AcpiTables/Csrt.aslc 
> b/Silicon/NXP/iMX6Pkg/AcpiTables/Csrt.aslc
> new file mode 100644
> index ..82c2420a2b7e
> --- /dev/null
> +++ b/Silicon/NXP/iMX6Pkg/AcpiTables/Csrt.aslc
> @@ -0,0 +1,408 @@
> +/** @file
> +*
> +*  Copyright (c) 2018 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/Platform.h"
> +#include "../Include/iMX6.h"

#include 
#include 
should just work here, since any user must declare use of
Silicon/NXP/iMX6Pkg/iMX6Pkg.dec anyway, and that puts the package
Include in the include path.

> +
> +#pragma pack(push, iMX6Csrt, 1)
> +
> +// Timer Resource Group
> +// Each timer consumes 4K of address space.
> +#define TIMER_ADDRES_SIZE 0x1000
> +#define TIMER_CAP_ALWAYS_ON 0x0001 // Timer is always ON.
> +#define TIMER_CAP_UP_COUNTER0x0002 // Up counter vs. down counter (0)
> +#define TIMER_CAP_READABLE  0x0004 // Counter has a software 
> interface.
> +#define TIMER_CAP_PERIODIC  0x0008 // Can generate periodic 
> interrupts.
> +#define TIMER_CAP_DRIVES_IRQ0x0010 // Timer interrupt drives a 
> physical IRQ.
> +#define TIMER_CAP_ONE_SHOT  0x0020 // Counter can generate one-shot 
> interrupts
> +
> +// Timer source clock codes
> +typedef enum {
> +  GPT_CLOCK_NONE= 0,
> +  GPT_CLOCK_PERIPHERAL  = 1,
> +  GPT_CLOCK_HI_FREQ = 2,
> +  GPT_CLOCK_EXT = 3,
> +  GPT_CLOCK_LOW_FREQ= 4,
> +#if defined(CPU_IMX6DQ) || defined (CPU_IMX6DQP)
> +  GPT_CLOCK_OSC_DIV_8   = 5,
> +  GPT_CLOCK_OSC = 7,
> +#elif (defined(CPU_IMX6SDL) || defined(CPU_IMX6SX))
> +  GPT_CLOCK_OSC = 5,
> +#else
> +#error iMX6 CPU Type Not Defined (Preprocessor Flag)
> +#endif
> +} GPT_SOURCE_CLOCK;
> +
> +// EPIT timer source clock codes
> +typedef enum {
> +  EPIT_CLOCK_NONE= 0,
> +  EPIT_CLOCK_PERIPHERAL  = 1,
> +  EPIT_CLOCK_HI_FREQ = 2,
> +  EPIT_CLOCK_LOW_FREQ= 3,
> +} EPIT_SOURCE_CLOCK;
> +
> +// Timer descriptor
> +typedef struct {
> +  EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER Header;
> +  UINT32 Capabilities;
> +  UINT32 Width;
> +  UINT32 Source;
> +  UINT32 Frequency;
> +  UINT32 FrequencyScale;
> +  UINT32 BaseAddress;
> +  UINT32 Size;
> +  UINT32 Interrupt;
> +  UINT32 ChipType;
> +} RD_TIMER;
> +
> +// Resource Group Shared Info
> +typedef struct {
> +  UINT16 RevMajor;
> +  UINT16 RevMinor;
> +  UINT32 ChipType;
> +} RG_PLATFORM_INFORMATION;
> +
> +// Timer group descriptor
> +typedef struct {
> +  EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER Header;
> +  RG_PLATFORM_INFORMATION PlatformInfo;
> +#if defined(CPU_IMX6SDL)
> +  RD_TIMER Timers[3];
> +#else
> +  RD_TIMER Timers[4];
> +#endif
> +} RG_TIMER;
> +
> +// PL310 L2 Cache Controller Resource Group
> 

Re: [edk2] [PATCH edk2-platforms 21/27] Silicon/NXP: Add i.MX6 PCIe DXE driver

2018-12-14 Thread Leif Lindholm
On Fri, Sep 21, 2018 at 08:26:13AM +, Chris Co wrote:
> This adds DXE driver support for PCIe on NXP i.MX6 SoCs.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Christopher Co 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> ---
>  Silicon/NXP/iMX6Pkg/Drivers/PciExpress/iMX6PciExpress.c   | 1139 
> 
>  Silicon/NXP/iMX6Pkg/Drivers/PciExpress/iMX6PciExpress.h   |  145 +++
>  Silicon/NXP/iMX6Pkg/Drivers/PciExpress/iMX6PciExpress.inf |   66 ++
>  3 files changed, 1350 insertions(+)
> 
> diff --git a/Silicon/NXP/iMX6Pkg/Drivers/PciExpress/iMX6PciExpress.c 
> b/Silicon/NXP/iMX6Pkg/Drivers/PciExpress/iMX6PciExpress.c
> new file mode 100644
> index ..424ab2d77227
> --- /dev/null
> +++ b/Silicon/NXP/iMX6Pkg/Drivers/PciExpress/iMX6PciExpress.c
> @@ -0,0 +1,1139 @@
> +/** @file
> +*
> +*  Copyright (c) 2018 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 "iMX6PciExpress.h"
> +
> +PCI_RESOURCE PcieResource[] = {
> +  // Memory resource
> +  {
> +PCIE_MEMORY_SPACE_BASE,
> +PCIE_MEMORY_SPACE_SIZE,
> +PCIE_MEMORY_SPACE_BASE
> +  },
> +};
> +
> +// Pcie read and write function
> +EFI_STATUS
> +PciePciWrite (
> +  IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
> +  IN UINTN Address,
> +  IN UINTN Count,
> +  IN VOID *Buffer
> +  );
> +
> +EFI_STATUS
> +PciePciRead (
> +  IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
> +  IN UINTN Address,
> +  IN UINTN Count,
> +  IN VOID *Buffer
> +  );
> +
> +// Internal Address Translation Unit configuration table. Map the Pcie device
> +// configuration baesd on configuration. Pci IO space is not supported on
> +// Windows. Memory space segment is just mapped back to the same address.
> +//
> +// The following table is used to setup basic translation setting on various
> +// ATU (Address Translation Unit). The ATU is responsible to retranslate
> +// address for inbound and outbound message.
> +//
> +// Address match mode address translation is based on the following formula :
> +// Address = Address - Base Address + Target Address
> +//
> +// There really isnt a need to retranslate the address for iMX6 however 
> proceed
> +// the program the ATU to for configuration and memory message.
> +IATU_SETTINGS iMX6iAtuSettings[] = {
> +  // Configuration message
> +  {
> +OUTBOUND,
> +0,
> +CFG0_TYPE,
> +PCIE_DEVICE_CONFIG_BASE_REG,
> +0,
> +PCIE_DEVICE_CONFIG_BASE_REG + PCIE_DEVICE_CONFIG_SIZE - 1,
> +PCIE_DEVICE_CONFIG_BASE_REG,
> +0,
> +REGION_ENABLE,
> +  },
> +
> +  // Memory message
> +  {
> +OUTBOUND,
> +2,
> +MEMORY_TYPE,
> +PCIE_MEMORY_SPACE_BASE,
> +0,
> +PCIE_MEMORY_SPACE_BASE + PCIE_MEMORY_SPACE_SIZE - 1,
> +PCIE_MEMORY_SPACE_BASE,
> +0,
> +REGION_ENABLE,
> +  },
> +};
> +
> +VOID
> +PcieSetupiAtu (
> +  IN  IATU_SETTINGS   *SettingsPtr
> +  )
> +{
> +  volatile CSP_PCIE_PL_REGS *pPortLogicRegs;

The volatile pointer antipattern again.
You're using it for register offsets here, so having it of
CSP_PCIE_PL_REGS * is fine, I guess, but the volatile has no effect.
And please drop the Hungarian notation.

Applies throughout.

> +
> +  ASSERT (SettingsPtr->RegionIndex < MAX_iATU_REGION);
> +  pPortLogicRegs = (CSP_PCIE_PL_REGS *)PCIE_CTRL_PORT_LOGIG_BASE_REG;
> +
> +  // Program specific ATU region
> +  MmioWrite32 (
> +(UINTN)>PCIE_PL_iATUVR,
> +(SettingsPtr->RegionDirection << 31 | SettingsPtr->RegionIndex));
> +
> +  MmioWrite32 (
> +(UINTN)>PCIE_PL_iATURC2,
> +REGION_DISABLE);
> +
> +  MmioWrite32 (
> +(UINTN)>PCIE_PL_iATURLBA,
> +SettingsPtr->LowerBaseAddr);
> +
> +  MmioWrite32 (
> +(UINTN)>PCIE_PL_iATURUBA,
> +SettingsPtr->UpperBaseAddr);
> +
> +  MmioWrite32 (
> +(UINTN)>PCIE_PL_iATURLA,
> +SettingsPtr->LimitAddr);
> +
> +  MmioWrite32 (
> +(UINTN)>PCIE_PL_iATURLTA,
> +SettingsPtr->LowerTargetAddr);
> +
> +  MmioWrite32 (
> +(UINTN)>PCIE_PL_iATURUTA,
> +SettingsPtr->UpperTargetAddr);
> +
> +  MmioWrite32 (
> +(UINTN)>PCIE_PL_iATURC1,
> +SettingsPtr->Type);
> +
> +  MmioWrite32 (
> +(UINTN)>PCIE_PL_iATURC2,
> +SettingsPtr->State);
> +}
> +
> +VOID
> +PcieSetupiAtuSettings (
> +  VOID
> +  )
> +{
> +  UINT32 i;
> +
> +  // Initialize internal Address Translation Unit based on settings specify
> +  // in iMX6iAtuSettings table.
> +  

Re: [edk2] [PATCH edk2-platforms 23/27] Silicon/NXP: Add i.MX6 Smbios Driver

2018-12-14 Thread Leif Lindholm
On Fri, Sep 21, 2018 at 08:26:15AM +, Chris Co wrote:
> This adds support populating the SMBIOS tables on an i.MX6 SoC.
> Platforms just need to define the relevant PCDs in their dsc file and
> this driver will fill out the SMBIOS table structures.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Christopher Co 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> ---
>  Silicon/NXP/iMX6Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c   | 1774 
> 
>  Silicon/NXP/iMX6Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.h   |   44 +
>  Silicon/NXP/iMX6Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf |   84 +
>  3 files changed, 1902 insertions(+)
> 
> diff --git 
> a/Silicon/NXP/iMX6Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c 
> b/Silicon/NXP/iMX6Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
> new file mode 100644
> index ..93c56dec254b
> --- /dev/null
> +++ b/Silicon/NXP/iMX6Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
> @@ -0,0 +1,1774 @@
> +/** @file
> +
> +  Static SMBIOS Table for the SolidRun HummingBoard-Edge iMX6 Quad 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
> +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) 2006 - 2011, Intel Corporation. All rights reserved.
> +  Copyright (c) 2012, Apple Inc. All rights reserved.
> +  Copyright (c) 2015, Linaro Limited. All rights reserved.
> +  Copyright (c) 2015, Hisilicon Limited. All rights reserved.
> +  Copyright (c) 2015, ARM Limited. All rights reserved.
> +  Copyright (c) 2018 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 "PlatformSmbiosDxe.h"
> +
> +// Default SMBIOS Tables for i.MX6
> +SMBIOS_TABLE_TYPE0 mBiosInfoType0 = {
> +  {
> +EFI_SMBIOS_TYPE_BIOS_INFORMATION,
> +sizeof (SMBIOS_TABLE_TYPE0),
> +SMBIOS_HANDLE_PI_RESERVED
> +  },
> +  1,// Vendor String
> +  2,// BiosVersion String
> +  0xE000,   // BiosSegment
> +  3,// BiosReleaseDate String
> +  (FixedPcdGet32 (PcdFdSize) - 1) / SIZE_64KB, // BiosSize
> +  {   // BiosCharacteristics
> +0,//  Reserved  :2;
> +0,//  Unknown   :1;
> +0,//  BiosCharacteristicsNotSupported   :1;
> +0,//  IsaIsSupported:1;
> +0,//  McaIsSupported:1;
> +0,//  EisaIsSupported   :1;
> +1,//  PciIsSupported:1;
> +0,//  PcmciaIsSupported :1;
> +0,//  PlugAndPlayIsSupported:1;
> +0,//  ApmIsSupported:1;
> +1,//  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  

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

2018-12-14 Thread Jagadeesh Ujja
Changes since RFC v4:
- Addressed all the comments from Liming Gao
  - Added an additional PCD 'PcdStandaloneMmCodeEnabled' to indicate
presence of StandaloneMM support.
  - MdePkg.dec file updated to include StandaloneMmServiceTableLib and
StandaloneMmRuntimeDxe library.
  - Platform specific changes will be posted in a seperate patchset.
  - AsmLfence wrapper function is supported for AArch64 platforms.
  - All the patches in this series can be pulled from
https://github.com/jagadeeshujja/edk2 (branch: topics/aarch64_secure_vars)

Changes since RFC 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 RFC v2: 
- Added 'Contributed-under' tag, removed Change-ID tag and
  maintained a single signed-off-by for the all the patches.  

Changes since RFC 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 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.

Jagadeesh Ujja (13):
  StandaloneMmPkg: Pull in additonal libraries from staging branch
  MdePkg: Add a PCD that indicates presence of Standalone MM mode
  MdeModulePkg: Add a PCD to indicate Standalone MM supports secure
variable
  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   
 |   5 +-
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf 
 |   2 +
 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/MdeModulePkg.dec  
 |   5 +
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf 
 |   1 +
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c   
 | 203 +++--
 
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf 

[edk2] [PATCH 01/13] StandaloneMmPkg: Pull in additonal libraries from staging branch

2018-12-14 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 

[edk2] [PATCH 02/13] MdePkg: Add a PCD that indicates presence of Standalone MM mode

2018-12-14 Thread Jagadeesh Ujja
Add a flag to indicate the presence of Standalone MM mode. For existing
library and/or drivers that can be refactored to be used as a Standalone
MM component, this flag can be used to choose the portions of the code
that gets executed in 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..af694fc 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 indicates Standalone MM execution mode is enabled
+  #  TRUE  - Standalone MM execution mode is enabled
+  #  FALSE - Standalone MM execution mode is not enabled
+  gEfiMdePkgTokenSpaceGuid.PcdStandaloneMmCodeEnabled|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] [PATCH 08/13] MdeModulePkg/Variable/RuntimeDxe: adapt for usability with MM Standalone

2018-12-14 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..4d768db 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
+  gEfiMdeModulePkgTokenSpaceGuid.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, );
+  if (PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = mSmmCommunication->Communicate (mSmmCommunication, 
mVariableBuffer, );
+  } else {
+Status = mSmmCommunication->Communicate (mSmmCommunication, 
mVariableBufferPhysical, );
+  }
   ASSERT_EFI_ERROR (Status);
 
   SmmCommunicateHeader  = (EFI_SMM_COMMUNICATE_HEADER *) mVariableBuffer;
@@ -991,9 +997,11 @@ SmmVariableReady (
 {
   EFI_STATUSStatus;
 
-  Status = gBS->LocateProtocol (, NULL, (VOID 
**));
-  if (EFI_ERROR (Status)) {
-return;
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+if (EFI_ERROR (Status)) {
+  return;
+}
   }
 
   Status = gBS->LocateProtocol (, NULL, (VOID 
**) );
@@ -1069,13 +1077,14 @@ SmmVariableWriteReady (
 {
   EFI_STATUSStatus;
   VOID  *ProtocolOps;
-
-  //
-  // Check whether the protocol is installed or not.
-  //
-  Status = gBS->LocateProtocol (, NULL, (VOID **) 
);
-  if (EFI_ERROR (Status)) {
-return;
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+//
+// Check whether the protocol is installed or not.
+//
+Status = gBS->LocateProtocol (, NULL, (VOID **) 
);
+if (EFI_ERROR (Status)) {
+  return;
+}
   }
 
   //
diff --git 
a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
index bd73f7a..c84dd2d 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]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdStandaloneMmVariableEnabled
+
 [Depex]
   gEfiSmmCommunicationProtocolGuid
 
-- 
2.7.4

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


[edk2] [PATCH 05/13] MdePkg/Library/BaseLib/AArch64: Add AsmLfence function

2018-12-14 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 | 33 +--
 MdePkg/Library/BaseLib/AArch64/AsmLfence.S   | 42 
 MdePkg/Library/BaseLib/AArch64/AsmLfence.asm | 41 +++
 MdePkg/Library/BaseLib/BaseLib.inf   |  2 +
 4 files changed, 105 insertions(+), 13 deletions(-)

diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 8cc0869..ca961ee 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -7697,19 +7697,6 @@ AsmWriteTr (
   );
 
 /**
-  Performs a serializing operation on all load-from-memory instructions that
-  were issued prior the AsmLfence function.
-
-  Executes a LFENCE instruction. This function is only available on IA-32 and 
x64.
-
-**/
-VOID
-EFIAPI
-AsmLfence (
-  VOID
-  );
-
-/**
   Patch the immediate operand of an IA32 or X64 instruction such that the byte,
   word, dword or qword operand is encoded at the end of the instruction's
   binary representation.
@@ -7752,4 +7739,24 @@ PatchInstructionX86 (
   );
 
 #endif // defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
+
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) || defined 
(MDE_CPU_AARCH64)
+
+/**
+  Performs a serializing operation on all load-from-memory instructions that
+  were issued prior the AsmLfence function.
+
+  In case of IA-32 and x64, Executes a LFENCE instruction.
+
+  In case of AArch64 this acts as a wrapper on the AArch64
+  specific MemoryFence function
+
+**/
+VOID
+EFIAPI
+AsmLfence (
+  VOID
+  );
+
+#endif  // defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) || defined 
(MDE_CPU_AARCH64)
 #endif // !defined (__BASE_LIB__)
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
+ 

[edk2] [PATCH 06/13] MdePkg/Library: Add StandaloneMmRuntimeDxe library

2018-12-14 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/Include/Library/StandaloneMmRuntimeDxe.h  | 39 

 MdePkg/Library/StandaloneMmRuntimeDxe/StandaloneMmRuntimeDxe.c   | 36 
++
 MdePkg/Library/StandaloneMmRuntimeDxe/StandaloneMmRuntimeDxe.inf | 36 
++
 MdePkg/MdePkg.dec|  3 ++
 4 files changed, 114 insertions(+)

diff --git a/MdePkg/Include/Library/StandaloneMmRuntimeDxe.h 
b/MdePkg/Include/Library/StandaloneMmRuntimeDxe.h
new file mode 100644
index 000..9c45c4d
--- /dev/null
+++ b/MdePkg/Include/Library/StandaloneMmRuntimeDxe.h
@@ -0,0 +1,39 @@
+/** @file
+  Provides a InMm implementation for RUNTIME DXE drivers
+
+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 __STANDALONE_MM_RUNTIME_DXE_H__
+#define __STANDALONE_MM_RUNTIME_DXE_H__
+
+#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
+  );
+
+#endif
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..43f5f26
--- /dev/null
+++ b/MdePkg/Library/StandaloneMmRuntimeDxe/StandaloneMmRuntimeDxe.inf
@@ -0,0 +1,36 @@
+## @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
+
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 17c90c2..0c2ebf5 100644
--- 

[edk2] [PATCH 12/13] SecurityPkg/AuthVariableLib: allow MM_STANDALONE drivers to use this library

2018-12-14 Thread Jagadeesh Ujja
“AuthVariableLib” 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 
Reviewed-by: Chao Zhang 
---
 SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf 
b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
index 572ba4e..4294d3b 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
+++ b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
@@ -2,6 +2,7 @@
 #  Provides authenticated variable services.
 #
 #  Copyright (c) 2015 - 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
@@ -21,12 +22,12 @@
   FILE_GUID  = B23CF5FB-6FCC-4422-B145-D855DBC05457
   MODULE_TYPE= DXE_RUNTIME_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = AuthVariableLib|DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER
+  LIBRARY_CLASS  = AuthVariableLib|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] [PATCH 09/13] MdeModulePkg/Variable/RuntimeDxe: adapt as a MM Standalone driver

2018-12-14 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 
(>VariableGlobal.VariableServicesLock);
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+ReleaseLockOnlyAtBootTime 
(>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 (
-,
-NULL,
-FtwProtocol
-);
+  if (PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = gMmst->MmLocateProtocol (
+  ,
+  NULL,
+  FtwProtocol
+  );
+  } else {
+Status = gSmst->SmmLocateProtocol (
+  ,
+  NULL,
+  FtwProtocol
+  );
+  }
   return Status;
 }
 
@@ -248,11 +259,19 @@ GetFvbByHandle (
   //
   // To get the SMM FVB protocol interface on the handle
   //
-  return gSmst->SmmHandleProtocol (
-  FvBlockHandle,
-  ,
-  (VOID **) FvBlock
-  );
+  if (PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+return gMmst->MmHandleProtocol (
+FvBlockHandle,
+,
+(VOID **) FvBlock
+ 

[edk2] [PATCH 10/13] MdeModulePkg/VarCheckLib: allow MM_STANDALONE drivers to use this library

2018-12-14 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] [PATCH 11/13] ArmPlatformPkg/NorFlashDxe: allow reusability as a MM driver

2018-12-14 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|   5 +-
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf  |   2 +
 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 (
+>Handle,
+, >DevicePath,
+,  >BlockIoProtocol,
+, 
>FvbProtocol,
+NULL
+);
+if (EFI_ERROR(Status)) {
+  FreePool (Instance);
+  return Status;
+}
+} else {
+  //Install DevicePath Protocol
+  Status = gMmst->MmInstallProtocolInterface (
+>Handle,
+,
+EFI_NATIVE_INTERFACE,
+>DevicePath
+);
+  if (EFI_ERROR(Status)) {
+FreePool (Instance);
+return Status;
+  }
+  //Install BlockIo Protocol
+  Status = gMmst->MmInstallProtocolInterface (
+>Handle,
+,
+EFI_NATIVE_INTERFACE,
+>BlockIoProtocol
+);
+  if (EFI_ERROR(Status)) {
+FreePool (Instance);
+return Status;
+  }
 
-Status = gBS->InstallMultipleProtocolInterfaces (
-  >Handle,
-  , >DevicePath,
-  ,  >BlockIoProtocol,
-  , >FvbProtocol,
-  NULL
-  );
-if (EFI_ERROR(Status)) {
-  FreePool (Instance);
-  return Status;
+  //Install FirmwareVolumeBlock Protocol
+  Status = gMmst->MmInstallProtocolInterface (
+>Handle,
+,
+EFI_NATIVE_INTERFACE,
+>FvbProtocol
+);
+  if (EFI_ERROR(Status)) {
+FreePool (Instance);
+return Status;
+  }
 }
   } else {
-Status = gBS->InstallMultipleProtocolInterfaces (
->Handle,
-, >DevicePath,
-,  >BlockIoProtocol,
-, >DiskIoProtocol,
-NULL
-);
-if (EFI_ERROR(Status)) {
-  FreePool (Instance);
-  return Status;
+if (!InMm ()) {
+  Status = gBS->InstallMultipleProtocolInterfaces (
+  >Handle,
+  , >DevicePath,
+  ,  >BlockIoProtocol,
+  , >DiskIoProtocol,
+  NULL
+  );
+  if (EFI_ERROR(Status)) {
+FreePool (Instance);
+return Status;
+  }
+} else {
+  //Install DevicePath Protocol
+  Status = gMmst->MmInstallProtocolInterface (
+>Handle,
+,
+EFI_NATIVE_INTERFACE,
+>DevicePath
+);
+  if (EFI_ERROR(Status)) {
+FreePool (Instance);
+

[edk2] [PATCH 13/13] CryptoPkg/BaseCryptLib: allow MM_STANDALONE drivers to use this library

2018-12-14 Thread Jagadeesh Ujja
“BaseCryptLib” 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 
---
 CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf   |  7 ++-
 CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf|  4 
 CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c | 15 +--
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
index f29445c..b6ebac5 100644
--- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
@@ -7,6 +7,7 @@
 #  buffer overflow or integer overflow.
 #
 #  Copyright (c) 2009 - 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
@@ -24,7 +25,7 @@
   FILE_GUID  = be3bb803-91b6-4da0-bd91-a8b21c18ca5d
   MODULE_TYPE= DXE_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = BaseCryptLib|DXE_DRIVER DXE_CORE 
UEFI_APPLICATION UEFI_DRIVER
+  LIBRARY_CLASS  = BaseCryptLib|DXE_DRIVER DXE_CORE 
UEFI_APPLICATION UEFI_DRIVER MM_STANDALONE
 
 #
 # The following information is for reference only and not required by the 
build tools.
@@ -85,6 +86,10 @@
   OpensslLib
   IntrinsicLib
   PrintLib
+  PcdLib
+
+[Pcd]
+  gEfiMdePkgTokenSpaceGuid.PcdStandaloneMmCodeEnabled
 
 #
 # Remove these [BuildOptions] after this library is cleaned up
diff --git a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
index 32628c8..fb16451 100644
--- a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
@@ -91,6 +91,10 @@
   OpensslLib
   IntrinsicLib
   PrintLib
+  PcdLib
+
+[Pcd]
+  gEfiMdePkgTokenSpaceGuid.PcdStandaloneMmCodeEnabled
 
 #
 # Remove these [BuildOptions] after this library is cleaned up
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c 
b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
index 5f9b0c2..de8e756 100644
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
@@ -3,6 +3,7 @@
   for OpenSSL-based Cryptographic Library (used in DXE & RUNTIME).
 
 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
@@ -77,12 +78,14 @@ time_t time (time_t *timer)
   time_t  CalTime;
   UINTN   Year;
 
-  //
-  // Get the current time and date information
-  //
-  Status = gRT->GetTime (, NULL);
-  if (EFI_ERROR (Status) || (Time.Year < 1970)) {
-return 0;
+  if (!PcdGetBool (PcdStandaloneMmCodeEnabled)) {
+//
+// Get the current time and date information
+//
+Status = gRT->GetTime (, NULL);
+if (EFI_ERROR (Status) || (Time.Year < 1970)) {
+  return 0;
+}
   }
 
   //
-- 
2.7.4

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


Re: [edk2] Line endings: Was "Re: [edk2-test][Patch] uefi-sct/SctPkg:Correct macro name style in HwErrRecVariable Test"

2018-12-14 Thread Laszlo Ersek
On 12/14/18 11:59, Leif Lindholm wrote:
> Hmm, this gets me thinking...
> 
> We were discussing before about doing a line ending conversion in
> edk2, and let the git gools provide native line endings (as designed).
> 
> Is this a good opportunity to run a pilot with edk2-test, where much
> less history will be lost?

Well, history won't be lost, in the sense that people running "git
blame" will need one more execution of "git blame" (to "look past" the
whitespace change commit), but yes, it will result in a minor inconvenience.

And, I think, converting the edk2-test repo would not be a bad test at all.

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


Re: [edk2] [PATCH] ArmVirtPkg/ArmVirt.dsc.inc: define TcpIoLib resolution unconditionally

2018-12-14 Thread Laszlo Ersek
On 12/14/18 12:22, Ard Biesheuvel wrote:
> Commit 9a67ba261fe9 ("ArmVirtPkg: Replace obsoleted network drivers
> from platform DSC/FDF") failed to take into account that the now
> unconditionally included IScsiDxe.inf from NetworkPkg requires a
> resolution for TcpIoLib.

I don't understand why this happened.


(a) I warned *precisely* about this issue, when I reviewed the v2
version of said commit. See bullet (5) in the following message:

cdd81f4c-1bdc-8bae-63a9-58eb4eb2afbd@redhat.com">http://mid.mail-archive.com/cdd81f4c-1bdc-8bae-63a9-58eb4eb2afbd@redhat.com


(b) What's more, my comments for the v3 version were summarily ignored
as well. See bullet (2) in:

91d253ae-9d0c-e28b-1bda-1be98cee4340@redhat.com">http://mid.mail-archive.com/91d253ae-9d0c-e28b-1bda-1be98cee4340@redhat.com

And now, the BaseCryptLib, OpensslLib and IntrinsicLib resolutions for
[LibraryClasses.common.UEFI_DRIVER] have been added to
"ArmVirtPkg/ArmVirtQemuKernel.dsc", despite their being redundant and my
having pointed out that fact. Worse, "ArmVirtQemuKernel.dsc" uses
"OpensslLib.inf", while "OpensslLibCrypto.inf" from "ArmVirt.dsc.inc" is
perfectly sufficient.


Commit 9a67ba261fe9 does not carry my R-b, and that's not a random fact.
The v3 patch was *not* ready for being pushed, to my eyes. And I was
pretty explicit about that.


> Since specifying such a resolution is harmless
> for platforms that have no networking enabled, let's just fix things
> by dropping the conditionals around it.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
>  ArmVirtPkg/ArmVirt.dsc.inc | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> index c3549c84d4c6..89c2db074711 100644
> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> @@ -80,9 +80,7 @@
>DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
>UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
>IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
> -!if $(NETWORK_IP6_ENABLE) == TRUE
>TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
> -!endif
>  !if $(HTTP_BOOT_ENABLE) == TRUE
>HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
>  !endif
> 

I'm *very strongly* tempted to simply revert 9a67ba261fe9, for blatantly
ignoring my explicit requests for updates. However, that would only
result in my having to review more (possibly incomplete) iterations of
the patch.

At least, this incremental fix is in line with my request in (a) -- "we
should make the current TcpIoLib class resolution unconditional". Please
go ahead and push it.

Reviewed-by: Laszlo Ersek 

I should really file a TianoCore BZ about the wrong / redundant
OpensslLib resolution in ArmVirtQemuKernel.dsc too. It's difficult for
me to find te motivation for that right now, seeing the disregard for my
earlier reviews.

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


Re: [edk2] [PATCH 5/7] OvmfPkg: Remove PcdPeiCoreMaxXXX PCDs' statement

2018-12-14 Thread Laszlo Ersek
On 12/14/18 11:28, Star Zeng wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1405
> 
> The codes have been updated to not use PcdPeiCoreMaxFvSupported,
> PcdPeiCoreMaxPeimPerFv and PcdPeiCoreMaxPpiSupported, so their
> statement in platform DSC could be removed.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Cc: Anthony Perard 
> Cc: Julien Grall 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> ---
>  OvmfPkg/OvmfPkgIa32.dsc| 2 --
>  OvmfPkg/OvmfPkgIa32X64.dsc | 2 --
>  OvmfPkg/OvmfPkgX64.dsc | 2 --
>  3 files changed, 6 deletions(-)
> 
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index eccf34d3d1cb..f61ad8105728 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -437,8 +437,6 @@ [PcdsFixedAtBuild]
>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1
>gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
>gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
>  !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 4ac4faf5dc18..914f809d4bac 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -442,8 +442,6 @@ [PcdsFixedAtBuild]
>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1
>gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
>gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
>  !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index ecd5db416c47..4605970f30c9 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -442,8 +442,6 @@ [PcdsFixedAtBuild]
>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1
>gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
>gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
>  !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
>gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> 

Reviewed-by: Laszlo Ersek 

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


Re: [edk2] [PATCH 05/13] MdePkg/Library/BaseLib/AArch64: Add AsmLfence function

2018-12-14 Thread Ard Biesheuvel
On Fri, 14 Dec 2018 at 13:13, Jagadeesh Ujja  wrote:
>
> 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 | 33 +--
>  MdePkg/Library/BaseLib/AArch64/AsmLfence.S   | 42 
>  MdePkg/Library/BaseLib/AArch64/AsmLfence.asm | 41 +++
>  MdePkg/Library/BaseLib/BaseLib.inf   |  2 +
>  4 files changed, 105 insertions(+), 13 deletions(-)
>
> diff --git a/MdePkg/Include/Library/BaseLib.h 
> b/MdePkg/Include/Library/BaseLib.h
> index 8cc0869..ca961ee 100644
> --- a/MdePkg/Include/Library/BaseLib.h
> +++ b/MdePkg/Include/Library/BaseLib.h
> @@ -7697,19 +7697,6 @@ AsmWriteTr (
>);
>
>  /**
> -  Performs a serializing operation on all load-from-memory instructions that
> -  were issued prior the AsmLfence function.
> -
> -  Executes a LFENCE instruction. This function is only available on IA-32 
> and x64.
> -
> -**/
> -VOID
> -EFIAPI
> -AsmLfence (
> -  VOID
> -  );
> -
> -/**
>Patch the immediate operand of an IA32 or X64 instruction such that the 
> byte,
>word, dword or qword operand is encoded at the end of the instruction's
>binary representation.
> @@ -7752,4 +7739,24 @@ PatchInstructionX86 (
>);
>
>  #endif // defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
> +
> +#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) || defined 
> (MDE_CPU_AARCH64)
> +
> +/**
> +  Performs a serializing operation on all load-from-memory instructions that
> +  were issued prior the AsmLfence function.
> +
> +  In case of IA-32 and x64, Executes a LFENCE instruction.
> +
> +  In case of AArch64 this acts as a wrapper on the AArch64
> +  specific MemoryFence function
> +
> +**/
> +VOID
> +EFIAPI
> +AsmLfence (
> +  VOID
> +  );
> +
> +#endif  // defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) || defined 
> (MDE_CPU_AARCH64)
>  #endif // !defined (__BASE_LIB__)
> 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

Any reason we can't simply do

b MemoryFence

here?

Also, why I understand the rationale, I still think it would be better
to change callers of the [x86 specific] AsmLfence() than to introduce
an alias of MemoryFence() for architectures where Lfence is not
defined.

This is not only about tidiness, but also about potentially having
different semantics, which we can't provide in general on ARM, but
only in particular cases [such as the code that is modified in this
series]

In other words, newly introduced occurrences of AsmLfence() now have
to be audited for being appropriate on AArc64 if they are added to
generic code.


> 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 

[edk2] [PATCH 03/13] MdeModulePkg: Add a PCD to indicate Standalone MM supports secure variable

2018-12-14 Thread Jagadeesh Ujja
Add a flag that indicates whether Standalone MM mode supports
secure storage of variables.

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

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 41d2b04..badea4a 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1041,6 +1041,11 @@
   # @Prompt Enable UEFI Stack Guard.
   gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|FALSE|BOOLEAN|0x30001055
 
+  ## This flag indicates secure variable functionality is implemented by 
Standalone MM
+  #  TRUE  - Secure variable storage supported by Standalone MM code.
+  #  FALSE - Standalone MM code does not support secure storage of variables
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdStandaloneMmVariableEnabled|FALSE|BOOLEAN|0x30001056
+
 [PcdsFixedAtBuild, PcdsPatchableInModule]
   ## Dynamic type PCD can be registered callback function for Pcd setting 
action.
   #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of 
callback function
-- 
2.7.4

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


[edk2] [PATCH 04/13] MdePkg/Include: add StandaloneMmServicesTableLib header file

2018-12-14 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 | 25 
 MdePkg/MdePkg.dec |  4 
 2 files changed, 29 insertions(+)

diff --git a/MdePkg/Include/Library/StandaloneMmServicesTableLib.h 
b/MdePkg/Include/Library/StandaloneMmServicesTableLib.h
new file mode 100644
index 000..db310ac
--- /dev/null
+++ b/MdePkg/Include/Library/StandaloneMmServicesTableLib.h
@@ -0,0 +1,25 @@
+/** @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 
+
+extern EFI_MM_SYSTEM_TABLE *gMmst;
+
+#endif
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index af694fc..17c90c2 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -243,6 +243,10 @@
   ##
   SafeIntLib|Include/Library/SafeIntLib.h
 
+  ## @libraryclass Provides a service to retrieve a pointer to the Standalone 
MM Services Table.
+  # Only available to MM_STANDALONE module types.
+  MmServicesTableLib|Include/Library/StandaloneMmServicesTableLib.h
+
 [LibraryClasses.IA32, LibraryClasses.X64]
   ##  @libraryclass  Abstracts both S/W SMI generation and detection.
   ##
-- 
2.7.4

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


[edk2] [PATCH 07/13] MdeModulePkg/FaultTolerantWriteDxe: allow reusability as a MM driver

2018-12-14 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..026bc60 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
+  gEfiMdeModulePkgTokenSpaceGuid.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,
-  ,
-  (VOID **) FvBlock
-  );
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+return gSmst->SmmHandleProtocol (
+FvBlockHandle,
+,
+(VOID **) FvBlock
+);
+  } else {
+return gMmst->MmHandleProtocol (
+FvBlockHandle,
+,
+(VOID **) FvBlock
+);
+  }
 }
 
 /**
@@ -119,11 +131,19 @@ FtwGetSarProtocol (
   //
   // Locate Smm Swap Address Range protocol
   //
-  Status = gSmst->SmmLocateProtocol (
-,
-NULL,
-SarProtocol
-);
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = gSmst->SmmLocateProtocol (
+  ,
+  NULL,
+  SarProtocol
+  );
+  } else {
+Status = gMmst->MmLocateProtocol (
+  ,
+  NULL,
+  SarProtocol
+  );
+  }
   return Status;
 }
 
@@ -158,13 +178,23 @@ GetFvbCountAndBuffer (
   BufferSize = 0;
   *NumberHandles = 0;
   *Buffer= NULL;
-  Status = gSmst->SmmLocateHandle (
-ByProtocol,
-,
-NULL,
-,
-*Buffer
-);
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = gSmst->SmmLocateHandle (
+  ByProtocol,
+  ,
+  NULL,
+  ,
+  *Buffer
+  );
+  } else {
+Status = gMmst->MmLocateHandle (
+  ByProtocol,
+  ,
+  NULL,
+  ,
+  *Buffer
+  );
+  }
   if (EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL) {
 return EFI_NOT_FOUND;
   }
@@ -173,15 +203,23 @@ GetFvbCountAndBuffer (
   if 

Re: [edk2] [PATCH] ArmVirtPkg/ArmVirt.dsc.inc: define TcpIoLib resolution unconditionally

2018-12-14 Thread Ard Biesheuvel
On Fri, 14 Dec 2018 at 14:56, Laszlo Ersek  wrote:
>
> On 12/14/18 12:22, Ard Biesheuvel wrote:
> > Commit 9a67ba261fe9 ("ArmVirtPkg: Replace obsoleted network drivers
> > from platform DSC/FDF") failed to take into account that the now
> > unconditionally included IScsiDxe.inf from NetworkPkg requires a
> > resolution for TcpIoLib.
>
> I don't understand why this happened.
>
>
> (a) I warned *precisely* about this issue, when I reviewed the v2
> version of said commit. See bullet (5) in the following message:
>
> cdd81f4c-1bdc-8bae-63a9-58eb4eb2afbd@redhat.com">http://mid.mail-archive.com/cdd81f4c-1bdc-8bae-63a9-58eb4eb2afbd@redhat.com
>
>
> (b) What's more, my comments for the v3 version were summarily ignored
> as well. See bullet (2) in:
>
> 91d253ae-9d0c-e28b-1bda-1be98cee4340@redhat.com">http://mid.mail-archive.com/91d253ae-9d0c-e28b-1bda-1be98cee4340@redhat.com
>
> And now, the BaseCryptLib, OpensslLib and IntrinsicLib resolutions for
> [LibraryClasses.common.UEFI_DRIVER] have been added to
> "ArmVirtPkg/ArmVirtQemuKernel.dsc", despite their being redundant and my
> having pointed out that fact. Worse, "ArmVirtQemuKernel.dsc" uses
> "OpensslLib.inf", while "OpensslLibCrypto.inf" from "ArmVirt.dsc.inc" is
> perfectly sufficient.
>
>
> Commit 9a67ba261fe9 does not carry my R-b, and that's not a random fact.
> The v3 patch was *not* ready for being pushed, to my eyes. And I was
> pretty explicit about that.
>
>
> > Since specifying such a resolution is harmless
> > for platforms that have no networking enabled, let's just fix things
> > by dropping the conditionals around it.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel 
> > ---
> >  ArmVirtPkg/ArmVirt.dsc.inc | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> > index c3549c84d4c6..89c2db074711 100644
> > --- a/ArmVirtPkg/ArmVirt.dsc.inc
> > +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> > @@ -80,9 +80,7 @@
> >DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
> >UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
> >IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
> > -!if $(NETWORK_IP6_ENABLE) == TRUE
> >TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
> > -!endif
> >  !if $(HTTP_BOOT_ENABLE) == TRUE
> >HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
> >  !endif
> >
>
> I'm *very strongly* tempted to simply revert 9a67ba261fe9, for blatantly
> ignoring my explicit requests for updates. However, that would only
> result in my having to review more (possibly incomplete) iterations of
> the patch.
>
> At least, this incremental fix is in line with my request in (a) -- "we
> should make the current TcpIoLib class resolution unconditional". Please
> go ahead and push it.
>
> Reviewed-by: Laszlo Ersek 
>

Thanks. Apologies for not looking more carefully whether the feedback
had in fact been incorporated before giving my R-b

Pushed as 9a67ba261fe9..a9ff32909b47

> I should really file a TianoCore BZ about the wrong / redundant
> OpensslLib resolution in ArmVirtQemuKernel.dsc too. It's difficult for
> me to find te motivation for that right now, seeing the disregard for my
> earlier reviews.
>

I assumed [incorrectly, I suppose] that people actually build test
platforms that they modify, but apparently not :-)
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg/PciBus: Fix system hang when no PCI Option ROM exists

2018-12-14 Thread Philippe Mathieu-Daudé
On 12/12/18 4:10 PM, Ruiyu Ni wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1394
> 
> When there is no PCI option ROM exists, today's logic still creates
> virtual BAR for option ROM using Length = 0, Alignment = (-1).
> It causes the final MEM32 alignment requirement is as big as
> 0x_.
> 
> The patch fixes this issue by only creating virtual BAR for option
> ROM when there is PCI option ROM.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Chiu Chasel 
> Cc: Hao A Wu 
> Cc: Jian J Wang 
> ---
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c 
> b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
> index 7255bcfbbc..ee5c77147e 100644
> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
> @@ -515,10 +515,12 @@ PciHostBridgeResourceAllocator (
>// All devices' Option ROM share the same MEM32 resource.
>//
>MaxOptionRomSize = GetMaxOptionRomSize (RootBridgeDev);
> -  RootBridgeDev->PciBar[0].BarType   = PciBarTypeOpRom;
> -  RootBridgeDev->PciBar[0].Length= MaxOptionRomSize;
> -  RootBridgeDev->PciBar[0].Alignment = MaxOptionRomSize - 1;
> -  GetResourceFromDevice (RootBridgeDev, IoBridge, Mem32Bridge, 
> PMem32Bridge, Mem64Bridge, PMem64Bridge);
> +  if (MaxOptionRomSize != 0) {
> +RootBridgeDev->PciBar[0].BarType   = PciBarTypeOpRom;
> +RootBridgeDev->PciBar[0].Length= MaxOptionRomSize;
> +RootBridgeDev->PciBar[0].Alignment = MaxOptionRomSize - 1;
> +GetResourceFromDevice (RootBridgeDev, IoBridge, Mem32Bridge, 
> PMem32Bridge, Mem64Bridge, PMem64Bridge);
> +  }
>  
>//
>// Create resourcemap by going through all the devices subject to this 
> root bridge
> 

Reviewed-by: Philippe Mathieu-Daudé 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Line endings: Was "Re: [edk2-test][Patch] uefi-sct/SctPkg:Correct macro name style in HwErrRecVariable Test"

2018-12-14 Thread Jin, Eric
Currently, the git am fail with " --ignore-space-change" switch on/off. It is 
better if we can solve it with "core.whitespace", "am.keepcr" and 
"core.autocrlf" in the meantime.

Should all existing patches hold until the conversion done or the conversion is 
tried on the branch until it is validated? 

Best Regards
Eric

-Original Message-
From: Supreeth Venkatesh [mailto:supreeth.venkat...@arm.com] 
Sent: Saturday, December 15, 2018 7:54 AM
To: Laszlo Ersek ; Leif Lindholm ; 
Andrew Fish ; Kinney, Michael D 
Cc: edk2-devel@lists.01.org; Jin, Eric 
Subject: Re: Line endings: Was "Re: [edk2-test][Patch] uefi-sct/SctPkg:Correct 
macro name style in HwErrRecVariable Test"

On Fri, 2018-12-14 at 20:57 +0100, Laszlo Ersek wrote:
> On 12/14/18 18:12, Supreeth Venkatesh wrote:
> > On Fri, 2018-12-14 at 14:24 +0100, Laszlo Ersek wrote:
> > > On 12/14/18 11:59, Leif Lindholm wrote:
> > > > Hmm, this gets me thinking...
> > > > 
> > > > We were discussing before about doing a line ending conversion 
> > > > in edk2, and let the git gools provide native line endings (as 
> > > > designed).
> > > > 
> > > > Is this a good opportunity to run a pilot with edk2-test, where 
> > > > much less history will be lost?
> > > 
> > > Well, history won't be lost, in the sense that people running "git 
> > > blame" will need one more execution of "git blame" (to "look past"
> > > the
> > > whitespace change commit), but yes, it will result in a minor 
> > > inconvenience.
> > > 
> > > And, I think, converting the edk2-test repo would not be a bad 
> > > test at all.
> > > 
> > 
> > Thanks Leif/Laszlo. I volunteer to try the tool. However, I admit
> > that
> > I have not tried this before, any pointers/instructions on how to
> > do
> > this?
> 
> I imagine you'd run a "find" command to locate all source/text files
> (skip ".git"), then feed them to xargs / dos2unix.
> 
> The trick is more in the git settings, once the internal
> representation
> has been converted to LF only. I'm thinking that "core.whitespace",
> "am.keepcr" and "core.autocrlf" should be set the "right way". (= to
> be
> researched)
Never mind. I think I misread the initial email. I was expecting some
git tool magic or script :). I can come up with one. Thanks.

> 
> Thanks
> Laszlo

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


Re: [edk2] [PATCH edk2-platforms 24/27] Silicon/NXP: Add i.MX6 common dsc and fdf files

2018-12-14 Thread Leif Lindholm
On Fri, Sep 21, 2018 at 08:26:16AM +, Chris Co wrote:
> This adds the common dsc and fdf definitions for NXP i.MX6 platforms.
> Platform dsc definitions will define $(BOARD_NAME), $(IMX_FAMILY),
> $(IMX_CHIP_TYPE), $(DRAM_SIZE), and $(BOARD_DIR) to indicate
> i.MX SoC family and board-specific configurations.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Christopher Co 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> ---
>  Silicon/NXP/iMX6Pkg/iMX6CommonDsc.inc | 897 
>  Silicon/NXP/iMX6Pkg/iMX6CommonFdf.inc | 287 +++
>  Silicon/NXP/iMX6Pkg/iMX6ConfigDsc.inc | 148 

I would prefer for these to be named .dsc.inc and .fdf.inc.

>  3 files changed, 1332 insertions(+)
> 
> diff --git a/Silicon/NXP/iMX6Pkg/iMX6CommonDsc.inc 
> b/Silicon/NXP/iMX6Pkg/iMX6CommonDsc.inc
> new file mode 100644
> index ..743a022c2b4a
> --- /dev/null
> +++ b/Silicon/NXP/iMX6Pkg/iMX6CommonDsc.inc
> @@ -0,0 +1,897 @@
> +#
> +# iMX6 Quad and Dual SOM platforms common description
> +#
> +#  Copyright (c) 2018 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] Section
> +#
> +
> +[Defines]
> +  PLATFORM_NAME  = iMX6
> +  PLATFORM_GUID  = F01954EE-8AC4-45BC-80E5-511EAE64C38C
> +  PLATFORM_VERSION   = 0.1
> +  DSC_SPECIFICATION  = 0x00010019
> +  OUTPUT_DIRECTORY   = Build/$(BOARD_NAME)
> +  SUPPORTED_ARCHITECTURES= ARM
> +  BUILD_TARGETS  = DEBUG|RELEASE

Please add NOOPT as well.

> +  SKUID_IDENTIFIER   = DEFAULT
> +
> +!include Silicon/NXP/iMX6Pkg/iMX6ConfigDsc.inc
> +
> +
> +#
> +# [BuildOptions] Section
> +#
> +
> +[BuildOptions]
> +  GCC:*_*_*_CC_FLAGS = -D$(BOARD_NAME) -DCPU_$(IMX_FAMILY) 
> -DSOCTYPE_$(IMX_CHIP_TYPE) -Wno-unused-local-typedefs

Why the disabled warning?

> +  GCC:*_*_*_OBJCOPY_PATH = noop
> +  GCC:*_*_*_SYMRENAME_PATH = noop

Hmm?

> +  *_*_*_ASL_PATH == asl.exe
> +  *_*_*_ASL_FLAGS == /MsftInternal
> +  *_*_*_ASL_OUTFLAGS == /Fo=
> +
> +# CPU_* compiler flag is used to select constants for iMX6.h
> +
> +[BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
> +  GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
> +
> +[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
> +  GCC:*_*_ARM_DLINK_FLAGS = -z common-page-size=0x1000

You can probably drop the common-page-size overrides now, we've
changed the toolchain profiles.

> +
> +
> +#
> +# [LibraryClasses] Sections
> +#
> +# When parsing the DSC file, the precedence rules will followed.
> +#  1. If a Library Class Instance (INF) is specified in the EDK II 
> [Components] section
> +# (INF files  sub-section,) then it will be used.
> +#  2. If not specified in the [Components] section, then the Library Class 
> Instance that is
> +# defined in the [LibraryClasses.$(ARCH).$(MODULE_TYPE)] section will be 
> used.
> +#  3. If not specified in the [LibraryClasses.$(ARCH).$(MODULE_TYPE)] 
> section, then
> +# the Library Class Instance that is defined in the
> +# [LibraryClasses.Common.$(MODULE_TYPE)] section will be used.
> +#  4. If not specified in the [LibraryClasses.Common.$(MODULE_TYPE)] 
> section, then
> +# the Library Class Instance that is defined in the 
> [LibraryClasses.$(ARCH)] section
> +# will be used.
> +#  5. If not specified in the [LibraryClasses.$(ARCH)] section, then the 
> Library Class
> +# Instance that is defined in the [LibraryClasses] Section or
> +# [LibraryClasses.Common] section will be used.
> +#  6. It is an error if it has not been specified in one of the above 
> sections
> +#
> +
> +
> +[LibraryClasses.common]
> +  #
> +  # CPU and Timing
> +  #
> +  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
> +  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
> +  CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> +  ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
> +  
> 

Re: [edk2] Line endings: Was "Re: [edk2-test][Patch] uefi-sct/SctPkg:Correct macro name style in HwErrRecVariable Test"

2018-12-14 Thread Supreeth Venkatesh
On Fri, 2018-12-14 at 20:57 +0100, Laszlo Ersek wrote:
> On 12/14/18 18:12, Supreeth Venkatesh wrote:
> > On Fri, 2018-12-14 at 14:24 +0100, Laszlo Ersek wrote:
> > > On 12/14/18 11:59, Leif Lindholm wrote:
> > > > Hmm, this gets me thinking...
> > > > 
> > > > We were discussing before about doing a line ending conversion
> > > > in
> > > > edk2, and let the git gools provide native line endings (as
> > > > designed).
> > > > 
> > > > Is this a good opportunity to run a pilot with edk2-test, where
> > > > much
> > > > less history will be lost?
> > > 
> > > Well, history won't be lost, in the sense that people running
> > > "git
> > > blame" will need one more execution of "git blame" (to "look
> > > past"
> > > the
> > > whitespace change commit), but yes, it will result in a minor
> > > inconvenience.
> > > 
> > > And, I think, converting the edk2-test repo would not be a bad
> > > test
> > > at all.
> > > 
> > 
> > Thanks Leif/Laszlo. I volunteer to try the tool. However, I admit
> > that
> > I have not tried this before, any pointers/instructions on how to
> > do
> > this?
> 
> I imagine you'd run a "find" command to locate all source/text files
> (skip ".git"), then feed them to xargs / dos2unix.
> 
> The trick is more in the git settings, once the internal
> representation
> has been converted to LF only. I'm thinking that "core.whitespace",
> "am.keepcr" and "core.autocrlf" should be set the "right way". (= to
> be
> researched)
Never mind. I think I misread the initial email. I was expecting some
git tool magic or script :). I can come up with one. Thanks.

> 
> Thanks
> Laszlo

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


Re: [edk2] [PATCH v2] ShellPkg/UefiShellDebug1CommandsLib: Remove the unused function CharToUpper

2018-12-14 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Friday, December 14, 2018 1:54 AM
> To: Zhang, Shenglei ; edk2-devel@lists.01.org
> Cc: Carsey, Jaben ; Ni, Ruiyu 
> Subject: Re: [PATCH v2] ShellPkg/UefiShellDebug1CommandsLib: Remove
> the unused function CharToUpper
> Importance: High
> 
> On 12/14/18 08:56, Shenglei Zhang wrote:
> > CharToUpper is an unused function, so it will be removed.
> > https://bugzilla.tianocore.org/show_bug.cgi?id=1399
> >
> > v2:Update the title.
> >
> > Cc: Laszlo Ersek 
> > Cc: Jaben Carsey 
> > Cc: Ruiyu Ni 
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Shenglei Zhang 
> > ---
> >  .../UefiShellDebug1CommandsLib.c  | 28 ---
> >  1 file changed, 28 deletions(-)
> >
> > diff --git
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
> dsLib.c
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
> dsLib.c
> > index bd4dfa98f7..480441b0f9 100644
> > ---
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
> dsLib.c
> > +++
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
> dsLib.c
> > @@ -113,34 +113,6 @@ UefiShellDebug1CommandsLibDestructor (
> >return (EFI_SUCCESS);
> >  }
> >
> > -/**
> > -  Convert a Unicode character to upper case only if
> > -  it maps to a valid small-case ASCII character.
> > -
> > -  This internal function only deal with Unicode character
> > -  which maps to a valid small-case ASCII character, i.e.
> > -  L'a' to L'z'. For other Unicode character, the input character
> > -  is returned directly.
> > -
> > -  @param  Char  The character to convert.
> > -
> > -  @retval LowerCharacter   If the Char is with range L'a' to L'z'.
> > -  @retval UnchangedOtherwise.
> > -
> > -
> > -  //Stolen from MdePkg Baselib
> > -**/
> > -CHAR16
> > -CharToUpper (
> > -  IN  CHAR16Char
> > -  )
> > -{
> > -  if (Char >= L'a' && Char <= L'z') {
> > -return (CHAR16) (Char - (L'a' - L'A'));
> > -  }
> > -
> > -  return Char;
> > -}
> >
> >  /**
> >Function returns a system configuration table that is stored in the
> >
> 
> Reviewed-by: Laszlo Ersek 
> 
> Thanks!
> Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v1 edk2-platforms 1/8] Platform/ARM/SgiPkg: Restructure virtio device registration

2018-12-14 Thread Vijayenthiran Subramaniam
On Fri, Dec 14, 2018 at 8:26 PM Ard Biesheuvel
 wrote:
>
> On Tue, 11 Dec 2018 at 10:08, Vijayenthiran Subramaniam
>  wrote:
> >
> > On Fri, Dec 7, 2018 at 5:49 AM Vijayenthiran Subramaniam
> >  wrote:
> > >
> > > On Thu, Dec 6, 2018 at 5:18 PM Ard Biesheuvel  
> > > wrote:
> > > >
> > > > On Wed, 5 Dec 2018 at 07:10, Vijayenthiran Subramaniam
> > > >  wrote:
> > > > >
> > > > > Hi Ard,
> > > > >
> > > > > The virtio block device and virtio network device are available in 
> > > > > software model only. As of now, it exposes only one instance of each 
> > > > > device.
> > > > >
> > > >
> > > > Are the virtio devices described by the device tree obtained from the
> > > > secure firmware?
> > >
> > > No. The device tree from secure firmware does not carry any devices
> > > information other than platform/config id.
> > >
> >
> > Please let me know if there are any further comments on this patch
> > series. Otherwise, requesting to review the series and merge.
> >
>
> Please rebase the series against latest edk2-platforms, and I will do
> the final review (and merge)

Sure. Will post the series as v2 after rebasing.

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


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

2018-12-14 Thread Philippe Mathieu-Daudé
Hi Pete, Leif.

On 12/12/18 9:01 PM, Leif Lindholm wrote:
> On Wed, Dec 12, 2018 at 07:53:04PM +, Pete Batard wrote:
>> On 2018.12.12 18:32, Leif Lindholm wrote:
>>> On Tue, Dec 11, 2018 at 08:16:07PM +, Pete Batard wrote:
> I _think_ all of the ATF binaries we have in non-osi are
> non-upstream. If the port for the rpi3 is upstream, I would be just as
> happy to have simple build instructions of a known good commit (with
> notes on toolchain version tested) in the Readme.md - and possibly a
> placeholder directory with a .inf in to drop a prebuilt image into.

 Well, while it is upstream, it is built using a custom rpi3 specific option
 which we had ATF to add, so that we could get a memory mapping that works
 with Windows (default one was okay for Linux but not Windows). So I doubt 
 we
 will ever get upstream binaries that we can use as is, if that's what you
 are alluding to.
>>>
>>> I don't really care all that much about that, but if we need
>>> modifications to run Windows (and nothing prevents that from working
>>> with Linux), then should we try to change the upstream defaults?
>>
>> The problem here is U-Boot.
>>
>> The RPi3 ATF has pretty much been designed around U-Boot usage (since it was
>> its only consumer until now), so, to achieve the above, we'll need to
>> validate that we aren't going to break anything for downstream RPi3/U-Boot
>> users, which I don't think we can accomplish in a reasonable timeframe.
>>
>> When I mentioned that the ATF works with Linux and Windows, I meant "when
>> used as part of an UEFI payload". But I have yet to run any comprehensive
>> test of our UEFI-tailored ATF within a U-Boot payload. And even though
>> nobody should be relying on a fixed memory mapping, I do some have concerns
>> that some people might have downstream elements that are tailored around the
>> current U-Boot friendly memory mapping, which we might break.
>>
>> As such, I'd rather first see usage of the UEFI bootloader take off with a
>> few Linux distros, after it has been officialized in edk2-platforms, so that
>> we can have a bit more weight in asking the U-Boot folks whether they'd
>> consider using our memory mapping as default.
> 
> Understood - thank you for this background.
> 
>>> But for me, I'd be happy with just the build instructions you have,
>>> and no binaries/license, in
>>> edk2-platforms/Platform/RaspberryPi/RPi3/Arm-Tf/, with the user having
>>> to drop in their own binaries.
>>
>> In that case, I think I'd still like to provide some links to downloadable
>> binaries, for people who don't want to have to rebuild ATF, and who consider
>> that download links provided in an official readme should be trustworthy
>> enough.
>>
>> I can certainly upload binary releases for the required ATF files in my
>> github clone of ATF, and then add links to that in the readme with the
>> instructions on how to rebuild ATF.
>>
>> However, I'd rather wait to do that until there has been an official tagged
>> new release for ATF (which would be 2.1 at this stage, since our changes
>> have been applied after 2.0), as it'll look better for Pi users to see an
>> initial ATF serial output that says "BL<#>: v2.1(release)" instead of the
>> current "BL<#>: v2.0(release):v2.0-278-gc3859557"
>>
>> How about this then: If ATF produces a formal release before this proposal
>> is integrated, I'll amend it to remove the ATF binary blobs and apply the
>> suggestion above, with the Atf/ build/link data moved out of non-osi. But if
>> they don't, I'll keep the proposal for ATF as is, and then submit a patch to
>> remove the non-osi data and apply the above at a later date, once there has
>> been a new ATF release.
> 
> Yeah, this certainly works for me.

I setup this Dockerfile [1] to have reproducible builds and avoid to
store those binaries in the non-osi repository, what do you think about
this approach?

[1] available here:
https://gitlab.com/philmd/edk2-platforms/blob/raspi3-atf/Platform/RaspberryPi/RPi3/Arm-Tf/Dockerfile

$ cat Platform/RaspberryPi/RPi3/Arm-Tf/Dockerfile
-- >8 --
#
# Docker image to build Trusted Firmware-A for the Raspberry Pi 3 board
#
# Copyright (c) 2018 Red Hat, Inc. All rights reserved.
#
# SPDX-License-Identifier: BSD 2-Clause "Simplified" License
#
# -
# Steps to reproduce an image:
#
# 1/ build the Docker image:
# $ docker build -t atf-raspi3-builder .
#
# 2/ build the firmware:
# The image will store the built files into the /build directory (within
Docker).
# You can mount a host directory using the '-v :/build'
option.
# For example, using the 'build' directory in your current directory:
# $ docker run --rm -v $PWD/build:/build atf-raspi3-builder
# [...]
#   AS  lib/xlat_tables_v2/aarch64/enable_mmu.S
#   PP  bl1/bl1.ld.S
#   LD  /build/rpi3/release/bl1/bl1.elf
#   BIN /build/rpi3/release/bl1.bin
# Built /build/rpi3/release/bl1.bin 

[edk2] [Patch V2] BaseTools: Fix PcdArray issue

2018-12-14 Thread BobCF
From: "Feng, Bob C" 

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

1. support hex number for array index
2. support Non-Dynamic Pcd for array data type
3. support {} and {CODE()} for array data type
4. Change GetStructurePcdMaxSize to be a static function since it need to
be called in another static function. And this function does not depend on
it's class instance.
5. Add unittest for RemoveCComments function and
ArrayIndex regular expression.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Ard Biesheuvel 
Cc: Philippe Mathieu-Daudé 
---
 BaseTools/Source/Python/Common/Misc.py|  6 ++
 .../Python/Workspace/BuildClassObject.py  |  3 +-
 .../Source/Python/Workspace/DscBuildData.py   | 59 ---
 BaseTools/Tests/TestRegularExpression.py  | 54 +
 4 files changed, 99 insertions(+), 23 deletions(-)
 create mode 100644 BaseTools/Tests/TestRegularExpression.py

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index b063f064fb..ea09f85e70 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -2144,10 +2144,16 @@ def CopyDict(ori_dict):
 if isinstance(ori_dict[key],(dict,OrderedDict)):
 new_dict[key] = CopyDict(ori_dict[key])
 else:
 new_dict[key] = ori_dict[key]
 return new_dict
+
+#
+# Remove the c/c++ comments: // and /* */
+#
+def RemoveCComments(ctext):
+return re.sub('//.*?\n|/\*.*?\*/', '\n', ctext, flags=re.S)
 ##
 #
 # This acts like the main() function for the script, unless it is 'import'ed 
into another
 # script.
 #
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index 008eee1a16..e9a1195fd2 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -17,11 +17,11 @@ import collections
 import re
 from collections import OrderedDict
 from Common.Misc import CopyDict
 import copy
 StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_\[\]]*$')
-ArrayIndex = re.compile("\[\s*\d{0,1}\s*\]")
+ArrayIndex = re.compile("\[\s*[0-9a-fA-FxX]*\s*\]")
 ## PcdClassObject
 #
 # This Class is used for PcdObject
 #
 # @param object: Inherited from object class
@@ -82,10 +82,11 @@ class PcdClassObject(object):
 dimension = ArrayIndex.findall(self._DatumType)
 for item in dimension:
 maxsize = item.lstrip("[").rstrip("]").strip()
 if not maxsize:
 maxsize = "-1"
+maxsize = str(int(maxsize,16)) if maxsize.startswith(("0x","0X")) 
else maxsize
 self._Capacity.append(maxsize)
 if hasattr(self, "SkuOverrideValues"):
 for sku in self.SkuOverrideValues:
 for defaultstore in self.SkuOverrideValues[sku]:
 fields = self.SkuOverrideValues[sku][defaultstore]
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index b485c75a84..37fb8d56b6 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -31,11 +31,11 @@ from .MetaDataTable import *
 from .MetaFileTable import *
 from .MetaFileParser import *
 
 from .WorkspaceCommon import GetDeclaredPcd
 from Common.Misc import AnalyzeDscPcd
-from Common.Misc import ProcessDuplicatedInf
+from Common.Misc import ProcessDuplicatedInf,RemoveCComments
 import re
 from Common.Parsing import IsValidWord
 from Common.VariableAttributes import VariableAttributes
 import Common.GlobalData as GlobalData
 import subprocess
@@ -1573,11 +1573,11 @@ class DscBuildData(PlatformBuildClassObject):
 mindefaultstorename = 
DefaultStoreObj.GetMin(PcdDefaultStoreSet)
 
str_pcd_obj.SkuInfoList[self.SkuIdMgr.SystemSkuId].HiiDefaultValue = 
str_pcd_obj.SkuInfoList[self.SkuIdMgr.SystemSkuId].DefaultStoreDict[mindefaultstorename]
 
 for str_pcd_obj in S_pcd_set.values():
 
-str_pcd_obj.MaxDatumSize = 
self.GetStructurePcdMaxSize(str_pcd_obj)
+str_pcd_obj.MaxDatumSize = 
DscBuildData.GetStructurePcdMaxSize(str_pcd_obj)
 Pcds[str_pcd_obj.TokenCName, str_pcd_obj.TokenSpaceGuidCName] 
= str_pcd_obj
 Pcds[str_pcd_obj.TokenCName, 
str_pcd_obj.TokenSpaceGuidCName].CustomAttribute['IsStru']=True
 
 for pcdkey in Pcds:
 pcd = Pcds[pcdkey]
@@ -1687,13 +1687,14 @@ class DscBuildData(PlatformBuildClassObject):
 if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue:
 Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
 Pcds[PcdCName, 
TokenSpaceGuid].DscRawValue[SkuName][TAB_DEFAULT_STORES_DEFAULT] = Settings[0]
 return Pcds
 
-def GetStructurePcdMaxSize(self, 

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

2018-12-14 Thread Pete Batard

Hi Ard,

Thanks for the review. I will incorporate the points you raised for 8/9/13.

On 2018.12.14 15:39, Ard Biesheuvel wrote:

On Mon, 10 Dec 2018 at 13:39, Pete Batard  wrote:


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(+)



This looks fine as well.

In general, please screen the code for the cosmetic stuff I mentioned.
I haven't looked at the SD/MMC drivers yet, and I don't have the
bandwidth (or the energy) to do a deep review of those. The NV storage
driver I will have a more careful look at, but not today - hopefully
by the end of next week,


I tried running PatchCheck.py but it doesn't seem to run on my system
(I have never used it in anger myself), but it should help you spot
many of the issues I brought up.


I ran PatchCheck.py on every single patch sent, and made sure the script 
didn't report any issue.


For instance, this is what PatchCheck reports on my Debian system for 
the 16 patches that apply to edk2-platforms:


-

# python /usr/src/edk2/BaseTools/Scripts/PatchCheck.py -16
Checking git commit: 4695ab7f1bc7
The commit message format passed all checks.
The code passed all checks.

Checking git commit: 4583a4c82bba
The commit message format passed all checks.
The code passed all checks.

Checking git commit: 7406c575c809
The commit message format passed all checks.
The code passed all checks.

Checking git commit: b5ee3fe94aae
The commit message format passed all checks.
The code passed all checks.

Checking git commit: 937845c4cc4d
The commit message format passed all checks.
The code passed all checks.

Checking git commit: 07dae6403e5e
The commit message format passed all checks.
The code passed all checks.

Checking git commit: cef8f008d1fa
The commit message format passed all checks.
The code passed all checks.

Checking git commit: 5304797f8494
The commit message format passed all checks.
The code passed all checks.

Checking git commit: 17711dc8965d
The commit message format passed all checks.
The code passed all checks.

Checking git commit: 83627cdc550f
The commit message format passed all checks.
The code passed all checks.

Checking git commit: c4f87ea8987b
The commit message format passed all checks.
The code passed all checks.

Checking git commit: ca99e77c7b95
The commit message format passed all checks.
The code passed all checks.

Checking git commit: eddd965e2672
The commit message format passed all checks.
The code passed all checks.

Checking git commit: 0893ac6d1509
The commit message format passed all checks.
The code passed all checks.

Checking git commit: f595d0be1e86
The commit message format passed all checks.
The code passed all checks.

Checking git commit: fe4b945ac743
The commit message format passed all checks.
The code passed all checks.

-

So, it doesn't look like the script is current set to detect space 
before parenthesis and the other cosmetic issues you pointed out. But 
I'll make sure to get that fixed. I am currently looking into having the 
Visual Studio editor automate the process of fixing this.


Note that I also found that 'git am' complained about empty newlines 
being present at the end of some files, so I'll fix that too.


Regards,

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


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

2018-12-14 Thread Leif Lindholm
On Fri, Dec 14, 2018 at 05:14:05PM +0100, Philippe Mathieu-Daudé wrote:
> >> I can certainly upload binary releases for the required ATF files in my
> >> github clone of ATF, and then add links to that in the readme with the
> >> instructions on how to rebuild ATF.
> >>
> >> However, I'd rather wait to do that until there has been an official tagged
> >> new release for ATF (which would be 2.1 at this stage, since our changes
> >> have been applied after 2.0), as it'll look better for Pi users to see an
> >> initial ATF serial output that says "BL<#>: v2.1(release)" instead of the
> >> current "BL<#>: v2.0(release):v2.0-278-gc3859557"
> >>
> >> How about this then: If ATF produces a formal release before this proposal
> >> is integrated, I'll amend it to remove the ATF binary blobs and apply the
> >> suggestion above, with the Atf/ build/link data moved out of non-osi. But 
> >> if
> >> they don't, I'll keep the proposal for ATF as is, and then submit a patch 
> >> to
> >> remove the non-osi data and apply the above at a later date, once there has
> >> been a new ATF release.
> > 
> > Yeah, this certainly works for me.
> 
> I setup this Dockerfile [1] to have reproducible builds and avoid to
> store those binaries in the non-osi repository, what do you think about
> this approach?

Get off my lawn? :)

> [1] available here:
> https://gitlab.com/philmd/edk2-platforms/blob/raspi3-atf/Platform/RaspberryPi/RPi3/Arm-Tf/Dockerfile

I think it's a good thing to have, especially for something like the
Pi. I guess if that exists, we can trust people who prefer not to use
containers to be happy to follow the Readme, or grab binaries from
Pete's github?

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


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

2018-12-14 Thread Ard Biesheuvel
On Mon, 10 Dec 2018 at 13:39, Pete Batard  wrote:
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Pete Batard 

Please fix the usual things like INF_VERSION and space before ( in
function or macro invocations.

Otherwise, this looks fine
'
> ---
>  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 

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

2018-12-14 Thread Ard Biesheuvel
On Mon, 10 Dec 2018 at 13:39, Pete Batard  wrote:
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Pete Batard 

Please use STATIC etc etc

> ---
>  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, 

Re: [edk2] [PATCH v1 edk2-platforms 1/8] Platform/ARM/SgiPkg: Restructure virtio device registration

2018-12-14 Thread Ard Biesheuvel
On Tue, 11 Dec 2018 at 10:08, Vijayenthiran Subramaniam
 wrote:
>
> On Fri, Dec 7, 2018 at 5:49 AM Vijayenthiran Subramaniam
>  wrote:
> >
> > On Thu, Dec 6, 2018 at 5:18 PM Ard Biesheuvel  
> > wrote:
> > >
> > > On Wed, 5 Dec 2018 at 07:10, Vijayenthiran Subramaniam
> > >  wrote:
> > > >
> > > > Hi Ard,
> > > >
> > > > The virtio block device and virtio network device are available in 
> > > > software model only. As of now, it exposes only one instance of each 
> > > > device.
> > > >
> > >
> > > Are the virtio devices described by the device tree obtained from the
> > > secure firmware?
> >
> > No. The device tree from secure firmware does not carry any devices
> > information other than platform/config id.
> >
>
> Please let me know if there are any further comments on this patch
> series. Otherwise, requesting to review the series and merge.
>

Please rebase the series against latest edk2-platforms, and I will do
the final review (and merge)

> > >
> > > > On Tue, Dec 4, 2018 at 8:16 PM Ard Biesheuvel 
> > > >  wrote:
> > > >>
> > > >> On Tue, 4 Dec 2018 at 10:12, Vijayenthiran Subramaniam
> > > >>  wrote:
> > > >> >
> > > >> > From: Daniil Egranov 
> > > >> >
> > > >> > SGI platforms support multiple virtio devices. So the existing code, 
> > > >> > that
> > > >> > supports registration of only the virtio disk, is restructured to
> > > >> > accommodate the registration of additional virtio devices.
> > > >> >
> > > >> > In addition to this, PCDs to represent the virtio controller base and
> > > >> > address space size are introduced.
> > > >> >
> > > >> > Contributed-under: TianoCore Contribution Agreement 1.1
> > > >> > Signed-off-by: Daniil Egranov 
> > > >> > ---
> > > >> >  Platform/ARM/SgiPkg/SgiPlatform.dec 
> > > >> >  |  8 ++-
> > > >> >  Platform/ARM/SgiPkg/SgiPlatform.dsc 
> > > >> >  |  7 +-
> > > >> >  Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
> > > >> >  |  8 ++-
> > > >> >  Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h  
> > > >> >  | 21 ++
> > > >> >  Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   
> > > >> >  | 14 +---
> > > >> >  Platform/ARM/SgiPkg/Drivers/PlatformDxe/{VirtioBlockIo.c => 
> > > >> > VirtioDevices.c} | 67 
> > > >> >  6 files changed, 81 insertions(+), 44 deletions(-)
> > > >> >
> > > >>
> > > >> Can these platforms only ever expose a single block device and a
> > > >> single network device?
> > > >>
> > > >> > diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec 
> > > >> > b/Platform/ARM/SgiPkg/SgiPlatform.dec
> > > >> > index f6e0ba1e927a..ed29a4d5d91f 100644
> > > >> > --- a/Platform/ARM/SgiPkg/SgiPlatform.dec
> > > >> > +++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
> > > >> > @@ -37,12 +37,16 @@ [Guids.common]
> > > >> >gSgiClarkHeliosAcpiTablesFileGuid = { 0x2af40815, 0xa84e, 0x4de9, 
> > > >> > { 0x8c, 0x38, 0x91, 0x40, 0xb3, 0x54, 0x40, 0x73 } }
> > > >> >
> > > >> >  [PcdsFeatureFlag.common]
> > > >> > -  # Set this PCD to TRUE to enable virtio support.
> > > >> > -  gArmSgiTokenSpaceGuid.PcdVirtioSupported|TRUE|BOOLEAN|0x0001
> > > >> > +  
> > > >> > gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|FALSE|BOOLEAN|0x0001
> > > >> >
> > > >> >  [PcdsFixedAtBuild]
> > > >> >gArmSgiTokenSpaceGuid.PcdDramBlock2Base|0|UINT64|0x0002
> > > >> >gArmSgiTokenSpaceGuid.PcdDramBlock2Size|0|UINT64|0x0003
> > > >> >
> > > >> > +  # Virtio Block device
> > > >> > +  
> > > >> > gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress|0x|UINT32|0x0004
> > > >> > +  
> > > >> > gArmSgiTokenSpaceGuid.PcdVirtioBlkSize|0x|UINT32|0x0005
> > > >> > +  
> > > >> > gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt|0x|UINT32|0x0006
> > > >> > +
> > > >> >  [Ppis]
> > > >> >gHwConfigDtInfoPpiGuid = { 0x6f606eb3, 0x9123, 0x4e15, { 
> > > >> > 0xa8, 0x9b, 0x0f, 0xac, 0x66, 0xef, 0xd0, 0x17 } }
> > > >> > diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
> > > >> > b/Platform/ARM/SgiPkg/SgiPlatform.dsc
> > > >> > index b3f76d2d9720..ada72be72f8a 100644
> > > >> > --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
> > > >> > +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
> > > >> > @@ -98,7 +98,7 @@ [LibraryClasses.common.UEFI_DRIVER, 
> > > >> > LibraryClasses.common.UEFI_APPLICATION, Libr
> > > >> >  
> > > >> > 
> > > >> >
> > > >> >  [PcdsFeatureFlag.common]
> > > >> > -  gArmSgiTokenSpaceGuid.PcdVirtioSupported|TRUE
> > > >> > +  gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|TRUE
> > > >> >
> > > >> >  [PcdsFixedAtBuild.common]
> > > >> >gArmTokenSpaceGuid.PcdVFPEnabled|1
> > > >> > @@ -180,6 +180,11 @@ [PcdsFixedAtBuild.common]
> > > >> ># Ethernet
> > > >> >gEmbeddedTokenSpaceGuid.PcdLan91xDxeBaseAddress|0x1800
> > > >> >
> > > >> > +  # Virtio Disk
> > > >> > +  

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

2018-12-14 Thread Ard Biesheuvel
On Mon, 10 Dec 2018 at 13:39, Pete Batard  wrote:
>
> 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(+)
>

Same as the previous patches: please check for the usual suspects.
Also, please make global variables STATIC if they are never referenced
from another object file.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


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

2018-12-14 Thread Ard Biesheuvel
On Mon, 10 Dec 2018 at 13:39, Pete Batard  wrote:
>
> 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(+)
>

This looks fine as well.

In general, please screen the code for the cosmetic stuff I mentioned.
I haven't looked at the SD/MMC drivers yet, and I don't have the
bandwidth (or the energy) to do a deep review of those. The NV storage
driver I will have a more careful look at, but not today - hopefully
by the end of next week,


I tried running PatchCheck.py but it doesn't seem to run on my system
(I have never used it in anger myself), but it should help you spot
many of the issues I brought up.


> 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
> 

Re: [edk2] [PATCH edk2-platforms 20/27] Silicon/NXP: Add i.MX6 Board init library

2018-12-14 Thread Leif Lindholm
On Fri, Sep 21, 2018 at 08:26:12AM +, Chris Co wrote:
> This adds support for board initialization which is common to
> NXP i.MX6-based platforms.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Christopher Co 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> ---
>  Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardHelper.S   |  89 
> 
>  Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardMem.c  | 110 
> 
>  Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6Common.c|  88 
> 
>  Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6QBoardCoreDef.c | 107 
> +++
>  4 files changed, 394 insertions(+)
> 
> diff --git a/Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardHelper.S 
> b/Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardHelper.S
> new file mode 100644
> index ..979e9a6b
> --- /dev/null
> +++ b/Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardHelper.S
> @@ -0,0 +1,89 @@
> +## @file
> +#
> +#  Copyright (c) 2018 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 

Are all of these really used?

> +
> +.text
> +.align 2
> +
> +// GIC Cpu interface
> +#define ARM_GIC_ICCICR  0x00  // CPU Interface Control Register
> +#define ARM_GIC_ICCPMR  0x04  // Interrupt Priority Mask Register
> +#define ARM_GIC_ICCBPR  0x08  // Binary Point Register
> +#define ARM_GIC_ICCIAR  0x0C  // Interrupt Acknowledge Register
> +#define ARM_GIC_ICCEIOR 0x10  // End Of Interrupt Register
> +#define ARM_GIC_ICCRPR  0x14  // Running Priority Register
> +#define ARM_GIC_ICCPIR  0x18  // Highest Pending Interrupt Register
> +#define ARM_GIC_ICCABPR 0x1C  // Aliased Binary Point Register
> +#define ARM_GIC_ICCIDR  0xFC  // Identification Register

Why do you need to access these directly from asm?
Hmm, they also look unused?

> +
> +// SRC (System Reset Controller) register offsets & masks
> +#define IMX6_SRC_SCR 0x0
> +#define IMX6_SRC_GPR10x20
> +#define IMX6_SRC_GPR20x24
> +#define IMX6_SRC_GPR30x28
> +#define IMX6_SRC_GPR40x2C
> +#define IMX6_SRC_GPR50x30
> +#define IMX6_SRC_GPR60x34
> +#define IMX6_SRC_GPR70x38
> +#define IMX6_SRC_GPR80x3C
> +#define IMX6_SRC_GPR90x40
> +#define IMX6_SRC_GPR10   0x44

As do these?

> +
> +GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
> +GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
> +GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
> +GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
> +
> +//UINTN
> +//ArmPlatformGetPrimaryCoreMpId (
> +//  VOID
> +//  );
> +ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
> +  MOV32 (r0, FixedPcdGet32 (PcdArmPrimaryCore))
> +  ldr   r0, [r0]
> +  bxlr
> +
> +//UINTN
> +//ArmPlatformIsPrimaryCore (
> +//  IN UINTN MpId
> +//  );
> +ASM_PFX(ArmPlatformIsPrimaryCore):
> +  mrc   p15,0,r0,c0,c0,5
> +  ands  r0,r0,#3
> +  moveq r0,#1
> +  movne r0,#0

Sprinkle some spaces after commas above please.

> +  bxlr
> +
> +//UINTN
> +//ArmPlatformGetCorePosition (
> +//  IN UINTN MpId
> +//  );
> +ASM_PFX(ArmPlatformGetCorePosition):
> +  and   r0, r0, #ARM_CORE_MASK
> +  bxlr
> +
> +ASM_PFX(ArmPlatformPeiBootAction):
> +  // enable unaligned access
> +  mrc   p15, 0, r1, c1, c0, 0
> +  bic   r1, r1, #0x2
> +  mcr   p15, 0, r1, c1, c0, 0
> +  isb
> +  bx r14
> +
> +ASM_FUNCTION_REMOVE_IF_UNREFERENCED
> diff --git a/Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardMem.c 
> b/Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardMem.c
> new file mode 100644
> index ..a2b601ec9c52
> --- /dev/null
> +++ b/Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardMem.c
> @@ -0,0 +1,110 @@
> +/** @file
> +*
> +*  Copyright (c) 2018 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 "iMX6.h"

<>

> +
> +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS  8
> +
> +/**
> +  Return the Virtual Memory Map of your platform
> +
> +  This Virtual Memory Map is used by 

[edk2] [PATCH v2 edk2-platforms 0/8] Platform/ARM/Sgi: Add support for virtio network device

2018-12-14 Thread Vijayenthiran Subramaniam
Changes since v1:
- Rebased the series against latest edk2-platforms

This patch series adds support for virtio network controller found in ARM SGI
plaform's fast models. The first patch in this series restructure the
virtio device registration code to allow registration of additional virtio
devices. The second patch adds support for the virtio network device. The rest
of the patches update the ACPI tables to add an entry for the virtio network
device and corresponding PCDs for virtio block and network device.

Daniil Egranov (4):
  Platform/ARM/SgiPkg: Restructure virtio device registration
  Platform/ARM/SgiPkg: Add support for virtio net device
  Sgi575: AcpiTables: Use PCDs for virtio disk
  Sgi575: AcpiTables: Add entry for virtio network device

Vijayenthiran Subramaniam (4):
  SgiClark.Ares: AcpiTables: Use PCDs for virtio disk
  SgiClark.Ares: AcpiTables: Add entry for virtio network device
  SgiClark.Helios: AcpiTables: Use PCDs for virtio disk
  SgiClark.Helios: AcpiTables: Add entry for virtio network device

 Platform/ARM/SgiPkg/SgiPlatform.dec  | 
 14 ++-
 Platform/ARM/SgiPkg/SgiPlatform.dsc  | 
 21 +++-
 Platform/ARM/SgiPkg/SgiPlatform.fdf  | 
  4 +
 Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf  | 
  7 ++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf| 
  7 ++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf  | 
  7 ++
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf  | 
 11 +-
 Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h   | 
 24 
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c| 
 14 +--
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/{VirtioBlockIo.c => VirtioDevices.c} | 
117 +++-
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl   | 
 28 -
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl | 
 29 -
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl   | 
 28 -
 13 files changed, 260 insertions(+), 51 deletions(-)
 create mode 100644 Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h
 rename Platform/ARM/SgiPkg/Drivers/PlatformDxe/{VirtioBlockIo.c => 
VirtioDevices.c} (25%)

-- 
2.7.4

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


[edk2] [PATCH v2 edk2-platforms 1/8] Platform/ARM/SgiPkg: Restructure virtio device registration

2018-12-14 Thread Vijayenthiran Subramaniam
From: Daniil Egranov 

SGI platforms support multiple virtio devices. So the existing code, that
supports registration of only the virtio disk, is restructured to
accommodate the registration of additional virtio devices.

In addition to this, PCDs to represent the virtio controller base and
address space size are introduced.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov 
---
 Platform/ARM/SgiPkg/SgiPlatform.dec  | 
 8 ++-
 Platform/ARM/SgiPkg/SgiPlatform.dsc  | 
 7 +-
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf  | 
 8 ++-
 Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h   | 
21 ++
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c| 
14 +---
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/{VirtioBlockIo.c => VirtioDevices.c} | 
67 
 6 files changed, 81 insertions(+), 44 deletions(-)

diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec 
b/Platform/ARM/SgiPkg/SgiPlatform.dec
index 916605298d9f..9300337a8d68 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dec
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -37,12 +37,16 @@ [Guids.common]
   gSgiClarkHeliosAcpiTablesFileGuid = { 0x2af40815, 0xa84e, 0x4de9, { 0x8c, 
0x38, 0x91, 0x40, 0xb3, 0x54, 0x40, 0x73 } }
 
 [PcdsFeatureFlag.common]
-  # Set this PCD to TRUE to enable virtio support.
-  gArmSgiTokenSpaceGuid.PcdVirtioSupported|TRUE|BOOLEAN|0x0001
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|FALSE|BOOLEAN|0x0001
 
 [PcdsFixedAtBuild]
   gArmSgiTokenSpaceGuid.PcdDramBlock2Base|0|UINT64|0x0002
   gArmSgiTokenSpaceGuid.PcdDramBlock2Size|0|UINT64|0x0003
 
+  # Virtio Block device
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress|0x|UINT32|0x0004
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkSize|0x|UINT32|0x0005
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt|0x|UINT32|0x0006
+
 [Ppis]
   gNtFwConfigDtInfoPpiGuid = { 0x6f606eb3, 0x9123, 0x4e15, { 0xa8, 0x9b, 
0x0f, 0xac, 0x66, 0xef, 0xd0, 0x17 } }
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
b/Platform/ARM/SgiPkg/SgiPlatform.dsc
index 19d2ac3a656a..ffebddc19eff 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -100,7 +100,7 @@ [LibraryClasses.common.UEFI_DRIVER, 
LibraryClasses.common.UEFI_APPLICATION, Libr
 

 
 [PcdsFeatureFlag.common]
-  gArmSgiTokenSpaceGuid.PcdVirtioSupported|TRUE
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|TRUE
 
 [PcdsFixedAtBuild.common]
   gArmTokenSpaceGuid.PcdVFPEnabled|1
@@ -185,6 +185,11 @@ [PcdsFixedAtBuild.common]
   # Ethernet
   gEmbeddedTokenSpaceGuid.PcdLan91xDxeBaseAddress|0x1800
 
+  # Virtio Disk
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress|0x1c13
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkSize|0x1
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt|202
+
 

 #
 # Components Section - list of all EDK II Modules needed by this Platform
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
index d903ed8d3375..f920f6ecafb8 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -20,7 +20,7 @@ [Defines]
 
 [Sources.common]
   PlatformDxe.c
-  VirtioBlockIo.c
+  VirtioDevices.c
 
 [Packages]
   EmbeddedPkg/EmbeddedPkg.dec
@@ -41,7 +41,11 @@ [Guids]
   gSgiClarkHeliosAcpiTablesFileGuid
 
 [FeaturePcd]
-  gArmSgiTokenSpaceGuid.PcdVirtioSupported
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported
+
+[FixedPcd]
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
 
 [Depex]
   TRUE
diff --git a/Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h 
b/Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h
new file mode 100644
index ..80d3e3ae4f91
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h
@@ -0,0 +1,21 @@
+/** @file
+*
+*  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.
+*
+**/
+
+#ifndef  __SGI_VIRTIO_DEVICES_FORMSET_H__
+#define  __SGI_VIRTIO_DEVICES_FORMSET_H__
+
+#define SGI_VIRTIO_BLOCK_GUID  \
+  { 0x5a96cdcd, 0x6116, 0x4929, { 0xb7, 0x01, 0x3a, 0xc2, 0xfb, 0x1c, 0xe2, 
0x28 } }
+
+#endif
diff --git 

[edk2] [PATCH v2 edk2-platforms 6/8] SgiClark.Ares: AcpiTables: Add entry for virtio network device

2018-12-14 Thread Vijayenthiran Subramaniam
SgiClark Ares include an instance of the virtio network device. Add
a representation for it in the ACPI tables.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vijayenthiran Subramaniam 
---
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf |  3 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl  | 17 
+
 2 files changed, 20 insertions(+)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
index 10a805e07fd1..d4bacdbc8c85 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
@@ -58,5 +58,8 @@ [FixedPcd]
   gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
   gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
+  gArmSgiTokenSpaceGuid.PcdVirtioNetBaseAddress
+  gArmSgiTokenSpaceGuid.PcdVirtioNetSize
+  gArmSgiTokenSpaceGuid.PcdVirtioNetInterrupt
 
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
index af4dc424a77c..69dc33c06b4d 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
@@ -118,5 +118,22 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", 
"ARMSGI",
 }
   })
 }
+
+// VIRTIO NET
+Device (VR01) {
+  Name (_HID, "LNRO0005")
+  Name (_UID, 1)
+  Name (_CCA, 1)// mark the device coherent
+
+  Name (_CRS, ResourceTemplate() {
+Memory32Fixed (ReadWrite,
+  FixedPcdGet32 (PcdVirtioNetBaseAddress),
+  FixedPcdGet32 (PcdVirtioNetSize)
+)
+Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
+  FixedPcdGet32 (PcdVirtioNetInterrupt)
+}
+  })
+}
   } // Scope(_SB)
 }
-- 
2.7.4

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


[edk2] [PATCH v2 edk2-platforms 7/8] SgiClark.Helios: AcpiTables: Use PCDs for virtio disk

2018-12-14 Thread Vijayenthiran Subramaniam
Use PCDs instead of hardcoded values for virtio disk in DSDT.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vijayenthiran Subramaniam 
---
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf |  4 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl  | 10 --
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
index 0ecce2db8a5d..3686e91bb7e7 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
@@ -55,4 +55,8 @@ [FixedPcd]
   gArmTokenSpaceGuid.PcdPciBusMin
   gArmTokenSpaceGuid.PcdPciBusMax
 
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
+
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl
index b8eb3b8e7332..3dcf6f71eadb 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl
@@ -254,8 +254,14 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", 
"ARMSGI",
   Name (_CCA, 1)// mark the device coherent
 
   Name (_CRS, ResourceTemplate() {
-Memory32Fixed (ReadWrite, 0x1c13, 0x1)
-Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 202 }
+Memory32Fixed (
+  ReadWrite,
+  FixedPcdGet32 (PcdVirtioBlkBaseAddress),
+  FixedPcdGet32 (PcdVirtioBlkSize)
+)
+Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
+  FixedPcdGet32 (PcdVirtioBlkInterrupt)
+}
   })
 }
   } // Scope(_SB)
-- 
2.7.4

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


[edk2] [PATCH v2 edk2-platforms 8/8] SgiClark.Helios: AcpiTables: Add entry for virtio network device

2018-12-14 Thread Vijayenthiran Subramaniam
SgiClark Helios include an instance of the virtio network device. Add
a representation for it in the ACPI tables.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vijayenthiran Subramaniam 
---
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf |  3 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl  | 18 
++
 2 files changed, 21 insertions(+)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
index 3686e91bb7e7..8b45702b7cd3 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
@@ -58,5 +58,8 @@ [FixedPcd]
   gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
   gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
+  gArmSgiTokenSpaceGuid.PcdVirtioNetBaseAddress
+  gArmSgiTokenSpaceGuid.PcdVirtioNetSize
+  gArmSgiTokenSpaceGuid.PcdVirtioNetInterrupt
 
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl
index 3dcf6f71eadb..7cfc419eb3a2 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl
@@ -264,5 +264,23 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", 
"ARMSGI",
 }
   })
 }
+
+// VIRTIO NET
+Device (VR01) {
+  Name (_HID, "LNRO0005")
+  Name (_UID, 1)
+  Name (_CCA, 1)// mark the device coherent
+
+  Name (_CRS, ResourceTemplate() {
+Memory32Fixed (
+  ReadWrite,
+  FixedPcdGet32 (PcdVirtioNetBaseAddress),
+  FixedPcdGet32 (PcdVirtioNetSize)
+)
+Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
+  FixedPcdGet32 (PcdVirtioNetInterrupt)
+}
+  })
+}
   } // Scope(_SB)
 }
-- 
2.7.4

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


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

2018-12-14 Thread Pete Batard

Hi Philippe, Hi Leif,

On 2018.12.14 16:36, Leif Lindholm wrote:

On Fri, Dec 14, 2018 at 05:14:05PM +0100, Philippe Mathieu-Daudé wrote:

I can certainly upload binary releases for the required ATF files in my
github clone of ATF, and then add links to that in the readme with the
instructions on how to rebuild ATF.

However, I'd rather wait to do that until there has been an official tagged
new release for ATF (which would be 2.1 at this stage, since our changes
have been applied after 2.0), as it'll look better for Pi users to see an
initial ATF serial output that says "BL<#>: v2.1(release)" instead of the
current "BL<#>: v2.0(release):v2.0-278-gc3859557"

How about this then: If ATF produces a formal release before this proposal
is integrated, I'll amend it to remove the ATF binary blobs and apply the
suggestion above, with the Atf/ build/link data moved out of non-osi. But if
they don't, I'll keep the proposal for ATF as is, and then submit a patch to
remove the non-osi data and apply the above at a later date, once there has
been a new ATF release.


Yeah, this certainly works for me.


I setup this Dockerfile [1] to have reproducible builds and avoid to
store those binaries in the non-osi repository, what do you think about
this approach?


Get off my lawn? :)


[1] available here:
https://gitlab.com/philmd/edk2-platforms/blob/raspi3-atf/Platform/RaspberryPi/RPi3/Arm-Tf/Dockerfile


I think it's a good thing to have, especially for something like the
Pi. I guess if that exists, we can trust people who prefer not to use
containers to be happy to follow the Readme, or grab binaries from
Pete's github?


That's one way to do it. As I indicated, as soon as ATF creates a 2.1 
tagged release, I will look into removing the binary blobs from non-osi.


However I am not planning to do that sooner. As a matter of fact, given 
that this is not a blocking issue and given the scope of what still 
needs to be addressed for RPi3 integration, I am kind of hoping we won't 
see an ATF release for another month or two, so that we can get through 
the current integration process, with the current binary blobs in 
non-osi, and then sort out their removal post integration.


Personally, I also expect that anybody who wants to build the binaries 
locally, can simply be directed to follow the official ATF build notes 
on how to set up their tool chain, and then refer to the build 
parameters from our readme. But then again, if we have a nice Docker 
solution to provide, I don't see why we shouldn't also point to it.


On the other hand, when it comes to providing trustworthy links, and 
since there exists a MinGW32 version of the Linaro GCC compilers, I'd 
much rather use AppVeyor for automated build of ATF binaries. The nice 
thing is that AppVeyor can keep and serve its build artefacts, so we'd 
be able to directly link to those, which should give some level of trust 
that the binaries haven't been tampered with by the owner of the repo 
(or at least that, if they have, the source would reflect it). And you 
can also easily configure AppVeyor to only build on tagged commits, 
which I think is what we want.


At any rate, I think there exists more than one solution to address the 
ATF binary provision problem for RPi3, while also not having to ask 
users to blindly trust any binaries we might link to. Maybe Docker or 
AppVeyor are what we want to use. Maybe there is yet another option on 
the table that we haven't talked about yet.


If we believe this is necessary, I can look into adding AppVeyor builds 
of the official ATF ASAP. But for the time being, I would prefer if we 
start discussing this in earnest once ATF 2.1 has been tagged for 
release, and I send a formal proposal to address the removal of the 
non-osi ATF binaries.


Regards,

/Pete

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


Re: [edk2] [PATCH edk2-platforms 17/27] Silicon/NXP: Add i.MX6 USB Phy Library

2018-12-14 Thread Leif Lindholm
On Fri, Sep 21, 2018 at 08:26:09AM +, Chris Co wrote:
> This adds support for configuring the USB EHCI PHY on NXP i.MX6 SoCs.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Christopher Co 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> ---
>  Silicon/NXP/iMX6Pkg/Include/iMX6UsbPhy.h|  20 ++
>  Silicon/NXP/iMX6Pkg/Library/iMX6UsbPhyLib/iMX6UsbPhy.c  | 328 
> 
>  Silicon/NXP/iMX6Pkg/Library/iMX6UsbPhyLib/iMX6UsbPhyLib.inf |  43 +++
>  3 files changed, 391 insertions(+)
> 
> diff --git a/Silicon/NXP/iMX6Pkg/Include/iMX6UsbPhy.h 
> b/Silicon/NXP/iMX6Pkg/Include/iMX6UsbPhy.h
> new file mode 100644
> index ..153c5461a6ad
> --- /dev/null
> +++ b/Silicon/NXP/iMX6Pkg/Include/iMX6UsbPhy.h
> @@ -0,0 +1,20 @@
> +/** @file
> +*
> +*  Copyright (c) 2018 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 _IMX6_USB_PHY_H_
> +#define _IMX6_USB_PHY_H_
> +
> +EFI_STATUS ImxUsbPhyInit (IMX_USBPHY_ID ImxUsbPhyId);
> +
> +#endif // _IMX6_USB_PHY_H_
> diff --git a/Silicon/NXP/iMX6Pkg/Library/iMX6UsbPhyLib/iMX6UsbPhy.c 
> b/Silicon/NXP/iMX6Pkg/Library/iMX6UsbPhyLib/iMX6UsbPhy.c
> new file mode 100644
> index ..317d17d14844
> --- /dev/null
> +++ b/Silicon/NXP/iMX6Pkg/Library/iMX6UsbPhyLib/iMX6UsbPhy.c
> @@ -0,0 +1,328 @@
> +/** @file
> +*
> +*  Copyright (c) 2018 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 
> +
> +#define USB_PHY_PLL_LOCK_TIMEOUT_USEC (UINT32)(1000*1000)
> +#define USB_EHCI_STOP_RESET_TIMEOUT_USEC (UINT32)(1000*1000)
> +
> +#define IMX_CCM_ANALOG_PLL_USB1_REG_LOCK 0x8000
> +#define IMX_USB_CMD_REG_RUN 0x0001
> +#define IMX_USB_CMD_REG_RESET 0x0002
> +
> +/**
> +  Wait for a register bit to be on/off
> +**/
> +EFI_STATUS
> +RegisterWaitBit (
> +  IN  volatile VOID   *RegisterAddr,

Why volatile?

> +  IN  UINT32  Mask,
> +  IN  BOOLEAN IsWaitOn,
> +  IN  UINT32  TimeOutUsec

Could just be called MicroSeconds (would match elsewhere in edk2).

> +  )
> +{
> +  UINT32 RegisterValue;
> +  UINT32 TimeUsec;

TimeWaited?

> +
> +  TimeUsec = 0;
> +  do {
> +RegisterValue = MmioRead32 ((UINTN)RegisterAddr) & Mask;
> +if (((RegisterValue == Mask) && IsWaitOn) || ((RegisterValue == 0)
> +&& !IsWaitOn)) {

Could you re-break this line to keep either side of || together and
aligned horizontally?

> +  return EFI_SUCCESS;
> +}
> +
> +MicroSecondDelay (10);
> +TimeUsec += 10;
> +  } while (TimeUsec < TimeOutUsec);
> +
> +  return EFI_TIMEOUT;
> +}
> +
> +/**
> +  Turn on the 480Mhz PLL
> +**/
> +EFI_STATUS
> +ImxUsbPhyEnablePll (
> +  IN  IMX_USBPHY_ID   ImxUsbPhyId
> +  )
> +{
> +  volatile IMX_CCM_ANALOG_REGISTERS *CcmAnaRegsPtr;
> +  volatile IMX_CCM_ANALOG_PLL_USB1_REG  *PllUsbClrRegPtr;
> +  volatile IMX_CCM_ANALOG_PLL_USB1_REG  *PllUsbSetRegPtr;

I am very confused by these. Three volatile pointers are created and
never used to access anything directly.
You can drop the volatile on all three, and the latter two would make
more sense as UINTN.

> +  IMX_CCM_ANALOG_PLL_USB1_REG   PllUsbClrReg;
> +  IMX_CCM_ANALOG_PLL_USB1_REG   PllUsbSetReg;
> +  EFI_STATUSStatus;
> +
> +  CcmAnaRegsPtr = (IMX_CCM_ANALOG_REGISTERS *)IMX_CCM_ANALOG_BASE;
> +
> +  switch (ImxUsbPhyId) {
> +  case IMX_USBPHY0:
> +PllUsbClrRegPtr = (IMX_CCM_ANALOG_PLL_USB1_REG 
> *)>PLL_USB1_CLR;
> +PllUsbSetRegPtr = (IMX_CCM_ANALOG_PLL_USB1_REG 
> *)>PLL_USB1_SET;
> +break;
> +  case IMX_USBPHY1:
> +PllUsbClrRegPtr = (IMX_CCM_ANALOG_PLL_USB1_REG 
> *)>PLL_USB2_CLR;
> +PllUsbSetRegPtr = (IMX_CCM_ANALOG_PLL_USB1_REG 
> *)>PLL_USB2_SET;
> +break;
> +  default:
> +return EFI_INVALID_PARAMETER;
> +  }
> +
> +  PllUsbClrReg.AsUint32 = 0;
> +  PllUsbClrReg.BYPASS = 1;
> +  MmioWrite32 ((UINTN)PllUsbClrRegPtr, PllUsbClrReg.AsUint32);
> +
> +  

Re: [edk2] Line endings: Was "Re: [edk2-test][Patch] uefi-sct/SctPkg:Correct macro name style in HwErrRecVariable Test"

2018-12-14 Thread Supreeth Venkatesh
On Fri, 2018-12-14 at 14:24 +0100, Laszlo Ersek wrote:
> On 12/14/18 11:59, Leif Lindholm wrote:
> > Hmm, this gets me thinking...
> > 
> > We were discussing before about doing a line ending conversion in
> > edk2, and let the git gools provide native line endings (as
> > designed).
> > 
> > Is this a good opportunity to run a pilot with edk2-test, where
> > much
> > less history will be lost?
> 
> Well, history won't be lost, in the sense that people running "git
> blame" will need one more execution of "git blame" (to "look past"
> the
> whitespace change commit), but yes, it will result in a minor
> inconvenience.
> 
> And, I think, converting the edk2-test repo would not be a bad test
> at all.
> 
Thanks Leif/Laszlo. I volunteer to try the tool. However, I admit that
I have not tried this before, any pointers/instructions on how to do
this?

> Thanks,
> Laszlo

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


Re: [edk2] [PATCH edk2-platforms 18/27] Silicon/NXP: Add i.MX6 Clock Library

2018-12-14 Thread Leif Lindholm
On Fri, Sep 21, 2018 at 08:26:11AM +, Chris Co wrote:
> This adds support for managing clocks on NXP i.MX6 SoC. It will
> manipulate the Clock Gating registers (CCGR).
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Christopher Co 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> ---
>  Silicon/NXP/iMX6Pkg/Library/iMX6ClkPwrLib/iMX6ClkPwr.c | 1876 
> 
>  Silicon/NXP/iMX6Pkg/Library/iMX6ClkPwrLib/iMX6ClkPwrLib.inf|   46 +
>  Silicon/NXP/iMX6Pkg/Library/iMX6ClkPwrLib/iMX6ClkPwr_private.h |  221 +++
>  3 files changed, 2143 insertions(+)
> 
> diff --git a/Silicon/NXP/iMX6Pkg/Library/iMX6ClkPwrLib/iMX6ClkPwr.c 
> b/Silicon/NXP/iMX6Pkg/Library/iMX6ClkPwrLib/iMX6ClkPwr.c
> new file mode 100644
> index ..07958b1e392d
> --- /dev/null
> +++ b/Silicon/NXP/iMX6Pkg/Library/iMX6ClkPwrLib/iMX6ClkPwr.c
> @@ -0,0 +1,1876 @@
> +/** @file
> +*
> +*  Copyright (c) 2018 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 "iMX6ClkPwr_private.h"
> +
> +static IMX_CLOCK_TREE_CACHE mImxpClockPwrCache;   // Cached clock value

STATIC

> +
> +STATIC CONST IMX_CCGR_INDEX ImxpCcgrIndexMap[] = {

Add m-prefix.

> +  {0, 0},  // MX6_AIPS_TZ1_CLK_ENABLE
> +  {0, 1},  // MX6_AIPS_TZ2_CLK_ENABLE
> +  {0, 2},  // MX6_APBHDMA_HCLK_ENABLE
> +  {0, 3},  // MX6_ASRC_CLK_ENABLE
> +  {0, 4},  // MX6_CAAM_SECURE_MEM_CLK_ENABLE
> +  {0, 5},  // MX6_CAAM_WRAPPER_ACLK_ENABLE
> +  {0, 6},  // MX6_CAAM_WRAPPER_IPG_ENABLE
> +  {0, 7},  // MX6_CAN1_CLK_ENABLE
> +  {0, 8},  // MX6_CAN1_SERIAL_CLK_ENABLE
> +  {0, 9},  // MX6_CAN2_CLK_ENABLE
> +  {0, 10}, // MX6_CAN2_SERIAL_CLK_ENABLE
> +  {0, 11}, // MX6_ARM_DBG_CLK_ENABLE
> +  {0, 12}, // MX6_DCIC1_CLK_ENABLE
> +  {0, 13}, // MX6_DCIC2_CLK_ENABLE
> +  {0, 14}, // MX6_DTCP_CLK_ENABLE
> +  {1, 0},  // MX6_ECSPI1_CLK_ENABLE
> +  {1, 1},  // MX6_ECSPI2_CLK_ENABLE
> +  {1, 2},  // MX6_ECSPI3_CLK_ENABLE
> +  {1, 3},  // MX6_ECSPI4_CLK_ENABLE
> +  {1, 4},  // MX6_ECSPI5_CLK_ENABLE
> +  {1, 5},  // MX6_ENET_CLK_ENABLE
> +  {1, 6},  // MX6_EPIT1_CLK_ENABLE
> +  {1, 7},  // MX6_EPIT2_CLK_ENABLE
> +  {1, 8},  // MX6_ESAI_CLK_ENABLE
> +  {1, 10}, // MX6_GPT_CLK_ENABLE
> +  {1, 11}, // MX6_GPT_SERIAL_CLK_ENABLE
> +  {1, 12}, // MX6_GPU2D_CLK_ENABLE
> +  {1, 13}, // MX6_GPU3D_CLK_ENABLE
> +  {2, 0},  // MX6_HDMI_TX_ENABLE
> +  {2, 2},  // MX6_HDMI_TX_ISFRCLK_ENABLE
> +  {2, 3},  // MX6_I2C1_SERIAL_CLK_ENABLE
> +  {2, 4},  // MX6_I2C2_SERIAL_CLK_ENABLE
> +  {2, 5},  // MX6_I2C3_SERIAL_CLK_ENABLE
> +  {2, 6},  // MX6_IIM_CLK_ENABLE
> +  {2, 7},  // MX6_IOMUX_IPT_CLK_IO_ENABLE
> +  {2, 8},  // MX6_IPMUX1_CLK_ENABLE
> +  {2, 9},  // MX6_IPMUX2_CLK_ENABLE
> +  {2, 10}, // MX6_IPMUX3_CLK_ENABLE
> +  {2, 11}, // MX6_IPSYNC_IP2APB_TZASC1_IPG_MASTER_CLK_ENABLE
> +  {2, 12}, // MX6_IPSYNC_IP2APB_TZASC2_IPG_MASTER_CLK_ENABLE
> +  {2, 13}, // MX6_IPSYNC_VDOA_IPG_MASTER_CLK_ENABLE
> +  {3, 0},  // MX6_IPU1_IPU_CLK_ENABLE
> +  {3, 1},  // MX6_IPU1_IPU_DI0_CLK_ENABLE
> +  {3, 2},  // MX6_IPU1_IPU_DI1_CLK_ENABLE
> +  {3, 3},  // MX6_IPU2_IPU_CLK_ENABLE
> +  {3, 4},  // MX6_IPU2_IPU_DI0_CLK_ENABLE
> +  {3, 5},  // MX6_IPU2_IPU_DI1_CLK_ENABLE
> +  {3, 6},  // MX6_LDB_DI0_CLK_ENABLE
> +  {3, 7},  // MX6_LDB_DI1_CLK_ENABLE
> +  {3, 8},  // MX6_MIPI_CORE_CFG_CLK_ENABLE
> +  {3, 9},  // MX6_MLB_CLK_ENABLE
> +  {3, 10}, // MX6_MMDC_CORE_ACLK_FAST_CORE_P0_ENABLE
> +  {3, 12}, // MX6_MMDC_CORE_IPG_CLK_P0_ENABLE
> +  {3, 14}, // MX6_OCRAM_CLK_ENABLE
> +  {3, 15}, // MX6_OPENVGAXICLK_CLK_ROOT_ENABLE
> +  {4, 0},  // MX6_PCIE_ROOT_ENABLE
> +  {4, 4},  // MX6_PL301_MX6QFAST1_S133CLK_ENABLE
> +  {4, 6},  // MX6_PL301_MX6QPER1_BCHCLK_ENABLE
> +  {4, 7},  // MX6_PL301_MX6QPER2_MAINCLK_ENABLE
> +  {4, 8},  // MX6_PWM1_CLK_ENABLE
> +  {4, 9},  // MX6_PWM2_CLK_ENABLE
> +  {4, 10}, // MX6_PWM3_CLK_ENABLE
> +  {4, 11}, // MX6_PWM4_CLK_ENABLE
> +  {4, 12}, // MX6_RAWNAND_U_BCH_INPUT_APB_CLK_ENABLE
> +  {4, 13}, // MX6_RAWNAND_U_GPMI_BCH_INPUT_BCH_CLK_ENABLE
> +  {4, 14}, // MX6_RAWNAND_U_GPMI_BCH_INPUT_GPMI_IO_CLK_ENABLE
> +  {4, 15}, // MX6_RAWNAND_U_GPMI_INPUT_APB_CLK_ENABLE
> +  {5, 0},  // MX6_ROM_CLK_ENABLE
> +  {5, 2},  // MX6_SATA_CLK_ENABLE
> +  {5, 3},  // MX6_SDMA_CLK_ENABLE
> +  {5, 6},  // MX6_SPBA_CLK_ENABLE
> +  {5, 7},  // MX6_SPDIF_CLK_ENABLE
> +  {5, 9},  // MX6_SSI1_CLK_ENABLE
> +  {5, 10}, // MX6_SSI2_CLK_ENABLE
> +  {5, 11}, // MX6_SSI3_CLK_ENABLE
> +  {5, 12}, // 

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

2018-12-14 Thread Leif Lindholm
On Fri, Dec 14, 2018 at 05:08:05PM +, Pete Batard wrote:
> Hi Philippe, Hi Leif,
> 
> On 2018.12.14 16:36, Leif Lindholm wrote:
> > On Fri, Dec 14, 2018 at 05:14:05PM +0100, Philippe Mathieu-Daudé wrote:
> > > > > I can certainly upload binary releases for the required ATF files in 
> > > > > my
> > > > > github clone of ATF, and then add links to that in the readme with the
> > > > > instructions on how to rebuild ATF.
> > > > > 
> > > > > However, I'd rather wait to do that until there has been an official 
> > > > > tagged
> > > > > new release for ATF (which would be 2.1 at this stage, since our 
> > > > > changes
> > > > > have been applied after 2.0), as it'll look better for Pi users to 
> > > > > see an
> > > > > initial ATF serial output that says "BL<#>: v2.1(release)" instead of 
> > > > > the
> > > > > current "BL<#>: v2.0(release):v2.0-278-gc3859557"
> > > > > 
> > > > > How about this then: If ATF produces a formal release before this 
> > > > > proposal
> > > > > is integrated, I'll amend it to remove the ATF binary blobs and apply 
> > > > > the
> > > > > suggestion above, with the Atf/ build/link data moved out of non-osi. 
> > > > > But if
> > > > > they don't, I'll keep the proposal for ATF as is, and then submit a 
> > > > > patch to
> > > > > remove the non-osi data and apply the above at a later date, once 
> > > > > there has
> > > > > been a new ATF release.
> > > > 
> > > > Yeah, this certainly works for me.
> > > 
> > > I setup this Dockerfile [1] to have reproducible builds and avoid to
> > > store those binaries in the non-osi repository, what do you think about
> > > this approach?
> > 
> > Get off my lawn? :)
> > 
> > > [1] available here:
> > > https://gitlab.com/philmd/edk2-platforms/blob/raspi3-atf/Platform/RaspberryPi/RPi3/Arm-Tf/Dockerfile
> > 
> > I think it's a good thing to have, especially for something like the
> > Pi. I guess if that exists, we can trust people who prefer not to use
> > containers to be happy to follow the Readme, or grab binaries from
> > Pete's github?
> 
> That's one way to do it. As I indicated, as soon as ATF creates a 2.1 tagged
> release, I will look into removing the binary blobs from non-osi.
> 
> However I am not planning to do that sooner. As a matter of fact, given that
> this is not a blocking issue and given the scope of what still needs to be
> addressed for RPi3 integration, I am kind of hoping we won't see an ATF
> release for another month or two, so that we can get through the current
> integration process, with the current binary blobs in non-osi, and then sort
> out their removal post integration.
> 
> Personally, I also expect that anybody who wants to build the binaries
> locally, can simply be directed to follow the official ATF build notes on
> how to set up their tool chain, and then refer to the build parameters from
> our readme. But then again, if we have a nice Docker solution to provide, I
> don't see why we shouldn't also point to it.
> 
> On the other hand, when it comes to providing trustworthy links, and since
> there exists a MinGW32 version of the Linaro GCC compilers, I'd much rather
> use AppVeyor for automated build of ATF binaries. The nice thing is that
> AppVeyor can keep and serve its build artefacts, so we'd be able to directly
> link to those, which should give some level of trust that the binaries
> haven't been tampered with by the owner of the repo (or at least that, if
> they have, the source would reflect it). And you can also easily configure
> AppVeyor to only build on tagged commits, which I think is what we want.
> 
> At any rate, I think there exists more than one solution to address the ATF
> binary provision problem for RPi3, while also not having to ask users to
> blindly trust any binaries we might link to. Maybe Docker or AppVeyor are
> what we want to use. Maybe there is yet another option on the table that we
> haven't talked about yet.
> 
> If we believe this is necessary, I can look into adding AppVeyor builds of
> the official ATF ASAP. But for the time being, I would prefer if we start
> discussing this in earnest once ATF 2.1 has been tagged for release, and I
> send a formal proposal to address the removal of the non-osi ATF binaries.

Sure, that works for me.

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


[edk2] [PATCH v2 edk2-platforms 2/8] Platform/ARM/SgiPkg: Add support for virtio net device

2018-12-14 Thread Vijayenthiran Subramaniam
From: Daniil Egranov 

Add support for virtio net device by adding PCDs to specify the data
required to setup the virtio net device and register it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov 
---
 Platform/ARM/SgiPkg/SgiPlatform.dec|  6 +++
 Platform/ARM/SgiPkg/SgiPlatform.dsc| 18 +--
 Platform/ARM/SgiPkg/SgiPlatform.fdf|  4 ++
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf|  3 ++
 Platform/ARM/SgiPkg/Include/Guid/SgiVirtioDevicesFormSet.h |  3 ++
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c| 54 

 6 files changed, 84 insertions(+), 4 deletions(-)

diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec 
b/Platform/ARM/SgiPkg/SgiPlatform.dec
index 9300337a8d68..10157c7b6eb3 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dec
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -38,6 +38,7 @@ [Guids.common]
 
 [PcdsFeatureFlag.common]
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|FALSE|BOOLEAN|0x0001
+  gArmSgiTokenSpaceGuid.PcdVirtioNetSupported|FALSE|BOOLEAN|0x0010
 
 [PcdsFixedAtBuild]
   gArmSgiTokenSpaceGuid.PcdDramBlock2Base|0|UINT64|0x0002
@@ -48,5 +49,10 @@ [PcdsFixedAtBuild]
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSize|0x|UINT32|0x0005
   gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt|0x|UINT32|0x0006
 
+  # Virtio Network device
+  gArmSgiTokenSpaceGuid.PcdVirtioNetBaseAddress|0x|UINT32|0x0007
+  gArmSgiTokenSpaceGuid.PcdVirtioNetSize|0x|UINT32|0x0008
+  gArmSgiTokenSpaceGuid.PcdVirtioNetInterrupt|0x|UINT32|0x0009
+
 [Ppis]
   gNtFwConfigDtInfoPpiGuid = { 0x6f606eb3, 0x9123, 0x4e15, { 0xa8, 0x9b, 
0x0f, 0xac, 0x66, 0xef, 0xd0, 0x17 } }
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
b/Platform/ARM/SgiPkg/SgiPlatform.dsc
index ffebddc19eff..7995c7d132d6 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -47,6 +47,7 @@ [LibraryClasses.common]
   VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
   
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
+  
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
 
 [LibraryClasses.common.SEC]
   HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
@@ -101,6 +102,7 @@ [LibraryClasses.common.UEFI_DRIVER, 
LibraryClasses.common.UEFI_APPLICATION, Libr
 
 [PcdsFeatureFlag.common]
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|TRUE
+  gArmSgiTokenSpaceGuid.PcdVirtioNetSupported|TRUE
 
 [PcdsFixedAtBuild.common]
   gArmTokenSpaceGuid.PcdVFPEnabled|1
@@ -182,14 +184,19 @@ [PcdsFixedAtBuild.common]
   gArmPlatformTokenSpaceGuid.PcdCoreCount|4
   gArmPlatformTokenSpaceGuid.PcdClusterCount|2
 
-  # Ethernet
-  gEmbeddedTokenSpaceGuid.PcdLan91xDxeBaseAddress|0x1800
-
   # Virtio Disk
   gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress|0x1c13
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSize|0x1
   gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt|202
 
+  # Ethernet / Virtio Network
+!ifdef EDK2_ENABLE_SMSC_91X
+  gEmbeddedTokenSpaceGuid.PcdLan91xDxeBaseAddress|0x1800
+!endif
+  gArmSgiTokenSpaceGuid.PcdVirtioNetBaseAddress|0x1c15
+  gArmSgiTokenSpaceGuid.PcdVirtioNetSize|0x1
+  gArmSgiTokenSpaceGuid.PcdVirtioNetInterrupt|204
+
 

 #
 # Components Section - list of all EDK II Modules needed by this Platform
@@ -294,8 +301,11 @@ [Components.common]
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   }
 
-  # SMSC LAN 91C111
+  # SMSC LAN 91C111 / Virtio Network
+!ifdef EDK2_ENABLE_SMSC_91X
   EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
+!endif
+  OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
   #
   # Required by PCI
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf 
b/Platform/ARM/SgiPkg/SgiPlatform.fdf
index 9c0ec1fa43a6..80c3412fd4ad 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
+++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
@@ -197,7 +197,11 @@ [FV.FvMain]
   INF NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
   INF NetworkPkg/TcpDxe/TcpDxe.inf
   INF NetworkPkg/IScsiDxe/IScsiDxe.inf
+
+!ifdef EDK2_ENABLE_SMSC_91X
   INF EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
+!endif
+  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
 [FV.FVMAIN_COMPACT]
 FvAlignment= 16
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
index f920f6ecafb8..3283ff045372 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -42,10 +42,13 @@ [Guids]
 
 [FeaturePcd]
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported
+  gArmSgiTokenSpaceGuid.PcdVirtioNetSupported
 
 [FixedPcd]
   gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
   

[edk2] [PATCH v2 edk2-platforms 3/8] Sgi575: AcpiTables: Use PCDs for virtio disk

2018-12-14 Thread Vijayenthiran Subramaniam
From: Daniil Egranov 

Use PCDs instead of hardcoded values for virtio disk in DSDT.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov 
---
 Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf |  4 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl  | 10 --
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
index 59ccb79b6475..e236b940a802 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
@@ -55,4 +55,8 @@ [FixedPcd]
   gArmTokenSpaceGuid.PcdPciBusMin
   gArmTokenSpaceGuid.PcdPciBusMax
 
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
+
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
index 509cd7cd4262..833f5b44b6a8 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
@@ -104,8 +104,14 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", 
"ARMSGI", EFI_ACPI_ARM_OEM
 Name (_CCA, 1)// mark the device coherent
 
 Name (_CRS, ResourceTemplate() {
-  Memory32Fixed (ReadWrite, 0x1c13, 0x1)
-  Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 202 }
+  Memory32Fixed (
+ReadWrite,
+FixedPcdGet32 (PcdVirtioBlkBaseAddress),
+FixedPcdGet32 (PcdVirtioBlkSize)
+  )
+  Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
+FixedPcdGet32 (PcdVirtioBlkInterrupt)
+  }
 })
   }
 }
-- 
2.7.4

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


[edk2] [PATCH v2 edk2-platforms 4/8] Sgi575: AcpiTables: Add entry for virtio network device

2018-12-14 Thread Vijayenthiran Subramaniam
From: Daniil Egranov 

SGI575 include an instance of the virtio network device. So add
a representation for it in the ACPI tables.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov 
---
 Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf |  3 +++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl  | 18 ++
 2 files changed, 21 insertions(+)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
index e236b940a802..c666ea9d51c7 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
@@ -58,5 +58,8 @@ [FixedPcd]
   gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
   gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
+  gArmSgiTokenSpaceGuid.PcdVirtioNetBaseAddress
+  gArmSgiTokenSpaceGuid.PcdVirtioNetSize
+  gArmSgiTokenSpaceGuid.PcdVirtioNetInterrupt
 
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
index 833f5b44b6a8..36bc8c3809a0 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
@@ -114,4 +114,22 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", 
"ARMSGI", EFI_ACPI_ARM_OEM
   }
 })
   }
+
+  // VIRTIO NET
+  Device (VR01) {
+Name (_HID, "LNRO0005")
+Name (_UID, 1)
+Name (_CCA, 1)// mark the device coherent
+
+Name (_CRS, ResourceTemplate() {
+  Memory32Fixed (
+ReadWrite,
+FixedPcdGet32 (PcdVirtioNetBaseAddress),
+FixedPcdGet32 (PcdVirtioNetSize)
+  )
+  Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
+FixedPcdGet32 (PcdVirtioNetInterrupt)
+  }
+})
+  }
 }
-- 
2.7.4

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


[edk2] [PATCH v2 edk2-platforms 5/8] SgiClark.Ares: AcpiTables: Use PCDs for virtio disk

2018-12-14 Thread Vijayenthiran Subramaniam
Use PCDs instead of hardcoded values for virtio disk in DSDT.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vijayenthiran Subramaniam 
---
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf |  4 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl  | 12 +---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
index dcfe4929bb5a..10a805e07fd1 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
@@ -55,4 +55,8 @@ [FixedPcd]
   gArmTokenSpaceGuid.PcdPciBusMin
   gArmTokenSpaceGuid.PcdPciBusMax
 
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkBaseAddress
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkSize
+  gArmSgiTokenSpaceGuid.PcdVirtioBlkInterrupt
+
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
index c94a7c69e33a..af4dc424a77c 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
@@ -107,9 +107,15 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", 
"ARMSGI",
   Name (_UID, 0)
   Name (_CCA, 1)// mark the device coherent
 
-  Name (_CRS, ResourceTemplate () {
-Memory32Fixed (ReadWrite, 0x1c13, 0x1)
-Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 202 }
+  Name (_CRS, ResourceTemplate() {
+Memory32Fixed (
+  ReadWrite,
+  FixedPcdGet32 (PcdVirtioBlkBaseAddress),
+  FixedPcdGet32 (PcdVirtioBlkSize)
+)
+Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {
+  FixedPcdGet32 (PcdVirtioBlkInterrupt)
+}
   })
 }
   } // Scope(_SB)
-- 
2.7.4

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