processor-firmware/ks2-boot-monitor.git
5 months agosec: skernel: allow invalidation of BTB with ICIALLU for CVE-2017-5715 master
Tero Kristo [Wed, 21 Oct 2020 09:35:25 +0000 (12:35 +0300)]
sec: skernel: allow invalidation of BTB with ICIALLU for CVE-2017-5715

As recommended by Arm in [1], ACTLR[0] (Enable invalidates of BTB)
needs to be set[2] for BTB to be invalidated on ICIALLU. This needs to
be done unconditionally for Cortex-A15 processors. Also provide a config
option for this in case someone actually needs to disable this in
future.

[1] https://developer.arm.com/support/security-update

Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
3 years agomakedefs: Fix issue with setting CHECK and VERBOSE
Dan Murphy [Mon, 24 Apr 2017 22:02:56 +0000 (17:02 -0500)]
makedefs: Fix issue with setting CHECK and VERBOSE

Within the ifndef tabs are not allowed.  These need
to be converted to spaces.  Without this CHECK is always
set and sparse is expected to be installed.

Fixes: aba308b9868d ("Makefile: Use OBJROOT for build output to enable out-of-tree builds")
Reported-by: Denys Dmytriyenko <denys@ti.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Tested-by: Denys Dmytriyenko <denys@ti.com>
3 years agosec: add msmc_ses_mpax settings for PMMC
Thanh Tran [Fri, 21 Apr 2017 17:06:06 +0000 (13:06 -0400)]
sec: add msmc_ses_mpax settings for PMMC

Add function skern_setup_pmmc_access() to configure MSMC_SES_MPAX
to allow PMMC access to DDR3 configuration space.
Only K2G has PMMC hence the function body only defined in K2G build.

These settings originally come from PMMC firmware.  We move the
settings to Boot Monitor because PMMC doesn't have enough privilege
to configure these registers on K2G HS. PMMC needs access to DDR3
configuration to enable/disable self refresh on K2G

Signed-off-by: Thanh Tran <thanh-tran@ti.com>
4 years agodocs: Update documentation for recent changes
Andrew F. Davis [Fri, 9 Dec 2016 22:24:04 +0000 (16:24 -0600)]
docs: Update documentation for recent changes

Signed-off-by: Andrew F. Davis <afd@ti.com>
4 years agoMakefile: Use OBJROOT for build output to enable out-of-tree builds
Andrew F. Davis [Fri, 9 Dec 2016 22:24:03 +0000 (16:24 -0600)]
Makefile: Use OBJROOT for build output to enable out-of-tree builds

The variable OBJROOT is used for object storage, use this everywhere to
allow out-of-tree builds. Also fixup some makefile formatting while we
are here.

Signed-off-by: Andrew F. Davis <afd@ti.com>
4 years agomakedefs: Move definition of OBJROOT to common file
Andrew F. Davis [Fri, 9 Dec 2016 22:24:02 +0000 (16:24 -0600)]
makedefs: Move definition of OBJROOT to common file

Move the definition of OBJROOT to the common definition file. Also
ensure it is always set.

Signed-off-by: Andrew F. Davis <afd@ti.com>
4 years agomake.rules: Fix quieting of mkdir command
Andrew F. Davis [Fri, 9 Dec 2016 22:24:01 +0000 (16:24 -0600)]
make.rules: Fix quieting of mkdir command

The quieting '@' only needs to go before the whole command,
having it before sub-commands causes the literal "@mkdir" to
be sent to shell, causing build to fail.

Signed-off-by: Andrew F. Davis <afd@ti.com>
4 years agosoc: Move load address to end of MSMC
Andrew F. Davis [Wed, 31 Aug 2016 20:19:53 +0000 (15:19 -0500)]
soc: Move load address to end of MSMC

Currently different SoCs put the boot monitor and related data at
different addresses in MSMC, even SoCs with the same memory map.
This creates an inconsistency and adds a burden for the boot monitor's
loader and for the kernel to track this cut-out. Fix this by always
loading the boot monitor into the last available space in MSMC across
all SoCs.

Signed-off-by: Andrew F. Davis <afd@ti.com>
[t-kristo@ti.com: rebased on top of the mkimage support patch]
Signed-off-by: Tero Kristo <t-kristo@ti.com>
4 years agoMakefile: Add support for mkimage header
Lokesh Vutla [Tue, 6 Sep 2016 06:12:34 +0000 (11:42 +0530)]
Makefile: Add support for mkimage header

