Commit Graph

4020 Commits

Author SHA1 Message Date
Haojian Zhuang 261e43b78f plat/hikey: migrate to mmc framework
Migrate to mmc framework.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2018-08-10 17:11:12 +08:00
Haojian Zhuang 7a8b483067 drivers/dw_mmc: migrate to mmc framework
Migrate dw_mmc driver from emmc framework to mmc framework. The
emmc framework will be abandoned.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2018-08-10 17:11:12 +08:00
Haojian Zhuang bd4e3deee9 drivers/mmc: set buswidth and speed before reading data
It should set buswidth and speed of mmc controller before accessing
mmc.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2018-08-10 17:11:12 +08:00
Haojian Zhuang 07858dd809 drivers/mmc: make mmc_ext_csd aligned with 16 char
DMA is always used in mmc driver. So the buffer address should
always follow the DMA limitation.

There're same requirement in mmc_read_blocks()/mmc_write_blocks()
on parameter buf. Since parameter buf comes from io_block driver,
it's already handled in io_block driver.

At here, just make the minimum address alignment on 16 chars.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2018-08-10 17:11:12 +08:00
Haojian Zhuang ea315a69de drivers/mmc: fix lba param to int
mmc_read_blocks()/mmc_write_blocks() derived from io_block_ops_t
type. It means that lba param should be integer type, not
unsigned integer type.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2018-08-10 17:11:12 +08:00
Haojian Zhuang e74dc940c6 drivers/mmc: send CMD8 only for SD card in initialization
Sending CMD8 before CMD1 just causes to fetch data failure in eMMC.
Check whether it's eMMC first. If it's eMMC, send CMD1 command instead.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2018-08-10 17:11:12 +08:00
Dimitris Papastamos 8ae41aec32
Merge pull request #1505 from Yann-lms/mmc_delays
mmc: add required delays when retrying commands
2018-08-10 09:44:09 +01:00
Antonio Nino Diaz 6a23356c4f Replace stdio.h functions by TF functions
Functions provided by stdio.h such as printf and sprintf are available
in the codebase, but they add a lot of code to the final image if they
are used:

- AArch64: ~4KB
- AArch32: ~2KB in T32, ~3KB in A32

tf_printf and tf_snprintf are a lot more simple, but it is preferable
to use them when possible because they are also used in common code.

Change-Id: Id09fd2b486198fe3d79276e2c27931595b7ba60e
Acked-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-10 09:36:18 +01:00
Antonio Nino Diaz 73bc6e77f1 tf_snprintf: Add support for '%s'
Change-Id: Ia3a159444e638f63de7dc5a6a4b76169c757188a
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-10 09:36:18 +01:00
Dimitris Papastamos 29be1b55f4
Merge pull request #1513 from antonio-nino-diaz-arm/an/xlat-caches
xlat v2: Cleanup and dcache coherency bug fix
2018-08-09 15:16:19 +01:00
Antonio Nino Diaz 3e318e4037 xlat v2: Flush xlat tables after being modified
During cold boot, the initial translation tables are created with data
caches disabled, so all modifications go to memory directly. After the
MMU is enabled and data cache is enabled, any modification to the tables
goes to data cache, and eventually may get flushed to memory.

If CPU0 modifies the tables while CPU1 is off, CPU0 will have the
modified tables in its data cache. When CPU1 is powered on, the MMU is
enabled, then it enables coherency, and then it enables the data cache.
Until this is done, CPU1 isn't in coherency, and the translation tables
it sees can be outdated if CPU0 still has some modified entries in its
data cache.

This can be a problem in some cases. For example, the warm boot code
uses only the tables mapped during cold boot, which don't normally
change. However, if they are modified (and a RO page is made RW, or a XN
page is made executable) the CPU will see the old attributes and crash
when it tries to access it.

This doesn't happen in systems with HW_ASSISTED_COHERENCY or
WARMBOOT_ENABLE_DCACHE_EARLY. In these systems, the data cache is
enabled at the same time as the MMU. As soon as this happens, the CPU is
in coherency.

