From owner-freebsd-arm@freebsd.org Mon Dec 26 03:15:43 2016 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CE7AC908CF for ; Mon, 26 Dec 2016 03:15:43 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4890F858 for ; Mon, 26 Dec 2016 03:15:43 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from [136.179.10.143] (helo=[10.140.230.85]) by id.bluezbox.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87 (FreeBSD)) (envelope-from ) id 1cLL4G-000Jk4-RM; Sun, 25 Dec 2016 18:31:17 -0800 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Re: Finally bringing FreeBSD to Parallella From: Oleksandr Tymoshenko In-Reply-To: <7E7AC5B2-02A5-462B-B111-F0C7DCF59DF4@student.tuwien.ac.at> Date: Sun, 25 Dec 2016 18:30:45 -0800 Cc: freebsd-arm@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <7E7AC5B2-02A5-462B-B111-F0C7DCF59DF4@student.tuwien.ac.at> To: =?utf-8?Q?Daniel_H=C3=BCbleitner?= X-Mailer: Apple Mail (2.3259) Sender: gonzo@id.bluezbox.com X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: > On Dec 25, 2016, at 5:05 PM, Daniel Hübleitner 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. [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: tuwien.ac.at] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 03:15:43 -0000 > On Dec 25, 2016, at 5:05 PM, Daniel H=C3=BCbleitner = wrote: >=20 > Merry Christmas everyone, >=20 > 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. >=20 > So what I=C2=B4m 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.=20 >=20 > 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=E2=80=99t 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.=20 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.=20 % svn diff arm/xilinx/zy7_gpio.c Index: arm/xilinx/zy7_gpio.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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[] =3D { + {"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 =3D=3D = 0) return (ENXIO); device_set_desc(dev, "Zynq-7000 GPIO driver");