Re: [edk2] [PATCH] MdePkg/BaseLib: Add GenerateGuid() to BaseLib

2018-05-22 Thread Ni, Ruiyu
Sorry, I forgot to include Long Qin.

Thanks/Ray

> -Original Message-
> From: edk2-devel  On Behalf Of Ruiyu Ni
> Sent: Wednesday, May 23, 2018 1:34 PM
> To: edk2-devel@lists.01.org
> Cc: Kinney, Michael D ; Gao, Liming
> 
> Subject: [edk2] [PATCH] MdePkg/BaseLib: Add GenerateGuid() to BaseLib
> 
> Per RFC4122, there are five versions of UUID (GUID).
> The version 4 only depends on truly random or pseudo-random number
> generation.
> So GenerateGuid () can be added to BaseLib. It uses the
> GetRandomNumber128() services exposed from MdePkg/RngLib.
> This API can be used by some EFI utilities which needs the guidgen services,
> e.g.: utility that partitions the disk in GPT format needs to fill the 
> generated
> GUID in partition table.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Liming Gao 
> Cc: Michael D Kinney 
> Cc: Qin Long 
> ---
>  MdePkg/Include/Library/BaseLib.h  | 18 -
>  MdePkg/Library/BaseLib/BaseLibInternals.h |  3 +-
>  MdePkg/Library/BaseLib/GenerateGuid.c | 64
> +++
>  3 files changed, 83 insertions(+), 2 deletions(-)  create mode 100644
> MdePkg/Library/BaseLib/GenerateGuid.c
> 
> diff --git a/MdePkg/Include/Library/BaseLib.h
> b/MdePkg/Include/Library/BaseLib.h
> index eb2899f852..272596d64c 100644
> --- a/MdePkg/Include/Library/BaseLib.h
> +++ b/MdePkg/Include/Library/BaseLib.h
> @@ -2,7 +2,7 @@
>Provides string functions, linked list functions, math functions,
> synchronization
>functions, file path functions, and CPU architecture-specific functions.
> 
> -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
>  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.  This
> program and the accompanying materials  are licensed and made available
> under the terms and conditions of the BSD License @@ -5104,6 +5104,22 @@
> EFIAPI  CpuDeadLoop (
>VOID
>);
> +
> +/**
> +  Generate a raw 128-bit (16-byte) GUID.
> +
> +  If Guid is NULL, then ASSERT().
> +
> +  @param Guid   Receive the 128-bit (16-byte) GUID.
> +
> +  @retval TRUE  The GUID is generated successfully.
> +  @retval FALSE The GUID is not generated.
> +**/
> +BOOLEAN
> +EFIAPI
> +GenerateGuid (
> +  OUT GUID  *Guid
> +  );
> 
>  #if defined (MDE_CPU_IPF)
> 
> diff --git a/MdePkg/Library/BaseLib/BaseLibInternals.h
> b/MdePkg/Library/BaseLib/BaseLibInternals.h
> index 9dca97a0dc..427eb44eba 100644
> --- a/MdePkg/Library/BaseLib/BaseLibInternals.h
> +++ b/MdePkg/Library/BaseLib/BaseLibInternals.h
> @@ -1,7 +1,7 @@
>  /** @file
>Declaration of internal functions in BaseLib.
> 
> -  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
> +  Copyright (c) 2006 - 2018, Intel Corporation. All rights
> + reserved.
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of the BSD
> License
>which accompanies this distribution.  The full text of the license may be
> found at @@ -20,6 +20,7 @@  #include 
> #include   #include 
> +#include 
> 
>  //
>  // Math functions
> diff --git a/MdePkg/Library/BaseLib/GenerateGuid.c
> b/MdePkg/Library/BaseLib/GenerateGuid.c
> new file mode 100644
> index 00..b90f7c5a83
> --- /dev/null
> +++ b/MdePkg/Library/BaseLib/GenerateGuid.c
> @@ -0,0 +1,64 @@
> +/** @file
> +  Generate GUID implementation.
> +
> +  Copyright (c) 2018, Intel Corporation. All rights reserved.  This
> + program and the accompanying materials  are licensed and made
> + available under the terms and conditions of the BSD License  which
> + accompanies this distribution.  The full text of the license may be
> + found at  http://opensource.org/licenses/bsd-license.php.
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +
> +**/
> +
> +#include "BaseLibInternals.h"
> +
> +/**
> +  Generate a raw 128-bit (16-byte) GUID.
> +
> +  If Guid is NULL, then ASSERT().
> +
> +  @param Guid   Receive the generated 128-bit (16-byte) GUID.
> +
> +  @retval TRUE  The GUID is generated successfully.
> +  @retval FALSE The GUID is not generated.
> +**/
> +BOOLEAN
> +EFIAPI
> +GenerateGuid (
> +  OUT GUID  *Guid
> +  )
> +{
> +  ASSERT (Guid != NULL);
> +
> +  //
> +  // A GUID is encoded as a 128-bit object as follows:
> +  //   0   1   2   3
> +  //   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
> +  //   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> +  //   |  time_low |
> +  // 

[edk2] [PATCH edk2-platforms v6 9/9] Platform/ARM/Sgi: Add Ssdt, Iort and Mcfg tables

2018-05-22 Thread Thomas Abraham
SGI platforms support a AHCI controller which is attached to a PCIe
root complex and it can generate PCIe ITS-MSI transactions. So the
Ssdt, Iort and Mcfg ACPI tables to desribe this topology to the
linux kernel.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Abraham 
---
 .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf|   3 +
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc| 106 +
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc|  59 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl |  95 ++
 4 files changed, 263 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl

diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
index 3694de9..e9bdd8a 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
@@ -25,8 +25,11 @@
   Dsdt.asl
   Fadt.aslc
   Gtdt.aslc
+  Iort.aslc
   Madt.aslc
+  Mcfg.aslc
   Spcr.aslc
+  Ssdt.asl
 
 [Packages]
   ArmPkg/ArmPkg.dec
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
new file mode 100644
index 000..a8b6363
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
@@ -0,0 +1,106 @@
+/** @file
+*  I/O Remapping Table (Iort)
+*
+*  Copyright (c) 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.
+*
+**/
+
+#include 
+#include 
+#include 
+#include "SgiAcpiHeader.h"
+
+#pragma pack(1)
+
+typedef struct
+{
+  EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE   ItsNode;
+  UINT32   ItsIdentifiers;
+} ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE;
+
+typedef struct
+{
+  EFI_ACPI_6_0_IO_REMAPPING_RC_NODERcNode;
+  EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE   RcIdMap;
+} ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE;
+
+typedef struct
+{
+  EFI_ACPI_6_0_IO_REMAPPING_TABLE  Header;
+  ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE   ItsNode;
+  ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODERcNode;
+} ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE;
+
+#pragma pack ()
+
+ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE Iort =
+{
+  // EFI_ACPI_6_0_IO_REMAPPING_TABLE
+  {
+ ARM_ACPI_HEADER  // EFI_ACPI_DESCRIPTION_HEADER
+ (
+   EFI_ACPI_6_0_IO_REMAPPING_TABLE_SIGNATURE,
+   ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE,
+   EFI_ACPI_IO_REMAPPING_TABLE_REVISION
+ ),
+ 2,  // NumNodes
+ sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE),  // NodeOffset
+ 0,  // Reserved
+  },
+  // ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE
+  {
+// EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE
+{
+  // EFI_ACPI_6_0_IO_REMAPPING_NODE
+  {
+EFI_ACPI_IORT_TYPE_ITS_GROUP,  // Type
+sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE), // Length
+0,  // Revision
+0,  // Reserved
+0,  // NumIdMappings
+0,  // IdReference
+  },
+  1,// GIC ITS Identifiers
+},
+0,
+  },
+  // ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE
+  {
+// EFI_ACPI_6_0_IO_REMAPPING_RC_NODE
+{
+  // EFI_ACPI_6_0_IO_REMAPPING_NODE
+  {
+EFI_ACPI_IORT_TYPE_ROOT_COMPLEX,  // Type
+sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE),  // Length
+0,  // Revision
+0,  // Reserved
+1,  // NumIdMappings
+__builtin_offsetof (ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE, RcIdMap),  
// IdReference
+  },
+  1,  // CacheCoherent
+  0,  // AllocationHints
+  0,  // Reserved
+  0,  // MemoryAccessFlags
+  EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED,  // AtsAttribute
+  0x0, // PciSegmentNumber
+},
+// EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE
+{
+  0x,  // InputBase
+  0x,  // NumIds
+  0x,  // OutputBase
+  __builtin_offsetof (ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE, ItsNode),  // 
OutputReference
+  0,  // Flags
+}
+  }
+};
+
+VOID* CONST ReferenceAcpiTable = 
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc
new file mode 100644
index 000..4a487a3
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc
@@ -0,0 +1,59 @@
+/** @file
+*  Memory mapped configuration space base address description table (MCFG)
+*
+*  Copyright (c) 2018, ARM Ltd. All rights reserved.
+*
+*  

[edk2] [PATCH edk2-platforms v6 0/9] Platform/ARM/Sgi: Add Arm's SGI platform support

2018-05-22 Thread Thomas Abraham
Changes since v5:
- removed 'Change-Id' from all the patches in this series.

Changes since v4:
- addressed all the review comments from Ard and Alexei

Changes since v3:
- adds support for SMSC9118 ethernet controller
- adds support for PCIe and SATA controller to enable SATA disk access

Changes since v2:
- addressed all the comments from Ard.
- PrePeiCore is used instead of PrePi.

Changes since v1:
- minor update to commit messages

Arm CoreLink System Guidance for Infrastructure is a collection of
resources to provide a representative view of typical compute subsystems
that can be designed and implemented using specific generations of Arm IP.
These compute subsystems address the expected requirements of a specific
segment of the infrastructure market which includes servers, storage and
networking.

This patch series adds initial platform port support for Arm'S SGI-575
platform. This platform has 8x Cortex-A75 CPUs, supports DynamIQ
with L3 cache options, supports 2x DDR4-3200 (DMC-620) memory controller
and is SBSAv3 compliant. This series includes support for GIC, Serial,
smsc91x and virtio block device.

Daniil Egranov (4):
  Platform/ARM/Sgi: add initial platform dxe driver implementation
  Platform/ARM/Sgi: add support for virtio block device
  Platform/ARM/Sgi: add the initial set of acpi tables
  Platform/ARM/Sgi: add support for smsc91x ethernet controller

Thomas Abraham (3):
  Platform/ARM/Sgi: Add Platform library implementation
  Platform/ARM/Sgi: implement PciHostBridgeLib support
  Platform/ARM/Sgi: Add Ssdt, Iort and Mcfg tables

Vishwanatha HG (2):
  Platform/ARM/Sgi: add NOR flash platform library implementation
  Platform/ARM/Sgi: add initial support for ARM SGI platform

 .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf|  58 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc|  90 ++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl |  99 ++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc|  87 ++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc| 151 +
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc| 106 +++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc| 173 +++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc|  59 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc|  77 +
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl |  95 ++
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   |  47 +++
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |  43 +++
 .../ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c |  81 +
 Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h|  41 +++
 Platform/ARM/SgiPkg/Include/SgiPlatform.h  |  71 +
 .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c   |  63 
 .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf |  34 ++
 .../Library/PciHostBridgeLib/PciHostBridgeLib.c| 188 +++
 .../Library/PciHostBridgeLib/PciHostBridgeLib.inf  |  63 
 .../SgiPkg/Library/PlatformLib/AArch64/Helper.S|  65 
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.c   |  73 +
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf |  67 
 .../SgiPkg/Library/PlatformLib/PlatformLibMem.c| 119 +++
 Platform/ARM/SgiPkg/SgiPlatform.dec|  37 +++
 Platform/ARM/SgiPkg/SgiPlatform.dsc| 303 ++
 Platform/ARM/SgiPkg/SgiPlatform.fdf| 342 +
 26 files changed, 2632 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl
 create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
 create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
 create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c
 create mode 100644 Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h
 create mode 100644 Platform/ARM/SgiPkg/Include/SgiPlatform.h
 create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c
 create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf
 create mode 100644 
Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
 create mode 100644 
Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
 create mode 100644 Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
 create mode 100644 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
 create mode 100644 

[edk2] [PATCH edk2-platforms v6 7/9] Platform/ARM/Sgi: add support for smsc91x ethernet controller

2018-05-22 Thread Thomas Abraham
From: Daniil Egranov 

SGI platforms include a SMSC9118 ethernet controller. Enable support
for this controller.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov 
Signed-off-by: Thomas Abraham 
---
 Platform/ARM/SgiPkg/Include/SgiPlatform.h|  4 
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c |  8 +++-
 Platform/ARM/SgiPkg/SgiPlatform.dsc  |  6 ++
 Platform/ARM/SgiPkg/SgiPlatform.fdf  | 16 
 4 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index 441a467..00ca7e9 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -27,6 +27,10 @@
 #define SGI_EXP_SMC_CS1_BASE  0x0C00
 #define SGI_EXP_SMC_CS1_SZSIZE_64MB
 
+// Expansion AXI - SMSC 91C111 (Ethernet)
+#define SGI_EXP_SMSC91X_BASE  0x1800
+#define SGI_EXP_SMSC91X_SZSIZE_64MB
+
 // Expansion AXI - System peripherals
 #define SGI_EXP_SYS_PERIPH_BASE   0x1C00
 #define SGI_EXP_SYS_PERIPH_SZ SIZE_2MB
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c 
b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
index c8f8dbf..166f914 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
@@ -22,7 +22,7 @@
 #include 
 
 // Total number of descriptors, including the final "end-of-table" descriptor.
-#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS  8
+#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS  9
 
 /**
   Returns the Virtual Memory Map of the platform.
@@ -64,6 +64,12 @@ ArmPlatformGetVirtualMemoryMap (
   VirtualMemoryTable[Index].Length  = SIZE_64MB;
   VirtualMemoryTable[Index].Attributes  = 
ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
 
+  // Expansion AXI - SMSC 91X (Ethernet)
+  VirtualMemoryTable[++Index].PhysicalBase  = SGI_EXP_SMSC91X_BASE;
+  VirtualMemoryTable[Index].VirtualBase = SGI_EXP_SMSC91X_BASE;
+  VirtualMemoryTable[Index].Length  = SGI_EXP_SMSC91X_SZ;
+  VirtualMemoryTable[Index].Attributes  = 
ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+
   // Expansion AXI - System Peripherals
   VirtualMemoryTable[++Index].PhysicalBase  = SGI_EXP_SYS_PERIPH_BASE;
   VirtualMemoryTable[Index].VirtualBase = SGI_EXP_SYS_PERIPH_BASE;
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
b/Platform/ARM/SgiPkg/SgiPlatform.dsc
index 6316c6a..b20090b 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -150,6 +150,9 @@
   gArmPlatformTokenSpaceGuid.PcdCoreCount|4
   gArmPlatformTokenSpaceGuid.PcdClusterCount|2
 
+  # Ethernet
+  gEmbeddedTokenSpaceGuid.PcdLan91xDxeBaseAddress|0x1800
+
 

 #
 # Components Section - list of all EDK II Modules needed by this Platform
@@ -248,3 +251,6 @@
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   }
+
+  # SMSC LAN 91C111
+  EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf 
b/Platform/ARM/SgiPkg/SgiPlatform.fdf
index d4fae50..6f6e6aa 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
+++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
@@ -155,6 +155,22 @@ READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
   INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
 
+  #
+  # Networking stack
+  #
+  INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
+  INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
+  INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
+  INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
+  INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
+  INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
+  INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
+  INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
+  INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
+  INF MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
+  INF MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
+  INF EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
+
 [FV.FVMAIN_COMPACT]
 FvAlignment= 16
 BlockSize  = 0x1000
-- 
2.7.4

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


[edk2] [PATCH edk2-platforms v6 2/9] Platform/ARM/Sgi: add NOR flash platform library implementation

2018-05-22 Thread Thomas Abraham
From: Vishwanatha HG 

Add a initial NOR flash driver platform wrapper as part of the platform
library. Access to NOR flash devices connected to CS0 and CS1 is enabled
in this initial implementation.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vishwanatha HG 
Signed-off-by: Thomas Abraham 
---
 .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c   | 63 ++
 .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf | 34 
 2 files changed, 97 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c
 create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf

diff --git a/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c 
b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c
new file mode 100644
index 000..3ab296a
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c
@@ -0,0 +1,63 @@
+/** @file
+
+  Copyright (c) 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.
+
+ **/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {
+  {
+SGI_EXP_SMC_CS0_BASE,
+SGI_EXP_SMC_CS0_BASE,
+SIZE_256KB * 256,
+SIZE_256KB,
+{ 0xEBF0B9DF, 0x17d0, 0x4812, { 0xA9, 0x59, 0xCF, 0xD7, 0x92, 0xEE, 0x31, 
0x13 } }
+  },
+  {
+SGI_EXP_SMC_CS1_BASE,
+SGI_EXP_SMC_CS1_BASE,
+SIZE_256KB * 256,
+SIZE_256KB,
+{ 0x1F15DA3C, 0x37FF, 0x4070, { 0xB4, 0x71, 0xBB, 0x4A, 0xF1, 0x2A, 0x72, 
0x4A } }
+  },
+};
+
+EFI_STATUS
+NorFlashPlatformInitialization (
+  VOID
+  )
+{
+  UINT64 SysRegFlash;
+
+  SysRegFlash = SGI_EXP_SYSPH_SYSTEM_REGISTERS + SGI_SYSPH_SYS_REG_FLASH;
+  MmioOr32 (SysRegFlash, SGI_SYSPH_SYS_REG_FLASH_RWEN);
+  return EFI_SUCCESS;
+}
+
+EFI_STATUS
+NorFlashPlatformGetDevices (
+  OUT NOR_FLASH_DESCRIPTION   **NorFlashDevices,
+  OUT UINT32  *Count
+  )
+{
+  if ((NorFlashDevices == NULL) || (Count == NULL)) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  *NorFlashDevices = mNorFlashDevices;
+  *Count = ARRAY_SIZE (mNorFlashDevices);
+  return EFI_SUCCESS;
+}
diff --git a/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf 
b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf
new file mode 100644
index 000..3a6b33b
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf
@@ -0,0 +1,34 @@
+#/** @file
+#
+#  Copyright (c) 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.
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = NorFlashSgiLib
+  FILE_GUID  = 3f021755-6d74-4065-9ee4-98225267b36e
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = NorFlashPlatformLib
+
+[Sources.common]
+  NorFlashLib.c
+
+[Packages]
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  MdePkg/MdePkg.dec
+  Platform/ARM/SgiPkg/SgiPlatform.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  IoLib
-- 
2.7.4

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


[edk2] [PATCH edk2-platforms v6 1/9] Platform/ARM/Sgi: Add Platform library implementation

2018-05-22 Thread Thomas Abraham
Add initial SGI platform library support. This includes the virtual
memory map and helper functions for platform intialization.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Abraham 
---
 Platform/ARM/SgiPkg/Include/SgiPlatform.h  |  67 +
 .../SgiPkg/Library/PlatformLib/AArch64/Helper.S|  65 +
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.c   |  73 ++
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf |  55 +++
 .../SgiPkg/Library/PlatformLib/PlatformLibMem.c| 105 +
 5 files changed, 365 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/Include/SgiPlatform.h
 create mode 100644 Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
 create mode 100644 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
 create mode 100644 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
 create mode 100644 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c

diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
new file mode 100644
index 000..441a467
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -0,0 +1,67 @@
+/** @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_PLATFORM_H__
+#define __SGI_PLATFORM_H__
+
+/***
+// Platform Memory Map
+/
+
+// Expansion AXI - SMC Chip Select 0
+#define SGI_EXP_SMC_CS0_BASE  0x0800
+#define SGI_EXP_SMC_CS0_SZSIZE_64MB
+
+// Expansion AXI - SMC Chip Select 1
+#define SGI_EXP_SMC_CS1_BASE  0x0C00
+#define SGI_EXP_SMC_CS1_SZSIZE_64MB
+
+// Expansion AXI - System peripherals
+#define SGI_EXP_SYS_PERIPH_BASE   0x1C00
+#define SGI_EXP_SYS_PERIPH_SZ SIZE_2MB
+
+// Base address of system peripherals
+#define SGI_EXP_SYSPH_SYSTEM_REGISTERS0x1C01
+#define SGI_EXP_SYSPH_VIRTIO_BLOCK_BASE   0x1C13
+
+// Sub System Peripherals - UART0
+#define SGI_SUBSYS_UART0_BASE 0x2A40
+#define SGI_SUBSYS_UART0_SZ   0x0001
+
+// Sub System Peripherals - UART1
+#define SGI_SUBSYS_UART1_BASE 0x2A41
+#define SGI_SUBSYS_UART1_SZ   0x0001
+
+// Sub System Peripherals - Generic Watchdog
+#define SGI_SUBSYS_GENERIC_WDOG_BASE  0x2A44
+#define SGI_SUBSYS_GENERIC_WDOG_SZSIZE_128KB
+
+// Sub System Peripherals - GIC
+#define SGI_SUBSYS_GENERIC_GIC_BASE   0x3000
+#define SGI_SUBSYS_GENERIC_GICR_BASE  0x300C
+#define SGI_SUBSYS_GENERIC_GIC_SZ SIZE_1MB
+
+// Expansion AXI - Platform Peripherals - UART0
+#define SGI_EXP_PLAT_PERIPH_UART0_BASE0x7FF7
+#define SGI_EXP_PLAT_PERIPH_UART0_SZ  SIZE_64KB
+
+// Expansion AXI - Platform Peripherals - UART1
+#define SGI_EXP_PLAT_PERIPH_UART1_BASE0x7FF8
+#define SGI_EXP_PLAT_PERIPH_UART1_SZ  SIZE_64KB
+
+// Register offsets into the System Registers Block
+#define SGI_SYSPH_SYS_REG_FLASH   0x4C
+#define SGI_SYSPH_SYS_REG_FLASH_RWEN  0x1
+
+#endif // __SGI_PLATFORM_H__
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S 
b/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
new file mode 100644
index 000..dab6c77
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
@@ -0,0 +1,65 @@
+/** @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.
+*
+**/
+
+#include 
+#include 
+
+.text
+.align 3
+
+GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
+GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
+GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
+GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
+
+//
+// First platform specific function to be called in the PEI phase

[edk2] [PATCH edk2-platforms v6 8/9] Platform/ARM/Sgi: implement PciHostBridgeLib support

2018-05-22 Thread Thomas Abraham
SGI platforms include a PCIe root complex to which a AHCI controller
is attached as an endpoint. So implement the PciHostBridgeLib glue
layer and enable support for PCIe and AHCI controllers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Abraham 
---
 .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf|   4 +
 .../Library/PciHostBridgeLib/PciHostBridgeLib.c| 188 +
 .../Library/PciHostBridgeLib/PciHostBridgeLib.inf  |  63 +++
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf |   8 +
 .../SgiPkg/Library/PlatformLib/PlatformLibMem.c|  10 +-
 Platform/ARM/SgiPkg/SgiPlatform.dsc|  47 ++
 Platform/ARM/SgiPkg/SgiPlatform.fdf|  20 +++
 7 files changed, 339 insertions(+), 1 deletion(-)
 create mode 100644 
Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
 create mode 100644 
Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf

diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
index ec47f94..3694de9 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
@@ -49,3 +49,7 @@
   gArmTokenSpaceGuid.PcdGicRedistributorsBase
   gArmTokenSpaceGuid.PcdGenericWatchdogControlBase
   gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase
+  gArmTokenSpaceGuid.PcdPciBusMin
+  gArmTokenSpaceGuid.PcdPciBusMax
+
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
b/Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
new file mode 100644
index 000..ddda194
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -0,0 +1,188 @@
+/** @file
+*  PCI Host Bridge Library instance for ARM SGI platforms
+*
+*  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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+GLOBAL_REMOVE_IF_UNREFERENCED
+STATIC CHAR16 CONST * CONST mPciHostBridgeLibAcpiAddressSpaceTypeStr[] = {
+  L"Mem", L"I/O", L"Bus"
+};
+
+#pragma pack(1)
+typedef struct {
+  ACPI_HID_DEVICE_PATH AcpiDevicePath;
+  EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
+} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
+#pragma pack ()
+
+STATIC EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath = {
+  {
+{
+  ACPI_DEVICE_PATH,
+  ACPI_DP,
+  {
+(UINT8) (sizeof (ACPI_HID_DEVICE_PATH)),
+(UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8)
+  }
+},
+EISA_PNP_ID (0x0A08), // PCIe
+0
+  }, {
+END_DEVICE_PATH_TYPE,
+END_ENTIRE_DEVICE_PATH_SUBTYPE,
+{
+  END_DEVICE_PATH_LENGTH,
+  0
+}
+  }
+};
+
+STATIC PCI_ROOT_BRIDGE mPciRootBridge[] = {
+  {
+0,  // Segment
+0,  // Supports
+0,  // Attributes
+TRUE,   // DmaAbove4G
+FALSE,  // NoExtendedConfigSpace
+FALSE,  // ResourceAssigned
+EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM |  // AllocationAttributes
+EFI_PCI_HOST_BRIDGE_MEM64_DECODE,
+{
+  // Bus
+  FixedPcdGet32 (PcdPciBusMin),
+  FixedPcdGet32 (PcdPciBusMax)
+}, {
+  // Io
+  FixedPcdGet64 (PcdPciIoBase),
+  FixedPcdGet64 (PcdPciIoBase) + FixedPcdGet64 (PcdPciIoSize) - 1
+}, {
+  // Mem
+  FixedPcdGet32 (PcdPciMmio32Base),
+  FixedPcdGet32 (PcdPciMmio32Base) + FixedPcdGet32 (PcdPciMmio32Size) - 1
+}, {
+  // MemAbove4G
+  FixedPcdGet64 (PcdPciMmio64Base),
+  FixedPcdGet64 (PcdPciMmio64Base) + FixedPcdGet64 (PcdPciMmio64Size) - 1
+}, {
+  // PMem
+  MAX_UINT64,
+  0
+}, {
+  // PMemAbove4G
+  MAX_UINT64,
+  0
+},
+(EFI_DEVICE_PATH_PROTOCOL *)
+  },
+};
+
+/**
+  Return all the root bridge instances in an array.
+
+  @param Count  Return the count of root bridge instances.
+
+  @return All the root bridge instances in an array.
+  The array should be passed into PciHostBridgeFreeRootBridges()
+  when it's not used.
+**/
+PCI_ROOT_BRIDGE *
+EFIAPI
+PciHostBridgeGetRootBridges (
+  UINTN *Count
+  )
+{
+  *Count = ARRAY_SIZE (mPciRootBridge);
+  return mPciRootBridge;
+}
+
+/**
+  Free the root bridge 

[edk2] [PATCH edk2-platforms v6 5/9] Platform/ARM/Sgi: add the initial set of acpi tables

2018-05-22 Thread Thomas Abraham
From: Daniil Egranov 

Add the initial set of Acpi tables for the SGI-575 platform. These tables
conform to the ACPI specification version 6.1. Some of the mandatory tables
required for SBBR v1.0 compilance are not included in this initial set
of Acpi tables.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov 
Signed-off-by: Thomas Abraham 
---
 .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf|  51 ++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc|  90 +++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl |  99 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc|  87 +++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc| 151 ++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc| 173 +
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc|  77 +
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   |   7 +
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |   6 +
 Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h|  41 +
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf |   4 +
 11 files changed, 786 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc
 create mode 100644 Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h

diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
new file mode 100644
index 000..ec47f94
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
@@ -0,0 +1,51 @@
+## @file
+#  ACPI table data and ASL sources required to boot the platform.
+#
+#  Copyright (c) 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.
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = Sgi575AcpiTables
+  FILE_GUID  = c712719a-0aaf-438c-9cdd-35ab4d60207d  # 
gSgi575AcpiTablesiFileGuid
+  MODULE_TYPE= USER_DEFINED
+  VERSION_STRING = 1.0
+
+[Sources]
+  Dbg2.aslc
+  Dsdt.asl
+  Fadt.aslc
+  Gtdt.aslc
+  Madt.aslc
+  Spcr.aslc
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdePkg/MdePkg.dec
+  Platform/ARM/SgiPkg/SgiPlatform.dec
+
+[FixedPcd]
+  gArmPlatformTokenSpaceGuid.PcdCoreCount
+  gArmPlatformTokenSpaceGuid.PcdClusterCount
+  gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase
+  gArmPlatformTokenSpaceGuid.PL011UartInterrupt
+
+  gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum
+  gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
+  gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
+  gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum
+  gArmTokenSpaceGuid.PcdGicDistributorBase
+  gArmTokenSpaceGuid.PcdGicRedistributorsBase
+  gArmTokenSpaceGuid.PcdGenericWatchdogControlBase
+  gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
new file mode 100644
index 000..ed671f3
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
@@ -0,0 +1,90 @@
+/** @file
+*  Debug Port Table 2 (DBG2)
+*
+*  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 "SgiAcpiHeader.h"
+#include 
+#include 
+#include 
+
+#define SGI_DBG2_NUM_DEBUG_PORTS   1
+#define SGI_DBG2_NUM_GAS   1
+#define SGI_DBG2_NS_STR_LENGTH 8
+#define SGI_PL011_REGISTER_SPACE   0x1000
+
+#define NAME_STR_UART1 {'C', 'O', 'M', '1', '\0', '\0', '\0', '\0'}
+
+#pragma pack(1)
+
+typedef struct {
+  EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT Dbg2Device;
+  

[edk2] [PATCH edk2-platforms v6 4/9] Platform/ARM/Sgi: add support for virtio block device

2018-05-22 Thread Thomas Abraham
From: Daniil Egranov 

Add the registration of the virtio block device.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov 
Signed-off-by: Thomas Abraham 
---
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   | 17 -
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |  6 ++
 .../ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c | 81 ++
 3 files changed, 103 insertions(+), 1 deletion(-)
 create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c

diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index eb26fde..ff30a42 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -15,11 +15,26 @@
 #include 
 
 EFI_STATUS
+InitVirtioBlockIo (
+  IN EFI_HANDLE ImageHandle
+);
+
+EFI_STATUS
 EFIAPI
 ArmSgiPkgEntryPoint (
   IN EFI_HANDLE ImageHandle,
   IN EFI_SYSTEM_TABLE   *SystemTable
   )
 {
-  return EFI_SUCCESS;
+  EFI_STATUS  Status;
+
+  if (FeaturePcdGet (PcdVirtioSupported)) {
+Status = InitVirtioBlockIo (ImageHandle);
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_ERROR, "%a: Failed to install Virtio Block device\n",
+__FUNCTION__));
+}
+  }
+
+  return Status;
 }
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
index ae9fda8..6aa286f 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -20,12 +20,18 @@
 
 [Sources.common]
   PlatformDxe.c
+  VirtioBlockIo.c
 
 [Packages]
   MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
   UefiDriverEntryPoint
+  VirtioMmioDeviceLib
+
+[FeaturePcd]
+  gArmSgiTokenSpaceGuid.PcdVirtioSupported
 
 [Depex]
   TRUE
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c
new file mode 100644
index 000..978c861
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c
@@ -0,0 +1,81 @@
+/** @file
+
+  Copyright (c) 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.
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#pragma pack (1)
+typedef struct {
+  VENDOR_DEVICE_PATH  Vendor;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
+} VIRTIO_BLK_DEVICE_PATH;
+#pragma pack ()
+
+STATIC VIRTIO_BLK_DEVICE_PATH mVirtioBlockDevicePath =
+{
+  {
+{
+  HARDWARE_DEVICE_PATH,
+  HW_VENDOR_DP,
+  {
+(UINT8)(sizeof (VENDOR_DEVICE_PATH)),
+(UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+  }
+},
+EFI_CALLER_ID_GUID,
+  },
+  {
+END_DEVICE_PATH_TYPE,
+END_ENTIRE_DEVICE_PATH_SUBTYPE,
+{
+  sizeof (EFI_DEVICE_PATH_PROTOCOL),
+  0
+}
+  }
+};
+
+/**
+ * Entrypoint for 'VirtioBlockIo' driver
+ */
+EFI_STATUS
+InitVirtioBlockIo (
+   IN EFI_HANDLE ImageHandle
+  )
+{
+  EFI_STATUS Status = 0;
+
+  Status = gBS->InstallProtocolInterface (,
+  , EFI_NATIVE_INTERFACE,
+  );
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "%a: Failed to install the EFI_DEVICE_PATH "
+  "protocol for the virtio block device (Status == %r)\n",
+  __FUNCTION__, Status));
+return Status;
+  }
+
+  Status = VirtioMmioInstallDevice (SGI_EXP_SYSPH_VIRTIO_BLOCK_BASE, 
ImageHandle);
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR,
+  "%a: Failed to install Virtio block device (Status == %r)\n",
+  __FUNCTION__, Status));
+gBS->UninstallProtocolInterface (ImageHandle,
+   , );
+  }
+
+  return Status;
+}
-- 
2.7.4

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


[edk2] [PATCH edk2-platforms v6 6/9] Platform/ARM/Sgi: add initial support for ARM SGI platform

2018-05-22 Thread Thomas Abraham
From: Vishwanatha HG 

Add the initial support for ARM's System Guidance for Infrastructure
(SGI) platforms. SGI-575 is the supported platform in this initial
implementation and can be extented to include support for upcoming
SGI platforms as well.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vishwanatha HG 
Signed-off-by: Thomas Abraham 
---
 Platform/ARM/SgiPkg/SgiPlatform.dec |  37 +
 Platform/ARM/SgiPkg/SgiPlatform.dsc | 250 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf | 306 
 3 files changed, 593 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/SgiPlatform.dec
 create mode 100644 Platform/ARM/SgiPkg/SgiPlatform.dsc
 create mode 100644 Platform/ARM/SgiPkg/SgiPlatform.fdf

diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec 
b/Platform/ARM/SgiPkg/SgiPlatform.dec
new file mode 100644
index 000..d995937
--- /dev/null
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -0,0 +1,37 @@
+#
+#  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]
+  DEC_SPECIFICATION  = 0x0001001A
+  PACKAGE_NAME   = SgiPkg
+  PACKAGE_GUID   = e6e0f26c-0df9-4f6c-a382-37ded896c6e9
+  PACKAGE_VERSION= 0.1
+
+
+#
+# Include Section - list of Include Paths that are provided by this package.
+#   Comments are used for Keywords and Module Types.
+#
+# Supported Module Types:
+#  BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
+#
+
+[Includes.common]
+  Include# Root include for the package
+
+[Guids.common]
+  gArmSgiTokenSpaceGuid  = { 0x577d6941, 0xaea1, 0x40b4, { 0x90, 0x93, 
0x2a, 0x86, 0x61, 0x72, 0x5a, 0x57 } }
+  gSgi575AcpiTablesiFileGuid = { 0xc712719a, 0x0aaf, 0x438c, { 0x9c, 0xdd, 
0x35, 0xab, 0x4d, 0x60, 0x20, 0x7d } }
+
+[PcdsFeatureFlag.common]
+  # Set this PCD to TRUE to enable virtio support.
+  gArmSgiTokenSpaceGuid.PcdVirtioSupported|TRUE|BOOLEAN|0x0001
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
b/Platform/ARM/SgiPkg/SgiPlatform.dsc
new file mode 100644
index 000..6316c6a
--- /dev/null
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -0,0 +1,250 @@
+#
+#  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 Section - statements that will be processed to create a Makefile.
+#
+
+[Defines]
+  PLATFORM_NAME  = ArmSgi
+  PLATFORM_GUID  = 3a6b2eae-0275-4b6e-a5d1-bd2ba1ce1fae
+  PLATFORM_VERSION   = 0.1
+  DSC_SPECIFICATION  = 0x0001001B
+  OUTPUT_DIRECTORY   = Build/$(PLATFORM_NAME)
+  SUPPORTED_ARCHITECTURES= AARCH64|ARM
+  BUILD_TARGETS  = NOOPT|DEBUG|RELEASE
+  SKUID_IDENTIFIER   = DEFAULT
+  FLASH_DEFINITION   = Platform/ARM/SgiPkg/SgiPlatform.fdf
+  BUILD_NUMBER   = 1
+
+!include Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
+
+[LibraryClasses.common]
+  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+  ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
+  
ArmPlatformSysConfigLib|Platform/ARM/VExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
+  ArmPlatformLib|Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
+  BasePathLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+  
EfiResetSystemLib|ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf
+  NorFlashPlatformLib|Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
+
+  # Virtio 

[edk2] [PATCH edk2-platforms v6 3/9] Platform/ARM/Sgi: add initial platform dxe driver implementation

2018-05-22 Thread Thomas Abraham
From: Daniil Egranov 

Add a initial platform dxe driver which starts of being almost
an empty implementation.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov 
Signed-off-by: Thomas Abraham 
---
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   | 25 +
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf | 31 ++
 2 files changed, 56 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
 create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf

diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
new file mode 100644
index 000..eb26fde
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -0,0 +1,25 @@
+/** @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.
+*
+**/
+
+#include 
+
+EFI_STATUS
+EFIAPI
+ArmSgiPkgEntryPoint (
+  IN EFI_HANDLE ImageHandle,
+  IN EFI_SYSTEM_TABLE   *SystemTable
+  )
+{
+  return EFI_SUCCESS;
+}
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
new file mode 100644
index 000..ae9fda8
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -0,0 +1,31 @@
+#
+#  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= 0x0001001A
+  BASE_NAME  = PlatformDxe
+  FILE_GUID  = 54cee352-c4cd-4d80-8524-54325c3a528e
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= ArmSgiPkgEntryPoint
+
+[Sources.common]
+  PlatformDxe.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  UefiDriverEntryPoint
+
+[Depex]
+  TRUE
-- 
2.7.4

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


Re: [edk2] reg: EDK2 - HTTP Boot Image Validation

2018-05-22 Thread Fu, Siyuan
Hi, Siva

What do you mean by "skip the validation of image types"? Do you want to skip 
the "Content-type" HTTP header check, or name extension check, or both of them?


BestRegards
Fu Siyuan

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Sivaraman Nainar
> Sent: Friday, May 18, 2018 5:17 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] reg: EDK2 - HTTP Boot Image Validation
> 
> Hello all,
> When HTTP Boot performed the code checking if the Image type as EFI ISO
> and IMG. If not the boot not when the content type is as
> "Content-type: text/plain".
> https://github.com/tianocore/edk2/blob/master/NetworkPkg/HttpBootDxe/HttpB
> ootSupport.c (HttpBootCheckImageType())
> 
> But as per RFC it described below.
> https://tools.ietf.org/html/rfc2616#section-7.2.1:
> "If and only if the media type is not given by a Content-Type field, the
> recipient MAY attempt to guess the media type via inspection of its
> content and/or the name extension(s) of the URI used to identify the
> resource."
> Can you please comment if this need to be addressed such a way we can skip
> the validation of image types.
> -Siva
> ___
> 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] [PATCH] MdePkg/BaseLib: Add GenerateGuid() to BaseLib

2018-05-22 Thread Ruiyu Ni
Per RFC4122, there are five versions of UUID (GUID).
The version 4 only depends on truly random or pseudo-random number
generation.
So GenerateGuid () can be added to BaseLib. It uses the
GetRandomNumber128() services exposed from MdePkg/RngLib.
This API can be used by some EFI utilities which needs the guidgen
services, e.g.: utility that partitions the disk in GPT format needs
to fill the generated GUID in partition table.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Liming Gao 
Cc: Michael D Kinney 
---
 MdePkg/Include/Library/BaseLib.h  | 18 -
 MdePkg/Library/BaseLib/BaseLibInternals.h |  3 +-
 MdePkg/Library/BaseLib/GenerateGuid.c | 64 +++
 3 files changed, 83 insertions(+), 2 deletions(-)
 create mode 100644 MdePkg/Library/BaseLib/GenerateGuid.c

diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index eb2899f852..272596d64c 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -2,7 +2,7 @@
   Provides string functions, linked list functions, math functions, 
synchronization
   functions, file path functions, and CPU architecture-specific functions.
 
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
@@ -5104,6 +5104,22 @@ EFIAPI
 CpuDeadLoop (
   VOID
   );
+
+/**
+  Generate a raw 128-bit (16-byte) GUID.
+
+  If Guid is NULL, then ASSERT().
+
+  @param Guid   Receive the 128-bit (16-byte) GUID.
+
+  @retval TRUE  The GUID is generated successfully.
+  @retval FALSE The GUID is not generated.
+**/
+BOOLEAN
+EFIAPI
+GenerateGuid (
+  OUT GUID  *Guid
+  );
  
 #if defined (MDE_CPU_IPF)
 
diff --git a/MdePkg/Library/BaseLib/BaseLibInternals.h 
b/MdePkg/Library/BaseLib/BaseLibInternals.h
index 9dca97a0dc..427eb44eba 100644
--- a/MdePkg/Library/BaseLib/BaseLibInternals.h
+++ b/MdePkg/Library/BaseLib/BaseLibInternals.h
@@ -1,7 +1,7 @@
 /** @file
   Declaration of internal functions in BaseLib.
 
-  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 //
 // Math functions
diff --git a/MdePkg/Library/BaseLib/GenerateGuid.c 
b/MdePkg/Library/BaseLib/GenerateGuid.c
new file mode 100644
index 00..b90f7c5a83
--- /dev/null
+++ b/MdePkg/Library/BaseLib/GenerateGuid.c
@@ -0,0 +1,64 @@
+/** @file
+  Generate GUID implementation.
+
+  Copyright (c) 2018, Intel Corporation. All rights reserved.
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "BaseLibInternals.h"
+
+/**
+  Generate a raw 128-bit (16-byte) GUID.
+
+  If Guid is NULL, then ASSERT().
+
+  @param Guid   Receive the generated 128-bit (16-byte) GUID.
+
+  @retval TRUE  The GUID is generated successfully.
+  @retval FALSE The GUID is not generated.
+**/
+BOOLEAN
+EFIAPI
+GenerateGuid (
+  OUT GUID  *Guid
+  )
+{
+  ASSERT (Guid != NULL);
+
+  //
+  // A GUID is encoded as a 128-bit object as follows:
+  //   0   1   2   3
+  //   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+  //   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+  //   |  time_low |
+  //   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+  //   |   time_mid| time_hi_and_version   |
+  //   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+  //   |clk_seq_hi_res |  clk_seq_low  | node (0-1)|
+  //   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+  //   | node (2-5)|
+  //   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+  // The below algorithm generates version 4 GUID from truly-random or 
pseudo-random numbers.
+  // The algorithm is as follows (per RFC 4122):
+  // > Set all 

Re: [edk2] [PATCH v3] MdePkg/IndustryStandard: Add header file for SPMI ACPI table

2018-05-22 Thread Yao, Jiewen
Reviewed-by: jiewen@intel.com

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Hao
> Wu
> Sent: Monday, May 21, 2018 10:16 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A ; Kinney, Michael D
> ; Younas Khan
> ; Yao, Jiewen ; Gao,
> Liming 
> Subject: [edk2] [PATCH v3] MdePkg/IndustryStandard: Add header file for SPMI
> ACPI table
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=840
> 
> Add the header file for Service Processor Management Interface ACPI table
> definition.
> 
> Cc: Younas Khan 
> Cc: Michael Kinney 
> Cc: Liming Gao 
> Cc: Jiewen Yao 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Hao Wu 
> ---
>  .../ServiceProcessorManagementInterfaceTable.h | 104
> +
>  1 file changed, 104 insertions(+)
>  create mode 100644
> MdePkg/Include/IndustryStandard/ServiceProcessorManagementInterfaceTable
> .h
> 
> diff --git
> a/MdePkg/Include/IndustryStandard/ServiceProcessorManagementInterfaceTa
> ble.h
> b/MdePkg/Include/IndustryStandard/ServiceProcessorManagementInterfaceTa
> ble.h
> new file mode 100644
> index 00..681de3b4b5
> --- /dev/null
> +++
> b/MdePkg/Include/IndustryStandard/ServiceProcessorManagementInterfaceTa
> ble.h
> @@ -0,0 +1,104 @@
> +/** @file
> +  Service Processor Management Interface (SPMI) ACPI table definition from
> +  Intelligent Platform Management Interface Specification Second Generation.
> +
> +  Copyright (c) 2018, Intel Corporation. All rights reserved.
> +  This program and the accompanying materials
> +  are licensed and made available under the terms and conditions of the BSD
> License
> +  which accompanies this distribution.  The full text of the license may be
> found at
> +  http://opensource.org/licenses/bsd-license.php
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +
> +  @par Revision Reference:
> +- Intelligent Platform Management Interface Specification Second
> Generation
> +  v2.0 Revision 1.1, Dated October 2013.
> +
> https://www.intel.com/content/dam/www/public/us/en/documents/specificati
> on-updates/ipmi-intelligent-platform-mgt-interface-spec-2nd-gen-v2-0-spec-up
> date.pdf
> +**/
> +#ifndef _SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE_H_
> +#define _SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE_H_
> +
> +#include 
> +
> +#pragma pack(1)
> +
> +///
> +/// Definition for the device identification information used by the Service
> +/// Processor Management Interface Description Table
> +///
> +typedef union {
> +  ///
> +  /// For PCI IPMI device
> +  ///
> +  struct {
> +UINT8 SegmentGroup;
> +UINT8 Bus;
> +UINT8 Device;
> +UINT8 Function;
> +  } Pci;
> +  ///
> +  /// For non-PCI IPMI device, the ACPI _UID value of the device
> +  ///
> +  UINT32  Uid;
> +}
> EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE_DEVICE_ID
> ;
> +
> +
> +///
> +/// Definition for Service Processor Management Interface Description Table
> +///
> +typedef struct {
> +  EFI_ACPI_DESCRIPTION_HEADER   Header;
> +  ///
> +  /// Indicates the type of IPMI interface.
> +  ///
> +  UINT8 InterfaceType;
> +  ///
> +  /// This field must always be 01h to be compatible with any software that
> +  /// implements previous versions of this spec.
> +  ///
> +  UINT8 Reserved1;
> +  ///
> +  /// Identifies the IPMI specification revision, in BCD format.
> +  ///
> +  UINT16SpecificationRevision;
> +  ///
> +  /// Interrupt type(s) used by the interface.
> +  ///
> +  UINT8 InterruptType;
> +  ///
> +  /// The bit assignment of the SCI interrupt within the GPEx_STS register 
> of a
> +  /// GPE described if the FADT that the interface triggers.
> +  ///
> +  UINT8 Gpe;
> +  ///
> +  /// Reserved, must be 00h.
> +  ///
> +  UINT8 Reserved2;
> +  ///
> +  /// PCI Device Flag.
> +  ///
> +  UINT8 PciDeviceFlag;
> +  ///
> +  /// The I/O APIC or I/O SAPIC Global System Interrupt used by the 
> interface.
> +  ///
> +  UINT32GlobalSystemInterrupt;
> +  ///
> +  /// The base address of the interface register set described using the
> +  /// Generic Address Structure (GAS, See [ACPI 2.0] for the definition).
> +  ///
> +  

Re: [edk2] [PATCH edk2-platforms v5 9/9] Platform/ARM/Sgi: Add Ssdt, Iort and Mcfg tables

2018-05-22 Thread Thomas Abraham
Hi Ard,

On Wed, May 23, 2018 at 10:13 AM, Ard Biesheuvel
 wrote:
> On 23 May 2018 at 06:29, Thomas Abraham  wrote:
>> SGI platforms support a AHCI controller which is attached to a PCIe
>> root complex and it can generate PCIe ITS-MSI transactions. So the
>> Ssdt, Iort and Mcfg ACPI tables to desribe this topology to the
>> linux kernel.
>>
>> Change-Id: I45d4cb03a5f25364f75587899faed634c612bb69
>
> Please remove the change-ids

Sorry, missed that. Will remove this from all the other patches in
this series in the next version.

>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Thomas Abraham 
>> ---
>>  .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf|   3 +
>>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc| 106 
>> +
>>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc|  59 
>>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl |  95 ++
>>  4 files changed, 263 insertions(+)
>>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
>>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc
>>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl
>>
>> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf 
>> b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
>> index 3694de9..e9bdd8a 100644
>> --- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
>> +++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
>> @@ -25,8 +25,11 @@
>>Dsdt.asl
>>Fadt.aslc
>>Gtdt.aslc
>> +  Iort.aslc
>>Madt.aslc
>> +  Mcfg.aslc
>>Spcr.aslc
>> +  Ssdt.asl
>>
>>  [Packages]
>>ArmPkg/ArmPkg.dec
>> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc 
>> b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
>> new file mode 100644
>> index 000..a8b6363
>> --- /dev/null
>> +++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
>> @@ -0,0 +1,106 @@
>> +/** @file
>> +*  I/O Remapping Table (Iort)
>> +*
>> +*  Copyright (c) 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.
>> +*
>> +**/
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include "SgiAcpiHeader.h"
>> +
>> +#pragma pack(1)
>> +
>> +typedef struct
>> +{
>> +  EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE   ItsNode;
>> +  UINT32   ItsIdentifiers;
>> +} ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE;
>> +
>> +typedef struct
>> +{
>> +  EFI_ACPI_6_0_IO_REMAPPING_RC_NODERcNode;
>> +  EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE   RcIdMap;
>> +} ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE;
>> +
>> +typedef struct
>> +{
>> +  EFI_ACPI_6_0_IO_REMAPPING_TABLE  Header;
>> +  ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE   ItsNode;
>> +  ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODERcNode;
>> +} ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE;
>> +
>> +#pragma pack ()
>> +
>> +ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE Iort =
>> +{
>> +  // EFI_ACPI_6_0_IO_REMAPPING_TABLE
>> +  {
>> + ARM_ACPI_HEADER  // EFI_ACPI_DESCRIPTION_HEADER
>> + (
>> +   EFI_ACPI_6_0_IO_REMAPPING_TABLE_SIGNATURE,
>> +   ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE,
>> +   EFI_ACPI_IO_REMAPPING_TABLE_REVISION
>> + ),
>> + 2,  // NumNodes
>> + sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE),  // NodeOffset
>> + 0,  // Reserved
>> +  },
>> +  // ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE
>> +  {
>> +// EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE
>> +{
>> +  // EFI_ACPI_6_0_IO_REMAPPING_NODE
>> +  {
>> +EFI_ACPI_IORT_TYPE_ITS_GROUP,  // Type
>> +sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE), // Length
>> +0,  // Revision
>> +0,  // Reserved
>> +0,  // NumIdMappings
>> +0,  // IdReference
>> +  },
>> +  1,// GIC ITS Identifiers
>> +},
>> +0,
>> +  },
>> +  // ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE
>> +  {
>> +// EFI_ACPI_6_0_IO_REMAPPING_RC_NODE
>> +{
>> +  // EFI_ACPI_6_0_IO_REMAPPING_NODE
>> +  {
>> +EFI_ACPI_IORT_TYPE_ROOT_COMPLEX,  // Type
>> +sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE),  // Length
>> +0,  // Revision
>> +0,  // Reserved
>> +1,  // NumIdMappings
>> +__builtin_offsetof (ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE, 
>> RcIdMap),  // IdReference
>> +  },
>> +  1,  // CacheCoherent
>> +  0,  // AllocationHints
>> +  0,  // Reserved
>> +  0,  // MemoryAccessFlags
>> +  EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED,  // AtsAttribute
>> +   

Re: [edk2] [Patch] Build spec: Add module scoped `<Pcd*>` section override scope statement

2018-05-22 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Zhu, Yonghong
>Sent: Wednesday, May 23, 2018 11:44 AM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming ; Kinney, Michael D
>; Shaw, Kevin W 
>Subject: [Patch] Build spec: Add module scoped `` section override
>scope statement
>
>Cc: Liming Gao 
>Cc: Michael Kinney 
>Cc: Kevin W Shaw 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yonghong Zhu 
>---
> 8_pre-build_autogen_stage/82_auto-generation_process.md | 7 ++-
> README.md   | 1 +
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
>diff --git a/8_pre-build_autogen_stage/82_auto-generation_process.md
>b/8_pre-build_autogen_stage/82_auto-generation_process.md
>index b4b59db..8f8f29b 100644
>--- a/8_pre-build_autogen_stage/82_auto-generation_process.md
>+++ b/8_pre-build_autogen_stage/82_auto-generation_process.md
>@@ -258,11 +258,11 @@ From the DSC file, the build tools collect the mapping
>between library classes
> and library instances (INF files), PCD data for the whole platform, the list 
> of
> modules (INF files) specified for the platform, and the build output 
> directory.
> Optionally, the name of the flash image layout description (FDF) file and 
> build
> options specific to the platform are also obtained. Parsing FDF file at this
> time is just for the PCD information which might be used by some modules,
>and
>-merge these PDC values into the information set of PCDs in DSC file.
>+merge these PCD values into the information set of PCDs in DSC file.
>
> A PCD entry must only be listed once per section in the DSC or FDF files.
>
> Multiple library class instances for a single library class must not be
> specified in the same `[LibraryClasses]` or `` section in the
>@@ -839,10 +839,15 @@ default method.
>   listed in a `PcdsDynamicEx` section, then use DynamicEx.
>
> * If not listed in any of the previous sections, and the PCD is listed in the
>   `PcdsDynamic` section, then use Dynamic.
>
>+If the Platform Integrator does not specify the format, and the PCD state is
>+in Platform DSC file `[Components]` section module scoped `` section,
>+then the PCD used in `[Components]` section module or its linked library INF
>+files will use the module scoped `` type as default type.
>+
> Build tools are required to process PCD values for `VOID*` PCDs into byte
> arrays, C format GUIDs or as C format strings (either ASCII or [L]"string")
> prior to autogenerating the code.
>
> PCD values stored in VPD regions are processed prior to completing the final
>diff --git a/README.md b/README.md
>index 9fb7e93..18e46c9 100644
>--- a/README.md
>+++ b/README.md
>@@ -223,5 +223,6 @@ Copyright (c) 2008-2017, Intel Corporation. All rights
>reserved.
> || [#775](https://bugzilla.tianocore.org/show_bug.cgi?id=775) 
> Build
>spec: Add description about auto detect thread number
>|   |
> || Add Flexible PCD value format into spec
>|   |
> || Update PCD value and SKU, DefaultStore info in build report
>|   |
> || Clarify structure PCD field value assignment precedence
>|   |
> || Update description for build handles PCDs for SKU support
>|   |
>+|| Add statement about module scoped `` section override
>scope
>|   |
>--
>2.6.1.windows.1

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


Re: [edk2] [PATCH edk2-platforms v5 8/9] Platform/ARM/Sgi: implement PciHostBridgeLib support

2018-05-22 Thread Ard Biesheuvel
On 23 May 2018 at 06:29, Thomas Abraham  wrote:
> SGI platforms include a PCIe root complex to which a AHCI controller
> is attached as an endpoint. So implement the PciHostBridgeLib glue
> layer and enable support for PCIe and AHCI controllers.
>
> Change-Id: I11e808a8eeb550b0147dc5bbb4615d805db7f24a

Drop this please

> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Thomas Abraham 
> ---
>  .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf|   4 +
>  .../Library/PciHostBridgeLib/PciHostBridgeLib.c| 188 
> +
>  .../Library/PciHostBridgeLib/PciHostBridgeLib.inf  |  63 +++
>  .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf |   8 +
>  .../SgiPkg/Library/PlatformLib/PlatformLibMem.c|  10 +-
>  Platform/ARM/SgiPkg/SgiPlatform.dsc|  48 ++
>  Platform/ARM/SgiPkg/SgiPlatform.fdf|  20 +++
>  7 files changed, 340 insertions(+), 1 deletion(-)
>  create mode 100644 
> Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
>  create mode 100644 
> Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
>
> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf 
> b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
> index ec47f94..3694de9 100644
> --- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
> +++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
> @@ -49,3 +49,7 @@
>gArmTokenSpaceGuid.PcdGicRedistributorsBase
>gArmTokenSpaceGuid.PcdGenericWatchdogControlBase
>gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase
> +  gArmTokenSpaceGuid.PcdPciBusMin
> +  gArmTokenSpaceGuid.PcdPciBusMax
> +
> +  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
> diff --git a/Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
> b/Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
> new file mode 100644
> index 000..ddda194
> --- /dev/null
> +++ b/Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
> @@ -0,0 +1,188 @@
> +/** @file
> +*  PCI Host Bridge Library instance for ARM SGI platforms
> +*
> +*  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 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +GLOBAL_REMOVE_IF_UNREFERENCED
> +STATIC CHAR16 CONST * CONST mPciHostBridgeLibAcpiAddressSpaceTypeStr[] = {
> +  L"Mem", L"I/O", L"Bus"
> +};
> +
> +#pragma pack(1)
> +typedef struct {
> +  ACPI_HID_DEVICE_PATH AcpiDevicePath;
> +  EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
> +} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
> +#pragma pack ()
> +
> +STATIC EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath = {
> +  {
> +{
> +  ACPI_DEVICE_PATH,
> +  ACPI_DP,
> +  {
> +(UINT8) (sizeof (ACPI_HID_DEVICE_PATH)),
> +(UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8)
> +  }
> +},
> +EISA_PNP_ID (0x0A08), // PCIe
> +0
> +  }, {
> +END_DEVICE_PATH_TYPE,
> +END_ENTIRE_DEVICE_PATH_SUBTYPE,
> +{
> +  END_DEVICE_PATH_LENGTH,
> +  0
> +}
> +  }
> +};
> +
> +STATIC PCI_ROOT_BRIDGE mPciRootBridge[] = {
> +  {
> +0,  // Segment
> +0,  // Supports
> +0,  // Attributes
> +TRUE,   // DmaAbove4G
> +FALSE,  // NoExtendedConfigSpace
> +FALSE,  // ResourceAssigned
> +EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM |  // AllocationAttributes
> +EFI_PCI_HOST_BRIDGE_MEM64_DECODE,
> +{
> +  // Bus
> +  FixedPcdGet32 (PcdPciBusMin),
> +  FixedPcdGet32 (PcdPciBusMax)
> +}, {
> +  // Io
> +  FixedPcdGet64 (PcdPciIoBase),
> +  FixedPcdGet64 (PcdPciIoBase) + FixedPcdGet64 (PcdPciIoSize) - 1
> +}, {
> +  // Mem
> +  FixedPcdGet32 (PcdPciMmio32Base),
> +  FixedPcdGet32 (PcdPciMmio32Base) + FixedPcdGet32 (PcdPciMmio32Size) - 1
> +}, {
> +  // MemAbove4G
> +  FixedPcdGet64 (PcdPciMmio64Base),
> +  FixedPcdGet64 (PcdPciMmio64Base) + FixedPcdGet64 (PcdPciMmio64Size) - 1
> +}, {
> +  // PMem
> +  MAX_UINT64,
> +  0
> +}, {
> +  // PMemAbove4G
> +  MAX_UINT64,
> +  0
> +},
> +(EFI_DEVICE_PATH_PROTOCOL *)
> +  },
> +};
> +
> +/**
> +  Return all the root bridge 

Re: [edk2] [PATCH edk2-platforms v5 9/9] Platform/ARM/Sgi: Add Ssdt, Iort and Mcfg tables

2018-05-22 Thread Ard Biesheuvel
On 23 May 2018 at 06:29, Thomas Abraham  wrote:
> SGI platforms support a AHCI controller which is attached to a PCIe
> root complex and it can generate PCIe ITS-MSI transactions. So the
> Ssdt, Iort and Mcfg ACPI tables to desribe this topology to the
> linux kernel.
>
> Change-Id: I45d4cb03a5f25364f75587899faed634c612bb69

Please remove the change-ids

> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Thomas Abraham 
> ---
>  .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf|   3 +
>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc| 106 
> +
>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc|  59 
>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl |  95 ++
>  4 files changed, 263 insertions(+)
>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc
>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl
>
> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf 
> b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
> index 3694de9..e9bdd8a 100644
> --- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
> +++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
> @@ -25,8 +25,11 @@
>Dsdt.asl
>Fadt.aslc
>Gtdt.aslc
> +  Iort.aslc
>Madt.aslc
> +  Mcfg.aslc
>Spcr.aslc
> +  Ssdt.asl
>
>  [Packages]
>ArmPkg/ArmPkg.dec
> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc 
> b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
> new file mode 100644
> index 000..a8b6363
> --- /dev/null
> +++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
> @@ -0,0 +1,106 @@
> +/** @file
> +*  I/O Remapping Table (Iort)
> +*
> +*  Copyright (c) 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.
> +*
> +**/
> +
> +#include 
> +#include 
> +#include 
> +#include "SgiAcpiHeader.h"
> +
> +#pragma pack(1)
> +
> +typedef struct
> +{
> +  EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE   ItsNode;
> +  UINT32   ItsIdentifiers;
> +} ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE;
> +
> +typedef struct
> +{
> +  EFI_ACPI_6_0_IO_REMAPPING_RC_NODERcNode;
> +  EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE   RcIdMap;
> +} ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE;
> +
> +typedef struct
> +{
> +  EFI_ACPI_6_0_IO_REMAPPING_TABLE  Header;
> +  ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE   ItsNode;
> +  ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODERcNode;
> +} ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE;
> +
> +#pragma pack ()
> +
> +ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE Iort =
> +{
> +  // EFI_ACPI_6_0_IO_REMAPPING_TABLE
> +  {
> + ARM_ACPI_HEADER  // EFI_ACPI_DESCRIPTION_HEADER
> + (
> +   EFI_ACPI_6_0_IO_REMAPPING_TABLE_SIGNATURE,
> +   ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE,
> +   EFI_ACPI_IO_REMAPPING_TABLE_REVISION
> + ),
> + 2,  // NumNodes
> + sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE),  // NodeOffset
> + 0,  // Reserved
> +  },
> +  // ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE
> +  {
> +// EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE
> +{
> +  // EFI_ACPI_6_0_IO_REMAPPING_NODE
> +  {
> +EFI_ACPI_IORT_TYPE_ITS_GROUP,  // Type
> +sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE), // Length
> +0,  // Revision
> +0,  // Reserved
> +0,  // NumIdMappings
> +0,  // IdReference
> +  },
> +  1,// GIC ITS Identifiers
> +},
> +0,
> +  },
> +  // ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE
> +  {
> +// EFI_ACPI_6_0_IO_REMAPPING_RC_NODE
> +{
> +  // EFI_ACPI_6_0_IO_REMAPPING_NODE
> +  {
> +EFI_ACPI_IORT_TYPE_ROOT_COMPLEX,  // Type
> +sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE),  // Length
> +0,  // Revision
> +0,  // Reserved
> +1,  // NumIdMappings
> +__builtin_offsetof (ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE, RcIdMap), 
>  // IdReference
> +  },
> +  1,  // CacheCoherent
> +  0,  // AllocationHints
> +  0,  // Reserved
> +  0,  // MemoryAccessFlags
> +  EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED,  // AtsAttribute
> +  0x0, // PciSegmentNumber
> +},
> +// EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE
> +{
> +  0x,  // InputBase
> +  0x,  // NumIds
> +  0x,  // OutputBase
> +  __builtin_offsetof (ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE, ItsNode),  // 
> OutputReference
> +  0,  // 

[edk2] [PATCH edk2-platforms v5 7/9] Platform/ARM/Sgi: add support for smsc91x ethernet controller

2018-05-22 Thread Thomas Abraham
From: Daniil Egranov 

SGI platforms include a SMSC9118 ethernet controller. Enable support
for this controller.

Change-Id: Iba449e1ab61a1bfffa15d7ac535ed17580bc2ca1
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov 
Signed-off-by: Thomas Abraham 
---
 Platform/ARM/SgiPkg/Include/SgiPlatform.h|  4 
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c |  8 +++-
 Platform/ARM/SgiPkg/SgiPlatform.dsc  |  6 ++
 Platform/ARM/SgiPkg/SgiPlatform.fdf  | 16 
 4 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index 441a467..00ca7e9 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -27,6 +27,10 @@
 #define SGI_EXP_SMC_CS1_BASE  0x0C00
 #define SGI_EXP_SMC_CS1_SZSIZE_64MB
 
+// Expansion AXI - SMSC 91C111 (Ethernet)
+#define SGI_EXP_SMSC91X_BASE  0x1800
+#define SGI_EXP_SMSC91X_SZSIZE_64MB
+
 // Expansion AXI - System peripherals
 #define SGI_EXP_SYS_PERIPH_BASE   0x1C00
 #define SGI_EXP_SYS_PERIPH_SZ SIZE_2MB
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c 
b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
index c8f8dbf..166f914 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
@@ -22,7 +22,7 @@
 #include 
 
 // Total number of descriptors, including the final "end-of-table" descriptor.
-#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS  8
+#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS  9
 
 /**
   Returns the Virtual Memory Map of the platform.
@@ -64,6 +64,12 @@ ArmPlatformGetVirtualMemoryMap (
   VirtualMemoryTable[Index].Length  = SIZE_64MB;
   VirtualMemoryTable[Index].Attributes  = 
ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
 
+  // Expansion AXI - SMSC 91X (Ethernet)
+  VirtualMemoryTable[++Index].PhysicalBase  = SGI_EXP_SMSC91X_BASE;
+  VirtualMemoryTable[Index].VirtualBase = SGI_EXP_SMSC91X_BASE;
+  VirtualMemoryTable[Index].Length  = SGI_EXP_SMSC91X_SZ;
+  VirtualMemoryTable[Index].Attributes  = 
ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+
   // Expansion AXI - System Peripherals
   VirtualMemoryTable[++Index].PhysicalBase  = SGI_EXP_SYS_PERIPH_BASE;
   VirtualMemoryTable[Index].VirtualBase = SGI_EXP_SYS_PERIPH_BASE;
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
b/Platform/ARM/SgiPkg/SgiPlatform.dsc
index 6316c6a..b20090b 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -150,6 +150,9 @@
   gArmPlatformTokenSpaceGuid.PcdCoreCount|4
   gArmPlatformTokenSpaceGuid.PcdClusterCount|2
 
+  # Ethernet
+  gEmbeddedTokenSpaceGuid.PcdLan91xDxeBaseAddress|0x1800
+
 

 #
 # Components Section - list of all EDK II Modules needed by this Platform
@@ -248,3 +251,6 @@
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   }
+
+  # SMSC LAN 91C111
+  EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf 
b/Platform/ARM/SgiPkg/SgiPlatform.fdf
index d4fae50..6f6e6aa 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
+++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
@@ -155,6 +155,22 @@ READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
   INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
 
+  #
+  # Networking stack
+  #
+  INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
+  INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
+  INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
+  INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
+  INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
+  INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
+  INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
+  INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
+  INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
+  INF MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
+  INF MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
+  INF EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
+
 [FV.FVMAIN_COMPACT]
 FvAlignment= 16
 BlockSize  = 0x1000
-- 
2.7.4

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


[edk2] [PATCH edk2-platforms v5 9/9] Platform/ARM/Sgi: Add Ssdt, Iort and Mcfg tables

2018-05-22 Thread Thomas Abraham
SGI platforms support a AHCI controller which is attached to a PCIe
root complex and it can generate PCIe ITS-MSI transactions. So the
Ssdt, Iort and Mcfg ACPI tables to desribe this topology to the
linux kernel.

Change-Id: I45d4cb03a5f25364f75587899faed634c612bb69
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Abraham 
---
 .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf|   3 +
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc| 106 +
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc|  59 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl |  95 ++
 4 files changed, 263 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl

diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
index 3694de9..e9bdd8a 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
@@ -25,8 +25,11 @@
   Dsdt.asl
   Fadt.aslc
   Gtdt.aslc
+  Iort.aslc
   Madt.aslc
+  Mcfg.aslc
   Spcr.aslc
+  Ssdt.asl
 
 [Packages]
   ArmPkg/ArmPkg.dec
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
new file mode 100644
index 000..a8b6363
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
@@ -0,0 +1,106 @@
+/** @file
+*  I/O Remapping Table (Iort)
+*
+*  Copyright (c) 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.
+*
+**/
+
+#include 
+#include 
+#include 
+#include "SgiAcpiHeader.h"
+
+#pragma pack(1)
+
+typedef struct
+{
+  EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE   ItsNode;
+  UINT32   ItsIdentifiers;
+} ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE;
+
+typedef struct
+{
+  EFI_ACPI_6_0_IO_REMAPPING_RC_NODERcNode;
+  EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE   RcIdMap;
+} ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE;
+
+typedef struct
+{
+  EFI_ACPI_6_0_IO_REMAPPING_TABLE  Header;
+  ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE   ItsNode;
+  ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODERcNode;
+} ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE;
+
+#pragma pack ()
+
+ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE Iort =
+{
+  // EFI_ACPI_6_0_IO_REMAPPING_TABLE
+  {
+ ARM_ACPI_HEADER  // EFI_ACPI_DESCRIPTION_HEADER
+ (
+   EFI_ACPI_6_0_IO_REMAPPING_TABLE_SIGNATURE,
+   ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE,
+   EFI_ACPI_IO_REMAPPING_TABLE_REVISION
+ ),
+ 2,  // NumNodes
+ sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE),  // NodeOffset
+ 0,  // Reserved
+  },
+  // ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE
+  {
+// EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE
+{
+  // EFI_ACPI_6_0_IO_REMAPPING_NODE
+  {
+EFI_ACPI_IORT_TYPE_ITS_GROUP,  // Type
+sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE), // Length
+0,  // Revision
+0,  // Reserved
+0,  // NumIdMappings
+0,  // IdReference
+  },
+  1,// GIC ITS Identifiers
+},
+0,
+  },
+  // ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE
+  {
+// EFI_ACPI_6_0_IO_REMAPPING_RC_NODE
+{
+  // EFI_ACPI_6_0_IO_REMAPPING_NODE
+  {
+EFI_ACPI_IORT_TYPE_ROOT_COMPLEX,  // Type
+sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE),  // Length
+0,  // Revision
+0,  // Reserved
+1,  // NumIdMappings
+__builtin_offsetof (ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE, RcIdMap),  
// IdReference
+  },
+  1,  // CacheCoherent
+  0,  // AllocationHints
+  0,  // Reserved
+  0,  // MemoryAccessFlags
+  EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED,  // AtsAttribute
+  0x0, // PciSegmentNumber
+},
+// EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE
+{
+  0x,  // InputBase
+  0x,  // NumIds
+  0x,  // OutputBase
+  __builtin_offsetof (ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE, ItsNode),  // 
OutputReference
+  0,  // Flags
+}
+  }
+};
+
+VOID* CONST ReferenceAcpiTable = 
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc
new file mode 100644
index 000..4a487a3
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc
@@ -0,0 +1,59 @@
+/** @file
+*  Memory mapped configuration space base address description table (MCFG)
+*
+*  

[edk2] [PATCH edk2-platforms v5 5/9] Platform/ARM/Sgi: add the initial set of acpi tables

2018-05-22 Thread Thomas Abraham
From: Daniil Egranov 

Add the initial set of Acpi tables for the SGI-575 platform. These tables
conform to the ACPI specification version 6.1. Some of the mandatory tables
required for SBBR v1.0 compilance are not included in this initial set
of Acpi tables.

Change-Id: I5c0edf8c98e758a925ea95acec1f9e4ca85eea46
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov 
Signed-off-by: Thomas Abraham 
---
 .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf|  51 ++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc|  90 +++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl |  99 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc|  87 +++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc| 151 ++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc| 173 +
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc|  77 +
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   |   7 +
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |   6 +
 Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h|  41 +
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf |   4 +
 11 files changed, 786 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc
 create mode 100644 Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h

diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
new file mode 100644
index 000..ec47f94
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
@@ -0,0 +1,51 @@
+## @file
+#  ACPI table data and ASL sources required to boot the platform.
+#
+#  Copyright (c) 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.
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = Sgi575AcpiTables
+  FILE_GUID  = c712719a-0aaf-438c-9cdd-35ab4d60207d  # 
gSgi575AcpiTablesiFileGuid
+  MODULE_TYPE= USER_DEFINED
+  VERSION_STRING = 1.0
+
+[Sources]
+  Dbg2.aslc
+  Dsdt.asl
+  Fadt.aslc
+  Gtdt.aslc
+  Madt.aslc
+  Spcr.aslc
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdePkg/MdePkg.dec
+  Platform/ARM/SgiPkg/SgiPlatform.dec
+
+[FixedPcd]
+  gArmPlatformTokenSpaceGuid.PcdCoreCount
+  gArmPlatformTokenSpaceGuid.PcdClusterCount
+  gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase
+  gArmPlatformTokenSpaceGuid.PL011UartInterrupt
+
+  gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum
+  gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
+  gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
+  gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum
+  gArmTokenSpaceGuid.PcdGicDistributorBase
+  gArmTokenSpaceGuid.PcdGicRedistributorsBase
+  gArmTokenSpaceGuid.PcdGenericWatchdogControlBase
+  gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
new file mode 100644
index 000..ed671f3
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
@@ -0,0 +1,90 @@
+/** @file
+*  Debug Port Table 2 (DBG2)
+*
+*  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 "SgiAcpiHeader.h"
+#include 
+#include 
+#include 
+
+#define SGI_DBG2_NUM_DEBUG_PORTS   1
+#define SGI_DBG2_NUM_GAS   1
+#define SGI_DBG2_NS_STR_LENGTH 8
+#define SGI_PL011_REGISTER_SPACE   0x1000
+
+#define NAME_STR_UART1 {'C', 'O', 'M', '1', '\0', '\0', '\0', '\0'}
+
+#pragma pack(1)
+
+typedef struct {
+  

[edk2] [PATCH edk2-platforms v5 6/9] Platform/ARM/Sgi: add initial support for ARM SGI platform

2018-05-22 Thread Thomas Abraham
From: Vishwanatha HG 

Add the initial support for ARM's System Guidance for Infrastructure
(SGI) platforms. SGI-575 is the supported platform in this initial
implementation and can be extented to include support for upcoming
SGI platforms as well.

Change-Id: I6c594d0f7e30af1aa97ea1fdcd5ed4e686a6667e
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vishwanatha HG 
Signed-off-by: Thomas Abraham 
---
 Platform/ARM/SgiPkg/SgiPlatform.dec |  37 +
 Platform/ARM/SgiPkg/SgiPlatform.dsc | 250 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf | 306 
 3 files changed, 593 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/SgiPlatform.dec
 create mode 100644 Platform/ARM/SgiPkg/SgiPlatform.dsc
 create mode 100644 Platform/ARM/SgiPkg/SgiPlatform.fdf

diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec 
b/Platform/ARM/SgiPkg/SgiPlatform.dec
new file mode 100644
index 000..d995937
--- /dev/null
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -0,0 +1,37 @@
+#
+#  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]
+  DEC_SPECIFICATION  = 0x0001001A
+  PACKAGE_NAME   = SgiPkg
+  PACKAGE_GUID   = e6e0f26c-0df9-4f6c-a382-37ded896c6e9
+  PACKAGE_VERSION= 0.1
+
+
+#
+# Include Section - list of Include Paths that are provided by this package.
+#   Comments are used for Keywords and Module Types.
+#
+# Supported Module Types:
+#  BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
+#
+
+[Includes.common]
+  Include# Root include for the package
+
+[Guids.common]
+  gArmSgiTokenSpaceGuid  = { 0x577d6941, 0xaea1, 0x40b4, { 0x90, 0x93, 
0x2a, 0x86, 0x61, 0x72, 0x5a, 0x57 } }
+  gSgi575AcpiTablesiFileGuid = { 0xc712719a, 0x0aaf, 0x438c, { 0x9c, 0xdd, 
0x35, 0xab, 0x4d, 0x60, 0x20, 0x7d } }
+
+[PcdsFeatureFlag.common]
+  # Set this PCD to TRUE to enable virtio support.
+  gArmSgiTokenSpaceGuid.PcdVirtioSupported|TRUE|BOOLEAN|0x0001
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
b/Platform/ARM/SgiPkg/SgiPlatform.dsc
new file mode 100644
index 000..6316c6a
--- /dev/null
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -0,0 +1,250 @@
+#
+#  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 Section - statements that will be processed to create a Makefile.
+#
+
+[Defines]
+  PLATFORM_NAME  = ArmSgi
+  PLATFORM_GUID  = 3a6b2eae-0275-4b6e-a5d1-bd2ba1ce1fae
+  PLATFORM_VERSION   = 0.1
+  DSC_SPECIFICATION  = 0x0001001B
+  OUTPUT_DIRECTORY   = Build/$(PLATFORM_NAME)
+  SUPPORTED_ARCHITECTURES= AARCH64|ARM
+  BUILD_TARGETS  = NOOPT|DEBUG|RELEASE
+  SKUID_IDENTIFIER   = DEFAULT
+  FLASH_DEFINITION   = Platform/ARM/SgiPkg/SgiPlatform.fdf
+  BUILD_NUMBER   = 1
+
+!include Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
+
+[LibraryClasses.common]
+  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+  ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
+  
ArmPlatformSysConfigLib|Platform/ARM/VExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
+  ArmPlatformLib|Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
+  BasePathLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+  
EfiResetSystemLib|ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf
+  NorFlashPlatformLib|Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  

[edk2] [PATCH edk2-platforms v5 8/9] Platform/ARM/Sgi: implement PciHostBridgeLib support

2018-05-22 Thread Thomas Abraham
SGI platforms include a PCIe root complex to which a AHCI controller
is attached as an endpoint. So implement the PciHostBridgeLib glue
layer and enable support for PCIe and AHCI controllers.

Change-Id: I11e808a8eeb550b0147dc5bbb4615d805db7f24a
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Abraham 
---
 .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf|   4 +
 .../Library/PciHostBridgeLib/PciHostBridgeLib.c| 188 +
 .../Library/PciHostBridgeLib/PciHostBridgeLib.inf  |  63 +++
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf |   8 +
 .../SgiPkg/Library/PlatformLib/PlatformLibMem.c|  10 +-
 Platform/ARM/SgiPkg/SgiPlatform.dsc|  48 ++
 Platform/ARM/SgiPkg/SgiPlatform.fdf|  20 +++
 7 files changed, 340 insertions(+), 1 deletion(-)
 create mode 100644 
Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
 create mode 100644 
Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf

diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
index ec47f94..3694de9 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
@@ -49,3 +49,7 @@
   gArmTokenSpaceGuid.PcdGicRedistributorsBase
   gArmTokenSpaceGuid.PcdGenericWatchdogControlBase
   gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase
+  gArmTokenSpaceGuid.PcdPciBusMin
+  gArmTokenSpaceGuid.PcdPciBusMax
+
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
b/Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
new file mode 100644
index 000..ddda194
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -0,0 +1,188 @@
+/** @file
+*  PCI Host Bridge Library instance for ARM SGI platforms
+*
+*  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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+GLOBAL_REMOVE_IF_UNREFERENCED
+STATIC CHAR16 CONST * CONST mPciHostBridgeLibAcpiAddressSpaceTypeStr[] = {
+  L"Mem", L"I/O", L"Bus"
+};
+
+#pragma pack(1)
+typedef struct {
+  ACPI_HID_DEVICE_PATH AcpiDevicePath;
+  EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
+} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
+#pragma pack ()
+
+STATIC EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath = {
+  {
+{
+  ACPI_DEVICE_PATH,
+  ACPI_DP,
+  {
+(UINT8) (sizeof (ACPI_HID_DEVICE_PATH)),
+(UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8)
+  }
+},
+EISA_PNP_ID (0x0A08), // PCIe
+0
+  }, {
+END_DEVICE_PATH_TYPE,
+END_ENTIRE_DEVICE_PATH_SUBTYPE,
+{
+  END_DEVICE_PATH_LENGTH,
+  0
+}
+  }
+};
+
+STATIC PCI_ROOT_BRIDGE mPciRootBridge[] = {
+  {
+0,  // Segment
+0,  // Supports
+0,  // Attributes
+TRUE,   // DmaAbove4G
+FALSE,  // NoExtendedConfigSpace
+FALSE,  // ResourceAssigned
+EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM |  // AllocationAttributes
+EFI_PCI_HOST_BRIDGE_MEM64_DECODE,
+{
+  // Bus
+  FixedPcdGet32 (PcdPciBusMin),
+  FixedPcdGet32 (PcdPciBusMax)
+}, {
+  // Io
+  FixedPcdGet64 (PcdPciIoBase),
+  FixedPcdGet64 (PcdPciIoBase) + FixedPcdGet64 (PcdPciIoSize) - 1
+}, {
+  // Mem
+  FixedPcdGet32 (PcdPciMmio32Base),
+  FixedPcdGet32 (PcdPciMmio32Base) + FixedPcdGet32 (PcdPciMmio32Size) - 1
+}, {
+  // MemAbove4G
+  FixedPcdGet64 (PcdPciMmio64Base),
+  FixedPcdGet64 (PcdPciMmio64Base) + FixedPcdGet64 (PcdPciMmio64Size) - 1
+}, {
+  // PMem
+  MAX_UINT64,
+  0
+}, {
+  // PMemAbove4G
+  MAX_UINT64,
+  0
+},
+(EFI_DEVICE_PATH_PROTOCOL *)
+  },
+};
+
+/**
+  Return all the root bridge instances in an array.
+
+  @param Count  Return the count of root bridge instances.
+
+  @return All the root bridge instances in an array.
+  The array should be passed into PciHostBridgeFreeRootBridges()
+  when it's not used.
+**/
+PCI_ROOT_BRIDGE *
+EFIAPI
+PciHostBridgeGetRootBridges (
+  UINTN *Count
+  )
+{
+  *Count = ARRAY_SIZE (mPciRootBridge);
+  return 

[edk2] [PATCH edk2-platforms v5 3/9] Platform/ARM/Sgi: add initial platform dxe driver implementation

2018-05-22 Thread Thomas Abraham
From: Daniil Egranov 

Add a initial platform dxe driver which starts of being almost
an empty implementation.

Change-Id: Iafe18ff81dd7c122080735f13ba68dee87f80b3e
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov 
Signed-off-by: Thomas Abraham 
---
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   | 25 +
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf | 31 ++
 2 files changed, 56 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
 create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf

diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
new file mode 100644
index 000..eb26fde
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -0,0 +1,25 @@
+/** @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.
+*
+**/
+
+#include 
+
+EFI_STATUS
+EFIAPI
+ArmSgiPkgEntryPoint (
+  IN EFI_HANDLE ImageHandle,
+  IN EFI_SYSTEM_TABLE   *SystemTable
+  )
+{
+  return EFI_SUCCESS;
+}
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
new file mode 100644
index 000..ae9fda8
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -0,0 +1,31 @@
+#
+#  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= 0x0001001A
+  BASE_NAME  = PlatformDxe
+  FILE_GUID  = 54cee352-c4cd-4d80-8524-54325c3a528e
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= ArmSgiPkgEntryPoint
+
+[Sources.common]
+  PlatformDxe.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  UefiDriverEntryPoint
+
+[Depex]
+  TRUE
-- 
2.7.4

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


[edk2] [PATCH edk2-platforms v5 1/9] Platform/ARM/Sgi: Add Platform library implementation

2018-05-22 Thread Thomas Abraham
Add initial SGI platform library support. This includes the virtual
memory map and helper functions for platform intialization.

Change-Id: Id73b4496be43e357a069f0ae42a204220d7a1a38
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Abraham 
---
 Platform/ARM/SgiPkg/Include/SgiPlatform.h  |  67 +
 .../SgiPkg/Library/PlatformLib/AArch64/Helper.S|  65 +
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.c   |  73 ++
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf |  55 +++
 .../SgiPkg/Library/PlatformLib/PlatformLibMem.c| 105 +
 5 files changed, 365 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/Include/SgiPlatform.h
 create mode 100644 Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
 create mode 100644 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
 create mode 100644 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
 create mode 100644 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c

diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
new file mode 100644
index 000..441a467
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -0,0 +1,67 @@
+/** @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_PLATFORM_H__
+#define __SGI_PLATFORM_H__
+
+/***
+// Platform Memory Map
+/
+
+// Expansion AXI - SMC Chip Select 0
+#define SGI_EXP_SMC_CS0_BASE  0x0800
+#define SGI_EXP_SMC_CS0_SZSIZE_64MB
+
+// Expansion AXI - SMC Chip Select 1
+#define SGI_EXP_SMC_CS1_BASE  0x0C00
+#define SGI_EXP_SMC_CS1_SZSIZE_64MB
+
+// Expansion AXI - System peripherals
+#define SGI_EXP_SYS_PERIPH_BASE   0x1C00
+#define SGI_EXP_SYS_PERIPH_SZ SIZE_2MB
+
+// Base address of system peripherals
+#define SGI_EXP_SYSPH_SYSTEM_REGISTERS0x1C01
+#define SGI_EXP_SYSPH_VIRTIO_BLOCK_BASE   0x1C13
+
+// Sub System Peripherals - UART0
+#define SGI_SUBSYS_UART0_BASE 0x2A40
+#define SGI_SUBSYS_UART0_SZ   0x0001
+
+// Sub System Peripherals - UART1
+#define SGI_SUBSYS_UART1_BASE 0x2A41
+#define SGI_SUBSYS_UART1_SZ   0x0001
+
+// Sub System Peripherals - Generic Watchdog
+#define SGI_SUBSYS_GENERIC_WDOG_BASE  0x2A44
+#define SGI_SUBSYS_GENERIC_WDOG_SZSIZE_128KB
+
+// Sub System Peripherals - GIC
+#define SGI_SUBSYS_GENERIC_GIC_BASE   0x3000
+#define SGI_SUBSYS_GENERIC_GICR_BASE  0x300C
+#define SGI_SUBSYS_GENERIC_GIC_SZ SIZE_1MB
+
+// Expansion AXI - Platform Peripherals - UART0
+#define SGI_EXP_PLAT_PERIPH_UART0_BASE0x7FF7
+#define SGI_EXP_PLAT_PERIPH_UART0_SZ  SIZE_64KB
+
+// Expansion AXI - Platform Peripherals - UART1
+#define SGI_EXP_PLAT_PERIPH_UART1_BASE0x7FF8
+#define SGI_EXP_PLAT_PERIPH_UART1_SZ  SIZE_64KB
+
+// Register offsets into the System Registers Block
+#define SGI_SYSPH_SYS_REG_FLASH   0x4C
+#define SGI_SYSPH_SYS_REG_FLASH_RWEN  0x1
+
+#endif // __SGI_PLATFORM_H__
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S 
b/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
new file mode 100644
index 000..dab6c77
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
@@ -0,0 +1,65 @@
+/** @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.
+*
+**/
+
+#include 
+#include 
+
+.text
+.align 3
+
+GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
+GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
+GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
+GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
+
+//
+// First 

[edk2] [PATCH edk2-platforms v5 4/9] Platform/ARM/Sgi: add support for virtio block device

2018-05-22 Thread Thomas Abraham
From: Daniil Egranov 

Add the registration of the virtio block device.

Change-Id: I857738b683a4a9a8751c42d04a268d9d74b82672
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Daniil Egranov 
Signed-off-by: Thomas Abraham 
---
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   | 17 -
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |  6 ++
 .../ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c | 81 ++
 3 files changed, 103 insertions(+), 1 deletion(-)
 create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c

diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index eb26fde..ff30a42 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -15,11 +15,26 @@
 #include 
 
 EFI_STATUS
+InitVirtioBlockIo (
+  IN EFI_HANDLE ImageHandle
+);
+
+EFI_STATUS
 EFIAPI
 ArmSgiPkgEntryPoint (
   IN EFI_HANDLE ImageHandle,
   IN EFI_SYSTEM_TABLE   *SystemTable
   )
 {
-  return EFI_SUCCESS;
+  EFI_STATUS  Status;
+
+  if (FeaturePcdGet (PcdVirtioSupported)) {
+Status = InitVirtioBlockIo (ImageHandle);
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_ERROR, "%a: Failed to install Virtio Block device\n",
+__FUNCTION__));
+}
+  }
+
+  return Status;
 }
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
index ae9fda8..6aa286f 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -20,12 +20,18 @@
 
 [Sources.common]
   PlatformDxe.c
