Commit Graph

34808 Commits

Author SHA1 Message Date
Kinsey Moore
127980c799 cpukit/microblaze: Add exception framework
This patch updates the CPU_Exception_frame to include all necessary
registers, combines hardware snd software exception handlers into a
shared vector, provides an architecture-specific hook for taking
control of exception handling, and moves exception handling over to
actually using the CPU_Exception_frame instead of a minimal interrupt
stack frame. As the significant contents of _exception_handler.S have
been entirely rewritten, the copyright information on this file has been
updated to reflect that.
2022-02-04 11:30:59 -06:00
Alex White
37543e1968 microblaze: Add support for libbsd networking
This includes fixes and improvements necessary to get libbsd networking
running.
2022-02-01 16:58:24 -06:00
Jennifer Averett
50a6580da0 microblaze: Add support for libbsd. 2022-02-01 16:58:24 -06:00
Sebastian Huber
20ca3b09ba sparc: Mark dl06 as expected fail 2022-01-28 08:43:19 +01:00
Sebastian Huber
b519e509a9 sptests: Avoid a dependency on errno
Avoid a dependency on errno which might be a thread-local object.  The tests
sp01, spstkalloc02, and sptls03 assume that no thread-local storage object is
present.

Update #4560.
2022-01-28 08:03:48 +01:00
Kinsey Moore
b539af865e cpukit: Prevent error with disabled stack checker
When the stack checker is not enabled, the stack checker reporting
function can still be called. This prevents that call from performing a
null memory access in trying to find the high water mark if the stack
checker was never initialized.

This also introduces a test to ensure this call does not cause a crash.

Closes #4588
2022-01-27 13:07:30 -06:00
Sebastian Huber
2145e0c7bf Remove obsolete rtems_gxx_*() implementation
GCC versions prior to 6.1 used a RTEMS thread model based on
rtems_gxx_*() functions. GCC version 6.1 or later uses the
self-contained synchronization objects of Newlib <sys/lock.h> for the
RTEMS thread model.

Remove the obsolete implementation.

Close #3143.
2022-01-27 11:06:46 +01:00
Sebastian Huber
e3f70b379b bsps: Avoid use of memcpy() in bsp_fdt_copy()
The memcpy() function may be not loaded at the time bsp_fdt_copy() is
called.
2022-01-19 08:11:20 +01:00
Christian Mauderer
aa95122c17 bsp/atsam: Optionally use DMA for UART Rx
If the system is busy with other interrupts and the UART is set to a
fast baud rate, it's possible to loose UART interrupts and therefore
characters. This allows to optionally enable a DMA for the UARTs so that
a number of lost interrupts can be tolerated.

The number of DMAs on this chip is limited and not not all applications
need that feature. Therefore the DMA is disabled by default.

Close #4578
2022-01-18 08:41:15 +01:00
Christian Mauderer
fbd18c09af bsp/atsam: Merge USART and UART driver
If no extended features of the USART are used and if the comparison
feature of the UART is not used, the two modules are compatible. The
drivers were nearly identical except for some names of the defines.

This patch merges the two drivers into one.

Update #4578
2022-01-18 08:41:11 +01:00
Sebastian Huber
12a2a8e442 arm: Optimize interrupt handling
Use the SRS (Store Return State) instruction if available.  This
considerably simplifies the context save and restore.
2022-01-17 08:14:12 +01:00
Sebastian Huber
84ba194477 arm: Fix stack alignment during interrupt handling
On a public interface, the stack pointer must be aligned on an 8-byte
boundary.  However, it may temporarily be only aligned on a 4-byte
boundary.  The interrupt handling code must ensure that the stack
pointer is properly aligned before it calls a function.  See also:

https://developer.arm.com/documentation/den0013/d/Interrupt-Handling/External-interrupt-requests/Nested-interrupt-handling

