refactor(console): disable getc() by defaultThe ability to read a character from the console constitutes an attackvector into TF-A, as it gives attackers a means to inject arbitrarydata into TF-A
refactor(console): disable getc() by defaultThe ability to read a character from the console constitutes an attackvector into TF-A, as it gives attackers a means to inject arbitrarydata into TF-A. It is dangerous to keep that feature enabled if notstrictly necessary, especially in production firmware builds.Thus, we need a way to disable this feature. Moreover, when it isdisabled, all related code should be eliminated from the firmwarebinaries, such that no remnant/dead getc() code remains in memory,which could otherwise be used as a gadget as part of a bigger securityattack.This patch disables getc() feature by default. For legitimate getc()use cases [1], it can be explicitly enabled by building TF-A withENABLE_CONSOLE_GETC=1.The following changes are introduced when getc() is disabled:- The multi-console framework no longer provides the console_getc() function.- If the console driver selected by the platform attempts to register a getc() callback into the multi-console framework then TF-A will now fail to build. If registered through the assembly function finish_console_register(): - On AArch64, you'll get: Error: undefined symbol CONSOLE_T_GETC used as an immediate value. - On AArch32, you'll get: Error: internal_relocation (type: OFFSET_IMM) not fixed up If registered through the C function console_register(), this requires populating a struct console with a getc field, which will trigger: error: 'console_t' {aka 'struct console'} has no member named 'getc'- All console drivers which previously registered a getc() callback have been modified to do so only when ENABLE_CONSOLE_GETC=1.[1] Example of such use cases would be: - Firmware recovery: retrieving a golden BL2 image over the console in order to repair a broken firmware on a bricked board. - Factory CLI tool: Drive some soak tests through the console.Discussed on TF-A mailing list here:https://lists.trustedfirmware.org/archives/list/tf-a@lists.trustedfirmware.org/thread/YS7F6RCNTWBTEOBLAXIRTXWIOYINVRW7/Change-Id: Icb412304cd23dbdd7662df7cf8992267b7975cc5Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>Acked-by: Baruch Siach <baruch@tkos.co.il>
show more ...
Don't return error information from console_flushAnd from crash_console_flush.We ignore the error information return by console_flush in _every_place where we call it, and casting the return typ
Don't return error information from console_flushAnd from crash_console_flush.We ignore the error information return by console_flush in _every_place where we call it, and casting the return type to void does notwork around the MISRA violation that this causes. Instead, we collectthe error information from the driver (to avoid changing that API), anddon't return it to the caller.Change-Id: I1e35afe01764d5c8f0efd04f8949d333ffb688c1Signed-off-by: Jimmy Brisson <jimmy.brisson@arm.com>
pl011: Use generic console_t data structureSince now the generic console_t structure holds the UART base address aswell, let's use that generic location and drop the UART driver specificdata stru
pl011: Use generic console_t data structureSince now the generic console_t structure holds the UART base address aswell, let's use that generic location and drop the UART driver specificdata structure at all.Change-Id: I7a23327394d142af4b293ea7ccd90b843c54587cSigned-off-by: Andre Przywara <andre.przywara@arm.com>
Correct UART PL011 initialization calculationCurrently for Armv7 plaforms the quotient calculated in pl011uart init code is moved to register r1.This patch moves the quotient to register r2 as d
Correct UART PL011 initialization calculationCurrently for Armv7 plaforms the quotient calculated in pl011uart init code is moved to register r1.This patch moves the quotient to register r2 as done for otherplatforms in the udiv instruction. Value of register r2 is thenused to calculate the values for IBRD and FBRD registerChange-Id: Ie6622f9f0e6d634378b471df5d02823b492c8a24Signed-off-by: Avinash Mehta <avinash.mehta@arm.com>
Remove MULTI_CONSOLE_API flag and references to itThe new API becomes the default one.Change-Id: Ic1d602da3dff4f4ebbcc158b885295c902a24fecSigned-off-by: Ambroise Vincent <ambroise.vincent@arm.co
Remove MULTI_CONSOLE_API flag and references to itThe new API becomes the default one.Change-Id: Ic1d602da3dff4f4ebbcc158b885295c902a24fecSigned-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
Console: removed legacy console APIThis interface has been deprecated in favour of MULTI_CONSOLE_API.Change-Id: I6170c1c8c74a890e5bd6d05396743fe62024a08aSigned-off-by: Ambroise Vincent <ambroise
Console: removed legacy console APIThis interface has been deprecated in favour of MULTI_CONSOLE_API.Change-Id: I6170c1c8c74a890e5bd6d05396743fe62024a08aSigned-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
Console: remove deprecated finish_console_registerThe old version of the macro is deprecated.Commit cc5859ca19ff ("Multi-console: Deprecate the`finish_console_register` macro") provides more det
Console: remove deprecated finish_console_registerThe old version of the macro is deprecated.Commit cc5859ca19ff ("Multi-console: Deprecate the`finish_console_register` macro") provides more details.Change-Id: I3d1cdf6496db7d8e6cfbb5804f508ff46ae7e67eSigned-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
Division functionality for cores that dont have divide hardware.Cortex a5 doesnt support hardware division such as sdiv and udiv commands.This commit adds a software division function in assembly
Division functionality for cores that dont have divide hardware.Cortex a5 doesnt support hardware division such as sdiv and udiv commands.This commit adds a software division function in assembly as well as includeappropriate files for software divison.The software division algorithm is a modified version obtained from:http://www.keil.com/support/man/docs/armasm/armasm_dom1359731155623.htmChange-Id: Ib405a330da5f1cea1e68e07e7b520edeef9e2652Signed-off-by: Usama Arif <usama.arif@arm.com>
Sanitise includes across codebaseEnforce full include path for includes. Deprecate old paths.The following folders inside include/lib have been left unchanged:- include/lib/cpus/${ARCH}- inclu
Sanitise includes across codebaseEnforce full include path for includes. Deprecate old paths.The following folders inside include/lib have been left unchanged:- include/lib/cpus/${ARCH}- include/lib/el3_runtime/${ARCH}The reason for this change is that having a global namespace forincludes isn't a good idea. It defeats one of the advantages of havingfolders and it introduces problems that are sometimes subtle (becauseyou may not know the header you are actually including if there are twoof them).For example, this patch had to be created because two headers werecalled the same way: e0ea0928d5b7 ("Fix gpio includes of mt8173 platformto avoid collision."). More recently, this patch has had similarproblems: 46f9b2c3a282 ("drivers: add tzc380 support").This problem was introduced in commit 4ecca33988b9 ("Move include andsource files to logical locations"). At that time, there weren't toomany headers so it wasn't a real issue. However, time has shown thatthis creates problems.Platforms that want to preserve the way they include headers may add theremoved paths to PLAT_INCLUDES, but this is discouraged.Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8fSigned-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
drivers/console: Link console framework code by defaultThis patch makes the build system link the console framework code bydefault, like it already does with other common libraries (e.g. cachehel
drivers/console: Link console framework code by defaultThis patch makes the build system link the console framework code bydefault, like it already does with other common libraries (e.g. cachehelpers). This should not make a difference in practice since TF islinked with --gc-sections, so the linker will garbage collect allfunctions and data that are not referenced by any other code. Thus, if aplatform doesn't want to include console code for size reasons anddoesn't make any references to console functions, the code will not beincluded in the final binary.To avoid compatibility issues with older platform ports, only make thischange for the MULTI_CONSOLE_API.Change-Id: I153a9dbe680d57aadb860d1c829759ba701130d3Signed-off-by: Julius Werner <jwerner@chromium.org>
Multi-console: Deprecate the `finish_console_register` macroThe `finish_console_register` macro is used by the multi consoleframework to register the `console_t` driver callbacks. It reliedon wea
Multi-console: Deprecate the `finish_console_register` macroThe `finish_console_register` macro is used by the multi consoleframework to register the `console_t` driver callbacks. It reliedon weak references to the `ldr` instruction to populate 0 to thecallback in case the driver has not defined the appropriatefunction. Use of `ldr` instruction to load absolute address to areference makes the binary position dependant. These instructionsshould be replaced with adrp/adr instruction for position independantexecutable(PIE). But adrp/adr instructions don't work well with weakreferences as described in GNU ld bugzilla issue 22589.This patch defines a new version of `finish_console_register` macrowhich can spcify which driver callbacks are valid and deprecates theold one. If any of the argument is not specified, then the macropopulates 0 for that callback. Hence the functionality of the previousdeprecated macro is preserved. The USE_FINISH_CONSOLE_REG_2 defineis used to select the new variant of the macro and will be removedonce the deprecated variant is removed.All the upstream console drivers have been migrated to use the newmacro in this patch.NOTE: Platforms be aware that the new variant of the`finish_console_register` should be used and the old variant isdeprecated.Change-Id: Ia6a67aaf2aa3ba93932992d683587bbd0ad25259Signed-off-by: Soby Mathew <soby.mathew@arm.com>
pl011: cnds: cbmem: 16550: Fix commentsThe comments with the prototypes of the register functions of theconsole drivers are incorrect. The arguments are wrong. This patch fixesthem.Change-Id: I
pl011: cnds: cbmem: 16550: Fix commentsThe comments with the prototypes of the register functions of theconsole drivers are incorrect. The arguments are wrong. This patch fixesthem.Change-Id: I38c4b481ee69e840780111c42f03c0752eb6315cSigned-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
pl011: Add support in AArch32 for MULTI_CONSOLE_APIAllow AArch32 to use the multi console driver by adding therequired functionsChange-Id: I9e69f18965f320074cf75442d6b0de891aef7936Signed-off-by
pl011: Add support in AArch32 for MULTI_CONSOLE_APIAllow AArch32 to use the multi console driver by adding therequired functionsChange-Id: I9e69f18965f320074cf75442d6b0de891aef7936Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Use SPDX license identifiersTo make software license auditing simpler, use SPDX[0] licenseidentifiers instead of duplicating the license text in every file.NOTE: Files that have been imported by
Use SPDX license identifiersTo make software license auditing simpler, use SPDX[0] licenseidentifiers 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: I80a00e1f641b8cc075ca5a95b10607ed9ed8761aSigned-off-by: dp-arm <dimitris.papastamos@arm.com>
Add console_flush() to console APIThis function ensures that console output is flushed, for examplebefore shutting down or use by another componentIn line with other console APIs, console_flush(
Add console_flush() to console APIThis function ensures that console output is flushed, for examplebefore shutting down or use by another componentIn line with other console APIs, console_flush() wrapsconsole_core_flush().Also implement console_core_flush() for PL011.Change-Id: I3db365065e4de04a454a5c2ce21be335a23a01e4Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
AArch32: Miscellaneous fixes in the AArch32 codeThis patch makes following miscellaneous fixes:* pl011_console.S: Fixed the bit mask used to check if the transmit FIFO is full or empty.* smcc_m
AArch32: Miscellaneous fixes in the AArch32 codeThis patch makes following miscellaneous fixes:* pl011_console.S: Fixed the bit mask used to check if the transmit FIFO is full or empty.* smcc_macros.S: Added `_fsxc` suffix while updating the SPSR. By default the assembler assumes `_fc` suffix which does not update all the fields in SPSR. By adding `_fsxc` suffix all the fields gets updated.* platform_helpers.S: Removed the weak definition for `plat_my_core_pos()` as this is a mandatory function which needs to be defined by all platforms.Change-Id: I8302292533c943686fff8d7c749a07132c052a3bSigned-off-by: Yatharth Kochar <yatharth.kochar@arm.com>
AArch32: Add console driverThis patch adds console drivers including the pl011 driverfor the AArch32 mode.Change-Id: Ifd22520d370fca3e73dbbf6f2d97d6aee65b67dd