]> git.proxmox.com Git - mirror_edk2.git/blame - EmbeddedPkg/Library/FdtLib/0001-EmbeddedPkg-Added-libfdt-port.patch
ArmPlatformPkg/Bds: Replaced 'EBL' by 'UEFI Shell' as the default shell on ARM Platforms
[mirror_edk2.git] / EmbeddedPkg / Library / FdtLib / 0001-EmbeddedPkg-Added-libfdt-port.patch
CommitLineData
48837c22 1From 669778eab2092ef85ed5b5e537203721cfb1215d Mon Sep 17 00:00:00 2001
2From: Olivier Martin <olivier.martin@arm.com>
3Date: Thu, 16 Feb 2012 15:44:35 +0000
4Subject: [PATCH 1/3] EmbeddedPkg: Added libfdt port
5
6This port is based on the 'libfdt' project (dual licensed BSD/GPL).
7
8Prior to apply this patch you must execute the following steps:
9
101. Clone the dtc into a temporary directory:
11cd EmbeddedPkg/Library
12git clone git://git.jdl.com/software/dtc.git
13
142. Copy the content of 'libfdt' into EmbeddedPkg/Library/FdtLib/
15cd dtc
16cp -a libfdt ../FdtLib
17
183. Copy the libfdt headers:
19mv ../FdtLib/libfdt.h ../../Include/
20mv ../FdtLib/fdt.h ../../Include/
21rm ../FdtLib/libfdt_env.h
22---
23 EmbeddedPkg/EmbeddedPkg.dsc | 1 +
24 EmbeddedPkg/Include/libfdt_env.h | 77 +++++++++++++++++++++++++++++++++
25 EmbeddedPkg/Library/FdtLib/FdtLib.inf | 38 ++++++++++++++++
26 EmbeddedPkg/Library/FdtLib/README.txt | 38 ++++++++++++++++
27 4 files changed, 154 insertions(+), 0 deletions(-)
28 mode change 100644 => 100755 EmbeddedPkg/EmbeddedPkg.dsc
29 create mode 100755 EmbeddedPkg/Include/libfdt_env.h
30 create mode 100755 EmbeddedPkg/Library/FdtLib/FdtLib.inf
31 create mode 100755 EmbeddedPkg/Library/FdtLib/README.txt
32
33diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc
34old mode 100644
35new mode 100755
36index 8862f3d..c3a2464
37--- a/EmbeddedPkg/EmbeddedPkg.dsc
38+++ b/EmbeddedPkg/EmbeddedPkg.dsc
39@@ -97,6 +97,7 @@
40
41 EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
42
43+ FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
44
45 [LibraryClasses.common.DXE_DRIVER]
46 PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
47diff --git a/EmbeddedPkg/Include/libfdt_env.h b/EmbeddedPkg/Include/libfdt_env.h
48new file mode 100755
49index 0000000..8c4f1c7
50--- /dev/null
51+++ b/EmbeddedPkg/Include/libfdt_env.h
52@@ -0,0 +1,77 @@
53+/** @file
54+*
55+* Copyright (c) 2011, ARM Limited. All rights reserved.
56+*
57+* This program and the accompanying materials
58+* are licensed and made available under the terms and conditions of the BSD License
59+* which accompanies this distribution. The full text of the license may be found at
60+* http://opensource.org/licenses/bsd-license.php
61+*
62+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
63+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
64+*
65+**/
66+
67+#ifndef _LIBFDT_ENV_H
68+#define _LIBFDT_ENV_H
69+
70+#include <Library/BaseLib.h>
71+#include <Library/BaseMemoryLib.h>
72+
73+typedef UINT8 uint8_t;
74+typedef UINT16 uint16_t;
75+typedef UINT32 uint32_t;
76+typedef UINT64 uint64_t;
77+typedef UINTN uintptr_t;
78+typedef UINTN size_t;
79+
80+static inline uint16_t fdt16_to_cpu(uint16_t x)
81+{
82+ return SwapBytes16 (x);
83+}
84+#define cpu_to_fdt16(x) fdt16_to_cpu(x)
85+
86+static inline uint32_t fdt32_to_cpu(uint32_t x)
87+{
88+ return SwapBytes32 (x);
89+}
90+#define cpu_to_fdt32(x) fdt32_to_cpu(x)
91+
92+static inline uint64_t fdt64_to_cpu(uint64_t x)
93+{
94+ return SwapBytes64 (x);
95+}
96+#define cpu_to_fdt64(x) fdt64_to_cpu(x)
97+
98+static inline void* memcpy(void* dest, const void* src, size_t len) {
99+ return CopyMem (dest, src, len);
100+}
101+
102+static inline void *memmove(void *dest, const void *src, size_t n) {
103+ return CopyMem (dest, src, n);
104+}
105+
106+static inline void *memset(void *s, int c, size_t n) {
107+ return SetMem (s, n, c);
108+}
109+
110+static inline int memcmp(const void* dest, const void* src, int len) {
111+ return CompareMem (dest, src, len);
112+}
113+
114+static inline void *memchr(const void *s, int c, size_t n) {
115+ return ScanMem8 (s, n, c);
116+}
117+
118+static inline size_t strlen (const char* str) {
119+ return AsciiStrLen (str);
120+}
121+
122+static inline char *strchr(const char *s, int c) {
123+ char pattern[2];
124+ pattern[0] = c;
125+ pattern[1] = 0;
126+ return AsciiStrStr (s, pattern);
127+}
128+
129+#endif /* _LIBFDT_ENV_H */
130diff --git a/EmbeddedPkg/Library/FdtLib/FdtLib.inf b/EmbeddedPkg/Library/FdtLib/FdtLib.inf
131new file mode 100755
132index 0000000..9753ed8
133--- /dev/null
134+++ b/EmbeddedPkg/Library/FdtLib/FdtLib.inf
135@@ -0,0 +1,38 @@
136+#/* @file\r
137+# Copyright (c) 2011, ARM Limited. All rights reserved.\r
138+# \r
139+# This program and the accompanying materials \r
140+# are licensed and made available under the terms and conditions of the BSD License \r
141+# which accompanies this distribution. The full text of the license may be found at \r
142+# http://opensource.org/licenses/bsd-license.php \r
143+#\r
144+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
145+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
146+#\r
147+#*/\r
148+\r
149+[Defines]\r
150+ INF_VERSION = 0x00010005\r
151+ BASE_NAME = FdtLib\r
152+ FILE_GUID = 6b2478c0-be23-11e0-a28c-0002a5d5c51b\r
153+ MODULE_TYPE = BASE\r
154+ VERSION_STRING = 1.0\r
155+ LIBRARY_CLASS = FdtLib\r
156+\r
157+#\r
158+# The following information is for reference only and not required by the build tools.\r
159+#\r
160+# VALID_ARCHITECTURES = ARM\r
161+#\r
162+\r
163+[Sources]\r
164+ fdt_ro.c\r
165+ fdt_rw.c\r
166+ fdt_strerror.c\r
167+ fdt_sw.c\r
168+ fdt_wip.c\r
169+ fdt.c\r
170+\r
171+[Packages]\r
172+ MdePkg/MdePkg.dec\r
173+ EmbeddedPkg/EmbeddedPkg.dec\r
174diff --git a/EmbeddedPkg/Library/FdtLib/README.txt b/EmbeddedPkg/Library/FdtLib/README.txt
175new file mode 100755
176index 0000000..c74db7a
177--- /dev/null
178+++ b/EmbeddedPkg/Library/FdtLib/README.txt
179@@ -0,0 +1,38 @@
180+Credits\r
181+-------\r
182+Principal original author: David Gibson (david AT gibson.dropbear.id.au)\r
183+Maintainer: Jon Loeliger (jdl AT jdl.com)\r
184+\r
185+\r
186+Licensing:\r
187+----------\r
188+libfdt is GPL/BSD dual-licensed.\r
189+\r
190+\r
191+Current version:\r
192+----------------\r
193+\r
194+# Latest commit in dtc.git repository :\r
195+commit a31e3ef83bfce62d07695355e5f06cd4d0e44b86\r
196+Author: Minghuan Lian <Minghuan.Lian@freescale.com>\r
197+Date: Mon Dec 5 12:22:07 2011 +1100\r
198+\r
199+# Latest commit in libfdt :\r
200+commit a31e3ef83bfce62d07695355e5f06cd4d0e44b86\r
201+Author: Minghuan Lian <Minghuan.Lian@freescale.com>\r
202+Date: Mon Dec 5 12:22:07 2011 +1100\r
203+\r
204+\r
205+How to update EmbeddedPkg/Library/FdtLib\r
206+----------------------------------------\r
207+1. Clone the dtc into a temporary directory:\r
208+git clone git://git.jdl.com/software/dtc.git\r
209+\r
210+2. Copy the content of 'libfdt' into EmbeddedPkg/Library/FdtLib/\r
211+cd dtc\r
212+cp -a libfdt/* $(EDK2_ROOT)/EmbeddedPkg/Library/FdtLib/\r
213+\r
214+3. Copy the libfdt headers:\r
215+mv $(EDK2_ROOT)/EmbeddedPkg/Library/FdtLib/libfdt.h $(EDK2_ROOT)/EmbeddedPkg/Include/\r
216+mv $(EDK2_ROOT)/EmbeddedPkg/Library/FdtLib/fdt.h $(EDK2_ROOT)/EmbeddedPkg/Include/\r
217+rm $(EDK2_ROOT)/EmbeddedPkg/Library/FdtLib/libfdt_env.h\r
218--
2191.7.0.4
220