Interrupts from PCI devices

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Bietje
Member
Member
Posts: 100
Joined: Wed Apr 20, 2011 6:57 am

Interrupts from PCI devices

Post by Bietje »

Hi,

I have written a MSI setup, but I do not know how to test it. My test PC supports MSI for an ethernet controller (class code: 0x2 - subclass code 0x0). How can I let this PCI device trigger an interrupt using my MSI setup? I have no TCP stack or something.. If you need additional information/code; just ask for it!

Thanks in advance & greets,
Bietje
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Interrupts from PCI devices

Post by Combuster »

You can't quite make an ethernet card raise interrupts without having it do meaningful stuff first. Write an implementation of ARP for starters, and see if you can get a request and reply using a sniffer. Depending on the hardware card you may get an interrupt when the send buffer is empty or when a packet has arrived. When you actually have something that can reliably trigger an interrupt, you have a proper tool to implement MSI.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Bietje
Member
Member
Posts: 100
Joined: Wed Apr 20, 2011 6:57 am

Re: Interrupts from PCI devices

Post by Bietje »

Hi,

That sounds as a good idea. Now I come with a second question.. I downloaded the specification of my NIC, so I know how I can send and receive ARP requests and sent replies. The specification says the following:
Realtek RTL8111B & RTL8168B Specification wrote:The RTL8111B/RTL8168B provide the following set of operational registers mapped into PCI memory
space and I/O space.
I guess that the base of the config space is defined in one of the PCI BAR's, but I couldn't find in which one I should look. So my question is, where can I find which BAR I should read?

Greets,
Bietje
Post Reply