Hi Jeremy,

Thanks for this reworked version.
A few minor comment below.

On Fri, Nov 20, 2015 at 04:18:51PM -0600, Jeremy Linton wrote:
> The code to detect what juno revision we are running on
> is fairly small. Put it in a common header, where it may be
> shared by a couple modules.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jeremy Linton <jeremy.lin...@arm.com>
> ---
>  ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h | 41 
> +++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h 
> b/ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h
> index d01d136..0e72a5c 100644
> --- a/ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h
> +++ b/ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h
> @@ -83,6 +83,47 @@
>      EFI_ACPI_ARM_CREATOR_REVISION   /* UINT32  CreatorRevision */ \
>    }
>  
> +//
> +// Hardware platform identifiers
> +//
> +#define JUNO_REVISION_UNKNOWN 0
> +#define JUNO_REVISION_R0      1
> +#define JUNO_REVISION_R1      2

So, swapping the enum for defines is fine with me (I might even prefer
it), but could we either keep the same names or prepend a separate
renaming patch to keep the diff clean?

> +
> +//
> +// We detect whether we are running on a Juno r0 or Juno r1
> +// board at runtime by checking the value of the MIDR register.
> +//
> +#define GetJunoRevision(JunoRevision)
> \

Any chance we can do this as a STATIC function instead of a long
macro? The above makes operation at the call-site
not-immediately-obvious, which is one of my biggest bugbears.

/
    Leif

> +{                                                                      \
> +  UINT32                Midr;                                               \
> +  UINT32                CpuType;                                       \
> +  UINT32                CpuRev;                                        \
> +                                                                       \
> +  JunoRevision = JUNO_REVISION_UNKNOWN;
>    \
> +                                                                       \
> +  Midr     = ArmReadMidr ();                                           \
> +  CpuType  = (Midr >> ARM_CPU_TYPE_SHIFT) & ARM_CPU_TYPE_MASK;         \
> +  CpuRev   = Midr & ARM_CPU_REV_MASK;                                  \
> +                                                                       \
> +  switch (CpuType) {                                                   \
> +  case ARM_CPU_TYPE_A53:                                               \
> +    if (CpuRev == ARM_CPU_REV (0, 0)) {                                \
> +      JunoRevision = JUNO_REVISION_R0;                                 \
> +    } else if (CpuRev == ARM_CPU_REV (0, 3)) {                         \
> +      JunoRevision = JUNO_REVISION_R1;                                 \
> +    }                                                                  \
> +    break;                                                             \
> +                                                                       \
> +  case ARM_CPU_TYPE_A57:                                               \
> +    if (CpuRev == ARM_CPU_REV (0, 0)) {                                \
> +      JunoRevision = JUNO_REVISION_R0;                                 \
> +    } else if (CpuRev == ARM_CPU_REV (1, 1)) {                         \
> +      JunoRevision = JUNO_REVISION_R1;                                 \
> +    }                                                                  \
> +  }                                                                    \
> +}
> +
>  #define JUNO_WATCHDOG_COUNT  2
>  
>  // Define if the exported ACPI Tables are based on ACPI 5.0 spec or latest
> -- 
> 2.4.3
> 
> 
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to