Two questions on Flattened Device Tree, newbus and device driver attaching
Thomas Skibo
ThomasSkibo at sbcglobal.net
Mon Aug 4 16:16:22 UTC 2014
On 8/3/14, 12:41 PM, Matías Perret Cantoni wrote:
> Hello everyone!
> I'm working with FreeBSD on the Zedboard (ported by Thomas Skibo
> <http://www.thomasskibo.com/zedbsd/>). Currently I'm trying to fully
> understand how the Flattened Device Tree (FDT) mechanism works and how it
> integrates with FreeBSD. What I've already understand (I think) is:
>
> (1) how to represent devices, memory mapping/ranges, interrupts, etc...
> in a Device Tree Source (DTS) file,
> (2) how the newbus framework works, and
> (3) how the kernel manages resources, devices and drivers.
>
> Although I've read all the documents I could find (and some source code)
> there are still two things I don't understand:
>
> *1) The DTS source file and CPUs definition:*
>
> The DTS file for the zedboard, /release/10.0.0/sys/boot/fdt/dts/zedboard.dts
> (here
> <https://svnweb.freebsd.org/base/release/10.0.0/sys/boot/fdt/dts/zedboard.dts?revision=260789&view=markup>),
> has the CPU definition all commented out:
>
> ...
> // cpus {
> // #address-cells = <1>;
> // #size-cells = <0>;
> // cpu at 0 {
> // device-type = "cpu";
> // model = "ARM Cortex-A9";
> // };
> // };
> ...
>
> This sounds really strange to me! How can the system tell the CPU it's
> running on? I'v found some other DTS files for other boards that *do
> define* it's
> CPUs. For example:
>
[snip]
>
> *So my first question is: How can the system tell on wich CPU it running
> on? can I add the CPUs definition in my DTS file?*
To be honest, I don't remember why I commented that out. I'm pretty
sure it's ignored but it might be useful to have that info in the .dtb
file anyway.
The system identifies the CPU by the CPU ID register. See
sys/arm/arm/identcpu.c and sys/arm/include/armreg.h.
--Thomas
--
--------
Thomas Skibo
ThomasSkibo at sbcglobal.net
More information about the freebsd-arm
mailing list