]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/BdsLib: Removed PSCI discoverability from the Linux loader
authorOlivier Martin <olivier.martin@arm.com>
Tue, 15 Jul 2014 09:21:41 +0000 (09:21 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 15 Jul 2014 09:21:41 +0000 (09:21 +0000)
Some platforms might decide to not support PSCI in their FDT-aware Linux
system even if their firmware supports it.
It is the responsibility of the platform engineer to provide the appropriate FDT.

The PCD gArmTokenSpaceGuid.PcdArmPsciSupport is not required anymore.

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@15658 6f19259b-4bc3-4df7-8a09-765794883524

ArmPkg/ArmPkg.dec
ArmPkg/Library/BdsLib/AArch64/BdsLinuxLoader.c
ArmPkg/Library/BdsLib/BdsLib.inf
ArmPkg/Library/BdsLib/BdsLinuxFdt.c
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc

index 14f16b85169a4d845503057185fc8aa5c8bca4b7..3b09a0f9ab02d10252a32c3b09e8fa3c289217fe 100644 (file)
@@ -65,8 +65,9 @@
   # it has been configured by the CPU DXE\r
   gArmTokenSpaceGuid.PcdDebuggerExceptionSupport|FALSE|BOOLEAN|0x00000032\r
 \r
-  # Define if the Power State Coordination Interface (PSCI) is supported by the Platform Trusted Firmware\r
-  gArmTokenSpaceGuid.PcdArmPsciSupport|FALSE|BOOLEAN|0x00000033\r
+  # Define if the spin-table mechanism is used by the secondary cores when booting\r
+  # Linux (instead of PSCI)\r
+  gArmTokenSpaceGuid.PcdArmLinuxSpinTable|FALSE|BOOLEAN|0x00000033\r
 \r
 [PcdsFixedAtBuild.common]\r
   gArmTokenSpaceGuid.PcdTrustzoneSupport|FALSE|BOOLEAN|0x00000006\r
index af113a1fc54a136e941f7d99b4bdda19e98765a6..e094413a53b83db914032619abf67d34b734dbf6 100644 (file)
@@ -271,7 +271,7 @@ BdsBootLinuxFdt (
   //\r
   // Install secondary core pens if the Power State Coordination Interface is not supported\r
   //\r
-  if (FeaturePcdGet (PcdArmPsciSupport) == FALSE) {\r
+  if (FeaturePcdGet (PcdArmLinuxSpinTable)) {\r
     // Place Pen at the start of Linux memory. We can then tell Linux to not use this bit of memory\r
     PenBase  = LinuxImage - 0x80000;\r
     PenSize  = (UINTN)&SecondariesPenEnd - (UINTN)&SecondariesPenStart;\r
index 6158fba5919a290d8f6b76cbf18f2e745c2b5a5c..4b9f664ea1a5f8eb30d0b59f3f23a7f8b4d20107 100644 (file)
@@ -73,9 +73,9 @@
   gEfiUsbIoProtocolGuid\r
   gEfiLoadedImageProtocolGuid\r
   gEfiSimpleNetworkProtocolGuid\r
-    \r
+\r
 [FeaturePcd]\r
-  gArmTokenSpaceGuid.PcdArmPsciSupport\r
+  gArmTokenSpaceGuid.PcdArmLinuxSpinTable\r
 \r
 [FixedPcd]\r
   gArmTokenSpaceGuid.PcdSystemMemoryBase\r
index 5ca24d7a7df8e34790c9294588986ae5c0b1f5e9..fb7bd5646e874155244b1c31b1e595f01d87c0d6 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 *\r
-*  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2011-2014, 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
@@ -16,8 +16,6 @@
 #include <Library/PcdLib.h>\r
 #include <libfdt.h>\r
 \r
-#include <IndustryStandard/ArmSmc.h>\r
-\r
 #include "BdsInternal.h"\r
 #include "BdsLinuxLoader.h"\r
 \r
@@ -214,38 +212,6 @@ IsLinuxReservedRegion (
   }\r
 }\r
 \r
-\r
-STATIC\r
-BOOLEAN\r
-IsPsciSmcSupported (\r
-  VOID\r
-  )\r
-{\r
-  BOOLEAN               PsciSmcSupported;\r
-  UINTN                 Rx;\r
-\r
-  PsciSmcSupported = FALSE;\r
-\r
-  // Check the SMC response to the Presence SMC\r
-  Rx = ARM_SMC_ID_PRESENCE;\r
-  ArmCallSmc (&Rx);\r
-  if (Rx == 1) {\r
-    // Check the SMC UID\r
-    Rx = ARM_SMC_ID_UID;\r
-    ArmCallSmc (&Rx);\r
-    if (Rx == ARM_TRUSTZONE_UID_4LETTERID) {\r
-      Rx = ARM_SMC_ID_UID + 1;\r
-      ArmCallSmc (&Rx);\r
-      if (Rx == ARM_TRUSTZONE_ARM_UID) {\r
-        PsciSmcSupported = TRUE;\r
-      }\r
-    }\r
-  }\r
-\r
-  return PsciSmcSupported;\r
-}\r
-\r
-\r
 /**\r
 ** Relocate the FDT blob to a more appropriate location for the Linux kernel.\r
 ** This function will allocate memory for the relocated FDT blob.\r
@@ -360,11 +326,9 @@ PrepareFdt (
   UINTN                 DescriptorSize;\r
   UINT32                DescriptorVersion;\r
   UINTN                 Pages;\r
-  BOOLEAN               PsciSmcSupported;\r
   UINTN                 OriginalFdtSize;\r
   BOOLEAN               CpusNodeExist;\r
   UINTN                 CoreMpId;\r
-  UINTN                 Smc;\r
 \r
   NewFdtBlobAllocation = 0;\r
 \r
@@ -395,17 +359,6 @@ PrepareFdt (
     goto FAIL_RELOCATE_FDT;\r
   }\r
 \r
-  //\r
-  // Ensure the Power State Coordination Interface (PSCI) SMCs are there if supported\r
-  //\r
-  PsciSmcSupported = FALSE;\r
-  if (FeaturePcdGet (PcdArmPsciSupport) == TRUE) {\r
-    PsciSmcSupported = IsPsciSmcSupported();\r
-    if (PsciSmcSupported == FALSE) {\r
-      DEBUG ((EFI_D_ERROR, "Warning: The Power State Coordination Interface (PSCI) is not supported by your platform Trusted Firmware.\n"));\r
-    }\r
-  }\r
-\r
   fdt = (VOID*)(UINTN)NewFdtBlobBase;\r
 \r
   node = fdt_subnode_offset (fdt, 0, "chosen");\r
@@ -564,31 +517,29 @@ PrepareFdt (
 \r
           CoreMpId = cpu_to_fdtn (CoreMpId);\r
           fdt_setprop (fdt, cpu_node, "reg", &CoreMpId, sizeof (CoreMpId));\r
-          if (PsciSmcSupported) {\r
-            fdt_setprop_string (fdt, cpu_node, "enable-method", "psci");\r
-          }\r
         } else {\r
           cpu_node = fdt_subnode_offset(fdt, node, Name);\r
         }\r
 \r
-        // If Power State Coordination Interface (PSCI) is not supported then it is expected the secondary\r
-        // cores are spinning waiting for the Operating System to release them\r
-        if ((PsciSmcSupported == FALSE) && (cpu_node >= 0)) {\r
-          // We as the bootloader are responsible for either creating or updating\r
-          // these entries. Do not trust the entries in the DT. We only know about\r
-          // 'spin-table' type. Do not try to update other types if defined.\r
-          Method = fdt_getprop(fdt, cpu_node, "enable-method", &lenp);\r
-          if ( (Method == NULL) || (!AsciiStrCmp((CHAR8 *)Method, "spin-table")) ) {\r
-            fdt_setprop_string(fdt, cpu_node, "enable-method", "spin-table");\r
-            CpuReleaseAddr = cpu_to_fdt64(ArmCoreInfoTable[Index].MailboxSetAddress);\r
-            fdt_setprop(fdt, cpu_node, "cpu-release-addr", &CpuReleaseAddr, sizeof(CpuReleaseAddr));\r
-\r
-            // If it is not the primary core than the cpu should be disabled\r
-            if (((ArmCoreInfoTable[Index].ClusterId != ClusterId) || (ArmCoreInfoTable[Index].CoreId != CoreId))) {\r
-              fdt_setprop_string(fdt, cpu_node, "status", "disabled");\r
+        if (cpu_node >= 0) {\r
+          Method = fdt_getprop (fdt, cpu_node, "enable-method", &lenp);\r
+          // We only care when 'enable-method' == 'spin-table'. If the enable-method is not defined\r
+          // or defined as 'psci' then we ignore its properties.\r
+          if ((Method != NULL) && (AsciiStrCmp ((CHAR8 *)Method, "spin-table") == 0)) {\r
+            // There are two cases;\r
+            //  - UEFI firmware parked the secondary cores and/or UEFI firmware is aware of the CPU\r
+            //    release addresses (PcdArmLinuxSpinTable == TRUE)\r
+            //  - the parking of the secondary cores has been managed before starting UEFI and/or UEFI\r
+            //    does not anything about the CPU release addresses - in this case we do nothing\r
+            if (FeaturePcdGet (PcdArmLinuxSpinTable)) {\r
+              CpuReleaseAddr = cpu_to_fdt64 (ArmCoreInfoTable[Index].MailboxSetAddress);\r
+              fdt_setprop (fdt, cpu_node, "cpu-release-addr", &CpuReleaseAddr, sizeof(CpuReleaseAddr));\r
+\r
+              // If it is not the primary core than the cpu should be disabled\r
+              if (((ArmCoreInfoTable[Index].ClusterId != ClusterId) || (ArmCoreInfoTable[Index].CoreId != CoreId))) {\r
+                fdt_setprop_string(fdt, cpu_node, "status", "disabled");\r
+              }\r
             }\r
-          } else {\r
-            Print(L"Warning: Unsupported enable-method type for CPU[%d] : %a\n", Index, (CHAR8 *)Method);\r
           }\r
         }\r
       }\r
@@ -596,36 +547,6 @@ PrepareFdt (
     }\r
   }\r
 \r
-  // If the Power State Coordination Interface is supported then we signal it in the Device Tree\r
-  if (PsciSmcSupported == TRUE) {\r
-    // Before to create it we check if the node is not already defined in the Device Tree\r
-    node = fdt_subnode_offset(fdt, 0, "psci");\r
-    if (node < 0) {\r
-      // The 'psci' node does not exist, create it\r
-      node = fdt_add_subnode(fdt, 0, "psci");\r
-      if (node < 0) {\r
-        DEBUG((EFI_D_ERROR,"Error on creating 'psci' node\n"));\r
-        Status = EFI_INVALID_PARAMETER;\r
-        goto FAIL_COMPLETE_FDT;\r
-      } else {\r
-        fdt_setprop_string (fdt, node, "compatible", "arm,psci");\r
-        fdt_setprop_string (fdt, node, "method", "smc");\r
-\r
-        Smc = cpu_to_fdtn (ARM_SMC_ARM_CPU_SUSPEND);\r
-        fdt_setprop (fdt, node, "cpu_suspend", &Smc, sizeof (Smc));\r
-\r
-        Smc = cpu_to_fdtn (ARM_SMC_ARM_CPU_OFF);\r
-        fdt_setprop (fdt, node, "cpu_off", &Smc, sizeof (Smc));\r
-\r
-        Smc = cpu_to_fdtn (ARM_SMC_ARM_CPU_ON);\r
-        fdt_setprop (fdt, node, "cpu_on", &Smc, sizeof (Smc));\r
-\r
-        Smc = cpu_to_fdtn (ARM_SMC_ARM_MIGRATE);\r
-        fdt_setprop (fdt, node, "migrate", &Smc, sizeof (Smc));\r
-      }\r
-    }\r
-  }\r
-\r
   DEBUG_CODE_BEGIN();\r
     //DebugDumpFdt (fdt);\r
   DEBUG_CODE_END();\r
index eebb96bad765c2dd044a511017a2805e1b2050aa..7cc4e27271f85101aa5d123c1cc6d83a49704487 100644 (file)
   #  It could be set FALSE to save size.\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE\r
 \r
-  ## FVP platforms support hardware power control\r
-  # Disabled for now as we have a version mismatch.\r
-  gArmTokenSpaceGuid.PcdArmPsciSupport|FALSE\r
-\r
 [PcdsFixedAtBuild.common]\r
   gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Fixed Virtual Platform"\r
   gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ARM-FVP"\r
index 6b3f5203d6b0be74e1f7aba5f7045c770575da64..55fdc595487a43266f098bdf6acc2d9ac8fa373a 100644 (file)
 ################################################################################\r
 \r
 [PcdsFeatureFlag.common]\r
-\r
 !ifdef $(EDK2_SKIP_PEICORE)\r
   gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec|TRUE\r
   gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores|TRUE\r
 !endif\r
\r
+\r
   ## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.\r
   #  It could be set FALSE to save size.\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE\r
\r
+\r
+  # UEFI firmware is responsible to park the secondary cores on this platform.\r
+  # This PCD ensures the secondary cores are parked into the AArch64 Linux parking protocol.\r
+  gArmTokenSpaceGuid.PcdArmLinuxSpinTable|TRUE\r
+\r
 [PcdsFixedAtBuild.common]\r
   gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Versatile Express"\r
   gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmVExpress-RTSM"\r