Given that boot monitor image is being generated to a specific target
location depending on the SoC and U-boot relies on addr_mon env variable
to be aligned with boot monitor target location. When ever the target
address gets updated in boot monitor, it is difficult to sync between
u-boot and boot monitor and also there is no way to update user that
boot monitor target location is updated.

To avoid this problem, generate boot monitor image with a mkimage
header which can be parsed by U-boot.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agosec: skernel: Use correct number of cores for stack size calculation
Andrew F. Davis [Wed, 31 Aug 2016 20:13:37 +0000 (15:13 -0500)]
sec: skernel: Use correct number of cores for stack size calculation

When calculating the total size of the monitors stack, the stack size per
core is multiplied by 4, for most Keystone 2 devices this is the correct
number of cores, but not for all anymore, so we may over allocate stack
space. Use the ARM_NUM_CORES macro instead.

Signed-off-by: Andrew F. Davis <afd@ti.com>
4 years agosec: Move function declaration into the correct headers
Andrew F. Davis [Wed, 31 Aug 2016 20:13:36 +0000 (15:13 -0500)]
sec: Move function declaration into the correct headers

Move functions defined in skern.c into new header file skern.h, then
only declare functions in skernel.h that are defined in skernel.S.

Signed-off-by: Andrew F. Davis <afd@ti.com>
4 years agosec: Cleanup and fix minor whitespace issues
Andrew F. Davis [Wed, 31 Aug 2016 20:13:35 +0000 (15:13 -0500)]
sec: Cleanup and fix minor whitespace issues

Fix typos, unify naming, add/remove whitespace, and other non-functional
changes. While here update the copyright dates.

Signed-off-by: Andrew F. Davis <afd@ti.com>
4 years agoMakefile: Move non-secure image size definition to central location
Andrew F. Davis [Wed, 31 Aug 2016 20:13:34 +0000 (15:13 -0500)]
Makefile: Move non-secure image size definition to central location

Currently the size of the non-secure image is defined in the makedefs
file in adition to individual SoC configuration files. The size of the
padded non-secure image does not depend on the SoC and is guaranteed to
be the same size by the padding so it should not be defined per SoC.
Remove the redundant definition and export the central definition.

Signed-off-by: Andrew F. Davis <afd@ti.com>
4 years agoMakefile: Use start address defined in config.h
Andrew F. Davis [Wed, 31 Aug 2016 20:13:33 +0000 (15:13 -0500)]
Makefile: Use start address defined in config.h

Currently the linker gets the start address for the image components
from per SoC lds files, whereas the code in the components gets its
address from an included config.h. This requires the address be
stored in two places and that both these files remain in sync, can lead
to errors and confusion. Define a symbol in code that can be referenced
by the linker to determine the code offset address, eliminating the need
to redefine the start address for the linker.

Signed-off-by: Andrew F. Davis <afd@ti.com>
4 years agoK2: Enable Hypervisor mode
Keerthy [Tue, 30 Aug 2016 10:12:40 +0000 (15:42 +0530)]
K2: Enable Hypervisor mode

Introduce function to switch to hypervisor mode for primary as
well as secondary CPUs. Keystone boot architecture mandates
using Boot Monitor to execute in monitor mode. The state change
from supervisor mode to hypervisor mode needs to be done in Boot
Monitor.

As part of switching modes set the Hyp Call Enable(HCE)
bit in Secure Configuration Register(SCR).

Signed-off-by: Keerthy <j-keerthy@ti.com>
5 years agosec: fix build warnings with -Wall
Tero Kristo [Fri, 13 Nov 2015 13:53:08 +0000 (15:53 +0200)]
sec: fix build warnings with -Wall

There are some un-used variables in the code, remove these to fix the
build warnings generated.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
5 years agosec: debug: fix build failures with DEBUG=1
Tero Kristo [Fri, 13 Nov 2015 13:45:42 +0000 (15:45 +0200)]
sec: debug: fix build failures with DEBUG=1

MPU_CFG registers were only declared internally under skern.c. Move the
register address declarations to the header, so the debug code can
access it also.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
5 years agoMakefile: Fix output when building .S files
Dave Gerlach [Tue, 27 Oct 2015 18:43:53 +0000 (13:43 -0500)]
Makefile: Fix output when building .S files

