Finally bringing FreeBSD to Parallella

Oleksandr Tymoshenko gonzo at bluezbox.com
Mon Dec 26 03:15:43 UTC 2016


> On Dec 25, 2016, at 5:05 PM, Daniel Hübleitner <daniel.huebleitner at student.tuwien.ac.at> wrote:
> 
> Merry Christmas everyone,
> 
> I am trying to port FreeBSD on the parallella board. So far I just wrote a kernel config where I included the zedboard config. I can build the world no problem. Where I ran into trouble is trying to statically compile the DTB. I have to say I dont really understand how the OS knows the driver it should use from the DTS. Furthermore there is a DTS under GPL from Xilinx itself in ../../../gnu/dts/arm/zynq-parallella.dts. How can it be that the Vendor DTS is so much different from the BSD DTS in sys/boot/fdt/dts. Shouldnt be there just one correct DTS for each board? And could it work if I just use the Vendor DTS? It looks to me that everybody just writes the DTS the way they want and due to a miracle it somehow works.
> 
> So what I´m trying to say is, would someone be interested in helping me bringing FreeBSD to the parallella micro-server. Its the first time I try to port BSD and I am doing it as part of a university project where I want to benchmark FreeBSD against Linux. 
> 
> I attached the kernel config I have so far. There are some links to the hardware in the config header.

Hi Daniel

Some boards have FreeBSD-specific DTS for historical reasons (one
of them - people were not sure that using GNU dts was OK). So
most of the platforms with early FDT support ended up with non-standard
DTS files. Since then some of them were converted to using
upstream dtbs: TI platforms and Raspberry Pi's for one. Zynq
is probably the last one that hasn’t been converted yet. I went
through zynq-7000.dtsi and it seems that the conversion should be
fairly simple: most of the nodes require only new "compatible"
strings in the existing drivers. Something like patch below.
We can not replace the strings, we have to maintain backward
compatibility. 

There might be more work though. Base addresses for register may
be different, some other properties' names might mismatch. But
it should be fairly easy to do. Let me know if you're going to
work on this conversion. Otherwise I'll try to do it myself some
time next week. 

% svn diff arm/xilinx/zy7_gpio.c
Index: arm/xilinx/zy7_gpio.c
===================================================================
--- arm/xilinx/zy7_gpio.c       (revision 310551)
+++ arm/xilinx/zy7_gpio.c       (working copy)
@@ -114,6 +114,12 @@
 #define ZY7_GPIO_INT_POLARITY(b)       (0x0220+0x40*(b)) /* int polarity */
 #define ZY7_GPIO_INT_ANY(b)            (0x0224+0x40*(b)) /* any edge */

+static struct ofw_compat_data compat_data[] = {
+       {"xlnx,zy7_gpio",               1},
+       {"xlnx,zynq-gpio-1.0",          1},
+       {NULL,                          0}
+};
+
 static device_t
 zy7_gpio_get_bus(device_t dev)
 {
@@ -289,7 +295,7 @@
        if (!ofw_bus_status_okay(dev))
                return (ENXIO);

-       if (!ofw_bus_is_compatible(dev, "xlnx,zy7_gpio"))
+       if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
                return (ENXIO);

        device_set_desc(dev, "Zynq-7000 GPIO driver");



More information about the freebsd-arm mailing list