Re: [edk2] [PATCH edk2-platforms 1/2] Platform/ARM/Sgi: fix incorrect check of config-id value

2018-12-04 Thread chandni cherukuri
On Tue, Dec 4, 2018 at 8:26 PM Ard Biesheuvel  wrote:
>
> On Tue, 4 Dec 2018 at 12:36, Chandni Cherukuri
>  wrote:
> >
> > On SGI platform, the value of configuration ID can be zero.
> > So avoid returning an error from the function that creates
> > the system ID HOB in case the value of the configuration ID
> > is zero.
> >
> > While at it, improve some of the error messages as well.
> >
>
> So the platform ID is still guaranteed to be non-zero?
>
>

Platform ID is the part number of the platform and it is a
unique 12-bit value as specified by the SGI platform
specification. So it is guaranteed to be non-zero value.

Thanks
Chandni

> > Cc: Ard Biesheuvel 
> > Cc: Leif Lindholm 
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Chandni Cherukuri 
> > ---
> >  Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c 
> > b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
> > index 15ea571..065b23d 100644
> > --- a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
> > +++ b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
> > @@ -67,7 +67,7 @@ GetSgiSystemId (
> >
> >Property = fdt_getprop (HwCfgDtBlob, Offset, "platform-id", NULL);
> >if (Property == NULL) {
> > -DEBUG ((DEBUG_ERROR, "Platform Id is NULL\n"));
> > +DEBUG ((DEBUG_ERROR, "platform-id property not found\n"));
> >  return EFI_INVALID_PARAMETER;
> >}
> >
> > @@ -75,7 +75,7 @@ GetSgiSystemId (
> >
> >Property = fdt_getprop (HwCfgDtBlob, Offset, "config-id", NULL);
> >if (Property == NULL) {
> > -DEBUG ((DEBUG_ERROR, "Config Id is NULL\n"));
> > +DEBUG ((DEBUG_ERROR, "config-id property not found\n"));
> >  return EFI_INVALID_PARAMETER;
> >}
> >
> > @@ -121,7 +121,7 @@ SgiPlatformPeim (
> >  return EFI_INVALID_PARAMETER;
> >}
> >
> > -  if (HobData->PlatformId == 0 || HobData->ConfigId == 0) {
> > +  if (HobData->PlatformId == 0) {
> >  ASSERT (FALSE);
> >  return EFI_INVALID_PARAMETER;
> >}
> > --
> > 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


[edk2] [PATCH edk2-platforms 2/2] Platform/ARM/Sgi: Use NT_FW_CONFIG instead of HW_CONFIG

2018-12-04 Thread Chandni Cherukuri
The hardware configuration in HW_CONFIG dts is not being
passed onto the operating system but used and terminated
at edk2 boot stage (BL33). So, as per the recommendations
of the trusted-firmware design, the hardware description
specified in NT_FW_CONFIG dts should be used instead of
HW_CONFIG dts.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/SgiPlatform.dec   |  2 +-
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf   |  2 +-
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf |  4 +--
 Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h   |  6 ++---
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c | 10 +++
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c  | 28 
++--
 Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S  |  6 ++---
 7 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec 
b/Platform/ARM/SgiPkg/SgiPlatform.dec
index f6e0ba1..9166052 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dec
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -45,4 +45,4 @@
   gArmSgiTokenSpaceGuid.PcdDramBlock2Size|0|UINT64|0x0003
 
 [Ppis]
-  gHwConfigDtInfoPpiGuid = { 0x6f606eb3, 0x9123, 0x4e15, { 0xa8, 0x9b, 
0x0f, 0xac, 0x66, 0xef, 0xd0, 0x17 } }
+  gNtFwConfigDtInfoPpiGuid = { 0x6f606eb3, 0x9123, 0x4e15, { 0xa8, 0x9b, 
0x0f, 0xac, 0x66, 0xef, 0xd0, 0x17 } }
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf 
b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
index 93377fa..260be58 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
@@ -71,4 +71,4 @@
 
 [Ppis]
   gArmMpCoreInfoPpiGuid
-  gHwConfigDtInfoPpiGuid
+  gNtFwConfigDtInfoPpiGuid
diff --git a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf 
b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
index a7c718b..a9173cc 100644
--- a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
+++ b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
@@ -34,7 +34,7 @@
   gArmSgiPlatformIdDescriptorGuid
 
 [Ppis]
-  gHwConfigDtInfoPpiGuid
+  gNtFwConfigDtInfoPpiGuid
 
 [Depex]
-  gHwConfigDtInfoPpiGuid
+  gNtFwConfigDtInfoPpiGuid
diff --git a/Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h 
b/Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h
index 934eef2..b830326 100644
--- a/Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h
+++ b/Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h
@@ -15,9 +15,9 @@
 #ifndef  SGI_PLATFORMID_PPI_
 #define  SGI_PLATFORMID_PPI_
 
-// HwConfig DT structure
+// NT_FW_CONFIG DT structure
 typedef struct {
-  UINT64  HwConfigDtAddr;
-} SGI_HW_CONFIG_INFO_PPI;
+  UINT64  NtFwConfigDtAddr;
+} SGI_NT_FW_CONFIG_INFO_PPI;
 
 #endif
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c 
b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
index 13bb423..d264292 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
@@ -17,8 +17,8 @@
 #include 
 #include 
 
-UINT64 HwConfigDtBlob;
-STATIC SGI_HW_CONFIG_INFO_PPI mHwConfigDtInfoPpi;
+UINT64 NtFwConfigDtBlob;
+STATIC SGI_NT_FW_CONFIG_INFO_PPI mNtFwConfigDtInfoPpi;
 
 STATIC ARM_CORE_INFO mCoreInfoTable[] = {
   {
@@ -40,7 +40,7 @@ ArmPlatformInitialize (
   IN  UINTN MpId
   )
 {
-  mHwConfigDtInfoPpi.HwConfigDtAddr = HwConfigDtBlob;
+  mNtFwConfigDtInfoPpi.NtFwConfigDtAddr = NtFwConfigDtBlob;
   return RETURN_SUCCESS;
 }
 
@@ -67,8 +67,8 @@ EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
   },
   {
 EFI_PEI_PPI_DESCRIPTOR_PPI,
-,
-
+,
+
   }
 };
 
diff --git a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c 
b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
index 065b23d..d133921 100644
--- a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
+++ b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
@@ -24,9 +24,9 @@
 
   This function returns the System ID of the platform
 
-  This functions locates the HwConfig PPI and gets the base address of HW 
CONFIG
-  DT from which the platform ID and config ID is obtained using FDT helper
-  functions
+  This functions locates the NtFwConfig PPI and gets the base address of
+  NT_FW_CONFIG DT from which the platform ID and config ID is obtained
+  using FDT helper functions
 
   @param[out]  Pointer to the SGI_PLATFORM_DESCRIPTOR HoB
   @return  returns EFI_SUCCESS on success and EFI_INVALID_PARAMETER on 
error
@@ -41,31 +41,31 @@ GetSgiSystemId (
 {
   CONST UINT32  *Property;
   INT32 Offset;
-  CONST VOID*HwCfgDtBlob;
-  SGI_HW_CONFIG_INFO_PPI*HwConfigInfoPpi;
+  CONST VOID

[edk2] [PATCH edk2-platforms 1/2] Platform/ARM/Sgi: fix incorrect check of config-id value

2018-12-04 Thread Chandni Cherukuri
On SGI platform, the value of configuration ID can be zero.
So avoid returning an error from the function that creates
the system ID HOB in case the value of the configuration ID
is zero.

While at it, improve some of the error messages as well.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c 
b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
index 15ea571..065b23d 100644
--- a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
+++ b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
@@ -67,7 +67,7 @@ GetSgiSystemId (
 
   Property = fdt_getprop (HwCfgDtBlob, Offset, "platform-id", NULL);
   if (Property == NULL) {
-DEBUG ((DEBUG_ERROR, "Platform Id is NULL\n"));
+DEBUG ((DEBUG_ERROR, "platform-id property not found\n"));
 return EFI_INVALID_PARAMETER;
   }
 
@@ -75,7 +75,7 @@ GetSgiSystemId (
 
   Property = fdt_getprop (HwCfgDtBlob, Offset, "config-id", NULL);
   if (Property == NULL) {
-DEBUG ((DEBUG_ERROR, "Config Id is NULL\n"));
+DEBUG ((DEBUG_ERROR, "config-id property not found\n"));
 return EFI_INVALID_PARAMETER;
   }
 
@@ -121,7 +121,7 @@ SgiPlatformPeim (
 return EFI_INVALID_PARAMETER;
   }
 
-  if (HobData->PlatformId == 0 || HobData->ConfigId == 0) {
+  if (HobData->PlatformId == 0) {
 ASSERT (FALSE);
 return EFI_INVALID_PARAMETER;
   }
-- 
2.7.4

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


[edk2] [PATCH edk2-platforms 0/2] Use NT_FW_CONFIG instead of HW_CONFIG

2018-12-04 Thread Chandni Cherukuri
The first patch removes an incorrect check on the configuration id
register value and does minor changes to the console error messages.

The second patch in this series adds usage of NT_FW_CONFIG for SGI
platforms. The hardware configuration (system-id) in HW_CONFIG dts
is not being passed onto the operating system. As per the
recommendations of the trusted-firmware design, since the hardware
description is being used only in edk2 boot stage (BL33), the
non-trusted firmware config device tree (NT_FW_CONFIG) can be used
instead of HW_CONFIG device tree to specify the hardware description.

Chandni Cherukuri (2): 
  Platform/ARM/Sgi: fix incorrect check of config-id value
  Platform/ARM/Sgi: Use NT_FW_CONFIG instead of HW_CONFIG

 Platform/ARM/SgiPkg/SgiPlatform.dec   |  2 +-
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf   |  2 +-
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf |  4 +--
 Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h   |  6 ++--
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c | 10 +++---
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c  | 34 
++--
 Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S  |  6 ++--
 7 files changed, 32 insertions(+), 32 deletions(-)

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


Re: [edk2] [PATCH edk2-platforms 0/3] drop GUIDs from NOR flash bank descriptors

2018-11-22 Thread chandni cherukuri
On Thu, Nov 22, 2018 at 1:20 PM Ard Biesheuvel
 wrote:
>
> On Thu, 22 Nov 2018 at 05:01, Thomas Abraham  wrote:
> >
> > Hi Ard,
> >
> > On Thu, Nov 22, 2018 at 3:46 AM Ard Biesheuvel
> >  wrote:
> > >
> > > On Wed, 21 Nov 2018 at 14:48, Thomas Abraham  
> > > wrote:
> > > >
> > > > Hi Ard,
> > > >
> > > > On Wed, Nov 21, 2018 at 5:31 PM Ard Biesheuvel
> > > >  wrote:
> > > > >
> > > > > Align edk2-platform with upcoming changes to EDK2 to get rid of 
> > > > > per-bank
> > > > > NOR flash GUIDs.
> > > > >
> > > > > Ard Biesheuvel (3):
> > > > >   Platform/ARM: replace hardcoded VenHW() device paths referring to 
> > > > > NOR
> > > > > flash
> > > > >   Silicon/SynQuacer: drop per-bank NOR flash GUIDs
> > > > >   Platform/ARM: drop per-bank NOR flash GUIDs
> > > > >
> > > > >  Platform/ARM/JunoPkg/ArmJuno.dec   |  2 +-
> > > > >  Platform/ARM/JunoPkg/ArmJuno.dsc   |  2 +-
> > > > >  .../JunoPkg/Library/NorFlashJunoLib/NorFlashJuno.c |  2 --
> > > > >  .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c   |  2 --
> > > > >  Platform/ARM/SgiPkg/SgiPlatform.dsc|  2 +-
> > > > >  Platform/ARM/VExpressPkg/ArmVExpress-CTA15-A7.dsc  |  2 +-
> > > > >  Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc   |  2 +-
> > > > >  .../NorFlashArmVExpressLib/NorFlashArmVExpress.c   |  4 
> > > > >  .../SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c  | 14 
> > > > > +++---
> > > > >  .../SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.h  |  3 +++
> > > > >  .../NorFlashSynQuacerLib/NorFlashSynQuacer.c   |  6 --
> > > > >  11 files changed, 15 insertions(+), 26 deletions(-)
> > > >
> > > > Tested this patch series and "[PATCH v2 0/5] ArmPlatformPkg,
> > > > ArmVirtPkg: discover NOR flash banks from DTB" patch series on the
> > > > Juno board. With these patches applied, the boot fails on Juno board
> > > > with the following messages. I have not yet tried to debug the issue
> > > > but wanted to let you know this.
> > > >
> > > > [...]
> > > > Loading driver at 0x000F830C000 EntryPoint=0x000F831B2AC IScsiDxe.efi
> > > > add-symbol-file
> > > > /home/thopan01/devel/juno/uefi/uefi/edk2/Build/ArmJuno/DEBUG_GCC5/AARCH64/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe/DEBUG/Udp4Dxe.dll
> > > > 0xF830
> > > > Loading driver at 0x000F82FF000 EntryPoint=0x000F8306DF0 Udp4Dxe.efi
> > > > add-symbol-file
> > > > /home/thopan01/devel/juno/uefi/uefi/edk2/Build/ArmJuno/DEBUG_GCC5/AARCH64/Platform/ARM/Drivers/FdtPlatformDxe/FdtPlatformDxe/DEBUG/FdtPlatformDxe.dll
> > > > 0xF82EE000
> > > > Loading driver at 0x000F82ED000 EntryPoint=0x000F82F76EC 
> > > > FdtPlatformDxe.efi
> > > > Found image: fip in block 5.
> > > > Found image: norkern in block 20.
> > > > Found image: ramdisk.img in block 116.
> > > > Found image: hdlcdclk in block 151.
> > > > Found image: selftest in block 152.
> > > > Found image: board.dtb in block 156.
> > > > Found image: scp_bl1 in block 249.
> > > > Found image: bl1 in block 251.
> > > > Found image: startup.nsh in block 252.
> > > > ASSERT [BootMonFs]
> > > > /home/thopan01/devel/juno/uefi/uefi/edk2/MdePkg/Library/BaseLib/String.c(173):
> > > > ((UINTN) String & 0x0001) == 0
> > > >
> > >
> > > Hi Thomas,
> > >
> > > Thanks for testing.
> > >
> > > Could you please apply this patch and re-test:
> > >
> > > --- a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> > > +++ b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> > > @@ -299,7 +299,7 @@
> > >  !if $(TARGET) == RELEASE
> > >gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21
> > >  !else
> > > -  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
> > > +  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x3f
> > >  !endif
> > >
> > >#  DEBUG_INIT  0x0001  // Initialization
> > >
> > > This will produce a backtrace when an ASSERT() is triggered, and from
> > > this we can figure out what the call stack looks like exactly (The
> > > ASSERT() occurs in StrLen (), which is called with a misaligned
> > > unicode string, but I cannot figure out where the call is made)
> > >
> > > Please share the backtrace and all the .dlls listed in it if you can 
> > > please.
> >
> > The following is the log with the above diff applied on top of your
> > patch series.
> >
>
> Thanks!
>
> Could you please share the output of
>
> nm -n 
> /home/thopan01/devel/juno/uefi/uefi/edk2/Build/ArmJuno/DEBUG_GCC5/AARCH64/Platform/ARM/Drivers/BootMonFs/BootMonFs/DEBUG/BootMonFs.dll
>
> as well so I can cross reference the addresses with the functions? Thanks.
>
>
Hi Ard,

With the following diff applied on top of your patches we see that the
ASSERT no longer comes in Juno and it boots till the UEFI Shell.

--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
@@ -129,7 +129,7 @@ NorFlashCreateInstance (
   Instance->Media.LastBlock = (NorFlashSize / BlockSize)-1;

   CopyGuid (>DevicePath.Vendor.Guid, );
-  Instance->DevicePath.Index = (UINT8)Index;
+  

[edk2] [PATCH v3 edk2-platforms 6/6] Platform/ARM/Sgi: Add initial support for SGI-Clark.Helios platform

2018-11-21 Thread Chandni Cherukuri
Add the initial support for ARM's System Guidance for Infrastructure
SGI-Clark.Helios platform. The ACPI tables for this platform are
installed.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Include/SgiPlatform.h | 1 +
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index 46f35e8..5501895 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -75,6 +75,7 @@
 //SGI-Clark Platform Identification values
 #define SGI_CLARK_PART_NUM0x786
 #define SGI_CLARK_CONF_ARES   0x1
+#define SGI_CLARK_CONF_HELIOS 0x2
 
 #define SGI_CONFIG_MASK   0x0F
 #define SGI_CONFIG_SHIFT  0x1C
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index 164151a..a8708a5 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -51,6 +51,9 @@ ArmSgiPkgEntryPoint (
   } else if ((PartNum == SGI_CLARK_PART_NUM) &&
  (ConfigId == SGI_CLARK_CONF_ARES)) {
 Status = LocateAndInstallAcpiFromFv ();
+  } else if ((PartNum == SGI_CLARK_PART_NUM) &&
+ (ConfigId == SGI_CLARK_CONF_HELIOS)) {
+Status = LocateAndInstallAcpiFromFv ();
   } else {
 Status = EFI_UNSUPPORTED;
   }
-- 
2.7.4

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


[edk2] [PATCH v3 edk2-platforms 5/6] Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Helios platform

2018-11-21 Thread Chandni Cherukuri
Add ACPI tables specific for SGI-Clark.Helios platform and let this
platform reuse the rest of the common SGI platform ACPI tables.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/SgiPlatform.dec |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.dsc |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf |   1 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf |  58 +
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |   1 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl  | 262 
+++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Madt.aslc | 266 

 7 files changed, 590 insertions(+)

diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec 
b/Platform/ARM/SgiPkg/SgiPlatform.dec
index f66fa1f..f6e0ba1 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dec
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -34,6 +34,7 @@
   gArmSgiTokenSpaceGuid  = { 0x577d6941, 0xaea1, 0x40b4, { 0x90, 0x93, 
0x2a, 0x86, 0x61, 0x72, 0x5a, 0x57 } }
   gSgi575AcpiTablesFileGuid  = { 0xc712719a, 0x0aaf, 0x438c, { 0x9c, 0xdd, 
0x35, 0xab, 0x4d, 0x60, 0x20, 0x7d } }
   gSgiClarkAresAcpiTablesFileGuid = { 0x4b0b91d0, 0x4a05, 0x45c4, { 0x88, 
0xa7, 0x88, 0xe1, 0x70, 0xe7, 0x66, 0x94 } }
+  gSgiClarkHeliosAcpiTablesFileGuid = { 0x2af40815, 0xa84e, 0x4de9, { 0x8c, 
0x38, 0x91, 0x40, 0xb3, 0x54, 0x40, 0x73 } }
 
 [PcdsFeatureFlag.common]
   # Set this PCD to TRUE to enable virtio support.
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
b/Platform/ARM/SgiPkg/SgiPlatform.dsc
index 8b8062a..0c21f1c 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -253,6 +253,7 @@
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
   Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
   Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
+  Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   #
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf 
b/Platform/ARM/SgiPkg/SgiPlatform.fdf
index dc81acd..b7af4a2 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
+++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
@@ -107,6 +107,7 @@ READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
   INF RuleOverride=ACPITABLE 
Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
   INF RuleOverride=ACPITABLE 
Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
+  INF RuleOverride=ACPITABLE 
Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
   INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   # Required by PCI
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
new file mode 100644
index 000..0ecce2d
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
@@ -0,0 +1,58 @@
+## @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  = SgiClarkHeliosAcpiTables
+  FILE_GUID  = 2af40815-a84e-4de9-8c38-9140b3544073
+  MODULE_TYPE= USER_DEFINED
+  VERSION_STRING = 1.0
+
+[Sources]
+  Dbg2.aslc
+  Fadt.aslc
+  Gtdt.aslc
+  Iort.aslc
+  Mcfg.aslc
+  SgiClarkHelios/Dsdt.asl
+  SgiClarkHelios/Madt.aslc
+  Spcr.aslc
+  Ssdt.asl
+
+[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
+  gArmTokenSpaceGuid.PcdPciBusMin
+  gArmTokenSpaceGuid.PcdPciBusMax
+
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Pl

[edk2] [PATCH v3 edk2-platforms 4/6] Platform/ARM/Sgi: Add initial support for SGI-Clark.Ares platform

2018-11-21 Thread Chandni Cherukuri
Add the initial support for ARM's System Guidance for Infrastructure
SGI-Clark.Ares platform. The ACPI tables for this platform are
installed.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Include/SgiPlatform.h |  4 
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 16 +---
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index b0cca4e..46f35e8 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -72,6 +72,10 @@
 #define SGI575_CONF_NUM   0x3
 #define SGI575_PART_NUM   0x783
 
+//SGI-Clark Platform Identification values
+#define SGI_CLARK_PART_NUM0x786
+#define SGI_CLARK_CONF_ARES   0x1
+
 #define SGI_CONFIG_MASK   0x0F
 #define SGI_CONFIG_SHIFT  0x1C
 #define SGI_PART_NUM_MASK 0xFFF
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index 249d0a0..164151a 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -48,14 +48,16 @@ ArmSgiPkgEntryPoint (
 
   if ((PartNum == SGI575_PART_NUM) && (ConfigId == SGI575_CONF_NUM)) {
 Status = LocateAndInstallAcpiFromFv ();
-if (EFI_ERROR (Status)) {
-  DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n",
-__FUNCTION__));
-  return Status;
-}
+  } else if ((PartNum == SGI_CLARK_PART_NUM) &&
+ (ConfigId == SGI_CLARK_CONF_ARES)) {
+Status = LocateAndInstallAcpiFromFv ();
   } else {
-DEBUG ((DEBUG_ERROR, "PlatformDxe: Unsupported Platform Id\n"));
-return EFI_UNSUPPORTED;
+Status = EFI_UNSUPPORTED;
+  }
+
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__));
+return Status;
   }
 
   Status = EFI_REQUEST_UNLOAD_IMAGE;
-- 
2.7.4

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


[edk2] [PATCH v3 edk2-platforms 3/6] Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Ares platform

2018-11-21 Thread Chandni Cherukuri
Add ACPI tables specific for SGI-Clark.Ares platform and let this
platform reuse the rest of the common SGI platform ACPI tables.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/SgiPlatform.dec   |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.dsc   |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf   |   1 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf |  58 +++
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf   |   1 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl  | 116 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Madt.aslc | 171 

 7 files changed, 349 insertions(+)

diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec 
b/Platform/ARM/SgiPkg/SgiPlatform.dec
index 2fcc13e..f66fa1f 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dec
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -33,6 +33,7 @@
   gArmSgiPlatformIdDescriptorGuid = { 0xf56f152a, 0xad2a, 0x11e6, { 0xb1, 
0xa7, 0x00, 0x50, 0x56, 0x3c, 0x44, 0xcc } }
   gArmSgiTokenSpaceGuid  = { 0x577d6941, 0xaea1, 0x40b4, { 0x90, 0x93, 
0x2a, 0x86, 0x61, 0x72, 0x5a, 0x57 } }
   gSgi575AcpiTablesFileGuid  = { 0xc712719a, 0x0aaf, 0x438c, { 0x9c, 0xdd, 
0x35, 0xab, 0x4d, 0x60, 0x20, 0x7d } }
+  gSgiClarkAresAcpiTablesFileGuid = { 0x4b0b91d0, 0x4a05, 0x45c4, { 0x88, 
0xa7, 0x88, 0xe1, 0x70, 0xe7, 0x66, 0x94 } }
 
 [PcdsFeatureFlag.common]
   # Set this PCD to TRUE to enable virtio support.
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
b/Platform/ARM/SgiPkg/SgiPlatform.dsc
index ede13b5..8b8062a 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -252,6 +252,7 @@
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
   Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
+  Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   #
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf 
b/Platform/ARM/SgiPkg/SgiPlatform.fdf
index de5bca6..dc81acd 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
+++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
@@ -106,6 +106,7 @@ READ_LOCK_STATUS   = TRUE
   #
   INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
   INF RuleOverride=ACPITABLE 
Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
+  INF RuleOverride=ACPITABLE 
Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
   INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   # Required by PCI
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
new file mode 100644
index 000..dcfe492
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
@@ -0,0 +1,58 @@
+## @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  = SgiClarkAresAcpiTables
+  FILE_GUID  = 4b0b91d0-4a05-45c4-88a7-88e170e76694
+  MODULE_TYPE= USER_DEFINED
+  VERSION_STRING = 1.0
+
+[Sources]
+  Dbg2.aslc
+  Fadt.aslc
+  Gtdt.aslc
+  Iort.aslc
+  Mcfg.aslc
+  SgiClarkAres/Dsdt.asl
+  SgiClarkAres/Madt.aslc
+  Spcr.aslc
+  Ssdt.asl
+
+[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
+  gArmTokenSpaceGuid.PcdPciBusMin
+  gArmTokenSpaceGuid.PcdPciBusMax
+
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
index df546af..0371c40 100644
--- a/Platform/ARM/SgiPkg/Drivers/P

[edk2] [PATCH v3 edk2-platforms 2/6] Platform/ARM/Sgi: Refactor ACPI tables for SGI platforms

2018-11-21 Thread Chandni Cherukuri
ACPI tables Dbg2.aslc, Fadt.aslc, Gtdt.aslc, Iort.aslc, Mcfg.aslc,
Spcr.aslc and Ssdt.asl are common for SGI platforms. To reduce
duplication of ACPI tables when new platforms are added these tables
are moved to the AcpiTables folder. Only platform specific tables
Dsdt.asl and Madt.aslc remain in the platform specific folder. Also
the AcpiTables.inf file is renamed as Sgi575AcpiTables.inf and moved to
AcpiTables folder.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/SgiPlatform.dsc  |   2 +-
 Platform/ARM/SgiPkg/SgiPlatform.fdf  |   2 +-
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf |  58 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf  |  58 
 Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h  |   2 +-
 Platform/ARM/SgiPkg/AcpiTables/Dbg2.aslc |  88 
 Platform/ARM/SgiPkg/AcpiTables/Fadt.aslc |  87 +++
 Platform/ARM/SgiPkg/AcpiTables/Gtdt.aslc | 152 
 Platform/ARM/SgiPkg/AcpiTables/Iort.aslc | 106 ++
 Platform/ARM/SgiPkg/AcpiTables/Mcfg.aslc |  59 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc  |  90 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl   |   2 +-
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc  |  87 ---
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc  | 152 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc  | 106 --
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc  |  59 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc  |  77 --
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl   |  95 
 Platform/ARM/SgiPkg/AcpiTables/Spcr.aslc |  77 ++
 Platform/ARM/SgiPkg/AcpiTables/Ssdt.asl  |  93 
 20 files changed, 724 insertions(+), 728 deletions(-)

diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
b/Platform/ARM/SgiPkg/SgiPlatform.dsc
index 1c152fa..ede13b5 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -251,7 +251,7 @@
   # ACPI Support
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-  Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
+  Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   #
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf 
b/Platform/ARM/SgiPkg/SgiPlatform.fdf
index c912984..de5bca6 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
+++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
@@ -105,7 +105,7 @@ READ_LOCK_STATUS   = TRUE
   # ACPI Support
   #
   INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-  INF RuleOverride=ACPITABLE 
Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
+  INF RuleOverride=ACPITABLE 
Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
   INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   # Required by PCI
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
deleted file mode 100644
index feb1018..000
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
+++ /dev/null
@@ -1,58 +0,0 @@
-## @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  # 
gSgi575AcpiTablesFileGuid
-  MODULE_TYPE= USER_DEFINED
-  VERSION_STRING = 1.0
-
-[Sources]
-  Dbg2.aslc
-  Dsdt.asl
-  Fadt.aslc
-  Gtdt.aslc
-  Iort.aslc
-  Madt.aslc
-  Mcfg.aslc
-  Spcr.aslc
-  Ssdt.asl
-
-[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.PcdGicDistr

[edk2] [PATCH v3 edk2-platforms 1/6] Platform/ARM/Sgi: Adapt to changes in system-id DT node.

2018-11-21 Thread Chandni Cherukuri
The 'system-id' node of HW_CONFIG device tree has been updated to have
a new property 'config-id' to hold the platform configuration value.
To adapt to this change, SGI_PLATFORM_DESCRIPTOR gets a new member
named 'ConfigId' and the function GetSgiPlatformId has been renamed
to GetSgiSystemId which takes the SGI_PLATFORM_DESCRIPTOR HoB as the
function parameter.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Include/SgiPlatform.h|  1 +
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c| 14 +++---
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c | 50 
+---
 3 files changed, 42 insertions(+), 23 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index 1454018..b0cca4e 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -79,6 +79,7 @@
 // ARM platform description data.
 typedef struct {
   UINTN  PlatformId;
+  UINTN  ConfigId;
 } SGI_PLATFORM_DESCRIPTOR;
 
 #endif // __SGI_PLATFORM_H__
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index 5ccd01d..249d0a0 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -30,21 +30,21 @@ ArmSgiPkgEntryPoint (
   )
 {
   EFI_STATUS  Status;
-  VOID*PlatformIdHob;
+  VOID*SystemIdHob;
   SGI_PLATFORM_DESCRIPTOR *HobData;
   UINT32  ConfigId;
   UINT32  PartNum;
 
-  PlatformIdHob = GetFirstGuidHob ();
-  if (PlatformIdHob == NULL) {
-DEBUG ((DEBUG_ERROR, "Platform ID HOB is NULL\n"));
+  SystemIdHob = GetFirstGuidHob ();
+  if (SystemIdHob == NULL) {
+DEBUG ((DEBUG_ERROR, "System ID HOB is NULL\n"));
 return EFI_INVALID_PARAMETER;
   }
 
-  HobData = (SGI_PLATFORM_DESCRIPTOR *)GET_GUID_HOB_DATA (PlatformIdHob);
+  HobData = (SGI_PLATFORM_DESCRIPTOR *)GET_GUID_HOB_DATA (SystemIdHob);
 
-  PartNum = HobData->PlatformId & SGI_PART_NUM_MASK;
-  ConfigId = (HobData->PlatformId >> SGI_CONFIG_SHIFT) & SGI_CONFIG_MASK;
+  PartNum = HobData->PlatformId;
+  ConfigId = HobData->ConfigId;
 
   if ((PartNum == SGI575_PART_NUM) && (ConfigId == SGI575_CONF_NUM)) {
 Status = LocateAndInstallAcpiFromFv ();
diff --git a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c 
b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
index 081d329..15ea571 100644
--- a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
+++ b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
@@ -22,19 +22,21 @@
 
 /**
 
-  This function returns the Platform ID of the platform
+  This function returns the System ID of the platform
 
   This functions locates the HwConfig PPI and gets the base address of HW 
CONFIG
-  DT from which the platform ID is obtained using FDT helper functions
+  DT from which the platform ID and config ID is obtained using FDT helper
+  functions
 
-  @return returns the platform ID on success else returns 0 on error
+  @param[out]  Pointer to the SGI_PLATFORM_DESCRIPTOR HoB
+  @return  returns EFI_SUCCESS on success and EFI_INVALID_PARAMETER on 
error
 
 **/
 
 STATIC
-UINT32
-GetSgiPlatformId (
- VOID
+EFI_STATUS
+GetSgiSystemId (
+  OUT SGI_PLATFORM_DESCRIPTOR   *HobData
 )
 {
   CONST UINT32  *Property;
@@ -48,34 +50,44 @@ GetSgiPlatformId (
   if (EFI_ERROR (Status)) {
 DEBUG ((DEBUG_ERROR,
   "PeiServicesLocatePpi failed with error %r\n", Status));
-return 0;
+return EFI_INVALID_PARAMETER;
   }
 
   HwCfgDtBlob = (VOID *)(UINTN)HwConfigInfoPpi->HwConfigDtAddr;
   if (fdt_check_header (HwCfgDtBlob) != 0) {
 DEBUG ((DEBUG_ERROR, "Invalid DTB file %p passed\n", HwCfgDtBlob));
-return 0;
+return EFI_INVALID_PARAMETER;
   }
 
   Offset = fdt_subnode_offset (HwCfgDtBlob, 0, "system-id");
   if (Offset == -FDT_ERR_NOTFOUND) {
 DEBUG ((DEBUG_ERROR, "Invalid DTB : system-id node not found\n"));
-return 0;
+return EFI_INVALID_PARAMETER;
   }
 
   Property = fdt_getprop (HwCfgDtBlob, Offset, "platform-id", NULL);
   if (Property == NULL) {
 DEBUG ((DEBUG_ERROR, "Platform Id is NULL\n"));
-return 0;
+return EFI_INVALID_PARAMETER;
   }
 
-  return fdt32_to_cpu (*Property);
+  HobData->PlatformId = fdt32_to_cpu (*Property);
+
+  Property = fdt_getprop (HwCfgDtBlob, Offset, "config-id", NULL);
+  if (Property == NULL) {
+DEBUG ((DEBUG_ERROR, "Config Id is NULL\n"));
+return EFI_INVALID_PARAMETER;
+  }
+
+  HobData->ConfigId = fdt32_to_cpu (*Property);
+
+  return EFI_SUCCESS;
 }
 
 /**
 
- This function 

[edk2] [PATCH v3 edk2-platforms 0/6] Platform/ARM/Sgi: Add support for Clark.Ares and Clark.Helios platforms

2018-11-21 Thread Chandni Cherukuri
Changes since v1:
- No code changes, posting this series again with correct patch subject

This patch series adds support for two new Arm's SGI platforms - 
SGI-Clark.Ares and SGI-Clark.Helios. The first patch in this
series adds support to use a new binding added to the system-id
node for Platform Identification. The second patch refactors the
ACPI tables to prevent duplication of ACPI tables. The common
ACPI tables for SGI platforms are put in the AcpiTables folder.
Dsdt.asl and Madt.aslc remain in the platform specific folder.
The rest of the patches add support for the two new SGI platforms.

Chandni Cherukuri (6):
  Platform/ARM/Sgi: Adapt to changes in system-id DT node.
  Platform/ARM/Sgi: Refactor ACPI tables for SGI platforms
  Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Ares platform
  Platform/ARM/Sgi: Add initial support for SGI-Clark.Ares platform
  Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Helios platform
  Platform/ARM/Sgi: Add initial support for SGI-Clark.Helios platform

 Platform/ARM/SgiPkg/SgiPlatform.dec  |   2 +
 Platform/ARM/SgiPkg/SgiPlatform.dsc  |   4 +-
 Platform/ARM/SgiPkg/SgiPlatform.fdf  |   4 +-
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf |  58 -
 Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf  |  58 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf|  58 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf  |  58 +
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf  |   2 +
 Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h  |   2 +-
 Platform/ARM/SgiPkg/Include/SgiPlatform.h|   6 +
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c|  33 +--
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c |  50 ++--
 Platform/ARM/SgiPkg/AcpiTables/Dbg2.aslc |  88 +++
 Platform/ARM/SgiPkg/AcpiTables/Fadt.aslc |  87 +++
 Platform/ARM/SgiPkg/AcpiTables/Gtdt.aslc | 152 +++
 Platform/ARM/SgiPkg/AcpiTables/Iort.aslc | 106 
 Platform/ARM/SgiPkg/AcpiTables/Mcfg.aslc |  59 +
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc  |  90 ---
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dsdt.asl   |   2 +-
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc  |  87 ---
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc  | 152 ---
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc  | 106 
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc  |  59 -
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc  |  77 --
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl   |  95 ---
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl | 116 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Madt.aslc| 171 
+
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl   | 262 
+++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Madt.aslc  | 266 

 Platform/ARM/SgiPkg/AcpiTables/Spcr.aslc |  77 ++
 Platform/ARM/SgiPkg/AcpiTables/Ssdt.asl  |  93 +++
 31 files changed, 1722 insertions(+), 758 deletions(-)
 delete mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAresAcpiTables.inf
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHeliosAcpiTables.inf
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Dbg2.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Fadt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Gtdt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Iort.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Mcfg.aslc
 delete mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
 delete mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Fadt.aslc
 delete mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
 delete mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc
 delete mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc
 delete mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc
 delete mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Dsdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkAres/Madt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Dsdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkHelios/Madt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Spcr.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Ssdt.asl

-- 
2.7.4
___
edk2-devel mailing list

Re: [edk2] [PATCH v3 edk2-platforms 0/5] Platform/ARM/Sgi: Add support for Clark.Ares and Clark.Helios platforms

2018-11-19 Thread chandni cherukuri
On Mon, Nov 12, 2018 at 9:57 PM Leif Lindholm  wrote:
>
> Hi Chadni,
>
> I will disregard this set.
> Please send out a new v3 containing the changes we've discussed, only
> after I've completed reviewing the set.
>
> Best Regards,
>
> Leif
>

Hi Leif,

Can I post the new v3 patchset containing the changes that we've discussed?

Thanks
Chandni

> On Mon, Nov 12, 2018 at 05:11:51PM +0530, Chandni Cherukuri wrote:
> > Changes since v2:
> > - Added additional checks for platform-id and config-id values.
> >
> > Changes since v1:
> > - No code changes, posting this series again with correct patch subject
> >
> > This patch series adds support for two new Arm's SGI platforms -
> > SGI-Clark.Ares and SGI-Clark.Helios. The first patch in this
> > series adds support to use a new binding added to the system-id
> > node for Platform Identification. The rest of the patches add
> > support for the two new SGI platforms.
> >
> > Chandni Cherukuri (5):
> >   Platform/ARM/Sgi: Adapt to changes in system-id DT node.
> >   Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Ares platform
> >   Platform/ARM/Sgi: Add initial support for SGI-Clark.Ares platform
> >   Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Helios platform
> >   Platform/ARM/Sgi: Add initial support for SGI-Clark.Helios platform
> >
> >  Platform/ARM/SgiPkg/SgiPlatform.dec  |   2 +
> >  Platform/ARM/SgiPkg/SgiPlatform.dsc  |   2 +
> >  Platform/ARM/SgiPkg/SgiPlatform.fdf  |   2 +
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf  |  58 +
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf  |  58 +
> >  Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf  |   2 +
> >  Platform/ARM/SgiPkg/Include/SgiPlatform.h|   5 +
> >  Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c|  19 +-
> >  Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c |  24 +-
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dbg2.aslc   |  90 +++
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dsdt.asl| 116 
> > +
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Fadt.aslc   |  87 +++
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Gtdt.aslc   | 152 
> > +++
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Iort.aslc   | 106 
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Madt.aslc   | 171 
> > +
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Mcfg.aslc   |  61 +
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Spcr.aslc   |  77 ++
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Ssdt.asl|  95 +++
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dbg2.aslc   |  90 +++
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dsdt.asl| 262 
> > +++
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Fadt.aslc   |  87 +++
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Gtdt.aslc   | 152 
> > +++
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Iort.aslc   | 106 
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Madt.aslc   | 266 
> > 
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Mcfg.aslc   |  61 +
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Spcr.aslc   |  77 ++
> >  Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Ssdt.asl|  95 +++
> >  27 files changed, 2315 insertions(+), 8 deletions(-)
> >  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf
> >  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf
> >  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dbg2.aslc
> >  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dsdt.asl
> >  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Fadt.aslc
> >  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Gtdt.aslc
> >  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Iort.aslc
> >  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Madt.aslc
> >  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Mcfg.aslc
> >  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Spcr.aslc
> >  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Ssdt.asl
> >  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dbg2.aslc
> >  create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dsdt.asl
> >  create mode 100644 Plat

Re: [edk2] [PATCH v2 edk2-platforms 1/5] Platform/ARM/Sgi: Adapt to changes in system-id DT node.

2018-11-12 Thread chandni cherukuri
On Mon, Nov 12, 2018 at 4:55 PM Leif Lindholm  wrote:
>
> +edk2-devel
>
> On Mon, Nov 12, 2018 at 04:28:35PM +0530, chandni cherukuri wrote:
> > On Fri, Nov 9, 2018 at 9:59 PM Leif Lindholm  
> > wrote:
> > >
> > > On Mon, Nov 05, 2018 at 02:56:55PM +0530, Chandni Cherukuri wrote:
> > > > The 'system-id' node of HW_CONFIG device tree has been updated to have
> > > > a new property 'config-id' to hold the platform configuration value.
> > > > Prior to this, configuration ID value was represented by the the upper
> > > > four bits of the 'platform ID' property value but it now has a seperate
> > > > property of its own in the 'system-id' node. So adapt to these changes
> > > > in the 'system-id' node.
> > >
> > > This gets a bit hairy semantically:
> > > - PlatformId used to be the contents of node "platform-id"
> > > - PlatformId is now the union of the lower 28 bits of node
> > >   "platform-id" and the 4 bottom bits of new node "config-id",
> > > - The result is still called PlatformId.
> > >
> > > Is there some better way of describing this? Should the function name
> > > change?
> > >
> > Before the 'system-id'  node is represented as -
> > system-id {
> >platform-id = <>; /* Consists of both PART NUMBER and Configuration ID */
> > }
> >
> > Earlier for the 'platform-id' property, the upper 4 bits consisted of
> > the configuration
> > number and the lower 12 bits consisted of the part number of the platform 
> > but
> > now that value has been split across two properties ('platform-id' and
> > 'config-id')
> > , 'platform-id' consists of the part number and 'config-id' consists
> > of the configuration
> > number of the platform.
> >
> > Currently the system-id node is represented as below -
> > system-id {
> >platform-id = <>; /* PART NUMBER */
> > config-id = <>;   /* Configuration ID */
> > }
> >
> > So even now the contents of the 'PlatformId' is still the same. To
> > account for the
> > changes done in the 'system-id' device tree node the code as been
> > modified so that
> > the 'PlatformId' variable still consists of both the PART NUMBER and
> > Configuration ID
> > of the platform.
>
> OK, so given that (excellent) explanation, it sounds to me like the
> function should be renamed (more below).
>
> > > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > > Signed-off-by: Chandni Cherukuri 
> > > > ---
> > > >  .../SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c   | 19 
> > > > ++-
> > >
> > > Can you ensure you generate patches in accordance with the
> > > instructions at
> > > https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers#contrib-23
> > > ?
> > >
> > ok. will generate the patches accordingly.
> >
> > > >  1 file changed, 18 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git 
> > > > a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c 
> > > > b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
> > > > index 081d329..8b6c71b 100644
> > > > --- a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
> > > > +++ b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
> > > > @@ -42,6 +42,8 @@ GetSgiPlatformId (
> > >
> > > Since this is changing what the return value of the function means,
> > > can the function description comment be updated as well?
> > >
> > The return value of the function is still the same as before. The function
> > returns the 'PlatformId' variable in which the upper 4 bits consists of the
> > Configuration ID and the lower 12 bits consists of the part number of
> > the platform.
>
> Yes, but the fact that the return value is numerically the same is
> irrelevant; it now means something different than what it used to be.
>
> Based on your explanation above, I would suggest a more appropriate
> name for this function would now be GetSgiSystemId.
>

Ok, will change the name of this function in the next version.

> *however* ... it also makes me question why this change was made in
> this way? If we're changing the underlying data structure, why are we
> not also changing SGI_PLATFORM_DESCRIPTOR to reflect this?
>
The intention was to not modify the ex

[edk2] [PATCH v3 edk2-platforms 5/5] Platform/ARM/Sgi: Add initial support for SGI-Clark.Helios platform

2018-11-12 Thread Chandni Cherukuri
Add the initial support for ARM's System Guidance for Infrastructure
SGI-Clark.Helios platform. The ACPI tables for this platform are
installed.

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Include/SgiPlatform.h | 1 +
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index b84709e..7b0bb4a 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -75,6 +75,7 @@
 //SGI-Clark Platform Identification values
 #define SGI_CLARK_PART_NUM0x786
 #define SGI_CLARKA_CONF_NUM   0x1
+#define SGI_CLARKH_CONF_NUM   0x2
 
 #define SGI_CONFIG_MASK   0x0F
 #define SGI_CONFIG_SHIFT  0x1C
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index 1c56f65..cf085f8 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -51,6 +51,9 @@ ArmSgiPkgEntryPoint (
   } else if ((PartNum == SGI_CLARK_PART_NUM) &&
  (ConfigId == SGI_CLARKA_CONF_NUM)) {
 Status = LocateAndInstallAcpiFromFv ();
+  } else if ((PartNum == SGI_CLARK_PART_NUM) &&
+ (ConfigId == SGI_CLARKH_CONF_NUM)) {
+Status = LocateAndInstallAcpiFromFv ();
   } else {
 Status = EFI_UNSUPPORTED;
   }
-- 
2.7.4

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


[edk2] [PATCH v3 edk2-platforms 4/5] Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Helios platform

2018-11-12 Thread Chandni Cherukuri
Added ACPI tables and GUID name 'gSgiClarkHeliosAcpiTablesFileGuid'
for SGI-Clark.Helios platform.

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/SgiPlatform.dec |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.dsc |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf |   1 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf |  58 +
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |   1 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dbg2.aslc  |  90 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dsdt.asl   | 262 
+++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Fadt.aslc  |  87 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Gtdt.aslc  | 152 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Iort.aslc  | 106 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Madt.aslc  | 266 

 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Mcfg.aslc  |  61 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Spcr.aslc  |  77 ++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Ssdt.asl   |  95 +++
 14 files changed, 1258 insertions(+)

diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec 
b/Platform/ARM/SgiPkg/SgiPlatform.dec
index f66fa1f..f6e0ba1 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dec
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -34,6 +34,7 @@
   gArmSgiTokenSpaceGuid  = { 0x577d6941, 0xaea1, 0x40b4, { 0x90, 0x93, 
0x2a, 0x86, 0x61, 0x72, 0x5a, 0x57 } }
   gSgi575AcpiTablesFileGuid  = { 0xc712719a, 0x0aaf, 0x438c, { 0x9c, 0xdd, 
0x35, 0xab, 0x4d, 0x60, 0x20, 0x7d } }
   gSgiClarkAresAcpiTablesFileGuid = { 0x4b0b91d0, 0x4a05, 0x45c4, { 0x88, 
0xa7, 0x88, 0xe1, 0x70, 0xe7, 0x66, 0x94 } }
+  gSgiClarkHeliosAcpiTablesFileGuid = { 0x2af40815, 0xa84e, 0x4de9, { 0x8c, 
0x38, 0x91, 0x40, 0xb3, 0x54, 0x40, 0x73 } }
 
 [PcdsFeatureFlag.common]
   # Set this PCD to TRUE to enable virtio support.
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
b/Platform/ARM/SgiPkg/SgiPlatform.dsc
index 0df0f88..99babd9 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -252,6 +252,7 @@
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
   Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
   Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf
+  Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   #
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf 
b/Platform/ARM/SgiPkg/SgiPlatform.fdf
index f400083..8ec3374 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
+++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
@@ -107,6 +107,7 @@ READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
   INF RuleOverride=ACPITABLE 
Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf
   INF RuleOverride=ACPITABLE 
Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf
+  INF RuleOverride=ACPITABLE 
Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf
   INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   # Required by PCI
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf
new file mode 100644
index 000..63ebf55
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf
@@ -0,0 +1,58 @@
+## @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  = SgiClarkHeliosAcpiTables
+  FILE_GUID  = 2af40815-a84e-4de9-8c38-9140b3544073
+  MODULE_TYPE= USER_DEFINED
+  VERSION_STRING = 1.0
+
+[Sources]
+  Dbg2.aslc
+  Dsdt.asl
+  Fadt.aslc
+  Gtdt.aslc
+  Iort.aslc
+  Madt.aslc
+  Mcfg.aslc
+  Spcr.aslc
+  Ssdt.asl
+
+[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.PcdArmArchTimer

[edk2] [PATCH v3 edk2-platforms 3/5] Platform/ARM/Sgi: Add initial support for SGI-Clark.Ares platform

2018-11-12 Thread Chandni Cherukuri
Add the initial support for ARM's System Guidance for Infrastructure
SGI-Clark.Ares platform. The ACPI tables for this platform are
installed.

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Include/SgiPlatform.h |  4 
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 16 +---
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index 1454018..b84709e 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -72,6 +72,10 @@
 #define SGI575_CONF_NUM   0x3
 #define SGI575_PART_NUM   0x783
 
+//SGI-Clark Platform Identification values
+#define SGI_CLARK_PART_NUM0x786
+#define SGI_CLARKA_CONF_NUM   0x1
+
 #define SGI_CONFIG_MASK   0x0F
 #define SGI_CONFIG_SHIFT  0x1C
 #define SGI_PART_NUM_MASK 0xFFF
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index 5ccd01d..1c56f65 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -48,14 +48,16 @@ ArmSgiPkgEntryPoint (
 
   if ((PartNum == SGI575_PART_NUM) && (ConfigId == SGI575_CONF_NUM)) {
 Status = LocateAndInstallAcpiFromFv ();
-if (EFI_ERROR (Status)) {
-  DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n",
-__FUNCTION__));
-  return Status;
-}
+  } else if ((PartNum == SGI_CLARK_PART_NUM) &&
+ (ConfigId == SGI_CLARKA_CONF_NUM)) {
+Status = LocateAndInstallAcpiFromFv ();
   } else {
-DEBUG ((DEBUG_ERROR, "PlatformDxe: Unsupported Platform Id\n"));
-return EFI_UNSUPPORTED;
+Status = EFI_UNSUPPORTED;
+  }
+
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__));
+return Status;
   }
 
   Status = EFI_REQUEST_UNLOAD_IMAGE;
-- 
2.7.4

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


[edk2] [PATCH v3 edk2-platforms 1/5] Platform/ARM/Sgi: Adapt to changes in system-id DT node.

2018-11-12 Thread Chandni Cherukuri
The 'system-id' node of HW_CONFIG device tree has been updated to have
a new property 'config-id' to hold the platform configuration value.
Prior to this, configuration ID value was represented by the the upper
four bits of the 'platform ID' property value but it now has a seperate
property of its own in the 'system-id' node. So adapt to these changes
in the 'system-id' node.

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c | 24 
+++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c 
b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
index 081d329..5bdf20c 100644
--- a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
+++ b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
@@ -42,6 +42,8 @@ GetSgiPlatformId (
   CONST VOID*HwCfgDtBlob;
   SGI_HW_CONFIG_INFO_PPI*HwConfigInfoPpi;
   EFI_STATUSStatus;
+  UINT32PlatformId;
+  UINT32ConfigId;
 
   Status = PeiServicesLocatePpi (, 0, NULL,
  (VOID**));
@@ -69,7 +71,27 @@ GetSgiPlatformId (
 return 0;
   }
 
-  return fdt32_to_cpu (*Property);
+  PlatformId = fdt32_to_cpu (*Property);
+
+  // Ensure upper 4-bits of platform-id is set to zero.
+  ASSERT ((PlatformId >> SGI_CONFIG_SHIFT) == 0);
+
+  Property = fdt_getprop (HwCfgDtBlob, Offset, "config-id", NULL);
+  if (Property == NULL) {
+DEBUG ((DEBUG_ERROR, "Config Id is NULL\n"));
+return 0;
+  }
+
+  ConfigId = fdt32_to_cpu (*Property);
+
+  // Ensure upper 28-bits of config-id is set to zero.
+  ASSERT ((ConfigId >> SGI_CONFIG_MASK) == 0);
+
+  // Concatenate the value of config ID into the platform ID value with
+  // config ID occupying the upper 4 bits of platform ID.
+  PlatformId = PlatformId | (ConfigId << SGI_CONFIG_SHIFT);
+
+  return PlatformId;
 }
 
 /**
-- 
2.7.4

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


[edk2] [PATCH v3 edk2-platforms 0/5] Platform/ARM/Sgi: Add support for Clark.Ares and Clark.Helios platforms

2018-11-12 Thread Chandni Cherukuri
Changes since v2:
- Added additional checks for platform-id and config-id values.

Changes since v1:
- No code changes, posting this series again with correct patch subject

This patch series adds support for two new Arm's SGI platforms - 
SGI-Clark.Ares and SGI-Clark.Helios. The first patch in this
series adds support to use a new binding added to the system-id
node for Platform Identification. The rest of the patches add
support for the two new SGI platforms.

Chandni Cherukuri (5):
  Platform/ARM/Sgi: Adapt to changes in system-id DT node.
  Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Ares platform
  Platform/ARM/Sgi: Add initial support for SGI-Clark.Ares platform
  Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Helios platform
  Platform/ARM/Sgi: Add initial support for SGI-Clark.Helios platform

 Platform/ARM/SgiPkg/SgiPlatform.dec  |   2 +
 Platform/ARM/SgiPkg/SgiPlatform.dsc  |   2 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf  |   2 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf  |  58 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf  |  58 +
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf  |   2 +
 Platform/ARM/SgiPkg/Include/SgiPlatform.h|   5 +
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c|  19 +-
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c |  24 +-
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dbg2.aslc   |  90 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dsdt.asl| 116 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Fadt.aslc   |  87 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Gtdt.aslc   | 152 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Iort.aslc   | 106 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Madt.aslc   | 171 
+
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Mcfg.aslc   |  61 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Spcr.aslc   |  77 ++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Ssdt.asl|  95 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dbg2.aslc   |  90 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dsdt.asl| 262 
+++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Fadt.aslc   |  87 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Gtdt.aslc   | 152 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Iort.aslc   | 106 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Madt.aslc   | 266 

 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Mcfg.aslc   |  61 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Spcr.aslc   |  77 ++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Ssdt.asl|  95 +++
 27 files changed, 2315 insertions(+), 8 deletions(-)
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dbg2.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dsdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Fadt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Gtdt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Iort.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Madt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Mcfg.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Spcr.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Ssdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dbg2.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dsdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Fadt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Gtdt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Iort.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Madt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Mcfg.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Spcr.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Ssdt.asl

-- 
2.7.4


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


[edk2] [PATCH v2 edk2-platforms 5/5] Platform/ARM/Sgi: Add platform support for SGI-Clark.Helios

2018-11-05 Thread Chandni Cherukuri
Platform support for SGI-Clark.Helios platform has been added.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 3 +++
 Platform/ARM/SgiPkg/Include/SgiPlatform.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index 1c56f65..cf085f8 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -51,6 +51,9 @@ ArmSgiPkgEntryPoint (
   } else if ((PartNum == SGI_CLARK_PART_NUM) &&
  (ConfigId == SGI_CLARKA_CONF_NUM)) {
 Status = LocateAndInstallAcpiFromFv ();
+  } else if ((PartNum == SGI_CLARK_PART_NUM) &&
+ (ConfigId == SGI_CLARKH_CONF_NUM)) {
+Status = LocateAndInstallAcpiFromFv ();
   } else {
 Status = EFI_UNSUPPORTED;
   }
diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index b84709e..7b0bb4a 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -75,6 +75,7 @@
 //SGI-Clark Platform Identification values
 #define SGI_CLARK_PART_NUM0x786
 #define SGI_CLARKA_CONF_NUM   0x1
+#define SGI_CLARKH_CONF_NUM   0x2
 
 #define SGI_CONFIG_MASK   0x0F
 #define SGI_CONFIG_SHIFT  0x1C
-- 
2.7.4

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


[edk2] [PATCH v2 edk2-platforms 4/5] Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Helios platform

2018-11-05 Thread Chandni Cherukuri
Added ACPI tables and GUID name 'gSgiClarkHeliosAcpiTablesFileGuid'
for SGI-Clark.Helios platform.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 .../ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf |  58 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dbg2.aslc |  90 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dsdt.asl  | 262 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Fadt.aslc |  87 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Gtdt.aslc | 152 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Iort.aslc | 106 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Madt.aslc | 266 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Mcfg.aslc |  61 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Spcr.aslc |  77 ++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Ssdt.asl  |  95 
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.dec|   1 +
 Platform/ARM/SgiPkg/SgiPlatform.dsc|   1 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf|   1 +
 14 files changed, 1258 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dbg2.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dsdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Fadt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Gtdt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Iort.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Madt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Mcfg.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Spcr.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Ssdt.asl

diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf
new file mode 100644
index 000..63ebf55
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf
@@ -0,0 +1,58 @@
+## @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  = SgiClarkHeliosAcpiTables
+  FILE_GUID  = 2af40815-a84e-4de9-8c38-9140b3544073
+  MODULE_TYPE= USER_DEFINED
+  VERSION_STRING = 1.0
+
+[Sources]
+  Dbg2.aslc
+  Dsdt.asl
+  Fadt.aslc
+  Gtdt.aslc
+  Iort.aslc
+  Madt.aslc
+  Mcfg.aslc
+  Spcr.aslc
+  Ssdt.asl
+
+[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
+  gArmTokenSpaceGuid.PcdPciBusMin
+  gArmTokenSpaceGuid.PcdPciBusMax
+
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dbg2.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dbg2.aslc
new file mode 100644
index 000..3970461
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/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
+

[edk2] [PATCH v2 edk2-platforms 3/5] Platform/ARM/Sgi: Add support for SGI-Clark.Ares platform

2018-11-05 Thread Chandni Cherukuri
Platform support for SGI-Clark.Ares platform has been added

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 16 +---
 Platform/ARM/SgiPkg/Include/SgiPlatform.h |  4 
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index 5ccd01d..1c56f65 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -48,14 +48,16 @@ ArmSgiPkgEntryPoint (
 
   if ((PartNum == SGI575_PART_NUM) && (ConfigId == SGI575_CONF_NUM)) {
 Status = LocateAndInstallAcpiFromFv ();
-if (EFI_ERROR (Status)) {
-  DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n",
-__FUNCTION__));
-  return Status;
-}
+  } else if ((PartNum == SGI_CLARK_PART_NUM) &&
+ (ConfigId == SGI_CLARKA_CONF_NUM)) {
+Status = LocateAndInstallAcpiFromFv ();
   } else {
-DEBUG ((DEBUG_ERROR, "PlatformDxe: Unsupported Platform Id\n"));
-return EFI_UNSUPPORTED;
+Status = EFI_UNSUPPORTED;
+  }
+
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__));
+return Status;
   }
 
   Status = EFI_REQUEST_UNLOAD_IMAGE;
diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index 1454018..b84709e 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -72,6 +72,10 @@
 #define SGI575_CONF_NUM   0x3
 #define SGI575_PART_NUM   0x783
 
+//SGI-Clark Platform Identification values
+#define SGI_CLARK_PART_NUM0x786
+#define SGI_CLARKA_CONF_NUM   0x1
+
 #define SGI_CONFIG_MASK   0x0F
 #define SGI_CONFIG_SHIFT  0x1C
 #define SGI_PART_NUM_MASK 0xFFF
-- 
2.7.4

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


[edk2] [PATCH v2 edk2-platforms 2/5] Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Ares platform

2018-11-05 Thread Chandni Cherukuri
Added ACPI tables and GUID name 'gSgiClarkAresAcpiTablesFileGuid'
for SGI-Clark.Ares platform.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 .../ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf |  58 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dbg2.aslc |  90 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dsdt.asl  | 116 ++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Fadt.aslc |  87 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Gtdt.aslc | 152 ++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Iort.aslc | 106 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Madt.aslc | 171 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Mcfg.aslc |  61 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Spcr.aslc |  77 ++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Ssdt.asl  |  95 
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.dec|   1 +
 Platform/ARM/SgiPkg/SgiPlatform.dsc|   1 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf|   1 +
 14 files changed, 1017 insertions(+)
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dbg2.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dsdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Fadt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Gtdt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Iort.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Madt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Mcfg.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Spcr.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Ssdt.asl

diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf
new file mode 100644
index 000..3787ab4
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf
@@ -0,0 +1,58 @@
+## @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  = SgiClarkAresAcpiTables
+  FILE_GUID  = 4b0b91d0-4a05-45c4-88a7-88e170e76694
+  MODULE_TYPE= USER_DEFINED
+  VERSION_STRING = 1.0
+
+[Sources]
+  Dbg2.aslc
+  Dsdt.asl
+  Fadt.aslc
+  Gtdt.aslc
+  Iort.aslc
+  Madt.aslc
+  Mcfg.aslc
+  Spcr.aslc
+  Ssdt.asl
+
+[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
+  gArmTokenSpaceGuid.PcdPciBusMin
+  gArmTokenSpaceGuid.PcdPciBusMax
+
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dbg2.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dbg2.aslc
new file mode 100644
index 000..3970461
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/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_GA

[edk2] [PATCH v2 edk2-platforms 1/5] Platform/ARM/Sgi: Adapt to changes in system-id DT node.

2018-11-05 Thread Chandni Cherukuri
The 'system-id' node of HW_CONFIG device tree has been updated to have
a new property 'config-id' to hold the platform configuration value.
Prior to this, configuration ID value was represented by the the upper
four bits of the 'platform ID' property value but it now has a seperate
property of its own in the 'system-id' node. So adapt to these changes
in the 'system-id' node.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 .../SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c   | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c 
b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
index 081d329..8b6c71b 100644
--- a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
+++ b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
@@ -42,6 +42,8 @@ GetSgiPlatformId (
   CONST VOID*HwCfgDtBlob;
   SGI_HW_CONFIG_INFO_PPI*HwConfigInfoPpi;
   EFI_STATUSStatus;
+  UINT32PlatformId;
+  UINT32ConfigId;
 
   Status = PeiServicesLocatePpi (, 0, NULL,
  (VOID**));
@@ -69,7 +71,22 @@ GetSgiPlatformId (
 return 0;
   }
 
-  return fdt32_to_cpu (*Property);
+  PlatformId = fdt32_to_cpu (*Property);
+
+  Property = fdt_getprop (HwCfgDtBlob, Offset, "config-id", NULL);
+  if (Property == NULL) {
+DEBUG ((DEBUG_ERROR, "Config Id is NULL\n"));
+return 0;
+  }
+
+  ConfigId = fdt32_to_cpu (*Property);
+
+  // Concatenate the value of config ID into the platform ID value with
+  // config ID occupying the upper 4 bits of platform ID.
+  ConfigId = ConfigId & SGI_CONFIG_MASK;
+  PlatformId = PlatformId | (ConfigId << SGI_CONFIG_SHIFT);
+
+  return PlatformId;
 }
 
 /**
-- 
2.7.4

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


[edk2] [PATCH v2 edk2-platforms 0/5] Platform/ARM/Sgi: Add support for Clark.Ares and

2018-11-05 Thread Chandni Cherukuri
In-Reply-To: 

Changes since v1:
- No code changes, posting this series again with correct patch subject

This patch series adds support for two new Arm's SGI platforms - 
SGI-Clark.Ares and SGI-Clark.Helios. The first patch in this
series adds support to use a new binding added to the system-id
node for Platform Identification. The rest of the patches add
support for the two new SGI platforms.

Chandni Cherukuri (5):
  Platform/ARM/Sgi: Adapt to changes in system-id DT node.
  Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Ares platform
  Platform/ARM/Sgi: Add support for SGI-Clark.Ares platform
  Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Helios platform
  Platform/ARM/Sgi: Add platform support for SGI-Clark.Helios

 .../ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf |  58 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dbg2.aslc |  90 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dsdt.asl  | 116 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Fadt.aslc |  87 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Gtdt.aslc | 152 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Iort.aslc | 106 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Madt.aslc | 171 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Mcfg.aslc |  61 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Spcr.aslc |  77 ++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Ssdt.asl  |  95 
 .../ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf |  58 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dbg2.aslc |  90 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dsdt.asl  | 262 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Fadt.aslc |  87 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Gtdt.aslc | 152 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Iort.aslc | 106 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Madt.aslc | 266 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Mcfg.aslc |  61 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Spcr.aslc |  77 ++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Ssdt.asl  |  95 
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   |  19 +-
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |   2 +
 Platform/ARM/SgiPkg/Include/SgiPlatform.h  |   5 +
 .../Library/SgiPlatformPei/SgiPlatformPeim.c   |  19 +-
 Platform/ARM/SgiPkg/SgiPlatform.dec|   2 +
 Platform/ARM/SgiPkg/SgiPlatform.dsc|   2 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf|   2 +
 27 files changed, 2310 insertions(+), 8 deletions(-)
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dbg2.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dsdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Fadt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Gtdt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Iort.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Madt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Mcfg.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Spcr.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Ssdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dbg2.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dsdt.asl
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Fadt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Gtdt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Iort.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Madt.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Mcfg.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Spcr.aslc
 create mode 100644 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Ssdt.asl


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


[edk2] [PATCH edk2-platforms 5/5] Platform/ARM/Sgi: Add platform support for SGI-Clark.Helios

2018-11-02 Thread Chandni Cherukuri
Platform support for SGI-Clark.Helios platform has been added.

Change-Id: Iaf7962334b6366d35a195e4c94341d1972783a81
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 3 +++
 Platform/ARM/SgiPkg/Include/SgiPlatform.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index 1c56f65..cf085f8 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -51,6 +51,9 @@ ArmSgiPkgEntryPoint (
   } else if ((PartNum == SGI_CLARK_PART_NUM) &&
  (ConfigId == SGI_CLARKA_CONF_NUM)) {
 Status = LocateAndInstallAcpiFromFv ();
+  } else if ((PartNum == SGI_CLARK_PART_NUM) &&
+ (ConfigId == SGI_CLARKH_CONF_NUM)) {
+Status = LocateAndInstallAcpiFromFv ();
   } else {
 Status = EFI_UNSUPPORTED;
   }
diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index b84709e..7b0bb4a 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -75,6 +75,7 @@
 //SGI-Clark Platform Identification values
 #define SGI_CLARK_PART_NUM0x786
 #define SGI_CLARKA_CONF_NUM   0x1
+#define SGI_CLARKH_CONF_NUM   0x2
 
 #define SGI_CONFIG_MASK   0x0F
 #define SGI_CONFIG_SHIFT  0x1C
-- 
2.7.4

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


[edk2] [PATCH edk2-platforms 4/5] Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Helios platform

2018-11-02 Thread Chandni Cherukuri
Added ACPI tables and GUID name 'gSgiClarkHeliosAcpiTablesFileGuid'
for SGI-Clark.Helios platform.

Change-Id: Ib212c0b27ad1f9f709385ac92e5e06b1bd33bfc0
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf |  58 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dbg2.aslc  |  90 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dsdt.asl   | 262 
+++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Fadt.aslc  |  87 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Gtdt.aslc  | 152 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Iort.aslc  | 106 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Madt.aslc  | 266 

 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Mcfg.aslc  |  61 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Spcr.aslc  |  77 ++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Ssdt.asl   |  95 +++
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.dec |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.dsc |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf |   1 +
 14 files changed, 1258 insertions(+)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf
new file mode 100644
index 000..63ebf55
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/AcpiTables.inf
@@ -0,0 +1,58 @@
+## @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  = SgiClarkHeliosAcpiTables
+  FILE_GUID  = 2af40815-a84e-4de9-8c38-9140b3544073
+  MODULE_TYPE= USER_DEFINED
+  VERSION_STRING = 1.0
+
+[Sources]
+  Dbg2.aslc
+  Dsdt.asl
+  Fadt.aslc
+  Gtdt.aslc
+  Iort.aslc
+  Madt.aslc
+  Mcfg.aslc
+  Spcr.aslc
+  Ssdt.asl
+
+[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
+  gArmTokenSpaceGuid.PcdPciBusMin
+  gArmTokenSpaceGuid.PcdPciBusMax
+
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dbg2.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/Dbg2.aslc
new file mode 100644
index 000..3970461
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkH/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;
+  EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTUREBaseAddressRegister;
+  UINT32AddressSize;
+  UINT8 
NameSpaceString[SGI_DBG2_NS_STR_LENGTH];
+} DBG2_DEBUG_DEVICE_INFORMATION;
+
+typedef struct {
+  EFI_ACPI_DEBUG_PORT_2_DESCR

[edk2] [PATCH edk2-platforms 3/5] Platform/ARM/Sgi: Add support for SGI-Clark.Ares platform

2018-11-02 Thread Chandni Cherukuri
Platform support for SGI-Clark.Ares platform has been added

Change-Id: I3bb15950963f1ccbf3c099894e90ef730dfc3f8e
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 16 +---
 Platform/ARM/SgiPkg/Include/SgiPlatform.h |  4 
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index 5ccd01d..1c56f65 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -48,14 +48,16 @@ ArmSgiPkgEntryPoint (
 
   if ((PartNum == SGI575_PART_NUM) && (ConfigId == SGI575_CONF_NUM)) {
 Status = LocateAndInstallAcpiFromFv ();
-if (EFI_ERROR (Status)) {
-  DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n",
-__FUNCTION__));
-  return Status;
-}
+  } else if ((PartNum == SGI_CLARK_PART_NUM) &&
+ (ConfigId == SGI_CLARKA_CONF_NUM)) {
+Status = LocateAndInstallAcpiFromFv ();
   } else {
-DEBUG ((DEBUG_ERROR, "PlatformDxe: Unsupported Platform Id\n"));
-return EFI_UNSUPPORTED;
+Status = EFI_UNSUPPORTED;
+  }
+
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__));
+return Status;
   }
 
   Status = EFI_REQUEST_UNLOAD_IMAGE;
diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index 1454018..b84709e 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -72,6 +72,10 @@
 #define SGI575_CONF_NUM   0x3
 #define SGI575_PART_NUM   0x783
 
+//SGI-Clark Platform Identification values
+#define SGI_CLARK_PART_NUM0x786
+#define SGI_CLARKA_CONF_NUM   0x1
+
 #define SGI_CONFIG_MASK   0x0F
 #define SGI_CONFIG_SHIFT  0x1C
 #define SGI_PART_NUM_MASK 0xFFF
-- 
2.7.4

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


[edk2] [PATCH edk2-platforms 2/5] Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Ares platform

2018-11-02 Thread Chandni Cherukuri
Added ACPI tables and GUID name 'gSgiClarkAresAcpiTablesFileGuid'
for SGI-Clark.Ares platform.

Change-Id: Ic58fdc4cdd5919b59ca7752ab3468b41cb79d0f0
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf |  58 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dbg2.aslc  |  90 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dsdt.asl   | 116 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Fadt.aslc  |  87 ++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Gtdt.aslc  | 152 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Iort.aslc  | 106 
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Madt.aslc  | 171 

 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Mcfg.aslc  |  61 +++
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Spcr.aslc  |  77 +
 Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Ssdt.asl   |  95 +++
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.dec |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.dsc |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf |   1 +
 14 files changed, 1017 insertions(+)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf
new file mode 100644
index 000..3787ab4
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/AcpiTables.inf
@@ -0,0 +1,58 @@
+## @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  = SgiClarkAresAcpiTables
+  FILE_GUID  = 4b0b91d0-4a05-45c4-88a7-88e170e76694
+  MODULE_TYPE= USER_DEFINED
+  VERSION_STRING = 1.0
+
+[Sources]
+  Dbg2.aslc
+  Dsdt.asl
+  Fadt.aslc
+  Gtdt.aslc
+  Iort.aslc
+  Madt.aslc
+  Mcfg.aslc
+  Spcr.aslc
+  Ssdt.asl
+
+[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
+  gArmTokenSpaceGuid.PcdPciBusMin
+  gArmTokenSpaceGuid.PcdPciBusMax
+
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
diff --git a/Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dbg2.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/Dbg2.aslc
new file mode 100644
index 000..3970461
--- /dev/null
+++ b/Platform/ARM/SgiPkg/AcpiTables/SgiClarkA/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;
+  EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTUREBaseAddressRegister;
+  UINT32AddressSize;
+  UINT8 
NameSpaceString[SGI_DBG2_NS_STR_LENGTH];
+} DBG2_DEBUG_DEVICE_INFORMATION;
+
+typedef struct {
+  EFI_ACPI_DEBUG_PORT_2_DESCR

[edk2] [PATCH edk2-platforms 1/5] Platform/ARM/Sgi: Adapt to changes in system-id DT node.

2018-11-02 Thread Chandni Cherukuri
The 'system-id' node of HW_CONFIG device tree has been updated to have
a new property 'config-id' to hold the platform configuration value.
Prior to this, configuration ID value was represented by the the upper
four bits of the 'platform ID' property value but it now has a seperate
property of its own in the 'system-id' node. So adapt to these changes
in the 'system-id' node.

Change-Id: Ia15e31df50f2f43746231e5c4352035a13510bba
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c | 241 
+++-
 1 file changed, 129 insertions(+), 112 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c 
b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
index 081d329..ba980e0 100644
--- a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
+++ b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
@@ -1,112 +1,129 @@
-/** @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 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-/**
-
-  This function returns the Platform ID of the platform
-
-  This functions locates the HwConfig PPI and gets the base address of HW 
CONFIG
-  DT from which the platform ID is obtained using FDT helper functions
-
-  @return returns the platform ID on success else returns 0 on error
-
-**/
-
-STATIC
-UINT32
-GetSgiPlatformId (
- VOID
-)
-{
-  CONST UINT32  *Property;
-  INT32 Offset;
-  CONST VOID*HwCfgDtBlob;
-  SGI_HW_CONFIG_INFO_PPI*HwConfigInfoPpi;
-  EFI_STATUSStatus;
-
-  Status = PeiServicesLocatePpi (, 0, NULL,
- (VOID**));
-  if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR,
-  "PeiServicesLocatePpi failed with error %r\n", Status));
-return 0;
-  }
-
-  HwCfgDtBlob = (VOID *)(UINTN)HwConfigInfoPpi->HwConfigDtAddr;
-  if (fdt_check_header (HwCfgDtBlob) != 0) {
-DEBUG ((DEBUG_ERROR, "Invalid DTB file %p passed\n", HwCfgDtBlob));
-return 0;
-  }
-
-  Offset = fdt_subnode_offset (HwCfgDtBlob, 0, "system-id");
-  if (Offset == -FDT_ERR_NOTFOUND) {
-DEBUG ((DEBUG_ERROR, "Invalid DTB : system-id node not found\n"));
-return 0;
-  }
-
-  Property = fdt_getprop (HwCfgDtBlob, Offset, "platform-id", NULL);
-  if (Property == NULL) {
-DEBUG ((DEBUG_ERROR, "Platform Id is NULL\n"));
-return 0;
-  }
-
-  return fdt32_to_cpu (*Property);
-}
-
-/**
-
- This function creates a Platform ID HOB and assigns PlatformId as the
- HobData
-
- @return asserts on error and returns EFI_INVALID_PARAMETER. On success
- returns EFI_SUCCESS
-
-**/
-EFI_STATUS
-EFIAPI
-SgiPlatformPeim (
- IN   EFI_PEI_FILE_HANDLE  FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
-)
-{
-  SGI_PLATFORM_DESCRIPTOR   *HobData;
-
-  // Create platform descriptor HOB
-  HobData = (SGI_PLATFORM_DESCRIPTOR *)BuildGuidHob (
- ,
- sizeof (SGI_PLATFORM_DESCRIPTOR));
-
-  // Get the platform id from the platform specific hw_config device tree
-  if (HobData == NULL) {
-DEBUG ((DEBUG_ERROR, "Platform HOB is NULL\n"));
-ASSERT (FALSE);
-return EFI_OUT_OF_RESOURCES;
-  }
-
-  HobData->PlatformId = GetSgiPlatformId ();
-  if (HobData->PlatformId == 0) {
-ASSERT (FALSE);
-return EFI_INVALID_PARAMETER;
-  }
-
-  return EFI_SUCCESS;
-}
+/** @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 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+
+  This function returns the Platform ID of the platform
+
+  This functions locates the HwConfig PPI and gets the base address of HW 
CONFIG
+  DT from which the platform ID is obtained using FDT helper functions
+
+  @return returns the platform ID on success else returns 0 on error
+
+**/
+
+STATIC
+UINT32
+GetSgiPlatformId

[edk2] [PATCH edk2-platforms 0/5] Add platform support for SGI-Clark platforms

2018-11-02 Thread Chandni Cherukuri
Rest of the patches add support for SGI-Clark.Ares and SGI-Clark.Helios
platforms.

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


Re: [edk2] [PATCH edk2-platforms] sgi575/acpi: Use ACPI 6.2 specification

2018-08-30 Thread chandni cherukuri
On Thu, Aug 30, 2018 at 6:33 PM Ard Biesheuvel
 wrote:
>
> On 30 August 2018 at 13:23, Leif Lindholm  wrote:
> > On Wed, Aug 29, 2018 at 04:14:16PM +0530, Chandni Cherukuri wrote:
> >> Switched from using ACPI 6.1 to 6.2 specification for
> >> SGI575 since SBBR 1.1 requires ACPI 6.2 tables or later.
> >
> > Just to clarify - this has no impact at all on the actual generated
> > tables, right?
> >
> > We really should have a better way of dealing with this.
> > (But we don't, at the moment.)
> >

Thanks for the review Leif.
There is no impact on the generated tables with this change.
>
> I don't see the point of these changes. The whole point of ACPI's
> forward compatibility guarantees is that a ACPI 6.1 system
> automatically complies with ACPI 6.2, and so these changes are not
> necessary for compliance with SBBR 1.1 either.

Thanks for the review Ard. I will abandon this patch.

>
> >> Contributed-under: TianoCore Contribution Agreement 1.1
> >> Cc: Ard Biesheuvel 
> >> Cc: Leif Lindholm 
> >> Signed-off-by: Chandni Cherukuri 
> >> ---
> >>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc |  8 ++--
> >>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc | 48 ++--
> >>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc |  4 +-
> >>  Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc |  6 +--
> >>  4 files changed, 33 insertions(+), 33 deletions(-)
> >>
> >> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc 
> >> b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
> >> index ed671f3..0183685 100644
> >> --- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
> >> +++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
> >> @@ -15,7 +15,7 @@
> >>
> >>  #include "SgiAcpiHeader.h"
> >>  #include 
> >> -#include 
> >> +#include 
> >>  #include 
> >>
> >>  #define SGI_DBG2_NUM_DEBUG_PORTS   1
> >> @@ -29,7 +29,7 @@
> >>
> >>  typedef struct {
> >>EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT Dbg2Device;
> >> -  EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTUREBaseAddressRegister;
> >> +  EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTUREBaseAddressRegister;
> >>UINT32AddressSize;
> >>UINT8 
> >> NameSpaceString[SGI_DBG2_NS_STR_LENGTH];
> >>  } DBG2_DEBUG_DEVICE_INFORMATION;
> >> @@ -56,7 +56,7 @@ typedef struct {
> >>  OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, BaseAddressRegister), /* 
> >> UINT16BaseAddressRegister Offset */  \
> >>  OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, AddressSize)  /* 
> >> UINT16AddressSize Offset */  \
> >>},  
> >>   \
> >> -  ARM_GAS32 (UartBase),/* 
> >> EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister */ \
> >> +  ARM_GAS32 (UartBase),/* 
> >> EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister */ \
> >>UartAddrLen, /* UINT32  AddressSize 
> >> */\
> >>UartNameStr  /* UINT8   
> >> NameSpaceString[MAX_DBG2_NAME_LEN] */ \
> >>  }
> >> @@ -64,7 +64,7 @@ typedef struct {
> >>  STATIC DBG2_TABLE Dbg2 = {
> >>{
> >>  ARM_ACPI_HEADER (
> >> -  EFI_ACPI_6_1_DEBUG_PORT_2_TABLE_SIGNATURE,
> >> +  EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE,
> >>DBG2_TABLE,
> >>EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION
> >>  ),
> >> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc 
> >> b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
> >> index 46d811e..39e3f02 100644
> >> --- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
> >> +++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
> >> @@ -16,7 +16,7 @@
> >>  #include "SgiAcpiHeader.h"
> >>  #include 
> >>  #include 
> >> -#include 
> >> +#include 
> >>
> >>  #define SGI_PLATFORM_WATCHDOG_COUNT   2
> >>  #define SGI_PLATFORM_TIMER_COUNT  (SGI_PLATFORM_WATCHDOG_COUNT + 
> >> 1)
> >> @@ -24,7 +24,7 @@
> >>
> >&g

[edk2] [PATCH edk2-platforms] sgi575/acpi: Use ACPI 6.2 specification

2018-08-29 Thread Chandni Cherukuri
Switched from using ACPI 6.1 to 6.2 specification for
SGI575 since SBBR 1.1 requires ACPI 6.2 tables or later.

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc |  8 ++--
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc | 48 ++--
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc |  4 +-
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc |  6 +--
 4 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
index ed671f3..0183685 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
@@ -15,7 +15,7 @@
 
 #include "SgiAcpiHeader.h"
 #include 
-#include 
+#include 
 #include 
 
 #define SGI_DBG2_NUM_DEBUG_PORTS   1
@@ -29,7 +29,7 @@
 
 typedef struct {
   EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT Dbg2Device;
-  EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTUREBaseAddressRegister;
+  EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTUREBaseAddressRegister;
   UINT32AddressSize;
   UINT8 
NameSpaceString[SGI_DBG2_NS_STR_LENGTH];
 } DBG2_DEBUG_DEVICE_INFORMATION;
@@ -56,7 +56,7 @@ typedef struct {
 OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, BaseAddressRegister), /* UINT16  
  BaseAddressRegister Offset */  \
 OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, AddressSize)  /* UINT16  
  AddressSize Offset */  \
   },   
 \
-  ARM_GAS32 (UartBase),/* 
EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister */ \
+  ARM_GAS32 (UartBase),/* 
EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister */ \
   UartAddrLen, /* UINT32  AddressSize */   
 \
   UartNameStr  /* UINT8   
NameSpaceString[MAX_DBG2_NAME_LEN] */ \
 }
@@ -64,7 +64,7 @@ typedef struct {
 STATIC DBG2_TABLE Dbg2 = {
   {
 ARM_ACPI_HEADER (
-  EFI_ACPI_6_1_DEBUG_PORT_2_TABLE_SIGNATURE,
+  EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE,
   DBG2_TABLE,
   EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION
 ),
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
index 46d811e..39e3f02 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
@@ -16,7 +16,7 @@
 #include "SgiAcpiHeader.h"
 #include 
 #include 
-#include 
+#include 
 
 #define SGI_PLATFORM_WATCHDOG_COUNT   2
 #define SGI_PLATFORM_TIMER_COUNT  (SGI_PLATFORM_WATCHDOG_COUNT + 1)
@@ -24,7 +24,7 @@
 
 #define SYSTEM_TIMER_BASE_ADDRESS 0x
 #define GTDT_GLOBAL_FLAGS 0
-#define GTDT_GTIMER_FLAGS 
EFI_ACPI_6_1_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY
+#define GTDT_GTIMER_FLAGS 
EFI_ACPI_6_2_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY
 
 #define SGI_GT_BLOCK_CTL_BASE 0x2A81
 #define SGI_GT_BLOCK_FRAME1_CTL_BASE  0x2A82
@@ -36,18 +36,18 @@
 #define SGI_GT_BLOCK_FRAME0_GSIV  0x5C
 
 #define SGI_GTX_TIMER_FLAGS   0
-#define GTX_TIMER_SECURE  
EFI_ACPI_6_1_GTDT_GT_BLOCK_COMMON_FLAG_SECURE_TIMER
+#define GTX_TIMER_SECURE  
EFI_ACPI_6_2_GTDT_GT_BLOCK_COMMON_FLAG_SECURE_TIMER
 #define GTX_TIMER_NON_SECURE  0
-#define GTX_TIMER_SAVE_CONTEXT
EFI_ACPI_6_1_GTDT_GT_BLOCK_COMMON_FLAG_ALWAYS_ON_CAPABILITY
+#define GTX_TIMER_SAVE_CONTEXT
EFI_ACPI_6_2_GTDT_GT_BLOCK_COMMON_FLAG_ALWAYS_ON_CAPABILITY
 #define SGI_GTX_COMMON_FLAGS_S(GTX_TIMER_SAVE_CONTEXT | 
GTX_TIMER_SECURE)
 #define SGI_GTX_COMMON_FLAGS_NS   (GTX_TIMER_SAVE_CONTEXT | 
GTX_TIMER_NON_SECURE)
 
-#define EFI_ACPI_6_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(\
+#define EFI_ACPI_6_2_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(\
   RefreshFramePhysicalAddress, ControlFramePhysicalAddress,   \
   WatchdogTimerGSIV, WatchdogTimerFlags)  \
   {   \
-EFI_ACPI_6_1_GTDT_SBSA_GENERIC_WATCHDOG,  \
-sizeof (EFI_ACPI_6_1_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE),   \
+EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG,  \
+sizeof (EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE),   \
 EFI_ACPI_RESERVED_WORD,   \
 RefreshFramePhysicalAddress,  \
 ControlFramePhysicalAddress, 

Re: [edk2] [PATCH edk2-platforms v2 0/2] ARM Dynamic Configuration

2018-06-17 Thread chandni cherukuri
On Fri, Jun 15, 2018 at 6:10 PM, Leif Lindholm  wrote:
> On Fri, Jun 15, 2018 at 05:30:00PM +0530, Chandni Cherukuri wrote:
>> On SGI platforms, the trusted firmware executes prior to the SEC
>> phase. It supplies to the SEC phase, a pointer to a HW CONFIG fdt
>> in the x1 which contains platform specific information such as part
>> number and config number of the SGI platform.
>>
>> The HW CONFIG FDT would look as,
>> /dts-v1/;
>> / {
>> /* compatible string */
>> compatible = "arm,sgi-isys3";
>>
>>   /* platform ID node */
>>   system-id {
>>platform-id = <0x03000783>;
>>   }
>> };
>>
>> In the very first step of the assembly code which executes in SEC phase
>> the fdt pointer is stored in a global variable from the register. A PPI
>> is created during the SEC phase which stores the global variable.
>>
>> During PEI phase, a Platform ID PEIM is installed which accessess the PPI
>> and retrieves the platform information using FDT helper functions and a
>> PlatformId HOB is created and populated with the information.
>>
>> During DXE phase the drivers can access the Platform ID HOB to get the
>> platform information and perform platform specific functions based on the
>> platform.
>
> It's helpful for subsequent revisions to keep a revision history in
> cover letter.
>
> Changes since v1:
> - ...
> - ...
> - ...
>
> Kept around and added to for subsequent revisions.
>
> However, you've addressed all of my comments on v1, so for my part -
> for the series:
> Reviewed-by: Leif Lindholm 
>
> But we want to hear back from Ard as well.
>
> /
> Leif

Thanks Leif for reviewing the patches. Have addressed the comments from Ard
and submitted v3 patchset and included "Changes since v1:" in the cover letter.

>
>> Chandni Cherukuri (2):
>>   Platform/ARM/Sgi: Install a Platform ID HOB
>>   Platform/ARM/Sgi: Pick ACPI tables to install based on platform ID
>>
>>  Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c |  33 +-
>>  Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf   |   2 +
>>  Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h   |  23 
>>  Platform/ARM/SgiPkg/Include/SgiPlatform.h |  13 +++
>>  Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S  |  13 ++-
>>  Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c |  10 ++
>>  Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf   |   3 +
>>  Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf |  40 +++
>>  Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c  | 112 
>> 
>>  Platform/ARM/SgiPkg/SgiPlatform.dec   |   5 +
>>  Platform/ARM/SgiPkg/SgiPlatform.dsc   |   1 +
>>  Platform/ARM/SgiPkg/SgiPlatform.fdf   |   1 +
>>  12 files changed, 247 insertions(+), 9 deletions(-)
>>  create mode 100644 Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h
>>  create mode 100644 
>> Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
>>  create mode 100644 
>> Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
>>
>> --
>> 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 v2 2/2] Platform/ARM/Sgi: Pick ACPI tables to install based on platform ID

2018-06-17 Thread chandni cherukuri
On Fri, Jun 15, 2018 at 6:35 PM, Ard Biesheuvel
 wrote:
> On 15 June 2018 at 14:00, Chandni Cherukuri  wrote:
>> Use the platform ID and config ID values from the platform ID
>> HOB to choose the right set of ACPI tables to be installed.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Chandni Cherukuri 
>> ---
>>  Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   | 33 
>> +---
>>  Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |  2 ++
>>  Platform/ARM/SgiPkg/SgiPlatform.dsc |  1 +
>>  Platform/ARM/SgiPkg/SgiPlatform.fdf |  1 +
>>  4 files changed, 32 insertions(+), 5 deletions(-)
>>
>> diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
>> b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
>> index edaae5b..f077a2c 100644
>> --- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
>> +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
>> @@ -14,6 +14,8 @@
>>
>>  #include 
>>  #include 
>> +#include 
>> +#include 
>>
>>  EFI_STATUS
>>  InitVirtioBlockIo (
>> @@ -28,20 +30,41 @@ ArmSgiPkgEntryPoint (
>>)
>>  {
>>EFI_STATUS  Status;
>> +  VOID*PlatformIdHob;
>> +  SGI_PLATFORM_DESCRIPTOR *HobData;
>> +  UINT32  ConfigId;
>> +  UINT32  PartNum;
>>
>> -  Status = LocateAndInstallAcpiFromFv ();
>> -  if (EFI_ERROR (Status)) {
>> -DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", 
>> __FUNCTION__));
>> -return Status;
>> +  PlatformIdHob = GetFirstGuidHob ();
>> +  if (PlatformIdHob == NULL) {
>> +DEBUG ((DEBUG_ERROR, "Platform ID HOB is NULL\n"));
>> +return EFI_INVALID_PARAMETER;
>> +  }
>> +
>> +  HobData = (SGI_PLATFORM_DESCRIPTOR *)(GET_GUID_HOB_DATA (PlatformIdHob));
>> +
>> +  PartNum = (HobData->PlatformId & SGI_PART_NUM_MASK);
>> +  ConfigId = ((HobData->PlatformId >> SGI_CONFIG_SHIFT) & SGI_CONFIG_MASK);
>> +
>> +  if ((PartNum == SGI575_PART_NUM) && (ConfigId == SGI575_CONF_NUM)) {
>> +Status = LocateAndInstallAcpiFromFv ();
>> +if (EFI_ERROR (Status)) {
>> +  DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", 
>> __FUNCTION__));
>> +  return Status;
>> +}
>> +  } else {
>> +DEBUG ((DEBUG_ERROR, "PlatformDxe: Unsupported Platform Id\n"));
>> +return EFI_UNSUPPORTED;
>>}
>>
>
>
>> -  Status = EFI_REQUEST_UNLOAD_IMAGE;
>>if (FeaturePcdGet (PcdVirtioSupported)) {
>>  Status = InitVirtioBlockIo (ImageHandle);
>>  if (EFI_ERROR (Status)) {
>>DEBUG ((DEBUG_ERROR, "%a: Failed to install Virtio Block device\n",
>>  __FUNCTION__));
>>  }
>> +  } else {
>> +Status = EFI_REQUEST_UNLOAD_IMAGE;
>>}
>>
>
> This is an unrelated (and unnecessary) change.

removed this unrelated change in v3 patchset
>
>
>>return Status;
>> diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
>> b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
>> index 51ad22f..b6b8209 100644
>> --- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
>> +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
>> @@ -30,10 +30,12 @@
>>
>>  [LibraryClasses]
>>AcpiLib
>> +  HobLib
>>UefiDriverEntryPoint
>>VirtioMmioDeviceLib
>>
>>  [Guids]
>> +  gArmSgiPlatformIdDescriptorGuid
>>gSgi575AcpiTablesiFileGuid
>>
>>  [FeaturePcd]
>> diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
>> b/Platform/ARM/SgiPkg/SgiPlatform.dsc
>> index a56175e..7b8e051 100644
>> --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
>> +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
>> @@ -199,6 +199,7 @@
>>  
>>
>> NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
>>}
>> +  Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
>>
>>#
>># DXE
>> diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf 
>> b/Platform/ARM/SgiPkg/SgiPlatform.fdf
>> index 17cdf48..0e5739e 100644
>> --- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
>> +++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
>> @@ -220,6 +220,7 @@ READ_LOCK_STATUS   = TRUE
>>INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
>>INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
>>INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
>> +  INF Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
>>
>>FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
>>  SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED 
>> = 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


[edk2] [PATCH edk2-platforms v3 1/2] Platform/ARM/Sgi: Install a Platform ID HOB

2018-06-17 Thread Chandni Cherukuri
On SGI platforms, the trusted firmware executes prior to
the SEC phase. It supplies to the SEC phase a pointer to
a fdt, that contains platform specific information such as
part number and config number of the SGI platform. The
platform code that executes during the SEC phase creates a
PPI that allows access to other PEIMs to obtain a copy of the
fdt pointer.

Further, during the PEI phase, a Platform ID PEIM installs a
Platform ID HOB. The Platform ID HOB can be used by DXE
drivers to identify the platform it is executing on.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h   |  23 
 Platform/ARM/SgiPkg/Include/SgiPlatform.h |  13 +++
 Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S  |  13 ++-
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c |  10 ++
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf   |   3 +
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf |  40 +++
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c  | 112 

 Platform/ARM/SgiPkg/SgiPlatform.dec   |   5 +
 8 files changed, 215 insertions(+), 4 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h 
b/Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h
new file mode 100644
index 000..dbc982d
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h
@@ -0,0 +1,23 @@
+/** @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_PLATFORMID_PPI_
+#define  SGI_PLATFORMID_PPI_
+
+//HwConfig DT structure
+typedef struct {
+  UINT64  HwConfigDtAddr;
+} SGI_HW_CONFIG_INFO_PPI;
+
+#endif
diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index 00ca7e9..1454018 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -68,4 +68,17 @@
 #define SGI_SYSPH_SYS_REG_FLASH   0x4C
 #define SGI_SYSPH_SYS_REG_FLASH_RWEN  0x1
 
+// SGI575_VERSION values
+#define SGI575_CONF_NUM   0x3
+#define SGI575_PART_NUM   0x783
+
+#define SGI_CONFIG_MASK   0x0F
+#define SGI_CONFIG_SHIFT  0x1C
+#define SGI_PART_NUM_MASK 0xFFF
+
+// ARM platform description data.
+typedef struct {
+  UINTN  PlatformId;
+} SGI_PLATFORM_DESCRIPTOR;
+
 #endif // __SGI_PLATFORM_H__
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S 
b/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
index dab6c77..3662266 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
@@ -22,15 +22,20 @@ GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
 GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
 GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
 GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
+GCC_ASM_IMPORT(HwConfigDtBlob)
 
 //
 // First platform specific function to be called in the PEI phase
 //
-// This function is actually the first function called by the PrePi
-// or PrePeiCore modules. It allows to retrieve arguments passed to
-// the UEFI firmware through the CPU registers.
-//
+// The trusted firmware passed the hw config DT blob in x1 register.
+// Keep a copy of it in a global variable.
+//VOID
+//ArmPlatformPeiBootAction (
+//  VOID
+//  );
 ASM_PFX(ArmPlatformPeiBootAction):
+  adr  x10, HwConfigDtBlob
+  str  x1, [x10]
   ret
 
 //UINTN
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c 
b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
index ea3201a..13bb423 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
@@ -15,6 +15,10 @@
 #include 
 #include 
 #include 
+#include 
+
+UINT64 HwConfigDtBlob;
+STATIC SGI_HW_CONFIG_INFO_PPI mHwConfigDtInfoPpi;
 
 STATIC ARM_CORE_INFO mCoreInfoTable[] = {
   {
@@ -36,6 +40,7 @@ ArmPlatformInitialize (
   IN  UINTN MpId
   )
 {
+  mHwConfigDtInfoPpi.HwConfigDtAddr = HwConfigDtBlob;
   return RETURN_SUCCESS;
 }
 
@@ -59,6 +64,11 @@ EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
 EFI_PEI_PPI_DESCRIPTOR_PPI,
 ,
 
+  },
+  {
+EFI_PEI_PPI_DESCRIPTOR_PPI,
+,
+
   }
 };
 
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf 
b/Platform/ARM/SgiP

[edk2] [PATCH edk2-platforms v3 2/2] Platform/ARM/Sgi: Pick ACPI tables to install based on platform ID

2018-06-17 Thread Chandni Cherukuri
Use the platform ID and config ID values from the platform ID
HOB to choose the right set of ACPI tables to be installed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   | 30 
+---
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |  2 ++
 Platform/ARM/SgiPkg/SgiPlatform.dsc |  1 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf |  1 +
 4 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index edaae5b..83adb63 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -14,6 +14,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 EFI_STATUS
 InitVirtioBlockIo (
@@ -28,11 +30,31 @@ ArmSgiPkgEntryPoint (
   )
 {
   EFI_STATUS  Status;
+  VOID*PlatformIdHob;
+  SGI_PLATFORM_DESCRIPTOR *HobData;
+  UINT32  ConfigId;
+  UINT32  PartNum;
 
-  Status = LocateAndInstallAcpiFromFv ();
-  if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__));
-return Status;
+  PlatformIdHob = GetFirstGuidHob ();
+  if (PlatformIdHob == NULL) {
+DEBUG ((DEBUG_ERROR, "Platform ID HOB is NULL\n"));
+return EFI_INVALID_PARAMETER;
+  }
+
+  HobData = (SGI_PLATFORM_DESCRIPTOR *)(GET_GUID_HOB_DATA (PlatformIdHob));
+
+  PartNum = (HobData->PlatformId & SGI_PART_NUM_MASK);
+  ConfigId = ((HobData->PlatformId >> SGI_CONFIG_SHIFT) & SGI_CONFIG_MASK);
+
+  if ((PartNum == SGI575_PART_NUM) && (ConfigId == SGI575_CONF_NUM)) {
+Status = LocateAndInstallAcpiFromFv ();
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", 
__FUNCTION__));
+  return Status;
+}
+  } else {
+DEBUG ((DEBUG_ERROR, "PlatformDxe: Unsupported Platform Id\n"));
+return EFI_UNSUPPORTED;
   }
 
   Status = EFI_REQUEST_UNLOAD_IMAGE;
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
index 51ad22f..b6b8209 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -30,10 +30,12 @@
 
 [LibraryClasses]
   AcpiLib
+  HobLib
   UefiDriverEntryPoint
   VirtioMmioDeviceLib
 
 [Guids]
+  gArmSgiPlatformIdDescriptorGuid
   gSgi575AcpiTablesiFileGuid
 
 [FeaturePcd]
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
b/Platform/ARM/SgiPkg/SgiPlatform.dsc
index a56175e..7b8e051 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -199,6 +199,7 @@
 
   
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
   }
+  Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
 
   #
   # DXE
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf 
b/Platform/ARM/SgiPkg/SgiPlatform.fdf
index 17cdf48..0e5739e 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
+++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
@@ -220,6 +220,7 @@ READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
   INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
   INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
+  INF Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
 
   FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
 SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = 
TRUE {
-- 
2.7.4

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


Re: [edk2] [PATCH 1/2] Platform/ARM/Sgi: Install a Platform ID HOB

2018-06-15 Thread chandni cherukuri
On Fri, Jun 15, 2018 at 3:48 PM, Leif Lindholm  wrote:
>
> Just some minor formatting points in addition to the comment on Ard's
> reply..
>
> On Fri, Jun 15, 2018 at 11:25:31AM +0530, Chandni Cherukuri wrote:
> > On SGI platforms, the trusted firmware executes prior to
> > the SEC phase. It supplies to the SEC phase a pointer to
> > a fdt, that contains platform specific information such as
> > part number and config number of the SGI platform. The
> > platform code that executes during the SEC phase creates a
> > PPI that allows access to other PEIMs to obtain a copy of the
> > fdt pointer.
> >
> > Further, during the PEI phase, a Platform ID PEIM installs a
> > Platform ID HOB. The Platform ID HOB can be used by DXE
> > drivers to identify the platform it is executing on.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Chandni Cherukuri 
> > ---
> >  .../SgiPkg/Library/PlatformLib/AArch64/Helper.S|  15 ++-
> >  .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.c   |  10 ++
> >  .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf |   3 +
> >  .../Library/SgiPlatformPeiLib/SgiPlatformPeiLib.c  | 108 
> > +
> >  .../SgiPlatformPeiLib/SgiPlatformPeiLib.inf|  40 
> >  Platform/ARM/SgiPkg/SgiPlatform.dec|   5 +
> >  6 files changed, 177 insertions(+), 4 deletions(-)
> >  create mode 100644 
> > Platform/ARM/SgiPkg/Library/SgiPlatformPeiLib/SgiPlatformPeiLib.c
> >  create mode 100644 
> > Platform/ARM/SgiPkg/Library/SgiPlatformPeiLib/SgiPlatformPeiLib.inf
> >
> > diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S 
> > b/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
> > index dab6c77..80b93ea 100644
> > --- a/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
> > +++ b/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
> > @@ -22,15 +22,22 @@ GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
> >  GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
> >  GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
> >  GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
> > +GCC_ASM_EXPORT(HwConfigDtBlob)
> > +
> > +HwConfigDtBlob: .long 0
> >
> >  //
> >  // First platform specific function to be called in the PEI phase
> >  //
> > -// This function is actually the first function called by the PrePi
> > -// or PrePeiCore modules. It allows to retrieve arguments passed to
> > -// the UEFI firmware through the CPU registers.
> > -//
> > +// The trusted firmware passed the hw config DT blob in x1 register.
> > +// Keep a copy of it in a global variable.
> > +//VOID
> > +//ArmPlatformPeiBootAction (
> > +//  VOID
> > +//  );
> >  ASM_PFX(ArmPlatformPeiBootAction):
> > +  ldr  x10, =HwConfigDtBlob
> > +  str  x1, [x10]
> >ret
> >
> >  //UINTN
> > diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c 
> > b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
> > index ea3201a..54860e0 100644
> > --- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
> > +++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
> > @@ -15,6 +15,10 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> > +
> > +extern UINT64 HwConfigDtBlob;
> > +STATIC SGI_HW_CONFIG_INFO_PPI mHwConfigDtInfoPpi;
> >
> >  STATIC ARM_CORE_INFO mCoreInfoTable[] = {
> >{
> > @@ -36,6 +40,7 @@ ArmPlatformInitialize (
> >IN  UINTN MpId
> >)
> >  {
> > +  mHwConfigDtInfoPpi.HwConfigDtAddr = 
> >return RETURN_SUCCESS;
> >  }
> >
> > @@ -59,6 +64,11 @@ EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
> >  EFI_PEI_PPI_DESCRIPTOR_PPI,
> >  ,
> >  
> > +  },
> > +  {
> > +EFI_PEI_PPI_DESCRIPTOR_PPI,
> > +,
> > +
> >}
> >  };
> >
> > diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf 
> > b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
> > index 42e14d5..5d4bf72 100644
> > --- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
> > +++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
> > @@ -61,7 +61,10 @@
> >gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
> >
> >  [Guids]
> > +  gArmSgiPlatformIdDescriptorGuid
> >gEfiHobListGuid  ## CONSUMES  ## SystemTable
> > +  gFdtTableGuid
> >
> >  [Ppis]
> >gArmMpCoreInfoPpiGuid
> > +  gHwConfigDtInfoPpiGuid

[edk2] [PATCH edk2-platforms v2 2/2] Platform/ARM/Sgi: Pick ACPI tables to install based on platform ID

2018-06-15 Thread Chandni Cherukuri
Use the platform ID and config ID values from the platform ID
HOB to choose the right set of ACPI tables to be installed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   | 33 
+---
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |  2 ++
 Platform/ARM/SgiPkg/SgiPlatform.dsc |  1 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf |  1 +
 4 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index edaae5b..f077a2c 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -14,6 +14,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 EFI_STATUS
 InitVirtioBlockIo (
@@ -28,20 +30,41 @@ ArmSgiPkgEntryPoint (
   )
 {
   EFI_STATUS  Status;
+  VOID*PlatformIdHob;
+  SGI_PLATFORM_DESCRIPTOR *HobData;
+  UINT32  ConfigId;
+  UINT32  PartNum;
 
-  Status = LocateAndInstallAcpiFromFv ();
-  if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__));
-return Status;
+  PlatformIdHob = GetFirstGuidHob ();
+  if (PlatformIdHob == NULL) {
+DEBUG ((DEBUG_ERROR, "Platform ID HOB is NULL\n"));
+return EFI_INVALID_PARAMETER;
+  }
+
+  HobData = (SGI_PLATFORM_DESCRIPTOR *)(GET_GUID_HOB_DATA (PlatformIdHob));
+
+  PartNum = (HobData->PlatformId & SGI_PART_NUM_MASK);
+  ConfigId = ((HobData->PlatformId >> SGI_CONFIG_SHIFT) & SGI_CONFIG_MASK);
+
+  if ((PartNum == SGI575_PART_NUM) && (ConfigId == SGI575_CONF_NUM)) {
+Status = LocateAndInstallAcpiFromFv ();
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", 
__FUNCTION__));
+  return Status;
+}
+  } else {
+DEBUG ((DEBUG_ERROR, "PlatformDxe: Unsupported Platform Id\n"));
+return EFI_UNSUPPORTED;
   }
 
-  Status = EFI_REQUEST_UNLOAD_IMAGE;
   if (FeaturePcdGet (PcdVirtioSupported)) {
 Status = InitVirtioBlockIo (ImageHandle);
 if (EFI_ERROR (Status)) {
   DEBUG ((DEBUG_ERROR, "%a: Failed to install Virtio Block device\n",
 __FUNCTION__));
 }
+  } else {
+Status = EFI_REQUEST_UNLOAD_IMAGE;
   }
 
   return Status;
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
index 51ad22f..b6b8209 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -30,10 +30,12 @@
 
 [LibraryClasses]
   AcpiLib
+  HobLib
   UefiDriverEntryPoint
   VirtioMmioDeviceLib
 
 [Guids]
+  gArmSgiPlatformIdDescriptorGuid
   gSgi575AcpiTablesiFileGuid
 
 [FeaturePcd]
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
b/Platform/ARM/SgiPkg/SgiPlatform.dsc
index a56175e..7b8e051 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -199,6 +199,7 @@
 
   
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
   }
+  Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
 
   #
   # DXE
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf 
b/Platform/ARM/SgiPkg/SgiPlatform.fdf
index 17cdf48..0e5739e 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
+++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
@@ -220,6 +220,7 @@ READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
   INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
   INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
+  INF Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
 
   FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
 SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = 
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 v2 0/2] ARM Dynamic Configuration

2018-06-15 Thread Chandni Cherukuri
On SGI platforms, the trusted firmware executes prior to the SEC
phase. It supplies to the SEC phase, a pointer to a HW CONFIG fdt
in the x1 which contains platform specific information such as part
number and config number of the SGI platform. 

The HW CONFIG FDT would look as,
/dts-v1/;
/ {
/* compatible string */
compatible = "arm,sgi-isys3";

/* platform ID node */
system-id {
 platform-id = <0x03000783>;
}
};

