values from pci_dev or read from config space - pci
Hi everybody! I was thinking about post this question in the linux-pci list, but I'm not sure if this question is very basic for it, so maybe it's better aks here. If not, I'll ask there. My question is about that I'm writing a driver for a old realtek network card, only for learning purposes, and I was conviced that I could read the values from the config space( values related to IRQ, I/O memory regions), examples: pci_read_config_byte(dev, IRQ_OFFSET, &irq); rtiomemr_start = pci_resource_start(dev, IO_MEM); rtiomemr_len = pci_resource_len(dev, IO_MEM); rtiomemr_end = pci_resource_end(dev, IO_MEM); But then I read in the Documentation/pci.text that the correct way to achieve this values are reading the valzes stored in the pci_dev structure. Actually, with the values from I/O memory regions I didn't have any problem, but I got a different values for IRQ. If I get the IRQ from the pci_dev, I get a X, but if I get the IRQ from the config space, I get another different number Y. Would be you so kind to explain: 1- Why it's better use the values stored in pci_dev structure instead of read from config space. 2- Why the IRQ number is different? (Maybe this question is answered with the first question hehe) Thank you very much Best regards
On Tue, 26 Aug 2014 08:33:18 +0200, Oscar Salvador said:
If I get the IRQ from the pci_dev, I get a X, but if I get the IRQ from the config space, I get another different number Y.
Would be you so kind to explain:
1- Why it's better use the values stored in pci_dev structure instead of read from config space. 2- Why the IRQ number is different? (Maybe this question is answered with the first question hehe)
The Linux kernel keeps track of both physical and logical IRQ numbers. So physical IRQ 0 is often wired to a timer on x86 systems, but logical IRQ 0 is used for NO_IRQ in dev->irq type usages. Screw it, I'll let Linus explain from a decade ago: http://yarchive.net/comp/linux/no_irq.html
Thanks ;)! I didn't find it. Kind regards 2014-08-26 15:39 GMT+02:00 <Valdis.Kletnieks@vt.edu>:
On Tue, 26 Aug 2014 08:33:18 +0200, Oscar Salvador said:
If I get the IRQ from the pci_dev, I get a X, but if I get the IRQ from the config space, I get another different number Y.
Would be you so kind to explain:
1- Why it's better use the values stored in pci_dev structure instead of read from config space. 2- Why the IRQ number is different? (Maybe this question is answered with the first question hehe)
The Linux kernel keeps track of both physical and logical IRQ numbers. So physical IRQ 0 is often wired to a timer on x86 systems, but logical IRQ 0 is used for NO_IRQ in dev->irq type usages.
Screw it, I'll let Linus explain from a decade ago:
participants (2)
-
Oscar Salvador -
Valdis.Kletnieks@vt.edu