1. 17 Feb, 2018 1 commit
    • Andreas Färber's avatar
      tegra: Fix mmap_region_t struct mismatch · 28db3e96
      Andreas Färber authored
      Commit fdb1964c
      
       ("xlat: Introduce
      MAP_REGION2() macro") added a granularity field to mmap_region_t.
      
      Tegra platforms were using the v2 xlat_tables implementation in
      common/tegra_common.mk, but v1 xlat_tables.h headers in soc/*/plat_setup.c
      where arrays are being defined. This caused the next physical address to
      be read as granularity, causing EINVAL error and triggering an assert.
      
      Consistently use xlat_tables_v2.h header to avoid this.
      
      Fixes ARM-software/tf-issues#548.
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      28db3e96
  2. 21 Sep, 2017 1 commit
    • Antonio Nino Diaz's avatar
      Fix type of `unsigned long` constants · e47ac1fd
      Antonio Nino Diaz authored
      
      
      The type `unsigned long` is 32 bit wide in AArch32, but 64 bit wide in
      AArch64. This is inconsistent and that's why we avoid using it as per
      the Coding Guidelines. This patch changes all `UL` occurrences to `U`
      or `ULL` depending on the context so that the size of the constant is
      clear.
      
      This problem affected the macro `BIT(nr)`. As long as this macro is used
      to fill fields of registers, that's not a problem, since all registers
      are 32 bit wide in AArch32 and 64 bit wide in AArch64. However, if the
      macro is used to fill the fields of a 64-bit integer, it won't be able
      to set the upper 32 bits in AArch32.
      
      By changing the type of this macro to `unsigned long long` the behaviour
      is always the same regardless of the architecture, as this type is
      64-bit wide in both cases.
      
      Some Tegra platform files have been modified by this patch.
      
      Change-Id: I918264c03e7d691a931f0d1018df25a2796cc221
      Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      e47ac1fd
  3. 15 Aug, 2017 1 commit
    • Julius Werner's avatar
      Add new alignment parameter to func assembler macro · 64726e6d
      Julius Werner authored
      
      
      Assembler programmers are used to being able to define functions with a
      specific aligment with a pattern like this:
      
          .align X
        myfunction:
      
      However, this pattern is subtly broken when instead of a direct label
      like 'myfunction:', you use the 'func myfunction' macro that's standard
      in Trusted Firmware. Since the func macro declares a new section for the
      function, the .align directive written above it actually applies to the
      *previous* section in the assembly file, and the function it was
      supposed to apply to is linked with default alignment.
      
      An extreme case can be seen in Rockchip's plat_helpers.S which contains
      this code:
      
        [...]
        endfunc plat_crash_console_putc
      
        .align 16
        func platform_cpu_warmboot
        [...]
      
      This assembles into the following plat_helpers.o:
      
        Sections:
        Idx Name                             Size  [...]  Algn
         9 .text.plat_crash_console_putc 00010000  [...]  2**16
        10 .text.platform_cpu_warmboot   00000080  [...]  2**3
      
      As can be seen, the *previous* function actually got the alignment
      constraint, and it is also 64KB big even though it contains only two
      instructions, because the .align directive at the end of its section
      forces the assembler to insert a giant sled of NOPs. The function we
      actually wanted to align has the default constraint. This code only
      works at all because the linker just happens to put the two functions
      right behind each other when linking the final image, and since the end
      of plat_crash_console_putc is aligned the start of platform_cpu_warmboot
      will also be. But it still wastes almost 64KB of image space
      unnecessarily, and it will break under certain circumstances (e.g. if
      the plat_crash_console_putc function becomes unused and its section gets
      garbage-collected out).
      
      There's no real way to fix this with the existing func macro. Code like
      
       func myfunc
       .align X
      
      happens to do the right thing, but is still not really correct code
      (because the function label is inserted before the .align directive, so
      the assembler is technically allowed to insert padding at the beginning
      of the function which would then get executed as instructions if the
      function was called). Therefore, this patch adds a new parameter with a
      default value to the func macro that allows overriding its alignment.
      
      Also fix up all existing instances of this dangerous antipattern.
      
      Change-Id: I5696a07e2fde896f21e0e83644c95b7b6ac79a10
      Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
      64726e6d
  4. 14 Jul, 2017 1 commit
  5. 15 Jun, 2017 1 commit
    • Anthony Zhou's avatar
      Tegra186: mce: fix MISRA defects · ab712fd8
      Anthony Zhou authored
      
      
      Main fixes:
      
      * Added explicit casts (e.g. 0U) to integers in order for them to be
        compatible with whatever operation they're used in [Rule 10.1]
      * Force operands of an operator to the same type category [Rule 10.4]
      * Added curly braces ({}) around if/while statements in order to
        make them compound [Rule 15.6]
      * Added parentheses [Rule 12.1]
      * Voided non C-library functions whose return types are not used [Rule 17.7]
      
      Change-Id: I91404edec2e2194b1ce2672d2a3fc6a1f5bf41f1
      Signed-off-by: default avatarAnthony Zhou <anzhou@nvidia.com>
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      ab712fd8
  6. 14 Jun, 2017 2 commits
  7. 03 May, 2017 1 commit
  8. 01 May, 2017 2 commits
  9. 21 Apr, 2017 1 commit
  10. 17 Apr, 2017 1 commit
  11. 13 Apr, 2017 4 commits
  12. 07 Apr, 2017 10 commits
  13. 05 Apr, 2017 9 commits
  14. 30 Mar, 2017 5 commits