There was an attempt of a fix in psci_helpers.S, but it didn't solve the
problem. That code has been deleted. The code was introduced in commit
<264410306381> ("Invalidate TLB entries during warm boot").

Now, during a map or unmap operation, the memory associated to each
modified table is flushed. Traversing a table will also flush it's
memory, as there is no way to tell in the current implementation if the
table that has been traversed has also been modified.

Change-Id: I4b520bca27502f1018878061bc5fb82af740bb92
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-07 12:47:12 +01:00
Dimitris Papastamos 781842ea8a
Merge pull request #1501 from robertovargas-arm/cci
cci: Wait before reading status register
2018-08-06 16:09:20 +01:00
Roberto Vargas 1eb735d753 Add librom support in FVP
Change-Id: Idb9ba3864d6de3053260724f07172fd32c1523e0
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-08-06 13:08:51 +01:00
Dimitris Papastamos 83f51dac2d
Merge pull request #1512 from npoushin/integration
Add support for Arm System Guidance for Mobile fixed virtual platform
2018-08-06 11:19:03 +01:00
Antonio Nino Diaz e5d5951973 xlat v2: Cleanup get/change mem attr helpers
Changed the names for consistency with the rest of the library. Introduced
new helpers that manipulate the active translation tables context.

Change-Id: Icaca56b67fcf6a96e88aa3c7e47411162e8e6856
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-06 09:45:50 +01:00
Nariman Poushin 354596f683 plat/arm: Add support for SGM775
Add support for System Guidance for Mobile platform SGM775

Change-Id: I2442a50caae8f597e5e5949cd48f695cf75d9653
Signed-off-by: Nariman Poushin <nariman.poushin@linaro.org>
2018-08-03 17:42:54 +01:00
Deepak Pandey 5b2a7813a8 css_pm_scmi: optimise cpu suspend to remove redundant scmi call
In css platforms where the cpu/cluster management is done by the hardware,
software does need to issue certain scmi requests.

This patch wraps those scmi calls around the HW_ASSISTED_COHERENCY
build option to remove them on platforms that have this hardware support.

Change-Id: Ie818e234484ef18549aa7f977aef5c3f0fc26c27
Signed-off-by: Deepak Pandey <Deepak.Pandey@arm.com>
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
Signed-off-by: Nariman Poushin <nariman.poushin@linaro.org>
2018-08-03 17:42:54 +01:00
Nariman Poushin eb5e1be431 plat/arm: tzc_dmc500: Add missing plat_arm.h include
This omission causes a build error as the definition for
arm_tzc_regions_info_t is needed from plat_arm.h

Change-Id: I26935ee90d3e36ab6a016ff2c4eee4413df3e4e8
Signed-off-by: Nariman Poushin <nariman.poushin@linaro.org>
2018-08-03 17:42:54 +01:00
Nariman Poushin 58192800e0 plat/arm: css: Set MT bit in incoming mpidr arugments
Change-Id: I278d6876508800abff7aa2480910306a24de5378
Signed-off-by: Nariman Poushin <nariman.poushin@linaro.org>
2018-08-03 17:42:53 +01:00
Dimitris Papastamos 60e27d5644
Merge pull request #1511 from chandnich/sgi575-updates
Sgi575 updates
2018-08-03 14:16:31 +01:00
Chandni Cherukuri a41d1b2ce3 plat/sgi: switch to using scmi
The Arm SGI platforms can switch to using SCMI. So enable support for
SCMI and remove portions of code that would be unused after switching
to SCMI.

Change-Id: Ifd9e1c944745f703da5f970b5daf1be2b07ed14e
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
2018-08-03 16:17:33 +05:30
Chandni Cherukuri 8e1cc44900 sgi: disable CPU power down bit in reset handler
On SGI platforms, the 'CORE_PWRDN_EN' bit of 'CPUPWRCTLR_EL1'
register requires an explicit write to clear it for hotplug and
idle to function correctly. The reset value of this bit is zero
but it still requires this explicit clear to zero. This indicates
that this could be a model related issue but for now this issue can
be fixed be clearing the CORE_PWRDN_EN in the platform specific
reset handler function.

