mirror of https://github.com/acidanthera/audk.git
221 lines
6.6 KiB
Diff
221 lines
6.6 KiB
Diff
From 669778eab2092ef85ed5b5e537203721cfb1215d Mon Sep 17 00:00:00 2001
|
|
From: Olivier Martin <olivier.martin@arm.com>
|
|
Date: Thu, 16 Feb 2012 15:44:35 +0000
|
|
Subject: [PATCH 1/3] EmbeddedPkg: Added libfdt port
|
|
|
|
This port is based on the 'libfdt' project (dual licensed BSD/GPL).
|
|
|
|
Prior to apply this patch you must execute the following steps:
|
|
|
|
1. Clone the dtc into a temporary directory:
|
|
cd EmbeddedPkg/Library
|
|
git clone git://git.jdl.com/software/dtc.git
|
|
|
|
2. Copy the content of 'libfdt' into EmbeddedPkg/Library/FdtLib/
|
|
cd dtc
|
|
cp -a libfdt ../FdtLib
|
|
|
|
3. Copy the libfdt headers:
|
|
mv ../FdtLib/libfdt.h ../../Include/
|
|
mv ../FdtLib/fdt.h ../../Include/
|
|
rm ../FdtLib/libfdt_env.h
|
|
---
|
|
EmbeddedPkg/EmbeddedPkg.dsc | 1 +
|
|
EmbeddedPkg/Include/libfdt_env.h | 77 +++++++++++++++++++++++++++++++++
|
|
EmbeddedPkg/Library/FdtLib/FdtLib.inf | 38 ++++++++++++++++
|
|
EmbeddedPkg/Library/FdtLib/README.txt | 38 ++++++++++++++++
|
|
4 files changed, 154 insertions(+), 0 deletions(-)
|
|
mode change 100644 => 100755 EmbeddedPkg/EmbeddedPkg.dsc
|
|
create mode 100755 EmbeddedPkg/Include/libfdt_env.h
|
|
create mode 100755 EmbeddedPkg/Library/FdtLib/FdtLib.inf
|
|
create mode 100755 EmbeddedPkg/Library/FdtLib/README.txt
|
|
|
|
diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc
|
|
old mode 100644
|
|
new mode 100755
|
|
index 8862f3d..c3a2464
|
|
--- a/EmbeddedPkg/EmbeddedPkg.dsc
|
|
+++ b/EmbeddedPkg/EmbeddedPkg.dsc
|
|
@@ -97,6 +97,7 @@
|
|
|
|
EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
|
|
|
|
+ FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
|
|
|
|
[LibraryClasses.common.DXE_DRIVER]
|
|
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
|
|
diff --git a/EmbeddedPkg/Include/libfdt_env.h b/EmbeddedPkg/Include/libfdt_env.h
|
|
new file mode 100755
|
|
index 0000000..8c4f1c7
|
|
--- /dev/null
|
|
+++ b/EmbeddedPkg/Include/libfdt_env.h
|
|
@@ -0,0 +1,77 @@
|
|
+/** @file
|
|
+*
|
|
+* Copyright (c) 2011, ARM Limited. All rights reserved.
|
|
+*
|
|
+* This program and the accompanying materials
|
|
+* are licensed and made available under the terms and conditions of the BSD License
|
|
+* which accompanies this distribution. The full text of the license may be found at
|
|
+* http://opensource.org/licenses/bsd-license.php
|
|
+*
|
|
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
+*
|
|
+**/
|
|
+
|
|
+#ifndef _LIBFDT_ENV_H
|
|
+#define _LIBFDT_ENV_H
|
|
+
|
|
+#include <Library/BaseLib.h>
|
|
+#include <Library/BaseMemoryLib.h>
|
|
+
|
|
+typedef UINT8 uint8_t;
|
|
+typedef UINT16 uint16_t;
|
|
+typedef UINT32 uint32_t;
|
|
+typedef UINT64 uint64_t;
|
|
+typedef UINTN uintptr_t;
|
|
+typedef UINTN size_t;
|
|
+
|
|
+static inline uint16_t fdt16_to_cpu(uint16_t x)
|
|
+{
|
|
+ return SwapBytes16 (x);
|
|
+}
|
|
+#define cpu_to_fdt16(x) fdt16_to_cpu(x)
|
|
+
|
|
+static inline uint32_t fdt32_to_cpu(uint32_t x)
|
|
+{
|
|
+ return SwapBytes32 (x);
|
|
+}
|
|
+#define cpu_to_fdt32(x) fdt32_to_cpu(x)
|
|
+
|
|
+static inline uint64_t fdt64_to_cpu(uint64_t x)
|
|
+{
|
|
+ return SwapBytes64 (x);
|
|
+}
|
|
+#define cpu_to_fdt64(x) fdt64_to_cpu(x)
|
|
+
|
|
+static inline void* memcpy(void* dest, const void* src, size_t len) {
|
|
+ return CopyMem (dest, src, len);
|
|
+}
|
|
+
|
|
+static inline void *memmove(void *dest, const void *src, size_t n) {
|
|
+ return CopyMem (dest, src, n);
|
|
+}
|
|
+
|
|
+static inline void *memset(void *s, int c, size_t n) {
|
|
+ return SetMem (s, n, c);
|
|
+}
|
|
+
|
|
+static inline int memcmp(const void* dest, const void* src, int len) {
|
|
+ return CompareMem (dest, src, len);
|
|
+}
|
|
+
|
|
+static inline void *memchr(const void *s, int c, size_t n) {
|
|
+ return ScanMem8 (s, n, c);
|
|
+}
|
|
+
|
|
+static inline size_t strlen (const char* str) {
|
|
+ return AsciiStrLen (str);
|
|
+}
|
|
+
|
|
+static inline char *strchr(const char *s, int c) {
|
|
+ char pattern[2];
|
|
+ pattern[0] = c;
|
|
+ pattern[1] = 0;
|
|
+ return AsciiStrStr (s, pattern);
|
|
+}
|
|
+
|
|
+#endif /* _LIBFDT_ENV_H */
|
|
diff --git a/EmbeddedPkg/Library/FdtLib/FdtLib.inf b/EmbeddedPkg/Library/FdtLib/FdtLib.inf
|
|
new file mode 100755
|
|
index 0000000..9753ed8
|
|
--- /dev/null
|
|
+++ b/EmbeddedPkg/Library/FdtLib/FdtLib.inf
|
|
@@ -0,0 +1,38 @@
|
|
+#/* @file
|
|
+# Copyright (c) 2011, ARM Limited. All rights reserved.
|
|
+#
|
|
+# This program and the accompanying materials
|
|
+# are licensed and made available under the terms and conditions of the BSD License
|
|
+# which accompanies this distribution. The full text of the license may be found at
|
|
+# http://opensource.org/licenses/bsd-license.php
|
|
+#
|
|
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
+#
|
|
+#*/
|
|
+
|
|
+[Defines]
|
|
+ INF_VERSION = 0x00010005
|
|
+ BASE_NAME = FdtLib
|
|
+ FILE_GUID = 6b2478c0-be23-11e0-a28c-0002a5d5c51b
|
|
+ MODULE_TYPE = BASE
|
|
+ VERSION_STRING = 1.0
|
|
+ LIBRARY_CLASS = FdtLib
|
|
+
|
|
+#
|
|
+# The following information is for reference only and not required by the build tools.
|
|
+#
|
|
+# VALID_ARCHITECTURES = ARM
|
|
+#
|
|
+
|
|
+[Sources]
|
|
+ fdt_ro.c
|
|
+ fdt_rw.c
|
|
+ fdt_strerror.c
|
|
+ fdt_sw.c
|
|
+ fdt_wip.c
|
|
+ fdt.c
|
|
+
|
|
+[Packages]
|
|
+ MdePkg/MdePkg.dec
|
|
+ EmbeddedPkg/EmbeddedPkg.dec
|
|
diff --git a/EmbeddedPkg/Library/FdtLib/README.txt b/EmbeddedPkg/Library/FdtLib/README.txt
|
|
new file mode 100755
|
|
index 0000000..c74db7a
|
|
--- /dev/null
|
|
+++ b/EmbeddedPkg/Library/FdtLib/README.txt
|
|
@@ -0,0 +1,38 @@
|
|
+Credits
|
|
+-------
|
|
+Principal original author: David Gibson (david AT gibson.dropbear.id.au)
|
|
+Maintainer: Jon Loeliger (jdl AT jdl.com)
|
|
+
|
|
+
|
|
+Licensing:
|
|
+----------
|
|
+libfdt is GPL/BSD dual-licensed.
|
|
+
|
|
+
|
|
+Current version:
|
|
+----------------
|
|
+
|
|
+# Latest commit in dtc.git repository :
|
|
+commit a31e3ef83bfce62d07695355e5f06cd4d0e44b86
|
|
+Author: Minghuan Lian <Minghuan.Lian@freescale.com>
|
|
+Date: Mon Dec 5 12:22:07 2011 +1100
|
|
+
|
|
+# Latest commit in libfdt :
|
|
+commit a31e3ef83bfce62d07695355e5f06cd4d0e44b86
|
|
+Author: Minghuan Lian <Minghuan.Lian@freescale.com>
|
|
+Date: Mon Dec 5 12:22:07 2011 +1100
|
|
+
|
|
+
|
|
+How to update EmbeddedPkg/Library/FdtLib
|
|
+----------------------------------------
|
|
+1. Clone the dtc into a temporary directory:
|
|
+git clone git://git.jdl.com/software/dtc.git
|
|
+
|
|
+2. Copy the content of 'libfdt' into EmbeddedPkg/Library/FdtLib/
|
|
+cd dtc
|
|
+cp -a libfdt/* $(EDK2_ROOT)/EmbeddedPkg/Library/FdtLib/
|
|
+
|
|
+3. Copy the libfdt headers:
|
|
+mv $(EDK2_ROOT)/EmbeddedPkg/Library/FdtLib/libfdt.h $(EDK2_ROOT)/EmbeddedPkg/Include/
|
|
+mv $(EDK2_ROOT)/EmbeddedPkg/Library/FdtLib/fdt.h $(EDK2_ROOT)/EmbeddedPkg/Include/
|
|
+rm $(EDK2_ROOT)/EmbeddedPkg/Library/FdtLib/libfdt_env.h
|
|
--
|
|
1.7.0.4
|
|
|