summaryrefslogtreecommitdiffstats
path: root/cpukit/include (follow)
Commit message (Collapse)AuthorAgeFilesLines
* libfdt: fdt_address_cells() and fdt_size_cells()Sebastian Huber2018-07-201-1/+1
| | | | | | | | Add internal fdt_cells() to avoid copy and paste. Test error cases and default values. Fix typo in fdt_size_cells() documentation comment. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* capture: Include missing header fileSebastian Huber2018-07-191-0/+2
|
* libfdt: Add helpers for accessing unaligned wordsDavid Gibson2018-07-191-1/+24
| | | | | | | | | | | | | | | | | | This adds some helpers to load (32 or 64 bit) words from an fdt blob, even if they're unaligned and we're on a platform that doesn't like plain unaligned loads and stores. We then use the helpers in a number of places. There are two purposes for this: 1) This makes libfdt more robust against a blob loaded at an unaligned address. It's usually good practice to load a blob at a 64-bit alignment, but it's nice to work even then. 2) Users can use these helpers to load integer values from within property values. These can often be unaligned, even if the blob as a whole is aligned, since some property encodings have integers and strings mixed together without any alignment gaps. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* pylibfdt: Add functions to update propertiesSimon Glass2018-07-191-0/+3
| | | | | | | | | Allow updating and creating properties, including special methods for integers. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add fdt_check_full() functionDavid Gibson2018-07-191-0/+2
| | | | | | | | | | | | | This new function implements a complete and thorough check of an fdt blob's structure. Given a buffer containing an fdt, it should return 0 only if the fdt within is structurally sound in all regards. It doesn't check anything about the blob's contents (i.e. the actual values of the nodes and properties), of course. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Simon Glass <sjg@chromium.org>
* libfdt: Add fdt_header_size()David Gibson2018-07-191-0/+11
| | | | | | | | | | | We have a couple of places within libfdt and its tests where we need to find the size of the header, based on the version. Add a helper function for it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
* libfdt: Safer access to strings sectionDavid Gibson2018-07-191-1/+17
| | | | | | | | | | | | | | | | | | | | | | | fdt_string() is used to retrieve strings from a DT blob's strings section. It's rarely used directly, but is widely used internally. However, it doesn't do any bounds checking, which means in the case of a corrupted blob it could access bad memory, which libfdt is supposed to avoid. This write a safe alternative to fdt_string, fdt_get_string(). It checks both that the given offset is within the string section and that the string it points to is properly \0 terminated within the section. It also returns the string's length as a convenience (since it needs to determine to do the checks anyway). fdt_string() is rewritten in terms of fdt_get_string() for compatibility. Most of the diff here is actually testing infrastructure. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
* libfdt: Make fdt_check_header() more thoroughDavid Gibson2018-07-192-6/+10
| | | | | | | | | | | | | | | | | | | | | | | Currently fdt_check_header() performs only some rudimentary checks, which is not really what the name suggests. This strengthens fdt_check_header() to check as much about the blob as is possible from the header alone: as well as checking the magic number and version, it checks that the total size is sane, and that all the sub-blocks within the blob lie within the total size. * This broadens the meaning of FDT_ERR_TRUNCATED to cover all sorts of improperly terminated blocks as well as just a structure block without FDT_END. * This makes fdt_check_header() only succeed on "complete" blobs, not in-progress sequential write blobs. The only reason this didn't fail before was that this function used to be called by many RO functions which are supposed to also work on incomplete SW blobs. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Simon Glass <sjg@chromium.org>
* Add limited read-only support for older (V2 and V3) device tree to libfdt.Nathan Whitehorn2018-07-191-1/+4
| | | | | | | | | | This can be useful in particular in the kernel when booting on systems with FDT-emitting firmware that is out of date. Releases of kexec-tools on ppc64 prior to the end of 2014 are notable examples of such. Signed-off-by: Nathan Whitehorn <nwhitehorn@freebsd.org> [dwg: Some whitespace cleanups] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* implement strnlen for systems that need itJohn Arbuckle2018-07-191-0/+27
| | | | | | | | Prior the Mac OS 10.7, the function strnlen() was not available. This patch implements strnlen() on Mac OS X versions that are below 10.7. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Remove leading underscores from identifiersDavid Gibson2018-07-193-21/+21
| | | | | | | | | | | | | | In a lot of places libfdt uses a leading _ character to mark an identifier as "internal" (not part of the published libfdt API). This is a bad idea, because identifiers with a leading _ are generally reserved by the C library or system. It's particularly dangerous for libfdt, because it's designed to be able to be integrated into lots of different environments. In some cases the leading _ has no purpose, so we simply drop it. In most cases we move it to the end, as our new convention for marking internal identifiers. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Fix some errors in commentsDavid Gibson2018-07-191-1/+1
| | | | | | | | | | A comment in tests/stringlist.c refers to fdt_get_string(), which is not a function that exists. From the content, it's supposed to be referring to fdt_getprop_string(). A comment in libfdt.h has an extraneous space in a function name. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Introduce fdt_setprop_placeholder() methodPantelis Antoniou2018-07-191-0/+31
| | | | | | | | | | | | In some cases you need to add a property but the contents of it are not known at creation time, merely the extend of it. This method allows you to create a property of a given size (filled with garbage) while a pointer to the property data will be provided. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> [dwg: Corrected commit message] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Add a libfdt function to write a property placeholderSimon Glass2018-07-191-0/+16
| | | | | | | | | | | | | The existing function to add a new property to a tree being built requires that the entire contents of the new property be passed in. For some applications it is more convenient to be able to add the property contents later, perhaps by reading from a file. This avoids double-buffering of the contents. Add a new function to support this and adjust the existing fdt_property() to use it. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Adjust libfdt.h to work with swigSimon Glass2018-07-191-1/+20
| | | | | | | | | | | | | | There are a few places where libfdt.h cannot be used as is with swig: - macros like fdt_totalsize() have to be defined as C declarations - fdt_offset_ptr() and fdt_getprop_namelen() need special treatment due to a TODO in the wrapper for fdt_getprop(). However they are not useful to Python so can be removed Add #ifdefs to work around these problem. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Change names of sparse helper macrosDavid Gibson2018-07-191-13/+13
| | | | | | | | | | | | | | | | | The default libfdt_env.h (for POSIXish userland builds) supports sparse checking. It has a couple of helper macros, __force and __bitwise which expand the relevant sparse attributes to enable checking for incorrect or missing endian conversions. Those are bad names: for one, leading underscores are supposed to be reserved for the system libraries, and worse, some systems (including RHEL7) do define those names already. So change them to FDT_FORCE and FDT_BITWISE which are far less likely to have collisions. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add fdt_setprop_empty()David Gibson2018-07-191-0/+30
| | | | | | | | | | Device trees can contain empty (zero length) properties, which are often used as boolean flags. These can already be created using fdt_setprop() passing a length of zero and a pointer which is ignored. It is safe to pass NULL, but that may not be obvious from the interface. To make it clearer, add an fdt_setprop_empty() helper macro. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add overlay application functionMaxime Ripard2018-07-192-0/+32
| | | | | | | | | | | The device tree overlays are a good way to deal with user-modifyable boards or boards with some kind of an expansion mechanism where we can easily plug new board in (like the BBB, the Raspberry Pi or the CHIP). Add a new function to merge overlays with a base device tree. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Extend the reach of FDT_ERR_BADPHANDLEMaxime Ripard2018-07-191-2/+4
| | | | | | | | So far, the BADPHANDLE error was only used for incorrect phandle values. Extend that meaning to an improperly formatted phandle property. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add new errors for the overlay codeMaxime Ripard2018-07-191-1/+10
| | | | | | | | | | | | | Add a few new error codes to report the failure conditions we might encounter in the overlay application code: - FDT_ERR_BADOVERLAY, when an overlay cannot be parsed, even though its structure is correct - FDT_ERR_NOPHANDLES, when we ran out of available phandles and we cannot use a new phandle without either using an invalid one (-1 or 0), or one already used. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Fix some typing errors in libfdt.h and livetree.cThomas Huth2018-07-191-2/+2
| | | | | | | Correct some typos discovered with the codespell utility. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add fdt_setprop_inplace_namelen_partialMaxime Ripard2018-07-191-0/+21
| | | | | | | | | | | | | Add a function to modify inplace only a portion of a property.. This is especially useful when the property is an array of values, and you want to update one of them without changing the DT size. Acked-by: Simon Glass <sjg@chromium.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> [dwg: Remove unnecessary unsigned qualifier, correct a comment] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add fdt_getprop_namelen_wMaxime Ripard2018-07-191-0/+7
| | | | | | | | | Add a function to retrieve a writeable property only by the first characters of its name. Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add max phandle retrieval functionMaxime Ripard2018-07-191-0/+15
| | | | | | | | | | Add a function to retrieve the highest phandle in a given device tree. Acked-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Agner <stefan@agner.ch> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add iterator over propertiesMaxime Ripard2018-07-191-0/+27
| | | | | | | | | | | Implement a macro based on fdt_first_property_offset and fdt_next_property_offset that provides a convenience to iterate over all the properties of a given node. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Simon Glass <sjg@chromium.org> [dwg: Removed a stray trailing blank line] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add a subnodes iterator macroThierry Reding2018-07-191-0/+28
| | | | | | | | | | The fdt_for_each_subnode() iterator macro provided by this patch can be used to iterate over a device tree node's subnodes. At each iteration a loop variable will be set to the next subnode. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Correct a missing space in a fdt_header castSimon Glass2018-07-191-1/+1
| | | | | | | The code style here is slightly incorrect. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Correct line lengths in libfdt.hSimon Glass2018-07-191-12/+23
| | | | | | | There are a few lines that are over 80 columns. Fix these. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Correct space-after-tab in libfdt.hSimon Glass2018-07-191-13/+12
| | | | | | | There are a few places with a space before a tab in this file. Fix them. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* score: Avoid structurally dead codeSebastian Huber2018-07-161-3/+2
| | | | This was spotted by Coverity Scan.
* linux: Add rbtree_postorder_for_each_entry_safe()Sebastian Huber2018-07-161-0/+16
| | | | Update #3465.
* linux: Simplify <linux/rbtree.h>Sebastian Huber2018-07-161-45/+37
| | | | | | | Remove the placeholder struct rb_node and use RBTree_Node directly via some C pre-processor defines to adjust the member names. Update #3465.
* linux: Install <linux/rbtree.h>Sebastian Huber2018-07-161-0/+133
| | | | | | This makes it possible to test this API. Update #3465.
* score: Add postorder tree iteration supportSebastian Huber2018-07-161-0/+66
| | | | Update #3465.
* posix: Check for new <pthread.h> prototypesSebastian Huber2018-07-051-1/+1
| | | | | Update #3342. Update #3343.
* score: Increase PER_CPU_CONTROL_SIZE_APPROXSebastian Huber2018-06-291-1/+1
| | | | | | Increase the PER_CPU_CONTROL_SIZE_APPROX on 64-bit targets. Update #3433.
* Rework initialization and interrupt stack supportSebastian Huber2018-06-273-76/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Statically initialize the interrupt stack area (_Configuration_Interrupt_stack_area_begin, _Configuration_Interrupt_stack_area_end, and _Configuration_Interrupt_stack_size) via <rtems/confdefs.h>. Place the interrupt stack area in a special section ".rtemsstack.interrupt". Let BSPs define the optimal placement of this section in their linker command files (e.g. in a fast on-chip memory). This change makes makes the CPU_HAS_SOFTWARE_INTERRUPT_STACK and CPU_HAS_HARDWARE_INTERRUPT_STACK CPU port defines superfluous, since the low level initialization code has all information available via global symbols. This change makes the CPU_ALLOCATE_INTERRUPT_STACK CPU port define superfluous, since the interrupt stacks are allocated by confdefs.h for all architectures. There is no need for BSP-specific linker command file magic (except the section placement), see previous ARM linker command file as a bad example. Remove _CPU_Install_interrupt_stack(). Initialize the hardware interrupt stack in _CPU_Initialize() if necessary (e.g. m68k_install_interrupt_stack()). The optional _CPU_Interrupt_stack_setup() is still useful to customize the registration of the interrupt stack area in the per-CPU information. The initialization stack can reuse the interrupt stack, since * interrupts are disabled during the sequential system initialization, and * the boot_card() function does not return. This stack resuse saves memory. Changes per architecture: arm: * Mostly replace the linker symbol based configuration of stacks with the standard <rtems/confdefs.h> configuration via CONFIGURE_INTERRUPT_STACK_SIZE. The size of the FIQ, ABT and UND mode stack is still defined via linker symbols. These modes are rarely used in applications and the default values provided by the BSP should be sufficient in most cases. * Remove the bsp_processor_count linker symbol hack used for the SMP support. This is possible since the interrupt stack area is now allocated by the linker and not allocated from the heap. This makes some configure.ac stuff obsolete. Remove the now superfluous BSP variants altcycv_devkit_smp and realview_pbx_a9_qemu_smp. bfin: * Remove unused magic linker command file allocation of initialization stack. Maybe a previous linker command file copy and paste problem? In the start.S the initialization stack is set to a hard coded value. lm32, m32c, mips, nios2, riscv, sh, v850: * Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack. m68k: * Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack. powerpc: * Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack. * Used dedicated memory region (REGION_RTEMSSTACK) for the interrupt stack on BSPs using the shared linkcmds.base (replacement for REGION_RWEXTRA). sparc: * Remove the hard coded initialization stack. Use the interrupt stack for the initialization stack on the boot processor. This saves 16KiB of RAM. Update #3459.
* score: Macros to declare and define global symbolsSebastian Huber2018-06-211-1/+33
| | | | | | Add RTEMS_DEFINE_GLOBAL_SYMBOL() and add RTEMS_DECLARE_GLOBAL_SYMBOL(). Update #3459.
* stackchk: Add SMP supportSebastian Huber2018-06-201-1/+3
| | | | | | | | | | | | Check the interrupt stacks of all processors. Set up the interrupt stack of the current processor for high water testing in the thread begin extension. This must be done after multi-threading started, since the initialization stacks may reuse the interrupt stacks. Disable thread dispatching in SMP configurations to prevent thread migration. Writing to the interrupt stack is only safe if done from the corresponding processor in thread context. Update #3459.
* stackchk: Remove dead codeSebastian Huber2018-06-201-2/+2
| | | | Update #3459.
* Add _CPU_Counter_frequency()Sebastian Huber2018-06-151-1/+11
| | | | | | | | | | Add rtems_counter_frequency() API function. Use it to initialize the counter value converter via the new system initialization step (RTEMS_SYSINIT_CPU_COUNTER). This decouples the counter implementation and the counter converter. It avoids an unnecessary pull in of the 64-bit integer division from libgcc. Update #3456.
* Add RTEMS_SYSINIT_CPU_COUNTERSebastian Huber2018-06-151-1/+2
| | | | | | Add initialization step for the CPU counter support. Update #3456.
* Reassign system initilization order numbersSebastian Huber2018-06-151-39/+39
| | | | | Assign each system initialization step a number divisible by 256 to allow more easily future additions. Keep the order as is.
* Add RTEMS_FATAL_SOURCE_INVALID_HEAP_FREESebastian Huber2018-06-051-0/+7
| | | | | | | | An invalid heap usage such as a double free is usually a fatal error since this indicates a use after free. Replace the use of printk() in free() with a fatal error. Update #3437.
* config: Hide CONFIGURE_SCHEDULER_COUNTSebastian Huber2018-05-281-5/+5
| | | | | Rename CONFIGURE_SCHEDULER_COUNT to _CONFIGURE_SCHEDULER_COUNT to emphasise that this is not a user configuration option.
* config: Hide CONFIGURE_INITIAL_EXTENSION_TABLESebastian Huber2018-05-281-3/+3
| | | | | | Rename CONFIGURE_INITIAL_EXTENSION_TABLE to _CONFIGURE_INITIAL_EXTENSION_TABLE to emphasise that this is not a user configuration option.
* libblock: Init deps in rtems_blkdev_create()Sebastian Huber2018-05-181-0/+1
| | | | Update #3358.
* telnetd: Always build telnet daemonSebastian Huber2018-05-021-0/+5
| | | | | | Add support for libbsd initialization. Update #3419.
* ftpd: Always build FTP daemonSebastian Huber2018-05-021-1/+6
| | | | | | Add support for libbsd initialization. Update #3419.
* network: Import latest <arpa/ftp.h> from FreeBSDSebastian Huber2018-05-021-0/+109
| | | | Update #3419.