Creating A devicetree.cb: Difference between revisions
Eocallaghan (talk | contribs) (Initial.) Â |
Eocallaghan (talk | contribs) Â |
||
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
This article should help people who are writting a devicetree.cb for their system. | This article should help people who are writting a '''devicetree.cb''' for their system. | ||
== What you will need == | == What you will need == | ||
While running GNU/Linux on the vendor BIOS, collect the output from: | |||
 | |||
* '''dmesg''' | |||
* '''lspci -ntvvv''' | |||
* '''cat /proc/ioports''' | |||
 | |||
If you have support for your board in '''serialice''' you may wish to gather its output also. | |||
 | |||
== Reading '''lspci''' output == | |||
 | |||
The Peripheral Component Interconnect ('''PCI''') is a standerdized local bus for attaching different hardwares to motherboard. | |||
 | |||
The '''lspci''' command reads the bus information and topology, its output format is given by example: | |||
 | |||
03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader (rev 01) | |||
+------ +----------------------Â +-------------------------------------------------------------- | |||
^Â Â Â ^Â Â Â Â Â Â Â Â Â Â Â Â ^ | |||
|Â Â Â |Â Â Â Â Â Â Â Â Â Â Â Â | | |||
|Â Â Â |Â Â Â Â Â Â Â Â Â Â Â Â Field 3: Name of device attached and its manufactured company name. | |||
|Â Â Â Field 2: PCI slot name. | |||
Field 1: PCI bus slot number. | |||
== Introduction == | == Introduction == | ||
Line 12: | Line 32: | ||
When a device in '''devicetree.cb''' is found during the coreboot PCI/system scan process the functions to do customized initialization are called via the '''device_operations''' and the '''chip_operations''' structures. You will find these structures in the devices source files. | When a device in '''devicetree.cb''' is found during the coreboot PCI/system scan process the functions to do customized initialization are called via the '''device_operations''' and the '''chip_operations''' structures. You will find these structures in the devices source files. | ||
== Keywords & Symbols == | |||
<source lang="ada"> | |||
chip, device, register,on,off,pci,ioapic,pnp,i2c,lapic,cpu_cluster,domain,irq,drq,io,ioapic_irq,inherit,subsystemid,end,= | |||
</source> | |||
== Syntax == | |||
* ioapic_irq | |||
<source lang="ada"> | |||
ioapic_irq: ioapic_irq number-literal pciint number-literal | |||
</source> | |||
rewrite this in BNF notation.. | |||
== Grammar == | |||
=== Literals === | |||
Literal values types are defined and thus consumed by the following regular expressions: | |||
* Hex | |||
<source lang="reg"> | |||
0x[0-9a-fA-F.]+ | |||
[0-9a-fA-F.]+ | |||
</source> | |||
* Decimals | |||
<source lang="reg"> | |||
[0-9.]+ | |||
</source> | |||
* PCI Interrupts | |||
<source lang="reg"> | |||
INT[A-D] | |||
</source> | |||
* Strings | |||
<source lang="reg"> | |||
\"[^\"]+\" | |||
[^ \n\t]+ | |||
</source> | |||
== NOTES == | |||
See source util/sconfig/sconfig.* for devicetree compiler.. | |||
== Examples == | |||
=== NorthBridge === | |||
.. | |||
=== Super I/O === | |||
»Â   chip superio/fintek/f71869ad | |||
»Â   »Â   device pnp 4e.00 off # Floppy | |||
»Â   »Â   »Â   io 0x60 = 0x3f0 | |||
»Â   »Â   »Â   irq 0x70 = 6 | |||
»Â   »Â   »Â   drq 0x74 = 2 | |||
»Â   »Â   end | |||
»Â   »Â   device pnp 4e.01 on # COM1 | |||
»Â   »Â   »Â   io 0x60 = 0x3f8 | |||
»Â   »Â   »Â   irq 0x70 = 4 | |||
»Â   »Â   end | |||
»Â   »Â   »Â   device pnp 4e.02 off # COM2 | |||
»Â   »Â   »Â   io 0x60 = 0x2f8 | |||
»Â   »Â   »Â   irq 0x70 = 3 | |||
»Â   »Â   end | |||
»Â   »Â   device pnp 4e.03 off # Parallel Port | |||
»Â   »Â   »Â   io 0x60 = 0x378 | |||
»Â   »Â   »Â   irq 0x70 = 7 | |||
»Â   »Â   »Â   drq 0x74 = 3 | |||
»Â   »Â   end | |||
»Â   »Â   device pnp 4e.04 on # Hardware Monitor | |||
»Â   »Â   »Â   io 0x60 = 0x295 | |||
»Â   »Â   »Â   irq 0x70 = 0 | |||
»Â   »Â   end | |||
»Â   »Â   device pnp 4e.05 on # KBC | |||
»Â   »Â   »Â   io 0x60 = 0x060 | |||
»Â   »Â   »Â   irq 0x70 = 1 # Keyboard IRQ | |||
»Â   »Â   »Â   irq 0x72 = 12 # Mouse IRQ | |||
»Â   »Â   end | |||
»Â   »Â   device pnp 4e.06 off end # GPIO | |||
»Â   »Â   device pnp 4e.07 on end # BSEL | |||
»Â   »Â   device pnp 4e.0a off end # PME | |||
»Â   end # f71869ad | |||
{{Cc-by-2.5}} |
Latest revision as of 13:51, 2 March 2014
This article should help people who are writting a devicetree.cb for their system.
What you will need
While running GNU/Linux on the vendor BIOS, collect the output from:
- dmesg
- lspci -ntvvv
- cat /proc/ioports
If you have support for your board in serialice you may wish to gather its output also.
Reading lspci output
The Peripheral Component Interconnect (PCI) is a standerdized local bus for attaching different hardwares to motherboard.
The lspci command reads the bus information and topology, its output format is given by example:
03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader (rev 01) +------ +---------------------- +-------------------------------------------------------------- ^ ^ ^ | | | | | Field 3: Name of device attached and its manufactured company name. | Field 2: PCI slot name. Field 1: PCI bus slot number.
Introduction
The mainboard's devicetree.cb file contains many build and platform configuration settings. One of the most important items is the mainboard device list.
A device needs to be listed in the mainboard devicetree.cb if it requires more setup than standard PCI initialization (resource allocation). Typically, that includes the CPU, northbridge, southbridge, and Super I/O. These devices are usually required for system specific configuration as well as indicate the system bus structure (pci_domain).
When a device in devicetree.cb is found during the coreboot PCI/system scan process the functions to do customized initialization are called via the device_operations and the chip_operations structures. You will find these structures in the devices source files.
Keywords & Symbols
<source lang="ada"> chip, device, register,on,off,pci,ioapic,pnp,i2c,lapic,cpu_cluster,domain,irq,drq,io,ioapic_irq,inherit,subsystemid,end,= </source>
Syntax
- ioapic_irq
<source lang="ada"> ioapic_irq: ioapic_irq number-literal pciint number-literal </source>
rewrite this in BNF notation..
Grammar
Literals
Literal values types are defined and thus consumed by the following regular expressions:
- Hex
<source lang="reg"> 0x[0-9a-fA-F.]+
[0-9a-fA-F.]+ </source>
- Decimals
<source lang="reg"> [0-9.]+ </source>
- PCI Interrupts
<source lang="reg"> INT[A-D] </source>
- Strings
<source lang="reg"> \"[^\"]+\"
[^ \n\t]+ </source>
NOTES
See source util/sconfig/sconfig.* for devicetree compiler..
Examples
NorthBridge
..
Super I/O
» chip superio/fintek/f71869ad » » device pnp 4e.00 off # Floppy » » » io 0x60 = 0x3f0 » » » irq 0x70 = 6 » » » drq 0x74 = 2 » » end » » device pnp 4e.01 on # COM1 » » » io 0x60 = 0x3f8 » » » irq 0x70 = 4 » » end » » » device pnp 4e.02 off # COM2 » » » io 0x60 = 0x2f8 » » » irq 0x70 = 3 » » end » » device pnp 4e.03 off # Parallel Port » » » io 0x60 = 0x378 » » » irq 0x70 = 7 » » » drq 0x74 = 3 » » end » » device pnp 4e.04 on # Hardware Monitor » » » io 0x60 = 0x295 » » » irq 0x70 = 0 » » end » » device pnp 4e.05 on # KBC » » » io 0x60 = 0x060 » » » irq 0x70 = 1 # Keyboard IRQ » » » irq 0x72 = 12 # Mouse IRQ » » end » » device pnp 4e.06 off end # GPIO » » device pnp 4e.07 on end # BSEL » » device pnp 4e.0a off end # PME » end # f71869ad
This file is licensed under Creative Commons Attribution 2.5 License. In short: you are free to distribute and modify the file as long as you attribute its author(s) or licensor(s). |