lib/utilities.h provided MB and GB macros so include from there
instead of providing the definition again for a53 platforms.
Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Remove all remaining instances of "# vim: ..." in files.
This vim settings were part of the initial commit. But no reason
to keep them.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Add convenience macros metal_err, metal_warn, metal_info, metal_dbg
to avoid using excessively long and redundant metal_log(METAL_LOG_*).
Add "function-name:line-number" prefix to all messages if the option
WITH_FUNC_LINE_LOG is set ON during the configuration phase.
Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>
As lib/system/generic/sys.h has metal/errno.h add this to the freertos
equivalent.
This fixes some compilation issues when linking against certain FreeRTOS port
BSPs.
Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
The lib/atomic.h exports memory_order enum into the global namespace,
but none of its enumerators. According to Section 7.3.3 "The using
declaration" of the C++ standard: "specifying an enumeration name
in a using-declaration does not declare its enumerators in
the using-declaration's declarative region." See also:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0943r1.html
Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>
This should have no functional change, but makes this header consistent
with how the other headers are organized.
Signed-off-by: Andrew Davis <afd@ti.com>
Enable cache, IPI, exception and shared-memory operations on Versal A72
for Libmetal.
Additionally, as the code for A72 and A53 is almost identical, move
the common code to generic/xlnx_common/zynqmp_aarch64 and differentiate
the slight differences with macro checks.
Signed-off-by: Ben Levinsky <ben.levinsky@xilinx.com>
Acked-by: tanmay.shah@xilinx.com
The METAL_MUTEX_INIT macro has been deprecated in release 2021.04.0
Remove it after it has been in a deprecated state for 2 years.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Missing header became evident after a code refactor in another NuttX
component, which resulted in build warnings.
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Declare PROJECT_EC_FLAGS to be a global property
to simplify code for target_compile_options.
Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>
The metal_machine_io_mem_map() used to call Xil_SetMPURegion directly
and could get into an infinite loop. Replace the faulty code in
metal_machine_io_mem_map() with Xil_MemMap() call and assert it succeeds.
Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>
Zephyr has prefixed all of its includes with <zephyr/...>. While the old
mode can still be used (CONFIG_LEGACY_INCLUDE_PATH) and is still enabled
by default, it's better to be prepared for its removal in the future.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Replace the architecture-specific machine directories with a common
C function for polling which calls to arch_cpu_idle.
Add a special case to map Zephyr arm64 to libmetal aarch64 in defining
PROJECT_PROCESSOR variable.
Set the MACHINE variable based CONFIG_ARCH instead of testing
individual arch config flags.
Signed-off-by: Eugene Cohen <quic_egmc@quicinc.com>
The file descriptor `irq_notify_fd` does not have the close-on-exec
(`FD_CLOEXEC`) flag so it possibly leaks to child processes.
This adds an `EFD_CLOEXEC` flag to the second argument of the `exentfd(2)` call,
which tells it to set an `FD_CLOEXEC` flag on the new file descriptor.
Signed-off-by: Kenta Sato <tosainu.maple@gmail.com>
Fix "unbalanced grouping commands" warnings by cleaning up
the end-of-block occurrences, defined without starting tag.
No need to define an API interface block in these files, the
interface is already described in the main sleep.h file.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
The currently missing implementation causes invalid timeouts when sending
remoteproc messages over virtIO. With this change, the specified timeout
of 15 seconds can be achieved. This seems to be the only usage in Zephyr.
Signed-off-by: Matthias Fend <matthias.fend@emfend.at>
Fix EWARM compilation error due to void pointer usage.
This fix has already been implemented for the generic system, but
was missing for the FreeRTOS.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
The header files including must be outside of the extern "C" { statement.
To be able to be included from C++ code.
Else such error can occur (reproduce on STM32MP1Cube distribution)
gcc/arm-none-eabi/include/c++/10.2.1/atomic:1467:3: error: template
with C linkage
1467 | template<typename _ITp>
| ^~~~~~~~
In file included from STM32CubeMP1/Middlewares/Third_Party/OpenAMP/
open-amp/lib/include/openamp/rpmsg.h:16,
from STM32CubeMP1/Middlewares/Third_Party/OpenAMP/
open-amp/lib/include/openamp/open_amp.h:11,
from empty_main.cpp:1:
STM32CubeMP1/Middlewares/Third_Party/OpenAMP/libmetal/lib/include/
metal/mutex.h:16:1: note: 'extern "C"' linkage
started here
16 | extern "C" {
| ^~~~~~~~~~
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
warning: makes pointer from integer without a cast
note: expected ‘void *’ but argument is of type ‘long unsigned int’
Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
Associated to the re-use of FreeRTOS mutex relying on the FreeRTOS
scheduling policy.
Add compilation warning message to indicate that the use of static
initialization of the atomic mutex for FreeRTOS environment is deprecated.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Re-enable the use of FreeRTOS mutex to take advantage of the
FreeRTOS priority-based preemptive scheduling policy.
This reverts commit 10a0d5be4a.
Fix checkpatch complaints, associated to the patch revert. Initial
patch did not respect the new coding rules.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Arm AArch32 processors have the same WFI assembly instruction
and so can works with the existing cortexm support.
Rename cortexm directory to arm.
Build tested with stm32mp157c_dk2 for Cortex-M,
rcar_h3ulcb for Cortex-R.
Signed-off-by: Julien Massot <julien.massot@iot.bzh>
metal_io_virt returns NULL on invalid input metal_io_region.
Check ptr before use it and remove the offset check which
is already tested in metal_io_virt.
Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
Zephyr ships now a different API for cache management. Instead of
hijacking the call into Zephyr, use the proper API directly in libmetal.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This unmaps the device regions which were opened during metal_uio_dev_open.
Failure to do this results in a file descriptor leak.
Signed-off-by: Lane Kolbly <lane.kolbly@ni.com>
PROJECT_VERSION* variables are recognized by cmake. Rename the
PROJECT_VER* variables used for the version.
Create a version file to make it easier to find and update the version.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
metal_sleep_usec() used portTICK_PERIOD_MS to determine how long to
sleep. If the FreeRTOS tick rate is set to greater than 1000, this will
be 0, resulting in a divide by zero error at run time. This changes it
to use pdMS_TO_TICKS(), which can accomodate higher tick rates.
Signed-off-by: Ed Mooring <ed.mooring@linaro.org>
According to UIO documentation, the offset device tree property
purpose is to be used "if the device’s memory is not page aligned".
Quoting the same documentation:
"To map the memory of mapping N, you have to use N times the page
size as your offset"
So wee need to pass i * getpagesize() to get the correct mapping,
otherwise, we end up with all io_region pointing to the same area.
Signed-off-by: Leo Sartre <sartre.l@ecagroup.com>
The MDK-ARM ARMCC doesn't provide the "stdatomic.h", however, with the
option "--gnu", it can support the standard gcc atomic routines.
This patch makes the armcc compiler use the "compiler/gcc/atomic.h"
Signed-off-by: Haithem Rahmani <haithem.rahmani@st.com>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
The GNU extensions enableable via the "--gnu" compile option, is
mandatory for the ARMCC to benefit from GNU atomic routines and macros.
This commit adds compilation error to notify user about ARMCC
Signed-off-by: Haithem Rahmani <haithem.rahmani@st.com>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Error values use in the library are not POSIX. Unlike the GNU gcc,the
EWARM toolchain doesn't support error such as EINVAL. To ensure coherency
in error management we have to ensure that library and application use
the same errno. Currently an "errno.h" is provided at application level
which makes GCC work correctly, but this is not the case for the IAR.
the added list is based on FreeBSD errno.h.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Includes are not found by the IAR.
As they seems unused, just suppress them.
Signed-off-by: Haithem Rahmani <haithem.rahmani@st.com>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
The sysfs attribute must be closed before metal_uio_read_map_attr()
function returns otherwise a resource is leaked.
Signed-off-by: Leo Sartre <sartre.l@ecagroup.com>
libmetal's libmetal_sleep_usec() takes a sleep time in micro-seconds.
The FreeRTOS function underlying it takes a sleep time in task ticks.
This was not properly corrected for, resulting in sleep times that
were off by an order of magnitude. The test code attempted to
correct for this as well, in the same wrong way.
Lastly, the metal_get_timestamp() function returned a value in
task ticks alone. This is a configuration dependent value.
This patch changes all three places to use microseconds for the
input and output values.
Signed-off-by: Ed Mooring <ed.mooring@linaro.org>