Page 1 of 2
PCI BIOS32 SET_PCI_IRQ call fails
Posted: Tue May 23, 2023 4:35 am
by korneliuszo
I try to configure PCI IRQ on my own os.
It uses protected mode with PIC interrupt controller.
When I call PCIBIOS function 0xb10f it fails with error code 0x88 on 2 computers.
It looks like I don't configure something priror calling it.
Re: PCI BIOS32 SET_PCI_IRQ call fails
Posted: Wed May 31, 2023 11:43 am
by Octocontrabass
korneliuszo wrote:When I call PCIBIOS function 0xb10f it fails with error code 0x88 on 2 computers.
What parameters are you passing to this function?
What are the contents of the PCI IRQ routing table? (Either the table returned by function 0xB10E or the $PIR table.)
Re: PCI BIOS32 SET_PCI_IRQ call fails
Posted: Thu Jun 01, 2023 9:05 am
by nullplan
So I just had a look at SeaBIOS, and it does not support this function. I would therefore assume that it is not always supported, and that tells me it might not be implemented very well on the BIOSes you did test with.
Re: PCI BIOS32 SET_PCI_IRQ call fails
Posted: Sun Jun 04, 2023 8:30 am
by korneliuszo
I call 0xb10f function with:
https://github.com/korneliuszo/bezbios/ ... i.cpp#L147
PIR table found by $PIR table allows routing I want to make.
Re: PCI BIOS32 SET_PCI_IRQ call fails
Posted: Sun Jun 04, 2023 3:56 pm
by Octocontrabass
Okay, but what are the actual values in each register when you perform that call? And what are the actual contents of the $PIR table?
It may also help to disassemble the BIOS code and see if it expects anything unusual. The PCI spec says the way you're calling it should be fine, but maybe the code isn't as position-independent as it should be (or maybe it just plain doesn't work because everyone uses ACPI).
Re: PCI BIOS32 SET_PCI_IRQ call fails
Posted: Tue Jun 06, 2023 9:23 am
by korneliuszo
It looks relocatable, but I'm not proficient in reverse engineering.
output from pir.py on thinkpad T235
Code: Select all
Found PIR Len: 144
checksum 0
PCI Interrupt Routing 1.0 present.
Router Device: 00:01.0
Exclusive IRQs: None
Compatible Router: 1045:c700
Device: 00:00, on-board
INTA#: Link 0x00, IRQ Bitmap None
INTB#: Link 0x00, IRQ Bitmap None
INTC#: Link 0x00, IRQ Bitmap None
INTD#: Link 0x00, IRQ Bitmap None
Device: 00:01, on-board
INTA#: Link 0x00, IRQ Bitmap None
INTB#: Link 0x00, IRQ Bitmap None
INTC#: Link 0x00, IRQ Bitmap None
INTD#: Link 0x00, IRQ Bitmap None
Device: 00:02, on-board
INTA#: Link 0x02, IRQ Bitmap 3 4 5 7 9 10 11 12 14
INTB#: Link 0x12, IRQ Bitmap 3 4 5 7 9 10 11 12 14
INTC#: Link 0x00, IRQ Bitmap None
INTD#: Link 0x00, IRQ Bitmap None
Device: 00:03, on-board
INTA#: Link 0x00, IRQ Bitmap None
INTB#: Link 0x00, IRQ Bitmap None
INTC#: Link 0x00, IRQ Bitmap None
INTD#: Link 0x00, IRQ Bitmap None
Device: 00:04, on-board
INTA#: Link 0x22, IRQ Bitmap 3 4 5 7 9 10 11 12 14
INTB#: Link 0x00, IRQ Bitmap None
INTC#: Link 0x00, IRQ Bitmap None
INTD#: Link 0x00, IRQ Bitmap None
Device: 00:05, on-board
INTA#: Link 0x32, IRQ Bitmap 3 4 5 7 9 10 11 12 14
INTB#: Link 0x00, IRQ Bitmap None
INTC#: Link 0x00, IRQ Bitmap None
INTD#: Link 0x00, IRQ Bitmap None
Device: 00:14, on-board
INTA#: Link 0x22, IRQ Bitmap 3 4 5 7 9 10 11 12 14
INTB#: Link 0x00, IRQ Bitmap None
INTC#: Link 0x00, IRQ Bitmap None
INTD#: Link 0x00, IRQ Bitmap None
Re: PCI BIOS32 SET_PCI_IRQ call fails
Posted: Tue Jun 06, 2023 11:51 am
by Octocontrabass
korneliuszo wrote:thinkpad T235
You mean 235? That should be old enough for the BIOS to handle IRQ routing. Which IRQ are you trying to route? Could there be a conflict?
Re: PCI BIOS32 SET_PCI_IRQ call fails
Posted: Tue Jun 06, 2023 11:52 am
by korneliuszo
IRQ10, 00:02 link A
Re: PCI BIOS32 SET_PCI_IRQ call fails
Posted: Tue Jun 06, 2023 12:15 pm
by Octocontrabass
What happens if you pick a different IRQ?
Re: PCI BIOS32 SET_PCI_IRQ call fails
Posted: Tue Jun 06, 2023 12:17 pm
by korneliuszo
IRQ 11 same effect
Re: PCI BIOS32 SET_PCI_IRQ call fails
Posted: Tue Jun 06, 2023 12:46 pm
by Octocontrabass
Can I see the BIOS code? Maybe there's something in there to explain why it doesn't work for you.
Re: PCI BIOS32 SET_PCI_IRQ call fails
Posted: Tue Jun 06, 2023 12:50 pm
by korneliuszo
https://drive.google.com/file/d/1maeKH9 ... sp=sharing
I would post on forum but bin files are not allowed
Set offset as 0 (it sits in 0xf0000 but segments can be reallocated)
Re: PCI BIOS32 SET_PCI_IRQ call fails
Posted: Tue Jun 06, 2023 10:42 pm
by Octocontrabass
I see nothing wrong with the BIOS code. Are you sure the correct values are in every register? Add "int $3\n\t" right before the call instruction and use the interrupt handler to dump the register contents.
Re: PCI BIOS32 SET_PCI_IRQ call fails
Posted: Wed Jun 07, 2023 7:18 am
by korneliuszo
Code: Select all
b'INT3!!!'
b'EIP: 0x001090D2'
b'CS: 0x00000008'
b'EFLAGS: 0x00000006'
b'EAX: 0x0000B10F'
b'EBX: 0x00000010'
b'ECX: 0x00000A0A'
b'EDX: 0x00148100'
b'ESI: 0x00148108'
b'EDI: 0x001479CB'
b'EBP: 0x00147980'
b'DS: 0x00000010'
b'ES: 0x00000010'
b'FS: 0x00000010'
b'GS: 0x00000010'
b'PCI 0x000FD86C'
b'PCI 0x0000880F'
it looks correct
Re: PCI BIOS32 SET_PCI_IRQ call fails
Posted: Wed Jun 07, 2023 7:43 pm
by Octocontrabass
Set an execute breakpoint at offset 0xD7B1 in the BIOS code. Do you hit the breakpoint when you call the BIOS? If so, what is the value of CX at that point?
Are there any unconfigured PCI-to-PCI bridges? (An unconfigured bridge will have class 6, subclass 4, and zero at either offset 0x19 or offset 0x1A in the configuration space.)