In the very first step of the assembly code which executes in SEC phase
the fdt pointer is stored in a global variable from the register. A PPI 
is created during the SEC phase which stores the global variable.

During PEI phase, a Platform ID PEIM is installed which accessess the PPI
and retrieves the platform information using FDT helper functions and a
PlatformId HOB is created and populated with the information.
 
During DXE phase the drivers can access the Platform ID HOB to get the
platform information and perform platform specific functions based on the
platform.

Chandni Cherukuri (2):
  Platform/ARM/Sgi: Install a Platform ID HOB
  Platform/ARM/Sgi: Pick ACPI tables to install based on platform ID

 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c |  33 +-
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf   |   2 +
 Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h   |  23 
 Platform/ARM/SgiPkg/Include/SgiPlatform.h |  13 +++
 Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S  |  13 ++-
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c |  10 ++
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf   |   3 +
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf |  40 +++
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c  | 112 

 Platform/ARM/SgiPkg/SgiPlatform.dec   |   5 +
 Platform/ARM/SgiPkg/SgiPlatform.dsc   |   1 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf   |   1 +
 12 files changed, 247 insertions(+), 9 deletions(-)
 create mode 100644 Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h
 create mode 100644 
Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
 create mode 100644 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c

-- 
2.7.4


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


[edk2] [PATCH edk2-platforms v2 1/2] Platform/ARM/Sgi: Install a Platform ID HOB

