]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - EmbeddedPkg/Include/libfdt_env.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / EmbeddedPkg / Include / libfdt_env.h
... / ...
CommitLineData
1/** @file\r
2*\r
3* Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
4*\r
5* SPDX-License-Identifier: BSD-2-Clause-Patent\r
6*\r
7**/\r
8\r
9#ifndef _LIBFDT_ENV_H\r
10#define _LIBFDT_ENV_H\r
11\r
12#include <Library/BaseLib.h>\r
13#include <Library/BaseMemoryLib.h>\r
14\r
15typedef UINT16 fdt16_t;\r
16typedef UINT32 fdt32_t;\r
17typedef UINT64 fdt64_t;\r
18\r
19typedef UINT8 uint8_t;\r
20typedef UINT16 uint16_t;\r
21typedef UINT32 uint32_t;\r
22typedef UINT64 uint64_t;\r
23typedef UINTN uintptr_t;\r
24typedef UINTN size_t;\r
25\r
26static inline uint16_t\r
27fdt16_to_cpu (\r
28 fdt16_t x\r
29 )\r
30{\r
31 return SwapBytes16 (x);\r
32}\r
33\r
34#define cpu_to_fdt16(x) fdt16_to_cpu(x)\r
35\r
36static inline uint32_t\r
37fdt32_to_cpu (\r
38 fdt32_t x\r
39 )\r
40{\r
41 return SwapBytes32 (x);\r
42}\r
43\r
44#define cpu_to_fdt32(x) fdt32_to_cpu(x)\r
45\r
46static inline uint64_t\r
47fdt64_to_cpu (\r
48 fdt64_t x\r
49 )\r
50{\r
51 return SwapBytes64 (x);\r
52}\r
53\r
54#define cpu_to_fdt64(x) fdt64_to_cpu(x)\r
55\r
56static inline void *\r
57memcpy (\r
58 void *dest,\r
59 const void *src,\r
60 size_t len\r
61 )\r
62{\r
63 return CopyMem (dest, src, len);\r
64}\r
65\r
66static inline void *\r
67memmove (\r
68 void *dest,\r
69 const void *src,\r
70 size_t n\r
71 )\r
72{\r
73 return CopyMem (dest, src, n);\r
74}\r
75\r
76static inline void *\r
77memset (\r
78 void *s,\r
79 int c,\r
80 size_t n\r
81 )\r
82{\r
83 return SetMem (s, n, c);\r
84}\r
85\r
86static inline int\r
87memcmp (\r
88 const void *dest,\r
89 const void *src,\r
90 int len\r
91 )\r
92{\r
93 return CompareMem (dest, src, len);\r
94}\r
95\r
96static inline void *\r
97memchr (\r
98 const void *s,\r
99 int c,\r
100 size_t n\r
101 )\r
102{\r
103 return ScanMem8 (s, n, c);\r
104}\r
105\r
106static inline size_t\r
107strlen (\r
108 const char *str\r
109 )\r
110{\r
111 return AsciiStrLen (str);\r
112}\r
113\r
114static inline char *\r
115strchr (\r
116 const char *s,\r
117 int c\r
118 )\r
119{\r
120 char pattern[2];\r
121\r
122 pattern[0] = c;\r
123 pattern[1] = 0;\r
124 return AsciiStrStr (s, pattern);\r
125}\r
126\r
127static inline size_t\r
128strnlen (\r
129 const char *str,\r
130 size_t strsz\r
131 )\r
132{\r
133 return AsciiStrnLenS (str, strsz);\r
134}\r
135\r
136static inline size_t\r
137strcmp (\r
138 const char *str1,\r
139 const char *str2\r
140 )\r
141{\r
142 return AsciiStrCmp (str1, str2);\r
143}\r
144\r
145static inline size_t\r
146strncmp (\r
147 const char *str1,\r
148 const char *str2,\r
149 size_t strsz\r
150 )\r
151{\r
152 return AsciiStrnCmp (str1, str2, strsz);\r
153}\r
154\r
155static inline size_t\r
156strncpy (\r
157 char *dest,\r
158 const char *source,\r
159 size_t dest_max\r
160 )\r
161{\r
162 return AsciiStrCpyS (dest, dest_max, source);\r
163}\r
164\r
165#endif /* _LIBFDT_ENV_H */\r