2 * This file does the necessary interface mapping between the bootwrapper
3 * device tree operations and the interface provided by shared source
4 * files flatdevicetree.[ch].
6 * Author: Mark A. Greer <mgreer@mvista.com>
8 * 2006 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
14 #include "flatdevtree.h"
17 static struct ft_cxt cxt;
19 static void *ft_finddevice(const char *name)
21 return ft_find_device(&cxt, name);
24 static int ft_getprop(const void *phandle, const char *propname, void *buf,
27 return ft_get_prop(&cxt, phandle, propname, buf, buflen);
30 static int ft_setprop(const void *phandle, const char *propname,
31 const void *buf, const int buflen)
33 return ft_set_prop(&cxt, phandle, propname, buf, buflen);
36 static void ft_pack(void)
41 static unsigned long ft_addr(void)
43 return (unsigned long)cxt.bph;
46 int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device)
48 dt_ops.finddevice = ft_finddevice;
49 dt_ops.getprop = ft_getprop;
50 dt_ops.setprop = ft_setprop;
51 dt_ops.ft_pack = ft_pack;
52 dt_ops.ft_addr = ft_addr;
54 return ft_open(&cxt, dt_blob, max_size, max_find_device,
55 platform_ops.realloc);