summaryrefslogtreecommitdiffstats
path: root/include/linux/bitops.h
Commit message (Collapse)AuthorAgeFilesLines
* bitops: split off linux/bits.hAhmad Fatoum2023-11-231-20/+1
| | | | | | | | | | | | | The bit definitions are split off in Linux into <linux/bits.h>, which is included by <linux/bitops.h> and extended with bit operations. Follow through in barebox to simplify porting kernel code and in future to speed up the build a bit by avoiding pulling in the whole bitops.h, when only needing macros like BIT(). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122172951.376531-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* tlsf: give malloc 8-byte alignment on 32-bit as wellAhmad Fatoum2023-09-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The current alignment of 4 bytes is too low. Access to 64-bit data via ldrd/strd requires at least an eight byte alignment: | Prior to ARMv6, if the memory address is not 64-bit aligned, the | data read from memory is UNPREDICTABLE. Alignment checking (taking | a data abort), and support for a big-endian (BE-32) data format are | implementation options. We already have at least an 8 byte alignment for dlmalloc, so have TLSF follow suit by aligning the accounting structures appropriately. Instead of adding manual padding, we could also enlarge block_header_t::size to an uint64_t unconditionally, but mark block_header_t __packed. This comes with a runtime cost though or ugly __builtin_assume_aligned annotations, so we stick to the simpler version. Reported-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/barebox/ly7d1z1qvs.fsf@ensc-pc.intern.sigma-chemnitz.de/ Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230911152433.3640781-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: bitops: import more BITS_TO_* defines from linuxDenis Orlov2023-06-091-1/+5
| | | | | | | | Those seem quite useful, e.g. when defining bitmasks. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20230609045829.2225-4-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: bitops: allow BIT* macros to be used in assembly codeDenis Orlov2023-06-091-6/+12
| | | | | | | | | | Use UL/ULL() macros for those so that corresponding suffixes only appear when we are compiling C code. Hide all the other functions/macros that we can't use in assembly with '#ifndef __ASSEMBLY__'. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20230609045829.2225-3-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bitops: implement assign_bit()Sascha Hauer2022-11-081-0/+14
| | | | | | | | assign_bit() is a useful shortcut to if (foo) set_bit(); else clear_bit(); Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20221107144524.489471-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bitops: include linux/types.hSascha Hauer2022-11-081-1/+1
| | | | | | | | | linux/types.h includes asm/types.h. linux/types.h declares 'bool' we need in the next patch, so include the former rather than the latter. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20221107144524.489471-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: add SPDX-License-IdentifierAhmad Fatoum2022-01-051-0/+2
| | | | | | | | | All these files lack a license statement, so add the default GPL-2.0-only. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220103120539.1730644-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: <linux/bitops.h>: discard left-over hweight codeAhmad Fatoum2021-11-011-5/+0
| | | | | | | | | | There are no definitions for __sw_hweight*, so no point in keeping the prototypes around. The scripts version of the header also ultimately tries to access non-existing normal headers, so fix that up as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030141739.2207431-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bitops: Fix shift overflow in GENMASK macrosSteffen Trumtrar2016-02-031-2/+5
| | | | | | | | | | | | | | | | | | Based on the original patch for linux: commit 00b4d9a14125f1e51874def2b9de6092e007412d Author: Maxime COQUELIN <maxime.coquelin@st.com> Date: Thu Nov 6 10:54:19 2014 On some 32 bits architectures, including x86, GENMASK(31, 0) returns 0 instead of the expected ~0UL. This is the same on some 64 bits architectures with GENMASK_ULL(63, 0). This is due to an overflow in the shift operand, 1 << 32 for GENMASK, 1 << 64 for GENMASK_ULL. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
* treewide: replace __inline__ with inlineSascha Hauer2015-07-021-2/+2
| | | | | | inline is preferred over __inline__ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: update bitop functions from kernelSascha Hauer2014-07-171-1/+213
| | | | | | Updates the bitop functions from v3.16-rc4 Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rename U-Boot-v2 project to bareboxSascha Hauer2009-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This has been done with the following script: find -path ./.git -prune -o -type f -print0 | xargs -0 -r sed -i \ -e 's/u2boot/barebox/g' \ -e 's/U2Boot/barebox/g' \ -e 's/U-boot V2/barebox/g' \ -e 's/u-boot v2/barebox/g' \ -e 's/U-Boot V2/barebox/g' \ -e 's/U-Boot-v2/barebox/g' \ -e 's/U_BOOT/BAREBOX/g' \ -e 's/UBOOT/BAREBOX/g' \ -e 's/uboot/barebox/g' \ -e 's/u-boot/barebox/g' \ -e 's/u_boot/barebox/g' \ -e 's/U-Boot/barebox/g' \ -e 's/U-boot/barebox/g' \ -e 's/U-BOOT/barebox/g' find -path ./.git -prune -o \( -name "*u-boot*" -o -name "*uboot*" -o -name "*u_boot*" \) -print0 | \ xargs -0 -r rename 's/u[-_]?boot/barebox/' It needs some manual fixup following in the next patch Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Bitops:Remove generic_funcsNishanth Menon2008-08-151-64/+7
| | | | | | | Use asm-generic/bitops/xyz.h instead of using generic_xyz functions. Signed-off-by: Nishanth Menon <x0nishan@ti.com>
* add ffssascha2007-10-151-1/+1
|
* svn_rev_354Sascha Hauer2007-07-051-1/+1
|
* * Code cleanup:wdenk2003-06-271-12/+12
| | | | | | | | | - remove trailing white space, trailing empty lines, C++ comments, etc. - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) * Patches by Kenneth Johansson, 25 Jun 2003: - major rework of command structure (work done mostly by Michal Cendrowski and Joakim Kristiansen)
* Initial revisionwdenk2000-08-211-0/+72