Currently nothing is output in the log when building .S files, fix the
makefile so that .S files are also listed in the simplified output when
building.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
5 years agoMakefile: Add header dependency check to build
Dave Gerlach [Tue, 27 Oct 2015 18:43:52 +0000 (13:43 -0500)]
Makefile: Add header dependency check to build

Make sure to rebuild any .c  or .S files that depend on header files that
have changed by generating .d dependency files for each object file. Also,
add the .d files that get generated to the .gitignore file and to the
make clean job.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
5 years agosoc: Introduce support for k2g
Nishanth Menon [Wed, 2 Sep 2015 13:12:17 +0000 (08:12 -0500)]
soc: Introduce support for k2g

Basic support for k2g

Based on original patch by Vitaly Andrianov <vitalya@ti.com>

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agosec: debug: Support DYNAMIC_DEBUG
Nishanth Menon [Wed, 30 Sep 2015 23:06:01 +0000 (18:06 -0500)]
sec: debug: Support DYNAMIC_DEBUG

One nice feature folks seem to want is the ability to do dynamic
enable and disable of print messages via smc instructions. This is
enabled by running make with DYNAMIC_DEBUG=1

Suggested-by: Madan Srinivas <madans@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agosec: skern: Abstract out PSCI commands out
Nishanth Menon [Wed, 16 Sep 2015 05:04:16 +0000 (00:04 -0500)]
sec: skern: Abstract out PSCI commands out

This allows us to add silicon vendor specific extensions seperately

See: http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/ for more
details.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agosec: skern: Print monitor details at boot
Nishanth Menon [Thu, 3 Sep 2015 00:34:28 +0000 (19:34 -0500)]
sec: skern: Print monitor details at boot

It is very easy to mix up binaries when we build for multiple
platforms and try to ensure we have the latest solution.

To help with the same, lets add a boot print to show us the details:
K2_BM_15.07-32-ge74254a1d3a6 SoC:k2hk built:16:42:18, Sep 29 2015

While at it update the default version information as well to match with
the latest tag.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agosec: skern: Add basic register accessors
Nishanth Menon [Fri, 11 Sep 2015 23:27:46 +0000 (18:27 -0500)]
sec: skern: Add basic register accessors

Simple register accessors to allow for consistent register access
functions as necessary. Add a basic barrier routine for serialization
where necessary.

NOTE: there is a bunch of cleanups needed through out the code to
ensure proper usage of accessors. we will get there eventually.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agosec: skern: Cast pointer for default address
Nishanth Menon [Tue, 29 Sep 2015 21:28:33 +0000 (16:28 -0500)]
sec: skern: Cast pointer for default address

Just a squash of sparse warning to explicitly cast 0 as the default
address pointer.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agosec: skern: Make unshared functions static
Nishanth Menon [Fri, 11 Sep 2015 23:00:20 +0000 (18:00 -0500)]
sec: skern: Make unshared functions static

Make functions that are used internally to skern to be static.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agosec: skern: Define shared functions
Nishanth Menon [Fri, 11 Sep 2015 22:58:42 +0000 (17:58 -0500)]
sec: skern: Define shared functions

Define the functions in the common header. These are used between the
C and Assembly code.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agosec: skern: Fix up proto declaration
Nishanth Menon [Fri, 11 Sep 2015 22:53:44 +0000 (17:53 -0500)]
sec: skern: Fix up proto declaration

Just follow ANSI standard and use void when no parameters
are expected. Fixes sparse warning:
skern.c:271:39: warning: non-ANSI function declaration of function
'fcn_p'

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agosec: debug: Include header to squash sparse warning
Nishanth Menon [Fri, 11 Sep 2015 22:48:48 +0000 (17:48 -0500)]
sec: debug: Include header to squash sparse warning

Including debug header ensures that we have the correct prototype
for the implementation done. This also squashes the sparse warning:

debug.c:103:6: warning: symbol 'skern_printf' was not declared. Should
it be static?

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agosec: debug: Provide option to get rid of UART options
Nishanth Menon [Thu, 3 Sep 2015 00:02:42 +0000 (19:02 -0500)]
sec: debug: Provide option to get rid of UART options

add option of doing make NOUART=1 which will get rid of
all access to uart for debug prints. This is pretty tricky
option that makes fails hard to debug. USE WITH CARE.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agosec: debug: Select debug prints at build
Nishanth Menon [Wed, 2 Sep 2015 23:34:29 +0000 (18:34 -0500)]
sec: debug: Select debug prints at build

