/usr/src/linux-headers-5.15.0-190/arch/xtensa/include/asm
NameSizeModeActions
asm-offsets.h350644editdlrm
asm-uaccess.h41800644editdlrm
asmmacro.h47630644editdlrm
atomic.h73010644editdlrm
barrier.h5940644editdlrm
bitops.h53980644editdlrm
bootparam.h14020644editdlrm
cache.h11140644editdlrm
cacheasm.h38560644editdlrm
cacheflush.h59680644editdlrm
checksum.h58930644editdlrm
cmpxchg.h56840644editdlrm
coprocessor.h46230644editdlrm
core.h8300644editdlrm
current.h6790644editdlrm
delay.h16680644editdlrm
dma.h18300644editdlrm
elf.h51150644editdlrm
fixmap.h11060644editdlrm
flat.h4400644editdlrm
ftrace.h9790644editdlrm
futex.h38890644editdlrm
highmem.h21670644editdlrm
hw_breakpoint.h15970644editdlrm
initialize_mmu.h51960644editdlrm
io.h19590644editdlrm
irq.h11270644editdlrm
irqflags.h20690644editdlrm
jump_label.h16550644editdlrm
kasan.h8590644editdlrm
Kbuild2300644editdlrm
kmem_layout.h27900644editdlrm
linkage.h1540644editdlrm
mmu.h4620644editdlrm
mmu_context.h36240644editdlrm
mxregs.h13300644editdlrm
nommu_context.h1560644editdlrm
page.h57930644editdlrm
pci-bridge.h21700644editdlrm
pci.h13020644editdlrm
perf_event.h1080644editdlrm
pgalloc.h14050644editdlrm
pgtable.h144700644editdlrm
platform.h15280644editdlrm
processor.h77050644editdlrm
ptrace.h33210644editdlrm
regs.h40170644editdlrm
seccomp.h2870644editdlrm
serial.h4430644editdlrm
shmparam.h5610644editdlrm
signal.h5020644editdlrm
smp.h9670644editdlrm
spinlock.h4720644editdlrm
spinlock_types.h3170644editdlrm
stackprotector.h11400644editdlrm
stacktrace.h11580644editdlrm
string.h33850644editdlrm
switch_to.h6010644editdlrm
syscall.h21400644editdlrm
sysmem.h4260644editdlrm
thread_info.h39650644editdlrm
timex.h14400644editdlrm
tlb.h4750644editdlrm
tlbflush.h56200644editdlrm
traps.h27790644editdlrm
uaccess.h93750644editdlrm
ucontext.h5400644editdlrm
unistd.h3700644editdlrm
vectors.h32760644editdlrm
vermagic.h4330644editdlrm
vmalloc.h960644editdlrm
Edit: /usr/src/linux-headers-5.15.0-190/arch/xtensa/include/asm/bitops.h (5398B)
/* * include/asm-xtensa/bitops.h * * Atomic operations that C can't guarantee us.Useful for resource counting etc. * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2001 - 2007 Tensilica Inc. */ #ifndef _XTENSA_BITOPS_H #define _XTENSA_BITOPS_H #ifndef _LINUX_BITOPS_H #error only can be included directly #endif #include #include #include #include #if XCHAL_HAVE_NSA static inline unsigned long __cntlz (unsigned long x) { int lz; asm ("nsau %0, %1" : "=r" (lz) : "r" (x)); return lz; } /* * ffz: Find first zero in word. Undefined if no zero exists. * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). */ static inline int ffz(unsigned long x) { return 31 - __cntlz(~x & -~x); } /* * __ffs: Find first bit set in word. Return 0 for bit 0 */ static inline unsigned long __ffs(unsigned long x) { return 31 - __cntlz(x & -x); } /* * ffs: Find first bit set in word. This is defined the same way as * the libc and compiler builtin ffs routines, therefore * differs in spirit from the above ffz (man ffs). */ static inline int ffs(unsigned long x) { return 32 - __cntlz(x & -x); } /* * fls: Find last (most-significant) bit set in word. * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. */ static inline int fls (unsigned int x) { return 32 - __cntlz(x); } /** * __fls - find last (most-significant) set bit in a long word * @word: the word to search * * Undefined if no set bit exists, so code should check against 0 first. */ static inline unsigned long __fls(unsigned long word) { return 31 - __cntlz(word); } #else /* Use the generic implementation if we don't have the nsa/nsau instructions. */ # include # include # include # include # include #endif #include #if XCHAL_HAVE_EXCLUSIVE #define BIT_OP(op, insn, inv) \ static inline void op##_bit(unsigned int bit, volatile unsigned long *p)\ { \ unsigned long tmp; \ unsigned long mask = 1UL << (bit & 31); \ \ p += bit >> 5; \ \ __asm__ __volatile__( \ "1: l32ex %[tmp], %[addr]\n" \ " "insn" %[tmp], %[tmp], %[mask]\n" \ " s32ex %[tmp], %[addr]\n" \ " getex %[tmp]\n" \ " beqz %[tmp], 1b\n" \ : [tmp] "=&a" (tmp) \ : [mask] "a" (inv mask), [addr] "a" (p) \ : "memory"); \ } #define TEST_AND_BIT_OP(op, insn, inv) \ static inline int \ test_and_##op##_bit(unsigned int bit, volatile unsigned long *p) \ { \ unsigned long tmp, value; \ unsigned long mask = 1UL << (bit & 31); \ \ p += bit >> 5; \ \ __asm__ __volatile__( \ "1: l32ex %[value], %[addr]\n" \ " "insn" %[tmp], %[value], %[mask]\n" \ " s32ex %[tmp], %[addr]\n" \ " getex %[tmp]\n" \ " beqz %[tmp], 1b\n" \ : [tmp] "=&a" (tmp), [value] "=&a" (value) \ : [mask] "a" (inv mask), [addr] "a" (p) \ : "memory"); \ \ return value & mask; \ } #elif XCHAL_HAVE_S32C1I #define BIT_OP(op, insn, inv) \ static inline void op##_bit(unsigned int bit, volatile unsigned long *p)\ { \ unsigned long tmp, value; \ unsigned long mask = 1UL << (bit & 31); \ \ p += bit >> 5; \ \ __asm__ __volatile__( \ "1: l32i %[value], %[mem]\n" \ " wsr %[value], scompare1\n" \ " "insn" %[tmp], %[value], %[mask]\n" \ " s32c1i %[tmp], %[mem]\n" \ " bne %[tmp], %[value], 1b\n" \ : [tmp] "=&a" (tmp), [value] "=&a" (value), \ [mem] "+m" (*p) \ : [mask] "a" (inv mask) \ : "memory"); \ } #define TEST_AND_BIT_OP(op, insn, inv) \ static inline int \ test_and_##op##_bit(unsigned int bit, volatile unsigned long *p) \ { \ unsigned long tmp, value; \ unsigned long mask = 1UL << (bit & 31); \ \ p += bit >> 5; \ \ __asm__ __volatile__( \ "1: l32i %[value], %[mem]\n" \ " wsr %[value], scompare1\n" \ " "insn" %[tmp], %[value], %[mask]\n" \ " s32c1i %[tmp], %[mem]\n" \ " bne %[tmp], %[value], 1b\n" \ : [tmp] "=&a" (tmp), [value] "=&a" (value), \ [mem] "+m" (*p) \ : [mask] "a" (inv mask) \ : "memory"); \ \ return tmp & mask; \ } #else #define BIT_OP(op, insn, inv) #define TEST_AND_BIT_OP(op, insn, inv) #include #endif /* XCHAL_HAVE_S32C1I */ #define BIT_OPS(op, insn, inv) \ BIT_OP(op, insn, inv) \ TEST_AND_BIT_OP(op, insn, inv) BIT_OPS(set, "or", ) BIT_OPS(clear, "and", ~) BIT_OPS(change, "xor", ) #undef BIT_OPS #undef BIT_OP #undef TEST_AND_BIT_OP #include #include #include #include #include #include #endif /* _XTENSA_BITOPS_H */