+  VirtioBlockIo.c
 
 [Packages]
   MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
   UefiDriverEntryPoint
+  VirtioMmioDeviceLib
+
+[FeaturePcd]
+  gArmSgiTokenSpaceGuid.PcdVirtioSupported
 
 [Depex]
   TRUE
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c
new file mode 100644
index 000..978c861
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c
@@ -0,0 +1,81 @@
+/** @file
+
+  Copyright (c) 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.
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#pragma pack (1)
+typedef struct {
+  VENDOR_DEVICE_PATH  Vendor;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
+} VIRTIO_BLK_DEVICE_PATH;
+#pragma pack ()
+
+STATIC VIRTIO_BLK_DEVICE_PATH mVirtioBlockDevicePath =
+{
+  {
+{
+  HARDWARE_DEVICE_PATH,
+  HW_VENDOR_DP,
+  {
+(UINT8)(sizeof (VENDOR_DEVICE_PATH)),
+(UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+  }
+},
+EFI_CALLER_ID_GUID,
+  },
+  {
+END_DEVICE_PATH_TYPE,
+END_ENTIRE_DEVICE_PATH_SUBTYPE,
+{
+  sizeof (EFI_DEVICE_PATH_PROTOCOL),
+  0
+}
+  }
+};
+
+/**
+ * Entrypoint for 'VirtioBlockIo' driver
+ */
+EFI_STATUS
+InitVirtioBlockIo (
+   IN EFI_HANDLE ImageHandle
+  )
+{
+  EFI_STATUS Status = 0;
+
+  Status = gBS->InstallProtocolInterface (,
+  , EFI_NATIVE_INTERFACE,
+  );
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "%a: Failed to install the EFI_DEVICE_PATH "
+  "protocol for the virtio block device (Status == %r)\n",
+  __FUNCTION__, Status));
+return Status;
+  }
+
+  Status = VirtioMmioInstallDevice (SGI_EXP_SYSPH_VIRTIO_BLOCK_BASE, 
ImageHandle);
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR,
+  "%a: Failed to install Virtio block device (Status == %r)\n",
+  __FUNCTION__, Status));
+gBS->UninstallProtocolInterface (ImageHandle,
+   , );
+  }
+
+  return Status;
+}
-- 
2.7.4

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


[edk2] [PATCH edk2-platforms v5 2/9] Platform/ARM/Sgi: add NOR flash platform library implementation

2018-05-22 Thread Thomas Abraham
From: Vishwanatha HG 

Add a initial NOR flash driver platform wrapper as part of the platform
library. Access to NOR flash devices connected to CS0 and CS1 is enabled
in this initial implementation.

Change-Id: I132945abff7af220987a7a566f2ea7a58732af24
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vishwanatha HG 
Signed-off-by: Thomas Abraham 
---
 .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c   | 63 ++
 .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf | 34 
 2 files changed, 97 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c
 create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf

diff --git a/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c 
b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c
new file mode 100644
index 000..3ab296a
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c
@@ -0,0 +1,63 @@
+/** @file
+
+  Copyright (c) 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.
+
+ **/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {
+  {
+SGI_EXP_SMC_CS0_BASE,
+SGI_EXP_SMC_CS0_BASE,
+SIZE_256KB * 256,
+SIZE_256KB,
+{ 0xEBF0B9DF, 0x17d0, 0x4812, { 0xA9, 0x59, 0xCF, 0xD7, 0x92, 0xEE, 0x31, 
0x13 } }
+  },
+  {
+SGI_EXP_SMC_CS1_BASE,
+SGI_EXP_SMC_CS1_BASE,
+SIZE_256KB * 256,
+SIZE_256KB,
+{ 0x1F15DA3C, 0x37FF, 0x4070, { 0xB4, 0x71, 0xBB, 0x4A, 0xF1, 0x2A, 0x72, 
0x4A } }
+  },
+};
+
+EFI_STATUS
+NorFlashPlatformInitialization (
+  VOID
+  )
+{
+  UINT64 SysRegFlash;
+
+  SysRegFlash = SGI_EXP_SYSPH_SYSTEM_REGISTERS + SGI_SYSPH_SYS_REG_FLASH;
+  MmioOr32 (SysRegFlash, SGI_SYSPH_SYS_REG_FLASH_RWEN);
+  return EFI_SUCCESS;
+}
+
+EFI_STATUS
+NorFlashPlatformGetDevices (
+  OUT NOR_FLASH_DESCRIPTION   **NorFlashDevices,
+  OUT UINT32  *Count
+  )
+{
+  if ((NorFlashDevices == NULL) || (Count == NULL)) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  *NorFlashDevices = mNorFlashDevices;
+  *Count = ARRAY_SIZE (mNorFlashDevices);
+  return EFI_SUCCESS;
+}
diff --git a/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf 
b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf
new file mode 100644
index 000..3a6b33b
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf
@@ -0,0 +1,34 @@
+#/** @file
+#
+#  Copyright (c) 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.
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = NorFlashSgiLib
+  FILE_GUID  = 3f021755-6d74-4065-9ee4-98225267b36e
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = NorFlashPlatformLib
+
+[Sources.common]
+  NorFlashLib.c
+
+[Packages]
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  MdePkg/MdePkg.dec
+  Platform/ARM/SgiPkg/SgiPlatform.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  IoLib
-- 
2.7.4

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


[edk2] [PATCH edk2-platforms v5 0/9] Platform/ARM/Sgi: Add Arm's SGI platform support

2018-05-22 Thread Thomas Abraham
Changes since v4:
- addressed all the review comments from Ard and Alexei

Changes since v3:
- adds support for SMSC9118 ethernet controller
- adds support for PCIe and SATA controller to enable SATA disk access

Changes since v2:
- addressed all the comments from Ard.
- PrePeiCore is used instead of PrePi.

Changes since v1:
- minor update to commit messages

Arm CoreLink System Guidance for Infrastructure is a collection of
resources to provide a representative view of typical compute subsystems
that can be designed and implemented using specific generations of Arm IP.
These compute subsystems address the expected requirements of a specific
segment of the infrastructure market which includes servers, storage and
networking.

This patch series adds initial platform port support for Arm'S SGI-575
platform. This platform has 8x Cortex-A75 CPUs, supports DynamIQ
with L3 cache options, supports 2x DDR4-3200 (DMC-620) memory controller
and is SBSAv3 compliant. This series includes support for GIC, Serial,
smsc91x and virtio block device.

Daniil Egranov (4):
  Platform/ARM/Sgi: add initial platform dxe driver implementation
  Platform/ARM/Sgi: add support for virtio block device
  Platform/ARM/Sgi: add the initial set of acpi tables
  Platform/ARM/Sgi: add support for smsc91x ethernet controller

Thomas Abraham (3):
  Platform/ARM/Sgi: Add Platform library implementation
  Platform/ARM/Sgi: implement PciHostBridgeLib support
  Platform/ARM/Sgi: Add Ssdt, Iort and Mcfg tables

Vishwanatha HG (2):
  Platform/ARM/Sgi: add NOR flash platform library implementation
  Platform/ARM/Sgi: add initial support for ARM SGI platform

 .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf|  58 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc|  90 ++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl |  99 ++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc|  87 ++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc| 151 +
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc| 106 +++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc| 173 +++
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc|  59 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc|  77 +
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl |  95 ++
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   |  47 +++
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |  43 +++
 .../ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c |  81 +
 Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h|  41 +++
 Platform/ARM/SgiPkg/Include/SgiPlatform.h  |  71 +
 .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c   |  63 
 .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf |  34 ++
 .../Library/PciHostBridgeLib/PciHostBridgeLib.c| 188 +++
 .../Library/PciHostBridgeLib/PciHostBridgeLib.inf  |  63 
 .../SgiPkg/Library/PlatformLib/AArch64/Helper.S|  65 
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.c   |  73 +
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf |  67 
 .../SgiPkg/Library/PlatformLib/PlatformLibMem.c| 119 +++
 Platform/ARM/SgiPkg/SgiPlatform.dec|  37 +++
 Platform/ARM/SgiPkg/SgiPlatform.dsc| 304 ++
 Platform/ARM/SgiPkg/SgiPlatform.fdf| 342 +
 26 files changed, 2633 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl
 create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
 create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
 create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c
 create mode 100644 Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h
 create mode 100644 Platform/ARM/SgiPkg/Include/SgiPlatform.h
 create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c
 create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf
 create mode 100644 
Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
 create mode 100644 
Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
 create mode 100644 Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
 create mode 100644 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
 create mode 100644 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
 create mode 100644 

Re: [edk2] [PATCH edk2-platforms v4 5/9] Platform/ARM/Sgi: add the initial set of acpi tables

2018-05-22 Thread Thomas Abraham
On Mon, May 21, 2018 at 2:36 PM, Ard Biesheuvel
 wrote:
> On 21 May 2018 at 10:25, Thomas Abraham  wrote:
>> From: Daniil Egranov 
>>
>> Add the initial version of Acpi tables for the SGI-575 platform which
>> is required to boot the linux kernel up to a busybox prompt.
>>
>
> Please drop these references to linux or busybox.
>
> If this collection of ACPI tables represents some specified minimum
> (SBBR?), we should mention that. If anything is missing in that
> respect, please add it instead.

Okay.

>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Daniil Egranov 
>> Signed-off-by: Thomas Abraham 
>> ---
>>  .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf|  53 +++
>>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc|  90 +++
>>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl |  99 
>>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc|  87 +++
>>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc| 123 +++
>>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc| 173 
>> +
>>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc|  77 +
>>  .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   |   7 +
>>  Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h|  41 +
>>  9 files changed, 750 insertions(+)
>>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
>>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
>>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
>>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc
>>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
>>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc
>>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc
>>  create mode 100644 Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h
>>
>> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf 
>> b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
>> new file mode 100644
>> index 000..2c9bd98
>> --- /dev/null
>> +++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
>> @@ -0,0 +1,53 @@
>> +## @file
>> +#  ACPI table data and ASL sources required to boot the platform.
>> +#
>> +#  Copyright (c) 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.
>> +#
>> +##
>> +
>> +[Defines]
>> +  INF_VERSION= 0x0001001A
>> +  BASE_NAME  = Sgi575AcpiTables
>> +  FILE_GUID  = c712719a-0aaf-438c-9cdd-35ab4d60207d  # 
>> gSgi575AcpiTablesiFileGuid
>> +  MODULE_TYPE= USER_DEFINED
>> +  VERSION_STRING = 1.0
>> +
>> +[Sources]
>> +  Dbg2.aslc
>> +  Dsdt.asl
>> +  Fadt.aslc
>> +  Gtdt.aslc
>> +  Madt.aslc
>> +  Spcr.aslc
>> +
>> +[Packages]
>> +  ArmPkg/ArmPkg.dec
>> +  ArmPlatformPkg/ArmPlatformPkg.dec
>> +  EmbeddedPkg/EmbeddedPkg.dec
>> +  MdeModulePkg/MdeModulePkg.dec
>> +  MdePkg/MdePkg.dec
>> +  Platform/ARM/SgiPkg/SgiPlatform.dec
>> +  Platform/ARM/VExpressPkg/ArmVExpressPkg.dec
>> +
>
> Do you really need all these packages?

Not all, will clean it up.

