summaryrefslogtreecommitdiff
path: root/plat/mediatek
AgeCommit message (Collapse)Author
2018-02-28Merge pull request #1287 from davidcunado-arm/dc/fix_misradavidcunado-arm
Update ULL() macro and instances of ull to comply with MISRA
2018-02-27Update ULL() macro and instances of ull to comply with MISRADavid Cunado
MISRA C-2012 Rule 7.3 violation: lowercase l shall not be used as literal suffixes. This patch resolves this for the ULL() macro by using ULL suffix instead of the ull suffix. Change-Id: Ia8183c399e74677e676956e8653e82375d0e0a01 Signed-off-by: David Cunado <david.cunado@arm.com>
2018-02-27Add comments about mismatched TCR_ELx and xlat tablesAntonio Nino Diaz
When the MMU is enabled and the translation tables are mapped, data read/writes to the translation tables are made using the attributes specified in the translation tables themselves. However, the MMU performs table walks with the attributes specified in TCR_ELx. They are completely independent, so special care has to be taken to make sure that they are the same. This has to be done manually because it is not practical to have a test in the code. Such a test would need to know the virtual memory region that contains the translation tables and check that for all of the tables the attributes match the ones in TCR_ELx. As the tables may not even be mapped at all, this isn't a test that can be made generic. The flags used by enable_mmu_xxx() have been moved to the same header where the functions are. Also, some comments in the linker scripts related to the translation tables have been fixed. Change-Id: I1754768bffdae75f53561b1c4a5baf043b45a304 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-01-29Disable workaround for CVE-2017-5715 on unaffected platformsDimitris Papastamos
Change-Id: Ib67b841ab621ca1ace3280e44cf3e1d83052cb73 Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
2017-12-11Merge pull request #1178 from davidcunado-arm/dc/enable_svedavidcunado-arm
Enable SVE for Non-secure world
2017-11-30Do not enable SVE on pre-v8.2 platformsDavid Cunado
Pre-v8.2 platforms such as the Juno platform does not have the Scalable Vector Extensions implemented and so the build option ENABLE_SVE is set to zero. This has a minor performance improvement with no functional impact. Change-Id: Ib072735db7a0247406f8b60e325b7e28b1e04ad1 Signed-off-by: David Cunado <david.cunado@arm.com>
2017-11-29Replace magic numbers in linkerscripts by PAGE_SIZEAntonio Nino Diaz
When defining different sections in linker scripts it is needed to align them to multiples of the page size. In most linker scripts this is done by aligning to the hardcoded value 4096 instead of PAGE_SIZE. This may be confusing when taking a look at all the codebase, as 4096 is used in some parts that aren't meant to be a multiple of the page size. Change-Id: I36c6f461c7782437a58d13d37ec8b822a1663ec1 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2017-10-17mt8173: Migrate to using interrupt propertiesJeenu Viswambharan
Change-Id: I1463a4f9b74d74d59ac1d37b7b9c8e53416ab904 Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2017-07-14Fix order of remaining platform #includesIsla Mitchell
This fix modifies the order of system includes to meet the ARM TF coding standard. There are some exceptions to this change in order to retain header groupings and where there are headers within #if statements. Change-Id: Ib5b668c992d817cc860e97b29e16ef106d17e404 Signed-off-by: Isla Mitchell <isla.mitchell@arm.com>
2017-06-20Resolve build errors flagged by GCC 6.2David Cunado
With GCC 6.2 compiler, more C undefined behaviour is being flagged as warnings, which result in build errors in ARM TF build. This patch addresses issue caused by enums with values that exceed maximum value for an int. For these cases the enum is converted to a set of defines. Change-Id: I5114164be10d86d5beef3ea1ed9be5863855144d Signed-off-by: David Cunado <david.cunado@arm.com>
2017-05-11Merge pull request #927 from jeenu-arm/state-switchdavidcunado-arm
Execution state switch
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-05-02Add macro to check whether the CPU implements an ELJeenu Viswambharan
Replace all instances of checks with the new macro. Change-Id: I0eec39b9376475a1a9707a3115de9d36f88f8a2a Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2017-04-12Merge pull request #885 from antonio-nino-diaz-arm/an/console-flushdavidcunado-arm
Implement console_flush()
2017-03-31Add support for GCC stack protectionDouglas Raillard
Introduce new build option ENABLE_STACK_PROTECTOR. It enables compilation of all BL images with one of the GCC -fstack-protector-* options. A new platform function plat_get_stack_protector_canary() is introduced. It returns a value that is used to initialize the canary for stack corruption detection. Returning a random value will prevent an attacker from predicting the value and greatly increase the effectiveness of the protection. A message is printed at the ERROR level when a stack corruption is detected. To be effective, the global data must be stored at an address lower than the base of the stacks. Failure to do so would allow an attacker to overwrite the canary as part of an attack which would void the protection. FVP implementation of plat_get_stack_protector_canary is weak as there is no real source of entropy on the FVP. It therefore relies on a timer's value, which could be predictable. Change-Id: Icaaee96392733b721fa7c86a81d03660d3c1bc06 Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
2017-03-31Add console_core_flush() in upstream platformsAntonio Nino Diaz
It is needed to add placeholders for this function because, as this is not a `plat_xxx()` function, there aren't weak definitions of it in any file. If `console_flush()` is used and there isn't an implementation of `console_core_flush()` in any file, the compilation will fail. Change-Id: I50eb56d085c4c9fbc85d40c343e86af6412f3020 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2017-03-27Merge pull request #873 from dp-arm/dp/makefile-reorgdavidcunado-arm
Move plat/common source file definitions to generic Makefiles
2017-03-20Move plat/common source file definitions to generic Makefilesdp-arm
These source file definitions should be defined in generic Makefiles so that all platforms can benefit. Ensure that the symbols are properly marked as weak so they can be overridden by platforms. NOTE: This change is a potential compatibility break for non-upstream platforms. Change-Id: I7b892efa9f2d6d216931360dc6c436e1d10cffed Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
2017-03-20plat/mediatek: Enable Cortex-A53 erratum 855873 workaroundAndre Przywara
The Mediatek 8173 SoC contains Cortex-A53 CPUs which are affected by erratum 855873. Enable the workaround that TF provides to fix this erratum. Change-Id: I6e1c7822c320d81bdd46b8942d1d755883dac1f5 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2017-02-06Introduce unified API to zero memoryDouglas Raillard
Introduce zeromem_dczva function on AArch64 that can handle unaligned addresses and make use of DC ZVA instruction to zero a whole block at a time. This zeroing takes place directly in the cache to speed it up without doing external memory access. Remove the zeromem16 function on AArch64 and replace it with an alias to zeromem. This zeromem16 function is now deprecated. Remove the 16-bytes alignment constraint on __BSS_START__ in firmware-design.md as it is now not mandatory anymore (it used to comply with zeromem16 requirements). Change the 16-bytes alignment constraints in SP min's linker script to a 8-bytes alignment constraint as the AArch32 zeromem implementation is now more efficient on 8-bytes aligned addresses. Introduce zero_normalmem and zeromem helpers in platform agnostic header that are implemented this way: * AArch32: * zero_normalmem: zero using usual data access * zeromem: alias for zero_normalmem * AArch64: * zero_normalmem: zero normal memory using DC ZVA instruction (needs MMU enabled) * zeromem: zero using usual data access Usage guidelines: in most cases, zero_normalmem should be preferred. There are 2 scenarios where zeromem (or memset) must be used instead: * Code that must run with MMU disabled (which means all memory is considered device memory for data accesses). * Code that fills device memory with null bytes. Optionally, the following rule can be applied if performance is important: * Code zeroing small areas (few bytes) that are not secrets should use memset to take advantage of compiler optimizations. Note: Code zeroing security-related critical information should use zero_normalmem/zeromem instead of memset to avoid removal by compilers' optimizations in some cases or misbehaving versions of GCC. Fixes ARM-software/tf-issues#408 Change-Id: Iafd9663fc1070413c3e1904e54091cf60effaa82 Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
2017-01-24Remove use of all deprecated APIsKoan-Sin Tan
Now it's possbile to build BL31 for MT8173 with ERROR_DEPRECATED=1. Signed-off-by: Koan-Sin Tan <koansin.tan@gmail.com>
2017-01-24Get rid of use of old GIC APIsKoan-Sin Tan
Signed-off-by: Koan-Sin Tan <koansin.tan@gmail.com>
2017-01-24Add support of PSCI_EXTENDED_STATE_ID to MT8173Koan-Sin Tan
Signed-off-by: Koan-Sin Tan <koansin.tan@gmail.com>
2017-01-24Get rid of use of compatibility APIKoan-Sin Tan
make 'make ARCH=aarch64 CROSS_COMPILE=aarch64-linux-gnu- PLAT=mt8173 ENABLE_PLAT_COMPAT=0' work. Change-Id: I13f35d8aef23dfa0e65883fa0be43f1513c9fef5 Signed-off-by: Koan-Sin Tan <koansin.tan@gmail.com>
2017-01-24Use #ifdef for IMAGE_BL* instead of #ifMasahiro Yamada
One nasty part of ATF is some of boolean macros are always defined as 1 or 0, and the rest of them are only defined under certain conditions. For the former group, "#if FOO" or "#if !FOO" must be used because "#ifdef FOO" is always true. (Options passed by $(call add_define,) are the cases.) For the latter, "#ifdef FOO" or "#ifndef FOO" should be used because checking the value of an undefined macro is strange. Here, IMAGE_BL* is handled by make_helpers/build_macro.mk like follows: $(eval IMAGE := IMAGE_BL$(call uppercase,$(3))) $(OBJ): $(2) @echo " CC $$<" $$(Q)$$(CC) $$(TF_CFLAGS) $$(CFLAGS) -D$(IMAGE) -c $$< -o $$@ This means, IMAGE_BL* is defined when building the corresponding image, but *undefined* for the other images. So, IMAGE_BL* belongs to the latter group where we should use #ifdef or #ifndef. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-01-18Merge pull request #801 from masahir0y/cleanupdavidcunado-arm
Macro cleanups
2017-01-18Move BL_COHERENT_RAM_BASE/END defines to common_def.hMasahiro Yamada
We have lots of duplicated defines (and comment blocks too). Move them to include/plat/common/common_def.h. While we are here, suffix the end address with _END instead of _LIMIT. The _END is a better fit to indicate the linker-derived real end address. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-01-14mt8173: Correct SPM MCDI firmware lengthPaul Kocialkowski
The actual length of the firmware is 1001 32 bit words. Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
2016-09-19Remove MT6795 plat_sip_svc.c to fix Coverity analysis error.Leon Chen
2016-09-12Support for Mediatek MT6795 SoCLeon Chen
This patch support single core to boot to Linux kernel through Trusted Firmware. It also support 32 bit kernel and 64 bit kernel booting.
2016-08-09Migrate platform makefile to new console driver locationSoby Mathew
This patch migrates the upstream platform makefiles to include the console drivers from the new location in ARM Trusted Firmware code base. Change-Id: I866d6c4951e475de1f836ce8a8c1d5e6da9577e3
2016-07-08Introduce utils.h header fileSandrine Bailleux
This patch introduces a new header file: include/lib/utils.h. Its purpose is to provide generic macros and helper functions that are independent of any BL image, architecture, platform and even not specific to Trusted Firmware. For now, it contains only 2 macros: ARRAY_SIZE() and IS_POWER_OF_TWO(). These were previously defined in bl_common.h and xlat_tables.c respectively. bl_common.h includes utils.h to retain compatibility for platforms that relied on bl_common.h for the ARRAY_SIZE() macro. Upstream platform ports that use this macro have been updated to include utils.h. Change-Id: I960450f54134f25d1710bfbdc4184f12c049a9a9
2016-05-20Replace MediaTek delay timer by generic oneAntonio Nino Diaz
Use the generic delay timer instead of having a specific platform file for configuring it. Change-Id: If6b8f60bc04230f4b85b2bcc1b670fc65461214e
2016-05-20Implement plat_get_syscnt_freq2 on platformsAntonio Nino Diaz
Replaced plat_get_syscnt_freq by plat_get_syscnt_freq2 on all upstream platforms. Change-Id: I3248f3f65a16dc5e9720012a05c35b9e3ba6abbe
2016-05-12MT8173: Add Sip function for MTK HW crypt driverYi Zheng
Change-Id: Idc40cc6243e532567ec4334ae37d97c003c90bfa Signed-off-by: Yi Zheng <yi.zheng@mediatek.com>
2016-05-12mt8173: Reorganize plat SiP functionsJimmy Huang
Due to the changes in Mediatek platform common code, we need to move plat related SiP functions to plat folder. Change-Id: I6b14b988235205a5858b4bf49043bc79d0512b06 Signed-off-by: Jimmy Huang <jimmy.huang@mediatek.com>
2016-05-04Merge pull request #617 from leon-chen-mtk/refactor_common_1danh-arm
Refactor MediaTek platform common code
2016-05-04Refactor MediaTek platform common codeLeon Chen
Refactor MediaTek platform common code for further mt6795 upstream.
2016-04-21Move `plat_get_syscnt_freq()` to arm_common.cYatharth Kochar
This patch moves the definition for `plat_get_syscnt_freq()` from arm_bl31_setup.c to arm_common.c. This could be useful in case a delay timer needs to be installed based on the generic timer in other BLs. This patch also modifies the return type for this function from `uint64_t` to `unsigned long long` within ARM and other platform files. Change-Id: Iccdfa811948e660d4fdcaae60ad1d700e4eda80d
2016-04-14Dump platform-defined regs in crash reportingGerald Lejeune
It is up to the platform to implement the new plat_crash_print_regs macro to report all relevant platform registers helpful for troubleshooting. plat_crash_print_regs merges or calls previously defined plat_print_gic_regs and plat_print_interconnect_regs macros for each existing platforms. NOTE: THIS COMMIT REQUIRES ALL PLATFORMS THAT ENABLE THE `CRASH_REPORTING` BUILD FLAG TO MIGRATE TO USE THE NEW `plat_crash_print_regs()` MACRO. BY DEFAULT, `CRASH_REPORTING` IS ENABLED IN DEBUG BUILDS FOR ALL PLATFORMS. Fixes: arm-software/tf-issues#373 Signed-off-by: Gerald Lejeune <gerald.lejeune@st.com>
2016-04-14Merge pull request #593 from mtk09422/mtcmos-fixdanh-arm
mt8173: Fix timing issue of mfg mtcmos power off
2016-04-14mt8173: Fix timing issue of mfg mtcmos power offFan Chen
In mt8173, there are totally 10 non-cpu mtcmos, so we cannot tell if SPM finished the power control flow by 10 status bits of PASR_PDP_3. So, extend PASR_PDP_3 status bits from 10 to 20 so that we can make sure if the control action has been done precisely. Change-Id: Ifd4faaa4173c6e0543aa8471149adb9fe7fadedc Signed-off-by: Fan Chen <fan.chen@mediatek.com>
2016-04-13Migrate platform ports to the new xlat_tables librarySoby Mathew
This patch modifies the upstream platform port makefiles to use the new xlat_tables library files. This patch also makes mmap region setup common between AArch64 and AArch32 for FVP platform port. The file `fvp_common.c` is moved from the `plat/arm/board/fvp/aarch64` folder to the parent folder as it is not specific to AArch64. Change-Id: Id2e9aac45e46227b6f83cccfd1e915404018ea0b
2016-04-07mt8173: fix spm driver build errorsyt.lee
To fix build errors in following build conditions, DEBUG=1 LOG_LEVEL<40 DEBUG=0 LOG_LEVEL>=40 Change-Id: Ib34aed07b2ae0abd8a3a46948adc9fbeaae715aa Signed-off-by: yt.lee <yt.lee@mediatek.com>
2016-04-01mt8173: Protect BL31 memory from non-secure accessJimmy Huang
BL31 usually handles confidential stuff, its memory must not be read/write accessible from non-secure world. This patch protects the BL31 memory range from non-secure read/write access. Change-Id: I442fb92b667bb2f9a62d471a90508b1ba4489911 Signed-off-by: Jimmy Huang <jimmy.huang@mediatek.com>
2016-03-09mt8173: support big core PLL control in system suspend flowJimmy Huang
This patch adds big core ARMPLL control in system suspend flow. Change-Id: I27a45dbbb360f17ff0b524a125630358ee2277e2 Signed-off-by: Louis Yu <louis.yu@mediatek.com> Signed-off-by: Jimmy Huang <jimmy.huang@mediatek.com>
2016-03-09mt8173: Remove gpio driver supportJimmy Huang
We no longer need to control power signal via gpio during system off, thus remove gpio driver support from platform code. Change-Id: I6dfec129fa163330951f37b45b71ba5b90355c3b Signed-off-by: Jimmy Huang <jimmy.huang@mediatek.com>
2016-03-09mt8173: Add #error directive to prevent RESET_TO_BL31Jimmy Huang
MT8173 platform code is incompatible with RESET_TO_BL31, add #error directive to prevent the case. We also move mt8173_def.h and plat_private.h to include directory, and remove some unnecessary code. Change-Id: I47b8d0a506820a4ea1fbe8c8fb0ec6c68d88feb5 Signed-off-by: Jimmy Huang <jimmy.huang@mediatek.com>
2016-02-17Fix gpio includes of mt8173 platform to avoid collision.Antonio Nino Diaz
All files including plat/mediatek/mt8173/drivers/gpio/gpio.h were using system includes instead of user includes, which may cause the wrong version of the header to be included. Said includes have been changed to user includes to make sure that the included file is the wanted one. Change-Id: I29bdfe96fbd9a7900875e2357bbb43f3ea431fa5
2016-02-01Merge pull request #508 from soby-mathew/sm/debug_xlatdanh-arm
Use tf_printf() for debug logs from xlat_tables.c