diff options
Diffstat (limited to 'arch/powerpc/boot/libfdt-wrapper.c')
-rw-r--r-- | arch/powerpc/boot/libfdt-wrapper.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/arch/powerpc/boot/libfdt-wrapper.c b/arch/powerpc/boot/libfdt-wrapper.c index c541fd8a95d4..9276327bc2bb 100644 --- a/arch/powerpc/boot/libfdt-wrapper.c +++ b/arch/powerpc/boot/libfdt-wrapper.c | |||
@@ -105,6 +105,11 @@ static int fdt_wrapper_setprop(const void *devp, const char *name, | |||
105 | return check_err(rc); | 105 | return check_err(rc); |
106 | } | 106 | } |
107 | 107 | ||
108 | static int fdt_wrapper_del_node(const void *devp) | ||
109 | { | ||
110 | return fdt_del_node(fdt, devp_offset(devp)); | ||
111 | } | ||
112 | |||
108 | static void *fdt_wrapper_get_parent(const void *devp) | 113 | static void *fdt_wrapper_get_parent(const void *devp) |
109 | { | 114 | { |
110 | return offset_devp(fdt_parent_offset(fdt, devp_offset(devp))); | 115 | return offset_devp(fdt_parent_offset(fdt, devp_offset(devp))); |
@@ -165,6 +170,7 @@ static unsigned long fdt_wrapper_finalize(void) | |||
165 | void fdt_init(void *blob) | 170 | void fdt_init(void *blob) |
166 | { | 171 | { |
167 | int err; | 172 | int err; |
173 | int bufsize; | ||
168 | 174 | ||
169 | dt_ops.finddevice = fdt_wrapper_finddevice; | 175 | dt_ops.finddevice = fdt_wrapper_finddevice; |
170 | dt_ops.getprop = fdt_wrapper_getprop; | 176 | dt_ops.getprop = fdt_wrapper_getprop; |
@@ -173,21 +179,21 @@ void fdt_init(void *blob) | |||
173 | dt_ops.create_node = fdt_wrapper_create_node; | 179 | dt_ops.create_node = fdt_wrapper_create_node; |
174 | dt_ops.find_node_by_prop_value = fdt_wrapper_find_node_by_prop_value; | 180 | dt_ops.find_node_by_prop_value = fdt_wrapper_find_node_by_prop_value; |
175 | dt_ops.find_node_by_compatible = fdt_wrapper_find_node_by_compatible; | 181 | dt_ops.find_node_by_compatible = fdt_wrapper_find_node_by_compatible; |
182 | dt_ops.del_node = fdt_wrapper_del_node; | ||
176 | dt_ops.get_path = fdt_wrapper_get_path; | 183 | dt_ops.get_path = fdt_wrapper_get_path; |
177 | dt_ops.finalize = fdt_wrapper_finalize; | 184 | dt_ops.finalize = fdt_wrapper_finalize; |
178 | 185 | ||
179 | /* Make sure the dt blob is the right version and so forth */ | 186 | /* Make sure the dt blob is the right version and so forth */ |
180 | fdt = blob; | 187 | fdt = blob; |
181 | err = fdt_open_into(fdt, fdt, fdt_totalsize(blob)); | 188 | bufsize = fdt_totalsize(fdt) + 4; |
182 | if (err == -FDT_ERR_NOSPACE) { | 189 | buf = malloc(bufsize); |
183 | int bufsize = fdt_totalsize(fdt) + 4; | 190 | if(!buf) |
184 | buf = malloc(bufsize); | 191 | fatal("malloc failed. can't relocate the device tree\n\r"); |
185 | err = fdt_open_into(fdt, buf, bufsize); | 192 | |
186 | } | 193 | err = fdt_open_into(fdt, buf, bufsize); |
187 | 194 | ||
188 | if (err != 0) | 195 | if (err != 0) |
189 | fatal("fdt_init(): %s\n\r", fdt_strerror(err)); | 196 | fatal("fdt_init(): %s\n\r", fdt_strerror(err)); |
190 | 197 | ||
191 | if (buf) | 198 | fdt = buf; |
192 | fdt = buf; | ||
193 | } | 199 | } |