We do not need to enable debug prints all the time - using a variable
based optimization is just plain useless when we can use build time
selection.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agosec: debug: Provide option to have configuration UART base address
Nishanth Menon [Wed, 2 Sep 2015 23:22:04 +0000 (18:22 -0500)]
sec: debug: Provide option to have configuration UART base address

Currently we support debug messages only to UART0. That is not need be
the case. Uart base address can be configurable if necessary.

Now, we can override it from soc specific config file OR
while building for a specific board as needed OR use the default
UART0. The only constraint is that the clocks and basic configuration
necessary for that UART should already be done.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agosec: debug: Replace existing debug prints with skern_debug
Nishanth Menon [Wed, 2 Sep 2015 23:34:29 +0000 (18:34 -0500)]
sec: debug: Replace existing debug prints with skern_debug

With this change, we deprecate all older debug prints in favor of
using skern_debug if we want to add debug messages OR skern_printf
if we want to print always.

While at this, make all "old exposed" data private for debug.

This allows us to control the debug entry points.

With this change, All debug messages are prefixed with DEBUG
to help differentiate with regular error messages.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agosec: debug: Add support for a minimal printf
Nishanth Menon [Wed, 2 Sep 2015 23:12:30 +0000 (18:12 -0500)]
sec: debug: Add support for a minimal printf

Provide support for a very simple printf alternative.
Use existing primitives to achieve the same old results.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agomakedefs: Cleanup unused variables
Nishanth Menon [Wed, 2 Sep 2015 00:12:21 +0000 (19:12 -0500)]
makedefs: Cleanup unused variables

cleanup remenants of unused variables, and while at it, add a minimal
set of comments.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoMakefile/makedefs: Export version information
Nishanth Menon [Wed, 16 Sep 2015 06:30:49 +0000 (01:30 -0500)]
Makefile/makedefs: Export version information

Export bootmonitor version information as defines for usage in code.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoMakefile: Add support for SoC specific make.inc
Nishanth Menon [Thu, 3 Sep 2015 10:43:52 +0000 (05:43 -0500)]
Makefile: Add support for SoC specific make.inc

make.inc can now exist in SoC specific folders for inclusion during
build of secure and non-secure components. This allows for conditional
build of components required for various SoC specific builds.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agomakedefs: Remove build-id from linker
Nishanth Menon [Wed, 16 Sep 2015 05:10:18 +0000 (00:10 -0500)]
makedefs: Remove build-id from linker

We dont use buildid, so, remove it. Fixes, the following gcc build warning:
/opt/gcc/arm/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld:
warning: .note.gnu.build-id section discarded, --build-id ignored.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoMakefile: Add support for sparse check
Nishanth Menon [Thu, 3 Sep 2015 10:43:52 +0000 (05:43 -0500)]
Makefile: Add support for sparse check

Build with make C=1 to check with sparse. by overriding the SPARSE
variable with other static analysers, Further additional checks may be
performed.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoMakefile: Allow build of tags and cscope output
Nishanth Menon [Mon, 24 Aug 2015 23:28:17 +0000 (18:28 -0500)]
Makefile: Allow build of tags and cscope output

Use tags and cscope for building browseable data. Create a softlink
Tags to the tags file to work with emacs as well.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoMakefile: Compress even more -remove SoC specific rules
Nishanth Menon [Tue, 1 Sep 2015 23:56:35 +0000 (18:56 -0500)]
Makefile: Compress even more -remove SoC specific rules

Since we now know the SoC list from the soc directory, we can just
use that list to build for all platforms. SoC specific rules make
makefile hard to deal with as SoCs explode in number in the future..
lets generate the list on the fly. The only caveat is to build with
image_<soc> instead of just <soc> as build target.. well.. not really
a big loss though..

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoMakefile: Allow for quiet build
Nishanth Menon [Mon, 24 Aug 2015 23:16:11 +0000 (18:16 -0500)]
Makefile: Allow for quiet build

Spam build console only if V=1 option is provided

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoMakefile: Use $(MAKE)
Nishanth Menon [Tue, 1 Sep 2015 23:21:33 +0000 (18:21 -0500)]
Makefile: Use $(MAKE)

See The following for more info.
https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html#MAKE-Variable

