1. 20 Jan, 2014 8 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
    • Ryan Harkin's avatar
      fvp: rename fvp_* files to plat_* · 03cb8fbb
      Ryan Harkin authored
      
      
      The FVP platform has a few filenames that begin with fvp_.  These are
      renamed to plat_ to make it easier to use the FVP port as a template.
      
      Change-Id: I601e6256d5ef3bae81a2e1f5df6de56db5b27069
      Signed-off-by: default avatarRyan Harkin <ryan.harkin@linaro.org>
      03cb8fbb
    • Ryan Harkin's avatar
      Build system: add 'make help' option · 72ee3314
      Ryan Harkin authored
      
      
      Add the 'help' target to the Makefile to present a brief guide to the
      various build options available.
      
      Change-Id: Ic3a3489860b6362eb236470ea6b43a16a1b2fe3a
      Signed-off-by: default avatarRyan Harkin <ryan.harkin@linaro.org>
      72ee3314
    • Ryan Harkin's avatar
      Build system: minor spacing tidyup · d7a6b0f8
      Ryan Harkin authored
      
      
      Tidy up the spacing of variable definitions within the makefiles to make
      them more consistent, easier to read and amend.
      
      Change-Id: Ic6d7c8489ca4330824abb5cd1ead8f1d449d1a85
      Signed-off-by: default avatarRyan Harkin <ryan.harkin@linaro.org>
      d7a6b0f8
    • Ryan Harkin's avatar
      Build system: Fixes #2: Add multi-platform support · 25cff83e
      Ryan Harkin authored
      
      
      Move all explicit platform or architecture specific references
      into a new platform.mk file that is defined for each platform.
      
      Change-Id: I9d6320d1ba957e0cc8d9b316b3578132331fa428
      Signed-off-by: default avatarRyan Harkin <ryan.harkin@linaro.org>
      25cff83e
    • Achin Gupta's avatar
      remove empty definition of display_boot_progress() · 5443f2be
      Achin Gupta authored
      This patch replaces the empty definition of display_boot_progress() in
      bl2_main.c with a weak definition. The former allowed bl2 to use the
      early_exceptions(). It is possible to do that with a simple weak
      definition as well.
      
      Change-Id: Idb3f425a5e265f3579b638e3d26bd8c9bb78f80d
      5443f2be
  2. 17 Jan, 2014 8 commits
    • Jeenu Viswambharan's avatar
      Change comments in assembler files to help ctags · 3a4cae05
      Jeenu Viswambharan authored
      Ctags seem to have a problem with generating tags for assembler symbols
      when a comment immediately follows an assembly label.
      
      This patch inserts a single space character between the label
      definition and the following comments to help ctags.
      
      The patch is generated by the command:
      
        git ls-files -- \*.S | xargs sed -i 's/^\([^:]\+\):;/\1: ;/1'
      
      Change-Id: If7a3c9d0f51207ea033cc8b8e1b34acaa0926475
      3a4cae05
    • Harry Liebel's avatar
      Probe for GICv3 re-distributors on core bring-up · eaec590e
      Harry Liebel authored
      The GICv3 distributor can have more ports than CPUs are available in
      the system. Probe all re-distributors and use the matching affinity
      levels as specified by each core and re-distributor to decide which
      re-distributor to use with which CPU core.
      
      If a core cannot be matched with a re-distributor, the core panics and
      is placed in an endless loop.
      
      Change-Id: Ie393cfe07c7449a2383959e3c968664882e18afc
      eaec590e
    • Harry Liebel's avatar
      Do not trap access to floating point registers · 4f603683
      Harry Liebel authored
      Traps when accessing architectural features are disabled by clearing bits
      in CPTR_EL3 during early boot, including accesses to floating point
      registers. The value of this register was previously undetermined, causing
      unwanted traps to EL3. Future EL3 code (for example, context save/restore
      code) may use floating point registers, although they are not used by current
      code.
      
      Also, the '-mgeneral-regs-only' flag is enabled in the GCC settings to
      prevent generation of code that uses floating point registers.
      
      Change-Id: I9a03675f6387bbbee81a6f2c9ccf81150db03747
      4f603683
    • Dan Handley's avatar
      Update year in copyright text to 2014 · e83b0cad
      Dan Handley authored
      Change-Id: Ic7fb61aabae1d515b9e6baf3dd003807ff42da60
      e83b0cad
    • Dan Handley's avatar
      Refer to separate issue tracking repository · 54078850
      Dan Handley authored
      Update documentation to refer to separate issue tracking
      repository, https://github.com/ARM-software/tf-issues/issues.
      
      Change-Id: Ib1cef65b0da420bec58290d8743eb069b1226c96
      54078850
    • Ian Spray's avatar
      Move GIC setup to a separate file · 8468739c
      Ian Spray authored
      GIC setup code which used to be in bl31_plat_setup.c is now in fvp_gic.c
      to simplify future changes to other bootloader stages.  This patch moves
      code from bl31_plat_setup.c to fvp_gic.c, simplifies the include file
      list for bl31_plat_setup.c, moves GIC declarations from the bl31.h header
      file into the platform.h, and reworks files according to coding style
      guide.
      
      Change-Id: I48d82a4ba33e7114dcc88f9ca98767a06cf8f417
      8468739c
    • Harry Liebel's avatar
      Build project with 'pedantic' · e22fb91e
      Harry Liebel authored
      Tighten up ISO C standard checking. Fix 'CASSERT' implementation to
      conform to C99 as opposed to GNU99 standard.
      
      Change-Id: I58ddc61913617b66f11da5b6e3f7363136d5cf7d
      e22fb91e
    • Harry Liebel's avatar
      Do not let GCC use built-in functions · 0af6d64d
      Harry Liebel authored
      In order to reduce the software dependency on the compiler, the project
      is now compiled with the '-ffreestanding' flag. This is to prevent GCC
      from replacing functions with more optimised versions. An example is
      where GCC replaces a simple printf() with a puts().
      
      Change-Id: I1973fe6957cd708e8432a0039af9d50e037bd884
      0af6d64d
  3. 20 Dec, 2013 6 commits
    • Sandrine Bailleux's avatar
      Fix SPSR register size in gp_regs structure · bdb774df
      Sandrine Bailleux authored
      SPSR is a 32-bit register and so its size should be reflected in
      the gp_regs structure.  This patch fixes the type of gp_regs.spsr
      to use a 32-bit variable.  It also makes the size of the other
      register fields more explicit.
      
      Change-Id: I27e0367df1a91cc501d5217c1b3856d4097c60ba
      bdb774df
    • Harry Liebel's avatar
      Local C library documentation updates · a960f282
      Harry Liebel authored
      - Update porting guide to describe where files live and how to get
        FreeBSD source code.
      - Update change-log to describe relocation and new functions.
      
      Change-Id: Id8f30cc7bafdd1064b3a5c5aae958c5aa3fb79f3
      a960f282
    • Harry Liebel's avatar
      Add strchr() and putchar() to local C library · 1bc9e1f6
      Harry Liebel authored
      Change-Id: I3659e119a242f8ef828e32bfdf5d0b4b7ac4f716
      1bc9e1f6
    • Harry Liebel's avatar
      Create local C library implementation (2/2) · 0f702c6e
      Harry Liebel authored
      - This change is split into two separate patches in order to
        simplify the history as interpreted by 'git'. The split is
        between the move/rename and addition of new files.
      - Remove dependency on toolchain C library headers and functions in
        order to ensure behavioural compatibility between toolchains.
      - Use FreeBSD as reference for C library implementation.
      - Do not let GCC use default library include paths.
      - Remove unused definitions in modified headers and implementations.
      - Move C library files to 'lib/stdlib' and 'include/stdlib'.
      - Break std.c functions out into separate files.
      
      Change-Id: I3e3d8d992052264d2a02489034ae4c03bf0f5512
      0f702c6e
    • Harry Liebel's avatar
      Create local C library implementation (1/2) · c81b1d0f
      Harry Liebel authored
      - This change is split into two separate patches in order to
        simplify the history as interpreted by 'git'. The split is
        between the move/rename and addition of new files.
      - Remove dependency on toolchain C library headers and functions in
        order to ensure behavioural compatibility between toolchains.
      - Use FreeBSD as reference for C library implementation.
      - Do not let GCC use default library include paths.
      - Remove unused definitions in modified headers and implementations.
      - Move C library files to 'lib/stdlib' and 'include/stdlib'.
      - Break std.c functions out into separate files.
      
      Change-Id: I91cddfb3229775f770ad781589670c57d347a154
      c81b1d0f
    • Harry Liebel's avatar
      Add debug macros · 57bb6581
      Harry Liebel authored
      - Add 'debug.h' with INFO, WARN and ERROR macros.
      - This prints the specified message with the appropriate tag.
      - INFO and WARN messages are only displayed when building with
        the DEBUG flag set. Error messages are always printed.
      
      Change-Id: I21835b6063fcc99649b30ac7489387cbd3705bc0
      57bb6581
  4. 12 Dec, 2013 4 commits
    • Sandrine Bailleux's avatar
      Make BL31's ns_entry_info a single-cpu area · 93ca221c
      Sandrine Bailleux authored
      ns_entry_info used to be a per-cpu array.  This is a waste of space
      because it is only accessed by the primary CPU on the cold boot path.
      This patch reduces ns_entry_info to a single-cpu area.
      
      Change-Id: I647c70c4e76069560f1aaad37a1d5910f56fba4c
      93ca221c
    • Sandrine Bailleux's avatar
      BL2: Sanity check value in x0 in the entry point code · 34edaed5
      Sandrine Bailleux authored
      Change-Id: Icef68e314e6ba0f3694189b57f4b1dbbea5ba255
      34edaed5
    • Sandrine Bailleux's avatar
      Move RUN_IMAGE constant from bl1.h to bl_common.h · ba6980a8
      Sandrine Bailleux authored
      RUN_IMAGE constant is used by all bootloader stages.
      
      Change-Id: I1b4e28d8fcf3ad1363f202c859f5efab0f320efe
      ba6980a8
    • Sandrine Bailleux's avatar
      Remove useless copies of meminfo structures · ee12f6f7
      Sandrine Bailleux authored
      Platform setup code has to reserve some memory for storing the
      memory layout information.  It is populated in early platform setup
      code.
      
      blx_get_sec_mem_layout() functions used to return a copy of this
      structure.  This patch modifies blx_get_sec_mem_layout() functions
      so that they now directly return a pointer to their memory layout
      structure.  It ensures that the memory layout returned by
      blx_get_sec_mem_layout() is always up-to-date and also avoids a
      useless copy of the meminfo structure.
      
      Also rename blx_get_sec_mem_layout() to blx_plat_sec_mem_layout()
      to make it clear those functions are platform specific.
      
      Change-Id: Ic7a6f9d6b6236b14865ab48a9f5eff545ce56551
      ee12f6f7
  5. 05 Dec, 2013 13 commits
    • Achin Gupta's avatar
      psci: update docs with status of cpu_suspend api · dc98e537
      Achin Gupta authored
      This patch makes changes to the documents to reflect the current
      state of play of the psci cpu_suspend function.
      
      Change-Id: I086509fb75111b6e9f93b7f6dbcd33cc4591b9f3
      dc98e537
    • 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
      remove check on non-secure entrypoint parameter · 2d94d4a0
      Achin Gupta authored
      In fvp_affinst_on/suspend, the non-secure entrypoint is always
      expected to lie in the DRAM. This check will not be valid if
      non-secure code executes directly out of flash e.g. a baremetal
      test. This patch removes this check.
      
      Change-Id: I0436e1138fc394aae8ff1ea59ebe38b46a440b61
      2d94d4a0
    • Achin Gupta's avatar
      move timer #defines & remove duplicate declaration · c2b43afc
      Achin Gupta authored
      This patch removes the duplicate declaration of psci_cpu_on in psci.h
      and moves the constants for the system level implementation of the
      generic timer from arch_helpers.h to arch.h. All other architectural
      constants are defined in arch.h so there is no need to add them to
      arch_helpers.h
      
      Change-Id: Ia8ad3f91854f7e57fce31873773eede55c384ff1
      c2b43afc
    • 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
    • Achin Gupta's avatar
      psci: fix values of incorrectly defined constants · 994dfceb
      Achin Gupta authored
      This patch fixes the following constant values in the psci.h:
      
      1. The affinity level shift value in the power_state parameter of the
         cpu_suspend psci call. The previous value was preventing shutdown
         of the affinity level 1.
      
      2. The values used for affinity state constants (ON, OFF,
         ON_PENDING). They did not match the values expected to be returned
         by the affinity_info psci api as mentioned in the spec.
      
      3. The state id shift value in the power_state parameter of the
         cpu_suspend psci call.
      
      Change-Id: I62ed5eb0e9640b4aa97b93923d6630e6b877a097
      994dfceb
    • Achin Gupta's avatar
      clear wakeup enable bit upon resuming from suspend · b127cdb8
      Achin Gupta authored
      The FVP specific code that gets called after a cpu has been physically
      powered on after having been turned off or suspended earlier does not
      clear the PWRC.PWKUPR.WEN bit. Not doing so causes problems if: a cpu
      is suspended, woken from suspend, powered down through a cpu_off call
      & receives a spurious interrupt. Since the WEN bit is not cleared
      after the cpu woke up from suspend, the spurious wakeup will power the
      cpu on. Since the cpu_off call clears the jump address in the mailbox
      this spurious wakeup will cause the cpu to crash.
      
      This patch fixes this issue by clearing the WEN bit whenever a cpu is
      powered up.
      
      Change-Id: Ic91f5dffe1ed01d76bc7fc807acf0ecd3e38ce5b
      b127cdb8
    • Achin Gupta's avatar
      rework general purpose registers save and restore · 4a826dda
      Achin Gupta authored
      The runtime exception handling assembler code used magic numbers for
      saving and restoring the general purpose register context on stack
      memory. The memory is interpreted as a 'gp_regs' structure and the
      magic numbers are offsets to members of this structure. This patch
      replaces the magic number offsets with constants. It also adds compile
      time assertions to prevent an incorrect assembler view of this
      structure.
      
      Change-Id: Ibf125bfdd62ba3a33e58c5f1d71f8c229720781c
      4a826dda
    • 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
    • Sandrine Bailleux's avatar
      Update user guide further to linker scripts changes · cd29b0a6
      Sandrine Bailleux authored
      This patch updates the user guide section about the memory layout.
        - Explain the verifications that the linker scripts does on the
          global memory layout.
        - Refer to the new linker symbols.
        - Describe the linker symbols exported to the trusted firmware code.
      
      Change-Id: I033ab2b867e8b9776deb4185b9986bcb8218f286
      cd29b0a6
    • Sandrine Bailleux's avatar
      Properly initialise the C runtime environment · 65f546a1
      Sandrine Bailleux authored
      This patch makes sure the C runtime environment is properly
      initialised before executing any C code.
      
        - Zero-initialise NOBITS sections (e.g. the bss section).
        - Relocate BL1 data from ROM to RAM.
      
      Change-Id: I0da81b417b2f0d1f7ef667cc5131b1e47e22571f
      65f546a1
    • Sandrine Bailleux's avatar
      Various improvements/cleanups on the linker scripts · 8d69a03f
      Sandrine Bailleux authored
        - Check at link-time that bootloader images will fit in memory
          at run time and that they won't overlap each other.
        - Remove text and rodata orphan sections.
        - Define new linker symbols to remove the need for platform setup
          code to know the order of sections.
        - Reduce the size of the raw binary images by cutting some sections
          out of the disk image and allocating them at load time, whenever
          possible.
        - Rework alignment constraints on sections.
        - Remove unused linker symbols.
        - Homogenize linker symbols names across all BLs.
        - Add some comments in the linker scripts.
      
      Change-Id: I47a328af0ccc7c8ab47fcc0dc6e7dd26160610b9
      8d69a03f
  6. 27 Nov, 2013 1 commit