Change-Id: I4222930daa9a3abacdace6b7c3f4a5472ac0cb19
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
2018-08-03 16:17:33 +05:30
Roberto Vargas 5accce5bcc Add support for romlib in the build system
Romlib is a new image that is stored in ROM and contains the code of
several libraries that can be shared between different images. All
the functions within in the library are accessed using a jump table
which allows to update the romlib image whithout changing the binary
compatibility. This jump table can be also stored in RAM and it can
allow to patch a romlib with potential bugs fixes..

Change-Id: If980ccdaca24b7aaca900e32acc68baf6f94ab35
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-08-03 11:31:42 +01:00
Roberto Vargas 6c37334567 Add atexit function to libc
We had exit but we didn't have atexit, and we were calling panic and
tf_printf from exit, which generated a dependency from exit to them.
Having atexit allows to set a different function pointer in every image.

Change-Id: I95b9556d680d96249ed3b14da159b6f417da7661
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-08-03 11:31:39 +01:00
Roberto Vargas ea7a57a3a5 Don't include mbebtls include paths in INCLUDES
Mbebtls include paths are controlled by the user using the variable
MBEDTLS_DIR and they are out of the TF source tree. Since these
includes have a different origin it is better to move them to a
different variable.

This change makes easier for the romlib Makefile to parse the include
paths.

Change-Id: I3e4c99300f1012bc7f88c6b9f5bc0ec1f7b5aa8d
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-08-03 11:31:37 +01:00
Roberto Vargas 180c4bc2c0 Create a library file for libmbedtls
TF Makefile was linking all the objects files generated for the
Mbed TLS library instead of creating a static library that could be
used in the linking stage.

Change-Id: I8e4cd843ef56033c9d3faeee71601d110b7e4c12
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-08-03 11:31:36 +01:00
Roberto Vargas 61f72a3425 Create a library file for libc
TF Makefile was linking all the objects files generated for the
c library instead of creating a static library that could be
used in the linking stage.

Change-Id: I721daea097e9b13cbb42c9f8eaa2af8fea0799cf
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-08-03 11:31:33 +01:00
Roberto Vargas fec3648478 Create a library file for libfdt
TF Makefile was linking all the objects files generated for the
fdt library instead of creating a static library that could be
used in the linking stage.

Change-Id: If3705bba188ec39e1fbf2322a7f2a9a941e1b90d
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-08-03 11:31:26 +01:00
Roberto Vargas 5fee02873b Add make macros to build library archives
This patch adds all the make macros needed to create a library archive
and to use it in the link stage.

Change-Id: I26597bfd6543649d0b68a9b1e06aec1ba353e6de
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-08-03 11:31:24 +01:00
Dimitris Papastamos f68bc8a1c2
Merge pull request #1506 from danielboulby-arm/db/SeparateCodeAndROData
Fix build for SEPARATE_CODE_AND_RODATA=0
2018-08-03 10:56:47 +01:00
Dimitris Papastamos f943ce74ae
Merge pull request #1509 from antonio-nino-diaz-arm/an/bool
xlat: psci: Use bool instead of int
2018-08-03 10:53:12 +01:00
Dimitris Papastamos 0454f64b72
Merge pull request #1503 from ARM-software/dh/dual-lic
Update license information in readme.rst
2018-08-03 09:36:49 +01:00
Dimitris Papastamos 90b19376b9
Merge pull request #1508 from sandrine-bailleux-arm/sb/fix-trusty-build
Fix handler prototype in Trusty generic dispatcher
2018-08-03 09:34:58 +01:00
Antonio Nino Diaz 362030bf06 psci: Use bool in internal interfaces
Change-Id: I77c9cd2d1d6d0122cc49917fa686014bee154589
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-02 15:08:18 +01:00
Antonio Nino Diaz 5b395e3746 xlat: Use bool instead of int
Change-Id: I35d5b6a7c219f6f38983b30f157c1ed3808af17f
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-02 15:08:18 +01:00
Yann Gautier 15e913d4ab mmc: add required delays when retrying commands
A new function mmc_reset_to_idle is also created.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
2018-08-02 13:48:17 +02:00
Dimitris Papastamos f214a80698
Merge pull request #1507 from jeenu-arm/bool
Define bool type
2018-08-02 10:21:27 +01:00
Daniel Boulby 2ecaafd2e8 Fix build for SEPARATE_CODE_AND_RODATA=0
TF won't build since no memory region is specified
for when SEPARATE_CODE_AND_RODATA=0 it still relies on
the ARM_MAP_BL_RO_DATA region which is never defined for
this case. Create memory region combining code and RO data for
when the build flag SEPARATE_CODE_AND_RODATA=0 to fix this

