1. 18 Jan, 2019 13 commits
    • Varun Wadekar's avatar
      Tegra: remove duplicate code from CPU's power on path · a9cbc0cb
      Varun Wadekar authored
      
      
      This patch removes duplicate code from the CPU's power on path. The removed
      code is already present as part of PSCI's power on logic.
      
      Change-Id: I4d18a605b219570c6bf997b9e6be6e7853ebf5cd
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      a9cbc0cb
    • Varun Wadekar's avatar
      Tegra: trusty: pass profiling base to Trusted OS · db82b619
      Varun Wadekar authored
      
      
      * Previous boot loader passes Shared DRAM address
        to be used by Trusted OS to dump its boot timing records
      * This patch adds support to pass the parameter
        to Trusted OS during cold boot
      
      Change-Id: I9f95bb6de80b1bbd2d2d6ec42619f895d911b8ed
      Signed-off-by: default avatarAkshay Sharan <asharan@nvidia.com>
      db82b619
    • Varun Wadekar's avatar
      Tegra: memctrl: assert if dynamic memmap fails · 7a6e0537
      Varun Wadekar authored
      
      
      This patch adds an assert in case the dynamic memmap routine fails.
      
      Change-Id: Idd20debbb8944340f5928c6f2cfea973a63a7b1c
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      7a6e0537
    • Varun Wadekar's avatar
      Tegra: lib: library for profiling the cold boot path · 087cf68a
      Varun Wadekar authored
      
      
      The non secure world would like to profile the boot path for
      the EL3 and S-EL1 firmwares. To allow it to do that, a non-secure
      DRAM region (4K) is allocated and the base address is passed to
      the EL3 firmware.
      
      This patch adds a library to allow the platform code to store the
      tag:timestamp pair to the shared memory. The tegra platform code
      then uses the `record` method to add timestamps.
      
      Original change by Akshay Sharan <asharan@nvidia.com>
      
      Change-Id: Idbbef9c83ed84a508b04d85a6637775960dc94ba
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      087cf68a
    • Varun Wadekar's avatar
      Tegra: sanity check non-secure DRAM address · 6460ed7a
      Varun Wadekar authored
      
      
      This patch fixes the logic to validate if a non-secure memory address
      overlaps the TZDRAM memory aperture.
      
      Change-Id: I68af7dc6acc705d7b0ee9161c4002376077b46b1
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      6460ed7a
    • Anthony Zhou's avatar
      Tegra: fix defects flagged by MISRA Rule 10.3 · aa64c5fb
      Anthony Zhou authored
      
      
      MISRA Rule 10.3, the value of an expression shall not be assigned to
      an object with a narrower essential type or of a different essential
      type category.
      
      The essential type of a enum member is anonymous enum, the enum member
      should be casted to the right type when using it.
      
      Both UL and ULL suffix equal to uint64_t constant in compiler
      aarch64-linux-gnu-gcc, to avoid confusing, only keep U and ULL suffix
      in platform code. So in some case, cast a constant to uint32_t is
      necessary.
      
      Change-Id: I1aae8cba81ef47481736e7f95f53570de7013187
      Signed-off-by: default avatarAnthony Zhou <anzhou@nvidia.com>
      aa64c5fb
    • Steven Kao's avatar
      Tegra: smmu: add a hook to get number of devices · bc5a86f7
      Steven Kao authored
      
      
      This patch adds a hook to get the number of smmu devices and
      removes the NUM_SMMU_DEVICES macro.
      
      Change-Id: Ia8dba7e9304224976b5da688b9e4b5438f11cc41
      Signed-off-by: default avatarSteven Kao <skao@nvidia.com>
      bc5a86f7
    • Anthony Zhou's avatar
      Tegra: common: fix defects flagged by MISRA scan · 4c994002
      Anthony Zhou authored
      
      
      Macro assert(e) request 'e' is a bool type, if useing other
      type, MISRA report a "The Essential Type Model" violation,
      Add a judgement to fix the defects, if 'e' is not bool type.
      
      Remove unused code [Rule 2.5]
      Fix the essential type model violation [Rule 10.6, 10.7]
      Use local parameter to raplace function parameter [Rule 17.8]
      
      Change-Id: Ifce932addbb0a4b063ef6b38349d886c051d81c0
      Signed-off-by: default avatarAnthony Zhou <anzhou@nvidia.com>
      4c994002
    • Steven Kao's avatar
      Tegra: read-modify-write ACTLR_ELx registers · 75516c3e
      Steven Kao authored
      
      
      This patch changes direct writes to ACTLR_ELx registers to use
      read-modify-write instead.
      
      Change-Id: I6e0eaa6974583f3035cb3724088f3f1c849da229
      Signed-off-by: default avatarSteven Kao <skao@nvidia.com>
      75516c3e
    • Anthony Zhou's avatar
      Tegra: common: drivers: fix MISRA defects · 61beb3e0
      Anthony Zhou authored
      
      
      Main fixes:
      
      Add suffix U for constant [Rule 10.1]
      
      Match the operands type [Rule 10.4]
      
      Use UL replace U for that constant define that need do "~"
      operation [Rule 12.4]
      
      Voided non c-library functions whose return types are not used
       [Rule 17.7]
      
      Change-Id: Ia1e814ca3890eab7904be9c79030502408f30936
      Signed-off-by: default avatarAnthony Zhou <anzhou@nvidia.com>
      61beb3e0
    • Anthony Zhou's avatar
      Tegra: pm: fix MISRA defects · b36aea5a
      Anthony Zhou authored
      
      
      Main fixes:
      
      * Use int32_t replace int, use uint32_t replace unsign int
        [Rule 4.6]
      * Add function define to header file [Rule 8.4]
      * Added curly braces ({}) around if statements in order to
        make them compound [Rule 15.6]
      * Voided non c-library functions whose return types are not used
        [Rule 17.7]
      
      Change-Id: Ifa3ba4e75046697cfede885096bee9a30efe6519
      Signed-off-by: default avatarAnthony Zhou <anzhou@nvidia.com>
      b36aea5a
    • Varun Wadekar's avatar
      Tegra: fix MISRA defects in tegra_bl31_setup.c · fcf23a14
      Varun Wadekar authored
      
      
      Main fixes:
      
      Add parentheses to avoid implicit operator precedence [Rule 12.1]
      
      Fixed if statement conditional to be essentially boolean [Rule 14.4]
      
      Added curly braces ({}) around if statements in order to
      make them compound [Rule 15.6]
      
      Voided non c-library functions whose return types are not used [Rule 17.7]
      
      Bug 200272157
      
      Change-Id: Ic3ab5a3de95aeb6d2265df940f7fb35ea0f19ab0
      Signed-off-by: default avatarAnthony Zhou <anzhou@nvidia.com>
      fcf23a14
    • Varun Wadekar's avatar
      Tegra: gpcdma: driver for general purpose DMA · 647d4a03
      Varun Wadekar authored
      
      
      This patch adds the driver for the general purpose DMA hardware
      block on newer Tegra SoCs. The GPCDMA is a special purpose DMA
      used to speed up memory copy operations to/from DRAM and TZSRAM.
      
      This patch introduces a macro 'USE_GPC_DMA' to allow platforms
      to override CPU based memory operations.
      
      Change-Id: I3170d409c83b77e785437b1002a8d70188fabbeb
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      647d4a03
  2. 16 Jan, 2019 14 commits
  3. 04 Jan, 2019 1 commit
    • Antonio Nino Diaz's avatar
      Sanitise includes across codebase · 09d40e0e
      Antonio Nino Diaz authored
      Enforce full include path for includes. Deprecate old paths.
      
      The following folders inside include/lib have been left unchanged:
      
      - include/lib/cpus/${ARCH}
      - include/lib/el3_runtime/${ARCH}
      
      The reason for this change is that having a global namespace for
      includes isn't a good idea. It defeats one of the advantages of having
      folders and it introduces problems that are sometimes subtle (because
      you may not know the header you are actually including if there are two
      of them).
      
      For example, this patch had to be created because two headers were
      called the same way: e0ea0928 ("Fix gpio includes of mt8173 platform
      to avoid collision."). More recently, this patch has had similar
      problems: 46f9b2c3 ("drivers: add tzc380 support").
      
      This problem was introduced in commit 4ecca339
      
       ("Move include and
      source files to logical locations"). At that time, there weren't too
      many headers so it wasn't a real issue. However, time has shown that
      this creates problems.
      
      Platforms that want to preserve the way they include headers may add the
      removed paths to PLAT_INCLUDES, but this is discouraged.
      
      Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8f
      Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      09d40e0e
  4. 18 Dec, 2018 2 commits
  5. 25 Oct, 2018 1 commit
    • Antonio Nino Diaz's avatar
      Add plat_crash_console_flush to platforms without it · 9c675b37
      Antonio Nino Diaz authored
      
      
      Even though at this point plat_crash_console_flush is optional, it will
      stop being optional in a following patch.
      
      The console driver of warp7 doesn't support flush, so the implementation
      is a placeholder.
      
      TI had ``plat_crash_console_init`` and ``plat_crash_console_putc``, but
      they weren't global so they weren't actually used. Also, they were
      calling the wrong functions.
      
      imx8_helpers.S only has placeholders for all of the functions.
      
      Change-Id: I8d17bbf37c7dad74e134c61ceb92acb9af497718
      Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      9c675b37
  6. 28 Sep, 2018 1 commit
  7. 22 Aug, 2018 1 commit
  8. 13 Jul, 2018 1 commit
    • Sandrine Bailleux's avatar
      Tegra: Fix up INFO() message · c426fd70
      Sandrine Bailleux authored
      With commit cf24229e
      
       ("Run compiler on debug macros for type
      checking"), the compiler will now always evaluate INFO() macro
      calls, no matter the LOG_LEVEL value. Therefore, any variable
      referenced in the macro has to be be defined.
      
      Address this issue by removing the local variable and using the
      expression it was assigned directly in the INFO() call.
      
      Change-Id: Iedc23b3538c1e162372e85390881e50718e50bf3
      Signed-off-by: default avatarSandrine Bailleux <sandrine.bailleux@arm.com>
      c426fd70
  9. 27 Apr, 2018 1 commit
  10. 27 Mar, 2018 1 commit
    • Joel Hutton's avatar
      Clean usage of void pointers to access symbols · 9f85f9e3
      Joel Hutton authored
      
      
      Void pointers have been used to access linker symbols, by declaring an
      extern pointer, then taking the address of it. This limits symbols
      values to aligned pointer values. To remove this restriction an
      IMPORT_SYM macro has been introduced, which declares it as a char
      pointer and casts it to the required type.
      
      Change-Id: I89877fc3b13ed311817bb8ba79d4872b89bfd3b0
      Signed-off-by: default avatarJoel Hutton <Joel.Hutton@Arm.com>
      9f85f9e3
  11. 22 Feb, 2018 1 commit
  12. 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
  13. 29 Aug, 2017 1 commit
  14. 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