From fdde3ff8285fb031264fda2cd605acc4b624e05f Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Sat, 24 Jun 2017 12:49:13 +0100 Subject: [PATCH] More PCI info --- kernel_module/pci.c | 21 +++++++++++++++++++++ rootfs_overlay/pci.sh | 1 - 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/kernel_module/pci.c b/kernel_module/pci.c index 246037f..724ff98 100644 --- a/kernel_module/pci.c +++ b/kernel_module/pci.c @@ -6,6 +6,8 @@ Usage: The standard is non-free, obviously: https://pcisig.com/specifications but Google gives several illegal PDF hits :-) +And of course: http://wiki.osdev.org/PCI + Like every other hardware, we could interact with PCI on x86 using only IO instructions and memory operations. @@ -31,6 +33,25 @@ DMA: - https://stackoverflow.com/questions/32592734/are-there-any-dma-driver-example-pcie-and-fpga/44716747#44716747 - https://stackoverflow.com/questions/17913679/how-to-instantiate-and-use-a-dma-driver-linux-module + +lspci -k shows something like: + + 00:04.0 Class 00ff: 1234:11e8 lkmc_pci + +Meaning of the first numbers: + + <8:bus>:<5:device>.<3:function> + +Often abbreviated to BDF. + +- bus: groups PCI slots +- device: maps to one slot +- function: https://stackoverflow.com/questions/19223394/what-is-the-function-number-in-pci/44735372#44735372 + +Class: pure magic: https://www-s.acm.illinois.edu/sigops/2007/roll_your_own/7.c.1.html +TODO: does it have any side effects? Set in the edu device at: + + k->class_id = PCI_CLASS_OTHERS */ #include /* put_user */ diff --git a/rootfs_overlay/pci.sh b/rootfs_overlay/pci.sh index d56d6d1..e0333a8 100755 --- a/rootfs_overlay/pci.sh +++ b/rootfs_overlay/pci.sh @@ -54,4 +54,3 @@ rmmod pci # Interrupt counts after we generate our interrupts. # Compare with before. cat /proc/interrupts -