This is part of our effort to make parallel builds actually work!.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoMakefile: Simplify the build cleaning process
Nishanth Menon [Tue, 1 Sep 2015 23:18:17 +0000 (18:18 -0500)]
Makefile: Simplify the build cleaning process

using the SOC variable we can cleanup as necessary.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agomakedefs: Move map files to requisite directory.
Nishanth Menon [Tue, 1 Sep 2015 23:11:16 +0000 (18:11 -0500)]
makedefs: Move map files to requisite directory.

No need to keep them around in old directories anymore..

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoMakefile: Build the intermediate image files in OBJDIR too
Nishanth Menon [Tue, 1 Sep 2015 23:07:38 +0000 (18:07 -0500)]
Makefile: Build the intermediate image files in OBJDIR too

Since we build same source with various parameters, we would
reasonably want the image files to reside corresponding to the SoC as
well.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoMakefile: Allow build so that objects are built in seperate directory
Nishanth Menon [Tue, 1 Sep 2015 22:21:30 +0000 (17:21 -0500)]
Makefile: Allow build so that objects are built in seperate directory

With this change the object files can be routed as necessary

Now, we can do make O=<some_path> and build objects there.

By default, we now start building the objects in corresponding SoC
specific directories.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoMake.rules: Move common make rules to make.rules
Nishanth Menon [Tue, 1 Sep 2015 21:41:56 +0000 (16:41 -0500)]
Make.rules: Move common make rules to make.rules

No reason to keep things duplicated when we can create common makefile
rules..

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoMakefile: Use -C to build a sub directory
Nishanth Menon [Tue, 1 Sep 2015 20:52:03 +0000 (15:52 -0500)]
Makefile: Use -C to build a sub directory

cd dir;make is the wrong way to build a sub directory.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoMakefile: Get rid of linker script modification
Nishanth Menon [Tue, 1 Sep 2015 20:13:59 +0000 (15:13 -0500)]
Makefile: Get rid of linker script modification

we know that linker scripts can include other scripts. So why not just
keep the SoC specific deltas where they belong, now that we have an
SoC specific directory to work with..

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoAll: Introduce SoC specific config header file
Nishanth Menon [Tue, 1 Sep 2015 19:34:34 +0000 (14:34 -0500)]
All: Introduce SoC specific config header file

By avoiding having a single config file, we can now work towards
building all platforms in parallel.

This is part of the breakup of the build to allow parallel builds in the
system.

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoAdd a .gitignore file
Nishanth Menon [Mon, 24 Aug 2015 22:16:42 +0000 (17:16 -0500)]
Add a .gitignore file

For the usual purpose of ignoring temporary files

Signed-off-by: Nishanth Menon <nm@ti.com>
5 years agoboot-monitor: fix build warning using gcc 4.9 tool chain
Murali Karicheri [Thu, 6 Aug 2015 15:21:39 +0000 (11:21 -0400)]
boot-monitor: fix build warning using gcc 4.9 tool chain

Fix the following build warning when using gcc 4.9 tool chain,

skern.c: In function 'skern_init':
skern.c:285:15: warning: assignment makes integer from pointer without a cast
   addr[i * 2] = (unsigned int *)_skern_123_init;

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
5 years agoboot-monitor: fix makefile to support multiple jobs
Vitaly Andrianov [Tue, 4 Aug 2015 18:31:35 +0000 (14:31 -0400)]
boot-monitor: fix makefile to support multiple jobs

Makefile target "all" lists targets for multiple EVMs, which cannot be
built simultaneously. This doesn't allow to use multiple jobs.
This patch makes the targets built one after another, which fixes the
issue.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
5 years agoboot-monitor: don't set fast-boot for ARM0 core K2_BM_15.07
Vitaly Andrianov [Fri, 5 Jun 2015 12:45:08 +0000 (08:45 -0400)]
boot-monitor: don't set fast-boot for ARM0 core

Setting the fast-boot RBL entry point for ARM0 prevents RBL to perform a
normal boot sequence when kernel issues the reboot command. We need to
leave the CORE_N_BASE_ADDR for ARM0 unmodified to allow it to perform normal
RBL boot.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
5 years agoboot-monitor: fix up makedefs for yocto build
Murali Karicheri [Fri, 15 May 2015 20:29:32 +0000 (16:29 -0400)]
boot-monitor: fix up makedefs for yocto build