Update #4579.
2022-01-17 08:14:12 +01:00
Sebastian Huber
41a1903dd9 arm: Avoid duplicate move from CPSR
Update #4579.
2022-01-17 08:12:15 +01:00
Sebastian Huber
0290e44b28 arm: Rework per-CPU control in interrupt handling
Use volatile register r0 for the per-CPU control of the current
processor instead of the non-volatile register r7.  This enables the use
of r7 in a follow up patch.  Do the interrupt handling in ARM mode.

Update #4579.
2022-01-15 19:49:41 +01:00
Sebastian Huber
2d1ea1abae arm: Use push/pop instructions for readability
Update #4579.
2022-01-15 19:49:41 +01:00
Sebastian Huber
4e530464b0 bsps: Default to CPU counter benchmark timer
Most BSPs which used the stubbed benachmark timer provide a CPU counter.
All BSPs provide at least a stub CPU counter.  Simply use the benchmark
timer implementation using the CPU counter.
2022-01-15 19:49:41 +01:00
Sebastian Huber
944c210b3d bsp/imx7: dl06 fails expectedly 2022-01-14 16:26:54 +01:00
Sebastian Huber
93ebc9da69 libtests/dl10: Enter shell on demand
Use rtems_shell_wait_for_input() similar to other potentially
interactive test programs.
2022-01-14 08:02:38 +01:00
Sebastian Huber
671f126a3a libtests/ofw01: Fix device tree blob alignment
A device tree blob must be aligned on an 8-byte boundary.
2022-01-13 15:15:52 +01:00
Gedare Bloom
6c36cb7a48 aarch64: always boot into EL1NS
Always start the executive in Exception Level 1, Non-Secure mode.
If we boot in EL3 Secure with GICv3 then we have to initialize
the distributor and redistributor to set up G1NS interrupts
early in the boot sequence before stepping down from EL3S to EL1NS.

Now there is no need to distinguish between secure and non-secure
world execution after the primary core boots, so get rid of the
AARCH64_IS_NONSECURE configuration option.
2022-01-12 09:00:19 -07:00
Gedare Bloom
63d27156cb arm/gicv3: refactor DIST initialization to helper 2022-01-12 09:00:19 -07:00
Gedare Bloom
ea7b1b79f8 bsps/aarch64: refactor register init and hooks 2022-01-12 09:00:19 -07:00
Sebastian Huber
37377b0f9d spintrcritical21: Clear pending events
The test runner checks that there are no pending events after a test
case.
2022-01-12 14:24:23 +01:00
Sebastian Huber
00081b30a8 Fix device tree blob alignment
A device tree blob must be aligned on an 8-byte boundary.
2022-01-11 18:01:17 +01:00
Sebastian Huber
cbc92325a1 bsp/qoriq: Implement Interrupt Manager directives
Update #3269.
2022-01-11 16:18:11 +01:00
Sebastian Huber
963a26c34b libtests/ofw01: Fix wrapped in bsp_fdt_get()
Use the stack pointer to check if we have to return the real device tree
since bsp_fdt_get() may get called before the BSS is cleared to zero.
2022-01-11 16:18:11 +01:00
Sebastian Huber
b982b8d44f build: Fix build item format 2022-01-11 16:18:11 +01:00
Sebastian Huber
8657986989 libtest: Check for pending events
Make sure there are no pending events after a test case.
2021-12-22 10:29:13 +01:00
Sebastian Huber
d40477161e rtems: Fix Clock Manager parameter descriptions
Update #4572.
2021-12-22 08:17:50 +01:00
Sebastian Huber
18e47db518 bsp/mrm332: Fix TLS support in linker command file 2021-12-22 08:17:49 +01:00
Joel Sherrill
e92bc25453 Remove powerpc/haleakala board
Closes #4302.
2021-12-17 10:28:07 -06:00
Ryan Long
98ab69323e libmisc/rtems-fdt: close() file 'bf'
close() file 'bf' to avoid leaking descriptor.

CID 1437645: Resource leak in rtems_fdt_load().