2018-06-15 Thread Chandni Cherukuri
On SGI platforms, the trusted firmware executes prior to
the SEC phase. It supplies to the SEC phase a pointer to
a fdt, that contains platform specific information such as
part number and config number of the SGI platform. The
platform code that executes during the SEC phase creates a
PPI that allows access to other PEIMs to obtain a copy of the
fdt pointer.

Further, during the PEI phase, a Platform ID PEIM installs a
Platform ID HOB. The Platform ID HOB can be used by DXE
drivers to identify the platform it is executing on.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h   |  23 
 Platform/ARM/SgiPkg/Include/SgiPlatform.h |  13 +++
 Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S  |  13 ++-
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c |  10 ++
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf   |   3 +
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf |  40 +++
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c  | 112 

 Platform/ARM/SgiPkg/SgiPlatform.dec   |   5 +
 8 files changed, 215 insertions(+), 4 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h 
b/Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h
new file mode 100644
index 000..5ffc69d
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Include/Ppi/SgiPlatformId.h
@@ -0,0 +1,23 @@
+/** @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_PLATFORMID_PPI_
+#define  SGI_PLATFORMID_PPI_
+
+//HwConfig DT structure
+typedef struct {
+  UINT64  *HwConfigDtAddr;
+} SGI_HW_CONFIG_INFO_PPI;
+
+#endif
diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index 00ca7e9..1454018 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -68,4 +68,17 @@
 #define SGI_SYSPH_SYS_REG_FLASH   0x4C
 #define SGI_SYSPH_SYS_REG_FLASH_RWEN  0x1
 
+// SGI575_VERSION values
+#define SGI575_CONF_NUM   0x3
+#define SGI575_PART_NUM   0x783
+
+#define SGI_CONFIG_MASK   0x0F
+#define SGI_CONFIG_SHIFT  0x1C
+#define SGI_PART_NUM_MASK 0xFFF
+
+// ARM platform description data.
+typedef struct {
+  UINTN  PlatformId;
+} SGI_PLATFORM_DESCRIPTOR;
+
 #endif // __SGI_PLATFORM_H__
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S 
b/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
index dab6c77..3662266 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
@@ -22,15 +22,20 @@ GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
 GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
 GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
 GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
+GCC_ASM_IMPORT(HwConfigDtBlob)
 
 //
 // First platform specific function to be called in the PEI phase
 //
-// This function is actually the first function called by the PrePi
-// or PrePeiCore modules. It allows to retrieve arguments passed to
-// the UEFI firmware through the CPU registers.
-//
+// The trusted firmware passed the hw config DT blob in x1 register.
+// Keep a copy of it in a global variable.
+//VOID
+//ArmPlatformPeiBootAction (
+//  VOID
+//  );
 ASM_PFX(ArmPlatformPeiBootAction):
+  adr  x10, HwConfigDtBlob
+  str  x1, [x10]
   ret
 
 //UINTN
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c 
b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
index ea3201a..c9ddbfb 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
@@ -15,6 +15,10 @@
 #include 
 #include 
 #include 
+#include 
+
+UINT64 HwConfigDtBlob;
+STATIC SGI_HW_CONFIG_INFO_PPI mHwConfigDtInfoPpi;
 
 STATIC ARM_CORE_INFO mCoreInfoTable[] = {
   {
@@ -36,6 +40,7 @@ ArmPlatformInitialize (
   IN  UINTN MpId
   )
 {
+  mHwConfigDtInfoPpi.HwConfigDtAddr = 
   return RETURN_SUCCESS;
 }
 
@@ -59,6 +64,11 @@ EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
 EFI_PEI_PPI_DESCRIPTOR_PPI,
 ,
 
+  },
+  {
+EFI_PEI_PPI_DESCRIPTOR_PPI,
+,
+
   }
 };
 
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf 
b/Platform/ARM/SgiPkg/Library/P

[edk2] [PATCH 0/2] ARM Dynamic Configuration

2018-06-14 Thread Chandni Cherukuri
On SGI platforms, the trusted firmware executes prior to the SEC
phase. It supplies to the SEC phase a pointer to a HW CONFIG fdt
in the x1 which contains platform specific information such as part
number and config number of the SGI platform. 

The HW CONFIG FDT would look as,
/dts-v1/;
/ {
/* compatible string */
compatible = "arm,sgi-isys3";

