<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">On Sat, Jun 6, 2020 at 5:40 PM Christian Mauderer <<a href="mailto:oss@c-mauderer.de" target="_blank">oss@c-mauderer.de</a>> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 04/06/2020 19:43, G S Niteesh Babu wrote:<br>
> The following files have been ported to RTEMS<br>
> 1) openfirm.h<br>
> 2) openfirm.c<br>
> 3) ofw_fdt.c<br>
> ---<br>
> cpukit/libfreebsd/dev/ofw/ofw_fdt.c | 117 ++++++++++++++++++++++++++-<br>
> cpukit/libfreebsd/dev/ofw/openfirm.c | 59 +++++++++++++-<br>
> cpukit/libfreebsd/dev/ofw/openfirm.h | 18 +++++<br>
> 3 files changed, 191 insertions(+), 3 deletions(-)<br>
> <br>
> diff --git a/cpukit/libfreebsd/dev/ofw/ofw_fdt.c b/cpukit/libfreebsd/dev/ofw/ofw_fdt.c<br>
> index e4f72e8142..5341440789 100644<br>
> --- a/cpukit/libfreebsd/dev/ofw/ofw_fdt.c<br>
> +++ b/cpukit/libfreebsd/dev/ofw/ofw_fdt.c<br>
> @@ -29,10 +29,13 @@<br>
> * SUCH DAMAGE.<br>
> */<br>
> <br>
> +#ifndef __rtems__<br>
> #include <sys/cdefs.h><br>
> __FBSDID("$FreeBSD$");<br>
> +#endif /* __rtems__ */<br>
> <br>
> #include <sys/param.h><br>
> +#ifndef __rtems__<br>
> #include <sys/kernel.h><br>
> #include <sys/malloc.h><br>
> #include <sys/systm.h><br>
> @@ -45,9 +48,18 @@ __FBSDID("$FreeBSD$");<br>
> #include <dev/ofw/ofwvar.h><br>
> #include <dev/ofw/openfirm.h><br>
> #include <dev/ofw/ofw_bus_subr.h><br>
> +#endif /* __rtems__ */<br>
> <br>
> #include "ofw_if.h"<br>
> -<br>
<br>
I'm not really happy about lines starting with "-" in the porting<br>
commits. I think we should apply the same rules like in libbsd: Only add<br>
stuff. Exception: The one at the end of the file is OK (where git tells<br>
you "\ No newline at end of file"). You can't really avoid that.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">I fixed this.</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> +#ifdef __rtems__<br>
> +#include <rtems.h><br>
> +#include <rtems/sysinit.h><br>
> +#include <libfdt.h><br>
> +#include <assert.h><br>
> +#include "openfirm.h"<br>
> +#endif /* __rtems__ */<br>
> +<br>
> +#ifndef __rtems__<br>
> #ifdef DEBUG<br>
> #define debugf(fmt, args...) do { printf("%s(): ", __func__); \<br>
> printf(fmt,##args); } while (0)<br>
> @@ -63,6 +75,7 @@ __FBSDID("$FreeBSD$");<br>
> #define FDT_MARVELL<br>
> #endif<br>
> #endif<br>
> +#endif /* __rtems__ */<br>
> <br>
> static int ofw_fdt_init(ofw_t, void *);<br>
> static phandle_t ofw_fdt_peer(ofw_t, phandle_t);<br>
> @@ -78,6 +91,7 @@ static ssize_t ofw_fdt_canon(ofw_t, const char *, char *, size_t);<br>
> static phandle_t ofw_fdt_finddevice(ofw_t, const char *);<br>
> static ssize_t ofw_fdt_instance_to_path(ofw_t, ihandle_t, char *, size_t);<br>
> static ssize_t ofw_fdt_package_to_path(ofw_t, phandle_t, char *, size_t);<br>
> +#ifndef __rtems__<br>
> static int ofw_fdt_interpret(ofw_t, const char *, int, cell_t *);<br>
> <br>
> static ofw_method_t ofw_fdt_methods[] = {<br>
> @@ -104,9 +118,11 @@ static ofw_def_t ofw_fdt = {<br>
> 0<br>
> };<br>
> OFW_DEF(ofw_fdt);<br>
> +#endif /* __rtems__ */<br>
> <br>
> static void *fdtp = NULL;<br>
> <br>
> +#ifndef __rtems__<br>
> static int<br>
> sysctl_handle_dtb(SYSCTL_HANDLER_ARGS)<br>
> {<br>
> @@ -127,6 +143,24 @@ sysctl_register_fdt_oid(void *arg)<br>
> sysctl_handle_dtb, "", "Device Tree Blob");<br>
> }<br>
> SYSINIT(dtb_oid, SI_SUB_KMEM, SI_ORDER_ANY, sysctl_register_fdt_oid, NULL);<br>
> +#else /* __rtems__ */<br>
> +const void* bsp_fdt_get(void);<br>
> +static void<br>
> +ofw_init(void)<br>
> +{<br>
> + int rv;<br>
> + const void *fdt;<br>
> +<br>
> + fdt = bsp_fdt_get();<br>
> + rv = ofw_fdt_init(NULL, fdt);<br>
> + assert(rv == 0);<br>
<br>
Is assert really the only error handling possible here? Asserts are<br>
allways a bit difficult because they stop the entire system. In which<br>
cases would it hit?</blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">The assert is reached when the FDT is not valid. The check is done</div><div class="gmail_default" style="font-size:small">using fdt_check_header. Shutting the system would be the only way<br></div><div class="gmail_default" style="font-size:small">right?</div><div class="gmail_default" style="font-size:small">I agree to assert is not the right way to quit. Can we quit with</div><div class="gmail_default" style="font-size:small">a proper error code like BSP_FATAL_INVALID_FDT or do we have</div><div class="gmail_default" style="font-size:small">something like that already?</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail_default" style="font-size:small"></span><br>
> +}<br>
> +RTEMS_SYSINIT_ITEM(<br>
> + ofw_init,<br>
> + RTEMS_SYSINIT_BSP_START,<br>
> + RTEMS_SYSINIT_ORDER_FIRST<br>
> +);<br>
> +#endif /* __rtems__ */<br>
> <br>
> static int<br>
> ofw_fdt_init(ofw_t ofw, void *data)<br>
> @@ -297,7 +331,11 @@ ofw_fdt_getprop(ofw_t ofw, phandle_t package, const char *propname, void *buf,<br>
> if (prop == NULL)<br>
> return (-1);<br>
> <br>
> +#ifndef __rtems__<br>
> bcopy(prop, buf, min(len, buflen));<br>
> +#else /* __rtems__ */<br>
> + memcpy(buf, prop, MIN(len, buflen));<br>
> +#endif /* __rtems__ */<br>
> <br>
> return (len);<br>
> }<br>
> @@ -407,6 +445,7 @@ ofw_fdt_package_to_path(ofw_t ofw, phandle_t package, char *buf, size_t len)<br>
> return (-1);<br>
> }<br>
> <br>
> +#ifndef __rtems__<br>
> #if defined(FDT_MARVELL)<br>
> static int<br>
> ofw_fdt_fixup(ofw_t ofw)<br>
> @@ -476,4 +515,78 @@ ofw_fdt_interpret(ofw_t ofw, const char *cmd, int nret, cell_t *retvals)<br>
> #else<br>
> return (0);<br>
> #endif<br>
> -}<br>
> \ No newline at end of file<br>
> +}<br>
> +#endif /* __rtems__ */<br>
> +<br>
> +#ifdef __rtems__<br>
> +int OFW_INIT(ofw_t ofw_obj, void *cookie)<br>
<br>
Again: Please use FreeBSD style. The return value should be on it's onw<br>
line during the definition (not during declaration).<br>
<br>
> +{<br>
<br>
There should be one empty line if you have no local variables (I'm not<br>
really consequent here too).<br>
<br>
> + return ofw_fdt_init(ofw_obj, cookie);<br>
<br>
And brackets around everything that is returned.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">I fixed all.</div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> +}<br>
> +<br>
> +phandle_t OFW_PEER(ofw_t ofw_obj, phandle_t node)<br>
> +{<br>
> + return ofw_fdt_peer(ofw_obj, node);<br>
> +}<br>
> +<br>
> +phandle_t OFW_CHILD(ofw_t ofw_obj, phandle_t node)<br>
> +{<br>
> + return ofw_fdt_child(ofw_obj, node);<br>
> +}<br>
> +<br>
> +phandle_t OFW_PARENT(ofw_t ofw_obj, phandle_t node)<br>
> +{<br>
> + return ofw_fdt_parent(ofw_obj, node);<br>
> +}<br>
> +<br>
> +phandle_t OFW_INSTANCE_TO_PACKAGE(ofw_t ofw_obj, ihandle_t instance)<br>
> +{<br>
> + return ofw_fdt_instance_to_package(ofw_obj, instance);<br>
> +}<br>
> +<br>
> +ssize_t OFW_GETPROPLEN(ofw_t ofw_obj, phandle_t package, const char *propname)<br>
> +{<br>
> + return ofw_fdt_getproplen(ofw_obj, package, propname);<br>
> +}<br>
> +<br>
> +ssize_t OFW_GETPROP(ofw_t ofw_obj, phandle_t package, const char *propname,<br>
> + void *buf, size_t buflen<br>
> +)<br>
> +{<br>
> + return ofw_fdt_getprop(ofw_obj, package, propname, buf, buflen);<br>
> +}<br>
> +<br>
> +int OFW_NEXTPROP(ofw_t ofw_obj, phandle_t package, const char *prev, char *buf,<br>
> + size_t size)<br>
> +{<br>
> + return ofw_fdt_nextprop(ofw_obj, package, prev, buf, size);<br>
> +}<br>
> +<br>
> +int OFW_SETPROP(ofw_t ofw_obj, phandle_t package, const char *propname,<br>
> + const void *buf, size_t len)<br>
> +{<br>
> + return ofw_fdt_setprop(ofw_obj, package, propname, buf, len);<br>
> +}<br>
> +<br>
> +ssize_t OFW_CANON(ofw_t ofw_obj, const char *device, char *buf, size_t len)<br>
> +{<br>
> + return ofw_fdt_canon(ofw_obj, device, buf, len);<br>
> +}<br>
> +<br>
> +phandle_t OFW_FINDDEVICE(ofw_t ofw_obj, const char *device)<br>
> +{<br>
> + return ofw_fdt_finddevice(ofw_obj, device);<br>
> +}<br>
> +<br>
> +ssize_t OFW_INSTANCE_TO_PATH(ofw_t ofw_obj, ihandle_t instance, char *buf,<br>
> + size_t len)<br>
> +{<br>
> + return ofw_fdt_instance_to_path(ofw_obj, instance, buf, len);<br>
> +}<br>
> +<br>
> +ssize_t OFW_PACKAGE_TO_PATH(ofw_t ofw_obj, phandle_t package, char *buf,<br>
> + size_t len)<br>
> +{<br>
> + return ofw_fdt_package_to_path(ofw_obj, package, buf, len);<br>
> +}<br>
> +#endif /* __rtems__ */<br>
> \ No newline at end of file<br>
> diff --git a/cpukit/libfreebsd/dev/ofw/openfirm.c b/cpukit/libfreebsd/dev/ofw/openfirm.c<br>
> index 50ebf2cf16..646c006e18 100644<br>
> --- a/cpukit/libfreebsd/dev/ofw/openfirm.c<br>
> +++ b/cpukit/libfreebsd/dev/ofw/openfirm.c<br>
> @@ -57,27 +57,39 @@<br>
> * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<br>
> */<br>
> <br>
> +#ifndef __rtems__<br>
> #include <sys/cdefs.h><br>
<br>
Don't we have a sys/cdefs.h? Or is that from libbsd in my installation?<br></blockquote><div><span class="gmail_default" style="font-size:small"></span></div><div><div class="gmail_default" style="font-size:small">It is not present in RTEMS but is present in newlib. What is this header</div><div class="gmail_default" style="font-size:small">used for? Do we really need it?</div></div><div><span class="gmail_default" style="font-size:small"><br></span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> __FBSDID("$FreeBSD$");<br>
> <br>
> #include "opt_platform.h"<br>
> +#endif /* __rtems__ */<br>
> <br>
> #include <sys/param.h><br>
> +#ifndef __rtems__<br>
> #include <sys/kernel.h><br>
> #include <sys/lock.h><br>
> #include <sys/malloc.h><br>
> #include <sys/mutex.h><br>
> #include <sys/queue.h><br>
> #include <sys/systm.h><br>
> +#endif /* __rtems__ */<br>
> #include <sys/endian.h><br>
> <br>
> +#ifndef __rtems__<br>
> #include <machine/stdarg.h><br>
> <br>
> #include <dev/ofw/ofwvar.h><br>
> #include <dev/ofw/openfirm.h><br>
> +#endif /* __rtems__ */<br>
> <br>
> #include "ofw_if.h"<br>
> +#ifdef __rtems__<br>
> +#include <assert.h><br>
<br>
Why do you need assert.h here?<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">I missed it while cleaning.</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> +#include "openfirm.h"<br>
> +#include "../../rtems-freebsd-helper.h"<br>
> +#endif /* __rtems__ */<br>
> <br>
> +#ifndef __rtems__<br>
> static void OF_putchar(int c, void *arg);<br>
> <br>
> MALLOC_DEFINE(M_OFWPROP, "openfirm", "Open Firmware properties");<br>
> @@ -85,7 +97,9 @@ MALLOC_DEFINE(M_OFWPROP, "openfirm", "Open Firmware properties");<br>
> static ihandle_t stdout;<br>
> <br>
> static ofw_def_t *ofw_def_impl = NULL;<br>
> +#endif /* __rtems__ */<br>
> static ofw_t ofw_obj;<br>
> +#ifndef __rtems__<br>
> static struct ofw_kobj ofw_kernel_obj;<br>
> static struct kobj_ops ofw_kernel_kops;<br>
> <br>
> @@ -224,14 +238,18 @@ OF_install(char *name, int prio)<br>
> <br>
> return (FALSE);<br>
> }<br>
> +#endif /* __rtems__ */<br>
> <br>
> /* Initializer */<br>
> int<br>
> OF_init(void *cookie)<br>
> {<br>
> +#ifndef __rtems__<br>
> phandle_t chosen;<br>
> +#endif /* __rtems__ */<br>
> int rv;<br>
> <br>
> +#ifndef __rtems__<br>
> if (ofw_def_impl == NULL)<br>
> return (-1);<br>
> <br>
> @@ -242,17 +260,21 @@ OF_init(void *cookie)<br>
> */<br>
> kobj_class_compile_static(ofw_def_impl, &ofw_kernel_kops);<br>
> kobj_init_static((kobj_t)ofw_obj, ofw_def_impl);<br>
> +#endif /* __rtems__ */<br>
> <br>
> rv = OFW_INIT(ofw_obj, cookie);<br>
> <br>
> +#ifndef __rtems__<br>
> if ((chosen = OF_finddevice("/chosen")) != -1)<br>
> if (OF_getencprop(chosen, "stdout", &stdout,<br>
> sizeof(stdout)) == -1)<br>
> stdout = -1;<br>
> +#endif /* __rtems__ */<br>
> <br>
> return (rv);<br>
> }<br>
> <br>
> +#ifndef __rtems__<br>
> static void<br>
> OF_putchar(int c, void *arg __unused)<br>
> {<br>
> @@ -314,6 +336,7 @@ OF_interpret(const char *cmd, int nreturns, ...)<br>
> <br>
> return (status);<br>
> }<br>
> +#endif /* __rtems__ */<br>
> <br>
> /*<br>
> * Device tree functions<br>
> @@ -324,8 +347,10 @@ phandle_t<br>
> OF_peer(phandle_t node)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (ofw_def_impl == NULL)<br>
> return (0);<br>
> +#endif /* __rtems__ */<br>
> <br>
> return (OFW_PEER(ofw_obj, node));<br>
> }<br>
> @@ -335,8 +360,10 @@ phandle_t<br>
> OF_child(phandle_t node)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (ofw_def_impl == NULL)<br>
> return (0);<br>
> +#endif /* __rtems__ */<br>
> <br>
> return (OFW_CHILD(ofw_obj, node));<br>
> }<br>
> @@ -346,8 +373,10 @@ phandle_t<br>
> OF_parent(phandle_t node)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (ofw_def_impl == NULL)<br>
> return (0);<br>
> +#endif /* __rtems__ */<br>
> <br>
> return (OFW_PARENT(ofw_obj, node));<br>
> }<br>
> @@ -357,8 +386,10 @@ phandle_t<br>
> OF_instance_to_package(ihandle_t instance)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (ofw_def_impl == NULL)<br>
> return (-1);<br>
> +#endif /* __rtems__ */<br>
> <br>
> return (OFW_INSTANCE_TO_PACKAGE(ofw_obj, instance));<br>
> }<br>
> @@ -368,8 +399,10 @@ ssize_t<br>
> OF_getproplen(phandle_t package, const char *propname)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (ofw_def_impl == NULL)<br>
> return (-1);<br>
> +#endif /* __rtems__ */<br>
> <br>
> return (OFW_GETPROPLEN(ofw_obj, package, propname));<br>
> }<br>
> @@ -387,8 +420,10 @@ ssize_t<br>
> OF_getprop(phandle_t package, const char *propname, void *buf, size_t buflen)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (ofw_def_impl == NULL)<br>
> return (-1);<br>
> +#endif /* __rtems__ */<br>
> <br>
> return (OFW_GETPROP(ofw_obj, package, propname, buf, buflen));<br>
> }<br>
> @@ -532,8 +567,10 @@ int<br>
> OF_nextprop(phandle_t package, const char *previous, char *buf, size_t size)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (ofw_def_impl == NULL)<br>
> return (-1);<br>
> +#endif /* __rtems__ */<br>
> <br>
> return (OFW_NEXTPROP(ofw_obj, package, previous, buf, size));<br>
> }<br>
> @@ -543,8 +580,10 @@ int<br>
> OF_setprop(phandle_t package, const char *propname, const void *buf, size_t len)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (ofw_def_impl == NULL)<br>
> return (-1);<br>
> +#endif /* __rtems__ */<br>
> <br>
> return (OFW_SETPROP(ofw_obj, package, propname, buf,len));<br>
> }<br>
> @@ -554,8 +593,10 @@ ssize_t<br>
> OF_canon(const char *device, char *buf, size_t len)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (ofw_def_impl == NULL)<br>
> return (-1);<br>
> +#endif /* __rtems__ */<br>
> <br>
> return (OFW_CANON(ofw_obj, device, buf, len));<br>
> }<br>
> @@ -565,8 +606,10 @@ phandle_t<br>
> OF_finddevice(const char *device)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (ofw_def_impl == NULL)<br>
> return (-1);<br>
> +#endif /* __rtems__ */<br>
> <br>
> return (OFW_FINDDEVICE(ofw_obj, device));<br>
> }<br>
> @@ -576,8 +619,10 @@ ssize_t<br>
> OF_instance_to_path(ihandle_t instance, char *buf, size_t len)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (ofw_def_impl == NULL)<br>
> return (-1);<br>
> +#endif /* __rtems__ */<br>
> <br>
> return (OFW_INSTANCE_TO_PATH(ofw_obj, instance, buf, len));<br>
> }<br>
> @@ -587,8 +632,10 @@ ssize_t<br>
> OF_package_to_path(phandle_t package, char *buf, size_t len)<br>
> {<br>
> <br>
> +#ifndef __rtems__<br>
> if (ofw_def_impl == NULL)<br>
> return (-1);<br>
> +#endif /* __rtems__ */<br>
> <br>
> return (OFW_PACKAGE_TO_PATH(ofw_obj, package, buf, len));<br>
> }<br>
> @@ -626,14 +673,18 @@ OF_child_xref_phandle(phandle_t parent, phandle_t xref)<br>
> phandle_t<br>
> OF_node_from_xref(phandle_t xref)<br>
> {<br>
> +#ifndef __rtems__<br>
> struct xrefinfo *xi;<br>
> +#endif /* __rtems__ */<br>
> phandle_t node;<br>
> <br>
> +#ifndef __rtems__<br>
> if (xref_init_done) {<br>
> if ((xi = xrefinfo_find(xref, FIND_BY_XREF)) == NULL)<br>
> return (xref);<br>
> return (xi->node);<br>
> }<br>
> +#endif /* __rtems__ */<br>
> <br>
> if ((node = OF_child_xref_phandle(OF_peer(0), xref)) == -1)<br>
> return (xref);<br>
> @@ -643,14 +694,18 @@ OF_node_from_xref(phandle_t xref)<br>
> phandle_t<br>
> OF_xref_from_node(phandle_t node)<br>
> {<br>
> +#ifndef __rtems__<br>
> struct xrefinfo *xi;<br>
> +#endif /* __rtems__ */<br>
> phandle_t xref;<br>
> <br>
> +#ifndef __rtems__<br>
> if (xref_init_done) {<br>
> if ((xi = xrefinfo_find(node, FIND_BY_NODE)) == NULL)<br>
> return (node);<br>
> return (xi->xref);<br>
> }<br>
> +#endif /* __rtems__ */<br>
> <br>
> if (OF_getencprop(node, "phandle", &xref, sizeof(xref)) == -1 &&<br>
> OF_getencprop(node, "ibm,phandle", &xref, sizeof(xref)) == -1 &&<br>
> @@ -659,6 +714,7 @@ OF_xref_from_node(phandle_t node)<br>
> return (xref);<br>
> }<br>
> <br>
> +#ifndef __rtems__<br>
> device_t<br>
> OF_device_from_xref(phandle_t xref)<br>
> {<br>
> @@ -845,4 +901,5 @@ OF_exit()<br>
> <br>
> for (;;) /* just in case */<br>
> ;<br>
> -}<br>
> \ No newline at end of file<br>
> +}<br>
> +#endif /* __rtems__ */<br>
> \ No newline at end of file<br>
> diff --git a/cpukit/libfreebsd/dev/ofw/openfirm.h b/cpukit/libfreebsd/dev/ofw/openfirm.h<br>
> index 74a7075367..00c0d4dd88 100644<br>
> --- a/cpukit/libfreebsd/dev/ofw/openfirm.h<br>
> +++ b/cpukit/libfreebsd/dev/ofw/openfirm.h<br>
> @@ -63,7 +63,13 @@<br>
> #define _DEV_OPENFIRM_H_<br>
> <br>
> #include <sys/types.h><br>
> +#ifndef __rtems__<br>
> #include <machine/_bus.h><br>
> +#else /* __rtems__ */<br>
> +#include <rtems.h><br>
> +#include <libfdt.h><br>
<br>
Maybe I missed it but for what do you need libfdt.h here?<br></blockquote><div><span class="gmail_default" style="font-size:small">Again, missed it while cleaning.</span> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> +#include "../../rtems-freebsd-helper.h"<br>
> +#endif /* __rtems__ */<br>
> <br>
> /*<br>
> * Prototypes for Open Firmware Interface Routines<br>
> @@ -73,7 +79,12 @@ typedef uint32_t ihandle_t;<br>
> typedef uint32_t phandle_t;<br>
> typedef uint32_t pcell_t;<br>
> <br>
> +#ifdef __rtems__<br>
> +typedef uint32_t cell_t;<br>
> +#endif /* __rtems__ */<br>
> +<br>
> #ifdef _KERNEL<br>
> +#ifndef __rtems__<br>
> #include <sys/malloc.h><br>
> <br>
> #include <machine/ofw_machdep.h><br>
> @@ -86,8 +97,10 @@ MALLOC_DECLARE(M_OFWPROP);<br>
> */<br>
> <br>
> boolean_t OF_install(char *name, int prio);<br>
> +#endif /* __rtems__*/<br>
> int OF_init(void *cookie);<br>
> <br>
> +#ifndef __rtems__<br>
> /*<br>
> * Known Open Firmware interface names<br>
> */<br>
> @@ -100,6 +113,7 @@ int OF_init(void *cookie);<br>
> /* Generic functions */<br>
> int OF_test(const char *name);<br>
> void OF_printf(const char *fmt, ...);<br>
> +#endif /* __rtems__ */<br>
> <br>
> /* Device tree functions */<br>
> phandle_t OF_peer(phandle_t node);<br>
> @@ -141,6 +155,7 @@ ssize_t OF_package_to_path(phandle_t node, char *buf, size_t len);<br>
> phandle_t OF_node_from_xref(phandle_t xref);<br>
> phandle_t OF_xref_from_node(phandle_t node);<br>
> <br>
> +#ifndef __rtems__<br>
> /*<br>
> * When properties contain references to other nodes using xref handles it is<br>
> * often necessary to use interfaces provided by the driver for the referenced<br>
> @@ -158,9 +173,11 @@ void OF_close(ihandle_t instance);<br>
> ssize_t OF_read(ihandle_t instance, void *buf, size_t len);<br>
> ssize_t OF_write(ihandle_t instance, const void *buf, size_t len);<br>
> int OF_seek(ihandle_t instance, uint64_t where);<br>
> +#endif /* __rtems__ */<br>
> <br>
> phandle_t OF_instance_to_package(ihandle_t instance);<br>
> ssize_t OF_instance_to_path(ihandle_t instance, char *buf, size_t len);<br>
> +#ifndef __rtems__<br>
> int OF_call_method(const char *method, ihandle_t instance,<br>
> int nargs, int nreturns, ...);<br>
> <br>
> @@ -183,5 +200,6 @@ int OF_interpret(const char *cmd, int nreturns, ...);<br>
> int OF_decode_addr(phandle_t dev, int regno, bus_space_tag_t *ptag,<br>
> bus_space_handle_t *phandle, bus_size_t *sz);<br>
> <br>
> +#endif /* __rtems__ */<br>
> #endif /* _KERNEL */<br>
> #endif /* _DEV_OPENFIRM_H_ */<br>
> \ No newline at end of file<br>
> <br>
</blockquote></div></div>