Newer versions of yocto build fails with all the hardcoded paths.
Fix this so that build can succeeds.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
5 years agoboot-monitor: add pre-built binary to support pre pg2 devices/evms
Murali Karicheri [Fri, 15 May 2015 14:53:47 +0000 (10:53 -0400)]
boot-monitor: add pre-built binary to support pre pg2 devices/evms

The fast boot support is not available on pre-pg2 k2hk devices and EVMs.
The current boot monitor source available is not backward compatible
with pre-pg2 socs. So to support these h/w, provide a pre-built binary
that can be used by the users. This binary is expected to be present
in the release pre-built binaries and UBI image. To build this binary
either revert the commit "boot-monitor: rework to support secondary
 CPU fast-boot" and build.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
6 years agoboot-monitor: rework to support secondary CPU fast-boot
Vitaly Andrianov [Mon, 9 Mar 2015 16:52:10 +0000 (12:52 -0400)]
boot-monitor: rework to support secondary CPU fast-boot

This commit changes the method of booting secondary ARM cores.
BM doesn't use anymore the same _skern_init function to initialize
all ARM cores. We have simplified _skern_123_init and corresponding
skern_123_init() for that.

When BM is being installed, it store _skern_123_init address at the
core_n_base_addr for each ARM core. When later we power on a slave core
RBL doesn't preform the complete boot, but branches directly to the
_skern_123_init()

_skern_123_init sets the monitor vectors and stack, initializes GIC
registers, and goes to non-secure SVR mode. There it initializes
non-secure SVR stack and branches to the kernel entry point.

This BM supports only fast boot mode only.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoboot-monitor: set L2ACTLR.8 bit K2_BM_14.09
Vitaly Andrianov [Fri, 22 Aug 2014 00:16:09 +0000 (20:16 -0400)]
boot-monitor: set L2ACTLR.8 bit

Disables DVM and cache maintenance operation message broadcast

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoboot-monitor: add workaround for stream performance degradation K2_BM_14.07
Murali Karicheri [Thu, 17 Jul 2014 16:28:17 +0000 (12:28 -0400)]
boot-monitor: add workaround for stream performance degradation

On Keystone II SOCs, to support IO coherency, the memory
pages have to be marked outer shareable. But this has
undesired effect on the system and there are extra
snoop related writes send on the bus which creates
pressure on the memory pipe and hence the performance.

Since this additional write traffic is for snoop-filter
which MSMC doesn't support, we can suppress those and
get back the performance.

So disables clean/evict from being pushed to external
memory by setting L2ACTLR[.3] = 1.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
6 years agoboot-monitor: clean up images for clean target
Murali Karicheri [Wed, 18 Jun 2014 14:51:44 +0000 (10:51 -0400)]
boot-monitor: clean up images for clean target

Currently make clean doesn't clean the SoC specific images. This
patch rename clean to build_clean and use clean to wipe out all of
images and objects.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
6 years agoboot-monitor: set NSACR.NS_SMP bit K2_BM_14.06
Vitaly Andrianov [Mon, 9 Jun 2014 13:51:12 +0000 (09:51 -0400)]
boot-monitor: set NSACR.NS_SMP bit

SMP Linux kernel sets the ACTRL.SMP bit. We need to set NSACR.NS_SMP bit
to make the ACTRL.SMP writable form non-secure world.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoboot-monitor: fix power on and power off sequence
Vitaly Andrianov [Wed, 28 May 2014 18:18:55 +0000 (14:18 -0400)]
boot-monitor: fix power on and power off sequence

Accordingly to PSCI API document the PSCI_CPU_ON just return ALREADY_ON
code for already running CPU. Otherwise it powers it on.

For POWER_OFF another CPU, the CPU just turns the DPSC off for required
CPU, but not wait for completion. If the CPU power off itself and it is not
the CPU 0. It calls WFI instruction, which has to complete the operation.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoboot-monitor: add and use PSCI definitions
Vitaly Andrianov [Tue, 27 May 2014 13:18:19 +0000 (09:18 -0400)]
boot-monitor: add and use PSCI definitions

We are converting boot-monitor to support PSCI API. This patch
adds command and error definitions from ARM DEN0022B document.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoboot-monitor: disable SMP bit on power on
Vitaly Andrianov [Tue, 27 May 2014 12:11:20 +0000 (08:11 -0400)]
boot-monitor: disable SMP bit on power on