/* platform ID node */
system-id {
 platform-id = <0x03000783>;
}
};

In the very first step of the assembly code which executes in SEC phase
the fdt pointer is stored in a global variable from the register. A PPI 
is created during the SEC phase which stores the global variable.

During PEI phase, a Platform ID PEIM is installed which accessess the PPI
and retrieves the platform information using FDT helper functions and a
PlatformId HOB is created and populated with the information.
 
During DXE phase the drivers can access the Platform ID HOB to get the
platform information and perform platform specific functions based on the
platform.

Chandni Cherukuri (2):
  Platform/ARM/Sgi: Install a Platform ID HOB
  Platform/ARM/Sgi: Pick ACPI tables to install based on platform ID

 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   | 25 +-
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |  2 +
 Platform/ARM/SgiPkg/Include/SgiPlatform.h  | 18 +
 .../SgiPkg/Library/PlatformLib/AArch64/Helper.S|  7 ++
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.c   | 10 +++
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf |  3 +
 .../Library/SgiPlatformPeiLib/SgiPlatformPeiLib.c  | 92 ++
 .../SgiPlatformPeiLib/SgiPlatformPeiLib.inf| 40 ++
 Platform/ARM/SgiPkg/SgiPlatform.dec|  5 ++
 Platform/ARM/SgiPkg/SgiPlatform.dsc|  1 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf|  1 +
 11 files changed, 203 insertions(+), 1 deletion(-)
 create mode 100644 
