]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/ArmVExpressPkg: Added support to differentiate ARMv8 FVP variants
authorOlivier Martin <olivier.martin@arm.com>
Wed, 25 Feb 2015 19:15:39 +0000 (19:15 +0000)
committeroliviermartin <oliviermartin@Edk2>
Wed, 25 Feb 2015 19:15:39 +0000 (19:15 +0000)
There are three FVP variants for the Base and Foundation models:
- model with GICv2 legacy memory map (same location as the Versatile Express model)
- model with GICv2 and Base model memory map
- model with GICv3 and Base model memory map

The new code detects the variants to load the appropriate device tree.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16932 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/AArch64/ArmFvpDxeAArch64.c
ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf
ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmVExpressInternal.h
ArmPlatformPkg/ArmVExpressPkg/Include/VExpressMotherBoard.h
ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c

index 2c7c5fa5ccc8a6d01d2172b9b4c56672185d85cb..41d94eda1dc758df059324ce136ad586baef0293 100644 (file)
 **/\r
 \r
 #include "ArmVExpressInternal.h"\r
+#include <Library/ArmGicLib.h>\r
 \r
 //\r
-// Description of the two AARCH64 model platforms :\r
+// Description of the AARCH64 model platforms :\r
 // just the platform id for the time being.\r
 // Platform ids are defined in ArmVExpressInternal.h for\r
 // all "ArmVExpress-like" platforms (AARCH64 or ARM architecture,\r
 //\r
 CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[] = {\r
   { ARM_FVP_VEXPRESS_AEMv8x4 },\r
-  { ARM_FVP_BASE_AEMv8x4_AEMv8x4 },\r
-  { ARM_FVP_FOUNDATION },\r
+  { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2 },\r
+  { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY },\r
+  { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3 },\r
+  { ARM_FVP_FOUNDATION_GICV2 },\r
+  { ARM_FVP_FOUNDATION_GICV2_LEGACY },\r
+  { ARM_FVP_FOUNDATION_GICV3 },\r
   { ARM_FVP_VEXPRESS_UNKNOWN }\r
 };\r
 \r
@@ -47,6 +52,9 @@ ArmVExpressGetPlatform (
 {\r
   EFI_STATUS            Status;\r
   UINT32                SysId;\r
+  UINT32                FvpSysId;\r
+  UINT32                VariantSysId;\r
+  ARM_GIC_ARCH_REVISION GicRevision;\r
 \r
   ASSERT (Platform != NULL);\r
 \r
@@ -54,15 +62,46 @@ ArmVExpressGetPlatform (
 \r
   SysId = MmioRead32 (ARM_VE_SYS_ID_REG);\r
   if (SysId != ARM_RTSM_SYS_ID) {\r
-    // Take out the FVP GIC variant to reduce the permutations. The GIC driver\r
-    // detects the version and does the right thing.\r
-    SysId &= ~ARM_FVP_SYS_ID_VARIANT_MASK;\r
-    if (SysId == (ARM_FVP_BASE_SYS_ID & ~ARM_FVP_SYS_ID_VARIANT_MASK)) {\r
-      Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4, Platform);\r
-    } else if (SysId == (ARM_FVP_FOUNDATION_SYS_ID & ~ARM_FVP_SYS_ID_VARIANT_MASK)) {\r
-      Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION, Platform);\r
+    // Remove the GIC variant to identify if we are running on the FVP Base or\r
+    // Foundation models\r
+    FvpSysId     = SysId & (ARM_FVP_SYS_ID_HBI_MASK |\r
+                            ARM_FVP_SYS_ID_PLAT_MASK );\r
+    // Extract the variant from the SysId\r
+    VariantSysId = SysId & ARM_FVP_SYS_ID_VARIANT_MASK;\r
+\r
+    if (FvpSysId == ARM_FVP_BASE_BOARD_SYS_ID) {\r
+      if (VariantSysId == ARM_FVP_GIC_VE_MMAP) {\r
+        // FVP Base Model with legacy GIC memory map\r
+        Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY, Platform);\r
+      } else {\r
+        GicRevision = ArmGicGetSupportedArchRevision ();\r
+\r
+        if (GicRevision == ARM_GIC_ARCH_REVISION_2) {\r
+          // FVP Base Model with GICv2 support\r
+          Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2, Platform);\r
+        } else {\r
+          // FVP Base Model with GICv3 support\r
+          Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3, Platform);\r
+        }\r
+      }\r
+    } else if (FvpSysId == ARM_FVP_FOUNDATION_BOARD_SYS_ID) {\r
+      if (VariantSysId == ARM_FVP_GIC_VE_MMAP) {\r
+        // FVP Foundation Model with legacy GIC memory map\r
+        Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV2_LEGACY, Platform);\r
+      } else {\r
+        GicRevision = ArmGicGetSupportedArchRevision ();\r
+\r
+        if (GicRevision == ARM_GIC_ARCH_REVISION_2) {\r
+          // FVP Foundation Model with GICv2\r
+          Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV2, Platform);\r
+        } else {\r
+          // FVP Foundation Model with GICv3\r
+          Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV3, Platform);\r
+        }\r
+      }\r
     }\r
   } else {\r
+    // FVP Versatile Express AEMv8\r
     Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_AEMv8x4, Platform);\r
   }\r
 \r
