libsel4platsupport: Init FDT ops in 'new_io_ops'
Now that there is an implementation of the FDT ops, we add a call to the
blanket I/O ops initialisation function to also initialise the FDT ops
alongside all the other interfaces.
diff --git a/libsel4platsupport/src/io.c b/libsel4platsupport/src/io.c
index bb0b0d3..9f63bcd 100644
--- a/libsel4platsupport/src/io.c
+++ b/libsel4platsupport/src/io.c
@@ -370,11 +370,23 @@
return error;
}
+ error = sel4platsupport_new_fdt_ops(&io_ops->io_fdt, simple, &io_ops->malloc_ops);
+ if (error) {
+ free(io_ops->io_mapper.cookie);
+ io_ops->io_mapper.cookie = NULL;
+ return error;
+ }
+
error = sel4platsupport_new_irq_ops(&io_ops->irq_ops, vka, simple, DEFAULT_IRQ_INTERFACE_CONFIG,
&io_ops->malloc_ops);
if (error) {
free(io_ops->io_mapper.cookie);
io_ops->io_mapper.cookie = NULL;
+ ssize_t fdt_size = simple_get_extended_bootinfo_length(simple, SEL4_BOOTINFO_HEADER_FDT);
+ if (fdt_size > 0) {
+ /* The FDT is available on this platform and we actually copied it, so we free it */
+ ps_free(&io_ops->malloc_ops, fdt_size, &io_ops->io_fdt.cookie);
+ }
return error;
}