Platform/ARM/SgiPkg/Library/SgiPlatformPeiLib/SgiPlatformPeiLib.c
 create mode 100644 
Platform/ARM/SgiPkg/Library/SgiPlatformPeiLib/SgiPlatformPeiLib.inf

-- 
2.7.4

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


[edk2] [PATCH 2/2] Platform/ARM/Sgi: Pick ACPI tables to install based on platform ID

2018-06-14 Thread Chandni Cherukuri
Use the platform ID and config ID values from the platform ID
HOB to choose the right set of ACPI tables to be installed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   | 33 ++
 .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |  2 ++
 Platform/ARM/SgiPkg/Include/SgiPlatform.h  | 24 ++--
 Platform/ARM/SgiPkg/SgiPlatform.dsc|  1 +
 Platform/ARM/SgiPkg/SgiPlatform.fdf|  1 +
 5 files changed, 53 insertions(+), 8 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index edaae5b..d0d5808 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -14,6 +14,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 EFI_STATUS
 InitVirtioBlockIo (
@@ -28,20 +30,41 @@ ArmSgiPkgEntryPoint (
   )
 {
   EFI_STATUS  Status;
+  VOID*PlatformIdHob;
+  SGI_PLATFORM_DESCRIPTOR *HobData;
+  UINT32  ConfigId;
+  UINT32  PartNum;
 
-  Status = LocateAndInstallAcpiFromFv ();
-  if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__));
-return Status;
+  PlatformIdHob = GetFirstGuidHob ();
+  if (PlatformIdHob == NULL) {
+DEBUG ((DEBUG_ERROR, "Platform ID Hob is NULL\n"));
+return EFI_INVALID_PARAMETER;
+  }
+
+  HobData = (SGI_PLATFORM_DESCRIPTOR *)(GET_GUID_HOB_DATA (PlatformIdHob));
+
+  PartNum = (HobData->PlatformId & SGI_PART_NUM_MASK);
+  ConfigId = ((HobData->PlatformId >> SGI_CONFIG_SHIFT) & SGI_CONFIG_MASK);
+
+  if ((PartNum == SGI575_PART_NUM) && (ConfigId == SGI575_CONF_NUM)) {
+Status = LocateAndInstallAcpiFromFv ();
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", 
__FUNCTION__));
+  return Status;
+}
+  } else {
+DEBUG ((DEBUG_ERROR, "PlatformDxe: Unsupported Platform Id\n"));
+return EFI_UNSUPPORTED;
   }
 
