]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg: Convert ArmJunoDxe to use common juno revision code
authorJeremy Linton <jeremy.linton@arm.com>
Wed, 27 Jul 2016 19:24:36 +0000 (14:24 -0500)
committerLeif Lindholm <leif.lindholm@linaro.org>
Thu, 28 Jul 2016 14:29:35 +0000 (15:29 +0100)
Now that the code to detect the Juno revision is in
the header go ahead and covert the ArmJunoDxe to use it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c

index dba1fcd7aeef020fa3c0ddf8419777ce844aaadb..b97f044004341cfe3b645c8bbf4fcabf4671088d 100644 (file)
 #include <Library/IoLib.h>\r
 #include <Library/PrintLib.h>\r
 \r
-//\r
-// Hardware platform identifiers\r
-//\r
-typedef enum {\r
-  UNKNOWN,\r
-  JUNO_R0,\r
-  JUNO_R1\r
-} JUNO_REVISION;\r
 \r
 // This GUID must match the FILE_GUID in ArmPlatformPkg/ArmJunoPkg/AcpiTables/AcpiTables.inf\r
 STATIC CONST EFI_GUID mJunoAcpiTableFile = { 0xa1dd808e, 0x1e95, 0x4399, { 0xab, 0xc0, 0x65, 0x3c, 0x82, 0xe8, 0x53, 0x0c } };\r
@@ -134,6 +126,16 @@ AcpiTableJunoR1Check (
   return TRUE;\r
 }\r
 \r
+STATIC\r
+BOOLEAN\r
+AcpiTableJunoR2Check (\r
+  IN  EFI_ACPI_DESCRIPTION_HEADER *AcpiHeader\r
+  )\r
+{\r
+  return TRUE;\r
+}\r
+\r
+\r
 EFI_STATUS\r
 EFIAPI\r
 ArmJunoEntryPoint (\r
@@ -146,13 +148,9 @@ ArmJunoEntryPoint (
   CHAR16                *TextDevicePath;\r
   UINTN                 TextDevicePathSize;\r
   VOID                  *Buffer;\r
-  UINT32                Midr;\r
-  UINT32                CpuType;\r
-  UINT32                CpuRev;\r
-  JUNO_REVISION         JunoRevision;\r
+  UINT32                JunoRevision;\r
   EFI_EVENT             EndOfDxeEvent;\r
 \r
-  JunoRevision = UNKNOWN;\r
   Status = PciEmulationEntryPoint ();\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
@@ -217,47 +215,25 @@ ArmJunoEntryPoint (
     DEBUG ((EFI_D_ERROR, "ArmJunoDxe: Failed to install ShellDynCmdRunAxf\n"));\r
   }\r
 \r
-  //\r
-  // We detect whether we are running on a Juno r0 or Juno r1 board at\r
-  // runtime by checking the value of the MIDR register.\r
-  //\r
-\r
-  Midr     = ArmReadMidr ();\r
-  CpuType  = (Midr >> ARM_CPU_TYPE_SHIFT) & ARM_CPU_TYPE_MASK;\r
-  CpuRev   = Midr & ARM_CPU_REV_MASK;\r
-\r
-  switch (CpuType) {\r
-  case ARM_CPU_TYPE_A53:\r
-    if (CpuRev == ARM_CPU_REV (0, 0)) {\r
-      JunoRevision = JUNO_R0;\r
-    } else if (CpuRev == ARM_CPU_REV (0, 3)) {\r
-      JunoRevision = JUNO_R1;\r
-    }\r
-    break;\r
-\r
-  case ARM_CPU_TYPE_A57:\r
-    if (CpuRev == ARM_CPU_REV (0, 0)) {\r
-      JunoRevision = JUNO_R0;\r
-    } else if (CpuRev == ARM_CPU_REV (1, 1)) {\r
-      JunoRevision = JUNO_R1;\r
-    }\r
-  }\r
+  GetJunoRevision(JunoRevision);\r
 \r
   //\r
   // Try to install the ACPI Tables\r
   //\r
-  if (JunoRevision == JUNO_R0) {\r
+  if (JunoRevision == JUNO_REVISION_R0) {\r
     Status = LocateAndInstallAcpiFromFvConditional (&mJunoAcpiTableFile, AcpiTableJunoR0Check);\r
-  } else if (JunoRevision == JUNO_R1) {\r
+  } else if (JunoRevision == JUNO_REVISION_R1) {\r
     Status = LocateAndInstallAcpiFromFvConditional (&mJunoAcpiTableFile, AcpiTableJunoR1Check);\r
+  } else if (JunoRevision == JUNO_REVISION_R2) {\r
+    Status = LocateAndInstallAcpiFromFvConditional (&mJunoAcpiTableFile, AcpiTableJunoR2Check);\r
   }\r
-  ASSERT_EFI_ERROR (Status);\r
 \r
+  ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
-  // Set the R1 two boot options if not already done.\r
+  // Setup R1/R2 options if not already done.\r
   //\r
-  if (JunoRevision == JUNO_R1) {\r
+  if (JunoRevision != JUNO_REVISION_R0) {\r
     // Enable PCI enumeration\r
     PcdSetBool (PcdPciDisableBusEnumeration, FALSE);\r
 \r