* UEFI port of Fdtlib
@ 2011-09-08 14:14 Olivier Martin
0 siblings, 0 replies; 5+ messages in thread
From: Olivier Martin @ 2011-09-08 14:14 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
[-- Attachment #1: Type: text/plain, Size: 876 bytes --]
Hello all,
I have ported the libfdt to Tianocore project [1] (under BSD license) which
is an implementation of UEFI specification supported by Intel, ARM Ltd and
other major companies.
I took the libfdt directory from the head revision of
git://git.jdl.com/software/dtc.git and ported it to the Tianocore project.
I had just needed to edit the libfdt_env.h to translate the POSIX types and
functions into their Tianocore equivalents.
I was advised to send my changes to this mailing-list (please find the
edited lifdt_env.h attached to this email).
I am using this libfdt library to add/update information to the Device Tree
(Linux kernel cmd line, etc) that is passed to the Linux kernel. I am
planning to push upstream my changes in the next couple of days.
Questions and comment are welcome !
Best Regards,
Olivier
[1] http://sourceforge.net/apps/mediawiki/tianocore/
[-- Attachment #2: libfdt_env.h --]
[-- Type: text/plain, Size: 1484 bytes --]
#ifndef _LIBFDT_ENV_H
#define _LIBFDT_ENV_H
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
typedef UINT8 uint8_t;
typedef UINT32 uint32_t;
typedef UINT64 uint64_t;
typedef UINTN uintptr_t;
typedef UINTN size_t;
#define _B(n) ((unsigned long long)((uint8_t *)&x)[n])
static inline uint32_t fdt32_to_cpu(uint32_t x)
{
return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
}
#define cpu_to_fdt32(x) fdt32_to_cpu(x)
static inline uint64_t fdt64_to_cpu(uint64_t x)
{
return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32)
| (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7);
}
#define cpu_to_fdt64(x) fdt64_to_cpu(x)
#undef _B
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 */
[-- Attachment #3: Type: text/plain, Size: 192 bytes --]
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 5+ messages in thread* UEFI port of Fdtlib
@ 2011-09-09 10:16 Olivier Martin
0 siblings, 0 replies; 5+ messages in thread
From: Olivier Martin @ 2011-09-09 10:16 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
[-- Attachment #1: Type: text/plain, Size: 876 bytes --]
Hello all,
I have ported the libfdt to Tianocore project [1] (under BSD license) which
is an implementation of UEFI specification supported by Intel, ARM Ltd and
other major companies.
I took the libfdt directory from the head revision of
git://git.jdl.com/software/dtc.git and ported it to the Tianocore project.
I had just needed to edit the libfdt_env.h to translate the POSIX types and
functions into their Tianocore equivalents.
I was advised to send my changes to this mailing-list (please find the
edited lifdt_env.h attached to this email).
I am using this libfdt library to add/update information to the Device Tree
(Linux kernel cmd line, etc) that is passed to the Linux kernel. I am
planning to push upstream my changes in the next couple of days.
Questions and comment are welcome !
Best Regards,
Olivier
[1] http://sourceforge.net/apps/mediawiki/tianocore/
[-- Attachment #2: libfdt_env.h --]
[-- Type: text/plain, Size: 1484 bytes --]
#ifndef _LIBFDT_ENV_H
#define _LIBFDT_ENV_H
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
typedef UINT8 uint8_t;
typedef UINT32 uint32_t;
typedef UINT64 uint64_t;
typedef UINTN uintptr_t;
typedef UINTN size_t;
#define _B(n) ((unsigned long long)((uint8_t *)&x)[n])
static inline uint32_t fdt32_to_cpu(uint32_t x)
{
return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
}
#define cpu_to_fdt32(x) fdt32_to_cpu(x)
static inline uint64_t fdt64_to_cpu(uint64_t x)
{
return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32)
| (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7);
}
#define cpu_to_fdt64(x) fdt64_to_cpu(x)
#undef _B
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 */
[-- Attachment #3: Type: text/plain, Size: 192 bytes --]
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 5+ messages in thread* UEFI port of Fdtlib
@ 2011-09-09 19:02 Olivier Martin
0 siblings, 0 replies; 5+ messages in thread
From: Olivier Martin @ 2011-09-09 19:02 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
[-- Attachment #1: Type: text/plain, Size: 876 bytes --]
Hello all,
I have ported the libfdt to Tianocore project [1] (under BSD license) which
is an implementation of UEFI specification supported by Intel, ARM Ltd and
other major companies.
I took the libfdt directory from the head revision of
git://git.jdl.com/software/dtc.git and ported it to the Tianocore project.
I had just needed to edit the libfdt_env.h to translate the POSIX types and
functions into their Tianocore equivalents.
I was advised to send my changes to this mailing-list (please find the
edited lifdt_env.h attached to this email).
I am using this libfdt library to add/update information to the Device Tree
(Linux kernel cmd line, etc) that is passed to the Linux kernel. I am
planning to push upstream my changes in the next couple of days.
Questions and comment are welcome !
Best Regards,
Olivier
[1] http://sourceforge.net/apps/mediawiki/tianocore/
[-- Attachment #2: libfdt_env.h --]
[-- Type: text/plain, Size: 1484 bytes --]
#ifndef _LIBFDT_ENV_H
#define _LIBFDT_ENV_H
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
typedef UINT8 uint8_t;
typedef UINT32 uint32_t;
typedef UINT64 uint64_t;
typedef UINTN uintptr_t;
typedef UINTN size_t;
#define _B(n) ((unsigned long long)((uint8_t *)&x)[n])
static inline uint32_t fdt32_to_cpu(uint32_t x)
{
return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
}
#define cpu_to_fdt32(x) fdt32_to_cpu(x)
static inline uint64_t fdt64_to_cpu(uint64_t x)
{
return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32)
| (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7);
}
#define cpu_to_fdt64(x) fdt64_to_cpu(x)
#undef _B
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 */
[-- Attachment #3: Type: text/plain, Size: 192 bytes --]
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <00cd01cc6f23$0c9f5990$25de0cb0$@martin@arm.com>]
end of thread, other threads:[~2011-09-12 10:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-08 14:14 UEFI port of Fdtlib Olivier Martin
-- strict thread matches above, loose matches on Subject: below --
2011-09-09 10:16 Olivier Martin
2011-09-09 19:02 Olivier Martin
[not found] <00cd01cc6f23$0c9f5990$25de0cb0$@martin@arm.com>
[not found] ` <00cd01cc6f23$0c9f5990$25de0cb0$@martin-5wv7dgnIgG8@public.gmane.org>
2011-09-12 1:39 ` David Gibson
[not found] ` <20110912013930.GL9025-787xzQ0H9iQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2011-09-12 10:00 ` Olivier Martin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox