OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:14 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Tue May 23, 2023 4:35 am 
Offline

Joined: Tue May 23, 2023 4:29 am
Posts: 10
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.


Top
 Profile  
 
 Post subject: Re: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Wed May 31, 2023 11:43 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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.)


Top
 Profile  
 
 Post subject: Re: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Thu Jun 01, 2023 9:05 am 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1593
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.

_________________
Carpe diem!


Top
 Profile  
 
 Post subject: Re: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Sun Jun 04, 2023 8:30 am 
Offline

Joined: Tue May 23, 2023 4:29 am
Posts: 10
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.


Top
 Profile  
 
 Post subject: Re: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Sun Jun 04, 2023 3:56 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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).


Top
 Profile  
 
 Post subject: Re: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Tue Jun 06, 2023 9:23 am 
Offline

Joined: Tue May 23, 2023 4:29 am
Posts: 10
It looks relocatable, but I'm not proficient in reverse engineering.

output from pir.py on thinkpad T235
Code:
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



Top
 Profile  
 
 Post subject: Re: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Tue Jun 06, 2023 11:51 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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?


Top
 Profile  
 
 Post subject: Re: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Tue Jun 06, 2023 11:52 am 
Offline

Joined: Tue May 23, 2023 4:29 am
Posts: 10
IRQ10, 00:02 link A


Top
 Profile  
 
 Post subject: Re: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Tue Jun 06, 2023 12:15 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
What happens if you pick a different IRQ?


Top
 Profile  
 
 Post subject: Re: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Tue Jun 06, 2023 12:17 pm 
Offline

Joined: Tue May 23, 2023 4:29 am
Posts: 10
IRQ 11 same effect


Top
 Profile  
 
 Post subject: Re: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Tue Jun 06, 2023 12:46 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
Can I see the BIOS code? Maybe there's something in there to explain why it doesn't work for you.


Top
 Profile  
 
 Post subject: Re: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Tue Jun 06, 2023 12:50 pm 
Offline

Joined: Tue May 23, 2023 4:29 am
Posts: 10
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)


Top
 Profile  
 
 Post subject: Re: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Tue Jun 06, 2023 10:42 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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.


Top
 Profile  
 
 Post subject: Re: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Wed Jun 07, 2023 7:18 am 
Offline

Joined: Tue May 23, 2023 4:29 am
Posts: 10
Code:
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


Top
 Profile  
 
 Post subject: Re: PCI BIOS32 SET_PCI_IRQ call fails
PostPosted: Wed Jun 07, 2023 7:43 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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.)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot], thewrongchristian and 71 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group