summaryrefslogtreecommitdiff
path: root/include/drivers
AgeCommit message (Collapse)Author
2017-05-24mbedtls: Use `tf_snprintf` instead of `snprintf`Antonio Nino Diaz
The Trusted Firmware uses a subset of the APIs provided by mbed TLS. This subset internally uses `snprintf`, but the only format specifier used is '%d', which is supported by `tf_snprintf`. This patch makes mbed TLS use `tf_snprintf` instead of `snprintf`, saving 3 KB in both debug and release builds when TBBR is enabled. Change-Id: I7f992a21015930d7c0f4660e7a28ceefd60b9597 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2017-05-12mbedtls: Namespace for TF specific macrosDavid Cunado
An earlier patch (arm-trusted-firmware#874) migrated MBEDTLS_ suffixed macros to have a TBBR_ suffix to avoid any potential clash with future mbedtls macros. But on reflection the TBBR_ suffix could be confusing as the macros are used to drive TF-specific configuration of mbedtls. As such this patch migrates these macros from TBBR_suffix to TF_MBEDTLS_ suffix which more accurately conveys their use. Change-Id: Ic87642b653ceeaa03d62f724976abd5e12e867d4 Signed-off-by: David Cunado <david.cunado@arm.com>
2017-05-03Use SPDX license identifiersdp-arm
To make software license auditing simpler, use SPDX[0] license identifiers instead of duplicating the license text in every file. NOTE: Files that have been imported by FreeBSD have not been modified. [0]: https://spdx.org/ Change-Id: I80a00e1f641b8cc075ca5a95b10607ed9ed8761a Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
2017-04-12Merge pull request #885 from antonio-nino-diaz-arm/an/console-flushdavidcunado-arm
Implement console_flush()
2017-03-31Add console_flush() to console APIAntonio Nino Diaz
This function ensures that console output is flushed, for example before shutting down or use by another component In line with other console APIs, console_flush() wraps console_core_flush(). Also implement console_core_flush() for PL011. Change-Id: I3db365065e4de04a454a5c2ce21be335a23a01e4 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2017-03-22mbedtls: Namespace TF specific macrosdp-arm
These macros are not part of mbed TLS so they should not be prefixed with `MBEDTLS_` to avoid potential collision in the future. Use the `TBBR_` suffix to highlight that they only used in TF. `MBEDTLS_KEY_ALG` was not modified because that is documented and used by platforms to select the key algorithm. Change-Id: Ief224681715c481691c80810501830ce16e210b0 Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
2017-01-23drivers: add designware emmc driverHaojian Zhuang
Support Designware eMMC driver. It's based on both IO block and eMMC driver. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2017-01-13Merge pull request #807 from nmenon/upstream/fix-16650-rxdavidcunado-arm
uart: 16550: Fix getc
2017-01-10uart: 16550: Fix getcNishanth Menon
tbz check for RDR status is to check for a bit being zero. Unfortunately, we are using a mask rather than the bit position. Further as per http://www.ti.com/lit/ds/symlink/pc16550d.pdf (page 17), LSR register bit 0 is Data ready status (RDR), not bit position 2. Update the same to match the specification. Reported-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Nishanth Menon <nm@ti.com>
2016-12-20Merge pull request #793 from jeenu-arm/gic-changesdanh-arm
GIC driver changes for extended power management
2016-12-15GICv3: Introduce power management APIs for RedistributorJeenu Viswambharan
Some GICv3 implementations have provision for power management operations at Redistributor level. This patch introduces and provides place-holders for Redistributor power management. The default implementations are empty stubs, but are weakly bound so as to enable implementation-specific drivers to override them. Change-Id: I4fec1358693d3603ca5dce242a2f7f0e730516d8 Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2016-12-14Fix incorrect copyright noticesAntonio Nino Diaz
Some files have incorrect copyright notices, this patch fixes all files with deviations from the standard notice. Change-Id: I66b73e78a50a235acb55f1e2ec2052a42c0570d2 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2016-12-01emmc/sd: for C99 compliance, changed the unsigned char/short bitfield to ↵Qixiang.Xu
unsigned int bitfields C99 restricts bitfields type is signed and unsigned integer or _Bool. See section 6.7.2.1 Structure and union specifiers. "A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed int, unsigned int, or some other implementation-defined type." Since the compiler packs bitfields anyways, actual data layout in the structure is unaffected. Signed-off-by: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
2016-09-20partition: check GPT partition tableHaojian Zhuang
Now only support GPT partition table. MBR partition table isn't supported yet. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2016-08-12emmc: support CMD23Haojian Zhuang
Support CMD23. When CMD23 is used, CMD12 could be avoided. Two scenarios: 1. CMD17 for single block, CMD18 + CMD12 for multiple blocks. 2. CMD23 + CMD18 for both single block and multiple blocks. The emmc_init() should initialize whether CMD23 is supported or not. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2016-07-27GICv3: Fix the GICD_IROUTER offsetSoby Mathew
This patch fixes the offset of GICD_IROUTER register defined in gicv3.h. Although the GICv3 documention mentions that the offset for this register is 0x6100-0x7FD8, the offset calculation for an interrupt id `n` is : 0x6000 + 8n, where n >= 32 This requires the offset for GICD_IROUTER to be defined as 0x6000. Fixes ARM-software/tf-issues#410 Change-Id: If9e91e30d946afe7f1f60fea4f065c7567093fa8
2016-07-18Rework type usage in Trusted FirmwareSoby Mathew
This patch reworks type usage in generic code, drivers and ARM platform files to make it more portable. The major changes done with respect to type usage are as listed below: * Use uintptr_t for storing address instead of uint64_t or unsigned long. * Review usage of unsigned long as it can no longer be assumed to be 64 bit. * Use u_register_t for register values whose width varies depending on whether AArch64 or AArch32. * Use generic C types where-ever possible. In addition to the above changes, this patch also modifies format specifiers in print invocations so that they are AArch64/AArch32 agnostic. Only files related to upcoming feature development have been reworked. Change-Id: I9f8c78347c5a52ba7027ff389791f1dad63ee5f8
2016-06-13Merge pull request #629 from ljerry/tf_issue_398danh-arm
Bring IO storage dummy driver
2016-05-27Merge pull request #632 from rockchip-linux/support-for-gpio-driver-v2danh-arm
rockchip/rk3399: Support the gpio driver and configure
2016-05-27gpio: support gpio set/get pull statusCaesar Wang
On some platform gpio can set/get pull status when input, add these function so we can set/get gpio pull status when need it. And they are optional function.
2016-05-25CCN: Add API to query the PART0 ID from CCNSoby Mathew
This patch adds the API `ccn_get_part0_id` to query the PART0 ID from the PERIPHERAL_ID 0 register in the CCN driver. This ID allows to distinguish the variant of CCN present on the system and possibly enable dynamic configuration of the IP based on the variant. Also added an assert in `ccn_master_to_rn_id_map()` to ensure that the master map bitfield provided by the platform is within the expected interface id. Change-Id: I92d2db7bd93a9be8a7fbe72a522cbcba0aba2d0e
2016-05-20Implement generic delay timerAntonio Nino Diaz
Add delay timer implementation based on the system generic counter. This either uses the platform's implementation of `plat_get_syscnt_freq()` or explicit clock multiplier/divider values provided by the platform. The current implementation of udelay has been modified to avoid unnecessary calculations while waiting on the loop and to make it easier to check for overflows. Change-Id: I9062e1d506dc2f68367fd9289250b93444721732
2016-05-12Bring IO storage dummy driverGerald Lejeune
Allow to handle cases where some images are pre-loaded (by debugger for instance) without introducing many switches in files calling load_* functions. Fixes: arm-software/tf-issues#398 Signed-off-by: Gerald Lejeune <gerald.lejeune@st.com>
2016-04-27drivers: add emmc stackHaojian Zhuang
In a lot of embedded platforms, eMMC device is the only one storage device. So loading content from eMMC device is required in ATF. Create the emmc stack that could co-work with IO block driver. Support to read/write/erase eMMC blocks on both rpmb and normal user area. Support to change the IO speed and bus width. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2016-04-27IO: support block device typeHaojian Zhuang
FIP is accessed as memory-mapped type. eMMC is block device type. In order to support FIP based on eMMC, add the new io_block layer. io_block always access eMMC device as block size. And it'll only copy the required data into buffer in io_block driver. So preparing an temporary buffer is required. When use io_block device, MAX_IO_BLOCK_DEVICES should be declared in platform_def.h. It's used to support multiple block devices. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2016-04-12Use unsigned long long instead of uintptr_t in TZC400/DMC500 driversYatharth Kochar
Currently the `tzc400_configure_region` and `tzc_dmc500_configure_region` functions uses uintptr_t as the data type for `region_top` and `region_base` variables, which will be converted to 32/64 bits for AArch32/AArch64 respectively. But the expectation is to keep these addresses at least 64 bit. This patch modifies the data types to make it at least 64 bit by using unsigned long long instead of uintptr_t for the `region_top` and `region_base` variables. It also modifies the associated macros `_tzc##fn_name##_write_region_xxx` accordingly. Change-Id: I4e3c6a8a39ad04205cf0f3bda336c3970b15a28b
2016-04-08Merge pull request #569 from Xilinx/zynqmp-v1danh-arm
Support for Xilinx Zynq UltraScale+ MPSoC
2016-04-07Merge pull request #575 from soby-mathew/sm/new_tzc_driverdanh-arm
Refactor the TZC driver and add DMC-500 driver
2016-04-01drivers: Add Cadence UART driverSoren Brinkmann
Add a driver for the Cadence UART which is found in Xilinx Zynq SOCs. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
2016-03-31Add ARM CoreLink DMC-500 driver to program TrustZone protectionVikram Kanigiri
The ARM CoreLink DMC-500 Dynamic Memory Controller provides the programmable address region control of a TrustZone Address Space Controller. The access permissions can be defined for eight separate address regions plus a background or default region. This patch adds a DMC-500 driver to define address regions and program their access permissions as per ARM 100131_0000_02_en (r0p0) document. Change-Id: I9d33120f9480d742bcf7937e4b876f9d40c727e6
2016-03-31Refactor the ARM CoreLink TZC-400 driverVikram Kanigiri
TrustZone protection can be programmed by both memory and TrustZone address space controllers like DMC-500 and TZC-400. These peripherals share a similar programmer's view. Furthermore, it is possible to have multiple instances of each type of peripheral in a system resulting in multiple programmer's views. For example, on the TZC-400 each of the 4 filter units can be enabled or disabled for each region. There is a single set of registers to program the region attributes. On the DMC-500, each filter unit has its own programmer's view resulting in multiple sets of registers to program the region attributes. The layout of the registers is almost the same across all these variations. Hence the existing driver in `tzc400\tzc400.c` is refactored into the new driver in `tzc\tzc400.c`. The previous driver file is still maintained for compatibility and it is now deprecated. Change-Id: Ieabd0528e244582875bc7e65029a00517671216d
2016-03-31TBB: add non-volatile counter supportJuan Castillo
This patch adds support for non-volatile counter authentication to the Authentication Module. This method consists of matching the counter values provided in the certificates with the ones stored in the platform. If the value from the certificate is lower than the platform, the boot process is aborted. This mechanism protects the system against rollback. The TBBR CoT has been updated to include this method as part of the authentication process. Two counters are used: one for the trusted world images and another for the non trusted world images. ** NEW PLATFORM APIs (mandatory when TBB is enabled) ** int plat_get_nv_ctr(void *cookie, unsigned int *nv_ctr); This API returns the non-volatile counter value stored in the platform. The cookie in the first argument may be used to select the counter in case the platform provides more than one (i.e. TBSA compliant platforms must provide trusted and non-trusted counters). This cookie is specified in the CoT. int plat_set_nv_ctr(void *cookie, unsigned int nv_ctr); This API sets a new counter value. The cookie may be used to select the counter to be updated. An implementation of these new APIs for ARM platforms is also provided. The values are obtained from the Trusted Non-Volatile Counters peripheral. The cookie is used to pass the extension OID. This OID may be interpreted by the platform to know which counter must return. On Juno, The trusted and non-trusted counter values have been tied to 31 and 223, respectively, and cannot be modified. ** IMPORTANT ** THIS PATCH BREAKS THE BUILD WHEN TRUSTED_BOARD_BOOT IS ENABLED. THE NEW PLATFORM APIs INTRODUCED IN THIS PATCH MUST BE IMPLEMENTED IN ORDER TO SUCCESSFULLY BUILD TF. Change-Id: Ic943b76b25f2a37f490eaaab6d87b4a8b3cbc89a
2016-02-22Merge pull request #518 from hzhuang1/pl061_gpio_v5danh-arm
Pl061 gpio v5
2016-02-12arm: gpio: add pl061 driverHaojian Zhuang
Add PL061 GPIO driver that is depend on gpio framework. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2016-02-12gpio: add gpio frameworkHaojian Zhuang
Define the gpio ops in gpio driver. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2016-02-09Move private APIs in gic_common.h to a private headerSoby Mathew
This patch moves the private GIC common accessors from `gic_common.h` to a new private header file `gic_common_private.h`. This patch also adds additional comments to GIC register accessors to highlight the fact that some of them access register values that correspond to multiple interrupt IDs. The convention used is that the `set`, `get` and `clr` accessors access and modify the values corresponding to a single interrupt ID whereas the `read` and `write` GIC register accessors access the raw GIC registers and it could correspond to multiple interrupt IDs depending on the register accessed. Change-Id: I2643ecb2533f01e3d3219fcedfb5f80c120622f9
2016-02-09Fix GIC_IPRIORITYR setting in new driversSoby Mathew
The code to set the interrupt priority for secure interrupts in the new GICv2 and GICv3 drivers is incorrect. The setup code to configure interrupt priorities of secure interrupts, one interrupt at a time, used gicd_write_ipriorityr()/gicr_write_ipriority() function affecting 4 interrupts at a time. This bug did not manifest itself because all the secure interrupts were configured to the highest secure priority(0) during cold boot and the adjacent non secure interrupt priority would be configured later by the normal world. This patch introduces new accessors, gicd_set_ipriorityr() and gicr_set_ipriorityr(), for configuring priority one interrupt at a time and fixes the the setup code to use the new accessors. Fixes ARM-software/tf-issues#344 Change-Id: I470fd74d2b7fce7058b55d83f604be05a27e1341
2016-02-01Merge pull request #501 from jcastillo-arm/jc/tf-issues/300danh-arm
Disable PL011 UART before configuring it
2016-01-21Disable PL011 UART before configuring itJuan Castillo
The PL011 TRM (ARM DDI 0183G) specifies that the UART must be disabled before any of the control registers are programmed. The PL011 driver included in TF does not disable the UART, so the initialization in BL2 and BL31 is violating this requirement (and potentially in BL1 if the UART is enabled after reset). This patch modifies the initialization function in the PL011 console driver to disable the UART before programming the control registers. Register clobber list and documentation updated. Fixes ARM-software/tf-issues#300 Change-Id: I839b2d681d48b03f821ac53663a6a78e8b30a1a1
2016-01-14Remove direct usage of __attribute__((foo))Soren Brinkmann
Migrate all direct usage of __attribute__ to usage of their corresponding macros from cdefs.h. e.g.: - __attribute__((unused)) -> __unused Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
2016-01-14Migrate __warn_deprecated -> __deprecatedSoren Brinkmann
Use the new __deprecated macro from the generic cdefs header and remove the deprecated __warn_deprecated. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
2016-01-13Rearrange fields in TF data structures to reduce paddingSoby Mathew
This patch rearranges fields of the `image_desc_t` & `auth_img_desc_t` data structures to reduce padding between the fields and thereby save memory. NOTE: Platform ports which anonymously initialize these structures should be aware of the rearrangement and do the required modification. Change-Id: I428b5429632797b31d5bd306174599c07e24c060
2016-01-05Always build with '-pedantic'Sandrine Bailleux
By default ARM TF is built with the '-pedantic' compiler flag, which helps detecting violations of the C standard. However, the mbed TLS library and its associated authentication module in TF used to fail building with this compiler flag. As a workaround, the mbed TLS authentication module makefile used to set the 'DISABLE_PEDANTIC' TF build flag. The compiler errors flagged by '-pedantic' in the mbed TLS library have been fixed between versions 1.3.9 and 2.2.0 and the library now properly builds with this compiler flag. This patch fixes the remaining compiler errors in the mbed TLS authentication module in TF and unsets the 'DISABLE_PEDANTIC' TF build flag. This means that TF is now always built with '-pedantic'. In particular, this patch: * Removes the final semi-colon in REGISTER_COT() macro. This semi-colon was causing the following error message: drivers/auth/tbbr/tbbr_cot.c:544:23: error: ISO C does not allow extra ';' outside of a function [-Werror=pedantic] This has been fixed both in the mbed TLS authentication module as well as in the certificate generation tool. Note that the latter code didn't need fixing since it is not built with '-pedantic' but the change has been propagated for consistency. Also fixed the REGISTER_KEYS() and REGISTER_EXTENSIONS() macros, which were suffering from the same issue. * Fixes a pointer type. It was causing the following error message: drivers/auth/mbedtls/mbedtls_crypto.c: In function 'verify_hash': drivers/auth/mbedtls/mbedtls_crypto.c:177:42: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith] Change-Id: I7b7a04ef711efd65e17b5be26990d1a0d940257d
2015-12-10Merge pull request #465 from jcastillo-arm/jc/tbb_mbedtls_2_xdanh-arm
Move up to mbed TLS 2.x
2015-12-10Move up to mbed TLS 2.xJuan Castillo
The mbed TLS library has introduced some changes in the API from the 1.3.x to the 2.x releases. Using the 2.x releases requires some changes to the crypto and transport modules. This patch updates both modules to the mbed TLS 2.x API. All references to the mbed TLS library in the code or documentation have been updated to 'mbed TLS'. Old references to PolarSSL have been updated to 'mbed TLS'. User guide updated to use mbed TLS 2.2.0. NOTE: moving up to mbed TLS 2.x from 1.3.x is not backward compatible. Applying this patch will require an mbed TLS 2.x release to be used. Also note that the mbed TLS license changed to Apache version 2.0. Change-Id: Iba4584408653cf153091f2ca2ee23bc9add7fda4
2015-12-10Merge pull request #463 from jcastillo-arm/jc/tf-issues/216danh-arm
De-feature PL011 UART driver to match generic UART spec
2015-12-10De-feature PL011 UART driver to match generic UART specJuan Castillo
The Server Base System Architecture document (ARM-DEN-0029) specifies a generic UART device. The programmer's view of this generic UART is a subset of the ARM PL011 UART. However, the current PL011 driver in Trusted Firmware uses some features that are outside the generic UART specification. This patch modifies the PL011 driver to exclude features outside the SBSA generic UART specification by setting the boolean build option 'PL011_GENERIC_UART=1'. Default value is 0 (use full PL011 features). User guide updated. Fixes ARM-software/tf-issues#216 Change-Id: I6e0eb86f9d69569bc3980fb57e70d6da5d91a737
2015-12-09Merge pull request #462 from soby-mathew/sm/runtime_consoledanh-arm
Enable BL31 to configure a runtime console
2015-12-09Introduce console_uninit() API in ARM Trusted FirmwareSoby Mathew
Allowing console base address to be set to NULL conveniently allows console driver to ignore further invocations to console_putc() and console_getc(). This patch adds `console_uninit()` API to the console driver which sets console base address as NULL. The BL images can invoke this API to finish the use of console and ignore any further invocations to print to the console. Change-Id: I00a1762b3e0b7c55f2be2f9c4c9bee3967189dde
2015-12-09Merge pull request #456 from soby-mathew/sm/gicv3-tsp-plat-changes-v2danh-arm
Modify TSP and ARM standard platforms for new GIC drivers v2