GSoC 2020: Implementation of OFW functions

Niteesh G. S. niteesh.gs at gmail.com
Tue May 5 17:10:05 UTC 2020


This is thread is about implementing OFW functions in RTEMS as part
of my GSoC project. I would like to start off with this part since the
refactoring
work will somewhat depend on this.

Implementing these functions into RTEMS will make porting drivers from
FreeBSD to RTEMS easy. Currently, the drivers ported from freebsd implement
the functions using libfdt variants but this causes a lot of code
duplication.
eg: bsps/arm/imx/start/imx_iomux.c

My initial thoughts were to implement these functions one by one. But then
Christian and Vijay mentioned about porting them from libbsd. I went
through the OFW code in libbsd and have described my porting process below.
Please have a look at it and let me know if I have missed something or you
would like to improve things.

The following files will be ported from libbsd
prefix = freebsd/sys/dev/ofw
<prefix>/openfirm.c
<prefix>/openfirm.h
<prefix>/ofw_fdt.c
<prefix>/ofwvar.h

The main idea is to port openfirm.h but the other files are dependencies of
openfirm.h

After going through some open firmware documentation. I guess as far as
RTEMS is
concerned we could avoid many functions like OF_init, OF_putchar, OF_test
and only care about functions defined under openfirm.h:105-142

But these functions have dependency on the automatically generated ofw_if.h
and KOBJS.
But after a close inspection, I guess the KOBJSLOOKUP macro in ofw_if.h can
be
redefined or replaced for RTEMS. Since all it does is call the respective
functions defined in ofw_fdt_methods(ofw_fdt.c).

I had just spent a few hours going through the code. If I had missed
something
please let me know.

Thanks,
Niteesh.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200505/a8e3eb93/attachment.html>


More information about the devel mailing list