# Linux Kernel Module Cheat

##### 23.6.1.4. Introduction to PCI

The PCI standard is non-free, obviously like everything in low level: https://pcisig.com/specifications but Google gives several illegal PDF hits :-)

And of course, the best documentation available is: http://wiki.osdev.org/PCI

Like every other hardware, we could interact with PCI on x86 using only IO instructions and memory operations.

But PCI is a complex communication protocol that the Linux kernel implements beautifully for us, so let’s use the kernel API.

Bibliography:

- edu device source and spec in QEMU tree:

  - https://github.com/qemu/qemu/blob/v2.7.0/hw/misc/edu.c

  - https://github.com/qemu/qemu/blob/v2.7.0/docs/specs/edu.txt

- http://www.zarb.org/~trem/kernel/pci/pci-driver.c inb outb runnable example (no device)

- LDD3 PCI chapter

- another QEMU device + module, but using a custom QEMU device:

  - https://github.com/levex/kernel-qemu-pci/blob/31fc9355161b87cea8946b49857447ddd34c7aa6/module/levpci.c

  - https://github.com/levex/kernel-qemu-pci/blob/31fc9355161b87cea8946b49857447ddd34c7aa6/qemu/hw/char/lev-pci.c

- https://is.muni.cz/el/1433/podzim2016/PB173/um/65218991/ course given by the creator of the edu device. In Czech, and only describes API

- http://nairobi-embedded.org/linux_pci_device_driver.html