>
>> +[FixedPcd]
>> +  gArmPlatformTokenSpaceGuid.PcdCoreCount
>> +  gArmPlatformTokenSpaceGuid.PcdClusterCount
>> +  gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum
>> +  gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
>> +  gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
>> +  gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum
>> +  gArmTokenSpaceGuid.PcdGicDistributorBase
>> +  gArmTokenSpaceGuid.PcdGicRedistributorsBase
>> +
>> +  gArmTokenSpaceGuid.PcdGenericWatchdogControlBase
>> +  gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase
>> +  gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase
>> +  gArmPlatformTokenSpaceGuid.PL011UartInterrupt
>> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc 
>> b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
>> new file mode 100644
>> index 000..ed671f3
>> --- /dev/null
>> +++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
>> @@ -0,0 +1,90 @@
>> +/** @file
>> +*  Debug Port Table 2 (DBG2)
>> +*
>> +*  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
>> +*  

Re: [edk2] [PATCH edk2-platforms v4 5/9] Platform/ARM/Sgi: add the initial set of acpi tables

2018-05-22 Thread Thomas Abraham
Hi Alexei,

On Mon, May 21, 2018 at 2:18 PM, Alexei Fedorov  wrote:
> Daniil, Thomas.
>
>
> Why is SGI_PLATFORM_WATCHDOG_COUNT defined as 2 in Gtdt.aslc :
>
>
> #define SGI_PLATFORM_WATCHDOG_COUNT   2
>
>
> and the same value is used in PlatformTimerCount field:
>
>
> SGI_PLATFORM_WATCHDOG_COUNT,  // UINT32  PlatformTimerCount
>
>
> although the table doesn't contain any SBSA Generic watchdog entries but only 
> GT blocks?

Yes, I missed that. These the SBSA Generic watchdog entries will be
included in the next vesion. Thanks for pointing this out.

Thanks,
Thomas.

>
>
> Regards.
>
> Alexei
>
> 
> From: edk2-devel  on behalf of Thomas 
> Abraham 
> Sent: 21 May 2018 09:25:48
> To: edk2-devel@lists.01.org
> Cc: leif.lindh...@linaro.org; ard.biesheu...@linaro.org
> Subject: [edk2] [PATCH edk2-platforms v4 5/9] Platform/ARM/Sgi: add the 
> initial set of acpi tables
>
> From: Daniil Egranov 
>
> Add the initial version of Acpi tables for the SGI-575 platform which
> is required to boot the linux kernel up to a busybox prompt.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Daniil Egranov 
> Signed-off-by: Thomas Abraham 
> ---
>  .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf|  53 +++
>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc|  90 +++
>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl |  99 
>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc|  87 +++
>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc| 123 +++
>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc| 173 
> +
>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc|  77 +
>  .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   |   7 +
>  Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h|  41 +
>  9 files changed, 750 insertions(+)
>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl
>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc
>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc
>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc
>  create mode 100644 Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h
>
> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf 
> b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
> new file mode 100644
> index 000..2c9bd98
> --- /dev/null
> +++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
> @@ -0,0 +1,53 @@
> +## @file
> +#  ACPI table data and ASL sources required to boot the platform.
> +#
> +#  Copyright (c) 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.
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION= 0x0001001A
> +  BASE_NAME  = Sgi575AcpiTables
> +  FILE_GUID  = c712719a-0aaf-438c-9cdd-35ab4d60207d  # 
> gSgi575AcpiTablesiFileGuid
> +  MODULE_TYPE= USER_DEFINED
> +  VERSION_STRING = 1.0
> +
> +[Sources]
> +  Dbg2.aslc
> +  Dsdt.asl
> +  Fadt.aslc
> +  Gtdt.aslc
> +  Madt.aslc
> +  Spcr.aslc
> +
> +[Packages]
> +  ArmPkg/ArmPkg.dec
> +  ArmPlatformPkg/ArmPlatformPkg.dec
> +  EmbeddedPkg/EmbeddedPkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  MdePkg/MdePkg.dec
> +  Platform/ARM/SgiPkg/SgiPlatform.dec
> +  Platform/ARM/VExpressPkg/ArmVExpressPkg.dec
> +
> +[FixedPcd]
> +  gArmPlatformTokenSpaceGuid.PcdCoreCount
> +  gArmPlatformTokenSpaceGuid.PcdClusterCount
> +  gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum
> +  gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
> +  gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
> +  gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum
> +  gArmTokenSpaceGuid.PcdGicDistributorBase
> +  gArmTokenSpaceGuid.PcdGicRedistributorsBase
> +
> +  gArmTokenSpaceGuid.PcdGenericWatchdogControlBase
> +  gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase
> +  gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase
> +  gArmPlatformTokenSpaceGuid.PL011UartInterrupt
> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc 
> b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
> new file mode 100644
> index 000..ed671f3
> --- /dev/null
> +++ 

Re: [edk2] [PATCH edk2-platforms v4 9/9] Platform/ARM/Sgi: Add Ssdt, Iort and Mcfg tables

2018-05-22 Thread Thomas Abraham
On Mon, May 21, 2018 at 2:59 PM, Ard Biesheuvel
 wrote:
> On 21 May 2018 at 10:25, Thomas Abraham  wrote:
>> SGI platforms support a AHCI controller which is attached to a PCIe
>> root complex and it can generate PCIe ITS-MSI transactions. So the
>> Ssdt, Iort and Mcfg ACPI tables to desribe this topology to the
>> linux kernel.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Thomas Abraham 
>> ---
>>  .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf|   5 +
>>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc| 106 
>> +
>>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc|  59 
>>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl |  91 ++
>>  4 files changed, 261 insertions(+)
>>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
>>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc
>>  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl
>>
>> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf 
>> b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
>> index 2c9bd98..485f819 100644
>> --- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
>> +++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
>> @@ -25,8 +25,11 @@
>>Dsdt.asl
>>Fadt.aslc
>>Gtdt.aslc
>> +  Iort.aslc
>>Madt.aslc
>> +  Mcfg.aslc
>>Spcr.aslc
>> +  Ssdt.asl
>>
>>  [Packages]
>>ArmPkg/ArmPkg.dec
>> @@ -51,3 +54,5 @@
>>gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase
>>gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase
>>gArmPlatformTokenSpaceGuid.PL011UartInterrupt
>> +
>> +  gArmSgiTokenSpaceGuid.PcdPciConfigurationSpaceBaseAddress
>> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc 
>> b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
>> new file mode 100644
>> index 000..f3b3105
>> --- /dev/null
>> +++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
>> @@ -0,0 +1,106 @@
>> +/** @file
>> +*  I/O Remapping Table (Iort)
>> +*
>> +*  Copyright (c) 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.
>> +*
>> +**/
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include "SgiAcpiHeader.h"
>> +
>> +#pragma pack(1)
>> +
>> +typedef struct
>> +{
>> +  EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE   ItsNode;
>> +  UINT32   ItsIdentifiers;
>> +} ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE;
>> +
>> +typedef struct
>> +{
>> +  EFI_ACPI_6_0_IO_REMAPPING_RC_NODERcNode;
>> +  EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE   RcIdMap;
>> +} ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE;
>> +
>> +typedef struct
>> +{
>> +  EFI_ACPI_6_0_IO_REMAPPING_TABLE  Header;
>> +  ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE   ItsNode;
>> +  ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODERcNode;
>> +} ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE;
>> +
>> +#pragma pack ()
>> +
>> +ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE Iort =
>> +{
>> +  // EFI_ACPI_6_0_IO_REMAPPING_TABLE
>> +  {
>> + ARM_ACPI_HEADER  // EFI_ACPI_DESCRIPTION_HEADER
>> + (
>> +   EFI_ACPI_6_0_IO_REMAPPING_TABLE_SIGNATURE,
>> +   ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE,
>> +   EFI_ACPI_IO_REMAPPING_TABLE_REVISION
>> + ),
>> + 2,  // NumNodes
>> + sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE),  // NodeOffset
>> + 0,  // Reserved
>> +  },
>> +  // ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE
>> +  {
>> +// EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE
>> +{
>> +  // EFI_ACPI_6_0_IO_REMAPPING_NODE
>> +  {
>> +EFI_ACPI_IORT_TYPE_ITS_GROUP,  // Type
>> +sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE), // Length
>> +0,  // Revision
>> +0,  // Reserved
>> +0,  // NumIdMappings
>> +0,  // IdReference
>> +  },
>> +  1,// GIC ITS Identifiers
>> +},
>> +0,
>> +  },
>> +  // ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE
>> +  {
>> +// EFI_ACPI_6_0_IO_REMAPPING_RC_NODE
>> +{
>> +  // EFI_ACPI_6_0_IO_REMAPPING_NODE
>> +  {
>> +EFI_ACPI_IORT_TYPE_ROOT_COMPLEX,  // Type
>> +sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE),  // Length
>> +0,  // Revision
>> +0,  // Reserved
>> +1,  // NumIdMappings
>> +__builtin_offsetof (ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE, 
>> RcIdMap),  // IdReference
>> +  },
>> +  1,  // CacheCoherent
>> +  0,  // AllocationHints
>> +  0,  // Reserved
>> +  0,  // MemoryAccessFlags
>> +  

Re: [edk2] [PATCH edk2-platforms v4 8/9] Platform/ARM/Sgi: implement PciHostBridgeLib support

2018-05-22 Thread Thomas Abraham
On Mon, May 21, 2018 at 2:46 PM, Ard Biesheuvel
 wrote:
> On 21 May 2018 at 10:25, Thomas Abraham  wrote:
>> SGI platforms include a PCIe root complex to which a AHCI controller
>> is attached as an endpoint. So implement the PciHostBridgeLib glue
>> layer and enable support for PCIe and AHCI controllers.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Thomas Abraham 
>> ---
>>  .../Library/PciHostBridgeLib/PciHostBridgeLib.c| 189 
>> +
>>  .../Library/PciHostBridgeLib/PciHostBridgeLib.inf  |  63 +++
>>  .../SgiPkg/Library/PlatformLib/PlatformLibMem.c|  20 ++-
>>  Platform/ARM/SgiPkg/SgiPlatform.dec|   4 +
>>  Platform/ARM/SgiPkg/SgiPlatform.dsc|  48 ++
>>  Platform/ARM/SgiPkg/SgiPlatform.fdf|  20 +++
>>  6 files changed, 343 insertions(+), 1 deletion(-)
>>  create mode 100644 
>> Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
>>  create mode 100644 
>> Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
>>
>> diff --git a/Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
>> b/Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
>> new file mode 100644
>> index 000..f8bf9fc
>> --- /dev/null
>> +++ b/Platform/ARM/SgiPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
>> @@ -0,0 +1,189 @@
>> +/** @file
>> +*  PCI Host Bridge Library instance for ARM SGI platforms
>> +*
>> +*  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 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +GLOBAL_REMOVE_IF_UNREFERENCED
>> +CHAR16 *mPciHostBridgeLibAcpiAddressSpaceTypeStr[] = {
>> +  L"Mem", L"I/O", L"Bus"
>> +};
>> +
>
> You can make this
>
> STATIC CHAR16 CONST * CONST
>
> afaict
>
>> +#pragma pack(1)
>> +typedef struct {
>> +  ACPI_HID_DEVICE_PATH AcpiDevicePath;
>> +  EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
>> +} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
>> +#pragma pack ()
>> +
>> +STATIC EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath = {
>> +  {
>> +{
>> +  ACPI_DEVICE_PATH,
>> +  ACPI_DP,
>> +  {
>> +(UINT8) (sizeof (ACPI_HID_DEVICE_PATH)),
>> +(UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8)
>> +  }
>> +},
>> +EISA_PNP_ID (0x0A08), // PCIe
>> +0
>> +  }, {
>> +END_DEVICE_PATH_TYPE,
>> +END_ENTIRE_DEVICE_PATH_SUBTYPE,
>> +{
>> +  END_DEVICE_PATH_LENGTH,
>> +  0
>> +}
>> +  }
>> +};
>> +
>> +STATIC PCI_ROOT_BRIDGE mPciRootBridge[] = {
>> +  {
>> +0,  // Segment
>> +0,  // Supports
>> +0,  // Attributes
>> +FALSE,  // DmaAbove4G
>
> Is 64-bit DMA not supported by this PCIe controller?

Yes, it does. Will fix it in the next version.

>
>> +FALSE,  // NoExtendedConfigSpace
>> +FALSE,  // ResourceAssigned
>> +EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM |  // AllocationAttributes
>> +EFI_PCI_HOST_BRIDGE_MEM64_DECODE,
>> +{
>> +  // Bus
>> +  FixedPcdGet32 (PcdPciBusMin),
>> +  FixedPcdGet32 (PcdPciBusMax)
>> +}, {
>> +  // Io
>> +  FixedPcdGet64 (PcdPciIoBase),
>> +  FixedPcdGet64 (PcdPciIoBase) + FixedPcdGet64 (PcdPciIoSize) - 1
>> +}, {
>> +  // Mem
>> +  FixedPcdGet32 (PcdPciMmio32Base),
>> +  FixedPcdGet32 (PcdPciMmio32Base) + FixedPcdGet32 (PcdPciMmio32Size) - 
>> 1
>> +}, {
>> +  // MemAbove4G
>> +  FixedPcdGet64 (PcdPciMmio64Base),
>> +  FixedPcdGet64 (PcdPciMmio64Base) + FixedPcdGet64 (PcdPciMmio64Size) - 
>> 1
>> +}, {
>> +  // PMem
>> +  MAX_UINT64,
>> +  0
>> +}, {
>> +  // PMemAbove4G
>> +  MAX_UINT64,
>> +  0
>> +},
>> +(EFI_DEVICE_PATH_PROTOCOL *)
>> +  },
>> +};
>> +
>> +/**
>> +  Return all the root bridge instances in an array.
>> +
>> +  @param Count  Return the count of root bridge instances.
>> +
>> +  @return All the root bridge instances in an array.
>> +  The array should be passed into PciHostBridgeFreeRootBridges()
>> +  when it's not used.
>> +**/
>> +PCI_ROOT_BRIDGE *
>> +EFIAPI
>> +PciHostBridgeGetRootBridges (
>> +  UINTN *Count

Re: [edk2] [PATCH edk2-platforms v4 7/9] Platform/ARM/Sgi: add support for smsc91x ethernet controller

2018-05-22 Thread Thomas Abraham
On Mon, May 21, 2018 at 2:39 PM, Ard Biesheuvel
 wrote:
> On 21 May 2018 at 10:25, Thomas Abraham  wrote:
>> From: Daniil Egranov 
>>
>> SGI platforms include a SMSC9118 ethernet controller. Enable support
>> for this controller.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Daniil Egranov 
>> Signed-off-by: Thomas Abraham 
>> ---
>>  Platform/ARM/SgiPkg/Include/SgiPlatform.h|  4 
>>  Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c |  8 +++-
>>  Platform/ARM/SgiPkg/SgiPlatform.dsc  |  6 ++
>>  Platform/ARM/SgiPkg/SgiPlatform.fdf  | 16 
>> 
>>  4 files changed, 33 insertions(+), 1 deletion(-)
>>
>> diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
>> b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
>> index 441a467..00ca7e9 100644
>> --- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
>> +++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
>> @@ -27,6 +27,10 @@
>>  #define SGI_EXP_SMC_CS1_BASE  0x0C00
>>  #define SGI_EXP_SMC_CS1_SZSIZE_64MB
>>
>> +// Expansion AXI - SMSC 91C111 (Ethernet)
>> +#define SGI_EXP_SMSC91X_BASE  0x1800
>> +#define SGI_EXP_SMSC91X_SZSIZE_64MB
>> +
>>  // Expansion AXI - System peripherals
>>  #define SGI_EXP_SYS_PERIPH_BASE   0x1C00
>>  #define SGI_EXP_SYS_PERIPH_SZ SIZE_2MB
>> diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c 
>> b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
>> index 9be71fb..f038559 100644
>> --- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
>> +++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
>> @@ -22,7 +22,7 @@
>>  #include 
>>
>>  // Total number of descriptors, including the final "end-of-table" 
>> descriptor.
>> -#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS  8
>> +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS  9
>>
>>  /**
>>Returns the Virtual Memory Map of the platform.
>> @@ -63,6 +63,12 @@ ArmPlatformGetVirtualMemoryMap (
>>VirtualMemoryTable[Index].Length  = SIZE_64MB;
>>VirtualMemoryTable[Index].Attributes  = 
>> ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
>>
>> +  // Expansion AXI - SMSC 91X (Ethernet)
>> +  VirtualMemoryTable[++Index].PhysicalBase  = SGI_EXP_SMSC91X_BASE;
>> +  VirtualMemoryTable[Index].VirtualBase = SGI_EXP_SMSC91X_BASE;
>> +  VirtualMemoryTable[Index].Length  = SGI_EXP_SMSC91X_SZ;
>> +  VirtualMemoryTable[Index].Attributes  = 
>> ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
>> +
>>// Expansion AXI - System Peripherals
>>VirtualMemoryTable[++Index].PhysicalBase  = SGI_EXP_SYS_PERIPH_BASE;
>>VirtualMemoryTable[Index].VirtualBase = SGI_EXP_SYS_PERIPH_BASE;
>> diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
>> b/Platform/ARM/SgiPkg/SgiPlatform.dsc
>> index c5f220e..f11c1f3 100644
>> --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
>> +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
>> @@ -150,6 +150,9 @@
>>gArmPlatformTokenSpaceGuid.PcdCoreCount|4
>>gArmPlatformTokenSpaceGuid.PcdClusterCount|2
>>
>> +  # Ethernet
>> +  gEmbeddedTokenSpaceGuid.PcdLan91xDxeBaseAddress|0x1800
>> +
>>  
>> 
>>  #
>>  # Components Section - list of all EDK II Modules needed by this Platform
>> @@ -249,3 +252,6 @@
>>
>> NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
>>PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
>>}
>> +
>> +  # SMSC LAN 91C111
>> +  EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
>> diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf 
>> b/Platform/ARM/SgiPkg/SgiPlatform.fdf
>> index d4fae50..6f6e6aa 100644
>> --- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
>> +++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
>> @@ -155,6 +155,22 @@ READ_LOCK_STATUS   = TRUE
>>INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
>>INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>>
>> +  #
>> +  # Networking stack
>> +  #
>> +  INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
>> +  INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
>> +  INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
>> +  INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
>> +  INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
>> +  INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
>> +  INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
>> +  INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
>> +  INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
>> +  INF MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
>> +  INF MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
>> +  INF EmbeddedPkg/Drivers/Lan91xDxe/Lan91xDxe.inf
>> +
>

Re: [edk2] [PATCH edk2-platforms v4 4/9] Platform/ARM/Sgi: add support for virtio block device

2018-05-22 Thread Thomas Abraham
On Mon, May 21, 2018 at 2:28 PM, Ard Biesheuvel
 wrote:
> On 21 May 2018 at 10:25, Thomas Abraham  wrote:
>> From: Daniil Egranov 
>>
>> Add the registration of the virtio block device.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Daniil Egranov 
>> Signed-off-by: Thomas Abraham 
>> ---
>>  .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   | 18 -
>>  .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |  1 +
>>  .../ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c | 76 
>> ++
>>  3 files changed, 94 insertions(+), 1 deletion(-)
>>  create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c
>>
>> diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
>> b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
>> index eb26fde..fb1e390 100644
>> --- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
>> +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
>> @@ -15,11 +15,27 @@
>>  #include 
>>
>>  EFI_STATUS
>> +InitVirtioBlockIo (
>> +  IN EFI_HANDLE ImageHandle
>> +);
>> +
>> +EFI_STATUS
>>  EFIAPI
>>  ArmSgiPkgEntryPoint (
>>IN EFI_HANDLE ImageHandle,
>>IN EFI_SYSTEM_TABLE   *SystemTable
>>)
>>  {
>> -  return EFI_SUCCESS;
>> +  EFI_STATUS  Status;
>> +
>> +  // Install Virtio Block IO.
>> +  if (FeaturePcdGet (PcdVirtioSupported) == TRUE) {
>
> No need to compare booleans with TRUE or FALSE.
>
>> +Status = InitVirtioBlockIo (ImageHandle);
>> +if (EFI_ERROR (Status)) {
>> +  DEBUG ((DEBUG_ERROR, "PlatformDxe: Failed to install Virtio Block 
>> IO\n"));
>> +  return Status;
>> +}
>> +  }
>> +
>> +  return Status;
>>  }
>> diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
>> b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
>> index dbe04c5..995f80d 100644
>> --- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
>> +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
>> @@ -20,6 +20,7 @@
>>
>>  [Sources.common]
>>PlatformDxe.c
>> +  VirtioBlockIo.c
>>
>>  [Packages]
>>ArmPkg/ArmPkg.dec
>> diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c 
>> b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c
>> new file mode 100644
>> index 000..58dfd22
>> --- /dev/null
>> +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioBlockIo.c
>> @@ -0,0 +1,76 @@
>> +/** @file
>> +
>> +  Copyright (c) 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.
>> +
>> +**/
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#pragma pack (1)
>> +typedef struct {
>> +  VENDOR_DEVICE_PATH  Vendor;
>> +  EFI_DEVICE_PATH_PROTOCOLEnd;
>> +} VIRTIO_BLK_DEVICE_PATH;
>> +#pragma pack ()
>> +
>> +STATIC VIRTIO_BLK_DEVICE_PATH mVirtioBlockDevicePath =
>> +{
>> +  {
>> +{
>> +  HARDWARE_DEVICE_PATH,
>> +  HW_VENDOR_DP,
>> +  {
>> +(UINT8)( sizeof (VENDOR_DEVICE_PATH) ),
>> +(UINT8)( (sizeof (VENDOR_DEVICE_PATH) ) >> 8)
>
> No spaces after ( or before ) please
>
>> +  }
>> +},
>> +EFI_CALLER_ID_GUID,
>> +  },
>> +  {
>> +END_DEVICE_PATH_TYPE,
>> +END_ENTIRE_DEVICE_PATH_SUBTYPE,
>> +{
>> +  sizeof (EFI_DEVICE_PATH_PROTOCOL),
>> +  0
>> +}
>> +  }
>> +};
>> +
>> +/**
>> + * Entrypoint for 'VirtioBlockIo' driver
>> + */
>> +EFI_STATUS
>> +InitVirtioBlockIo (
>> +   IN EFI_HANDLE ImageHandle
>> +  )
>> +{
>> +  EFI_STATUS Status = 0;
>> +
>> +  Status = gBS->InstallProtocolInterface (,
>> +   , EFI_NATIVE_INTERFACE,
>> +   );
>> +
>
> Please use correct indentation.
>
>> +  if (EFI_ERROR (Status)) {
>> +return Status;
>> +  }
>> +
>> +  // Declare the Virtio BlockIo device
>> +  Status = VirtioMmioInstallDevice (SGI_EXP_SYSPH_VIRTIO_BLOCK_BASE, 
>> ImageHandle);
>> +  if (EFI_ERROR (Status)) {
>> +DEBUG ((DEBUG_ERROR, "PlatformDxe: Failed to install Virtio block 
>> device\n"));
>> +  }
>> +
>
> Please handle this error correctly. If the call to
> VirtioMmioInstallDevice() fails, you will exit this function and hence
> the DXE entry point with an error, which will result in the driver to
> be unloaded. However, you just installed gEfiDevicePathProtocolGuid
> with references to the driver's code, and attempts to invoke those
> will result in a crash after this.

Okay, thanks for pointing this out. This 

Re: [edk2] [PATCH edk2-platforms v4 3/9] Platform/ARM/Sgi: add initial platform dxe driver implementation

2018-05-22 Thread Thomas Abraham
On Mon, May 21, 2018 at 2:25 PM, Ard Biesheuvel
 wrote:
> On 21 May 2018 at 10:25, Thomas Abraham  wrote:
>> From: Daniil Egranov 
>>
>> Add a initial platform dxe driver which starts of being almost
>> an empty implementation.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Daniil Egranov 
>> Signed-off-by: Thomas Abraham 
>> ---
>>  .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   | 25 
>>  .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf | 73 
>> ++
>>  2 files changed, 98 insertions(+)
>>  create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
>>  create mode 100644 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
>>
>> diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
>> b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
>> new file mode 100644
>> index 000..eb26fde
>> --- /dev/null
>> +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
>> @@ -0,0 +1,25 @@
>> +/** @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.
>> +*
>> +**/
>> +
>> +#include 
>> +
>> +EFI_STATUS
>> +EFIAPI
>> +ArmSgiPkgEntryPoint (
>> +  IN EFI_HANDLE ImageHandle,
>> +  IN EFI_SYSTEM_TABLE   *SystemTable
>> +  )
>> +{
>> +  return EFI_SUCCESS;
>> +}
>> diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
>> b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
>> new file mode 100644
>> index 000..dbe04c5
>> --- /dev/null
>> +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
>> @@ -0,0 +1,73 @@
>> +#
>> +#  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= 0x0001001A
>> +  BASE_NAME  = PlatformDxe
>> +  FILE_GUID  = 54cee352-c4cd-4d80-8524-54325c3a528e
>> +  MODULE_TYPE= DXE_DRIVER
>> +  VERSION_STRING = 1.0
>> +  ENTRY_POINT= ArmSgiPkgEntryPoint
>> +
>> +[Sources.common]
>> +  PlatformDxe.c
>> +
>> +[Packages]
>> +  ArmPkg/ArmPkg.dec
>> +  ArmPlatformPkg/ArmPlatformPkg.dec
>> +  EmbeddedPkg/EmbeddedPkg.dec
>> +  MdePkg/MdePkg.dec
>> +  OvmfPkg/OvmfPkg.dec
>> +  Platform/ARM/SgiPkg/SgiPlatform.dec
>> +
>> +[LibraryClasses]
>> +  AcpiLib
>> +  BaseMemoryLib
>> +  DebugLib
>> +  DxeServicesTableLib
>> +  FdtLib
>> +  HobLib
>> +  IoLib
>> +  PcdLib
>> +  PrintLib
>> +  SerialPortLib
>> +  UefiBootServicesTableLib
>> +  UefiRuntimeServicesTableLib
>> +  UefiLib
>> +  UefiDriverEntryPoint
>> +  VirtioMmioDeviceLib
>> +
>> +[Guids]
>> +  gEfiEndOfDxeEventGroupGuid
>> +  gEfiFileInfoGuid
>> +  gEfiHobListGuid
>> +  gFdtTableGuid
>> +  gEfiAcpi10TableGuid
>> +  gEfiAcpiTableGuid
>> +  gSgi575AcpiTablesiFileGuid
>> +
>> +[Protocols]
>> +  gEfiBlockIoProtocolGuid
>> +  gEfiDevicePathFromTextProtocolGuid
>> +  gEfiSimpleFileSystemProtocolGuid
>> +
>> +[FeaturePcd]
>> +  gArmSgiTokenSpaceGuid.PcdVirtioSupported
>> +
>> +[FixedPcd]
>> +  gArmTokenSpaceGuid.PcdSystemMemoryBase
>> +  gArmTokenSpaceGuid.PcdSystemMemorySize
>> +  gArmTokenSpaceGuid.PcdHypFvBaseAddress
>> +  gArmTokenSpaceGuid.PcdHypFvSize
>> +
>
> As I mentioned in my review of v1: I think it is fine to start with an
> empty stub for a driver, but please don't limit that to the C file.
>
> None of these library classes, guids, protocols or PCDs are being used
> in this patch. References to them should be added along with the code
> that actually uses those references.

Yes, I missed this part. This will be fixed in the next version.

Thanks,
Thomas.

>
>> +[Depex]
>> +  TRUE
>> --
>> 2.7.4
>>
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms v4 2/9] Platform/ARM/Sgi: add NOR flash platform library implementation

2018-05-22 Thread Thomas Abraham
Hi Ard,

On Mon, May 21, 2018 at 2:23 PM, Ard Biesheuvel
 wrote:
> On 21 May 2018 at 10:25, Thomas Abraham  wrote:
>> From: Vishwanatha HG 
>>
>> Add a initial NOR flash driver platform wrapper as part of the platform
>> library. Access to NOR flash devices connected to CS0 and CS1 is enabled
>> in this initial implementation.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Vishwanatha HG 
>> Signed-off-by: Thomas Abraham 
>> ---
>>  .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c   | 66 
>> ++
>>  .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf | 34 +++
>>  2 files changed, 100 insertions(+)
>>  create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c
>>  create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf
>>
>> diff --git a/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c 
>> b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c
>> new file mode 100644
>> index 000..9b4981f
>> --- /dev/null
>> +++ b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c
>> @@ -0,0 +1,66 @@
>> +/** @file
>> +
>> +  Copyright (c) 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.
>> +
>> + **/
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {
>> +  {
>> +SGI_EXP_SMC_CS0_BASE,
>> +SGI_EXP_SMC_CS0_BASE,
>> +SIZE_256KB * 256,
>> +SIZE_256KB,
>> +{0xEBF0B9DF, 0x17d0, 0x4812, { 0xA9, 0x59, 0xCF, 0xD7, 0x92, 0xEE, 
>> 0x31, 0x13} }
>> +  },
>> +  {
>> +SGI_EXP_SMC_CS1_BASE,
>> +SGI_EXP_SMC_CS1_BASE,
>> +SIZE_256KB * 256,
>> +SIZE_256KB,
>> +{ 0x1F15DA3C, 0x37FF, 0x4070, { 0xB4, 0x71, 0xBB, 0x4A, 0xF1, 0x2A, 
>> 0x72, 0x4A } }
>
> Please use consistent whitespace in these GUID definitions.
>
>> +  },
>> +};
>> +
>> +EFI_STATUS
>> +NorFlashPlatformInitialization (
>> +  VOID
>> +  )
>> +{
>> +  UINT64 SysRegFlash;
>> +
>> +  SysRegFlash = SGI_EXP_SYSPH_SYSTEM_REGISTERS + SGI_SYSPH_SYS_REG_FLASH;
>> +  if ((MmioRead32 (SysRegFlash) & SGI_SYSPH_SYS_REG_FLASH_RWEN) == 0) {
>> +MmioWrite32 (SysRegFlash, 1);
>
> SGI_SYSPH_SYS_REG_FLASH_RWEN?

The SysReg register has a bit in it that has to be set to allow
read/write access to the NOR flash. So this macros represents that
bit.

>
> Should you use MmioOr32() here? (I can't tell, I don't have the docs)

Tested with MmioOr32() and that works as well. So updated the code.

Thanks,
Thomas.


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


[edk2] [Patch] Build spec: Add module scoped `<Pcd*>` section override scope statement

2018-05-22 Thread Yonghong Zhu
Cc: Liming Gao 
Cc: Michael Kinney 
Cc: Kevin W Shaw 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu 
---
 8_pre-build_autogen_stage/82_auto-generation_process.md | 7 ++-
 README.md   | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/8_pre-build_autogen_stage/82_auto-generation_process.md 
b/8_pre-build_autogen_stage/82_auto-generation_process.md
index b4b59db..8f8f29b 100644
--- a/8_pre-build_autogen_stage/82_auto-generation_process.md
+++ b/8_pre-build_autogen_stage/82_auto-generation_process.md
@@ -258,11 +258,11 @@ From the DSC file, the build tools collect the mapping 
between library classes
 and library instances (INF files), PCD data for the whole platform, the list of
 modules (INF files) specified for the platform, and the build output directory.
 Optionally, the name of the flash image layout description (FDF) file and build
 options specific to the platform are also obtained. Parsing FDF file at this
 time is just for the PCD information which might be used by some modules, and
-merge these PDC values into the information set of PCDs in DSC file.
+merge these PCD values into the information set of PCDs in DSC file.
 
 A PCD entry must only be listed once per section in the DSC or FDF files.
 
 Multiple library class instances for a single library class must not be
 specified in the same `[LibraryClasses]` or `` section in the
@@ -839,10 +839,15 @@ default method.
   listed in a `PcdsDynamicEx` section, then use DynamicEx.
 
 * If not listed in any of the previous sections, and the PCD is listed in the
   `PcdsDynamic` section, then use Dynamic.
 
+If the Platform Integrator does not specify the format, and the PCD state is
+in Platform DSC file `[Components]` section module scoped `` section, 
+then the PCD used in `[Components]` section module or its linked library INF
+files will use the module scoped `` type as default type.
+
 Build tools are required to process PCD values for `VOID*` PCDs into byte
 arrays, C format GUIDs or as C format strings (either ASCII or [L]"string")
 prior to autogenerating the code.
 
 PCD values stored in VPD regions are processed prior to completing the final
diff --git a/README.md b/README.md
index 9fb7e93..18e46c9 100644
--- a/README.md
+++ b/README.md
@@ -223,5 +223,6 @@ Copyright (c) 2008-2017, Intel Corporation. All rights 
reserved.
 || [#775](https://bugzilla.tianocore.org/show_bug.cgi?id=775) 
Build spec: Add description about auto detect thread number 


 |   |
 || Add Flexible PCD value format into spec 



|   |
 || Update PCD value and SKU, DefaultStore info in build report 



|   |
 || Clarify structure PCD field value assignment precedence 



|   |
 || Update description for build handles PCDs for SKU support   



|   |
+|| Add statement about module scoped `` section override 
scope   


 |  
 |
-- 
2.6.1.windows.1

___
edk2-devel 

[edk2] [PATCH] MdeModulePkg/PciBus: Use actual max bus # for subordinary bus #

2018-05-22 Thread Ruiyu Ni
Current code assumes the max bus(0xFF) is under this P2P bridge and
temporarily set it as subordinate bus.
It may cause silicon hangs during PCI enumeration in some specific
case.

Instead, it should get the max bus number from the bus number
resources returned from
PCI_HOST_BRIDGE_RESOURCE_ALLOCATION.StartBusEnumeration() and set it
as subordinate bus.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Star Zeng 
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 39 -
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
index 976496379a..729e86b55e 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
@@ -29,6 +29,43 @@ CHAR16 *mBarTypeStr[] = {
   L"Unknow"
   };
 
+/**
+  Retrieve the max bus number that is assigned to the Root Bridge hierarchy.
+  It can support the case that there are multiple bus ranges.
+
+  @param  Bridge   Bridge device instance.
+
+  @retval  The max bus number that is assigned to this Root 
Bridge hierarchy.
+
+**/
+UINT16
+PciGetMaxBusNumber (
+  IN PCI_IO_DEVICE  *Bridge
+  )
+{
+  PCI_IO_DEVICE  *RootBridge;
+  EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR  *BusNumberRanges;
+  UINT64 MaxNumberInRange;
+
+  //
+  // Get PCI Root Bridge device
+  //
+  RootBridge = Bridge;
+  while (RootBridge->Parent != NULL) {
+RootBridge = RootBridge->Parent;
+  }
+  MaxNumberInRange = 0;
+  //
+  // Get next available PCI bus number
+  //
+  BusNumberRanges = RootBridge->BusNumberRanges;
+  while (BusNumberRanges->Desc != ACPI_END_TAG_DESCRIPTOR) {
+MaxNumberInRange = BusNumberRanges->AddrRangeMin + 
BusNumberRanges->AddrLen - 1;
+BusNumberRanges++;
+  }
+  return (UINT16) MaxNumberInRange;
+}
+
 /**
   Retrieve the PCI Card device BAR information via PciIo interface.
 
@@ -1193,7 +1230,7 @@ PciScanBus (
   // Temporarily initialize SubBusNumber to maximum bus number to 
ensure the
   // PCI configuration transaction to go through any PPB
   //
-  Register  = 0xFF;
+  Register  = PciGetMaxBusNumber (Bridge);
   Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 
PCI_BRIDGE_SUBORDINATE_BUS_REGISTER_OFFSET);
   Status = PciRootBridgeIo->Pci.Write (
   PciRootBridgeIo,
-- 
2.16.1.windows.1

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


Re: [edk2] [Patch v2 0/5] Remove X86 ASM and S files

2018-05-22 Thread Zeng, Star
Reviewed-by: Star Zeng  to MdeModulePkg changes.


Thanks,
Star
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Liming 
Gao
Sent: Friday, May 18, 2018 5:32 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch v2 0/5] Remove X86 ASM and S files

For IA32 and X64, NASM has replaced ASM and S files.
1. Remove ASM from all modules.
2. Remove S files from the drivers only.
3. https://bugzilla.tianocore.org/show_bug.cgi?id=881
After NASM is updated, S files can be removed from Library.

V2:
Update commit message.

The patch set are in https://github.com/lgao4/edk2/tree/AsmClean

Liming Gao (5):
  IntelFrameworkModulePkg: Remove X86 ASM and S files
  MdeModulePkg: Remove X86 ASM and S files
  MdePkg: Remove X86 ASM and S files
  SourceLevelDebugPkg: Remove X86 ASM and S files
  UefiCpuPkg: Remove X86 ASM and S files

 .../Csm/LegacyBiosDxe/IA32/InterruptTable.S|  67 ---
 .../Csm/LegacyBiosDxe/IA32/InterruptTable.asm  |  73 ---
 .../Csm/LegacyBiosDxe/LegacyBiosDxe.inf|   4 -
 .../Csm/LegacyBiosDxe/X64/InterruptTable.S |  72 ---
 .../Csm/LegacyBiosDxe/X64/InterruptTable.asm   |  71 ---
 MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf|   2 -
 MdeModulePkg/Core/DxeIplPeim/Ia32/IdtVectorAsm.S   |  80 ---
 MdeModulePkg/Core/DxeIplPeim/Ia32/IdtVectorAsm.asm |  88 ---
 .../BootScriptExecutorDxe.inf  |   4 -
 .../Acpi/BootScriptExecutorDxe/IA32/S3Asm.S|  66 ---
 .../Acpi/BootScriptExecutorDxe/IA32/S3Asm.asm  |  71 ---
 .../Acpi/BootScriptExecutorDxe/X64/S3Asm.S | 130 -
 .../Acpi/BootScriptExecutorDxe/X64/S3Asm.asm   | 135 -
 MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf   |   2 -
 .../Universal/CapsulePei/X64/PageFaultHandler.S|  81 ---
 .../Universal/CapsulePei/X64/PageFaultHandler.asm  |  87 ---
 .../Universal/DebugSupportDxe/DebugSupportDxe.inf  |   4 -
 .../Universal/DebugSupportDxe/Ia32/AsmFuncs.S  | 407 --
 .../Universal/DebugSupportDxe/Ia32/AsmFuncs.asm| 509 --
 .../Universal/DebugSupportDxe/X64/AsmFuncs.S   | 551 ---
 .../Universal/DebugSupportDxe/X64/AsmFuncs.asm | 596 -
 MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf  |   4 -
 MdeModulePkg/Universal/EbcDxe/EbcDxe.inf   |   4 -
 MdeModulePkg/Universal/EbcDxe/Ia32/EbcLowLevel.S   |  83 ---
 MdeModulePkg/Universal/EbcDxe/Ia32/EbcLowLevel.asm | 207 ---
 MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.S| 147 -
 MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.asm  | 246 -
 MdePkg/Library/BaseCpuLib/BaseCpuLib.inf   |   4 -
 MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.asm |  40 --
 MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.asm|  39 --
 MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.asm  |  38 --
 MdePkg/Library/BaseCpuLib/X64/CpuSleep.asm |  37 --
 .../BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf  |   2 -
 MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.asm  | 141 -
 MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.asm   | 127 -
 MdePkg/Library/BaseLib/BaseLib.inf | 246 -
 MdePkg/Library/BaseLib/Ia32/ARShiftU64.asm |  48 --
 MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.asm  |  40 --
 MdePkg/Library/BaseLib/Ia32/CpuId.asm  |  66 ---
 MdePkg/Library/BaseLib/Ia32/CpuIdEx.asm|  68 ---
 MdePkg/Library/BaseLib/Ia32/CpuPause.asm   |  40 --
 MdePkg/Library/BaseLib/Ia32/DisableCache.asm   |  45 --
 MdePkg/Library/BaseLib/Ia32/DisableInterrupts.asm  |  40 --
 MdePkg/Library/BaseLib/Ia32/DisablePaging32.asm|  57 --
 MdePkg/Library/BaseLib/Ia32/DivU64x32.asm  |  46 --
 MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.asm |  51 --  
MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.asm |  92 
 MdePkg/Library/BaseLib/Ia32/EnableCache.asm|  45 --
 .../BaseLib/Ia32/EnableDisableInterrupts.asm   |  41 --
 MdePkg/Library/BaseLib/Ia32/EnableInterrupts.asm   |  40 --
 MdePkg/Library/BaseLib/Ia32/EnablePaging32.asm |  57 --
 MdePkg/Library/BaseLib/Ia32/EnablePaging64.asm |  68 ---
 MdePkg/Library/BaseLib/Ia32/FlushCacheLine.asm |  55 --
 MdePkg/Library/BaseLib/Ia32/FxRestore.asm  |  42 --
 MdePkg/Library/BaseLib/Ia32/FxSave.asm |  42 --
 MdePkg/Library/BaseLib/Ia32/Invd.asm   |  40 --
 MdePkg/Library/BaseLib/Ia32/LRotU64.asm|  51 --
 MdePkg/Library/BaseLib/Ia32/LShiftU64.asm  |  48 --
 MdePkg/Library/BaseLib/Ia32/LongJump.asm   |  46 --
 MdePkg/Library/BaseLib/Ia32/ModU64x32.asm  |  45 --
 MdePkg/Library/BaseLib/Ia32/Monitor.asm|  45 --
 MdePkg/Library/BaseLib/Ia32/MultU64x32.asm |  43 --
 MdePkg/Library/BaseLib/Ia32/MultU64x64.asm |  47 --
 MdePkg/Library/BaseLib/Ia32/Mwait.asm  |  43 --
 MdePkg/Library/BaseLib/Ia32/RRotU64.asm|  51 --
 

Re: [edk2] [Patch v2 0/5] Remove X86 ASM and S files

2018-05-22 Thread Ni, Ruiyu
""SourceLevelDebugPkg: Remove X86 ASM and S files" looks good.

Reviewed-by: Ruiyu Ni 

Thanks/Ray

> -Original Message-
> From: edk2-devel  On Behalf Of Liming
> Gao
> Sent: Friday, May 18, 2018 5:32 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch v2 0/5] Remove X86 ASM and S files
> 
> For IA32 and X64, NASM has replaced ASM and S files.
> 1. Remove ASM from all modules.
> 2. Remove S files from the drivers only.
> 3. https://bugzilla.tianocore.org/show_bug.cgi?id=881
> After NASM is updated, S files can be removed from Library.
> 
> V2:
> Update commit message.
> 
> The patch set are in https://github.com/lgao4/edk2/tree/AsmClean
> 
> Liming Gao (5):
>   IntelFrameworkModulePkg: Remove X86 ASM and S files
>   MdeModulePkg: Remove X86 ASM and S files
>   MdePkg: Remove X86 ASM and S files
>   SourceLevelDebugPkg: Remove X86 ASM and S files
>   UefiCpuPkg: Remove X86 ASM and S files
> 
>  .../Csm/LegacyBiosDxe/IA32/InterruptTable.S|  67 ---
>  .../Csm/LegacyBiosDxe/IA32/InterruptTable.asm  |  73 ---
>  .../Csm/LegacyBiosDxe/LegacyBiosDxe.inf|   4 -
>  .../Csm/LegacyBiosDxe/X64/InterruptTable.S |  72 ---
>  .../Csm/LegacyBiosDxe/X64/InterruptTable.asm   |  71 ---
>  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf|   2 -
>  MdeModulePkg/Core/DxeIplPeim/Ia32/IdtVectorAsm.S   |  80 ---
>  MdeModulePkg/Core/DxeIplPeim/Ia32/IdtVectorAsm.asm |  88 ---
>  .../BootScriptExecutorDxe.inf  |   4 -
>  .../Acpi/BootScriptExecutorDxe/IA32/S3Asm.S|  66 ---
>  .../Acpi/BootScriptExecutorDxe/IA32/S3Asm.asm  |  71 ---
>  .../Acpi/BootScriptExecutorDxe/X64/S3Asm.S | 130 -
>  .../Acpi/BootScriptExecutorDxe/X64/S3Asm.asm   | 135 -
>  MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf   |   2 -
>  .../Universal/CapsulePei/X64/PageFaultHandler.S|  81 ---
>  .../Universal/CapsulePei/X64/PageFaultHandler.asm  |  87 ---
>  .../Universal/DebugSupportDxe/DebugSupportDxe.inf  |   4 -
>  .../Universal/DebugSupportDxe/Ia32/AsmFuncs.S  | 407 --
>  .../Universal/DebugSupportDxe/Ia32/AsmFuncs.asm| 509 --
>  .../Universal/DebugSupportDxe/X64/AsmFuncs.S   | 551 ---
>  .../Universal/DebugSupportDxe/X64/AsmFuncs.asm | 596 ---
> --
>  MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf  |   4 -
>  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf   |   4 -
>  MdeModulePkg/Universal/EbcDxe/Ia32/EbcLowLevel.S   |  83 ---
>  MdeModulePkg/Universal/EbcDxe/Ia32/EbcLowLevel.asm | 207 ---
>  MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.S| 147 -
>  MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.asm  | 246 -
>  MdePkg/Library/BaseCpuLib/BaseCpuLib.inf   |   4 -
>  MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.asm |  40 --
>  MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.asm|  39 --
>  MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.asm  |  38 --
>  MdePkg/Library/BaseCpuLib/X64/CpuSleep.asm |  37 --
>  .../BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf  |   2 -
>  MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.asm  | 141 -
>  MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.asm   | 127 -
>  MdePkg/Library/BaseLib/BaseLib.inf | 246 -
>  MdePkg/Library/BaseLib/Ia32/ARShiftU64.asm |  48 --
>  MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.asm  |  40 --
>  MdePkg/Library/BaseLib/Ia32/CpuId.asm  |  66 ---
>  MdePkg/Library/BaseLib/Ia32/CpuIdEx.asm|  68 ---
>  MdePkg/Library/BaseLib/Ia32/CpuPause.asm   |  40 --
>  MdePkg/Library/BaseLib/Ia32/DisableCache.asm   |  45 --
>  MdePkg/Library/BaseLib/Ia32/DisableInterrupts.asm  |  40 --
>  MdePkg/Library/BaseLib/Ia32/DisablePaging32.asm|  57 --
>  MdePkg/Library/BaseLib/Ia32/DivU64x32.asm  |  46 --
>  MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.asm |  51 --
> MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.asm |  92 
>  MdePkg/Library/BaseLib/Ia32/EnableCache.asm|  45 --
>  .../BaseLib/Ia32/EnableDisableInterrupts.asm   |  41 --
>  MdePkg/Library/BaseLib/Ia32/EnableInterrupts.asm   |  40 --
>  MdePkg/Library/BaseLib/Ia32/EnablePaging32.asm |  57 --
>  MdePkg/Library/BaseLib/Ia32/EnablePaging64.asm |  68 ---
>  MdePkg/Library/BaseLib/Ia32/FlushCacheLine.asm |  55 --
>  MdePkg/Library/BaseLib/Ia32/FxRestore.asm  |  42 --
>  MdePkg/Library/BaseLib/Ia32/FxSave.asm |  42 --
>  MdePkg/Library/BaseLib/Ia32/Invd.asm   |  40 --
>  MdePkg/Library/BaseLib/Ia32/LRotU64.asm|  51 --
>  MdePkg/Library/BaseLib/Ia32/LShiftU64.asm  |  48 --
>  MdePkg/Library/BaseLib/Ia32/LongJump.asm   |  46 --
>  MdePkg/Library/BaseLib/Ia32/ModU64x32.asm  |  45 --
>  MdePkg/Library/BaseLib/Ia32/Monitor.asm|  45 --
>  MdePkg/Library/BaseLib/Ia32/MultU64x32.asm |  43 --
>  

Re: [edk2] [PATCH v2] MdePkg/Hpet: Add Event Timer Block ID definition.

2018-05-22 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>Marvin H?user
>Sent: Thursday, May 17, 2018 8:42 PM
>To: edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Gao, Liming
>
>Subject: [edk2] [PATCH v2] MdePkg/Hpet: Add Event Timer Block ID definition.
>
>This patch adds the HPET Event Timer Block ID definition that can be
>found in the IA-PC HPET Specification, section 3.2.4.
>
>V2:
>  - Do not change the copyright date as requested.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Marvin Haeuser 
>---
> MdePkg/Include/IndustryStandard/HighPrecisionEventTimerTable.h | 16
>
> 1 file changed, 16 insertions(+)
>
>diff --git
>a/MdePkg/Include/IndustryStandard/HighPrecisionEventTimerTable.h
>b/MdePkg/Include/IndustryStandard/HighPrecisionEventTimerTable.h
>index 0d83cd5335de..6218a77c543c 100644
>--- a/MdePkg/Include/IndustryStandard/HighPrecisionEventTimerTable.h
>+++ b/MdePkg/Include/IndustryStandard/HighPrecisionEventTimerTable.h
>@@ -22,6 +22,22 @@
> //
> #pragma pack(1)
>
>+///
>+/// HPET Event Timer Block ID described in IA-PC HPET Specification, 3.2.4.
>+///
>+typedef union {
>+  struct {
>+UINT32 Revision   : 8;
>+UINT32 NumberOfTimers : 5;
>+UINT32 CounterSize: 1;
>+UINT32 Reserved   : 1;
>+UINT32 LegacyRoute: 1;
>+UINT32 VendorId   : 16;
>+  }  Bits;
>+  UINT32 Uint32;
>+} EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_BLOCK_ID;
>+
>+
> ///
> /// High Precision Event Timer Table header definition.
> ///
>--
>2.17.0.windows.1
>
>___
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2] MdePkg: Update MmSwDispatch.h's references to SmmSw2Dispatch.

2018-05-22 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Marvin Häuser [mailto:marvin.haeu...@outlook.com]
>Sent: Thursday, May 17, 2018 8:42 PM
>To: edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Gao, Liming
>
>Subject: [PATCH v2] MdePkg: Update MmSwDispatch.h's references to
>SmmSw2Dispatch.
>
>MmSwDispatch.h current refers to the deprecated SmmSw2Dispatch
>protocol. Replace those references with the new MmSwDispatch name.
>
>V2:
>  - Do not change the copyright date as requested.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Marvin Haeuser 
>---
> MdePkg/Include/Protocol/MmSwDispatch.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/MdePkg/Include/Protocol/MmSwDispatch.h
>b/MdePkg/Include/Protocol/MmSwDispatch.h
>index d3acb64e6f3d..e412bb2e66c0 100644
>--- a/MdePkg/Include/Protocol/MmSwDispatch.h
>+++ b/MdePkg/Include/Protocol/MmSwDispatch.h
>@@ -15,8 +15,8 @@
>
> **/
>
>-#ifndef _MM_SW_DISPATCH2_H_
>-#define _MM_SW_DISPATCH2_H_
>+#ifndef _MM_SW_DISPATCH_H_
>+#define _MM_SW_DISPATCH_H_
>
> #include 
>
>@@ -117,7 +117,7 @@ EFI_STATUS
> ///
> /// Interface structure for the MM Software MMI Dispatch Protocol.
> ///
>-/// The EFI_MM_SW_DISPATCH2_PROTOCOL provides the ability to install
>child handlers for the
>+/// The EFI_MM_SW_DISPATCH_PROTOCOL provides the ability to install
>child handlers for the
> /// given software.  These handlers will respond to software interrupts, and
>the maximum software
> /// interrupt in the EFI_MM_SW_REGISTER_CONTEXT is denoted by
>MaximumSwiValue.
> ///
>--
>2.17.0.windows.1

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


Re: [edk2] [PATCH] BaseTools: Rename String to StringUtils.

2018-05-22 Thread Gao, Liming
This patch passes my platform. 

Reviewed-by: Liming Gao 

> -Original Message-
> From: Gao, Liming
> Sent: Monday, May 21, 2018 9:00 AM
> To: marvin.haeu...@outlook.com; edk2-devel@lists.01.org
> Cc: Zhu, Yonghong ; Gao, Liming 
> Subject: RE: [PATCH] BaseTools: Rename String to StringUtils.
> 
> Marvin:
>   Thanks. This is a good enhancement. I will verify it in my platform and let 
> you know the result.
> 
> Thanks
> Liming
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> > Marvin H?user
> > Sent: Saturday, May 19, 2018 6:50 PM
> > To: edk2-devel@lists.01.org
> > Cc: Gao, Liming 
> > Subject: [edk2] [PATCH] BaseTools: Rename String to StringUtils.
> >
> > For case-insensitive file systems, edk2 String.py collides with the
> > Python string.py, which results in build errors. This,for example,
> > applies to building via the Windows Subsystem for Linux from a
> > DriveFS file system. This patch renames String to StringUtils to
> > prevent conflicts for case-insensitive file systems.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Marvin Haeuser 
> > ---
> >  BaseTools/Source/Python/AutoGen/AutoGen.py| 2 +-
> >  BaseTools/Source/Python/AutoGen/BuildEngine.py| 2 +-
> >  BaseTools/Source/Python/AutoGen/GenC.py   | 2 +-
> >  BaseTools/Source/Python/AutoGen/GenMake.py| 2 +-
> >  BaseTools/Source/Python/AutoGen/GenPcdDb.py   | 2 +-
> >  BaseTools/Source/Python/AutoGen/IdfClassObject.py | 2 +-
> >  BaseTools/Source/Python/AutoGen/UniClassObject.py | 2 +-
> >  BaseTools/Source/Python/Common/Database.py| 2 +-
> >  BaseTools/Source/Python/Common/Parsing.py | 2 +-
> >  BaseTools/Source/Python/Common/{String.py => StringUtils.py}  | 0
> >  BaseTools/Source/Python/Common/ToolDefClassObject.py  | 2 +-
> >  BaseTools/Source/Python/Ecc/Configuration.py  | 2 +-
> >  BaseTools/Source/Python/Ecc/Ecc.py| 2 +-
> >  BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py   | 2 +-
> >  BaseTools/Source/Python/Eot/Eot.py| 2 +-
> >  BaseTools/Source/Python/Eot/InfParserLite.py  | 2 +-
> >  BaseTools/Source/Python/Eot/Parser.py | 4 ++--
> >  BaseTools/Source/Python/GenFds/AprioriSection.py  | 2 +-
> >  BaseTools/Source/Python/GenFds/FdfParser.py   | 4 ++--
> >  BaseTools/Source/Python/GenFds/FfsInfStatement.py | 2 +-
> >  BaseTools/Source/Python/GenFds/GenFds.py  | 2 +-
> >  BaseTools/Source/Python/GenFds/OptRomInfStatement.py  | 2 +-
> >  BaseTools/Source/Python/Makefile  | 4 ++--
> >  BaseTools/Source/Python/Table/TableDataModel.py   | 2 +-
> >  BaseTools/Source/Python/Table/TableDec.py | 2 +-
> >  BaseTools/Source/Python/Table/TableDsc.py | 2 +-
> >  BaseTools/Source/Python/Table/TableEotReport.py   | 2 +-
> >  BaseTools/Source/Python/Table/TableFdf.py | 2 +-
> >  BaseTools/Source/Python/Table/TableFile.py| 2 +-
> >  BaseTools/Source/Python/Table/TableFunction.py| 2 +-
> >  BaseTools/Source/Python/Table/TableIdentifier.py  | 2 +-
> >  BaseTools/Source/Python/Table/TableInf.py | 2 +-
> >  BaseTools/Source/Python/Table/TablePcd.py | 2 +-
> >  BaseTools/Source/Python/Table/TableQuery.py   | 2 +-
> >  BaseTools/Source/Python/Table/TableReport.py  | 2 +-
> >  BaseTools/Source/Python/UPT/Library/{String.py => StringUtils.py} | 0
> >  BaseTools/Source/Python/Workspace/DecBuildData.py | 2 +-
> >  BaseTools/Source/Python/Workspace/DscBuildData.py | 2 +-
> >  BaseTools/Source/Python/Workspace/InfBuildData.py | 2 +-
> >  BaseTools/Source/Python/Workspace/MetaFileParser.py   | 2 +-
> >  BaseTools/Source/Python/Workspace/WorkspaceDatabase.py| 2 +-
> >  BaseTools/Source/Python/build/BuildReport.py  | 2 +-
> >  42 files changed, 43 insertions(+), 43 deletions(-)
> >
> > diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
> > b/BaseTools/Source/Python/AutoGen/AutoGen.py
> > index 1e6511cdb5d2..4304967aee42 100644
> > --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> > +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> > @@ -33,7 +33,7 @@ from Common.LongFilePathSupport import CopyLongFilePath
> >  from 

Re: [edk2] [PATCH 3/6] MdePkg/UefiLib: introduce EfiAllocatePeiAccessiblePages routine

2018-05-22 Thread Zeng, Star

On 2018/5/23 3:11, Laszlo Ersek wrote:

On 05/22/18 19:47, Ard Biesheuvel wrote:


OK, to summarize:
- move the implementation of EfiAllocatePeiAccessiblePages() to
DxeServicesLib (and perhaps rename it to something more appropriate
for its new home)
- only restrict the X64 version to below 4 GB if EfiMemoryTop and
EfiFreeMemoryTop are both below 4 GB.


Just checking EfiFreeMemoryTop should be enough as EfiFreeMemoryTop 
means the capable TOP to be allocated.


And seemingly, there is an assumption here that next boot PEI S3 has 
same situation with current boot PEI.



Thanks,
Star


If this works with pure X64 OVMF (including S3 without SMM), I'd be very
happy with it.

Also we should regression test whether IA32X64 OVMF continues working
(including S3 without SMM, and S3 with SMM).

I'm glad to help with the testing once patches are posted.

OVMF installs the permanent PEI RAM in PublishPeiMemory()
[OvmfPkg/PlatformPei/MemDetect.c]. It keeps things under 4GB, so I think
this approach should work.

Thanks Ard & Mike!
Laszlo



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


Re: [edk2] [PATCH 3/6] MdePkg/UefiLib: introduce EfiAllocatePeiAccessiblePages routine

2018-05-22 Thread Zeng, Star

On 2018/5/22 22:08, Ard Biesheuvel wrote:

Add a routine to UefiLib that abstracts the allocation of memory that
should be accessible by PEI after a warm reboot. We will use it to


Glad to see this patch series.

It is the case "PEI for S3", but not "PEI after a warm reboot".


Thanks,
Star


replace open coded implementations that limit the address to < 4 GB,
which may not be possible on non-Intel systems that have no 32-bit
addressable memory at all.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
  MdePkg/Include/Library/UefiLib.h | 23 ++
  MdePkg/Library/UefiLib/UefiLib.c | 48 
  2 files changed, 71 insertions(+)

diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/UefiLib.h
index 256498e3fd8d..8fa077af41e0 100644
--- a/MdePkg/Include/Library/UefiLib.h
+++ b/MdePkg/Include/Library/UefiLib.h
@@ -1520,4 +1520,27 @@ EfiLocateProtocolBuffer (
OUT UINTN *NoProtocols,
OUT VOID  ***Buffer
);
+
+/**
+  Allocates one or more 4KB pages of a given type from a memory region that is
+  accessible to PEI.
+
+  Allocates the number of 4KB pages of type 'MemoryType' and returns a
+  pointer to the allocated buffer.  The buffer returned is aligned on a 4KB
+  boundary.  If Pages is 0, then NULL is returned.  If there is not enough
+  memory remaining to satisfy the request, then NULL is returned.
+
+  @param[in]  MemoryTypeThe memory type to allocate
+  @param[in]  Pages The number of 4 KB pages to allocate.
+
+  @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID *
+EFIAPI
+EfiAllocatePeiAccessiblePages (
+  IN EFI_MEMORY_TYPE  MemoryType,
+  IN UINTNPages
+  );
+
  #endif
diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/UefiLib.c
index ba449a1c34ce..3a9d75149dd7 100644
--- a/MdePkg/Library/UefiLib/UefiLib.c
+++ b/MdePkg/Library/UefiLib/UefiLib.c
@@ -1715,3 +1715,51 @@ EfiLocateProtocolBuffer (
  
return EFI_SUCCESS;

  }
+
+/**
+  Allocates one or more 4KB pages of a given type from a memory region that is
+  accessible to PEI.
+
+  Allocates the number of 4KB pages of type 'MemoryType' and returns a
+  pointer to the allocated buffer.  The buffer returned is aligned on a 4KB
+  boundary.  If Pages is 0, then NULL is returned.  If there is not enough
+  memory remaining to satisfy the request, then NULL is returned.
+
+  @param[in]  MemoryTypeThe memory type to allocate
+  @param[in]  Pages The number of 4 KB pages to allocate.
+
+  @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID *
+EFIAPI
+EfiAllocatePeiAccessiblePages (
+  IN EFI_MEMORY_TYPE  MemoryType,
+  IN UINTNPages
+  )
+{
+  EFI_STATUSStatus;
+  EFI_PHYSICAL_ADDRESS  Memory;
+  EFI_ALLOCATE_TYPE AllocType;
+
+  if (Pages == 0) {
+return NULL;
+  }
+
+#ifdef MDE_CPU_X64
+  //
+  // On X64 systems, a X64 build of DXE may be combined with a 32-bit build of
+  // PEI, and so we need to allocate below 4 GB to ensure that the allocation
+  // is accessible by PEI.
+  //
+  AllocType = AllocateMaxAddress;
+  Memory = MAX_UINT32;
+#else
+  AllocType = AllocateAnyPages;
+#endif
+  Status = gBS->AllocatePages (AllocType, MemoryType, Pages, );
+  if (EFI_ERROR (Status)) {
+return NULL;
+  }
+  return (VOID *)(UINTN)Memory;
+}



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


Re: [edk2] [Patch 2/2] MdePkg/TcgStorage*.h: Fix ECC reported issues.

2018-05-22 Thread Bi, Dandan
Reviewed-by: Dandan Bi 

And these changes are in SecurityPkg not MdePkg.
Please update the package name in the subject of the patch before commit.


Thanks,
Dandan

-Original Message-
From: Dong, Eric 
Sent: Tuesday, May 22, 2018 1:51 PM
To: edk2-devel@lists.01.org
Cc: Bi, Dandan 
Subject: [Patch 2/2] MdePkg/TcgStorage*.h: Fix ECC reported issues.

Cc: Dandan Bi 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong 
---
 SecurityPkg/Include/Library/TcgStorageCoreLib.h|  2 +-
 SecurityPkg/Include/Library/TcgStorageOpalLib.h| 12 ++--
 SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalUtil.c |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/SecurityPkg/Include/Library/TcgStorageCoreLib.h 
b/SecurityPkg/Include/Library/TcgStorageCoreLib.h
index 97f9a9f968..6e178c968f 100644
--- a/SecurityPkg/Include/Library/TcgStorageCoreLib.h
+++ b/SecurityPkg/Include/Library/TcgStorageCoreLib.h
@@ -2,7 +2,7 @@
   Public API for the Tcg Core library to perform the lowest level TCG Data 
encoding.
   
   (TCG Storage Architecture Core Specification, Version 2.01, Revision 1.00,
-  
@https://trustedcomputinggroup.org/tcg-storage-architecture-core-specification/)
+  
https://trustedcomputinggroup.org/tcg-storage-architecture-core-specification/)
 
   Check http://trustedcomputinggroup.org for latest specification updates.
 
diff --git a/SecurityPkg/Include/Library/TcgStorageOpalLib.h 
b/SecurityPkg/Include/Library/TcgStorageOpalLib.h
index b3092eb5cd..33f8fee183 100644
--- a/SecurityPkg/Include/Library/TcgStorageOpalLib.h
+++ b/SecurityPkg/Include/Library/TcgStorageOpalLib.h
@@ -2,22 +2,22 @@
   Public API for Opal Core library.
 
   (TCG Storage Architecture Core Specification, Version 2.01, Revision 1.00,
-  
@https://trustedcomputinggroup.org/tcg-storage-architecture-core-specification/
+  
https://trustedcomputinggroup.org/tcg-storage-architecture-core-specification/
 
   Storage Work Group Storage Security Subsystem Class: Pyrite, Version 1.00 
Final, Revision 1.00,
-  
@https://trustedcomputinggroup.org/tcg-storage-security-subsystem-class-pyrite/
+  
https://trustedcomputinggroup.org/tcg-storage-security-subsystem-class-pyrite/
 
   Storage Work Group Storage Security Subsystem Class: Opal, Version 2.01 
Final, Revision 1.00,
-  
@https://trustedcomputinggroup.org/storage-work-group-storage-security-subsystem-class-opal/
+  
https://trustedcomputinggroup.org/storage-work-group-storage-security-subsystem-class-opal/
 
   TCG Storage Security Subsystem Class: Opalite Version 1.00 Revision 1.00,
-  
@https://trustedcomputinggroup.org/tcg-storage-security-subsystem-class-opalite/
+  
https://trustedcomputinggroup.org/tcg-storage-security-subsystem-class-opalite/
 
   TCG Storage Feature Set: Block SID Authentication, Version 1.00 Final, 
Revision 1.00,
-  
@https://trustedcomputinggroup.org/tcg-storage-feature-set-block-sid-authentication-specification/
+  
https://trustedcomputinggroup.org/tcg-storage-feature-set-block-sid-authentication-specification/
 
   TCG Storage Opal SSC Feature Set: PSID Version 1.00, Revision 1.00,
-  @https://trustedcomputinggroup.org/tcg-storage-opal-feature-set-psid/)
+  https://trustedcomputinggroup.org/tcg-storage-opal-feature-set-psid/)
 
   Check http://trustedcomputinggroup.org for latest specification updates.
 
diff --git a/SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalUtil.c 
b/SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalUtil.c
index a8bf3a9160..ca8e7fbbdf 100644
--- a/SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalUtil.c
+++ b/SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalUtil.c
@@ -981,7 +981,7 @@ OpalUtilGetActiveDataRemovalMechanism (
 /**
   Calculate the estimated time.
 
-  @param[in]  IsMinite   Whether the input time value is 
minute type or second type.
+  @param[in]  IsMinute   Whether the input time value is 
minute type or second type.
   @param[in]  Time   The input time value.
 
 **/
-- 
2.15.0.windows.1

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


Re: [edk2] [Patch 1/2] MdePkg/TcgStorage*.h: Fixed ECC reported issues.

2018-05-22 Thread Bi, Dandan
Reviewed-by: Dandan Bi 

Thanks,
Dandan

-Original Message-
From: Dong, Eric 
Sent: Tuesday, May 22, 2018 1:51 PM
To: edk2-devel@lists.01.org
Cc: Bi, Dandan 
Subject: [Patch 1/2] MdePkg/TcgStorage*.h: Fixed ECC reported issues.

Cc: Dandan Bi 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong 
---
 MdePkg/Include/IndustryStandard/TcgStorageCore.h | 2 +-  
MdePkg/Include/IndustryStandard/TcgStorageOpal.h | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/MdePkg/Include/IndustryStandard/TcgStorageCore.h 
b/MdePkg/Include/IndustryStandard/TcgStorageCore.h
index ab121722ba..0b2852e92d 100644
--- a/MdePkg/Include/IndustryStandard/TcgStorageCore.h
+++ b/MdePkg/Include/IndustryStandard/TcgStorageCore.h
@@ -2,7 +2,7 @@
   TCG defined values and structures.
 
   (TCG Storage Architecture Core Specification, Version 2.01, Revision 1.00,
-  
@https://trustedcomputinggroup.org/tcg-storage-architecture-core-specification/)
+  
+ https://trustedcomputinggroup.org/tcg-storage-architecture-core-specif
+ ication/)
 
   Check http://trustedcomputinggroup.org for latest specification updates.
 
diff --git a/MdePkg/Include/IndustryStandard/TcgStorageOpal.h 
b/MdePkg/Include/IndustryStandard/TcgStorageOpal.h
index ace7309cee..e8f313c3d3 100644
--- a/MdePkg/Include/IndustryStandard/TcgStorageOpal.h
+++ b/MdePkg/Include/IndustryStandard/TcgStorageOpal.h
@@ -2,16 +2,16 @@
   Opal Specification defined values and structures.
 
   (TCG Storage Architecture Core Specification, Version 2.01, Revision 1.00,
-  
@https://trustedcomputinggroup.org/tcg-storage-architecture-core-specification/
+  
+ https://trustedcomputinggroup.org/tcg-storage-architecture-core-specif
+ ication/
 
   Storage Work Group Storage Security Subsystem Class: Pyrite, Version 1.00 
Final, Revision 1.00,
-  
@https://trustedcomputinggroup.org/tcg-storage-security-subsystem-class-pyrite/
+  
+ https://trustedcomputinggroup.org/tcg-storage-security-subsystem-class
+ -pyrite/
 
   Storage Work Group Storage Security Subsystem Class: Opal, Version 2.01 
Final, Revision 1.00,
-  
@https://trustedcomputinggroup.org/storage-work-group-storage-security-subsystem-class-opal/
+  
+ https://trustedcomputinggroup.org/storage-work-group-storage-security-
+ subsystem-class-opal/
 
   TCG Storage Security Subsystem Class: Opalite Version 1.00 Revision 1.00,
-  
@https://trustedcomputinggroup.org/tcg-storage-security-subsystem-class-opalite/)
+  
+ https://trustedcomputinggroup.org/tcg-storage-security-subsystem-class
+ -opalite/)
 
   Check http://trustedcomputinggroup.org for latest specification updates.
 
--
2.15.0.windows.1

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


Re: [edk2] Booting ISO gives `Reloc 0 block size 2756420659 is invalid`

2018-05-22 Thread Laszlo Ersek
Hi Paul,

On 05/22/18 16:50, Paul Menzel wrote:
> Dear EDK2 folks,
> 
> 
> On the two Dell laptops XPS 13 9360 and 9370 and with OVMF and QEMU the
> Grml live image [1] cannot be started from a USB device.
> 
> The error on the display is:
> 
>> Reloc 0 block size 2756420659 is invalid
>> Relocation failed: Unsupported
>> Failed to load image: Unsupported
>> start_image() returned Unsupported
> 
> With OVMF I only the the first two lines.
> 
> Unfortunately, I do not know where the error comes from. Is it a GRU
> problem?

These messages are printed by the "shim" UEFI application:

  https://github.com/rhboot/shim/blob/master/shim.c

probably when it attempts to load "grub".

I suggest reporting the issue at
. (Perhaps this issue has been
reported already, I'm not sure.)

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


[edk2] Booting ISO gives `Reloc 0 block size 2756420659 is invalid`

2018-05-22 Thread Paul Menzel

Dear EDK2 folks,


On the two Dell laptops XPS 13 9360 and 9370 and with OVMF and QEMU the 
Grml live image [1] cannot be started from a USB device.


The error on the display is:


Reloc 0 block size 2756420659 is invalid
Relocation failed: Unsupported
Failed to load image: Unsupported
start_image() returned Unsupported


With OVMF I only the the first two lines.

Unfortunately, I do not know where the error comes from. Is it a GRU 
problem?


Here is how you can reproduce this with QEMU.

Download the ISO file [2], and follow *How to run OVMF* in the Wiki [3]. 
I downloaded Gerd’s prebuilt images [4] and extracted them.


Then I did `mkdir hda-contents` and run QEMU with the command below.

qemu-system-x86_64 -enable-kvm -bios 
edk2.git/ovmf-x64/OVMF-pure-efi.fd -hda fat:hda-contents -net none -hdb 
~/Downloads/grml64-full_sid_latest.iso



Kind regards,

Paul


[1] https://grml.org/daily/
[2] https://daily.grml.org/grml64-full_sid/latest/grml64-full_sid_latest.iso
[3] https://github.com/tianocore/tianocore.github.io/wiki/How-to-run-OVMF
[4] 
https://www.kraxel.org/repos/jenkins/edk2/edk2.git-ovmf-x64-0-20180508.84.g7cd8a57599.noarch.rpm


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


Re: [edk2] [PATCH 3/6] MdePkg/UefiLib: introduce EfiAllocatePeiAccessiblePages routine

2018-05-22 Thread Laszlo Ersek
On 05/22/18 19:47, Ard Biesheuvel wrote:

> OK, to summarize:
> - move the implementation of EfiAllocatePeiAccessiblePages() to
> DxeServicesLib (and perhaps rename it to something more appropriate
> for its new home)
> - only restrict the X64 version to below 4 GB if EfiMemoryTop and
> EfiFreeMemoryTop are both below 4 GB.

If this works with pure X64 OVMF (including S3 without SMM), I'd be very
happy with it.

Also we should regression test whether IA32X64 OVMF continues working
(including S3 without SMM, and S3 with SMM).

I'm glad to help with the testing once patches are posted.

OVMF installs the permanent PEI RAM in PublishPeiMemory()
[OvmfPkg/PlatformPei/MemDetect.c]. It keeps things under 4GB, so I think
this approach should work.

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


Re: [edk2] [PATCH] ShellPkg/[hex]edit: use SimpleTextInEx to read console

2018-05-22 Thread Jim.Dailey
Ray,

The patch in the message below was applied to the tree on 12 Feb this
year (5563281fa2b31093a1cbd415553b9264c5136e89).

Part of the change to MainTextEditor.c causes an issue where I cannot
enter (at least some) shifted punctuation.  For example, after this
check in I cannot edit a shell script and create a comment because I
cannot enter the "#" character.  When I try to type "#", the status bar
simply shows "Unknown Command".

I don't really understand the change, but if in the MainEditorKeyInput
function in file MainTextEditor.c I delete the "NoShiftState" check
from the first "else if" below:

+//
+// dispatch to different components' key handling function
+//
+if (EFI_NOT_FOUND != MenuBarDispatchControlHotKey()) {
+  Status = EFI_SUCCESS;
+} else if (NoShiftState && ((KeyData.Key.ScanCode == SCAN_NULL) || 
((KeyData.Key.ScanCode >= SCAN_UP) && (KeyData.Key.ScanCode <= 
SCAN_PAGE_DOWN {
+  Status = FileBufferHandleInput ();
+} else if (NoShiftState && (KeyData.Key.ScanCode >= SCAN_F1) && 
(KeyData.Key.ScanCode <= SCAN_F12)) {
+  Status = MenuBarDispatchFunctionKey ();
+} else {
+  StatusBarSetStatusString (L"Unknown Command");
+  FileBufferMouseNeedRefresh = FALSE;  
+}

then I am able to enter "#" and other characters that I previously was
unable to enter.

Can you have a look at this?  I assume any shell binary built with
this change will have a similar issue.

Thanks,
Jim

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ruiyu Ni
Sent: Monday, February 12, 2018 9:34 AM
To: edk2-devel@lists.01.org
Cc: Jaben Carsey; Felix
Subject: [edk2] [PATCH] ShellPkg/[hex]edit: use SimpleTextInEx to read console

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

Edit and HexEdit commands assume that SimpleTxtIn translates
Ctrl+ key combinations into Unicode control characters
(0x1-0x1A).

Such translation does not seem to be required by the UEFI spec.
Shell should not rely on implementation specific behavior.
It should instead use SimpleTextInEx to read Ctrl+ key
combinations.

The patch changes edit and hexedit to only consumes SimpleTextInEx.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Reported-by: Felix 
Cc: Felix 
Cc: Jaben Carsey 
---
 .../Edit/MainTextEditor.c  | 135 +-
 .../Edit/TextEditorTypes.h |  21 ++-
 .../UefiShellDebug1CommandsLib/EditInputBar.c  |  34 +++-
 .../UefiShellDebug1CommandsLib/EditInputBar.h  |   6 +-
 .../UefiShellDebug1CommandsLib/EditMenuBar.c   |  38 +++-
 .../UefiShellDebug1CommandsLib/EditMenuBar.h   |   6 +-
 .../HexEdit/HexEditorTypes.h   |  25 +--
 .../HexEdit/MainHexEditor.c| 205 +
 8 files changed, 309 insertions(+), 161 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
index 14f51dff19..a197f80a40 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
@@ -1,7 +1,7 @@
 /** @file
   Implements editor interface functions.
 
-  Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved. 
+  Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved. 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -1362,7 +1362,9 @@ MainCommandDisplayHelp (
 {
   INT32   CurrentLine;
   CHAR16  *InfoString;
-  EFI_INPUT_KEY   Key;
+  EFI_KEY_DATAKeyData;
+  EFI_STATUS  Status;
+  UINTN   EventIndex;
   
   //
   // print helpInfo  
@@ -1371,14 +1373,39 @@ MainCommandDisplayHelp (
 InfoString = HiiGetString(gShellDebug1HiiHandle, 
MainMenuHelpInfo[CurrentLine], NULL);
 ShellPrintEx (0, CurrentLine+1, L"%E%s%N", InfoString);
   }
-  
+
   //
   // scan for ctrl+w
   //
-  do {
-gST->ConIn->ReadKeyStroke (gST->ConIn, );
-  } while(SCAN_CONTROL_W != Key.UnicodeChar); 
+  while (TRUE) {
+Status = gBS->WaitForEvent (1, >WaitForKeyEx, 
);
+if (EFI_ERROR (Status) || (EventIndex != 0)) {
+  continue;
+}
+Status = MainEditor.TextInputEx->ReadKeyStrokeEx (MainEditor.TextInputEx, 
);
+if (EFI_ERROR (Status)) {
+  continue;
+}
 
+if ((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) {
+  //
+  // For consoles that don't support shift state reporting,
+  // CTRL+W is translated to L'W' - L'A' + 1.
+  //
+  if (KeyData.Key.UnicodeChar == L'W' - L'A' + 1) {
+break;
+  }
+   

Re: [edk2] [PATCH 1/6] OvmfPkg/PlatformBootManagerLib: add missing report status code call

2018-05-22 Thread Laszlo Ersek
On 05/22/18 16:08, Ard Biesheuvel wrote:
> Consumers of status code reports may rely on a status code to be
> reported when the ReadyToBoot event is signalled. For instance,
> FirmwarePerformanceDxe will fail to install the FPDT ACPI table
> in this case. So add the missing call.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
>  OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 +
>  OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c   | 4 
>  2 files changed, 5 insertions(+)
> 
> diff --git 
> a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
> b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
> index 27789b7377bc..f10b68424b91 100644
> --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
> +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
> @@ -55,6 +55,7 @@ [LibraryClasses]
>QemuFwCfgS3Lib
>LoadLinuxLib
>QemuBootOrderLib
> +  ReportStatusCodeLib
>UefiLib
>  
>  [Pcd]
> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c 
> b/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c
> index ef728dfdeb60..f20df9533fda 100644
> --- a/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c
> +++ b/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c
> @@ -18,6 +18,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -149,6 +150,9 @@ TryRunningQemuKernel (
>//
>EfiSignalEventReadyToBoot();
>  
> +  REPORT_STATUS_CODE (EFI_PROGRESS_CODE,
> +(EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT));
> +
>Status = LoadLinux (KernelBuf, SetupBuf);
>  
>  FreeAndReturn:
> 

Good catch!

Reviewed-by: Laszlo Ersek 

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


Re: [edk2] [PATCH 2/6] ArmVirtPkg/PlatformBootManagerLib: add missing report status code call

2018-05-22 Thread Laszlo Ersek
On 05/22/18 16:08, Ard Biesheuvel wrote:
> Consumers of status code reports may rely on a status code to be
> reported when the ReadyToBoot event is signalled. For instance,
> FirmwarePerformanceDxe will fail to install the FPDT ACPI table
> in this case. So add the missing call.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
>  ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 +
>  ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c   | 4 
>  2 files changed, 5 insertions(+)
> 
> diff --git 
> a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
> b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
> index d6c1ef95dc44..0cbc82f5d27d 100644
> --- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
> +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
> @@ -53,6 +53,7 @@ [LibraryClasses]
>PrintLib
>QemuBootOrderLib
>QemuFwCfgLib
> +  ReportStatusCodeLib
>UefiBootManagerLib
>UefiBootServicesTableLib
>UefiLib
> diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c 
> b/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c
> index ac47d21e71c8..7b59f57eb19f 100644
> --- a/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c
> +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c
> @@ -20,6 +20,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -1072,6 +1073,9 @@ TryRunningQemuKernel (
>//
>EfiSignalEventReadyToBoot();
>  
> +  REPORT_STATUS_CODE (EFI_PROGRESS_CODE,
> +(EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT));
> +
>//
>// Start the image.
>//
> 

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


Re: [edk2] [PATCH 3/6] MdePkg/UefiLib: introduce EfiAllocatePeiAccessiblePages routine

2018-05-22 Thread Ard Biesheuvel
On 22 May 2018 at 19:40, Kinney, Michael D  wrote:
> Ard,
>
> The corner case that does not work with this
> approach is when X64 DXE is combined with an
> X64 PEI.  OVMF uses this and other platforms
> could choose to use X64 PEI phase.
>

Actually, this approach simply encodes the current status quo. X64 DXE
builds unconditionally limit the allocations to < 4 GB if PEI needs to
access them, regardless of whether PEI is 32-bit or 64-bit.

Also, OVMF's X64 PEI still only maps the lower 4 GB of DRAM, so it
actually relies on the current behavior, and allocating above 4 GB
under the assumption that a 64-bit PEI will be able to access it will
actually break things.

> The other mismatch here is adding some PI Spec
> Concepts (e.g. PEI phase) to a UEFI library.
> Maybe DxeServicesLib would be a better place
> to put this type of API.
>

OK, fair enough.

> One clue we have about the memory usage in the
> PEI phase is from the EFI_HOB_HANDOFF_INFO_TABLE
> HOB.
>
>   ///
>   /// The highest address location of memory that is allocated for use by the 
> HOB producer
>   /// phase. This address must be 4-KB aligned to meet page restrictions of 
> UEFI.
>   ///
>   EFI_PHYSICAL_ADDRESSEfiMemoryTop;
>
>   ///
>   /// The highest address location of free memory that is currently available
>   /// for use by the HOB producer phase.
>   ///
>   EFI_PHYSICAL_ADDRESSEfiFreeMemoryTop;
>
> So maybe we could have an X64 specific implementation
> of this new API that checks one of these HOB fields.
> If they are below 4GB, then allocate memory below
> 4GB.  If one is above 4GB, then no restrictions.
> All other archs allocate with no restrictions.
>

That works for me.

> Now this approach will still allocate below 4GB for
> X64 PEI if the this HOB contains addressed below 4GB,
> but that would match the memory usage for that
> X64 PEI implementation.
>

OK, to summarize:
- move the implementation of EfiAllocatePeiAccessiblePages() to
DxeServicesLib (and perhaps rename it to something more appropriate
for its new home)
- only restrict the X64 version to below 4 GB if EfiMemoryTop and
EfiFreeMemoryTop are both below 4 GB.

I will give others some time to respond to this.

Thanks,
Ard.


>> -Original Message-
>> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
>> Sent: Tuesday, May 22, 2018 7:09 AM
>> To: edk2-devel@lists.01.org
>> Cc: Ard Biesheuvel ; Laszlo
>> Ersek ; Leif Lindholm
>> ; Kinney, Michael D
>> ; Gao, Liming
>> ; Zeng, Star
>> ; Dong, Eric ;
>> Bi, Dandan 
>> Subject: [PATCH 3/6] MdePkg/UefiLib: introduce
>> EfiAllocatePeiAccessiblePages routine
>>
>> Add a routine to UefiLib that abstracts the allocation
>> of memory that
>> should be accessible by PEI after a warm reboot. We will
>> use it to
>> replace open coded implementations that limit the
>> address to < 4 GB,
>> which may not be possible on non-Intel systems that have
>> no 32-bit
>> addressable memory at all.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Ard Biesheuvel
>> 
>> ---
>>  MdePkg/Include/Library/UefiLib.h | 23 ++
>>  MdePkg/Library/UefiLib/UefiLib.c | 48
>> 
>>  2 files changed, 71 insertions(+)
>>
>> diff --git a/MdePkg/Include/Library/UefiLib.h
>> b/MdePkg/Include/Library/UefiLib.h
>> index 256498e3fd8d..8fa077af41e0 100644
>> --- a/MdePkg/Include/Library/UefiLib.h
>> +++ b/MdePkg/Include/Library/UefiLib.h
>> @@ -1520,4 +1520,27 @@ EfiLocateProtocolBuffer (
>>OUT UINTN *NoProtocols,
>>OUT VOID  ***Buffer
>>);
>> +
>> +/**
>> +  Allocates one or more 4KB pages of a given type from
>> a memory region that is
>> +  accessible to PEI.
>> +
>> +  Allocates the number of 4KB pages of type
>> 'MemoryType' and returns a
>> +  pointer to the allocated buffer.  The buffer returned
>> is aligned on a 4KB
>> +  boundary.  If Pages is 0, then NULL is returned.  If
>> there is not enough
>> +  memory remaining to satisfy the request, then NULL is
>> returned.
>> +
>> +  @param[in]  MemoryTypeThe memory type to
>> allocate
>> +  @param[in]  Pages The number of 4 KB
>> pages to allocate.
>> +
>> +  @return A pointer to the allocated buffer or NULL if
>> allocation fails.
>> +
>> +**/
>> +VOID *
>> +EFIAPI
>> +EfiAllocatePeiAccessiblePages (
>> +  IN EFI_MEMORY_TYPE  MemoryType,
>> +  IN UINTNPages
>> +  );
>> +
>>  #endif
>> diff --git a/MdePkg/Library/UefiLib/UefiLib.c
>> b/MdePkg/Library/UefiLib/UefiLib.c
>> index ba449a1c34ce..3a9d75149dd7 100644
>> --- a/MdePkg/Library/UefiLib/UefiLib.c
>> +++ b/MdePkg/Library/UefiLib/UefiLib.c
>> @@ -1715,3 +1715,51 @@ EfiLocateProtocolBuffer (
>>
>>return EFI_SUCCESS;
>>  }
>> +
>> +/**
>> +  Allocates one or more 4KB pages of a 

Re: [edk2] [PATCH 3/6] MdePkg/UefiLib: introduce EfiAllocatePeiAccessiblePages routine

2018-05-22 Thread Kinney, Michael D
Ard,

The corner case that does not work with this
approach is when X64 DXE is combined with an
X64 PEI.  OVMF uses this and other platforms
could choose to use X64 PEI phase.

The other mismatch here is adding some PI Spec
Concepts (e.g. PEI phase) to a UEFI library.
Maybe DxeServicesLib would be a better place
to put this type of API.

One clue we have about the memory usage in the
PEI phase is from the EFI_HOB_HANDOFF_INFO_TABLE
HOB.

  ///
  /// The highest address location of memory that is allocated for use by the 
HOB producer
  /// phase. This address must be 4-KB aligned to meet page restrictions of 
UEFI.
  ///
  EFI_PHYSICAL_ADDRESSEfiMemoryTop;

  ///
  /// The highest address location of free memory that is currently available
  /// for use by the HOB producer phase.
  ///
  EFI_PHYSICAL_ADDRESSEfiFreeMemoryTop;

So maybe we could have an X64 specific implementation
of this new API that checks one of these HOB fields.
If they are below 4GB, then allocate memory below
4GB.  If one is above 4GB, then no restrictions.
All other archs allocate with no restrictions.

Now this approach will still allocate below 4GB for
X64 PEI if the this HOB contains addressed below 4GB,
but that would match the memory usage for that
X64 PEI implementation.

Best regards,

Mike

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Tuesday, May 22, 2018 7:09 AM
> To: edk2-devel@lists.01.org
> Cc: Ard Biesheuvel ; Laszlo
> Ersek ; Leif Lindholm
> ; Kinney, Michael D
> ; Gao, Liming
> ; Zeng, Star
> ; Dong, Eric ;
> Bi, Dandan 
> Subject: [PATCH 3/6] MdePkg/UefiLib: introduce
> EfiAllocatePeiAccessiblePages routine
> 
> Add a routine to UefiLib that abstracts the allocation
> of memory that
> should be accessible by PEI after a warm reboot. We will
> use it to
> replace open coded implementations that limit the
> address to < 4 GB,
> which may not be possible on non-Intel systems that have
> no 32-bit
> addressable memory at all.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel
> 
> ---
>  MdePkg/Include/Library/UefiLib.h | 23 ++
>  MdePkg/Library/UefiLib/UefiLib.c | 48
> 
>  2 files changed, 71 insertions(+)
> 
> diff --git a/MdePkg/Include/Library/UefiLib.h
> b/MdePkg/Include/Library/UefiLib.h
> index 256498e3fd8d..8fa077af41e0 100644
> --- a/MdePkg/Include/Library/UefiLib.h
> +++ b/MdePkg/Include/Library/UefiLib.h
> @@ -1520,4 +1520,27 @@ EfiLocateProtocolBuffer (
>OUT UINTN *NoProtocols,
>OUT VOID  ***Buffer
>);
> +
> +/**
> +  Allocates one or more 4KB pages of a given type from
> a memory region that is
> +  accessible to PEI.
> +
> +  Allocates the number of 4KB pages of type
> 'MemoryType' and returns a
> +  pointer to the allocated buffer.  The buffer returned
> is aligned on a 4KB
> +  boundary.  If Pages is 0, then NULL is returned.  If
> there is not enough
> +  memory remaining to satisfy the request, then NULL is
> returned.
> +
> +  @param[in]  MemoryTypeThe memory type to
> allocate
> +  @param[in]  Pages The number of 4 KB
> pages to allocate.
> +
> +  @return A pointer to the allocated buffer or NULL if
> allocation fails.
> +
> +**/
> +VOID *
> +EFIAPI
> +EfiAllocatePeiAccessiblePages (
> +  IN EFI_MEMORY_TYPE  MemoryType,
> +  IN UINTNPages
> +  );
> +
>  #endif
> diff --git a/MdePkg/Library/UefiLib/UefiLib.c
> b/MdePkg/Library/UefiLib/UefiLib.c
> index ba449a1c34ce..3a9d75149dd7 100644
> --- a/MdePkg/Library/UefiLib/UefiLib.c
> +++ b/MdePkg/Library/UefiLib/UefiLib.c
> @@ -1715,3 +1715,51 @@ EfiLocateProtocolBuffer (
> 
>return EFI_SUCCESS;
>  }
> +
> +/**
> +  Allocates one or more 4KB pages of a given type from
> a memory region that is
> +  accessible to PEI.
> +
> +  Allocates the number of 4KB pages of type
> 'MemoryType' and returns a
> +  pointer to the allocated buffer.  The buffer returned
> is aligned on a 4KB
> +  boundary.  If Pages is 0, then NULL is returned.  If
> there is not enough
> +  memory remaining to satisfy the request, then NULL is
> returned.
> +
> +  @param[in]  MemoryTypeThe memory type to
> allocate
> +  @param[in]  Pages The number of 4 KB
> pages to allocate.
> +
> +  @return A pointer to the allocated buffer or NULL if
> allocation fails.
> +
> +**/
> +VOID *
> +EFIAPI
> +EfiAllocatePeiAccessiblePages (
> +  IN EFI_MEMORY_TYPE  MemoryType,
> +  IN UINTNPages
> +  )
> +{
> +  EFI_STATUSStatus;
> +  EFI_PHYSICAL_ADDRESS  Memory;
> +  EFI_ALLOCATE_TYPE AllocType;
> +
> +  if (Pages == 0) {
> +return NULL;
> +  }
> +
> +#ifdef MDE_CPU_X64
> +  //
> +  // On X64 systems, a X64 build of DXE may be combined
> with a 32-bit 

Re: [edk2] [platforms PATCH v2 4/4] Marvell/Library: ComPhyLib: Fix configuration for PCIE x4 and x2

2018-05-22 Thread Marcin Wojtas
2018-05-22 13:20 GMT+02:00 Leif Lindholm :
> On Mon, May 21, 2018 at 12:54:01PM +0200, Marcin Wojtas wrote:
>> Hi Leif,
>>
>>
>> 2018-05-09 18:49 GMT+02:00 Leif Lindholm :
>>
>> > A couple of minor style comments.
>> >
>> > If you don't disagree, I can fix that up before pushing and you can
>> > have Reviewed-by: Leif Lindholm  for 1,3-4.
>> >
>> >
>> Yes, I would appreciate that.
>
> 1,3-4/4 pushed as 5cfda16b1a..a310c6b5e1.
>
> /
> Leif

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


Re: [edk2] [PATCH edk2-platforms 0/5] Seattle spring cleaning

2018-05-22 Thread Ard Biesheuvel
On 22 May 2018 at 16:56, Leif Lindholm  wrote:
> On Tue, May 15, 2018 at 07:37:31PM +0200, Ard Biesheuvel wrote:
>> Some cleanup patches for Seattle, removing the unused code that deals
>> with configurations where the SCP, ARM-TF or PSCI support are absent,
>> which is rather pointless for a platform that is no longer under
>> development.
>>
>> Ard Biesheuvel (5):
>>   Silicon/AMD/Styx: make ARM-TF and PSCI dependencies unconditional
>>   Silicon/AMD/Styx: remove MpBootDxe driver
>>   Silicon/AMD/Styx: remove support for the ACPI parking protocol
>>   Silicon/AMD/Styx: make ISCP dependency unconditional
>>   Platform/AMD/Overdrive: enable support for NVME PCIe devices
>
> For the series:
> Reviewed-by: Leif Lindholm 
>

Thanks

Pushed as 735e517fefbf..e174fc77d3bb


>
>>  .../AMD/OverdriveBoard/OverdriveBoard.dsc |  20 +--
>>  .../AMD/OverdriveBoard/OverdriveBoard.fdf |   6 +-
>>  Platform/LeMaker/CelloBoard/CelloBoard.dsc|   3 -
>>  .../Overdrive1000Board/Overdrive1000Board.dsc |  19 --
>>  .../Overdrive1000Board/Overdrive1000Board.fdf |   5 -
>>  Silicon/AMD/Styx/AcpiTables/AcpiTables.inf|   3 -
>>  Silicon/AMD/Styx/AcpiTables/Fadt.c|   5 +-
>>  Silicon/AMD/Styx/AcpiTables/Madt.c|  24 +--
>>  Silicon/AMD/Styx/AmdStyx.dec  |  12 --
>>  Silicon/AMD/Styx/Common/Protocol/AmdMpBoot.h  |  39 
>>  .../AMD/Styx/Common/Protocol/AmdMpCoreInfo.h  |   7 -
>>  .../AMD/Styx/Drivers/MpBootDxe/MpBootDxe.c| 170 --
>>  .../AMD/Styx/Drivers/MpBootDxe/MpBootDxe.inf  |  53 --
>>  .../AMD/Styx/Drivers/MpBootDxe/MpBootHelper.S |  87 -
>>  .../Styx/Drivers/PlatInitDxe/PlatInitDxe.c|  91 --
>>  .../Styx/Drivers/PlatInitDxe/PlatInitDxe.inf  |   6 -
>>  .../Styx/Drivers/PlatInitPei/PlatInitPei.c| 120 ++---
>>  .../Styx/Drivers/PlatInitPei/PlatInitPei.inf  |   2 -
>>  .../PlatformSmbiosDxe/PlatformSmbiosDxe.c |  40 -
>>  .../PlatformSmbiosDxe/PlatformSmbiosDxe.inf   |   1 -
>>  .../Library/MemoryInitPei/MemoryInitPeiLib.c  |  58 +++---
>>  .../MemoryInitPei/MemoryInitPeiLib.inf|   3 -
>>  .../RealTimeClockLib/RealTimeClockLib.c   |  16 +-
>>  .../RealTimeClockLib/RealTimeClockLib.inf |   3 -
>>  .../Library/ResetSystemLib/ResetSystemLib.inf |   3 -
>>  .../StyxDtbLoaderLib/StyxDtbLoaderLib.inf |   2 -
>>  26 files changed, 89 insertions(+), 709 deletions(-)
>>  delete mode 100644 Silicon/AMD/Styx/Common/Protocol/AmdMpBoot.h
>>  delete mode 100644 Silicon/AMD/Styx/Drivers/MpBootDxe/MpBootDxe.c
>>  delete mode 100644 Silicon/AMD/Styx/Drivers/MpBootDxe/MpBootDxe.inf
>>  delete mode 100644 Silicon/AMD/Styx/Drivers/MpBootDxe/MpBootHelper.S
>>
>> --
>> 2.17.0
>>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms 0/5] assorted SynQuacer updates

2018-05-22 Thread Ard Biesheuvel
On 27 April 2018 at 13:37, Ard Biesheuvel  wrote:
> Some changes that have been queuing up over the past weeks.
>
> Ard Biesheuvel (4):
>   Platform/Socionext/DeveloperBox: add SNP driver
>   Platform/SynQuacer: add 'acpiview' shell command to build
>   Silicon/SynQuacer/PlatformDxe: depex on gEfiVariableArchProtocolGuid
>   Silicon/SynQuacer: drop BEFORE depex for varstore formatting
>
> Masahisa KOJIMA (1):
>   Silicon/SynQuacer/NetsecDxe: Add polling function to reinitialize GMAC
>

Series pushed as f17e3a164917..735e517fefbf

Thanks.



>  .../Socionext/DeveloperBox/DeveloperBox.dsc   |   3 +
>  .../Socionext/DeveloperBox/DeveloperBox.fdf   |   1 +
>  .../SynQuacerEvalBoard/SynQuacerEvalBoard.dsc |   2 +
>  .../SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf |   6 +-
>  .../Drivers/Fip006Dxe/NorFlashFvbDxe.c|  15 +++
>  .../Drivers/Net/NetsecDxe/NetsecDxe.c | 108 ++
>  .../Drivers/Net/NetsecDxe/NetsecDxe.h |   4 +
>  .../Drivers/PlatformDxe/PlatformDxe.inf   |   2 +-
>  8 files changed, 136 insertions(+), 5 deletions(-)
>
> --
> 2.17.0
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms 2/5] Platform/Socionext/DeveloperBox: add SNP driver

2018-05-22 Thread Leif Lindholm
To save me making a triple-take when I see this commit in the log in
future, could you change the subject to say SnpDxe instead of SNP?

If so, for the series:
Reviewed-by: Leif Lindholm 

On Fri, Apr 27, 2018 at 01:37:45PM +0200, Ard Biesheuvel wrote:
> Even though the builtin NETSEC controller driver implements the Simple
> Network Protocol (SNP) directly, other network controllers connected
> via PCIe may be supported by a UNDI driver, which require the generic
> SnpDxe driver in order to be usable.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
>  Platform/Socionext/DeveloperBox/DeveloperBox.dsc | 1 +
>  Platform/Socionext/DeveloperBox/DeveloperBox.fdf | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc 
> b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> index cc36c2ed1772..430c3fb06df1 100644
> --- a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> @@ -633,6 +633,7 @@ [Components.common]
>MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
>MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
>MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> +  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
>MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
>MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
>MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.fdf 
> b/Platform/Socionext/DeveloperBox/DeveloperBox.fdf
> index 2da83850975b..1b8de4c3823a 100644
> --- a/Platform/Socionext/DeveloperBox/DeveloperBox.fdf
> +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.fdf
> @@ -203,6 +203,7 @@ [FV.FvMain]
>INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
>INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
>INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> +  INF MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
>INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
>INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
>INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> -- 
> 2.17.0
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms 0/5] Seattle spring cleaning

2018-05-22 Thread Leif Lindholm
On Tue, May 15, 2018 at 07:37:31PM +0200, Ard Biesheuvel wrote:
> Some cleanup patches for Seattle, removing the unused code that deals
> with configurations where the SCP, ARM-TF or PSCI support are absent,
> which is rather pointless for a platform that is no longer under
> development.
> 
> Ard Biesheuvel (5):
>   Silicon/AMD/Styx: make ARM-TF and PSCI dependencies unconditional
>   Silicon/AMD/Styx: remove MpBootDxe driver
>   Silicon/AMD/Styx: remove support for the ACPI parking protocol
>   Silicon/AMD/Styx: make ISCP dependency unconditional
>   Platform/AMD/Overdrive: enable support for NVME PCIe devices

For the series:
Reviewed-by: Leif Lindholm 


>  .../AMD/OverdriveBoard/OverdriveBoard.dsc |  20 +--
>  .../AMD/OverdriveBoard/OverdriveBoard.fdf |   6 +-
>  Platform/LeMaker/CelloBoard/CelloBoard.dsc|   3 -
>  .../Overdrive1000Board/Overdrive1000Board.dsc |  19 --
>  .../Overdrive1000Board/Overdrive1000Board.fdf |   5 -
>  Silicon/AMD/Styx/AcpiTables/AcpiTables.inf|   3 -
>  Silicon/AMD/Styx/AcpiTables/Fadt.c|   5 +-
>  Silicon/AMD/Styx/AcpiTables/Madt.c|  24 +--
>  Silicon/AMD/Styx/AmdStyx.dec  |  12 --
>  Silicon/AMD/Styx/Common/Protocol/AmdMpBoot.h  |  39 
>  .../AMD/Styx/Common/Protocol/AmdMpCoreInfo.h  |   7 -
>  .../AMD/Styx/Drivers/MpBootDxe/MpBootDxe.c| 170 --
>  .../AMD/Styx/Drivers/MpBootDxe/MpBootDxe.inf  |  53 --
>  .../AMD/Styx/Drivers/MpBootDxe/MpBootHelper.S |  87 -
>  .../Styx/Drivers/PlatInitDxe/PlatInitDxe.c|  91 --
>  .../Styx/Drivers/PlatInitDxe/PlatInitDxe.inf  |   6 -
>  .../Styx/Drivers/PlatInitPei/PlatInitPei.c| 120 ++---
>  .../Styx/Drivers/PlatInitPei/PlatInitPei.inf  |   2 -
>  .../PlatformSmbiosDxe/PlatformSmbiosDxe.c |  40 -
>  .../PlatformSmbiosDxe/PlatformSmbiosDxe.inf   |   1 -
>  .../Library/MemoryInitPei/MemoryInitPeiLib.c  |  58 +++---
>  .../MemoryInitPei/MemoryInitPeiLib.inf|   3 -
>  .../RealTimeClockLib/RealTimeClockLib.c   |  16 +-
>  .../RealTimeClockLib/RealTimeClockLib.inf |   3 -
>  .../Library/ResetSystemLib/ResetSystemLib.inf |   3 -
>  .../StyxDtbLoaderLib/StyxDtbLoaderLib.inf |   2 -
>  26 files changed, 89 insertions(+), 709 deletions(-)
>  delete mode 100644 Silicon/AMD/Styx/Common/Protocol/AmdMpBoot.h
>  delete mode 100644 Silicon/AMD/Styx/Drivers/MpBootDxe/MpBootDxe.c
>  delete mode 100644 Silicon/AMD/Styx/Drivers/MpBootDxe/MpBootDxe.inf
>  delete mode 100644 Silicon/AMD/Styx/Drivers/MpBootDxe/MpBootHelper.S
> 
> -- 
> 2.17.0
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v3 0/4] RFC: ovmf: Add support for TPM Physical Presence interface

2018-05-22 Thread Laszlo Ersek
On 05/18/18 14:23, marcandre.lur...@redhat.com wrote:
> From: Marc-André Lureau 
> 
> Hi,
> 
> The following series adds basic TPM PPI 1.3 support for OVMF-on-QEMU
> with TPM2 (I haven't looked at TPM1, for lack of interest).
> 
> PPI test runs successfully with Windows 10 WHLK, despite the limited
> number of supported funcions (tpm2_ppi_funcs table, in particular, no
> function allows to manipulate Tcg2PhysicalPresenceFlags)
> 
> The way it works is relatively simple: a memory region is allocated by
> QEMU to save PPI related variables. An ACPI interface is exposed by
> QEMU to let the guest manipulate those. At boot, ovmf processes and
> updates the PPI qemu region and request variables.
> 
> I build edk2 with:
> 
> $ build -DTPM2_ENABLE
> 
> I test with qemu & swtpm/libtpms (tpm2 branches, swtpm_setup.sh --tpm2
>  --tpm-state tpmstatedir)
> 
> $ swtpm socket --tpmstate tpmstatedir --ctrl type=unixio,path=tpmsock
>   --tpm2 &
> 
> $ qemu .. -chardev socket,id=chrtpm,path=tpmsock -tpmdev
>   emulator,id=tpm0,chardev=chrtpm -device tpm-crb,tpmdev=tpm0
> 
> Github trees:
> https://github.com/elmarco/edk2/tree/tpm-ppi
> https://github.com/elmarco/qemu/tree/tpm-ppi
> 
> Thanks
> 
> v3: after Laszlo review
>  - dropped DxeTcg2PhysicalPresenceLib.uni
>  - removed mTpm2PPIFuncs static initialization, use hard-coded assignments
>  - declared STATIC the functions that should be
>  - fixed an OUT/IN decorator
>  - use EFI_PROTOCOL_ERROR instead of EFI_INVALID_PARAMETER when PPI
>initialization fails
>  - replaced EFI_D_INFO with DEBUG_INFO
>  - added a check for mPpi address that it doesn't cross a page boundary
>  - added a GetMemorySpaceDescriptor() check for memory type
>  - declared *mPpi as volatile, to correct mmio access
>  - a few more style changes
>  - comments updated
>  - some minor dead code/inclusion/defines removal
>  - added a few r-b tags
> 
> v2:
>  - style and commit message fixes
> 
> Marc-André Lureau (4):
>   OvmfPkg: add Tcg2PhysicalPresenceLibNull when !TPM2_ENABLE
>   OvmfPkg/IndustryStandard: add QemuTpm.h header
>   OvmfPkg: add Tcg2PhysicalPresenceLibQemu
>   OvmfPkg/PlatformBootManagerLib: process TPM PPI request
> 
>  OvmfPkg/OvmfPkgIa32.dsc   |   4 +-
>  OvmfPkg/OvmfPkgIa32X64.dsc|   4 +-
>  OvmfPkg/OvmfPkgX64.dsc|   4 +-
>  .../PlatformBootManagerLib.inf|   2 +
>  .../DxeTcg2PhysicalPresenceLib.inf|  33 +
>  .../DxeTcg2PhysicalPresenceLib.inf|  46 +-
>  OvmfPkg/Include/IndustryStandard/QemuTpm.h|  69 ++
>  .../PlatformBootManagerLib/BdsPlatform.c  |   6 +
>  .../DxeTcg2PhysicalPresenceLib.c  |  20 +-
>  .../DxeTcg2PhysicalPresenceLib.c  | 919 ++
>  .../PhysicalPresenceStrings.uni   |  33 +-
>  11 files changed, 1081 insertions(+), 59 deletions(-)
>  create mode 100644 
> OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLib.inf
>  copy {SecurityPkg/Library/DxeTcg2PhysicalPresenceLib => 
> OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu}/DxeTcg2PhysicalPresenceLib.inf 
> (66%)
>  create mode 100644 OvmfPkg/Include/IndustryStandard/QemuTpm.h
>  copy 
> EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuSleep.c
>  => OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLib.c 
> (55%)
>  create mode 100644 
> OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c
>  copy {SecurityPkg/Library/DxeTcg2PhysicalPresenceLib => 
> OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu}/PhysicalPresenceStrings.uni (56%)
> 

I briefly summarized the updates that I mentioned in review on the
patches themselves, and pushed the series as commit range
75135cc6988e..8d65d3b25e35.

Thank you guys again!
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v3 3/4] OvmfPkg: add Tcg2PhysicalPresenceLibQemu

2018-05-22 Thread Laszlo Ersek
On 05/18/18 14:23, marcandre.lur...@redhat.com wrote:

> +/**
> +  Initializes QEMU PPI memory region.
> +
> +  @retval EFI_SUCCESS   Operation completed successfully.
> +  @retval EFI_PROTOCOL_ERRORPPI address is invalid.
> +**/
> +STATIC
> +EFI_STATUS
> +QemuTpmInitPPI (
> +  VOID
> +  )
> +{
> +  EFI_STATUS  Status;
> +  QEMU_FWCFG_TPM_CONFIG   Config;
> +  EFI_PHYSICAL_ADDRESSPpiAddress64;
> +  EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
> +  int i;

(1) This should be "UINTN Idx".

> +
> +  if (mPpi != NULL) {
> +return EFI_SUCCESS;
> +  }
> +
> +  Status = QemuTpmReadConfig ();
> +  if (EFI_ERROR (Status)) {
> +return Status;
> +  }
> +
> +  mPpi = (QEMU_TPM_PPI *)(UINTN)Config.PpiAddress;
> +  if (mPpi == NULL) {
> +return EFI_PROTOCOL_ERROR;
> +  }
> +
> +  DEBUG ((DEBUG_INFO, "[TPM2PP] mPpi=%p version=%d\n", mPpi, 
> Config.TpmVersion));
> +
> +  PpiAddress64 = (UINTN)mPpi;
> +  if ((PpiAddress64 & ~(UINT64)EFI_PAGE_MASK) !=
> +  ((PpiAddress64 + sizeof *mPpi - 1) & ~(UINT64)EFI_PAGE_MASK)) {
> +DEBUG ((DEBUG_ERROR, "[TPM2PP] mPpi crosses a page boundary\n"));
> +return EFI_PROTOCOL_ERROR;
> +  }
> +
> +  Status = gDS->GetMemorySpaceDescriptor (PpiAddress64, );
> +  if (Status != EFI_SUCCESS && Status != EFI_NOT_FOUND) {
> +ASSERT_EFI_ERROR (Status);
> +return EFI_PROTOCOL_ERROR;
> +  }
> +  if (Status == EFI_SUCCESS && (
> +Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo &&
> +Descriptor.GcdMemoryType != EfiGcdMemoryTypeNonExistent)) {
> +DEBUG ((DEBUG_ERROR, "[TPM2PP] mPpi has an invalid memory type\n"));
> +return EFI_PROTOCOL_ERROR;
> +  }

(2) In edk2 we generally don't compare EFI_STATUS variables against
EFI_SUCCESS, instead we write [!]EFI_ERROR (Status). Whether that's
easier or harder to understand is anyone's guess, but either way that's
the idiom.

(3) The indentation / parentheses around "Descriptor.GcdMemoryType"
aren't idiomatic.

(4) I think the new checks introduce a new logic bug in this patch -- if
we return EFI_PROTOCOL_ERROR, we should re-set mPpi to NULL. Otherwise
the next call to QemuTpmInitPPI() will succeed, using a bogus mPpi
value.

> +
> +  for (i = 0; i < sizeof (mPpi->Func); i++) {
> +mPpi->Func[i] = 0;
> +  }

(5) Functionally this is OK, because mPpi->Func has UINT8 elements;
however we should really use ARRAY_SIZE() here.

> +  if (Config.TpmVersion == QEMU_TPM_VERSION_2) {
> +mPpi->Func[TCG2_PHYSICAL_PRESENCE_NO_ACTION] = TPM_PPI_FLAGS;
> +mPpi->Func[TCG2_PHYSICAL_PRESENCE_CLEAR] = TPM_PPI_FLAGS;
> +mPpi->Func[TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR] = TPM_PPI_FLAGS;
> +mPpi->Func[TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR_2] = TPM_PPI_FLAGS;
> +mPpi->Func[TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR_3] = TPM_PPI_FLAGS;
> +mPpi->Func[TCG2_PHYSICAL_PRESENCE_SET_PCR_BANKS] = TPM_PPI_FLAGS;
> +mPpi->Func[TCG2_PHYSICAL_PRESENCE_CHANGE_EPS] = TPM_PPI_FLAGS;
> +mPpi->Func[TCG2_PHYSICAL_PRESENCE_LOG_ALL_DIGESTS] = TPM_PPI_FLAGS;
> +mPpi->Func[TCG2_PHYSICAL_PRESENCE_ENABLE_BLOCK_SID] = TPM_PPI_FLAGS;
> +mPpi->Func[TCG2_PHYSICAL_PRESENCE_DISABLE_BLOCK_SID] = TPM_PPI_FLAGS;
> +  }
> +
> +  if (mPpi->In == 0) {
> +mPpi->In = 1;
> +mPpi->Request = TCG2_PHYSICAL_PRESENCE_NO_ACTION;
> +mPpi->LastRequest = TCG2_PHYSICAL_PRESENCE_NO_ACTION;
> +mPpi->NextStep = TCG2_PHYSICAL_PRESENCE_NO_ACTION;
> +  }
> +
> +  return EFI_SUCCESS;
> +}

Thus, I've squashed the following patch into yours, and build-tested it:

> diff --git 
> a/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c 
> b/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c
> index cc4046228ba3..52913f573676 100644
> --- a/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c
> +++ b/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c
> @@ -99,7 +99,7 @@ QemuTpmInitPPI (
>QEMU_FWCFG_TPM_CONFIG   Config;
>EFI_PHYSICAL_ADDRESSPpiAddress64;
>EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
> -  int i;
> +  UINTN   Idx;
>
>if (mPpi != NULL) {
>  return EFI_SUCCESS;
> @@ -121,23 +121,23 @@ QemuTpmInitPPI (
>if ((PpiAddress64 & ~(UINT64)EFI_PAGE_MASK) !=
>((PpiAddress64 + sizeof *mPpi - 1) & ~(UINT64)EFI_PAGE_MASK)) {
>  DEBUG ((DEBUG_ERROR, "[TPM2PP] mPpi crosses a page boundary\n"));
> -return EFI_PROTOCOL_ERROR;
> +goto InvalidPpiAddress;
>}
>
>Status = gDS->GetMemorySpaceDescriptor (PpiAddress64, );
> -  if (Status != EFI_SUCCESS && Status != EFI_NOT_FOUND) {
> +  if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) {
>  ASSERT_EFI_ERROR (Status);
> -return EFI_PROTOCOL_ERROR;
> +goto InvalidPpiAddress;
>}
> -  if (Status == EFI_SUCCESS && (
> -Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo &&
> -

Re: [edk2] [PATCH v2] BaseTools/Workspace: Fix ValueChain set

2018-05-22 Thread Carsey, Jaben
Marvin,

I have seen funny stuff when outlook shows me the email with patch, but it's 
part of the displaying not the sending bits...

-Jaben

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Gao, Liming
> Sent: Tuesday, May 22, 2018 5:52 AM
> To: marvin.haeu...@outlook.com; edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> 
> Yes. I also check V1. It also pass patchchecker.
> 
> > -Original Message-
> > From: Marvin Häuser [mailto:marvin.haeu...@outlook.com]
> > Sent: Tuesday, May 22, 2018 8:51 PM
> > To: edk2-devel@lists.01.org
> > Cc: Gao, Liming ; Zhu, Yonghong
> 
> > Subject: RE: [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> >
> > Thanks Liming!
> > Maybe this is an issue with my e-mail client or server, I just heard 
> > Exchange
> sometimes messes up.
> > If there really is no such change as I'm observing here, V1 should be fine
> too.
> >
> > Regards,
> > Marvin.
> >
> > > -Original Message-
> > > From: Gao, Liming 
> > > Sent: Tuesday, May 22, 2018 2:49 PM
> > > To: marvin.haeu...@outlook.com; edk2-devel@lists.01.org
> > > Cc: Zhu, Yonghong 
> > > Subject: RE: [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> > >
> > > Marvin:
> > >   I don't see the whitespace in this patch. I also run
> > > BaseTools\Scripts\PatchCheck.py. There is no issue found.
> > >
> > > > -Original Message-
> > > > From: Marvin Häuser [mailto:marvin.haeu...@outlook.com]
> > > > Sent: Tuesday, May 22, 2018 7:52 PM
> > > > To: edk2-devel@lists.01.org
> > > > Cc: Gao, Liming ; Zhu, Yonghong
> > > > 
> > > > Subject: RE: [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> > > >
> > > > This is odd. I generated another patch and checked for whitespace and
> > > CRLF/LF changes and found everything to be fine.
> > > > Now V2 has the exact same whitespace change as V1. Also, if I see it
> > > > right, it failed to CC Yonghong even though the CMD clearly shows the
> cc.
> > > >
> > > > Is there maybe some git expert around who has an idea what the issue
> > > could be?
> > > >
> > > > Thanks,
> > > > Marvin
> > > >
> > > > > -Original Message-
> > > > > From: edk2-devel  On Behalf Of
> > > > > Marvin Häuser
> > > > > Sent: Tuesday, May 22, 2018 1:48 PM
> > > > > To: edk2-devel@lists.01.org
> > > > > Cc: liming@intel.com
> > > > > Subject: [edk2] [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> > > > >
> > > > > Commit 88252a90d1ca7846731cd2e4e8e860454f7d97a3 changed
> > > ValueChain
> > > > > from a dict to a set, but also changed the (former) key type from a
> > > > > touple to two separate values, which was probably unintended and
> > > > > also breaks build for packages involving Structured PCDs, because
> > > > > add() only takes one argument.
> > > > > This commit changes the values back to touples.
> > > > >
> > > > > V2:
> > > > >   - Removed a whitespace change.
> > > > >
> > > > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > > > Signed-off-by: Marvin Haeuser 
> > > > > ---
> > > > >  BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++--
> > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > > > b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > > > index 8476543c5352..0262a91ed855 100644
> > > > > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > > > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > > > @@ -1347,7 +1347,7 @@ class
> DscBuildData(PlatformBuildClassObject):
> > > > >  nextskuid = 
> > > > > self.SkuIdMgr.GetNextSkuId(nextskuid)
> > > > >  stru_pcd.SkuOverrideValues[skuid] =
> > > > > copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not
> > > > > NoDefault else copy.deepcopy({defaultstorename:
> > > > > stru_pcd.DefaultValues for defaultstorename in DefaultStores} if
> > > > > DefaultStores else
> > > > > {TAB_DEFAULT_STORES_DEFAULT:stru_pcd.DefaultValues})
> > > > >  if not NoDefault:
> > > > > -stru_pcd.ValueChain.add(skuid,'')
> > > > > +stru_pcd.ValueChain.add((skuid,''))
> > > > >  if stru_pcd.Type in
> > > > > [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],
> > > > > self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
> > > > >  for skuid in SkuIds:
> > > > >  nextskuid = skuid @@ -1366,7 +1366,7 @@ class
> > > > > DscBuildData(PlatformBuildClassObject):
> > > > >  for defaultstoreid in DefaultStores:
> > > > >  if defaultstoreid not in
> stru_pcd.SkuOverrideValues[skuid]:
> > > > >
> > > > > 

[edk2] [PATCH 3/6] MdePkg/UefiLib: introduce EfiAllocatePeiAccessiblePages routine

2018-05-22 Thread Ard Biesheuvel
Add a routine to UefiLib that abstracts the allocation of memory that
should be accessible by PEI after a warm reboot. We will use it to
replace open coded implementations that limit the address to < 4 GB,
which may not be possible on non-Intel systems that have no 32-bit
addressable memory at all.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 MdePkg/Include/Library/UefiLib.h | 23 ++
 MdePkg/Library/UefiLib/UefiLib.c | 48 
 2 files changed, 71 insertions(+)

diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/UefiLib.h
index 256498e3fd8d..8fa077af41e0 100644
--- a/MdePkg/Include/Library/UefiLib.h
+++ b/MdePkg/Include/Library/UefiLib.h
@@ -1520,4 +1520,27 @@ EfiLocateProtocolBuffer (
   OUT UINTN *NoProtocols,
   OUT VOID  ***Buffer
   );
+
+/**
+  Allocates one or more 4KB pages of a given type from a memory region that is
+  accessible to PEI.
+
+  Allocates the number of 4KB pages of type 'MemoryType' and returns a
+  pointer to the allocated buffer.  The buffer returned is aligned on a 4KB
+  boundary.  If Pages is 0, then NULL is returned.  If there is not enough
+  memory remaining to satisfy the request, then NULL is returned.
+
+  @param[in]  MemoryTypeThe memory type to allocate
+  @param[in]  Pages The number of 4 KB pages to allocate.
+
+  @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID *
+EFIAPI
+EfiAllocatePeiAccessiblePages (
+  IN EFI_MEMORY_TYPE  MemoryType,
+  IN UINTNPages
+  );
+
 #endif
diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/UefiLib.c
index ba449a1c34ce..3a9d75149dd7 100644
--- a/MdePkg/Library/UefiLib/UefiLib.c
+++ b/MdePkg/Library/UefiLib/UefiLib.c
@@ -1715,3 +1715,51 @@ EfiLocateProtocolBuffer (
 
   return EFI_SUCCESS;
 }
+
+/**
+  Allocates one or more 4KB pages of a given type from a memory region that is
+  accessible to PEI.
+
+  Allocates the number of 4KB pages of type 'MemoryType' and returns a
+  pointer to the allocated buffer.  The buffer returned is aligned on a 4KB
+  boundary.  If Pages is 0, then NULL is returned.  If there is not enough
+  memory remaining to satisfy the request, then NULL is returned.
+
+  @param[in]  MemoryTypeThe memory type to allocate
+  @param[in]  Pages The number of 4 KB pages to allocate.
+
+  @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID *
+EFIAPI
+EfiAllocatePeiAccessiblePages (
+  IN EFI_MEMORY_TYPE  MemoryType,
+  IN UINTNPages
+  )
+{
+  EFI_STATUSStatus;
+  EFI_PHYSICAL_ADDRESS  Memory;
+  EFI_ALLOCATE_TYPE AllocType;
+
+  if (Pages == 0) {
+return NULL;
+  }
+
+#ifdef MDE_CPU_X64
+  //
+  // On X64 systems, a X64 build of DXE may be combined with a 32-bit build of
+  // PEI, and so we need to allocate below 4 GB to ensure that the allocation
+  // is accessible by PEI.
+  //
+  AllocType = AllocateMaxAddress;
+  Memory = MAX_UINT32;
+#else
+  AllocType = AllocateAnyPages;
+#endif
+  Status = gBS->AllocatePages (AllocType, MemoryType, Pages, );
+  if (EFI_ERROR (Status)) {
+return NULL;
+  }
+  return (VOID *)(UINTN)Memory;
+}
-- 
2.17.0

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


[edk2] [PATCH 5/6] MdeModulePkg/DxeCorePerformanceLib: use EfiAllocatePeiAccessiblePages

2018-05-22 Thread Ard Biesheuvel
Replace the call to and implementation of the function
FpdtAllocateReservedMemoryBelow4G() with a call to
EfiAllocatePeiAccessiblePages, which boils down to the same on X64,
but does not crash non-X64 systems that lack memory below 4 GB.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 45 
++--
 1 file changed, 4 insertions(+), 41 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 71d624fc9ce9..301ea4c32a78 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -165,46 +165,6 @@ IsKnownID (
   }
 }
 
-/**
-  Allocate EfiReservedMemoryType below 4G memory address.
-
-  This function allocates EfiReservedMemoryType below 4G memory address.
-
-  @param[in]  Size   Size of memory to allocate.
-
-  @return Allocated address for output.
-
-**/
-VOID *
-FpdtAllocateReservedMemoryBelow4G (
-  IN UINTN   Size
-  )
-{
-  UINTN Pages;
-  EFI_PHYSICAL_ADDRESS  Address;
-  EFI_STATUSStatus;
-  VOID  *Buffer;
-
-  Buffer  = NULL;
-  Pages   = EFI_SIZE_TO_PAGES (Size);
-  Address = 0x;
-
-  Status = gBS->AllocatePages (
-  AllocateMaxAddress,
-  EfiReservedMemoryType,
-  Pages,
-  
-  );
-  ASSERT_EFI_ERROR (Status);
-
-  if (!EFI_ERROR (Status)) {
-Buffer = (VOID *) (UINTN) Address;
-ZeroMem (Buffer, Size);
-  }
-
-  return Buffer;
-}
-
 /**
   Allocate buffer for Boot Performance table.
 
@@ -348,7 +308,10 @@ AllocateBootPerformanceTable (
 //
 // Fail to allocate at specified address, continue to allocate at any 
address.
 //
-mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) 
FpdtAllocateReservedMemoryBelow4G (BootPerformanceDataSize);
+mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) 
EfiAllocatePeiAccessiblePages (
+ 
EfiReservedMemoryType,
+ EFI_SIZE_TO_PAGES 
(BootPerformanceDataSize)
+ );
   }
   DEBUG ((DEBUG_INFO, "DxeCorePerformanceLib: ACPI Boot Performance Table 
address = 0x%x\n", mAcpiBootPerformanceTable));
 
-- 
2.17.0

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


[edk2] [PATCH 4/6] IntelFrameworkPkg/FrameworkUefiLib: add EfiAllocatePeiAccessiblePages routine

2018-05-22 Thread Ard Biesheuvel
Add the newly introduced EfiAllocatePeiAccessiblePages() routine which
allocates memory in a way that guarantees that PEI can access it after
a warm reboot.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c | 48 
 1 file changed, 48 insertions(+)

diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c 
b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c
index 443a73917215..a488fe780b04 100644
--- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c
+++ b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c
@@ -1687,3 +1687,51 @@ EfiLocateProtocolBuffer (
 
   return EFI_SUCCESS;
 }
+
+/**
+  Allocates one or more 4KB pages of a given type from a memory region that is
+  accessible to PEI.
+
+  Allocates the number of 4KB pages of type 'MemoryType' and returns a
+  pointer to the allocated buffer.  The buffer returned is aligned on a 4KB
+  boundary.  If Pages is 0, then NULL is returned.  If there is not enough
+  memory remaining to satisfy the request, then NULL is returned.
+
+  @param[in]  MemoryTypeThe memory type to allocate
+  @param[in]  Pages The number of 4 KB pages to allocate.
+
+  @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID *
+EFIAPI
+EfiAllocatePeiAccessiblePages (
+  IN EFI_MEMORY_TYPE  MemoryType,
+  IN UINTNPages
+  )
+{
+  EFI_STATUSStatus;
+  EFI_PHYSICAL_ADDRESS  Memory;
+  EFI_ALLOCATE_TYPE AllocType;
+
+  if (Pages == 0) {
+return NULL;
+  }
+
+#ifdef MDE_CPU_X64
+  //
+  // On X64 systems, a X64 build of DXE may be combined with a 32-bit build of
+  // PEI, and so we need to allocate below 4 GB to ensure that the allocation
+  // is accessible by PEI.
+  //
+  AllocType = AllocateMaxAddress;
+  Memory = MAX_UINT32;
+#else
+  AllocType = AllocateAnyPages;
+#endif
+  Status = gBS->AllocatePages (AllocType, MemoryType, Pages, );
+  if (EFI_ERROR (Status)) {
+return NULL;
+  }
+  return (VOID *)(UINTN)Memory;
+}
-- 
2.17.0

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


[edk2] [PATCH 6/6] MdeModulePkg/FirmwarePerformanceDataTableDxe: use EfiAllocatePeiAccessiblePages

2018-05-22 Thread Ard Biesheuvel
Replace the call to and implementation of the function
FpdtAllocateReservedMemoryBelow4G() with a call to
EfiAllocatePeiAccessiblePages, which boils down to the same on X64,
but does not crash non-X64 systems that lack memory below 4 GB.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 
MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
 | 50 
 1 file changed, 8 insertions(+), 42 deletions(-)

diff --git 
a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
 
b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
index e719e9e482cb..6663cbeac501 100644
--- 
a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
+++ 
b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
@@ -179,46 +179,6 @@ FpdtAcpiTableChecksum (
   Buffer[ChecksumOffset] = CalculateCheckSum8 (Buffer, Size);
 }
 
-/**
-  Allocate EfiReservedMemoryType below 4G memory address.
-
-  This function allocates EfiReservedMemoryType below 4G memory address.
-
-  @param[in]  Size   Size of memory to allocate.
-
-  @return Allocated address for output.
-
-**/
-VOID *
-FpdtAllocateReservedMemoryBelow4G (
-  IN UINTN   Size
-  )
-{
-  UINTN Pages;
-  EFI_PHYSICAL_ADDRESS  Address;
-  EFI_STATUSStatus;
-  VOID  *Buffer;
-
-  Buffer  = NULL;
-  Pages   = EFI_SIZE_TO_PAGES (Size);
-  Address = 0x;
-
-  Status = gBS->AllocatePages (
-  AllocateMaxAddress,
-  EfiReservedMemoryType,
-  Pages,
-  
-  );
-  ASSERT_EFI_ERROR (Status);
-
-  if (!EFI_ERROR (Status)) {
-Buffer = (VOID *) (UINTN) Address;
-ZeroMem (Buffer, Size);
-  }
-
-  return Buffer;
-}
-
 /**
   Callback function upon VariableArchProtocol and LockBoxProtocol
   to allocate S3 performance table memory and save the pointer to LockBox.
@@ -287,7 +247,10 @@ FpdtAllocateS3PerformanceTableMemory (
 //
 // Fail to allocate at specified address, continue to allocate at any 
address.
 //
-mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) 
FpdtAllocateReservedMemoryBelow4G (sizeof (S3_PERFORMANCE_TABLE));
+mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) 
EfiAllocatePeiAccessiblePages (
+   
EfiReservedMemoryType,
+   
EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE))
+   );
   }
   DEBUG ((EFI_D_INFO, "FPDT: ACPI S3 Performance Table address = 0x%x\n", 
mAcpiS3PerformanceTable));
   if (mAcpiS3PerformanceTable != NULL) {
@@ -368,7 +331,10 @@ InstallFirmwarePerformanceDataTable (
   //
   // Fail to allocate at specified address, continue to allocate at any 
address.
   //
-  mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) 
FpdtAllocateReservedMemoryBelow4G (BootPerformanceDataSize);
+  mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) 
EfiAllocatePeiAccessiblePages (
+   
EfiReservedMemoryType,
+   
EFI_SIZE_TO_PAGES (BootPerformanceDataSize)
+   );
 }
 DEBUG ((DEBUG_INFO, "FPDT: ACPI Boot Performance Table address = 0x%x\n", 
mAcpiBootPerformanceTable));
 if (mAcpiBootPerformanceTable == NULL) {
-- 
2.17.0

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


[edk2] [PATCH 2/6] ArmVirtPkg/PlatformBootManagerLib: add missing report status code call

2018-05-22 Thread Ard Biesheuvel
Consumers of status code reports may rely on a status code to be
reported when the ReadyToBoot event is signalled. For instance,
FirmwarePerformanceDxe will fail to install the FPDT ACPI table
in this case. So add the missing call.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 +
 ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c   | 4 
 2 files changed, 5 insertions(+)

diff --git 
a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index d6c1ef95dc44..0cbc82f5d27d 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -53,6 +53,7 @@ [LibraryClasses]
   PrintLib
   QemuBootOrderLib
   QemuFwCfgLib
+  ReportStatusCodeLib
   UefiBootManagerLib
   UefiBootServicesTableLib
   UefiLib
diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c 
b/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c
index ac47d21e71c8..7b59f57eb19f 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1072,6 +1073,9 @@ TryRunningQemuKernel (
   //
   EfiSignalEventReadyToBoot();
 
+  REPORT_STATUS_CODE (EFI_PROGRESS_CODE,
+(EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT));
+
   //
   // Start the image.
   //
-- 
2.17.0

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


[edk2] [PATCH 1/6] OvmfPkg/PlatformBootManagerLib: add missing report status code call

2018-05-22 Thread Ard Biesheuvel
Consumers of status code reports may rely on a status code to be
reported when the ReadyToBoot event is signalled. For instance,
FirmwarePerformanceDxe will fail to install the FPDT ACPI table
in this case. So add the missing call.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 +
 OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c   | 4 
 2 files changed, 5 insertions(+)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 27789b7377bc..f10b68424b91 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -55,6 +55,7 @@ [LibraryClasses]
   QemuFwCfgS3Lib
   LoadLinuxLib
   QemuBootOrderLib
+  ReportStatusCodeLib
   UefiLib
 
 [Pcd]
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c 
b/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c
index ef728dfdeb60..f20df9533fda 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -149,6 +150,9 @@ TryRunningQemuKernel (
   //
   EfiSignalEventReadyToBoot();
 
+  REPORT_STATUS_CODE (EFI_PROGRESS_CODE,
+(EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT));
+
   Status = LoadLinux (KernelBuf, SetupBuf);
 
 FreeAndReturn:
-- 
2.17.0

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


[edk2] [PATCH 0/6] Abstract allocation of PEI accessible memory

2018-05-22 Thread Ard Biesheuvel
At the moment, FirmwarePerformanceTableDataDxe or DxeCorePerformanceLib
are unusable on systems such as AMD Seattle, because they unconditionally
attempt to allocate memory below 4 GB, and ASSERT() if this fails. On AMD
Seattle, no 32-bit addressable DRAM exists, and so the driver will always
assert, and crash a running DEBUG build.

The reason for this is that some platforms (i.e., X64 builds consisting of
a 32-bit PEI stage and 64-bit remaining stages) require these allocations
to be below 4 GB, and for some reason, open coding this practice throughout
the code without regard for other architectures has been regarded as an
acceptable approach.

Instead, I would like to propose the approach implemented in this series:
- create an abstracted EfiAllocatePeiAccessiblePages() routine in UefiLib
  that simply allocates pages from any region on all architectures except
  X64, and allocate below 4 GB for X64
- update the various call sites with calls to this new function.

The above is implemented in patches #3 - #6. Patches #1 and #2 are fixes
for issues that I observed in ArmVirtPkg and OvmfPkg while working on
these patches.

Code can be found here:
https://github.com/ardbiesheuvel/edk2/tree/allocate-pei

Cc: Laszlo Ersek 
Cc: Leif Lindholm 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Star Zeng 
Cc: Eric Dong 
Cc: Dandan Bi  

Ard Biesheuvel (6):
  OvmfPkg/PlatformBootManagerLib: add missing report status code call
  ArmVirtPkg/PlatformBootManagerLib: add missing report status code call
  MdePkg/UefiLib: introduce EfiAllocatePeiAccessiblePages routine
  IntelFrameworkPkg/FrameworkUefiLib: add EfiAllocatePeiAccessiblePages
routine
  MdeModulePkg/DxeCorePerformanceLib: use EfiAllocatePeiAccessiblePages
  MdeModulePkg/FirmwarePerformanceDataTableDxe: use
EfiAllocatePeiAccessiblePages

 .../PlatformBootManagerLib.inf|  1 +
 .../PlatformBootManagerLib/QemuKernel.c   |  4 ++
 .../Library/FrameworkUefiLib/UefiLib.c| 48 ++
 .../DxeCorePerformanceLib.c   | 45 ++---
 .../FirmwarePerformanceDxe.c  | 50 +++
 MdePkg/Include/Library/UefiLib.h  | 23 +
 MdePkg/Library/UefiLib/UefiLib.c  | 48 ++
 .../PlatformBootManagerLib.inf|  1 +
 .../PlatformBootManagerLib/QemuKernel.c   |  4 ++
 9 files changed, 141 insertions(+), 83 deletions(-)

-- 
2.17.0

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


Re: [edk2] [PATCH v2] BaseTools/Workspace: Fix ValueChain set

2018-05-22 Thread Gao, Liming
Yes. I also check V1. It also pass patchchecker.

> -Original Message-
> From: Marvin Häuser [mailto:marvin.haeu...@outlook.com]
> Sent: Tuesday, May 22, 2018 8:51 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming ; Zhu, Yonghong 
> Subject: RE: [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> 
> Thanks Liming!
> Maybe this is an issue with my e-mail client or server, I just heard Exchange 
> sometimes messes up.
> If there really is no such change as I'm observing here, V1 should be fine 
> too.
> 
> Regards,
> Marvin.
> 
> > -Original Message-
> > From: Gao, Liming 
> > Sent: Tuesday, May 22, 2018 2:49 PM
> > To: marvin.haeu...@outlook.com; edk2-devel@lists.01.org
> > Cc: Zhu, Yonghong 
> > Subject: RE: [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> >
> > Marvin:
> >   I don't see the whitespace in this patch. I also run
> > BaseTools\Scripts\PatchCheck.py. There is no issue found.
> >
> > > -Original Message-
> > > From: Marvin Häuser [mailto:marvin.haeu...@outlook.com]
> > > Sent: Tuesday, May 22, 2018 7:52 PM
> > > To: edk2-devel@lists.01.org
> > > Cc: Gao, Liming ; Zhu, Yonghong
> > > 
> > > Subject: RE: [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> > >
> > > This is odd. I generated another patch and checked for whitespace and
> > CRLF/LF changes and found everything to be fine.
> > > Now V2 has the exact same whitespace change as V1. Also, if I see it
> > > right, it failed to CC Yonghong even though the CMD clearly shows the cc.
> > >
> > > Is there maybe some git expert around who has an idea what the issue
> > could be?
> > >
> > > Thanks,
> > > Marvin
> > >
> > > > -Original Message-
> > > > From: edk2-devel  On Behalf Of
> > > > Marvin Häuser
> > > > Sent: Tuesday, May 22, 2018 1:48 PM
> > > > To: edk2-devel@lists.01.org
> > > > Cc: liming@intel.com
> > > > Subject: [edk2] [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> > > >
> > > > Commit 88252a90d1ca7846731cd2e4e8e860454f7d97a3 changed
> > ValueChain
> > > > from a dict to a set, but also changed the (former) key type from a
> > > > touple to two separate values, which was probably unintended and
> > > > also breaks build for packages involving Structured PCDs, because
> > > > add() only takes one argument.
> > > > This commit changes the values back to touples.
> > > >
> > > > V2:
> > > >   - Removed a whitespace change.
> > > >
> > > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > > Signed-off-by: Marvin Haeuser 
> > > > ---
> > > >  BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > > b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > > index 8476543c5352..0262a91ed855 100644
> > > > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > > @@ -1347,7 +1347,7 @@ class DscBuildData(PlatformBuildClassObject):
> > > >  nextskuid = 
> > > > self.SkuIdMgr.GetNextSkuId(nextskuid)
> > > >  stru_pcd.SkuOverrideValues[skuid] =
> > > > copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not
> > > > NoDefault else copy.deepcopy({defaultstorename:
> > > > stru_pcd.DefaultValues for defaultstorename in DefaultStores} if
> > > > DefaultStores else
> > > > {TAB_DEFAULT_STORES_DEFAULT:stru_pcd.DefaultValues})
> > > >  if not NoDefault:
> > > > -stru_pcd.ValueChain.add(skuid,'')
> > > > +stru_pcd.ValueChain.add((skuid,''))
> > > >  if stru_pcd.Type in
> > > > [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],
> > > > self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
> > > >  for skuid in SkuIds:
> > > >  nextskuid = skuid @@ -1366,7 +1366,7 @@ class
> > > > DscBuildData(PlatformBuildClassObject):
> > > >  for defaultstoreid in DefaultStores:
> > > >  if defaultstoreid not in 
> > > > stru_pcd.SkuOverrideValues[skuid]:
> > > >
> > > > stru_pcd.SkuOverrideValues[skuid][defaultstoreid] =
> > > >
> > copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid][mindefaultstoren
> > > > a
> > > > me])
> > > > -
> > > > stru_pcd.ValueChain.add(skuid,defaultstoreid)
> > > > +
> > > > + stru_pcd.ValueChain.add((skuid,defaultstoreid))
> > > >  S_pcd_set = DscBuildData.OverrideByFdfComm(S_pcd_set)
> > > >  Str_Pcd_Values = self.GenerateByteArrayValue(S_pcd_set)
> > > >  if Str_Pcd_Values:
> > > > --
> > > > 2.17.0.windows.1
> > > >
> > > > ___
> > > > edk2-devel mailing list
> > > > 

Re: [edk2] [PATCH v2] BaseTools/Workspace: Fix ValueChain set

2018-05-22 Thread Marvin Häuser
Thanks Liming!
Maybe this is an issue with my e-mail client or server, I just heard Exchange 
sometimes messes up.
If there really is no such change as I'm observing here, V1 should be fine too.

Regards,
Marvin.

> -Original Message-
> From: Gao, Liming 
> Sent: Tuesday, May 22, 2018 2:49 PM
> To: marvin.haeu...@outlook.com; edk2-devel@lists.01.org
> Cc: Zhu, Yonghong 
> Subject: RE: [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> 
> Marvin:
>   I don't see the whitespace in this patch. I also run
> BaseTools\Scripts\PatchCheck.py. There is no issue found.
> 
> > -Original Message-
> > From: Marvin Häuser [mailto:marvin.haeu...@outlook.com]
> > Sent: Tuesday, May 22, 2018 7:52 PM
> > To: edk2-devel@lists.01.org
> > Cc: Gao, Liming ; Zhu, Yonghong
> > 
> > Subject: RE: [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> >
> > This is odd. I generated another patch and checked for whitespace and
> CRLF/LF changes and found everything to be fine.
> > Now V2 has the exact same whitespace change as V1. Also, if I see it
> > right, it failed to CC Yonghong even though the CMD clearly shows the cc.
> >
> > Is there maybe some git expert around who has an idea what the issue
> could be?
> >
> > Thanks,
> > Marvin
> >
> > > -Original Message-
> > > From: edk2-devel  On Behalf Of
> > > Marvin Häuser
> > > Sent: Tuesday, May 22, 2018 1:48 PM
> > > To: edk2-devel@lists.01.org
> > > Cc: liming@intel.com
> > > Subject: [edk2] [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> > >
> > > Commit 88252a90d1ca7846731cd2e4e8e860454f7d97a3 changed
> ValueChain
> > > from a dict to a set, but also changed the (former) key type from a
> > > touple to two separate values, which was probably unintended and
> > > also breaks build for packages involving Structured PCDs, because
> > > add() only takes one argument.
> > > This commit changes the values back to touples.
> > >
> > > V2:
> > >   - Removed a whitespace change.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Marvin Haeuser 
> > > ---
> > >  BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > index 8476543c5352..0262a91ed855 100644
> > > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > @@ -1347,7 +1347,7 @@ class DscBuildData(PlatformBuildClassObject):
> > >  nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
> > >  stru_pcd.SkuOverrideValues[skuid] =
> > > copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not
> > > NoDefault else copy.deepcopy({defaultstorename:
> > > stru_pcd.DefaultValues for defaultstorename in DefaultStores} if
> > > DefaultStores else
> > > {TAB_DEFAULT_STORES_DEFAULT:stru_pcd.DefaultValues})
> > >  if not NoDefault:
> > > -stru_pcd.ValueChain.add(skuid,'')
> > > +stru_pcd.ValueChain.add((skuid,''))
> > >  if stru_pcd.Type in
> > > [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],
> > > self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
> > >  for skuid in SkuIds:
> > >  nextskuid = skuid @@ -1366,7 +1366,7 @@ class
> > > DscBuildData(PlatformBuildClassObject):
> > >  for defaultstoreid in DefaultStores:
> > >  if defaultstoreid not in 
> > > stru_pcd.SkuOverrideValues[skuid]:
> > >
> > > stru_pcd.SkuOverrideValues[skuid][defaultstoreid] =
> > >
> copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid][mindefaultstoren
> > > a
> > > me])
> > > -stru_pcd.ValueChain.add(skuid,defaultstoreid)
> > > +
> > > + stru_pcd.ValueChain.add((skuid,defaultstoreid))
> > >  S_pcd_set = DscBuildData.OverrideByFdfComm(S_pcd_set)
> > >  Str_Pcd_Values = self.GenerateByteArrayValue(S_pcd_set)
> > >  if Str_Pcd_Values:
> > > --
> > > 2.17.0.windows.1
> > >
> > > ___
> > > edk2-devel mailing list
> > > edk2-devel@lists.01.org
> > > https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2] BaseTools/Workspace: Fix ValueChain set

2018-05-22 Thread Gao, Liming
Marvin:
  I don't see the whitespace in this patch. I also run 
BaseTools\Scripts\PatchCheck.py. There is no issue found. 

> -Original Message-
> From: Marvin Häuser [mailto:marvin.haeu...@outlook.com]
> Sent: Tuesday, May 22, 2018 7:52 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming ; Zhu, Yonghong 
> Subject: RE: [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> 
> This is odd. I generated another patch and checked for whitespace and CRLF/LF 
> changes and found everything to be fine.
> Now V2 has the exact same whitespace change as V1. Also, if I see it right, 
> it failed to CC Yonghong even though the CMD clearly
> shows the cc.
> 
> Is there maybe some git expert around who has an idea what the issue could be?
> 
> Thanks,
> Marvin
> 
> > -Original Message-
> > From: edk2-devel  On Behalf Of Marvin
> > Häuser
> > Sent: Tuesday, May 22, 2018 1:48 PM
> > To: edk2-devel@lists.01.org
> > Cc: liming@intel.com
> > Subject: [edk2] [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> >
> > Commit 88252a90d1ca7846731cd2e4e8e860454f7d97a3 changed ValueChain
> > from a dict to a set, but also changed the (former) key type from a touple 
> > to
> > two separate values, which was probably unintended and also breaks build
> > for packages involving Structured PCDs, because add() only takes one
> > argument.
> > This commit changes the values back to touples.
> >
> > V2:
> >   - Removed a whitespace change.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Marvin Haeuser 
> > ---
> >  BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > index 8476543c5352..0262a91ed855 100644
> > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > @@ -1347,7 +1347,7 @@ class DscBuildData(PlatformBuildClassObject):
> >  nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
> >  stru_pcd.SkuOverrideValues[skuid] =
> > copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault
> > else copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for
> > defaultstorename in DefaultStores} if DefaultStores else
> > {TAB_DEFAULT_STORES_DEFAULT:stru_pcd.DefaultValues})
> >  if not NoDefault:
> > -stru_pcd.ValueChain.add(skuid,'')
> > +stru_pcd.ValueChain.add((skuid,''))
> >  if stru_pcd.Type in
> > [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],
> > self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
> >  for skuid in SkuIds:
> >  nextskuid = skuid
> > @@ -1366,7 +1366,7 @@ class DscBuildData(PlatformBuildClassObject):
> >  for defaultstoreid in DefaultStores:
> >  if defaultstoreid not in 
> > stru_pcd.SkuOverrideValues[skuid]:
> >  
> > stru_pcd.SkuOverrideValues[skuid][defaultstoreid] =
> > copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid][mindefaultstorena
> > me])
> > -stru_pcd.ValueChain.add(skuid,defaultstoreid)
> > +
> > + stru_pcd.ValueChain.add((skuid,defaultstoreid))
> >  S_pcd_set = DscBuildData.OverrideByFdfComm(S_pcd_set)
> >  Str_Pcd_Values = self.GenerateByteArrayValue(S_pcd_set)
> >  if Str_Pcd_Values:
> > --
> > 2.17.0.windows.1
> >
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v3 1/4] OvmfPkg: add Tcg2PhysicalPresenceLibNull when !TPM2_ENABLE

2018-05-22 Thread Laszlo Ersek
On 05/18/18 14:23, marcandre.lur...@redhat.com wrote:

> diff --git 
> a/OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLib.inf 
> b/OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLib.inf
> new file mode 100644
> index ..92ce5f04b37f
> --- /dev/null
> +++ 
> b/OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLib.inf
> @@ -0,0 +1,33 @@
> +## @file
> +#  NULL Tcg2PhysicalPresenceLib library instance
> +#
> +# Under SecurityPkg, the corresponding library instance will check and
> +# execute TPM 2.0 request from OS or BIOS; the request may ask for user
> +# confirmation before execution. This Null instance implements a no-op
> +# Tcg2PhysicalPresenceLibProcessRequest(), without user interaction.
> +#
> +# Copyright (C) 2018, Red Hat, Inc.
> +# Copyright (c) 2013 - 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.
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION= 0x00010005
> +  BASE_NAME  = DxeTcg2PhysicalPresenceLibNull
> +  FILE_GUID  = 2A6BA243-DC22-42D8-9C3D-AE3728DC7AFA
> +  MODULE_TYPE= DXE_DRIVER
> +  VERSION_STRING = 1.0
> +  LIBRARY_CLASS  = Tcg2PhysicalPresenceLib|DXE_DRIVER 
> DXE_RUNTIME_DRIVER DXE_SAL_DRIVER UEFI_APPLICATION UEFI_DRIVER
> +
> +[Sources]
> +  DxeTcg2PhysicalPresenceLib.c
> +
> +[Packages]
> +  MdeModulePkg/MdeModulePkg.dec
> +  SecurityPkg/SecurityPkg.dec

Here my suggestion was to drop MdeModulePkg.dec, and keep MdePkg.dec and
SecurityPkg.dec.

Anyway, I plan to fix that up for you.

With it fixed:

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 v2] BaseTools/Workspace: Fix ValueChain set

2018-05-22 Thread Marvin Häuser
This is odd. I generated another patch and checked for whitespace and CRLF/LF 
changes and found everything to be fine.
Now V2 has the exact same whitespace change as V1. Also, if I see it right, it 
failed to CC Yonghong even though the CMD clearly shows the cc.

Is there maybe some git expert around who has an idea what the issue could be?

Thanks,
Marvin

> -Original Message-
> From: edk2-devel  On Behalf Of Marvin
> Häuser
> Sent: Tuesday, May 22, 2018 1:48 PM
> To: edk2-devel@lists.01.org
> Cc: liming@intel.com
> Subject: [edk2] [PATCH v2] BaseTools/Workspace: Fix ValueChain set
> 
> Commit 88252a90d1ca7846731cd2e4e8e860454f7d97a3 changed ValueChain
> from a dict to a set, but also changed the (former) key type from a touple to
> two separate values, which was probably unintended and also breaks build
> for packages involving Structured PCDs, because add() only takes one
> argument.
> This commit changes the values back to touples.
> 
> V2:
>   - Removed a whitespace change.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marvin Haeuser 
> ---
>  BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py
> b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index 8476543c5352..0262a91ed855 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -1347,7 +1347,7 @@ class DscBuildData(PlatformBuildClassObject):
>  nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
>  stru_pcd.SkuOverrideValues[skuid] =
> copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault
> else copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for
> defaultstorename in DefaultStores} if DefaultStores else
> {TAB_DEFAULT_STORES_DEFAULT:stru_pcd.DefaultValues})
>  if not NoDefault:
> -stru_pcd.ValueChain.add(skuid,'')
> +stru_pcd.ValueChain.add((skuid,''))
>  if stru_pcd.Type in
> [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],
> self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
>  for skuid in SkuIds:
>  nextskuid = skuid
> @@ -1366,7 +1366,7 @@ class DscBuildData(PlatformBuildClassObject):
>  for defaultstoreid in DefaultStores:
>  if defaultstoreid not in 
> stru_pcd.SkuOverrideValues[skuid]:
>  
> stru_pcd.SkuOverrideValues[skuid][defaultstoreid] =
> copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid][mindefaultstorena
> me])
> -stru_pcd.ValueChain.add(skuid,defaultstoreid)
> +
> + stru_pcd.ValueChain.add((skuid,defaultstoreid))
>  S_pcd_set = DscBuildData.OverrideByFdfComm(S_pcd_set)
>  Str_Pcd_Values = self.GenerateByteArrayValue(S_pcd_set)
>  if Str_Pcd_Values:
> --
> 2.17.0.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2] BaseTools/Workspace: Fix ValueChain set

2018-05-22 Thread Marvin Häuser
Commit 88252a90d1ca7846731cd2e4e8e860454f7d97a3 changed ValueChain
from a dict to a set, but also changed the (former) key type from a
touple to two separate values, which was probably unintended and also
breaks build for packages involving Structured PCDs, because add()
only takes one argument.
This commit changes the values back to touples.

V2:
  - Removed a whitespace change.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 8476543c5352..0262a91ed855 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1347,7 +1347,7 @@ class DscBuildData(PlatformBuildClassObject):
 nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
 stru_pcd.SkuOverrideValues[skuid] = 
copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault else 
copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for defaultstorename in 
DefaultStores} if DefaultStores else 
{TAB_DEFAULT_STORES_DEFAULT:stru_pcd.DefaultValues})
 if not NoDefault:
-stru_pcd.ValueChain.add(skuid,'')
+stru_pcd.ValueChain.add((skuid,''))
 if stru_pcd.Type in 
[self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], 
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
 for skuid in SkuIds:
 nextskuid = skuid
@@ -1366,7 +1366,7 @@ class DscBuildData(PlatformBuildClassObject):
 for defaultstoreid in DefaultStores:
 if defaultstoreid not in 
stru_pcd.SkuOverrideValues[skuid]:
 stru_pcd.SkuOverrideValues[skuid][defaultstoreid] 
= copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid][mindefaultstorename])
-stru_pcd.ValueChain.add(skuid,defaultstoreid)
+stru_pcd.ValueChain.add((skuid,defaultstoreid))
 S_pcd_set = DscBuildData.OverrideByFdfComm(S_pcd_set)
 Str_Pcd_Values = self.GenerateByteArrayValue(S_pcd_set)
 if Str_Pcd_Values:
-- 
2.17.0.windows.1

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


Re: [edk2] [PATCH] Platform/ARM: Fix FVP broken build with "-D ARM_FVP_RUN_NORFLASH"

2018-05-22 Thread Leif Lindholm
On Mon, May 21, 2018 at 04:09:26PM +0100, AlexeiFedorov wrote:
> From: Alexei Fedorov 
> 
> UEFI build fails for ArmVExpress-FVP-AArch64 when using
> "-D ARM_FVP_RUN_NORFLASH" build option, which prevents
> EDK2_SKIP_PEICORE macro from being defined in
> ArmVExpress-FVP-AArch64.dsc:
> 
> !ifndef ARM_FVP_RUN_NORFLASH
>   DEFINE EDK2_SKIP_PEICORE=1
> !endif
> 
> When EDK2_SKIP_PEICORE macro is not defined, build fails with
> errors 1001:
> Module type [PEI_CORE] is not supported by library instance
> [MdeModulePkg\Library\DxeReportStatusCodeLib\DxeReportStatusCodeLib.inf]
> consumed by [n:\edk2\MdeModulePkg\Core\Pei\PeiMain.inf]
> Module type [PEIM] is not supported by library instance
> [MdeModulePkg\Library\DxeReportStatusCodeLib\DxeReportStatusCodeLib.inf]
> consumed by [n:\edk2\MdeModulePkg\Core\DxeIplPeim\DxeIpl.inf]
> and
> ../Platform/ARM/VExpressPkg/Include/Platform/RTSM/ArmPlatform.h:19:10:
> fatal error: VExpressMotherBoard.h: No such file or directory
> 
> This patch fixes the above build errors by adding
> MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
> in [LibraryClasses.common.PEI_CORE] and [LibraryClasses.common.PEIM]
> sections of ArmVExpress.dsc.inc and
> Platform/ARM/VExpressPkg/ArmVExpressPkg.dec
> in [Packages] section of ArmVExpressLibSec.inf
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Alexei Fedorov 

Reviewed-by: Leif Lindholm 
Pushed as f17e3a1649.

Thanks!

> ---
> All the changes can be reviewed at:
> https://github.com/AlexeiFedorov/edk2-platforms/tree/237_fix_fvp_build_v1
> 
> Notes:
> v1:
> Add PeiReportStatusCodeLib in PEI_CORE and PEIM sections   [Alexei]
> Add ArmVExpressPkg.dec in ArmVExpressLibSec.inf[Alexei]
> 
>  Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc  | 
> 2 ++
>  Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf | 
> 3 ++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc 
> b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> index 
> de201b0c81d020e1e06ee320cf0f14f186723657..bb899b91c525ee821b9506cca75224f4bc41e3ae
>  100644
> --- a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> +++ b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> @@ -166,6 +166,7 @@ [LibraryClasses.common.PEI_CORE]
>
> MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
>PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
>PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
> +  
> ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
>
> OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
>
> PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
>
> ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
> @@ -179,6 +180,7 @@ [LibraryClasses.common.PEIM]
>
> MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
>PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
>PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
> +  
> ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
>
> OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
>
> PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
>
> PeiResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
> diff --git 
> a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf 
> b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf
> index 
> 2287756cf8c5f988ac1fe85485f242407ebffa67..ec29d99835401b65f45ff494df4a0955a1618af1
>  100644
> --- 
> a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf
> +++ 
> b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf
> @@ -1,5 +1,5 @@
>  #/* @file
> -#  Copyright (c) 2011-2012, ARM Limited. All rights reserved.
> +#  Copyright (c) 2011-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
> @@ -22,6 +22,7 @@ [Defines]
>  [Packages]
>MdePkg/MdePkg.dec
>MdeModulePkg/MdeModulePkg.dec
> +  Platform/ARM/VExpressPkg/ArmVExpressPkg.dec
>EmbeddedPkg/EmbeddedPkg.dec
>ArmPkg/ArmPkg.dec
>ArmPlatformPkg/ArmPlatformPkg.dec
> -- 
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org

Re: [edk2] [PATCH] BaseTools/Workspace: Fix ValueChain set

2018-05-22 Thread Zhu, Yonghong
The patch looks good. Please send V2 to remove the space change. Thanks.

Best Regards,
Zhu Yonghong


-Original Message-
From: Marvin Häuser [mailto:marvin.haeu...@outlook.com] 
Sent: Saturday, May 19, 2018 5:28 PM
To: edk2-devel@lists.01.org
Cc: Carsey, Jaben ; Gao, Liming ; 
Zhu, Yonghong 
Subject: RE: [PATCH] BaseTools/Workspace: Fix ValueChain set

Sorry, it seems like my IDE did whitespace changes for the second change.
I will submit a V2 once the functionality has been reviewed.

> -Original Message-
> From: edk2-devel  On Behalf Of Marvin 
> Häuser
> Sent: Saturday, May 19, 2018 12:43 AM
> To: edk2-devel@lists.01.org
> Cc: jaben.car...@intel.com; liming@intel.com
> Subject: [edk2] [PATCH] BaseTools/Workspace: Fix ValueChain set
> 
> Commit 88252a90d1ca7846731cd2e4e8e860454f7d97a3 changed ValueChain 
> from a dict to a set, but also changed the (former) key type from a 
> touple to two separate values, which was probably unintended and also 
> breaks build for packages involving Structured PCDs, because add() 
> only takes one argument.
> This commit changes the values back to touples.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marvin Haeuser 
> ---
>  BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py
> b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index 8476543c5352..0262a91ed855 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -1347,7 +1347,7 @@ class DscBuildData(PlatformBuildClassObject):
>  nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
>  stru_pcd.SkuOverrideValues[skuid] =
> copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault 
> else copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for 
> defaultstorename in DefaultStores} if DefaultStores else
> {TAB_DEFAULT_STORES_DEFAULT:stru_pcd.DefaultValues})
>  if not NoDefault:
> -stru_pcd.ValueChain.add(skuid,'')
> +stru_pcd.ValueChain.add((skuid,''))
>  if stru_pcd.Type in
> [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],
> self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
>  for skuid in SkuIds:
>  nextskuid = skuid @@ -1366,7 +1366,7 @@ class 
> DscBuildData(PlatformBuildClassObject):
>  for defaultstoreid in DefaultStores:
>  if defaultstoreid not in 
> stru_pcd.SkuOverrideValues[skuid]:
>  
> stru_pcd.SkuOverrideValues[skuid][defaultstoreid] = 
> copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid][mindefaultstorena
> me])
> -stru_pcd.ValueChain.add(skuid,defaultstoreid)
> +
> + stru_pcd.ValueChain.add((skuid,defaultstoreid))
>  S_pcd_set = DscBuildData.OverrideByFdfComm(S_pcd_set)
>  Str_Pcd_Values = self.GenerateByteArrayValue(S_pcd_set)
>  if Str_Pcd_Values:
> --
> 2.17.0.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [platforms PATCH v2 4/4] Marvell/Library: ComPhyLib: Fix configuration for PCIE x4 and x2

2018-05-22 Thread Leif Lindholm
On Mon, May 21, 2018 at 12:54:01PM +0200, Marcin Wojtas wrote:
> Hi Leif,
> 
> 
> 2018-05-09 18:49 GMT+02:00 Leif Lindholm :
> 
> > A couple of minor style comments.
> >
> > If you don't disagree, I can fix that up before pushing and you can
> > have Reviewed-by: Leif Lindholm  for 1,3-4.
> >
> >
> Yes, I would appreciate that.

1,3-4/4 pushed as 5cfda16b1a..a310c6b5e1.

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


Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track FPDT record in DXE phase

2018-05-22 Thread Ard Biesheuvel
On 22 May 2018 at 12:38, Zeng, Star  wrote:
> I could not recall the whole background.
>
> Let us separate the problem into two parts.
>
> 1. For this special case in DxeCorePerformanceLib, we at least have approach 
> (although just for short term).

I disagree. The approach involves attempting to allocate below 4 GB,
and fall back to allocating elsewhere if that fails.

On X64, the fallback should not exist. If the first allocation fails,
you will end up with an allocation that PEI may not be able to access,
and you will not get any error or warning about this condition.

On other architectures, allocating below 4 GB unnecessarily may be
wasteful, since it uses up 32-bit addressable that we may prefer to
use for DMA, for instance, given that 32-bit DMA is more efficient
even on PCIe systems.

So even if it makes the error go away, I think it is not a solution at all.

> 2. For the general problem about whether introducing new interface (PCD and 
> API, seemingly it needs to be in MdePkg), it depends on whether we agree to 
> add new interface and seems need more time to discuss. If yes, then 
> library/driver could be updated to consume it.
>
> If we agree to add new interface, as current instances of MemoryAllocationLib 
> are very nature by phases (PEI, DXE (Uefi/DxeCore), SMM, etc), but the new 
> interface is just needed in DXE (Uefi/DxeCore) instances, how about adding it 
> in UefiLib?
>

That is a good point, actually. I will look into this.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track FPDT record in DXE phase

2018-05-22 Thread Zeng, Star
I could not recall the whole background.

Let us separate the problem into two parts.

1. For this special case in DxeCorePerformanceLib, we at least have approach 
(although just for short term).
2. For the general problem about whether introducing new interface (PCD and 
API, seemingly it needs to be in MdePkg), it depends on whether we agree to add 
new interface and seems need more time to discuss. If yes, then library/driver 
could be updated to consume it.

If we agree to add new interface, as current instances of MemoryAllocationLib 
are very nature by phases (PEI, DXE (Uefi/DxeCore), SMM, etc), but the new 
interface is just needed in DXE (Uefi/DxeCore) instances, how about adding it 
in UefiLib?


Thanks,
Star
-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Tuesday, May 22, 2018 6:00 PM
To: Zeng, Star ; Ard Biesheuvel 
Cc: Bi, Dandan ; Andrew Fish ; Kinney, 
Michael D ; Leif Lindholm 
; edk2-devel@lists.01.org; Gao, Liming 
; Matt Sealey 
Subject: Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track 
FPDT record in DXE phase

Hi Star,

On 05/22/18 11:38, Zeng, Star wrote:
> It comes to an old question: how to know PEI is 32bit/64bit? But not DXE is 
> 32bit/64bit.

we've discussed this question in the past (as you remember :) ) and people 
suggested both HOBs and PCDs to expose the "PEI phase max address" to DXE. All 
of those ideas were rejected -- I'm unsure why, to this day --, but assuming 
people who opposed those ideas are going to oppose them again, I think Ard's 
idea is good, about introducing dedicated MemoryAllocationLib interfaces, for 
PEI-targeted memory allocation.

Once drivers adopt these new interfaces, platforms can at least fork the 
MemoryAllocationLib instance(s) they need, and customize the PEI phase max 
address one way or another.

Thanks,
Laszlo

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Tuesday, May 22, 2018 5:03 PM
> To: Zeng, Star 
> Cc: Bi, Dandan ; Laszlo Ersek 
> ; Andrew Fish ; Kinney, Michael D 
> ; Leif Lindholm 
> ; edk2-devel@lists.01.org; Gao, Liming 
> ; Matt Sealey 
> Subject: Re: [edk2] [PATCH v2 3/8] 
> MdeModulePkg/DxeCorePerformanceLib:Track FPDT record in DXE phase
> 
> pd On 22 May 2018 at 10:58, Zeng, Star  wrote:
>> How about the code to try allocating <4G memory, then try allocating any 
>> memory if failed to allocate <4G memory?
>>
>> For example, the code snippet in SmbiosDxe.c.
>>
>> PhysicalAddress = 0x;
>> Status = gBS->AllocatePages (
>> AllocateMaxAddress,
>> EfiRuntimeServicesData,
>> EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
>> 
>> );
>> if (EFI_ERROR (Status)) {
>>   DEBUG ((EFI_D_ERROR, "SmbiosCreateTable () could not allocate 
>> EntryPointStructure < 4GB\n"));
>>   Status = gBS->AllocatePages (
>>   AllocateAnyPages,
>>   EfiRuntimeServicesData,
>>   EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
>>   
>>   );
>>  if (EFI_ERROR (Status)) {
>> return EFI_OUT_OF_RESOURCES;
>>   }
>> }
>>
> 
> Yes, that should do the trick.
> 
> But perhaps we should add something like
> 
> AllocatePeiAccessiblePages()
> 
> to MemoryAllocationLib, which just uses AllocateMaxAddress or 
> AllocateAnyPages depending on whether MDE_CPU_X64 is #defined.
> 

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


Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track FPDT record in DXE phase

2018-05-22 Thread Ard Biesheuvel
On 22 May 2018 at 11:38, Zeng, Star  wrote:
> It comes to an old question: how to know PEI is 32bit/64bit? But not DXE is 
> 32bit/64bit.
>

True. But the current approach is to always assume that PEI is 32-bit,
on every architecture. We can improve upon that by only making this
assumption on X64 builds of DXE, and do so in an abstracted manner
rather than putting the hardcoded limit everywhere in the code.



> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Tuesday, May 22, 2018 5:03 PM
> To: Zeng, Star 
> Cc: Bi, Dandan ; Laszlo Ersek ; 
> Andrew Fish ; Kinney, Michael D 
> ; Leif Lindholm ; 
> edk2-devel@lists.01.org; Gao, Liming ; Matt Sealey 
> 
> Subject: Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track 
> FPDT record in DXE phase
>
> pd On 22 May 2018 at 10:58, Zeng, Star  wrote:
>> How about the code to try allocating <4G memory, then try allocating any 
>> memory if failed to allocate <4G memory?
>>
>> For example, the code snippet in SmbiosDxe.c.
>>
>> PhysicalAddress = 0x;
>> Status = gBS->AllocatePages (
>> AllocateMaxAddress,
>> EfiRuntimeServicesData,
>> EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
>> 
>> );
>> if (EFI_ERROR (Status)) {
>>   DEBUG ((EFI_D_ERROR, "SmbiosCreateTable () could not allocate 
>> EntryPointStructure < 4GB\n"));
>>   Status = gBS->AllocatePages (
>>   AllocateAnyPages,
>>   EfiRuntimeServicesData,
>>   EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
>>   
>>   );
>>  if (EFI_ERROR (Status)) {
>> return EFI_OUT_OF_RESOURCES;
>>   }
>> }
>>
>
> Yes, that should do the trick.
>
> But perhaps we should add something like
>
> AllocatePeiAccessiblePages()
>
> to MemoryAllocationLib, which just uses AllocateMaxAddress or
> AllocateAnyPages depending on whether MDE_CPU_X64 is #defined.
>
> --
> Ard.
>
>> -Original Message-
>> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
>> Sent: Tuesday, May 22, 2018 4:52 PM
>> To: Bi, Dandan ; Laszlo Ersek ; 
>> Andrew Fish ; Kinney, Michael D 
>> Cc: Leif Lindholm ; edk2-devel@lists.01.org; Zeng, 
>> Star ; Gao, Liming ; Matt Sealey 
>> 
>> Subject: Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track 
>> FPDT record in DXE phase
>>
>> (+ Laszlo, Andrew, Mike)
>>
>> On 22 May 2018 at 02:33, Bi, Dandan  wrote:
>>> Sorry for the delayed response.
>>>
>>> The allocated  performance table ( below 4G ) is to save the boot 
>>> performance data in normal boot and S3 phase.
>>> PEIM FirmwarePerformancePei will get the address of the performance table 
>>> and update the performance date of S3 phase to the table.
>>> The address need to be handled in PEI phase(32bit), that's the main reason 
>>> why we allocate it below 4G.
>>>
>>
>> The 32-bit PEI + 64-bit DXE combo is specific to X64. You have added
>> code to a generic library that ASSERT()s if allocating memory below 4
>> GB fails, breaking non-PC architectures.
>>
>> So please, fix this. Or at least suggest a way around it so that other
>> architectures can keep using this library.
>>
>> This is another consequence of our failure to model the special 32-bit
>> PEI/64-bit DXE combination using proper PI interfaces, resulting in
>> these kinds of breakages and open coded 4 GB allocations all
>> throughout the code. Can we please work on getting this fixed?
>>
>>
>>> -Original Message-
>>> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
>>> Sent: Wednesday, May 2, 2018 12:27 AM
>>> To: Bi, Dandan ; Leif Lindholm 
>>> 
>>> Cc: edk2-devel@lists.01.org; Zeng, Star ; Gao, Liming 
>>> ; Matt Sealey 
>>> Subject: Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track 
>>> FPDT record in DXE phase
>>>
>>> On 30 January 2018 at 14:53, Dandan Bi  wrote:
 V2:
 Update DxecorePerformanceLib to report the boot performance table
 address instead of records contents.

 Updated to convert Pref entry to FPDT record in DXE phase and then
 allocate boot performance table to save the record and report
 the address of boot performance table to FirmwarePerformanceDxe.

 Cc: Liming Gao 
 Cc: Star Zeng 
 

Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track FPDT record in DXE phase

2018-05-22 Thread Laszlo Ersek
Hi Star,

On 05/22/18 11:38, Zeng, Star wrote:
> It comes to an old question: how to know PEI is 32bit/64bit? But not DXE is 
> 32bit/64bit.

we've discussed this question in the past (as you remember :) ) and
people suggested both HOBs and PCDs to expose the "PEI phase max
address" to DXE. All of those ideas were rejected -- I'm unsure why, to
this day --, but assuming people who opposed those ideas are going to
oppose them again, I think Ard's idea is good, about introducing
dedicated MemoryAllocationLib interfaces, for PEI-targeted memory
allocation.

Once drivers adopt these new interfaces, platforms can at least fork the
MemoryAllocationLib instance(s) they need, and customize the PEI phase
max address one way or another.

Thanks,
Laszlo

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
> Sent: Tuesday, May 22, 2018 5:03 PM
> To: Zeng, Star 
> Cc: Bi, Dandan ; Laszlo Ersek ; 
> Andrew Fish ; Kinney, Michael D 
> ; Leif Lindholm ; 
> edk2-devel@lists.01.org; Gao, Liming ; Matt Sealey 
> 
> Subject: Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track 
> FPDT record in DXE phase
> 
> pd On 22 May 2018 at 10:58, Zeng, Star  wrote:
>> How about the code to try allocating <4G memory, then try allocating any 
>> memory if failed to allocate <4G memory?
>>
>> For example, the code snippet in SmbiosDxe.c.
>>
>> PhysicalAddress = 0x;
>> Status = gBS->AllocatePages (
>> AllocateMaxAddress,
>> EfiRuntimeServicesData,
>> EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
>> 
>> );
>> if (EFI_ERROR (Status)) {
>>   DEBUG ((EFI_D_ERROR, "SmbiosCreateTable () could not allocate 
>> EntryPointStructure < 4GB\n"));
>>   Status = gBS->AllocatePages (
>>   AllocateAnyPages,
>>   EfiRuntimeServicesData,
>>   EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
>>   
>>   );
>>  if (EFI_ERROR (Status)) {
>> return EFI_OUT_OF_RESOURCES;
>>   }
>> }
>>
> 
> Yes, that should do the trick.
> 
> But perhaps we should add something like
> 
> AllocatePeiAccessiblePages()
> 
> to MemoryAllocationLib, which just uses AllocateMaxAddress or
> AllocateAnyPages depending on whether MDE_CPU_X64 is #defined.
> 

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


Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track FPDT record in DXE phase

2018-05-22 Thread Zeng, Star
It comes to an old question: how to know PEI is 32bit/64bit? But not DXE is 
32bit/64bit.

Thanks,
Star
-Original Message-
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
Sent: Tuesday, May 22, 2018 5:03 PM
To: Zeng, Star 
Cc: Bi, Dandan ; Laszlo Ersek ; Andrew 
Fish ; Kinney, Michael D ; Leif 
Lindholm ; edk2-devel@lists.01.org; Gao, Liming 
; Matt Sealey 
Subject: Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track 
FPDT record in DXE phase

pd On 22 May 2018 at 10:58, Zeng, Star  wrote:
> How about the code to try allocating <4G memory, then try allocating any 
> memory if failed to allocate <4G memory?
>
> For example, the code snippet in SmbiosDxe.c.
>
> PhysicalAddress = 0x;
> Status = gBS->AllocatePages (
> AllocateMaxAddress,
> EfiRuntimeServicesData,
> EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
> 
> );
> if (EFI_ERROR (Status)) {
>   DEBUG ((EFI_D_ERROR, "SmbiosCreateTable () could not allocate 
> EntryPointStructure < 4GB\n"));
>   Status = gBS->AllocatePages (
>   AllocateAnyPages,
>   EfiRuntimeServicesData,
>   EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
>   
>   );
>  if (EFI_ERROR (Status)) {
> return EFI_OUT_OF_RESOURCES;
>   }
> }
>

Yes, that should do the trick.

But perhaps we should add something like

AllocatePeiAccessiblePages()

to MemoryAllocationLib, which just uses AllocateMaxAddress or
AllocateAnyPages depending on whether MDE_CPU_X64 is #defined.

-- 
Ard.

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Tuesday, May 22, 2018 4:52 PM
> To: Bi, Dandan ; Laszlo Ersek ; 
> Andrew Fish ; Kinney, Michael D 
> Cc: Leif Lindholm ; edk2-devel@lists.01.org; Zeng, 
> Star ; Gao, Liming ; Matt Sealey 
> 
> Subject: Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track 
> FPDT record in DXE phase
>
> (+ Laszlo, Andrew, Mike)
>
> On 22 May 2018 at 02:33, Bi, Dandan  wrote:
>> Sorry for the delayed response.
>>
>> The allocated  performance table ( below 4G ) is to save the boot 
>> performance data in normal boot and S3 phase.
>> PEIM FirmwarePerformancePei will get the address of the performance table 
>> and update the performance date of S3 phase to the table.
>> The address need to be handled in PEI phase(32bit), that's the main reason 
>> why we allocate it below 4G.
>>
>
> The 32-bit PEI + 64-bit DXE combo is specific to X64. You have added
> code to a generic library that ASSERT()s if allocating memory below 4
> GB fails, breaking non-PC architectures.
>
> So please, fix this. Or at least suggest a way around it so that other
> architectures can keep using this library.
>
> This is another consequence of our failure to model the special 32-bit
> PEI/64-bit DXE combination using proper PI interfaces, resulting in
> these kinds of breakages and open coded 4 GB allocations all
> throughout the code. Can we please work on getting this fixed?
>
>
>> -Original Message-
>> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
>> Sent: Wednesday, May 2, 2018 12:27 AM
>> To: Bi, Dandan ; Leif Lindholm 
>> 
>> Cc: edk2-devel@lists.01.org; Zeng, Star ; Gao, Liming 
>> ; Matt Sealey 
>> Subject: Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track 
>> FPDT record in DXE phase
>>
>> On 30 January 2018 at 14:53, Dandan Bi  wrote:
>>> V2:
>>> Update DxecorePerformanceLib to report the boot performance table
>>> address instead of records contents.
>>>
>>> Updated to convert Pref entry to FPDT record in DXE phase and then
>>> allocate boot performance table to save the record and report
>>> the address of boot performance table to FirmwarePerformanceDxe.
>>>
>>> Cc: Liming Gao 
>>> Cc: Star Zeng 
>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>> Signed-off-by: Dandan Bi 
>>> ---
>>>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 1389 
>>> +++-
>>>  .../DxeCorePerformanceLib.inf  |   20 +-
>>>  .../DxeCorePerformanceLibInternal.h|   17 +-
>>>  3 files changed, 1108 insertions(+), 318 deletions(-)
>>>
>>> diff --git 
>>> 

Re: [edk2] [PATCH] BaseTools/tools_def: add "-fno-unwind-tables" to GCC_AARCH64_CC_FLAGS

2018-05-22 Thread Laszlo Ersek
On 05/21/18 12:30, Leif Lindholm wrote:
> On Fri, May 18, 2018 at 08:23:01PM +0200, Laszlo Ersek wrote:
>> The ElfConvert routines in GenFw don't handle the ".eh_frame" ELF section
>> emitted by gcc. For this reason, Leif disabled the generation of that
>> section for AARCH64 with "-fno-asynchronous-unwind-tables" in commit
>> 28e80befa4fe [1], and Ard did the same for IA32 and X64 in commit
>> 26ecc55c027d [2]. (The CLANG38 toolchain received the same flag at its
>> inception, in commit 6f756db5ea05 [3].)
>>
>> However, ".eh_frame" is back now; in upstream gcc commit 9cbee213b579 [4]
>> (part of tag "gcc-8_1_0-release"), both "-fasynchronous-unwind-tables" and
>> "-funwind-tables" were made the default for AARCH64. (The patch author
>> described the effects on the gcc mailing list [5].) We have to counter the
>> latter flag with "-fno-unwind-tables", otherwise GenFw chokes on
>> ".eh_frame" again (triggered for example on Fedora 28).
>>
>> "-f[no-]unwind-tables" goes back to at least gcc-4.4 [6], so it's safe to
>> add to GCC_AARCH64_CC_FLAGS.
> 
> I'm not against this patch (which fixes a real problem), but would
> it be possible to take the opposite approach, as Peter Jones did for
> GRUB when the same issue hit there?:
> 
> http://lists.gnu.org/archive/html/grub-devel/2018-02/msg00095.html
> 
> I.e., rather than keep adding flags when new "special" sections are
> added by toolchains, explicitly filter those out as part of the link
> step.

I guess this could be implemented in two places in BaseTools:

(1) In GenFw / ElfConvert. I'm afraid that's beyond my binutils-fu at
the moment.

(2) In "BaseTools/Scripts/GccBase.lds". This is similarly beyond my
binutils-fu, but at least I can make more comments on it:

We already discard a good number of sections, but we keep (and realign)
"eh_frame". From Ard's commit message 26ecc55c027d, I believe the idea
here was to "retain the .eh_frame data for external debugging", and then
strip it with "objcopy -R .eh_frame" finally (see
[Dynamic-Library-File],  in
"BaseTools/Conf/build_rule.template").

However, in practice we stub out objcopy (see under "GCC Common" in
"BaseTools/Conf/tools_def.template"), and then we must prevent the
generation of .eh_frame in the first place.

Rather than adding "-fno-unwind-tables", I considered moving .eh_frame
to /DISCARD/, or else turning $(OBJCOPY) into the real thing. However,
that would affect more targets than just AARCH64/GCC, and I really
didn't (don't) remember why we have this redundancy with "objcopy -R
.eh_frame" vs. "-no-fasynchronous-unwind-tables". The latest practice
seemed to be "add more -fno-..." (see the commits I referenced above),
so I went with that.


I suggest we push this patch now, plus I could:

- submit a followup for IA32/X64, if that's deemed best,
- file a BZ for GenFw / ElfConvert about the programmatic relocation
  filtering,
- file a BZ for GccBase.lds / tools_def.template, to discard or strip
  .eh_frame under GCC.

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


Re: [edk2] [PATCH] BaseTools/tools_def: add "-fno-unwind-tables" to GCC_AARCH64_CC_FLAGS

2018-05-22 Thread Laszlo Ersek
On 05/21/18 11:32, Ard Biesheuvel wrote:
> On 21 May 2018 at 02:37, Gao, Liming  wrote:
>> Laszlo:
>>   Is this change required for IA32 and X64 arch?
>>
> 
> The upstream GCC change is limited to AArch64, but I suppose it
> wouldn't hurt to add this to IA32/X64 as well, given that it currently
> only reaffirms the default, and will do the right thing if that
> default ever changes for IA32/X64 as well.

Right; I wanted to keep the patch surgical. I don't really understand
why it makes sense for gcc to use different "unwind-tables" defaults for
AARCH64 vs. IA32/X64; however, I did think the gcc developers must have
made a conscious decision, to restrict the change to AARCH64.

I can submit a followup patch for IA32/X64, but I'll first respond under
Leif's suggestion too (that subthread will likely take more discussion).

Thanks!
Laszlo

> 
> 
>>> -Original Message-
>>> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
>>> Sent: Saturday, May 19, 2018 4:21 PM
>>> To: Laszlo Ersek 
>>> Cc: edk2-devel-01 ; Danilo C. L. de Paula 
>>> ; Cole Robinson ;
>>> Gerd Hoffmann ; Leif Lindholm 
>>> ; Gao, Liming ; Paolo 
>>> Bonzini
>>> ; Zhu, Yonghong 
>>> Subject: Re: [PATCH] BaseTools/tools_def: add "-fno-unwind-tables" to 
>>> GCC_AARCH64_CC_FLAGS
>>>
>>> On 18 May 2018 at 20:23, Laszlo Ersek  wrote:
 The ElfConvert routines in GenFw don't handle the ".eh_frame" ELF section
 emitted by gcc. For this reason, Leif disabled the generation of that
 section for AARCH64 with "-fno-asynchronous-unwind-tables" in commit
 28e80befa4fe [1], and Ard did the same for IA32 and X64 in commit
 26ecc55c027d [2]. (The CLANG38 toolchain received the same flag at its
 inception, in commit 6f756db5ea05 [3].)

 However, ".eh_frame" is back now; in upstream gcc commit 9cbee213b579 [4]
 (part of tag "gcc-8_1_0-release"), both "-fasynchronous-unwind-tables" and
 "-funwind-tables" were made the default for AARCH64. (The patch author
 described the effects on the gcc mailing list [5].) We have to counter the
 latter flag with "-fno-unwind-tables", otherwise GenFw chokes on
 ".eh_frame" again (triggered for example on Fedora 28).

 "-f[no-]unwind-tables" goes back to at least gcc-4.4 [6], so it's safe to
 add to GCC_AARCH64_CC_FLAGS.

 [1] https://github.com/tianocore/edk2/commit/28e80befa4fe
 [2] https://github.com/tianocore/edk2/commit/26ecc55c027d
 [3] https://github.com/tianocore/edk2/commit/6f756db5ea05
 [4] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=9cbee213b579
 [5] 
 http://mid.mail-archive.com/7b28c03a-c032-6cec-c127-1c12cbe98eeb@foss.arm.com
 [6] https://gcc.gnu.org/onlinedocs/gcc-4.4.7/gcc/Code-Gen-Options.html

 Cc: "Danilo C. L. de Paula" 
 Cc: Ard Biesheuvel 
 Cc: Cole Robinson 
 Cc: Gerd Hoffmann 
 Cc: Leif Lindholm 
 Cc: Liming Gao 
 Cc: Paolo Bonzini 
 Cc: Yonghong Zhu 
 Reported-by: "Danilo C. L. de Paula" 
 Contributed-under: TianoCore Contribution Agreement 1.1
 Signed-off-by: Laszlo Ersek 
>>>
>>> Reviewed-by: Ard Biesheuvel 
>>>
 ---

 Notes:
 Repo:   https://github.com/lersek/edk2.git
 Branch: aarch64_no_unwind_tables

  BaseTools/Conf/tools_def.template | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/BaseTools/Conf/tools_def.template 
 b/BaseTools/Conf/tools_def.template
 index 03d700018550..9429033fe2e3 100755
 --- a/BaseTools/Conf/tools_def.template
 +++ b/BaseTools/Conf/tools_def.template
 @@ -4537,7 +4537,7 @@ DEFINE GCC_X64_CC_FLAGS= 
 DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-ad
  DEFINE GCC_IPF_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) 
 -minline-int-divide-min-latency
  DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) 
 -mlittle-endian -mabi=aapcs -fno-short-enums
>>> -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer 
>>> -Wno-address -mthumb -mfloat-abi=soft -fno-pic -fno-pie
  DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access
 -DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) 
 -mlittle-endian -fno-short-enums -fverbose-asm
>>> -funsigned-char  -ffunction-sections -fdata-sections -Wno-address 
>>> -fno-asynchronous-unwind-tables -fno-pic -fno-pie -ffixed-x18
 +DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) 
 -mlittle-endian -fno-short-enums -fverbose-asm
>>> 

Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track FPDT record in DXE phase

2018-05-22 Thread Ard Biesheuvel
pd On 22 May 2018 at 10:58, Zeng, Star  wrote:
> How about the code to try allocating <4G memory, then try allocating any 
> memory if failed to allocate <4G memory?
>
> For example, the code snippet in SmbiosDxe.c.
>
> PhysicalAddress = 0x;
> Status = gBS->AllocatePages (
> AllocateMaxAddress,
> EfiRuntimeServicesData,
> EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
> 
> );
> if (EFI_ERROR (Status)) {
>   DEBUG ((EFI_D_ERROR, "SmbiosCreateTable () could not allocate 
> EntryPointStructure < 4GB\n"));
>   Status = gBS->AllocatePages (
>   AllocateAnyPages,
>   EfiRuntimeServicesData,
>   EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
>   
>   );
>  if (EFI_ERROR (Status)) {
> return EFI_OUT_OF_RESOURCES;
>   }
> }
>

Yes, that should do the trick.

But perhaps we should add something like

AllocatePeiAccessiblePages()

to MemoryAllocationLib, which just uses AllocateMaxAddress or
AllocateAnyPages depending on whether MDE_CPU_X64 is #defined.

-- 
Ard.

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Tuesday, May 22, 2018 4:52 PM
> To: Bi, Dandan ; Laszlo Ersek ; 
> Andrew Fish ; Kinney, Michael D 
> Cc: Leif Lindholm ; edk2-devel@lists.01.org; Zeng, 
> Star ; Gao, Liming ; Matt Sealey 
> 
> Subject: Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track 
> FPDT record in DXE phase
>
> (+ Laszlo, Andrew, Mike)
>
> On 22 May 2018 at 02:33, Bi, Dandan  wrote:
>> Sorry for the delayed response.
>>
>> The allocated  performance table ( below 4G ) is to save the boot 
>> performance data in normal boot and S3 phase.
>> PEIM FirmwarePerformancePei will get the address of the performance table 
>> and update the performance date of S3 phase to the table.
>> The address need to be handled in PEI phase(32bit), that's the main reason 
>> why we allocate it below 4G.
>>
>
> The 32-bit PEI + 64-bit DXE combo is specific to X64. You have added
> code to a generic library that ASSERT()s if allocating memory below 4
> GB fails, breaking non-PC architectures.
>
> So please, fix this. Or at least suggest a way around it so that other
> architectures can keep using this library.
>
> This is another consequence of our failure to model the special 32-bit
> PEI/64-bit DXE combination using proper PI interfaces, resulting in
> these kinds of breakages and open coded 4 GB allocations all
> throughout the code. Can we please work on getting this fixed?
>
>
>> -Original Message-
>> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
>> Sent: Wednesday, May 2, 2018 12:27 AM
>> To: Bi, Dandan ; Leif Lindholm 
>> 
>> Cc: edk2-devel@lists.01.org; Zeng, Star ; Gao, Liming 
>> ; Matt Sealey 
>> Subject: Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track 
>> FPDT record in DXE phase
>>
>> On 30 January 2018 at 14:53, Dandan Bi  wrote:
>>> V2:
>>> Update DxecorePerformanceLib to report the boot performance table
>>> address instead of records contents.
>>>
>>> Updated to convert Pref entry to FPDT record in DXE phase and then
>>> allocate boot performance table to save the record and report
>>> the address of boot performance table to FirmwarePerformanceDxe.
>>>
>>> Cc: Liming Gao 
>>> Cc: Star Zeng 
>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>> Signed-off-by: Dandan Bi 
>>> ---
>>>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 1389 
>>> +++-
>>>  .../DxeCorePerformanceLib.inf  |   20 +-
>>>  .../DxeCorePerformanceLibInternal.h|   17 +-
>>>  3 files changed, 1108 insertions(+), 318 deletions(-)
>>>
>>> diff --git 
>>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
>>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>>> index 7c0e207..c6f8a16 100644
>>> --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>>> +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>>> @@ -8,11 +8,11 @@
>>>which are consumed by DxePerformanceLib to logging performance data in 
>>> DXE phase.
>>>
>>>This library is mainly used by DxeCore to start performance logging to 
>>> ensure that
>>>Performance Protocol is installed at the very beginning of DXE phase.
>>>
>>> -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
>>> 

Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track FPDT record in DXE phase

2018-05-22 Thread Zeng, Star
How about the code to try allocating <4G memory, then try allocating any memory 
if failed to allocate <4G memory?

For example, the code snippet in SmbiosDxe.c.

PhysicalAddress = 0x;
Status = gBS->AllocatePages (
AllocateMaxAddress,
EfiRuntimeServicesData,
EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),

);
if (EFI_ERROR (Status)) {
  DEBUG ((EFI_D_ERROR, "SmbiosCreateTable () could not allocate 
EntryPointStructure < 4GB\n"));
  Status = gBS->AllocatePages (
  AllocateAnyPages,
  EfiRuntimeServicesData,
  EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
  
  );
 if (EFI_ERROR (Status)) {
return EFI_OUT_OF_RESOURCES;
  }
}


Thanks,
Star
-Original Message-
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
Sent: Tuesday, May 22, 2018 4:52 PM
To: Bi, Dandan ; Laszlo Ersek ; Andrew 
Fish ; Kinney, Michael D 
Cc: Leif Lindholm ; edk2-devel@lists.01.org; Zeng, 
Star ; Gao, Liming ; Matt Sealey 

Subject: Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track 
FPDT record in DXE phase

(+ Laszlo, Andrew, Mike)

On 22 May 2018 at 02:33, Bi, Dandan  wrote:
> Sorry for the delayed response.
>
> The allocated  performance table ( below 4G ) is to save the boot performance 
> data in normal boot and S3 phase.
> PEIM FirmwarePerformancePei will get the address of the performance table and 
> update the performance date of S3 phase to the table.
> The address need to be handled in PEI phase(32bit), that's the main reason 
> why we allocate it below 4G.
>

The 32-bit PEI + 64-bit DXE combo is specific to X64. You have added
code to a generic library that ASSERT()s if allocating memory below 4
GB fails, breaking non-PC architectures.

So please, fix this. Or at least suggest a way around it so that other
architectures can keep using this library.

This is another consequence of our failure to model the special 32-bit
PEI/64-bit DXE combination using proper PI interfaces, resulting in
these kinds of breakages and open coded 4 GB allocations all
throughout the code. Can we please work on getting this fixed?


> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Wednesday, May 2, 2018 12:27 AM
> To: Bi, Dandan ; Leif Lindholm 
> Cc: edk2-devel@lists.01.org; Zeng, Star ; Gao, Liming 
> ; Matt Sealey 
> Subject: Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track 
> FPDT record in DXE phase
>
> On 30 January 2018 at 14:53, Dandan Bi  wrote:
>> V2:
>> Update DxecorePerformanceLib to report the boot performance table
>> address instead of records contents.
>>
>> Updated to convert Pref entry to FPDT record in DXE phase and then
>> allocate boot performance table to save the record and report
>> the address of boot performance table to FirmwarePerformanceDxe.
>>
>> Cc: Liming Gao 
>> Cc: Star Zeng 
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Dandan Bi 
>> ---
>>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 1389 
>> +++-
>>  .../DxeCorePerformanceLib.inf  |   20 +-
>>  .../DxeCorePerformanceLibInternal.h|   17 +-
>>  3 files changed, 1108 insertions(+), 318 deletions(-)
>>
>> diff --git 
>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>> index 7c0e207..c6f8a16 100644
>> --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>> +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>> @@ -8,11 +8,11 @@
>>which are consumed by DxePerformanceLib to logging performance data in 
>> DXE phase.
>>
>>This library is mainly used by DxeCore to start performance logging to 
>> ensure that
>>Performance Protocol is installed at the very beginning of DXE phase.
>>
>> -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
>> +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
>>  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
>>  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
>> @@ -23,27 +23,65 @@ WITHOUT WARRANTIES 

Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track FPDT record in DXE phase

2018-05-22 Thread Ard Biesheuvel
(+ Laszlo, Andrew, Mike)

On 22 May 2018 at 02:33, Bi, Dandan  wrote:
> Sorry for the delayed response.
>
> The allocated  performance table ( below 4G ) is to save the boot performance 
> data in normal boot and S3 phase.
> PEIM FirmwarePerformancePei will get the address of the performance table and 
> update the performance date of S3 phase to the table.
> The address need to be handled in PEI phase(32bit), that's the main reason 
> why we allocate it below 4G.
>

The 32-bit PEI + 64-bit DXE combo is specific to X64. You have added
code to a generic library that ASSERT()s if allocating memory below 4
GB fails, breaking non-PC architectures.

So please, fix this. Or at least suggest a way around it so that other
architectures can keep using this library.

This is another consequence of our failure to model the special 32-bit
PEI/64-bit DXE combination using proper PI interfaces, resulting in
these kinds of breakages and open coded 4 GB allocations all
throughout the code. Can we please work on getting this fixed?


> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Wednesday, May 2, 2018 12:27 AM
> To: Bi, Dandan ; Leif Lindholm 
> Cc: edk2-devel@lists.01.org; Zeng, Star ; Gao, Liming 
> ; Matt Sealey 
> Subject: Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track 
> FPDT record in DXE phase
>
> On 30 January 2018 at 14:53, Dandan Bi  wrote:
>> V2:
>> Update DxecorePerformanceLib to report the boot performance table
>> address instead of records contents.
>>
>> Updated to convert Pref entry to FPDT record in DXE phase and then
>> allocate boot performance table to save the record and report
>> the address of boot performance table to FirmwarePerformanceDxe.
>>
>> Cc: Liming Gao 
>> Cc: Star Zeng 
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Dandan Bi 
>> ---
>>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 1389 
>> +++-
>>  .../DxeCorePerformanceLib.inf  |   20 +-
>>  .../DxeCorePerformanceLibInternal.h|   17 +-
>>  3 files changed, 1108 insertions(+), 318 deletions(-)
>>
>> diff --git 
>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>> index 7c0e207..c6f8a16 100644
>> --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>> +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>> @@ -8,11 +8,11 @@
>>which are consumed by DxePerformanceLib to logging performance data in 
>> DXE phase.
>>
>>This library is mainly used by DxeCore to start performance logging to 
>> ensure that
>>Performance Protocol is installed at the very beginning of DXE phase.
>>
>> -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
>> +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
>>  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
>>  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
>> @@ -23,27 +23,65 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, 
>> EITHER EXPRESS OR IMPLIED.
>>  **/
>>
>>
>>  #include "DxeCorePerformanceLibInternal.h"
>>
>> -
>>  //
>> -// The data structure to hold global performance data.
>> +// Data for FPDT performance records.
>>  //
>> -GAUGE_DATA_HEADER*mGaugeData;
>> +#define SMM_BOOT_RECORD_COMM_SIZE (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, 
>> Data) + sizeof(SMM_BOOT_RECORD_COMMUNICATE))
>> +#define STRING_SIZE (EDKII_STRING_EVENT_RECORD_NAME_LENGTH * 
>> sizeof (CHAR8))
>> +#define MAX_RECORD_SIZE (sizeof (DYNAMIC_STRING_EVENT_RECORD) + 
>> STRING_SIZE)
>> +#define FIRMWARE_RECORD_BUFFER  0x1
>> +#define CACHE_HANDLE_GUID_COUNT 0x1000
>> +
>> +BOOT_PERFORMANCE_TABLE  *mAcpiBootPerformanceTable = NULL;
>> +BOOT_PERFORMANCE_TABLE  mBootPerformanceTableTemplate = {
>> +  {
>> +EFI_ACPI_5_0_FPDT_BOOT_PERFORMANCE_TABLE_SIGNATURE,
>> +sizeof (BOOT_PERFORMANCE_TABLE)
>> +  },
>> +  {
>> +{
>> +  EFI_ACPI_5_0_FPDT_RUNTIME_RECORD_TYPE_FIRMWARE_BASIC_BOOT,// Type
>> +  sizeof (EFI_ACPI_5_0_FPDT_FIRMWARE_BASIC_BOOT_RECORD),// 
>> Length
>> +  EFI_ACPI_5_0_FPDT_RUNTIME_RECORD_REVISION_FIRMWARE_BASIC_BOOT // 
>> Revision
>> +},
>> +0,  // Reserved
>> +//
>> +// These values will be updated at runtime.
>> +//
>> +0,  // ResetEnd
>> +0,  // OsLoaderLoadImageStart
>> +0,  // OsLoaderStartImageStart
>> +0,  //