1. 29 Aug, 2017 1 commit
  2. 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
  3. 31 Jul, 2017 1 commit
  4. 14 Jul, 2017 1 commit
  5. 15 Jun, 2017 6 commits
    • Anthony Zhou's avatar
      Tegra: delay_timer: fix MISRA defects · 3436089d
      Anthony Zhou authored
      
      
      Main fixes:
      
      * Include header file for function declarations [Rule 8.4]
      * Move global object into function [Rule 8.9]
      
      Change-Id: I1bc9f3f0ebd4ffc0b8444ac856cd97b0cb56bda4
      Signed-off-by: default avatarAnthony Zhou <anzhou@nvidia.com>
      3436089d
    • Varun Wadekar's avatar
      Tegra: gic: fix MISRA defects · 9a8f05e4
      Varun Wadekar authored
      
      
      Main fixes:
      
      * Use int32_t replace int, use uint32_t replace unsign int [Rule 4.6]
      * 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]
      * Fixed assert/if statements conditions to be essentially boolean [Rule 14.4]
      * Added curly braces ({}) around if statements in order to
        make them compound [Rule 15.6]
      * Convert macros form headers to unsigned ints
      
      Change-Id: I8051cc16499cece2039c9751bd347645f40f0901
      Signed-off-by: default avatarAnthony Zhou <anzhou@nvidia.com>
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      9a8f05e4
    • Anthony Zhou's avatar
      Tegra: fiq_glue: fix MISRA defects · 5bd1a177
      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]
      
      * Convert object type to match the type of function parameters
        [Rule 10.3]
      
      * Added curly braces ({}) around if statements in order to
        make them compound [Rule 15.6]
      
      * Expressions resulting from the expansion of macro parameters
        shall be enclosed in parentheses[Rule 20.7]
      
      Change-Id: I5cf83caafcc1650b545ca731bf3eb8f0bfeb362b
      Signed-off-by: default avatarAnthony Zhou <anzhou@nvidia.com>
      5bd1a177
    • Anthony Zhou's avatar
      Tegra: pmc: fix defects flagged during MISRA analysis · 31d97dc2
      Anthony Zhou authored
      
      
      Main fixes:
      
      * Fixed if/while statement conditional to be essentially boolean [Rule 14.4]
      
      * Added curly braces ({}) around if/for/while statements in order to
        make them compound [Rule 15.6]
      
      * 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]
      
      Change-Id: Ic72b248aeede6cf18bf85051188ea7b8fd8ae829
      Signed-off-by: default avatarAnthony Zhou <anzhou@nvidia.com>
      31d97dc2
    • Varun Wadekar's avatar
      Tegra: memctrl: check GPU reset state from common place · f5f64e4d
      Varun Wadekar authored
      
      
      This patch moves the GPU reset state check, during VideoMem resize, to the
      common SiP handler, to reduce code duplication.
      
      Change-Id: I3818c5f104b809da83dc2a61d6a8149606f81c13
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      f5f64e4d
    • Varun Wadekar's avatar
      Tegra: memctrl_v2: fix software logic to check "flush complete" · 368d5450
      Varun Wadekar authored
      
      
      This patch fixes the logic to check if the command written to the
      MC_CLIENT_HOTRESET_CTRLx registers, was accepted by the hardware module.
      
      Change-Id: If94fff9424555cb4688042eda17b4b20f4eb399a
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      368d5450
  6. 14 Jun, 2017 2 commits
  7. 08 Jun, 2017 1 commit
    • Soren Brinkmann's avatar
      tegra: Fix build errors · d20f189d
      Soren Brinkmann authored
      
      
      The 'impl' variable is guarded by the symbol DEBUG, but used in an INFO
      level print statement. INFO is defined based on LOG_LEVEL. Hence, builds
      would fail when
       - DEBUG=0 && LOG_LEVEL>=LOG_LEVEL_INFO with a variable used but not defined
       - DEBUG=1 && LOG_LEVEL<LOG_LEVEL_INFO with a variable defined but not used
      
      Fixing this by guarding impl with the same condition that guards INFO.
      
      Fixes ARM-software/tf-issues#490
      Signed-off-by: default avatarSoren Brinkmann <soren.brinkmann@xilinx.com>
      d20f189d
  8. 03 May, 2017 1 commit
  9. 01 May, 2017 4 commits
  10. 26 Apr, 2017 2 commits
  11. 21 Apr, 2017 1 commit
  12. 19 Apr, 2017 1 commit
  13. 17 Apr, 2017 1 commit
  14. 13 Apr, 2017 8 commits
  15. 10 Apr, 2017 1 commit
    • Varun Wadekar's avatar
      Tegra: memctrl_v1: enable 'xlat_table_v2' library · c05a2197
      Varun Wadekar authored
      
      
      This patch enables the 'xlat_table_v2' library for the Tegra Memory
      Controller driver. This library allows us to dynamically map/unmap
      memory regions, with MMU enabled.
      
      The Memory Controller driver maps/unmaps non-overlapping Video Memory
      region, to clean it of any secure contents, before it resizes the
      region.
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      c05a2197
  16. 07 Apr, 2017 6 commits
  17. 05 Apr, 2017 2 commits