summaryrefslogtreecommitdiff
path: root/cpukit/include (follow)
AgeCommit message (Collapse)Author
2020-03-02libfdt: De-inline fdt_header_size()Simon Glass
There does not seem to be a strong reason to inline this function. Also we are about to add some extra code to it which will increase its size. Move it into fdt.c and use a simple declaration in libfdt.h Signed-off-by: Simon Glass <sjg@chromium.org> Message-Id: <20200220214557.176528-2-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-02libfdt.h: add explicit cast from void* to uint8_t* in fdt(32|64)_stLuc Michel
Including libfdt.h in a C++ project fails during compilation with recent version of GCC or Clang. This simple example: extern "C" { #include <libfdt.h> } int main(void) { return 0; } leads to the following errors with GCC 9.1.0: /usr/include/libfdt.h: In function ‘void fdt32_st(void*, uint32_t)’: /usr/include/libfdt.h:139:16: error: invalid conversion from ‘void*’ to ‘uint8_t*’ {aka ‘unsigned char*’} [-fpermissive] 139 | uint8_t *bp = property; | ^~~~~~~~ | | | void* /usr/include/libfdt.h: In function ‘void fdt64_st(void*, uint64_t)’: /usr/include/libfdt.h:163:16: error: invalid conversion from ‘void*’ to ‘uint8_t*’ {aka ‘unsigned char*’} [-fpermissive] 163 | uint8_t *bp = property; | ^~~~~~~~ | | | void* This commit adds an explicit cast to uint8_t* to fix this issue. Signed-off-by: Luc Michel <luc.michel@greensocs.com> Message-Id: <20190910104824.1321594-1-luc.michel@greensocs.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-02libfdt: Replace GPL/BSD boilerplate/reference with SPDX tagsRob Herring
Replace instances of dual GPLv2 or BSD license boilerplate with SPDX tags. Signed-off-by: Rob Herring <robh@kernel.org> Message-Id: <20190620211944.9378-3-robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-02libfdt: Add FDT_CREATE_FLAG_NO_NAME_DEDUP flag that trades size for speedNicholas Piggin
Searching for duplicate names scales O(n^2) with the number of names added to a fdt, which can cause a noticable slowdown with larger device trees and very slow CPU cores. Add FDT_CREATE_FLAG_NO_NAME_DEDUP that allow the caller to trade fdt size for speed in the creation process. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Message-Id: <20190509094122.834-4-npiggin@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-02libfdt: Introduce fdt_create_with_flags()Nicholas Piggin
There is a need to be able to specify some options when building an FDT with the SW interface. This can be accomplished with minimal changes by storing intermediate data in the fdt header itself, in fields that are not otherwise needed during the creation process and can be set by fdt_finish(). The fdt.magic field is already used exactly this way, as a state to check with callers that the FDT has been created but not yet finished. fdt.version and fdt.last_comp_version are used to make room for more intermediate state. These are adjacent and unused during the building process. last_comp_version is not yet used for intermediate state, but it is zeroed and treated as used, so as to allow future growth easily. A new interface, fdt_create_with_flags() is added, which takes 32-bit flag value to control creation. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Message-Id: <20190509094122.834-3-npiggin@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-02libfdt: Make fdt_get_max_phandle() an inlineDavid Gibson
It's now a trivial wrapper around fdt_find_max_phandle() so we might as well inline it. We also remove it from the versioning linker script. Theoretically, that's a breaking ABI change except that we haven't yet released a version with it exposed in the shared object, so we can get away with it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-02libfdt: Add phandle generation helperThierry Reding
The new fdt_generate_phandle() function can be used to generate a new, unused phandle given a specific device tree blob. The implementation is somewhat naive in that it simply walks the entire device tree to find the highest phandle value and then returns a phandle value one higher than that. A more clever implementation might try to find holes in the current set of phandle values and fill them. But this implementation is relatively simple and works reliably. Also add a test that validates that phandles generated by this new API are indeed unique. Signed-off-by: Thierry Reding <treding@nvidia.com> Message-Id: <20190326153302.17109-3-thierry.reding@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-02libfdt: Add new maximum phandle lookup functionThierry Reding
The fdt_get_max_phandle() function has some shortcomings. On one hand it returns just a uint32_t which means to check for the "negative" error code a caller has to explicitly check against the error code (uint32_t)-1. In addition, the -1 is the only error code that can be returned, so a caller cannot tell the difference between the various failures. Fix this by adding a new fdt_find_max_phandle() function that returns an error code on failure and 0 on success, just like other APIs, and stores the maximum phandle value in an output argument on success. This also refactors fdt_get_max_phandle() to use the new function. Add a note pointing out that the new fdt_find_max_phandle() function should be preferred over fdt_get_max_phandle(). Signed-off-by: Thierry Reding <treding@nvidia.com> Message-Id: <20190326153302.17109-1-thierry.reding@gmail.com> [dwg: Reword for some inaccuracies in the commit message] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-02libfdt: add fdt_append_addrrange()AKASHI Takahiro
This function will append an address range property using parent node's "#address-cells" and "#size-cells" properties. It will be used in implementing kdump with kexec_file_load system call at linux kernel for arm64 once it is merged into kernel tree. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Message-Id: <20190327061552.17170-2-takahiro.akashi@linaro.org> [dwg: Correct a SEGV error in the testcase] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-02Revert "libfdt: Add phandle generation helper"David Gibson
This reverts commit 54ea41c22415cb0e283d22faf71202051c89400c. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-02libfdt: Add phandle generation helperThierry Reding
The new fdt_generate_phandle() function can be used to generate a new, unused phandle given a specific device tree blob. The implementation is somewhat naive in that it simply walks the entire device tree to find the highest phandle value and then returns a phandle value one higher than that. A more clever implementation might try to find holes in the current set of phandle values and fill them. But this implementation is relatively simple and works reliably. Also add a test that validates that phandles generated by this new API are indeed unique. Signed-off-by: Thierry Reding <treding@nvidia.com> Message-Id: <20190320151003.28941-1-thierry.reding@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-02libfdt: Fix FDT_ERR_NOTFOUND typos in documentationGeert Uytterhoeven
The actual error is FDT_ERR_NOTFOUND, not FDT_ERR_NOT_FOUND. Fixes: d29126c90acb0d70 ("libfdt: Add iterator over properties") Fixes: 902d0f0953d0074b ("libfdt: Add a subnodes iterator macro") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-02libfdt: Fix fdt_getprop_by_offset() parameter name in documentationGeert Uytterhoeven
The second parameter of fdt_getprop_by_offset() is called "offset", not "ffset". Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-02libfdt: Don't use memcpy to handle unaligned reads on ARMDavid Gibson
6dcb8ba4 "libfdt: Add helpers for accessing unaligned words" introduced the fdt32_ld() and fdt64_ld() helpers for loading values from the FDT blob which might not be naturally aligned. This matters for ARM, where attempting a plain unaligned load will often cause an exception. However, it seems the memcpy() we used here was surprisingly expensive, making libfdt nearly 6x slower on at least some ARM platforms. This patch takes an alternative approach, using a bunch of 1-byte loads and shifts to implement the helpers. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-03-02libfdt: return correct value if #size-cells property is not presentJohn Clarke
According to the device tree specification, the default value for #size-cells is 1, but fdt_size_cells() was returning 2 if this property was not present. This patch also makes fdt_address_cells() and fdt_size_cells() conform to the behaviour documented in libfdt.h. The defaults are only returned if fdt_getprop() returns -FDT_ERR_NOTFOUND, otherwise the actual error is returned. Signed-off-by: John Clarke <johnc@kirriwa.net>
2020-02-28score: Fix context switch extensions (SMP)Sebastian Huber
In uniprocessor and SMP configurations, the context switch extensions were called during _Thread_Do_dispatch(): void _Thread_Do_dispatch( Per_CPU_Control *cpu_self, ISR_Level level ) { Thread_Control *executing; executing = cpu_self->executing; ... do { Thread_Control *heir; heir = _Thread_Get_heir_and_make_it_executing( cpu_self ); ... _User_extensions_Thread_switch( executing, heir ); ... _Context_Switch( &executing->Registers, &heir->Registers ); ... } while ( cpu_self->dispatch_necessary ); ... } In uniprocessor configurations, this is fine and the context switch extensions are called for all thread switches except the very first thread switch to the initialization thread. However, in SMP configurations, the context switch may be invalidated and updated in the low-level _Context_Switch() routine. See: https://docs.rtems.org/branches/master/c-user/symmetric_multiprocessing_services.html#thread-dispatch-details In case such an update happens, a thread will execute on the processor which was not seen in the previous call of the context switch extensions. This can confuse for example event record consumers which use events generated by a context switch extension. Fixing this is not straight forward. The context switch extensions call must move after the low-level context switch. The problem here is that we may end up in _Thread_Handler(). Adding the context switch extensions call to _Thread_Handler() covers now also the thread switch to the initialization thread. We also have to save the last executing thread (ancestor) of the processor. Registers or the stack cannot be used for this purpose. We have to add it to the per-processor information. Existing extensions may be affected, since now context switch extensions use the stack of the heir thread. The stack checker is affected by this. Calling the thread switch extensions in the low-level context switch is difficult since at this point an intermediate stack is used which is only large enough to enable servicing of interrupts. Update #3885.
2020-02-26config: Initialize IO drivers on demandSebastian Huber
2020-02-25config: Resurrect NULL_DRIVER_TABLE_ENTRYSebastian Huber
This define may be used by application configurations for the CONFIGURE_APPLICATION_EXTRA_DRIVERS definition. Update #3875.
2020-02-25config: Add <rtems/confdefs/wkspace.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Change licence of <rtems/confdefs.h> to BSD-2-Clause according to file history. Update #3053. Close #3875.
2020-02-25config: Add <rtems/confdefs/objectsposix.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/wkspacesupport.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/objectsclassic.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/threads.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/unlimited.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/iodrivers.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/console.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/initthread.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/inittask.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/extensions.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/newlib.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/clock.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/mcpi.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/malloc.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Move the default configuration to library files so that application configurations do not include the definitions for the default case. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/bdbuf.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/scheduler.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/libio.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/percpu.h>Sebastian Huber
Remove comments and copyrightable content from the moved content. Use BSD-2-Clause for new file according to file history of <rtems/confdefs.h>. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/bsp.h>Sebastian Huber
Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Add <rtems/confdefs/libpci.h>Sebastian Huber
Derive copyright and license for new file form the file history. Update #3875.
2020-02-25config: Add <rtems/confdefs/obsolete.h>Sebastian Huber
Unify handling of obsolete configuration options. Remove comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
2020-02-25config: Remove _Configure_Max_Objects()Sebastian Huber
Use rtems_resource_maximum_per_allocation() directly. The use of _Configure_Zero_or_one() was superfluous. Update #3875.
2020-02-25config: Improve _Configure_From_workspace()Sebastian Huber
Commit 4c09f4b3fefc7ba5c5868a97ad00c1ee14a06677 changed the cast from size_t to ssize_t to try to fix an workspace issue on 16-bit architectures. This change was reverted by commit 7ff6115b8b913d848b8fe76daf72ca0b4bbf2548 for the workspace but not _Configure_From_workspace(). Change the cast to uintptr_t to be in line with the Heap Handler.
2020-02-25config: Remove CONFIGURE_DISABLE_SMP_CONFIGURATIONSebastian Huber
The CONFIGURE_DISABLE_SMP_CONFIGURATION configuration option and rtems_configuration_is_smp_enabled() were added during the SMP support development cycle as a workaround to fix some testsuite failures in SMP configurations. All use cases were replaced with tests for specific conditions. The configuration option and test macro were undocumented. Close #3876.
2020-02-25score: _Scheduler_Is_non_preempt_mode_supported()Sebastian Huber
If the non-preempt mode for threads is supported depends on the scheduler implementation. Add _Scheduler_Is_non_preempt_mode_supported() to indicate this. Update #3876.
2020-02-25config: CONFIGURE_INIT_TASK_INITIAL_MODESSebastian Huber
Determine the default for CONFIGURE_INIT_TASK_INITIAL_MODES depeding on whether RTEMS_SMP is defined or not. In the tests, use CONFIGURE_INIT_TASK_INITIAL_MODES to explicitly request RTEMS_NO_PREEMPT mode if necessary. Update #3876.
2020-02-25score: Add _SMP_Need_inter_processor_interrupts()Sebastian Huber
Test for the proper system condition instead of using the rtems_configuration_is_smp_enabled() workaround. Update #3876.
2020-02-25libio: Add POSIX user environment pointer to TCBSebastian Huber
The IO library used a POSIX key to store an optional POSIX user environment pointer. This pulled in the POSIX keys support in every application configuration. Add a user environment pointer to the thread control block (TCB) instead. Applications which do not need the POSIX user environment will just get an overhead of one pointer per thread. Close #3882.
2020-02-25config: Add _SMP_Is_enabledSebastian Huber
Move the is SMP enabled configuration constant out of the configuration table. Since this was the last configuration constant in rtems_configuration_table, remove this type. Update #3875.
2020-02-25config: Add _SMP_Processor_configure_maximumSebastian Huber
Move the processor maximum configuration constant out of the configuration table. Update #3875.
2020-02-25config: Add _Workspace_Is_unifiedSebastian Huber
Move the unified workspace configuration constant out of the configuration table. Provide a default definition of the unified workspace constant. Update #3875.