We don't know the SMP bit status of the core after RBL boots it.
It is better to disable it explicitly.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoboot-monitor: add support of the PSCI_CPU_OFF API
Vitaly Andrianov [Wed, 14 May 2014 18:47:13 +0000 (14:47 -0400)]
boot-monitor: add support of the PSCI_CPU_OFF API

It adds support of the psci_cpu_off API. This support of powering
a particular core only, but not the entire cluster.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoboot-monitor: fix powering down cpu sequence
Vitaly Andrianov [Wed, 14 May 2014 18:43:39 +0000 (14:43 -0400)]
boot-monitor: fix powering down cpu sequence

Accordingly to tetris spec a powering itself core has to power off
itself by turning off ots DPSC, disable caches, flushes L1 data cache.
Only after that it has to disable SMP bit and execute a WFI instruction.

This patch also adds displaying cpi_id to debug output

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoboot monitor: add support for k2l and k2e devices.
Hao Zhang [Tue, 7 Jan 2014 21:59:28 +0000 (16:59 -0500)]
boot monitor: add support for k2l and k2e devices.

7 years agoboot-monitor: enable ECC and parity enable bit for L1 and L2 caches on ARM K2_BM_13.11
Murali Karicheri [Thu, 26 Sep 2013 18:18:28 +0000 (14:18 -0400)]
boot-monitor: enable ECC and parity enable bit for L1 and L2 caches on ARM

This is disabled as this is an optional feature. This patch enables this
on ARM for K2

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
7 years agoboot-monitor: fix the clobber list
Murali Karicheri [Thu, 29 Aug 2013 19:20:06 +0000 (15:20 -0400)]
boot-monitor: fix the clobber list

The SMP disable asm instruction needs to add r8 to clobber list

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
7 years agoboot-monitor: fix poweron and poweroff functions
Vitaly Andrianov [Thu, 15 Aug 2013 14:57:04 +0000 (10:57 -0400)]
boot-monitor: fix poweron and poweroff functions

This patch fixes several bugs in the skern_poweron_cpu() and
skern_poweroff_cpu()

1. makes *addr volatile
2. uses correct bits to poll on and off status
3. If the CPU turns off itself, doesn't poll the status
4. Reser SMP bit

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
7 years agoboot-monitor: add changes for errata 799270 and 798870
Murali Karicheri [Thu, 11 Jul 2013 18:50:07 +0000 (14:50 -0400)]
boot-monitor: add changes for errata 799270 and 798870

Also fix up function naming in sync with rest of the file

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
7 years agoboot-monitor: remove soft-float option
Murali Karicheri [Fri, 24 May 2013 19:38:21 +0000 (15:38 -0400)]
boot-monitor: remove soft-float option

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
7 years agoboot-monitor: fix MPU settings to provide user space access
Murali Karicheri [Mon, 6 May 2013 18:21:33 +0000 (14:21 -0400)]
boot-monitor: fix MPU settings to provide user space access

fix an address incrementing bug in the MPU setting code

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
7 years agoboot-monitor: update MPU settings for user mode access
Murali Karicheri [Mon, 18 Mar 2013 17:43:41 +0000 (13:43 -0400)]
boot-monitor: update MPU settings for user mode access

Some more settings for user mode access

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
7 years agoboot-monitor: adding conditional compile for simulator support code
Murali Karicheri [Tue, 16 Apr 2013 21:45:31 +0000 (17:45 -0400)]
boot-monitor: adding conditional compile for simulator support code

This removes the access to simulator workaround memeory access to DDR
space.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
7 years agoboot-monitor: updates for ARM errata 763126
Murali Karicheri [Mon, 15 Apr 2013 16:17:47 +0000 (12:17 -0400)]
boot-monitor: updates for ARM errata 763126

ACTLR bit31 to be set for errata 763126.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
8 years agoboot-monitor: set ACTLR.smp bit
Vitaly Andrianov [Tue, 2 Apr 2013 12:52:13 +0000 (08:52 -0400)]
boot-monitor: set ACTLR.smp bit

SMP bit in ACTLR requires to be set to enables receiving of instruction cache, BTB,
and TLB maintenance operations. This can be done only in Secure PL1 modes. So this
change is done in boot monitor code.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
8 years ago[temp] boot-monitor: add MPU settings to allow user space access to registers
Murali Karicheri [Fri, 22 Feb 2013 15:43:40 +0000 (10:43 -0500)]
[temp] boot-monitor: add MPU settings to allow user space access to registers

