blob: 6c6845f76cf7a6599023c498e373a855a4934bc8 [file] [log] [blame]
Gerald Van Baren9f0f3582007-04-06 14:17:14 -04001/*
2 * libfdt - Flat Device Tree manipulation (build/run environment adaptation)
3 * Copyright (C) 2007 Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com
4 * Original version written by David Gibson, IBM Corporation.
5 *
Wolfgang Denke9ea2302013-07-08 11:48:07 +02006 * SPDX-License-Identifier: LGPL-2.1+
Gerald Van Baren9f0f3582007-04-06 14:17:14 -04007 */
8
Gerald Van Barenc0577a62007-03-31 11:59:59 -04009#ifndef _LIBFDT_ENV_H
10#define _LIBFDT_ENV_H
11
Mike Frysinger4ad8e9f2009-07-02 19:23:25 -040012#include "compiler.h"
Kim Phillips2575c722013-01-16 13:59:34 +000013#include "linux/types.h"
Gerald Van Baren6c1da532007-03-31 12:05:39 -040014
Kim Phillipsf3a42e22008-06-10 11:06:17 -050015extern struct fdt_header *working_fdt; /* Pointer to the working fdt */
Gerald Van Barenc0577a62007-03-31 11:59:59 -040016
Kim Phillips2575c722013-01-16 13:59:34 +000017typedef __be16 fdt16_t;
18typedef __be32 fdt32_t;
19typedef __be64 fdt64_t;
20
Mike Frysinger4ad8e9f2009-07-02 19:23:25 -040021#define fdt32_to_cpu(x) be32_to_cpu(x)
22#define cpu_to_fdt32(x) cpu_to_be32(x)
23#define fdt64_to_cpu(x) be64_to_cpu(x)
24#define cpu_to_fdt64(x) cpu_to_be64(x)
David Gibsonb4141b82008-07-07 10:10:48 +100025
Maxime Ripardab154212016-07-05 10:26:37 +020026#ifdef __UBOOT__
27#include <vsprintf.h>
28
29#define strtoul(cp, endp, base) simple_strtoul(cp, endp, base)
30#endif
31
Gerald Van Baren8777dbd2013-05-04 22:17:49 -040032/* adding a ramdisk needs 0x44 bytes in version 2008.10 */
33#define FDT_RAMDISK_OVERHEAD 0x80
34
Gerald Van Barenc0577a62007-03-31 11:59:59 -040035#endif /* _LIBFDT_ENV_H */