*\r
* Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
*\r
-* This program and the accompanying materials\r
-* are licensed and made available under the terms and conditions of the BSD License\r
-* which accompanies this distribution. The full text of the license may be found at\r
-* http://opensource.org/licenses/bsd-license.php\r
-*\r
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+* SPDX-License-Identifier: BSD-2-Clause-Patent\r
*\r
**/\r
\r
#ifndef _LIBFDT_ENV_H\r
#define _LIBFDT_ENV_H\r
\r
-#include <Uefi.h>\r
#include <Library/BaseLib.h>\r
#include <Library/BaseMemoryLib.h>\r
\r
-typedef UINT16 fdt16_t;\r
-typedef UINT32 fdt32_t;\r
-typedef UINT64 fdt64_t;\r
-\r
-typedef UINT8 uint8_t;\r
-typedef UINT16 uint16_t;\r
-typedef UINT32 uint32_t;\r
-typedef UINT64 uint64_t;\r
-typedef UINTN uintptr_t;\r
-typedef UINTN size_t;\r
-\r
-static inline uint16_t fdt16_to_cpu(fdt16_t x)\r
+typedef UINT16 fdt16_t;\r
+typedef UINT32 fdt32_t;\r
+typedef UINT64 fdt64_t;\r
+\r
+typedef UINT8 uint8_t;\r
+typedef UINT16 uint16_t;\r
+typedef UINT32 uint32_t;\r
+typedef UINT64 uint64_t;\r
+typedef UINTN uintptr_t;\r
+typedef UINTN size_t;\r
+\r
+static inline uint16_t\r
+fdt16_to_cpu (\r
+ fdt16_t x\r
+ )\r
{\r
return SwapBytes16 (x);\r
}\r
-#define cpu_to_fdt16(x) fdt16_to_cpu(x)\r
\r
-static inline uint32_t fdt32_to_cpu(fdt32_t x)\r
+#define cpu_to_fdt16(x) fdt16_to_cpu(x)\r
+\r
+static inline uint32_t\r
+fdt32_to_cpu (\r
+ fdt32_t x\r
+ )\r
{\r
return SwapBytes32 (x);\r
}\r
-#define cpu_to_fdt32(x) fdt32_to_cpu(x)\r
\r
-static inline uint64_t fdt64_to_cpu(fdt64_t x)\r
+#define cpu_to_fdt32(x) fdt32_to_cpu(x)\r
+\r
+static inline uint64_t\r
+fdt64_to_cpu (\r
+ fdt64_t x\r
+ )\r
{\r
return SwapBytes64 (x);\r
}\r
-#define cpu_to_fdt64(x) fdt64_to_cpu(x)\r
\r
-static inline void* memcpy(void* dest, const void* src, size_t len) {\r
+#define cpu_to_fdt64(x) fdt64_to_cpu(x)\r
+\r
+static inline void *\r
+memcpy (\r
+ void *dest,\r
+ const void *src,\r
+ size_t len\r
+ )\r
+{\r
return CopyMem (dest, src, len);\r
}\r
\r
-static inline void *memmove(void *dest, const void *src, size_t n) {\r
+static inline void *\r
+memmove (\r
+ void *dest,\r
+ const void *src,\r
+ size_t n\r
+ )\r
+{\r
return CopyMem (dest, src, n);\r
}\r
\r
-static inline void *memset(void *s, int c, size_t n) {\r
+static inline void *\r
+memset (\r
+ void *s,\r
+ int c,\r
+ size_t n\r
+ )\r
+{\r
return SetMem (s, n, c);\r
}\r
\r
-static inline int memcmp(const void* dest, const void* src, int len) {\r
+static inline int\r
+memcmp (\r
+ const void *dest,\r
+ const void *src,\r
+ int len\r
+ )\r
+{\r
return CompareMem (dest, src, len);\r
}\r
\r
-static inline void *memchr(const void *s, int c, size_t n) {\r
+static inline void *\r
+memchr (\r
+ const void *s,\r
+ int c,\r
+ size_t n\r
+ )\r
+{\r
return ScanMem8 (s, n, c);\r
}\r
\r
-static inline size_t strlen (const char* str) {\r
+static inline size_t\r
+strlen (\r
+ const char *str\r
+ )\r
+{\r
return AsciiStrLen (str);\r
}\r
\r
-static inline char *strchr(const char *s, int c) {\r
- char pattern[2];\r
+static inline char *\r
+strchr (\r
+ const char *s,\r
+ int c\r
+ )\r
+{\r
+ char pattern[2];\r
+\r
pattern[0] = c;\r
pattern[1] = 0;\r
return AsciiStrStr (s, pattern);\r
}\r
\r
-/**\r
- Load and Install FDT from Semihosting\r
+static inline size_t\r
+strnlen (\r
+ const char *str,\r
+ size_t strsz\r
+ )\r
+{\r
+ return AsciiStrnLenS (str, strsz);\r
+}\r
+\r
+static inline size_t\r
+strcmp (\r
+ const char *str1,\r
+ const char *str2\r
+ )\r
+{\r
+ return AsciiStrCmp (str1, str2);\r
+}\r
\r
- @param Filename Name of the file to load from semihosting\r
+static inline size_t\r
+strncmp (\r
+ const char *str1,\r
+ const char *str2,\r
+ size_t strsz\r
+ )\r
+{\r
+ return AsciiStrnCmp (str1, str2, strsz);\r
+}\r
\r
- @return EFI_SUCCESS Fdt Blob was successfully installed into the configuration table\r
- from semihosting\r
- @return EFI_NOT_FOUND Fail to locate the file in semihosting\r
- @return EFI_OUT_OF_RESOURCES Fail to allocate memory to contain the blob\r
-**/\r
-EFI_STATUS\r
-InstallFdtFromSemihosting (\r
- IN CONST CHAR16* FileName\r
- );\r
+static inline size_t\r
+strncpy (\r
+ char *dest,\r
+ const char *source,\r
+ size_t dest_max\r
+ )\r
+{\r
+ return AsciiStrCpyS (dest, dest_max, source);\r
+}\r
\r
#endif /* _LIBFDT_ENV_H */\r