1. 06 Jul, 2018 1 commit
    • Teddy Reed's avatar
      hikey: Add development TBB support · e59a3bff
      Teddy Reed authored
      
      
      This patch adds experimental support for TRUSTED_BOARD_BOOT to the
      Hikey. This is adapted from the RPi3 and QEMU implementations.
      
      Since the Hikey starts from BL2 the TRUSTED_BOARD_BOOT ROT begins there
      too. When TRUSTED_BOARD_BOOT is defined, the BL1 build is skipped.
      
      See the following example:
      
      make \
       PLAT=hikey \
       BL33=u-boot.bin \
       SCP_BL2=mcuimage.bin \
       TRUSTED_BOARD_BOOT=1 \
       MBEDTLS_DIR=../../mbedtls \
       GENERATE_COT=1 \
       all fip
      Signed-off-by: default avatarTeddy Reed <teddy.reed@gmail.com>
      e59a3bff
  2. 14 Jun, 2018 1 commit
    • Roberto Vargas's avatar
      Make TF UUID RFC 4122 compliant · 03364865
      Roberto Vargas authored
      
      
      RFC4122 defines that fields are stored in network order (big endian),
      but TF-A stores them in machine order (little endian by default in TF-A).
      We cannot change the future UUIDs that are already generated, but we can store
      all the bytes using arrays and modify fiptool to generate the UUIDs with
      the correct byte order.
      
      Change-Id: I97be2d3168d91f4dee7ccfafc533ea55ff33e46f
      Signed-off-by: default avatarRoberto Vargas <roberto.vargas@arm.com>
      03364865
  3. 27 Apr, 2018 1 commit
    • Masahiro Yamada's avatar
      types: use int-ll64 for both aarch32 and aarch64 · 0a2d5b43
      Masahiro Yamada authored
      Since commit 031dbb12
      
       ("AArch32: Add essential Arch helpers"),
      it is difficult to use consistent format strings for printf() family
      between aarch32 and aarch64.
      
      For example, uint64_t is defined as 'unsigned long long' for aarch32
      and as 'unsigned long' for aarch64.  Likewise, uintptr_t is defined
      as 'unsigned int' for aarch32, and as 'unsigned long' for aarch64.
      
      A problem typically arises when you use printf() in common code.
      
      One solution could be, to cast the arguments to a type long enough
      for both architectures.  For example, if 'val' is uint64_t type,
      like this:
      
        printf("val = %llx\n", (unsigned long long)val);
      
      Or, somebody may suggest to use a macro provided by <inttypes.h>,
      like this:
      
        printf("val = %" PRIx64 "\n", val);
      
      But, both would make the code ugly.
      
      The solution adopted in Linux kernel is to use the same typedefs for
      all architectures.  The fixed integer types in the kernel-space have
      been unified into int-ll64, like follows:
      
          typedef signed char           int8_t;
          typedef unsigned char         uint8_t;
      
          typedef signed short          int16_t;
          typedef unsigned short        uint16_t;
      
          typedef signed int            int32_t;
          typedef unsigned int          uint32_t;
      
          typedef signed long long      int64_t;
          typedef unsigned long long    uint64_t;
      
      [ Linux commit: 0c79a8e29b5fcbcbfd611daf9d500cfad8370fcf ]
      
      This gets along with the codebase shared between 32 bit and 64 bit,
      with the data model called ILP32, LP64, respectively.
      
      The width for primitive types is defined as follows:
      
                         ILP32           LP64
          int            32              32
          long           32              64
          long long      64              64
          pointer        32              64
      
      'long long' is 64 bit for both, so it is used for defining uint64_t.
      'long' has the same width as pointer, so for uintptr_t.
      
      We still need an ifdef conditional for (s)size_t.
      
      All 64 bit architectures use "unsigned long" size_t, and most 32 bit
      architectures use "unsigned int" size_t.  H8/300, S/390 are known as
      exceptions; they use "unsigned long" size_t despite their architecture
      is 32 bit.
      
      One idea for simplification might be to define size_t as 'unsigned long'
      across architectures, then forbid the use of "%z" string format.
      However, this would cause a distortion between size_t and sizeof()
      operator.  We have unknowledge about the native type of sizeof(), so
      we need a guess of it anyway.  I want the following formula to always
      return 1:
      
        __builtin_types_compatible_p(size_t, typeof(sizeof(int)))
      
      Fortunately, ARM is probably a majority case.  As far as I know, all
      32 bit ARM compilers use "unsigned int" size_t.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      0a2d5b43
  4. 11 Apr, 2018 3 commits
  5. 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
  6. 26 Mar, 2018 1 commit
  7. 12 Mar, 2018 1 commit
    • Michael Brandl's avatar
      plat/hikey: boot memory layout to dedicated file · 4368ae07
      Michael Brandl authored
      
      
      Boot memory layout is specific for a platform, but should not be
      mixed up with other platform specific attributes. A separate file is
      much cleaner and better to compare with other platforms. Take a look
      at plat/poplar where it is done the same way.
      
      Moved hikey_def.h to system include folder and moved includes from
      hikey_def.h to more general platform_def.h.
      Signed-off-by: default avatarMichael Brandl <git@fineon.pw>
      4368ae07
  8. 06 Mar, 2018 1 commit
  9. 05 Mar, 2018 4 commits
  10. 27 Feb, 2018 1 commit
  11. 07 Feb, 2018 1 commit
  12. 01 Feb, 2018 2 commits
  13. 30 Jan, 2018 1 commit
  14. 29 Jan, 2018 1 commit
  15. 27 Jan, 2018 1 commit
  16. 24 Jan, 2018 2 commits
  17. 30 Nov, 2017 1 commit
    • David Cunado's avatar
      Do not enable SVE on pre-v8.2 platforms · 3872fc2d
      David Cunado authored
      
      
      Pre-v8.2 platforms such as the Juno platform does not have
      the Scalable Vector Extensions implemented and so the build
      option ENABLE_SVE is set to zero.
      
      This has a minor performance improvement with no functional
      impact.
      
      Change-Id: Ib072735db7a0247406f8b60e325b7e28b1e04ad1
      Signed-off-by: default avatarDavid Cunado <david.cunado@arm.com>
      3872fc2d
  18. 22 Nov, 2017 1 commit
  19. 01 Nov, 2017 1 commit
  20. 18 Oct, 2017 2 commits
  21. 13 Sep, 2017 2 commits
  22. 07 Sep, 2017 1 commit
    • Leo Yan's avatar
      Hikey: enable CPU debug module · e246617b
      Leo Yan authored
      
      
      Every CPU has its own debug module and this module is used by JTAG
      debugging and coresight tracing. If without enabling it, it's easily to
      introduce lockup issue when we enable debugging features.
      
      This patch is to enable CPU debug module when power on CPU; this allows
      connecting to all cores through JTAG and used by kernel coresight
      driver.
      Signed-off-by: default avatarMatthias Welwarsky <maw@sysgo.com>
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      e246617b
  23. 01 Sep, 2017 2 commits
  24. 29 Aug, 2017 2 commits
    • Eleanor Bonnici's avatar
      HiKey: Rename CPUACTRL reg constants · f9a856ba
      Eleanor Bonnici authored
      
      
      Constants named as *ACTLR* refer in fact to the CPUACTRL_EL1 register.
      Since ACTLR and ACTRL_EL1 are different registers this patch renames
      these constants for clarity.
      
      Change-Id: I2a9e402dab7b0fcb6e481ee0d8a11eda943ed299
      Signed-off-by: default avatarEleanor Bonnici <Eleanor.bonnici@arm.com>
      f9a856ba
    • Leo Yan's avatar
      Hikey: enable watchdog reset · 3506ff11
      Leo Yan authored
      
      
      At the system boot time we need enable watchdog reset, otherwise after
      the watchdog is timeout it cannot reset the SoC. We need set the bit 0
      and bit 16 together, the bit 16 is mask bit so after set bit 16 we have
      permission to operate bit 0 and bit 0 is watchdog reset enabling bit.
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      3506ff11
  25. 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
  26. 26 Jul, 2017 1 commit
    • Leo Yan's avatar
      hikey: Disable VBUS_DET interrupt for PMIC · c9e8774c
      Leo Yan authored
      
      
      After disconnect Jumper pin 1-2 in J15 header, the signal VBUS_DET is to
      be pulled down to low level. This will assert the interrupt signal in
      PMIC and trigger IRQ in GIC; the asserted signal from VBUS_DET is level
      triggered and kernel reports the warning for unhooked interrupt handling;
      and VBUS_DET stays with low level, this triggers IRQ storm in kernel.
      
      This patch is to disable interrupt for VBUS_DET in PMIC, this can
      dismiss the verbose log and IRQ storm after kernel booting.
      
      [   40.835279] irq 57: nobody cared (try booting with the "irqpoll" option)
      [   40.842075] CPU: 0 PID: 980 Comm: irq/57-hi655x-p Not tainted 4.4.77-568944-g576a0114dec8-dirty #667
      [   40.851303] Hardware name: HiKey Development Board (DT)
      [   40.856580] Call trace:
      [   40.859060] [<ffffff800808c4cc>] dump_backtrace+0x0/0x1e0
      [   40.864516] [<ffffff800808c8ac>] show_stack+0x20/0x28
      [   40.869622] [<ffffff80084b9688>] dump_stack+0xa8/0xe0
      [   40.874729] [<ffffff800812dd5c>] __report_bad_irq+0x40/0xec
      [   40.880360] [<ffffff800812e0bc>] note_interrupt+0x1e4/0x2d8
      [   40.885992] [<ffffff800812b11c>] handle_irq_event_percpu+0xd8/0x268
      [   40.892324] [<ffffff800812b2f8>] handle_irq_event+0x4c/0x7c
      [   40.897955] [<ffffff800812ecbc>] handle_level_irq+0xcc/0x178
      [   40.903672] [<ffffff800812a778>] generic_handle_irq+0x34/0x4c
      [   40.909481] [<ffffff80085074c8>] pl061_irq_handler+0xa8/0x124
      [   40.915286] [<ffffff800812a778>] generic_handle_irq+0x34/0x4c
      [   40.921092] [<ffffff800812a820>] __handle_domain_irq+0x90/0xf8
      [   40.926985] [<ffffff8008082620>] gic_handle_irq+0x58/0xa8
      Signed-off-by: default avatarDmitry Shmidt <dimitrysh@google.com>
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      c9e8774c
  27. 14 Jul, 2017 1 commit
  28. 12 Jul, 2017 2 commits
    • Victor Chong's avatar
      hikey: Add BL32 (OP-TEE) support · 3b6e88a2
      Victor Chong authored
      
      Signed-off-by: default avatarVictor Chong <victor.chong@linaro.org>
      3b6e88a2
    • Victor Chong's avatar
      hikey: Remove unnecessary code · c0cde364
      Victor Chong authored
      
      
      PLATFORM_LINKER_FORMAT
      and
      PLATFORM_LINKER_ARCH
      defines are removed from
      plat/hisilicon/hikey/include/platform_def.h
      since there are already defined in
      include/plat/common/common_def.h
      which is included by
      plat/hisilicon/hikey/hikey_def.h
      which is included by
      plat/hisilicon/hikey/include/platform_def.h
      
      The line
      $(eval $(call FIP_ADD_IMG,SCP_BL2,--scp-fw))
      is removed from
      plat/hisilicon/hikey/platform.mk
      to clear the warning below:
      
      Makefile:544: warning: overriding commands for target `check_SCP_BL2'
      plat/hisilicon/hikey/platform.mk:19: warning: ignoring old commands for target `check_SCP_BL2'
      
      $(eval $(call FIP_ADD_IMG,SCP_BL2,--scp-fw))
      already exists in
      Makefile
      and applies to plat hikey so is redundant in
      plat/hisilicon/hikey/platform.mk
      Signed-off-by: default avatarVictor Chong <victor.chong@linaro.org>
      c0cde364