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

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
miaowei
Member
Member
Posts: 84
Joined: Wed Dec 18, 2013 9:10 am

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

Post 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?
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: RTL8139, how to calculate IRQ id from IRQ-PIN & IRQ LINE

Post 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:
"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 ]
miaowei
Member
Member
Posts: 84
Joined: Wed Dec 18, 2013 9:10 am

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

Post 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.
Post Reply