Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Linux kernel TLV meetup, 21.09.2015
Kfir Gollan
 What is hardware probing?
 Different approaches for detecting hardware
 Probing in the linux kernel
 Have you ever wondered how does the OS know what
hardware components are available on a given
machine?
 Basically, some...
 Hardcode the details of the hardware into the kernel
 Static configuration
 Device trees
 Dynamic configuration
 ACP...
Formal definition:
“The Device Tree is a data structure for describing
hardware.
Rather than hard coding every detail of a...
 Device tree source (DTS)
 Device tree bindings
 Device tree blob (DTB)
 Flattened Device Tree (FDT)
 Device tree com...
{
compatible = "nvidia,harmony", "nvidia,tegra20";
#address-cells = <1>;
#size-cells = <1>;
interrupt-parent = <&intc>;
me...
{
….
sound {
compatible = "nvidia,harmony-sound";
i2s-controller = <&i2s1>;
i2s-codec = <&wm8903>;
};
};
chosen {
bootargs = "console=ttyS0,115200 loglevel=8";
initrd-start = <0xc8000000>;
initrd-end = <0xc8200000>;
};
 Xillybus Device tree tutorial
 Device trees for Dummies!
 Documentation/devicetree/
 usage-model.txt
 booting-withou...
 Advanced configuration and power interface
 Originally created by Intel, Toshiba & Microsoft
 Currently maintained by ...
The fact that it takes more code to parse and interpret
ACPI than it does to route traffic on the internet
backbones shoul...
 Divided to three major components
 ACPI registers
 ACPI BIOS
 ACPI tables
 AML – ACPI Machine Language
 Requires a ...
 Motherboard devices are described in an hierarchical
format called the ACPI namespace.
 ACPI definition blocks
 Differ...
Device (BT)
{
Name (_HID, "TOS6205")
Method (_STA, 0, NotSerialized)
{
If (BTEN)
{
Return (0x00)
}
Else
{
Return (0x0F)
}
...
Device (BT)
{
…
Method (DUSB, 0, NotSerialized)
{
Store (0x00, _SB.PCI0.LPC0.EC0.BTDT)
}
…
}
 ACPI Component Architecture
 (OS)-independent reference implementation of the
Advanced Configuration and Power Interfac...
 A collection of modules that implement the core logic
of ACPI.
 AML interpreter
 Execution of the AML bytecode
 ACPI ...
 Intermediate layer between the ACPI core and the rest
of the system
 Translate syscall to a matching ACPI method
 Stan...
 Platform devices
 Platform devices are devices that typically appear as
autonomous entities in the system.
 No bus ini...
 PCI devices
 Drivers are registered to the PCI subsystem of the
kernel.
 When a device is detected the matching driver...
Hardware Probing in the Linux Kernel
Hardware Probing in the Linux Kernel
Hardware Probing in the Linux Kernel
Hardware Probing in the Linux Kernel
Upcoming SlideShare
Loading in …5
×

Hardware Probing in the Linux Kernel

Agenda:
Have you ever wondered how the kernel knows what hardware your computer has installed? Have you heard about DMI but not sure how is it different than DTB?
In this talk I will introduce you to this the hardware probing process and discuss different methods for probing and the pros and cons of each.

Speaker:
Kfir Gollan, senior embedded developer, Linux kernel hacker and software team leader.

  • Be the first to comment

Hardware Probing in the Linux Kernel

  1. 1. Linux kernel TLV meetup, 21.09.2015 Kfir Gollan
  2. 2.  What is hardware probing?  Different approaches for detecting hardware  Probing in the linux kernel
  3. 3.  Have you ever wondered how does the OS know what hardware components are available on a given machine?  Basically, someone needs to tell the OS what is available.  The process of detecting all the hardware components and pairing them up with the matching drivers in the OS is called hardware probing, or just probing for short.
  4. 4.  Hardcode the details of the hardware into the kernel  Static configuration  Device trees  Dynamic configuration  ACPI  Bus based detection  PCI
  5. 5. Formal definition: “The Device Tree is a data structure for describing hardware. Rather than hard coding every detail of a device into an operating system, many aspect of the hardware can be described in a data structure that is passed to the operating system at boot time.” devicetree.org
  6. 6.  Device tree source (DTS)  Device tree bindings  Device tree blob (DTB)  Flattened Device Tree (FDT)  Device tree compiler (DTC)
  7. 7. { compatible = "nvidia,harmony", "nvidia,tegra20"; #address-cells = <1>; #size-cells = <1>; interrupt-parent = <&intc>; memory { device_type = "memory"; reg = <0x00000000 0x40000000>; }; ... };
  8. 8. { …. sound { compatible = "nvidia,harmony-sound"; i2s-controller = <&i2s1>; i2s-codec = <&wm8903>; }; };
  9. 9. chosen { bootargs = "console=ttyS0,115200 loglevel=8"; initrd-start = <0xc8000000>; initrd-end = <0xc8200000>; };
  10. 10.  Xillybus Device tree tutorial  Device trees for Dummies!  Documentation/devicetree/  usage-model.txt  booting-without-of.txt
  11. 11.  Advanced configuration and power interface  Originally created by Intel, Toshiba & Microsoft  Currently maintained by the UEFI forum  Current last revision of the spec was released at May 2015 (Revision 6.0)  Replaces APM (Advanced Power Management)  Allows the kernel/user to control power features without going into BIOS configuration  It’s complex! (Revision 6.0 is 1056 pages long)
  12. 12. The fact that it takes more code to parse and interpret ACPI than it does to route traffic on the internet backbones should be a hint something is badly wrong either in ACPI the spec, ACPI the implementation or both. Alan Cox ACPI is a complete design disaster in every way Linus Torvalds Basically, it is just complex.
  13. 13.  Divided to three major components  ACPI registers  ACPI BIOS  ACPI tables  AML – ACPI Machine Language  Requires a full-fledged interpreter to be implemented in the kernel.
  14. 14.  Motherboard devices are described in an hierarchical format called the ACPI namespace.  ACPI definition blocks  Differentiated System Description Table (DSDT)  Secondary System Description Table (SSDT)  The operating system is simply required to iterate over the ACPI namespace and load the proper drivers for each device that is listed there.
  15. 15. Device (BT) { Name (_HID, "TOS6205") Method (_STA, 0, NotSerialized) { If (BTEN) { Return (0x00) } Else { Return (0x0F) } } ... }
  16. 16. Device (BT) { … Method (DUSB, 0, NotSerialized) { Store (0x00, _SB.PCI0.LPC0.EC0.BTDT) } … }
  17. 17.  ACPI Component Architecture  (OS)-independent reference implementation of the Advanced Configuration and Power Interface Specification (ACPI).  www.acpica.org  Divided into a few major components  OS services layer  ACPI core subsystem  device drivers
  18. 18.  A collection of modules that implement the core logic of ACPI.  AML interpreter  Execution of the AML bytecode  ACPI table management  Validation, parsing, installation and removal  Resource management  Dependencies between resources  IRQ routing tables  Namespace management  Providing simple access to the full ACPI device hierarchy  Many others
  19. 19.  Intermediate layer between the ACPI core and the rest of the system  Translate syscall to a matching ACPI method  Standard set of interfaces that perform OS dependenet functions  Memory allocation  Hardware access  Threading and synchronization  Needs to be implemented by each operating system that wishes to use ACPICA.
  20. 20.  Platform devices  Platform devices are devices that typically appear as autonomous entities in the system.  No bus initialization and management required  Directly probe the hardware – implementing .probe function struct platform_driver { int (*probe)(struct platform_device *); int (*remove)(struct platform_device *); ... };
  21. 21.  PCI devices  Drivers are registered to the PCI subsystem of the kernel.  When a device is detected the matching drivers probe function is invoked. struct pci_driver { ... int (*probe) (struct pci_dev *dev, ..); void (*remove) (struct pci_dev *dev); ... };

×