[coreboot] Re: Idiots guide to devicetree.cb

2020-11-25 Thread Jonathan Neuschäfer
On Wed, Nov 25, 2020 at 06:57:07AM -0800, mtur...@codeaurora.org wrote:
> On 2020-11-24 03:05, Andy Pont wrote:
> > Hello,
> > 
> > Is there an idiots guide to the definitions in devicetree.cb?  Trying
> > to make sense of the USB and PCIe configuration stuff.
> 
> I don't know if these qualify as part of an idiots guide, but I found these
> links especially useful when learning devicetree (all from elinux.org):
> 
> Device Tree Reference: https://elinux.org/Device_Tree_Reference
> Device Tree Usage: https://elinux.org/Device_Tree_Usage
> Device Tree Mysteries: https://elinux.org/Device_Tree_Mysteries

No, these are unfortunately not suitable, because they are about the
OpenFirmware-derived Devicetree format. The devicetree.cb format used in
coreboot is different, albeit serving a similar purpose (hardware
description and configuration).


One important detail about the devicetree.cb format is that a "chip"
statement specifies a file path to a chip.h file that defines a struct
(e.g. "chip soc/intel/skylake" -> src/soc/intel/skylake/chip.h),
and a "register" statement sets a member of that struct to a particular
value (as far as I understand it).


Jonathan Neuschäfer


signature.asc
Description: PGP signature
___
coreboot mailing list -- coreboot@coreboot.org
To unsubscribe send an email to coreboot-le...@coreboot.org


[coreboot] Re: Idiots guide to devicetree.cb

2020-11-25 Thread Andy Pont

Patrick wrote...

I'd love to see somebody pick up the bits of information they gather on 
the device tree and write a doc on that in Documentation/ (which gets 
rendered to doc.coreboot.org). Andy, willing to take that on? :-)
I’m happy to give it a try but it will have to wait until I’ve finished 
doing battle with this machine and got it all working!


GPIO pin definitions and an Embedded Controller are the current 
headache!  I seem to keep finding new ways to make it stop at 
POST_FSP_SILICON_INIT!


-Andy.
___
coreboot mailing list -- coreboot@coreboot.org
To unsubscribe send an email to coreboot-le...@coreboot.org


[coreboot] Re: Idiots guide to devicetree.cb

2020-11-25 Thread Patrick Georgi via coreboot
Am Mi., 25. Nov. 2020 um 15:57 Uhr schrieb :

> On 2020-11-24 03:05, Andy Pont wrote:
> > Is there an idiots guide to the definitions in devicetree.cb?  Trying
> > to make sense of the USB and PCIe configuration stuff.
>
https://doc.coreboot.org/acpi/devicetree.html describes some aspects but
it's relatively specific about listing devices for the purpose of having
them appear in ACPI, so that's just a subset.
https://doc.coreboot.org/acpi/devicetree.html#diving-into-the-above-example
is probably the most interesting part in terms of generic information.
https://link.springer.com/chapter/10.1007/978-1-4842-0070-4_4 also has some
bits on the devicetree (page 28+).

Roughly speaking:
- The device tree is mostly modeled after PCI (because that's where it was
first used), although it was extended over time to be able to describe
other topologies.
- "device" entries enumerate addressable devices at a certain point in the
physical hardware tree
- "chip" entries describe the drivers that are used for the sub-tree they
cover
- "register" entries fill in values into the struct referred to by the
next-outer "chip"
- io, irq point to device registers.

The naming of the keywords doesn't make all too much sense, since it
remained unchanged (except for compatible additions) since ~2003 when that
structure was devised, while both hardware and our use of the device tree
evolved.

I'd love to see somebody pick up the bits of information they gather on the
device tree and write a doc on that in Documentation/ (which gets rendered
to doc.coreboot.org). Andy, willing to take that on? :-)


> Device Tree Reference: https://elinux.org/Device_Tree_Reference
> Device Tree Usage: https://elinux.org/Device_Tree_Usage
> Device Tree Mysteries: https://elinux.org/Device_Tree_Mysteries

Those are u-boot/Linux-style device trees, loosely based on the
OpenFirmware device tree.
devicetree.cb is something else, coming from LinuxBIOS v2
LinuxBIOS v3 used Linux-style device trees but it didn't stick (as in:
people didn't port that back to v2, which later became v4), so our device
tree is still based on the old LBv2 thing.


Patrick
-- 
Google Germany GmbH, ABC-Str. 19, 20354 Hamburg
Registergericht und -nummer: Hamburg, HRB 86891, Sitz der Gesellschaft:
Hamburg
Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
___
coreboot mailing list -- coreboot@coreboot.org
To unsubscribe send an email to coreboot-le...@coreboot.org


[coreboot] Re: Idiots guide to devicetree.cb

2020-11-25 Thread mturney

On 2020-11-24 03:05, Andy Pont wrote:

Hello,

Is there an idiots guide to the definitions in devicetree.cb?  Trying
to make sense of the USB and PCIe configuration stuff.


I don't know if these qualify as part of an idiots guide, but I found 
these links especially useful when learning devicetree (all from 
elinux.org):


Device Tree Reference: https://elinux.org/Device_Tree_Reference
Device Tree Usage: https://elinux.org/Device_Tree_Usage
Device Tree Mysteries: https://elinux.org/Device_Tree_Mysteries

Cheers,
T.mike



-Andy.

___
coreboot mailing list -- coreboot@coreboot.org
To unsubscribe send an email to coreboot-le...@coreboot.org

___
coreboot mailing list -- coreboot@coreboot.org
To unsubscribe send an email to coreboot-le...@coreboot.org