1. 06 May, 2014 4 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
      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
  2. 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
  3. 20 Mar, 2014 1 commit
    • 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
  4. 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
  5. 20 Feb, 2014 2 commits
    • 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
      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
  6. 17 Feb, 2014 2 commits
    • Jeenu Viswambharan's avatar
      Add support for handling runtime service requests · caa84939
      Jeenu Viswambharan authored
      
      
      This patch uses the reworked exception handling support to handle
      runtime service requests through SMCs following the SMC calling
      convention. This is a giant commit since all the changes are
      inter-related. It does the following:
      
      1. Replace the old exception handling mechanism with the new one
      2. Enforce that SP_EL0 is used C runtime stacks.
      3. Ensures that the cold and warm boot paths use the 'cpu_context'
         structure to program an ERET into the next lower EL.
      4. Ensures that SP_EL3 always points to the next 'cpu_context'
         structure prior to an ERET into the next lower EL
      5. Introduces a PSCI SMC handler which completes the use of PSCI as a
         runtime service
      
      Change-Id: I661797f834c0803d2c674d20f504df1b04c2b852
      Co-authored-by: default avatarAchin Gupta <achin.gupta@arm.com>
      caa84939
    • James Morrissey's avatar
      Fix asserts appearing in release builds · 40a6f647
      James Morrissey authored
      Also fix warnings generated in release builds when assert code
      is absent.
      
      Change-Id: I45b9173d3888f9e93e98eb5b4fdc06727ba5cbf4
      40a6f647
  7. 20 Jan, 2014 3 commits
    • Achin Gupta's avatar
      psci: fix affinity level upgrade issue · 75f7367b
      Achin Gupta authored
      The psci implementation does not track target affinity level requests
      specified during cpu_suspend calls correctly as per the following
      example.
      
      1. cpu0.cluster0 calls cpu_suspend with the target affinity level as 0
      2. Only the cpu0.cluster0 is powered down while cluster0 remains
         powered up
      3. cpu1.cluster0 calls cpu_off to power itself down to highest
         possible affinity level
      4. cluster0 will be powered off even though cpu0.cluster0 does not
         allow cluster shutdown
      
      This patch introduces reference counts at affinity levels > 0 to track
      the number of cpus which want an affinity instance at level X to
      remain powered up. This instance can be turned off only if its
      reference count is 0. Cpus still undergo the normal state transitions
      (ON, OFF, ON_PENDING, SUSPEND) but the higher levels can only be
      either ON or OFF depending upon their reference count.
      
      The above issue is thus fixed as follows:
      
      1. cluster0's reference count is incremented by two when cpu0 and cpu1
         are initially powered on.
      
      2. cpu0.cluster0 calls cpu_suspend with the target affinity level as
         0. This does not affect the cluster0 reference count.
      
      3. Only the cpu0.cluster0 is powered down while cluster0 remains
         powered up as it has a non-zero reference count.
      
      4. cpu1.cluster0 call cpu_off to power itself down to highest possible
         affinity level. This decrements the cluster0 reference count.
      
      5. cluster0 is still not powered off since its reference count will at
         least be 1 due to the restriction placed by cpu0.
      
      Change-Id: I433dfe82b946f5f6985b1602c2de87800504f7a9
      75f7367b
    • Achin Gupta's avatar
      psci: preserve target affinity level during suspend · a45e3973
      Achin Gupta authored
      This patch adds support to save and restore the target affinity level
      specified during a cpu_suspend psci call. This ensures that we
      traverse only through the affinity levels that we originally intended
      to after resuming from suspend.
      
      Change-Id: I0900ae49a50b496da137cfec8f158da0397ec56c
      a45e3973
    • Achin Gupta's avatar
      psci: replace secure context with suspend context · a59caa4c
      Achin Gupta authored
      The secure context saved and restored across a cpu_suspend operation
      can be more than just the state of the secure system registers e.g. we
      also need to save the affinity level till which the cpu is being
      powered down. This patch creates a suspend_context data structure
      which includes the system register context. This will allow other bits
      to be saved and restored as well in subsequent patches.
      
      Change-Id: I1c1f7d25497388b54b7d6ee4fab77e8c6a9992c4
      a59caa4c
  8. 17 Jan, 2014 1 commit
  9. 05 Dec, 2013 4 commits
    • Achin Gupta's avatar
      psci: rectify and homogenise generic code · 0959db5c
      Achin Gupta authored
      This patch performs a major rework of the psci generic implementation
      to achieve the following:
      
      1. replace recursion with iteration where possible to aid code
         readability e.g. affinity instance states are changed iteratively
         instead of recursively.
      
      2. acquire pointers to affinity instance nodes at the beginning of a
         psci operation. All subsequent actions use these pointers instead
         of calling psci_get_aff_map_node() repeatedly e.g. management of
         locks has been abstracted under functions which use these pointers
         to ensure correct ordering. Helper functions have been added to
         create these abstractions.
      
      3. assertions have been added to cpu level handlers to ensure correct
         state transition
      
      4. the affinity level extents specified to various functions have the
         same meaning i.e. start level is always less than the end level.
      
      Change-Id: If0508c3a7b20ea3ddda2a66128429382afc3dfc8
      0959db5c
    • Achin Gupta's avatar
      psci: rework cpu_off assertion and minor cleanups · 3140a9e5
      Achin Gupta authored
      This patch:
      
      1. removes a duplicate assertion to check that the only error
         condition that can be returned while turning a cpu off is
         PSCI_E_DENIED. Having this assertion after calling
         psci_afflvl_off() is sufficient.
      
      2. corrects some incorrect usage of 'its' vs 'it is'
      
      3. removes some unwanted white spaces
      
      Change-Id: Icf014e269b54f5be5ce0b9fbe6b41258e4ebf403
      3140a9e5
    • Achin Gupta's avatar
      psci: fix error due to a non zero context id · c8afc789
      Achin Gupta authored
      In the previous psci implementation, the psci_afflvl_power_on_finish()
      function would run into an error condition if the value of the context
      id parameter in the cpu_on and cpu_suspend psci calls was != 0. The
      parameter was being restored as the return value of the affinity level
      0 finisher function. A non zero context id would be treated as an
      error condition. This would prevent successful wake up of the cpu from
      a power down state. Also, the contents of the general purpose
      registers were not being cleared upon return to the non-secure world
      after a cpu power up. This could potentially allow the non-secure
      world to view secure data.
      
      This patch ensures that all general purpose registers are set to ~0
      prior to the final eret that drops the execution to the non-secure
      world. The context id is used to initialize the general purpose
      register x0 prior to re-entry into the non-secure world and is no
      longer restored as a function return value. A platform helper
      (platform_get_stack()) has been introduced to facilitate this change.
      
      Change-Id: I2454911ffd75705d6aa8609a5d250d9b26fa097c
      c8afc789
    • Dan Handley's avatar
      Enable third party contributions · ab2d31ed
      Dan Handley authored
      - Add instructions for contributing to ARM Trusted Firmware.
      
      - Update copyright text in all files to acknowledge contributors.
      
      Change-Id: I9311aac81b00c6c167d2f8c889aea403b84450e5
      ab2d31ed
  10. 25 Oct, 2013 1 commit