1 /*
2 * Copyright (C) 2006 David Gibson, IBM Corporation.
3 *
4 * This file is part of libxl, and was originally taken from libfdt.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; version 2.1 only. with the special
9 * exception on linking described in file LICENSE.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * Additionally, this particular file is dual licensed. That is,
17 * alternatively, at your option:
18 *
19 * Redistribution and use in source and binary forms, with or
20 * without modification, are permitted provided that the following
21 * conditions are met:
22 *
23 * 1. Redistributions of source code must retain the above
24 * copyright notice, this list of conditions and the following
25 * disclaimer.
26 * 2. Redistributions in binary form must reproduce the above
27 * copyright notice, this list of conditions and the following
28 * disclaimer in the documentation and/or other materials
29 * provided with the distribution.
30 *
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
32 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
33 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
34 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
36 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
37 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
38 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
39 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
41 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
42 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
43 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 *
45 * Note that this applies only to this file, and other files with a
46 * similar notice. Also, note that when the same code is distributed
47 * along with the rest of libxl, you must comply with the terms of the
48 * LGPLv2.1 for the whole of libxl including this file.
49 *
50 * The intent is to permit, in particular, upstream libfdt to
51 * incorporate improvements to this file within upstream libfdt. At
52 * the time of writing, upstream libfdt is dual licensed: 2-clause BSD
53 * (as above) and GPLv2-or-later. The 2-clause BSD licence is
54 * compatible with both GPLv2-or-later and LGPLv2.1-only; this permits
55 * copying in both directions, and the optional licence upgrade to a
56 * copyleft licence by libdft upstream or the Xen Project,
57 * respectively.
58 */
59
60 #ifndef LIBXL_LIBFDT_COMPAT_H
61 #define LIBXL_LIBFDT_COMPAT_H
62
63 #include "libxl_internal.h"
64 #include <libfdt.h>
65
66 #if !HAVE_DECL_FDT_FIRST_SUBNODE
67 _hidden int fdt_first_subnode(const void *fdt, int offset);
68 #endif
69
70 #if !HAVE_DECL_FDT_NEXT_SUBNODE
71 _hidden int fdt_next_subnode(const void *fdt, int offset);
72 #endif
73
74 #if !HAVE_DECL_FDT_PROPERTY_U32
fdt_property_u32(void * fdt,const char * name,uint32_t val)75 static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val)
76 {
77 uint32_t tmp = cpu_to_fdt32(val);
78 return fdt_property(fdt, name, &tmp, sizeof(tmp));
79 }
80 #endif
81
82 #endif
83
84 /*
85 * Local variables:
86 * mode: C
87 * c-basic-offset: 4
88 * indent-tabs-mode: nil
89 * End:
90 */
91