summaryrefslogtreecommitdiff
path: root/plat
AgeCommit message (Collapse)Author
2017-08-29plat/arm: Fix ARM_INSTANTIATE_LOCK syntax anomalyJeenu Viswambharan
The current definition of ARM_INSTANTIATE_LOCK macro includes a semicolon, which means it's omitted where it's used. This is anomalous for a C statement in global scope. Fix this by removing semicolon from the definition; and where it's a NOP, declare a file-scoped variable explicitly tagged as unused to avoid compiler warning. No functional changes. Change-Id: I2c1d92ece4777e272a025011e03b8003f3543335 Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2017-08-29Merge pull request #1070 from rockchip-linux/rk3399-fixes-logicdanh-arm
rockchip/rk3399: Support Turning off VD_LOGIC during suspend-to-ram
2017-08-29Merge pull request #1068 from jenswi-linaro/optee_arm_platdanh-arm
Optee arm platform common
2017-08-29rockchip/rk3399: reinitilize secure sgrf when resumeLin Huang
when shutdown logic power rail, the some sgrf register value will reset, so need to reinitilize secure. Change-Id: I8ad0570432e54441fe1c60dd2960a81fd58f7163 Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29rockchip/rk3399: do secure timer init in pmusramLin Huang
we will use timer in pmusarm, when logic power rail shutdown, the secure timer will gone, so need to initial it in pmusram. Change-Id: I472e7eec3fc197f56223e6fff9167556c1c5e3bc Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29rockchip/rk3399: use slice1 to restore ddr slice1 ~ slice4Lin Huang
we do not have enough pmusram space now, so use slice1 to restore ddr slice1 ~ slice4, that's will save more pmusram space. Change-Id: Id54a7944f33d01a8f244cee6a8a0707bfe4d42da Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29rockchip/rk3399: disable more powerdomain prepare for shutdown logic railLin Huang
Change-Id: Ia59adf48cf14eb627721264765bce50cb31065ef Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29rockchip/rk3399: save and restore pd_alive registerLin Huang
pd_alive control cru, grf, timer, gpio and wdt, when turn off logic power rail, these register value will back to reset value, we need to save them value in suspend and restore them when resuem, since timer will reinitial in kernel, so it not need to save/restore. Change-Id: I0fc2a011d3cdc04b66ffbf728e769eb28b51ee38 Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29Hikey: enable watchdog resetLeo Yan
At the system boot time we need enable watchdog reset, otherwise after the watchdog is timeout it cannot reset the SoC. We need set the bit 0 and bit 16 together, the bit 16 is mask bit so after set bit 16 we have permission to operate bit 0 and bit 0 is watchdog reset enabling bit. Signed-off-by: Leo Yan <leo.yan@linaro.org>
2017-08-29rockchip/rk3399: set ddr clock source back to dpll when ddr resumeLin Huang
when logic power rail shutdown, CRU register will back to reset value, ddr use abpll as clock source when do suspend, we need to save and dpll value in pmusram, then set back these ddr clock back to dpll when dddr resume. Change-Id: I95dc0173649e8515859cfa46b40a606e0cc2fe3f Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29rockchip/rk3399: reinitilize debug uart when resumeLin Huang
when shutdown logic power rail, the uart register value will reset, so need to reinitilize debug uart. Change-Id: I48d3535c0068fd671dea6ea32e908612992faf62 Signed-off-by: Lin Huang <hl@rock-chips.com> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2017-08-25Merge pull request #1064 from islmit01/im/shifted_afinitydavidcunado-arm
FVP: Always assume shifted affinity with MT bit
2017-08-25Merge pull request #1061 from robertovargas-arm/norflashdavidcunado-arm
nor-flash
2017-08-25FVP: bl2: optionally map ARM_OPTEE_PAGEABLE_LOAD_MEMJens Wiklander
If SPD_opteed is defined map ARM_OPTEE_PAGEABLE_LOAD_MEM in bl2 to allow loading of OP-TEE paged part. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-08-24qemu: Add OP-TEE extra image parsing supportJens Wiklander
OP-TEE may have extra images to be loaded. Load them one by one and do the parsing. In this patch, ARM TF need to load up to 3 images for OP-TEE: header, pager and pages images. Header image is the info about optee os and images. Pager image include pager code and data. Paged image include the paging parts using virtual memory. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-08-24qemu: replace deprecated plat_psci_common.cJens Wiklander
Change to compile with new plat/common/plat_psci_common.c instead of the old deprecated plat/common/aarch64/plat_psci_common.c Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-08-24qemu: replace deprecated ADDR_SPACE_SIZEJens Wiklander
Replaces the deprecated ADDR_SPACE_SIZE with PLAT_PHY_ADDR_SPACE_SIZE and PLAT_VIRT_ADDR_SPACE_SIZE. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-08-23FVP: Always assume shifted affinity with MT bitIsla Mitchell
At present, the MPIDR validation on FVP relies on MT bit set along with shifted affinities. This currently is additionally dependent on the FVP model being of variant C. This however should be based on the presence of MT bit alone. This patch makes the change to always assume that the affinities are shifted in the FVP model when MT bit is present. Change-Id: I09fcb0126e1b38d29124bdeaf3450a60b95d485d Signed-off-by: Isla Mitchell <isla.mitchell@arm.com>
2017-08-23norflash: Add full status checkRoberto Vargas
The nor_XXXXX functions may fail due to different reasons, and it is convenient to do a full check to detect any failure. It is also a good idea to have a specific function to do a full status check, because new checks can be added to this function and they will be incorporated automatically to any function calling it. Change-Id: I54fed913e37ef574c1608e94139a519426348d12 Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2017-08-22Merge pull request #1053 from jwerner-chromium/JW_func_aligndavidcunado-arm
Add new alignment parameter to func assembler macro
2017-08-22norflash: Add nor_erase() to NOR driverRoberto Vargas
NOR memory only supports setting bits to 1. To clear a bit, set to zero, the NOR memory needs to be erased. Change-Id: Ia82eb15a5af9a6d4fc7e5ea2b58e6db87226b351 Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2017-08-22norflash: Clear status register before sending commandsRoberto Vargas
The status register bits remain until explicitly cleared, which means that a command can be incorrectly considered to have generated an error - for example, after reset the status register contents may be unknown or if a previous command had failed. This patch clears the status register before beginning any command to be sure that the status register only represents information about the current operation. Change-Id: I9e98110ee24179937215461c00b6543a3467b350 Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2017-08-22norflash: Wait for WSM bit in lock/unlockRoberto Vargas
lock/unlock operation must wait until WSM bit is set. Since we do not allow to loop forever then these functions must return an error if WSM bit isn't enabled after a number of tries. Change-Id: I21c9e292b514b28786ff4a225128bcd8c1bfa999 Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2017-08-22norflash: clean-up norflash.cRoberto Vargas
- Add comments to all the functions - Simplify nor_poll_dws - Simplify nor_word_program Change-Id: I29c0199d2908a4fceb1ac3430fcfdd699be22bb3 Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2017-08-17Merge pull request #1051 from Kevin-WangTao/fix_suspend_issuedanh-arm
Hikey960: fix PSCI suspend stuck issue
2017-08-17Hikey960: fix PSCI suspend stuck issueTao Wang
Clear the cpuidle flag when resuming from idle. This flag is set when entering idle, and if it remains set when resuming, it can prevent the cluster from powering off during the next system suspend operation. During system suspend, all CPUs are plugged out except the last CPU, which is suspended. If any of the cpuidle flags are set at this point, the last CPU will be stuck in a WFI loop and will not be powered off. This problem only occurs during system suspend. Signed-off-by: Tao Wang <kevin.wangtao@linaro.org>
2017-08-16qemu: Add LOAD_IMAGE_V2 supportFu Wei
The generic LOAD_IMAGE_V2 framework has been merged and enable for almost all the arm platform. Because qemu platform doesn't share those common files with arm, QEMU haven't got this support yet. This patch add all the necessary code the files for adding LOAD_IMAGE_V2 support on QEMU and enable it as default. Fixes ARM-software/tf-issues#507 Signed-off-by: Fu Wei <fu.wei@linaro.org>
2017-08-15Add new alignment parameter to func assembler macroJulius Werner
Assembler programmers are used to being able to define functions with a specific aligment with a pattern like this: .align X myfunction: However, this pattern is subtly broken when instead of a direct label like 'myfunction:', you use the 'func myfunction' macro that's standard in Trusted Firmware. Since the func macro declares a new section for the function, the .align directive written above it actually applies to the *previous* section in the assembly file, and the function it was supposed to apply to is linked with default alignment. An extreme case can be seen in Rockchip's plat_helpers.S which contains this code: [...] endfunc plat_crash_console_putc .align 16 func platform_cpu_warmboot [...] This assembles into the following plat_helpers.o: Sections: Idx Name Size [...] Algn 9 .text.plat_crash_console_putc 00010000 [...] 2**16 10 .text.platform_cpu_warmboot 00000080 [...] 2**3 As can be seen, the *previous* function actually got the alignment constraint, and it is also 64KB big even though it contains only two instructions, because the .align directive at the end of its section forces the assembler to insert a giant sled of NOPs. The function we actually wanted to align has the default constraint. This code only works at all because the linker just happens to put the two functions right behind each other when linking the final image, and since the end of plat_crash_console_putc is aligned the start of platform_cpu_warmboot will also be. But it still wastes almost 64KB of image space unnecessarily, and it will break under certain circumstances (e.g. if the plat_crash_console_putc function becomes unused and its section gets garbage-collected out). There's no real way to fix this with the existing func macro. Code like func myfunc .align X happens to do the right thing, but is still not really correct code (because the function label is inserted before the .align directive, so the assembler is technically allowed to insert padding at the beginning of the function which would then get executed as instructions if the function was called). Therefore, this patch adds a new parameter with a default value to the func macro that allows overriding its alignment. Also fix up all existing instances of this dangerous antipattern. Change-Id: I5696a07e2fde896f21e0e83644c95b7b6ac79a10 Signed-off-by: Julius Werner <jwerner@chromium.org>
2017-08-14Merge pull request #1040 from sliai/support-opteed-headerdanh-arm
Support opteed header
2017-08-14Merge pull request #1046 from jeenu-arm/revcdanh-arm
Support for RevC FVP model
2017-08-14Merge pull request #1043 from tekkamanninja/qemu_xlat_tables_v2_upstreamdanh-arm
qemu: use translation tables library v2 as default.
2017-08-09Add Trusted OS extra image parsing support for ARM standard platformsSummer Qin
Trusted OS may have extra images to be loaded. Load them one by one and do the parsing. In this patch, ARM TF need to load up to 3 images for optee os: header, pager and paged images. Header image is the info about optee os and images. Pager image include pager code and data. Paged image include the paging parts using virtual memory. Change-Id: Ia3bcfa6d8a3ed7850deb5729654daca7b00be394 Signed-off-by: Summer Qin <summer.qin@arm.com>
2017-08-09Support Trusted OS firmware extra images in TF toolsSummer Qin
Since Trusted OS firmware may have extra images, need to assign new uuid and image id for them. The TBBR chain of trust has been extended to add support for the new images within the existing Trusted OS firmware content certificate. Change-Id: I678dac7ba1137e85c5779b05e0c4331134c10e06 Signed-off-by: Summer Qin <summer.qin@arm.com>
2017-08-02FVP: Support Base FVP RevCJeenu Viswambharan
Revision C of the Base FVP has the same memory map as earlier revisions, but has the following differences: - Implements CCI550 instead of CCI400, - Has a single instantiation of SMMUv3, - CPU MPIDs are shifted left by one level, and has MT bit set in them. The correct interconnect to program is chosen at run time based on the FVP revision. Therefore, this patch implements FVP functions for interconnect programming, rather than depending on ARM generic ones. The macros used have been renamed to reflect this change. Additionally, this patch initializes SMMUv3 as part of FVP early platform setup. New ARM config flags are introduced for feature queries at run time. Change-Id: Ic7b7f080953a51fceaf62ce7daa6de0573801f09 Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2017-08-01FVP: Remove CCI registers from crash dumpJeenu Viswambharan
The CCI crash dump macros assumes CCI base at build time. Since this can't be the case for CCI on FVP, choose not to register dump CCI registers for FVP. Change-Id: I7374a037e7fd0a85b138e84b3cf0aa044262da97 Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2017-08-01FVP: Add support for multi-threaded CPUsJeenu Viswambharan
ARM CPUs with multi-threading implementation has more than one Processing Element in a single physical CPU. Such an implementation will reflect the following changes in the MPIDR register: - The MT bit set; - Affinity levels pertaining to cluster and CPUs occupy one level higher than in a single-threaded implementation, and the lowest affinity level pertains to hardware threads. MPIDR affinity level fields essentially appear shifted to left than otherwise. The FVP port henceforth assumes that both properties above to be concomitant on a given FVP platform. To accommodate for varied MPIDR formats at run time, this patch re-implements the FVP platform-specific functions that translates MPIDR values to a linear indices, along with required validation. The same treatment is applied for GICv3 MPIDR hashing function as well. An FVP-specific build option FVP_MAX_PE_PER_CPU is introduced which specifies the maximum number of threads implemented per CPU. For backwards compatibility, its value defaults to 1. Change-Id: I729b00d3e121d16ce9a03de4f9db36dfac580e3f Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2017-08-01FVP: Fix AArch32 stack functions to be ABI-compliantJeenu Viswambharan
plat_get_my_stack is called from C, so it can't expect argument registers to be preserved. Stash registers temporarily onto the stack instead. plat_set_my_stack is called during early init, when there exists no stack. Use any register other than argument registers to stash temporary values. Change-Id: I98052e20671d0933201d45ec7a5affccd71ce08c Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2017-08-01Merge pull request #1021 from vwadekar/psci-early-suspend-handlerdavidcunado-arm
lib: psci: early suspend handler for platforms
2017-08-01Merge pull request #1038 from Leo-Yan/fix_vbus_det_irqdavidcunado-arm
hikey: Disable VBUS_DET interrupt for PMIC
2017-07-31Tegra: implement the early suspend handlerVarun Wadekar
This patch implements the early suspend handler for Tegra SoCs. This handler is empty for now and the actual support for a particular platform would be added later. Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-07-31Merge pull request #1035 from sandrine-bailleux-arm/sb/xlat-lib-ctxdavidcunado-arm
Translation table library v2 improvements
2017-07-31qemu: use translation tables library v2 as default.Fu Wei
Almost all the arm platform has switch to translation tables library v2 as default. Because qemu platform doesn't use arm_common.mk like other arm platforms, QEMU haven't switched to v2 yet. This patch adds all the necessary code for adding translation tables library v2 support on QEMU and use it as default. Fixes ARM-software/tf-issues#508 Signed-off-by: Fu Wei <fu.wei@linaro.org>
2017-07-26Merge pull request #1032 from soby-mathew/sm/css_scp_reorgdavidcunado-arm
Reorganise CSS SCP bootloader layer
2017-07-26xlat lib v2: Expose *_ctx() APIsSandrine Bailleux
In a previous patch, the xlat_ctx_t type has been made public. This patch now makes the *_ctx() APIs public. Each API now has a *_ctx() variant. Most of them were already implemented and this patch just makes them public. However, some of them were missing so this patch introduces them. Now that all these APIs are public, there's no good reason for splitting them accross 2 files (xlat_tables_internal.c and xlat_tables_common.c). Therefore, this patch moves all code into xlat_tables_internal.c and removes xlat_tables_common.c. It removes it from the library's makefile as well. This last change introduces a compatibility break for platform ports that specifically include the xlat_tables_common.c file instead of including the library's Makefile. The UniPhier platform makefile has been updated to now omit this file from the list of source files. The prototype of mmap_add_region_ctx() has been slightly changed. The mmap_region_t passed in argument needs to be constant because it gets called from map_add(), which receives a constant region. The former implementation of mmap_add() used to cast the const qualifier away, which is not a good practice. Also remove init_xlation_table(), which was a sub-function of init_xlat_tables(). Now there's just init_xlat_tables() (and init_xlat_tables_ctx()). Both names were too similar, which was confusing. Besides, now that all the code is in a single file, it's no longer needed to have 2 functions for that. Change-Id: I4ed88c68e44561c3902fbebb89cb197279c5293b Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2017-07-26hikey: Disable VBUS_DET interrupt for PMICLeo Yan
After disconnect Jumper pin 1-2 in J15 header, the signal VBUS_DET is to be pulled down to low level. This will assert the interrupt signal in PMIC and trigger IRQ in GIC; the asserted signal from VBUS_DET is level triggered and kernel reports the warning for unhooked interrupt handling; and VBUS_DET stays with low level, this triggers IRQ storm in kernel. This patch is to disable interrupt for VBUS_DET in PMIC, this can dismiss the verbose log and IRQ storm after kernel booting. [ 40.835279] irq 57: nobody cared (try booting with the "irqpoll" option) [ 40.842075] CPU: 0 PID: 980 Comm: irq/57-hi655x-p Not tainted 4.4.77-568944-g576a0114dec8-dirty #667 [ 40.851303] Hardware name: HiKey Development Board (DT) [ 40.856580] Call trace: [ 40.859060] [<ffffff800808c4cc>] dump_backtrace+0x0/0x1e0 [ 40.864516] [<ffffff800808c8ac>] show_stack+0x20/0x28 [ 40.869622] [<ffffff80084b9688>] dump_stack+0xa8/0xe0 [ 40.874729] [<ffffff800812dd5c>] __report_bad_irq+0x40/0xec [ 40.880360] [<ffffff800812e0bc>] note_interrupt+0x1e4/0x2d8 [ 40.885992] [<ffffff800812b11c>] handle_irq_event_percpu+0xd8/0x268 [ 40.892324] [<ffffff800812b2f8>] handle_irq_event+0x4c/0x7c [ 40.897955] [<ffffff800812ecbc>] handle_level_irq+0xcc/0x178 [ 40.903672] [<ffffff800812a778>] generic_handle_irq+0x34/0x4c [ 40.909481] [<ffffff80085074c8>] pl061_irq_handler+0xa8/0x124 [ 40.915286] [<ffffff800812a778>] generic_handle_irq+0x34/0x4c [ 40.921092] [<ffffff800812a820>] __handle_domain_irq+0x90/0xf8 [ 40.926985] [<ffffff8008082620>] gic_handle_irq+0x58/0xa8 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com> Signed-off-by: Leo Yan <leo.yan@linaro.org>
2017-07-25FVP: Do not map DEVICE2 memory range when TBB is disabledSandrine Bailleux
The DEVICE2 memory range is needed to access the Root of Trust Public Key registers. This is not needed when Trusted Board Boot is disabled so it's safer to not map it in this case. This also saves one level-2 page table in each of BL1 and BL2 images. Also add some comments. Change-Id: I67456b44f3fd5e145f6510a8499b7fdf720a7273 Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2017-07-20Merge pull request #1029 from islmit01/im/fix_includesdavidcunado-arm
Fix order of includes
2017-07-20CSS: Prevent SCP_BL2/2U from overwriting BL1 RW dataSoby Mathew
On ARM CSS platforms, the SCP_BL2/2U image is loaded below BL1 read-write data. This same memory is used to load BL31 later on. But sufficient checks were not done to ensure that the SCP_BL2 would not overwrite BL1 rw data. This patch adds the required CASSERT checks to prevent overwrite into BL1 or BL2 memory by load of SCP_BL2/2U. Also the size of BL31 is increased and SCP_BL2/2U size is decreased to accomodate it within the allocated region. Change-Id: I23b28b5e1589e91150852a06452bd52b273216ee Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2017-07-20CSS: Reorganize the SCP Image transfer functionalitySoby Mathew
The SCP_BL2 is transferred to SCP during BL2 image load and authenticate sequence. The Boot-Over-MHU (BOM) protocol is used as transport for this. After the SCP boots using the transferred image, the AP CPU waits till the `READY` message is received from SCP. This patch separates the API for transport of image from the wait for `READY` message and also moves the related files to the `css/drivers` folder. The previous API `scp_bootloader_transfer` is renamed to `css_scp_boot_image_xfer` to reflect the css naming convention. This reorganisation also allows easier switch to a different transport (eg: Shared Data Structure based transfer) in future Change-Id: I8a96f9c4616ffde6dbfdf7c18f6f6f8bfa40bbf0 Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2017-07-20Resize the BL2 size limit for JunoSoby Mathew
Recent patches to reduce the memory footprint of BL images have resulted in saving several pages of memory. This patch reduces the BL2 size limit by 20KB for Juno when ARM_BOARD_OPTIMISE_MEM=1 so that more free space can be freed up for Trusted OS (BL32). Also SCP_BL2/SCP_BL2U size is now restricted to 80K. Change-Id: I1573d7a34e24d15e4abce8a14da40dbb5dc81e37 Signed-off-by: Soby Mathew <soby.mathew@arm.com>