Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 04 Aug 2014 09:13:21 -0700
From:      Thomas Skibo <ThomasSkibo@sbcglobal.net>
To:        freebsd-arm@freebsd.org, =?UTF-8?B?TWF0w61hcyBQZXJyZXQgQ2FudG9uaQ==?= <perretcantonim@gmail.com>
Subject:   Re: Two questions on Flattened Device Tree, newbus and device driver attaching
Message-ID:  <53DFB121.40909@sbcglobal.net>
In-Reply-To: <CADLKG03f2KAEeTGCZTh=_ABufDfiWo6pSXW407aCcByon2BinA@mail.gmail.com>
References:  <CADLKG03f2KAEeTGCZTh=_ABufDfiWo6pSXW407aCcByon2BinA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help


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@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@sbcglobal.net




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53DFB121.40909>