Closes #4297
2021-12-17 10:27:27 -06:00
Sebastian Huber
60cec828e7 dtc: Update VERSION 2021-12-14 16:06:19 +01:00
Vikram Garhwal
75b3f48aa3 libfdt: overlay: make overlay_get_target() public
This is done to get the target path for the overlay nodes which is very useful
in many cases. For example, Xen hypervisor needs it when applying overlays
because Xen needs to do further processing of the overlay nodes, e.g. mapping of
resources(IRQs and IOMMUs) to other VMs, creation of SMMU pagetables, etc.

Signed-off-by: Vikram Garhwal <fnu.vikram@xilinx.com>
Message-Id: <1637204036-382159-2-git-send-email-fnu.vikram@xilinx.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
Elvira Khabirova
8b21a1b9b2 libfdt: fix an incorrect integer promotion
UINT32_MAX is an integer of type unsigned int. UINT32_MAX + 1 overflows
unless explicitly computed as unsigned long long. This led to some
invalid addresses being treated as valid.

Cast UINT32_MAX to uint64_t explicitly.

Signed-off-by: Elvira Khabirova <e.khabirova@omp.ru>
2021-12-14 16:00:44 +01:00
Georg Kotheimer
4c05a91712 libfdt: Add ALIGNMENT error string
The ALIGNMENT error was missing a string, leading to <unknown error>
being returned.

Signed-off-by: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
Andre Przywara
c07e23899b fdtget: Fix signedness comparisons warnings
With -Wsign-compare, compilers warn about a mismatching signedness in
the different legs of the conditional operator, in fdtget.c.

In the questionable expression, we are constructing a 16-bit value out of
two unsigned 8-bit values, however are relying on the compiler's
automatic expansion of the uint8_t to a larger type, to survive the left
shift. This larger type happens to be an "int", so this part of the
expression becomes signed.

Fix this by explicitly blowing up the uint8_t to a larger *unsigned* type,
before doing the left shift. And while we are at it, convert the hardly
readable conditional operator usage into a sane switch/case expression.

This fixes "make fdtget", when compiled with -Wsign-compare.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Message-Id: <20210618172030.9684-3-andre.przywara@arm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
David Gibson
21351a2f79 Fix CID 1461557
Coverity gets a bit confused by loading fdt_size_dt_strings() and
using it in a memmove().  In fact this is safe because the callers
have verified this information (via FDT_RW_PROBE() in fdt_pack() or
construction in fdt_open_into()).

Passing in strings_size like we already do struct_size seems to get
Coverity to follow what's going on here.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
Rob Herring
34052ef78c libfdt: Add FDT alignment check to fdt_check_header()
Only checking the FDT alignment in fdt_ro_probe_() means that
fdt_check_header() can pass, but then subsequent API calls fail on
alignment checks. Let's add an alignment check to fdt_check_header() so
alignment errors are found up front.

Cc: Tom Rini <trini@konsulko.com>
Cc: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Message-Id: <20210406190712.2118098-1-robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
David Gibson
a3fa0702c8 libfdt: Fix a possible "unchecked return value" warning
Apparently the unchecked return value of the first fdt_next_tag() call in
fdt_add_subnode_namelen() is tripping Coverity Scan in some circumstances,
although it appears not to for the scan on our project itself.

This fdt_next_tag() should always return FDT_BEGIN_NODE, since otherwise
the fdt_subnode_offset_namelen() above would have returned BADOFFSET or
BADSTRUCTURE.

Still, add a check to shut Coverity up, gated by a can_assume() to avoid
bloat in small builds.

Reported-by: Ryan Long <ryan.long@oarcorp.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
Justin Covell
a582ab37c2 Set last_comp_version correctly in new dtb and fix potential version issues in fdt_open_into
Changes in v3:
- Remove noop version sets
- Set version correctly on loaded fdt in fdt_open_into

Fixes: f1879e1a50eb ("Add limited read-only support for older (V2 and V3) device tree to libfdt.")

Signed-off-by: Justin Covell <jujugoboom@gmail.com>

Message-Id: <20201229041749.2187-1-jujugoboom@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
David Gibson
0b85832782 libfdt: Tweak description of assume-aligned load helpers
There's a small inaccuracy in the comment describing these new helpers.
This corrects it, and reformats while we're there.

