1. 22 May, 2014 1 commit
    • Vikram Kanigiri's avatar
      Introduce macros to manipulate the SPSR · 23ff9baa
      Vikram Kanigiri authored
      This patch introduces macros (SPSR_64 and SPSR_32) to
      create a SPSR for both aarch32 and aarch64 execution
      states. These macros allow the user to set fields
      in the SPSR depending upon its format.
      The make_spsr() function which did not allow
      manipulation of all the fields in the aarch32 SPSR
      has been replaced by these new macros.
      
      Change-Id: I9425dda0923e8d5f03d03ddb8fa0e28392c4c61e
      23ff9baa
  2. 16 May, 2014 1 commit
    • Soby Mathew's avatar
      Rework BL3-1 unhandled exception handling and reporting · a43d431b
      Soby Mathew authored
      This patch implements the register reporting when unhandled exceptions are
      taken in BL3-1. Unhandled exceptions will result in a dump of registers
      to the console, before halting execution by that CPU. The Crash Stack,
      previously called the Exception Stack, is used for this activity.
      This stack is used to preserve the CPU context and runtime stack
      contents for debugging and analysis.
      
      This also introduces the per_cpu_ptr_cache, referenced by tpidr_el3,
      to provide easy access to some of BL3-1 per-cpu data structures.
      Initially, this is used to provide a pointer to the Crash stack.
      
      panic() now prints the the error file and line number in Debug mode
      and prints the PC value in release mode.
      
      The Exception Stack is renamed to Crash Stack with this patch.
      The original intention of exception stack is no longer valid
      since we intend to support several valid exceptions like IRQ
      and FIQ in the trusted firmware context. This stack is now
      utilized for dumping and reporting the system state when a
      crash happens and hence the rename.
      
      Fixes ARM-software/tf-issues#79 Improve reporting of unhandled exception
      
      Change-Id: I260791dc05536b78547412d147193cdccae7811a
      a43d431b
  3. 09 May, 2014 1 commit
    • Sandrine Bailleux's avatar
      fvp: Provide per-EL MMU setup functions · b793e431
      Sandrine Bailleux authored
      Instead of having a single version of the MMU setup functions for all
      bootloader images that can execute either in EL3 or in EL1, provide
      separate functions for EL1 and EL3. Each bootloader image can then
      call the appropriate version of these functions. The aim is to reduce
      the amount of code compiled in each BL image by embedding only what's
      needed (e.g. BL1 to embed only EL3 variants).
      
      Change-Id: Ib86831d5450cf778ae78c9c1f7553fe91274c2fa
      b793e431
  4. 08 May, 2014 1 commit
    • Soby Mathew's avatar
      Preserve x19-x29 across world switch for exception handling · c3260f9b
      Soby Mathew authored
      Previously exception handlers in BL3-1, X19-X29 were not saved
      and restored on every SMC/trap into EL3. Instead these registers
      were 'saved as needed' as a side effect of the A64 ABI used by the C
      compiler.
      
      That approach failed when world switching but was not visible
      with the TSP/TSPD code because the TSP is 64-bit, did not
      clobber these registers when running and did not support pre-emption
      by normal world interrupts. These scenarios showed
      that the values in these registers can be passed through a world
      switch, which broke the normal and trusted world assumptions
      about these registers being preserved.
      
      The Ideal solution saves and restores these registers when a
      world switch occurs - but that type of implementation is more complex.
      So this patch always saves and restores these registers on entry and
      exit of EL3.
      
      Fixes ARM-software/tf-issues#141
      
      Change-Id: I9a727167bbc594454e81cf78a97ca899dfb11c27
      c3260f9b
  5. 07 May, 2014 2 commits
    • Andrew Thoelke's avatar
      Access system registers directly in assembler · 7935d0a5
      Andrew Thoelke authored
      Instead of using the system register helper functions to read
      or write system registers, assembler coded functions should
      use MRS/MSR instructions. This results in faster and more
      compact code.
      
      This change replaces all usage of the helper functions with
      direct register accesses.
      
      Change-Id: I791d5f11f257010bb3e6a72c6c5ab8779f1982b3
      7935d0a5
    • Andrew Thoelke's avatar
      Correct usage of data and instruction barriers · 8cec598b
      Andrew Thoelke authored
      The current code does not always use data and instruction
      barriers as required by the architecture and frequently uses
      barriers excessively due to their inclusion in all of the
      write_*() helper functions.
      
      Barriers should be used explicitly in assembler or C code
      when modifying processor state that requires the barriers in
      order to enable review of correctness of the code.
      
      This patch removes the barriers from the helper functions and
      introduces them as necessary elsewhere in the code.
      
      PORTING NOTE: check any port of Trusted Firmware for use of
      system register helper functions for reliance on the previous
      barrier behaviour and add explicit barriers as necessary.
      
      Fixes ARM-software/tf-issues#92
      
      Change-Id: Ie63e187404ff10e0bdcb39292dd9066cb84c53bf
      8cec598b
  6. 06 May, 2014 9 commits
    • Dan Handley's avatar
      Remove variables from .data section · 625de1d4
      Dan Handley authored
      Update code base to remove variables from the .data section,
      mainly by using const static data where possible and adding
      the const specifier as required. Most changes are to the IO
      subsystem, including the framework APIs. The FVP power
      management code is also affected.
      
      Delay initialization of the global static variable,
      next_image_type in bl31_main.c, until it is realy needed.
      Doing this moves the variable from the .data to the .bss
      section.
      
      Also review the IO interface for inconsistencies, using
      uintptr_t where possible instead of void *. Remove the
      io_handle and io_dev_handle typedefs, which were
      unnecessary, replacing instances with uintptr_t.
      
      Fixes ARM-software/tf-issues#107.
      
      Change-Id: I085a62197c82410b566e4698e5590063563ed304
      625de1d4
    • Dan Handley's avatar
      Reduce deep nesting of header files · 97043ac9
      Dan Handley authored
      Reduce the number of header files included from other header
      files as much as possible without splitting the files. Use forward
      declarations where possible. This allows removal of some unnecessary
      "#ifndef __ASSEMBLY__" statements.
      
      Also, review the .c and .S files for which header files really need
      including and reorder the #include statements alphabetically.
      
      Fixes ARM-software/tf-issues#31
      
      Change-Id: Iec92fb976334c77453e010b60bcf56f3be72bd3e
      97043ac9
    • Dan Handley's avatar
      Always use named structs in header files · fb037bfb
      Dan Handley authored
      Add tag names to all unnamed structs in header files. This
      allows forward declaration of structs, which is necessary to
      reduce header file nesting (to be implemented in a subsequent
      commit).
      
      Also change the typedef names across the codebase to use the _t
      suffix to be more conformant with the Linux coding style. The
      coding style actually prefers us not to use typedefs at all but
      this is considered a step too far for Trusted Firmware.
      
      Also change the IO framework structs defintions to use typedef'd
      structs to be consistent with the rest of the codebase.
      
      Change-Id: I722b2c86fc0d92e4da3b15e5cab20373dd26786f
      fb037bfb
    • Dan Handley's avatar
      Move PSCI global functions out of private header · c5945735
      Dan Handley authored
      Move the PSCI global functions out of psci_private.h and into
      psci.h to allow the standard service to only depend on psci.h.
      
      Change-Id: I8306924a3814b46e70c1dcc12524c7aefe06eed1
      c5945735
    • Dan Handley's avatar
      Separate BL functions out of arch.h · 5b827a8f
      Dan Handley authored
      Move the BL function prototypes out of arch.h and into the
      appropriate header files to allow more efficient header file
      inclusion. Create new BL private header files where there is no
      sensible existing header file.
      
      Change-Id: I45f3e10b72b5d835254a6f25a5e47cf4cfb274c3
      5b827a8f
    • Dan Handley's avatar
      Separate out CASSERT macro into own header · bdbfc3c2
      Dan Handley authored
      Separate out the CASSERT macro out of bl_common.h into its own
      header to allow more efficient header inclusion.
      
      Change-Id: I291be0b6b8f9879645e839a8f0dd1ec9b3db9639
      bdbfc3c2
    • Dan Handley's avatar
      Remove vpath usage in makefiles · bee82417
      Dan Handley authored
      Remove all usage of the vpath keyword in makefiles as it was prone
      to mistakes. Specify the relative paths to source files instead.
      
      Also reorder source files in makefiles alphabetically.
      
      Fixes ARM-software/tf-issues#121
      
      Change-Id: Id15f60655444bae60e0e2165259efac71a50928b
      bee82417
    • Dan Handley's avatar
      Make use of user/system includes more consistent · 35e98e55
      Dan Handley authored
      Make codebase consistent in its use of #include "" syntax for
      user includes and #include <> syntax for system includes.
      
      Fixes ARM-software/tf-issues#65
      
      Change-Id: If2f7c4885173b1fd05ac2cde5f1c8a07000c7a33
      35e98e55
    • Dan Handley's avatar
      Move include and source files to logical locations · 4ecca339
      Dan Handley authored
      Move almost all system include files to a logical sub-directory
      under ./include. The only remaining system include directories
      not under ./include are specific to the platform. Move the
      corresponding source files to match the include directory
      structure.
      
      Also remove pm.h as it is no longer used.
      
      Change-Id: Ie5ea6368ec5fad459f3e8a802ad129135527f0b3
      4ecca339
  7. 29 Apr, 2014 1 commit
    • Vikram Kanigiri's avatar
      Preserve PSCI cpu_suspend 'power_state' parameter. · 759ec93b
      Vikram Kanigiri authored
      This patch saves the 'power_state' parameter prior to suspending
      a cpu and invalidates it upon its resumption. The 'affinity level'
      and 'state id' fields of this parameter can be read using a set of
      public and private apis. Validation of power state parameter is
      introduced which checks for SBZ bits are zero.
      This change also takes care of flushing the parameter from the cache
      to main memory. This ensures that it is available after cpu reset
      when the caches and mmu are turned off. The earlier support for
      saving only the 'affinity level' field of the 'power_state' parameter
      has also been reworked.
      
      Fixes ARM-Software/tf-issues#26
      Fixes ARM-Software/tf-issues#130
      
      Change-Id: Ic007ccb5e39bf01e0b67390565d3b4be33f5960a
      759ec93b
  8. 26 Mar, 2014 4 commits
    • Andrew Thoelke's avatar
      Place assembler functions in separate sections · 0a30cf54
      Andrew Thoelke authored
      This extends the --gc-sections behaviour to the many assembler
      support functions in the firmware images by placing each function
      into its own code section. This is achieved by creating a 'func'
      macro used to declare each function label.
      
      Fixes ARM-software/tf-issues#80
      
      Change-Id: I301937b630add292d2dec6d2561a7fcfa6fec690
      0a30cf54
    • Achin Gupta's avatar
      Fix build failure due to a typo in TSPD code · 2eb01d34
      Achin Gupta authored
      This patch fixes a build failure when TSPD support is included. The failure was
      due to a missing semi-colon at the end of a C statement in tspd_common.c
      
      Change-Id: I8fbd0d500bd9145b15f862b8686e570b80fcce8c
      2eb01d34
    • Vikram Kanigiri's avatar
      Fix build by correcting asm helper function usage in TSPD · 31526cb0
      Vikram Kanigiri authored
      This patch fixes a regression failure due to the use of functions by the 
      TSPD code which access system registers with partially qualified names. 
      These functions had been removed in an earlier patch. The relevant code 
      has been updated to access these registers with their fully qualified 
      names.
      
      Fixes ARM-software/tf-issues#119
      
      Change-Id: Ide1bc5036e1b8164a42f7b7fe86186ad860e0ef9
      31526cb0
    • Vikram Kanigiri's avatar
      Add standby state support in PSCI cpu_suspend api · d118f9f8
      Vikram Kanigiri authored
      This patch adds support in the generic PSCI implementation to call a
      platform specific function to enter a standby state using an example
      implementation in ARM FVP port
      
      Fixes ARM-software/tf-issues#94
      Change-Id: Ic1263fcf25f28e09162ad29dca954125f9aa8cc9
      d118f9f8
  9. 21 Mar, 2014 1 commit
    • Vikram Kanigiri's avatar
      Remove partially qualified asm helper functions · 6ba0b6d6
      Vikram Kanigiri authored
      Each ARM Trusted Firmware image should know in which EL it is running
      and it should use the corresponding register directly instead of reading
      currentEL and knowing which asm register to read/write
      
      Change-Id: Ief35630190b6f07c8fbb7ba6cb20db308f002945
      6ba0b6d6
  10. 20 Mar, 2014 2 commits
    • Jeenu Viswambharan's avatar
      Implement standard calls for TSP · 52538b9b
      Jeenu Viswambharan authored
      This patch adds call count, UID and version information SMC calls for
      the Trusted OS, as specified by the SMC calling convention.
      
      Change-Id: I9a3e84ac1bb046051db975d853dcbe9612aba6a9
      52538b9b
    • Jeenu Viswambharan's avatar
      Implement ARM Standard Service · 64f6ea9b
      Jeenu Viswambharan authored
      This patch implements ARM Standard Service as a runtime service and adds
      support for call count, UID and revision information SMCs. The existing
      PSCI implementation is subsumed by the Standard Service calls and all
      PSCI calls are therefore dispatched by the Standard Service to the PSCI
      handler.
      
      At present, PSCI is the only specification under Standard Service. Thus
      call count returns the number of PSCI calls implemented. As this is the
      initial implementation, a revision number of 0.1 is returned for call
      revision.
      
      Fixes ARM-software/tf-issues#62
      
      Change-Id: I6d4273f72ad6502636efa0f872e288b191a64bc1
      64f6ea9b
  11. 05 Mar, 2014 1 commit
    • Jon Medhurst's avatar
      Update Makefiles to get proper dependency checking working. · 6d55d109
      Jon Medhurst authored
      
      
      This change requires all platforms to now specify a list of source files
      rather than object files.
      
      New source files should preferably be specified by using the path as
      well and we should add this in the future for all files so we can remove
      use of vpath. This is desirable because vpath hides issues like the fact
      that BL2 currently pulls in a BL1 file bl1/aarch64/early_exceptions.S
      and if in the future we added bl2/aarch64/early_exceptions.S then it's
      likely only one of the two version would be used for both bootloaders.
      
      This change also removes the 'dump' build target and simply gets
      bootloaders to always generate a dump file. At the same time the -x
      option is added so the section headers and symbols table are listed.
      
      Fixes ARM-software/tf-issues#11
      
      Change-Id: Ie38f7be76fed95756c8576cf3f3ea3b7015a18dc
      Signed-off-by: default avatarJon Medhurst <tixy@linaro.org>
      6d55d109
  12. 26 Feb, 2014 1 commit
    • Jeenu Viswambharan's avatar
      Implement late binding for runtime hooks · 7f366605
      Jeenu Viswambharan authored
      At present SPD power management hooks and BL3-2 entry are implemented
      using weak references. This would have the handlers bound and registered
      with the core framework at build time, but leaves them dangling if a
      service fails to initialize at runtime.
      
      This patch replaces implementation by requiring runtime handlers to
      register power management and deferred initialization hooks with the
      core framework at runtime. The runtime services are to register the
      hooks only as the last step, after having all states successfully
      initialized.
      
      Change-Id: Ibe788a2a381ef39aec1d4af5ba02376e67269782
      7f366605
  13. 20 Feb, 2014 4 commits
    • Achin Gupta's avatar
      Rework arithmetic operations in Test Secure Payload · 916a2c1e
      Achin Gupta authored
      
      
      This patch reworks the service provided by the TSP to perform common
      arithmetic operations on a set of arguments provided by the non-secure
      world. For a addition, division, subtraction & multiplication operation
      requested on two arguments in x0 and x1 the steps are:
      
      1. TSPD saves the non-secure context and passes the operation and its
         arguments to the TSP.
      
      2. TSP asks the TSPD to return the same arguments once again. This
         exercises an additional SMC path.
      
      3. TSP now has two copies of both x0 and x1. It performs the operation
         on the corresponding copies i.e. in case of addition it returns x0+x0
         and x1+x1.
      
      4. TSPD receives the result, saves the secure context, restores the
         non-secure context and passes the result back to the non-secure
         client.
      
      Change-Id: I6eebfa2ae0a6f28b1d2e11a31f575c7a4b96724b
      Co-authored-by: default avatarJeenu Viswambharan <jeenu.viswambharan@arm.com>
      916a2c1e
    • Achin Gupta's avatar
      Add power management support in the SPD · 607084ee
      Achin Gupta authored
      This patch implements a set of handlers in the SPD which are called by
      the PSCI runtime service upon receiving a power management
      operation. These handlers in turn pass control to the Secure Payload
      image if required before returning control to PSCI. This ensures that
      the Secure Payload has complete visibility of all power transitions in
      the system and can prepare accordingly.
      
      Change-Id: I2d1dba5629b7cf2d53999d39fe807dfcf3f62fe2
      607084ee
    • Achin Gupta's avatar
      Add Test Secure Payload Dispatcher (TSPD) service · 375f538a
      Achin Gupta authored
      
      
      This patch adds the TSPD service which is responsible for managing
      communication between the non-secure state and the Test Secure Payload
      (TSP) executing in S-EL1.
      
      The TSPD does the following:
      
      1. Determines the location of the TSP (BL3-2) image and passes control
         to it for initialization. This is done by exporting the 'bl32_init()'
         function.
      
      2. Receives a structure containing the various entry points into the TSP
         image as a response to being initialized. The TSPD uses this
         information to determine how the TSP should be entered depending on
         the type of operation.
      
      3. Implements a synchronous mechanism for entering into and returning
         from the TSP image. This mechanism saves the current C runtime
         context on top of the current stack and jumps to the TSP through an
         ERET instruction. The TSP issues an SMC to indicate completion of the
         previous request. The TSPD restores the saved C runtime context and
         resumes TSP execution.
      
      This patch also introduces a Make variable 'SPD' to choose the specific
      SPD to include in the build. By default, no SPDs are included in the
      build.
      
      Change-Id: I124da5695cdc510999b859a1bf007f4d049e04f3
      Co-authored-by: default avatarJeenu Viswambharan <jeenu.viswambharan@arm.com>
      375f538a
    • Achin Gupta's avatar
      Move PSCI to runtime services directory · 0a9f7473
      Achin Gupta authored
      This patch creates a 'services' directory and moves the PSCI under
      it. Other runtime services e.g. the Secure Payload Dispatcher service
      will be placed under the same directory in the future.
      
      Also fixes issue ARM-software/tf-issues#12
      
      Change-Id: I187f83dcb660b728f82155d91882e961d2255068
      0a9f7473