Change-Id: I6c129eb0833497710cce55e76b8908ce03e0a638
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
2018-08-01 16:26:26 +01:00
Jeenu Viswambharan eea75baa97 Define bool type
This would enable us to write semantically sensible code.

Change-Id: Ie7c75f9c024f671a037448f5c0922174fff3f0ce
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2018-08-01 15:15:11 +01:00
Sandrine Bailleux 2de6deaae5 Fix handler prototype in Trusty generic dispatcher
Fix the types of the arguments of trusty_generic_platform_smc()
to match the expected prototype of a runtime service handler
(see rt_svc_handle_t type).

Change-Id: Ie839d116ca924b4b018ea2abbef72a1073da2a32
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2018-08-01 16:07:20 +02:00
Dimitris Papastamos e313c122a7
Merge pull request #1500 from danielboulby-arm/db/RORedirection
Set console function pointers to const
2018-07-31 16:09:07 +01:00
Dan Handley 327cfc273f Update license information in readme.rst
Added information on how disjunctively dual licensed code from
other projects is treated in the TF-A project.

Change-Id: Idca329abba4d36bd3c4fd722ac1556940b9135a2
Signed-off-by: Dan Handley <dan.handley@arm.com>
2018-07-31 09:47:15 +01:00
Dimitris Papastamos 72bc63185c
Merge pull request #1498 from glneo/cache-early-fixes
Early cache enable and coherency fixes
2018-07-30 16:53:34 +01:00
Dimitris Papastamos 2ee596c498
Merge pull request #1493 from antonio-nino-diaz-arm/an/xlat-misra
Fix MISRA defects in xlat tables lib and SP805 driver
2018-07-30 16:44:43 +01:00
Dimitris Papastamos 8dd7bc6e24 readme: Add information about the TF-A IRC channel
Fixes ARM-software/tf-issues#607

Change-Id: I5637f53e7f4857c85ee8b3af06ebcf86b9e4f1bc
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
2018-07-30 16:05:56 +01:00
Daniel Boulby 455bca21fe Set console function pointers to const
Set the function pointers in the console struct and the functions
they point to to const since they only need to be defined when
the console is being initialised and should not be changed after

Change-Id: I0574307111e3ab2f13d1a4a74c3fa75532dfa4be
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
2018-07-30 13:10:44 +01:00
Antonio Nino Diaz 354305c3cf Fix MISRA defects in SP805 driver
Fix violations of MISRA C-2012 Rules 10.1, 10.3 and 10.4.

Change-Id: I13c6acda798c1666892f630f097a23e68748f9e4
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-30 09:30:15 +01:00
Antonio Nino Diaz e7b9886c7c xlat: Fix MISRA defects
Fix defects of MISRA C-2012 rules 8.13, 10.1, 10.3, 10.4, 10.8, 11.6,
14.4, 15.7, 17.8, 20.10, 20.12, 21.1 and Directive 4.9.

Change-Id: I7ff61e71733908596dbafe2e99d99b4fce9765bd
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-30 09:30:15 +01:00
Soby Mathew eef90a772d
Merge pull request #1497 from SNG-ARM/master
RAS changes for SGI575 platform
2018-07-27 11:03:13 +01:00
Soby Mathew 128dad9a20
Merge pull request #1494 from hzhuang1/pcie_pin
Hikey960: configure pins for PCIe controller
2018-07-27 11:02:36 +01:00