summaryrefslogtreecommitdiffstats
path: root/cpukit (follow)
Commit message (Collapse)AuthorAgeFilesLines
* imfs: Replace devfs with an IMFS specializationSebastian Huber2020-03-0918-816/+213
| | | | | | | | | | | | | | | | Add a simplified path evaluation function IMFS_eval_path_devfs() for a device only IMFS configuration. The code size can be further reduced by the application if it disables the support for legacy IO drivers via: #define CONFIGURE_IMFS_DISABLE_MKNOD #define CONFIGURE_IMFS_DISABLE_MKNOD_DEVICE Obsolete CONFIGURE_MAXIMUM_DEVICES. Remove BSP_MAXIMUM_DEVICES. Update #3894. Update #3898.
* imfs: Simplify code generationSebastian Huber2020-03-091-11/+17
| | | | Update #3894.
* imfs: Remove unused handlersSebastian Huber2020-03-091-6/+1
| | | | Update #3894.
* imfs: Constify imfs_memfile_bytes_per_blockSebastian Huber2020-03-094-40/+2
| | | | | | | | The CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK value is validated by <rtems/confdefs/libio.h>. Changing this value during runtime could lead to memory corruption. Update #3894.
* imfs: Use _IMFS_get_time()Sebastian Huber2020-03-091-6/+5
| | | | Update #3894.
* libio: Constify some functionsSebastian Huber2020-03-091-4/+4
|
* console: Use IMFS_add_node() for simple task consSebastian Huber2020-03-041-20/+50
| | | | | | | Change license to BSD-2-Clause according to file history. Update #3053. Update #3894.
* console: Use IMFS_add_node() for simple consoleSebastian Huber2020-03-041-17/+38
| | | | | | | Change license to BSD-2-Clause according to file history. Update #3053. Update #3894.
* imfs: Add IMFS_add_node()Sebastian Huber2020-03-045-16/+312
| | | | Update #3894.
* imfs: Simplify IMFS_create_node()Sebastian Huber2020-03-041-3/+4
| | | | Update #3894.
* imfs: Remove IMFS_NODE_FLAG_NAME_ALLOCATEDSebastian Huber2020-03-043-17/+39
| | | | | | | | Remove IMFS_NODE_FLAG_NAME_ALLOCATED and instead replace the node control in rename operations. This avoids a special case in the general node destruction which pulled in free(). Update #3894.
* rtems: rtems_scheduler_get_processor_maximum()Sebastian Huber2020-03-044-54/+3
| | | | | | | | | | | | In uniprocessor configurations, use compile-time constants for rtems_scheduler_get_processor_maximum() and rtems_scheduler_get_processor(). This helps compilers and static analyzers to deduce that some loop bodies are only executed once and some conditional statements have a fixed outcome (may improve code generation and reduce false positives). In SMP configurations, directly provide the internal implementation for performance reasons.
* config: Remove <rtems/btimer.h> includeSebastian Huber2020-03-041-4/+0
| | | | | | | The use of CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER does not define anything, so remove the <rtems/btimer.h> include. Update #3875.
* rtems: Add rtems_scheduler_map_priority_from_posix()Sebastian Huber2020-03-033-0/+89
| | | | Update #3881.
* rtems: Add rtems_scheduler_map_priority_to_posix()Sebastian Huber2020-03-033-0/+89
| | | | Update #3881.
* dtc: Update VERSIONSebastian Huber2020-03-021-3/+3
|
* libfdt: Allow exclusion of fdt_check_full()Simon Glass2020-03-021-63/+0
| | | | | | | | | | This function is used to perform a full check of the device tree. Allow it to be excluded if all assumptions are enabled. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20200220214557.176528-9-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add support for disabling ordering check/fixupSimon Glass2020-03-021-1/+2
| | | | | | | | | | Add a way to remove this check and the reordering code, which is unnecessary if the dtb is known to be correctly ordered. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20200220214557.176528-8-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add support for disabling version checksSimon Glass2020-03-023-24/+32
| | | | | | | | | Allow enabling FDT_ASSUME_LATEST to disable version checks. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20200220214557.176528-7-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add support for disabling rollback handlingSimon Glass2020-03-021-3/+15
| | | | | | | | | | Allow enabling FDT_ASSUME_NO_ROLLBACK to disable rolling back after a failed operation. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20200220214557.176528-6-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add support for disabling sanity checksSimon Glass2020-03-022-24/+48
| | | | | | | | | | Allow enabling ASSUME_VALID_INPUT to disable sanity checks on the device tree and the parameters to libfdt. This assumption covers that cases where the problem could be with either. Signed-off-by: Simon Glass <sjg@chromium.org> Message-Id: <20200220214557.176528-5-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add support for disabling dtb checksSimon Glass2020-03-024-29/+45
| | | | | | | | | | | Support ASSUME_VALID_DTB to disable some sanity checks If we assume that the DTB itself is valid then we can skip some checks and save code space. Add various conditions to handle this. Signed-off-by: Simon Glass <sjg@chromium.org> Message-Id: <20200220214557.176528-4-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Add a way to control the level of checks in the codeSimon Glass2020-03-021-0/+104
| | | | | | | | | | | | | Add a new ASSUME_MASK option, which allows for some control over the checks used in libfdt. With all assumptions enabled, libfdt assumes that the input data and parameters are all correct and that internal errors cannot happen. By default no assumptions are made and all checks are enabled. Signed-off-by: Simon Glass <sjg@chromium.org> Message-Id: <20200220214557.176528-3-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: De-inline fdt_header_size()Simon Glass2020-03-022-4/+10
| | | | | | | | | | | 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>
* libfdt: Correct prototype for fdt_ro_probe_()David Gibson2020-03-021-2/+2
| | | | | | | | | | | This function returns an int32_t, however the prototype in libfdt_internal.h shows it returning an int. We haven't caught this before because they're the same type on nearly all platforms this gets built on. Apparently it's not the case on FreeRTOS, so someone hit this mismatch building for that platform. Reported-by: dharani kumar <dharanikumarsrvn@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt.h: add explicit cast from void* to uint8_t* in fdt(32|64)_stLuc Michel2020-03-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* libfdt: Allow #size-cells of 0David Gibson2020-03-021-3/+5
| | | | | | | | | | | | | | | | | | c12b2b0c20eb "libfdt: fdt_address_cells() and fdt_size_cells()" introduced a bug as it consolidated code between the helpers for getting #address-cells and #size-cells. Specifically #size-cells is allowed to be 0, and is frequently found so in practice for /cpus. IEEE1275 only requires implementations to handle 1..4 for #address-cells, although one could make a case for #address-cells == #size-cells == 0 being used to represent a bridge with a single port. While we're there, it's not totally obvious that the existing implicit cast of a u32 to int will give the correct results according to strict C, although it does work in practice. Straighten that up to cast only after we've made our range checks. Reported-by: yonghuhaige via https://github.com/dgibson/dtc/issues/28 Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Tweak data handling to satisfy CoverityDavid Gibson2020-03-023-12/+18
| | | | | | | | | | | | | | | | | | | | | | | In libfdt we often sanity test fdt_totalsize(fdt) fairly early, then trust it (but *only* that header field) for the remainder of our work. However, Coverity gets confused by this - it sees the byteswap in fdt32_ld() and assumes that means it is coming from an untrusted source everytime, resulting in many tainted data warnings. Most of these end up with logic in fdt_get_string() as the unsafe destination for this tainted data, so let's tweak the logic there to make it clearer to Coverity that this is ok. We add a sanity test on fdt_totalsize() to fdt_probe_ro_(). Because the interface allows bare ints to be used for offsets, we already have the assumption that totalsize must be 31-bits or less (2GiB would be a ludicrously large fdt). This makes this more explicit. We also make fdt_probe_ro() return the size for convenience, and change the logic in fdt_get_string() to keep it in a local so that Coverity can see that it has already been bounds-checked. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Replace GPL/BSD boilerplate/reference with SPDX tagsRob Herring2020-03-0212-551/+12
| | | | | | | | 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>
* libfdt: Add FDT_CREATE_FLAG_NO_NAME_DEDUP flag that trades size for speedNicholas Piggin2020-03-022-14/+33
| | | | | | | | | | | | | 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>
* libfdt: Introduce fdt_create_with_flags()Nicholas Piggin2020-03-023-3/+66
| | | | | | | | | | | | | | | | | | | | | | | 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>
* libfdt: Ensure fdt_add_property frees allocated name string on failureNicholas Piggin2020-03-022-6/+39
| | | | | | | | | | | | | If fdt_add_property or fdt_property_placeholder fail after allocating a string for the name, they return without freeing that string. This does not change the structure of the tree, but in very specific cases it could lead to undesirable space consumption. Fix this by rolling back the string allocation in this situation. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Message-Id: <20190509094122.834-2-npiggin@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Make fdt_get_max_phandle() an inlineDavid Gibson2020-03-022-13/+11
| | | | | | | | | | 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>
* libfdt: Add phandle generation helperThierry Reding2020-03-022-0/+37
| | | | | | | | | | | | | | | | | 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>
* libfdt: Add new maximum phandle lookup functionThierry Reding2020-03-023-15/+46
| | | | | | | | | | | | | | | | | | | | | | 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>
* libfdt: add fdt_append_addrrange()AKASHI Takahiro2020-03-022-0/+108
| | | | | | | | | | | | | 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>
* Revert "libfdt: Add phandle generation helper"David Gibson2020-03-023-51/+0
| | | | | | This reverts commit 54ea41c22415cb0e283d22faf71202051c89400c. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add phandle generation helperThierry Reding2020-03-023-0/+51
| | | | | | | | | | | | | | | | | 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>
* libfdt: Fix FDT_ERR_NOTFOUND typos in documentationGeert Uytterhoeven2020-03-021-2/+2
| | | | | | | | | 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>
* libfdt: Fix fdt_getprop_by_offset() parameter name in documentationGeert Uytterhoeven2020-03-021-1/+1
| | | | | | | | 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>
* libfdt: Don't use memcpy to handle unaligned reads on ARMDavid Gibson2020-03-021-7/+15
| | | | | | | | | | | | | | | 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>
* libfdt: return correct value if #size-cells property is not presentJohn Clarke2020-03-022-4/+14
| | | | | | | | | | | | | 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>
* score: Fix context switch extensions (SMP)Sebastian Huber2020-02-287-3/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* config: Initialize IO drivers on demandSebastian Huber2020-02-264-13/+75
|
* score: Fix label defined but not used warningSebastian Huber2020-02-251-0/+2
| | | | Update #3835.
* config: Resurrect NULL_DRIVER_TABLE_ENTRYSebastian Huber2020-02-251-1/+3
| | | | | | | This define may be used by application configurations for the CONFIGURE_APPLICATION_EXTRA_DRIVERS definition. Update #3875.
* config: Add <rtems/confdefs/wkspace.h>Sebastian Huber2020-02-253-263/+232
| | | | | | | | | | | 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.
* config: Add <rtems/confdefs/objectsposix.h>Sebastian Huber2020-02-253-198/+200
| | | | | | | | Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
* config: Add <rtems/confdefs/wkspacesupport.h>Sebastian Huber2020-02-253-25/+66
| | | | | | | | Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.
* config: Add <rtems/confdefs/objectsclassic.h>Sebastian Huber2020-02-253-113/+129
| | | | | | | | Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file. Update #3053. Update #3875.