xref: /openbmc/linux/arch/powerpc/include/asm/string.h (revision be709d48)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_STRING_H
3 #define _ASM_POWERPC_STRING_H
4 
5 #ifdef __KERNEL__
6 
7 #define __HAVE_ARCH_STRNCPY
8 #define __HAVE_ARCH_STRNCMP
9 #define __HAVE_ARCH_MEMSET
10 #define __HAVE_ARCH_MEMCPY
11 #define __HAVE_ARCH_MEMMOVE
12 #define __HAVE_ARCH_MEMCMP
13 #define __HAVE_ARCH_MEMCHR
14 #define __HAVE_ARCH_MEMSET16
15 #define __HAVE_ARCH_MEMCPY_FLUSHCACHE
16 
17 extern char * strcpy(char *,const char *);
18 extern char * strncpy(char *,const char *, __kernel_size_t);
19 extern __kernel_size_t strlen(const char *);
20 extern int strcmp(const char *,const char *);
21 extern int strncmp(const char *, const char *, __kernel_size_t);
22 extern char * strcat(char *, const char *);
23 extern void * memset(void *,int,__kernel_size_t);
24 extern void * memcpy(void *,const void *,__kernel_size_t);
25 extern void * memmove(void *,const void *,__kernel_size_t);
26 extern int memcmp(const void *,const void *,__kernel_size_t);
27 extern void * memchr(const void *,int,__kernel_size_t);
28 extern void * memcpy_flushcache(void *,const void *,__kernel_size_t);
29 
30 #ifdef CONFIG_PPC64
31 #define __HAVE_ARCH_MEMSET32
32 #define __HAVE_ARCH_MEMSET64
33 
34 extern void *__memset16(uint16_t *, uint16_t v, __kernel_size_t);
35 extern void *__memset32(uint32_t *, uint32_t v, __kernel_size_t);
36 extern void *__memset64(uint64_t *, uint64_t v, __kernel_size_t);
37 
38 static inline void *memset16(uint16_t *p, uint16_t v, __kernel_size_t n)
39 {
40 	return __memset16(p, v, n * 2);
41 }
42 
43 static inline void *memset32(uint32_t *p, uint32_t v, __kernel_size_t n)
44 {
45 	return __memset32(p, v, n * 4);
46 }
47 
48 static inline void *memset64(uint64_t *p, uint64_t v, __kernel_size_t n)
49 {
50 	return __memset64(p, v, n * 8);
51 }
52 #else
53 #define __HAVE_ARCH_STRLEN
54 
55 extern void *memset16(uint16_t *, uint16_t, __kernel_size_t);
56 #endif
57 #endif /* __KERNEL__ */
58 
59 #endif	/* _ASM_POWERPC_STRING_H */
60