Fixes: f98f28ab ("libfdt: Internally perform potentially unaligned loads")
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
Tom Rini
03b601aff1 libfdt: Internally perform potentially unaligned loads
Commits 6dcb8ba4 "libfdt: Add helpers for accessing unaligned words"
introduced changes to support unaligned reads for ARM platforms and
11738cf01f15 "libfdt: Don't use memcpy to handle unaligned reads on ARM"
improved the performance of these helpers.

On further discussion, while there are potential cases where we could be
used on platforms that do not fixup unaligned reads for us, making this
choice the default is very expensive in terms of binary size and access
time.  To address this, introduce and use new fdt{32,64}_ld_ functions
that call fdt{32,64}_to_cpu() as was done prior to the above mentioned
commits.  Leave the existing load functions as unaligned-safe and
include comments in both cases.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Message-Id: <20201211022736.31657-1-trini@konsulko.com>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
Tom Rini
064a1d76a4 libfdt: Check for 8-byte address alignment in fdt_ro_probe_()
The device tree must be loaded in to memory at an 8-byte aligned
address.  Add a check for this condition in fdt_ro_probe_() and a new
error code to return if we are not.

Signed-off-by: Tom Rini <trini@konsulko.com>
Message-Id: <20201104130605.28874-1-trini@konsulko.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
Andre Przywara
611a2a5a51 libfdt: Fix kernel-doc comments
The API documentation in libfdt.h seems to follow the Linux kernel's
kernel-doc format[1].

Running "scripts/kernel-doc -v -none" on the file reports some problems,
mostly missing return values and missing parameter descriptions.

Fix those up by providing the missing bits, and fixing the other small
issues reported by the script.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/doc-guide/kernel-doc.rst
Message-Id: <20201012165331.25016-1-andre.przywara@arm.com>

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
Andre Przywara
65b98121da libfdt: fdt_strerror(): Fix comparison warning
With -Wsign-compare, compilers warn about a mismatching signedness
in a comparison in fdt_strerror().

Force FDT_ERRTABSIZE to be signed (it's surely small enough to fit), so
that the types match. Also move the minus sign to errval, as this is
actually what we use in the next line.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Message-Id: <20201001164630.4980-7-andre.przywara@arm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
Andre Przywara
140935c560 libfdt: fdt_get_string(): Fix sequential write comparison warnings
With -Wsign-compare, compilers warn about a mismatching signedness in
comparisons in fdt_get_string().

Introduce a new usigned variable, which holds the actual (negated)
stroffset value, so we avoid negating all the other variables and have
proper types everywhere.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Message-Id: <20201001164630.4980-6-andre.przywara@arm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
Andre Przywara
58b4fe7cd5 libfdt: libfdt_wip: Fix comparison warning
With -Wsign-compare, compilers warn about a mismatching signedness
in a comparison in fdt_setprop_inplace_namelen_partial().

fdt_getprop_namelen() will only return negative error values in "proplen"
if the return value is NULL. So we can rely on "proplen" being positive
in our case and can safely cast it to an unsigned type.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Message-Id: <20201001164630.4980-5-andre.przywara@arm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
Andre Przywara
113cc99965 libfdt: fdt_create_with_flags(): Fix comparison warning
With -Wsign-compare, compilers warn about a mismatching signedness
in a comparison in fdt_create_with_flags().

By making hdrsize a signed integer (we are sure it's a very small
number), we avoid all the casts and have matching types.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Message-Id: <20201001164630.4980-4-andre.przywara@arm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00
Andre Przywara
a5ec1266e5 libfdt: fdt_move(): Fix comparison warnings
With -Wsign-compare, compilers warn about a mismatching signedness
in comparisons in fdt_move().

This stems from "bufsize" being passed in as a signed integer, even
though we would expect a buffer size to be positive.

Short of changing the prototype, check that bufsize is not negative, and
cast it to an unsigned type in the comparison.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Message-Id: <20201001164630.4980-3-andre.przywara@arm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-14 16:00:44 +01:00