index 8a096baae28301e1ac5e635b3fd7987a1a56ba29..a69601ba122d71392bf891aa16480c8651ac08ed 100644 (file)
@@ -1,6 +1,6 @@
 #/** @file\r
 #\r
-#  Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>\r
+#  Copyright (c) 2013-2015, ARM Ltd. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -45,3 +45,6 @@
   UefiDriverEntryPoint\r
   UefiBootServicesTableLib\r
   VirtioMmioDeviceLib\r
+\r
+[LibraryClasses.AARCH64]\r
+  ArmGicLib\r
index 2e9335047afaadc5aae838546ce30e76669fa8f7..075ced8e89d530d1de7cd894c15044fdd61ce0d7 100644 (file)
@@ -36,8 +36,12 @@ typedef enum {
   ARM_FVP_VEXPRESS_A15x1_A7x1,\r
   ARM_FVP_VEXPRESS_A15x4_A7x4,\r
   ARM_FVP_VEXPRESS_AEMv8x4,\r
-  ARM_FVP_BASE_AEMv8x4_AEMv8x4,\r
-  ARM_FVP_FOUNDATION,\r
+  ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2,\r
+  ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY,\r
+  ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3,\r
+  ARM_FVP_FOUNDATION_GICV2,\r
+  ARM_FVP_FOUNDATION_GICV2_LEGACY,\r
+  ARM_FVP_FOUNDATION_GICV3,\r
   ARM_HW_A9x4,\r
   ARM_HW_A15x2_A7x3,\r
   ARM_HW_A15,\r
index dd16b9368ac870531ee05ec0bbc52a7e084dfba5..38691c35828b16637f0fc111879c2fe00b129685 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 *  Header defining Versatile Express constants (Base addresses, sizes, flags)\r
 *\r
-*  Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2011-2015, ARM Limited. All rights reserved.\r
 *\r
 *  This program and the accompanying materials\r
 *  are licensed and made available under the terms and conditions of the BSD License\r
 //GICH          0x2c004000              0x2c010000\r
 //GICV          0x2c006000              0x2c020000\r
 \r
+#define ARM_FVP_BASE_BOARD_SYS_ID       (0x00200100)\r
+#define ARM_FVP_FOUNDATION_BOARD_SYS_ID (0x00100100)\r
+\r
+#define ARM_FVP_SYS_ID_REV_MASK        (UINT32)(0xFUL   << 28)\r
+#define ARM_FVP_SYS_ID_HBI_MASK        (UINT32)(0xFFFUL << 16)\r
+#define ARM_FVP_SYS_ID_VARIANT_MASK    (UINT32)(0xFUL   << 12)\r
+#define ARM_FVP_SYS_ID_PLAT_MASK       (UINT32)(0xFUL   << 8 )\r
+#define ARM_FVP_SYS_ID_FPGA_MASK       (UINT32)(0xFFUL  << 0 )\r
+#define ARM_FVP_GIC_VE_MMAP            0x0\r
+#define ARM_FVP_GIC_BASE_MMAP          (UINT32)(1 << 12)\r
+\r
 // The default SYS_IDs. These can be changed when starting the model.\r
 #define ARM_RTSM_SYS_ID                (0x225F500)\r
-#define ARM_FVP_BASE_SYS_ID            (0x00201100)\r
-#define ARM_FVP_FOUNDATION_SYS_ID      (0x00101100)\r
-\r
-#define ARM_FVP_SYS_ID_VARIANT_MASK    (UINT32)(0xFUL << 12)\r
+#define ARM_FVP_BASE_SYS_ID            (ARM_FVP_BASE_BOARD_SYS_ID | ARM_FVP_GIC_BASE_MMAP)\r
+#define ARM_FVP_FOUNDATION_SYS_ID      (ARM_FVP_FOUNDATION_BOARD_SYS_ID | ARM_FVP_GIC_BASE_MMAP)\r
 \r
 #endif /* VEXPRESSMOTHERBOARD_H_ */\r
index c6b37fca0153d920892bf71d5f7611aac39c6156..2000c9bdf4369689cea6623dd7b410221af37c35 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2011-2013, ARM Ltd. All rights reserved.<BR>\r
+  Copyright (c) 2011-2015, ARM Ltd. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -269,7 +269,7 @@ LcdPlatformSetMode (
   if (SysId != ARM_RTSM_SYS_ID) {\r
     // Take out the FVP GIC variant to reduce the permutations.\r
     SysId &= ~ARM_FVP_SYS_ID_VARIANT_MASK;\r
-    if (SysId != (ARM_FVP_BASE_SYS_ID & ~ARM_FVP_SYS_ID_VARIANT_MASK)) {\r
+    if (SysId != ARM_FVP_BASE_BOARD_SYS_ID) {\r
       // Set the DVI into the new mode\r
       Status = ArmPlatformSysConfigSet (SYS_CFG_DVIMODE, mResolutions[ModeNumber].Mode);\r
       if (EFI_ERROR(Status)) {\r