Bryan O'Donoghue [Wed, 4 Jul 2018 12:16:35 +0000 (13:16 +0100)]
warp7: panic: hab: Call into BootROM failsafe on panic path
This patch adds a callback into the BootROM's provided High Assurance Boot
(HAB) failsafe function when panicking i.e. the call is done without making
use of stack.
The HAB failsafe function allows a piece of software to call into the
BootROM and place the processor into failsafe mode.
Failsafe mode is a special mode which presents a serial download protocol
interface over UART or USB at the time of writing.
If the board has been set into secure mode, then only a signed binary can
be used to recover the board.
Thus failsafe gives a putatively secure method of performing a secure
recovery over UART or USB.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Ryan Harkin <ryan.harkin@linaro.org>
Bryan O'Donoghue [Mon, 11 Jun 2018 12:39:20 +0000 (13:39 +0100)]
warp7: mem_params_desc: Add boot entries to mem params array
This patch adds entries to the mem params array for
- BL32
- BL32_EXTRA1
- BL32_EXTRA2
- BL33
- HW_CONFIG_ID
BL32 is marked as bootable to indicate that OPTEE is the thing that should
be booted next.
In our model OPTEE chain-loads onto u-boot so only BL32 is bootable.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Thu, 24 May 2018 12:00:57 +0000 (13:00 +0100)]
warp7: io_storage: Add initial stub warp7_io_storage.c
This commit adds support for parsing a FIP pre-loaded by a previous
boot-phase such as u-boot or via ATF reading directly from eMMC.
[bod: squashing several patches from Rui, Jun and bod]
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Fri, 25 May 2018 16:54:01 +0000 (17:54 +0100)]
warp7: Define a platform_def.h
This patch defines a platform_def.h describing
- FIP layout and location
- eMMC device select
- UART identity select
- System clock frequency
- Operational memory map
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Fri, 25 May 2018 16:20:50 +0000 (17:20 +0100)]
warp7: mem_params_desc: Add a file which exports a REGISTER_BL_IMAGE_DESCS
In order to link even a basic image we need to declare
REGISTER_BL_IMAGE_DESCS. This patch declares an empty structure which is
passed to REGISTER_BL_IMAGE_DESCS(). Later patches will add in some
meaningful data.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Fri, 25 May 2018 16:18:56 +0000 (17:18 +0100)]
warp7: Add a warp7_private.h file
Internal declarations for the WaRP7 port will go here. For now just include
sys/types.h.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Thu, 24 May 2018 18:38:11 +0000 (19:38 +0100)]
warp7: image_load: Add warp7_image_load.c
This commit adds warp7_image_load.c with the functions
- plat_flush_next_bl_params()
- plat_get_bl_image_load_info()
- plat_get_next_bl_params()
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Thu, 24 May 2018 18:32:52 +0000 (19:32 +0100)]
warp7: Add initial warp7_helpers.S
This commit adds a warp7_helpers.S which contains a implementation of:
- platform_mem_init
- plat_get_my_entrypoint
- plat_crash_console_init
- plat_crash_console_putc
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Fri, 25 May 2018 15:45:27 +0000 (16:45 +0100)]
imx: imx_wdog: Add code to initialize the wdog block
The watchdog block on the IMX is mercifully simple. This patch maps the
various registers and bits associated with the block.
We are mostly only really interested in the power-down-enable (PDE) bits in
the block for the purposes of ATF.
The i.MX7 Solo Applications Processor Reference Manual details the PDE bit
as follows:
"Power Down Enable bit. Reset value of this bit is 1, which means the power
down counter inside the WDOG is enabled after reset. The software must
write 0 to this bit to disable the counter within 16 seconds of reset
de-assertion. Once disabled this counter cannot be enabled again. See
Power-down counter event for operation of this counter."
This patch does that zero write in-lieu of later phases in the boot
no-longer have the necessary permissions to rewrite the PDE bit directly.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Wed, 11 Jul 2018 15:35:17 +0000 (16:35 +0100)]
imx: imx_caam: Add code to initialize the CAAM job-rings to NS-world
This patch defines the most basic part of the CAAM and the only piece of
the CAAM silicon we are really interested in, in ATF, the CAAM control
structure.
The CAAM itself is a huge address space of some 32k, way out of scope for
the purpose we have in ATF.
This patch adds a simple CAAM init function that assigns ownership of the
CAAM job-rings to the non-secure MID with the ownership bit set to
non-secure.
This will allow later logic in the boot process such as OPTEE, u-boot and
Linux to assign job-rings as appropriate, restricting if necessary but
leaving open the main functionality of the CAAM to the Linux NS runtime.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Tue, 3 Jul 2018 14:07:32 +0000 (15:07 +0100)]
imx: imx_hab: Define a HAB header file
The High Assurance Boot or HAB is an on-chip method of providing a
root-of-trust from the reset vector to subsequent stages in the bootup
flow of the Cortex-A7 on the i.MX series of processors.
This patch adds a simple header file with pointer offsets of the provided
set of HAH API callbacks in the BootROM.
The relative offset of the function pointers is a constant and known
quantum, a software-contract between NXP and an implementation which is
defined in the NXP HAB documentation.
All we need is the correct base offset and then we can map the set of
function pointers relative to that offset.
imx_hab_arch.h provides the correct offset and the imx_hab.h hooks the
offset to the pre-determined callbacks.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Ryan Harkin <ryan.harkin@linaro.org>
Bryan O'Donoghue [Tue, 3 Jul 2018 14:11:33 +0000 (15:11 +0100)]
imx7: hab_arch: Provide a hab_arch.h file
In order to enable compile time differences in HAB interaction, we should
split out the definition of the base address of the HAB API.
Some version of the i.MX series have different offsets from the BootROM
base for the HAB callback table.
This patch defines the header into which we will define the i.MX7 specific
offset. The offset of the i.MX7 function-callback table is simultaneously
defined.
Once done, we can latch a set of common function pointer locations from the
offset given here and if necessary change the offset for different
processors without any other code-change.
For now all we support is i.MX7 so the only offset being defined is that
for the i.MX7.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Ryan Harkin <ryan.harkin@linaro.org>
Bryan O'Donoghue [Fri, 25 May 2018 15:52:03 +0000 (16:52 +0100)]
imx: imx_snvs: Add an SNVS core functionality
This patch adds snvs.c with a imx_snvs_init() function.
imx_snvs_init() sets up permissions of the RTC via the SNVS HPCOMR.
During previous work with OPTEE on the i.MX7 part we discovered that prior
to switching from secure-world to normal-world it is required to apply more
permissive permissions than are defaulted to in order for Linux to be able
to access the RTC and CAAM functionality in general.
This patch pertains to fixing the RTC permissions by way of the
HPCOMR.NPSWA_EN bit.
Once set non-privileged code aka Linux-kernel code has permissions to
access the SNVS where the RTC resides.
Perform that permissions fix in imx_snvs_init() now, with a later patch making
the call from our platform setup code.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Mon, 25 Jun 2018 12:15:10 +0000 (13:15 +0100)]
imx: imx_snvs: Define a SNVS header and memory map
This commit defines two things.
- The basic SNVS memory map. At the moment that is total overkill for the
permission bits we need to set inside the SNVS but, for the sake of
completeness define the whole SNVS area as a struct.
- The bits of the HPCOMR register
A permission fix will need to be applied to the SNVS block prior to
switching on TrustZone. All we need to do is waggle a bit in the HPCOMR
register. To do that waggle we first need to define the bits of the
HPCOMR register.
- A imx_snvs_init() function definition
Declare the snvs_init() function so that it can be called from our
platform setup code.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Fri, 25 May 2018 15:56:52 +0000 (16:56 +0100)]
imx: imx_csu: Add a simple CSU layer
- Add a header to define imx_csu_init().
- Defines the Central Security Unit's Config Security Level
permission bits.
- Define CSU_CSL_OPEN_ACCESS permission bitmask
- Run a loop to setup peripheral CSU permissions
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Fri, 25 May 2018 15:43:22 +0000 (16:43 +0100)]
imx: imx_aips: Add initial AIPS support
This patch adds an initial AHB-to-IP TrustZone (AIPS-TZ) initialization
routine. Setting up the AIPSTZ controller is required to inform the SoC
interconnect fabric which bus-masters can read/write and if the read/writes
are buffered.
For our purposes the initial configuration is for everything to be open. We
can lock-down later on as necessary.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Wed, 20 Jun 2018 15:56:31 +0000 (16:56 +0100)]
imx: imx_io_mux: Define an IO-mux layer
This patch defines:
- The full range of IO-mux register offsets relative to the base address of
the IO-mux block base address.
- The bits for muxing the UART1 TX/RX lines.
- The bits for muxing the UART6 TX/RX lines.
- The pad control pad bits for the UART
Two functions are provided to configure pad muxes:
- void io_muxc_set_pad_alt_function(pad_mux_offset, alt_function)
Takes a pad_mux_offset and sets the alt_function bit-mask supplied.
This will have the effect of switching the pad into one of its defined
peripheral functions. These peripheral function modes are defined in the
NXP documentation and need to be referred to in order to correctly
configure a new alternative-function.
- void io_muxc_set_pad_features(pad_feature_offset, pad_features)
Takes a pad_feature_offset and applies a pad_features bit-mask to the
indicated pad.
This function allows the setting of PAD drive-strength, pull-up values,
hysteresis glitch filters and slew-rate settings.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Fri, 27 Jul 2018 14:03:51 +0000 (15:03 +0100)]
imx7: imx7_clock: usb: Initialize the USB core clocks
This patch initializes USB core clocks for the i.MX7.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Fri, 27 Jul 2018 13:53:43 +0000 (14:53 +0100)]
imx7: imx7_clock: wdog: Initialize the watchdog clocks
This patch initializes the watchdog clocks for the i.MX7.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Fri, 8 Jun 2018 12:16:29 +0000 (13:16 +0100)]
imx7: imx7_clock: uart: Add UART clock init logic
This patch adds an internal UART init routine that gets called from the
external facing clock init function.
In the first pass this call does an explicit disable of all UART
clock-gates. Later changes will enable only the UART clock-gates we care
about.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Mon, 16 Jul 2018 17:21:19 +0000 (18:21 +0100)]
imx: imx_clock: usb: Add USB clock API
This set of patches adds a very minimal layer of USB enabling patches to
clock.c. Unlike the watchdog or UART blocks the USB clocks pertain to PHYs,
the main USB clock etc, not to different instances of the same IP block.
As a result this patch-set takes the clock CCGR clock identifier directly
rather than as an index of an instance of blocks of the same type.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Fri, 13 Jul 2018 09:21:40 +0000 (10:21 +0100)]
imx: imx_clock: wdog: Add watchdog clock API
This patch adds a set of functions to enable the clock for each of the
watchdog IP blocks.
Unlike the MMC and UART blocks, the watchdog blocks operate off of the one
root clock, only the clock-gates are enable/disabled individually.
As a consequence the function clock_set_wdog_clk_root_bits() is used to set
the root-slice just once for all of the watchdog blocks.
Future implementations may need to change this model but for now on the one
supported processor and similar NXP SoCs this model should work fine.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Jun Nie [Thu, 28 Jun 2018 08:38:11 +0000 (16:38 +0800)]
imx: imx_clock: mmc: Add USDHC clock API
This patch adds an API to configure up the base USDHC clocks, taking a
bit-mask of silicon specific bits as an input from a higher layer in order
to direct the necessary clock source.
Signed-off-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Wed, 30 May 2018 18:56:54 +0000 (19:56 +0100)]
imx: imx_clock: uart: Add UART clock API
This patch adds an API to configure up the base UART clocks, taking a
bit-mask of silicon specific bits as an input from a higher layer in order
to direct the necessary clock source.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Fri, 25 May 2018 15:48:39 +0000 (16:48 +0100)]
imx: imx_clock: Add driver and associated clock register definitions
This commit:
- Defines a clock stub with a conjoined header defining the clock
memory map.
- Defines the CCM Clock Gating Register which comes in a quadrumvirate
register set to read, set, clear and toggle individual clock gates into
one of four states based bitmask.
00: Domain clocks not needed
01: Domain clocks needed when in RUN
10: Domain clocks needed when in RUN and WAIT
11: Domain clocks needed all the time
- Defines clock control register bits
There are various quadrumvirate register blocks target-root, misc-root,
post-root, pre-root in the CCM.
The number of registers is huge but the four registers in each
quadrumvirate block contain the same bits, so the number of bit
definitions is actually quite low.
- Defines clock identifiers
An array of clock gates is provided in the CCM block. In order to index
that array and thus enable/disable clock gates for the right components,
we need to provide meaningful names to the indices.
Section 5.2.5 of the i.MX7 Solo Application Processor Reference Manual
Rev 0.1 provides the relevant details.
- Defines target mux select bits
This is a comprehensive definition of the target clock mux select bits.
These bits are required to correctly select the clock source. Defining
all of the bits up-front even for unused blocks in ATF means we can
switch on any block we want at a later date without having to write new
code in the clock-mux layer.
- Defines identifier indices into root-slice array
The root-slice array of control registers has a specific set of indices,
which differ from the clock-gate indices.
- Provides a clock gate enable/disable routine
Provides a clock-gate enable/disable routine via the set/clr
registers in a given clock-gate control register block.
This index passed should be one of the enums associated with CCM and
depending on enable/disable being passed either set or clr will be
written to.
The Domain0 bits are currently the only bits targeted by this write, more
work may need to be done on the domain bits in subsequent patches as a
result.
- imx: Adds set/clr routines to clock layer
Adds a set and clr routine to the clock layer. These routines allow us to
access the set and clear registers of the "target" block registers. These
are the registers where we select the clock source from the available list.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Fri, 25 May 2018 15:05:20 +0000 (16:05 +0100)]
imx7: imx_regs: Add a shared imx-regs.h for i.MX7 ATF platforms
In order to have some common code shared between similar SOCs its pretty
common to have IP blocks reused. In reusing those blocks we frequently need
to map compatible blocks to different addresses depending on the SOC.
This patch adds a basic memory map of the i.MX7 based on the "Cortex-A7
Memory Map" section 2.12 of "i.MX7Solo Applications Processor Reference
Manual, Rev 0.1 08/2016"
In memory map terms the i.MX7S and i.MX7D are identical with the D
variant containing two Cortex-A7 cores plus a Cortex-M core and the S
variant containing one Cortex-A7 and one Cortex-M.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Jun Nie [Thu, 28 Jun 2018 08:38:02 +0000 (16:38 +0800)]
drivers: imx: mxc_usdhc: Add USDHC driver to support boot EMMC
Add USDHC driver to support boot EMMC. Only initialization
and single/multiple block read are tested.
[bod: fixed checkpatch.pl complaints]
[bod: changed name to imx_usdhc for namespace consistency]
[bod: squashed antecedent fixes into this one patch]
Signed-off-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Wed, 15 Aug 2018 15:25:30 +0000 (16:25 +0100)]
drivers: mmc: Add missing response type for some commands
Add missing response type for SWITCH command and STOP_TRANSMISSION
so that controller can be configured accordingly.
[bod: ported this change from Jun's eMMC patches to the MMC driver]
Signed-off-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Wed, 15 Aug 2018 14:59:07 +0000 (15:59 +0100)]
drivers: mmc: Fix R3 response type definition
The R3 response type definition should be (1 << 0). Make sure we define the
expected response code in the appropriate fashion.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Jun Nie [Thu, 28 Jun 2018 08:38:00 +0000 (16:38 +0800)]
drivers: emmc: dw_mmc: Add response flag into response ID definition
Add response flag into ID definition so that driver does not
need to handle it again.
Signed-off-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Jun Nie [Wed, 4 Jul 2018 07:51:20 +0000 (15:51 +0800)]
drivers: imx: imx_gpt: Add general purpose timer API binding
Add delay timer API so that it can be called by delay timer
layer and used as delay timer globally.
[bod: changed name from imx_delay_timer -> imx_gpt ]
Signed-off-by: Jun Nie <jun.nie@linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Fri, 25 May 2018 16:35:09 +0000 (17:35 +0100)]
drivers: imx: crash-console: Add a mxc_crash_console driver
This patch does two main things
- It implements the crash console UART init in assembly, as a
hard-coded 115200 8N1 assumed from the 24 MHz clock.
If the clock setup code has not run yet, this code can't work but,
setting up clocks and clock-gates is way out of scope for this type of
recovery function.
- It adds code to write a character out of the NXP UART without using any
stack-based operations when doing so.
- Provides support for crash console in DCE or DTE mode.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Bryan O'Donoghue [Fri, 25 May 2018 16:36:56 +0000 (17:36 +0100)]
drivers: imx: uart: Add mxc_console
- Adds a simple register read/write abstraction to cut-down on the
amount of typing and text required to access UART registers in this driver.
- Adds a console getc() callback.
- Adds a console putc() callback, translating '\n' to '\r' + '\n'.
- Initializes the MXC UART, take a crude method of calculating the
BAUD rate generator. The UART clock-gates must have been enabled prior
to launching the UART init code.
Special care needs to be taken to ensure the UBIR is initialized before the
UBMR and we need to ensure that UCR2.SRST comes good before trying to
program other registers associated with the UART.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Dimitris Papastamos [Thu, 30 Aug 2018 15:55:05 +0000 (16:55 +0100)]
Merge pull request #1546 from antonio-nino-diaz-arm/an/log-misra
Fix some MISRA defect in log helpers
Antonio Nino Diaz [Tue, 28 Aug 2018 10:44:44 +0000 (11:44 +0100)]
Fix MISRA defects in log helpers
No functional changes.
Change-Id: I850f08718abb69d5d58856b0e3de036266d8c2f4
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Thu, 23 Aug 2018 14:11:46 +0000 (15:11 +0100)]
libc: Fix some MISRA defects
No functional changes.
Change-Id: I907aa47565af2a6c435a5560041fd2b59e65c25c
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Dimitris Papastamos [Thu, 30 Aug 2018 15:18:49 +0000 (16:18 +0100)]
Merge pull request #1542 from antonio-nino-diaz-arm/an/bl31-misra
Some MISRA fixes in BL31, cci and smmu
Dimitris Papastamos [Thu, 30 Aug 2018 15:09:30 +0000 (16:09 +0100)]
Merge pull request #1544 from jwerner-chromium/JW_handle_ea
context_mgmt: Fix HANDLE_EA_EL3_FIRST implementation
Dimitris Papastamos [Thu, 30 Aug 2018 15:08:25 +0000 (16:08 +0100)]
Merge pull request #1539 from antonio-nino-diaz-arm/an/gic-misra
MISRA fixes for the GIC driver
Dimitris Papastamos [Thu, 30 Aug 2018 15:08:12 +0000 (16:08 +0100)]
Merge pull request #1535 from antonio-nino-diaz-arm/an/backtrace
Introduce backtrace function
Antonio Nino Diaz [Thu, 23 Aug 2018 09:19:23 +0000 (10:19 +0100)]
drivers: cci: Fix MISRA defects
Change-Id: Ifdb0ceec19d267b14d796b5d31f08f7342190484
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Tue, 21 Aug 2018 15:12:29 +0000 (16:12 +0100)]
drivers: smmu: Fix MISRA defects
Change-Id: I2954a99d5b72069bcb7bac9d6926c6209d6ba881
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Tue, 21 Aug 2018 13:14:31 +0000 (14:14 +0100)]
Fix MISRA defects in some common headers
Change-Id: I8fbb4c785e7e07c7241e0c399a9b65161985c9df
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Fri, 24 Aug 2018 15:30:29 +0000 (16:30 +0100)]
Fix MISRA defects in BL31 common code
Change-Id: I5993b425445ee794e6d2a792c244c0af53640655
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Tue, 21 Aug 2018 08:42:26 +0000 (09:42 +0100)]
plat/arm: gic: Fix macros
Change-Id: I130e35d55c474ecd80f9a825be23620d5bc1a715
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Tue, 21 Aug 2018 08:44:43 +0000 (09:44 +0100)]
plat/common: gic: MISRA fixes
Change-Id: I11509a3271d7608048d49e7dd5192be0c2a313f0
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Tue, 21 Aug 2018 09:03:07 +0000 (10:03 +0100)]
gic v3: Fix width of types of helper functions
Change-Id: I08447b44fffb6e54f9fab957eee369ccbda4247a
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Tue, 21 Aug 2018 09:02:33 +0000 (10:02 +0100)]
gic: Fix types
Change-Id: I6a2adef87c20f9279446a54b7e69618fba3d2a25
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Fri, 24 Aug 2018 10:46:33 +0000 (11:46 +0100)]
gic: Fix definitions
Change-Id: I945029ca26ea2e63f0d92c5f33019b882f23bd72
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Mon, 13 Aug 2018 14:29:29 +0000 (15:29 +0100)]
gic v3: Turn macros into static inline functions
Change-Id: Ib587f12f36810fc7d4f4b8f575195554299b8ed4
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Thu, 23 Aug 2018 14:13:58 +0000 (15:13 +0100)]
backtrace: Print backtrace in assert() and panic()
When any of these functions is called the backtrace will be printed to
the console.
Change-Id: Id60842df824b320c485a9323ed6b80600f4ebe35
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Douglas Raillard [Tue, 21 Aug 2018 11:54:45 +0000 (12:54 +0100)]
backtrace: Introduce backtrace function
This function diplays the backtrace, the current EL and security state
to allow a post-processing tool to choose the right binary to interpret
the dump.
The output can be fed to GNU addr2line to resolve function names given
an ELF binary compiled with debug information. The "-i" flag is
recommended to improve display in case of inlined functions. The *.dump
files generated during the build process can also be used.
The function works in AArch64 and AArch32. In AArch32 it only works in
A32 mode (without T32 interworking), which is enforced in the Makefile.
Sample output of a backtrace at EL3:
BACKTRACE: START: function_name
0: EL3: 0x798
1: EL3: 0x538
2: EL3: 0x550
3: EL3: 0x55c
4: EL3: 0x568
5: EL3: 0x5a8
6: EL3: 0xf4
BACKTRACE: END: function_name
In order to enable it the new option ENABLE_BACKTRACE must be set to 1.
This option is set to 1 by default only in AArch64 debug builds. As
usual, it can be overridden by the platform makefile and in the build
command line.
Change-Id: Icaff39b0e5188329728be2f3c72b868b2368e794
Co-authored-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
Antonio Nino Diaz [Wed, 8 Aug 2018 15:28:43 +0000 (16:28 +0100)]
Allow manually setting the AArch32 instruction set
At the moment the AArch32 instruction set isn't specified in the command
line, which means that the compiler is free to choose the one it sees
fit. This decision may change between compiler versions, so it is better
to specify it manually.
The build option AARCH32_INSTRUCTION_SET has been introduced for this
reason. This option can be set to T32 or A32 to pass the correct flags
to the compiler.
The current behaviour is to default to T32 due to it's smaller size.
Change-Id: I02297eb1d9404b5868ff7c054fbff9b3cda7fdb6
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Soby Mathew [Thu, 30 Aug 2018 04:37:32 +0000 (05:37 +0100)]
Merge pull request #1545 from npoushin/integration
maintainers: Update maintainer for sgi/sgm platforms
Soby Mathew [Thu, 30 Aug 2018 04:37:13 +0000 (05:37 +0100)]
Merge pull request #1514 from glneo/for-upstream-psci
K3 PSCI Support
Julius Werner [Tue, 28 Aug 2018 21:45:43 +0000 (14:45 -0700)]
context_mgmt: Fix HANDLE_EA_EL3_FIRST implementation
This patch fixes a bug in the context management code that causes it to
ignore the HANDLE_EA_EL3_FIRST compile-time option and instead always
configure SCR_EL3 to force all external aborts to trap into EL3. The
code used #ifdef to read compile-time option declared with add_define in
the Makefile... however, those options are always defined, they're just
defined to either 0 or 1, so #if is the correct syntax to check for
them. Also update the documentation to match.
This bug has existed since the Nov 2017 commit
76454abf4 (AArch64:
Introduce External Abort handling), which changed the
HANDLE_EA_EL3_FIRST option to use add_define.
Change-Id: I7189f41d0daee78fa2fcf4066323e663e1e04d3d
Signed-off-by: Julius Werner <jwerner@chromium.org>
Nariman Poushin [Wed, 29 Aug 2018 15:27:52 +0000 (16:27 +0100)]
maintainers: Update maintainer for sgi/sgm platforms
Dimitris Papastamos [Tue, 28 Aug 2018 09:18:17 +0000 (10:18 +0100)]
Merge pull request #1543 from Yann-lms/drivers_st
maintainers: add drivers folders for STM32MP1
Dimitris Papastamos [Tue, 28 Aug 2018 09:07:21 +0000 (10:07 +0100)]
Merge pull request #1538 from jts-arm/typos
Remove unnecessary casts
Dimitris Papastamos [Tue, 28 Aug 2018 09:07:02 +0000 (10:07 +0100)]
Merge pull request #1536 from jts-arm/dsu
DSU erratum 936184 workaround: bug fix
Dimitris Papastamos [Tue, 28 Aug 2018 09:06:00 +0000 (10:06 +0100)]
Merge pull request #1531 from MISL-EBU-System-SW/marvell-plat-updates
plat: marvell: bl31: Update the early platform setup API
Yann Gautier [Tue, 28 Aug 2018 09:01:59 +0000 (11:01 +0200)]
maintainers: add drivers folders for STM32MP1
Folders drivers/st/ and include/drivers/st/ are added in maintainers.rst,
under STM32MP1 platform port.
This will allow notifications for the files modified there.
Signed-off-by: Yann Gautier <yann.gautier@st.com>
John Tsichritzis [Wed, 22 Aug 2018 09:40:33 +0000 (10:40 +0100)]
DSU erratum 936184 workaround: bug fix
The initial implementation was corrupting registers that it shouldn't.
Now this is fixed.
Change-Id: Iaa407c18e668b2d9381391bf10d6876fe936aded
Signed-off-by: John Tsichritzis <john.tsichritzis@arm.com>
John Tsichritzis [Thu, 23 Aug 2018 08:57:54 +0000 (09:57 +0100)]
Remove unnecessary casts
Small patch which removes some redundant casts to (void *).
Change-Id: If1cfd68f2989bac1d39dbb3d1c31d4119badbc21
Signed-off-by: John Tsichritzis <john.tsichritzis@arm.com>
Andrew F. Davis [Thu, 24 May 2018 16:15:42 +0000 (11:15 -0500)]
ti: k3: common: Add basic PSCI reset support
Use TI-SCI messages to request reset from system controller firmware.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Andrew F. Davis [Thu, 24 May 2018 16:15:42 +0000 (11:15 -0500)]
ti: k3: common: Add basic PSCI core on support
Use TI-SCI messages to request core start from system controller
firmware.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Andrew F. Davis [Fri, 4 May 2018 19:06:13 +0000 (19:06 +0000)]
ti: k3: drivers: ti_sci: Add support for Processor control
TI-SCI message protocol provides support for controlling of various
physical cores available in the SoC. In order to control which host is
capable of controlling a physical processor core, there is a processor
access control list that needs to be populated as part of the board
configuration data.
Introduce support for the set of TI-SCI message protocol APIs that
provide us with this capability of controlling physical cores.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Andreas Dannenberg <dannenberg@ti.com>
Andrew F. Davis [Fri, 4 May 2018 19:06:12 +0000 (19:06 +0000)]
ti: k3: drivers: ti_sci: Add support for Core control
Since system controller now has control over SoC power management, core
operation such as reset need to be explicitly requested to reboot the SoC.
Add support for this here.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Andreas Dannenberg <dannenberg@ti.com>
Andrew F. Davis [Fri, 4 May 2018 19:06:11 +0000 (19:06 +0000)]
ti: k3: drivers: ti_sci: Add support for Clock control
TI-SCI message protocol provides support for management of various
hardware entities within the SoC.
In general, we expect to function at a device level of abstraction,
however, for proper operation of hardware blocks, many clocks directly
supplying the hardware block needs to be queried or configured.
Introduce support for the set of TI-SCI message protocol support that
provide us with this capability.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Andreas Dannenberg <dannenberg@ti.com>
Andrew F. Davis [Fri, 4 May 2018 19:06:10 +0000 (19:06 +0000)]
ti: k3: drivers: ti_sci: Add support for Device control
TI-SCI message protocol provides support for management of various
hardware entitites within the SoC.
We introduce the fundamental device management capability support to
the driver protocol as part of this change.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Andreas Dannenberg <dannenberg@ti.com>
Andrew F. Davis [Fri, 4 May 2018 19:06:09 +0000 (19:06 +0000)]
ti: k3: drivers: Add support for TI System Control Interface protocol
Texas Instrument's System Control Interface (TI-SCI) Message Protocol
is used in Texas Instrument's System on Chip (SoC) such as those
in K3 family AM654x SoCs to communicate between various compute
processors with a central system controller entity.
TI-SCI message protocol provides support for management of various
hardware entities within the SoC. Add support driver to allow
communication with system controller entity within the SoC.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Andreas Dannenberg <dannenberg@ti.com>
Andrew F. Davis [Fri, 4 May 2018 19:06:08 +0000 (19:06 +0000)]
ti: k3: drivers: Add Secure Proxy driver
Secure Proxy module manages hardware threads that are meant
for communication between the processor entities. Add support
for this here.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Dimitris Papastamos [Wed, 22 Aug 2018 13:40:50 +0000 (14:40 +0100)]
Merge pull request #1528 from antonio-nino-diaz-arm/an/libc
libc: Cleanup library
Antonio Nino Diaz [Thu, 16 Aug 2018 14:42:44 +0000 (15:42 +0100)]
libc: armclang: Implement compiler printf symbols
armclang replaces calls to printf by calls to one of the symbols
__0printf, __1printf or __2printf. This patch adds new functions with
these names that internally call printf so that the Trusted Firmware can
be compiled with this compiler.
Change-Id: I06a0e3e5001232fe5b2577615666ddd66e81eef0
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Thu, 16 Aug 2018 15:46:06 +0000 (16:46 +0100)]
libc: Use printf and snprintf across codebase
tf_printf and tf_snprintf are now called printf and snprintf, so the
code needs to be updated.
Change-Id: Iffeee97afcd6328c4c2d30830d4923b964682d71
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Wed, 15 Aug 2018 16:02:28 +0000 (17:02 +0100)]
libc: Move tf_printf and tf_snprintf to libc
Change their names to printf and snprintf. They are much smaller than
the previous versions we had, which makes them better suited for the
Trusted Firmware.
Change-Id: Ia872af91b7b967c47fce012eccecede7873a3daf
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Wed, 15 Aug 2018 15:52:32 +0000 (16:52 +0100)]
tf_printf: Return number of printed characters
The C standard says that printf() has to return the number of characters
it has printed.
Change-Id: I0ef50b1d6766d140724ac0a2fa2c5d023431f984
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Thu, 16 Aug 2018 15:52:57 +0000 (16:52 +0100)]
libc: Fix all includes in codebase
The codebase was using non-standard headers. It is needed to replace
them by the correct ones so that we can use the new libc headers.
Change-Id: I530f71d9510cb036e69fe79823c8230afe890b9d
Acked-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Tue, 14 Aug 2018 12:39:29 +0000 (13:39 +0100)]
libc: Cleanup SCC headers
Only leave the parts relevant to the Trusted Firmware.
Change-Id: I0444c16e402f6c1629211d03bf6cb32ca3dbcf59
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Wed, 15 Aug 2018 18:51:09 +0000 (19:51 +0100)]
libc: Add AArch32 and AArch64 headers
Change-Id: I4f58bb4660078c9bc76d2826c90b2fa711719a3e
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Fri, 17 Aug 2018 09:45:47 +0000 (10:45 +0100)]
libc: Introduce files from SCC
Taken from http://git.simple-cc.org/scc/ from the following commit:
67508ad14af314cea2229783d3c084f28c41daf0
Permission has been granted from the author to use them under the
license BSD-3-Clause instead of ISC.
Change-Id: I65c0ce3ab60c49d34a57533af12a74bd7bde88e5
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Mon, 13 Aug 2018 18:41:17 +0000 (19:41 +0100)]
libc: Cleanup FreeBSD files
Remove code specific to FreeBSD so that they can be used in this
repository.
Change-Id: I5c11eb5b3c05a7fb91aed08371a1f7a0e6122a94
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Mon, 13 Aug 2018 18:39:40 +0000 (19:39 +0100)]
libc: Import files from FreeBSD
From commit
aafd1cf4235d78ce85b76d7da63e9589039344b3:
- sys/sys/endian.h
- sys/arm/include/endian.h
- sys/arm64/include/endian.h
- sys/sys/errno.h
- lib/libc/strchr.c
- lib/libc/strcmp.c
- lib/libc/strncmp.c
- lib/libc/strnlen.c
strcasecmp() hasn't been imported.
Change-Id: I8a0787aec9ba8960a008fb5c66f7a73c84919b93
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Mon, 13 Aug 2018 18:51:26 +0000 (19:51 +0100)]
libc: Introduce cdefs.h, assert.h and strlen.c
Change-Id: I76091d52571f1950111c4b1670d5fc3883607715
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Thu, 16 Aug 2018 13:53:05 +0000 (14:53 +0100)]
libc: Cleanup remaining files
The existing files had some style problems that this patch fixes.
Change-Id: I794e0d96e52f8da0ffa0d70a41f36c4432b4e563
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Wed, 15 Aug 2018 15:54:55 +0000 (16:54 +0100)]
libc: Remove printf-like functions
They are too big for the Trusted Firmware, and it can be confusing to
have two versions of the same functions with different names. tf_printf
and tf_snprintf will replace them in the next patch.
Change-Id: I978414ac169cc3156e249549ef101a70eb31a295
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Fri, 17 Aug 2018 08:46:43 +0000 (09:46 +0100)]
libc: Remove sscanf() and timingsafe_bcmp()
sscanf() is unused and it doesn't work, so it doesn't make sense to
keep it.
timingsafe_bcmp() isn't used anywhere.
Change-Id: Ib5d28ff21d0f3ccc36c5c0fb5474b3384105cf80
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Tue, 14 Aug 2018 12:17:41 +0000 (13:17 +0100)]
libc: Remove non-Arm files
Remove all files that don't have only Arm copyright. This is the first
step to cleanup the C library in this repository. They will be re-added
in the following patches.
Change-Id: I72c40a1620d1df3228fc397ec695d569a20245fd
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Dimitris Papastamos [Wed, 22 Aug 2018 09:25:41 +0000 (10:25 +0100)]
Merge pull request #1532 from jeenu-arm/misra-fixes
MISRA fixes
Dimitris Papastamos [Wed, 22 Aug 2018 09:24:24 +0000 (10:24 +0100)]
Merge pull request #1533 from jeenu-arm/mpam
AArch64: Enable MPAM for lower ELs
Dimitris Papastamos [Wed, 22 Aug 2018 09:24:06 +0000 (10:24 +0100)]
Merge pull request #1530 from antonio-nino-diaz-arm/an/rpi3-deprecated
rpi3: Migrate from deprecated APIs
Dimitris Papastamos [Wed, 22 Aug 2018 09:23:52 +0000 (10:23 +0100)]
Merge pull request #1526 from robertovargas-arm/arm-memprotect
memprotect: Move files to specific platform makefiles
Roberto Vargas [Mon, 6 Aug 2018 12:35:31 +0000 (13:35 +0100)]
memprotect: Move files to specific platform makefiles
All the arm platforms were including the files related to
mem-protect. This configuration generates some problems
with new platforms that don't support such functionality,
and for that reason this patch moves these files to the
platform specific makefiles.
Change-Id: I6923e5224668b76667795d8e11723cede7979b1e
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
Dimitris Papastamos [Mon, 20 Aug 2018 13:57:39 +0000 (14:57 +0100)]
Merge pull request #1388 from vwadekar/report-cve-2017-5715
cpus: denver: report CVE_2017_5715 mitigation to higher layers
Dimitris Papastamos [Mon, 20 Aug 2018 08:38:17 +0000 (09:38 +0100)]
Merge pull request #1524 from danielboulby-arm/db/ReclaimInit
rockchip: Add plat_is_my_cpu_primary function
Dimitris Papastamos [Mon, 20 Aug 2018 08:37:16 +0000 (09:37 +0100)]
Merge pull request #1523 from jts-arm/dsu
DSU erratum 936184 workaround
Jeenu Viswambharan [Thu, 2 Aug 2018 09:14:12 +0000 (10:14 +0100)]
SiP: MISRA fixes for execution state switch
These changes address most of the required MISRA rules. In the process,
some from generic code is also fixed.
No functional changes.
Change-Id: I707dbec9b34b802397e99da2f5ae738165d6feba
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Jeenu Viswambharan [Thu, 2 Aug 2018 09:14:12 +0000 (10:14 +0100)]
RAS: MISRA fixes
These changes address most of the required MISRA rules. In the process,
some from generic code is also fixed.
No functional changes.
Change-Id: I76cacf6e1d73b09510561b5090c2bb66d81bec88
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Jeenu Viswambharan [Thu, 2 Aug 2018 09:14:12 +0000 (10:14 +0100)]
EHF: MISRA fixes
These changes address most of the required MISRA rules. In the process,
some from generic code are also fixed.
No functional changes.
Change-Id: I19786070af7bc5e1f6d15bdba93e22a4451d8fe9
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Jeenu Viswambharan [Fri, 10 Aug 2018 10:05:31 +0000 (11:05 +0100)]
SDEI: Fix locking issues
The event lock for a shared event was being unlocked twice, and the
locking sequence for event complete was misplaced. This patch fixes both
issues.
Change-Id: Ie2fb15c6ec240af132d7d438946ca160bd5c63dc
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>