-  Status = EFI_REQUEST_UNLOAD_IMAGE;
   if (FeaturePcdGet (PcdVirtioSupported)) {
 Status = InitVirtioBlockIo (ImageHandle);
 if (EFI_ERROR (Status)) {
   DEBUG ((DEBUG_ERROR, "%a: Failed to install Virtio Block device\n",
 __FUNCTION__));
 }
+  } else {
+Status = EFI_REQUEST_UNLOAD_IMAGE;
   }
 
   return Status;
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
index 51ad22f..b6b8209 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -30,10 +30,12 @@
 
 [LibraryClasses]
   AcpiLib
+  HobLib
   UefiDriverEntryPoint
   VirtioMmioDeviceLib
 
 [Guids]
+  gArmSgiPlatformIdDescriptorGuid
   gSgi575AcpiTablesiFileGuid
 
 [FeaturePcd]
diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h 
b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index 00ca7e9..756954c 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -12,8 +12,8 @@
 *
 **/
 
-#ifndef __SGI_PLATFORM_H__
-#define __SGI_PLATFORM_H__
+#ifndef SGI_PLATFORM_H_
+#define SGI_PLATFORM_H_
 
 
/***
 // Platform Memory Map
@@ -68,4 +68,22 @@
 #define SGI_SYSPH_SYS_REG_FLASH   0x4C
 #define SGI_SYSPH_SYS_REG_FLASH_RWEN  0x1
 
-#endif // __SGI_PLATFORM_H__
+// SGI575_VERSION values
+#define SGI575_CONF_NUM   0x3
+#define SGI575_PART_NUM   0x783
+
+#define SGI_CONFIG_MASK   0x0F
+#define SGI_CONFIG_SHIFT  0x1C
+#define SGI_PART_NUM_MASK 0xFFF
+
+//HwConfig DT structure^M
+typedef struct {
+  UINT64  *HwConfigDtAddr;
+} SGI_HW_CONFIG_INFO_PPI;
+
+// ARM platform description data.
+typedef struct {
+  UINTN  PlatformId;
+} SGI_PLATFORM_DESCRIPTOR;
+
+#endif // SGI_PLATFORM_H_
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc 
b/Platform/ARM/SgiPkg/SgiPlatform.dsc
index a56175e..f571897 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -199,6 +199,7 @@
 
   
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
   }
+  Platform/ARM/SgiPkg/Library/SgiPlatformPeiLib/SgiPlatformPeiLib.inf
 
   #
   # DXE
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf 
b/Platform/ARM/SgiPkg/SgiPlatform.fdf
index 17cdf48..05203a8 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
+++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
@@ -220,6 +220,7 @@ READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
   INF Mde

[edk2] [PATCH 1/2] Platform/ARM/Sgi: Install a Platform ID HOB

2018-06-14 Thread Chandni Cherukuri
On SGI platforms, the trusted firmware executes prior to
the SEC phase. It supplies to the SEC phase a pointer to
a fdt, that contains platform specific information such as
part number and config number of the SGI platform. The
platform code that executes during the SEC phase creates a
PPI that allows access to other PEIMs to obtain a copy of the
fdt pointer.

Further, during the PEI phase, a Platform ID PEIM installs a
Platform ID HOB. The Platform ID HOB can be used by DXE
drivers to identify the platform it is executing on.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri 
---
 .../SgiPkg/Library/PlatformLib/AArch64/Helper.S|  15 ++-
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.c   |  10 ++
 .../ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf |   3 +
 .../Library/SgiPlatformPeiLib/SgiPlatformPeiLib.c  | 108 +
 .../SgiPlatformPeiLib/SgiPlatformPeiLib.inf|  40 
 Platform/ARM/SgiPkg/SgiPlatform.dec|   5 +
 6 files changed, 177 insertions(+), 4 deletions(-)
 create mode 100644 
Platform/ARM/SgiPkg/Library/SgiPlatformPeiLib/SgiPlatformPeiLib.c
 create mode 100644 
Platform/ARM/SgiPkg/Library/SgiPlatformPeiLib/SgiPlatformPeiLib.inf

diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S 
b/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
index dab6c77..80b93ea 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/AArch64/Helper.S
@@ -22,15 +22,22 @@ GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
 GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
 GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
 GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
+GCC_ASM_EXPORT(HwConfigDtBlob)
+
+HwConfigDtBlob: .long 0
 
 //
 // First platform specific function to be called in the PEI phase
 //
-// This function is actually the first function called by the PrePi
-// or PrePeiCore modules. It allows to retrieve arguments passed to
-// the UEFI firmware through the CPU registers.
-//
+// The trusted firmware passed the hw config DT blob in x1 register.
+// Keep a copy of it in a global variable.
+//VOID
+//ArmPlatformPeiBootAction (
+//  VOID
+//  );
 ASM_PFX(ArmPlatformPeiBootAction):
+  ldr  x10, =HwConfigDtBlob
+  str  x1, [x10]
   ret
 
 //UINTN
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c 
b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
index ea3201a..54860e0 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c
@@ -15,6 +15,10 @@
 #include 
 #include 
 #include 
+#include 
+
+extern UINT64 HwConfigDtBlob;
+STATIC SGI_HW_CONFIG_INFO_PPI mHwConfigDtInfoPpi;
 
 STATIC ARM_CORE_INFO mCoreInfoTable[] = {
   {
@@ -36,6 +40,7 @@ ArmPlatformInitialize (
   IN  UINTN MpId
   )
 {
+  mHwConfigDtInfoPpi.HwConfigDtAddr = 
   return RETURN_SUCCESS;
 }
 
@@ -59,6 +64,11 @@ EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
 EFI_PEI_PPI_DESCRIPTOR_PPI,
 ,
 
+  },
+  {
+EFI_PEI_PPI_DESCRIPTOR_PPI,
+,
+
   }
 };
 
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf 
b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
index 42e14d5..5d4bf72 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
@@ -61,7 +61,10 @@
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
 
 [Guids]
+  gArmSgiPlatformIdDescriptorGuid
   gEfiHobListGuid  ## CONSUMES  ## SystemTable
+  gFdtTableGuid
 
 [Ppis]
   gArmMpCoreInfoPpiGuid
+  gHwConfigDtInfoPpiGuid
diff --git a/Platform/ARM/SgiPkg/Library/SgiPlatformPeiLib/SgiPlatformPeiLib.c 
b/Platform/ARM/SgiPkg/Library/SgiPlatformPeiLib/SgiPlatformPeiLib.c
new file mode 100644
index 000..f6446e6
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Library/SgiPlatformPeiLib/SgiPlatformPeiLib.c
@@ -0,0 +1,108 @@
+/** @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 
+#include 
+#include 
+#include 
+#include 
+
+/**
+
+  This function returns the Platform ID of the platform
+
+  This functions locates the HwConfig PPI and gets the base address of HW 
CONFIG
+  DT from which the platform ID is obtained using FDT helper functions
+
+  @return returns the platform ID on success else returns 0 on error
+
+**/
+
+STATIC
+UINT32
+GetSgiPlatformId (
+ VOID
+)
+{
+  CONST UINT32  *Property;
+  INT32 Offset