summaryrefslogtreecommitdiff
path: root/plat/mediatek
AgeCommit message (Collapse)Author
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
2016-02-01Merge pull request #501 from jcastillo-arm/jc/tf-issues/300danh-arm
Disable PL011 UART before configuring it
2016-02-01Use tf_printf() for debug logs from xlat_tables.cSoby Mathew
The debug prints used to debug translation table setup in xlat_tables.c used the `printf()` standard library function instead of the stack optimized `tf_printf()` API. DEBUG_XLAT_TABLE option was used to enable debug logs within xlat_tables.c and it configured a much larger stack size for the platform in case it was enabled. This patch modifies these debug prints within xlat_tables.c to use tf_printf() and modifies the format specifiers to be compatible with tf_printf(). The debug prints are now enabled if the VERBOSE prints are enabled in Trusted Firmware via LOG_LEVEL build option. The much larger stack size definition when DEBUG_XLAT_TABLE is defined is no longer required and the platform ports are modified to remove this stack size definition. Change-Id: I2f7d77ea12a04b827fa15e2adc3125b1175e4c23
2016-01-26mt8173: Fix long latency issue of mtcmos contorlFan Chen
We found sometimes mtcmos operation is too long in spm (>1ms), so update a new version to fix it. I verified with 5 hours power_LoadTest, every mtcmos control can finish in 500us (average is 100~200us). Change-Id: I47b712bf9898870f4abcecbea47e01b9786231d4 Signed-off-by: Fan Chen <fan.chen@mediatek.com>
2016-01-26mt8173: Improve performance by handling more interrupts during idleWeiyi Lu
1. Set more wakeup source 2. Update PCM code for control logic Change-Id: I2ad06bd85bd1c75a22c838eab4cf5566c443b89a Signed-off-by: Weiyi Lu <weiyi.lu@mediatek.com>
2016-01-26mt8173: Implement subsystem power control logic in ARM TFJimmy Huang
1. Add SiP calls for subsystem power on/off and check support 2. Add subsystem power control related initialization in bl31_plat_setup.c 3. Add subsystem power on/off and power ack waiting functions 4. Update PCM code for subsystem physical power control logic Change-Id: Ia0ebb1964c8f9758159bcf17c1813d76ef52cf64 Signed-off-by: yt.lee <yt.lee@mediatek.com>
2016-01-26mt8173: support big/Little cluster power off for CPU idle(C2 state)Jimmy Huang
1. add power control for both big and Little cluster in MCDI 2. fix incorrect PCM_HOTPLUG_VALID_MASK in spm_hotplug.c 3. check the power status of cpus in cluster before setting the cputop power control Change-Id: Ifa85306a8bc218098667247904d281494c2f7bfe Signed-off-by: Weiyi Lu <weiyi.lu@mediatek.com>
2016-01-26mt8173: Move SPM related PLL settings to ARM TFJimmy Huang
Move SPM related PLL settings to spm_boot_init in ARM TF SPM driver Change-Id: I414b896caae072570c8de33a25e06db4ae011f57 Signed-off-by: yt.lee <yt.lee@mediatek.com>
2016-01-26mt8173: Fix USB remote wake up problemJimmy Huang
This patch updates SPM driver settings and PCM code to fix USB remote wake up problem. Change-Id: I07a81cc64b1d226d111380580d09ae25879f4285 Signed-off-by: yt.lee <yt.lee@mediatek.com>
2016-01-26mt8173: Enable dynamic clock managementJimmy Huang
This patch enables dynamic clock management control to reduce power consumption in various components. Change-Id: I8f66d9b72c8b1d70169ffe46cc361b16a0dadb77 Signed-off-by: Jimmy Huang <jimmy.huang@mediatek.com>