PCI Devices - Is This Right?

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
Lprogster
Member
Member
Posts: 174
Joined: Tue Nov 14, 2006 11:59 am

PCI Devices - Is This Right?

Post by Lprogster »

...
Last edited by Lprogster on Tue Oct 23, 2007 11:01 am, edited 2 times in total.
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:

Post by Combuster »

Does that correctly identify the vendor, device and version of a PCI device?
Two notes:

Code: Select all

 version = pci_read_short ( bus , slot , 0 , 8 ) >> 8; 
this reads in the Class code and subclass, then discards the former. You probably want to read a short 0xA which is the Revision ID.

Also, your code does not support multifunction devices, Several motherboard resources are commonly collected on one 'slot' with different functions. A cheap way to detect those is by checking wether there are different device/vendor IDs in different functions.
Oh, an something I've been wondering: does VESA support hardware cursors? I haven't found anything on it so far...
AFAIK, that's hardware-dependent business. As a matter of fact I'm trying to get that to work on my ATI card but its accellerator CRTC declared war on me :(
"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 ]
exkor
Member
Member
Posts: 111
Joined: Wed May 23, 2007 9:38 pm

Post by exkor »

I would go with this link as example http://www.osdev.org/osfaq2/index.php/W ... n%20PCI%3F
Lprogster
Member
Member
Posts: 174
Joined: Tue Nov 14, 2006 11:59 am

Post by Lprogster »

AFAIK, that's hardware-dependent business. As a matter of fact I'm trying to get that to work on my ATI card but its accellerator CRTC declared war on me...
Okay, good luck with that - though I'm sure you'll manage!
this reads in the Class code and subclass, then discards the former. You probably want to read a short 0xA which is the Revision ID.
...

Thank you both,
Lster
Last edited by Lprogster on Tue Oct 23, 2007 11:02 am, edited 1 time in total.
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:

Post by Combuster »

Wouldn't the class code and subclass be at 0xA and the revision ID 0x8? As the right-side of the table is 0 and the left 31...
Ack ](*,)% X_X _&&](*,)!"#O.o$#$&](*,) My wrong.
"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 ]
Lprogster
Member
Member
Posts: 174
Joined: Tue Nov 14, 2006 11:59 am

Post by Lprogster »

Wow! God made a mistake! :) ;)
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:

Post by Combuster »

If I was God, it was obviously part of the big plan 8)
"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 ]
Post Reply