what's the relationship between IOAPIC,PCI and AHCI(andEHCI)

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
User avatar
lemonyii
Member
Member
Posts: 153
Joined: Thu Mar 25, 2010 11:28 pm
Location: China

what's the relationship between IOAPIC,PCI and AHCI(andEHCI)

Post by lemonyii »

after i solved the local apic problem,i'm trying to try io apic and AHCI,EHCI and so on.
but just a moment ago, i read http://forum.osdev.org/viewtopic.php?f=1&t=21745
and suddenly i got confused:what's the relationship between IOAPIC,PCI,and the xHCIs?
i have read a few about PCI bus,what i do understand is only i8259.
in a book i found that all the host controllers are on either PCI bus or MP bus,
and io apic is on MP bus,and most host controllers support PCI configuration interface.
Can someone explain the relationship between these things? mostly between PCI and IOAPIC.
or recommand some useful but short articles.
thx
Enjoy my life!------A fish with a tattooed retina
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: what's the relationship between IOAPIC,PCI and AHCI(andE

Post by Love4Boobies »

AHCI si an API for SATA controllers, EHCI is a type of USB 2.0 controller, xHCI is the same for USB 3.0, and the I/O APIC is emplyed for interrupt management in MP systems. PCI? PCI devices interrupt :)

Search the wiki for articles.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
lemonyii
Member
Member
Posts: 153
Joined: Thu Mar 25, 2010 11:28 pm
Location: China

Re: what's the relationship between IOAPIC,PCI and AHCI(andE

Post by lemonyii »

Hi
AHCI si an API for SATA controllers, EHCI is a type of USB 2.0 controller, xHCI is the same for USB 3.0, and the I/O APIC is emplyed for interrupt management in MP systems.
i know this.but my question is ,what's the relationship between them? say,does all the interrupt of host controllers pass through IOAPIC?
what's the PCI in OS developer's view?
thx
Enjoy my life!------A fish with a tattooed retina
Selenic
Member
Member
Posts: 123
Joined: Sat Jan 23, 2010 2:56 pm

Re: what's the relationship between IOAPIC,PCI and AHCI(andE

Post by Selenic »

lemonyii wrote:i know this.but my question is ,what's the relationship between them? say,does all the interrupt of host controllers pass through IOAPIC?
Basically, PCI devices produce interrupts. The IOAPIC receives the interrupt signal and, based on how it is set up, either ignores it or sends it to a destination determined by its settings. The destination processor picks up the interrupt and hands it off to your code, which has to query the device to find out what the device actually wants.
USB controllers are almost always PCI devices and simply act as bridges, passing messages and interrupts from one interface to the other.
User avatar
lemonyii
Member
Member
Posts: 153
Joined: Thu Mar 25, 2010 11:28 pm
Location: China

Re: what's the relationship between IOAPIC,PCI and AHCI(andE

Post by lemonyii »

and what role does the PCI perform in the view of programmer? just a configuration interface?
say,if i want to drive most of the device, what should i do with PCI? or just program other host controllers?
thx
Enjoy my life!------A fish with a tattooed retina
computafreak
Member
Member
Posts: 76
Joined: Sun Dec 14, 2008 1:53 pm

Re: what's the relationship between IOAPIC,PCI and AHCI(andE

Post by computafreak »

PCI is a bus. It's read by sending an integer in a specific form (which tells the PCI root bus which bus, device, function and offset to select) to port 0xCF8, and reading another integer from port 0xCFC.

Most other devices (USB, some types of HDDs, graphics cards [AGP and PCIe] and PCI cards) will hang off the PCI bus - they'll be detectable through bus enumeration. To program other host controllers properly, with as few assumptions as possible, you'll need to write a PCI driver.

In the view of a programmer, the PCI bus is a hierarchical collection of buses and devices. You can read information about a valid device (vendor id != 0xFFFF, device id != 0xFFFF) and its state, and know whether it's actually a device, or whether it's another PCI bus with other devices behind it. You can also write the information, and reconfigure it (although as far as I know, this is only used for hot-plug devices and BARS, which tell you the IO and memory ranges the device uses.)

PCI buses have a Header Type field with the value 0x1, PCI devices (including USB buses, etc) have a Header Type with the value 0x2. There's also CardBus devices, which are fairly rare in desktop computers.
Post Reply