OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 8:06 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: PCI Bridge acpi apic routing
PostPosted: Mon Aug 27, 2018 8:23 am 
Offline
Member
Member

Joined: Sun Jun 05, 2005 11:00 pm
Posts: 233
Hi all,

Let me try to explain.

for now I can read acpi apic routing table " method _PRT ". but my biggest question is.

for all devices in BUS 00 I lookup at the table... its fine! ok!

when I have devices under the bridge? like my ethernet card: BUS 2, DEVICE 0, FUNCTION 0.

I cannot understand what can I do. that information is not in the acpi apic routing table.

can anyone help me please?


Top
 Profile  
 
 Post subject: Re: PCI Bridge acpi apic routing
PostPosted: Tue Aug 28, 2018 6:07 pm 
Offline
Member
Member

Joined: Sun Jun 05, 2005 11:00 pm
Posts: 233
problem solved, Just scan PCI BUS looking for PCIBridge for that BUS example " 2 ", then look at the acpi apic routing and find what irq is assign for Device and int pin for that bridge device and funcion.

But I have some problem. how can I execute a _PRT method in acpi ? and how can I inform acpi that I want to use apic, insted of PIC 8259?

I read so many pdf from acpica, etc. I cannot understand. I have a virtualbox and I'm testing my os changing chipset from ICH9 to PIIX3.
using ICH9 and enable IOAPIC, everything works, but when I change to PIIX3 with IOAPIC, all irqs from PCI is in mode PIC 8259. I cannot find how to get what irq table is using...


tnx all.


Top
 Profile  
 
 Post subject: Re: PCI Bridge acpi apic routing
PostPosted: Wed Aug 29, 2018 4:18 am 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

digo_rp wrote:
and how can I inform acpi that I want to use apic, insted of PIC 8259?


The firmware's AML has a global "_PIC" method that you're supposed to execute to tell it you want to use IO APICs.

digo_rp wrote:
But I have some problem. how can I execute a _PRT method in acpi ?


To execute AML (ACPI Machine Language) you need an interpreter (e.g. something that fetches the next machine code instruction, figures out what it is, then emulates the instruction; and keeps doing that in a loop).

Of course this interpreter will need to allow the AML to access various things (IO ports, PCI configuration space, ...) and there's no sane/easy way to tell if the AML was maliciously tampered with before the OS was booted, so now you've got "potentially malicious AML" accessing various things (IO ports, PCI configuration space, ...). ;)


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: PCI Bridge acpi apic routing
PostPosted: Wed Aug 29, 2018 4:50 am 
Offline
Member
Member

Joined: Sun Jun 05, 2005 11:00 pm
Posts: 233
tnx a lot Brendan.

but do you know the best way to discover if acpi is using apic or picm without an interpreter?

Because using virtualbox with PIIX3 chipset with IOAPIC, just work PIC 8259 ISA Interrupt routed to PCI. and when I change to ICH9, then I can use APIC Interrupts.

example: my network card is at legacy IRQ 9 PIN 1 <- INTA, with PIIX3 with IOAPIC, with apic enable, all pci are routed to PIC 8259 ISA IRQ.


Top
 Profile  
 
 Post subject: Re: PCI Bridge acpi apic routing
PostPosted: Wed Aug 29, 2018 5:50 am 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

digo_rp wrote:
but do you know the best way to discover if acpi is using apic or picm without an interpreter?


This is a bit backwards - typically you don't discover what ACPI is using; the OS decides what it wants to use (e.g. using FADT to determine if PIC chips exist, using MADT to determine of IO APICs exist) and then tells ACPI what it wants to use. If the OS doesn't tell ACPI that it wants to use IO APICs; then (if PIC chips exist) ACPI assumes the OS will be using PIC chips and won't be using IO APICs at all.

It's also not going to help much - you will need "something" to determine (and possibly reconfigure) IRQ routing, and to switch to different sleep states, and to control fan speeds, and to handle various events (to wake the OS up, to inform it a device was inserted, ...) and for many other things. Trying to figure out "PIC or IO APIC" without an AML interpreter today just postpones the problem until tomorrow when you want to do everything else without an AML interpreter.

There's are only 4 actual solutions that I know of:
  • Use an AML interpreter (e.g. port ACPICA)
  • Spend ages researching and implementing an "AML to native" compiler so that you can convert the AML to native and execute it without an interpreter. Note: This doesn't make much sense because AML isn't performance critical, the native compiler won't be portable, and AML is only part of the problem anyway.
  • Write a motherboard driver for every motherboard (most likely based on any motherboard/chipset datasheet you can get your hands on combined with a disassembly of the motherboard's AML)
  • Don't use ACPI at all (and rely on backward compatibility), which means no power management, no IO APIC, no hot-plug PCI, ...

digo_rp wrote:
Because using virtualbox with PIIX3 chipset with IOAPIC, just work PIC 8259 ISA Interrupt routed to PCI. and when I change to ICH9, then I can use APIC Interrupts.

example: my network card is at legacy IRQ 9 PIN 1 <- INTA, with PIIX3 with IOAPIC, with apic enable, all pci are routed to PIC 8259 ISA IRQ.


The worse type of bug a programmer can have is "works by accident" because there's no symptoms to tell the programmer that their code is completely wrong.

If VirtualBox uses "IO APIC input number = legacy PIC input number" then that's just a trap to lead unsuspecting victims towards "works by accident" bugs.


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: PCI Bridge acpi apic routing
PostPosted: Wed Aug 29, 2018 6:10 am 
Offline
Member
Member

Joined: Sun Jun 05, 2005 11:00 pm
Posts: 233
thx so much.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], SemrushBot [Bot] and 64 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