Page 1 of 1

RTL8139, how to calculate IRQ id from IRQ-PIN & IRQ LINE

Posted: Sun Jun 12, 2016 4:21 am
by miaowei
Hi.
I don't know how to get the IRQ number allocated to rtl8139 during bios POST.
I read it's PCI configuration room, and got irq pin = 32, irq line = 1.
But how to caulcate the real IRQ number ?

I regarded irq-line as IRQ number(namely, 1) and wrote my driver, however, i can not receive any interrupt after booting. (i test on real machine. my net cable is well connected to internet. I set all bits in Interrupt Mask Register, and other necessary operation with Command Register , etc. I also transmit a package in the test code)

And, when i pressed keyboard, an interrupt occur (i know it from message on screen). That's not surprising, keyboard occupies IRQ 1 too.

i don't want to check my driver code in the first, because i doubt my nic doesn't use IRQ 1 at all.

BTW: this RTL8139 chip is not onboard, it's a second network card i bought on market and plug in the PCI slot. The motherboard has a onboard intel network card already.

who can help me?

Re: RTL8139, how to calculate IRQ id from IRQ-PIN & IRQ LINE

Posted: Sun Jun 12, 2016 6:20 am
by Combuster
It's madness, but considering it's the first hit on my first google query you might've spend a bit more time on searching next time :wink:

Re: RTL8139, how to calculate IRQ id from IRQ-PIN & IRQ LINE

Posted: Sun Jun 12, 2016 8:56 pm
by miaowei
Combuster wrote:It's madness, but considering it's the first hit on my first google query you might've spend a bit more time on searching next time :wink:
I am sorry, it's not that i didn't google ------ i didn't know what key word to search.

i didn't realize there is things new introduced by PCI. i thought it's as simple as devices on ISA bus.

the IRQ routing seems a little complex, i just take a quick glance at it, it seems that, although routing table and processing is complex, we don't need touch it. BIOS put the finall result in PCI-LINE register in configuration room.

BTW, i got interrupt, after two bugs fixed:
1, i read pci-line and pci-pin register using a wrong ADDRESS OFFSET to pci configuration room base. so i got a wrong irq-line.

2, i forgot to clear bit 2 of IMR in 8259A, thus the second 8259 chip disabled.