1. 01 Apr, 2016 10 commits
    • Evan Lloyd's avatar
      Make:Improve version string generation portability · 414ab853
      Evan Lloyd authored
      To get round problems encountered when building in a DOS build
      environment the generation of the .o file containing build identifier
      strings is modified.
      The problems encounterred were:
         1. DOS echo doesn't strip ' characters from the output text.
         2. git is not available from CMD.EXE so the BUILD_STRING value needs
            some other origin.
      
      A BUILD_STRING value of "development build" is used for now.
      
      MAKE_BUILD_STRINGS is used to customise build string generation in a DOS
      environment. This variable is not defined in the UNIX build environment
      make file helper, and so the existing build string generation behaviour
      is retained in these build environments.
      
      NOTE: This commit completes a cumulative series aimed at improving
            build portability across development environments.
            This enables the build to run on several new build environments,
            if the relevant tools are available.
            At this point the build is tested on Windows 7 Enterprise SP1,
            using CMD.EXE, Cygwin and Msys (MinGW),as well as a native
            Linux envionment".  The Windows platform builds used
            aarch64-none-elf-gcc.exe 4.9.1.  CMD.EXE and Msys used Gnu
            Make 3.81, cygwin used Gnu Make 4.1.
      
      CAVEAT: The cert_create tool build is not tested on the Windows
              platforms (openssl-for-windows has a GPL license).
      
      Change-Id: Iaa4fc89dbe2a9ebae87e2600c9eef10a6af30251
      414ab853
    • Evan Lloyd's avatar
      Make:Improve directory generation portability. · 51b27702
      Evan Lloyd authored
      Because of command differences in some build environments the "inline"
      method of generating the build directory structure is not portable.
      (e.g. in DOS environments the mkdir shell command fails if a directory
      already exists, whereas in UNIX environments it succeeds.)
      
      To improve portability we generate the directories needed using make,
      but use the "order-only prerequisites" feature of make to prevent writes
      of files into the directories generating re-builds, as suggested in the
      GNU make Manual (Version 4.1 September 2014).
      
      Change-Id: Ic9af475831063c7fe6f8bccffef184d79e799419
      51b27702
    • Evan Lloyd's avatar
      Make:Allow for extension in tool names. · 42a45b51
      Evan Lloyd authored
      In some build environments executable programs have a specific file
      extension.  The value of BIN_EXT is appended to the relevant tool file
      names to allow for this.
      The value of BIN_EXT is set, where appropriate, by the build environment
      specific make helper (to .exe for Windows build environments).
      
      .gitignore is updated to hide the new (.exe) files.
      
      Change-Id: Icc32f64b750e425265075ad4e0dea18129640b86
      42a45b51
    • Evan Lloyd's avatar
      Make:Use "simply expanded" make variables. · b169f6a9
      Evan Lloyd authored
      Replace some "recursively expanded" make variables with "simply
      expanded" variables (i.e. replace = with :=). This has no functional
      impact but is more consistent and theoretically more efficient.
      
      Change-Id: Iaf33d7c8ad48464ae0d39923515d1e7f230c95c1
      b169f6a9
    • Evan Lloyd's avatar
      Build:Replace soft links with file copy. · bb5a762c
      Evan Lloyd authored
      Some build environments do not support symbolic links. This patch
      removes the symlinks previously used to build fip_create and instead
      copies the relevant header files.
      The original motivation for using symlinks was to avoid Trusted Firmware
      library headers conflicting with headers in the compiler standard
      include path. Copying the header files instead has the same effect.
      
      Like other build artefacts, the copied files are listed in .gitignore.
      
      The distclean targets have also been updated to remove the copies.
      
      Change-Id: Ie8b67bcb133f7f1d660ae93b857950aa15e42b1e
      bb5a762c
    • Evan Lloyd's avatar
      Make:Use environment variables for OS detection. · e7f54dbd
      Evan Lloyd authored
      Add make helper files to select the appropriate settings for the build
      environment. Selection is made in make_helpers/build_env.mk, which
      selects other files to include using generic build environment settings.
      The Trusted Firmware Makefile and supporting tool Makefiles are updated
      to include build_env.mk instead of unix.mk.
      
      NOTE: This change does not fully enable builds in other build
            environments. It facilitates this without compromising the
            existing build environments.
      
      Change-Id: Ic4064ffe6ce158bbd16d7cc9f27dd4655a3580f6
      e7f54dbd
    • Evan Lloyd's avatar
      Make:Diagnostic fail if no eval · 1670d9df
      Evan Lloyd authored
      To help diagnose make problems, we report an error if the make
      program used does not provide the $(eval ) make functionality.
      This will detect early versions of GNU make and other make programs.
      
      Change-Id: I0ebb0f63694cf0b04eaeb7ea1e9e172fb9770ce0
      1670d9df
    • Evan Lloyd's avatar
      Make:Make shell commands more portable · f1477d4a
      Evan Lloyd authored
      Macros are inserted to replace direct invocations of commands that are
      problematic on some build environments. (e.g. Some environments expect
      \ in paths instead of /.)
      The changes take into account mismatched command mappings across
      environments.
      The new helper file unix.mk retains existing makefile behaviour on unix
      like build environments by providing the following macro definitions:
        SHELL_COPY        cp -f
        SHELL_COPY_TREE   cp -rf
        SHELL_DELETE      rm -f
        SHELL_DELETE_ALL  rm -rf
        MAKE_PREREQ_DIR   mkdir -p  (As make target)
        SHELL_REMOVE_DIR  rm -rf
      
      Change-Id: I1b5ca5e1208e78230b15284c4af00c1c006cffcb
      f1477d4a
    • Evan Lloyd's avatar
      Make:Add realclean to .PHONY list · aeb25668
      Evan Lloyd authored
      Update the cert_create Makefile to list realclean as .PHONY
      (like clean)
      
      Change-Id: I9dc8a61a11574a044372e0952b5b12b74e133747
      aeb25668
    • Evan Lloyd's avatar
      Make:Remove calls to shell from makefiles. · 231c1470
      Evan Lloyd authored
      As an initial stage of making Trusted Firmware build environment more
      portable, we remove most uses of the $(shell ) function and replace them
      with more portable make function based solutions.
      
      Note that the setting of BUILD_STRING still uses $(shell ) since it's
      not possible to reimplement this as a make function. Avoiding invocation
      of this on incompatible host platforms will be implemented separately.
      
      Change-Id: I768e2f9a265c78814a4adf2edee4cc46cda0f5b8
      231c1470
  2. 31 Mar, 2016 3 commits
    • danh-arm's avatar
      Merge pull request #570 from davwan01/bl31-in-dram · 4c51badf
      danh-arm authored
      Add support to load BL31 in DRAM
      4c51badf
    • danh-arm's avatar
      Merge pull request #554 from ljerry/tf_issue_368_ter · aaa416a4
      danh-arm authored
      Enable asynchronous abort exceptions during boot
      aaa416a4
    • David Wang's avatar
      Add support to load BL31 in DRAM · 4518dd9a
      David Wang authored
      This patch adds an option to the ARM common platforms to load BL31 in the
      TZC secured DRAM instead of the default secure SRAM.
      
      To enable this feature, set `ARM_BL31_IN_DRAM` to 1 in build options.
      If TSP is present, then setting this option also sets the TSP location
      to DRAM and ignores the `ARM_TSP_RAM_LOCATION` build flag.
      
      To use this feature, BL2 platform code must map in the DRAM used by
      BL31. The macro ARM_MAP_BL31_SEC_DRAM is provided for this purpose.
      Currently, only the FVP BL2 platform code maps in this DRAM.
      
      Change-Id: If5f7cc9deb569cfe68353a174d4caa48acd78d67
      4518dd9a
  3. 30 Mar, 2016 3 commits
    • Gerald Lejeune's avatar
      Add ISR_EL1 to crash report · 6b836cf9
      Gerald Lejeune authored
      
      
      Bring ISR bits definition as a mnemonic for troublershooters as well.
      Signed-off-by: default avatarGerald Lejeune <gerald.lejeune@st.com>
      6b836cf9
    • Gerald Lejeune's avatar
      Remove DAIF bits handling macros · 4ca57535
      Gerald Lejeune authored
      
      
      These macros are unused and redundant with other CPU system registers
      functions.
      
      Moreover enable_serror() function implementation may not reach its purpose
      because it does not handle the value of SCR_EL3.EA.
      Signed-off-by: default avatarGerald Lejeune <gerald.lejeune@st.com>
      4ca57535
    • Gerald Lejeune's avatar
      Enable asynchronous abort exceptions during boot · adb4fcfb
      Gerald Lejeune authored
      
      
      Asynchronous abort exceptions generated by the platform during cold boot are
      not taken in EL3 unless SCR_EL3.EA is set.
      
      Therefore EA bit is set along with RES1 bits in early BL1 and BL31 architecture
      initialisation. Further write accesses to SCR_EL3 preserve these bits during
      cold boot.
      
      A build flag controls SCR_EL3.EA value to keep asynchronous abort exceptions
      being trapped by EL3 after cold boot or not.
      
      For further reference SError Interrupts are also known as asynchronous external
      aborts.
      
      On Cortex-A53 revisions below r0p2, asynchronous abort exceptions are taken in
      EL3 whatever the SCR_EL3.EA value is.
      
      Fixes arm-software/tf-issues#368
      Signed-off-by: default avatarGerald Lejeune <gerald.lejeune@st.com>
      adb4fcfb
  4. 29 Mar, 2016 3 commits
  5. 22 Mar, 2016 2 commits
    • Sandrine Bailleux's avatar
      Simplify Firmware Design document · eaefdecd
      Sandrine Bailleux authored
      The Firmware Design document is meant to provide a general overview
      of the Trusted Firmware code. Although it is useful to provide some
      guidance around the responsibilities of the platform layer, it should
      not provide too much platform specific implementation details. Right
      now, some sections are too tied to the implementation on ARM
      platforms. This makes the Firmware Design document harder to digest.
      
      This patch simplifies this aspect of the Firmware Design document.
      The sections relating the platform initialisations performed by the
      different BL stages have been simplified and the extra details about
      the ARM platforms implementation have been moved to the Porting Guide
      when appropriate.
      
      This patch also provides various documentation fixes and additions
      in the Firmware Design and Platform Porting Guide. In particular:
      
       - Update list of SMCs supported by BL1.
      
       - Remove MMU setup from architectural inits, as it is actually
         performed by platform code.
      
       - Similarly, move runtime services initialisation, BL2 image
         initialization and BL33 execution out of the platform
         initialisation paragraph.
      
       - List SError interrupt unmasking as part of BL1 architectural
         initialization.
      
       - Mention Trusted Watchdog enabling in BL1 on ARM platforms.
      
       - Fix order of steps in "BL2 image load and execution" section.
      
       - Refresh section about GICv3/GICv2 drivers initialisation on
         ARM platforms.
      
      Change-Id: I32113c4ffdc26687042629cd8bbdbb34d91e3c14
      eaefdecd
    • Soby Mathew's avatar
      Make cpu operations warning a VERBOSE print · 1319e7b1
      Soby Mathew authored
      The assembler helper function `print_revision_warning` is used when a
      CPU specific operation is enabled in the debug build (e.g. an errata
      workaround) but doesn't apply to the executing CPU's revision/part number.
      However, in some cases the system integrator may want a single binary to
      support multiple platforms with different IP versions, only some of which
      contain a specific erratum.  In this case, the warning can be emitted very
      frequently when CPUs are being powered on/off.
      
      This patch modifies this warning print behaviour so that it is emitted only
      when LOG_LEVEL >= LOG_LEVEL_VERBOSE. The `debug.h` header file now contains
      guard macros so that it can be included in assembly code.
      
      Change-Id: Ic6e7a07f128dcdb8498a5bfdae920a8feeea1345
      1319e7b1
  6. 16 Mar, 2016 2 commits
  7. 14 Mar, 2016 2 commits
    • Antonio Nino Diaz's avatar
      Remove all non-configurable dead loops · 1c3ea103
      Antonio Nino Diaz authored
      Added a new platform porting function plat_panic_handler, to allow
      platforms to handle unexpected error situations. It must be
      implemented in assembly as it may be called before the C environment
      is initialized. A default implementation is provided, which simply
      spins.
      
      Corrected all dead loops in generic code to call this function
      instead. This includes the dead loop that occurs at the end of the
      call to panic().
      
      All unnecesary wfis from bl32/tsp/aarch64/tsp_exceptions.S have
      been removed.
      
      Change-Id: I67cb85f6112fa8e77bd62f5718efcef4173d8134
      1c3ea103
    • danh-arm's avatar
      Merge pull request #547 from ljerry/tf_issue_371 · 5cc34831
      danh-arm authored
      Add "size" function to IO memmap device driver
      5cc34831
  8. 11 Mar, 2016 4 commits
  9. 09 Mar, 2016 6 commits
  10. 07 Mar, 2016 3 commits
    • Antonio Nino Diaz's avatar
      Initialize secondary CPUs during cold boot · 4e85e4fd
      Antonio Nino Diaz authored
      The previous reset code in BL1 performed the following steps in
      order:
      
      1. Warm/Cold boot detection.
         If it's a warm boot, jump to warm boot entrypoint.
      
      2. Primary/Secondary CPU detection.
         If it's a secondary CPU, jump to plat_secondary_cold_boot_setup(),
         which doesn't return.
      
      3. CPU initialisations (cache, TLB...).
      
      4. Memory and C runtime initialization.
      
      For a secondary CPU, steps 3 and 4 are never reached. This shouldn't
      be a problem in most cases, since current implementations of
      plat_secondary_cold_boot_setup() either panic or power down the
      secondary CPUs.
      
      The main concern is the lack of secondary CPU initialization when
      bare metal EL3 payloads are used in case they don't take care of this
      initialisation themselves.
      
      This patch moves the detection of primary/secondary CPU after step 3
      so that the CPU initialisations are performed per-CPU, while the
      memory and the C runtime initialisation are only performed on the
      primary CPU. The diagrams used in the ARM Trusted Firmware Reset
      Design documentation file have been updated to reflect the new boot
      flow.
      
      Platforms ports might be affected by this patch depending on the
      behaviour of plat_secondary_cold_boot_setup(), as the state of the
      platform when entering this function will be different.
      
      Fixes ARM-software/tf-issues#342
      
      Change-Id: Icbf4a0ee2a3e5b856030064472f9fa6696f2eb9e
      4e85e4fd
    • Antonio Nino Diaz's avatar
      Porting guide: Clarify API that don't follow AAPCS · e5846732
      Antonio Nino Diaz authored
      This patch clarifies a porting API in the Porting Guide that do not
      follow the ARM Architecture Program Calling Standards (AAPCS). The
      list of registers that are allowed to be clobbered by this API has
      been updated in the Porting Guide.
      
      Fixes ARM-software/tf-issues#259
      
      Change-Id: Ibf2adda2e1fb3e9b8f53d8a918d5998356eb8fce
      e5846732
    • Kristina Martsenko's avatar
      Initialize all translation table entries · 2af926dd
      Kristina Martsenko authored
      The current translation table code maps in a series of regions, zeroing
      the unmapped table entries before and in between the mapped regions. It
      doesn't, however, zero the unmapped entries after the last mapped
      region, leaving those entries at whatever value that memory has
      initially.
      
      This is bad because those values can look like valid translation table
      entries, pointing to valid physical addresses. The CPU is allowed to do
      speculative reads from any such addresses. If the addresses point to
      device memory, the results can be unpredictable.
      
      This patch zeroes the translation table entries following the last
      mapped region, ensuring all table entries are either valid or zero
      (invalid).
      
      In addition, it limits the value of ADDR_SPACE_SIZE to those allowed by
      the architecture and supported by the current code (see D4.2.5 in the
      Architecture Reference Manual). This simplifies this patch a lot and
      ensures existing code doesn't do unexpected things.
      
      Change-Id: Ic28b6c3f89d73ef58fa80319a9466bb2c7131c21
      2af926dd
  11. 03 Mar, 2016 2 commits
    • Sandrine Bailleux's avatar
      Extend memory attributes to map non-cacheable memory · 5f654975
      Sandrine Bailleux authored
      At the moment, the memory translation library allows to create memory
      mappings of 2 types:
      
       - Device nGnRE memory (named MT_DEVICE in the library);
      
       - Normal, Inner Write-back non-transient, Outer Write-back
         non-transient memory (named MT_MEMORY in the library).
      
      As a consequence, the library code treats the memory type field as a
      boolean: everything that is not device memory is normal memory and
      vice-versa.
      
      In reality, the ARMv8 architecture allows up to 8 types of memory to
      be used at a single time for a given exception level. This patch
      reworks the memory attributes such that the memory type is now defined
      as an integer ranging from 0 to 7 instead of a boolean. This makes it
      possible to extend the list of memory types supported by the memory
      translation library.
      
      The priority system dictating memory attributes for overlapping
      memory regions has been extended to cope with these changes but the
      algorithm at its core has been preserved. When a memory region is
      re-mapped with different memory attributes, the memory translation
      library examines the former attributes and updates them only if
      the new attributes create a more restrictive mapping. This behaviour
      is unchanged, only the manipulation of the value has been modified
      to cope with the new format.
      
      This patch also introduces a new type of memory mapping in the memory
      translation library: MT_NON_CACHEABLE, meaning Normal, Inner
      Non-cacheable, Outer Non-cacheable memory. This can be useful to map
      a non-cacheable memory region, such as a DMA buffer for example.
      
      The rules around the Execute-Never (XN) bit in a translation table
      for an MT_NON_CACHEABLE memory mapping have been aligned on the rules
      used for MT_MEMORY mappings:
       - If the memory is read-only then it is also executable (XN = 0);
       - If the memory is read-write then it is not executable (XN = 1).
      
      The shareability field for MT_NON_CACHEABLE mappings is always set as
      'Outer-Shareable'. Note that this is not strictly needed since
      shareability is only relevant if the memory is a Normal Cacheable
      memory type, but this is to align with the existing device memory
      mappings setup. All Device and Normal Non-cacheable memory regions
      are always treated as Outer Shareable, regardless of the translation
      table shareability attributes.
      
      This patch also removes the 'ATTR_SO' and 'ATTR_SO_INDEX' #defines.
      They were introduced to map memory as Device nGnRnE (formerly called
      "Strongly-Ordered" memory in the ARMv7 architecture) but were not
      used anywhere in the code base. Removing them avoids any confusion
      about the memory types supported by the library.
      
      Upstream platforms do not currently use the MT_NON_CACHEABLE memory
      type.
      
      NOTE: THIS CHANGE IS SOURCE COMPATIBLE BUT PLATFORMS THAT RELY ON THE
      BINARY VALUES OF `mmap_attr_t` or the `attr` argument of
      `mmap_add_region()` MAY BE BROKEN.
      
      Change-Id: I717d6ed79b4c845a04e34132432f98b93d661d79
      5f654975
    • Antonio Nino Diaz's avatar
      Add cache topology info to FVP DTBs · b1063d95
      Antonio Nino Diaz authored
      From version 4.0 onwards, the ARM64 Linux kernel expects the device
      tree to indicate the cache hierarchy. Failing to provide this
      information results in the following warning message to be printed by
      the kernel:
      
          `Unable to detect cache hierarchy from DT for CPU x`
      
      All the FVP device trees provided in the TF source tree have been
      modified to add this information.
      
      Fixes ARM-software/tf-issues#325
      
      Change-Id: I0ff888992e602b81a0fe1744a86151d625727511
      b1063d95