This is a temporary solution to allow user space access to BOOTCFG and
PSC registers so that DSPs can be loaded and booted from user space.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
8 years agoboot-monitor: disable debug printouts
Vitaly Andrianov [Wed, 20 Feb 2013 18:45:37 +0000 (13:45 -0500)]
boot-monitor: disable debug printouts

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
8 years agoboot-monitor: using arch_timer frequency that is passed from u-boot
Vitaly Andrianov [Wed, 20 Feb 2013 18:11:48 +0000 (13:11 -0500)]
boot-monitor: using arch_timer frequency that is passed from u-boot

The skern_init() is actually called with four parameters where
arch timer frequency is passed in R3 and dpsc_base in R2.
This patch fixes the bug by adding dpsc_base parameter before freq.

It also used the provided frequency instead of hard-coded value
to set the arch_timer_freq.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
8 years agoboot-monitor: add skern_putbyte() and skern_putui() functions
Vitaly Andrianov [Wed, 20 Feb 2013 18:00:29 +0000 (13:00 -0500)]
boot-monitor: add skern_putbyte() and skern_putui() functions

This patch adds debug functions to print byte and unsigned long values

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
8 years agoboot-monitor: update for configuring A15 for vfp, l2 latency etc
Murali Karicheri [Thu, 31 Jan 2013 20:17:45 +0000 (15:17 -0500)]
boot-monitor: update for configuring A15 for vfp, l2 latency etc

Enable l2 tag latency and enable VFP
Enable group0 for all interrupts in GIC

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
8 years agoboot-monitor: update L2 cache latency values
Murali Karicheri [Mon, 28 Jan 2013 20:48:59 +0000 (15:48 -0500)]
boot-monitor: update L2 cache latency values

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
8 years agoboot-monitor: update License information
Murali Karicheri [Mon, 28 Jan 2013 20:48:03 +0000 (15:48 -0500)]
boot-monitor: update License information

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
8 years agoboot-monitor: add license file
Murali Karicheri [Fri, 18 Jan 2013 22:59:59 +0000 (17:59 -0500)]
boot-monitor: add license file

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
8 years agoboot-monitor: set arch timer frequency register
Murali Karicheri [Fri, 18 Jan 2013 22:32:31 +0000 (17:32 -0500)]
boot-monitor: set arch timer frequency register

8 years agoboot-monitor: Documentation added
Murali Karicheri [Fri, 11 Jan 2013 17:01:07 +0000 (12:01 -0500)]
boot-monitor: Documentation added

Initial version of the readme.txt added

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
8 years agoboot-monitor: add top level build infrastructure
Murali Karicheri [Fri, 11 Jan 2013 16:57:15 +0000 (11:57 -0500)]
boot-monitor: add top level build infrastructure

This patch adds a top level infrastructure to build boot monitor
code. The build generates a config.h that configures the boot monitor
software.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
8 years agoboot-monitor: non-sec: add non secure init code
Murali Karicheri [Fri, 11 Jan 2013 16:54:44 +0000 (11:54 -0500)]
boot-monitor: non-sec: add non secure init code

This patch adds non secure init code that initialize the primary and
secondary boot monitor. On primary CPU, this is called from u-boot
that then calls the RBL API (smc #0) to execute skern_init() as a
privileged function call. As part of the primary init() call, the
secondary core entry point function gets updated at Rom Boot loader
(RBL) ARM magic address location. When secondary core is powered ON,
RBL gets executed and finally enters the secondary core entry point
function in boot monitor.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
8 years agoboot-monitor: sec: add monitor code and power on/off smc calls
Murali Karicheri [Fri, 11 Jan 2013 16:02:37 +0000 (11:02 -0500)]
boot-monitor: sec: add monitor code and power on/off smc calls

This patch implements boot monitor secure part.

boot monitor secure part is implemented in assembly(skernel.S) and C code
(skern.c). The assmembly code has the monitor vectors and provides a
init() function to do the following:-
    - Replace RBL monitor code with boot monitor code including the
      the vectors.
    - switches from RBL monitor stack to boot monitor stack
    - Calls skern_init() to initialize the secondary core entry point
      to boot monitor core.
monitor vector function direct smc calls to C code to execute following monitor
services:-
     - Power ON/OFF secondary CPUs
Also implements a debug function to put debug traces to UART port

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Cyril Chemparathy <cyril@ti.com>